Changes On Branch stubbed-tcl
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch stubbed-tcl Excluding Merge-Ins

This is equivalent to a diff from a0da8b3873 to ba91fe5f9e

2012-09-28
20:15
Refinements to the Tcl stubs integration. check-in: a0b3507d6c user: mistachkin tags: tclStubsV2
10:18
Update to the latest SQLite amalgamation, for the purpose of testing recent changes in SQLite. check-in: c0f245de25 user: drh tags: trunk
07:26
load Tcl dynamically using the Stubs mechanism in stead of linking in the library statically. Closed-Leaf check-in: ba91fe5f9e user: jan.nijtmans tags: stubbed-tcl
2012-09-27
21:16
Merge the partialCommitPerms branch which fixes an issue with permission bit changes of non-specified files being picked up by a partial commit. check-in: a0da8b3873 user: drh tags: trunk
17:29
Update the pre-checkin checklist to talk about the new --tk option to the diff command. check-in: 394177917c user: drh tags: trunk
2012-09-25
11:48
Candidate fix for maintaining existing permission bits for partial check-ins. Closed-Leaf check-in: 33ffb32cb8 user: mistachkin tags: partialCommitPerms

Changes to src/makemake.tcl.

   422    422   #    used if the FOSSIL_TCL_SOURCE macro is not defined.
   423    423   #
   424    424   TCLINCDIR = $(TCLDIR)/include
   425    425   TCLLIBDIR = $(TCLDIR)/lib
   426    426   
   427    427   #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
   428    428   #
   429         -LIBTCL = -ltcl86
          429  +LIBTCL = -ltclstub86
   430    430   
   431    431   #### C Compile and options for use in building executables that
   432    432   #    will run on the target platform.  This is usually the same
   433    433   #    as BCC, unless you are cross-compiling.  This C compiler builds
   434    434   #    the finished binary for fossil.  The BCC compiler above is used
   435    435   #    for building intermediate code-generator tools.
   436    436   #
................................................................................
   460    460   
   461    461   # With HTTPS support
   462    462   ifdef FOSSIL_ENABLE_SSL
   463    463   TCC += -DFOSSIL_ENABLE_SSL=1
   464    464   RCC += -DFOSSIL_ENABLE_SSL=1
   465    465   endif
   466    466   
   467         -# With Tcl support (statically linked)
          467  +# With Tcl support
   468    468   ifdef FOSSIL_ENABLE_TCL
   469         -TCC += -DFOSSIL_ENABLE_TCL=1 -DSTATIC_BUILD
          469  +TCC += -DFOSSIL_ENABLE_TCL=1 -DUSE_TCL_STUBS
   470    470   RCC += -DFOSSIL_ENABLE_TCL=1
   471    471   endif
   472    472   
   473    473   # With JSON support
   474    474   ifdef FOSSIL_ENABLE_JSON
   475    475   TCC += -DFOSSIL_ENABLE_JSON=1
   476    476   RCC += -DFOSSIL_ENABLE_JSON=1

Changes to src/th_tcl.c.

    33     33   /*
    34     34   ** Workaround NRE-specific issue in Tcl_EvalObjCmd (SF bug #3399564) by using
    35     35   ** Tcl_EvalObjv instead of invoking the objProc directly.
    36     36    */
    37     37   #define USE_TCL_EVALOBJV   1
    38     38   #endif
    39     39   
           40  +#ifdef _WIN32
           41  +# include <windows.h>
           42  +#else
           43  +# include <dlfcn.h>
           44  +#endif
           45  +
    40     46   /*
    41     47   ** These macros are designed to reduce the redundant code required to marshal
    42     48   ** arguments from TH1 to Tcl.
    43     49    */
    44     50   #define USE_ARGV_TO_OBJV() \
    45     51     int objc;                \
    46     52     Tcl_Obj **objv;          \
................................................................................
   443    449     Th_Interp *interp,
   444    450     void *pContext
   445    451   ){
   446    452     struct TclContext *tclContext = (struct TclContext *)pContext;
   447    453     int argc;
   448    454     char **argv;
   449    455     char *argv0 = 0;
          456  +#ifdef USE_TCL_STUBS
          457  +#ifdef _WIN32
          458  +  WCHAR lib[] = L"tcl87.dll";
          459  +#define minver lib[4]
          460  +#define dlopen(a,b) (void *)LoadLibraryW(a);
          461  +#define dlsym(a,b) GetProcAddress((HANDLE)(a),b);
          462  +#else
          463  +#ifdef __CYGWIN__
          464  +  char lib[] = "libtcl8.7.dll";
          465  +#else
          466  +  char lib[] = "libtcl8.7.so";
          467  +#endif
          468  +#define minver lib[8]
          469  +#endif
          470  +  void *handle = NULL;
          471  +  void (*findExecutable)(const char *) = 0;
          472  +  Tcl_Interp *(*createInterp)() = 0;
          473  +#endif /* USE_TCL_STUBS */
   450    474     Tcl_Interp *tclInterp;
   451    475   
   452    476     if ( !tclContext ){
   453    477       Th_ErrorMessage(interp,
   454    478           "Invalid Tcl context", (const char *)"", 0);
   455    479       return TH_ERROR;
   456    480     }
................................................................................
   458    482       return TH_OK;
   459    483     }
   460    484     argc = tclContext->argc;
   461    485     argv = tclContext->argv;
   462    486     if( argc>0 && argv ){
   463    487       argv0 = argv[0];
   464    488     }
          489  +#ifdef USE_TCL_STUBS
          490  +  while( --minver>'3' ){
          491  +    handle = dlopen(lib, RTLD_NOW | RTLD_LOCAL);
          492  +    if( handle ) {
          493  +      const char *sym = "_Tcl_FindExecutable";
          494  +      findExecutable = (void (*)(const char *)) dlsym(handle, sym+1);
          495  +      if (!findExecutable)
          496  +        findExecutable = (void (*)(const char *)) dlsym(handle, sym);
          497  +      sym = "_Tcl_CreateInterp";
          498  +      createInterp = (Tcl_Interp * (*)(void)) dlsym(handle, sym+1);
          499  +      if (!createInterp)
          500  +        createInterp = (Tcl_Interp * (*)(void)) dlsym(handle, sym);
          501  +      break;
          502  +    }
          503  +  }
          504  +  if( !handle ){
          505  +    Th_ErrorMessage(interp,
          506  +        "Could not create Tcl interpreter", (const char *)"", 0);
          507  +    return TH_ERROR;
          508  +  }
          509  +#  undef Tcl_FindExecutable
          510  +#  define Tcl_FindExecutable findExecutable
          511  +#  undef Tcl_CreateInterp
          512  +#  define Tcl_CreateInterp createInterp
          513  +#endif /* USE_TCL_STUBS */
   465    514     Tcl_FindExecutable(argv0);
   466         -  tclInterp = tclContext->interp = Tcl_CreateInterp();
   467         -  if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
          515  +  tclInterp = Tcl_CreateInterp();
          516  +  if( !tclInterp || !Tcl_InitStubs(tclInterp, "8.4", 0)
          517  +      || Tcl_InterpDeleted(tclInterp) ){
   468    518       Th_ErrorMessage(interp,
   469    519           "Could not create Tcl interpreter", (const char *)"", 0);
   470    520       return TH_ERROR;
   471    521     }
          522  +  tclContext->interp = tclInterp;
   472    523     if( Tcl_Init(tclInterp)!=TCL_OK ){
   473    524       Th_ErrorMessage(interp,
   474    525           "Tcl initialization error:", Tcl_GetStringResult(tclInterp), -1);
   475    526       Tcl_DeleteInterp(tclInterp);
   476    527       tclContext->interp = tclInterp = 0;
   477    528       return TH_ERROR;
   478    529     }

Changes to win/Makefile.mingw.

    94     94   #    used if the FOSSIL_TCL_SOURCE macro is not defined.
    95     95   #
    96     96   TCLINCDIR = $(TCLDIR)/include
    97     97   TCLLIBDIR = $(TCLDIR)/lib
    98     98   
    99     99   #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
   100    100   #
   101         -LIBTCL = -ltcl86
          101  +LIBTCL = -ltclstub86
   102    102   
   103    103   #### C Compile and options for use in building executables that
   104    104   #    will run on the target platform.  This is usually the same
   105    105   #    as BCC, unless you are cross-compiling.  This C compiler builds
   106    106   #    the finished binary for fossil.  The BCC compiler above is used
   107    107   #    for building intermediate code-generator tools.
   108    108   #
................................................................................
   132    132   
   133    133   # With HTTPS support
   134    134   ifdef FOSSIL_ENABLE_SSL
   135    135   TCC += -DFOSSIL_ENABLE_SSL=1
   136    136   RCC += -DFOSSIL_ENABLE_SSL=1
   137    137   endif
   138    138   
   139         -# With Tcl support (statically linked)
          139  +# With Tcl support
   140    140   ifdef FOSSIL_ENABLE_TCL
   141         -TCC += -DFOSSIL_ENABLE_TCL=1 -DSTATIC_BUILD
          141  +TCC += -DFOSSIL_ENABLE_TCL=1 -DUSE_TCL_STUBS
   142    142   RCC += -DFOSSIL_ENABLE_TCL=1
   143    143   endif
   144    144   
   145    145   # With JSON support
   146    146   ifdef FOSSIL_ENABLE_JSON
   147    147   TCC += -DFOSSIL_ENABLE_JSON=1
   148    148   RCC += -DFOSSIL_ENABLE_JSON=1

Changes to win/Makefile.mingw.mistachkin.

    94     94   #    used if the FOSSIL_TCL_SOURCE macro is not defined.
    95     95   #
    96     96   TCLINCDIR = $(TCLDIR)/include
    97     97   TCLLIBDIR = $(TCLDIR)/lib
    98     98   
    99     99   #### Tcl: Which Tcl library do we want to use (8.4, 8.5, 8.6, etc)?
   100    100   #
   101         -LIBTCL = -ltcl86
          101  +LIBTCL = -ltclstub86
   102    102   
   103    103   #### C Compile and options for use in building executables that
   104    104   #    will run on the target platform.  This is usually the same
   105    105   #    as BCC, unless you are cross-compiling.  This C compiler builds
   106    106   #    the finished binary for fossil.  The BCC compiler above is used
   107    107   #    for building intermediate code-generator tools.
   108    108   #
................................................................................
   132    132   
   133    133   # With HTTPS support
   134    134   ifdef FOSSIL_ENABLE_SSL
   135    135   TCC += -DFOSSIL_ENABLE_SSL=1
   136    136   RCC += -DFOSSIL_ENABLE_SSL=1
   137    137   endif
   138    138   
   139         -# With Tcl support (statically linked)
          139  +# With Tcl support
   140    140   ifdef FOSSIL_ENABLE_TCL
   141         -TCC += -DFOSSIL_ENABLE_TCL=1 -DSTATIC_BUILD
          141  +TCC += -DFOSSIL_ENABLE_TCL=1 -DUSE_TCL_STUBS
   142    142   RCC += -DFOSSIL_ENABLE_TCL=1
   143    143   endif
   144    144   
   145    145   # With JSON support
   146    146   ifdef FOSSIL_ENABLE_JSON
   147    147   TCC += -DFOSSIL_ENABLE_JSON=1
   148    148   RCC += -DFOSSIL_ENABLE_JSON=1