1999-12-16 04:25:11 -08:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Objective Caml LablTk library */
|
|
|
|
/* */
|
|
|
|
/* Francois Rouaix, Francois Pessaux and Jun Furuse */
|
|
|
|
/* projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* Jacques Garrigue, Kyoto University RIMS */
|
|
|
|
/* */
|
|
|
|
/* Copyright 1999 Institut National de Recherche en Informatique et */
|
|
|
|
/* en Automatique and Kyoto University. All rights reserved. */
|
|
|
|
/* This file is distributed under the terms of the GNU Library */
|
|
|
|
/* General Public License. */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1999-11-30 06:59:39 -08:00
|
|
|
#include <tcl.h>
|
|
|
|
#include <tk.h>
|
2000-04-17 01:55:44 -07:00
|
|
|
#include <mlvalues.h>
|
|
|
|
#include <callback.h>
|
1999-11-30 06:59:39 -08:00
|
|
|
#include "camltk.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Basically the same thing as FileProc */
|
2000-04-17 01:55:44 -07:00
|
|
|
void TimerProc (ClientData clientdata)
|
1999-11-30 06:59:39 -08:00
|
|
|
{
|
|
|
|
callback2(*handler_code,Val_long(clientdata),Val_int(0));
|
|
|
|
}
|
|
|
|
|
2001-08-28 07:47:48 -07:00
|
|
|
CAMLprim value camltk_add_timer(value milli, value cbid)
|
1999-11-30 06:59:39 -08:00
|
|
|
{
|
|
|
|
CheckInit();
|
|
|
|
/* look at tkEvent.c , Tk_Token is an int */
|
2000-01-19 19:01:18 -08:00
|
|
|
return (Val_int(Tcl_CreateTimerHandler(Int_val(milli), TimerProc,
|
|
|
|
(ClientData) (Int_val(cbid)))));
|
1999-11-30 06:59:39 -08:00
|
|
|
}
|
|
|
|
|
2001-08-28 07:47:48 -07:00
|
|
|
CAMLprim value camltk_rem_timer(value token)
|
1999-11-30 06:59:39 -08:00
|
|
|
{
|
2000-01-19 19:01:18 -08:00
|
|
|
Tcl_DeleteTimerHandler((Tcl_TimerToken) Int_val(token));
|
1999-11-30 06:59:39 -08:00
|
|
|
return Val_unit;
|
|
|
|
}
|
|
|
|
|