|
Revision 7413, 1.4 KB
(checked in by westram, 14 months ago)
|
|
merged from dev [7355] [7369] [7370]
- Refactored AISC (interpreter)
- separated 'struct global' into several classes (mostly 'Interpreter').
- precompile all commands and use a dispatcher
- changes to behavior
- new command WARNING
- detects deadlocks
- error if referencing data w/o loading it
- error when files are not closed
- tweaked/added several errors reported
|
| Line | |
|---|
| 1 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 2 | // http://www.arb-home.de/ // |
|---|
| 3 | |
|---|
| 4 | #ifndef AISC_DEF_H |
|---|
| 5 | #define AISC_DEF_H |
|---|
| 6 | |
|---|
| 7 | #define SIMPLE_ARB_ASSERT |
|---|
| 8 | #ifndef ARB_ASSERT_H |
|---|
| 9 | #include <arb_assert.h> |
|---|
| 10 | #endif |
|---|
| 11 | |
|---|
| 12 | #define aisc_assert(cond) arb_assert(cond) |
|---|
| 13 | |
|---|
| 14 | #if defined(DEBUG) |
|---|
| 15 | // #define TRACE // aisc-"debugger" |
|---|
| 16 | // #define SHOW_CALLER // show where error was raised |
|---|
| 17 | // #define MASK_ERRORS // useful to valgrind via makefile |
|---|
| 18 | #endif |
|---|
| 19 | |
|---|
| 20 | #define OPENFILES 16 |
|---|
| 21 | #define HASHSIZE 1024 |
|---|
| 22 | #define STACKSIZE 20 |
|---|
| 23 | |
|---|
| 24 | enum LookupScope { |
|---|
| 25 | LOOKUP_LIST, |
|---|
| 26 | LOOKUP_BLOCK, |
|---|
| 27 | LOOKUP_BLOCK_REST, |
|---|
| 28 | LOOKUP_LIST_OR_PARENT_LIST, |
|---|
| 29 | }; |
|---|
| 30 | |
|---|
| 31 | class Command; |
|---|
| 32 | class Code; |
|---|
| 33 | class hash; |
|---|
| 34 | class Token; |
|---|
| 35 | class Location; |
|---|
| 36 | class Data; |
|---|
| 37 | class Interpreter; |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | #if defined(SHOW_CALLER) |
|---|
| 41 | #define CALLER_FILE __FILE__ |
|---|
| 42 | #define CALLER_LINE __LINE__ |
|---|
| 43 | #else // !defined(SHOW_CALLER) |
|---|
| 44 | #define CALLER_FILE NULL |
|---|
| 45 | #define CALLER_LINE 0 |
|---|
| 46 | #endif |
|---|
| 47 | |
|---|
| 48 | #define print_error(code_or_loc, err) (code_or_loc)->print_error_internal(err, CALLER_FILE, CALLER_LINE) |
|---|
| 49 | #define print_warning(code_or_loc, err) (code_or_loc)->print_warning_internal(err, CALLER_FILE, CALLER_LINE) |
|---|
| 50 | |
|---|
| 51 | #define printf_error(code_or_loc, format, arg) print_error(code_or_loc, formatted(format, arg)) |
|---|
| 52 | #define printf_warning(code_or_loc, format, arg) print_warning(code_or_loc, formatted(format, arg)) |
|---|
| 53 | |
|---|
| 54 | #else |
|---|
| 55 | #error aisc_def.h included twice |
|---|
| 56 | #endif // AISC_DEF_H |
|---|