| 1 |
/* |
| 2 |
* The Regina Rexx Interpreter |
| 3 |
* Copyright (C) 1992-1994 Anders Christensen <[email protected]> |
| 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 |
|
| 20 |
/* JH 20-10-99 */ /* To make Direct setting of stems Direct and not Symbolic. */ |
| 21 |
|
| 22 |
|
| 23 |
/* |
| 24 |
* Routines in lexsrc.l |
| 25 |
*/ |
| 26 |
#ifndef FLEX_SCANNER |
| 27 |
extern YY_CHAR_TYPE *yysptr, yysbuf[] ; |
| 28 |
#endif |
| 29 |
void fetch_file(tsd_t *TSD, |
| 30 |
FILE *fptr, |
| 31 |
internal_parser_type *ipt); |
| 32 |
void fetch_string(tsd_t *TSD, |
| 33 |
const streng *str, |
| 34 |
internal_parser_type *ipt); |
| 35 |
|
| 36 |
/* |
| 37 |
* Routines in parsing.c |
| 38 |
*/ |
| 39 |
int bmstrstr( const streng *heystack, int start, const streng *needle, int caseless ) ; |
| 40 |
void doparse( tsd_t *TSD, const streng *source, cnodeptr subtree, int caseless ) ; |
| 41 |
void parseargtree(tsd_t *TSD, cparamboxptr argbox, cnodeptr thisptr, int flags ); |
| 42 |
|
| 43 |
|
| 44 |
/* |
| 45 |
* Routines in debug.c |
| 46 |
*/ |
| 47 |
void dumpvars( const tsd_t *TSD ); |
| 48 |
void dumptree( const tsd_t *TSD, const treenode *thisptr, int level, int newline ) ; |
| 49 |
streng *getsourceline( const tsd_t *TSD, int line, int charnr, const internal_parser_type *ipt ) ; |
| 50 |
#ifdef TRACEMEM |
| 51 |
void marksource( clineboxptr ) ; |
| 52 |
#endif |
| 53 |
|
| 54 |
|
| 55 |
/* |
| 56 |
* Routines in files.c |
| 57 |
*/ |
| 58 |
streng *readkbdline( tsd_t *TSD ) ; |
| 59 |
void mark_filetable( const tsd_t *TSD) ; |
| 60 |
int filename_cmp( const streng *name1, const streng *name2 ); |
| 61 |
void purge_filetable( tsd_t *TSD ) ; |
| 62 |
int init_filetable( tsd_t *TSD ) ; |
| 63 |
void fixup_file( tsd_t *TSD, const streng * ) ; |
| 64 |
streng *get_external_routine( const tsd_t *TSD, const char *inname, |
| 65 |
FILE **fp ); |
| 66 |
void find_shared_library(const tsd_t *TSD,const char *, const char *, char *); |
| 67 |
void CloseOpenFiles ( const tsd_t *TSD, FilePtrDisposition fpd ) ; |
| 68 |
streng *ConfigStreamQualified( tsd_t *TSD, const streng *name ); |
| 69 |
streng *std_charin( tsd_t *TSD, cparamboxptr parms ) ; |
| 70 |
streng *std_charout( tsd_t *TSD, cparamboxptr parms ) ; |
| 71 |
streng *std_chars( tsd_t *TSD, cparamboxptr parms ) ; |
| 72 |
streng *std_linein( tsd_t *TSD, cparamboxptr parms ) ; |
| 73 |
streng *std_lineout( tsd_t *TSD, cparamboxptr parms ) ; |
| 74 |
streng *std_lines( tsd_t *TSD, cparamboxptr parms ) ; |
| 75 |
streng *std_stream( tsd_t *TSD, cparamboxptr parms ) ; |
| 76 |
void closefile( tsd_t *TSD, const streng *name ) ; |
| 77 |
void *addr_reopen_file( tsd_t *TSD, const streng *filename, char code, int iserror ); |
| 78 |
streng *addr_io_file( tsd_t *TSD, void *fileptr, const streng *line ) ; |
| 79 |
void addr_reset_file( tsd_t *TSD, void *fileptr ); |
| 80 |
streng *addr_file_info( tsd_t *TSD, const streng *source, int defchannel ); |
| 81 |
#ifndef NDEBUG |
| 82 |
streng *dbg_dumpfiles( tsd_t *TSD, cparamboxptr parms ) ; |
| 83 |
#endif |
| 84 |
streng *unx_open( tsd_t *TSD, cparamboxptr parms ) ; |
| 85 |
streng *unx_close( tsd_t *TSD, cparamboxptr parms ) ; |
| 86 |
#if !defined(HAVE__SPLITPATH2) && !defined(HAVE__SPLITPATH) && !defined(__EMX__) && !defined(DJGPP) |
| 87 |
int my_splitpath2( const char *in, char *out, char **drive, char **dir, char **name, char **ext ) ; |
| 88 |
#endif |
| 89 |
int my_fullpath( tsd_t *TSD, char *dst, const char *src ); |
| 90 |
int my_fullpathstreng( const tsd_t *TSD, char *dst, const streng *src ); |
| 91 |
streng *arexx_exists( tsd_t *TSD, cparamboxptr parms ) ; |
| 92 |
|
| 93 |
/* |
| 94 |
* Routines in expr.c |
| 95 |
*/ |
| 96 |
int isboolean( tsd_t *TSD, nodeptr, int suberror, const char *op ) ; |
| 97 |
num_descr *calcul( tsd_t *TSD, nodeptr, num_descr**, int leftorright, int oper ) ; |
| 98 |
int init_expr( tsd_t *TSD ) ; |
| 99 |
streng *evaluate( tsd_t *TSD, nodeptr thisptr, streng **kill ) ; |
| 100 |
|
| 101 |
/* |
| 102 |
* Routines in cmsfuncs.c |
| 103 |
*/ |
| 104 |
streng *cms_sleep( tsd_t *TSD, cparamboxptr parms ) ; |
| 105 |
streng *cms_makebuf( tsd_t *TSD, cparamboxptr parms ) ; |
| 106 |
streng *cms_justify( tsd_t *TSD, cparamboxptr parms ) ; |
| 107 |
streng *cms_find( tsd_t *TSD, cparamboxptr parms ) ; |
| 108 |
streng *cms_index( tsd_t *TSD, cparamboxptr parms ) ; |
| 109 |
streng *cms_desbuf( tsd_t *TSD, cparamboxptr parms ) ; |
| 110 |
streng *cms_buftype( tsd_t *TSD, cparamboxptr parms ) ; |
| 111 |
streng *cms_dropbuf( tsd_t *TSD, cparamboxptr parms ) ; |
| 112 |
streng *cms_state( tsd_t *TSD, cparamboxptr parms ) ; |
| 113 |
|
| 114 |
/* |
| 115 |
* Routines in memory.c |
| 116 |
*/ |
| 117 |
int init_memory( tsd_t *TSD ) ; |
| 118 |
#ifdef FLISTS |
| 119 |
void *get_a_chunk( int bytes ) ; |
| 120 |
void *get_a_chunkTSD( const tsd_t *TSD, int bytes ) ; |
| 121 |
streng *get_a_streng( int bytes ) ; |
| 122 |
streng *get_a_strengTSD( const tsd_t *TSD, int bytes ) ; |
| 123 |
void give_a_chunk( void *ptr ) ; |
| 124 |
void give_a_chunkTSD( const tsd_t *TSD, void *ptr ) ; |
| 125 |
void give_a_streng( streng *ptr ) ; |
| 126 |
void give_a_strengTSD( const tsd_t *TSD, streng *ptr ) ; |
| 127 |
int show_free_lists(const tsd_t *TSD); |
| 128 |
void purge_flists(const tsd_t *TSD); |
| 129 |
#endif |
| 130 |
#ifdef TRACEMEM |
| 131 |
void *mymalloc( int bytes ) ; |
| 132 |
void *mymallocTSD( const tsd_t *TSD, int bytes ) ; |
| 133 |
void myfree( void *ptr ) ; |
| 134 |
void myfreeTSD( const tsd_t *TSD, void *ptr ) ; |
| 135 |
void regmarker( const tsd_t *TSD, void (*func)(const tsd_t *TSD) ) ; |
| 136 |
int have_allocated( tsd_t *TSD, int flag ) ; |
| 137 |
void markmemory( void *ptr, int i ) ; |
| 138 |
int listleaked( const tsd_t *TSD, int pflag ) ; |
| 139 |
void memory_stats( const tsd_t *TSD ) ; |
| 140 |
void mark_listleaked_params( const tsd_t *TSD ) ; |
| 141 |
#endif /* TRACEMEM */ |
| 142 |
|
| 143 |
#ifdef TRACEMEM |
| 144 |
# define Malloc(bytes) mymalloc(bytes) |
| 145 |
# define Malloc_TSD(TSD,bytes) mymallocTSD(TSD,bytes) |
| 146 |
# define MallocTSD(bytes) mymallocTSD(TSD,bytes) |
| 147 |
# define Free(ptr) myfree(ptr) |
| 148 |
# define Free_TSD(TSD,ptr) myfreeTSD(TSD,ptr) |
| 149 |
# define FreeTSD(ptr) myfreeTSD(TSD,ptr) |
| 150 |
# define Free_string(ptr) myfree(ptr) |
| 151 |
# define Free_string_TSD(TSD,ptr) myfreeTSD(TSD,ptr) |
| 152 |
# define Free_stringTSD(ptr) myfreeTSD(TSD,ptr) |
| 153 |
#elif defined(FLISTS) |
| 154 |
# define Malloc(bytes) get_a_chunk(bytes) |
| 155 |
# define Malloc_TSD(TSD,bytes) get_a_chunkTSD(TSD,bytes) |
| 156 |
# define MallocTSD(bytes) get_a_chunkTSD(TSD,bytes) |
| 157 |
# define Free(ptr) give_a_chunk(ptr) |
| 158 |
# define Free_TSD(TSD,ptr) give_a_chunkTSD(TSD,ptr) |
| 159 |
# define FreeTSD(ptr) give_a_chunkTSD(TSD,ptr) |
| 160 |
# define Free_string(ptr) give_a_streng(ptr) |
| 161 |
# define Free_string_TSD(TSD,ptr) give_a_strengTSD(TSD,ptr) |
| 162 |
# define Free_stringTSD(ptr) give_a_strengTSD(TSD,ptr) |
| 163 |
#else /* neither TRACEMEM nor FLISTS */ |
| 164 |
# define Malloc(bytes) Malloc_TSD(__regina_get_tsd(),bytes) |
| 165 |
# define Malloc_TSD(TSD,bytes) (TSD)->MTMalloc(TSD,bytes) |
| 166 |
# define MallocTSD(bytes) Malloc_TSD(TSD,bytes) |
| 167 |
# define Free(ptr) Free_TSD(__regina_get_tsd(),ptr) |
| 168 |
# define Free_TSD(TSD,ptr) (TSD)->MTFree(TSD,ptr) |
| 169 |
# define FreeTSD(ptr) Free_TSD(TSD,ptr) |
| 170 |
# ifdef CHECK_MEMORY |
| 171 |
void give_a_streng( streng *ptr ) ; |
| 172 |
void give_a_strengTSD( const tsd_t *TSD, streng *ptr ) ; |
| 173 |
# define Free_string(ptr) give_a_streng(ptr) |
| 174 |
# define Free_string_TSD(TSD,ptr) give_a_strengTSD(TSD,ptr) |
| 175 |
# define Free_stringTSD(ptr) give_a_strengTSD(TSD,ptr) |
| 176 |
# else |
| 177 |
# define Free_string(ptr) Free_string_TSD(__regina_get_tsd(),ptr) |
| 178 |
# define Free_string_TSD(TSD,ptr) (TSD)->MTFree(TSD,ptr) |
| 179 |
# define Free_stringTSD(ptr) Free_string_TSD(TSD,ptr) |
| 180 |
# endif /* CHECK_MEMORY */ |
| 181 |
#endif /* ifdef TRACEMEM */ |
| 182 |
|
| 183 |
|
| 184 |
/* |
| 185 |
* Routines in stack.c |
| 186 |
*/ |
| 187 |
int init_stacks( tsd_t *TSD ) ; |
| 188 |
int external_queues_used( const tsd_t *TSD ) ; |
| 189 |
void purge_stacks( const tsd_t *TSD ) ; |
| 190 |
streng *popline( tsd_t *TSD, const streng *queue_name, int *result, unsigned long waitflag ) ; |
| 191 |
int stack_lifo( tsd_t *TSD, streng *line, const streng *queue_name ) ; |
| 192 |
int stack_fifo( tsd_t *TSD, streng *line, const streng *queue_name ) ; |
| 193 |
int lines_in_stack( tsd_t *TSD, const streng *queue_name ) ; |
| 194 |
#ifdef TRACEMEM |
| 195 |
void mark_stack( const tsd_t *TSD ) ; |
| 196 |
#endif /* TRACEMEM */ |
| 197 |
int drop_buffer( const tsd_t *TSD, int num ) ; |
| 198 |
int make_buffer( tsd_t *TSD ) ; |
| 199 |
void type_buffer( tsd_t *TSD ) ; |
| 200 |
Queue *find_free_slot( const tsd_t *TSD ) ; |
| 201 |
Queue *fill_input_queue_stem( tsd_t *TSD, streng *stemname, int stem0 ) ; |
| 202 |
Queue *fill_input_queue_stream( tsd_t *TSD, void *fileptr ); |
| 203 |
void flush_stack( const tsd_t *TSD, Queue *src, Queue *dst, int is_fifo ) ; |
| 204 |
streng *stack_to_line( const tsd_t *TSD, Queue *q ); |
| 205 |
int create_queue( tsd_t *TSD, const streng *queue_name, streng **result ); |
| 206 |
int delete_queue( tsd_t *TSD, const streng *queue_name ); |
| 207 |
int timeout_queue( tsd_t *TSD, const streng *timeout, const streng *queue_name ); |
| 208 |
streng *get_queue( tsd_t *TSD ); |
| 209 |
void fill_queue_name( const tsd_t *TSD, int *len, char **name ); |
| 210 |
streng *set_queue( tsd_t *TSD, const streng *queue_name ); |
| 211 |
Queue *addr_reopen_queue( tsd_t *TSD, const streng *queuename, char code ) ; |
| 212 |
int addr_same_queue( const tsd_t *TSD, const Queue *q1, const Queue *q2 ) ; |
| 213 |
Queue *addr_redir_queue( const tsd_t *TSD, Queue *q ) ; |
| 214 |
void addr_purge_queue( const tsd_t *TSD, Queue *q ) ; |
| 215 |
streng *addr_io_queue( tsd_t *TSD, Queue *q, streng *buffer, int isFIFO ) ; |
| 216 |
void addr_close_queue( const tsd_t *TSD, Queue *q ) ; |
| 217 |
|
| 218 |
|
| 219 |
/* |
| 220 |
* Routines in misc.c |
| 221 |
*/ |
| 222 |
void set_locale_info( const char *info ); |
| 223 |
void mem_upper( void *m, int len ); |
| 224 |
void mem_lower( void *m, int len ); |
| 225 |
void mem_upperrx64( void *m, rx_64 len ); |
| 226 |
void mem_lowerrx64( void *m, rx_64 len ); |
| 227 |
int mem_cmpic( const void *buf1, const void *buf2, int len ); |
| 228 |
const char *system_type( void ) ; |
| 229 |
double cpu_time( void ) ; |
| 230 |
void getsecs( time_t *secs, time_t *usecs ) ; |
| 231 |
unsigned hashvalue(const char *string, int length ) ; |
| 232 |
unsigned hashvalue_ic(const char *string, int length ) ; |
| 233 |
unsigned hashvalue_var(const streng *name, int start, int *stop ); |
| 234 |
#ifdef SKYOS |
| 235 |
clock_t clock( void ); |
| 236 |
#endif |
| 237 |
char **makeargs(const char *string, char escape); |
| 238 |
char *splitoffarg(const char *string, const char **trailer, char escape); |
| 239 |
char **makesimpleargs(const char *string); |
| 240 |
void destroyargs(char **args); |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
/* |
| 245 |
* Routines in error.c |
| 246 |
*/ |
| 247 |
int init_error( tsd_t *TSD ) ; |
| 248 |
const streng *errortext( const tsd_t *TSD, int errorno, int suberrnum, int request_english, int apply_inserts ) ; |
| 249 |
void exiterror( int errorno , int suberrorno, ... ) ; |
| 250 |
void __reginaerror( char *errtext ) ; |
| 251 |
const char *getsym( int numb ) ; |
| 252 |
int lineno_of( cnodeptr ) ; |
| 253 |
void clear_errortext_buffers( const tsd_t *TSD ); |
| 254 |
|
| 255 |
|
| 256 |
/* |
| 257 |
* Routines in variable.c |
| 258 |
*/ |
| 259 |
int known_reserved_variable( const char *name, unsigned length ); |
| 260 |
/* We need a fast determination: */ |
| 261 |
#define KNOWN_RESERVED(n,l) ((l) && (*(n)=='.') && known_reserved_variable((n),(l))) |
| 262 |
|
| 263 |
void detach( const tsd_t *TSD, variableptr ptr ) ; |
| 264 |
int init_vars( tsd_t *TSD ) ; |
| 265 |
void expand_to_str( const tsd_t *TSD, variableptr ptr ) ; |
| 266 |
int var_was_found( const tsd_t *TSD ) ; |
| 267 |
var_hashtable *create_new_varpool( const tsd_t *TSD, int size ) ; |
| 268 |
void setdirvalue( tsd_t *TSD, const streng *name, streng *value ) ; |
| 269 |
void setvalue( tsd_t *TSD, const streng *name, streng *value, int pool ) ; |
| 270 |
num_descr *fix_compoundnum( tsd_t *TSD, nodeptr thisptr, num_descr *newdescr, |
| 271 |
streng *string_val ); |
| 272 |
void setshortcutnum( tsd_t *TSD, nodeptr thisptr, num_descr *value, |
| 273 |
streng *string_val ); |
| 274 |
const streng *getdirvalue( tsd_t *TSD, const streng *name ) ; |
| 275 |
const streng *getvalue( tsd_t *TSD, const streng *name, int pool ) ; |
| 276 |
const streng *isvariable( tsd_t *TSD, const streng *name ) ; |
| 277 |
int variables_per_SAA( tsd_t *TSD ); |
| 278 |
void restore_variable_state( const tsd_t *TSD, int state ); |
| 279 |
const streng *get_it_anyway( tsd_t *TSD, const streng *name, int pool ) ; |
| 280 |
const streng *get_it_anyway_compound( tsd_t *TSD, const streng *str ) ; |
| 281 |
void expose_var( tsd_t *TSD, const streng *name ) ; |
| 282 |
void drop_var( tsd_t *TSD, const streng *name ) ; |
| 283 |
void drop_dirvar( tsd_t *TSD, const streng *name ) ; |
| 284 |
void upper_var( tsd_t *TSD, const streng *name ) ; |
| 285 |
void set_ignore_novalue( const tsd_t *TSD ) ; |
| 286 |
int valid_var_symbol( const streng *symbol ) ; |
| 287 |
void clear_ignore_novalue( const tsd_t *TSD ) ; |
| 288 |
#ifdef TRACEMEM |
| 289 |
void markvariables( const tsd_t *TSD, cproclevel ) ; |
| 290 |
#endif /* TRACEMEM */ |
| 291 |
const streng *shortcut( tsd_t *TSD, nodeptr ) ; |
| 292 |
num_descr *shortcutnum( tsd_t *TSD, nodeptr ) ; |
| 293 |
void setshortcut( tsd_t *TSD, nodeptr thisptr, streng *value ) ; |
| 294 |
streng *fix_compound( tsd_t *TSD, nodeptr thisptr, streng *value ) ; |
| 295 |
void kill_variables( const tsd_t *TSD, var_hashtable *array ) ; |
| 296 |
variableptr get_next_variable( tsd_t *TSD, int reset ) ; |
| 297 |
void set_reserved_value( tsd_t *TSD, int poolid, streng *val_str, |
| 298 |
int val_int, int vflag ); |
| 299 |
|
| 300 |
|
| 301 |
/* |
| 302 |
* Routines in shell.c |
| 303 |
*/ |
| 304 |
void put_stem( tsd_t *TSD, environpart *e, streng *str ); |
| 305 |
int init_shell( tsd_t *TSD ) ; |
| 306 |
void cleanup_envirpart(const tsd_t *TSD, environpart *ep); |
| 307 |
int posix_do_command( tsd_t *TSD, const streng *command, int flag, environment *env, Queue *redir ) ; |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
/* |
| 312 |
* Routines in tracing.c |
| 313 |
*/ |
| 314 |
int init_tracing( tsd_t *TSD ) ; |
| 315 |
int purge_tracing( tsd_t *TSD ) ; |
| 316 |
void set_trace( tsd_t *TSD, const streng * ) ; |
| 317 |
void set_trace_char( tsd_t *TSD, char ) ; |
| 318 |
void flush_trace_chars( tsd_t *TSD ) ; |
| 319 |
void queue_trace_char( const tsd_t *TSD, char ch ) ; |
| 320 |
void tracenumber( tsd_t *TSD, const num_descr *num, char type ) ; |
| 321 |
void tracebool( tsd_t *TSD, int value, char type ) ; |
| 322 |
int pushcallstack( const tsd_t *TSD, treenode *thisptr ) ; |
| 323 |
void popcallstack( const tsd_t *TSD, int value ) ; |
| 324 |
void traceerror( tsd_t *TSD, const treenode *thisptr, int RC ) ; |
| 325 |
void tracecompound( tsd_t *TSD, const streng *stem, int length, const streng *index, char trch ) ; |
| 326 |
void starttrace( const tsd_t *TSD ) ; |
| 327 |
int intertrace( tsd_t *TSD ) ; |
| 328 |
void tracevalue( tsd_t *TSD, const streng *str, char type ) ; |
| 329 |
void traceline( tsd_t *TSD, const treenode *thisptr, char tch, int offset ) ; |
| 330 |
void traceback( tsd_t *TSD ) ; |
| 331 |
|
| 332 |
|
| 333 |
/* |
| 334 |
* Routines in interp.c |
| 335 |
*/ |
| 336 |
streng *dointerpret( tsd_t *TSD, streng *string ) ; |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
/* |
| 341 |
* Routines in interpret.c |
| 342 |
*/ |
| 343 |
void update_envirs( const tsd_t *TSD, proclevel level ) ; |
| 344 |
proclevel newlevel( tsd_t *TSD, proclevel oldlevel ) ; |
| 345 |
#define IPRT_BUFSIZE 2 /* buffer elements for the state in InterpreterStatus */ |
| 346 |
void SaveInterpreterStatus(const tsd_t *TSD,unsigned *state); |
| 347 |
void RestoreInterpreterStatus(const tsd_t *TSD,const unsigned *state); |
| 348 |
streng *CallInternalFunction( tsd_t *TSD, nodeptr node, nodeptr thisptr, |
| 349 |
paramboxptr args ); |
| 350 |
streng *interpret( tsd_t * volatile TSD, nodeptr volatile rootnode ) ; |
| 351 |
nodeptr getlabel( const tsd_t *TSD, const streng *name ) ; |
| 352 |
void removelevel( tsd_t *TSD, proclevel level ) ; |
| 353 |
void jump_rexx_signal( tsd_t *TSD ); |
| 354 |
void jump_interpreter_exit( tsd_t *TSD, int processExitCode ); |
| 355 |
void jump_script_exit( tsd_t *TSD, streng *result ); |
| 356 |
int init_spec_vars( tsd_t *TSD ) ; |
| 357 |
|
| 358 |
|
| 359 |
/* |
| 360 |
* Routines in yaccsrc.y |
| 361 |
*/ |
| 362 |
int yylex( void ) ; |
| 363 |
int __reginaparse( void ) ; |
| 364 |
void kill_lines( const tsd_t *TSD, lineboxptr first ) ; |
| 365 |
void destroytree( const tsd_t *TSD, nodeptr thisptr ) ; |
| 366 |
void newlabel( const tsd_t *TSD, internal_parser_type *ipt, nodeptr thisptr ) ; |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
/* |
| 371 |
* Routines in funcs.c |
| 372 |
*/ |
| 373 |
streng *buildtinfunc( tsd_t *TSD, nodeptr thisptr ) ; |
| 374 |
void deallocplink( tsd_t *TSD, paramboxptr first ) ; |
| 375 |
paramboxptr initplist( tsd_t *TSD, cnodeptr thisptr ); |
| 376 |
paramboxptr initargs( tsd_t *TSD, int argc, const int *lengths, |
| 377 |
const char **strings ); |
| 378 |
int myatol( const tsd_t *TSD, const streng *text ) ; |
| 379 |
void checkparam( cparamboxptr params, int min, int max, const char *name ) ; |
| 380 |
char getoptionchar( tsd_t *TSD, const streng *param, const char *bif, int argnum, const char *ansi_options, const char *regina_options ) ; |
| 381 |
int atozpos( tsd_t *TSD, const streng *text, const char *bif, int argnum ) ; |
| 382 |
rx_64 atozposrx64( tsd_t *TSD, const streng *text, const char *bif, int argnum ) ; |
| 383 |
int atopos( tsd_t *TSD, const streng *text, const char *bif, int argnum ) ; |
| 384 |
rx_64 atoposrx64( tsd_t *TSD, const streng *text, const char *bif, int argnum ) ; |
| 385 |
int atoposorzero( tsd_t *TSD, const streng *text, const char *bif, int argnum ) ; |
| 386 |
char getonechar( tsd_t *TSD, const streng *text, const char *bif, int argnum ) ; |
| 387 |
char getonespecialchar( tsd_t *TSD, const streng *text, const char *bif, int argnum ) ; |
| 388 |
streng *int_to_streng( const tsd_t *TSD, int input ) ; |
| 389 |
streng *rx64_to_streng( const tsd_t *TSD, rx_64 input ) ; |
| 390 |
streng *rx64u_to_streng( const tsd_t *TSD, rx_64u input ) ; |
| 391 |
int convert_date(tsd_t *TSD, const streng *, char, struct tm *, char); |
| 392 |
int convert_time(const tsd_t *TSD,const streng *, char, struct tm *, time_t *); |
| 393 |
int basedays(int); |
| 394 |
#ifdef TRACEMEM |
| 395 |
void mark_param_cache( const tsd_t *TSD ) ; |
| 396 |
#endif |
| 397 |
void addtwostrings( char *one, char *two, char *answer ) ; |
| 398 |
const char *BIFname( tsd_t *TSD ); |
| 399 |
|
| 400 |
|
| 401 |
/* |
| 402 |
* Routines in cmath.c |
| 403 |
*/ |
| 404 |
double myatof( const tsd_t *TSD, const streng *string ) ; |
| 405 |
int myisnumber( const tsd_t *TSD, const streng *string ) ; |
| 406 |
int myisinteger( const streng *string ) ; |
| 407 |
|
| 408 |
|
| 409 |
/* |
| 410 |
Functions in rexx.c |
| 411 |
*/ |
| 412 |
#ifdef __cplusplus |
| 413 |
extern "C" { |
| 414 |
#endif |
| 415 |
|
| 416 |
#ifdef RXLIB |
| 417 |
# if defined(__LCC__) |
| 418 |
int __regina_faked_main(int argc,char *argv[]) ; |
| 419 |
# else |
| 420 |
# ifdef __MINGW32__ |
| 421 |
# ifdef __REGINA_DLL |
| 422 |
int APIENTRY __regina_faked_main(int argc,char *argv[]) __declspec(dllexport); |
| 423 |
# else |
| 424 |
int APIENTRY __regina_faked_main(int argc,char *argv[]) __declspec(dllimport); |
| 425 |
# endif |
| 426 |
# else |
| 427 |
int APIENTRY __regina_faked_main(int argc,char *argv[]) ; |
| 428 |
# endif |
| 429 |
# endif |
| 430 |
#else |
| 431 |
int main(int argc,char *argv[]) ; |
| 432 |
#endif |
| 433 |
|
| 434 |
#ifdef __cplusplus |
| 435 |
} |
| 436 |
#endif |
| 437 |
|
| 438 |
int __regina_reexecute_main(int argc, char **argv); |
| 439 |
void mark_systeminfo( const tsd_t *TSD) ; |
| 440 |
nodeptr treadit( cnodeptr ) ; |
| 441 |
void setup_system( tsd_t *TSD, int isclient ); |
| 442 |
sysinfobox *creat_sysinfo( const tsd_t *TSD, streng *envir ); |
| 443 |
void setGlobalTSD( const tsd_t *TSD); |
| 444 |
const tsd_t *getGlobalTSD( void ); |
| 445 |
|
| 446 |
|
| 447 |
/* |
| 448 |
* Functions in signals.h |
| 449 |
*/ |
| 450 |
trap *gettraps( const tsd_t *TSD, proclevel level ) ; |
| 451 |
sigtype *getsigs( proclevel level ) ; |
| 452 |
void mark_signals( const tsd_t *TSD ) ; |
| 453 |
signal_handler regina_signal(int signum, signal_handler action); |
| 454 |
void halt_raised( tsd_t *TSD ); |
| 455 |
int condition_hook( tsd_t *TSD, int, int, int, int, streng *, streng * ) ; |
| 456 |
#ifdef WIN32 |
| 457 |
void __regina_Win32RaiseCtrlC( tsd_t *TSD ); |
| 458 |
#endif |
| 459 |
|
| 460 |
void signal_setup( const tsd_t *TSD ) ; |
| 461 |
int identify_trap( int type ) ; |
| 462 |
void set_rexx_halt( tsd_t *TSD ) ; |
| 463 |
|
| 464 |
/* |
| 465 |
* Routines in library.c |
| 466 |
*/ |
| 467 |
int init_library( tsd_t *TSD ) ; |
| 468 |
void free_orphaned_libs( tsd_t *TSD ); |
| 469 |
void purge_library( tsd_t *TSD ); |
| 470 |
struct library *find_library( const tsd_t *TSD, const streng *name ); |
| 471 |
void set_err_message( const tsd_t *TSD, const char *message1, const char *message2 ) ; |
| 472 |
streng *rex_rxfuncerrmsg( tsd_t *TSD, cparamboxptr parms ) ; |
| 473 |
streng *rex_rxfuncquery( tsd_t *TSD, cparamboxptr parms ) ; |
| 474 |
streng *rex_rxfuncadd( tsd_t *TSD, cparamboxptr parms ) ; |
| 475 |
streng *rex_rxfuncdefine( tsd_t *TSD, cparamboxptr parms ); |
| 476 |
streng *rex_gciprefixchar( tsd_t *TSD, cparamboxptr parms ); |
| 477 |
streng *rex_rxfuncdrop( tsd_t *TSD, cparamboxptr parms ) ; |
| 478 |
int IfcRegFunc( const tsd_t *TSD, const char *rxname, const char *module, |
| 479 |
const char *objnam, PFN entry ); |
| 480 |
int IfcRegExit( const tsd_t *TSD, const char *rxname, const char *module, |
| 481 |
const char *objnam, PFN entry, void *user_area ); |
| 482 |
int IfcRegSubcom( const tsd_t *TSD, const char *rxname, const char *module, |
| 483 |
const char *objnam, PFN entry, void *user_area ); |
| 484 |
int IfcDelFunc( tsd_t *TSD, const char *rxname ); |
| 485 |
int IfcDelExit( tsd_t *TSD, const char *rxname, const char *module ); |
| 486 |
int IfcDelSubcom( tsd_t *TSD, const char *rxname, const char *module ); |
| 487 |
int IfcQueryFunc( const tsd_t *TSD, const char *rxname ); |
| 488 |
int IfcQueryExit( const tsd_t *TSD, const char *rxname, const char *module, |
| 489 |
void *user_area ); |
| 490 |
int IfcQuerySubcom( const tsd_t *TSD, const char *rxname, |
| 491 |
const char *module, void *user_area ); |
| 492 |
struct entry_point *loaded_lib_func( const tsd_t *TSD, const streng *name ); |
| 493 |
struct entry_point *exit_hook( const tsd_t *TSD, const char *env, int len ); |
| 494 |
struct entry_point *subcom_hook( const tsd_t *TSD, const char *com, int len ); |
| 495 |
|
| 496 |
/* |
| 497 |
* functions in mt_notmt.c/mt_<os>.c |
| 498 |
*/ |
| 499 |
int IfcReginaCleanup( void ); |
| 500 |
|
| 501 |
/* |
| 502 |
* functions in macros.c |
| 503 |
*/ |
| 504 |
void killsystem( tsd_t *TSD, sysinfo systm ) ; |
| 505 |
internal_parser_type enter_macro( tsd_t *TSD, const streng *source, |
| 506 |
void **ept, unsigned long *extlength); |
| 507 |
streng *do_instore( tsd_t * volatile TSD, const streng *name, paramboxptr args, |
| 508 |
const streng *envir, int * volatile RetCode, int hooks, |
| 509 |
const void *instore, unsigned long instore_length, |
| 510 |
const char *instore_source, |
| 511 |
unsigned long instore_source_length, |
| 512 |
const internal_parser_type *ipt, |
| 513 |
int ctype ) ; |
| 514 |
streng *execute_external( tsd_t * volatile TSD, const streng *command, |
| 515 |
paramboxptr args, const streng *envir, |
| 516 |
int * volatile RetCode, int hooks, int ctype ) ; |
| 517 |
int count_params( cparamboxptr ptr, int soft ) ; |
| 518 |
streng *get_parameter( paramboxptr ptr, int number ) ; |
| 519 |
|
| 520 |
|
| 521 |
/* |
| 522 |
* Functions in envir.c |
| 523 |
*/ |
| 524 |
void post_process_system_call( tsd_t *TSD, const streng *cmd, |
| 525 |
int rc_code, const streng *rc_value, |
| 526 |
cnodeptr thisptr ); |
| 527 |
streng *perform( tsd_t *TSD, const streng *command, const streng *envir, cnodeptr thisptr, cnodeptr overwrite ); |
| 528 |
void add_envir( tsd_t *TSD, const streng *name, int type, int subtype ) ; |
| 529 |
int envir_exists( const tsd_t *TSD, const streng *name ); |
| 530 |
streng *get_envir_details( const tsd_t *TSD, char opt, const streng *name ); |
| 531 |
int set_subcomed_envir( const tsd_t *TSD, const streng *name, int subcomed ); |
| 532 |
int get_subcomed_envir( const tsd_t *TSD, const streng *name ); |
| 533 |
int init_envir( tsd_t *TSD ) ; |
| 534 |
void del_envir( tsd_t *TSD, const streng *name ) ; |
| 535 |
int set_envir( const tsd_t *TSD, const streng *envirname, const nodeptr ios ) ; |
| 536 |
streng *run_popen( tsd_t *TSD, const streng *command, const streng *envir ) ; |
| 537 |
|
| 538 |
|
| 539 |
/* |
| 540 |
* Functions in client.c |
| 541 |
*/ |
| 542 |
int init_client( tsd_t *TSD ) ; |
| 543 |
int hookup( tsd_t *TSD, int type ) ; |
| 544 |
int hookup_output( tsd_t *TSD, int type, const streng *outdata ) ; |
| 545 |
int hookup_output2( tsd_t *TSD, int type, const streng *outdata1, const streng *outdata2 ) ; |
| 546 |
int hookup_input( tsd_t *TSD, int type, streng **indata ) ; |
| 547 |
int hookup_input_output( tsd_t *TSD, int type, const streng *outdata, streng **indata ) ; |
| 548 |
streng *call_unknown_external( tsd_t *TSD, const streng *name, cparamboxptr parms, char called ) ; |
| 549 |
streng *call_known_external( tsd_t *TSD, const struct entry_point *vbox, cparamboxptr parms, char called ) ; |
| 550 |
streng *SubCom( tsd_t *TSD, const streng *command, const streng *envir, int *rc ) ; |
| 551 |
|
| 552 |
/* |
| 553 |
* Routines in options.c |
| 554 |
*/ |
| 555 |
void do_options( const tsd_t *TSD, proclevel pl, streng *options, int ) ; |
| 556 |
int get_options_flag( cproclevel, int ) ; |
| 557 |
void set_options_flag( proclevel, int, int ) ; |
| 558 |
|
| 559 |
|
| 560 |
/* |
| 561 |
* Routines in rexxext.c |
| 562 |
*/ |
| 563 |
char *mygetenv( const tsd_t *TSD, const char *name, char *buf, int bufsize ) ; |
| 564 |
void set_pause_at_exit( ); |
| 565 |
streng *rex_userid( tsd_t *TSD, cparamboxptr parms ) ; |
| 566 |
streng *rex_getcaller( tsd_t *TSD, cparamboxptr parms ) ; |
| 567 |
streng *rex_getcallstack( tsd_t *TSD, cparamboxptr parms ) ; |
| 568 |
streng *rex_rxqueue( tsd_t *TSD, cparamboxptr parms ) ; |
| 569 |
#if defined(WIN32) && !defined(__WINS__) && !defined(__EPOC32__) |
| 570 |
void set_pause_at_exit( void ); |
| 571 |
#endif |
| 572 |
|
| 573 |
/* |
| 574 |
* Routines in vmscmd.c |
| 575 |
*/ |
| 576 |
int init_vms( tsd_t *TSD ) ; |
| 577 |
int vms_do_command( tsd_t *TSD, const streng *cmd, int io_flags, environment *env, Queue *redir ); |
| 578 |
int vms_killproc( tsd_t *TSD ) ; |
| 579 |
streng *vms_resolv_symbol( tsd_t *TSD, streng *name, streng *newstr, streng *pool ) ; |
| 580 |
|
| 581 |
/* |
| 582 |
* Routines in builtin.c |
| 583 |
*/ |
| 584 |
int init_builtin( tsd_t *TSD ) ; |
| 585 |
streng *ext_pool_value( tsd_t *TSD, streng *name, streng *value, streng *env ); |
| 586 |
streng *std_abbrev( tsd_t *TSD, cparamboxptr parms ) ; |
| 587 |
streng *std_abs( tsd_t *TSD, cparamboxptr parms ) ; |
| 588 |
streng *std_address( tsd_t *TSD, cparamboxptr parms ) ; |
| 589 |
streng *std_arg( tsd_t *TSD, cparamboxptr parms ) ; |
| 590 |
streng *std_bitand( tsd_t *TSD, cparamboxptr parms ) ; |
| 591 |
streng *std_bitor( tsd_t *TSD, cparamboxptr parms ) ; |
| 592 |
streng *std_bitxor( tsd_t *TSD, cparamboxptr parms ) ; |
| 593 |
streng *std_center( tsd_t *TSD, cparamboxptr parms ) ; |
| 594 |
streng *std_changestr( tsd_t *TSD, cparamboxptr parms ) ; |
| 595 |
streng *std_compare( tsd_t *TSD, cparamboxptr parms ) ; |
| 596 |
streng *std_condition( tsd_t *TSD, cparamboxptr parms ) ; |
| 597 |
streng *std_copies( tsd_t *TSD, cparamboxptr parms ) ; |
| 598 |
streng *std_countstr( tsd_t *TSD, cparamboxptr parms ) ; |
| 599 |
streng *std_datatype( tsd_t *TSD, cparamboxptr parms ) ; |
| 600 |
streng *std_date( tsd_t *TSD, cparamboxptr parms ) ; |
| 601 |
streng *std_delstr( tsd_t *TSD, cparamboxptr parms ) ; |
| 602 |
streng *std_delword( tsd_t *TSD, cparamboxptr parms ) ; |
| 603 |
streng *std_digits( tsd_t *TSD, cparamboxptr parms ) ; |
| 604 |
streng *std_errortext( tsd_t *TSD, cparamboxptr parms ) ; |
| 605 |
streng *std_form( tsd_t *TSD, cparamboxptr parms ) ; |
| 606 |
streng *std_format( tsd_t *TSD, cparamboxptr parms ) ; |
| 607 |
streng *std_fuzz( tsd_t *TSD, cparamboxptr parms ) ; |
| 608 |
streng *std_insert( tsd_t *TSD, cparamboxptr parms ) ; |
| 609 |
streng *std_lastpos( tsd_t *TSD, cparamboxptr parms ) ; |
| 610 |
streng *std_length( tsd_t *TSD, cparamboxptr parms ) ; |
| 611 |
streng *std_left( tsd_t *TSD, cparamboxptr parms ) ; |
| 612 |
streng *std_max( tsd_t *TSD, cparamboxptr parms ) ; |
| 613 |
streng *std_min( tsd_t *TSD, cparamboxptr parms ) ; |
| 614 |
streng *std_overlay( tsd_t *TSD, cparamboxptr parms ) ; |
| 615 |
streng *std_pos( tsd_t *TSD, cparamboxptr parms ) ; |
| 616 |
streng *std_qualify( tsd_t *TSD, cparamboxptr parms ) ; |
| 617 |
streng *std_queued( tsd_t *TSD, cparamboxptr parms ) ; |
| 618 |
streng *std_right( tsd_t *TSD, cparamboxptr parms ) ; |
| 619 |
streng *std_reverse( tsd_t *TSD, cparamboxptr parms ) ; |
| 620 |
streng *std_random( tsd_t *TSD, cparamboxptr parms ) ; |
| 621 |
streng *std_sign( tsd_t *TSD, cparamboxptr parms ) ; |
| 622 |
streng *std_sourceline( tsd_t *TSD, cparamboxptr parms ) ; |
| 623 |
streng *std_space( tsd_t *TSD, cparamboxptr parms ) ; |
| 624 |
streng *std_strip( tsd_t *TSD, cparamboxptr parms ) ; |
| 625 |
streng *std_substr( tsd_t *TSD, cparamboxptr parms ) ; |
| 626 |
streng *std_subword( tsd_t *TSD, cparamboxptr parms ) ; |
| 627 |
streng *std_symbol( tsd_t *TSD, cparamboxptr parms ) ; |
| 628 |
streng *std_time( tsd_t *TSD, cparamboxptr parms ) ; |
| 629 |
streng *std_trace( tsd_t *TSD, cparamboxptr parms ) ; |
| 630 |
streng *std_translate( tsd_t *TSD, cparamboxptr parms ) ; |
| 631 |
streng *std_trunc( tsd_t *TSD, cparamboxptr parms ) ; |
| 632 |
streng *std_value( tsd_t *TSD, cparamboxptr parms ) ; |
| 633 |
streng *std_verify( tsd_t *TSD, cparamboxptr parms ) ; |
| 634 |
streng *std_word( tsd_t *TSD, cparamboxptr parms ) ; |
| 635 |
streng *std_wordindex( tsd_t *TSD, cparamboxptr parms ) ; |
| 636 |
streng *std_wordlength( tsd_t *TSD, cparamboxptr parms ) ; |
| 637 |
streng *std_wordpos( tsd_t *TSD, cparamboxptr parms ) ; |
| 638 |
streng *std_words( tsd_t *TSD, cparamboxptr parms ) ; |
| 639 |
streng *std_xrange( tsd_t *TSD, cparamboxptr parms ) ; |
| 640 |
streng *rex_poolid( tsd_t *TSD, cparamboxptr parms ) ; |
| 641 |
streng *rex_lower( tsd_t *TSD, cparamboxptr parms ); |
| 642 |
|
| 643 |
/* |
| 644 |
* Routines in convert.c |
| 645 |
*/ |
| 646 |
streng *std_b2x( tsd_t *TSD, cparamboxptr parms ) ; |
| 647 |
streng *std_c2d( tsd_t *TSD, cparamboxptr parms ) ; |
| 648 |
streng *std_c2x( tsd_t *TSD, cparamboxptr parms ) ; |
| 649 |
streng *std_d2c( tsd_t *TSD, cparamboxptr parms ) ; |
| 650 |
streng *std_d2x( tsd_t *TSD, cparamboxptr parms ) ; |
| 651 |
streng *std_x2b( tsd_t *TSD, cparamboxptr parms ) ; |
| 652 |
streng *std_x2c( tsd_t *TSD, cparamboxptr parms ) ; |
| 653 |
streng *std_x2d( tsd_t *TSD, cparamboxptr parms ) ; |
| 654 |
|
| 655 |
/* |
| 656 |
* Routines in dbgfuncs.c |
| 657 |
*/ |
| 658 |
#ifdef FLISTS |
| 659 |
streng *dbg_freelists( tsd_t *TSD, cparamboxptr parms ) ; |
| 660 |
#endif |
| 661 |
#ifndef NDEBUG |
| 662 |
# ifdef TRACEMEM |
| 663 |
streng *dbg_allocated( tsd_t *TSD, cparamboxptr parms ) ; |
| 664 |
# endif |
| 665 |
streng *dbg_dumpvars( tsd_t *TSD, cparamboxptr parms ) ; |
| 666 |
streng *dbg_dumptree( tsd_t *TSD, cparamboxptr parms ) ; |
| 667 |
# ifdef TRACEMEM |
| 668 |
streng *dbg_listleaked( tsd_t *TSD, cparamboxptr parms ) ; |
| 669 |
streng *dbg_memorystats( tsd_t *TSD, cparamboxptr parms ) ; |
| 670 |
# endif /* TRACEMEM */ |
| 671 |
#endif /* !NDEBUG */ |
| 672 |
streng *dbg_traceback( tsd_t *TSD, cparamboxptr parms ) ; |
| 673 |
|
| 674 |
/* |
| 675 |
* Routines in vmsfuncs.c |
| 676 |
*/ |
| 677 |
#ifdef VMS |
| 678 |
streng *vms_f_directory( tsd_t *TSD, cparamboxptr parms ) ; |
| 679 |
streng *vms_f_file_attributes( tsd_t *TSD, cparamboxptr parms ) ; |
| 680 |
streng *vms_f_getdvi( tsd_t *TSD, cparamboxptr parms ) ; |
| 681 |
streng *vms_f_getjpi( tsd_t *TSD, cparamboxptr parms ) ; |
| 682 |
streng *vms_f_getqui( tsd_t *TSD, cparamboxptr parms ) ; |
| 683 |
streng *vms_f_getsyi( tsd_t *TSD, cparamboxptr parms ) ; |
| 684 |
streng *vms_f_identifier( tsd_t *TSD, cparamboxptr parms ) ; |
| 685 |
streng *vms_f_message( tsd_t *TSD, cparamboxptr parms ) ; |
| 686 |
streng *vms_f_mode( tsd_t *TSD, cparamboxptr parms ) ; |
| 687 |
streng *vms_f_pid( tsd_t *TSD, cparamboxptr parms ) ; |
| 688 |
streng *vms_f_privilege( tsd_t *TSD, cparamboxptr parms ) ; |
| 689 |
streng *vms_f_process( tsd_t *TSD, cparamboxptr parms ) ; |
| 690 |
streng *vms_f_string( tsd_t *TSD, cparamboxptr parms ) ; |
| 691 |
streng *vms_f_time( tsd_t *TSD, cparamboxptr parms ) ; |
| 692 |
streng *vms_f_setprv( tsd_t *TSD, cparamboxptr parms ) ; |
| 693 |
streng *vms_f_user( tsd_t *TSD, cparamboxptr parms ) ; |
| 694 |
streng *vms_f_locate( tsd_t *TSD, cparamboxptr parms ) ; |
| 695 |
streng *vms_f_length( tsd_t *TSD, cparamboxptr parms ) ; |
| 696 |
streng *vms_f_integer( tsd_t *TSD, cparamboxptr parms ) ; |
| 697 |
streng *vms_f_trnlnm( tsd_t *TSD, cparamboxptr parms ) ; |
| 698 |
streng *vms_f_logical( tsd_t *TSD, cparamboxptr parms ) ; |
| 699 |
streng *vms_f_parse( tsd_t *TSD, cparamboxptr parms ) ; |
| 700 |
streng *vms_f_search( tsd_t *TSD, cparamboxptr parms ) ; |
| 701 |
streng *vms_f_type( tsd_t *TSD, cparamboxptr parms ) ; |
| 702 |
streng *vms_f_file_attributes( tsd_t *TSD, cparamboxptr parms ) ; |
| 703 |
streng *vms_f_extract( tsd_t *TSD, cparamboxptr parms ) ; |
| 704 |
streng *vms_f_element( tsd_t *TSD, cparamboxptr parms ) ; |
| 705 |
streng *vms_f_cvui( tsd_t *TSD, cparamboxptr parms ) ; |
| 706 |
streng *vms_f_cvsi( tsd_t *TSD, cparamboxptr parms ) ; |
| 707 |
streng *vms_f_cvtime( tsd_t *TSD, cparamboxptr parms ) ; |
| 708 |
streng *vms_f_fao( tsd_t *TSD, cparamboxptr parms ) ; |
| 709 |
#endif |
| 710 |
|
| 711 |
/* |
| 712 |
* Routines in unxfuncs.c |
| 713 |
*/ |
| 714 |
streng *unx_popen( tsd_t *TSD, cparamboxptr parms ) ; |
| 715 |
streng *unx_getpid( tsd_t *TSD, cparamboxptr parms ) ; |
| 716 |
streng *unx_gettid( tsd_t *TSD, cparamboxptr parms ) ; |
| 717 |
streng *unx_eof( tsd_t *TSD, cparamboxptr parms ) ; |
| 718 |
streng *unx_uname( tsd_t *TSD, cparamboxptr parms ) ; |
| 719 |
streng *unx_fork( tsd_t *TSD, cparamboxptr parms ) ; |
| 720 |
streng *unx_unixerror( tsd_t *TSD, cparamboxptr parms ) ; |
| 721 |
streng *unx_chdir( tsd_t *TSD, cparamboxptr parms ) ; |
| 722 |
streng *unx_getenv( tsd_t *TSD, cparamboxptr parms ) ; |
| 723 |
streng *unx_putenv( tsd_t *TSD, cparamboxptr parms ) ; |
| 724 |
streng *unx_crypt( tsd_t *TSD, cparamboxptr parms ) ; |
| 725 |
|
| 726 |
/* |
| 727 |
* Routines in os2funcs.c |
| 728 |
*/ |
| 729 |
streng *os2_directory( tsd_t *TSD, cparamboxptr parms ) ; |
| 730 |
streng *os2_beep( tsd_t *TSD, cparamboxptr parms ) ; |
| 731 |
streng *os2_filespec( tsd_t *TSD, cparamboxptr parms ) ; |
| 732 |
|
| 733 |
/* |
| 734 |
* Routines in rexxsaa.c |
| 735 |
*/ |
| 736 |
int init_rexxsaa( tsd_t *TSD ) ; |
| 737 |
void deinit_rexxsaa( tsd_t *TSD ) ; |
| 738 |
|
| 739 |
/* |
| 740 |
* Routines in vmsfuncs.c |
| 741 |
*/ |
| 742 |
int init_vmf( tsd_t *TSD ) ; |
| 743 |
|
| 744 |
/* |
| 745 |
* Routines in wrappers.c |
| 746 |
*/ |
| 747 |
void *wrapper_load( const tsd_t *TSD, const streng *module ) ; |
| 748 |
void wrapper_unload( const tsd_t *TSD, void *libhandle ) ; |
| 749 |
PFN wrapper_get_addr( const tsd_t *TSD, const struct library *lptr, const streng *name) ; |
| 750 |
|
| 751 |
/* |
| 752 |
* Routines in staticld.c |
| 753 |
*/ |
| 754 |
#ifdef DYNAMIC_STATIC |
| 755 |
void *static_dlopen( char *name ); |
| 756 |
int static_dlsym( void *addr, char *name, void **faddr ); |
| 757 |
void static_list_packages(); |
| 758 |
#endif |
| 759 |
|
| 760 |
/* |
| 761 |
* Routines in strengs.c |
| 762 |
* string and streng routines are ugly but we need the speedup of passing the |
| 763 |
* TSD to take profit from flists in the multi-threading environment. |
| 764 |
*/ |
| 765 |
void __regina_Str_first( void ); |
| 766 |
#if !defined(FLISTS) || defined(TRACEMEM) |
| 767 |
streng *__regina_Str_make( int size ) ; |
| 768 |
streng *__regina_Str_make_TSD( const tsd_t *TSD, int size ) ; |
| 769 |
# define Str_make(a) __regina_Str_make(a) |
| 770 |
# define Str_make_TSD(TSD,a) __regina_Str_make_TSD(TSD,a) |
| 771 |
# define Str_makeTSD(size) Str_make_TSD(TSD,size) |
| 772 |
#else |
| 773 |
# define Str_make(a) get_a_streng(a) |
| 774 |
# define Str_make_TSD(TSD,a) get_a_strengTSD(TSD,a) |
| 775 |
# define Str_makeTSD(a) get_a_strengTSD(TSD,a) |
| 776 |
#endif |
| 777 |
#define nullstringptr() Str_makeTSD(0) |
| 778 |
streng *Str_ndup( const streng *name, int length ) ; |
| 779 |
streng *Str_ndup_TSD( const tsd_t *TSD, const streng *name, int length ) ; |
| 780 |
#define Str_ndupTSD(name,length) Str_ndup_TSD(TSD,name,length) |
| 781 |
streng *Str_nodup( const streng *name, int length, int offset ) ; |
| 782 |
streng *Str_nodup_TSD( const tsd_t *TSD, const streng *name, int offset, int length ) ; |
| 783 |
#define Str_nodupTSD(name,length,offset) Str_nodup_TSD(TSD,name,length,offset) |
| 784 |
streng *Str_dup( const streng *name ) ; |
| 785 |
streng *Str_dup_TSD( const tsd_t *TSD, const streng *input ) ; |
| 786 |
#define Str_dupTSD(name) Str_dup_TSD(TSD,name) |
| 787 |
streng *Str_dupstr( const streng *name ) ; |
| 788 |
streng *Str_dupstr_TSD( const tsd_t *TSD, const streng *input ) ; |
| 789 |
#define Str_dupstrTSD(name) Str_dupstr_TSD(TSD,name) |
| 790 |
streng *Str_ncpy( streng *to, const streng *from, int length ) ; |
| 791 |
streng *Str_ncpy_TSD( const tsd_t *TSD, streng *to, const streng *from, int length ) ; |
| 792 |
#define Str_ncpyTSD(to,from,length) Str_ncpy_TSD(TSD,to,from,length) |
| 793 |
streng *Str_ncre( const char *from, int length ) ; |
| 794 |
streng *Str_ncre_TSD( const tsd_t *TSD, const char *from, int length ) ; |
| 795 |
#define Str_ncreTSD(from,length) Str_ncre_TSD(TSD,from,length) |
| 796 |
streng *Str_cat( streng *to, const streng *from ) ; |
| 797 |
streng *Str_cat_TSD( const tsd_t *TSD, streng *first, const streng *second ) ; |
| 798 |
#define Str_catTSD(first,second) Str_cat_TSD(TSD,first,second) |
| 799 |
streng *Str_ncat( streng *to, const streng *from, int length ) ; |
| 800 |
streng *Str_ncat_TSD( const tsd_t *TSD, streng *first, const streng *second, int length ) ; |
| 801 |
#define Str_ncatTSD(first,second,length) Str_ncat_TSD(TSD,first,second,length) |
| 802 |
streng *Str_nocat( streng *to, const streng *from, int length, int offset ) ; |
| 803 |
streng *Str_nocat_TSD( const tsd_t *TSD, streng *first, const streng *second, int length, int offset ) ; |
| 804 |
#define Str_nocatTSD(first,second,length,offset) Str_nocat_TSD(TSD,first,second,length,offset) |
| 805 |
int Str_ncmp( const streng *one, const streng *two, int length ) ; |
| 806 |
int Str_cmp( const streng *one, const streng *two ) ; |
| 807 |
int Str_ccmp( const streng *one, const streng *two ) ; |
| 808 |
int Str_cncmp( const streng *one, const streng *two, int length ) ; |
| 809 |
int Str_cnocmp( const streng *one, const streng *two, int length, int offset ) ; |
| 810 |
streng *Str_cre( const char *value ) ; |
| 811 |
streng *Str_cre_TSD( const tsd_t *TSD, const char *input ) ; |
| 812 |
#define Str_creTSD(value) Str_cre_TSD(TSD,value) |
| 813 |
streng *Str_crestr( const char *value ); |
| 814 |
streng *Str_crestr_TSD( const tsd_t *TSD, const char *input ) ; |
| 815 |
#define Str_crestrTSD(input) Str_crestr_TSD(TSD,input) |
| 816 |
streng *Str_catstr( streng *in, const char *more ) ; |
| 817 |
streng *Str_catstr_TSD( const tsd_t *TSD, streng *base, const char *append ) ; |
| 818 |
#define Str_catstrTSD(base,append) Str_catstr_TSD(TSD,base,append) |
| 819 |
streng *Str_ncatstr( streng *base, const char *input, int length ) ; |
| 820 |
streng *Str_ncatstr_TSD( const tsd_t *TSD, streng *base, const char *input, int length ) ; |
| 821 |
#define Str_ncatstrTSD(base,input,length) Str_ncatstr_TSD(TSD,base,input,length) |
| 822 |
char *str_of( const tsd_t *TSD, const streng *input ) ; |
| 823 |
#define str_ofTSD(input) str_of(TSD,input) |
| 824 |
#ifndef EXTERNAL_TO_REGINA |
| 825 |
volatile char *tmpstr_of( tsd_t *TSD, const streng *input ) ; |
| 826 |
#endif |
| 827 |
streng *Str_upper( streng *in ) ; |
| 828 |
streng *Str_lower( streng *in ) ; |
| 829 |
streng *Str_strp( streng * input, char chr, char opt ) ; |
| 830 |
void __regina_Str_last( void ); |
| 831 |
|
| 832 |
/* |
| 833 |
* Routines in strmath.c |
| 834 |
*/ |
| 835 |
#define DIVTYPE_NORMAL 0 |
| 836 |
#define DIVTYPE_INTEGER 1 |
| 837 |
#define DIVTYPE_REMAINDER 2 |
| 838 |
#define DIVTYPE_BOTH 3 /* use only with str_div directly ! */ |
| 839 |
|
| 840 |
int descr_sign( const void * ) ; |
| 841 |
streng *str_sign( tsd_t *TSD, const streng*); |
| 842 |
streng *str_trunc( tsd_t *TSD, const streng*, int ) ; |
| 843 |
streng *str_normalize( const tsd_t *TSD, const streng* ) ; |
| 844 |
streng *str_digitize( tsd_t *TSD, streng*, int, int, const char *, int ) ; |
| 845 |
streng *str_format( tsd_t *TSD, const streng*, int, int, int, int ) ; |
| 846 |
streng *str_binerize( tsd_t *TSD, num_descr *, int, int, int, const char *, int ) ; |
| 847 |
int str_true( const tsd_t *TSD, const streng* ) ; |
| 848 |
streng *str_abs( tsd_t *TSD, const streng* ) ; |
| 849 |
num_descr *get_a_descr( tsd_t *TSD, const char *big, int argno, const streng* ) ; |
| 850 |
void free_a_descr( const tsd_t *TSD, num_descr* ) ; |
| 851 |
#ifdef TRACEMEM |
| 852 |
void mark_descrs( const tsd_t *TSD ) ; |
| 853 |
#endif |
| 854 |
int init_math( tsd_t *TSD ) ; |
| 855 |
void descr_copy( const tsd_t *TSD, const num_descr *f, num_descr *s ) ; |
| 856 |
num_descr *string_incr( tsd_t *TSD, num_descr *input, cnodeptr node ); |
| 857 |
void string_mul( tsd_t *TSD, const num_descr *f, const num_descr *s, |
| 858 |
num_descr *r, cnodeptr left, cnodeptr right ); |
| 859 |
void string_div( tsd_t *TSD, const num_descr *f, const num_descr *s, |
| 860 |
num_descr *r, num_descr *r2, int type, cnodeptr left, |
| 861 |
cnodeptr right ); |
| 862 |
int myiswnumber( tsd_t *TSD, const streng *number, num_descr **num, |
| 863 |
int noDigitsLimit ); |
| 864 |
void str_round( num_descr *descr, int size ) ; |
| 865 |
void str_round_lostdigits( tsd_t *TSD, num_descr *descr, int size ); |
| 866 |
void string_pow( tsd_t *TSD, const num_descr *num, num_descr *acc, |
| 867 |
num_descr *res, cnodeptr lname, cnodeptr rname); |
| 868 |
int descr_to_int( const tsd_t *TSD, const num_descr *input, int, int, const char *, int ) ; |
| 869 |
num_descr *is_a_descr( const tsd_t *TSD, const streng *input ) ; |
| 870 |
int getdescr( const tsd_t *TSD, const streng *num, num_descr *descr ) ; |
| 871 |
int string_test( const tsd_t *TSD, const num_descr *fdescr, |
| 872 |
const num_descr *sdescr ) ; |
| 873 |
void string_add( tsd_t *TSD, const num_descr *f, const num_descr *s, |
| 874 |
num_descr *r, cnodeptr left, cnodeptr right ); |
| 875 |
void str_strip( num_descr *num ) ; |
| 876 |
streng *str_norm( const tsd_t *TSD, num_descr *in, streng *trystr ) ; |
| 877 |
int streng_to_int( const tsd_t *TSD, const streng *input, int *error ) ; |
| 878 |
rx_64 streng_to_rx64( const tsd_t *TSD, const streng *input, int *error ) ; |
| 879 |
|
| 880 |
/* |
| 881 |
* Routines in instore.c |
| 882 |
*/ |
| 883 |
void NewProg(void); |
| 884 |
void EndProg(nodeptr Start); |
| 885 |
nodeptr FreshNode(void); |
| 886 |
void RejectNode(nodeptr NoLongerUsed); |
| 887 |
offsrcline *FreshLine(void); |
| 888 |
void DestroyInternalParsingTree(const tsd_t *TSD, internal_parser_type *ipt); |
| 889 |
external_parser_type *TinTree(const tsd_t *TSD, |
| 890 |
const internal_parser_type *ipt, |
| 891 |
unsigned long *length); |
| 892 |
internal_parser_type ExpandTinnedTree(const tsd_t *TSD, |
| 893 |
const external_parser_type *ept, |
| 894 |
unsigned long length, |
| 895 |
const char *incore_source, |
| 896 |
unsigned long incore_source_length); |
| 897 |
int IsValidTin(const external_parser_type *ept, unsigned long eptlen); |
| 898 |
|
| 899 |
/* |
| 900 |
* Routines in arxfuncs.c |
| 901 |
*/ |
| 902 |
int init_arexxf( tsd_t *TSD ); |
| 903 |
streng *arexx_open ( tsd_t *TSD, cparamboxptr parm1 ); |
| 904 |
streng *arexx_close( tsd_t *TSD, cparamboxptr parm1 ); |
| 905 |
streng *arexx_writech( tsd_t *TSD, cparamboxptr parm1 ); |
| 906 |
streng *arexx_writeln( tsd_t *TSD, cparamboxptr parm1 ); |
| 907 |
streng *arexx_seek( tsd_t *TSD, cparamboxptr parm1 ); |
| 908 |
streng *arexx_readch( tsd_t *TSD, cparamboxptr parm1 ); |
| 909 |
streng *arexx_readln( tsd_t *TSD, cparamboxptr parm1 ); |
| 910 |
streng *arexx_eof( tsd_t *TSD, cparamboxptr parm1 ); |
| 911 |
streng *arexx_b2c( tsd_t *TSD, cparamboxptr parm1 ); |
| 912 |
streng *arexx_c2b( tsd_t *TSD, cparamboxptr parm1 ); |
| 913 |
streng *arexx_bitchg( tsd_t *TSD, cparamboxptr parm1 ); |
| 914 |
streng *arexx_bitclr( tsd_t *TSD, cparamboxptr parm1 ); |
| 915 |
streng *arexx_bitset( tsd_t *TSD, cparamboxptr parm1 ); |
| 916 |
streng *arexx_bittst( tsd_t *TSD, cparamboxptr parm1 ); |
| 917 |
streng *arexx_bitcomp( tsd_t *TSD, cparamboxptr parm1 ); |
| 918 |
streng *arexx_hash( tsd_t *TSD, cparamboxptr parm1 ); |
| 919 |
streng *arexx_compress( tsd_t *TSD, cparamboxptr parm1 ); |
| 920 |
streng *arexx_trim( tsd_t *TSD, cparamboxptr parm1 ); |
| 921 |
streng *arexx_upper( tsd_t *TSD, cparamboxptr parm1 ); |
| 922 |
streng *arexx_randu( tsd_t *TSD, cparamboxptr parm1 ); |
| 923 |
streng *arexx_getspace( tsd_t *TSD, cparamboxptr parm1 ); |
| 924 |
streng *arexx_freespace( tsd_t *TSD, cparamboxptr parm1 ); |
| 925 |
streng *arexx_import( tsd_t *TSD, cparamboxptr parm1 ); |
| 926 |
streng *arexx_export( tsd_t *TSD, cparamboxptr parm1 ); |
| 927 |
streng *arexx_storage( tsd_t *TSD, cparamboxptr parm1 ); |
| 928 |
streng *arexx_show( tsd_t *TSD, cparamboxptr parm1 ); |
| 929 |
|
| 930 |
/* |
| 931 |
****************************************************************************** |
| 932 |
****************************************************************************** |
| 933 |
****************************************************************************** |
| 934 |
* global variables |
| 935 |
*/ |
| 936 |
|
| 937 |
/* externals which are protected by regina_parser (see lexsrc.l) */ |
| 938 |
extern internal_parser_type parser_data; |
| 939 |
extern int retlength ; /* value shared by lexsrc.l and yaccsrc.y only */ |
| 940 |
extern char retvalue[] ; /* value shared by lexsrc.l and yaccsrc.y only */ |
| 941 |
extern char *__reginatext ; /* value shared by lexsrc.l and yaccsrc.y only */ |
| 942 |
extern unsigned SymbolDetect ; /* value shared by lexsrc.l and yaccsrc.y only */ |
| 943 |
#define SD_INPUT 0x00000001 |
| 944 |
#define SD_OUTPUT 0x00000002 |
| 945 |
#define SD_ERROR 0x00000004 |
| 946 |
#define SD_NORMAL 0x00000008 |
| 947 |
#define SD_APPEND 0x00000010 |
| 948 |
#define SD_REPLACE 0x00000020 |
| 949 |
#define SD_STREAM 0x00000040 |
| 950 |
#define SD_STEM 0x00000080 |
| 951 |
#define SD_LIFO 0x00000100 |
| 952 |
#define SD_FIFO 0x00000200 |
| 953 |
#define SD_NOEOL 0x00000400 |
| 954 |
#define SD_ADDRWITH 0x000007FF /* All the above */ |
| 955 |
#ifndef NDEBUG |
| 956 |
extern int __reginadebug ; |
| 957 |
#endif |
| 958 |
/* end of externals protected by regina_parser (see lexsrc.l) */ |
| 959 |
|
| 960 |
extern unsigned countthreads; /* Not protected and not save in use! */ |
| 961 |
|
| 962 |
extern const char *months[]; |
| 963 |
extern const char *signalnames[]; |
| 964 |
#ifdef WIN32 |
| 965 |
extern volatile int __regina_Win32CtrlCRaised; |
| 966 |
#endif |
| 967 |
extern unsigned char_info[]; |
| 968 |
extern unsigned char u_to_l[]; |
| 969 |
extern unsigned char l_to_u[]; |
| 970 |
extern const char *numeric_forms[] ; |
| 971 |
extern const char *invo_strings[] ; |
| 972 |
extern const char *argv0 ; |
| 973 |
/* Don't terminate the following lines by a semicolon */ |
| 974 |
EXPORT_GLOBAL_PROTECTION_VAR(regina_globals) |
| 975 |
|