📄 userflow.cpp
字号:
DWORD dwPos;
if(!m_FlowStrTable.Lookup(m_pStyle->m_ListConst[i].lpName,(void * &)dwPos)){
if(GetPositionId(m_pStyle->m_ListConst[i].lpConst,dwPos,m_pStyle->m_ListConst[i].dwId)){
m_FlowStrTable.SetAt(m_pStyle->m_ListConst[i].lpName,(void *)dwPos);
}
else{
WriteError(pName,m_icLine,m_pStyle->m_ListConst[i].lpName,"style compile error:const define error");
m_ierror++;
}
}
else {
WriteError(pName,m_icLine,m_pStyle->m_ListConst[i].lpName,"style compile error:const define more than once");
m_ierror++;
}
}
}
}
else {
WriteError(pName,m_icLine,pIdentyString,"style create error");
m_ierror++;
}
}
else {
WriteError(pName,m_icLine,pIdentyString,"style file name error");
m_ierror++;
}
}
else {
WriteError(pName,m_icLine,pIdentyString,"style file define error");
m_ierror++;
}
break;
case WORD_INCLUDE:
{
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
while(dwIdentyId!=WORD_ENDOFLINE&&dwIdentyId!=WORD_ENDOFFILE)
m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(pIdentyString){
if(!m_pScanner->OpenSubScan(pIdentyString)){
WriteError(pName,m_icLine,pIdentyString,"cant openfile");
m_ierror++;
}
}
else {
WriteError(pName,m_icLine,pIdentyString,"file name error");
m_ierror++;
}
}
break;
case WORD_GOTO:
{
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(m_mypos.istype==TYPE_PUBLIC_POS){
WriteError(pName,m_icLine,pIdentyString,"define label in other object erea");
m_ierror++;
break;
}
if(GetPositionId(pIdentyString,dwIdenty)){
if((dwIdenty&ITYPE_FILTER)==TYPE_LABEL){
dwIdentyId=WORD_GOTO;
m_LineCode.Add(dwIdentyId);
m_LineCode.Add(dwIdenty);
dwIdenty=WORD_ENDOFLINE;
m_LineCode.Add(dwIdenty);
bAddLineCode=TRUE;
}
else {
WriteError(pName,m_icLine,pIdentyString,"unknown words");
m_ierror++;
break;
}
}
else {
dwIdentyId=WORD_GOTO;
m_LineCode.Add(dwIdentyId);
dwIdentyId=NewLabel(-1,m_icLine);
dwIdenty=WORD_ENDOFLINE;
m_LineCode.Add(dwIdentyId);
m_LineCode.Add(dwIdenty);
if(m_mypos.istype==TYPE_EVENT_POS){
CString cs=m_mypos.csTemp;
cs+="__";
cs+=pIdentyString;
m_FlowStrTable.SetAt((LPCTSTR)cs,(void *)(dwIdentyId));
m_mypos.pt.pe->dwVarNum+=1;
}
else {
CString cs=m_mypos.csTemp;
cs+="__";
cs+=pIdentyString;
m_FlowStrTable.SetAt((LPCTSTR)cs,(void *)(dwIdentyId));
m_mypos.pt.pf->dwVarNum+=1;
}
bAddLineCode=TRUE;
}
}
break;
case WORD_DEFPROC:
case WORD_STARTPROC:
{
BOOL bRealDef=((dwIdenty&POSID_FILTER)==WORD_STARTPROC);
CString csTempNow;
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(m_mypos.istype!=TYPE_PUBLIC_POS){
WriteError(pName,m_icLine,pIdentyString,"define function in other object erea");
m_ierror++;
break;
}
if(bRealDef)
m_mypos.csTemp=pIdentyString;
csTempNow=pIdentyString;
if(GetPositionId(pIdentyString,dwIdenty)){
if((dwIdenty&ITYPE_FILTER)!=TYPE_FUNCTION){
WriteError(pName,m_icLine,pIdentyString,"function name is used by other type");
m_ierror++;
break;
}
if(m_ListFunction[dwIdenty&POSID_FILTER].iStart==-1){
if(bRealDef){
m_ListFunction[dwIdenty&POSID_FILTER].iStart=m_LineList.GetSize();
m_mypos.istype=TYPE_FUNC_POS;
m_mypos.pt.pf=&m_ListFunction[dwIdenty&POSID_FILTER];
break;
}
else {
//多次申明
break;
}
}
else {
if(bRealDef){
WriteError(pName,m_icLine,pIdentyString,"function defined more than once");
m_ierror++;
break;
}
else {
//先定义后申明
break;
}
}
}
else {
USERFUCTION lbs;
if(bRealDef){
dwIdentyId=WORD_STARTPROC;
m_LineCode.Add(dwIdentyId);
lbs.iStart=m_LineList.GetSize();
lbs.iEnd=-m_icLine;
}
else{
lbs.iEnd=-m_icLine;
lbs.iStart=-1;
}
lbs.dwUserFuncPositionId=m_ListFunction.GetSize();
lbs.dwUserFuncPositionId&=POSID_FILTER;
lbs.dwUserFuncPositionId|=TYPE_FUNCTION;
lbs.dwVarNum=0;
lbs.ParamNum=0;
lbs.iStartParam=-1;
int ierror=0;
PARAMEMTER prm;
while(1){
prm.lpstrPreFix=NULL;
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(dwIdentyId==WORD_ENDOFFILE||dwIdentyId==WORD_ENDOFLINE)break;
if(dwIdentyId!=WORD_IDENTY){
WriteError(pName,m_icLine,pIdentyString,"unknown words");
m_ierror++;
ierror=1;
break;
}
if(!CStyle::m_StrStyleCommand.Lookup(pIdentyString,(void *&)dwIdenty)){
prm.lpstrPreFix=UniVar::NewBlock(strlen(pIdentyString)+1);
strcpy(prm.lpstrPreFix,pIdentyString);
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(dwIdentyId!=WORD_IDENTY||dwIdentyId==WORD_ENDOFFILE||dwIdentyId==WORD_ENDOFLINE){
WriteError(pName,m_icLine,pIdentyString,"unknown words");
m_ierror++;
ierror=1;
break;
}
if(!CStyle::m_StrStyleCommand.Lookup(pIdentyString,(void *&)dwIdenty)){
WriteError(pName,m_icLine,pIdentyString,"unknown words");
m_ierror++;
ierror=1;
break;
}
}
if(dwIdenty==WORD_INT_TYPE)
prm.tv=(0);
else if(dwIdenty==WORD_FLOAT_TYPE)
prm.tv=(0.0f);
else if(dwIdenty==WORD_DWORD_TYPE)
prm.tv=(DWORD(0));
else if(dwIdenty==WORD_STRING_TYPE)
prm.tv=("");
else if(dwIdenty==WORD_HANDLE_TYPE){
prm.tv=((DWORD)0);
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
int ilen=0;
if(dwIdentyId==WORD_UINT)ilen=atoi(pIdentyString);
if(ilen<0||ilen>=(int)0xfffff0){
WriteError(pName,m_icLine,pIdentyString,"error block data area size defined");
m_ierror++;
ierror=1;
break;
}
prm.tv.SetValue((void *)NULL,ilen);
}
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(dwIdentyId==WORD_OPERATOR){
if(!strcmp(pIdentyString,"&")){
prm.tv.inout=1;
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
}
else {
WriteError(pName,m_icLine,pIdentyString,"unknown words");
m_ierror++;
ierror=1;
break;
}
}
else
prm.tv.inout=0;
if(dwIdentyId==WORD_ENDOFFILE||dwIdentyId==WORD_ENDOFLINE){
WriteError(pName,m_icLine,pIdentyString,"not a complete clause");
m_ierror++;
ierror=1;
break;
}
if(dwIdentyId!=WORD_IDENTY){
WriteError(pName,m_icLine,pIdentyString,"lost data type define");
m_ierror++;
ierror=1;
break;
}
CString cs=csTempNow;
cs+="__";
cs+=pIdentyString;
m_FlowStrTable.SetAt((LPCTSTR)cs,(void *)((lbs.dwVarNum)|TYPE_LOCALVAR));
lbs.dwVarNum++;
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
prm.tv.btmust=1;
if(dwIdentyId==WORD_OPERATOR){
if(!strcmp(pIdentyString,"=")){
int iv=prm.tv.inout;
prm.tv.btmust=0;
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(dwIdentyId==WORD_UINT){
int i=atoi(pIdentyString);
if(strlen(pIdentyString)>2){
if(pIdentyString[1]=='x'||pIdentyString[1]=='X'){
sscanf(pIdentyString,"%lx",&i);
}
}
if(prm.tv.it==DATA_TYPE_INT)
prm.tv=i;
else if(prm.tv.it==DATA_TYPE_DWORD)
prm.tv=(DWORD)i;
else if(prm.tv.it==DATA_TYPE_FLOAT)
prm.tv=(double)i;
else {
WriteError(pName,m_icLine,pIdentyString,"error parameter define");
m_ierror++;
ierror=1;
break;
//error
}
}
else if(dwIdentyId==WORD_FLOAT){
if(prm.tv.it==DATA_TYPE_INT)
prm.tv=((int)atof(pIdentyString));
else if(prm.tv.it==DATA_TYPE_DWORD)
prm.tv=((DWORD)atof(pIdentyString));
else if(prm.tv.it==DATA_TYPE_FLOAT)
prm.tv=(atof(pIdentyString));
else {
WriteError(pName,m_icLine,pIdentyString,"error parameter define");
m_ierror++;
ierror=1;
break;
//error
}
}
else if(dwIdentyId==WORD_STRING){
if(prm.tv.it==DATA_TYPE_STRING)
prm.tv=(pIdentyString);
else {
WriteError(pName,m_icLine,pIdentyString,"error parameter define");
m_ierror++;
ierror=1;
break;
//error
}
}
else if(dwIdentyId==WORD_OPERATOR){
if(!strcmp(pIdentyString,"-")){
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(dwIdentyId==WORD_UINT){
if(prm.tv.it==DATA_TYPE_INT)
prm.tv=(0-atoi(pIdentyString));
else if(prm.tv.it==DATA_TYPE_FLOAT)
prm.tv=(0.0f-atoi(pIdentyString));
else {
WriteError(pName,m_icLine,pIdentyString,"error parameter define");
m_ierror++;
ierror=1;
break;
//error
}
}
else if(dwIdentyId==WORD_FLOAT){
if(prm.tv.it==DATA_TYPE_INT)
prm.tv=(0-(int)atof(pIdentyString));
else if(prm.tv.it==DATA_TYPE_FLOAT)
prm.tv=(0.0f-atof(pIdentyString));
else {
WriteError(pName,m_icLine,pIdentyString,"error parameter define");
m_ierror++;
ierror=1;
break;
//error
}
}
else {
//error
WriteError(pName,m_icLine,pIdentyString,"this type pemeter cont have default valueu");
m_ierror++;
ierror=1;
break;
}
}
else {
//error
WriteError(pName,m_icLine,pIdentyString,"lost default value ");
m_ierror++;
ierror=1;
break;
}
}
else {
//error
WriteError(pName,m_icLine,pIdentyString,"lost default value");
m_ierror++;
ierror=1;
break;
}
prm.tv.inout=iv;
prm.tv.btmust=0;
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
}
else {
if(!strcmp(pIdentyString,"//")){
m_ParamArray.Add(prm);
lbs.ParamNum++;
break;
}
else {
WriteError(pName,m_icLine,pIdentyString,"unknown words");
m_ierror++;
ierror=1;
break;
}
}
}
if(dwIdentyId==WORD_COMMA){
m_ParamArray.Add(prm);
lbs.ParamNum++;
}
else if(dwIdentyId==WORD_ENDOFFILE||dwIdentyId==WORD_ENDOFLINE){
m_ParamArray.Add(prm);
lbs.ParamNum++;
break;
}
else {
if(!strcmp(pIdentyString,"//")){
m_ParamArray.Add(prm);
lbs.ParamNum++;
break;
}
else {
WriteError(pName,m_icLine,pIdentyString,"unknown words,lost , before next parameter");
m_ierror++;
ierror=1;
break;
}
}
};
if(ierror){
if(prm.lpstrPreFix)UniVar::DeleteBlock(prm.lpstrPreFix);
}
else {
if(lbs.ParamNum)
lbs.iStartParam=m_ParamArray.GetSize()-lbs.ParamNum;
else lbs.iStartParam=-1;
dwIdenty=WORD_ENDOFLINE;
if(bRealDef){
m_LineCode.Add(lbs.dwUserFuncPositionId);
m_LineCode.Add(dwIdenty);
}
m_ListFunction.Add(lbs);
m_FlowStrTable.SetAt((LPCTSTR)csTempNow,(void *)lbs.dwUserFuncPositionId);
if(bRealDef){
m_mypos.istype=TYPE_FUNC_POS;
m_mypos.pt.pf=&m_ListFunction[m_ListFunction.GetSize()-1];
bAddLineCode=TRUE;
}
}
}
}
break;
case WORD_STARTEVENT:
{
pIdentyString=m_pScanner->ReadWord(pName,dwIdentyId,m_icLine);
if(m_mypos.istype!=TYPE_PUBLIC_POS){
WriteError(pName,m_icLine,pIdentyString,"define event in other object erea");
m_ierror++;
break;
}
m_mypos.csTemp=pIdentyString;
CString cs=pIdentyString;
cs="\'"+cs;
if(GetPositionId((LPSTR)(LPCTSTR)cs,dwIdenty)){
if((dwIdenty&ITYPE_FILTER)==TYPE_EVENT){
WriteError(pName,m_icLine,pIdentyString,"event already defined");
m_ierror++;
}
else {
WriteError(pName,m_icLine,pIdentyString,"unknown words");
m_ierror++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -