"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "root/cint/cint/lib/WildCard/README" of archive root_v5.20.00.win32gcc.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 lib/WildCard/README
    2 
    3  This directory includes WildCard interpreter, a marriage of C/C++ and Tcl/Tk
    4 interpreters.  Now it works on HP-UX, Linux and Windows-NT/9x. Windows-NT/9x
    5 version is in lib/wintcldl directory. This directory is dedicated to UNIX
    6 environment.
    7 
    8  This version should be good for Tcl4.1/Tk7.5 to Tcl/Tk8.3. Please report to
    9 the author if you find problems.
   10 
   11 What you need:=============================================================
   12 
   13  What you need to run WildCard are
   14 
   15     + libtcl.sl
   16     + libtk.sl
   17     + cint5.11.tar.gz  or later
   18     + C++ compiler desirable
   19 
   20 Compile: ==================================================================
   21 
   22  After you install cint 5.11.10 or later, you can do below.
   23 
   24  1) Edit 'setup' script
   25    Please set INCLD ad LIB variables properly. Especially library and include
   26    paths.
   27 
   28  2) Run setup
   29         $ sh ./setup
   30   After this , you can re-compile by 'make'.
   31 
   32 
   33 Hint and trouble shooting: ================================================
   34 
   35  1) Ignore warning message from cint
   36    When you do 'sh ./setup' , you will see warning messages as shown below.
   37   Ignore all of them. These are harmless.
   38 
   39     Warning: File "TCLTK.h" already loaded
   40     Warning: File "TKMACRO.h" already loaded
   41     Warning: File "TCLMACRO.h" already loaded
   42     Warning: Link requested for undefined class Tcl_Channel_ FILE: LINE:0
   43     Warning: Link requested for undefined class Tcl_Command_ FILE: LINE:0
   44                    .
   45                    .
   46 
   47  2) Linker error , undefined reference, add #pragma link statement in TCLTK.h
   48    If you have linker errors that there are undefined references or unresolved
   49   symbols, edit TCLTK.h and add '#pragma link off' statement around line 100.
   50   For example, if you get following linker error,
   51 
   52     G__c_wildc.o(.text+0xcb7f): undefined reference to `Tk_UpdatePointer'
   53 
   54   add following line to the TCLTK.h. 
   55 
   56     #pragma link off function Tk_UpdatePointer;
   57 
   58   This line must be enclosed by #ifdef __MAKECINT__ and #endif.
   59 
   60 What WildCard can do ======================================================
   61  WildCard has full functionality of CINT and Tcl/Tk interpreters. You can
   62 enjoy 100% compatibility from cint and wish in one environment. Take a look
   63 at wildc.wc and calc.wc examples. To start wildc interpreter, use following
   64 command.
   65 
   66    $ wildc wildc.wc
   67 
   68 To monitor what is going on
   69 
   70    $ wildc -T wildc.wc
   71 
   72 
   73 WildCard Commands ========================================================
   74 
   75 How to start WildCard:
   76 	WildCard interpreter can be started by 'wildc' command. You can give
   77 	mixed C/C++ and Tcl/Tk script. WildCard interpreter usually accepts
   78         source code with .wc extension.
   79 
   80     Example:
   81 	$ wildc grcalc.wc            # starts C/C++ interpreter
   82 
   83 
   84 How to debug WildC script:
   85         You can give -S, -s, -t, -T and -b debug option to the wildc. 
   86         Debugger works in the same way as CINT. You can set break point, 
   87         step through and trace your source code.
   88 
   89     Example:
   90         $ wildc -S grcalc.wc
   91 
   92         You MUST USE 'p WildCard_Exit()' to terminate process in the debug
   93         mode. Otherwise, behavior is not guaranteed.
   94 
   95     Example:
   96         wildc> p WildCard_Exit()
   97 
   98 
   99 In Tcl:
  100 
  101   ceval {C/C++ expression}
  102 	ceval can be used in Tcl/Tk script to evaluate C/C++ expression. 
  103 	Result is returned as form of string.
  104 
  105     Example:
  106 	ceval 1+2
  107 	ceval printf("abc\n");
  108 	button .b -text "button"
  109 	bind .b <Button-1> {ceval CallBack()}
  110 
  111 In C/C++:
  112 
  113   #pragma tcl <interp> <link variable list>
  114   #pragma endtcl
  115 	#pragma tcl statement starts Tcl/Tk interpreter. 
  116 	If it appears within a function, Tcl/Tk script will be evaluated 
  117 	when the function is executed.
  118 	If it appears in a global scope, Tcl/Tk script will be immediately 
  119 	evaluated. #pragma endtcl can be omitted in global scope. In this
  120 	case, WildCard_MainLoop() is implicitly called to start X11 event
  121 	loop.
  122 
  123     Example:
  124 	f() {
  125 	  #pragma tcl interp
  126 	    # tcl/tk commands evaluated when f() is called
  127 	  #pragma endtcl
  128 	}
  129 	#pragma tcl interp
  130 	  # tcl/tk commands evaluated when source code loading
  131 	#pragma endtcl
  132 	#pragma tcl interp
  133 	  # tcl/tk commands evaluated when source code loading 
  134 	  # and implicitly calls WildCard_MainLoop() because #pragma
  135 	  # endtcl is omitted.
  136 
  137 
  138 	A parameter <interp> must be a valid Tcl_Interp* object. A global
  139 	object 'interp' is preregistered in the WildCard environment for
  140 	user's convenience.
  141 	After the <interp> you can list up arbitrary number of C/C++ variables
  142 	to link to Tcl/Tk interpreters. Variables must be type of int, double
  143 	or char* and must be a simple object name. Variables are unlinked at
  144 	#pragma endtcl.
  145 
  146     Example:
  147         f(char *color) {
  148 	  static int i=0;
  149 	  #pragma tcl interp color i
  150 	    button -.b$i -text "Button Test" -bg $color
  151 	  #pragma endtcl
  152 	  ++i;
  153 	}
  154 
  155 
  156   WildCard_MainLoop();
  157   WildCard_Exit();
  158 	WildCard_MainLoop() and WildCard_Exit() are API function for the
  159 	WildCard interpreter. WildCard_MainLoop() starts X11 event loop
  160 	to get mouse and keyboard events. The events are handled by Tcl/Tk
  161 	interpreter.
  162 	WildCard_Exit() must be used to quit WildCard interpreter. exit()
  163 	will not work.
  164 
  165     Example:
  166         void DrawGraphics() {
  167 	  #pragma tcl interp
  168 	    button .b -text "Exit"
  169 	    bind .b <Button-1> {ceval Exit_CallBack()}
  170 	    pack .b
  171 	  #pragma endtcl
  172 	}
  173         void Exit_CallBack() { WildCard_Exit(); }
  174 	main() {
  175 	  DrawGraphics();
  176           WildCard_MainLoop();
  177 	}
  178 
  179   Tcl_xxx()
  180   Tk_xxx()
  181 	The WildCard interpreter embeds all of the Tcl/Tk methods as 
  182 	precompiled library. You can access Tcl/Tk intrinsics from
  183 	C/C++ interpreter. You don't need to use them in most of the cases.
  184 
  185     Example:
  186         int i; 
  187 	Tcl_LinkVar(interp,"i",(char*)(&i),TCL_LINK_INT);
  188 	    // parenthesis around (&i) is needed in WildCard.
  189 
  190