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

📄 mystring.lst

📁 此代码是实现将lwip协议移植于51单片机的测试程序
💻 LST
字号:
C51 COMPILER V7.02b   MYSTRING                                                             08/25/2006 11:59:57 PAGE 1   


C51 COMPILER V7.02b, COMPILATION OF MODULE MYSTRING
OBJECT MODULE PLACED IN mystring.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE mystring\mystring.c LARGE INCDIR(c:\t\inc;c:\t\inc) DEBUG OBJECTEXTEND PRIN
                    -T(.\mystring.lst) OBJECT(mystring.obj)

stmt level    source

   1          //**********************************************************************************
   2          //杨屹    2002/08/20    第一版
   3          //字符串操作函数
   4          //联系方法:gdtyy@ri.gdt.com.cn(2003/07/31以前有效)
   5          //**********************************************************************************
   6          //使用方法:
   7          //自包含
   8          //与标准库函数用法相同。
   9          //**********************************************************************************
  10          #include <general.h>
*** WARNING C318 IN LINE 10 OF mystring\mystring.c: can't open file 'general.h'
  11          //#include <mystring.h>
  12          //#include <serial.h>
  13          
  14          void yystrlwr(unsigned char *str)//将字符串全部转换成小写格式
  15          {
  16   1              int i;
  17   1              unsigned char ch;
  18   1              for(i=0;1;i++){
  19   2                      ch=*(str+i);
  20   2                      if(ch=='\0') break;
  21   2                      else if(ch>='A'&&ch<='Z') *(str+i)=ch-'A'+'a';
  22   2              }       
  23   1      }
  24          
  25          char yystrcmp(unsigned char *stra,unsigned char *strb)//比较a和b两个字符串的大小,a>b 1 a=b 0 a<b -1
  26          {
  27   1              int i;
  28   1              unsigned char cha,chb;
  29   1              for(i=0;1;i++){
  30   2                      cha=*(stra+i);
  31   2                      chb=*(strb+i);
  32   2                      if(cha=='\0'&&chb=='\0') return 0;
  33   2                      else if(cha>chb) return 1;
  34   2                      else if(cha<chb) return -1;
  35   2              }       
  36   1      }
  37          
  38          unsigned int yystrlen(unsigned char *str)//计算字符串长度,不包括'\0'标志。
  39          {
  40   1              unsigned int i=0;
  41   1      
  42   1              while(*str++!='\0'){
  43   2                      i++;
  44   2              }
  45   1                      
  46   1              return i;
  47   1      }
  48          
  49          bit StrToNum(unsigned char *Str,long int *Num)//字符串转换成数值(自动区分十进制“无前缀”和十六进制“0x”
             -)
  50          {
  51   1              int i=0;
  52   1              unsigned char ch;
C51 COMPILER V7.02b   MYSTRING                                                             08/25/2006 11:59:57 PAGE 2   

  53   1              long int x=0;
  54   1      
  55   1              if(Str[0]=='0'&&(Str[1]=='x'|Str[1]=='X')){
  56   2                      i=2;
  57   2                      ch=Str[i];
  58   2                      while(ch!='\0'&&i<MaxLenStr){
*** ERROR C202 IN LINE 58 OF MYSTRING\MYSTRING.C: 'MaxLenStr': undefined identifier
  59   3                              if((ch<'0'||ch>'9')&&(ch<'a'||ch>'z')&&(ch<'A'||ch>'Z')) return 0;
  60   3                              else{
  61   4                                      if(ch>='0'&&ch<='9') x=x*16+(ch-'0');
  62   4                                      else if(ch>='a'&&ch<='z') x=x*16+(ch-'a'+10);
  63   4                                      else x=x*16+(ch-'A'+10);
  64   4                                      //x=x*10+(ch-'0');
  65   4                              }
  66   3                              i=i+1;
  67   3                              ch=Str[i];
  68   3                      }
  69   2                      if(i<MaxLenStr||Str[MaxLenStr]=='\0'){
*** ERROR C202 IN LINE 69 OF MYSTRING\MYSTRING.C: 'MaxLenStr': undefined identifier
  70   3                              *Num=x;
  71   3                              return 1;
  72   3                      }
  73   2                      else return 0;
  74   2              }
  75   1              else{
  76   2                      i=0;
  77   2                      ch=Str[i];
  78   2                      while(ch!='\0'&&i<MaxLenStr){
*** ERROR C202 IN LINE 78 OF MYSTRING\MYSTRING.C: 'MaxLenStr': undefined identifier
  79   3                              if(ch<'0'||ch>'9') return 0;
  80   3                              else x=x*10+(ch-'0');
  81   3                              i=i+1;
  82   3                              ch=Str[i];
  83   3                      }
  84   2                      if(i<MaxLenStr||Str[MaxLenStr]=='\0'){
*** ERROR C202 IN LINE 84 OF MYSTRING\MYSTRING.C: 'MaxLenStr': undefined identifier
  85   3                              *Num=x;
  86   3                              return 1;
  87   3                      }
  88   2                      else return 0;
  89   2              }
  90   1      }
  91          
  92          bit StrToHEX(unsigned char *Str,long int *Num)//字符串转换成数值(默认字符串为十六进制数值表示)
  93          {
  94   1              int i=0;
  95   1              unsigned char ch;
  96   1              long int x=0;
  97   1      
  98   1              ch=Str[i];
  99   1              while(ch!='\0'&&i<MaxLenStr){
*** ERROR C202 IN LINE 99 OF MYSTRING\MYSTRING.C: 'MaxLenStr': undefined identifier
 100   2                      if((ch<'0'||ch>'9')&&(ch<'a'||ch>'z')&&(ch<'A'||ch>'Z')) return 0;
 101   2                      else{
 102   3                              if(ch>='0'&&ch<='9') x=x*16+(ch-'0');
 103   3                              else if(ch>='a'&&ch<='z') x=x*16+(ch-'a'+10);
 104   3                              else x=x*16+(ch-'A'+10);
 105   3                      }
 106   2                      i=i+1;
 107   2                      ch=Str[i];
 108   2              }
 109   1              if(i<MaxLenStr||Str[MaxLenStr]=='\0'){
C51 COMPILER V7.02b   MYSTRING                                                             08/25/2006 11:59:57 PAGE 3   

*** ERROR C202 IN LINE 109 OF MYSTRING\MYSTRING.C: 'MaxLenStr': undefined identifier
 110   2                      *Num=x;
 111   2                      return 1;
 112   2              }
 113   1              else return 0;
 114   1      
 115   1      }

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

⌨️ 快捷键说明

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