|##########| |#MAGIC #|CLABLLFI |#PROJECT #|"" |#PATHS #|"StdProject" |#FLAGS #|xx-x-x--x---x-x----------------- |#USERSW #|-------------------------------- |#USERMASK#|-------------------------------- |#SWITCHES#|xx---xxxxx------ |##########| DEFINITION MODULE Rexx; (* $A- *) FROM System IMPORT BITSET,BPTR,Regs; FROM Dos IMPORT DeviceListPtr,DosLibraryPtr,FileHandlePtr, FileLockPtr,StandardPacketPtr; FROM Exec IMPORT ExecBasePtr,Library,List,ListPtr,MemReqs,Message, MessagePtr,MsgPort,MsgPortPtr,Node,NodePtr; TYPE RexxErrors = (ok, programNotFound, executionNotHalted, noMemoryAvailable, invalidCharacterInProgram, unmatchedQuote, unterminatedComment, clauseTooLong, unrecognizedToken, symbolOrStringTooLong, invalidMessagePacket, commandStringError, errorReturnFromFunction, hostEnvironmentNotFound, requiredLibraryNotFound, functionNotFound, noReturnValue, wrongNumbersOfArguments, invalidArgumentToFunction, invalidProcedure, unexpectedThenElse, unexpectedWhenOtherwise, unexpectedLeaveIterate, invalidStatementInSelect, missingThenClauses, missingOtherwise, missingOrUnexpectedEnd, symbolMismatchOnEnd, invalidDoSyntax, incompleteDoIfSelec, labelNotFound, symbolExpected, stringOrSymbolExpected, invalidSubKeyword, requiredKeywordMissing, extraneousCharacters, subKeywordConflict, invalidTemplate, invalidTraceRequest, uninitializedVariable, invalidVariableName, invalidExpression, unbalancedParentheses, nestingLevelExceeded, invalidExpressionResult, expressionRequired, booleanValueNot0or1, arithmeticConversionError, invalidOperand); CONST ReturnOk = 0; ReturnWarn = 5; ReturnError = 10; ReturnFatal = 20; TYPE AttributeFlags = (keep,string,notNum,number,binary,float,ext, source); AttributeFlagSet = SET OF AttributeFlags; NexxStr = RECORD iValue : LONGINT; length : CARDINAL; flags : AttributeFlagSet; hash : SHORTCARD; (*buff : ARRAY OF CHAR;*) END; NexxStrPtr = POINTER TO NexxStr; CONST intNum = AttributeFlagSet:{number,binary,string}; dpNum = AttributeFlagSet:{number,float}; alpha = AttributeFlagSet:{notNum,string}; owned = AttributeFlagSet:{source,ext,keep}; keepStr = AttributeFlagSet:{string,source,notNum}; keepNum = AttributeFlagSet:{string,source,number,binary}; TYPE RexxArg = RECORD size : LONGINT; length : CARDINAL; flags : AttributeFlagSet; hash : SHORTCARD; (* buff : ARRAY OF CHAR *) END; RexxArgPtr = POINTER TO RexxArg; CONST maxRMArg = 15; TYPE Command = (co0,comn,func,close,query,co5,co6,addFH,addLib,remLib, addCon,remCon,tcOpn,tcCls); ModifierFlags = (noIO,result,moString,token,nonRet,mo5,mo6,mo7); ModifierFlagSet = SET OF ModifierFlags; ActionRec = RECORD command : Command; modifier : ModifierFlagSet; add : CARDINAL END; RexxMsg = RECORD OF Message taskBlock, libBase : ANYPTR; action : ActionRec; result1, result2 : LONGINT; args : ARRAY [0..maxRMArg] OF ANYPTR; passPort : MsgPortPtr; commAddr, fileExt : ANYPTR; stdin, stdout : FileHandlePtr; avail : LONGINT END; RexxMsgPtr = POINTER TO RexxMsg; RexxRsrc = RECORD OF Node func : INTEGER; base : ANYPTR; size, arg1, arg2 : LONGINT END; RexxRsrcPtr = POINTER TO RexxRsrc; RsrcNodeType = (any,lib,port,file,host,clip); CONST globalsz = 200; TYPE RexxTaskFlags = (trace,halt,susp,tcUse,rtf4,rtf5,wait,rtfClose); RexxTaskFlagSet = SET OF RexxTaskFlags; RexxTask = RECORD global : ARRAY [0..globalsz-1] OF SHORTINT; msgPort : MsgPort; flags : RexxTaskFlagSet; sigBit : SHORTCARD; clientID, msgPkt, taskID, rexxPort, errTrap, stackPtr : ANYPTR; envList, freeList, memList, fileList, portList : List END; RexxTaskPtr = POINTER TO RexxTask; CONST memQuant = $10; memMask = $FFFFFFF0; memQuick = public; TYPE SrcNodePtr = POINTER TO SrcNode; SrcNode = RECORD succ, pred : SrcNodePtr; ptr : ANYPTR; size : LONGINT END; CONST rxsdir = "REXX"; rxstname = "ARexx"; TYPE RxsLibPtr = POINTER TO RxsLib; RxsLib = RECORD OF Library flags : RexxTaskFlagSet; sysBase : ExecBasePtr; dosBase : DosLibraryPtr; ieeeDPBase : ANYPTR; segList : BPTR; nil : FileHandlePtr; chunk, maxNest : LONGINT; null, false, true, rexx, command, stdin, stdout, stderr : NexxStrPtr; version, taskName : ANYPTR; taskPri : LONGINT; taskSeg : BPTR; stackSize : LONGINT; rexxDir, cTable : ANYPTR; notice : NexxStrPtr; rexxPort : MsgPort; readLock : CARDINAL; traceFH : FileHandlePtr; taskList : List; numTask : INTEGER; libList : List; numLib : INTEGER; clipList : List; numClip : INTEGER; msgList : List; numMsg : INTEGER; pgmList : List; numPgm : INTEGER; traceCnt : CARDINAL; avail : INTEGER END; CONST tcOpen = rtf4; stop = wait; vers = 34; rev = 9; rxsalloc = $80000000; rxschunk = $00000400; rxsnest = $00000020; rxstpri = $00000000; rxsstack = $00001000; rxslisth = $00000005; TYPE CharAttrFlags = (space,digit,caAlpha,rexxSym,rexxOpr,rexxSpc,upper, lower); CharAttrFlagSet = SET OF CharAttrFlags; CONST buffsz = 204; TYPE IoBuff = RECORD OF RexxRsrc; rpt : ANYPTR; rct : LONGINT; dfh, lock : FileLockPtr; bct : LONGINT; area : ARRAY [0..buffsz-1] OF SHORTINT END; IoBuffPtr = POINTER TO IoBuff; CONST exist = -1; strf = 0; read = 1; write = 2; append = 3; TYPE RexxMsgPort = RECORD OF RexxRsrc; port : MsgPort; replyList : List END; CONST stack = 2002; queue = 2003; fail = -1; VAR RexxBase : RxsLibPtr; LIBRARY RexxBase BY -126 PROCEDURE CreateArgstring(String IN A0 : ANYPTR; Length IN D0 : LONGINT):ANYPTR; LIBRARY RexxBase BY -132 PROCEDURE DeleteArgstring(ArgString IN A0 : ANYPTR); LIBRARY RexxBase BY -138 PROCEDURE LengthArgstring(Arg IN A0 :RexxArgPtr):LONGINT; LIBRARY RexxBase BY -144 PROCEDURE CreateRexxMsg(ReplyPort IN A0 : MsgPortPtr; Extension IN A1 : ANYPTR; Host IN D0 : ANYPTR):RexxMsgPtr; LIBRARY RexxBase BY -150 PROCEDURE DeleteRexxMsg(Message IN A0 : RexxMsgPtr); LIBRARY RexxBase BY -156 PROCEDURE ClearRexxMsg(MsgPtr IN A0 : MessagePtr; Count IN D0 : LONGINT); LIBRARY RexxBase BY -162 PROCEDURE FillRexxMsg(MsgPtr IN A0 : RexxMsgPtr; Count IN D0 : LONGINT; Mask IN D1 : BITSET):BOOLEAN; LIBRARY RexxBase BY -168 PROCEDURE IsRexxMsg(MsgPtr IN A0 : MessagePtr):BOOLEAN; LIBRARY RexxBase BY -450 PROCEDURE LockRexxBase(Resource IN D0 : RsrcNodeType); LIBRARY RexxBase BY -456 PROCEDURE UnlockRexxBase(Resource IN D0 : RsrcNodeType); GROUP TypeGrp = AttributeFlags,AttributeFlagSet,NexxStr,NexxStrPtr,intNum, dpNum,alpha,owned,keepStr,keepNum,RexxArg,RexxArgPtr, maxRMArg,Command,ModifierFlags,ModifierFlagSet,ActionRec, RexxMsg,RexxMsgPtr,RexxRsrc,RexxRsrcPtr,RsrcNodeType, globalsz,RexxTaskFlags,RexxTaskFlagSet,RexxTask,RexxTaskPtr, memQuant,memMask,memQuick,SrcNodePtr,SrcNode,rxsdir, rxstname,RxsLib,tcOpen,stop,vers,rev,rxsalloc,rxschunk, rxsnest,rxstpri,rxsstack,rxslisth,CharAttrFlags, CharAttrFlagSet,buffsz,IoBuff,IoBuffPtr,exist,strf,read, write,append,RexxMsgPort,stack,queue,fail,RexxBase; ProcGrp = CreateArgstring,DeleteArgstring,LengthArgstring, CreateRexxMsg,DeleteRexxMsg, ClearRexxMsg,FillRexxMsg,IsRexxMsg, LockRexxBase,UnlockRexxBase; All = TypeGrp,ProcGrp; END Rexx.