1 /* 2 * The Regina Rexx Interpreter 3 * Copyright (C) 1992-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 20 #include "wrappers.h" 21 22 /* <<<<<<<<<<< Things you might want to configure >>>>>>>>>>>>>> */ 23 /* 24 * Although you'd probably better off compiling rxiface.c with these 25 * symbols set at the commandline than actually changing this file 26 */ 27 28 /* 29 * The cpp symbol RXPROG contains the name of the rexx interpreter to 30 * start. If not defined elsewhere (like on the command line), a default 31 * value is used. It is invoked using exec*p*, so you don't need to 32 * specify a full path unless 'rexx' is located somewhere outside PATH. 33 */ 34 #ifndef RXPROG 35 # define RXPROG "rexx" 36 #endif 37 38 /* 39 * When the application starts up the interpreter, a version number is 40 * sent from the interpreter to the application, as the first thing. 41 * This piece of information serves two purposes: If the interpreter 42 * was not properly started, that will be sensed and an apropriate 43 * errormessage can be returned to the calling routine in the application. 44 * Secondly, if the interpreter and the application have different 45 * versions of the interfacing software, that will be detected. 46 * 47 * MAKE SURE THAT YOU CHANGE THE VERSION NUMBER WHENEVER YOU CHANGE 48 * THE DEFINITION OF THE INTERFACE! At worst, pick a number at random, 49 * just choose a version number that isn't likely to have been chosen 50 * by somebody else. 51 * 52 * NOTE: I've taken the liberty to 'reserve' 0xdeadbeef as the version 53 * number for the versions I write and distribute. If you change 54 * anything, make sure that you set RXVERSION_MAJ to something 55 * else. -anders <anders@pvv.unit.no> 56 * The version number for my changes is 0xbadab0de :-) 57 * Mark - <M.Hessling@qut.edu.au> 58 */ 59 #ifndef RXVERSION_MAJ 60 # define RXVERSION_MAJ 0xbadab0de 61 # define RXVERSION_MIN 0x00002000 62 #endif 63 64 /* 65 * These are the commands sent through the communication channel. Their 66 * format is fixed. 67 68 RX_RETURN int=code, int=rval 69 RX_SCOMRET int=code, int=flag, str=retvalue 70 RX_SUBCOM 71 72 */ 73 #define RX_RETURN 1 74 #define RX_SUBCOM 2 75 #define RX_GETVAR 3 76 #define RX_SETVAR 4 77 #define RX_EXECUTE 5 78 #define RX_VALUE 6 79 #define RX_ENVIR 7 80 #define RX_RETVOID 8 81 #define RX_SYNCREQ 9 82 #define RX_SYNCACK 10 83 #define RX_SETEXIT 11 84 #define RX_CLREXIT 12 85 #define RX_DO_HOOK 13 86 #define RX_TYPE_EXTERNAL 14 87 #define RX_TYPE_INSTORE 15 88 #define RX_TYPE_MACRO 16 89 #define RX_TYPE_SOURCE 17 90 #define RX_INSTORE 18 91 #define RX_DROP_INSTORE 19 92 #define RX_GETSVAR 20 93 #define RX_SETSVAR 21 94 #define RX_CODE_SOURCE 22 95 #define RX_CODE_VERSION 23 96 #define RX_CODE_QUEUE 24 97 #define RX_CODE_PARAM 25 98 #define RX_TYPE_COMMAND 26 99 #define RX_TYPE_FUNCTION 27 100 #define RX_TYPE_SUBROUTINE 28 101 #define RX_VERSION 29 102 #define RX_STRINGS 30 103 #define RX_NEXTVAR 31 104 #define RX_ADDFUNC 32 105 #define RX_DELFUNC 33 106 #define RX_EXECFUNC 34 107 #define RX_CODE_PARAMS 35 108 109 #define RX_CODE_OK 0 110 #define RX_CODE_NOVALUE 1 111 #define RX_CODE_INVNAME 2 112 #define RX_CODE_EXISTS 3 113 #define RX_CODE_NOSUCH 4 114 #define RX_CODE_NOMEM 5 115 116 #define RX_HOOK_GO_ON 0 117 #define RX_HOOK_NOPE 1 118 #define RX_HOOK_ERROR 2 119 120 #define RX_NO_STRING (-1) 121 122 #define RX_EXIT_STDOUT 0 123 #define RX_EXIT_STDERR 1 124 #define RX_EXIT_TRCIN 2 125 #define RX_EXIT_PULL 3 126 #define RX_EXIT_INIT 4 127 #define RX_EXIT_TERMIN 5 128 #define RX_EXIT_SUBCOM 6 129 #define RX_EXIT_FUNC 7 130 #define RX_EXIT_GETENV 8 131 #define RX_EXIT_SETENV 9 132 #define RX_EXIT_GETCWD 10 133 #define RX_EXIT_SETCWD 11 134 135 #define RX_LASTHOOK 32 136 137 #define RXFLAG_OK 0x0000 138 139 #define RXFLAG_ERROR 0x0001 140 #define RXFLAG_FAILURE 0x0002 141 142 #define RXFLAG_NOVALUE 0x0001 143 144 #define RXFLAG_NOTREG 30 145 146 int IfcStartUp( tsd_t *TSD, char *name, int *Major, int *Minor ) ; 147 int IfcExecScript( tsd_t * volatile TSD, int NameLen, const char *Name, 148 int ArgCount, const int *ParLengths, const char **ParStrings, 149 int CallType, int ExitFlags, int EnvLen, const char *EnvName, 150 int SourceCode, int restricted, 151 const char *SourceString, unsigned long SourceStringLen, 152 const void *TinnedTree, unsigned long TinnedTreeLen, 153 int *RetLen, char **RetString, void **instore_buf, 154 unsigned long *instore_length ) ; 155 int IfcExecCallBack( tsd_t * volatile TSD, int NameLen, const char *Name, 156 int ArgCount, const int *ParLengths, const char **ParStrings, 157 int *RetLen, char **RetString ); 158 159 int IfcVarPool( tsd_t *TSD, int Code, int *Lengths, char *Strings[], 160 int *allocated ); 161 162 int IfcSubCmd( tsd_t *TSD, int EnvLen, const char *EnvStr, int CmdLen, 163 const char *CmdStr, int *RetLen, char **RetStr ) ; 164 int IfcDoExit( tsd_t *TSD, int Code, 165 int OutputLength1, char *OutputString1, 166 int OutputLength2, char *OutputString2, 167 int *InputLength, char **InputString ) ; 168 int IfcExecFunc( tsd_t *TSD, PFN Func, char *Name, int Params, 169 int *Lengths, char **Strings, 170 int queue_name_len, char *queue_name, 171 int *RetLength, char **RetString, 172 int *RC, char called, void *gci_info ) ; 173 int IfcRegDllFunc( const tsd_t *TSD, const char* rxname, const char* module, const char* objnam ) ; 174 175 int IfcHaveFunctionExit(const tsd_t *TSD); 176 177 unsigned long IfcFreeMemory( void *); 178 void *IfcAllocateMemory( unsigned long ); 179 180 int IfcCreateQueue( tsd_t *TSD, const char *qname, const int qlen, char *data, unsigned long *dupflag, unsigned long buflen ); 181 int IfcDeleteQueue( tsd_t *TSD, const char *qname, const int qlen ); 182 int IfcQueryQueue( tsd_t *TSD, const char *qname, const int qlen, unsigned long *count ); 183 int IfcAddQueue( tsd_t *TSD, const char *qname, const int qlen, const char *data, const int datalen, unsigned long addlifo ); 184 int IfcPullQueue( tsd_t *TSD, const char *qname, const int qlen, char **data, unsigned long *datalen, unsigned long waitforline ); 185