| | |
| | |
|
| | | stKMem KMem;
|
| | |
|
| | | enum enParamTypes
|
| | | enum enParamTypes //参数类型
|
| | | {
|
| | | KLParamCoil,
|
| | | KLParamWord,
|
| | | KLParamNum,
|
| | |
|
| | | KLParamCoil, //参数为线圈,1bit
|
| | | KLParamWord, //参数为字类型, 16bit
|
| | | KLParamNum, //参数为立即数
|
| | | };
|
| | | struct stOpDef
|
| | | struct stOpDef //指令定义
|
| | | {
|
| | | int nOpType1;
|
| | | CStringA OpTxt;
|
| | | int nParamCount;
|
| | | int nParamType;
|
| | | CStringA ShowTxt;
|
| | | int nOpType1; //指令类型
|
| | | CStringA OpTxt; //指令文本显示
|
| | | int nParamCount; //指令的参数个数
|
| | | int nParamType; //指令的参数类型
|
| | | CStringA ShowTxt; //指令的显示文本
|
| | | };
|
| | | static stOpDef OpDef[];
|
| | |
|
| | | static int nOpDefCount;
|
| | | struct stParam
|
| | | struct stParam //参数定义
|
| | | {
|
| | | CStringA sParamStr;
|
| | | int nParamType;
|
| | | int nParamAddr;
|
| | | CStringA sParamStr; //参数显示文本
|
| | | int nParamType; //参数类型
|
| | | int nParamAddr; //参数地址.
|
| | | };
|
| | |
|
| | | struct stProg
|
| | | struct stProg //程序定义
|
| | | {
|
| | | int nOpType1;
|
| | | int nBinStep;
|
| | | int nParamCount;
|
| | | stParam Params[3];
|
| | | int PairTo;
|
| | | int nOpType1; //指令类型
|
| | | int nBinStep; //指令步
|
| | | int nParamCount; //参数数量
|
| | | stParam Params[3]; //参数们
|
| | | int PairTo; //对应指令
|
| | | };
|
| | |
|
| | |
|
| | | struct stCoilAnno
|
| | | struct stCoilAnno //线圈注释定义
|
| | | {
|
| | | unsigned short nType;
|
| | | unsigned short nAddr;
|
| | | CString sCoilName;
|
| | | CString sAnno;
|
| | | unsigned short nType; //类型
|
| | | unsigned short nAddr; //地址
|
| | | CString sCoilName; //线圈名称
|
| | | CString sAnno; //注释文本
|
| | | };
|
| | | stCoilAnno mCoilAnnos[10000]=
|
| | | stCoilAnno mCoilAnnos[10000] =
|
| | | {
|
| | | };
|
| | |
|
| | |
| | |
|
| | |
|
| | |
|
| | | enum enSection {
|
| | | SectionNone = 0,
|
| | | SectionSysCfg = 1,
|
| | | SectionProg = 2,
|
| | | SectionAnno = 3,
|
| | | SectionCoilList = 4,
|
| | | SectionDataList = 5,
|
| | | enum enSection { //数据节类型定义
|
| | | SectionNone = 0, //
|
| | | SectionSysCfg = 1, //系统配置节
|
| | | SectionProg = 2, //程序节
|
| | | SectionAnno = 3, //注释节
|
| | | SectionCoilList = 4, //线圈列表节
|
| | | SectionDataList = 5, //数据列表节
|
| | | };
|
| | |
|
| | | struct stSectionDef |
| | | struct stSectionDef
|
| | | {
|
| | | int nSectionType;
|
| | | CStringA SectionName;
|
| | | };
|
| | | stSectionDef SectionDef[5]=
|
| | | stSectionDef SectionDef[5] =
|
| | | {
|
| | | {SectionSysCfg,"SYSCFG"},
|
| | | {SectionProg,"PROG"},
|
| | |
| | | {SectionCoilList,"MONCOILLIST"},
|
| | | {SectionDataList,"MONDATALIST"},
|
| | | };
|
| | | int nSectionDefCount = sizeof(SectionDef) / sizeof(stSectionDef);
|
| | | int TxtToSection(CStringA txt);
|
| | | int GetSectionTxt(int nSectionType, CStringA & txt);
|
| | | int ScanSections();
|
| | |
|
| | | struct stSection{
|
| | | int nSectionType;
|
| | | int nSectionLineNo;
|
| | | int nLines;
|
| | | };
|
| | | stSection Sections[100] = { 0 };
|
| | | int nSectionCount;
|
| | | |
| | | int GetSectionPos(int nSectionType, int * nSectionLine, int * nSectionLines);
|
| | | int nSectionDefCount = sizeof(SectionDef) / sizeof(stSectionDef);
|
| | | int TxtToSection(CStringA txt);
|
| | | int GetSectionTxt(int nSectionType, CStringA& txt);
|
| | | int ScanSections();
|
| | |
|
| | | // 操作
|
| | | struct stSection {
|
| | | int nSectionType;
|
| | | int nSectionLineNo;
|
| | | int nLines;
|
| | | };
|
| | | stSection Sections[100] = { 0 };
|
| | | int nSectionCount;
|
| | |
|
| | | int GetSectionPos(int nSectionType, int* nSectionLine, int* nSectionLines);
|
| | |
|
| | | // 操作
|
| | | public:
|
| | | int TxtToOp(CStringA optxt, int* ParamCount, int* ParamType);
|
| | | int OpToTxt(int nOp, CStringA & OpTxt);
|