[comp.sources.amiga] v02i011: dme - programmer's text editor V1.31, Part03/06

page@swan.ulowell.edu (Bob Page) (10/22/88)

Submitted-by: dillon@cory.berkeley.edu (Matt Dillon)
Posting-number: Volume 2, Issue 11
Archive-name: editors/dme131.3of6

# This is a shell archive.  Remove anything before this line
# then unpack it by saving it in a file and typing "sh file"
# (Files unpacked will be owned by you and have default permissions).
# This archive contains the following files:
#	./src/filereq.c
#	./src/rexx/rxslib.h
#	./src/rexx/rxslib.i
#	./src/rexx/rexxio.h
#	./src/rexx/rexxio.i
#	./src/rexx/errors.h
#	./src/rexx/errors.i
#	./src/rexx/rxsupplib.i
#	./src/rexx/storage.h
#	./src/rexx/storage.i
#	./src/tags
#
if `test ! -d ./src`
then
  mkdir ./src
  echo "mkdir ./src"
fi
if `test ! -s ./src/filereq.c`
then
echo "writing ./src/filereq.c"
cat > ./src/filereq.c << '\Rogue\Monster\'

/*
 *  ARP interface (ARPLOAD, ARPSAVE)
 */

#include "defs.h"

void
do_arpinsfile()
{
    char file[64];
    char dir[64];
    long oldlock = CurrentDir(Ep->dirlock);

    splitpath(Ep->Name, file, dir);
    if (arpreq("INSERTFILE", file, dir, NULL)) {
	CurrentDir(oldlock);
	fixfile(file, dir);
	av[0] = (ubyte *)"i";
	av[1] = (ubyte *)file;
	do_edit();
	return;
    }
    CurrentDir(oldlock);
}

void
do_arpload()
{
    char file[64];
    char dir[64];
    long oldlock = CurrentDir(Ep->dirlock);

    splitpath(Ep->Name, file, dir);
    if (arpreq("NEWFILE", file, dir, NULL)) {
	long newlock;
	if (newlock = Lock(dir, SHARED_LOCK)) {
	    UnLock(CurrentDir(oldlock));
	    Ep->dirlock = newlock;
	    /*
	    fixfile(file,dir);
	    */
	    av[0] = (ubyte *)"n";
	    av[1] = (ubyte *)file;
	    do_edit();
	    return;
	}
    }
    CurrentDir(oldlock);
}

void
do_arpsave()
{
    char file[64];
    char dir[64];
    long oldlock = CurrentDir(Ep->dirlock);

    splitpath(Ep->Name, file, dir);
    if (arpreq("SAVEAS", file, dir, NULL)) {
	CurrentDir(oldlock);
	fixfile(file,dir);
	av[1] = (ubyte *)file;
	do_saveas();
    } else {
	CurrentDir(oldlock);
    }
}

fixfile(file,dir)
register char *file,*dir;
{
    register char *ptr;
    register short len = strlen(dir);
    char hasdev = 0;

    /*
     *	do we need to add a slash to the directory spec?
     */

    if (len && dir[len-1] != '/' && dir[len-1] != ':') {
	dir[len++] = '/';
	dir[len] = 0;
    }

    /*
     *	Is file spec really a full path spec?
     */

    for (ptr = file; *ptr; ++ptr) {
	if (ptr[0] == ':')
	    hasdev = 1;
    }
    if (!hasdev) {
	movmem(file,file+len,strlen(file)+1);
	movmem(dir,file,len);
    }
}

/*
 *  Search backwards for first ':' or '/' and split path there.
 *  This subroutine may appear to be coded incorrectly to a novice
 *  programmer.  It isn't [now].
 */

splitpath(name, file, dir)
register char *name;
char *file, *dir;
{
    register short i;
    for (i = strlen(name); i >= 0; --i) {       /* was (incorrectly) "i > 0" */
	if (name[i] == ':' || name[i] == '/')
	    break;
    }
    ++i;
    strcpy(file, name + i);
    bmov(name, dir, i);
    dir[i] = 0;
}

#asm

		;   arpreq(hail,file,dir,window)

		FAR DATA
		FAR CODE

		public	_arpreq
		public	_LVOOldOpenLibrary
		public	_LVOCloseLibrary
		public	_SysBase

_LVOFileRequest equ	-294

arp_name_text	dc.b 'arp.library',0

fs		ds.l	1   ;hailing text
		ds.l	1   ;file name
		ds.l	1   ;directory
		ds.l	1   ;window requesting
		ds.w	1   ;LONG Align, idiots!  set to 0
		ds.l	1   ;func for wildcards
		ds.l	1   ;func to call w/intuimessages

_arpreq:
		lea.l	fs,A0
		movem.l 4(sp),D0-D3             ;setup fields
		movem.l D0-D3,(A0)
		clr.w	fs+16
		move.l	_SysBase,A6

		lea.l	arp_name_text,a1	;open library
		jsr	_LVOOldOpenLibrary(a6)
		tst.l	d0
		beq.s	done
		move.l	d0,a6
		lea.l	fs,a0
		jsr	_LVOFileRequest(A6)     ;call requestor
		move.l	D0,-(sp)                ;return value
		move.l	A6,A1			;CloseLibrary(arpbase)
		move.l	_SysBase,A6
		jsr	_LVOCloseLibrary(A6)
		move.l	(sp)+,D0                ;return value
done		rts

#endasm


\Rogue\Monster\
else
  echo "will not over write ./src/filereq.c"
fi
if [ `wc -c ./src/filereq.c | awk '{printf $1}'` -ne 3110 ]
then
echo `wc -c ./src/filereq.c | awk '{print "Got " $1 ", Expected " 3110}'`
fi
if `test ! -d ./src/rexx`
then
  mkdir ./src/rexx
  echo "mkdir ./src/rexx"
fi
if `test ! -s ./src/rexx/rxslib.h`
then
echo "writing ./src/rexx/rxslib.h"
cat > ./src/rexx/rxslib.h << '\Rogue\Monster\'
/* === rexx/rxslib.h ===================================================
 *
 * Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
 *
 * =====================================================================
 * The header file for the REXX Systems Library
 */

#ifndef REXX_RXSLIB_H
#define REXX_RXSLIB_H

#ifndef REXX_STORAGE_H
#include "rexx/storage.h"
#endif

/* Some macro definitions                                               */

#define RXSNAME  "rexxsyslib.library"
#define RXSID    "rexxsyslib 1.0 (23 AUG 87)\n"
#define RXSDIR   "REXX"
#define RXSTNAME "ARexx"

/* The REXX systems library structure.  This should be considered as    */
/* semi-private and read-only, except for documented exceptions.        */

struct RxsLib {
   struct Library rl_Node;             /* EXEC library node             */
   UBYTE    rl_Flags;                  /* global flags                  */
   UBYTE    rl_pad;
   APTR     rl_SysBase;                /* EXEC library base             */
   APTR     rl_DOSBase;                /* DOS library base              */
   APTR     rl_IeeeDPBase;             /* IEEE DP math library base     */
   LONG     rl_SegList;                /* library seglist               */
   LONG     rl_MaxAlloc;               /* maximum memory allocation     */
   LONG     rl_Chunk;                  /* allocation quantum            */
   LONG     rl_MaxNest;                /* maximum expression nesting    */
   struct NexxStr *rl_NULL;            /* static string: NULL           */
   struct NexxStr *rl_FALSE;           /* static string: FALSE          */
   struct NexxStr *rl_TRUE;            /* static string: TRUE           */
   struct NexxStr *rl_REXX;            /* static string: REXX           */
   struct NexxStr *rl_COMMAND;         /* static string: COMMAND        */
   struct NexxStr *rl_STDIN;           /* static string: STDIN          */
   struct NexxStr *rl_STDOUT;          /* static string: STDOUT         */
   struct NexxStr *rl_STDERR;          /* static string: STDERR         */
   STRPTR    rl_Version;               /* version/configuration string  */

   STRPTR    rl_TaskName;              /* name string for tasks         */
   LONG      rl_TaskPri;               /* starting priority             */
   LONG      rl_TaskSeg;               /* startup seglist               */
   LONG      rl_StackSize;             /* stack size                    */
   STRPTR    rl_RexxDir;               /* REXX directory                */
   STRPTR    rl_CTABLE;                /* character attribute table     */
   struct NexxStr *rl_Notice;          /* copyright notice              */

   struct MsgPort rl_RexxPort;         /* REXX public port              */
   UWORD     rl_ReadLock;              /* lock count                    */
   LONG      rl_TraceFH;               /* global trace console          */
   struct List rl_TaskList;            /* REXX task list                */
   WORD      rl_NumTask;               /* task count                    */
   struct List rl_LibList;             /* Library List header           */
   WORD      rl_NumLib;                /* library count                 */
   struct List rl_ClipList;            /* ClipList header               */
   WORD      rl_NumClip;               /* clip node count               */
   struct List rl_MsgList;             /* pending messages              */
   WORD      rl_NumMsg;                /* pending count                 */
   };

/* Global flag bit definitions for RexxMaster                           */
#define RLFB_TRACE RTFB_TRACE          /* interactive tracing?          */
#define RLFB_HALT  RTFB_HALT           /* halt execution?               */
#define RLFB_SUSP  RTFB_SUSP           /* suspend execution?            */
#define RLFB_TCUSE RTFB_TCUSE          /* trace console in use?         */
#define RLFB_TCOPN 4                   /* trace console open?           */
#define RLFB_STOP  6                   /* deny further invocations      */
#define RLFB_CLOSE 7                   /* close the master              */

#define RLFMASK    0x07                /* passed flags                  */

/* Initialization constants                                             */

#define RXSVERS    2                   /* main version                  */
#define RXSREV     1                   /* revision                      */
#define RXSALLOC   0x800000            /* maximum allocation            */
#define RXSCHUNK   1024                /* allocation quantum            */
#define RXSNEST    32                  /* expression nesting limit      */
#define RXSTPRI    0                   /* task priority                 */
#define RXSSTACK   4096                /* stack size                    */
#define RXSLISTH   4                   /* number of list headers        */

/* Character attribute flag bits used in REXX.  Defined only for        */
/* ASCII characters (range 0-127).                                      */

#define CTB_SPACE   0                  /* white space characters        */
#define CTB_DIGIT   1                  /* decimal digits 0-9            */
#define CTB_ALPHA   2                  /* alphabetic characters         */
#define CTB_REXXSYM 3                  /* REXX symbol characters        */
#define CTB_REXXOPR 4                  /* REXX operator characters      */
#define CTB_REXXSPC 5                  /* REXX special symbols          */
#define CTB_UPPER   6                  /* UPPERCASE alphabetic          */
#define CTB_LOWER   7                  /* lowercase alphabetic          */
                                                                      
/* Attribute flags                                                      */
#define CTF_SPACE   (1 << CTB_SPACE)
#define CTF_DIGIT   (1 << CTB_DIGIT)
#define CTF_ALPHA   (1 << CTB_ALPHA)
#define CTF_REXXSYM (1 << CTB_REXXSYM)
#define CTF_REXXOPR (1 << CTB_REXXOPR)
#define CTF_REXXSPC (1 << CTB_REXXSPC)
#define CTF_UPPER   (1 << CTB_UPPER)
#define CTF_LOWER   (1 << CTB_LOWER)

#endif
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/rxslib.h"
fi
if [ `wc -c ./src/rexx/rxslib.h | awk '{printf $1}'` -ne 6046 ]
then
echo `wc -c ./src/rexx/rxslib.h | awk '{print "Got " $1 ", Expected " 6046}'`
fi
if `test ! -s ./src/rexx/rxslib.i`
then
echo "writing ./src/rexx/rxslib.i"
cat > ./src/rexx/rxslib.i << '\Rogue\Monster\'
* === rexx/rxslib.i ====================================================
*
* Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
*
* ======================================================================
* Include file for the REXX Systems Library

         IFND     REXX_RXSLIB_I
REXX_RXSLIB_I  SET   1

         IFND     REXX_STORAGE_I
         INCLUDE  "rexx/storage.i"
         ENDC

         ; Macro definitions 

RXSNAME  MACRO
         dc.b     'rexxsyslib.library',0
         ENDM

RXSID    MACRO
         dc.b     'rexxsyslib 1.02 (01 NOV 87)',10,0
         ENDM

RXSDIR   MACRO                         ; directory (device) for programs
         dc.b     'REXX',0
         ENDM

RXSTNAME MACRO                         ; name for tasks
         dc.b     'ARexx',0
         ENDM

* Macro to call a library function (assumes library pointer is in A6)
CALLSYS  MACRO    * FunctionName
         CALLLIB  _LVO\1
         ENDM

* Macro to define an external library entry point (offset)
XLIB     MACRO    * FunctionName
         XREF     _LVO\1
         ENDM

* Structure definition for the REXX systems library
         STRUCTURE RxsLib,LIB_SIZE     ; EXEC library node
         UBYTE    rl_Flags             ; global flags
         UBYTE    rl_pad
         APTR     rl_SysBase           ; EXEC library base
         APTR     rl_DOSBase           ; DOS library base
         APTR     rl_IeeeDPBase        ; IEEE DP math library base
         LONG     rl_SegList           ; library seglist
         LONG     rl_MaxAlloc          ; maximum memory allocation
         LONG     rl_Chunk             ; allocation quantum
         LONG     rl_MaxNest           ; maximum expression nesting
         APTR     rl_NULL              ; static string: NULL
         APTR     rl_FALSE             ; static string: FALSE
         APTR     rl_TRUE              ; static string: TRUE
         APTR     rl_REXX              ; static string: REXX
         APTR     rl_COMMAND           ; static string: COMMAND
         APTR     rl_STDIN             ; static string: STDIN
         APTR     rl_STDOUT            ; static string: STDOUT
         APTR     rl_STDERR            ; static string: STDERR
         APTR     rl_Version           ; version string

         LONG     rl_TaskName          ; name string for tasks
         LONG     rl_TaskPri           ; starting priority
         LONG     rl_TaskSeg           ; startup seglist
         LONG     rl_StackSize         ; stack size
         APTR     rl_RexxDir           ; REXX directory
         APTR     rl_CTABLE            ; character attribute table
         APTR     rl_Notice            ; copyright notice

         STRUCT   rl_RexxPort,MP_SIZE  ; public port
         UWORD    rl_ReadLock          ; lock count
         APTR     rl_TraceFH           ; global trace console
         STRUCT   rl_TaskList,LH_SIZE  ; REXX task list
         WORD     rl_NumTask
         STRUCT   rl_LibList,LH_SIZE   ; Library List header
         WORD     rl_NumLib
         STRUCT   rl_ClipList,LH_SIZE  ; ClipList header
         WORD     rl_NumClip
         STRUCT   rl_MsgList,LH_SIZE   ; pending messages
         WORD     rl_NumMsg
         LABEL    rl_SIZEOF

* Global flag bit definitions for RexxMaster
RLFB_TRACE  EQU   RTFB_TRACE           ; interactive tracing?
RLFB_HALT   EQU   RTFB_HALT            ; halt execution?
RLFB_SUSP   EQU   RTFB_SUSP            ; suspend execution?
RLFB_TCUSE  EQU   RTFB_TCUSE           ; trace console in use?
RLFB_TCOPN  EQU   4                    ; trace console open?
RLFB_STOP   EQU   6                    ; deny further invocations
RLFB_CLOSE  EQU   7                    ; close the master

RLFMASK     EQU      $07               ; passed flags

         ; Initialization constants

RXSVERS  EQU      2                    ; main version
RXSREV   EQU      1                    ; revision
RXSALLOC EQU      $800000              ; maximum allocation
RXSCHUNK EQU      1024                 ; allocation quantum
RXSNEST  EQU      32                   ; expression nesting limit
RXSTPRI  EQU      0                    ; task priority
RXSSTACK EQU      4096                 ; stack size
RXSLISTH EQU      4                    ; number of list headers

* The library entry point offsets
         LIBINIT
         LIBDEF   _LVORexx             ; Main entry point
         LIBDEF   _LVOrxParse          ; (private)
         LIBDEF   _LVOrxInstruct       ; (private)
         LIBDEF   _LVOrxSuspend        ; (private)
         LIBDEF   _LVOEvalOp           ; (private)

         LIBDEF   _LVOAssignValue      ; (private)
         LIBDEF   _LVOEnterSymbol      ; (private)
         LIBDEF   _LVOFetchValue       ; (private)
         LIBDEF   _LVOLookUpValue      ; (private)
         LIBDEF   _LVOSetValue         ; (private)
         LIBDEF   _LVOSymExpand        ; (private)

         LIBDEF   _LVOErrorMsg
         LIBDEF   _LVOIsSymbol
         LIBDEF   _LVOCurrentEnv
         LIBDEF   _LVOGetSpace
         LIBDEF   _LVOFreeSpace

         LIBDEF   _LVOCreateArgstring
         LIBDEF   _LVODeleteArgstring
         LIBDEF   _LVOLengthArgstring
         LIBDEF   _LVOCreateRexxMsg
         LIBDEF   _LVODeleteRexxMsg
         LIBDEF   _LVOClearRexxMsg
         LIBDEF   _LVOFillRexxMsg
         LIBDEF   _LVOIsRexxMsg

         LIBDEF   _LVOAddRsrcNode
         LIBDEF   _LVOFindRsrcNode
         LIBDEF   _LVORemRsrcList
         LIBDEF   _LVORemRsrcNode
         LIBDEF   _LVOOpenPublicPort
         LIBDEF   _LVOClosePublicPort
         LIBDEF   _LVOListNames

         LIBDEF   _LVOClearMem
         LIBDEF   _LVOInitList
         LIBDEF   _LVOInitPort
         LIBDEF   _LVOFreePort

         LIBDEF   _LVOCmpString
         LIBDEF   _LVOStcToken
         LIBDEF   _LVOStrcmpN
         LIBDEF   _LVOStrcmpU
         LIBDEF   _LVOStrcpyA
         LIBDEF   _LVOStrcpyN
         LIBDEF   _LVOStrcpyU
         LIBDEF   _LVOStrflipN
         LIBDEF   _LVOStrlen
         LIBDEF   _LVOToUpper

         LIBDEF   _LVOCVa2i
         LIBDEF   _LVOCVi2a
         LIBDEF   _LVOCVi2arg
         LIBDEF   _LVOCVi2az
         LIBDEF   _LVOCVc2x
         LIBDEF   _LVOCVx2c

         LIBDEF   _LVOOpenF
         LIBDEF   _LVOCloseF
         LIBDEF   _LVOReadStr
         LIBDEF   _LVOReadF
         LIBDEF   _LVOWriteF
         LIBDEF   _LVOSeekF
         LIBDEF   _LVOQueueF
         LIBDEF   _LVOStackF
         LIBDEF   _LVOExistF

         LIBDEF   _LVODOSCommand
         LIBDEF   _LVODOSRead
         LIBDEF   _LVODOSWrite
         LIBDEF   _LVOCreateDOSPkt
         LIBDEF   _LVODeleteDOSPkt
         LIBDEF   _LVOSendDOSPkt
         LIBDEF   _LVOWaitDOSPkt
         LIBDEF   _LVOFindDevice

         LIBDEF   _LVOAddClipNode
         LIBDEF   _LVORemClipNode
         LIBDEF   _LVOLockRexxBase
         LIBDEF   _LVOUnlockRexxBase

* Character attribute flag bits used in REXX.  Attributes are defined only
* for ASCII characters (range 0-127).
CTB_SPACE   EQU   0                    ; white space characters
CTB_DIGIT   EQU   1                    ; decimal digits 0-9
CTB_ALPHA   EQU   2                    ; alphabetic characters
CTB_REXXSYM EQU   3                    ; REXX symbol characters
CTB_REXXOPR EQU   4                    ; REXX operator characters
CTB_REXXSPC EQU   5                    ; REXX special symbols
CTB_UPPER   EQU   6                    ; UPPERCASE alphabetic
CTB_LOWER   EQU   7                    ; lowercase alphabetic

* Attribute flags
CTF_SPACE   EQU   1<<CTB_SPACE
CTF_DIGIT   EQU   1<<CTB_DIGIT
CTF_ALPHA   EQU   1<<CTB_ALPHA
CTF_REXXSYM EQU   1<<CTB_REXXSYM
CTF_REXXOPR EQU   1<<CTB_REXXOPR
CTF_REXXSPC EQU   1<<CTB_REXXSPC
CTF_UPPER   EQU   1<<CTB_UPPER
CTF_LOWER   EQU   1<<CTB_LOWER

         ENDC
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/rxslib.i"
fi
if [ `wc -c ./src/rexx/rxslib.i | awk '{printf $1}'` -ne 7722 ]
then
echo `wc -c ./src/rexx/rxslib.i | awk '{print "Got " $1 ", Expected " 7722}'`
fi
if `test ! -s ./src/rexx/rexxio.h`
then
echo "writing ./src/rexx/rexxio.h"
cat > ./src/rexx/rexxio.h << '\Rogue\Monster\'
/* === rexx/rexxio.h ====================================================
 *
 * Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
 *
 * ======================================================================
 * Header file for ARexx Input/Output related structures
 */

#ifndef REXX_REXXIO_H
#define REXX_REXXIO_H

#ifndef REXX_STORAGE_H
#include "rexx/storage.h"
#endif

#define RXBUFFSZ  204                  /* buffer length                 */

/* The IoBuff is a resource node used to maintain the File List.  Nodes are
 * allocated and linked into the list whenever a file is opened.
 */

struct IoBuff {
   struct RexxRsrc iobNode;            /* structure for files/strings   */
   APTR     iobRpt;                    /* read/write pointer            */
   LONG     iobRct;                    /* character count               */
   LONG     iobDFH;                    /* DOS filehandle                */
   APTR     iobLock;                   /* DOS lock                      */
   LONG     iobBct;                    /* buffer length                 */
   BYTE     iobArea[RXBUFFSZ];         /* buffer area                   */
   };                                  /* size: 256 bytes               */

/* Access mode definitions                                              */
#define RXIO_EXIST   -1                /* an external filehandle        */
#define RXIO_STRF    0                 /* a "string file"               */
#define RXIO_READ    1                 /* read-only access              */
#define RXIO_WRITE   2                 /* write mode                    */
#define RXIO_APPEND  3                 /* append mode (existing file)   */

/* Offset anchors for SeekF()                                           */
#define RXIO_BEGIN   -1                /* relative to start             */
#define RXIO_CURR    0                 /* relative to current position  */
#define RXIO_END     1                 /* relative to end               */

/* The Library List contains just plain resource nodes.                 */

#define LLOFFSET(rrp) (rrp->rr_Arg1)   /* "Query" offset                */
#define LLVERS(rrp)   (rrp->rr_Arg2)   /* library version               */

/* The RexxClipNode structure is used to maintain the Clip List.  The
 * value string is stored as an argstring in the rr_Arg1 field.
 */

#define CLVALUE(rrp) ((STRPTR) rrp->rr_Arg1)

/* A message port structure, maintained as a resource node.
 * The ReplyList holds packets that have been received but haven't been
 * replied.
 */

struct RexxMsgPort {
   struct RexxRsrc rmp_Node;           /* linkage node                  */
   struct MsgPort  rmp_Port;           /* the message port              */
   struct List     rmp_ReplyList;      /* messages awaiting reply       */
   };

/* DOS Device types                                                     */
#define DT_DEV    0                    /* a device                      */
#define DT_DIR    1                    /* an ASSIGNed directory         */
#define DT_VOL    2                    /* a volume                      */

/* Private DOS packet types                                             */
#define ACTION_STACK 2002              /* stack a line                  */
#define ACTION_QUEUE 2003              /* queue a line                  */

#endif
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/rexxio.h"
fi
if [ `wc -c ./src/rexx/rexxio.h | awk '{printf $1}'` -ne 3327 ]
then
echo `wc -c ./src/rexx/rexxio.h | awk '{print "Got " $1 ", Expected " 3327}'`
fi
if `test ! -s ./src/rexx/rexxio.i`
then
echo "writing ./src/rexx/rexxio.i"
cat > ./src/rexx/rexxio.i << '\Rogue\Monster\'
* === rexx/rexxio.i ====================================================
*
* Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
*
* ======================================================================
* Include file for Input/Output related structures

         IFND     REXX_REXXIO_I
REXX_REXXIO_I  SET   1

         IFND     REXX_STORAGE_I
         INCLUDE  "rexx/storage.i"
         ENDC

RXBUFFSZ EQU      204                  ; buffer length

* The IoBuff is a resource node used to maintain the File List.  Nodes are
* allocated and linked into the list whenever a file is opened.

         STRUCTURE IoBuff,rr_SIZEOF    ; structure for files/strings
         APTR     iobRpt               ; read/write pointer
         LONG     iobRct               ; character count
         LONG     iobDFH               ; DOS filehandle
         APTR     iobLock              ; DOS lock
         LONG     iobBct               ; buffer length
         STRUCT   iobArea,RXBUFFSZ     ; buffer area
         LABEL    iobSIZEOF            ; size: 256 bytes

IOBNAME  EQU      LN_NAME              ; logical name
IOBMODE  EQU      rr_Arg1              ; access mode
IOBEOF   EQU      rr_Arg1+1            ; EOF flag
IOBPOS   EQU      rr_Arg2              ; current position

* Access mode definitions
RXIO_EXIST  EQU      -1                ; an existing filehandle
RXIO_STRF   EQU      0                 ; a "string file"
RXIO_READ   EQU      1                 ; read-only access
RXIO_WRITE  EQU      2                 ; write mode
RXIO_APPEND EQU      3                 ; append mode (existing file)

* Offset anchors for SeekF()
RXIO_BEGIN  EQU      -1                ; relative to start
RXIO_CURR   EQU      0                 ; relative to current position
RXIO_END    EQU      1                 ; relative to end

* The Library List contains just plain resource nodes.
LLOFFSET EQU      rr_Arg1              ; "Query" offset
LLVERS   EQU      rr_Arg2              ; library version

* The RexxClipNode structure is used to maintain the Clip List.  The
* value string is stored as an argstring in the rr_Arg1 field.
CLVALUE  EQU      rr_Arg1              ; value string

* A message port structure, maintained as a resource node.
* The ReplyList holds packets that have been received but haven't been
* replied.

         STRUCTURE RexxMsgPort,rr_SIZEOF
         STRUCT   rmp_Port,MP_SIZE           ; the message port
         STRUCT   rmp_ReplyList,LH_SIZE      ; messages awaiting reply 
         LABEL    rmp_SIZEOF

* Device types
DT_DEV   EQU      0                    ; a device
DT_DIR   EQU      1                    ; an ASSIGNed directory
DT_VOL   EQU      2                    ; a volume

* Private packet types
ACTION_STACK   EQU   2002              ; stack a line
ACTION_QUEUE   EQU   2003              ; queue a line

         ENDC
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/rexxio.i"
fi
if [ `wc -c ./src/rexx/rexxio.i | awk '{printf $1}'` -ne 2853 ]
then
echo `wc -c ./src/rexx/rexxio.i | awk '{print "Got " $1 ", Expected " 2853}'`
fi
if `test ! -s ./src/rexx/errors.h`
then
echo "writing ./src/rexx/errors.h"
cat > ./src/rexx/errors.h << '\Rogue\Monster\'
/* == errors.h =========================================================
 *
 * Copyright (c) 1987 by William S. Hawes (All Rights Reserved)
 * 
 * =====================================================================
 * Definitions for ARexx error codes
 */

#define ERRC_MSG  0                    /*  error code offset           */
#define ERR10_001 (ERRC_MSG+1)         /*  program not found           */
#define ERR10_002 (ERRC_MSG+2)         /*  execution halted            */
#define ERR10_003 (ERRC_MSG+3)         /*  no memory available         */
#define ERR10_004 (ERRC_MSG+4)         /*  invalid character in program*/
#define ERR10_005 (ERRC_MSG+5)         /*  unmatched quote             */
#define ERR10_006 (ERRC_MSG+6)         /*  unterminated comment        */
#define ERR10_007 (ERRC_MSG+7)         /*  clause too long             */
#define ERR10_008 (ERRC_MSG+8)         /*  unrecognized token          */
#define ERR10_009 (ERRC_MSG+9)         /*  symbol or string too long   */

#define ERR10_010 (ERRC_MSG+10)        /*  invalid message packet      */
#define ERR10_011 (ERRC_MSG+11)        /*  command string error        */
#define ERR10_012 (ERRC_MSG+12)        /*  error return from function  */
#define ERR10_013 (ERRC_MSG+13)        /*  host environment not found  */
#define ERR10_014 (ERRC_MSG+14)        /*  required library not found  */
#define ERR10_015 (ERRC_MSG+15)        /*  function not found          */
#define ERR10_016 (ERRC_MSG+16)        /*  no return value             */
#define ERR10_017 (ERRC_MSG+17)        /*  wrong number of arguments   */
#define ERR10_018 (ERRC_MSG+18)        /*  invalid argument to function*/
#define ERR10_019 (ERRC_MSG+19)        /*  invalid PROCEDURE           */

#define ERR10_020 (ERRC_MSG+20)        /*  unexpected THEN/ELSE        */
#define ERR10_021 (ERRC_MSG+21)        /*  unexpected WHEN/OTHERWISE   */
#define ERR10_022 (ERRC_MSG+22)        /*  unexpected LEAVE or ITERATE */
#define ERR10_023 (ERRC_MSG+23)        /*  invalid statement in SELECT */
#define ERR10_024 (ERRC_MSG+24)        /*  missing THEN clauses        */
#define ERR10_025 (ERRC_MSG+25)        /*  missing OTHERWISE           */
#define ERR10_026 (ERRC_MSG+26)        /*  missing or unexpected END   */
#define ERR10_027 (ERRC_MSG+27)        /*  symbol mismatch on END      */
#define ERR10_028 (ERRC_MSG+28)        /*  invalid DO syntax           */
#define ERR10_029 (ERRC_MSG+29)        /*  incomplete DO/IF/SELECT     */

#define ERR10_030 (ERRC_MSG+30)        /*  label not found             */
#define ERR10_031 (ERRC_MSG+31)        /*  symbol expected             */
#define ERR10_032 (ERRC_MSG+32)        /*  string or symbol expected   */
#define ERR10_033 (ERRC_MSG+33)        /*  invalid sub-keyword         */
#define ERR10_034 (ERRC_MSG+34)        /*  required keyword missing    */
#define ERR10_035 (ERRC_MSG+35)        /*  extraneous characters       */
#define ERR10_036 (ERRC_MSG+36)        /*  sub-keyword conflict        */
#define ERR10_037 (ERRC_MSG+37)        /*  invalid template            */
#define ERR10_038 (ERRC_MSG+38)        /*  invalid TRACE request       */
#define ERR10_039 (ERRC_MSG+39)        /*  uninitialized variable      */

#define ERR10_040 (ERRC_MSG+40)        /*  invalid variable name       */
#define ERR10_041 (ERRC_MSG+41)        /*  invalid expression          */
#define ERR10_042 (ERRC_MSG+42)        /*  unbalanced parentheses      */
#define ERR10_043 (ERRC_MSG+43)        /*  nesting level exceeded      */
#define ERR10_044 (ERRC_MSG+44)        /*  invalid expression result   */
#define ERR10_045 (ERRC_MSG+45)        /*  expression required         */
#define ERR10_046 (ERRC_MSG+46)        /*  boolean value not 0 or 1    */
#define ERR10_047 (ERRC_MSG+47)        /*  arithmetic conversion error */
#define ERR10_048 (ERRC_MSG+48)        /*  invalid operand             */

/* Return Codes for general use ...                                    */
#define RC_FAIL   -1                   /*  something's wrong           */
#define RC_OK     0                    /*  success                     */
#define RC_WARN   5                    /*  warning only                */
#define RC_ERROR  10                   /*  something's wrong           */
#define RC_FATAL  20                   /*  complete or severe failure  */
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/errors.h"
fi
if [ `wc -c ./src/rexx/errors.h | awk '{printf $1}'` -ne 4334 ]
then
echo `wc -c ./src/rexx/errors.h | awk '{print "Got " $1 ", Expected " 4334}'`
fi
if `test ! -s ./src/rexx/errors.i`
then
echo "writing ./src/rexx/errors.i"
cat > ./src/rexx/errors.i << '\Rogue\Monster\'
* ========================     errors.i     =============================
* Definitions for Rexx error codes

ERRC_MSG    EQU   0                 ; error code offset
ERR10_001   EQU   (ERRC_MSG+1)      ; Program not found
ERR10_002   EQU   (ERRC_MSG+2)      ; execution halted
ERR10_003   EQU   (ERRC_MSG+3)      ; no memory available
ERR10_004   EQU   (ERRC_MSG+4)      ; invalid character in program
ERR10_005   EQU   (ERRC_MSG+5)      ; unmatched quote
ERR10_006   EQU   (ERRC_MSG+6)      ; unterminated comment
ERR10_007   EQU   (ERRC_MSG+7)      ; clause too long
ERR10_008   EQU   (ERRC_MSG+8)      ; unrecognized token
ERR10_009   EQU   (ERRC_MSG+9)      ; symbol or string too long

ERR10_010   EQU   (ERRC_MSG+10)     ; invalid message packet
ERR10_011   EQU   (ERRC_MSG+11)     ; command string error
ERR10_012   EQU   (ERRC_MSG+12)     ; error return from function
ERR10_013   EQU   (ERRC_MSG+13)     ; host environment not found
ERR10_014   EQU   (ERRC_MSG+14)     ; required library not available
ERR10_015   EQU   (ERRC_MSG+15)     ; function not found
ERR10_016   EQU   (ERRC_MSG+16)     ; function did not return value
ERR10_017   EQU   (ERRC_MSG+17)     ; wrong number of arguments
ERR10_018   EQU   (ERRC_MSG+18)     ; invalid argument to function
ERR10_019   EQU   (ERRC_MSG+19)     ; invalid PROCEDURE instruction

ERR10_020   EQU   (ERRC_MSG+20)     ; unexpected THEN/ELSE
ERR10_021   EQU   (ERRC_MSG+21)     ; unexpected WHEN/OTHERWISE
ERR10_022   EQU   (ERRC_MSG+22)     ; unexpected BREAK, LEAVE or ITERATE
ERR10_023   EQU   (ERRC_MSG+23)     ; invalid statement in SELECT
ERR10_024   EQU   (ERRC_MSG+24)     ; missing or multiple THEN clauses
ERR10_025   EQU   (ERRC_MSG+25)     ; missing OTHERWISE
ERR10_026   EQU   (ERRC_MSG+26)     ; missing or unexpected END
ERR10_027   EQU   (ERRC_MSG+27)     ; symbol mismatch on END/LEAVE/ITERATE
ERR10_028   EQU   (ERRC_MSG+28)     ; invalid 'DO' syntax
ERR10_029   EQU   (ERRC_MSG+29)     ; incomplete DO/IF/SELECT

ERR10_030   EQU   (ERRC_MSG+30)     ; label not found
ERR10_031   EQU   (ERRC_MSG+31)     ; symbol expected
ERR10_032   EQU   (ERRC_MSG+32)     ; string or symbol expected
ERR10_033   EQU   (ERRC_MSG+33)     ; invalid sub-keyword
ERR10_034   EQU   (ERRC_MSG+34)     ; required keyword missing
ERR10_035   EQU   (ERRC_MSG+35)     ; extraneous characters in clause
ERR10_036   EQU   (ERRC_MSG+36)     ; sub-keyword conflict
ERR10_037   EQU   (ERRC_MSG+37)     ; invalid template
ERR10_038   EQU   (ERRC_MSG+38)     ; invalid TRACE request
ERR10_039   EQU   (ERRC_MSG+39)     ; uninitialized variable

ERR10_040   EQU   (ERRC_MSG+40)     ; invalid variable name
ERR10_041   EQU   (ERRC_MSG+41)     ; invalid expression
ERR10_042   EQU   (ERRC_MSG+42)     ; unbalanced parentheses
ERR10_043   EQU   (ERRC_MSG+43)     ; nesting level exceeded
ERR10_044   EQU   (ERRC_MSG+44)     ; invalid expression result
ERR10_045   EQU   (ERRC_MSG+45)     ; expression required
ERR10_046   EQU   (ERRC_MSG+46)     ; boolean value not 0 or 1
ERR10_047   EQU   (ERRC_MSG+47)     ; arithmetic conversion error
ERR10_048   EQU   (ERRC_MSG+48)     ; invalid operand

* Return Codes for general use ...
RC_FAIL     EQU   -1                ; something's wrong
RC_OK       EQU   0                 ; success
RC_WARN     EQU   5                 ; A warning only
RC_ERROR    EQU   10                ; Something wrong
RC_FATAL    EQU   20                ; Complete or severe failure
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/errors.i"
fi
if [ `wc -c ./src/rexx/errors.i | awk '{printf $1}'` -ne 3437 ]
then
echo `wc -c ./src/rexx/errors.i | awk '{print "Got " $1 ", Expected " 3437}'`
fi
if `test ! -s ./src/rexx/rxsupplib.i`
then
echo "writing ./src/rexx/rxsupplib.i"
cat > ./src/rexx/rxsupplib.i << '\Rogue\Monster\'
* === rxsupplib.i ======================================================
*
* Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
*
* ======================================================================
* 
* Include file for Rexx Support Library

         IFND     REXX_RXSUPPLIB_I
REXX_RXSUPPLIB_I  SET   1

         IFND     REXX_STORAGE_I
         INCLUDE  "rexx/storage.i"
         ENDC

         IFND     REXX_RXSLIB_I
         INCLUDE  "rexx/rxslib.i"
         ENDC

* Structure definition for the Rexx Support Library
         STRUCTURE RexxSupport,LIB_SIZE
         APTR     rs_SysBase           ; EXEC base
         APTR     rs_REXXBase          ; Rexx System Library base
         LONG     rs_SegList           ; library seglist
         LABEL    rs_SIZEOF

RSNAME   MACRO
         dc.b     'rexxsupport.library',0
         ENDM

RSID     MACRO
         dc.b     'rexxsupport 1.0 (22 AUG 87)',13,10,0
         ENDM

RSVERS   EQU   2
RSREV    EQU   1

* Various system constants
MemList     EQU   $142                 ; Memory list
DeviceList  EQU   $15E                 ; Devices list
LibList     EQU   $17A                 ; Libraries list
PortList    EQU   $188                 ; Ports list
ReadyList   EQU   $196                 ; Ready Tasks
WaitList    EQU   $1A4                 ; Waiting Tasks

         ENDC
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/rxsupplib.i"
fi
if [ `wc -c ./src/rexx/rxsupplib.i | awk '{printf $1}'` -ne 1342 ]
then
echo `wc -c ./src/rexx/rxsupplib.i | awk '{print "Got " $1 ", Expected " 1342}'`
fi
if `test ! -s ./src/rexx/storage.h`
then
echo "writing ./src/rexx/storage.h"
cat > ./src/rexx/storage.h << '\Rogue\Monster\'
/* === rexx/storage.h ==================================================
 *
 * Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
 *
 * =====================================================================
 * Header file to define ARexx data structures.
 */

#ifndef REXX_STORAGE_H
#define REXX_STORAGE_H

#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif

#ifndef EXEC_NODES_H
#include "exec/nodes.h"
#endif

#ifndef EXEC_LISTS_H
#include "exec/lists.h"
#endif

#ifndef EXEC_PORTS_H
#include "exec/ports.h"
#endif

#ifndef EXEC_LIBRARIES_H
#include "exec/libraries.h"
#endif

/* The RexxStr structure is used to maintain the internal strings in REXX.
 * It includes the buffer area for the string and associated attributes.
 * This is actually a variable-length structure; it is allocated for a
 * specific length string, and the length is never modified thereafter
 * (since it's used for recycling).
 */

struct NexxStr {
   LONG     ns_Ivalue;                 /* integer value                 */
   UWORD    ns_Length;                 /* length in bytes (excl null)   */
   UBYTE    ns_Flags;                  /* attribute flags               */
   UBYTE    ns_Hash;                   /* hash code                     */
   BYTE     ns_Buff[8];                /* buffer area for strings       */
   };                                  /* size: 16 bytes (minimum)      */

#define NXADDLEN 9                     /* offset plus null byte         */
#define IVALUE(nsPtr) (nsPtr->ns_Ivalue)

/* String attribute flag bit definitions                                */
#define NSB_KEEP     0                 /* permanent string?             */
#define NSB_STRING   1                 /* string form valid?            */
#define NSB_NOTNUM   2                 /* non-numeric?                  */
#define NSB_NUMBER   3                 /* a valid number?               */
#define NSB_BINARY   4                 /* integer value saved?          */
#define NSB_FLOAT    5                 /* floating point format?        */
#define NSB_EXT      6                 /* an external string?           */
#define NSB_SOURCE   7                 /* part of the program source?   */

/* The flag form of the string attributes                               */
#define NSF_KEEP     (1 << NSB_KEEP  )
#define NSF_STRING   (1 << NSB_STRING)
#define NSF_NOTNUM   (1 << NSB_NOTNUM)
#define NSF_NUMBER   (1 << NSB_NUMBER)
#define NSF_BINARY   (1 << NSB_BINARY)
#define NSF_FLOAT    (1 << NSB_FLOAT )
#define NSF_EXT      (1 << NSB_EXT   )
#define NSF_SOURCE   (1 << NSB_SOURCE)

/* Combinations of flags                                                */
#define NSF_INTNUM   (NSF_NUMBER | NSF_BINARY | NSF_STRING)
#define NSF_DPNUM    (NSF_NUMBER | NSF_FLOAT)
#define NSF_ALPHA    (NSF_NOTNUM | NSF_STRING)
#define NSF_OWNED    (NSF_SOURCE | NSF_EXT | NSF_KEEP)
#define KEEPSTR      (NSF_STRING | NSF_SOURCE | NSF_NOTNUM)
#define KEEPNUM      (NSF_STRING | NSF_SOURCE | NSF_NUMBER | NSF_BINARY)

/* The RexxArg structure is identical to the NexxStr structure, but
 * is allocated from system memory rather than from internal storage.
 * This structure is used for passing arguments to external programs.
 * It is usually passed as an "argstring", a pointer to the string buffer.
 */
struct RexxArg {
   LONG     ra_Size;                   /* total allocated length        */
   UWORD    ra_Length;                 /* length of string              */
   UBYTE    ra_Flags;                  /* attribute flags               */
   UBYTE    ra_Hash;                   /* hash code                     */
   BYTE     ra_Buff[8];                /* buffer area                   */
   };                                  /* size: 16 bytes (minimum)      */

/* The RexxMsg structure is used for all communications with Rexx programs.
 * It is an EXEC message with a parameter block appended.
 */

struct RexxMsg {
   struct Message rm_Node;             /* EXEC message structure        */
   APTR     rm_TaskBlock;              /* pointer to global structure   */
   APTR     rm_LibBase;                /* library base                  */
   LONG     rm_Action;                 /* command (action) code         */
   LONG     rm_Result1;                /* primary result (return code)  */
   LONG     rm_Result2;                /* secondary result              */
   STRPTR   rm_Args[16];               /* argument block (ARG0-ARG15)   */

   struct MsgPort *rm_PassPort;        /* forwarding port               */
   STRPTR   rm_CommAddr;               /* host address (port name)      */
   STRPTR   rm_FileExt;                /* file extension                */
   LONG     rm_Stdin;                  /* input stream (filehandle)     */
   LONG     rm_Stdout;                 /* output stream (filehandle)    */
   LONG     rm_avail;                  /* future expansion              */
   };                                  /* size: 128 bytes               */


/* Field definitions                                                    */
#define ARG0(rmp) (rmp->rm_Args[0])    /* start of argblock             */
#define ARG1(rmp) (rmp->rm_Args[1])    /* first argument                */
#define ARG2(rmp) (rmp->rm_Args[2])    /* second argument               */

#define MAXRMARG  15                   /* maximum arguments             */

/* Command (action) codes for message packets                           */
#define RXCOMM    0x01000000           /* a command-level invocation    */
#define RXFUNC    0x02000000           /* a function call               */
#define RXCLOSE   0x03000000           /* close the port                */
#define RXQUERY   0x04000000           /* query for information         */
#define RXADDFH   0x07000000           /* add a function host           */
#define RXADDLIB  0x08000000           /* add a function library        */
#define RXREMLIB  0x09000000           /* remove a function library     */
#define RXADDCON  0x0A000000           /* add/update a ClipList string  */
#define RXREMCON  0x0B000000           /* remove a ClipList string      */
#define RXTCOPN   0x0C000000           /* open the trace console        */
#define RXTCCLS   0x0D000000           /* close the trace console       */

/* Command modifier flag bits                                           */
#define RXFB_NOIO    16                /* suppress I/O inheritance?     */
#define RXFB_RESULT  17                /* result string expected?       */
#define RXFB_STRING  18                /* program is a "string file"?   */
#define RXFB_TOKEN   19                /* tokenize the command line?    */
#define RXFB_NONRET  20                /* a "no-return" message?        */

/* Modifier flags                                                       */
#define RXFF_RESULT  (1 << RXFB_RESULT)
#define RXFF_STRING  (1 << RXFB_STRING)
#define RXFF_TOKEN   (1 << RXFB_TOKEN )
#define RXFF_NONRET  (1 << RXFB_NONRET)

#define RXCODEMASK   0xFF000000
#define RXARGMASK    0x0000000F

/* The RexxRsrc structure is used to manage global resources.
 * The name string for each node is created as a RexxArg structure,
 * and the total size of the node is saved in the "rr_Size" field.
 * Functions are provided to allocate and release resource nodes.
 * If special deletion operations are required, an offset and base can
 * be provided in "rr_Func" and "rr_Base", respectively.  This function
 * will be called with the base in register A6 and the node in A0.
 */

struct RexxRsrc {
   struct Node rr_Node;
   WORD     rr_Func;                   /* "auto-delete" offset          */
   APTR     rr_Base;                   /* "auto-delete" base            */
   LONG     rr_Size;                   /* total size of node            */
   LONG     rr_Arg1;                   /* available ...                 */
   LONG     rr_Arg2;                   /* available ...                 */
   };                                  /* size: 32 bytes                */

/* Resource node types                                                  */
#define RRT_ANY      0                 /* any node type ...             */
#define RRT_LIB      1                 /* a function library            */
#define RRT_PORT     2                 /* a public port                 */
#define RRT_FILE     3                 /* a file IoBuff                 */
#define RRT_HOST     4                 /* a function host               */
#define RRT_CLIP     5                 /* a Clip List node              */

/* The RexxTask structure holds the fields used by REXX to communicate with
 * external processes, including the client task.  It includes the global
 * data structure (and the base environment).  The structure is passed to
 * the newly-created task in its "wake-up" message.
 */

#define GLOBALSZ  200                  /* total size of GlobalData      */

struct RexxTask {
   BYTE     rt_Global[GLOBALSZ];       /* global data structure         */
   struct MsgPort rt_MsgPort;          /* global message port           */
   UBYTE    rt_Flags;                  /* task flag bits                */
   BYTE     rt_SigBit;                 /* signal bit                    */

   APTR     rt_ClientID;               /* the client's task ID
   APTR     rt_MsgPkt;                 /* the packet being processed
   APTR     rt_TaskID;                 /* our task ID
   APTR     rt_RexxPort;               /* the REXX public port

   APTR     rt_ErrTrap;                /* Error trap address
   APTR     rt_StackPtr;               /* stack pointer for traps

   struct List rt_Header1;             /* Environment list              */
   struct List rt_Header2;             /* Memory freelist               */
   struct List rt_Header3;             /* Memory allocation list        */
   struct List rt_Header4;             /* Files list                    */
   struct List rt_Header5;             /* Message Ports List            */
   };

/* Definitions for RexxTask flag bits                                   */
#define RTFB_TRACE   0                 /* external trace flag           */
#define RTFB_HALT    1                 /* external halt flag            */
#define RTFB_SUSP    2                 /* suspend task?                 */
#define RTFB_TCUSE   3                 /* trace console in use?         */
#define RTFB_WAIT    6                 /* waiting for reply?            */
#define RTFB_CLOSE   7                 /* task completed?               */

/* Definitions for memory allocation constants                          */
#define MEMQUANT  16                   /* quantum of memory space       */
#define MEMMASK   0xFFFFFFF0           /* mask for rounding the size    */

#define MEMQUICK  (1 << 0 )            /* EXEC flags: MEMF_PUBLIC       */
#define MEMCLEAR  (1 << 16)            /* EXEC flags: MEMF_CLEAR        */

/* The SrcNode is a temporary structure used to hold values destined for a
 * segment array.  It is also used to maintain the memory freelist.
 */

struct SrcNode {
   struct SrcNode *sn_Succ;            /* next node                     */
   struct SrcNode *sn_Pred;
   APTR     sn_Ptr;                    /* pointer value                 */
   LONG     sn_Size;                   /* size of object                */
   };                                  /* size: 16 bytes                */

#endif
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/storage.h"
fi
if [ `wc -c ./src/rexx/storage.h | awk '{printf $1}'` -ne 11323 ]
then
echo `wc -c ./src/rexx/storage.h | awk '{print "Got " $1 ", Expected " 11323}'`
fi
if `test ! -s ./src/rexx/storage.i`
then
echo "writing ./src/rexx/storage.i"
cat > ./src/rexx/storage.i << '\Rogue\Monster\'
* === rexx/storage.i ===================================================
*
* Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
*
* ======================================================================
* Include file for REXX data structures and memory/storage management.

         IFND REXX_STORAGE_I
REXX_STORAGE_I SET   1

         IFND EXEC_TYPES_I
         INCLUDE "exec/types.i"
         ENDC

         IFND EXEC_NODES_I
         INCLUDE "exec/nodes.i"
         ENDC

         IFND EXEC_LISTS_I
         INCLUDE "exec/lists.i"
         ENDC

         IFND EXEC_PORTS_I
         INCLUDE "exec/ports.i"
         ENDC

         IFND EXEC_LIBRARIES_I
         INCLUDE "exec/libraries.i"
         ENDC

* The NexxStr structure is used to maintain the internal strings in REXX.
* It includes the buffer area for the string and associated attributes.
* This is actually a variable-length structure; it is allocated for a
* specific length string, and the length is never modified thereafter
* (since it's used for recycling).

         STRUCTURE NexxStr,0
         LONG     ns_Ivalue            ; integer value
         UWORD    ns_Length            ; length in bytes (excl null byte)
         UBYTE    ns_Flags             ; attribute flags
         UBYTE    ns_Hash              ; sum-of-characters hash code
         STRUCT   ns_Buff,8            ; buffer area for strings
         LABEL    ns_SIZEOF            ; size: 16 bytes (minimum)

NXADDLEN EQU      9                    ; structure offset plus null byte
IVALUE   EQU      ns_Ivalue            ; integer value

* String attribute flag bit definitions
NSB_KEEP    EQU   0                    ; permanent string? (in Symbol Table)
NSB_STRING  EQU   1                    ; string form valid?
NSB_NOTNUM  EQU   2                    ; non-numeric?
NSB_NUMBER  EQU   3                    ; a valid number?
NSB_BINARY  EQU   4                    ; integer value saved?
NSB_FLOAT   EQU   5                    ; floating point format?
NSB_EXT     EQU   6                    ; an external string?
NSB_SOURCE  EQU   7                    ; part of the program source?

* The flag form of the string attributes
NSF_KEEP    EQU   1<<NSB_KEEP
NSF_STRING  EQU   1<<NSB_STRING
NSF_NOTNUM  EQU   1<<NSB_NOTNUM
NSF_NUMBER  EQU   1<<NSB_NUMBER
NSF_BINARY  EQU   1<<NSB_BINARY
NSF_FLOAT   EQU   1<<NSB_FLOAT
NSF_EXT     EQU   1<<NSB_EXT
NSF_SOURCE  EQU   1<<NSB_SOURCE

* Combinations of flags 
NSF_INTNUM  EQU   (NSF_NUMBER!NSF_BINARY!NSF_STRING)
NSF_DPNUM   EQU   (NSF_NUMBER!NSF_FLOAT)
NSF_ALPHA   EQU   (NSF_NOTNUM!NSF_STRING)
NSF_OWNED   EQU   (NSF_SOURCE!NSF_EXT!NSF_KEEP)
KEEPSTR     EQU   (NSF_STRING!NSF_SOURCE!NSF_NOTNUM)
KEEPNUM     EQU   (NSF_STRING!NSF_SOURCE!NSF_NUMBER!NSF_BINARY)

* The RexxArg structure is identical to the NexxStr structure, but
* is allocated from system memory rather than from internal storage.
* This structure is used for passing arguments to external programs.
* It is usually passed as an "argstring", a pointer to the string buffer.

         STRUCTURE RexxArg,0
         LONG     ra_Size              ; total allocated length
         UWORD    ra_Length            ; length of string
         UBYTE    ra_Flags             ; attribute flags
         UBYTE    ra_Hash              ; hash code
         STRUCT   ra_Buff,8            ; buffer area
         LABEL    ra_SIZEOF            ; size: 16 bytes

* The RexxMsg structure is used for all communications with Rexx programs.
* It is an EXEC message with a parameter block appended.

         STRUCTURE RexxMsg,MN_SIZE
         APTR     rm_TaskBlock         ; pointer to RexxTask structure
         APTR     rm_LibBase           ; library pointer
         LONG     rm_Action            ; command (action) code
         LONG     rm_Result1           ; return code
         LONG     rm_Result2           ; secondary result
         STRUCT   rm_Args,16*4         ; argument block (ARG0-ARG15)
         APTR     rm_PassPort          ; forwarding port
         APTR     rm_CommAddr          ; host address (port name)
         APTR     rm_FileExt           ; file extension
         LONG     rm_Stdin             ; input stream
         LONG     rm_Stdout            ; output stream
         LONG     rm_avail             ; future expansion
         LABEL    rm_SIZEOF            ; size: 128 bytes

* Field definitions
ACTION   EQU      rm_Action            ; action code
RESULT1  EQU      rm_Result1           ; primary return/error level
RESULT2  EQU      rm_Result2           ; secondary return/result string
ARG0     EQU      rm_Args              ; start of argblock
ARG1     EQU      rm_Args+4            ; first argument
ARG2     EQU      rm_Args+8            ; second argument

MAXRMARG EQU      15                   ; maximum arguments

* Command (action) codes for message packets
RXCOMM   EQU      $01000000            ; a command-level invocation
RXFUNC   EQU      $02000000            ; a function call
RXCLOSE  EQU      $03000000            ; close the port
RXQUERY  EQU      $04000000            ; query for information
RXADDFH  EQU      $07000000            ; add a function host
RXADDLIB EQU      $08000000            ; add a function library
RXREMLIB EQU      $09000000            ; remove a function library
RXADDCON EQU      $0A000000            ; add/update a ClipList string
RXREMCON EQU      $0B000000            ; remove a ClipList string
RXTCOPN  EQU      $0C000000            ; open the trace console
RXTCCLS  EQU      $0D000000            ; close the trace console

* Command modifier flag bits
RXFB_NOIO   EQU   16                   ; suppress I/O inheritance?
RXFB_RESULT EQU   17                   ; result string expected?
RXFB_STRING EQU   18                   ; program is a "string file"?
RXFB_TOKEN  EQU   19                   ; tokenize the command line?
RXFB_NONRET EQU   20                   ; a "no-return" message?

* Modifier flags
RXFF_RESULT EQU   1<<RXFB_RESULT
RXFF_STRING EQU   1<<RXFB_STRING
RXFF_TOKEN  EQU   1<<RXFB_TOKEN
RXFF_NONRET EQU   1<<RXFB_NONRET

RXCODEMASK  EQU   $FF000000
RXARGMASK   EQU   $0000000F

* The RexxRsrc structure is used to manage global resources.
* The name string for each node is created as a RexxArg structure,
* and the total size of the node is saved in the "rr_Size" field.
* Functions are provided to allocate and release resource nodes.
* If special deletion operations are required, an offset and base can
* be provided in "rr_Func" and "rr_Base", respectively.  This function
* will be called with the base in register A6 and the node in A0.

         STRUCTURE RexxRsrc,LN_SIZE
         WORD     rr_Func              ; "auto-delete" offset
         APTR     rr_Base              ; "auto-delete" base
         LONG     rr_Size              ; total size of node
         LONG     rr_Arg1              ; available ...
         LONG     rr_Arg2              ; available ...
         LABEL    rr_SIZEOF            ; size: 32 bytes

* Field definitions
RRTYPE   EQU      LN_TYPE              ; node type
RRNAME   EQU      LN_NAME              ; node name (argstring)
RRSIZE   EQU      rr_Size              ; total size of node

* Resource node types
RRT_ANY  EQU      0                    ; any node type ...
RRT_LIB  EQU      1                    ; a function library
RRT_PORT EQU      2                    ; a public port
RRT_FILE EQU      3                    ; a file IoBuff
RRT_HOST EQU      4                    ; a function host
RRT_CLIP EQU      5                    ; a Clip List node

* The RexxTask structure holds the fields used by REXX to communicate with
* external processes, including the client task.  It includes the global
* data structure (and the base environment).  The structure is passed to
* the newly-created task in its "wake-up" message.

GLOBALSZ EQU      200                  ; space for the Global Data structure

         STRUCTURE RexxTask,GLOBALSZ   ; global data structure
         STRUCT   rt_MsgPort,MP_SIZE   ; message port
         UBYTE    rt_Flags             ; task flag bits
         BYTE     rt_SigBit            ; signal bit 

         APTR     rt_ClientID          ; the client's task ID
         APTR     rt_MsgPkt            ; the packet being processed
         APTR     rt_TaskID            ; our task ID
         APTR     rt_RexxPort          ; the REXX public port

         APTR     rt_ErrTrap           ; Error trap address
         APTR     rt_StackPtr          ; stack pointer for traps

         STRUCT   rt_Header1,LH_SIZE
         STRUCT   rt_Header2,LH_SIZE
         STRUCT   rt_Header3,LH_SIZE
         STRUCT   rt_Header4,LH_SIZE
         STRUCT   rt_Header5,LH_SIZE
         LABEL    rt_SIZEOF

ENVLIST  EQU      rt_Header1           ; environment list (internal)
FREELIST EQU      rt_Header2           ; freelist (internal)
MEMLIST  EQU      rt_Header3           ; allocation list (external)
FILELIST EQU      rt_Header4           ; I/O files list (external)
PORTLIST EQU      rt_Header5           ; message ports list (external)
NUMLISTS EQU      5

* Definitions for RexxTask flag bits
RTFB_TRACE  EQU      0                 ; external trace flag
RTFB_HALT   EQU      1                 ; external halt flag
RTFB_SUSP   EQU      2                 ; suspend task?
RTFB_TCUSE  EQU      3                 ; trace console in use?
RTFB_WAIT   EQU      6                 ; waiting for reply?
RTFB_CLOSE  EQU      7                 ; task completed?

* Definitions for memory allocation constants
MEMQUANT EQU      16                   ; quantum of memory space
MEMMASK  EQU      $FFFFFFF0            ; mask for rounding the size

MEMQUICK EQU      (1<<0)               ; EXEC flags: MEMF_PUBLIC
MEMCLEAR EQU      (1<<16)              ; EXEC flags: MEMF_CLEAR

* The SrcNode is a temporary structure used to hold values destined for a
* segment array.  It is also used to maintain the memory freelist.

         STRUCTURE SrcNode,0           ; temporary source data structure
         APTR     sn_Succ
         APTR     sn_Pred
         APTR     sn_Ptr               ; pointer value
         LONG     sn_Size              ; size of object
         LABEL    sn_SIZEOF            ; size: 16 bytes

         ENDC
\Rogue\Monster\
else
  echo "will not over write ./src/rexx/storage.i"
fi
if [ `wc -c ./src/rexx/storage.i | awk '{printf $1}'` -ne 10195 ]
then
echo `wc -c ./src/rexx/storage.i | awk '{print "Got " $1 ", Expected " 10195}'`
fi
if `test ! -s ./src/tags`
then
echo "writing ./src/tags"
cat > ./src/tags << '\Rogue\Monster\'
setpen cmd1.c /^setpen(
text_init cmd1.c /^text_init(
text_switch cmd1.c /^text_switch(
text_sync cmd1.c /^text_sync(
text_load cmd1.c /^text_load(
text_colno cmd1.c /^text_colno(
text_lineno cmd1.c /^text_lineno(
text_lines cmd1.c /^text_lines(
text_cols cmd1.c /^text_cols(
text_imode cmd1.c /^text_imode(
text_tabsize cmd1.c /^text_tabsize(
text_name cmd1.c /^text_name(
text_uninit cmd1.c /^text_uninit(
inversemode cmd1.c /^inversemode(
text_cursor cmd1.c /^text_cursor(
text_position cmd1.c /^text_position(
displayblock cmd1.c /^displayblock(
text_redrawblock cmd1.c /^text_redrawblock(
text_displayseg cmd1.c /^text_displayseg(
text_redisplay cmd1.c /^text_redisplay(
text_redisplaycurrline cmd1.c /^text_redisplaycurrline(
text_write cmd1.c /^text_write(
do_up cmd1.c /^do_up(
do_scrolldown cmd1.c /^do_scrolldown(
do_scrollup cmd1.c /^do_scrollup(
do_down cmd1.c /^do_down(
do_page cmd1.c /^do_page(
do_downadd cmd1.c /^do_downadd(
do_left cmd1.c /^do_left(
do_right cmd1.c /^do_right(
do_tab cmd1.c /^do_tab(
do_backtab cmd1.c /^do_backtab(
do_return cmd1.c /^do_return(
do_bs cmd1.c /^do_bs(
do_recall cmd1.c /^do_recall(
do_esc cmd1.c /^do_esc(
escapecomlinemode cmd1.c /^escapecomlinemode(
do_del cmd1.c /^do_del(
do_top cmd1.c /^do_top(
do_bottom cmd1.c /^do_bottom(
do_firstcolumn cmd1.c /^do_firstcolumn(
do_firstnb cmd1.c /^do_firstnb(
do_lastcolumn cmd1.c /^do_lastcolumn(
do_goto cmd1.c /^do_goto(
do_screentop cmd1.c /^do_screentop(
do_screenbottom cmd1.c /^do_screenbottom(
do_findstr cmd1.c /^do_findstr(
do_findr cmd1.c /^do_findr(
do_find cmd1.c /^do_find(
search_operation cmd1.c /^search_operation(
uninit_init cmd2.c /^uninit_init(
do_remeol cmd2.c /^do_remeol(
do_wleft cmd2.c /^do_wleft(
do_wright cmd2.c /^do_wright(
do_split cmd2.c /^do_split(
do_join cmd2.c /^do_join(
do_margin cmd2.c /^do_margin(
do_wordwrap cmd2.c /^do_wordwrap(
do_reformat cmd2.c /^do_reformat(
do_tabstop cmd2.c /^do_tabstop(
do_insertmode cmd2.c /^do_insertmode(
do_insline cmd2.c /^do_insline(
do_deline cmd2.c /^do_deline(
do_chfilename cmd2.c /^do_chfilename(
do_edit cmd2.c /^do_edit(
do_bsave cmd2.c /^do_bsave(
do_save cmd2.c /^do_save(
do_savetabs cmd2.c /^do_savetabs(
do_saveas cmd2.c /^do_saveas(
do_block cmd2.c /^do_block(
blockok cmd2.c /^blockok(
do_bdelete cmd2.c /^do_bdelete(
do_bcopy cmd2.c /^do_bcopy(
do_bmove cmd2.c /^do_bmove(
do_if cmd2.c /^do_if(
do_toggle cmd2.c /^do_toggle(
do_tlate cmd2.c /^do_tlate(
do_bsource cmd2.c /^do_bsource(
do_scanf cmd2.c /^do_scanf(
movetocursor cmd2.c /^movetocursor(
extend cmd2.c /^extend(
makeroom cmd2.c /^makeroom(
freelist cmd2.c /^freelist(
do_setfont cmd3.c /^do_setfont(
do_ignorecase cmd3.c /^do_ignorecase(
init_command command.c /^init_command(
do_command command.c /^do_command(
do_null command.c /^do_null(
do_source command.c /^do_source(
do_quit command.c /^do_quit(
do_execute command.c /^do_execute(
do_repeat command.c /^do_repeat(
breakout command.c /^breakout(
do_arpinsfile filereq.c /^do_arpinsfile(
do_arpload filereq.c /^do_arpload(
do_arpsave filereq.c /^do_arpsave(
fixfile filereq.c /^fixfile(
splitpath filereq.c /^splitpath(
_LVOOldOpenLibrary filereq.c /^ 	jsr	_LVOOldOpenLibrary(
keyctl keyboard.c /^keyctl(
dealloc_hash keyboard.c /^dealloc_hash(
resethash keyboard.c /^resethash(
returnoveride keyboard.c /^returnoveride(
addhash keyboard.c /^addhash(
remhash keyboard.c /^remhash(
keyspectomacro keyboard.c /^keyspectomacro(
do_map keyboard.c /^do_map(
do_unmap keyboard.c /^do_unmap(
do_clearmap keyboard.c /^do_clearmap(
do_savemap keyboard.c /^do_savemap(
DeadKeyConvert keyboard.c /^DeadKeyConvert(
LN keyboard.c /^    LN(
cqtoa keyboard.c /^cqtoa(
get_codequal keyboard.c /^get_codequal(
main main.c /^main(
do_iconify main.c /^do_iconify(
do_tomouse main.c /^do_tomouse(
iconify main.c /^iconify(
uniconify main.c /^uniconify(
do_newwindow main.c /^do_newwindow(
TOpenWindow main.c /^TOpenWindow(
opensharedwindow main.c /^opensharedwindow(
closesharedwindow main.c /^closesharedwindow(
getyn main.c /^getyn(
title main.c /^title(
window_title main.c /^window_title(
set_window_params main.c /^set_window_params(
exiterr main.c /^exiterr(
breakcheck main.c /^breakcheck(
breakreset main.c /^breakreset(
do_windowparm main.c /^do_windowparm(
do_resize main.c /^do_resize(
ops main.c /^ops(
menu_strip menu.c /^menu_strip(
menu_off menu.c /^menu_off(
menu_on menu.c /^menu_on(
do_menuoff menu.c /^do_menuoff(
do_menuon menu.c /^do_menuon(
menutomacro menu.c /^menutomacro(
menu_cmd menu.c /^menu_cmd(
fixmenu menu.c /^fixmenu(
do_menuclear menu.c /^do_menuclear(
do_menuadd menu.c /^do_menuadd(
do_menudelhdr menu.c /^do_menudelhdr(
do_menudel menu.c /^do_menudel(
PMAdd mods.c /^PMAdd(
PMRem mods.c /^PMRem(
PMKill mods.c /^PMKill(
do_pushmark mods.c /^do_pushmark(
do_popmark mods.c /^do_popmark(
do_swapmark mods.c /^do_swapmark(
do_purgemark mods.c /^do_purgemark(
do_ping mods.c /^do_ping(
do_pong mods.c /^do_pong(
do_undo mods.c /^do_undo(
do_ctags refs.c /^do_ctags(
do_refs refs.c /^do_refs(
searchref refs.c /^searchref(
openrexx rexx.c /^openrexx(
closerexx rexx.c /^closerexx(
do_rx rexx.c /^do_rx(
do_rx1 rexx.c /^do_rx1(
do_rx2 rexx.c /^do_rx2(
do_rxImplied rexx.c /^do_rxImplied(
do_rexx rexx.c /^do_rexx(
makemygadget subs.c /^makemygadget(
firstns subs.c /^firstns(
lastns subs.c /^lastns(
wordlen subs.c /^wordlen(
getpath subs.c /^getpath(
allocb subs.c /^allocb(
allocl subs.c /^allocl(
bmovl subs.c /^bmovl(
detab subs.c /^detab(
xefgets subs.c /^xefgets(
ncstrcmp subs.c /^ncstrcmp(
finded subs.c /^finded(


\Rogue\Monster\
else
  echo "will not over write ./src/tags"
fi
if [ `wc -c ./src/tags | awk '{printf $1}'` -ne 5534 ]
then
echo `wc -c ./src/tags | awk '{print "Got " $1 ", Expected " 5534}'`
fi
echo "Finished archive 3 of 6"
# if you want to concatenate archives, remove anything after this line
exit
-- 
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
Have five nice days.