📄 execute.h
字号:
#define norw 13
#define txmax 100
#define nmax 14
#define al 10
#define amax 2047
#define levmax 3
#define cxmax 200
#define stacksize 500
enum symbol
{
nul , ident , number ,plus , minus , times, slash , oddsym , eql , neq , lss , leq ,
gtr , geq , lparen , rparen , comma , semicolon , period , becomes , beginsym , endsym ,
ifsym , thensym , whilesym , writesym , readsym , dosym , callsym , constsym , varsym ,
procsym,
};
#define symnum 32
enum object
{
constant,
variable,
procedur,
};
enum fct
{
lit , opr , lod , sto , cal , inte , jmp , jpc ,
};
#define fctnum 8
struct instruction
{
enum fct f;
int l;
int a;
};
struct tablestruct
{
char name[al];
enum object kind;
int val;
int level;
int adr;
int size;
};
struct errm
{
int line;
int type;
};
#if !defined(AFX_EXECUTE_H__8F7D36AF_B182_4BDA_9181_99AF4D0BF23E__INCLUDED_)
#define AFX_EXECUTE_H__8F7D36AF_B182_4BDA_9181_99AF4D0BF23E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// execute.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// Cexecute document
#include <afxwin.h>
class Cexecute : public CDocument
{
public:
Cexecute(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(Cexecute)
// Attributes
public:
FILE* fas;
FILE* fa;
FILE* fa1;
FILE* fa2;
int hang;
int lie;
bool listswitch;
bool tableswitch;
char ch;
bool nxtlev[symnum];
enum symbol sym ;
char id[al+1];
int num;
int cc,ll;
int cx;
char line[81];
char a[al+1];
struct instruction code[cxmax];
char word[norw][al];
enum symbol wsym[norw];
enum symbol ssym[256];
char mnemonic[fctnum][5];
bool declbegsys[symnum];
bool statbegsys[symnum];
bool facbegsys[symnum];
struct tablestruct table[txmax];
struct errm allerrmsg[50];
FILE* fin;
FILE* fout;
char fname[al];
int err;
void error(int n,int line);
int getsym();
int getch();
void init();
int gen(enum fct x,int y,int z);
int test(bool* s1,bool* s2,int n);
int inset(int e,bool* s);
int addset(bool* sr,bool* s1,bool* s2,int n);
int subset(bool* sr,bool* s1,bool* s2,int n);
int mulset(bool* sr,bool* s1,bool* s2,int n);
int block(int lev, int tx,bool* fsys);
void interpret(char** table);
int factor(bool* fsys,int* ptx,int lev);
int term(bool* fsys,int* ptx,int lev);
int condition(bool* fsys,int* ptx,int lev);
int expression(bool* fsys,int* ptx,int lev);
int statement(bool* fsys,int* ptx,int lev);
void listcode(int cx0);
int vardeclaration(int* ptx,int lev,int* pdx);
int constdeclaration(int* ptx,int lev,int* pdx);
int position(char* idt,int tx);
void enter(enum object k,int* ptx,int lev, int* pdx);
int base(int l,int* s,int b);
#define getsymdo if(-1==getsym()) return -1
#define getchdo if(-1==getch()) return -1
#define testdo(a,b,c) if(-1==test(a,b,c)) return -1
#define gendo(a,b,c) if(-1==gen(a,b,c)) return -1
#define expressiondo(a,b,c) if(-1==expression(a,b,c)) return -1
#define factordo(a,b,c) if(-1==factor(a,b,c)) return -1
#define termdo(a,b,c) if(-1==term(a,b,c))
#define conditiondo(a,b,c) if(-1==condition(a,b,c)) return -1
#define statementdo(a,b,c) if(-1==statement(a,b,c)) return -1
#define constdeclarationdo(a,b,c) if(-1==constdeclaration(a,b,c)) return -1
#define vardeclarationdo(a,b,c) if(-1==vardeclaration(a,b,c)) return -1
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(Cexecute)
public:
virtual void Serialize(CArchive& ar); // overridden for document i/o
protected:
virtual BOOL OnNewDocument();
//}}AFX_VIRTUAL
// Implementation
public:
int errline;
int outputlie();
int outputhang();
char msgtable[100][50];
//char** mtable;
virtual ~Cexecute();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(Cexecute)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXECUTE_H__8F7D36AF_B182_4BDA_9181_99AF4D0BF23E__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -