rivet-3.2.6/0000775000175000017510000000000014711627350012154 5ustar manghimanghirivet-3.2.6/cmake/0000775000175000017510000000000014711540756013240 5ustar manghimanghirivet-3.2.6/cmake/cmake_extra_modules/0000775000175000017510000000000014711540756017253 5ustar manghimanghirivet-3.2.6/cmake/cmake_extra_modules/FindAPACHE.cmake0000664000175000017510000000336014711540756022001 0ustar manghimanghi# # APACHE_FOUND - System has APACHE # APACHE_INCLUDE_DIR - The APACHE include directory # # APACHE_LOCATION # setting this enables search for apache libraries / headers in this location # # Include directories # find_path(APACHE_INCLUDE_DIR NAMES httpd.h PATH_SUFFIXES httpd apache apache2 HINTS ${APACHE_INCLUDE_DIR_HINTS} ${APACHE_ROOT}/include) # Tryto find apxs, in order to get more information... find_program(APACHE_APXS_BIN NAMES apxs apxs2 apxs.exe apxs2.exe PATH_SUFFIXES httpd apache apache2 HINTS ${APACHE_ROOT}/bin) if(NOT DEFINED APACHE_MODULE_DIR) if(APACHE_APXS_BIN) EXEC_PROGRAM(${APACHE_APXS_BIN} ARGS -q LIBEXECDIR OUTPUT_VARIABLE APACHE_MODULE_DIR) else(APACHE_APXS_BIN) find_path(APACHE_MODULE_DIR NAMES mod_alias.so mod_auth_basic.so HINTS ${APACHE_MODULE_DIR_HINTS} ${APACHE_ROOT}/modules) endif(APACHE_APXS_BIN) endif(NOT DEFINED APACHE_MODULE_DIR) if(NOT DEFINED APACHE_LIB_DIR) message(STATUS "not found") if(APACHE_APXS_BIN) EXEC_PROGRAM(${APACHE_APXS_BIN} ARGS -q LIBDIR OUTPUT_VARIABLE APACHE_LIB_DIR ) else(APACHE_APXS_BIN) ## Use the bin dir, inside Apache server... find_path(APACHE_LIB_DIR NAMES httpd httpd.exe HINTS ${APACHE_LIB_DIR_HINTS} ${APACHE_ROOT}/bin) endif(APACHE_APXS_BIN) endif(NOT DEFINED APACHE_LIB_DIR) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set APACHE_FOUND to TRUE if # all listed variables are TRUE find_package_handle_standard_args(APACHE DEFAULT_MSG APACHE_INCLUDE_DIR ) mark_as_advanced(APACHE_INCLUDE_DIR) mark_as_advanced(APACHE_MODULE_DIR) mark_as_advanced(APACHE_LIB_DIR) rivet-3.2.6/cmake/cmake_extra_modules/FindAPR.cmake0000664000175000017510000000671614711540756021512 0ustar manghimanghi# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # - Find Apache Portable Runtime # Find the APR includes and libraries # This module defines # APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc. # APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR. # APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR. # also defined, but not for general use are # APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library. # APR first. FIND_PATH(APR_INCLUDE_DIR apr.h /usr/local/include/apr-1 /usr/local/include/apr-1.0 /usr/include/apr-1 /usr/include/apr-1.0 ${APR_INCLUDE_DIR_HINTS} ${APACHE_INCLUDE_DIR_HINTS} ${APACHE_ROOT}/include ) SET(APR_NAMES ${APR_NAMES} libapr-1 apr-1) FIND_LIBRARY(APR_LIBRARY NAMES ${APR_NAMES} PATHS /usr/lib /usr/local/lib ${APR_LIBRARY_HINTS} ${APACHE_ROOT}/lib ) IF (APR_LIBRARY AND APR_INCLUDE_DIR) SET(APR_LIBRARIES ${APR_LIBRARY}) SET(APR_FOUND "YES") ELSE (APR_LIBRARY AND APR_INCLUDE_DIR) SET(APR_FOUND "NO") ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR) IF (APR_FOUND) IF (NOT APR_FIND_QUIETLY) MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}") ENDIF (NOT APR_FIND_QUIETLY) ELSE (APR_FOUND) IF (APR_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find APR library") ENDIF (APR_FIND_REQUIRED) ENDIF (APR_FOUND) # Deprecated declarations. SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} ) GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH) MARK_AS_ADVANCED( APR_LIBRARY APR_INCLUDE_DIR ) # Next, APRUTIL. FIND_PATH(APRUTIL_INCLUDE_DIR apu.h /usr/local/include/apr-1 /usr/local/include/apr-1.0 /usr/include/apr-1 /usr/include/apr-1.0 ${APRUTIL_INCLUDE_DIR_HINTS} ${APACHE_INCLUDE_DIR_HINTS} ${APACHE_ROOT}/include ) SET(APRUTIL_NAMES ${APRUTIL_NAMES} libaprutil-1 aprutil-1 ) FIND_LIBRARY(APRUTIL_LIBRARY NAMES ${APRUTIL_NAMES} PATHS /usr/lib /usr/local/lib ${APRUTIL_LIBRARY_HINTS} ${APR_LIBRARY} ${APACHE_ROOT}/lib ${APR_LIBRARY_HINTS} ) IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY}) SET(APRUTIL_FOUND "YES") ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) SET(APRUTIL_FOUND "NO") ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) IF (APRUTIL_FOUND) IF (NOT APRUTIL_FIND_QUIETLY) MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}") ENDIF (NOT APRUTIL_FIND_QUIETLY) ELSE (APRUTIL_FOUND) IF (APRUTIL_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find APRUTIL library") ENDIF (APRUTIL_FIND_REQUIRED) ENDIF (APRUTIL_FOUND) # Deprecated declarations. SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} ) GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH) MARK_AS_ADVANCED( APRUTIL_LIBRARY APRUTIL_INCLUDE_DIR ) rivet-3.2.6/cmake/cmake_extra_modules/checks.cmake0000664000175000017510000001352214711540756021520 0ustar manghimanghi# Check headers include(CheckIncludeFile) include(CheckIncludeFiles) check_include_files(dlfcn.h HAVE_DLFCN_H) check_include_files(inttypes.h HAVE_INTTYPES_H) check_include_files(limits.h HAVE_LIMITS_H) check_include_files(memory.h HAVE_MEMORY_H) check_include_files(net/errno.h HAVE_NET_ERRNO_H) check_include_files(stdint.h HAVE_STDINT_H) check_include_files(stdlib.h HAVE_STDLIB_H) check_include_files(strings.h HAVE_STRINGS_H) check_include_files(string.h HAVE_STRING_H) check_include_files(sys/param.h HAVE_SYS_PARAM_H) check_include_files(sys/stat.h HAVE_SYS_STAT_H ) check_include_files(sys/types.h HAVE_SYS_TYPES_H ) check_include_files(unistd.h HAVE_UNISTD_H ) check_include_files(dirent.h HAVE_DIRENT_H) check_include_files(limits.h HAVE_LIMITS_H) check_include_files(alloca.h HAVE_ALLOCA_H ) check_include_files(stdint.h HAVE_STDINT_H ) check_include_files(sys/mman.h HAVE_SYS_MMAN_H) check_include_files(errno.h HAVE_ERRNO_H) check_include_files(float.h HAVE_FLOAT_H) check_include_files(sys/wait.h HAVE_SYS_WAIT_H) check_include_files(values.h HAVE_VALUES_H) check_include_files(stdarg.h HAVE_STDARG_H) # Check functions include(CheckFunctionExists) check_function_exists(fseek64 HAVE_FSEEK64) check_function_exists(open64 HAVE_OPEN64) check_function_exists(memcpy HAVE_MEMCPY) check_function_exists(mmap HAVE_MMAP) check_function_exists(lseek64 HAVE_LSEEK64) set(CMAKE_EXTRA_INCLUDE_FILES math.h) if(NOT WIN32) set(CMAKE_REQUIRED_LIBRARIES m) endif() check_function_exists(round HAVE_ROUND) set(CMAKE_EXTRA_INCLUDE_FILES) set(CMAKE_REQUIRED_LIBRARIES) # Check types include ( CheckTypeSize ) check_type_size ( "long double" HAVE_LONG_DOUBLE ) check_type_size ( "double" SIZEOF_DOUBLE ) check_type_size ( "long double" SIZEOF_LONG_DOUBLE ) check_type_size ( "void*" SIZEOF_VOID_P ) # set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h) # check_type_size("struct stat64" _LARGEFILE64_SOURCE) # set(CMAKE_EXTRA_INCLUDE_FILES) # Check symbols include(CheckSymbolExists) # Custom checks... include (CheckCSourceCompiles) check_c_source_compiles("#include int main () { off64_t offset; return 0;}" HAVE_TYPE_OFF64_T) check_c_source_compiles("#include int main () { struct stat64 p; return 0;}" HAVE_STRUCT_STAT64) check_c_source_compiles("#include #include int main () { struct dirent64 p; return 0;}" HAVE_STRUCT_DIRENT64) check_c_source_compiles("#include int main () {struct stat64 buf; int i = stat64(\"/\", &buf); return 0;}" NO_LARGEFILE64_SOURCE) if(NOT NO_LARGEFILE64_SOURCE) check_c_source_compiles("#define _LARGEFILE64_SOURCE 1 #include int main () {struct stat64 buf; int i = stat64(\"/\", &buf); return 0;}" _LARGEFILE64_SOURCE) endif(NOT NO_LARGEFILE64_SOURCE) check_c_source_compiles("#include int main () {char *p = (char *)strtoll; char *q = (char *)strtoull; return 0;}" NO_ISOC99_SOURCE) if(NOT NO_ISOC99_SOURCE) check_c_source_compiles("#define _ISOC99_SOURCE 1 #include int main () {char *p = (char *)strtoll; char *q = (char *)strtoull; return 0;}" _ISOC99_SOURCE) endif(NOT NO_ISOC99_SOURCE) check_c_source_compiles("#include int main () {char *p = (char *)open64; return 0;}" NO_LARGEFILE_SOURCE64) if(NOT NO_LARGEFILE_SOURCE64) check_c_source_compiles("#define _LARGEFILE_SOURCE64 1 #include int main () {char *p = (char *)open64; return 0;}" _LARGEFILE_SOURCE64) endif(NOT NO_LARGEFILE_SOURCE64) # See if the compiler knows natively about __int64 set(tcl_cv_type_64bit "none") check_c_source_compiles("int main () {__int64 value = (__int64) 0; return 0;}" HAS___int64) if(HAS___int64) set(tcl_type_64bit "__int64") else(HAS___int64) set(tcl_type_64bit "long long") endif(HAS___int64) check_c_source_compiles("int main () {switch (0) {case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ; }; return 0;}" HAS_WIDE_INT_NE_LONG) if(HAS_WIDE_INT_NE_LONG) set(tcl_cv_type_64bit ${tcl_type_64bit}) endif(HAS_WIDE_INT_NE_LONG) if(${tcl_cv_type_64bit} STREQUAL "none") set(TCL_WIDE_INT_IS_LONG 1) elseif((${tcl_cv_type_64bit} STREQUAL "__int64") AND WIN32) else(${tcl_cv_type_64bit} STREQUAL "none") set(TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}) endif(${tcl_cv_type_64bit} STREQUAL "none") # Check for ANSI C header files... # ========================================================================== message(STATUS "Cheking for ANSI C header files...") if(HAVE_STDLIB_H AND HAVE_STDARG_H AND HAVE_STRING_H AND HAVE_FLOAT_H) set(ac_cv_header_stdc ON) endif(HAVE_STDLIB_H AND HAVE_STDARG_H AND HAVE_STRING_H AND HAVE_FLOAT_H) if(ac_cv_header_stdc) # SunOS 4.x string.h does not declare mem*, contrary to ANSI. SET(CMAKE_EXTRA_INCLUDE_FILES string.h) check_function_exists(memchr ac_cv_header_stdc) SET(CMAKE_EXTRA_INCLUDE_FILES) endif(ac_cv_header_stdc) if(ac_cv_header_stdc) # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. SET(CMAKE_EXTRA_INCLUDE_FILES stdlib.h) check_function_exists(free ac_cv_header_stdc) SET(CMAKE_EXTRA_INCLUDE_FILES) endif(ac_cv_header_stdc) if(ac_cv_header_stdc) set(STDC_HEADERS 1) endif(ac_cv_header_stdc) if(NOT HAVE_DIRENT_H) set(NO_DIRENT_H 1) endif() if(NOT HAVE_DLFCN_H) set(NO_DLFCN_H 1) endif() if(NOT HAVE_ERRNO_H) set(NO_ERRNO_H 1) endif() if(NOT HAVE_FLOAT_H) set(NO_FLOAT_H 1) endif() if(NOT HAVE_LIMITS_H) set(NO_LIMITS_H 1) endif() if(NOT HAVE_SYS_WAIT_H) set(NO_SYS_WAIT_H 1) endif() if(NOT HAVE_VALUES_H) set(NO_VALUES_H 1) endif() if(NOT HAVE_STDLIB_H) set(NO_STDLIB_H 1) endif() if(NOT HAVE_STRING_H) set(NO_STRING_H 1) endif() if(NOT HAVE_ROUND) set(NO_HAVE_ROUND 1) endif() if(BUILD_STATIC_LIBS) set(STATIC_BUILD 1) endif(BUILD_STATIC_LIBS) rivet-3.2.6/cmake/cmake_extra_modules/config.h.cmake0000664000175000017510000001675614711540756021767 0ustar manghimanghi/* * config.h.cmake - CMake generator template for config.h * Each field bracketed by @'s is corresponds to a variable * that is either set/not set by the CMakeLists.txt config * script. */ /* Define if building universal (internal helper macro) */ #cmakedefine AC_APPLE_UNIVERSAL_BUILD @AC_APPLE_UNIVERSAL_BUILD@ /* configure command string */ #cmakedefine CONFIGURE_CMD "@CONFIGURE_CMD@" /* Display Rivet version in Apache signature */ #cmakedefine DISPLAY_VERSION @DISPLAY_VERSION@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@ /* Define to 1 if you have the `lseek64' function. */ #cmakedefine HAVE_LSEEK64 @HAVE_LSEEK64@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NET_ERRNO_H @HAVE_NET_ERRNO_H@ /* Define to 1 if you have the `open64' function. */ #cmakedefine HAVE_OPEN64 @HAVE_OPEN64@ /* Define to 1 if you have the `round' function. */ #ifndef HAVE_ROUND #cmakedefine HAVE_ROUND @HAVE_ROUND@ #endif #ifndef NO_HAVE_ROUND #cmakedefine NO_HAVE_ROUND @NO_HAVE_ROUND@ #endif /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRING_H @HAVE_STRING_H@ /* Is 'struct dirent64' in ? */ /* #undef HAVE_STRUCT_DIRENT64 */ /* Is 'struct stat64' in ? */ /* #undef HAVE_STRUCT_STAT64 */ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_PARAM_H @HAVE_SYS_PARAM_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ /* Is off64_t in ? */ /* #undef HAVE_TYPE_OFF64_T */ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@ /* Honor HEAD requests */ #cmakedefine01 HEAD_REQUESTS /* Rivet Tcl package version */ #cmakedefine INIT_VERSION "@INIT_VERSION@" /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #cmakedefine LT_OBJDIR "@LT_OBJDIR@" #ifndef RIVET_LT_OBJDIR #define RIVET_LT_OBJDIR ".libs/" #endif /* Max size of data in POST operations */ #define MAX_POST @MAX_POST@ /* No Compiler support for module scope symbols */ #ifndef RIVET_MODULE_SCOPE #define RIVET_MODULE_SCOPE extern __attribute__((__visibility__("hidden"))) #endif /* yes, MPM worker single thread */ #cmakedefine MPM_SINGLE_TCL_THREAD @MPM_SINGLE_TCL_THREAD@ /* The path to a working tclsh executable */ #ifndef RIVET_NAMEOFEXECUTABLE #define NAMEOFEXECUTABLE "@NAMEOFEXECUTABLE@" #endif /* commands will not be exported */ #cmakedefine01 NAMESPACE_EXPORT /* good, no automatic import will be done */ #cmakedefine01 NAMESPACE_IMPORT /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@ #cmakedefine NO_DIRENT_H @NO_DIRENT_H@ /* Do we have ? */ #cmakedefine NO_DLFCN_H @NO_DLFCN_H@ /* Do we have ? */ #cmakedefine NO_ERRNO_H @NO_ERRNO_H@ /* Do we have ? */ #cmakedefine NO_FLOAT_H @NO_FLOAT_H@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@ #cmakedefine NO_LIMITS_H @NO_LIMITS_H@ /* Do we have ? */ #cmakedefine NO_STDLIB_H @NO_STDLIB_H@ /* Do we have ? */ #cmakedefine NO_STRING_H @NO_STRING_H@ /* Do we have ? */ #cmakedefine NO_SYS_WAIT_H @NO_SYS_WAIT_H@ /* Do we have ? */ #cmakedefine NO_VALUES_H @NO_VALUES_H@ /* No description provided for NO_VIZ... */ #cmakedefine NO_VIZ /* Name of package */ #define PACKAGE "rivet" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "@PROJECT_NAME@" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "@PROJECT_NAME@ @RIVET_VERSION@" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "rivet" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ #define PACKAGE_VERSION "@RIVET_VERSION@" /* The path to the rivet tcl library */ #ifndef RIVETLIB_DESTDIR #define RIVETLIB_DESTDIR "@RIVETLIB_DESTDIR@" #endif /* mod_rivet core */ #ifndef RIVET_CORE #define RIVET_CORE "@RIVET_CORE@" #endif /* Separate Channels for virtual hosts */ #cmakedefine01 SEPARATE_CHANNELS /* one interpreter per child */ #cmakedefine01 SEPARATE_VIRTUAL_INTERPS /* requests will be serialized */ #cmakedefine SERIALIZE_HTTP_REQUESTS @SERIALIZE_HTTP_REQUESTS@ /* Is this a static build? */ #cmakedefine STATIC_BUILD @STATIC_BUILD@ /* Define to 1 if you have the ANSI C header files. */ #cmakedefine STDC_HEADERS @STDC_HEADERS@ /* Is memory debugging enabled? */ #cmakedefine TCL_MEM_DEBUG @TCL_MEM_DEBUG@ /* Are we building with threads enabled? */ #cmakedefine TCL_THREADS @TCL_THREADS@ /* Are wide integers to be implemented with C 'long's? */ #cmakedefine TCL_WIDE_INT_IS_LONG @TCL_WIDE_INT_IS_LONG@ /* What type should be used to define wide integers? */ #cmakedefine TCL_WIDE_INT_TYPE @TCL_WIDE_INT_TYPE@ /* UNDER_CE version */ #cmakedefine UNDER_CE @UNDER_CE@ /* Path to the disk directory where uploads are saved */ #define UPLOAD_DIR "@UPLOAD_DIR@" /* uploads go to files */ #cmakedefine01 UPLOAD_FILES_TO_VAR /* Do we want to use the threaded memory allocator? */ #cmakedefine USE_THREAD_ALLOC @USE_THREAD_ALLOC@ /* Version number of package */ #define VERSION "@RIVET_VERSION@" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Add the _ISOC99_SOURCE flag when building */ #cmakedefine _ISOC99_SOURCE @_ISOC99_SOURCE@ /* Add the _LARGEFILE64_SOURCE flag when building */ #cmakedefine _LARGEFILE64_SOURCE @_LARGEFILE64_SOURCE@ /* Add the _LARGEFILE_SOURCE64 flag when building */ #cmakedefine _LARGEFILE_SOURCE64 @_LARGEFILE_SOURCE64@ /* # needed in sys/socket.h Should OS/390 do the right thing with sockets? */ #cmakedefine _OE_SOCKETS @_OE_SOCKETS@ /* Do we really want to follow the standard? Yes we do! */ #cmakedefine _POSIX_PTHREAD_SEMANTICS @_POSIX_PTHREAD_SEMANTICS@ /* Do we want the reentrant OS API? */ #cmakedefine _REENTRANT @_REENTRANT@ /* Do we want the thread-safe OS API? */ #cmakedefine _THREAD_SAFE @_THREAD_SAFE@ /* _WIN32_WCE version */ #cmakedefine _WIN32_WCE @_WIN32_WCE@ /* Do we want to use the XOPEN network library? */ #cmakedefine _XOPEN_SOURCE_EXTENDED @_XOPEN_SOURCE_EXTENDED@ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #define inline #endif /* * vim: syntax=c */ rivet-3.2.6/cmake/cmake_extra_modules/rivet_config.h.cmake0000664000175000017510000002502414711540756023164 0ustar manghimanghi#ifndef _RIVET_CONFIG_H #define _RIVET_CONFIG_H 1 /* * rivet_config.h. CMake generator template for rivet_config.h * Each field bracketed by @'s is corresponds to a variable * that is either set/not set by the CMakeLists.txt config * script. */ /* Define if building universal (internal helper macro) */ #ifndef RIVET_AC_APPLE_UNIVERSAL_BUILD #cmakedefine RIVET_AC_APPLE_UNIVERSAL_BUILD @AC_APPLE_UNIVERSAL_BUILD@ #endif /* configure command string */ #ifndef RIVET_CONFIGURE_CMD #cmakedefine RIVET_CONFIGURE_CMD "@CONFIGURE_CMD@" #endif /* Display Rivet version in Apache signature */ #ifndef RIVET_DISPLAY_VERSION #cmakedefine01 RIVET_DISPLAY_VERSION #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_DLFCN_H #cmakedefine RIVET_HAVE_DLFCN_H @HAVE_DLFCN_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_INTTYPES_H #cmakedefine RIVET_HAVE_INTTYPES_H @HAVE_INTTYPES_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_LIMITS_H #cmakedefine RIVET_HAVE_LIMITS_H @HAVE_LIMITS_H@ #endif /* Define to 1 if you have the `lseek64' function. */ #ifndef RIVET_HAVE_LSEEK64 #cmakedefine RIVET_HAVE_LSEEK64 @HAVE_LSEEK64@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_MEMORY_H #cmakedefine RIVET_HAVE_MEMORY_H @HAVE_MEMORY_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_NET_ERRNO_H #cmakedefine RIVET_HAVE_NET_ERRNO_H @HAVE_NET_ERRNO_H@ #endif /* Define to 1 if you have the `open64' function. */ #ifndef RIVET_HAVE_OPEN64 #cmakedefine RIVET_HAVE_OPEN64 @HAVE_OPEN64@ #endif /* Define to 1 if you have the `round' function. */ #ifndef RIVET_HAVE_ROUND #cmakedefine RIVET_HAVE_ROUND @HAVE_ROUND@ #endif #ifndef RIVET_NO_HAVE_ROUND #cmakedefine RIVET_NO_HAVE_ROUND @NO_HAVE_ROUND@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_STDINT_H #cmakedefine RIVET_HAVE_STDINT_H @HAVE_STDINT_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_STDLIB_H #cmakedefine RIVET_HAVE_STDLIB_H @HAVE_STDLIB_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_STRINGS_H #cmakedefine RIVET_HAVE_STRINGS_H @HAVE_STRINGS_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_STRING_H #cmakedefine RIVET_HAVE_STRING_H @HAVE_STRING_H@ #endif /* Is 'struct dirent64' in ? */ #ifndef RIVET_HAVE_STRUCT_DIRENT64 #cmakedefine RIVET_HAVE_STRUCT_DIRENT64 @HAVE_STRUCT_DIRENT64@ #endif /* Is 'struct stat64' in ? */ #ifndef RIVET_HAVE_STRUCT_STAT64 #cmakedefine RIVET_HAVE_STRUCT_STAT64 @HAVE_STRUCT_STAT64@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_SYS_PARAM_H #cmakedefine RIVET_HAVE_SYS_PARAM_H @HAVE_SYS_PARAM_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_SYS_STAT_H #cmakedefine RIVET_HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_SYS_TYPES_H #cmakedefine RIVET_HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ #endif /* Is off64_t in ? */ #ifndef RIVET_HAVE_TYPE_OFF64_T #cmakedefine RIVET_HAVE_TYPE_OFF64_T @HAVE_TYPE_OFF64_T@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_UNISTD_H #cmakedefine RIVET_HAVE_UNISTD_H @HAVE_UNISTD_H@ #endif /* Honor HEAD requests */ #ifndef RIVET_HEAD_REQUESTS #cmakedefine01 RIVET_HEAD_REQUESTS #endif /* Rivet Tcl package version */ #ifndef RIVET_INIT_VERSION #define RIVET_INIT_VERSION "@INIT_VERSION@" #endif /* Define to the sub-directory where libtool stores uninstalled libraries. */ #ifndef RIVET_LT_OBJDIR #define RIVET_LT_OBJDIR ".libs/" #endif /* Max size of data in POST operations */ #ifndef RIVET_MAX_POST #define RIVET_MAX_POST @MAX_POST@ #endif /* No Compiler support for module scope symbols */ #ifndef RIVET_MODULE_SCOPE #define RIVET_MODULE_SCOPE extern __attribute__((__visibility__("hidden"))) #endif /* yes, MPM worker single thread */ #ifndef RIVET_MPM_SINGLE_TCL_THREAD #cmakedefine RIVET_MPM_SINGLE_TCL_THREAD @MPM_SINGLE_TCL_THREAD@ #endif /* The path to a working tclsh executable */ #ifndef RIVET_NAMEOFEXECUTABLE #define RIVET_NAMEOFEXECUTABLE "@NAMEOFEXECUTABLE@" #endif /* commands will not be exported */ #ifndef RIVET_NAMESPACE_EXPORT #cmakedefine01 RIVET_NAMESPACE_EXPORT #endif /* good, no automatic import will be done */ #ifndef RIVET_NAMESPACE_IMPORT #cmakedefine01 RIVET_NAMESPACE_IMPORT #endif /* Define to 1 if you have the header file, and it defines `DIR'. */ #ifndef RIVET_HAVE_DIRENT_H #cmakedefine RIVET_HAVE_DIRENT_H @HAVE_DIRENT_H@ #endif #ifndef RIVET_NO_DIRENT_H #cmakedefine RIVET_NO_DIRENT_H @NO_DIRENT_H@ #endif /* Do we have ? */ #ifndef RIVET_NO_DLFCN_H #cmakedefine RIVET_NO_DLFCN_H @NO_DLFCN_H@ #endif /* Do we have ? */ #ifndef RIVET_NO_ERRNO_H #cmakedefine RIVET_NO_ERRNO_H @NO_ERRNO_H@ #endif /* Do we have ? */ #ifndef RIVET_NO_FLOAT_H #cmakedefine RIVET_NO_FLOAT_H @NO_FLOAT_H@ #endif /* Define to 1 if you have the header file. */ #ifndef RIVET_HAVE_LIMITS_H #cmakedefine RIVET_HAVE_LIMITS_H @HAVE_LIMITS_H@ #endif #ifndef RIVET_NO_LIMITS_H #cmakedefine RIVET_NO_LIMITS_H @NO_LIMITS_H@ #endif /* Do we have ? */ #ifndef RIVET_NO_STDLIB_H #cmakedefine RIVET_NO_STDLIB_H @NO_STDLIB_H@ #endif /* Do we have ? */ #ifndef RIVET_NO_STRING_H #cmakedefine RIVET_NO_STRING_H @NO_STRING_H@ #endif /* Do we have ? */ #ifndef RIVET_NO_SYS_WAIT_H #cmakedefine RIVET_NO_SYS_WAIT_H @NO_SYS_WAIT_H@ #endif /* Do we have ? */ #ifndef RIVET_NO_VALUES_H #cmakedefine RIVET_NO_VALUES_H @NO_VALUES_H@ #endif /* No description provided for NO_VIZ... */ #ifndef RIVET_NO_VIZ #cmakedefine RIVET_NO_VIZ #endif /* Name of package */ #ifndef RIVET_PACKAGE #define RIVET_PACKAGE "rivet" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef RIVET_PACKAGE_BUGREPORT #define RIVET_PACKAGE_BUGREPORT "" #endif /* Define to the full name of this package. */ #ifndef RIVET_PACKAGE_NAME #define RIVET_PACKAGE_NAME "@PROJECT_NAME@" #endif /* Define to the full name and version of this package. */ #ifndef RIVET_PACKAGE_STRING #define RIVET_PACKAGE_STRING "@PROJECT_NAME@ @RIVET_VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef RIVET_PACKAGE_TARNAME #define RIVET_PACKAGE_TARNAME "rivet" #endif /* Define to the home page for this package. */ #ifndef RIVET_PACKAGE_URL #define RIVET_PACKAGE_URL "" #endif /* Define to the version of this package. */ #ifndef RIVET_PACKAGE_VERSION #define RIVET_PACKAGE_VERSION "@RIVET_VERSION@" #endif /* The path to the rivet tcl library */ #ifndef RIVET_RIVETLIB_DESTDIR #define RIVET_RIVETLIB_DESTDIR "@RIVETLIB_DESTDIR@" #endif /* mod_rivet core */ #ifndef RIVET_RIVET_CORE #define RIVET_RIVET_CORE "@RIVET_CORE@" #endif #ifndef RIVET_CORE /*#define RIVET_CORE "@RIVET_CORE@"*/ #endif /* Separate Channels for virtual hosts */ #ifndef RIVET_SEPARATE_CHANNELS #cmakedefine01 RIVET_SEPARATE_CHANNELS #endif /* one interpreter per child */ #ifndef RIVET_SEPARATE_VIRTUAL_INTERPS #cmakedefine01 RIVET_SEPARATE_VIRTUAL_INTERPS #endif /* requests will be serialized */ #ifndef RIVET_SERIALIZE_HTTP_REQUESTS #cmakedefine RIVET_SERIALIZE_HTTP_REQUESTS @SERIALIZE_HTTP_REQUESTS@ #endif /* Is this a static build? */ #ifndef RIVET_STATIC_BUILD #cmakedefine RIVET_STATIC_BUILD @STATIC_BUILD@ #endif /* Define to 1 if you have the ANSI C header files. */ #ifndef RIVET_STDC_HEADERS #cmakedefine RIVET_STDC_HEADERS @STDC_HEADERS@ #endif /* Is memory debugging enabled? */ #ifndef RIVET_TCL_MEM_DEBUG #cmakedefine RIVET_TCL_MEM_DEBUG @TCL_MEM_DEBUG@ #endif /* Are we building with threads enabled? */ #ifndef RIVET_TCL_THREADS #cmakedefine RIVET_TCL_THREADS 1 #endif /* Are wide integers to be implemented with C 'long's? */ #ifndef RIVET_TCL_WIDE_INT_IS_LONG #cmakedefine RIVET_TCL_WIDE_INT_IS_LONG @TCL_WIDE_INT_IS_LONG@ #endif /* What type should be used to define wide integers? */ #ifndef RIVET_TCL_WIDE_INT_TYPE #cmakedefine RIVET_TCL_WIDE_INT_TYPE @TCL_WIDE_INT_TYPE@ #endif /* UNDER_CE version */ #ifndef RIVET_UNDER_CE #cmakedefine RIVET_UNDER_CE @UNDER_CE@ #endif /* Path to the disk directory where uploads are saved */ #ifndef RIVET_UPLOAD_DIR #define RIVET_UPLOAD_DIR "@UPLOAD_DIR@" #endif /* uploads go to files */ #ifndef RIVET_UPLOAD_FILES_TO_VAR #cmakedefine01 RIVET_UPLOAD_FILES_TO_VAR #endif /* Do we want to use the threaded memory allocator? */ #ifndef RIVET_USE_THREAD_ALLOC #cmakedefine RIVET_USE_THREAD_ALLOC @USE_THREAD_ALLOC@ #endif /* Version number of package */ #ifndef RIVET_VERSION #define RIVET_VERSION "@RIVET_VERSION@" #endif /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Add the _ISOC99_SOURCE flag when building */ #ifndef RIVET__ISOC99_SOURCE #cmakedefine RIVET__ISOC99_SOURCE @_ISOC99_SOURCE@ #endif /* Add the _LARGEFILE64_SOURCE flag when building */ #ifndef RIVET__LARGEFILE64_SOURCE #cmakedefine RIVET__LARGEFILE64_SOURCE @_LARGEFILE64_SOURCE@ #endif /* Add the _LARGEFILE_SOURCE64 flag when building */ #ifndef RIVET__LARGEFILE_SOURCE64 #cmakedefine RIVET__LARGEFILE_SOURCE64 @_LARGEFILE_SOURCE64@ #endif /* # needed in sys/socket.h Should OS/390 do the right thing with sockets? */ #ifndef RIVET__OE_SOCKETS #cmakedefine RIVET__OE_SOCKETS @_OE_SOCKETS@ #endif /* Do we really want to follow the standard? Yes we do! */ #ifndef RIVET__POSIX_PTHREAD_SEMANTICS #cmakedefine RIVET__POSIX_PTHREAD_SEMANTICS @_POSIX_PTHREAD_SEMANTICS@ #endif /* Do we want the reentrant OS API? */ #ifndef RIVET__REENTRANT #cmakedefine RIVET__REENTRANT @_REENTRANT@ #endif /* Do we want the thread-safe OS API? */ #ifndef RIVET__THREAD_SAFE #cmakedefine RIVET__THREAD_SAFE @_THREAD_SAFE@ #endif /* _WIN32_WCE version */ #ifndef RIVET__WIN32_WCE #cmakedefine RIVET__WIN32_WCE @_WIN32_WCE@ #endif /* Do we want to use the XOPEN network library? */ #ifndef RIVET__XOPEN_SOURCE_EXTENDED #cmakedefine RIVET__XOPEN_SOURCE_EXTENDED @_XOPEN_SOURCE_EXTENDED@ #endif /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #ifndef _rivet_inline #define _rivet_inline #endif #endif /* once: _RIVET_CONFIG_H */ #endif rivet-3.2.6/cmake/CMakeLists.txt0000664000175000017510000005333114711540756016005 0ustar manghimanghi# Georgios Petasis, petasis@iit.demokritos.gr # The minimum version of cmake required. This may work also in 2.8, # but I have not tested. My cmake is version 3.9.0. cmake_minimum_required(VERSION 3.2 FATAL_ERROR) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() # Rivet version: # In order to avoid chasing around multiple definition of the module version we infer # this information from the file VERSION, which must stay in the project root directory # and assuming we are working from a direct child directory SET ( RIVET_TOP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.." ) # Read the file named VERSION from the top Rivet directory... FILE ( READ "${RIVET_TOP_DIR}/VERSION" RIVET_VERSION_FROM_FILE ) STRING ( REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _ ${RIVET_VERSION_FROM_FILE} ) SET ( RIVET_MAJOR_VERSION ${CMAKE_MATCH_1} ) SET ( RIVET_MINOR_VERSION ${CMAKE_MATCH_2} ) SET ( RIVET_PATCH_VERSION ${CMAKE_MATCH_3} ) MESSAGE ( STATUS "Rivet version: ${RIVET_MAJOR_VERSION}.${RIVET_MINOR_VERSION}.${RIVET_PATCH_VERSION}" ) set(RIVET_VERSION ${RIVET_MAJOR_VERSION}.${RIVET_MINOR_VERSION}.${RIVET_PATCH_VERSION}) set(INIT_VERSION ${RIVET_MAJOR_VERSION}.${RIVET_MINOR_VERSION}) # Rivetlib version: set(RIVETLIB_PACKAGE "rivetlib") set(RIVETLIB_PACKAGE_VERSION ${INIT_VERSION}) # The arguments argument are optional, declares version and language # (in this case C). project(Rivet VERSION ${RIVET_VERSION} LANGUAGES C) # User options... # =========================================================================== set(with-tclsh "" CACHE FILEPATH "location of a working tclsh executable") set(with-tcl "" CACHE PATH "directory containing tcl configuration (tclConfig.sh)") set(with-post-max 0 CACHE STRING "BYTES Maximum size of data to be sent with a POST") set(with-rivet-core "mod_rivet_ng" CACHE STRING "mod_rivet core directory") set(with-upload-dir "/tmp" CACHE STRING "Default directory for uploads") option(version-display "Display Rivet version in Apache signature" OFF) option(head-requests "Returns real headers in response to a HEAD request" OFF) option(single-thread "forces the worker brigde to create a single thread (debug)" OFF) option(rivet-commands-export "prevent export from ::rivet namespace" ON) option(import-rivet-commands "requires explicit namespace import" OFF) option(virtual-interps-separation "to turn on virtual host separation" OFF) option(requests-serialization "Forces HTTP requests serialization among threads(debug)" OFF) option(upload-var "whether files are uploaded to Tcl variables" ON) option(BUILD_SHARED_LIBS "build and link with shared libraries" ON) option(TCL_THREADS "build with threads" ON) option(TCL_MEM_DEBUG "build with memory debugging" OFF) include(CMakeDependentOption) CMAKE_DEPENDENT_OPTION(BUILD_STATIC_LIBS "build as static library" ON "NOT BUILD_SHARED_LIBS" OFF) # Offer the user the choice of overriding the installation directories set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries") set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables") set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files") if(WIN32 AND NOT CYGWIN) set(DEF_INSTALL_CMAKE_DIR CMake) else() set(DEF_INSTALL_CMAKE_DIR lib/CMake/Rivet) endif() set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() # Use GNU install directories include(GNUInstallDirs) # Rivet source files... # =========================================================================== set(RIVET_SRC_DIR "${PROJECT_SOURCE_DIR}/../src") set(RIVET_LIB_DIR "${PROJECT_SOURCE_DIR}/../rivet") set(RIVET_CORE ${with-rivet-core}) set(rivetparser_sources ${RIVET_SRC_DIR}/parser/rivetParser.c ${RIVET_SRC_DIR}/parser/parserPkgInit.c ) set(rivetlib_sources ${RIVET_SRC_DIR}/librivet/rivetList.c ${RIVET_SRC_DIR}/librivet/rivetCrypt.c ${RIVET_SRC_DIR}/librivet/rivetWWW.c ${RIVET_SRC_DIR}/librivet/rivetPkgInit.c ) set(rivet_worker_mpm_sources ${RIVET_SRC_DIR}/${RIVET_CORE}/rivet_worker_mpm.c ${RIVET_SRC_DIR}/${RIVET_CORE}/worker_prefork_common.c ) set(rivet_prefork_mpm_sources ${RIVET_SRC_DIR}/${RIVET_CORE}/rivet_prefork_mpm.c ${RIVET_SRC_DIR}/${RIVET_CORE}/worker_prefork_common.c ) set(rivet_lazy_mpm_sources ${RIVET_SRC_DIR}/${RIVET_CORE}/rivet_lazy_mpm.c ) set(mod_rivet_sources ${RIVET_SRC_DIR}/${RIVET_CORE}/mod_rivet.c ${RIVET_SRC_DIR}/request/apache_multipart_buffer.c ${RIVET_SRC_DIR}/request/apache_request.c ${RIVET_SRC_DIR}/${RIVET_CORE}/rivetCore.c ${RIVET_SRC_DIR}/${RIVET_CORE}/rivetInspect.c ${RIVET_SRC_DIR}/${RIVET_CORE}/rivetChannel.c ${RIVET_SRC_DIR}/parser/rivetParser.c ${RIVET_SRC_DIR}/${RIVET_CORE}/TclWebapache.c ${RIVET_SRC_DIR}/${RIVET_CORE}/apache_config.c ${RIVET_SRC_DIR}/${RIVET_CORE}/mod_rivet_cache.c ${RIVET_SRC_DIR}/${RIVET_CORE}/mod_rivet_common.c ${RIVET_SRC_DIR}/${RIVET_CORE}/mod_rivet_generator.c ) # Add build targets... # =========================================================================== add_library(mod_rivet ${mod_rivet_sources}) add_library(rivetparser ${rivetparser_sources}) add_library(rivetlib ${rivetlib_sources}) add_library(rivet_worker_mpm ${rivet_worker_mpm_sources}) add_library(rivet_prefork_mpm ${rivet_prefork_mpm_sources}) add_library(rivet_lazy_mpm ${rivet_lazy_mpm_sources}) add_library(rivet::parser ALIAS rivetparser) add_library(rivet::lib ALIAS rivetparser) add_library(rivet::rivet ALIAS mod_rivet) add_library(rivet::worker_mpm ALIAS rivet_worker_mpm) add_library(rivet::prefork_mpm ALIAS rivet_prefork_mpm) add_library(rivet::lazy_mpm ALIAS rivet_lazy_mpm) SET ( RIVET_LIB_SUFFIX ".so" ) SET ( RIVET_LIB_PREFIX "lib" ) SET_TARGET_PROPERTIES(mod_rivet PROPERTIES PREFIX "" SUFFIX ${RIVET_LIB_SUFFIX}) SET_TARGET_PROPERTIES(rivet_worker_mpm PROPERTIES PREFIX "" SUFFIX ${RIVET_LIB_SUFFIX}) SET_TARGET_PROPERTIES(rivet_prefork_mpm PROPERTIES PREFIX "" SUFFIX ${RIVET_LIB_SUFFIX}) SET_TARGET_PROPERTIES(rivet_lazy_mpm PROPERTIES PREFIX "" SUFFIX ${RIVET_LIB_SUFFIX}) SET_TARGET_PROPERTIES(rivetparser PROPERTIES PREFIX ${RIVET_LIB_PREFIX}) SET_TARGET_PROPERTIES(rivetlib PROPERTIES PREFIX ${RIVET_LIB_PREFIX}) # Definitions... # =========================================================================== target_compile_definitions (rivetparser PRIVATE HAVE_CONFIG_H=1 USE_TCL_STUBS=1 START_TAG="" ) target_compile_definitions (rivetlib PRIVATE HAVE_CONFIG_H=1 USE_TCL_STUBS=1 START_TAG="" ) target_compile_definitions (rivet_worker_mpm PRIVATE HAVE_CONFIG_H=1 ) target_compile_definitions (rivet_prefork_mpm PRIVATE HAVE_CONFIG_H=1 ) target_compile_definitions (rivet_lazy_mpm PRIVATE HAVE_CONFIG_H=1 ) target_compile_definitions (mod_rivet PRIVATE HAVE_CONFIG_H=1 START_TAG="" ) # =========================================================================== # Locate needed packages... # =========================================================================== list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_extra_modules") include(checks) # Locate Tcl... # =========================================================================== MESSAGE ( STATUS "Searching for Tcl..." ) if (NOT "${with-tcl}" STREQUAL "") MESSAGE ( STATUS " Tcl lib directory manually set by -Dwith-tcl=" ${with-tcl} ) get_filename_component(RIVET_TCL_ROOT "${with-tcl}" DIRECTORY) MESSAGE ( STATUS " Setting Tcl root to: " ${RIVET_TCL_ROOT} ) set ( CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${RIVET_TCL_ROOT} ) set (TCL_ROOT ${RIVET_TCL_ROOT}) set (TclStub_ROOT ${RIVET_TCL_ROOT}) endif () if (NOT "${with-tclsh}" STREQUAL "") MESSAGE ( STATUS " Tclsh manually set by -Dwith-tclsh=" ${with-tclsh} ) set (TCL_TCLSH ${with-tclsh}) endif () FIND_PACKAGE ( TCL 8.6.1 REQUIRED ) FIND_PACKAGE ( TclStub 8.6.1 REQUIRED ) MESSAGE ( STATUS " TCL_TCLSH: " ${TCL_TCLSH} ) MESSAGE ( STATUS " TCL_INCLUDE_PATH: " ${TCL_INCLUDE_PATH} ) MESSAGE ( STATUS " TCL_LIBRARY: " ${TCL_LIBRARY} ) MESSAGE ( STATUS " TCL_STUB_LIBRARY: " ${TCL_STUB_LIBRARY} ) # Locate Apache... # =========================================================================== MESSAGE ( STATUS "Searching for Apache..." ) find_package(APACHE REQUIRED) MESSAGE ( STATUS " APACHE_INCLUDE_DIR: " ${APACHE_INCLUDE_DIR} ) MESSAGE ( STATUS " APACHE_MODULE_DIR: " ${APACHE_MODULE_DIR} ) MESSAGE ( STATUS " APACHE_LIB_DIR: " ${APACHE_LIB_DIR} ) # Locate Apr... # =========================================================================== MESSAGE ( STATUS "Searching for Apr..." ) find_package(APR REQUIRED) MESSAGE ( STATUS " APR_INCLUDE_DIR: " ${APR_INCLUDE_DIR} ) MESSAGE ( STATUS " APR_LIBRARY: " ${APR_LIBRARY} ) MESSAGE ( STATUS " APRUTIL_INCLUDE_DIR: " ${APRUTIL_INCLUDE_DIR} ) MESSAGE ( STATUS " APRUTIL_LIBRARY: " ${APRUTIL_LIBRARY} ) find_package(Threads) # Set up include directories... # =========================================================================== set(RIVET_GENERATE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}) set(RIVET_GENERATE_DIR ${PROJECT_BINARY_DIR}/generated) set(RIVET_INCLUDE_DIRS_PUBLIC "${TCL_INCLUDE_PATH}" "${APACHE_INCLUDE_DIR}" "${APR_INCLUDE_DIR}" "${APRUTIL_INCLUDE_DIR}" ) set(RIVET_INCLUDE_DIRS_PRIVATE "${RIVET_SRC_DIR}" "${RIVET_SRC_DIR}/${RIVET_CORE}" "${RIVET_SRC_DIR}/parser" "${RIVET_SRC_DIR}/request" "${RIVET_GENERATE_DIR}" "${PROJECT_BINARY_DIR}" ) target_include_directories(rivetparser PUBLIC ${RIVET_INCLUDE_DIRS_PUBLIC} PRIVATE ${RIVET_INCLUDE_DIRS_PRIVATE}) target_include_directories(rivetlib PUBLIC ${RIVET_INCLUDE_DIRS_PUBLIC} PRIVATE ${RIVET_INCLUDE_DIRS_PRIVATE}) target_include_directories(rivet_worker_mpm PUBLIC ${RIVET_INCLUDE_DIRS_PUBLIC} PRIVATE ${RIVET_INCLUDE_DIRS_PRIVATE}) target_include_directories(rivet_prefork_mpm PUBLIC ${RIVET_INCLUDE_DIRS_PUBLIC} PRIVATE ${RIVET_INCLUDE_DIRS_PRIVATE}) target_include_directories(rivet_lazy_mpm PUBLIC ${RIVET_INCLUDE_DIRS_PUBLIC} PRIVATE ${RIVET_INCLUDE_DIRS_PRIVATE}) target_include_directories(mod_rivet PUBLIC ${RIVET_INCLUDE_DIRS_PUBLIC} PRIVATE ${RIVET_INCLUDE_DIRS_PRIVATE}) # Set up libraries... # =========================================================================== target_link_libraries(rivetparser ${TCL_STUB_LIBRARY}) target_link_libraries(rivetlib ${TCL_STUB_LIBRARY}) target_link_libraries(mod_rivet ${TCL_LIBRARY}) if(WIN32) # Under Windows, we need to link with all libraries, even libhttpd.lib MESSAGE ( STATUS "Searching for libhttpd.lib (Windows)..." ) FIND_LIBRARY(APACHE_HTTPD_LIBRARY libhttpd libhttpd.lib NAMES ${APACHE_HTTPD_NAMES} PATHS ${APACHE_HTTPD_LIBRARY_HINTS} ${APACHE_ROOT}/lib ) MESSAGE ( STATUS " APACHE_HTTPD_LIBRARY: " ${APACHE_HTTPD_LIBRARY} ) # Export all symbols from mod_rivet #SET_TARGET_PROPERTIES(mod_rivet PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_link_libraries(mod_rivet ${APR_LIBRARY} ${APACHE_HTTPD_LIBRARY} ) target_link_libraries(rivet_worker_mpm ${APR_LIBRARY} ${APRUTIL_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet) target_link_libraries(rivet_prefork_mpm ${APR_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet) target_link_libraries(rivet_lazy_mpm ${APR_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet) # rivet_worker_mpm.c uses round(), which is available in C99 SET_TARGET_PROPERTIES(rivet_worker_mpm PROPERTIES C_STANDARD 99) if(MSVC) # Libraries linked with tclstubs.lib library, cannot use /SAFESEH SET_TARGET_PROPERTIES(rivetparser PROPERTIES LINK_FLAGS /SAFESEH:NO ) SET_TARGET_PROPERTIES(rivetlib PROPERTIES LINK_FLAGS /SAFESEH:NO ) endif(MSVC) endif(WIN32) # Handle user options... # =========================================================================== MESSAGE( STATUS "Rivet version ${RIVET_VERSION}:") MESSAGE( STATUS " Core in use: " ${RIVET_CORE}) set(CONFIGURE_CMD "cmake -${CMAKE_ARGC} ${CMAKE_ARGV0}") if(version-display) set(DISPLAY_VERSION 1) else(version-display) set(DISPLAY_VERSION 0) endif() if(head-requests) set(HEAD_REQUESTS 1) endif() set(MAX_POST ${with-post-max}) if(single-thread) set(MPM_SINGLE_TCL_THREAD 1) endif() set(NAMEOFEXECUTABLE ${TCL_TCLSH}) if(import-rivet-commands) message(STATUS " Forcing Rivet to import commands from ::rivet namespace") set(NAMESPACE_IMPORT 1) endif() if(rivet-commands-export) message(STATUS " Forcing Rivet to export commands from ::rivet namespace") set(NAMESPACE_EXPORT 1) endif() set(SEPARATE_CHANNELS 0) if(virtual-interps-separation) set(SEPARATE_VIRTUAL_INTERPS 1) endif() if(requests-serialization) set(SERIALIZE_HTTP_REQUESTS 1) endif() if(upload-var) set(UPLOAD_FILES_TO_VAR 1) endif() set(UPLOAD_DIR ${with-upload-dir}) # Location of the Rivet library... # =========================================================================== if(NOT DEFINED RIVETLIB_DESTDIR) set(RIVETLIB_DESTDIR "${APACHE_LIB_DIR}/rivet${RIVET_VERSION}") endif(NOT DEFINED RIVETLIB_DESTDIR) if(TCL_THREADS) set(TCL_THREADS 1) if(NOT WIN32) set(USE_THREAD_ALLOC 1) set(_REENTRANT 1) set(_THREAD_SAFE 1) STRING (REGEX MATCH "SunOS" PROJECT_OS_SunOS ${CMAKE_SYSTEM_NAME}) if(PROJECT_OS_SunOS) set(_POSIX_PTHREAD_SEMANTICS 1) endif(PROJECT_OS_SunOS) endif(NOT WIN32) endif(TCL_THREADS) # Definitions... # =========================================================================== if(_REENTRANT) target_compile_definitions(rivetparser PRIVATE _REENTRANT=1) target_compile_definitions(rivetlib PRIVATE _REENTRANT=1) target_compile_definitions(rivet_worker_mpm PRIVATE _REENTRANT=1) target_compile_definitions(rivet_prefork_mpm PRIVATE _REENTRANT=1) target_compile_definitions(rivet_lazy_mpm PRIVATE _REENTRANT=1) target_compile_definitions(mod_rivet PRIVATE _REENTRANT=1) endif(_REENTRANT) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_compile_definitions(rivetparser PRIVATE LINUX=1) target_compile_definitions(rivetlib PRIVATE LINUX=1) target_compile_definitions(rivet_worker_mpm PRIVATE LINUX=1) target_compile_definitions(rivet_prefork_mpm PRIVATE LINUX=1) target_compile_definitions(rivet_lazy_mpm PRIVATE LINUX=1) target_compile_definitions(mod_rivet PRIVATE LINUX=1) endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") # Set variables for generating config files... # =========================================================================== set(RIVET_AC_APPLE_UNIVERSAL_BUILD ${AC_APPLE_UNIVERSAL_BUILD}) set(RIVET_CONFIGURE_CMD ${CONFIGURE_CMD}) set(RIVET_DISPLAY_VERSION ${DISPLAY_VERSION}) set(RIVET_HAVE_DLFCN_H ${HAVE_DLFCN_H}) set(RIVET_HAVE_INTTYPES_H ${HAVE_INTTYPES_H}) set(RIVET_HAVE_LIMITS_H ${HAVE_LIMITS_H}) set(RIVET_HAVE_LSEEK64 ${HAVE_LSEEK64}) set(RIVET_HAVE_MEMORY_H ${HAVE_MEMORY_H}) set(RIVET_HAVE_NET_ERRNO_H ${HAVE_NET_ERRNO_H}) set(RIVET_HAVE_OPEN64 ${HAVE_OPEN64}) set(RIVET_HAVE_STDINT_H ${HAVE_STDINT_H}) set(RIVET_HAVE_STDLIB_H ${HAVE_STDLIB_H}) set(RIVET_HAVE_STRINGS_H ${HAVE_STRINGS_H}) set(RIVET_HAVE_STRING_H ${HAVE_STRING_H}) set(RIVET_HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H}) set(RIVET_HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H}) set(RIVET_HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}) set(RIVET_HAVE_UNISTD_H ${HAVE_UNISTD_H}) set(RIVET_HEAD_REQUESTS ${HEAD_REQUESTS}) set(RIVET_MPM_SINGLE_TCL_THREAD ${MPM_SINGLE_TCL_THREAD}) set(RIVET_NAMESPACE_EXPORT ${NAMESPACE_EXPORT}) set(RIVET_NAMESPACE_IMPORT ${NAMESPACE_IMPORT}) set(RIVET_HAVE_DIRENT_H ${HAVE_DIRENT_H}) set(RIVET_NO_DIRENT_H ${NO_DIRENT_H}) set(RIVET_NO_DLFCN_H ${NO_DLFCN_H}) set(RIVET_NO_ERRNO_H ${NO_ERRNO_H}) set(RIVET_NO_FLOAT_H ${NO_FLOAT_H}) set(RIVET_HAVE_LIMITS_H ${HAVE_LIMITS_H}) set(RIVET_NO_LIMITS_H ${NO_LIMITS_H}) set(RIVET_NO_STDLIB_H ${NO_STDLIB_H}) set(RIVET_NO_STRING_H ${NO_STRING_H}) set(RIVET_NO_SYS_WAIT_H ${NO_SYS_WAIT_H}) set(RIVET_NO_VALUES_H ${NO_VALUES_H}) set(RIVET_NO_VIZ ${NO_VIZ}) set(RIVET_SEPARATE_CHANNELS ${SEPARATE_CHANNELS}) set(RIVET_SEPARATE_VIRTUAL_INTERPS ${SEPARATE_VIRTUAL_INTERPS}) set(RIVET_SERIALIZE_HTTP_REQUESTS ${SERIALIZE_HTTP_REQUESTS}) set(RIVET_STATIC_BUILD ${STATIC_BUILD}) set(RIVET_STDC_HEADERS ${STDC_HEADERS}) set(RIVET_TCL_MEM_DEBUG ${TCL_MEM_DEBUG}) set(RIVET_TCL_THREADS ${TCL_THREADS}) set(RIVET_TCL_WIDE_INT_IS_LONG ${TCL_WIDE_INT_IS_LONG}) set(RIVET_TCL_WIDE_INT_TYPE ${TCL_WIDE_INT_TYPE}) set(RIVET_UNDER_CE ${UNDER_CE}) set(RIVET_UPLOAD_FILES_TO_VAR ${UPLOAD_FILES_TO_VAR}) set(RIVET_UPLOAD_DIR ${UPLOAD_DIR}) set(RIVET_USE_THREAD_ALLOC ${USE_THREAD_ALLOC}) set(RIVET__ISOC99_SOURCE ${_ISOC99_SOURCE}) set(RIVET__LARGEFILE64_SOURCE ${_LARGEFILE64_SOURCE}) set(RIVET__LARGEFILE_SOURCE64 ${_LARGEFILE_SOURCE64}) set(RIVET__OE_SOCKETS ${_OE_SOCKETS}) set(RIVET__POSIX_PTHREAD_SEMANTICS ${_POSIX_PTHREAD_SEMANTICS}) set(RIVET__REENTRANT ${_REENTRANT}) set(RIVET__THREAD_SAFE ${_THREAD_SAFE}) set(RIVET__WIN32_WCE ${_WIN32_WCE}) set(RIVET__XOPEN_SOURCE_EXTENDED ${_XOPEN_SOURCE_EXTENDED}) set(RIVET_HAVE_ROUND ${HAVE_ROUND}) set(RIVET_NO_HAVE_ROUND ${NO_HAVE_ROUND}) # Generate headers rivet_config.h, config.h # =========================================================================== MESSAGE(STATUS "Generating: " ${RIVET_GENERATE_DIR}/rivet_config.h) configure_file("${PROJECT_SOURCE_DIR}/cmake_extra_modules/rivet_config.h.cmake" "${RIVET_GENERATE_DIR}/rivet_config.h" ) MESSAGE(STATUS "Generating: " ${RIVET_GENERATE_DIR}/config.h) configure_file("${PROJECT_SOURCE_DIR}/cmake_extra_modules/config.h.cmake" "${RIVET_GENERATE_DIR}/config.h" ) # Generate init.tcl # =========================================================================== MESSAGE(STATUS "Generating: " ${RIVET_GENERATE_DIR}/init.tcl) configure_file("${RIVET_LIB_DIR}/init.tcl.in" "${RIVET_GENERATE_DIR}/init.tcl" @ONLY) # =========================================================================== # Installation section... # =========================================================================== MESSAGE ( STATUS "==========================================================================" ) MESSAGE ( STATUS "Rivet ${RIVET_VERSION} will be installed in the following " "directories:" ) MESSAGE ( STATUS " + mod_rivet.so: " ${APACHE_MODULE_DIR} ) MESSAGE ( STATUS " (to override this location, use -DAPACHE_MODULE_DIR=...)") MESSAGE ( STATUS " + Rivet library: " ${RIVETLIB_DESTDIR} ) MESSAGE ( STATUS " (to override this location, use -DAPACHE_LIB_DIR=... or") MESSAGE ( STATUS " -DRIVETLIB_DESTDIR=...)") MESSAGE ( STATUS "==========================================================================" ) # Library mod_rivet (mod_rivet.so) must be installed in the directory Apache2 # searches for modules... # =========================================================================== if(WIN32) install(TARGETS mod_rivet EXPORT Rivet_mod_rivet RUNTIME DESTINATION ${APACHE_MODULE_DIR}) else(WIN32) install(TARGETS mod_rivet EXPORT Rivet_mod_rivet LIBRARY DESTINATION ${APACHE_MODULE_DIR}) endif(WIN32) # Install mpms... # =========================================================================== install(TARGETS rivet_worker_mpm rivet_prefork_mpm rivet_lazy_mpm EXPORT Rivet_MPMs ARCHIVE DESTINATION ${RIVETLIB_DESTDIR}/mpm LIBRARY DESTINATION ${RIVETLIB_DESTDIR}/mpm RUNTIME DESTINATION ${RIVETLIB_DESTDIR}/mpm) # Install libraries... # =========================================================================== install(TARGETS rivetparser rivetlib EXPORT Rivet_Libraries ARCHIVE DESTINATION ${RIVETLIB_DESTDIR} LIBRARY DESTINATION ${RIVETLIB_DESTDIR} RUNTIME DESTINATION ${RIVETLIB_DESTDIR}) # Install library files... # =========================================================================== install(FILES ${RIVET_GENERATE_DIR}/init.tcl ${RIVET_LIB_DIR}/default_request_handler.tcl ${RIVET_LIB_DIR}/pkgIndex.tcl DESTINATION ${RIVETLIB_DESTDIR}) # Install library directories... # =========================================================================== install(DIRECTORY ${RIVET_LIB_DIR}/rivet-tcl DESTINATION ${RIVETLIB_DESTDIR}) install(DIRECTORY ${RIVET_LIB_DIR}/packages/asciiglyphs ${RIVET_LIB_DIR}/packages/calendar ${RIVET_LIB_DIR}/packages/dio ${RIVET_LIB_DIR}/packages/entities ${RIVET_LIB_DIR}/packages/form ${RIVET_LIB_DIR}/packages/formbroker ${RIVET_LIB_DIR}/packages/session ${RIVET_LIB_DIR}/packages/tclrivet DESTINATION ${RIVETLIB_DESTDIR}/packages) # Regenerate pkgIndex.tcl in all libraries... # =========================================================================== SET ( RIVET_LIBS_ARCH ${RIVETLIB_DESTDIR} ) file(WRITE ${RIVETLIB_DESTDIR}/regenerate_pkgIndex.tcl "puts \"Regenerating pkgIndex.tcl in [pwd]:\" file delete {*}[glob [file join packages * pkgIndex.tcl]] pkgIndex.tcl pkg_mkIndex -verbose [pwd] init.tcl packages/*/*.tcl *[info sharedlibextension]" ) install(CODE " execute_process(COMMAND ${TCL_TCLSH} regenerate_pkgIndex.tcl WORKING_DIRECTORY ${RIVETLIB_DESTDIR}) file(REMOVE ${RIVETLIB_DESTDIR}/regenerate_pkgIndex.tcl) " ) rivet-3.2.6/cmake/README.cmake0000664000175000017510000000356414711540756015207 0ustar manghimanghiIn order to build Rivet with cmake, the following software is required: a) cmake, version 3.2 or newer. Compiling Rivet with cmake: ------------------------------------------------------- 1) Change the working directory to "cmake". 2) Execute the following commands (all commands must be executed from the "cmake" directory): cmake -E make_directory build cmake -E chdir build cmake .. cmake --build build --target all --clean-first cmake --build build --target install 3) To install mod_rivet.so/Rivet library to a custom location, the following commands can be used: cmake -E make_directory build cmake -E chdir build cmake \ -DAPACHE_MODULE_DIR=/home/tcl/rivet/branches/cmake/cmake/test/modules \ -DAPACHE_LIB_DIR=/home/tcl/rivet/branches/cmake/cmake/test/ .. cmake --build build --config Release --target install 4) To install mod_rivet.so/Rivet library in a system where Apache Server is not in a known location (i.e. under Windows), you can speficy APACHE_ROOT: cmake -E make_directory build cmake -E chdir build cmake -DAPACHE_ROOT=F:/Apache24 .. cmake --build build --config Release --target install 5) Compile for 64 bits under Windows (for Visual Studio 2017): cmake -E make_directory build_64 cmake -E chdir build_64 cmake -DAPACHE_ROOT=F:/Apache24_64 -G "Visual Studio 15 2017 Win64" .. cmake --build build_64 --config Release --target install -G "..." can be set to any of the available 64-bit generators available under the platform. 6) Specify Tcl at a non standard location: cmake -E make_directory build_64 cmake -E chdir build_64 cmake -DAPACHE_ROOT=F:/Apache24_64 -G "Visual Studio 15 2017 Win64" -Dwith-tcl=C:/TclApps/Tcl64/lib .. cmake --build build_64 --config Release --target install Instead of -Dwith-tcl=, -DTCL_ROOT=, -DTclStub_ROOT, and -DTCL_TCLSH= can be specified as an alternative. rivet-3.2.6/contrib/0000775000175000017510000000000014711540756013620 5ustar manghimanghirivet-3.2.6/contrib/README0000664000175000017510000000072214711540756014501 0ustar manghimanghi README file for 'contrib', directory that stores various contribution that don't fit well in the current distribution of Rivet ======================================================================= $Id: $ ======================================================================= rvt.vim: Syntax highlighting of rvt files in Vim form.tcl: TclOO form package (contributed by Clif Flynt) two-mode-mode.el: Switches between tcl and sgml(html) modes (David Welton) rivet-3.2.6/contrib/form.tcl0000664000175000017510000003024414711540756015272 0ustar manghimanghi# form.tcl -- generate forms automatically. # Copyright 2002-2004 The Apache Software Foundation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. package require TclOO package provide form 1.0 # # Rivet form class # ::oo::class create form { variable DefaultValues DefaultArgs arguments defaults constructor {args} { # set the form method to be a post and the action to be # a refetching of the current page set arguments(method) post set arguments(action) [env DOCUMENT_URI] trace add variable defaults write "[self] setDefaults" # use $this for the type for form-global stuff like form arguments my import_data form arguments $args if {[info exists arguments(defaults)]} { # make the public variable contain the name of the array # we are sucking default values out of set defaults $arguments(defaults) upvar $arguments(defaults) tempDefaults array set DefaultValues [array get tempDefaults] unset arguments(defaults) } } destructor { } method destroy {} { ::oo::delete object [self] } # # import_data -- given a field type, field name, name of an array, and a # list of key-value pairs, prepend any default key-value pairs, # set a default value if one exists, then store the resulting # key-value pairs in the named array # method import_data {type arrayName list} { upvar 1 $arrayName data # # If there are elements in the defaultArgs array for the # specified type, combine them with the list of key-value # pairs, putting the DefaultArgs values first so the # key-value pairs from list can possibly override them. # if {[info exists DefaultArgs($type)]} { set list [concat $DefaultArgs($type) $list] } # # if there is a default value for the name stored in the # DefaultValues array in this class, set the value # element of the array the caller named to contain that # value # if {[info exists DefaultValues([self])]} { set data(value) $DefaultValues([self]) } # # if we don't have an even number of key-value pairs, # that just ain't right # if {[expr [llength $list] % 2]} { return -code error "Unmatched key-value pairs -- [llength $list] in [string map {< ^ > v} $list] " } # # for each key-value pair in the list, strip the first # dash character from the key part and map it to lower # case, then use that as the key for the passed-in # array and store the corresonding value in there # # we also prep and return the list of key-value pairs, normalized # with the lowercase thing # set return "" foreach {var val} $list { set var [string range [string tolower $var] 1 end] set data($var) $val if {($var == "values") || ($var == "labels")} { continue } lappend return -$var $val } return $return } # # my argstring - given an array name, construct areturn string of the # style key1="data1" key2="data2" etc for each key value pair in the # array # method argstring {arrayName} { upvar 1 $arrayName data set string "" foreach arg [lsort [array names data]] { append string " $arg=\"$data($arg)\"" } return $string } # # default_value -- if only a name is given, returns a default value # for that name if one exists else an empty list. # # if a name and a value are given, the default value is set to that # name (and the new default value is returned). # method default_value {name {newValue ""}} { if {[lempty $newValue]} { if {![info exists DefaultValues($name)]} { return } return $DefaultValues($name) } return [set DefaultValues($name) $newValue] } # # default_args - given a type and a variable number of arguments, # if there are no arguments other than the type, return the # element of that name from the DefaultArgs array, if that element # exists, else return an empty list. # # if a name and a value are given, sets the DefaultArgs to the variable # list of arguments. # method default_args {type args} { # if only one argument was specified if {[lempty $args]} { if {![info exists DefaultArgs($type)]} { return } return $DefaultArgs($type) } # make sure we have an even number of key-value pairs if {[expr [llength $args] % 2]} { return -code error "Unmatched key-value pairs" } # set the DefaultArgs for the specified type return [set DefaultArgs($type) $args] } # # start - generate the
with all of its arguments # method start {{args ""}} { if {![lempty $args]} { # replicated in constructor my import_data form arguments $args } html "" } # # end - generate the
# method end {} { html "" } # # field - emit a field of the given field type and name, including # any default key-value pairs defined for this field type and # optional key-value pairs included with the statement # method field {type name args} { # import any default key-value pairs, then any specified in this # field declaration my import_data $type data $args # generate the field definition set string "= 0} { append string { checked="checked"} } } } } append string " />" # ...and emit it if {($type == "radio") || ($type == "checkbox")} { html $string$data(label)$data(post) } else { html $string } } # # text -- emit an HTML "text" field # method text {name args} { my field text $name {*}$args } # # password -- emit an HTML "password" field # method password {name args} { my field password $name {*}$args } # # hidden -- emit an HTML "hidden" field # method hidden {name args} { my field hidden $name {*}$args } # # submit -- emit an HTML "submit" field # method submit {name args} { my field submit $name {*}$args } # # button -- emit an HTML "button" field # method button {name args} { my field button $name {*}$args } # # reset -- emit an HTML "reset" button # method reset {name args} { my field reset $name {*}$args } # # image -- emit an HTML image field # method image {name args} { my field image $name {*}$args } # # checkbox -- emit an HTML "checkbox" form field # method checkbox {name args} { my field checkbox $name {*}$args } # # radio -- emit an HTML "radiobutton" form field # method radio {name args} { my field radio $name {*}$args } # # color -- emit an HTML 5 "color" form field # method color {name args} { my field color $name {*}$args } # # date -- emit an HTML 5 "date" form field # method date {name args} { my field date $name {*}$args } # # datetime -- emit an HTML 5 "datetime" form field # method datetime {name args} { my field datetime $name {*}$args } # # datetime_local -- emit an HTML 5 "datetime-local" form field # method datetime_local {name args} { my field datetime-local $name {*}$args } # # email -- emit an HTML 5 "email" form field # method email {name args} { my field email $name {*}$args } # # file -- emit an HTML 5 "file" form field # method file {name args} { my field email $name {*}$args } # # month -- emit an HTML 5 "month" form field # method month {name args} { my field month $name {*}$args } # # number -- emit an HTML 5 "number" form field # method number {name args} { my field number $name {*}$args } # # range -- emit an HTML 5 "range" form field # method range {name args} { my field range $name {*}$args } # # search -- emit an HTML 5 "search" form field # method search {name args} { my field search $name {*}$args } # # tel -- emit an HTML 5 "tel" form field # method tel {name args} { my field tel $name {*}$args } # # time -- emit an HTML 5 "time" form field # method time {name args} { my field time $name {*}$args } # # url -- emit an HTML 5 "url" form field # method url {name args} { my field url $name {*}$args } # # week -- emit an HTML 5 "week" form field # method week {name args} { my field week $name {*}$args } # # radiobuttons -- # method radiobuttons {name args} { set data(values) [list] set data(labels) [list] set list [my import_data radiobuttons data $args] if {[lempty $data(labels)]} { set data(labels) $data(values) } foreach label $data(labels) value $data(values) { my radio $name {*}$list -label $label -value $value } } # # select -- generate a selector # # part of the key value pairs can include -values with a list, # and -labels with a list and it'll populate the