Abl.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. //***************************************************************************
  5. //
  6. // ABL.H
  7. //
  8. //***************************************************************************
  9. #ifndef ABL_H
  10. #define ABL_H
  11. #ifndef ABLGEN_H
  12. #include "ablgen.h"
  13. #endif
  14. #ifndef ABLEXEC_H
  15. #include "ablexec.h"
  16. #endif
  17. #ifndef ABLSYMT_H
  18. #include "ablsymt.h"
  19. #endif
  20. #ifndef ABLENV_H
  21. #include "ablenv.h"
  22. #endif
  23. #ifndef ABLDBUG_H
  24. #include "abldbug.h"
  25. #endif
  26. //***************************************************************************
  27. #define DEBUGGING
  28. void ABLi_init (unsigned long runtimeStackSize, // = 20480,
  29. unsigned long maxCodeBufferSize, // = 10240,
  30. unsigned long maxRegisteredModules, // = 200,
  31. unsigned long maxStaticVariables, // = 100,
  32. void* (*systemMallocCallback) (unsigned long memSize),
  33. void* (*stackMallocCallback) (unsigned long memSize),
  34. void* (*codeMallocCallback) (unsigned long memSize),
  35. void* (*symbolMallocCallback) (unsigned long memSize),
  36. void (*systemFreeCallback) (void* memBlock),
  37. void (*stackFreeCallback) (void* memBlock),
  38. void (*codeFreeCallback) (void* memBlock),
  39. void (*symbolFreeCallback) (void* memBlock),
  40. long (*fileCreateCB) (void** file, char* fName),
  41. long (*fileOpenCB) (void** file, char* fName),
  42. long (*fileCloseCB) (void** file),
  43. bool (*fileEofCB) (void* file),
  44. long (*fileReadCB) (void* file, unsigned char* buffer, long length),
  45. long (*fileReadLongCB) (void* file),
  46. long (*fileReadStringCB) (void* file, unsigned char* buffer),
  47. long (*fileReadLineExCB) (void* file, unsigned char* buffer, long maxLength),
  48. long (*fileWriteCB) (void* file, unsigned char* buffer, long length),
  49. long (*fileWriteByteCB) (void* file, unsigned char byte),
  50. long (*fileWriteLongCB) (void* file, long value),
  51. long (*fileWriteStringCB) (void* file, char* buffer),
  52. void (*debuggerPrintCallback) (char* s),
  53. void (*ablFatalCallback) (long code, char* s),
  54. bool debugInfo = false,
  55. bool debug = false,
  56. bool profile = false);
  57. ABLParamPtr ABLi_createParamList (long numParameters);
  58. void ABLi_setIntegerParam (ABLParamPtr paramList, long index, long value);
  59. void ABLi_setRealParam (ABLParamPtr paramList, long index, float value);
  60. void ABLi_deleteParamList (ABLParamPtr paramList);
  61. long ABLi_preProcess (char* sourceFileName,
  62. long* numErrors = NULL,
  63. long* numLinesProcessed = NULL,
  64. long* numFilesProcessed = NULL,
  65. bool printLines = false);
  66. ABLModulePtr ABLi_loadLibrary (char* sourceFileName,
  67. long* numErrors = NULL,
  68. long* numLinesProcessed = NULL,
  69. long* numFilesProcessed = NULL,
  70. bool printLines = false,
  71. bool createInstance = true);
  72. long ABLi_execute (SymTableNodePtr moduleIdPtr,
  73. SymTableNodePtr functionIdPtr = NULL,
  74. ABLParamPtr paramList = NULL,
  75. StackItemPtr returnVal = NULL);
  76. long ABLi_deleteModule (SymTableNodePtr moduleIdPtr);
  77. ABLModulePtr ABLi_getModule (long id);
  78. DebuggerPtr ABLi_getDebugger (void);
  79. void ABLi_saveEnvironment (ABLFile* ablFile);
  80. void ABLi_loadEnvironment (ABLFile* ablFile, bool malloc);
  81. void ABLi_close (void);
  82. bool ABLi_enabled (void);
  83. void ABLi_addFunction (char* name,
  84. bool isOrder,
  85. char* paramList,
  86. char* returnType,
  87. void (*codeCallback)(void));
  88. void ABLi_setRandomCallbacks (void (*seedRandomCallback) (unsigned long seed),
  89. long (*randomCallback) (long range));
  90. void ABLi_setDebugPrintCallback (void (*ABLDebugPrintCallback) (char* s));
  91. void ABLi_setGetTimeCallback (unsigned long (*ABLGetTimeCallback) (void));
  92. void ABLi_setEndlessStateCallback (void (*endlessStateCallback) (UserFile* log));
  93. char ABLi_popChar (void);
  94. long ABLi_popInteger (void);
  95. float ABLi_popReal (void);
  96. bool ABLi_popBoolean (void);
  97. float ABLi_popIntegerReal (void);
  98. long ABLi_popAnything (ABLStackItem* value);
  99. char* ABLi_popCharPtr (void);
  100. long* ABLi_popIntegerPtr (void);
  101. float* ABLi_popRealPtr (void);
  102. char* ABLi_popBooleanPtr (void);
  103. void ABLi_pushInteger (long value);
  104. void ABLi_pushReal (float value);
  105. void ABLi_pushBoolean (bool value);
  106. long ABLi_peekInteger (void);
  107. float ABLi_peekReal (void);
  108. bool ABLi_peekBoolean (void);
  109. char* ABLi_peekCharPtr (void);
  110. long* ABLi_peekIntegerPtr (void);
  111. float* ABLi_peekRealPtr (void);
  112. void ABLi_pokeChar (long val);
  113. void ABLi_pokeInteger (long val);
  114. void ABLi_pokeReal (float val);
  115. void ABLi_pokeBoolean (bool val);
  116. long ABLi_registerInteger (char* name, long* address, long numElements = 0);
  117. long ABLi_registerReal (char* name, float* address, long numElements = 0);
  118. bool ABLi_getSkipOrder (void);
  119. void ABLi_resetOrders (void);
  120. long ABLi_getCurrentState (void);
  121. void ABLi_transState (long newState);
  122. //***************************************************************************
  123. #endif