blob: 3010ac0c6d60e543d9045604570e0463c1a8c074 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#ifndef _h_UEMF
2#define _h_UEMF 1
3
4#ifdef WIN
5 #include <direct.h>
6 #include <io.h>
7 #include <sys/stat.h>
8 #include <limits.h>
9 #include <tchar.h>
10 #include <windows.h>
11 #include <winnls.h>
12 #include <time.h>
13 #include <sys/types.h>
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <fcntl.h>
17 #include <errno.h>
18#endif /* WIN */
19
20#ifdef CE
21 /*#include <errno.h>*/
22 #include <limits.h>
23 #include <tchar.h>
24 #include <windows.h>
25 #include <winsock.h>
26 #include <winnls.h>
27 #include "CE/wincompat.h"
28 #include <winsock.h>
29#endif /* CE */
30
31#ifdef NW
32 #include <direct.h>
33 #include <io.h>
34 #include <sys/stat.h>
35 #include <time.h>
36 #include <sys/types.h>
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <fcntl.h>
40 #include <errno.h>
41 #include <niterror.h>
42 #define EINTR EINUSE
43 #define WEBS 1
44 #include <limits.h>
45 #include <netdb.h>
46 #include <process.h>
47 #include <tiuser.h>
48 #include <sys/time.h>
49 #include <arpa/inet.h>
50 #include <sys/types.h>
51 #include <sys/socket.h>
52 #include <sys/filio.h>
53 #include <netinet/in.h>
54#endif /* NW */
55
56#ifdef SCOV5
57 #include <sys/types.h>
58 #include <stdio.h>
59 #include "sys/socket.h"
60 #include "sys/select.h"
61 #include "netinet/in.h"
62 #include "arpa/inet.h"
63 #include "netdb.h"
64#endif /* SCOV5 */
65
66#ifdef UNIX
67 #include <stdio.h>
68#endif /* UNIX */
69
70#ifdef LINUX
71 #include <sys/types.h>
72 #include <sys/stat.h>
73 #include <sys/param.h>
74 #include <limits.h>
75 #include <stdio.h>
76 #include <stdlib.h>
77 #include <unistd.h>
78 #include <sys/socket.h>
79 #include <sys/select.h>
80 #include <netinet/in.h>
81 #include <arpa/inet.h>
82 #include <netdb.h>
83 #include <time.h>
84 #include <fcntl.h>
85 #include <errno.h>
86#endif /* LINUX */
87
88#ifdef LYNX
89 #include <limits.h>
90 #include <stdarg.h>
91 #include <stdio.h>
92 #include <stdlib.h>
93 #include <unistd.h>
94 #include <socket.h>
95 #include <netinet/in.h>
96 #include <arpa/inet.h>
97 #include <netdb.h>
98 #include <time.h>
99 #include <fcntl.h>
100 #include <errno.h>
101#endif /* LYNX */
102
103#ifdef MACOSX
104 #include <sys/stat.h>
105 #include <stdio.h>
106 #include <stdlib.h>
107 #include <unistd.h>
108 #include <sys/socket.h>
109 #include <netinet/in.h>
110 #include <arpa/inet.h>
111 #include <netdb.h>
112 #include <fcntl.h>
113 #include <errno.h>
114#endif /* MACOSX */
115
116#ifdef UW
117 #include <stdio.h>
118#endif /* UW */
119
120#ifdef VXWORKS
121 #include <vxWorks.h>
122 #include <sockLib.h>
123 #include <selectLib.h>
124 #include <inetLib.h>
125 #include <ioLib.h>
126 #include <stdio.h>
127 #include <stat.h>
128 #include <time.h>
129 #include <usrLib.h>
130 #include <fcntl.h>
131 #include <errno.h>
132#endif /* VXWORKS */
133
134#ifdef sparc
135# define __NO_PACK
136#endif /* sparc */
137
138#ifdef SOLARIS
139 #include <sys/types.h>
140 #include <limits.h>
141 #include <stdio.h>
142 #include <stdlib.h>
143 #include <unistd.h>
144 #include <socket.h>
145 #include <sys/select.h>
146 #include <netinet/in.h>
147 #include <arpa/inet.h>
148 #include <netdb.h>
149 #include <time.h>
150 #include <fcntl.h>
151 #include <errno.h>
152#endif /* SOLARIS */
153
154#ifdef QNX4
155 #include <sys/types.h>
156 #include <stdio.h>
157 #include <sys/socket.h>
158 #include <sys/select.h>
159 #include <netinet/in.h>
160 #include <arpa/inet.h>
161 #include <netdb.h>
162 #include <stdlib.h>
163 #include <unistd.h>
164 #include <sys/uio.h>
165 #include <sys/wait.h>
166#endif /* QNX4 */
167
168#ifdef ECOS
169 #include <limits.h>
170 #include <cyg/infra/cyg_type.h>
171 #include <cyg/kernel/kapi.h>
172 #include <time.h>
173 #include <network.h>
174 #include <errno.h>
175#endif /* ECOS */
176
177#include <ctype.h>
178#include <stdarg.h>
179#include <string.h>
180
181#ifndef WEBS
182#include "messages.h"
183#endif /* ! WEBS */
184
185#ifdef UW
186 #define __NO_PACK 1
187#endif /* UW */
188
189#if (defined (SCOV5) || defined (VXWORKS) || defined (LINUX) || defined (LYNX) || defined (MACOSX))
190#ifndef O_BINARY
191#define O_BINARY 0
192#endif /* O_BINARY */
193#define SOCKET_ERROR -1
194#endif /* SCOV5 || VXWORKS || LINUX || LYNX || MACOSX */
195
196#if (defined (WIN) || defined (CE))
197
198#define __NO_FCNTL 1
199
200#undef R_OK
201#define R_OK 4
202#undef W_OK
203#define W_OK 2
204#undef X_OK
205#define X_OK 1
206#undef F_OK
207#define F_OK 0
208#endif /* WIN || CE */
209
210#if (defined (LINUX) && !defined (_STRUCT_TIMEVAL))
211struct timeval
212{
213 time_t tv_sec;
214 time_t tv_usec;
215};
216#define _STRUCT_TIMEVAL 1
217#endif /* LINUX && ! _STRUCT_TIMEVAL */
218
219#ifdef ECOS
220 #define O_RDONLY 1
221 #define O_BINARY 2
222
223 #define __NO_PACK 1
224 #define __NO_EJ_FILE 1
225 #define __NO_CGI_BIN 1
226 #define __NO_FCNTL 1
227
228 #define LIBKERN_INLINE
229
230#endif /* ECOS */
231
232#ifdef QNX4
233 typedef long fd_mask;
234 #define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
235#endif /* QNX4 */
236
237#ifdef NW
238 #define fd_mask fd_set
239 #define INADDR_NONE -1l
240 #define Sleep delay
241
242 #define __NO_FCNTL 1
243
244 #undef R_OK
245 #define R_OK 4
246 #undef W_OK
247 #define W_OK 2
248 #undef X_OK
249 #define X_OK 1
250 #undef F_OK
251 #define F_OK 0
252#endif /* NW */
253
254#define TRACE_MAX (4096 - 48)
255#define VALUE_MAX_STRING (4096 - 48)
256#define SYM_MAX (512)
257#define XML_MAX 4096
258#define BUF_MAX 4096
259#define FMT_STATIC_MAX 256
260
261#if (defined (LITTLEFOOT) || defined (WEBS))
262#define LF_BUF_MAX (510)
263#define LF_PATHSIZE LF_BUF_MAX
264#else
265#define LF_BUF_MAX BUF_MAX
266#define LF_PATHSIZE PATHSIZE
267#define UPPATHSIZE PATHSIZE
268#endif /* LITTLEFOOT || WEBS */
269
270#ifndef CHAR_T_DEFINED
271#define CHAR_T_DEFINED 1
272#ifdef UNICODE
273
274#define T(x) __TXT(x)
275#define __TXT(s) L ## s
276typedef unsigned short char_t;
277typedef unsigned short uchar_t;
278
279#define TSZ(x) (sizeof(x) / sizeof(char_t))
280
281#define TASTRL(x) ((wcslen(x) + 1) * sizeof(char_t))
282
283#else
284#define T(s) s
285typedef char char_t;
286#define TSZ(x) (sizeof(x))
287#define TASTRL(x) (strlen(x) + 1)
288#ifdef WIN
289typedef unsigned char uchar_t;
290#endif /* WIN */
291
292#endif /* UNICODE */
293
294#endif /* ! CHAR_T_DEFINED */
295
296#ifndef TRUE
297#define TRUE 1
298#endif
299
300#ifndef FALSE
301#define FALSE 0
302#endif
303
304#define GOAHEAD_COPYRIGHT \
305 T("Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved.")
306
307#if (defined (LITTLEFOOT) && defined (INMEM))
308 #include "lf/inmem.h"
309#endif /* LITTLEFOOT && INMEM */
310
311#ifdef UNICODE
312
313#define gmain wmain
314
315#define gasctime _wasctime
316#define gsprintf swprintf
317#define gprintf wprintf
318#define gfprintf fwprintf
319#define gsscanf swscanf
320#define gvsprintf vswprintf
321
322#define gstrcpy wcscpy
323#define gstrncpy wcsncpy
324#define gstrncat wcsncat
325#define gstrlen wcslen
326#define gstrcat wcscat
327#define gstrcmp wcscmp
328#define gstrncmp wcsncmp
329#define gstricmp wcsicmp
330#define gstrchr wcschr
331#define gstrrchr wcsrchr
332#define gstrtok wcstok
333#define gstrnset wcsnset
334#define gstrrchr wcsrchr
335#define gstrspn wcsspn
336#define gstrcspn wcscspn
337#define gstrstr wcsstr
338#define gstrtol wcstol
339
340#define gfopen _wfopen
341#define gopen _wopen
342#define gclose close
343#define gcreat _wcreat
344#define gfgets fgetws
345#define gfputs fputws
346#define gfscanf fwscanf
347#define ggets _getws
348#define glseek lseek
349#define gunlink _wunlink
350#define gread read
351#define grename _wrename
352#define gwrite write
353#define gtmpnam _wtmpnam
354#define gtempnam _wtempnam
355#define gfindfirst _wfindfirst
356#define gfinddata_t _wfinddata_t
357#define gfindnext _wfindnext
358#define gfindclose _findclose
359#define gstat _wstat
360#define gaccess _waccess
361#define gchmod _wchmod
362
363typedef struct _stat gstat_t;
364
365#define gmkdir _wmkdir
366#define gchdir _wchdir
367#define grmdir _wrmdir
368#define ggetcwd _wgetcwd
369
370#define gtolower towlower
371#define gtoupper towupper
372#ifdef CE
373#define gisspace isspace
374#define gisdigit isdigit
375#define gisxdigit isxdigit
376#define gisupper isupper
377#define gislower islower
378#define gisprint isprint
379#else
380#define gremove _wremove
381#define gisspace iswspace
382#define gisdigit iswdigit
383#define gisxdigit iswxdigit
384#define gisupper iswupper
385#define gislower iswlower
386#endif /* if CE */
387#define gisalnum iswalnum
388#define gisalpha iswalpha
389#define gatoi(s) wcstol(s, NULL, 10)
390
391#define gctime _wctime
392#define ggetenv _wgetenv
393#define gexecvp _wexecvp
394
395#else /* ! UNICODE */
396
397#ifdef VXWORKS
398#define gchdir vxchdir
399#define gmkdir vxmkdir
400#define grmdir vxrmdir
401#elif (defined (LYNX) || defined (LINUX) || defined (MACOSX) || defined (SOLARIS))
402#define gchdir chdir
403#define gmkdir(s) mkdir(s,0755)
404#define grmdir rmdir
405#else
406#define gchdir chdir
407#define gmkdir mkdir
408#define grmdir rmdir
409#endif /* VXWORKS #elif LYNX || LINUX || MACOSX || SOLARIS*/
410
411#define gclose close
412#define gclosedir closedir
413#define gchmod chmod
414#define ggetcwd getcwd
415#define glseek lseek
416#define gloadModule loadModule
417#define gopen open
418#define gopendir opendir
419#define gread read
420#define greaddir readdir
421#define grename rename
422#define gstat stat
423#define gunlink unlink
424#define gwrite write
425
426#define gasctime asctime
427#define gsprintf sprintf
428#define gprintf printf
429#define gfprintf fprintf
430#define gsscanf sscanf
431#define gvsprintf vsprintf
432
433#define gstrcpy strcpy
434#define gstrncpy strncpy
435#define gstrncat strncat
436#define gstrlen strlen
437#define gstrcat strcat
438#define gstrcmp strcmp
439#define gstrncmp strncmp
440#define gstricmp strcmpci
441#define gstrchr strchr
442#define gstrrchr strrchr
443#define gstrtok strtok
444#define gstrnset strnset
445#define gstrrchr strrchr
446#define gstrspn strspn
447#define gstrcspn strcspn
448#define gstrstr strstr
449#define gstrtol strtol
450
451#define gfopen fopen
452#define gcreat creat
453#define gfgets fgets
454#define gfputs fputs
455#define gfscanf fscanf
456#define ggets gets
457#define gtmpnam tmpnam
458#define gtempnam tempnam
459#define gfindfirst _findfirst
460#define gfinddata_t _finddata_t
461#define gfindnext _findnext
462#define gfindclose _findclose
463#define gaccess access
464
465typedef struct stat gstat_t;
466
467#define gremove remove
468
469#define gtolower tolower
470#define gtoupper toupper
471#define gisspace isspace
472#define gisdigit isdigit
473#define gisxdigit isxdigit
474#define gisalnum isalnum
475#define gisalpha isalpha
476#define gisupper isupper
477#define gislower islower
478#define gatoi atoi
479
480#define gctime ctime
481#define ggetenv getenv
482#define gexecvp execvp
483#ifndef VXWORKS
484#define gmain main
485#endif /* ! VXWORKS */
486#ifdef VXWORKS
487#define fcntl(a, b, c)
488#endif /* VXWORKS */
489#endif /* ! UNICODE */
490
491#ifdef INMEM
492 #include "lf/inmem.h"
493#endif
494
495#ifndef FNAMESIZE
496#define FNAMESIZE 254
497#endif /* FNAMESIZE */
498
499#define E_MAX_ERROR 4096
500#define URL_MAX 4096
501
502#define E_ASSERT 0x1
503#define E_LOG 0x2
504#define E_USER 0x3
505
506#define E_L T(__FILE__), __LINE__
507#define E_ARGS_DEC char_t *file, int line
508#define E_ARGS file, line
509
510#if (defined (ASSERT) || defined (ASSERT_CE))
511 #define a_assert(C) if (C) ; else error(E_L, E_ASSERT, T("%s"), T(#C))
512#else
513 #define a_assert(C) if (1) ; else
514#endif /* ASSERT || ASSERT_CE */
515
516typedef enum {
517 undefined = 0,
518 byteint = 1,
519 shortint = 2,
520 integer = 3,
521 hex = 4,
522 percent = 5,
523 octal = 6,
524 big = 7,
525 flag = 8,
526 floating = 9,
527 string = 10,
528 bytes = 11,
529 symbol = 12,
530 errmsg = 13
531} vtype_t;
532
533#ifndef __NO_PACK
534#pragma pack(2)
535#endif /* _NO_PACK */
536
537typedef struct {
538
539 union {
540 char flag;
541 char byteint;
542 short shortint;
543 char percent;
544 long integer;
545 long hex;
546 long octal;
547 long big[2];
548#ifdef FLOATING_POINT_SUPPORT
549 double floating;
550#endif /* FLOATING_POINT_SUPPORT */
551 char_t *string;
552 char *bytes;
553 char_t *errmsg;
554 void *symbol;
555 } value;
556
557 vtype_t type;
558 unsigned int valid : 8;
559 unsigned int allocated : 8;
560} value_t;
561
562#ifndef __NO_PACK
563#pragma pack()
564#endif /* __NO_PACK */
565
566#define VALUE_ALLOCATE 0x1
567
568#define value_numeric(t) (t >= byteint && t <= big)
569#define value_str(t) (t >= string && t <= bytes)
570#define value_ok(t) (t > undefined && t <= symbol)
571
572#define VALUE_VALID { {0}, integer, 1 }
573#define VALUE_INVALID { {0}, undefined, 0 }
574
575typedef struct {
576 unsigned char *buf;
577 unsigned char *servp;
578 unsigned char *endp;
579 unsigned char *endbuf;
580 int buflen;
581 int maxsize;
582 int increment;
583} ringq_t;
584
585#ifdef B_STATS
586#ifndef B_L
587#define B_L T(__FILE__), __LINE__
588#define B_ARGS_DEC char_t *file, int line
589#define B_ARGS file, line
590#endif /* B_L */
591#endif /* B_STATS */
592
593typedef struct {
594 union {
595 void *next;
596 int size;
597 } u;
598 int flags;
599} bType;
600
601#define B_SHIFT 4
602#define B_ROUND ((1 << (B_SHIFT)) - 1)
603#define B_MAX_CLASS 13
604#define B_MALLOCED 0x80000000
605#define B_DEFAULT_MEM (64 * 1024)
606#define B_MAX_FILES (512)
607#define B_FILL_CHAR (0x77)
608#define B_FILL_WORD (0x77777777)
609#define B_MAX_BLOCKS (64 * 1024)
610
611
612#define B_INTEGRITY 0x8124000
613#define B_INTEGRITY_MASK 0xFFFF000
614#define B_USE_MALLOC 0x1
615#define B_USER_BUF 0x2
616
617
618typedef struct sym_t {
619 struct sym_t *forw;
620 value_t name;
621 value_t content;
622 int arg;
623} sym_t;
624
625typedef int sym_fd_t;
626
627#define EMF_SCRIPT_JSCRIPT 0
628#define EMF_SCRIPT_TCL 1
629#define EMF_SCRIPT_EJSCRIPT 2
630#define EMF_SCRIPT_MAX 3
631
632#define MAXINT INT_MAX
633#define BITSPERBYTE 8
634#define BITS(type) (BITSPERBYTE * (int) sizeof(type))
635#define STRSPACE T("\t \n\r\t")
636
637#ifndef max
638#define max(a,b) (((a) > (b)) ? (a) : (b))
639#endif /* max */
640
641#ifndef min
642#define min(a,b) (((a) < (b)) ? (a) : (b))
643#endif /* min */
644
645typedef struct {
646 char_t *minute;
647 char_t *hour;
648 char_t *day;
649 char_t *month;
650 char_t *dayofweek;
651} cron_t;
652
653extern long cronUntil(cron_t *cp, int period, time_t testTime);
654extern int cronAlloc(cron_t *cp, char_t *str);
655extern int cronFree(cron_t *cp);
656
657
658#if ((defined (WIN) || defined (CE)) && defined (WEBS))
659#define EWOULDBLOCK WSAEWOULDBLOCK
660#define ENETDOWN WSAENETDOWN
661#define ECONNRESET WSAECONNRESET
662#endif /* (WIN || CE) && WEBS) */
663
664#define SOCKET_EOF 0x1
665#define SOCKET_CONNECTING 0x2
666#define SOCKET_BROADCAST 0x4
667#define SOCKET_PENDING 0x8
668#define SOCKET_FLUSHING 0x10
669#define SOCKET_DATAGRAM 0x20
670#define SOCKET_ASYNC 0x40
671#define SOCKET_BLOCK 0x80
672#define SOCKET_LISTENING 0x100
673#define SOCKET_CLOSING 0x200
674#define SOCKET_CONNRESET 0x400
675
676#define SOCKET_PORT_MAX 0xffff
677
678
679#define SOCKET_WOULDBLOCK 1
680#define SOCKET_RESET 2
681#define SOCKET_NETDOWN 3
682#define SOCKET_AGAIN 4
683#define SOCKET_INTR 5
684#define SOCKET_INVAL 6
685
686#define SOCKET_READABLE 0x2
687#define SOCKET_WRITABLE 0x4
688#define SOCKET_EXCEPTION 0x8
689#define EMF_SOCKET_MESSAGE (WM_USER+13)
690
691#ifdef LITTLEFOOT
692#define SOCKET_BUFSIZ 510
693#else
694#define SOCKET_BUFSIZ 1024
695#endif /* LITTLEFOOT */
696
697typedef void (*socketHandler_t)(int sid, int mask, int data);
698typedef int (*socketAccept_t)(int sid, char *ipaddr, int port,
699 int listenSid);
700typedef struct {
701 char host[64];
702 ringq_t inBuf;
703 ringq_t outBuf;
704 ringq_t lineBuf;
705 socketAccept_t accept;
706 socketHandler_t handler;
707 int handler_data;
708 int handlerMask;
709 int sid;
710 int port;
711 int flags;
712 int sock;
713 int fileHandle;
714 int interestEvents;
715 int currentEvents;
716 int selectEvents;
717 int saveMask;
718 int error;
719} socket_t;
720
721
722extern void bclose();
723extern int bopen(void *buf, int bufsize, int flags);
724
725
726#ifdef NO_BALLOC
727#define balloc(B_ARGS, num) malloc(num)
728#define bfree(B_ARGS, p) free(p)
729#define bfreeSafe(B_ARGS, p) \
730 if (p) { free(p); } else
731#define brealloc(B_ARGS, p, num) realloc(p, num)
732extern char_t *bstrdupNoBalloc(char_t *s);
733extern char *bstrdupANoBalloc(char *s);
734#define bstrdup(B_ARGS, s) bstrdupNoBalloc(s)
735#define bstrdupA(B_ARGS, s) bstrdupANoBalloc(s)
736#define gstrdup(B_ARGS, s) bstrdupNoBalloc(s)
737
738#else /* BALLOC */
739
740#ifndef B_STATS
741#define balloc(B_ARGS, num) balloc(num)
742#define bfree(B_ARGS, p) bfree(p)
743#define bfreeSafe(B_ARGS, p) bfreeSafe(p)
744#define brealloc(B_ARGS, p, size) brealloc(p, size)
745#define bstrdup(B_ARGS, p) bstrdup(p)
746
747#ifdef UNICODE
748#define bstrdupA(B_ARGS, p) bstrdupA(p)
749#else /* UNICODE */
750#define bstrdupA bstrdup
751#endif /* UNICODE */
752
753#endif /* B_STATS */
754
755#define gstrdup bstrdup
756extern void *balloc(B_ARGS_DEC, int size);
757extern void bfree(B_ARGS_DEC, void *mp);
758extern void bfreeSafe(B_ARGS_DEC, void *mp);
759extern void *brealloc(B_ARGS_DEC, void *buf, int newsize);
760extern char_t *bstrdup(B_ARGS_DEC, char_t *s);
761
762#ifdef UNICODE
763extern char *bstrdupA(B_ARGS_DEC, char *s);
764#else /* UNICODE */
765#define bstrdupA bstrdup
766#endif /* UNICODE */
767#endif /* BALLOC */
768
769extern void bstats(int handle, void (*writefn)(int handle, char_t *fmt, ...));
770
771#define B_USE_MALLOC 0x1 /* Okay to use malloc if required */
772#define B_USER_BUF 0x2 /* User supplied buffer for mem */
773
774
775#ifndef LINUX
776extern char_t *basename(char_t *name);
777#endif /* !LINUX */
778
779#if (defined (UEMF) && defined (WEBS))
780
781#define emfSchedCallback websSchedCallBack
782#define emfUnschedCallback websUnschedCallBack
783#define emfReschedCallback websReschedCallBack
784#endif /* UEMF && WEBS */
785
786typedef void (emfSchedProc)(void *data, int id);
787extern int emfSchedCallback(int delay, emfSchedProc *proc, void *arg);
788extern void emfUnschedCallback(int id);
789extern void emfReschedCallback(int id, int delay);
790extern void emfSchedProcess();
791extern int emfInstGet();
792extern void emfInstSet(int inst);
793extern void error(E_ARGS_DEC, int flags, char_t *fmt, ...);
794extern void (*errorSetHandler(void (*function)(int etype, char_t *msg))) \
795 (int etype, char_t *msg);
796
797#ifdef B_STATS
798#define hAlloc(x) HALLOC(B_L, x)
799#define hAllocEntry(x, y, z) HALLOCENTRY(B_L, x, y, z)
800extern int HALLOC(B_ARGS_DEC, void ***map);
801extern int HALLOCENTRY(B_ARGS_DEC, void ***list, int *max, int size);
802#else
803extern int hAlloc(void ***map);
804extern int hAllocEntry(void ***list, int *max, int size);
805#endif /* B_STATS */
806
807extern int hFree(void ***map, int handle);
808
809extern int ringqOpen(ringq_t *rq, int increment, int maxsize);
810extern void ringqClose(ringq_t *rq);
811extern int ringqLen(ringq_t *rq);
812
813extern int ringqPutc(ringq_t *rq, char_t c);
814extern int ringqInsertc(ringq_t *rq, char_t c);
815extern int ringqPutStr(ringq_t *rq, char_t *str);
816extern int ringqGetc(ringq_t *rq);
817
818extern int fmtValloc(char_t **s, int n, char_t *fmt, va_list arg);
819extern int fmtAlloc(char_t **s, int n, char_t *fmt, ...);
820extern int fmtStatic(char_t *s, int n, char_t *fmt, ...);
821
822#ifdef UNICODE
823extern int ringqPutcA(ringq_t *rq, char c);
824extern int ringqInsertcA(ringq_t *rq, char c);
825extern int ringqPutStrA(ringq_t *rq, char *str);
826extern int ringqGetcA(ringq_t *rq);
827#else
828#define ringqPutcA ringqPutc
829#define ringqInsertcA ringqInsertc
830#define ringqPutStrA ringqPutStr
831#define ringqGetcA ringqGetc
832#endif /* UNICODE */
833
834extern int ringqPutBlk(ringq_t *rq, unsigned char *buf, int len);
835extern int ringqPutBlkMax(ringq_t *rq);
836extern void ringqPutBlkAdj(ringq_t *rq, int size);
837extern int ringqGetBlk(ringq_t *rq, unsigned char *buf, int len);
838extern int ringqGetBlkMax(ringq_t *rq);
839extern void ringqGetBlkAdj(ringq_t *rq, int size);
840extern void ringqFlush(ringq_t *rq);
841extern void ringqAddNull(ringq_t *rq);
842
843extern int scriptSetVar(int engine, char_t *var, char_t *value);
844extern int scriptEval(int engine, char_t *cmd, char_t **rslt, int chan);
845
846extern void socketClose();
847extern void socketCloseConnection(int sid);
848extern void socketCreateHandler(int sid, int mask, socketHandler_t
849 handler, int arg);
850extern void socketDeleteHandler(int sid);
851extern int socketEof(int sid);
852extern int socketCanWrite(int sid);
853extern void socketSetBufferSize(int sid, int in, int line, int out);
854extern int socketFlush(int sid);
855extern int socketGets(int sid, char_t **buf);
856extern int socketGetPort(int sid);
857extern int socketInputBuffered(int sid);
858extern int socketOpen();
859extern int socketOpenConnection(char *host, int port,
860 socketAccept_t accept, int flags);
861extern void socketProcess(int hid);
862extern int socketRead(int sid, char *buf, int len);
863extern int socketReady(int hid);
864extern int socketWrite(int sid, char *buf, int len);
865extern int socketWriteString(int sid, char_t *buf);
866extern int socketSelect(int hid, int timeout);
867extern int socketGetHandle(int sid);
868extern int socketSetBlock(int sid, int flags);
869extern int socketGetBlock(int sid);
870extern int socketAlloc(char *host, int port, socketAccept_t accept,
871 int flags);
872extern void socketFree(int sid);
873extern int socketGetError();
874extern socket_t *socketPtr(int sid);
875extern int socketWaitForEvent(socket_t *sp, int events, int *errCode);
876extern void socketRegisterInterest(socket_t *sp, int handlerMask);
877extern int socketGetInput(int sid, char *buf, int toRead, int *errCode);
878
879extern char_t *strlower(char_t *string);
880extern char_t *strupper(char_t *string);
881
882extern char_t *stritoa(int n, char_t *string, int width);
883
884extern sym_fd_t symOpen(int hash_size);
885extern void symClose(sym_fd_t sd);
886extern sym_t *symLookup(sym_fd_t sd, char_t *name);
887extern sym_t *symEnter(sym_fd_t sd, char_t *name, value_t v, int arg);
888extern int symDelete(sym_fd_t sd, char_t *name);
889extern void symWalk(sym_fd_t sd, void (*fn)(sym_t *symp));
890extern sym_t *symFirst(sym_fd_t sd);
891extern sym_t *symNext(sym_fd_t sd);
892extern int symSubOpen();
893extern void symSubClose();
894
895extern void trace(int lev, char_t *fmt, ...);
896extern void traceRaw(char_t *buf);
897extern void (*traceSetHandler(void (*function)(int level, char_t *buf)))
898 (int level, char_t *buf);
899
900extern value_t valueInteger(long value);
901extern value_t valueString(char_t *value, int flags);
902extern value_t valueErrmsg(char_t *value);
903extern void valueFree(value_t *v);
904extern int vxchdir(char *dirname);
905
906extern unsigned int hextoi(char_t *hexstring);
907extern unsigned int gstrtoi(char_t *s);
908extern time_t timeMsec();
909
910extern char_t *ascToUni(char_t *ubuf, char *str, int nBytes);
911extern char *uniToAsc(char *buf, char_t *ustr, int nBytes);
912extern char_t *ballocAscToUni(char *cp, int alen);
913extern char *ballocUniToAsc(char_t *unip, int ulen);
914
915extern char_t *basicGetHost();
916extern char_t *basicGetAddress();
917extern char_t *basicGetProduct();
918extern void basicSetHost(char_t *host);
919extern void basicSetAddress(char_t *addr);
920
921extern int harnessOpen(char_t **argv);
922extern void harnessClose(int status);
923extern void harnessTesting(char_t *msg, ...);
924extern void harnessPassed();
925extern void harnessFailed(int line);
926extern int harnessLevel();
927
928#endif /* _h_UEMF */
929