summaryrefslogtreecommitdiffstats
path: root/byterun/rotatecursor.c
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>1996-11-02 18:00:46 +0000
committerDamien Doligez <damien.doligez-inria.fr>1996-11-02 18:00:46 +0000
commit312cfbddfd988fb1b74299ff90e19b1b6ef30043 (patch)
tree54250fbbfc3056c052edb0c680a6171c2f690beb /byterun/rotatecursor.c
parent1aaf9a118aef383c39ff7424ae8814c836bda771 (diff)
Portage Mac/MPW:
Makefile: clean: eviter d'effacer interp.a config.h: #include pour Mac fix_code.c: version sans switch interp.c: ajout action periodique, suppression de quelques ++ inutiles main.c: initialisation action periodique major_gc.c: return 0 pour calmer le compilo C misc.c: ui_gc_message et ui_fatal_error -> ui_print_stderr signals.h: include "mlvalues.h" startup.c: donne la chaine pour uncaught exception Failure sys.c: diverses modifs Mac terminfo.c: return Val_unit pour calmer le compilo C git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1134 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/rotatecursor.c')
-rw-r--r--byterun/rotatecursor.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/byterun/rotatecursor.c b/byterun/rotatecursor.c
new file mode 100644
index 000000000..9e6cb15c0
--- /dev/null
+++ b/byterun/rotatecursor.c
@@ -0,0 +1,78 @@
+/***********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Damien Doligez, projet Para, INRIA Rocquencourt */
+/* */
+/* Copyright 1996 Institut National de Recherche en Informatique et */
+/* Automatique. Distributed only by permission. */
+/* */
+/***********************************************************************/
+
+/* $Id$ */
+
+/* Cursor rotation for MPW tools (ocamlrun and ocamlyacc) */
+
+#include <CursorCtl.h>
+#include <stdlib.h>
+#include <Timer.h>
+#include <Types.h>
+
+#include "rotatecursor.h"
+
+typedef struct {
+ TMTask t;
+ int volatile *p1;
+ int volatile *p2;
+} Xtmtask;
+
+static Xtmtask mytmtask;
+
+
+#if GENERATINGCFM
+
+static void mytimerproc (Xtmtask *p)
+{
+ if (p->p1 != NULL && *(p->p1) == 0) *(p->p1) = 1;
+ if (p->p2 != NULL && *(p->p2) == 0) *(p->p2) = 1;
+}
+
+#else
+
+extern Xtmtask *getparam() ONEWORDINLINE(0x2009); /* MOVE.L A1, D0 */
+
+static void mytimerproc (void)
+{
+ register Xtmtask *p = getparam ();
+
+ if (p->p1 != NULL && *(p->p1) == 0) *(p->p1) = 1;
+ if (p->p2 != NULL && *(p->p2) == 0) *(p->p2) = 1;
+}
+
+#endif /* GENERATINGCFM */
+
+
+static void remove_task (void)
+{
+ RmvTime ((QElemPtr) &mytmtask);
+}
+
+void rotatecursor_init (int volatile *p1, int volatile *p2)
+{
+ InitCursorCtl (NULL);
+ mytmtask.t.tmAddr = NewTimerProc (mytimerproc);
+ mytmtask.t.tmWakeUp = 0;
+ mytmtask.t.tmReserved = 0;
+ mytmtask.p1 = p1;
+ mytmtask.p2 = p2;
+ InsTime ((QElemPtr) &mytmtask);
+ PrimeTime ((QElemPtr) &mytmtask, 1);
+ atexit (remove_task);
+}
+
+int rotatecursor_action (int direction)
+{
+ PrimeTime ((QElemPtr) &mytmtask, 62); /* 16 Hz */
+ RotateCursor (direction ? 32 : -32);
+ return 0;
+}