home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / string.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-20  |  16.8 KB  |  375 lines

  1. #if (defined(__IBMC__) || defined(__IBMCPP__))
  2. #pragma info( none )
  3. #ifndef __CHKHDR__
  4.    #pragma info( none )
  5. #endif
  6. #pragma info( restore )
  7. #endif
  8.  
  9. #ifndef __string_h
  10.    #define __string_h
  11.  
  12.    #ifdef __cplusplus
  13.       extern "C" {
  14.    #endif
  15.  
  16.    #ifndef  _LNK_CONV
  17.       #ifdef _M_I386
  18.          #define _LNK_CONV   _Optlink
  19.       #else
  20.          #define _LNK_CONV
  21.       #endif
  22.    #endif
  23.  
  24.    #ifndef _IMPORT
  25.       #ifdef __IMPORTLIB__
  26.          #define _IMPORT _Import
  27.       #else
  28.          #define _IMPORT
  29.       #endif
  30.    #endif
  31.  
  32.    /********************************************************************/
  33.    /*  <string.h> header file                                          */
  34.    /*                                                                  */
  35.    /*  VisualAge for C++ for Windows, Version 3.5                      */
  36.    /*    Licensed Material - Property of IBM                           */
  37.    /*                                                                  */
  38.    /*  5801-ARR and Other Materials                                    */
  39.    /*                                                                  */
  40.    /*  (c) Copyright IBM Corp 1991, 1996. All rights reserved.         */
  41.    /*                                                                  */
  42.    /********************************************************************/
  43.  
  44.    #ifndef __size_t
  45.       #define __size_t
  46.       typedef unsigned int size_t;
  47.    #endif
  48.  
  49.    #ifndef NULL
  50.       #if (defined(__EXTENDED__)  || defined( __cplusplus ))
  51.          #define NULL 0
  52.       #else
  53.          #define NULL ((void *)0)
  54.       #endif
  55.    #endif
  56.  
  57.    #ifdef _M_I386
  58.    char * _Builtin __strcat( char *, const char * );
  59.    char * _Builtin __strchr( const char *, int );
  60.    int    _Builtin __strcmp( const char *, const char * );
  61.    char * _Builtin __strcpy( char*, const char * );
  62.    size_t _Builtin __strlen( const char * );
  63.    char * _Builtin __strncat( char *, const char *, size_t );
  64.    int    _Builtin __strncmp( const char *, const char *, size_t );
  65.    char * _Builtin __strncpy( char *, const char *, size_t );
  66.    char * _Builtin __strrchr( const char *, int );
  67.    #endif
  68.  
  69.    #if defined(__THW_PPC__)
  70.      #if (defined(__IBMCPP__) || defined(__IBMC__))
  71.         #ifdef __cplusplus
  72.           extern "builtin" char *__strcpy(char *s1, const char *s2);
  73.           extern "builtin" int   __strcmp(const char *s1, const char *s2);
  74.           extern "builtin" size_t __strlen(const char *s);
  75.           extern "builtin" char *__strchr(const char *s, int c);
  76.           extern "builtin" char *__strrchr(const char *s, int c);
  77.           extern "builtin" char  *__strcat(char *s1, const char *s2);
  78.         #else
  79.           char * _Builtin  __strcpy(char *s1, const char *s2);
  80.           int    _Builtin  __strcmp(const char *s1, const char *s2);
  81.           size_t _Builtin  __strlen(const char *s);
  82.           char * _Builtin  __strchr(const char *s, int c);
  83.           char * _Builtin  __strrchr(const char *s, int c);
  84.           char * _Builtin  __strcat(char *s1, const char *s2);
  85.         #endif
  86.      #endif
  87.  
  88.      char * strncat( char *, const char *, size_t );
  89.      int    strncmp( const char *, const char *, size_t );
  90.      char * strncpy( char *, const char *, size_t );
  91.      char * strrchr( const char *, int );
  92.  
  93.       #if defined(__STR__) && (defined(__IBMC__) || defined(__IBMCPP__))
  94.           #ifdef __cplusplus
  95.                 inline char *strcpy(char *s1, const char *s2) { return __strcpy (s1, s2);}
  96.                 inline int   strcmp(const char *s1, const char *s2)     { return __strcmp (s1, s2);}
  97.                 inline size_t strlen(const char *s) { return __strlen (s); }
  98.                 inline char  *strchr(const char *s, int c) { return __strchr (s, c); }
  99.                 inline char  *strrchr(const char *s, int c) { return __strrchr (s, c); }
  100.                 inline char  *strcat(char *s1, const char *s2) { return __strcat (s1, s2); }
  101.           #else
  102.                #define strcpy(__s1,__s2) __strcpy(__s1,__s2)
  103.                #define strcmp(__s1,__s2) __strcmp(__s1,__s2)
  104.                #define strlen(__s1) __strlen(__s1)
  105.                #define strchr(__s1,__c) __strchr(__s1,__c)
  106.                #define strrchr(__s1,__c) __strrchr(__s1,__c)
  107.                #define strcat(__s1,__s2) __strcat(__s1,__s2)
  108.           #endif
  109.       #else
  110.           char * strcpy(char *s1, const char *s2);
  111.           int  strcmp(const char *s1, const char *s2);
  112.           size_t strlen(const char *s);
  113.           char * strchr(const char *s, int c);
  114.           char * strrchr(const char *s, int c);
  115.           char * strcat(char *s1, const char *s2);
  116.       #endif
  117.    #endif
  118.  
  119.    int    _IMPORT _LNK_CONV strcoll( const char *, const char * );
  120.    size_t _IMPORT _LNK_CONV strcspn( const char *, const char * );
  121.    char * _IMPORT _LNK_CONV strerror( int );
  122.    char * _IMPORT _LNK_CONV strpbrk( const char *, const char * );
  123.    size_t _IMPORT _LNK_CONV strspn( const char *, const char * );
  124.    char * _IMPORT _LNK_CONV strstr( const char *, const char * );
  125.    char * _IMPORT _LNK_CONV strtok( char*, const char * );
  126.    size_t _IMPORT _LNK_CONV strxfrm( char *, const char *, size_t );
  127.  
  128.    #ifdef _M_I386
  129.    #ifdef __cplusplus
  130.       inline char * _LNK_CONV strcat( char * s1, const char * s2 )
  131.                                { return __strcat( s1, s2 ); }
  132.       inline char * _LNK_CONV strchr( const char * s, int ch )
  133.                                { return __strchr( s, ch ); }
  134.       inline int    _LNK_CONV strcmp( const char * s1, const char * s2 )
  135.                                { return __strcmp( s1, s2 ); }
  136.       inline char * _LNK_CONV strcpy( char * s1, const char * s2 )
  137.                                { return __strcpy( s1, s2 ); }
  138.       inline size_t _LNK_CONV strlen( const char * s )
  139.                                { return __strlen( s ); }
  140.       inline char * _LNK_CONV strncat( char * s1, const char * s2, size_t len )
  141.                                { return __strncat( s1, s2, len ); }
  142.       inline int    _LNK_CONV strncmp( const char * s1, const char * s2, size_t len )
  143.                                { return __strncmp( s1, s2, len ); }
  144.       inline char * _LNK_CONV strncpy( char * s1, const char * s2, size_t len )
  145.                                { return __strncpy( s1, s2, len ); }
  146.       inline char * _LNK_CONV strrchr( const char * s1, int ch )
  147.                                { return __strrchr( s1, ch ); }
  148.    #else
  149.       char * _IMPORT _LNK_CONV strcat( char *, const char * );
  150.       char * _IMPORT _LNK_CONV strchr( const char *, int );
  151.       int    _IMPORT _LNK_CONV strcmp( const char *, const char * );
  152.       char * _IMPORT _LNK_CONV strcpy( char *, const char * );
  153.       size_t _IMPORT _LNK_CONV strlen( const char * );
  154.       char * _IMPORT _LNK_CONV strncat( char *, const char *, size_t );
  155.       int    _IMPORT _LNK_CONV strncmp( const char *, const char *, size_t );
  156.       char * _IMPORT _LNK_CONV strncpy( char *, const char *, size_t );
  157.       char * _IMPORT _LNK_CONV strrchr( const char *, int );
  158.  
  159.       #pragma info( none )
  160.       #define strcat( x, y )     __strcat( (x), (y) )
  161.       #define strchr( x, y )     __strchr( (x), (y) )
  162.       #define strcmp( x, y )     __strcmp( (x), (y) )
  163.       #define strcpy( x, y )     __strcpy( (x), (y) )
  164.       #define strlen( x )        __strlen( (x) )
  165.       #define strncat( x, y, z ) __strncat( (x), (y), (z) )
  166.       #define strncmp( x, y, z ) __strncmp( (x), (y), (z) )
  167.       #define strncpy( x, y, z ) __strncpy( (x), (y), (z) )
  168.       #define strrchr( x, y )    __strrchr( (x), (y) )
  169.       #pragma info( restore )
  170.    #endif
  171.    #endif
  172.  
  173.  
  174.    #ifndef __memory_h
  175.       #define __memory_h
  176.  
  177.       #ifdef _M_I386
  178.       void * _Builtin __memcpy( void *, const void *, size_t );
  179.       void * _Builtin __memchr( const void *, int, size_t );
  180.       int    _Builtin __memcmp( const void *, const void *, size_t );
  181.       void * _Builtin __memset( void *, int, size_t );
  182.       void * _Builtin __memmove( void *, const void *, size_t );
  183.       #endif
  184.  
  185.       #ifdef _M_I386
  186.       #ifdef __cplusplus
  187.          inline void * _LNK_CONV memcpy( void * m1, const void * m2, size_t len )
  188.                                   { return __memcpy( m1, m2, len ); }
  189.          inline void * _LNK_CONV memchr( const void * m, int ch, size_t len )
  190.                                   { return __memchr( m, ch, len ); }
  191.          inline int    _LNK_CONV memcmp( const void * m1, const void * m2, size_t len )
  192.                                   { return __memcmp( m1, m2, len ); }
  193.          inline void * _LNK_CONV memset( void * m, int ch, size_t len )
  194.                                   { return __memset( m, ch, len ); }
  195.          inline void * _LNK_CONV memmove( void * m1, const void * m2, size_t len )
  196.                                   { return __memmove( m1, m2, len ); }
  197.       #else
  198.          void * _IMPORT _LNK_CONV memcpy( void *, const void *, size_t );
  199.          void * _IMPORT _LNK_CONV memchr( const void *, int, size_t );
  200.          int    _IMPORT _LNK_CONV memcmp( const void *, const void *, size_t );
  201.          void * _IMPORT _LNK_CONV memset( void *, int, size_t );
  202.          void * _IMPORT _LNK_CONV memmove( void *, const void *, size_t );
  203.  
  204.          #pragma info( none )
  205.          #define memcpy( x, y, z )  __memcpy( (x), (y), (z) )
  206.          #define memchr( x, y, z )  __memchr( (x), (y), (z) )
  207.          #define memcmp( x, y, z )  __memcmp( (x), (y), (z) )
  208.          #define memset( x, y, z )  __memset( (x), (y), (z) )
  209.          #define memmove( x, y, z ) __memmove( (x), (y), (z) )
  210.          #pragma info( restore )
  211.       #endif
  212.       #endif
  213.  
  214.       #ifdef __THW_PPC__
  215.         #if defined(__IBMCPP__) || defined(__IBMC__)
  216.           #ifdef __cplusplus
  217.                extern "builtin" void  *__memchr(const void *s, int c, size_t n);
  218.                extern "builtin" void  *__memcpy(void *s1, const void *s2, size_t n);
  219.                extern "builtin" void  *__memmove(void *s1, const void *s2, size_t n);
  220.                extern "builtin" int __memcmp(const void *s1, const void *s2, size_t n);
  221.                extern "builtin" void  *__memset(void *s, int c, size_t n);
  222.           #else
  223.                void  * _Builtin __memchr(const void *s, int c, size_t n);
  224.                void  * _Builtin __memcpy(void *s1, const void *s2, size_t n);
  225.                void *  _Builtin __memmove(void *s1, const void *s2, size_t n);
  226.                int     _Builtin __memcmp(const void *s1, const void *s2, size_t n);
  227.                void *  _Builtin __memset(void *s, int c, size_t n);
  228.           #endif
  229.         #endif
  230.         #if defined(__STR__) && (defined(__IBMC__) || defined(__IBMCPP__))
  231.                #ifdef __cplusplus
  232.                   inline void  *memchr(const void *s, int c, size_t n) { return __memchr (s, c, n); }
  233.                   inline void  *memcpy(void *s1, const void *s2, size_t n) { return __memcpy (s1, s2, n); }
  234.                   inline void  *memmove(void *s1, const void *s2, size_t n) { return __memmove (s1, s2, n); }
  235.                   inline int    memcmp(const void *s1, const void *s2, size_t n) { return __memcmp (s1, s2, n); }
  236.                   inline void  *memset(void *s, int c, size_t n) { return __memset(s, c, n); }
  237.                #else
  238.                   #define memchr(__s1,__c,__n) __memchr(__s1,__c,__n)
  239.                   #define memcpy(__s1,__s2,__n) __memcpy(__s1,__s2,__n)
  240.                   #define memmove(__s1,__s2,__n) __memmove(__s1,__s2,__n)
  241.                   #define memcmp(__s1,__s2,__n) __memcmp(__s1,__s2,__n)
  242.                   #define memset(__s1,__c,__n) __memset(__s1,__c,__n)
  243.                #endif
  244.         #else
  245.                void * memcpy( void *, const void *, size_t );
  246.                void * memchr( const void *, int, size_t );
  247.                int    memcmp( const void *, const void *, size_t );
  248.                void * memset( void *, int, size_t );
  249.                void * memmove( void *, const void *, size_t );
  250.                void * memmove( void *, const void *, size_t );
  251.         #endif
  252.       #endif
  253.  
  254.       #if defined( __EXTENDED__ )
  255.  
  256.          void * _IMPORT _LNK_CONV memccpy( void *, void *, int, unsigned int );
  257.          int    _IMPORT _LNK_CONV memicmp( void *, void *, unsigned int );
  258.  
  259.          #define _fmemcpy( x, y, z )     memcpy( (x), (y), (z) )
  260.          #define _fmemchr( x, y, z )     memchr( (x), (y), (z) )
  261.          #define _fmemcmp( x, y, z )     memcmp( (x), (y), (z) )
  262.          #define _fmemset( x, y, z )     memset( (x), (y), (z) )
  263.          #define _fmemccpy( w, x, y, z ) memccpy( (w), (x), (y), (z) )
  264.          #define _fmemicmp( x, y, z )    memicmp( (x), (y), (z) )
  265.  
  266.       #endif
  267.  
  268.    #endif
  269.  
  270.    #if defined(__EXTENDED__)
  271.  
  272.       char * _IMPORT _LNK_CONV strdup( const char * );
  273.       int    _IMPORT _LNK_CONV stricmp( const char *, const char * );
  274.       char * _IMPORT _LNK_CONV strlwr( char * );
  275.       int    _IMPORT _LNK_CONV strnicmp( const char *, const char *, size_t );
  276.       char * _IMPORT _LNK_CONV strupr( char * );
  277.  
  278.       int    _IMPORT _LNK_CONV strcmpi( const char *, const char * );
  279.       char * _IMPORT _LNK_CONV strrev( char * );
  280.       char * _IMPORT _LNK_CONV strset( char *, int );
  281.       char * _IMPORT _LNK_CONV strnset( char *, int, size_t );
  282.       char * _IMPORT _LNK_CONV _strerror( const char * );
  283.  
  284.       #define _fmemmove( x, y, z )  memmove( (x), (y), (z) )
  285.       #define _fstrcat( x, y )      strcat( (x), (y) )
  286.       #define _fstrchr( x, y )      strchr( (x), (y) )
  287.       #define _fstrcmp( x, y )      strcmp( (x), (y) )
  288.       #define _fstrcpy( x, y )      strcpy( (x), (y) )
  289.       #define _fstrlen( x )         strlen( (x) )
  290.       #define _fstrncat( x, y, z )  strncat( (x), (y), (z) )
  291.       #define _fstrncmp( x, y, z )  strncmp( (x), (y), (z) )
  292.       #define _fstrncpy( x, y, z )  strncpy( (x), (y), (z) )
  293.       #define _fstrrchr( x, y )     strrchr( (x), (y) )
  294.  
  295.       size_t _IMPORT _LNK_CONV _fstrcspn( const char *, const char * );
  296.       char * _IMPORT _LNK_CONV _fstrdup( const char * );
  297.       char * _IMPORT _LNK_CONV _nstrdup( const char * );
  298.       int    _IMPORT _LNK_CONV _fstricmp( const char *, const char * );
  299.       char * _IMPORT _LNK_CONV _fstrlwr( char * );
  300.       int    _IMPORT _LNK_CONV _fstrnicmp( const char *, const char *, size_t );
  301.       char * _IMPORT _LNK_CONV _fstrnset( char *, int, size_t );
  302.       char * _IMPORT _LNK_CONV _fstrpbrk( const char *, const char * );
  303.       char * _IMPORT _LNK_CONV _fstrrev( char * );
  304.       char * _IMPORT _LNK_CONV _fstrset( char *, int );
  305.       size_t _IMPORT _LNK_CONV _fstrspn( const char *, const char * );
  306.       char * _IMPORT _LNK_CONV _fstrstr( const char *, const char * );
  307.       char * _IMPORT _LNK_CONV _fstrtok( char*, const char * );
  308.       char * _IMPORT _LNK_CONV _fstrupr( char * );
  309.  
  310.     #if (defined(__IBMC__) || defined(__IBMCPP__))
  311.       #ifdef __OS2__
  312.       #pragma map( _fstrcspn , "strcspn"  )
  313.       #pragma map( _fstrdup  , "strdup"   )
  314.       #pragma map( _nstrdup  , "strdup"   )
  315.       #pragma map( _fstricmp , "stricmp"  )
  316.       #pragma map( _fstrlwr  , "strlwr"   )
  317.       #pragma map( _fstrnicmp, "strnicmp" )
  318.       #pragma map( _fstrnset , "strnset"  )
  319.       #pragma map( _fstrpbrk , "strpbrk"  )
  320.       #pragma map( _fstrrev  , "strrev"   )
  321.       #pragma map( _fstrset  , "strset"   )
  322.       #pragma map( _fstrspn  , "strspn"   )
  323.       #pragma map( _fstrstr  , "strstr"   )
  324.       #pragma map( _fstrtok  , "strtok"   )
  325.       #pragma map( _fstrupr  , "strupr"   )
  326.       #else
  327.       #pragma map( _fstrcspn , "?strcspn"  )
  328.       #pragma map( _fstrdup  , "?strdup"   )
  329.       #pragma map( _nstrdup  , "?strdup"   )
  330.       #pragma map( _fstricmp , "?stricmp"  )
  331.       #pragma map( _fstrlwr  , "?strlwr"   )
  332.       #pragma map( _fstrnicmp, "?strnicmp" )
  333.       #pragma map( _fstrnset , "?strnset"  )
  334.       #pragma map( _fstrpbrk , "?strpbrk"  )
  335.       #pragma map( _fstrrev  , "?strrev"   )
  336.       #pragma map( _fstrset  , "?strset"   )
  337.       #pragma map( _fstrspn  , "?strspn"   )
  338.       #pragma map( _fstrstr  , "?strstr"   )
  339.       #pragma map( _fstrtok  , "?strtok"   )
  340.       #pragma map( _fstrupr  , "?strupr"   )
  341.       #endif
  342.     #else
  343.       #pragma Alias( _fstrcspn , "strcspn"  )
  344.       #pragma Alias( _fstrdup  , "strdup"   )
  345.       #pragma Alias( _nstrdup  , "strdup"   )
  346.       #pragma Alias( _fstricmp , "stricmp"  )
  347.       #pragma Alias( _fstrlwr  , "strlwr"   )
  348.       #pragma Alias( _fstrnicmp, "strnicmp" )
  349.       #pragma Alias( _fstrnset , "strnset"  )
  350.       #pragma Alias( _fstrpbrk , "strpbrk"  )
  351.       #pragma Alias( _fstrrev  , "strrev"   )
  352.       #pragma Alias( _fstrset  , "strset"   )
  353.       #pragma Alias( _fstrspn  , "strspn"   )
  354.       #pragma Alias( _fstrstr  , "strstr"   )
  355.       #pragma Alias( _fstrtok  , "strtok"   )
  356.       #pragma Alias( _fstrupr  , "strupr"   )
  357.     #endif
  358.  
  359.    #endif
  360.  
  361.    #ifdef __cplusplus
  362.       }
  363.    #endif
  364.  
  365. #endif
  366.  
  367. #if (defined(__IBMC__) || defined(__IBMCPP__))
  368. #pragma info( none )
  369. #ifndef __CHKHDR__
  370.    #pragma info( restore )
  371. #endif
  372. #pragma info( restore )
  373. #endif
  374.  
  375.