2 * The Regina Rexx Interpreter
3 * Copyright (C) 2000 Mark Hessling <M.Hessling@qut.edu.au>
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.
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.
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.
19 #ifndef _REXXBIF_H_INCLUDED
20 #define _REXXBIF_H_INCLUDED
22 #if defined(HAVE_CONFIG_H)
25 # include "configur.h"
30 #if defined(VMS) || defined(MAC)
33 # include <sys/types.h>
36 #if defined(TIME_WITH_SYS_TIME)
37 # include <sys/time.h>
40 # if defined(HAVE_SYS_TIME_H)
41 # include <sys/time.h>
47 #if defined(WIN32) && defined(__BORLANDC__)
60 #ifdef EXTERNAL_TO_REGINA
61 typedef struct tsdtype
{ /* FGC: This will lead to severe troubles. Imagine
62 * some called routines which are compiled with the
63 * other typedef and linked with a routine using this
64 * kind. Strange things MUST happen. To avoid the
65 * ugliest errors ALWAYS add a scratch space of
66 * at least 4KB. This is a heuristic value.
67 * This is one of the most errorneous programming
68 * techniques to import features and functions from
70 * MH. This is included just in case there is an
71 * overlap problem when rexxbif.h is included in the
72 * base Regina code. When used in programs independent
73 * from Regina, the filler is not required.
75 char filler_never_touch
[0x1000];
79 # define tsd_t dummy_tsd_t
80 # define MAKESTRENG( size ) MakeStreng( size )
81 # define DROPSTRENG( x ) DropStreng( x )
82 # define REXX_RIGHT( s,l,p ) Rexx_right( NULL,s,l,p )
83 # define REXX_X2D( x,err ) Rexx_x2d( NULL,x,err )
84 # define REXX_D2X( x ) Rexx_d2x( NULL,x )
85 # ifndef STRENG_TYPEDEFED
87 * typedef a streng type
89 typedef struct strengtype
{
100 * We are including this from within the Regina Interpreter
103 # define MAKESTRENG( size ) Str_makeTSD( size )
104 # define DROPSTRENG( x ) FreeTSD( x )
105 # define REXX_RIGHT( s,l,p ) Rexx_right( TSD,s,l,p )
106 # define REXX_X2D( x,err ) Rexx_x2d( TSD,x,err )
107 # define REXX_D2X( x ) Rexx_d2x( TSD,x )
110 extern streng
*Rexx_right( const tsd_t
*TSD
, streng
*str
, int length
, char padch
);
111 extern int Rexx_x2d( const tsd_t
*TSD
, const streng
*hex
, int *error
);
112 extern streng
*Rexx_d2x( const tsd_t
*TSD
, int num
);
114 #ifdef EXTERNAL_TO_REGINA
115 extern void DropStreng( streng
*str
);
116 extern streng
*MakeStreng( int num
);
119 #define PSTRENGLEN(x) ((x)->value ? (x)->len : 0)
120 #define PSTRENGVAL(x) ((x)->value)
124 * Define the RXSTRING type, but only if we haven't already included
125 * a SAA header file, which #defines RXSTRLEN()
128 # define MAKERXSTRING(x,c,l) ((x).strptr=(c),(x).strlength=(l))
129 # define RXNULLSTRING(x) (!(x).strptr)
130 # define RXSTRLEN(x) ((x).strptr ? (x).strlength : 0UL)
131 # define RXSTRPTR(x) ((x).strptr)
133 #endif /* RXSTRLEN */