| | 1 | /* $Header: d:/cvsroot/tads/tads3/vmbiftad.h,v 1.2 1999/05/17 02:52:29 MJRoberts Exp $ */ |
| | 2 | |
| | 3 | /* |
| | 4 | * Copyright (c) 1998, 2002 Michael J. Roberts. All Rights Reserved. |
| | 5 | * |
| | 6 | * Please see the accompanying license file, LICENSE.TXT, for information |
| | 7 | * on using and copying this software. |
| | 8 | */ |
| | 9 | /* |
| | 10 | Name |
| | 11 | vmbift3.h - function set definition - T3 VM system interface |
| | 12 | Function |
| | 13 | |
| | 14 | Notes |
| | 15 | |
| | 16 | Modified |
| | 17 | 12/06/98 MJRoberts - Creation |
| | 18 | */ |
| | 19 | |
| | 20 | #ifndef VMBIFTAD_H |
| | 21 | #define VMBIFTAD_H |
| | 22 | |
| | 23 | #include "vmbif.h" |
| | 24 | |
| | 25 | #endif /* VMBIFTAD_H */ |
| | 26 | |
| | 27 | /* ------------------------------------------------------------------------ */ |
| | 28 | /* |
| | 29 | * T3 VM function set intrinsics |
| | 30 | */ |
| | 31 | class CVmBifT3: public CVmBif |
| | 32 | { |
| | 33 | public: |
| | 34 | /* run the garbage collector */ |
| | 35 | static void run_gc(VMG_ uint argc); |
| | 36 | |
| | 37 | /* set the SAY instruction's handler function */ |
| | 38 | static void set_say(VMG_ uint argc); |
| | 39 | |
| | 40 | /* get the VM version number */ |
| | 41 | static void get_vm_vsn(VMG_ uint argc); |
| | 42 | |
| | 43 | /* get the VM identification string */ |
| | 44 | static void get_vm_id(VMG_ uint argc); |
| | 45 | |
| | 46 | /* get the VM banner string */ |
| | 47 | static void get_vm_banner(VMG_ uint argc); |
| | 48 | |
| | 49 | /* get the 'preinit' status - true if preinit, nil if normal */ |
| | 50 | static void get_vm_preinit_mode(VMG_ uint argc); |
| | 51 | |
| | 52 | /* debug trace functions */ |
| | 53 | static void debug_trace(VMG_ uint argc); |
| | 54 | |
| | 55 | /* get the global symbol table, if available */ |
| | 56 | static void get_global_symtab(VMG_ uint argc); |
| | 57 | |
| | 58 | /* allocate a new property ID */ |
| | 59 | static void alloc_new_prop(VMG_ uint argc); |
| | 60 | |
| | 61 | /* get a stack trace */ |
| | 62 | static void get_stack_trace(VMG_ uint argc); |
| | 63 | |
| | 64 | protected: |
| | 65 | /* |
| | 66 | * service routine - retrieve source information for a given code |
| | 67 | * location |
| | 68 | */ |
| | 69 | static void get_source_info(VMG_ ulong entry_addr, ulong method_ofs, |
| | 70 | vm_val_t *retval); |
| | 71 | }; |
| | 72 | |
| | 73 | /* |
| | 74 | * T3 VM Test function set - test and debug function set |
| | 75 | */ |
| | 76 | class CVmBifT3Test: public CVmBif |
| | 77 | { |
| | 78 | public: |
| | 79 | /* get an instance's unique identifier number */ |
| | 80 | static void get_obj_id(VMG_ uint argc); |
| | 81 | |
| | 82 | /* get an instance's garbage collection state */ |
| | 83 | static void get_obj_gc_state(VMG_ uint argc); |
| | 84 | |
| | 85 | /* get the Unicode character code for the first character of a string */ |
| | 86 | static void get_charcode(VMG_ uint argc); |
| | 87 | }; |
| | 88 | |
| | 89 | /* ------------------------------------------------------------------------ */ |
| | 90 | /* |
| | 91 | * debug_trace mode flags |
| | 92 | */ |
| | 93 | |
| | 94 | /* check to see if the debugger is present */ |
| | 95 | #define T3DBG_CHECK 1 |
| | 96 | |
| | 97 | /* break into the debugger */ |
| | 98 | #define T3DBG_BREAK 2 |
| | 99 | |
| | 100 | |
| | 101 | |
| | 102 | /* ------------------------------------------------------------------------ */ |
| | 103 | /* |
| | 104 | * Function set vector. Define this only if VMBIF_DEFINE_VECTOR has |
| | 105 | * been defined, so that this file can be included for the prototypes |
| | 106 | * alone without defining the function vector. |
| | 107 | */ |
| | 108 | #ifdef VMBIF_DEFINE_VECTOR |
| | 109 | |
| | 110 | void (*G_bif_t3[])(VMG_ uint) = |
| | 111 | { |
| | 112 | &CVmBifT3::run_gc, |
| | 113 | &CVmBifT3::set_say, |
| | 114 | &CVmBifT3::get_vm_vsn, |
| | 115 | &CVmBifT3::get_vm_id, |
| | 116 | &CVmBifT3::get_vm_banner, |
| | 117 | &CVmBifT3::get_vm_preinit_mode, |
| | 118 | &CVmBifT3::debug_trace, |
| | 119 | &CVmBifT3::get_global_symtab, |
| | 120 | &CVmBifT3::alloc_new_prop, |
| | 121 | &CVmBifT3::get_stack_trace |
| | 122 | }; |
| | 123 | |
| | 124 | void (*G_bif_t3_test[])(VMG_ uint) = |
| | 125 | { |
| | 126 | &CVmBifT3Test::get_obj_id, |
| | 127 | &CVmBifT3Test::get_obj_gc_state, |
| | 128 | &CVmBifT3Test::get_charcode |
| | 129 | }; |
| | 130 | |
| | 131 | #endif /* VMBIF_DEFINE_VECTOR */ |