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

📄 shell.lst

📁 基于RTX51系统,C语言写的程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.12   SHELL                                                                 09/22/2008 16:30:54 PAGE 1   


C51 COMPILER V8.12, COMPILATION OF MODULE SHELL
OBJECT MODULE PLACED IN shell.OBJ
COMPILER INVOKED BY: E:\keil\C51\BIN\C51.EXE shell.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include<rtx51tny.h>
   2          #include<reg52.h>
   3          
   4          #define MaxLenWord 20 /*20   单词最大长度*/                 
   5          #define MaxLenWordTable 10 /*10   词表最多字数*/
   6          #define MaxLenComNumBuf 256 /*256   命令缓冲区最大长度*/
   7          #define MaxComNum 30         //最大命令种类数
   8          #define MaxLenCom 10         //命令最大长度
   9          #define MAIN 0
  10          int i;
  11          unsigned char ch;
  12          typedef struct{
  13                          int Num;     //有效单词数
  14                          int LeftCurveNum;  //左括号数
  15                          int RightCurveNum; //右括号数
  16                          struct{
  17                                 int Length;
  18                                 unsigned char Str[MaxLenWord+1]; //单词内容+'\0' 
  19                                }wt[MaxLenWordTable];               
  20          }stWORDTABLE;
  21          
  22          
  23          unsigned  char ComTable[MaxComNum][MaxLenCom+1]= {"com1","com2","com3","com4","com5","com6","com7","out","
             -close","help","debug"};
  24            
  25            //os_create_task(MAIN);
  26          
  27          void TaskMain(void)_task_ MAIN  //主任务定义
  28          {
  29   1        //串口人机界面的初始界面
  30   1        PrintStr("\t\t****************************************\n");
*** WARNING C206 IN LINE 30 OF SHELL.C: 'PrintStr': missing function-prototype
*** ERROR C267 IN LINE 30 OF SHELL.C: 'PrintStr': requires ANSI-style prototype
  31   1        PrintStr("\t\t*    Welcome to use SimpleShell        *\n");
  32   1        PrintStr("\t\t****************************************\n\n\n");
  33   1        
  34   1        PrintStr(">");                    //串口人机界面的命令提示符
  35   1        while(!ShellEnd)
*** ERROR C202 IN LINE 35 OF SHELL.C: 'ShellEnd': undefined identifier
  36   1        {
  37   2          switch(State)
*** ERROR C202 IN LINE 37 OF SHELL.C: 'State': undefined identifier
  38   2           {
  39   3              case StatInputCom:
*** ERROR C202 IN LINE 39 OF SHELL.C: 'StatInputCom': undefined identifier
  40   3                  {
  41   4                   if(ch=_getkey())
  42   4                   {
  43   5                      if(ch==13)
  44   5                      {
  45   6                       PrintStr("\n");
  46   6                        ComBuf[i+1]='\0';
  47   6                        if(i+1==0)
  48   6                          PrintStr(">");
  49   6                        else
C51 COMPILER V8.12   SHELL                                                                 09/22/2008 16:30:54 PAGE 2   

  50   6                          State=StatExeCom;
  51   6                       } 
  52   5                      else
  53   5                         {
  54   6                          i=i+1;
  55   6                          if((i>=MaxLenComBuf)&&(ch!=8))
  56   6                            {
  57   7                             putchar(7);
  58   7                             i=MaxLenComBuf-1;
  59   7                            }
  60   6                           else
  61   6                             {
  62   7                              if(ch==8)
  63   7                                {
  64   8                                 i=i-2;
  65   8                                 if(i<-1)
  66   8                                  {i=-1;putchar(7);}
  67   8                                 else
  68   8                                  {
  69   9                                   putchar(8);
  70   9                                   putchar(' ');
  71   9                                   putchar(8);    
  72   9                                   }
  73   8                                }
  74   7                               else
  75   7                                {
  76   8                                 putchar(ch);
  77   8                                 ComBuf[i]=ch;
  78   8                                }
  79   7                              }
  80   6                          }
  81   5                        break;
  82   5                   }
  83   4                    else
  84   4                    {
  85   5                     os_wait(K_IVL,10,0);
  86   5                     break;
  87   5                  }     
  88   4            }
  89   3            case StatExeCom:
  90   3                 {
  91   4                  PrintStr("\n");
  92   4                  if(InterpretCommand(ComBuf,&WordTable)==1&& WordTable.Num !=0)
  93   4                    {
  94   5                     strlwr(WordTable.wt[0].Str);
  95   5                      for(tem=0;tem<MaxComNum&&!ComMatchFlag;tem++)
  96   5                       if(strcmp(WordTable.wt[0].Str,ComTale[tem])==0)
  97   5                         ComMatchFlag=1;
  98   5                        if(ComMatchFlag)
  99   5                          {
 100   6                           tem--;
 101   6                           switch(tem)
 102   6                            {
 103   7                             case 0:{Command1(&WordTable);break;}
 104   7                             case 1:{Command2(&WordTable);break;}
 105   7                             case 2:{Command3(&WordTable);break;}
 106   7                             case 3:{Command4(&WordTable);break;}
 107   7                             case 4:{Command5(&WordTable);break;}
 108   7                             case 5:{Command6(&WordTable);break;}
 109   7                             case 6:{Command7(&WordTable);break;}
 110   7                             case 7:{DebugOut(&WordTable);break;}
 111   7                             case 8:
C51 COMPILER V8.12   SHELL                                                                 09/22/2008 16:30:54 PAGE 3   

 112   7                                    {
 113   8                                     //ShellEnd=1;
 114   8                                     PrintStr("\n\t This Command is limited!\n\n");
 115   8                                     break;    
 116   8                                     }
 117   7                             case 9:{clrscr();break;}
 118   7                             case 10:{DisplayHelpMenu(&WordTable);break;}
 119   7                             case 11:{DebugChange(&WordTable);break;}    
 120   7                             }
 121   6                          }
 122   5                          else
 123   5                           PrintStr("  Bad command!\n\n");
 124   5                         }
 125   4                         else
 126   4                            {
 127   5                              if(WordTable.Num)
 128   5                                PrintStr("  Bad command!\n\n");
 129   5                             }
 130   4                       ComMatchFlag=0;
 131   4                       State=StatInputCom;
 132   4                        if(ShellEnd)
 133   4                        {
 134   5                         PrintStr("\n\n");
 135   5                        }
 136   4                       else PrintStr(">");
 137   4                       i=-1;
 138   4                       break;
 139   4                       }
 140   3                       default:
 141   3                              {
 142   4                                //ShellEnd=1;
 143   4                                 PrintStr("System fatal error!\n");
 144   4                                 putchar(7);putchar(7);putchar(7);
 145   4                               }
 146   3                 }                             
 147   2             }  
 148   1          }
 149          
 150          
 151          
 152          /////////////////////////////////////////////////////////
 153          
 154          bit InterpretCommand(unsigned char *Combuf,stWORDTABLE *WordTable)
 155          {
 156   1        int i=0;
 157   1        int j=0;
 158   1        int k=-1;
 159   1        int StrFlag=0;

⌨️ 快捷键说明

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