📄 run.h
字号:
#ifndef __RUN.H__
#define __RUN.H__
#include "Type.h"
#include "State.h"
#include "ErrorVal.h"
#include "Common.h"
// Run.cpp中的函数
void RunProgram();
void ClearAll();
void ClearVar();
int RunLine(const int);
void JoinVar(VarAllType *,const char [],const VarType);
void PutValue(const int, const int);
void PutValue(const int, const double);
void PutValue(const int, const char []);
void PutValue(const VarArrayHeadType *, const int, const int);
int GetValue(const VarArrayHeadType *, const int);
void CallCls();
void CallDim(const char []);
void CallGiveValue(const char []);
void CallInput(const char []);
void CallPrint(const char []);
void CallLocate(const char []);
void CallFor(char []);
void CallNext();
void CallIf(const char []);
void CallElse();
void CallDelay(const char []);
void CallEndIf();
void CallEndSub();
void CallContinue();
void CallBreak();
void CallGosub(const char []);
void CallDelete(const char []);
void CreateTable();
// 外部调用的函数
extern int NextLine(const int);
extern void SetColor(const int,const int);
extern double Expression(const char [], int &);
extern void BoolChange(const char [], char *);
extern int Boolean(const char [], int &);
// Run.cpp中用到的常数
// 最大允许的IF语句数
const int MaxIf = 20;
// 最大允许的循环数
const int MaxFor = 20;
// 最大允许的过程数
const int MaxSub = 10;
// 最大允许的IF嵌套层数
const int MaxNestIf = 5;
// 最大允许的循环嵌套层数
const int MaxNestFor = 10;
// 最大允许的过程递归层数
const int MaxNestSub = 100;
// 输入的最大长度
const int MaxInput = 255;
// 延时语句的最长时间
const int MaxDelayTime = 30000;
// 每个下标的最大长度
const int MaxLenOfRange = 3;
// Run.cpp中的全局变量
int NowIf;
int NowFor;
int NowSub;
// IF语句的个数
int TotIfInProg;
// FOR语句的个数
int TotForInProg;
// SUB语句的个数
int TotSubInProg;
// 输出光标的坐标
int OutX;
int OutY;
// 嵌套IF语句的序号栈
int NestIf[MaxNestIf];
// 嵌套FOR语句的序号栈
int NestFor[MaxNestFor];
// IF语句表的类型
struct IfType
{
// 开始行序号
int Start;
// ELSE语句的行序号
int Else;
// 结束行的序号
int End;
} If[MaxIf];
// 循环表的类型
struct ForType
{
// 开始行的序号
int StartNo;
// 循环变量
char Var[MaxLenOfVar];
// 结束行的序号
int EndNo;
// 循环终值
int End;
// 循环步长值
int Step;
// 循环变量值
int VarValue;
} For[MaxFor];
// SUB表类型
struct SubType
{
// 开始行序号
int Start;
// 过程名
char Name[MaxLenOfSubName];
// 结束行序号
int End;
} Sub[MaxSub];
// 过程递归栈类型
struct NestSubType
{
int No;
int Return;
} NestSub[MaxNestSub];
// 引用的外部变量
extern VarAllType *HeadAll, *TailAll;
extern VarIntType *HeadInt, *TailInt;
extern VarRealType *HeadReal, *TailReal;
extern VarArrayHeadType *HeadArray, *TailArray;
extern VarAllType *pNewAll;
extern VarIntType *pNewInt;
extern VarRealType *pNewReal;
extern VarArrayHeadType *pNewArrayHead;
extern VarArrayElemType *pNewArrayElem;
extern LineType *Text[MaxX];
extern int EndLine;
extern int RunLineNo;
extern bool Finished;
extern ErrorType Error;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -