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
|
module CleanCocl;
import StdEnv;
import cache_variable;
import CoclSystemDependent,Clean2AppleEventHandler;
//1.3
from events import KeyDownEvent,HighLevelEvent,GetNextEvent,WaitNextEvent,Toolbox,RgnHandle;
//3.1
/*2.0
from events import KeyDownEvent,HighLevelEvent,GetNextEvent,WaitNextEvent,::Toolbox,::RgnHandle;
0.2*/
from predef import init_identifiers;
DeviceMask :== -31361; // HighLevelEventMask+UpdateMask+ActivMask+KeyboardMask+MouseMask+OsMask+1
Start world
# (symbol_table,world) = init_identifiers newHeap world;
| install_apple_event_handlers==0 && store_state (empty_cache symbol_table)<>0
= event_loop world;
= world;
{}{
event_loop world
// # (b,what,message,when,position1,position2,modifiers,tb) = GetNextEvent DeviceMask 0;
# (b,what,message,when,position1,position2,modifiers,tb) = WaitNextEvent (-1)/*DeviceMask*/ (-1) 0 0;
| what==KeyDownEvent
= world;
| what==HighLevelEvent
# event = (b,what,message,when,position1,position2,modifiers);
# ((ok,quit),world) = accFiles handle_apple_event world;
with {
handle_apple_event :: !*Files -> (!(!Bool,!Bool),!*Files);
handle_apple_event files
# (ok,quit,files) = HandleAppleEvent event script_handler files;
= ((ok,quit),files);
}
| quit
= world;
= event_loop world;
= event_loop world;
}
/*
import deltaEventIO, deltaIOState
import CoclSystemDependent
Don`tCareId
:== 0
Start :: !*World -> *World
Start world
# (_, world)
= StartIO [menus : SystemDependentDevices] 0 SystemDependentInitialIO world
with
menus
= MenuSystem [file]
file
= PullDownMenu Don`tCareId "File" Able
[MenuItem Don`tCareId "Quit" (Key 'Q') Able Quit]
= world
Quit :: *s (IOState *s) -> (*s, IOState *s)
Quit s io
= (s, QuitIO io)
*/
|