blob: 9e6cb15c04e9c839889f37bc76948d357dd9d9d6 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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;
}
|