1 | /* |
---|
2 | * uemf.h -- Go Ahead Micro Embedded Management Framework Header |
---|
3 | * |
---|
4 | * Copyright (c) Go Ahead Software, Inc., 1995-1999 |
---|
5 | * |
---|
6 | * See the file "license.txt" for usage and redistribution license requirements |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef _h_UEMF |
---|
10 | #define _h_UEMF 1 |
---|
11 | |
---|
12 | /******************************** Description *********************************/ |
---|
13 | |
---|
14 | /* |
---|
15 | * Go Ahead Web Server header. This defines the Web public APIs |
---|
16 | */ |
---|
17 | |
---|
18 | /******************************* Per O/S Includes *****************************/ |
---|
19 | |
---|
20 | #if WIN |
---|
21 | #include <direct.h> |
---|
22 | #include <io.h> |
---|
23 | #include <sys/stat.h> |
---|
24 | #include <limits.h> |
---|
25 | #include <tchar.h> |
---|
26 | #include <windows.h> |
---|
27 | #include <winnls.h> |
---|
28 | #include <time.h> |
---|
29 | #include <sys/types.h> |
---|
30 | #include <stdio.h> |
---|
31 | #include <stdlib.h> |
---|
32 | #endif |
---|
33 | |
---|
34 | #if CE |
---|
35 | #include <limits.h> |
---|
36 | #include <tchar.h> |
---|
37 | #include <windows.h> |
---|
38 | #include <winnls.h> |
---|
39 | #include "CE/wincompat.h" |
---|
40 | #endif |
---|
41 | |
---|
42 | #if NW |
---|
43 | #include <stdio.h> |
---|
44 | #endif |
---|
45 | |
---|
46 | #if UNIX |
---|
47 | #include <stdio.h> |
---|
48 | #endif |
---|
49 | |
---|
50 | #if LINUX || __rtems__ |
---|
51 | #include <sys/types.h> |
---|
52 | #include <sys/stat.h> |
---|
53 | #include <sys/param.h> |
---|
54 | #include <limits.h> |
---|
55 | #include <stdio.h> |
---|
56 | #include <stdlib.h> |
---|
57 | #include <unistd.h> |
---|
58 | #include <sys/socket.h> |
---|
59 | #include <sys/select.h> |
---|
60 | #include <netinet/in.h> |
---|
61 | #include <arpa/inet.h> |
---|
62 | #include <netdb.h> |
---|
63 | #include <time.h> |
---|
64 | #endif |
---|
65 | |
---|
66 | #if LYNX |
---|
67 | #include <limits.h> |
---|
68 | #include <stdarg.h> |
---|
69 | #include <stdio.h> |
---|
70 | #include <stdlib.h> |
---|
71 | #include <unistd.h> |
---|
72 | #include <socket.h> |
---|
73 | #include <netinet/in.h> |
---|
74 | #include <arpa/inet.h> |
---|
75 | #include <netdb.h> |
---|
76 | #include <time.h> |
---|
77 | #endif |
---|
78 | |
---|
79 | #if UW |
---|
80 | #include <stdio.h> |
---|
81 | #endif |
---|
82 | |
---|
83 | #if VXW486 |
---|
84 | #include <vxWorks.h> |
---|
85 | #include <sockLib.h> |
---|
86 | #include <selectLib.h> |
---|
87 | #include <inetLib.h> |
---|
88 | #include <ioLib.h> |
---|
89 | #include <stdio.h> |
---|
90 | #include <stat.h> |
---|
91 | #include <time.h> |
---|
92 | #include <usrLib.h> |
---|
93 | #endif |
---|
94 | |
---|
95 | #if QNX4 |
---|
96 | #include <sys/types.h> |
---|
97 | #include <stdio.h> |
---|
98 | #include <sys/socket.h> |
---|
99 | #include <sys/select.h> |
---|
100 | #include <netinet/in.h> |
---|
101 | #include <arpa/inet.h> |
---|
102 | #include <netdb.h> |
---|
103 | #endif |
---|
104 | |
---|
105 | /********************************** Includes **********************************/ |
---|
106 | |
---|
107 | #include <ctype.h> |
---|
108 | #include <stdarg.h> |
---|
109 | #include <string.h> |
---|
110 | |
---|
111 | /********************************** Unicode ***********************************/ |
---|
112 | /* |
---|
113 | * Constants and limits. Also FNAMESIZE and PATHSIZE are currently defined |
---|
114 | * in param.h to be 128 and 512 |
---|
115 | */ |
---|
116 | #define TRACE_MAX (4096 - 48) |
---|
117 | #define VALUE_MAX_STRING (4096 - 48) |
---|
118 | #define SYM_MAX (512) |
---|
119 | #define XML_MAX 4096 /* Maximum size for tags/tokens */ |
---|
120 | #define BUF_MAX 4096 /* General sanity check for bufs */ |
---|
121 | |
---|
122 | /* |
---|
123 | * Type for unicode systems |
---|
124 | */ |
---|
125 | #if UNICODE |
---|
126 | |
---|
127 | /* |
---|
128 | * To convert strings to UNICODE. We have a level of indirection so things |
---|
129 | * like T(__FILE__) will expand properly. |
---|
130 | */ |
---|
131 | #define T(x) __TXT(x) |
---|
132 | #define __TXT(s) L ## s |
---|
133 | typedef unsigned short char_t; |
---|
134 | typedef unsigned short uchar_t; |
---|
135 | |
---|
136 | /* |
---|
137 | * Text size of buffer macro. A buffer bytes will hold (size / char size) |
---|
138 | * characters. |
---|
139 | */ |
---|
140 | #define TSZ(x) (sizeof(x) / sizeof(char_t)) |
---|
141 | |
---|
142 | /* |
---|
143 | * How many ASCII bytes are required to represent this UNICODE string? |
---|
144 | */ |
---|
145 | #define TASTRL(x) ((wcslen(x) + 1) * sizeof(char_t)) |
---|
146 | |
---|
147 | |
---|
148 | #define gmain wmain |
---|
149 | |
---|
150 | #define gsprintf swprintf |
---|
151 | #define gprintf wprintf |
---|
152 | #define gfprintf fwprintf |
---|
153 | #define gsscanf swscanf |
---|
154 | #define gvsprintf vswprintf |
---|
155 | |
---|
156 | #define gstrcpy wcscpy |
---|
157 | #define gstrncpy wcsncpy |
---|
158 | #define gstrncat wcsncat |
---|
159 | #define gstrlen wcslen |
---|
160 | #define gstrcat wcscat |
---|
161 | #define gstrcmp wcscmp |
---|
162 | #define gstrncmp wcsncmp |
---|
163 | #define gstricmp wcsicmp |
---|
164 | #define gstrchr wcschr |
---|
165 | #define gstrrchr wcsrchr |
---|
166 | #define gstrtok wcstok |
---|
167 | #define gstrnset wcsnset |
---|
168 | #define gstrstr wcsstr |
---|
169 | |
---|
170 | #define gfopen _wfopen |
---|
171 | #define gopen _wopen |
---|
172 | #define gcreat _wcreat |
---|
173 | #define gfgets fgetws |
---|
174 | #define gfputs fputws |
---|
175 | #define gunlink _wunlink |
---|
176 | #define grename _wrename |
---|
177 | #define gtmpnam _wtmpnam |
---|
178 | #define gtempnam _wtempnam |
---|
179 | #define gfindfirst _wfindfirst |
---|
180 | #define gfinddata_t _wfinddata_t |
---|
181 | #define gfindnext _wfindnext |
---|
182 | #define gfindclose _findclose |
---|
183 | #define gstat _wstat |
---|
184 | #define gaccess _waccess |
---|
185 | |
---|
186 | typedef struct _stat gstat_t; |
---|
187 | |
---|
188 | #define gmkdir _wmkdir |
---|
189 | #define gchdir _wchdir |
---|
190 | #define grmdir _wrmdir |
---|
191 | #define gremove _wremove |
---|
192 | #define ggetcwd _wgetcwd |
---|
193 | |
---|
194 | #define gtolower towlower |
---|
195 | #define gtoupper towupper |
---|
196 | #define gisspace iswspace |
---|
197 | #define gisdigit iswdigit |
---|
198 | #define gisxdigit iswxdigit |
---|
199 | #define gisalnum iswalnum |
---|
200 | #define gisalpha iswalpha |
---|
201 | #define gisupper iswupper |
---|
202 | #define gislower iswlower |
---|
203 | #define gatoi(s) wcstol(s, NULL, 10) |
---|
204 | |
---|
205 | #define gctime _wctime |
---|
206 | #define ggetenv _wgetenv |
---|
207 | #define gexecvp _wexecvp |
---|
208 | |
---|
209 | #else /* ! UNICODE */ |
---|
210 | |
---|
211 | #define T(s) s |
---|
212 | #define TSZ(x) (sizeof(x)) |
---|
213 | #define TASTRL(x) (strlen(x) + 1) |
---|
214 | typedef char char_t; |
---|
215 | #if WIN |
---|
216 | typedef unsigned char uchar_t; |
---|
217 | #endif |
---|
218 | |
---|
219 | #define gsprintf sprintf |
---|
220 | #define gprintf printf |
---|
221 | #define gfprintf fprintf |
---|
222 | #define gsscanf sscanf |
---|
223 | #define gvsprintf vsprintf |
---|
224 | |
---|
225 | #define gstrcpy strcpy |
---|
226 | #define gstrncpy strncpy |
---|
227 | #define gstrncat strncat |
---|
228 | #define gstrlen strlen |
---|
229 | #define gstrcat strcat |
---|
230 | #define gstrcmp strcmp |
---|
231 | #define gstrncmp strncmp |
---|
232 | #define gstricmp stricmp |
---|
233 | #define gstrchr strchr |
---|
234 | #define gstrrchr strrchr |
---|
235 | #define gstrtok strtok |
---|
236 | #define gstrnset strnset |
---|
237 | #define gstrstr strstr |
---|
238 | |
---|
239 | #define gfopen fopen |
---|
240 | #define gopen open |
---|
241 | #define gcreat creat |
---|
242 | #define gfgets fgets |
---|
243 | #define gfputs fputs |
---|
244 | #define gunlink unlink |
---|
245 | #define grename rename |
---|
246 | #define gtmpnam tmpnam |
---|
247 | #define gtempnam tempnam |
---|
248 | #define gfindfirst _findfirst |
---|
249 | #define gfinddata_t _finddata_t |
---|
250 | #define gfindnext _findnext |
---|
251 | #define gfindclose _findclose |
---|
252 | #define gstat stat |
---|
253 | #define gaccess access |
---|
254 | |
---|
255 | typedef struct stat gstat_t; |
---|
256 | |
---|
257 | #define gmkdir mkdir |
---|
258 | #define gchdir chdir |
---|
259 | #define grmdir rmdir |
---|
260 | #define gremove remove |
---|
261 | #define ggetcwd getcwd |
---|
262 | |
---|
263 | #define gtolower tolower |
---|
264 | #define gtoupper toupper |
---|
265 | #define gisspace isspace |
---|
266 | #define gisdigit isdigit |
---|
267 | #define gisxdigit isxdigit |
---|
268 | #define gisalnum isalnum |
---|
269 | #define gisalpha isalpha |
---|
270 | #define gisupper isupper |
---|
271 | #define gislower islower |
---|
272 | #define gatoi atoi |
---|
273 | |
---|
274 | #define gctime ctime |
---|
275 | #define ggetenv getenv |
---|
276 | #define gexecvp execvp |
---|
277 | #ifndef VXW486 |
---|
278 | #define gmain main |
---|
279 | #endif |
---|
280 | #endif |
---|
281 | |
---|
282 | /********************************** Defines ***********************************/ |
---|
283 | |
---|
284 | #define FNAMESIZE 256 /* Max length of file names */ |
---|
285 | |
---|
286 | #define E_MAX_ERROR 4096 |
---|
287 | /* |
---|
288 | * Error types |
---|
289 | */ |
---|
290 | #define E_ASSERT 0x1 /* Assertion error */ |
---|
291 | #define E_LOG 0x2 /* Log error to log file */ |
---|
292 | #define E_USER 0x3 /* Error that must be displayed */ |
---|
293 | |
---|
294 | #define E_L T(__FILE__), __LINE__ |
---|
295 | #define E_ARGS_DEC char_t *file, int line |
---|
296 | #define E_ARGS file, line |
---|
297 | |
---|
298 | #if ASSERT |
---|
299 | #define a_assert(C) if (C) ; else error(E_L, E_ASSERT, T("%s"), #C) |
---|
300 | #else |
---|
301 | #define a_assert(C) if (1) ; else |
---|
302 | #endif |
---|
303 | |
---|
304 | #define VALUE_VALID { {0}, integer, 1 } |
---|
305 | #define VALUE_INVALID { {0}, undefined, 0 } |
---|
306 | |
---|
307 | /* |
---|
308 | * Allocation flags |
---|
309 | */ |
---|
310 | #define VALUE_ALLOCATE 0x1 |
---|
311 | |
---|
312 | #define value_numeric(t) (t == integer) |
---|
313 | #define value_str(t) (t >= string || t <= bytes) |
---|
314 | #define value_ok(t) (t > undefined && t <= symbol) |
---|
315 | |
---|
316 | /* |
---|
317 | * These values are not prefixed so as to aid code readability |
---|
318 | */ |
---|
319 | #if !defined(UW) && !defined(__rtems__) |
---|
320 | #pragma pack(2) |
---|
321 | #endif |
---|
322 | |
---|
323 | typedef enum { |
---|
324 | undefined = 0, |
---|
325 | integer = 1, |
---|
326 | string = 2, |
---|
327 | bytes = 3, |
---|
328 | errmsg = 4 |
---|
329 | } value_type_t; |
---|
330 | |
---|
331 | /* |
---|
332 | * In UW, bit fields default to unsigned unless explicitly defined as signed. |
---|
333 | * Unfortunately, enum become ints, but not explicitly signed. Thus, if using |
---|
334 | * an enum type in a bit field, it becomes unsigned, but we need signed. So |
---|
335 | * for UW we declare value_type_t to be a signed int to make this all work. |
---|
336 | */ |
---|
337 | typedef struct { |
---|
338 | |
---|
339 | union { |
---|
340 | long integer; |
---|
341 | char_t *string; |
---|
342 | char_t *bytes; |
---|
343 | char_t *errmsg; |
---|
344 | void *symbol; |
---|
345 | } value; |
---|
346 | |
---|
347 | #if UW |
---|
348 | signed int type : 8; |
---|
349 | #else |
---|
350 | value_type_t type : 8; |
---|
351 | #endif |
---|
352 | |
---|
353 | unsigned int valid : 1; |
---|
354 | unsigned int user_def_1 : 1; |
---|
355 | unsigned int allocated : 1; /* String was balloced */ |
---|
356 | } value_t; |
---|
357 | |
---|
358 | /* |
---|
359 | * Extract a string from the value depending whether inline or via pointer |
---|
360 | */ |
---|
361 | #define value_strget(v) \ |
---|
362 | (((v)->type == bytes) ? (v)->value.bytes : (v)->value.string) |
---|
363 | |
---|
364 | #if !defined(UW) && !defined(__rtems__) |
---|
365 | #pragma pack() |
---|
366 | #endif |
---|
367 | |
---|
368 | /******************************************************************************/ |
---|
369 | /* |
---|
370 | * A ring queue allows maximum utilization of memory for data storage and is |
---|
371 | * ideal for input/output buffering. This module provides a highly effecient |
---|
372 | * implementation and a vehicle for dynamic strings. |
---|
373 | * |
---|
374 | * WARNING: This is a public implementation and callers have full access to |
---|
375 | * the queue structure and pointers. Change this module very carefully. |
---|
376 | * |
---|
377 | * This module follows the open/close model. |
---|
378 | * |
---|
379 | * Operation of a ringq where rq is a pointer to a ringq : |
---|
380 | * |
---|
381 | * rq->buflen contains the size of the buffer. |
---|
382 | * rq->buf will point to the start of the buffer. |
---|
383 | * rq->servp will point to the first (un-consumed) data byte. |
---|
384 | * rq->endp will point to the next free location to which new data is added |
---|
385 | * rq->endbuf will point to one past the end of the buffer. |
---|
386 | * |
---|
387 | * Eg. If the ringq contains the data "abcdef", it might look like : |
---|
388 | * |
---|
389 | * +-------------------------------------------------------------------+ |
---|
390 | * | | | | | | | | a | b | c | d | e | f | | | | | |
---|
391 | * +-------------------------------------------------------------------+ |
---|
392 | * ^ ^ ^ ^ |
---|
393 | * | | | | |
---|
394 | * rq->buf rq->servp rq->endp rq->enduf |
---|
395 | * |
---|
396 | * The queue is empty when servp == endp. This means that the queue will hold |
---|
397 | * at most rq->buflen -1 bytes. It is the fillers responsibility to ensure |
---|
398 | * the ringq is never filled such that servp == endp. |
---|
399 | * |
---|
400 | * It is the fillers responsibility to "wrap" the endp back to point to |
---|
401 | * rq->buf when the pointer steps past the end. Correspondingly it is the |
---|
402 | * consumers responsibility to "wrap" the servp when it steps to rq->endbuf. |
---|
403 | * The ringqPutc and ringqGetc routines will do this automatically. |
---|
404 | */ |
---|
405 | |
---|
406 | /* |
---|
407 | * Ring queue buffer structure |
---|
408 | */ |
---|
409 | typedef struct { |
---|
410 | unsigned char *buf; /* Holding buffer for data */ |
---|
411 | unsigned char *servp; /* Pointer to start of data */ |
---|
412 | unsigned char *endp; /* Pointer to end of data */ |
---|
413 | unsigned char *endbuf; /* Pointer to end of buffer */ |
---|
414 | int buflen; /* Length of ring queue */ |
---|
415 | int maxsize; /* Maximum size */ |
---|
416 | int increment; /* Growth increment */ |
---|
417 | } ringq_t; |
---|
418 | |
---|
419 | /* |
---|
420 | * Block allocation definitions |
---|
421 | */ |
---|
422 | #define B_L __FILE__, __LINE__ |
---|
423 | #define B_ARGS_DEC char *file, int line |
---|
424 | #define B_ARGS file, line |
---|
425 | |
---|
426 | /* |
---|
427 | * Block classes are: 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, |
---|
428 | * 16384, 32768, 65536 |
---|
429 | */ |
---|
430 | #define B_SHIFT 4 /* Convert size to class */ |
---|
431 | #define B_ROUND ((1 << (B_SHIFT)) - 1) |
---|
432 | #define B_MAX_CLASS 13 /* Maximum class number + 1 */ |
---|
433 | #define B_MALLOCED 0x80000000 /* Block was malloced */ |
---|
434 | #define B_DEFAULT_MEM (64 * 1024) /* Default memory allocation */ |
---|
435 | #define B_MAX_FILES (512) /* Maximum number of files */ |
---|
436 | #define B_FILL_CHAR (0x77) /* Fill byte for buffers */ |
---|
437 | #define B_FILL_WORD (0x77777777) /* Fill word for buffers */ |
---|
438 | #define B_MAX_BLOCKS (64 * 1024) /* Maximum allocated blocks */ |
---|
439 | |
---|
440 | /* |
---|
441 | * Flags. The integer value is used as an arbitrary value to fill the flags. |
---|
442 | */ |
---|
443 | |
---|
444 | #define B_USE_MALLOC 0x1 /* Okay to use malloc if required */ |
---|
445 | #define B_USER_BUF 0x2 /* User supplied buffer for mem */ |
---|
446 | #define B_INTEGRITY 0x8124000 /* Integrity value */ |
---|
447 | #define B_INTEGRITY_MASK 0xFFFF000 /* Integrity mask */ |
---|
448 | |
---|
449 | /* |
---|
450 | * The symbol table record for each symbol entry |
---|
451 | */ |
---|
452 | |
---|
453 | typedef struct sym_t { |
---|
454 | struct sym_t *forw; /* Pointer to next hash list */ |
---|
455 | value_t name; /* Name of symbol */ |
---|
456 | value_t content; /* Value of symbol */ |
---|
457 | int arg; /* Parameter value */ |
---|
458 | } sym_t; |
---|
459 | |
---|
460 | typedef int sym_fd_t; /* Returned by symOpen */ |
---|
461 | |
---|
462 | /* |
---|
463 | * Socket flags |
---|
464 | */ |
---|
465 | #define SOCKET_EOF 0x1 /* Seen end of file */ |
---|
466 | #define SOCKET_CONNECTING 0x2 /* Connect in progress */ |
---|
467 | #define SOCKET_BROADCAST 0x4 /* Broadcast mode */ |
---|
468 | #define SOCKET_PENDING 0x8 /* Message pending on this socket */ |
---|
469 | #define SOCKET_FLUSHING 0x10 /* Background flushing */ |
---|
470 | #define SOCKET_LISTENING 0x20 /* Server socket listening */ |
---|
471 | |
---|
472 | /* |
---|
473 | * Socket error values |
---|
474 | */ |
---|
475 | #define SOCKET_WOULDBLOCK 1 /* Socket would block on I/O */ |
---|
476 | #define SOCKET_RESET 2 /* Socket has been reset */ |
---|
477 | #define SOCKET_NETDOWN 3 /* Network is down */ |
---|
478 | #define SOCKET_AGAIN 4 /* Issue the request again */ |
---|
479 | #define SOCKET_INTR 5 /* Call was interrupted */ |
---|
480 | #define SOCKET_INVAL 6 /* Invalid */ |
---|
481 | |
---|
482 | /* |
---|
483 | * Handler event masks |
---|
484 | */ |
---|
485 | #define SOCKET_READABLE 0x2 /* Make socket readable */ |
---|
486 | #define SOCKET_WRITABLE 0x4 /* Make socket writable */ |
---|
487 | #define SOCKET_EXCEPTION 0x8 /* Interested in exceptions */ |
---|
488 | |
---|
489 | #define SOCKET_BUFSIZ 512 /* Underlying buffer size */ |
---|
490 | |
---|
491 | typedef void (*socketHandler_t)(int sid, int mask, int data); |
---|
492 | typedef int (*socketAccept_t)(int sid, char *ipaddr, int port); |
---|
493 | |
---|
494 | /* |
---|
495 | * Script engines |
---|
496 | */ |
---|
497 | #define EMF_SCRIPT_JSCRIPT 0 /* javascript */ |
---|
498 | #define EMF_SCRIPT_TCL 1 /* tcl */ |
---|
499 | #define EMF_SCRIPT_EJSCRIPT 2 /* Ejscript */ |
---|
500 | #define EMF_SCRIPT_MAX 3 |
---|
501 | |
---|
502 | #define MAXINT INT_MAX |
---|
503 | #define BITSPERBYTE 8 |
---|
504 | #define BITS(type) (BITSPERBYTE * (int) sizeof(type)) |
---|
505 | |
---|
506 | #ifndef max |
---|
507 | #define max(a,b) (((a) > (b)) ? (a) : (b)) |
---|
508 | #endif |
---|
509 | |
---|
510 | #ifndef min |
---|
511 | #define min(a,b) (((a) < (b)) ? (a) : (b)) |
---|
512 | #endif |
---|
513 | |
---|
514 | /******************************* Per O/S Defines ******************************/ |
---|
515 | |
---|
516 | #if VXW486 || LINUX || __rtems__ || LYNX |
---|
517 | #ifndef O_BINARY |
---|
518 | #define O_BINARY 0 |
---|
519 | #endif |
---|
520 | #define SOCKET_ERROR -1 |
---|
521 | #endif |
---|
522 | |
---|
523 | #if WIN |
---|
524 | #undef R_OK |
---|
525 | #define R_OK 4 |
---|
526 | #undef W_OK |
---|
527 | #define W_OK 2 |
---|
528 | #undef X_OK |
---|
529 | #define X_OK 1 |
---|
530 | #undef F_OK |
---|
531 | #define F_OK 0 |
---|
532 | #endif |
---|
533 | |
---|
534 | /********************************* Prototypes *********************************/ |
---|
535 | |
---|
536 | extern void bclose(); |
---|
537 | extern int bopen(void *buf, int bufsize, int flags); |
---|
538 | #if NO_BALLOC |
---|
539 | #undef B_L |
---|
540 | #define B_L x |
---|
541 | #define balloc(x, num) malloc(num) |
---|
542 | #define bfree(x, p) free(p) |
---|
543 | #define bfreeSafe(x, p) \ |
---|
544 | if (p) { bfree(x, p); } else |
---|
545 | #define brealloc(x, p, num) realloc(p, num) |
---|
546 | extern char *bstrdupANoBalloc(char *s); |
---|
547 | #define bstrdupA(x, s) bstrdupANoBalloc(s) |
---|
548 | #if UNICODE |
---|
549 | extern char_t *bstrdupNoBalloc(char_t *s); |
---|
550 | #define bstrdup(x, s) bstrdupNoBalloc(s) |
---|
551 | #define gstrdup(x, s) bstrdupNoBalloc(s) |
---|
552 | #else /* Not UNICODE */ |
---|
553 | #define bstrdup(x, s) bstrdupANoBalloc(s) |
---|
554 | #define gstrdup(x, s) bstrdupANoBalloc(s) |
---|
555 | #endif /* UNICODE */ |
---|
556 | |
---|
557 | #else /* BALLOC */ |
---|
558 | extern void *balloc(B_ARGS_DEC, int size); |
---|
559 | extern void bfree(B_ARGS_DEC, void *mp); |
---|
560 | extern void *brealloc(B_ARGS_DEC, void *buf, int newsize); |
---|
561 | extern void bstats(int handle, void (*writefn)(int fd, char_t *fmt, ...)); |
---|
562 | extern char_t *bstrdup(B_ARGS_DEC, char_t *s); |
---|
563 | extern void bfreeSafe(B_ARGS_DEC, void* mp); |
---|
564 | #define gstrdup(B_ARGS, s) bstrdup(B_ARGS, s) |
---|
565 | #if UNICODE |
---|
566 | extern char *bstrdupA(B_ARGS_DEC, char *s); |
---|
567 | #else |
---|
568 | #define bstrdupA bstrdup |
---|
569 | #endif /* UNICODE */ |
---|
570 | #endif /* BALLOC */ |
---|
571 | |
---|
572 | #if !LINUX && !__rtems__ |
---|
573 | extern char_t* basename(char_t* name); |
---|
574 | #endif |
---|
575 | |
---|
576 | extern void *emfCreateTimer(int delay, void (*routine)(long arg), long arg); |
---|
577 | extern void emfDeleteTimer(void *id); |
---|
578 | extern int emfInstGet(); |
---|
579 | extern void emfInstSet(int inst); |
---|
580 | extern void error(E_ARGS_DEC, int flags, char_t *fmt, ...); |
---|
581 | |
---|
582 | extern int hAlloc(void*** map); |
---|
583 | extern int hFree(void*** map, int handle); |
---|
584 | extern int hAllocEntry(void ***list, int *max, int size); |
---|
585 | |
---|
586 | extern int ringqOpen(ringq_t *rq, int increment, int maxsize); |
---|
587 | extern void ringqClose(ringq_t *rq); |
---|
588 | extern int ringqLen(ringq_t *rq); |
---|
589 | |
---|
590 | extern int ringqPutc(ringq_t *rq, char_t c); |
---|
591 | extern int ringqInsertc(ringq_t *rq, char_t c); |
---|
592 | extern int ringqPutstr(ringq_t *rq, char_t *str); |
---|
593 | extern int ringqGetc(ringq_t *rq); |
---|
594 | |
---|
595 | extern int gvsnprintf(char_t **s, int n, char_t *fmt, va_list arg); |
---|
596 | extern int gsnprintf(char_t **s, int n, char_t *fmt, ...); |
---|
597 | |
---|
598 | #if UNICODE |
---|
599 | extern int ringqPutcA(ringq_t* rq, char c); |
---|
600 | extern int ringqInsertcA(ringq_t* rq, char c); |
---|
601 | extern int ringqPutstrA(ringq_t* rq, char* str); |
---|
602 | extern int ringqGetcA(ringq_t* rq); |
---|
603 | #else |
---|
604 | #define ringqPutcA ringqPutc |
---|
605 | #define ringqInsertcA ringqInsertc |
---|
606 | #define ringqPutstrA ringqPutstr |
---|
607 | #define ringqGetcA ringqGetc |
---|
608 | #endif |
---|
609 | |
---|
610 | extern int ringqPutBlk(ringq_t *rq, unsigned char *buf, int len); |
---|
611 | extern int ringqPutBlkMax(ringq_t *rq); |
---|
612 | extern void ringqPutBlkAdj(ringq_t *rq, int size); |
---|
613 | extern int ringqGetBlk(ringq_t *rq, unsigned char *buf, int len); |
---|
614 | extern int ringqGetBlkMax(ringq_t *rq); |
---|
615 | extern void ringqGetBlkAdj(ringq_t *rq, int size); |
---|
616 | extern void ringqFlush(ringq_t *rq); |
---|
617 | |
---|
618 | extern int scriptSetVar(int engine, char_t *var, char_t *value); |
---|
619 | extern int scriptEval(int engine, char_t *cmd, char_t **rslt, int chan); |
---|
620 | |
---|
621 | extern void socketClose(); |
---|
622 | extern void socketCloseConnection(int sid); |
---|
623 | extern void socketCreateHandler(int sid, int mask, socketHandler_t |
---|
624 | handler, int arg); |
---|
625 | extern void socketDeleteHandler(int sid); |
---|
626 | extern int socketEof(int sid); |
---|
627 | extern int socketFlush(int sid, int block); |
---|
628 | extern int socketGets(int sid, char_t** buf); |
---|
629 | extern int socketInputBuffered(int sid); |
---|
630 | extern int socketOpen(); |
---|
631 | extern int socketOpenConnection(char *host, int port, |
---|
632 | socketAccept_t accept, int flags); |
---|
633 | extern void socketProcess(); |
---|
634 | extern int socketRead(int sid, char *buf, int len); |
---|
635 | extern int socketReady(); |
---|
636 | extern int socketWrite(int sid, char *buf, int len); |
---|
637 | extern int socketWriteString(int sid, char_t *buf); |
---|
638 | extern int socketSelect(); |
---|
639 | |
---|
640 | extern char_t *strlower(char_t *string); |
---|
641 | extern char_t *strupper(char_t *string); |
---|
642 | |
---|
643 | extern char_t *stritoa(int n, char_t *string, int width); |
---|
644 | |
---|
645 | extern sym_fd_t symOpen(int hash_size); |
---|
646 | extern void symClose(sym_fd_t sd, void (*cleanup)(sym_t *sp)); |
---|
647 | extern sym_t *symLookup(sym_fd_t sd, char_t *name); |
---|
648 | extern sym_t *symEnter(sym_fd_t sd, char_t *name, value_t v, int arg); |
---|
649 | extern int symDelete(sym_fd_t sd, char_t *name); |
---|
650 | extern void symWalk(sym_fd_t sd, void (*fn)(sym_t *symp)); |
---|
651 | |
---|
652 | extern void goahead_trace(int lev, char_t *fmt, ...); |
---|
653 | |
---|
654 | extern value_t valueInteger(long value); |
---|
655 | extern value_t valueString(char_t *value, int flags); |
---|
656 | extern value_t valueErrmsg(char_t *value); |
---|
657 | extern void valueFree(value_t *v); |
---|
658 | |
---|
659 | extern char_t *ascToUni(char_t *ubuf, char *str, int nBytes); |
---|
660 | extern char *uniToAsc(char *buf, char_t *ustr, int nBytes); |
---|
661 | extern char_t *ballocAscToUni(char * cp); |
---|
662 | extern char *ballocUniToAsc(char_t * unip, int ulen); |
---|
663 | |
---|
664 | #endif /* _h_UEMF */ |
---|
665 | |
---|
666 | /******************************************************************************/ |
---|