plugins.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. extern int onopen_gotoline;
  2. void CALLBACK message_cb(char *message,int err_type,char *func,char *file,int line,int chr) {
  3. char *title="GT-Dev - Error",sprint[340];
  4. int icon=0;
  5. strcpy(sprint,"In file '%s' (line %d), in function '%s' :\n\n");
  6. switch (err_type) {
  7. #define ET_FATAL -2
  8. #define ET_WARNING -1
  9. #define ET_ERROR 0
  10. #define ET_INTERNAL_WARNING 1
  11. #define ET_INTERNAL_FAILURE 2
  12. case ET_FATAL:
  13. strcat(sprint,"Fatal error!\n%s");
  14. icon=ICO_ERROR;
  15. break;
  16. case ET_ERROR:
  17. strcat(sprint,"Error : %s");
  18. icon=ICO_ERROR;
  19. break;
  20. case ET_WARNING:
  21. strcat(sprint,"Warning : %s");
  22. icon=ICO_WARN;
  23. break;
  24. case ET_INTERNAL_WARNING:
  25. strcat(sprint,"An unexpected event has occurred (%s); "
  26. "it might be possible to continue, but the generated code may "
  27. "contain bugs.\nPlease report this bug to the developer\n\n"
  28. "Continue?");
  29. icon=ICO_QUEST;
  30. break;
  31. case ET_INTERNAL_FAILURE:
  32. strcat(sprint,"An internal error has occurred (%s).\n\n"
  33. "Please report this bug to the developer");
  34. icon=ICO_ERROR;
  35. break;
  36. }
  37. char sprinted[400];
  38. if (onopen_gotoline<0) onopen_gotoline=line;
  39. sprintf(sprinted,sprint,file,line,func,message);
  40. SimpleDlg(title,sprinted,B_CENTER,W_NORMAL|icon);
  41. }
  42. void CALLBACK progr_cb(char *func,char *file,unsigned int fprogress) {
  43. char b[100];
  44. sprintf(b,func?"Function '%s', %d%% of '%s'":"%s%d%% of '%s'",func,fprogress,file);
  45. b[58]=0;
  46. char *msg_old=msg;
  47. msg=b;
  48. DrawStatus();
  49. LCD_restore(Port);
  50. msg=msg_old;
  51. }