home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-07-11 | 1.4 KB | 45 lines | [TEXT/ObLi] |
- MODULE Runtime; (*mf 8.10.92*)
-
- (* If you want to use Oberon memory allocation and Garbage Collection,
- you have to import Runtime and call GC by yourself! *)
-
- IMPORT
- SYS:=SYSTEM;
-
- TYPE
- Module= POINTER- TO ModDesc;
- ModDesc= RECORD link: Module; data: LONGINT END;
-
- VAR
- a5: LONGINT; modList: Module; mark1, scan: PROCEDURE;
-
- PROCEDURE GC*; (*Call the Garbage Collector*)
- VAR mod: Module;
- BEGIN mod:=modList;
- WHILE mod#NIL DO SYS.PUTREG(9, mod.data); mark1;
- mod:=mod.link
- END;
- scan
- END GC;
-
- BEGIN SYS.GETREG(13, a5);
- SYS.GET(a5-24, modList); SYS.GET(a5-20, mark1); SYS.GET(a5-16, scan)
- END Runtime.
-
- (*
- Runtime exceptions are generated to vector number 7 (TRAPcc), and array index check
- exceptions are compiled into the CHK instruction which has vector number 6. You can
- install a trap handler of your own in these slots. If you don't, MacsBug will handle the
- exception if installed. The TRAPcc.W instruction is used with a word parameter signifying
- the source of the trap as follows:
-
- 2 NIL_reference (/n compiler option disables NIL_checking)
- 16 Invalid case in CASE statement
- 17 Function procedure without RETURN statement
- 18 Type guard check (/t compiler option disables type_checking)
- 19 Implied type guard check in record assignment
- 23 Out of heap space (when Oberon's NEW is used, not NewPtr)
-
- Use the /x compiler option to turn off array index range checking.
-
- *)