⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shell.lst

📁 基于RTX51系统,C语言写的程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 160   1      
 161   1        int SentenceEndFlag=0;
 162   1        char ch;
 163   1        WordTable->Num=0;
 164   1        WordTable->LeftCurveNum=0;
 165   1        WordTable->RightCurveNum=0;
 166   1      
 167   1        ch=ComBuf[0];
 168   1        while(!SentenceEndFlag&&i<MaxLenComBuf)
 169   1           {
 170   2            if((ch>='0'&&ch<='9')||(ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')||(ch=='.'))
 171   2              {
 172   3                if(StrFlag==0)
 173   3                 {  StrFlag=1;
C51 COMPILER V8.12   SHELL                                                                 09/22/2008 16:30:54 PAGE 4   

 174   4                    k=k+1;
 175   4                    j=0;
 176   4                    if(k>MaxLenWordTable)
 177   4                      return 0;
 178   4                    WordTable->wt[k].Str[j]=ch;
 179   4                    WordTable->Num=k+1;
 180   4                   
 181   4                 }
 182   3                else
 183   3                 {
 184   4                   j=j+1;
 185   4                   if(j>=MaxLenWord) return 0;
 186   4                   WordTable->wt[k].Str[j]=ch;
 187   4                 }   
 188   3               }
 189   2             else if(ch==' '||ch==','||ch=='('||ch==')'||ch=='\0')
 190   2                   {
 191   3                     if(ch=='(')
 192   3                       WordTable->LeftCurveNum++;
 193   3                     if(ch==')')
 194   3                       WordTable->RightCurveNum++;
 195   3                     if(StrFlag==1)
 196   3                       {
 197   4                        StrFlag=0;j=j+1;
 198   4                        WordTable->wt[k].Str[j]='\0';
 199   4                        WordTable->wt[k].Length=j;
 200   4                       }
 201   3                     if(ch=='\0')
 202   3                        SentenceEndFlag=1; 
 203   3                    }
 204   2               else
 205   2                  {return 0;}
 206   2               i=i+1;
 207   2               ch=ComBuf[i];     
 208   2           }
 209   1           if(i<MaxLenComBuf||ComBuf[MaxLenComBuf]=='\0')
 210   1             {if(WordTable->LeftCurveNum==WordTable->RightCurveNum)
 211   2                 return 1;
 212   2              else
 213   2                 return 0;
 214   2              }
 215   1            else
 216   1              {return 0;}               
 217   1      }
 218          ///////////////////////////help&debug///////////////////////////////
 219          void DisplayHelpMenu(stWORDTABLE WordTable)
 220          {
 221   1       WordTable=WordTable;
 222   1       PrintStr("\n");
 223   1       PrintStr("\tcom1    Command1.\n");
 224   1       PrintStr("\tcom2    Command2.\n");
 225   1       PrintStr("\tcom3    Command3.\n");
 226   1       PrintStr("\tcom4    Command4.\n");
 227   1       PrintStr("\tcom5    Command5.\n");
 228   1       PrintStr("\tcom6    Command6.\n");
 229   1       PrintStr("\tcom7    Command7.\n");
 230   1       PrintStr("\tout     Set P0 out data.\n");
 231   1       PrintStr("\tclose   Exit.(this command is limited here.)\n");
 232   1       PrintStr("\tclr     Clear sreen.\n");
 233   1       PrintStr("\thelp    Display this menu.\n\n");
 234   1       PrintStr("\tdebug   Set debug parameter.\n\n");
 235   1      }
C51 COMPILER V8.12   SHELL                                                                 09/22/2008 16:30:54 PAGE 5   

 236          
 237          
 238          void Debugchange(stWORDTABLE *WordTable)
 239          {
 240   1       if(WordTable->Num==1)
 241   1          PrintStr("\n\tPlease input New Value!\n\n");
 242   1       else
 243   1         {
 244   2          if((WordTable->wt[1].Str[0]>='0')&&(WordTable->wt[1].Str[0]<='9'))
 245   2             mDebug=WordTable->wt[1].Str[0]-'0';
 246   2          else
 247   2            {PrintStr("\n\tValue Error!\n\n");return;}
 248   2         }
 249   1       PrintStr("mDebug=");
 250   1       PrintByte(mDebug);
 251   1       PrintStr("\n");
 252   1      }
 253          //////////////////////////////////////////// out/////////////////////////
 254          void Debugout(stWORDTABLE *WordTable)
 255          {
 256   1       unsigned char i;
 257   1       outDebug=0;
 258   1       if(WordTable->Num==1)
 259   1        {
 260   2         printStr("\n\tPlease input New Value!\n\n");
 261   2         return;
 262   2        }
 263   1       else
 264   1        {
 265   2         if(WordTable->wt[1].Length>3)
 266   2          {
 267   3           PrintStr("\n\tPlease input Corrret Value!\n\n");
 268   3           return;
 269   3          }
 270   2          else
 271   2           {
 272   3             for(i=0;i<WordTable->wt[1].Length;i++)
 273   3              {
 274   4      
 275   4               if(WordTable->wt[1].Str[i]>='0'&&WordTable->wt[1].Str[i]<='9')
 276   4                 outDebug=outDebug+WordTable->wt[1].Str[i]-'0';
 277   4               else
 278   4                 {
 279   5                  PrintStr("\n\tPlease input Corrret Value!\n\n");
 280   5                  return;
 281   5                 }
 282   4               outDebug=outDebug*10; 
 283   4             }
 284   3             outDebug=outDebug/10;
 285   3             if(outDebug>255)
 286   3               PrintStr("\n\tPlease input Corrret Value!\n\n");
 287   3             else
 288   3               {
 289   4                i=(unsigned char)outDebug;
 290   4                P0=i;
 291   4               } 
 292   3             } 
 293   2         }
 294   1       PrintStr("outDebug=");
 295   1       PrintByte(unsigned char)outDebug;
 296   1       PrintStr("\n");
 297   1      }
C51 COMPILER V8.12   SHELL                                                                 09/22/2008 16:30:54 PAGE 6   

 298          ////////////////////////////////////////debug_add//////////////
 299          /*void TaskUser1 (void)_task_ USER1
 300          {
 301           for(;;)
 302           {
 303            if(mDebug&0x1)
 304             PrintStr("\tUserTask1 is active.\n");
 305             os_wait(K_TMO,255,0);
 306           }
 307          }
 308          
 309          void TaskUser2(void)_task_ USER2
 310          {
 311            int i;
 312            i=0;
 313            for(;;)
 314            {
 315             if(mDebug&0x2)
 316             {
 317              i=1-i;
 318              if(i==0)
 319                P0=0;
 320              else
 321                P0=1;
 322             }
 323            os_wait(K_TMO,255,0);   
 324           }
 325          }
 326          
 327           */

C51 COMPILATION COMPLETE.  1 WARNING(S),  4 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -