summaryrefslogtreecommitdiff
path: root/otherlibs/labltk/support/cltkTimer.c
blob: 2b8ec0e1bda1913d38e949b0d58ea6a816ee0d5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <tcl.h>
#include <tk.h>
#include <caml/mlvalues.h>
#include "camltk.h"


/* Basically the same thing as FileProc */
void TimerProc (clientdata)
     ClientData clientdata;
{
  callback2(*handler_code,Val_long(clientdata),Val_int(0));
}

value camltk_add_timer(milli, cbid) /* ML */
     value milli;
     value cbid;
{
  CheckInit();
  /* look at tkEvent.c , Tk_Token is an int */ 
  return (value)Tcl_CreateTimerHandler(Int_val(milli), TimerProc, 
				       (ClientData) (Long_val(cbid)));
}

value camltk_rem_timer(token) /* ML */
     value token;
{
  Tcl_DeleteTimerHandler((Tcl_TimerToken) token);
  return Val_unit;
}