Index: tolbase/CMakeLists.txt
===================================================================
--- tolbase/CMakeLists.txt	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/CMakeLists.txt	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,63 @@
+cmake_minimum_required( VERSION 2.8 )
+project( TOLTCL )
+
+set( CMAKE_MODULE_PATH
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+  ${CMAKE_MODULE_PATH} )
+
+include( LibFindMacros )
+
+# The version number.
+set (TOLBASE_VERSION_MAJOR 3)
+set (TOLBASE_VERSION_MINOR 2)
+
+# look for tol
+find_package( TOL REQUIRED )
+if( TOL_FOUND )
+  message( STATUS "TOL_INCLUDE_DIR = ${TOL_INCLUDE_DIR}" )
+  message( STATUS "TOL_LIBRARIES = ${TOL_LIBRARIES}" )
+else( TOL_FOUND )
+endif( TOL_FOUND )
+
+# look for tcl
+if ( WIN32 AND TOL_PREFIX_PATH )
+  set( TCL_LIBRARY_PATH "${TOL_PREFIX_PATH}/lib" )
+  message( STATUS "buscando dll en = ${TOL_PREFIX_PATH}/bin" )
+  find_library( TCL_LIBRARY
+      NAMES "tcl84" "tcl85" "tcl86"
+      PATHS "${TCL_LIBRARY_PATH}"
+      NO_DEFAULT_PATH
+    )
+  find_library( TK_LIBRARY
+      NAMES "tk84" "tk85" "tk86"
+      PATHS "${TCL_LIBRARY_PATH}"
+      NO_DEFAULT_PATH
+    )
+  find_path(
+    TCL_INCLUDE_PATH
+    NAMES "tcl.h"
+    PATHS "${TOL_PREFIX_PATH}/include"
+    NO_DEFAULT_PATH
+    )
+  set( TCL_PROCESS_INCLUDES TCL_INCLUDE_PATH )
+  set( TCL_PROCESS_LIBS TCL_LIBRARY TK_LIBRARY )
+  libfind_process( TCL )
+else( WIN32 AND TOL_PREFIX_PATH )
+  find_package( TCL REQUIRED )
+endif( WIN32 AND TOL_PREFIX_PATH )
+
+if( TCL_FOUND )
+  message( STATUS ${TCL_INCLUDE_PATH} )
+  message( STATUS ${TCL_LIBRARY_PATH} )
+  get_filename_component( CMAKE_INSTALL_PREFIX ${TCL_LIBRARY_PATH} PATH )
+  message( STATUS "Using CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
+else( TCL_FOUND )
+  message( SEND_ERROR "Tolbase needs Tcl library" )
+endif( TCL_FOUND )
+  
+set( TOLBASE_DEST_DIR "lib/TolbaseApp${TOLBASE_VERSION_MAJOR}.${TOLBASE_VERSION_MINOR}"
+  CACHE INTERNAL "" )
+
+add_subdirectory( generic )
+add_subdirectory( lib )
+
Index: tolbase/cmake/linux-i686.toolchain.cmake
===================================================================
--- tolbase/cmake/linux-i686.toolchain.cmake	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/cmake/linux-i686.toolchain.cmake	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,6 @@
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_VERSION 1)
+set(CMAKE_SYSTEM_PROCESSOR "i686")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags")
Index: tolbase/cmake/modules/FindTOL.cmake
===================================================================
--- tolbase/cmake/modules/FindTOL.cmake	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/cmake/modules/FindTOL.cmake	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,55 @@
+# This module defines
+# TOL_FOUND.  If false, you cannot build anything that requires TOL.
+# TOL_INCLUDE_DIR where to find the tol's header files
+# TOL_LIBRARIES, the libraries to link against to use TOL
+# also defined, but not for general use is
+# TOL_LIBRARY, the path to tol library.
+#
+# You can provide in TOL_PREFIX_PATH the path to the prefix
+# instalation of TOL.
+#
+
+include( LibFindMacros )
+
+set( TOL_FOUND 0 )
+
+if( EXISTS ${TOL_PREFIX_PATH} )
+
+  #find includes
+  find_path(
+    TOL_INCLUDE_DIR
+    NAMES "tol/tol_bcommon.h"
+    PATHS ${TOL_PREFIX_PATH}
+    PATH_SUFFIXES "include"
+    NO_DEFAULT_PATH )
+  find_library( TOL_LIBRARY
+    NAMES tol
+    PATHS ${TOL_PREFIX_PATH}
+    PATH_SUFFIXES "lib"
+    NO_DEFAULT_PATH )
+else(  EXISTS ${TOL_PREFIX_PATH} )
+
+  #find includes
+  find_path(
+    TOL_INCLUDE_DIR
+    NAMES "tol/tol_bcommon.h" )
+  find_library( TOL_LIBRARY
+    NAMES tol )
+endif( EXISTS ${TOL_PREFIX_PATH} )
+
+set( TOL_PROCESS_INCLUDES TOL_INCLUDE_DIR )
+set( TOL_PROCESS_LIBS TOL_LIBRARY )
+libfind_process( TOL )
+
+if( TOL_FOUND )
+  add_definitions(
+    -DHAVE_CONFIG_H -DUSE_DELAY_INIT -D__USE_ZIP_ARCHIVE__
+    -D__USE_DYNSCOPE__
+    -D__POOL_NONE__=0 -D__POOL_BFSMEM__=1 -D__USE_POOL__=__POOL_BFSMEM__
+    -D__HASH_MAP_MSVC__=1 -D__HASH_MAP_GOOGLE__=2 -D__HASH_MAP_GCC__=3 
+    -D__HASH_MAP_ICC__=4 -D__USE_HASH_MAP__=__HASH_MAP_GOOGLE__ )
+  if( UNIX )
+    add_definitions( -DUNIX )
+  endif( )
+endif( TOL_FOUND )
+
Index: tolbase/cmake/modules/LibFindMacros.cmake
===================================================================
--- tolbase/cmake/modules/LibFindMacros.cmake	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/cmake/modules/LibFindMacros.cmake	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,265 @@
+# Version 2.2
+# Public Domain, originally written by Lasse KÃ€rkkÃ€inen <tronic>
+# Maintained at https://github.com/Tronic/cmake-modules
+# Please send your improvements as pull requests on Github.
+
+# Find another package and make it a dependency of the current package.
+# This also automatically forwards the "REQUIRED" argument.
+# Usage: libfind_package(<prefix> <another package> [extra args to find_package])
+macro (libfind_package PREFIX PKG)
+  set(${PREFIX}_args ${PKG} ${ARGN})
+  if (${PREFIX}_FIND_REQUIRED)
+    set(${PREFIX}_args ${${PREFIX}_args} REQUIRED)
+  endif()
+  find_package(${${PREFIX}_args})
+  set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG})
+  unset(${PREFIX}_args)
+endmacro()
+
+# A simple wrapper to make pkg-config searches a bit easier.
+# Works the same as CMake's internal pkg_check_modules but is always quiet.
+macro (libfind_pkg_check_modules)
+  find_package(PkgConfig QUIET)
+  if (PKG_CONFIG_FOUND)
+    pkg_check_modules(${ARGN} QUIET)
+  endif()
+endmacro()
+
+# Avoid useless copy&pasta by doing what most simple libraries do anyway:
+# pkg-config, find headers, find library.
+# Usage: libfind_pkg_detect(<prefix> <pkg-config args> FIND_PATH <name> [other args] FIND_LIBRARY <name> [other args])
+# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2)
+function (libfind_pkg_detect PREFIX)
+  # Parse arguments
+  set(argname pkgargs)
+  foreach (i ${ARGN})
+    if ("${i}" STREQUAL "FIND_PATH")
+      set(argname pathargs)
+    elseif ("${i}" STREQUAL "FIND_LIBRARY")
+      set(argname libraryargs)
+    else()
+      set(${argname} ${${argname}} ${i})
+    endif()
+  endforeach()
+  if (NOT pkgargs)
+    message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.")
+  endif()
+  # Find library
+  libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs})
+  if (pathargs)
+    find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS})
+  endif()
+  if (libraryargs)
+    find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
+  endif()
+endfunction()
+
+# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
+# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR)
+# Fourth argument "QUIET" may be used for silently testing different define names.
+# This function does nothing if the version variable is already defined.
+function (libfind_version_header PREFIX VERSION_H DEFINE_NAME)
+  # Skip processing if we already have a version or if the include dir was not found
+  if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR)
+    return()
+  endif()
+  set(quiet ${${PREFIX}_FIND_QUIETLY})
+  # Process optional arguments
+  foreach(arg ${ARGN})
+    if (arg STREQUAL "QUIET")
+      set(quiet TRUE)
+    else()
+      message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.")
+    endif()
+  endforeach()
+  # Read the header and parse for version number
+  set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
+  if (NOT EXISTS ${filename})
+    if (NOT quiet)
+      message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
+    endif()
+    return()
+  endif()
+  file(READ "${filename}" header)
+  string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}")
+  # No regex match?
+  if (match STREQUAL header)
+    if (NOT quiet)
+      message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"<version>\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
+    endif()
+    return()
+  endif()
+  # Export the version string
+  set(${PREFIX}_VERSION "${match}" PARENT_SCOPE)
+endfunction()
+
+# Do the final processing once the paths have been detected.
+# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
+# all the variables, each of which contain one include directory.
+# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
+# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
+# Also handles errors in case library detection was required, etc.
+function (libfind_process PREFIX)
+  # Skip processing if already processed during this configuration run
+  if (${PREFIX}_FOUND)
+    return()
+  endif()
+
+  set(found TRUE)  # Start with the assumption that the package was found
+
+  # Did we find any files? Did we miss includes? These are for formatting better error messages.
+  set(some_files FALSE)
+  set(missing_headers FALSE)
+
+  # Shorthands for some variables that we need often
+  set(quiet ${${PREFIX}_FIND_QUIETLY})
+  set(required ${${PREFIX}_FIND_REQUIRED})
+  set(exactver ${${PREFIX}_FIND_VERSION_EXACT})
+  set(findver "${${PREFIX}_FIND_VERSION}")
+  set(version "${${PREFIX}_VERSION}")
+
+  # Lists of config option names (all, includes, libs)
+  unset(configopts)
+  set(includeopts ${${PREFIX}_PROCESS_INCLUDES})
+  set(libraryopts ${${PREFIX}_PROCESS_LIBS})
+
+  # Process deps to add to 
+  foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
+    if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
+      # The package seems to export option lists that we can use, woohoo!
+      list(APPEND includeopts ${${i}_INCLUDE_OPTS})
+      list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
+    else()
+      # If plural forms don't exist or they equal singular forms
+      if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
+          ({i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
+        # Singular forms can be used
+        if (DEFINED ${i}_INCLUDE_DIR)
+          list(APPEND includeopts ${i}_INCLUDE_DIR)
+        endif()
+        if (DEFINED ${i}_LIBRARY)
+          list(APPEND libraryopts ${i}_LIBRARY)
+        endif()
+      else()
+        # Oh no, we don't know the option names
+        message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!")
+      endif()
+    endif()
+  endforeach()
+  
+  if (includeopts)
+    list(REMOVE_DUPLICATES includeopts)
+  endif()
+  
+  if (libraryopts)
+    list(REMOVE_DUPLICATES libraryopts)
+  endif()
+
+  string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}")
+  if (NOT tmp STREQUAL "${includeopts} ${libraryopts}")
+    message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).")
+  endif()
+
+  # Include/library names separated by spaces (notice: not CMake lists)
+  unset(includes)
+  unset(libs)
+
+  # Process all includes and set found false if any are missing
+  foreach (i ${includeopts})
+    list(APPEND configopts ${i})
+    if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
+      list(APPEND includes "${${i}}")
+    else()
+      set(found FALSE)
+      set(missing_headers TRUE)
+    endif()
+  endforeach()
+
+  # Process all libraries and set found false if any are missing
+  foreach (i ${libraryopts})
+    list(APPEND configopts ${i})
+    if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
+      list(APPEND libs "${${i}}")
+    else()
+      set (found FALSE)
+    endif()
+  endforeach()
+
+  # Version checks
+  if (found AND findver)
+    if (NOT version)
+      message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.")
+    elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver))
+      set(found FALSE)
+      set(version_unsuitable TRUE)
+    endif()
+  endif()
+
+  # If all-OK, hide all config options, export variables, print status and exit
+  if (found)
+    foreach (i ${configopts})
+      mark_as_advanced(${i})
+    endforeach()
+    if (NOT quiet)
+      message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
+      if (LIBFIND_DEBUG)
+        message(STATUS "  ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}")
+        message(STATUS "  ${PREFIX}_INCLUDE_OPTS=${includeopts}")
+        message(STATUS "  ${PREFIX}_INCLUDE_DIRS=${includes}")
+        message(STATUS "  ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
+        message(STATUS "  ${PREFIX}_LIBRARIES=${libs}")
+      endif()
+      set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
+      set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
+      set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
+      set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
+      set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
+    endif()
+    return()    
+  endif()
+
+  # Format messages for debug info and the type of error
+  set(vars "Relevant CMake configuration variables:\n")
+  foreach (i ${configopts})
+    mark_as_advanced(CLEAR ${i})
+    set(val ${${i}})
+    if ("${val}" STREQUAL "${i}-NOTFOUND")
+      set (val "<not found>")
+    elseif (val AND NOT EXISTS ${val})
+      set (val "${val}  (does not exist)")
+    else()
+      set(some_files TRUE)
+    endif()
+    set(vars "${vars}  ${i}=${val}\n")
+  endforeach()
+  set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n")
+  if (version_unsuitable)
+    set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but")
+    if (exactver)
+      set(msg "${msg} only version ${findver} is acceptable.")
+    else()
+      set(msg "${msg} version ${findver} is the minimum requirement.")
+    endif()
+  else()
+    if (missing_headers)
+      set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?")
+    elseif (some_files)
+      set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?")
+      if(findver)
+        set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).")
+      endif()
+    else()
+      set(msg "We were unable to find package ${PREFIX}.")
+    endif()
+  endif()
+
+  # Fatal error out if REQUIRED
+  if (required)
+    set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.")
+    message(FATAL_ERROR "${msg}\n${vars}")
+  endif()
+  # Otherwise just print a nasty warning
+  if (NOT quiet)
+    message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}")
+  endif()
+endfunction()
Index: tolbase/cmake/modules/MSysMacros.cmake
===================================================================
--- tolbase/cmake/modules/MSysMacros.cmake	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/cmake/modules/MSysMacros.cmake	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,12 @@
+if( MSYS )
+  get_filename_component( msys_usr $ENV{WD} DIRECTORY )
+  set( MSYS_USR_PATH ${msys_usr} CACHE INTERNAL "" )
+endif( MSYS )
+
+macro( msys_convert_path var path )
+  if( MSYS )
+    string( REGEX REPLACE ^/usr ${MSYS_USR_PATH} ${var} ${path} )
+  else( MSYS )
+    set( ${var} ${path} PARENT_SCOPE )
+  endif( MSYS )
+endmacro( )
Index: tolbase/generic/CMakeLists.txt
===================================================================
--- tolbase/generic/CMakeLists.txt	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/generic/CMakeLists.txt	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,34 @@
+add_definitions( -DTCL_THREADS -DTOLBASE_VERSION=\"${TOLBASE_VERSION_MAJOR}.${TOLBASE_VERSION_MINOR}\")
+include_directories( ${TCL_INCLUDE_PATH} )
+ 
+message( STATUS "Using TCL_INCLUDE_PATH = ${TCL_INCLUDE_PATH}" )
+message( STATUS "Using TCL_LIBRARY = ${TCL_LIBRARY}" )
+message( STATUS "Using TK_LIBRARY = ${TCL_LIBRARY}" )
+
+if ( NOT WIN32 )
+	# use, i.e. don't skip the full RPATH for the build tree
+  SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
+
+  # when building, don't use the install RPATH already
+  # (but later on when installing)
+  SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
+
+  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+  # add the automatically determined parts of the RPATH
+  # which point to directories outside the build tree to the install RPATH
+  SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+
+  # the RPATH to be used when installing, but only if it's not a system directory
+  LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+  IF("${isSystemDir}" STREQUAL "-1")
+     SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+  ENDIF("${isSystemDir}" STREQUAL "-1")
+endif( NOT WIN32 )
+
+add_executable( tolbase tolbase.c )
+target_link_libraries( tolbase ${TCL_LIBRARY} ${TK_LIBRARY} )
+
+message( STATUS "TOLBASE_DEST_DIR = ${TOLBASE_DEST_DIR}" )
+install( TARGETS tolbase RUNTIME DESTINATION "bin" )
Index: tolbase/generic/tolbase.c
===================================================================
--- tolbase/generic/tolbase.c	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/generic/tolbase.c	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,136 @@
+/* 
+ * tkAppInit.c --
+ *
+ *	Provides a default version of the Tcl_AppInit procedure for
+ *	use in wish and similar Tk-based applications.
+ *
+ * Copyright (c) 1993 The Regents of the University of California.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tk.h"
+#include "locale.h"
+
+#ifdef TK_TEST
+extern int		Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+#endif /* TK_TEST */
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * main --
+ *
+ *	This is the main program for the application.
+ *
+ * Results:
+ *	None: Tk_Main never returns here, so this procedure never
+ *	returns either.
+ *
+ * Side effects:
+ *	Whatever the application does.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+main(argc, argv)
+    int argc;			/* Number of command-line arguments. */
+    char **argv;		/* Values of command-line arguments. */
+{
+    /*
+     * The following #if block allows you to change the AppInit
+     * function by using a #define of TCL_LOCAL_APPINIT instead
+     * of rewriting this entire file.  The #if checks for that
+     * #define and uses Tcl_AppInit if it doesn't exist.
+     */
+    
+#ifndef TK_LOCAL_APPINIT
+#define TK_LOCAL_APPINIT Tcl_AppInit    
+#endif
+    extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
+    
+    /*
+     * The following #if block allows you to change how Tcl finds the startup
+     * script, prime the library or encoding paths, fiddle with the argv,
+     * etc., without needing to rewrite Tk_Main()
+     */
+    
+#ifdef TK_LOCAL_MAIN_HOOK
+    extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
+    TK_LOCAL_MAIN_HOOK(&argc, &argv);
+#endif
+
+    Tk_Main(argc, argv, TK_LOCAL_APPINIT);
+    return 0;			/* Needed only to prevent compiler warning. */
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tcl_AppInit --
+ *
+ *	This procedure performs application-specific initialization.
+ *	Most applications, especially those that incorporate additional
+ *	packages, will have their own version of this procedure.
+ *
+ * Results:
+ *	Returns a standard Tcl completion code, and leaves an error
+ *	message in the interp's result if an error occurs.
+ *
+ * Side effects:
+ *	Depends on the startup script.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tcl_AppInit(interp)
+    Tcl_Interp *interp;		/* Interpreter for application. */
+{
+    if (Tcl_Init(interp) == TCL_ERROR) {
+	return TCL_ERROR;
+    }
+    if (Tk_Init(interp) == TCL_ERROR) {
+	return TCL_ERROR;
+    }
+    Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
+#ifdef TK_TEST
+    if (Tktest_Init(interp) == TCL_ERROR) {
+	return TCL_ERROR;
+    }
+    Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
+            (Tcl_PackageInitProc *) NULL);
+#endif /* TK_TEST */
+
+
+    /*
+     * Call the init procedures for included packages.  Each call should
+     * look like this:
+     *
+     * if (Mod_Init(interp) == TCL_ERROR) {
+     *     return TCL_ERROR;
+     * }
+     *
+     * where "Mod" is the name of the module.
+     */
+
+    /*
+     * Call Tcl_CreateCommand for application-specific commands, if
+     * they weren't already created by the init procedures called above.
+     */
+
+    /*
+     * Specify a user-specific startup file to invoke if the application
+     * is run interactively.  Typically the startup file is "~/.apprc"
+     * where "app" is the name of the application.  If this line is deleted
+     * then no user-specific startup file will be run under any conditions.
+     */
+
+    Tcl_PkgRequire( interp, "TolbaseApp", TOLBASE_VERSION, 1);
+    return TCL_OK;
+}
Index: tolbase/lib/CMakeLists.txt
===================================================================
--- tolbase/lib/CMakeLists.txt	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/lib/CMakeLists.txt	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,18 @@
+if( POLICY CMP0026 )
+  cmake_policy( SET CMP0026 OLD )
+endif( POLICY CMP0026 )
+
+configure_file (
+  "${CMAKE_CURRENT_SOURCE_DIR}/pkgIndex.tcl.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl"
+  )
+
+install( FILES 
+  "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl" 
+  COMPONENT RUNTIME DESTINATION "${TOLBASE_DEST_DIR}" )
+
+install( DIRECTORY 
+  autoscroll      markupparser  nbdbmanager      renderpane   wtree
+  byswidget       markupviewer  notebookdb       rmtps_client
+  mimetex         toltk         mkWidgets1.3     trycatch
+  COMPONENT RUNTIME DESTINATION ${TOLBASE_DEST_DIR} )
Index: tolbase/lib/pkgIndex.tcl.in
===================================================================
--- tolbase/lib/pkgIndex.tcl.in	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
+++ tolbase/lib/pkgIndex.tcl.in	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -0,0 +1,7 @@
+# Tcl package index file, version 1.1
+
+package ifneeded TolbaseApp @TOLBASE_VERSION_MAJOR@.@TOLBASE_VERSION_MINOR@ \
+    [ string map [list %d $dir] {
+      lappend auto_path {%d}
+      source [ file join {%d} toltk init_toltk.tcl ]
+    } ]
Index: tolbase/lib/wtree/wtree.tcl
===================================================================
--- tolbase/lib/wtree/wtree.tcl	(revision 08c59de8a8a296565cbdc886f936b1280e845ced)
+++ tolbase/lib/wtree/wtree.tcl	(revision 4fce39e5dccae65b6a9274fbc31c7557c5390b85)
@@ -2,5 +2,5 @@
   package require tile
 }
-package require -exact treectrl 2.2.9
+package require treectrl 2.2.9
 package require autoscroll
 package require snit
