~ubuntu-branches/ubuntu/karmic/fweb/karmic

« back to all changes in this revision

Viewing changes to Web/strmac.web

  • Committer: Bazaar Package Importer
  • Author(s): Yann Dirson
  • Date: 2002-01-04 23:20:22 UTC
  • Revision ID: james.westby@ubuntu.com-20020104232022-330ad4iyzpvb5bm4
Tags: upstream-1.62
ImportĀ upstreamĀ versionĀ 1.62

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@z --- strmac.web ---
 
2
 
 
3
FWEB version 1.62 (September 25, 1998)
 
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.