/[james]/archive/wimplibs/Object/2
ViewVC logotype

Contents of /archive/wimplibs/Object/2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Thu Sep 25 18:54:17 2003 UTC (21 years, 1 month ago) by james
File size: 3396 byte(s)
Initial import.

1 REM > JLibraries:Object.2
2 REM © James Bursa, 1997
3
4 REM JB 16 Nov 1997 created
5 REM JB 29 Nov 1997 sets <task$Objects>
6 REM JB 06 Dec 1997 optimised to grab memory in chunks of 16 objects
7 REM JB 07 Dec 1997 speeded up FNObject_Hand by reversing search
8
9 REM Object types
10 REM ~~~~~~~~~~~~
11 REM 0 windows
12 REM 1 icons
13 REM 2 menus
14 REM 3 menu items
15 REM 4 named heap blocks
16 REM 5 messages files
17 REM 6 sprite areas
18
19
20 DEF PROCObject_Init
21 LOCAL Task_ObjsB%
22
23 Task_Objs% = FNHeap_Alloc(8 + 24 * 16)
24 IF Task_Objs% = 0 THEN ERROR Erro_Memo%, ""
25 Task_ObjsB% = !Task_Objs%
26
27 Task_ObjsB%!00 = 0
28 Task_ObjsB%!04 = 16
29
30 IF Task_ThrowBack% THEN
31 @% = "+g20.20"
32 OSCLI"SetEval " + Task_Name$ + "$Objects " + STR$Task_Objs%
33 OSCLI"SetEval " + Task_Name$ + "$Handle " + STR$Task_Hand%
34 ENDIF
35 ENDPROC
36
37 REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
38
39 DEF PROCObject_Add(Type%, Hand%, Word%, Name$)
40 LOCAL Objs%, Spac%
41
42 Task_ObjsB% = !Task_Objs%
43 Objs% = Task_ObjsB%!00
44 Spac% = Task_ObjsB%!04
45
46 IF Objs% = Spac% THEN
47 IF FNHeap_ReAlloc(Task_Objs%, 8 + 24 * (Spac% + 16)) = 0 THEN ERROR Erro_Memo%, ""
48 Task_ObjsB% = !Task_Objs%
49 Task_ObjsB%!04 += 16
50 ENDIF
51
52 Task_ObjsB%!(8 + 24 * Objs% + 00) = Type%
53 Task_ObjsB%!(8 + 24 * Objs% + 04) = Hand%
54 Task_ObjsB%!(8 + 24 * Objs% + 08) = Word%
55 $(Task_ObjsB% + 8 + 24 * Objs% + 12) = LEFT$(Name$, 11)
56
57 Task_ObjsB%!00 = Objs% + 1
58
59 ENDPROC
60
61 REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
62
63 DEF FNObject_Name(Type%, Hand%, Word%)
64 LOCAL Objs%, Loop%
65
66 Task_ObjsB% = !Task_Objs%
67 Objs% = Task_ObjsB%!00
68
69 IF Objs% THEN
70 FOR Loop% = 0 TO (Objs% - 1)
71 IF Task_ObjsB%!(8 + 24 * Loop% + 04) = Hand% THEN
72 IF Task_ObjsB%!(8 + 24 * Loop% + 00) = Type% THEN
73 IF Task_ObjsB%!(8 + 24 * Loop% + 08) = Word% THEN =$(Task_ObjsB% + 8 + 24 * Loop% + 12)
74 ENDIF
75 ENDIF
76 NEXT
77 ENDIF
78
79 ="None"
80
81 REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
82
83 DEF FNObject_Hand(Type%, Name$, Word%)
84 LOCAL Objs%, Loop%, Obje%
85
86 Task_ObjsB% = !Task_Objs%
87 Objs% = Task_ObjsB%!00
88 IF Objs% = 0 THEN =&7FFFFFFF
89 Obje% = Task_ObjsB% + 8 + 24 * (Objs% - 1)
90
91 FOR Loop% = 0 TO (Objs% - 1)
92 IF !Obje% = Type% THEN IF Obje%!8 = Word% THEN IF $(Obje% + 12) = Name$ THEN =Obje%!4
93 Obje% -= 24
94 NEXT
95
96 =&7FFFFFFF
97
98 REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
99
100 DEF FNObject_Find(Type%, Word%)
101 LOCAL Objs%, Loop%
102
103 Task_ObjsB% = !Task_Objs%
104 Objs% = Task_ObjsB%!00
105
106 IF Objs% THEN
107 FOR Loop% = 0 TO (Objs% - 1)
108 IF Task_ObjsB%!(8 + 24 * Loop% + 00) = Type% THEN
109 IF Task_ObjsB%!(8 + 24 * Loop% + 08) = Word% THEN =Task_ObjsB%!(8 + 24 * Loop% + 04)
110 ENDIF
111 NEXT
112 ENDIF
113
114 =&7FFFFFFF
115
116 REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
117
118 DEF PROCObject_Remove(Type%, Hand%, Word%)
119 LOCAL Objs%, Loop%
120
121 Task_ObjsB% = !Task_Objs%
122 Objs% = Task_ObjsB%!00
123 Loop% = -1
124 REPEAT
125 Loop% += 1
126 IF Loop% > Objs% THEN ERROR 1,"ObjectRemove:NotFound"
127 UNTIL (Task_ObjsB%!(8 + 24 * Loop% + 00) = Type%) AND (Task_ObjsB%!(8 + 24 * Loop% + 04) = Hand%) AND (Task_ObjsB%!(8 + 24 * Loop% + 08) = Word%)
128
129 SYS"WimpExt_MemCopy", Task_ObjsB% + 8 + 24 * Loop% + 24, Task_ObjsB% + 8 + 24 * Loop%, ((Objs% - Loop%) - 1) * 24
130 Task_ObjsB%!00 -= 1
131 Task_ObjsB%!04 = Task_ObjsB%!00
132 IF FNHeap_ReAlloc(Task_Objs%, 8 + 24 * (Objs% - 1))
133 ENDPROC

  ViewVC Help
Powered by ViewVC 1.1.26