First attempt at debianization
[erwise] / Cl / WWWLibrary / HTUtils.h
1 /*      Macros for general use                                  HTUtils.h
2 **
3 **      See also: the system dependent file "tcp.h"
4 */
5
6 /* extern void *malloc(size_t size); */
7
8 #ifndef HTUTILS_H
9 #define HTUTILS_H
10
11 #ifdef SHORT_NAMES
12 #define WWW_TraceFlag HTTrFlag
13 #endif
14
15 /*      Debug message control.
16 */
17 #ifdef DEBUG
18
19 #ifndef STDIO_H
20 #include <stdio.h>
21 #define STDIO_H
22 #endif
23
24 #define TRACE (WWW_TraceFlag)
25 #define PROGRESS(str) printf(str)
26 extern int WWW_TraceFlag;
27 #else
28 #define TRACE 0
29 #define PROGRESS(str) /* nothing for now */
30 #endif
31 #define CTRACE if(TRACE)fprintf
32 #define tfp stdout
33
34 /*      Standard C library for malloc() etc
35 */
36 #ifdef vax
37 #ifdef unix
38 #define ultrix  /* Assume vax+unix=ultrix */
39 #endif
40 #endif
41
42 #ifndef VMS
43 #ifndef ultrix
44 #ifdef NeXT
45 #include <libc.h>       /* NeXT */
46 #endif
47 #ifndef MACH            /* Vincent.Cate@furmint.nectar.cs.cmu.edu */
48 #include <stdlib.h>     /* ANSI */
49 #endif
50 #else
51 #include <malloc.h>     /* ultrix */
52 #include <memory.h>
53 #include <stdio.h>
54 #endif
55
56 #else                           /* VMS */
57 #include <stdio.h>
58 #include <ctype.h>
59 #endif
60
61 #define PUBLIC                  /* Accessible outside this module     */
62 #define PRIVATE static          /* Accessible only within this module */
63
64 #ifdef __STDC__
65 #define CONST const             /* "const" only exists in STDC */
66 #define NOPARAMS (void)
67 #define PARAMS(parameter_list) parameter_list
68 #define NOARGS (void)
69 #define ARGS1(t,a) \
70   (t a)
71 #define ARGS2(t,a,u,b) \
72   (t a, u b)
73 #define ARGS3(t,a,u,b,v,c) \
74   (t a, u b, v c)
75 #define ARGS4(t,a,u,b,v,c,w,d) \
76   (t a, u b, v c, w d)
77 #define ARGS5(t,a,u,b,v,c,w,d,x,e) \
78   (t a, u b, v c, w d, x e)
79 #define ARGS6(t,a,u,b,v,c,w,d,x,e,y,f) \
80   (t a, u b, v c, w d, x e, y f)
81 #define ARGS7(t,a,u,b,v,c,w,d,x,e,y,f,z,g) \
82   (t a, u b, v c, w d, x e, y f, z g)
83 #define ARGS8(t,a,u,b,v,c,w,d,x,e,y,f,z,g,s,h) \
84   (t a, u b, v c, w d, x e, y f, z g, s h)
85 #define ARGS9(t,a,u,b,v,c,w,d,x,e,y,f,z,g,s,h,r,i) \
86   (t a, u b, v c, w d, x e, y f, z g, s h, r i)
87
88 #else  /* not ANSI */
89
90 #define CONST
91 #define NOPARAMS ()
92 #define PARAMS(parameter_list) ()
93 #define NOARGS ()
94 #define ARGS1(t,a) (a) \
95   t a;
96 #define ARGS2(t,a,u,b) (a,b) \
97   t a; u b;
98 #define ARGS3(t,a,u,b,v,c) (a,b,c) \
99   t a; u b; v c;
100 #define ARGS4(t,a,u,b,v,c,w,d) (a,b,c,d) \
101   t a; u b; v c; w d;
102 #define ARGS5(t,a,u,b,v,c,w,d,x,e) (a,b,c,d,e) \
103   t a; u b; v c; w d; x e;
104 #define ARGS6(t,a,u,b,v,c,w,d,x,e,y,f) (a,b,c,d,e,f) \
105   t a; u b; v c; w d; x e; y f;
106 #define ARGS7(t,a,u,b,v,c,w,d,x,e,y,f,z,g) (a,b,c,d,e,f,g) \
107   t a; u b; v c; w d; x e; y f; z g;
108 #define ARGS8(t,a,u,b,v,c,w,d,x,e,y,f,z,g,s,h) (a,b,c,d,e,f,g,h) \
109   t a; u b; v c; w d; x e; y f; z g; s h;
110 #define ARGS9(t,a,u,b,v,c,w,d,x,e,y,f,z,g,s,h,r,i) (a,b,c,d,e,f,g,h,i) \
111   t a; u b; v c; w d; x e; y f; z g; s h; r i;
112
113 #endif /* __STDC__ (ANSI) */
114
115 #ifndef NULL
116 #define NULL ((void *)0)
117 #endif
118
119
120 /* Note: GOOD and BAD are already defined (differently) on RS6000 aix */
121 /* #define GOOD(status) ((status)&1)     VMS style status: test bit 0         */
122 /* #define BAD(status)  (!GOOD(status))  Bit 0 set if OK, otherwise clear   */
123
124 #ifndef BOOLEAN_DEFINED
125 typedef char    BOOLEAN;                /* Logical value */
126 #ifndef CURSES
127 #ifndef TRUE
128 #define TRUE    (BOOLEAN)1
129 #define FALSE   (BOOLEAN)0
130 #endif
131 #endif
132 #define BOOLEAN_DEFINED
133 #endif
134
135 #ifndef BOOL
136 #define BOOL BOOLEAN
137 #endif
138 #ifndef YES
139 #define YES (BOOLEAN)1
140 #define NO (BOOLEAN)0
141 #endif
142
143 #define TCP_PORT 80             /* 80 Allocated by Jon Postel/ISI 24-Jan-92 */
144
145 /*      Is character c white space? */
146
147 #ifndef NOT_ASCII
148 #define WHITE(c) (((unsigned char)(c))<=' ')    /* Assumes ASCII but faster */
149 #else
150 #define WHITE(c) ( ((c)==' ') || ((c)=='\t') || ((c)=='\n') || ((c)=='\r') )
151 #endif
152
153 #define HT_LOADED (29999)               /* Instead of a socket */
154
155 #include "HTString.h"  /* String utilities */
156
157 #ifndef ERWISE_UI
158 /* Toni */
159 #include <stdarg.h>
160 #endif /* ERWISE */
161
162 #ifdef CURSES
163 /* htbrowse.c; */
164 #include <curses.h>
165
166 extern        WINDOW  *w_top, *w_text, *w_prompt;
167 extern        void    user_message PARAMS((const char *fmt, ...));
168 extern        void    prompt_set PARAMS((CONST char * msg));
169 extern        void    prompt_count PARAMS((long kb));
170 #else
171 #define user_message printf
172 #endif
173
174 /*      Out Of Memory checking for malloc() return:
175 */
176 #ifndef __FILE__
177 #define __FILE__ ""
178 #define __LINE__ ""
179 #endif
180
181 #define outofmem(file, func) \
182  { fprintf(stderr, "%s %s: out of memory.\nProgram aborted.\n", file, func); \
183   exit(1);}
184 /* extern void outofmem PARAMS((const char *fname, const char *func)); */
185
186
187 extern        void    msg_init PARAMS((int height));
188 extern        void    msg_printf PARAMS((int y, const char *fmt, ...));
189 extern        void    msg_exit PARAMS((int wait_for_key));
190
191 #endif /* HTUTILS_H */
192