gtdev-plugins.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #define PLUGIN_GTBASIC 0
  2. #define PLUGIN_GTC 1
  3. #define PluginName(x) ((x)?"GTC":"GTDEVBAS")
  4. #define ET_FATAL -2
  5. #define ET_WARNING -1
  6. #define ET_ERROR 0
  7. #define ET_INTERNAL_WARNING 1
  8. #define ET_INTERNAL_FAILURE 2
  9. #define et_isinternal(x) ((x)>0)
  10. typedef void CALLBACK (*Msg_Callback_t)(char *message,int err_type,char *func,char *file,int line,int chr);
  11. #define MAX_PROGRESS 65535
  12. typedef void CALLBACK (*Progr_Callback_t)(char *func,char *file,unsigned int fprogress);
  13. #define GTC_Compile ((int(*CALLBACK)(char *in,char *out,Msg_Callback_t msg_process, \
  14. Progr_Callback_t progr_process)) st->sft[0])
  15. void CALLBACK message_cb(char *message,int err_type,char *func,char *file,int line,int chr);
  16. void CALLBACK progr_cb(char *func,char *file,unsigned int fprogress);
  17. //#define DEBUG_COMPILE
  18. #ifdef DEBUG_COMPILE
  19. #define NEED_DEBUG_MSG
  20. void debug_msg(char *s);
  21. #endif
  22. int Compile(char *in_file,int plugin) {
  23. //#ifdef DEBUG_COMPILE
  24. // debug_msg("Compile step#1");
  25. //#endif
  26. SecureTab *st=GetAppSecureTable(PluginName(plugin));
  27. if (!st) return 0;
  28. //#ifdef DEBUG_COMPILE
  29. // debug_msg("Compile step#2");
  30. //#endif
  31. int res=-1;
  32. if (plugin==PLUGIN_GTC) {
  33. #ifdef COMPILE_ONLY
  34. ST_helpMsg("Compiling...");
  35. #endif
  36. //#ifdef DEBUG_COMPILE
  37. // debug_msg("Compile step#3");
  38. //#endif
  39. res=GTC_Compile(in_file,"main\\outbin",message_cb,progr_cb);
  40. //#ifdef DEBUG_COMPILE
  41. // {
  42. // char b[100];
  43. // sprintf(b,"\n Compile step#4: r=%d \n",res);
  44. // debug_msg(b);
  45. // }
  46. //#endif
  47. #ifdef COMPILE_ONLY
  48. if (!res) ST_helpMsg("Compile successful!");
  49. else if (res==1) ST_helpMsg("error");
  50. else if (res==2) ST_helpMsg("couldn't open");
  51. #endif
  52. }
  53. return res;
  54. }