diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2000-01-20 03:01:18 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2000-01-20 03:01:18 +0000 |
commit | 7ad04d651d11c14ea85310d4980651d61add2da8 (patch) | |
tree | 58084c94199318afea2ada35b0fac17c2de27342 /otherlibs/labltk/support/cltkEval.c | |
parent | a928f5cd699efe6c46d15958572848ce90d44478 (diff) |
synchronize with bazar-ocaml/camltk41
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2761 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/labltk/support/cltkEval.c')
-rw-r--r-- | otherlibs/labltk/support/cltkEval.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/otherlibs/labltk/support/cltkEval.c b/otherlibs/labltk/support/cltkEval.c index ff9eb5702..5d1efa9df 100644 --- a/otherlibs/labltk/support/cltkEval.c +++ b/otherlibs/labltk/support/cltkEval.c @@ -54,7 +54,8 @@ value copy_string_list(argc, argv) /* * Calling Tcl from Caml - * this version works on an arbitrary Tcl command + * this version works on an arbitrary Tcl command, + * and does parsing and substitution */ value camltk_tcl_eval(str) /* ML */ value str; @@ -206,7 +207,29 @@ value v; /* Eval */ Tcl_ResetResult(cltclinterp); if (Tcl_GetCommandInfo(cltclinterp,argv[0],&info)) { /* command found */ +#if (TCL_MAJOR_VERSION >= 8) + /* info.proc might be a NULL pointer + * We should probably attempt an Obj invocation, but the following quick + * hack is easier. + */ + if (info.proc == NULL) { + Tcl_DString buf; + char *string; + Tcl_DStringInit(&buf); + Tcl_DStringAppend(&buf, argv[0], -1); + for (i=1; i<size; i++) { + Tcl_DStringAppend(&buf, " ", -1); + Tcl_DStringAppend(&buf, argv[i], -1); + } + // fprintf(stderr,"80 compat: %s\n", argv[0]); + result = Tcl_Eval(cltclinterp, Tcl_DStringValue(&buf)); + Tcl_DStringFree(&buf); + } + else + result = (*info.proc)(info.clientData,cltclinterp,size,argv); +#else result = (*info.proc)(info.clientData,cltclinterp,size,argv); +#endif } else {/* implement the autoload stuff */ if (Tcl_GetCommandInfo(cltclinterp,"unknown",&info)) { /* unknown found */ for (i = size; i >= 0; i--) |