home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / fweb153.zip / fweb-1.53 / web / strmac.web < prev    next >
Text File  |  1995-09-23  |  2KB  |  63 lines

  1. @z --- strmac.web ---
  2.  
  3. FWEB version 1.53 (September 23, 1995)
  4.  
  5. Based on version 0.5 of S. Levy's CWEB [copyright (C) 1987 Princeton University]
  6.  
  7. @x-----------------------------------------------------------------------------
  8.  
  9. \Title{STRMAC.WEB} % Macros to help avoid spurious compiler warnings. 
  10.  
  11. @c 
  12. @* STRING MACROS.  Here we define various macros that strictly speaking
  13. shouldn't be necessary under a fully ANSI environment, but help in
  14. preventing spurious compiler warnings about pointer conversions.
  15.  
  16. @I formats.hweb
  17.  
  18. @I os.hweb
  19.  
  20. @ The make file produces \.{strmac.h} from this file.
  21. @a
  22. #ifndef _strmac_
  23.  
  24.     #define _strmac_
  25.     @<String casting macros@>@;
  26.  
  27. #endif /* |_strmac_| */
  28.  
  29. @
  30. @<String casting...@>=
  31.  
  32. #define ATOF(s) atof((CONST char *)(s))
  33. #define ATOI(s) atoi((CONST char *)(s))
  34. #define ATOL(s) atol((CONST char *)(s))
  35. #define FGETS(s,n,stream) fgets((char *)(s),(int)(n),(FILE *)(stream))
  36. #define FOPEN(name,iomode) fopen((char *)(name),(char *)(iomode))
  37. #define GETENV(env) OC(getenv((char *)(env)))
  38. #define MEMCMP(s1,s2,n) memcmp((CONST void *)(s1),(CONST void *)(s2),\
  39.         (size_t)(n)) 
  40. #define MEMSET(buffer,c,n) memset((void *)(buffer),(int)(c),(size_t)(n))
  41. #define QSORT(array,number,size,comparison) qsort((void *)(array),\
  42.     (size_t)(number),(size_t)(size),\
  43.     (int (*)(CONST void *,CONST void *))(comparison))
  44. #define STRCAT(dest,src) strcat((char *)(dest),(CONST char *)(src))
  45. #define STRNCAT(dest,src,n) strncat((char *)(dest),(CONST char *)(src),\
  46.         (size_t)(n))
  47. #define STRPBRK(s1,s2) strpbrk((CONST char *)(s1),(CONST char *)(s2))
  48. #define STRCHR(s,c) strchr((CONST char *)(s),(int)(c))
  49. #define STRRCHR(s,c) strrchr((CONST char *)(s),(int)(c))
  50. #define STRCMP(s1,s2) strcmp((CONST char *)(s1),(CONST char *)(s2))
  51. #define STRNCMP(s1,s2,n) strncmp((CONST char *)(s1),(CONST char *)(s2),\
  52.         (size_t)(n))
  53. #define STRCPY(dest,src) strcpy((char *)(dest),(CONST char *)(src))
  54. #define STRNCPY(dest,src,n) strncpy((char *)(dest),(CONST char *)(src),\
  55.         (size_t)(n))
  56. #define STRSPN(s1,s2) strspn((CONST char *)(s1),(CONST char *)(s2))
  57. #define STRLEN(s) strlen((CONST char *)(s))
  58. #define STRTOD(s,endptr) strtod((CONST char *)(s),(char **)(endptr))
  59. #define STRTOL(s,endptr,radix) strtol((CONST char *)(s),\
  60.     (char **)(endptr),(int)(radix)) 
  61.  
  62. @* INDEX.
  63.