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

📄 lib_str.lst

📁 lpc2478开发板基于IAR编译器移植ucos实验例程
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   00000094   0300B0E1           MOVS     R0,R3
   \                     ??Str_Copy_N_1:
   \   00000098   3000BDE8           POP      {R4,R5}
   \   0000009C   0EF0A0E1           MOV      PC,LR            ;; return
    313          }
    314          
    315          
    316          /*$PAGE*/
    317          /*
    318          *********************************************************************************************************
    319          *                                              Str_Cat()
    320          *
    321          * Description : Append concatenation string to destination string.
    322          *
    323          * Argument(s) : pdest       Pointer to destination   string to append concatenation  string (see Note #1).
    324          *
    325          *               pstr_cat    Pointer to concatenation string to append to destination string.
    326          *
    327          * Return(s)   : Pointer to destination string, if NO errors (see Note #2).
    328          *
    329          *               Pointer to NULL,               otherwise.
    330          *
    331          * Caller(s)   : various.
    332          *
    333          * Note(s)     : (1) Destination string buffer size NOT validated; buffer overruns MUST be prevented by caller.
    334          *
    335          *                   (a) Destination buffer size MUST be large enough to accomodate the entire concatenated
    336          *                       string size including the terminating NULL character.
    337          *
    338          *               (2) String concatenation terminates when :
    339          *
    340          *                   (a) Destination/Concatenation string pointer(s) are passed NULL pointers.
    341          *                       (1) No string concatenation performed; NULL pointer returned.
    342          *
    343          *                   (b) Destination string overlaps with NULL address.
    344          *                       (1) No string concatenation performed; NULL pointer returned.
    345          *
    346          *                   (c) Destination/Concatenation string pointer(s) points to NULL.
    347          *                       (1) String buffer(s) overlap with NULL address.
    348          *                       (2) Concatenation string appended into destination string buffer up to but NOT
    349          *                           beyond or including the NULL address; destination string buffer properly
    350          *                           terminated with NULL character.
    351          *
    352          *                   (d) Concatenation string's terminating NULL character found.
    353          *                       (1) Entire concatenation string appended to destination string.
    354          *********************************************************************************************************
    355          */
    356          

   \                                 In segment CODE, align 4, keep-with-next
    357          CPU_CHAR  *Str_Cat (CPU_CHAR  *pdest,
    358                              CPU_CHAR  *pstr_cat)
    359          {
   \                     Str_Cat:
   \   00000000   0020B0E1           MOVS     R2,R0
    360              CPU_CHAR  *pstr;
    361              CPU_CHAR  *pstr_next;
    362          
    363                                                                          /* Rtn NULL if str ptr(s) NULL (see Note #2a).          */
    364              if (pdest == (CPU_CHAR *)0) {
   \   00000004   000052E3           CMP      R2,#+0
   \   00000008   0100001A           BNE      ??Str_Cat_0
    365                  return  ((CPU_CHAR *)0);
   \   0000000C   0000A0E3           MOV      R0,#+0
   \   00000010   210000EA           B        ??Str_Cat_1
    366              }
    367              if (pstr_cat == (CPU_CHAR *)0) {
   \                     ??Str_Cat_0:
   \   00000014   000051E3           CMP      R1,#+0
   \   00000018   0100001A           BNE      ??Str_Cat_2
    368                  return  ((CPU_CHAR *)0);
   \   0000001C   0000A0E3           MOV      R0,#+0
   \   00000020   1D0000EA           B        ??Str_Cat_1
    369              }
    370          
    371          
    372              pstr = pdest;
   \                     ??Str_Cat_2:
   \   00000024   0230B0E1           MOVS     R3,R2
    373              while (( pstr != (CPU_CHAR *)0) &&                          /* Adv to end of cur dest str until NULL ptr ...        */
    374                     (*pstr != (CPU_CHAR  )0)) {                          /* ... or NULL char found..                             */
   \                     ??Str_Cat_3:
   \   00000028   000053E3           CMP      R3,#+0
   \   0000002C   0400000A           BEQ      ??Str_Cat_4
   \   00000030   0000D3E5           LDRB     R0,[R3, #+0]
   \   00000034   000050E3           CMP      R0,#+0
   \   00000038   0100000A           BEQ      ??Str_Cat_4
    375                  pstr++;
   \   0000003C   013093E2           ADDS     R3,R3,#+1
   \   00000040   F8FFFFEA           B        ??Str_Cat_3
    376              }
    377              if (pstr == (CPU_CHAR *)0) {                                /* If NULL str overrun, rtn NULL (see Note #2b).        */
   \                     ??Str_Cat_4:
   \   00000044   000053E3           CMP      R3,#+0
   \   00000048   0100001A           BNE      ??Str_Cat_5
    378                  return ((CPU_CHAR *)0);
   \   0000004C   0000A0E3           MOV      R0,#+0
   \   00000050   110000EA           B        ??Str_Cat_1
    379              }
    380          
    381              pstr_next = pstr;
   \                     ??Str_Cat_5:
   \   00000054   03C0B0E1           MOVS     R12,R3
    382              pstr_next++;
   \   00000058   01C09CE2           ADDS     R12,R12,#+1
    383              while (( pstr_next != (CPU_CHAR *)0) &&                     /* Cat str until NULL ptr(s) (see Note #2c) ...         */
    384                     ( pstr_cat  != (CPU_CHAR *)0) &&
    385                     (*pstr_cat  != (CPU_CHAR  )0)) {                     /* ... or NULL char found    (see Note #2d).            */
   \                     ??Str_Cat_6:
   \   0000005C   00005CE3           CMP      R12,#+0
   \   00000060   0A00000A           BEQ      ??Str_Cat_7
   \   00000064   000051E3           CMP      R1,#+0
   \   00000068   0800000A           BEQ      ??Str_Cat_7
   \   0000006C   0000D1E5           LDRB     R0,[R1, #+0]
   \   00000070   000050E3           CMP      R0,#+0
   \   00000074   0500000A           BEQ      ??Str_Cat_7
    386                 *pstr = *pstr_cat;
   \   00000078   0000D1E5           LDRB     R0,[R1, #+0]
   \   0000007C   0000C3E5           STRB     R0,[R3, #+0]
    387                  pstr++;
   \   00000080   013093E2           ADDS     R3,R3,#+1
    388                  pstr_next++;
   \   00000084   01C09CE2           ADDS     R12,R12,#+1
    389                  pstr_cat++;
   \   00000088   011091E2           ADDS     R1,R1,#+1
   \   0000008C   F2FFFFEA           B        ??Str_Cat_6
    390              }
    391          
    392             *pstr = (CPU_CHAR)0;                                         /* Append NULL char (see Note #2c2).                    */
   \                     ??Str_Cat_7:
   \   00000090   0000A0E3           MOV      R0,#+0
   \   00000094   0000C3E5           STRB     R0,[R3, #+0]
    393          
    394          
    395              return (pdest);
   \   00000098   0200B0E1           MOVS     R0,R2
   \                     ??Str_Cat_1:
   \   0000009C   0EF0A0E1           MOV      PC,LR            ;; return
    396          }
    397          
    398          
    399          /*$PAGE*/
    400          /*
    401          *********************************************************************************************************
    402          *                                             Str_Cat_N()
    403          *
    404          * Description : Append concatenation string to destination string, up to a maximum number of characters.
    405          *
    406          * Argument(s) : pdest       Pointer to destination   string to append concatenation  string (see Note #1).
    407          *
    408          *               pstr_cat    Pointer to concatenation string to append to destination string.
    409          *
    410          *               len_max     Maximum number of characters to concatenate (see Note #2e).
    411          *
    412          * Return(s)   : Pointer to destination string, if NO errors (see Note #2).
    413          *
    414          *               Pointer to NULL,               otherwise.
    415          *
    416          * Caller(s)   : various.
    417          *
    418          * Note(s)     : (1) Destination string buffer size NOT validated; buffer overruns MUST be prevented by caller.
    419          *
    420          *                   (a) Destination buffer size MUST be large enough to accomodate the entire concatenated
    421          *                       string size including the terminating NULL character.
    422          *
    423          *               (2) String concatenation terminates when :
    424          *
    425          *                   (a) Destination/Concatenation string pointer(s) are passed NULL pointers.
    426          *                       (1) No string concatenation performed; NULL pointer returned.
    427          *
    428          *                   (b) Destination string overlaps with NULL address.
    429          *                       (1) No string concatenation performed; NULL pointer returned.
    430          *
    431          *                   (c) Destination/Concatenation string pointer(s) points to NULL.
    432          *                       (1) String buffer(s) overlap with NULL address.
    433          *                       (2) Concatenation string appended into destination string buffer up to but NOT
    434          *                           beyond or including the NULL address; destination string buffer properly
    435          *                           terminated with NULL character.
    436          *
    437          *                   (d) Concatenation string's terminating NULL character found.
    438          *                       (1) Entire concatenation string appended to destination string.
    439          *
    440          *                   (e) 'len_max' number of characters concatenated.
    441          *                       (1) 'len_max' number of characters does NOT include the terminating NULL character.
    442          *
    443          *                           See also Note #1a.
    444          *********************************************************************************************************
    445          */
    446          /*$PAGE*/

   \                                 In segment CODE, align 4, keep-with-next
    447          CPU_CHAR  *Str_Cat_N (CPU_CHAR    *pdest,
    448                                CPU_CHAR    *pstr_cat,
    449                                CPU_SIZE_T   len_max)
    450          {
   \                     Str_Cat_N:
   \   00000000   30002DE9           PUSH     {R4,R5}
   \   00000004   0030B0E1           MOVS     R3,R0
    451              CPU_CHAR    *pstr;
    452              CPU_CHAR    *pstr_next;
    453              CPU_SIZE_T   len_cat;
    454          
    455                                                                          /* Rtn NULL if str ptr(s) NULL     (see Note #2a).      */
    456              if (pdest == (CPU_CHAR *)0) {
   \   00000008   000053E3           CMP      R3,#+0
   \   0000000C   0100001A           BNE      ??Str_Cat_N_0
    457                  return  ((CPU_CHAR *)0);
   \   00000010   0000A0E3           MOV      R0,#+0
   \   00000014   2A0000EA           B        ??Str_Cat_N_1
    458              }
    459              if (pstr_cat == (CPU_CHAR *)0) {
   \                     ??Str_Cat_N_0:
   \   00000018   000051E3           CMP      R1,#+0
   \   0000001C   0100001A           BNE      ??Str_Cat_N_2
    460                  return  ((CPU_CHAR *)0);
   \   00000020   0000A0E3           MOV      R0,#+0
   \   00000024   260000EA           B        ??Str_Cat_N_1
    461              }
    462          
    463              if (len_max == (CPU_SIZE_T)0) {                             /* Rtn NULL if cat len equals zero (see Note #2e).      */
   \                     ??Str_Cat_N_2:
   \   00000028   000052E3           CMP      R2,#+0

⌨️ 快捷键说明

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