📄 main.c
字号:
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ +
+ main.c - this is the boot-strap file which conatins the entry +
+ exit point of the HEC engine +
+ +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ includes +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#include <stdio.h> /* ANSI C includes ------------------------*/
#include "common.h" /* universal elements ---------------------*/
#include "cmdline.h"
#include "error.h"
#include "exenv.h"
#include "init.h"
#include "reformat.h"
#include "interrupt.h"
#include "run.h"
#include "dbgdata.h"
//#define DBG_MAIN 1
#ifdef DBG_MAIN
#define DBG_MAIN0(str) printf("main(): "); printf(str);
#define DBG_MAIN1(str,arg1) printf("main(): "); printf(str,arg1);
#define DBG_MAIN2(str,arg1,arg2) printf("main(): "); printf(str,arg1,arg2);
#else
#define DBG_MAIN0(str)
#define DBG_MAIN1(str,arg1)
#define DBG_MAIN2(str,arg1,arg2)
#endif
int main(int argc, char *argv[])
{
struct CmdLine cl;
nErrors = 0;
RAM = NULL;
interruptOn = TRUE;
DebugData_init();
/*1) establishing error log */
DBG_MAIN0("1) establishing error log\n");
setUpErrorFile();
if (nErrors > 1)
{
closeErrorFile();
shutDown(SHUTDOWN_ERROR);
}
/*2) handle command line arguments, set computer switches */
DBG_MAIN0("2) invoking handleArguments()\n");
cl = handleArguments(argc, argv);
if (cl.ok == FALSE)
{
closeErrorFile();
shutDown(SHUTDOWN_ERROR);
}
/*3) init execution environment and load bytecode */
DBG_MAIN0("3) invoking initHEC()\n");
if (initHEC(cl) == FALSE)
{
DebugData_free();
closeHEC();
closeErrorFile();
shutDown(SHUTDOWN_ERROR);
}
/*4) re-format numeric operands to native and verify */
DBG_MAIN0("4) invoking reformat()\n");
if (reformat() == FALSE)
{
DebugData_free();
closeHEC();
closeErrorFile();
shutDown(SHUTDOWN_ERROR);
}
/*5) begin execution*/
printDebugData(&debugData);
DBG_MAIN0("5) invoking run()\n");
runHEC(cl.debug);
DebugData_free();
closeHEC();
closeErrorFile();
printf("main(): exiting with (%d) errors\n", nErrors);
return SHUTDOWN_OK;
} /*end main*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -