ucosiiucosii
typedef struct{
int Num;
int LeftCurveNum,RightCurveNum; struct{
int Length;
unsigned char Str[MaxLenWord+1]; /*for '\0'*/ } wt[MaxLenWordTable];
} WORDTABLE;
bit GetWord(unsigned char *ComBuf,WORDTABLE *WordTable)
{
int i=0; /*ComBuf String po...
ucosii
typedef struct{
int Num;
int LeftCurveNum,RightCurveNum; struct{
int Length;
unsigned char Str[MaxLenWord+1]; /*for '\0'*/ } wt[MaxLenWordTable];
} WORDTABLE;
bit GetWord(unsigned char *ComBuf,WORDTABLE *WordTable)
{
int i=0; /*ComBuf String pointer*/ int j=0; /*Length of Word */
int k=-1; /*The number of WordTable*/ int StrFlag=0; /*There is "0-9/a-z/A-Z" before " ,()"*/
int SentenceEndFlag=0; /*Sentence end*/ char ch;
WordTable->Num=0;
WordTable->LeftCurveNum=0;
WordTable->RightCurveNum=0;
ch=ComBuf[0];
while(!SentenceEndFlag&&i='0'&&ch<='9')||(ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')||(ch=='.')){
if(StrFlag==0){
StrFlag=1;k=k+1;j=0;
if(k>=MaxLenWordTable) return 0; WordTable->wt[k].Str[j]=ch;
WordTable->Num=k+1;
}
else{
j=j+1;
if(j>=MaxLenWord) return 0;
WordTable->wt[k].Str[j]=ch;
}
}
else if(ch==' '||ch==','||ch=='('||ch==')'||ch=='\0'){
if(ch=='(') WordTable->LeftCurveNum++; if(ch==')') WordTable->RightCurveNum++; if(StrFlag==1){
StrFlag=0;j=j+1;
WordTable->wt[k].Str[j]='\0';
WordTable->wt[k].Length=j;
}
if(ch=='\0') SentenceEndFlag=1; }
else{
return 0;
}
i=i+1;
ch=ComBuf[i];
}
if(i
if(WordTable->LeftCurveNum==WordTable->RightCurveNum) return 1;
else return 0;
}
else{
return 0;
}
}
void yyshell(void *yydata) reentrant {
yydata=yydata;
clrscr();
PrintStr("\t\t***********************************************\n");
PrintStr("\t\t* Welcom to use this program *\n");
PrintStr("\t\t* Author:YangYi 20020715 *\n");
PrintStr("\t\t***********************************************\n\n\n");
/*Login & Password*/
PrintStr("% ");
while(!ShellEnd){
switch(State){
case StatInputCom:{
if(yygetch(&ch)){
if(ch==13) /*Enter return key*/ {
PrintStr("\n");
ComBuf[i+1]='\0';
if(i+1==0) PrintStr("% "); else
State=StatExeCom;
}
else{
i=i+1;
if((i>=MaxLenComBuf)&&(ch!=8)){ PrintChar(7);
i=MaxLenComBuf-1;
}
else{
if(ch==8){
i=i-2;
if(i<-1) {i=-1;PrintChar(7);}
else{
PrintChar(8);
PrintChar(' ');
PrintChar(8);
}
}
else{
PrintChar(ch);
ComBuf[i]=ch;
}
}
}
break;
}
else{
//OSTimeDly(10);
break;
}
}
case StatExeCom:{
if(GetWord(ComBuf,&WordTable)==1&&WordTable.Num!=0){
yystrlwr(WordTable.wt[0].Str);
for(tem=0;tem
本文档为【ucosii】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。