1
2
3
4
5
6
7
8
9
10
11
12
13
14if known context_asnc : endinput ; fi ;
15
16boolean context_asnc ; context_asnc := true ;
17
18
19
20
21
22
23
24
25
26
27
28numeric mfun_sync_count ;
29numeric mfun_sync_page ;
30
31vardef StartSync(expr n) =
32 numeric CurrentSyncClass ; CurrentSyncClass := n ;
33 numeric SyncHOffset ; SyncHOffset := 0 ;
34 numeric SyncVOffset ; SyncVOffset := 0 ;
35 numeric SyncWidth ; SyncWidth := 0 ;
36 path SyncPaths[] ;
37 numeric SyncTasks[] ;
38 numeric SyncKinds[] ;
39
40 mfun_sync_page := RealPageNumber ;
41 mfun_sync_count := 0 ;
42enddef ;
43
44def StopSync =
45
46enddef ;
47
48vardef CollectSyncDataPage =
49 mfun_sync_count := lua.mp.sync_collect(CurrentSyncClass,mfun_sync_page) ;
50enddef ;
51
52vardef CollectSyncDataRegion(expr region) =
53 mfun_sync_count := lua.mp.sync_collect(CurrentSyncClass,mfun_sync_page,region) ;
54enddef ;
55
56vardef MakeSyncPaths =
57 if mfun_sync_count > 0 :
58 save k, t, b ;
59 save l ; l := SyncHOffset ;
60 save r ; r := SyncHOffset SyncWidth ;
61 save y ; y := lua.mp.sync_get_y() SyncVOffset ;
62 for i=1 upto mfun_sync_count :
63 k := lua.mp.sync_get_kind(i) ;
64 t := lua.mp.sync_get_top(i) y ;
65 b := lua.mp.sync_get_bottom(i) y ;
66 SyncPaths[i] = ((l,t) -- (r,t) -- (r,b) -- (l,b) -- cycle) ;
67 SyncTasks[i] = lua.mp.sync_get_task(i) ;
68 SyncKinds[i] = k ;
69 endfor ;
70 fi ;
71enddef ;
72
73
74
75vardef ExtendSyncPaths =
76 mfun_sync_count := lua.mp.sync_extend() ;
77enddef ;
78
79
80
81vardef PruneSyncPaths =
82 mfun_sync_count := lua.mp.sync_prune() ;
83enddef ;
84
85
86
87vardef CollapseSyncPaths =
88 mfun_sync_count := lua.mp.sync_collapse() ;
89enddef ;
90
91def SetSyncColor(expr n, i, c) =
92 lua.mp.sync_set_color(n,i,c) ;
93enddef ;
94
95vardef TheSyncColor(expr n, i) =
96 lua.mp.sync_get_color(n,i)
97enddef ;
98
99vardef SyncPathColor(expr i) =
100 lua.mp.sync_get_color(CurrentSyncClass,SyncTasks[i])
101enddef ;
102
103def DrawSyncPaths =
104 for i=1 upto NOfSyncPaths :
105 draw SyncPaths[i] withcolor SyncPathColor(i) ;
106 endfor ;
107enddef ;
108
109def FillSyncPaths =
110 for i=1 upto NOfSyncPaths :
111 fill SyncPaths[i] withcolor SyncPathColor(i) ;
112 endfor ;
113enddef ;
114
115vardef NOfSyncPaths =
116 mfun_sync_count
117enddef ;
118 |