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

Annotation of /archive/wimplibs/Heap/2

Parent Directory Parent Directory | Revision Log Revision Log


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

1 james 32 REM > JLibraries:Heap.2
2     REM © James Bursa, 1997
3    
4     REM JB 16 Nov 1997 created
5    
6    
7     DEF PROCHeap_Init(Anch%)
8     Task_HeapBase% = HIMEM
9     SYS"WimpExt_Heap", 0, HIMEM, Anch%
10     ENDPROC
11    
12     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
13    
14     DEF FNHeap_Alloc(Size%)
15     LOCAL Anch%
16     SYS"WimpExt_Heap", 2 ,, Size% TO ,Anch%
17     =Anch%
18    
19     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
20    
21     DEF PROCHeap_Free(Anch%)
22     SYS"WimpExt_Heap", 3, Anch%
23     ENDPROC
24    
25     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
26    
27     DEF FNHeap_ReAlloc(Anch%, Size%)
28     LOCAL Flag%
29     SYS"WimpExt_Heap", 4, Anch%, Size% TO , Flag%
30     =(Flag% <> 0)
31    
32     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
33    
34     DEF FNHeap_Grab(Size%, Word%, Name$)
35     LOCAL Anch%
36     SYS"WimpExt_Heap", 2,, Size% TO , Anch%
37     IF Anch% > 0 THEN PROCObject_Add(4, Anch%, Word%, Name$)
38     =(Anch% <> 0)
39    
40     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
41    
42     DEF FNHeap_Safe(Size%, Word%, Name$)
43     IF NOT FNHeap_Grab(Size%, Word%, Name$) THEN ERROR Erro_Memo%, ""
44     =FNHeap_Find(Word%, Name$)
45    
46     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
47    
48     DEF FNHeap_Find(Word%, Name$)
49     Hand% = FNObject_Hand(4, Name$, Word%)
50     IF Hand% = &7FFFFFFF THEN ERROR 1, ("FNHeap_Find: "+Name$+", "+STR$Word%)
51     =!Hand%
52    
53     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
54    
55     DEF PROCHeap_Lose(Word%, Name$)
56     LOCAL Hand%
57     IF Name$ = "*" THEN
58     Hand% = FNObject_Find(4, Word%)
59     WHILE Hand% <> &7FFFFFFF
60     SYS"WimpExt_Heap", 3, Hand%
61     PROCObject_Remove(4, Hand%, Word%)
62     Hand% = FNObject_Find(4, Word%)
63     ENDWHILE
64     ELSE
65     Hand% = FNObject_Hand(4, Name$, Word%)
66     IF Hand% <> &7FFFFFFF THEN
67     SYS"WimpExt_Heap", 3, Hand%
68     PROCObject_Remove(4, Hand%, Word%)
69     ENDIF
70     ENDIF
71     ENDPROC

  ViewVC Help
Powered by ViewVC 1.1.26