#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#------------------cut here--------------------
#!/bin/sh
# shar:   Shell Archiver
#	Run the following text with /bin/sh to create:
#	args.h
#	kw.h
#	mm.h
# This archive created: Sun Dec 15 11:15:52 1991
cat << \Cookie_Monster > args.h
/*
 * args.h: arglists
 */
#ifndef _ARGS_D
#define _ARGS_D

typedef struct args {
    int count;
    char **words;
} ARGS;

extern int wildcards();
#endif /*_ARGS_D*/
Cookie_Monster
cat << \Cookie_Monster > kw.h
/*
 * defines for control structures
*/
#ifndef _KW_D
#define _KW_D

#define SETBITS 6
#define Elem(x)	(1<<(x+SETBITS))

/*
 * bits 6-15 define a bitfield of control keywords.
 * These keywords are bitfielded so that the scanner and the parser can
 * deal with them quickly, but without a lot of code.
 */
#define IF	Elem(0)
#define THEN	Elem(1)
#define ELIF	Elem(2)
#define ELSE	Elem(3)
#define FI	Elem(4)
#define WHILE	Elem(5)
#define FOR	Elem(6)
#define DO	Elem(7)
#define DONE	Elem(8)

/*
 * 1-56 are reserved for shell builtins (55 of them)
 */	
#define EMPTY	1
#define EXIT	2	/* exit the shell */
/*
 * 58-61 are list splicing (lists are terminated by ; - all other list
 * separators need special splicing.)
 * NEWLINE is in here for convenience, but we never splice a list with ; !!
 */
#define NEWLINE	57	/* newline or ; */	/* lowest priority */
#define BG	58	/* &'ed */		/* lowest priority */
#define PIPE	59	/* pipe */		/* highest priority */
#define OR	60	/* || */		/* second level priority */
#define AND	61	/* && */		/* second level priority */

#define ISCOMMAND(ptr) (ptr->c_type < NEWLINE || ptr->c_type > AND)
#define ISBINARY(ptr) (ptr->c_type >= NEWLINE && ptr->c_type < AND)
#define ISUSERCMD(ptr) (ptr->c_type > AND)

/*
 * the command structure - holds every bit of control structure we can
 * fabricate (42 bytes long, amazingly enough...)
 */
typedef struct command {
    unsigned c_type;		/* command */
    struct command *c_next;	/* pointer to next command */
    int c_lineno;		/* line (in shellscript) where command is */

    char *c_text;		/* text of the command */
    int c_fs;			/* start and end of first argument */
    int c_fe;
    unsigned c_listop;		/* if terminated with |, ||, or && */
    char *c_filein;		/* magic for <<pattern */
    struct command *c_list;	/* rest of this list */
    struct command *c_ctl;	/* for control structure - fi/done */
    struct command *c_expr;	/* for control structure - expression */
    struct command *c_true;	/* control structures; true branch */	
#define c_body	c_true		/* body of FOR and WHILE */
    struct command *c_false;	/* control structures; false branch */	
} CMD;

extern CMD *scan();
extern CMD *parse();

#endif /*_KW_D*/
Cookie_Monster
cat << \Cookie_Monster > mm.h
/*
 * things of global interest for memory management
 */
#ifndef _MM_D
#define _MM_D

typedef char *MARKP;

extern MARKP mm_mark();		/* set a heap mark */
extern       mm_release();	/* release memory to that heap mark */
extern char *mm_new();		/* allocate bytes off the heap */
extern char *mm_expand();	/* expand the size of an item */
extern char *mm_strdup();	/* duplicate a string onto the heap */

#endif /*_MM_D*/
Cookie_Monster
#	End of shell archive
exit 0
