?login_element?

Subversion Repositories NedoOS

Rev

Rev 497 | Blame | Compare with Previous | Last modification | View Log | Download

  1. #ifndef INTERPRETER_H
  2. #define INTERPRETER_H
  3.  
  4. #include <math.h>
  5. #include <inttypes.h>
  6.  
  7. #include "cmdlist.c"
  8.  
  9. void myprint(char * s);
  10.  
  11. //#define FOR_DEBUGGER
  12.  
  13. using namespace std;
  14. #ifdef FOR_DEBUGGER
  15.     extern uint64_t *pc;
  16.     extern uint64_t *prog;
  17.     #define MAINDISPATCH goto *labels[*pc++]
  18.     #define DISPATCH return -1
  19.     int interpret();
  20.     void pushpar(uint64_t progpar);
  21. #else
  22.     #define MAINDISPATCH DISPATCH
  23.     #define DISPATCH goto *labels[*pc++]
  24.     int interpret(uint64_t *prog, uint64_t progpar);
  25. #endif //FOR_DEBUGGER
  26.  
  27. #define GETPAR *pc++
  28. #define PUSH(x) datastack[++datastackindex].u = x
  29. #define PUSHFLOAT(x) datastack[++datastackindex].d = x
  30. #define POP datastack[datastackindex--]
  31. #define TOS datastack[datastackindex]
  32. #define PUSHCALLSTACK(x) callstack[++callstackindex] = x
  33. #define POPCALLSTACK callstack[callstackindex--]
  34.  
  35. #define STACKSIZE 256
  36. #define LOCALSSIZE 8192
  37.  
  38. typedef union {
  39.     uint64_t u;
  40.     int64_t i;
  41.     double d;
  42.     uint64_t *p;
  43. } data64bit;
  44.  
  45. extern uint8_t datastackindex;
  46. extern uint8_t callstackindex;
  47. extern data64bit datastack[STACKSIZE];
  48. extern uint64_t callstack[STACKSIZE];
  49. extern data64bit locals[LOCALSSIZE];
  50.  
  51. uint64_t *loadscript(int state_index, char *waspath);
  52.  
  53.  
  54. #endif // INTERPRETER_H
  55.