main.c 922 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "__virtualmath.h"
  2. volatile bool is_KeyInterrupt = false;
  3. void signalStop(int signum);
  4. int main(int argc, char *argv[]) {
  5. Inter *inter = NULL;
  6. signal(SIGINT, signalStop);
  7. if (setjmp(memVirtualMath_Env) == -1){
  8. fprintf(stderr, "ERROR: Fatal memory error encountered, May be caused by insufficient memory!\n");
  9. return 1;
  10. }
  11. memVirtualMathUseJmp = true;
  12. if (getArgs(argc, argv))
  13. goto args_error;
  14. inter = makeInter(args.out_file, args.error_file, args.in_file, NULL);
  15. for (ResultType status = not_return; status != error_return && argv[optind] != NULL; optind++)
  16. status = runCodeBlock(argv[optind], inter);
  17. if (args.run_commandLine)
  18. runCodeStdin(inter);
  19. freeInter(inter, true);
  20. args_error: freeArgs();
  21. return 0;
  22. }
  23. void signalStop(int signum) {
  24. is_KeyInterrupt = true;
  25. }
  26. /** TODO-szh List
  27. * 官方函数
  28. * 官方类
  29. */