diff options
Diffstat (limited to 'otherlibs/labltk/support')
-rw-r--r-- | otherlibs/labltk/support/camltk.h | 4 | ||||
-rw-r--r-- | otherlibs/labltk/support/cltkCaml.c | 6 | ||||
-rw-r--r-- | otherlibs/labltk/support/cltkDMain.c | 12 | ||||
-rw-r--r-- | otherlibs/labltk/support/cltkEval.c | 27 | ||||
-rw-r--r-- | otherlibs/labltk/support/cltkImg.c | 12 | ||||
-rw-r--r-- | otherlibs/labltk/support/cltkMain.c | 10 |
6 files changed, 37 insertions, 34 deletions
diff --git a/otherlibs/labltk/support/camltk.h b/otherlibs/labltk/support/camltk.h index deba33086..195b82334 100644 --- a/otherlibs/labltk/support/camltk.h +++ b/otherlibs/labltk/support/camltk.h @@ -32,14 +32,14 @@ extern char * caml_string_to_tcl( value ); /* cltkEval.c */ CAMLTKextern Tcl_Interp *cltclinterp; /* The Tcl interpretor */ -extern value copy_string_list(int argc, char ** argv); +extern value copy_string_list(int argc, char **argv); /* cltkCaml.c */ /* pointers to Caml values */ extern value *tkerror_exn; extern value *handler_code; extern int CamlCBCmd(ClientData clientdata, Tcl_Interp *interp, - int argc, char *argv[]); + int argc, CONST84 char *argv[]); CAMLTKextern void tk_error(char * errmsg) Noreturn; /* cltkMain.c */ diff --git a/otherlibs/labltk/support/cltkCaml.c b/otherlibs/labltk/support/cltkCaml.c index 976c864ef..4bb65f418 100644 --- a/otherlibs/labltk/support/cltkCaml.c +++ b/otherlibs/labltk/support/cltkCaml.c @@ -28,7 +28,11 @@ value * tkerror_exn = NULL; value * handler_code = NULL; /* The Tcl command for evaluating callback in Caml */ +#if (TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION >= 4 || TK_MAJOR_VERSION > 8) +int CamlCBCmd(ClientData clientdata, Tcl_Interp *interp, int argc, CONST84 char **argv) +#else int CamlCBCmd(ClientData clientdata, Tcl_Interp *interp, int argc, char **argv) +#endif { CheckInit(); @@ -38,7 +42,7 @@ int CamlCBCmd(ClientData clientdata, Tcl_Interp *interp, int argc, char **argv) int id; if (Tcl_GetInt(interp, argv[1], &id) != TCL_OK) return TCL_ERROR; - callback2(*handler_code,Val_int(id),copy_string_list(argc - 2,&argv[2])); + callback2(*handler_code,Val_int(id),copy_string_list(argc - 2,(char **)&argv[2])); /* Never fails (Caml would have raised an exception) */ /* but result may have been set by callback */ return TCL_OK; diff --git a/otherlibs/labltk/support/cltkDMain.c b/otherlibs/labltk/support/cltkDMain.c index 7b2e59bc2..9272e8fc2 100644 --- a/otherlibs/labltk/support/cltkDMain.c +++ b/otherlibs/labltk/support/cltkDMain.c @@ -17,7 +17,7 @@ /* $Id$ */ #include <unistd.h> -#include <fcntl.h> +#include <fcntl.h> #include <tcl.h> #include <tk.h> #include "gc.h" @@ -34,7 +34,7 @@ #endif -/* +/* * Dealing with signals: when a signal handler is defined in Caml, * the actual execution of the signal handler upon reception of the * signal is delayed until we are sure we are out of the GC. @@ -48,7 +48,7 @@ int signal_events = 0; /* do we have a pending timer */ -void invoke_pending_caml_signals (clientdata) +void invoke_pending_caml_signals (clientdata) ClientData clientdata; { signal_events = 0; @@ -203,7 +203,7 @@ int Caml_Init(interp) cltclinterp = interp; /* Create the camlcallback command */ Tcl_CreateCommand(cltclinterp, - CAMLCB, CamlCBCmd, + CAMLCB, CamlCBCmd, (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL); /* This is required by "unknown" and thus autoload */ @@ -220,7 +220,7 @@ int Caml_Init(interp) strcat(f, home); strcat(f, "/"); strcat(f, RCNAME); - if (0 == access(f,R_OK)) + if (0 == access(f,R_OK)) if (TCL_OK != Tcl_EvalFile(cltclinterp,f)) { stat_free(f); tk_error(cltclinterp->result); @@ -228,7 +228,7 @@ int Caml_Init(interp) stat_free(f); } } - + /* Initialisations from caml_main */ { int verbose_init = 0, diff --git a/otherlibs/labltk/support/cltkEval.c b/otherlibs/labltk/support/cltkEval.c index e7fbed879..168b9fe8f 100644 --- a/otherlibs/labltk/support/cltkEval.c +++ b/otherlibs/labltk/support/cltkEval.c @@ -63,7 +63,7 @@ CAMLprim value camltk_tcl_eval(value str) char *cmd = NULL; CheckInit(); - + /* Tcl_Eval may write to its argument, so we take a copy * If the evaluation raises a Caml exception, we have a space * leak @@ -83,8 +83,7 @@ CAMLprim value camltk_tcl_eval(value str) } } - -/* +/* * Calling Tcl from Caml * direct call, argument is TkArgs vect type TkArgs = @@ -94,8 +93,8 @@ CAMLprim value camltk_tcl_eval(value str) * NO PARSING, NO SUBSTITUTION */ -/* - * Compute the size of the argument (of type TkArgs). +/* + * Compute the size of the argument (of type TkArgs). * TkTokenList must be expanded, * TkQuote count for one. */ @@ -119,14 +118,14 @@ int argv_size(value v) } /* Fill a preallocated vector arguments, doing expansion and all. - * Assumes Tcl will + * Assumes Tcl will * not tamper with our strings * make copies if strings are "persistent" */ int fill_args (char **argv, int where, value v) { value l; - + switch (Tag_val(v)) { case 0: argv[where] = caml_string_to_tcl(Field(v,0)); /* must free by stat_free */ @@ -144,10 +143,10 @@ int fill_args (char **argv, int where, value v) fill_args(tmpargv,0,Field(v,0)); tmpargv[size] = NULL; merged = Tcl_Merge(size,tmpargv); - for(i = 0 ; i<size; i++){ stat_free(tmpargv[i]); } + for(i = 0; i<size; i++){ stat_free(tmpargv[i]); } stat_free((char *)tmpargv); /* must be freed by stat_free */ - argv[where] = (char*)stat_alloc(strlen(merged)+1); + argv[where] = (char*)stat_alloc(strlen(merged)+1); strcpy(argv[where], merged); Tcl_Free(merged); return (where + 1); @@ -169,7 +168,7 @@ CAMLprim value camltk_tcl_direct_eval(value v) CheckInit(); /* walk the array to compute final size for Tcl */ - for(i=0,size=0;i<Wosize_val(v);i++) + for(i=0, size=0; i<Wosize_val(v); i++) size += argv_size(Field(v,i)); /* +2: one slot for NULL @@ -180,11 +179,11 @@ CAMLprim value camltk_tcl_direct_eval(value v) /* Copy -- argv[i] must be freed by stat_free */ { int where; - for(i=0, where=0;i<Wosize_val(v);i++){ + for(i=0, where=0; i<Wosize_val(v); i++){ where = fill_args(argv,where,Field(v,i)); } if( size != where ){ tk_error("fill_args error!!! Call the CamlTk maintainer!"); } - for(i=0; i<where; i++){ allocated[i] = argv[i]; } + for(i=0; i<where; i++){ allocated[i] = argv[i]; } argv[size] = NULL; argv[size + 1] = NULL; } @@ -221,7 +220,7 @@ CAMLprim value camltk_tcl_direct_eval(value v) result = (*info.proc)(info.clientData,cltclinterp,size+1,argv); } else { /* ah, it isn't there at all */ result = TCL_ERROR; - Tcl_AppendResult(cltclinterp, "Unknown command \"", + Tcl_AppendResult(cltclinterp, "Unknown command \"", argv[0], "\"", NULL); } } @@ -232,7 +231,7 @@ CAMLprim value camltk_tcl_direct_eval(value v) } stat_free((char *)argv); stat_free((char *)allocated); - + switch (result) { case TCL_OK: return tcl_string_to_caml (cltclinterp->result); diff --git a/otherlibs/labltk/support/cltkImg.c b/otherlibs/labltk/support/cltkImg.c index 9bda0d9e2..d8d5dd3d0 100644 --- a/otherlibs/labltk/support/cltkImg.c +++ b/otherlibs/labltk/support/cltkImg.c @@ -38,10 +38,10 @@ CAMLprim value camltk_getimgdata (value imgname) /* ML */ int code,size; #if (TK_MAJOR_VERSION < 8) - if (NULL == (ph = Tk_FindPhoto(String_val(imgname)))) + if (NULL == (ph = Tk_FindPhoto(String_val(imgname)))) tk_error("no such image"); #else - if (NULL == (ph = Tk_FindPhoto(cltclinterp, String_val(imgname)))) + if (NULL == (ph = Tk_FindPhoto(cltclinterp, String_val(imgname)))) tk_error("no such image"); #endif @@ -76,17 +76,17 @@ CAMLprim value camltk_getimgdata (value imgname) /* ML */ } CAMLprim void -camltk_setimgdata_native (value imgname, value pixmap, value x, value y, +camltk_setimgdata_native (value imgname, value pixmap, value x, value y, value w, value h) /* ML */ { Tk_PhotoHandle ph; Tk_PhotoImageBlock pib; #if (TK_MAJOR_VERSION < 8) - if (NULL == (ph = Tk_FindPhoto(String_val(imgname)))) + if (NULL == (ph = Tk_FindPhoto(String_val(imgname)))) tk_error("no such image"); #else - if (NULL == (ph = Tk_FindPhoto(cltclinterp, String_val(imgname)))) + if (NULL == (ph = Tk_FindPhoto(cltclinterp, String_val(imgname)))) tk_error("no such image"); #endif @@ -106,7 +106,7 @@ ph,&pib,Int_val(x),Int_val(y),Int_val(w),Int_val(h) #if (TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION >= 4 || TK_MAJOR_VERSION > 8) , TK_PHOTO_COMPOSITE_SET #endif - ); + ); } CAMLprim void camltk_setimgdata_bytecode(argv,argn) diff --git a/otherlibs/labltk/support/cltkMain.c b/otherlibs/labltk/support/cltkMain.c index 655da151b..2853b3856 100644 --- a/otherlibs/labltk/support/cltkMain.c +++ b/otherlibs/labltk/support/cltkMain.c @@ -34,7 +34,7 @@ #define R_OK 4 #endif -/* +/* * Dealing with signals: when a signal handler is defined in Caml, * the actual execution of the signal handler upon reception of the * signal is delayed until we are sure we are out of the GC. @@ -122,7 +122,7 @@ CAMLprim value camltk_opentk(value argv) tmp = Field(tmp, 1); i++; } - + sprintf( argcstr, "%d", argc ); Tcl_SetVar(cltclinterp, "argc", argcstr, TCL_GLOBAL_ONLY); args = Tcl_Merge(argc, tkargv); /* args must be freed by Tcl_Free */ @@ -139,13 +139,13 @@ CAMLprim value camltk_opentk(value argv) if (NULL == cltk_mainWindow) tk_error(cltclinterp->result); - + Tk_GeometryRequest(cltk_mainWindow,200,200); } /* Create the camlcallback command */ Tcl_CreateCommand(cltclinterp, - CAMLCB, CamlCBCmd, + CAMLCB, CamlCBCmd, (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL); /* This is required by "unknown" and thus autoload */ @@ -162,7 +162,7 @@ CAMLprim value camltk_opentk(value argv) strcat(f, home); strcat(f, "/"); strcat(f, RCNAME); - if (0 == access(f,R_OK)) + if (0 == access(f,R_OK)) if (TCL_OK != Tcl_EvalFile(cltclinterp,f)) { stat_free(f); tk_error(cltclinterp->result); |