1 /*
2  *  The Regina Rexx Interpreter
3  *  Copyright (C) 1993-1994  Anders Christensen <anders@pvv.unit.no>
4  *
5  *  This library is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Library General Public
7  *  License as published by the Free Software Foundation; either
8  *  version 2 of the License, or (at your option) any later version.
9  *
10  *  This library is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  *  Library General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Library General Public
16  *  License along with this library; if not, write to the Free
17  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 #ifndef __REXXSAA_H_INCLUDED
20 #define __REXXSAA_H_INCLUDED
21 /* Remember to add prototypes for Rexx*() functions */
22 
23 #if defined(WIN32) && (defined(__WATCOMC__) || defined(__BORLANDC__))
24 # include <windows.h>
25 #endif
26 
27 #if defined(__RSXNT__) || defined(__MINGW32__)
28 # include <windows.h>
29 #endif
30 
31 #if defined(_MSC_VER) && !defined(__WINS__)
32 # if _MSC_VER >= 1100
33 /* Stupid MSC can't compile own headers without warning at least in VC 5.0 */
34 #   pragma warning(disable: 4115 4201 4214 4514)
35 # endif
36 # include <windows.h>
37 # if _MSC_VER >= 1100
38 #   pragma warning(default: 4115 4201 4214)
39 # endif
40 # define VOID_TYPEDEFED
41 #endif
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * pack(1) was introduced in Regina 3.3 to become binary compatible in
49  * structures with OS/2, Object Rexx, etc.
50  */
51 #ifdef OREXX_BINARY_COMPATIBLE
52 # pragma pack(1)
53 #endif
54 
55 #ifndef CONST
56 /* Introduced in Regina 2.0, may/should not exist in non-ANSI compilers.
57  * Everybody can see which params will change even if CONST is not defined.
58  * We don't use CONST at all places to be consistent with other
59  * implementations. You can see a "CONST" as a comment before each variable
60  * which is/must not be changed.
61  */
62 # define CONST const
63 #endif
64 
65 #if defined(__MINGW32__)
66 # if defined(__REGINA_DLL)
67 #  define EXTNAME(n) __declspec(dllexport)
68 # else
69 #  define EXTNAME(n) __declspec(dllimport)
70 # endif
71 #else
72 #define EXTNAME(n)
73 #endif
74 
75 #if !defined(OS2_VAC_C) && !defined(_OS2EMX_H) && !defined(__RSXNT__) && !defined(__MINGW32__)
76 
77 # if !defined(VOID_TYPEDEFED) && !defined(VOID)
78 typedef void VOID ;
79 #  define VOID_TYPEDEFED
80 # endif
81 
82 # ifndef PVOID_TYPEDEFED
83 typedef void* PVOID ;
84 #  define PVOID_TYPEDEFED
85 # endif
86 
87 # ifndef CHAR_TYPEDEFED
88 typedef char CHAR;
89 #  define CHAR_TYPEDEFED
90 # endif
91 # ifndef PCHAR_TYPEDEFED
92 typedef CHAR *PCHAR ;
93 #  define PCHAR_TYPEDEFED
94 # endif
95 # ifndef UCHAR_TYPEDEFED
96 typedef unsigned char UCHAR ;
97 #  define UCHAR_TYPEDEFED
98 # endif
99 # ifndef PUCHAR_TYPEDEFED
100 typedef UCHAR *PUCHAR;
101 #  define PUCHAR_TYPEDEFED
102 # endif
103 
104 # ifndef SHORT_TYPEDEFED
105 typedef short SHORT;
106 #  define SHORT_TYPEDEFED
107 # endif
108 # ifndef PSHORT_TYPEDEFED
109 typedef SHORT *PSHORT ;
110 #  define PSHORT_TYPEDEFED
111 # endif
112 # ifndef USHORT_TYPEDEFED
113 typedef unsigned short USHORT ;
114 #  define USHORT_TYPEDEFED
115 # endif
116 # ifndef PUSHORT_TYPEDEFED
117 typedef USHORT *PUSHORT;
118 #  define PUSHORT_TYPEDEFED
119 # endif
120 
121 # ifndef LONG_TYPEDEFED
122 typedef long LONG;
123 #  define LONG_TYPEDEFED
124 # endif
125 # ifndef PLONG_TYPEDEFED
126 typedef LONG *PLONG;
127 #  define PLONG_TYPEDEFED
128 # endif
129 # ifndef ULONG_TYPEDEFED
130 typedef unsigned long ULONG ;
131 #  define ULONG_TYPEDEFED
132 # endif
133 
134 typedef char *PSZ ;
135 typedef CONST char *PCSZ ;
136 typedef CHAR *PCH ;
137 
138 #endif
139 
140 #ifdef __MINGW32__
141 typedef CONST char *PCSZ ;
142 #endif
143 
144 #ifdef INCL_REXXSAA
145 # define INCL_RXSUBCOM
146 # define INCL_RXSHV
147 # define INCL_RXFUNC
148 # define INCL_RXSYSEXIT
149 # define INCL_RXMACRO
150 # define INCL_RXARI
151 # define INCL_RXQUEUE
152 # define INCL_RXMACRO
153 #endif
154 
155 /*
156  * For Innotek gcc, force use of _System calling convention
157  */
158 #if defined( __EMX__ ) && defined( __INNOTEK_LIBC__ )
159 # undef APIENTRY
160 # define APIENTRY _System
161 #endif
162 
163 #if !defined(APIENTRY)
164 # define APIENTRY
165 #endif
166 
167 #if !defined(APIRET)
168 # define APIRET ULONG
169 #endif
170 
171 #if !defined(_OS2EMX_H) && !defined( PFN_TYPEDEFED )
172 typedef APIRET (APIENTRY *PFN)();
173 #endif
174 
175 
176 typedef struct RXSTRING_type
177 {
178    ULONG strlength ;
179    char* strptr ;
180 } RXSTRING ;
181 typedef RXSTRING *PRXSTRING ;
182 
183 #if !defined(_OS2EMX_H)
184 typedef struct REXXDATETIME_type
185 {
186    USHORT hours;               /* hour of the day (24-hour)    */
187    USHORT minutes;             /* minute of the hour           */
188    USHORT seconds;             /* second of the minute         */
189    USHORT hundredths;          /* hundredths of a second       */
190    USHORT day;                 /* day of the month             */
191    USHORT month;               /* month of the year            */
192    USHORT year;                /* current year                 */
193    USHORT weekday;             /* day of the week              */
194    ULONG  microseconds;        /* microseconds                 */
195    ULONG  yearday;             /* day number within the year   */
196    USHORT valid;               /* valid time stamp marker      */
197 } REXXDATETIME;
198 #define DATETIME REXXDATETIME
199 typedef REXXDATETIME *PDATETIME;
200 #endif
201 
202 #define RXAUTOBUFLEN  256L
203 
204 typedef struct {
205    char *sysexit_name ;
206    LONG  sysexit_code ;
207 } RXSYSEXIT ;
208 typedef RXSYSEXIT *PRXSYSEXIT ;
209 
210 typedef PUCHAR PEXIT ;
211 
212 /*
213  * typedefs for Rexx handler types
214  */
215 typedef APIRET APIENTRY RexxFunctionHandler(PCSZ name, ULONG argc, /* CONST */ PRXSTRING argv, PCSZ queuename, PRXSTRING returnstring) ;
216 typedef LONG APIENTRY RexxExitHandler( LONG, LONG, /* CONST */ PEXIT ) ;
217 typedef APIRET APIENTRY RexxSubcomHandler(/* CONST */ PRXSTRING, PUSHORT, PRXSTRING);
218 
219 /*
220  * -------------------------------------------------------------------
221  * System Exit Interface
222  *-------------------------------------------------------------------
223  */
224 #ifdef INCL_RXSYSEXIT
225 
226 /*
227  * The following are definition for the function codes and subcodes for
228  * System Exit Handlers. All RXxxx macros are function codes, while the
229  * RXxxxyyy macros are function subcodes for function code RXxxx.
230  */
231 #define RXFNC        2
232 # define RXFNCCAL    1
233 
234 #define RXCMD        3
235 # define RXCMDHST    1
236 
237 #define RXMSQ        4 /* Net yet implemented */
238 # define RXMSQPLL    1 /* Net yet implemented */
239 # define RXMSQPSH    2 /* Net yet implemented */
240 # define RXMSQSIZ    3 /* Net yet implemented */
241 # define RXMSQNAM   20 /* Net yet implemented */
242 
243 #define RXSIO        5
244 # define RXSIOSAY    1
245 # define RXSIOTRC    2
246 # define RXSIOTRD    3
247 # define RXSIODTR    4
248 # define RXSIOTLL    5 /* Net yet implemented */
249 
250 #define RXHLT        7
251 # define RXHLTCLR    1
252 # define RXHLTTST    2
253 
254 #define RXTRC        8
255 # define RXTRCTST    1
256 
257 #define RXINI        9
258 # define RXINIEXT    1
259 
260 #define RXTER       10
261 # define RXTEREXT    1
262 
263 #define RXDBG       11
264 # define RXDBGTST    1
265 
266 #define RXENV       12  /* System Environment interface */
267 # define RXENVGET    1  /* Get System Environment Variable */
268 # define RXENVSET    2  /* Set System Environment Variable */
269 # define RXCWDGET    3  /* Get Current Working Directory */
270 # define RXCWDSET    4  /* Set Current Working Directory */
271 
272 #define RXENDLST     0
273 #define RXNOOFEXITS 13  /* MUST be 1 more than last exit number */
274 
275 /* Symbolic return codes for System Exit Handlers */
276 #define RXEXIT_HANDLED       0
277 #define RXEXIT_NOT_HANDLED   1
278 #define RXEXIT_RAISE_ERROR (-1)
279 
280 #define RXEXIT_DROPPABLE     0x00
281 #define RXEXIT_NONDROP       0x01
282 
283 /* Return Codes from RXEXIT interface */
284 
285 #define RXEXIT_ISREG         0x01
286 #define RXEXIT_ERROR         0x01
287 #define RXEXIT_FAILURE       0x02
288 #define RXEXIT_BADENTRY      1001
289 #define RXEXIT_NOEMEM        1002
290 #define RXEXIT_BADTYPE       1003
291 #define RXEXIT_NOTINIT       1004
292 #define RXEXIT_OK               0
293 #define RXEXIT_DUP             10
294 #define RXEXIT_MAXREG          20
295 #define RXEXIT_NOTREG          30
296 #define RXEXIT_NOCANDROP       40
297 #define RXEXIT_LOADERR         50
298 #define RXEXIT_NOPROC         127
299 
300 typedef struct {
301    struct {
302                unsigned  rxfferr:1 ;
303                unsigned  rxffnfnd:1 ;
304                unsigned  rxffsub:1 ;
305    }                     rxfnc_flags ;
306    /* CONST */ PUCHAR    rxfnc_name ;
307                USHORT    rxfnc_namel ;
308    /* CONST */ PUCHAR    rxfnc_que ;
309                USHORT    rxfnc_quel ;
310                USHORT    rxfnc_argc ;
311    /* CONST */ PRXSTRING rxfnc_argv ;
312                RXSTRING  rxfnc_retc ;
313 } RXFNCCAL_PARM ;
314 
315 typedef struct {
316    struct {
317                unsigned rxfcfail:1 ;
318                unsigned rxfcerr:1 ;
319    }                    rxcmd_flags ;
320    /* CONST */ PUCHAR   rxcmd_address ;
321                USHORT   rxcmd_addressl ;
322    /* CONST */ PUCHAR   rxcmd_dll ;
323                USHORT   rxcmd_dll_len ;
324    /* CONST */ RXSTRING rxcmd_command ;
325                RXSTRING  rxcmd_retc ;
326 } RXCMDHST_PARM ;
327 
328 typedef struct {
329    RXSTRING rxmsq_retc ;
330 } RXMSQPLL_PARM ;
331 
332 typedef struct {
333    struct {
334                unsigned rxfmlifo:1 ;
335    }                    rxmsq_flags ;
336    /* CONST */ RXSTRING rxmsq_value ;
337 } RXMSQPSH_PARM ;
338 
339 typedef struct {
340    ULONG rxmsq_size ;
341 } RXMSQSIZ_PARM ;
342 
343 typedef struct {
344    RXSTRING rxmsq_name ;
345 } RXMSQNAM_PARM ;
346 
347 typedef struct {
348    /* CONST */ RXSTRING rxsio_string ;
349 } RXSIOSAY_PARM ;
350 
351 typedef struct {
352    /* CONST */ RXSTRING rxsio_string ;
353 } RXSIOTRC_PARM ;
354 
355 typedef struct {
356    RXSTRING rxsiotrd_retc ;
357 } RXSIOTRD_PARM ;
358 
359 typedef struct {
360    RXSTRING rxsiodtr_retc ;
361 } RXSIODTR_PARM ;
362 
363 typedef struct {
364    struct {
365       unsigned rxfhhalt:1 ;
366    }           rxhlt_flags ;
367 } RXHLTTST_PARM ;
368 
369 typedef struct {
370    struct {
371       unsigned rxftrace:1 ;
372    }           rxtrx_flags ;
373 } RXTRCTST_PARM ;
374 
375 typedef struct {
376    RXSTRING rxenv_name ;
377    RXSTRING rxenv_value ;
378 } RXENVGET_PARM ;
379 
380 typedef struct {
381    RXSTRING rxenv_name ;
382    RXSTRING rxenv_value ;
383 } RXENVSET_PARM ;
384 
385 typedef struct {
386    RXSTRING rxcwd_value ;
387 } RXCWDGET_PARM ;
388 
389 typedef struct {
390    RXSTRING rxcwd_value ;
391 } RXCWDSET_PARM ;
392 
393 APIRET APIENTRY RexxRegisterExitExe(
394                 PCSZ             EnvName,
395 #ifdef RX_WEAKTYPING
396                 PFN              EntryPoint,
397 #else
398                 RexxExitHandler *EntryPoint,
399 #endif
400     /* CONST */ PUCHAR           UserArea )
401 EXTNAME("RexxRegisterExitExe");
402 #define REXXREGISTEREXITEXE RexxRegisterExitExe
403 
404 APIRET APIENTRY RexxRegisterExitDll(
405                 PCSZ   EnvName,
406                 PCSZ   ModuleName,
407                 PCSZ   ProcedureName,
408     /* CONST */ PUCHAR UserArea,
409                 ULONG  DropAuth )
410 EXTNAME("RexxRegisterExitDll");
411 #define REXXREGISTEREXITDLL RexxRegisterExitDll
412 
413 APIRET APIENTRY RexxDeregisterExit(
414                 PCSZ EnvName,
415                 PCSZ ModuleName )
416 EXTNAME("RexxDeregisterExit");
417 #define REXXDEREGISTEREXIT RexxDeregisterExit
418 
419 APIRET APIENTRY RexxQueryExit (
420                 PCSZ    ExitName,
421                 PCSZ    ModuleName,
422                 PUSHORT Flag,
423                 PUCHAR  UserArea)
424 EXTNAME("RexxQueryExit");
425 #define REXXQUERYEXIT RexxQueryExit
426 
427 #endif /* INCL_RXSYSEXIT */
428 
429 
430 #define MAXENVNAMELEN 32767   /* at least, there is no limit */
431 
432 #define MAKERXSTRING(x,c,l)   ((x).strptr=(c),(x).strlength=(l))
433 #define RXNULLSTRING(x)       (!(x).strptr)
434 #define RXSTRLEN(x)           ((x).strptr ? (x).strlength : 0UL)
435 #define RXSTRPTR(x)           ((x).strptr)
436 #define RXVALIDSTRING(x)      ((x).strptr && (x).strlength)
437 #define RXZEROLENSTRING(x)    ((x).strptr && !(x).strlength)
438 
439 #define RXCOMMAND         0
440 #define RXSUBROUTINE      1
441 #define RXFUNCTION        2
442 /*
443  * RXRESTRICTED is OR'ed with one of the above values to run Regina
444  * in "restricted" mode
445  */
446 #define RXRESTRICTED    256
447 
448 
449 #ifdef INCL_RXSHV
450 
451 /*
452  * Definitions and declarations for the Rexx variable pool interface.
453  */
454 
455 # define RXSHV_OK       0x00    /* Everything OK */
456 # define RXSHV_NEWV     0x01    /* Var not previously set */
457 # define RXSHV_LVAR     0x02    /* Last var in a NEXTV sequence */
458 # define RXSHV_TRUNC    0x04    /* Name or value has been truncated */
459 # define RXSHV_BADN     0x08    /* Bad/invalid name */
460 # define RXSHV_MEMFL    0x10    /* Memory problem, e.g. out of memory */
461 # define RXSHV_BADF     0x80    /* Invalid function code */
462 
463 # define RXSHV_NOAVL    0x90    /* Interface is not available */
464 
465 /*
466  * Note: Some documentation claims that RXSHV_BADF should have the
467  *       value 0x80, but that can't be correct, can it?
468  */
469 
470 # define RXSHV_SET      0x00    /* Set variable */
471 # define RXSHV_FETCH    0x01    /* Get value of variable */
472 # define RXSHV_DROPV    0x02    /* Drop variable */
473 # define RXSHV_SYSET    0x03    /* Set symbolic variable */
474 # define RXSHV_SYFET    0x04    /* Get value of symbolic variable */
475 # define RXSHV_SYDRO    0x05    /* Drop symbolic variable */
476 # define RXSHV_NEXTV    0x06    /* Get next var in a NEXTV sequence */
477 # define RXSHV_PRIV     0x07    /* Get private information */
478 # define RXSHV_EXIT     0x08    /* Set function exit value */
479 
480 /*
481  * Note: A symbolic variable is a symbol that will be 'expanded' before
482  *       use, while a (normal) variable is used directly, without
483  *       expanding it first.
484  */
485 
486 typedef struct shvnode
487 {
488    struct shvnode *shvnext ;
489    RXSTRING        shvname ;
490    RXSTRING        shvvalue ;
491    ULONG           shvnamelen ;
492    ULONG           shvvaluelen ;
493    UCHAR           shvcode ;
494    UCHAR           shvret ;
495 } SHVBLOCK ;
496 
497 typedef SHVBLOCK *PSHVBLOCK ;
498 
499 APIRET APIENTRY RexxVariablePool(
500                 PSHVBLOCK  RequestBlockList )
501 EXTNAME("RexxVariablePool");
502 #define REXXVARIABLEPOOL RexxVariablePool
503 
504 #endif /* INCL_RXSHV */
505 
506 
507 APIRET APIENTRY RexxFreeMemory(
508                 PVOID      MemoryBlock )
509 EXTNAME("RexxFreeMemory");
510 #define REXXFREEMEMORY RexxFreeMemory
511 
512 PVOID APIENTRY  RexxAllocateMemory(
513                 ULONG      size )
514 EXTNAME("RexxAllocateMemory");
515 #define REXXALLOCATEMEMORY RexxAllocateMemory
516 
517 
518 APIRET APIENTRY RexxStart(
519                 LONG       ArgCount,
520     /* CONST */ PRXSTRING  ArgList,
521                 PCSZ       ProgramName,
522     /* CONST */ PRXSTRING  Instore,
523                 PCSZ       EnvName,
524                 LONG       CallType,
525     /* CONST */ PRXSYSEXIT Exits,
526                 PSHORT     ReturnCode,
527                 PRXSTRING  Result )
528 EXTNAME("RexxStart");
529 #define REXXSTART RexxStart
530 
531 /*
532  * Return codes .... haha there doesn't seem to be a standard, except
533  * zero is OK, negative is an Rexx error, the positive error codes below
534  * are my own 'invention'
535  */
536 #define RX_START_OK         0
537 #define RX_START_BADP       1  /* Bad parameters */
538 #define RX_START_UNIMPL     2  /* Not yet implemented :-) */
539 #define RX_START_TOOMANYP   3  /* Too many parameters */
540 #define RX_DIDNT_START      4  /* Unable to start interpreter */
541 
542 APIRET APIENTRY RexxCallBack(
543                 PCSZ       ProcedureName,
544                 LONG       ArgCount,
545                 PRXSTRING  ArgList,
546                 PSHORT     ReturnCode,
547                 PRXSTRING  Result )
548 EXTNAME("RexxCallBack");
549 #define REXXCALLBACK RexxCallBack
550 
551 /*
552  * Return codes for RexxCallBack
553  */
554 #define RX_CB_OK         0
555 #define RX_CB_BADP       1  /* Bad parameters */
556 #define RX_CB_NOTSTARTED 2  /* Interface not running */
557 #define RX_CB_TOOMANYP   3  /* Too many parameters */
558 #define RX_CB_BADN       8  /* Procedure not found */
559 /*
560  * -------------------------------------------------------------------
561  * Sub-command Interface
562  *-------------------------------------------------------------------
563  */
564 #ifdef INCL_RXSUBCOM
565 
566 APIRET APIENTRY RexxRegisterSubcomExe(
567                 PCSZ               EnvName,
568 #ifdef RX_WEAKTYPING
569                 PFN                EntryPoint,
570 #else
571                 RexxSubcomHandler *EntryPoint,
572 #endif
573     /* CONST */ PUCHAR             UserArea )
574 EXTNAME("RexxRegisterSubcomExe");
575 #define REXXREGISTERSUBCOMEXE RexxRegisterSubcomExe
576 
577 APIRET APIENTRY RexxDeregisterSubcom(
578                 PCSZ EnvName,
579                 PCSZ ModuleName )
580 EXTNAME("RexxDeregisterSubcom");
581 #define REXXDEREGISTERSUBCOM RexxDeregisterSubcom
582 
583 APIRET APIENTRY RexxRegisterSubcomDll(
584                 PCSZ   EnvName,
585                 PCSZ   ModuleName,
586                 PCSZ   ProcedureName,
587     /* CONST */ PUCHAR UserArea,
588                 ULONG  DropAuth )
589 EXTNAME("RexxRegisterSubcomDll");
590 #define REXXREGISTERSUBCOMDLL RexxRegisterSubcomDll
591 
592 APIRET APIENTRY RexxQuerySubcom(
593                 PCSZ    Envname,
594                 PCSZ    ModuleName,
595                 PUSHORT Flag,       /* Documentation diverges ... */
596                 PUCHAR  UserArea )
597 EXTNAME("RexxQuerySubcom");
598 #define REXXQUERYSUBCOM RexxQuerySubcom
599 
600 #define RXSUBCOM_OK          0
601 #define RXSUBCOM_DUP        10
602 #define RXSUBCOM_MAXREG     20
603 #define RXSUBCOM_NOTREG     30
604 #define RXSUBCOM_NOCANDROP  40
605 #define RXSUBCOM_LOADERR    50
606 #define RXSUBCOM_NOPROC    127
607 
608 #define RXSUBCOM_BADENTRY 1001
609 #define RXSUBCOM_NOEMEM   1002
610 #define RXSUBCOM_BADTYPE  1003
611 #define RXSUBCOM_NOTINIT  1004
612 
613 /* I don't know the 'real' values of these */
614 #define RXSUBCOM_ERROR      0x01
615 #define RXSUBCOM_ISREG      0x01
616 #define RXSUBCOM_FAILURE    0x02
617 
618 #define RXSUBCOM_DROPPABLE  0x00
619 #define RXSUBCOM_NONDROP    0x01
620 
621 #endif /* INCL_RXSUBCOM */
622 
623 
624 /*
625  * -------------------------------------------------------------------
626  * External Function Interface
627  *-------------------------------------------------------------------
628  */
629 #ifdef INCL_RXFUNC
630 
631 #define RXFUNC_OK             0
632 #define RXFUNC_DEFINED       10
633 #define RXFUNC_NOMEM         20
634 #define RXFUNC_NOTREG        30
635 #define RXFUNC_MODNOTFND     40
636 #define RXFUNC_ENTNOTFND     50
637 #define RXFUNC_NOTINIT       60
638 #define RXFUNC_BADTYPE       70
639 #define RXFUNC_NOEMEM      1002
640 
641 APIRET APIENTRY RexxRegisterFunctionExe(
642                 PCSZ                 name,
643 #ifdef RX_WEAKTYPING
644                 PFN                  EntryPoint )
645 #else
646                 RexxFunctionHandler *EntryPoint )
647 #endif
648 EXTNAME("RexxRegisterFunctionExe");
649 #define REXXREGISTERFUNCTIONEXE RexxRegisterFunctionExe
650 
651 APIRET APIENTRY RexxRegisterFunctionDll(
652                 PCSZ ExternalName,
653                 PCSZ LibraryName,
654                 PCSZ InternalName )
655 EXTNAME("RexxRegisterFunctionDll");
656 #define REXXREGISTERFUNCTIONDLL RexxRegisterFunctionDll
657 
658 APIRET APIENTRY RexxDeregisterFunction(
659                 PCSZ name )
660 EXTNAME("RexxDeregisterFunction");
661 #define REXXDEREGISTERFUNCTION RexxDeregisterFunction
662 
663 APIRET APIENTRY RexxQueryFunction(
664                 PCSZ name )
665 EXTNAME("RexxQueryFunction");
666 #define REXXQUERYFUNCTION RexxQueryFunction
667 
668 #endif /* INCL_RXFUNC */
669 
670 /*
671  * -------------------------------------------------------------------
672  * Asynchronous Request Interface
673  *-------------------------------------------------------------------
674  */
675 #ifdef INCL_RXARI
676 
677 /***    Return Codes from Asynchronous Request interface */
678 
679 #define RXARI_OK                   0
680 #define RXARI_NOT_FOUND            1
681 #define RXARI_PROCESSING_ERROR     2
682 
683 APIRET APIENTRY RexxSetHalt(
684                 LONG pid,
685                 LONG tid)
686 EXTNAME("RexxSetHalt");
687 #define REXXSETHALT RexxSetHalt
688 
689 APIRET APIENTRY RexxSetTrace(
690                 LONG pid,
691                 LONG tid)
692 EXTNAME("RexxSetTrace");
693 #define REXXSETTRACE RexxSetTrace
694 
695 APIRET APIENTRY RexxResetTrace(
696                 LONG pid,
697                 LONG tid)
698 EXTNAME("RexxResetTrace");
699 #define REXXRESETTRACE RexxResetTrace
700 
701 #endif /* INCL_RXARI */
702 
703 /*
704  * -------------------------------------------------------------------
705  * External Queue Interface
706  *-------------------------------------------------------------------
707  */
708 #ifdef INCL_RXQUEUE
709 
710 ULONG  APIENTRY RexxCreateQueue (
711                 PSZ,
712                 ULONG,
713                 PSZ,
714                 ULONG* )
715 EXTNAME("RexxCreateQueue");
716 #define REXXCREATEQUEUE RexxCreateQueue
717 
718 ULONG  APIENTRY RexxDeleteQueue (
719                 PSZ )
720 EXTNAME("RexxDeleteQueue");
721 #define REXXDELETEQUEUE RexxDeleteQueue
722 
723 ULONG  APIENTRY RexxQueryQueue (
724                 PSZ,
725                 ULONG* )
726 EXTNAME("RexxQueryQueue");
727 #define REXXQUERYQUEUE RexxQueryQueue
728 
729 ULONG  APIENTRY RexxAddQueue (
730                 PSZ,
731                 PRXSTRING,
732                 ULONG )
733 EXTNAME("RexxAddQueue");
734 #define REXXADDQUEUE RexxAddQueue
735 
736 ULONG  APIENTRY RexxPullQueue (
737                 PSZ,
738                 PRXSTRING,
739                 PDATETIME,
740                 ULONG )
741 EXTNAME("RexxPullQueue");
742 #define REXXPULLQUEUE RexxPullQueue
743 
744 /* Request flags for External Data Queue access --------------------- */
745 #define RXQUEUE_FIFO          0    /* Access queue first-in-first-out */
746 #define RXQUEUE_LIFO          1    /* Access queue last-in-first-out  */
747 
748 #define RXQUEUE_NOWAIT        0    /* Wait for data if queue empty    */
749 #define RXQUEUE_WAIT          1    /* Don't wait on an empty queue    */
750 
751 /* Return Codes from RxQueue interface ------------------------------ */
752 #define RXQUEUE_OK            0        /* Successful return           */
753 #define RXQUEUE_NOTINIT       1000     /* Queues not initialized      */
754 
755 #define RXQUEUE_STORAGE       1        /* Ret info buf not big enough */
756 #define RXQUEUE_SIZE          2        /* Data size > 64K-64          */
757 #define RXQUEUE_DUP           3        /* Attempt-duplicate queue name*/
758 #define RXQUEUE_NOEMEM        4        /* Not enough available memory */
759 #define RXQUEUE_BADQNAME      5        /* Not a valid queue name      */
760 #define RXQUEUE_PRIORITY      6        /* Not accessed as LIFO|FIFO   */
761 #define RXQUEUE_BADWAITFLAG   7        /* Not accessed as WAIT|NOWAIT */
762 #define RXQUEUE_EMPTY         8        /* No data in queue            */
763 #define RXQUEUE_NOTREG        9        /* Queue does not exist        */
764 #define RXQUEUE_ACCESS       10        /* Queue busy and wait active  */
765 #define RXQUEUE_MAXREG       11        /* No memory to create a queue */
766 #define RXQUEUE_MEMFAIL      12        /* Failure in memory management*/
767 #define RXQUEUE_NETERROR    100        /* Network error               */
768 
769 #endif /* INCL_RXQUEUE */
770 
771 /*
772  * -------------------------------------------------------------------
773  * Macrospace Interface
774  *-------------------------------------------------------------------
775  */
776 #ifdef INCL_RXMACRO
777 
778 APIRET APIENTRY RexxAddMacro (
779                 PSZ,                         /* Function to add or change    */
780                 PSZ,                         /* Name of file to get function */
781                 ULONG  )                     /* Flag indicating search pos   */
782 EXTNAME("RexxAddMacro");
783 #define REXXADDMACRO  RexxAddMacro
784 
785 APIRET APIENTRY RexxDropMacro (
786                 PSZ )                         /* Name of function to remove  */
787 EXTNAME("RexxDropMacro");
788 #define REXXDROPMACRO  RexxDropMacro
789 
790 APIRET APIENTRY RexxSaveMacroSpace (
791                 ULONG ,                      /* Argument count (0==save all) */
792                 PSZ *,                       /* List of funct names to save  */
793                 PSZ)                         /* File to save functions in    */
794 EXTNAME("RexxSaveMacroSpace");
795 #define REXXSAVEMACROSPACE  RexxSaveMacroSpace
796 
797 APIRET APIENTRY RexxLoadMacroSpace (
798                 ULONG ,                      /* Argument count (0==load all) */
799                 PSZ *,                       /* List of funct names to load  */
800                 PSZ)                        /* File to load functions from  */
801 EXTNAME("RexxLoadMacroSpace");
802 #define REXXLOADMACROSPACE  RexxLoadMacroSpace
803 
804 APIRET APIENTRY RexxQueryMacro (
805                 PSZ,                         /* Function to search for       */
806                 PUSHORT )                   /* Ptr for position flag return */
807 EXTNAME("RexxQueryMacro");
808 #define REXXQUERYMACRO  RexxQueryMacro
809 
810 APIRET APIENTRY RexxReorderMacro(
811                 PSZ,                         /* Name of funct change order   */
812                 ULONG  )                    /* New position for function    */
813 EXTNAME("RexxReorderMacro");
814 #define REXXREORDERMACRO  RexxReorderMacro
815 
816 APIRET APIENTRY RexxClearMacroSpace(
817                 )
818 EXTNAME("RexxClearMacroSpace");
819 #define REXXCLEARMACROSPACE  RexxClearMacroSpace
820 
821 /* Registration Search Order Flags ---------------------------------- */
822 #define RXMACRO_SEARCH_BEFORE       1  /* Beginning of search order   */
823 #define RXMACRO_SEARCH_AFTER        2  /* End of search order         */
824 
825 /* Return Codes from RxMacroSpace interface ------------------------- */
826 #define RXMACRO_OK                 0  /* Macro interface completed    */
827 #define RXMACRO_NO_STORAGE         1  /* Not Enough Storage Available */
828 #define RXMACRO_NOT_FOUND          2  /* Requested function not found */
829 #define RXMACRO_EXTENSION_REQUIRED 3  /* File ext required for save   */
830 #define RXMACRO_ALREADY_EXISTS     4  /* Macro functions exist        */
831 #define RXMACRO_FILE_ERROR         5  /* File I/O error in save/load  */
832 #define RXMACRO_SIGNATURE_ERROR    6  /* Incorrect format for load    */
833 #define RXMACRO_SOURCE_NOT_FOUND   7  /* Requested cannot be found    */
834 #define RXMACRO_INVALID_POSITION   8  /* Invalid search order pos     */
835 #define RXMACRO_NOT_INIT           9  /* API not initialized          */
836 
837 #endif /* INCL_RXMACRO */
838 
839 
840 /* REGINA EXTENSIONS *********************************************************/
841 /* The following functions are an extension to the standard. Never try to
842  * address the function directly if you want to be compatible. Use the dynamic
843  * linking machanism of your operating system instead.
844  *
845  *
846  * ReginaVersion returns informations about the version of the library.
847  * This function was introduced in version 2.0.
848  * Returns: ULONG, in lower byte the two-digit fraction part of the version.
849  *          The higher bytes will hold the integer part of the version.
850  *          Examples: 0x10A codes the Version "1.10".
851  * VersionString will be filled if VersionString is non-NULL.
852  * If VersionString is non-NULL then there are two possibilities:
853  * a) VersionString->strlength == 0: VersionString is filled with the
854  *                                   appropriate values. VersionString->strptr
855  *                                   is always created.
856  * b) VersionString->strlength != 0: VersionString->strptr is filled up to
857  *                                   this value. VersionString->strlength will
858  *                                   hold the copied bytes.
859  * Note: A terminating ASCII-zero is appended if there is enough space
860  *       although it is never counted in VersionString.strlength.
861  *       RexxAllocateMemory is used if needed.
862  */
863 APIRET APIENTRY ReginaVersion(
864                 PRXSTRING VersionString )
865 EXTNAME("ReginaVersion");
866 #define REGINAVERSION ReginaVersion
867 
868 /*
869  * ReginaCleanup performs a graceful cleanup. This is done automatically
870  * on many systems but you can't be sure in all cases. The cleanup operations
871  * destroys all informations that are collected so far by one thread.
872  * It works for a single process or thread too. Although all memory is
873  * freed, some open handles may remain open. It is necessary to perform
874  * the appropriate "RexxDeregister<whatever>" calls before this routine
875  * is called.
876  * This function was introduced in version 3.3.
877  * Returns: ULONG, 0 if this call hasn't done anything.
878  *          1 if at least something could be freed.
879  * It is allowed to reuse every API function after this call but this routine
880  * must not be used when some parts of the Regina core are in use.
881  */
882 APIRET APIENTRY ReginaCleanup( )
883 EXTNAME("ReginaCleanup");
884 #define REGINACLEANUP ReginaCleanup
885 
886 #ifdef OREXX_BINARY_COMPATIBLE
887 # pragma pack()
888 #endif
889 
890 #ifdef __cplusplus
891 }
892 #endif
893 
894 #endif /* __REXXSAA_H_INCLUDED */
895