summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--otherlibs/labltk/support/.depend4
-rw-r--r--otherlibs/labltk/support/Makefile6
-rw-r--r--otherlibs/labltk/support/Makefile.nt6
-rw-r--r--otherlibs/labltk/support/camltk.h15
-rw-r--r--otherlibs/labltk/support/cltkCaml.c21
-rw-r--r--otherlibs/labltk/support/cltkEval.c30
-rw-r--r--otherlibs/labltk/support/cltkEvent.c8
-rw-r--r--otherlibs/labltk/support/cltkFile.c3
-rw-r--r--otherlibs/labltk/support/cltkMain.c13
-rw-r--r--otherlibs/labltk/support/cltkMisc.c11
-rw-r--r--otherlibs/labltk/support/cltkTimer.c13
-rw-r--r--otherlibs/labltk/support/cltkVar.c33
-rw-r--r--otherlibs/labltk/support/cltkWait.c22
13 files changed, 84 insertions, 101 deletions
diff --git a/otherlibs/labltk/support/.depend b/otherlibs/labltk/support/.depend
index 8a6335ac3..8c7b959bf 100644
--- a/otherlibs/labltk/support/.depend
+++ b/otherlibs/labltk/support/.depend
@@ -1,11 +1,11 @@
protocol.cmi: widget.cmi
textvariable.cmi: protocol.cmi widget.cmi
-coerce.cmo: widget.cmi
-coerce.cmx: widget.cmx
fileevent.cmo: protocol.cmi fileevent.cmi
fileevent.cmx: protocol.cmx fileevent.cmi
protocol.cmo: widget.cmi protocol.cmi
protocol.cmx: widget.cmx protocol.cmi
+slave.cmo: widget.cmi
+slave.cmx: widget.cmx
support.cmo: support.cmi
support.cmx: support.cmi
textvariable.cmo: protocol.cmi widget.cmi textvariable.cmi
diff --git a/otherlibs/labltk/support/Makefile b/otherlibs/labltk/support/Makefile
index d34f18373..3491399dd 100644
--- a/otherlibs/labltk/support/Makefile
+++ b/otherlibs/labltk/support/Makefile
@@ -11,7 +11,7 @@ opt: support.cmx widget.cmx protocol.cmx \
COBJS=cltkCaml.o cltkEval.o cltkEvent.o cltkFile.o cltkMain.o \
cltkMisc.o cltkTimer.o cltkVar.o cltkWait.o
-CCFLAGS=-ccopt "$(TK_DEFS) $(X11_INCLUDES)"
+CCFLAGS=-I../../../byterun $(TK_DEFS) $(X11_INCLUDES)
COMPFLAGS=-I $(OTHERS)/unix
@@ -47,11 +47,11 @@ clean :
$(CAMLOPT) -c $(COMPFLAGS) $<
.c.o:
- $(LABLCOMP) $(CCFLAGS) $<
+ $(BYTECC) $(BYTECCCOMPOPTS) $(CCFLAGS) -c $<
depend:
$(LABLDEP) *.mli *.ml > .depend
-$(COBJS): $(TOPDIR)/config/Makefile
+$(COBJS): $(TOPDIR)/config/Makefile camltk.h
include .depend
diff --git a/otherlibs/labltk/support/Makefile.nt b/otherlibs/labltk/support/Makefile.nt
index 04675302e..01699a785 100644
--- a/otherlibs/labltk/support/Makefile.nt
+++ b/otherlibs/labltk/support/Makefile.nt
@@ -11,7 +11,7 @@ opt: support.cmx widget.cmx protocol.cmx \
COBJS=cltkCaml.obj cltkEval.obj cltkEvent.obj cltkFile.obj cltkMain.obj \
cltkMisc.obj cltkTimer.obj cltkVar.obj cltkWait.obj
-CCFLAGS=-ccopt "/Zi $(TK_DEFS)"
+CCFLAGS=-I..\..\..\byterun /Zi $(TK_DEFS)
COMPFLAGS=-I $(OTHERS)/win32unix
@@ -46,9 +46,11 @@ clean :
$(CAMLOPT) -c $(COMPFLAGS) $<
.c.obj:
- $(LABLCOMP) $(CCFLAGS) $<
+ $(BYTECC) $(BYTECCCOMPOPTS) $(CCFLAGS) -c $<
depend:
$(LABLDEP) *.mli *.ml > .depend
+$(COBJS): camltk.h
+
!include .depend
diff --git a/otherlibs/labltk/support/camltk.h b/otherlibs/labltk/support/camltk.h
index 301d7257d..1111bc7c8 100644
--- a/otherlibs/labltk/support/camltk.h
+++ b/otherlibs/labltk/support/camltk.h
@@ -15,22 +15,25 @@
/* $Id$ */
+/* cltkMisc.c */
+/* copy a Caml string to the C heap. Must be deallocated with stat_free */
+extern char *string_to_c(value s);
+
/* cltkEval.c */
extern Tcl_Interp *cltclinterp; /* The Tcl interpretor */
-
-/* copy a Caml string to the C heap. Must be deallocated with stat_free */
-char *string_to_c();
+extern value copy_string_list(int argc, char ** argv);
/* cltkCaml.c */
/* pointers to Caml values */
extern value *tkerror_exn;
extern value *handler_code;
-int CamlCBCmd();
-void tk_error();
+extern int CamlCBCmd(ClientData clientdata, Tcl_Interp *interp,
+ int argc, char *argv[]);
+extern void tk_error(char * errmsg) Noreturn;
/* cltkMain.c */
extern int signal_events;
-void invoke_pending_caml_signals();
+extern void invoke_pending_caml_signals(ClientData clientdata);
extern Tk_Window cltk_mainWindow;
extern int cltk_slave_mode;
diff --git a/otherlibs/labltk/support/cltkCaml.c b/otherlibs/labltk/support/cltkCaml.c
index ad84ab156..003b9a541 100644
--- a/otherlibs/labltk/support/cltkCaml.c
+++ b/otherlibs/labltk/support/cltkCaml.c
@@ -17,19 +17,17 @@
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
-#include <caml/callback.h>
+#include <mlvalues.h>
+#include <alloc.h>
+#include <callback.h>
+#include <fail.h>
#include "camltk.h"
value * tkerror_exn = NULL;
value * handler_code = NULL;
/* The Tcl command for evaluating callback in Caml */
-int CamlCBCmd(clientdata, interp, argc, argv)
- ClientData clientdata;
- Tcl_Interp *interp;
- int argc;
- char *argv[];
+int CamlCBCmd(ClientData clientdata, Tcl_Interp *interp, int argc, char **argv)
{
CheckInit();
@@ -53,8 +51,7 @@ int CamlCBCmd(clientdata, interp, argc, argv)
* using the following. TCL_VOLATILE ensures that Tcl will make
* a copy of the string
*/
-value camltk_return (v) /* ML */
- value v;
+value camltk_return (value v) /* ML */
{
CheckInit();
@@ -63,8 +60,7 @@ value camltk_return (v) /* ML */
}
/* Note: raise_with_string WILL copy the error message */
-void tk_error(errmsg)
- char *errmsg;
+void tk_error(char *errmsg)
{
raise_with_string(*tkerror_exn, errmsg);
}
@@ -75,8 +71,7 @@ void tk_error(errmsg)
takes place during loading of the protocol module
*/
-value camltk_init(v) /* ML */
- value v;
+value camltk_init(value v) /* ML */
{
/* Initialize the Caml pointers */
if (tkerror_exn == NULL)
diff --git a/otherlibs/labltk/support/cltkEval.c b/otherlibs/labltk/support/cltkEval.c
index 5d1efa9df..ddaea5303 100644
--- a/otherlibs/labltk/support/cltkEval.c
+++ b/otherlibs/labltk/support/cltkEval.c
@@ -19,9 +19,9 @@
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
-#include <caml/alloc.h>
-#include <caml/memory.h>
+#include <mlvalues.h>
+#include <alloc.h>
+#include <memory.h>
#ifdef HAS_UNISTD
#include <unistd.h>
#endif
@@ -31,9 +31,7 @@
Tcl_Interp *cltclinterp = NULL;
/* Copy a list of strings from the C heap to Caml */
-value copy_string_list(argc, argv)
- int argc;
- char ** argv;
+value copy_string_list(int argc, char **argv)
{
value res;
int i;
@@ -57,8 +55,7 @@ value copy_string_list(argc, argv)
* this version works on an arbitrary Tcl command,
* and does parsing and substitution
*/
-value camltk_tcl_eval(str) /* ML */
-value str;
+value camltk_tcl_eval(value str) /* ML */
{
int code;
char *cmd = NULL;
@@ -100,8 +97,7 @@ value str;
* TkTokenList must be expanded,
* TkQuote count for one.
*/
-int argv_size(v)
-value v;
+int argv_size(value v)
{
switch (Tag_val(v)) {
case 0: /* TkToken */
@@ -115,6 +111,9 @@ value v;
}
case 2: /* TkQuote */
return 1;
+ default: /* should not happen */
+ Assert(0);
+ return 0;
}
}
@@ -134,10 +133,7 @@ static char *quotedargv[16];
* not tamper with our strings
* make copies if strings are "persistent"
*/
-int fill_args (argv, where, v)
-char ** argv;
-int where;
-value v;
+int fill_args (char **argv, int where, value v)
{
switch (Tag_val(v)) {
case 0:
@@ -164,12 +160,14 @@ value v;
stat_free((char *)tmpargv);
return (where + 1);
}
+ default: /* should not happen */
+ Assert(0);
+ return 0;
}
}
/* v is an array of TkArg */
-value camltk_tcl_direct_eval(v) /* ML */
-value v;
+value camltk_tcl_direct_eval(value v) /* ML */
{
int i;
int size; /* size of argv */
diff --git a/otherlibs/labltk/support/cltkEvent.c b/otherlibs/labltk/support/cltkEvent.c
index 30bc64e87..fecb4244a 100644
--- a/otherlibs/labltk/support/cltkEvent.c
+++ b/otherlibs/labltk/support/cltkEvent.c
@@ -17,10 +17,11 @@
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
+#include <mlvalues.h>
+#include <alloc.h>
#include "camltk.h"
-value camltk_tk_mainloop() /* ML */
+value camltk_tk_mainloop(void) /* ML */
{
CheckInit();
@@ -42,8 +43,7 @@ static int event_flag_table[] = {
TK_ALL_EVENTS
};
-value camltk_dooneevent(flags) /* ML */
- value flags;
+value camltk_dooneevent(value flags) /* ML */
{
int ret;
diff --git a/otherlibs/labltk/support/cltkFile.c b/otherlibs/labltk/support/cltkFile.c
index 93f459076..183acb277 100644
--- a/otherlibs/labltk/support/cltkFile.c
+++ b/otherlibs/labltk/support/cltkFile.c
@@ -22,7 +22,8 @@
#endif
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
+#include <mlvalues.h>
+#include <callback.h>
#include "camltk.h"
/*
diff --git a/otherlibs/labltk/support/cltkMain.c b/otherlibs/labltk/support/cltkMain.c
index bd9ebe439..e5ae28c73 100644
--- a/otherlibs/labltk/support/cltkMain.c
+++ b/otherlibs/labltk/support/cltkMain.c
@@ -18,9 +18,10 @@
#include <string.h>
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
-#include <caml/callback.h>
+#include <mlvalues.h>
+#include <memory.h>
+#include <callback.h>
+#include <signals.h>
#ifdef HAS_UNISTD
#include <unistd.h> /* for R_OK */
#endif
@@ -44,8 +45,7 @@
int signal_events = 0; /* do we have a pending timer */
-void invoke_pending_caml_signals (clientdata)
- ClientData clientdata;
+void invoke_pending_caml_signals (ClientData clientdata)
{
signal_events = 0;
enter_blocking_section(); /* triggers signal handling */
@@ -64,8 +64,7 @@ Tk_Window cltk_mainWindow;
int cltk_slave_mode = 0;
/* Initialisation, based on tkMain.c */
-value camltk_opentk(display, name) /* ML */
- value display,name;
+value camltk_opentk(value display, value name) /* ML */
{
if (!cltk_slave_mode) {
/* Create an interpreter, dies if error */
diff --git a/otherlibs/labltk/support/cltkMisc.c b/otherlibs/labltk/support/cltkMisc.c
index 8bd6d323a..2640427a7 100644
--- a/otherlibs/labltk/support/cltkMisc.c
+++ b/otherlibs/labltk/support/cltkMisc.c
@@ -15,15 +15,15 @@
/* $Id$ */
+#include <string.h>
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
+#include <mlvalues.h>
+#include <memory.h>
#include "camltk.h"
/* Parsing results */
-value camltk_splitlist (v) /* ML */
- value v;
+value camltk_splitlist (value v) /* ML */
{
int argc;
char **argv;
@@ -46,8 +46,7 @@ value camltk_splitlist (v) /* ML */
}
/* Copy a Caml string to the C heap. Should deallocate with stat_free */
-char *string_to_c(s)
- value s;
+char *string_to_c(value s)
{
int l = string_length(s);
char *res = stat_alloc(l + 1);
diff --git a/otherlibs/labltk/support/cltkTimer.c b/otherlibs/labltk/support/cltkTimer.c
index 8de594314..a3d3d3cac 100644
--- a/otherlibs/labltk/support/cltkTimer.c
+++ b/otherlibs/labltk/support/cltkTimer.c
@@ -17,20 +17,18 @@
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
+#include <mlvalues.h>
+#include <callback.h>
#include "camltk.h"
/* Basically the same thing as FileProc */
-void TimerProc (clientdata)
- ClientData clientdata;
+void TimerProc (ClientData clientdata)
{
callback2(*handler_code,Val_long(clientdata),Val_int(0));
}
-value camltk_add_timer(milli, cbid) /* ML */
- value milli;
- value cbid;
+value camltk_add_timer(value milli, value cbid) /* ML */
{
CheckInit();
/* look at tkEvent.c , Tk_Token is an int */
@@ -38,8 +36,7 @@ value camltk_add_timer(milli, cbid) /* ML */
(ClientData) (Int_val(cbid)))));
}
-value camltk_rem_timer(token) /* ML */
- value token;
+value camltk_rem_timer(value token) /* ML */
{
Tcl_DeleteTimerHandler((Tcl_TimerToken) Int_val(token));
return Val_unit;
diff --git a/otherlibs/labltk/support/cltkVar.c b/otherlibs/labltk/support/cltkVar.c
index cf981ce6f..efca7621a 100644
--- a/otherlibs/labltk/support/cltkVar.c
+++ b/otherlibs/labltk/support/cltkVar.c
@@ -19,12 +19,13 @@
#include <string.h>
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
+#include <mlvalues.h>
+#include <memory.h>
+#include <alloc.h>
+#include <callback.h>
#include "camltk.h"
-value camltk_getvar(var) /* ML */
- value var;
+value camltk_getvar(value var) /* ML */
{
char *s;
char *stable_var = NULL;
@@ -41,9 +42,7 @@ value camltk_getvar(var) /* ML */
return(copy_string(s));
}
-value camltk_setvar(var,contents) /* ML */
- value var;
- value contents;
+value camltk_setvar(value var, value contents) /* ML */
{
char *s;
char *stable_var = NULL;
@@ -68,12 +67,12 @@ value camltk_setvar(var,contents) /* ML */
typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, char *part1, char *part2, int flags));
*/
-static char * tracevar(clientdata, interp, name1, name2, flags)
- ClientData clientdata;
- Tcl_Interp *interp; /* Interpreter containing variable. */
- char *name1; /* Name of variable. */
- char *name2; /* Second part of variable name. */
- int flags; /* Information about what happened. */
+static char * tracevar(ClientData clientdata, Tcl_Interp *interp,
+ char *name1, char *name2, int flags)
+ /* Interpreter containing variable. */
+ /* Name of variable. */
+ /* Second part of variable name. */
+ /* Information about what happened. */
{
Tcl_UntraceVar2(interp, name1, name2,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
@@ -83,9 +82,7 @@ static char * tracevar(clientdata, interp, name1, name2, flags)
}
/* Sets up a callback upon modification of a variable */
-value camltk_trace_var(var,cbid) /* ML */
- value var;
- value cbid;
+value camltk_trace_var(value var, value cbid) /* ML */
{
char *cvar = NULL;
@@ -106,9 +103,7 @@ value camltk_trace_var(var,cbid) /* ML */
return Val_unit;
}
-value camltk_untrace_var(var,cbid) /* ML */
- value var;
- value cbid;
+value camltk_untrace_var(value var, value cbid) /* ML */
{
char *cvar = NULL;
diff --git a/otherlibs/labltk/support/cltkWait.c b/otherlibs/labltk/support/cltkWait.c
index dbb5dc866..57028372f 100644
--- a/otherlibs/labltk/support/cltkWait.c
+++ b/otherlibs/labltk/support/cltkWait.c
@@ -17,8 +17,9 @@
#include <tcl.h>
#include <tk.h>
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
+#include <mlvalues.h>
+#include <memory.h>
+#include <callback.h>
#include "camltk.h"
/* The following are replacements for
@@ -42,9 +43,8 @@ struct WinCBData {
Tk_Window win;
};
-static void WaitVisibilityProc(clientData, eventPtr)
- ClientData clientData;
- XEvent *eventPtr; /* Information about event (not used). */
+static void WaitVisibilityProc(ClientData clientData, XEvent *eventPtr)
+ /* Information about event (not used). */
{
struct WinCBData *vis = clientData;
value cbid = Val_int(vis->cbid);
@@ -57,9 +57,7 @@ static void WaitVisibilityProc(clientData, eventPtr)
}
/* Sets up a callback upon Visibility of a window */
-value camltk_wait_vis(win,cbid) /* ML */
- value win;
- value cbid;
+value camltk_wait_vis(value win, value cbid) /* ML */
{
struct WinCBData *vis =
(struct WinCBData *)stat_alloc(sizeof(struct WinCBData));
@@ -74,9 +72,7 @@ value camltk_wait_vis(win,cbid) /* ML */
return Val_unit;
}
-static void WaitWindowProc(clientData, eventPtr)
- ClientData clientData;
- XEvent *eventPtr;
+static void WaitWindowProc(ClientData clientData, XEvent *eventPtr)
{
if (eventPtr->type == DestroyNotify) {
struct WinCBData *vis = clientData;
@@ -88,9 +84,7 @@ static void WaitWindowProc(clientData, eventPtr)
}
/* Sets up a callback upon window destruction */
-value camltk_wait_des(win,cbid) /* ML */
- value win;
- value cbid;
+value camltk_wait_des(value win, value cbid) /* ML */
{
struct WinCBData *vis =
(struct WinCBData *)stat_alloc(sizeof(struct WinCBData));