File: strmac.web

package info (click to toggle)
fweb 1.62-15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,216 kB
  • sloc: ansic: 41,943; makefile: 344; sh: 152
file content (62 lines) | stat: -rw-r--r-- 2,261 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@z --- strmac.web ---

FWEB version 1.62 (September 25, 1998)

Based on version 0.5 of S. Levy's CWEB [copyright (C) 1987 Princeton University]

@x-----------------------------------------------------------------------------

\Title{STRMAC.WEB} % Macros to help avoid spurious compiler warnings. 

@c 
@* STRING MACROS.  Here we define various macros that strictly speaking
shouldn't be necessary under a fully ANSI environment, but help in
preventing spurious compiler warnings about pointer conversions.

@I formats.hweb

@I os.hweb

@ The make file produces \.{strmac.h} from this file.
@a
#ifndef _strmac_

	#define _strmac_
	@<String casting macros@>@;

#endif /* |_strmac_| */

@
@<String casting...@>=

#define ATOF(s) atof((CONST char *)(s))
#define ATOI(s) atoi((CONST char *)(s))
#define ATOL(s) atol((CONST char *)(s))
#define FGETS(s,n,stream) fgets((char *)(s),(int)(n),(FILE *)(stream))
#define FOPEN(name,iomode) fopen((char *)(name),(char *)(iomode))
#define GETENV(env) OC(getenv((char *)(env)))
#define MEMCMP(s1,s2,n) memcmp((CONST void *)(s1),(CONST void *)(s2),\
		(size_t)(n)) 
#define MEMSET(buffer,c,n) memset((void *)(buffer),(int)(c),(size_t)(n))
#define QSORT(array,number,size,comparison) qsort((void *)(array),\
	(size_t)(number),(size_t)(size),\
	(int (*)(CONST void *,CONST void *))(comparison))
#define STRCAT(dest,src) strcat((char *)(dest),(CONST char *)(src))
#define STRNCAT(dest,src,n) strncat((char *)(dest),(CONST char *)(src),\
		(size_t)(n))
#define STRPBRK(s1,s2) strpbrk((CONST char *)(s1),(CONST char *)(s2))
#define STRCHR(s,c) strchr((CONST char *)(s),(int)(c))
#define STRRCHR(s,c) strrchr((CONST char *)(s),(int)(c))
#define STRCMP(s1,s2) strcmp((CONST char *)(s1),(CONST char *)(s2))
#define STRNCMP(s1,s2,n) strncmp((CONST char *)(s1),(CONST char *)(s2),\
		(size_t)(n))
#define STRCPY(dest,src) strcpy((char *)(dest),(CONST char *)(src))
#define STRNCPY(dest,src,n) strncpy((char *)(dest),(CONST char *)(src),\
		(size_t)(n))
#define STRSPN(s1,s2) strspn((CONST char *)(s1),(CONST char *)(s2))
#define STRLEN(s) strlen((CONST char *)(s))
#define STRTOD(s,endptr) strtod((CONST char *)(s),(char **)(endptr))
#define STRTOL(s,endptr,radix) strtol((CONST char *)(s),\
	(char **)(endptr),(int)(radix)) 

@* INDEX.