Changeset 4630

Show
Ignore:
Timestamp:
02/20/10 02:16:13 (4 years ago)
Author:
douglask
Message:

Startup performance boost by providing a cutdown tclInit procedure which doesn't look through all parent folders of vic.exe to find the Tcl files.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vic/branches/mpeg4/Tcl.cpp

    r4591 r4630  
    4545#ifdef USE_ZVFS 
    4646#include "zvfs.h" 
     47extern "C" { 
     48        char *TclSetPreInitScript(char *string); 
     49} 
    4750#endif 
    4851 
     
    7578        Tcl_SetVar(tcl, "auto_path", "/zvfs/tcl /zvfs/tk /zvfs/vic", TCL_GLOBAL_ONLY); 
    7679        Tcl_SetVar(tcl, "tcl_libPath", "/zvfs/tcl /zvfs/tk /zvfs/vic", TCL_GLOBAL_ONLY); 
     80        TclSetPreInitScript("\n" 
     81"proc tclInit {} {\n" 
     82"  global tcl_libPath tcl_library env\n" 
     83"  rename tclInit {}\n" 
     84"  set tcl_library [set env(TCL_LIBRARY)]\n" 
     85"  set tclfile [file join $tcl_library init.tcl]\n" 
     86"  if {[file exists $tclfile]} {\n" 
     87"    set errors {}\n" 
     88"    if {[catch {uplevel #0 [list source $tclfile]} msg opts]} {\n" 
     89"      append errors \"$tclfile: $msg\n\"\n" 
     90"      append errors \"[dict get $opts -errorinfo]\n\"\n" 
     91"      set msg \"Can't find a usable init.tcl in the following location: \n\"\n" 
     92"      append msg \"$errors\n\n\"\n" 
     93"      append msg \"This probably means that VIC wasn't built properly.\n\"\n" 
     94"      error $msg\n" 
     95"    }\n" 
     96"  }\n" 
     97"}\n" 
     98"tclInit"); 
    7799#endif 
    78100        //Tk_InitConsoleChannels(tcl);