v01i071: hype - a SunView object-oriented window builder, Part11/11

Charles Mcgrew mcgrew at dartagnan.rutgers.edu
Fri Sep 15 12:54:02 AEST 1989


Submitted-by: apctrc!zmls04 at uunet.uu.net (Martin L. Smith)
Posting-number: Volume 1, Issue 71
Archive-name: hype/part11

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	src
# This archive created: Thu Sep 14 21:00:27 1989
export PATH; PATH=/bin:$PATH
if test ! -d 'src'
then
	echo shar: creating directory "'src'"
	mkdir 'src'
fi
echo shar: entering directory "'src'"
cd 'src'
echo shar: extracting "'info.c'" '(2096 characters)'
if test -f 'info.c'
then
	echo shar: will not over-write existing file "'info.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'info.c'
	X
	X#include "util.h"
	X#include "string.h"
	X#include "itemmod.h"
	X#include "tlmod.h"
	X#include "objmod.h"
	X#include "../archives/container/container.h"
	X#include "pathname.h"
	X
	Xtypedef struct il {
	X    struct il		*next;
	X    Container		val;
	X    String		name;
	X} InfoNode, *InfoList;
	X
	X
	X
	Xstatic
	XInfoList new_infonode()
	X{
	X    InfoList temp;
	X    temp = (InfoList) malloc(sizeof(InfoNode) * 1);
	X    temp->val = cnew_con();
	X    temp->next = NULL;
	X    return temp;
	X}
	XInfoList next_infonode(ilist)
	XInfoList ilist;
	X{
	X    if (ilist == NULL) {
	X	return NULL;
	X    } else {
	X	return ilist->next;
	X    }
	X}
	XString inode_name(ilist)
	XInfoList ilist;
	X{
	X    return ilist->name;
	X}
	XContainer inode_val(ilist)
	XInfoList ilist;
	X{
	X    return ilist->val;
	X}
	X
	Xvoid	unmake_infonode(ilist)
	XInfoList ilist;
	X{
	X    cdestroy(ilist->val);
	X    free(ilist);
	X}
	X
	Xvoid	unmake_infolist(ilist)
	XInfoList ilist;
	X{
	X    if (ilist != NULL) {
	X	unmake_infolist(ilist->next);
	X	unmake_infonode(ilist);
	X    }
	X}
	X
	X
	XContainer info_look(ilist,name)
	XInfoList ilist;
	XString name;
	X{
	X    InfoList temp;
	X    while (ilist != NULL) {
	X	if (strcmp(ilist->name,name) == 0) {
	X	    return ilist->val;
	X	}
	X	ilist = ilist->next;
	X    }
	X    return NULL;
	X}
	X
	XInfoList info_add_data(ilist,name,data)
	XString name;
	XInfoList ilist;
	XContainer data;
	X{
	X    InfoList temp;
	X    temp = ilist;
	X    crewind(data);
	X    while (temp != NULL) {
	X	if (strcmp(temp->name,name) == 0) {
	X	    cdestroy(temp->val);
	X	    crewind(data);
	X	    temp->val = ccpy_con(data);
	X	    return ilist;
	X	}
	X	temp = temp->next;
	X    }
	X    temp = new_infonode();
	X    temp->name = mystrcpy(name);
	X    cdestroy(temp->val);
	X    temp->val = ccpy_con(data);
	X    temp->next = ilist;
	X    return temp;
	X}
	X
	XInfoList read_info(fd,obj)
	XFILE *fd;
	XOBPtr obj;
	X{
	X    char *name,*tlname;
	X    char c;
	X    Container script;
	X    Container def;
	X    InfoList temp,ilist;
	X    char *x;
	X    c = fgetc(fd);
	X    temp = NULL;
	X
	X    while (c != '+') 
	X    {
	X	ungetc(c,fd);
	X	ilist = new_infonode();
	X	ilist->next = temp;
	X	read_script(fd,ilist->val);
	X	x = fgetline(fd);
	X	ilist->name = x;
	X	c = fgetc(fd);
	X	temp = ilist;
	X    }
	X    c = fgetc(fd);
	X    return temp;
	X}
	X
SHAR_EOF
if test 2096 -ne "`wc -c < 'info.c'`"
then
	echo shar: error transmitting "'info.c'" '(should have been 2096 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'info.h'" '(63 characters)'
if test -f 'info.h'
then
	echo shar: will not over-write existing file "'info.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'info.h'
	Xtypedef void *InfoList;
	Xvoid *info_look();
	Xvoid *read_info();
	X
SHAR_EOF
if test 63 -ne "`wc -c < 'info.h'`"
then
	echo shar: error transmitting "'info.h'" '(should have been 63 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'init.c'" '(6337 characters)'
if test -f 'init.c'
then
	echo shar: will not over-write existing file "'init.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'init.c'
	X#include <stdio.h>
	X
	Xextern	int unixcom(),opencom(),closecom(),ask(),choose();
	Xextern  int concat();
	Xextern	int itemval();
	Xextern	int stderrcom(),stdoutcom();
	Xextern	int send();
	Xextern	int param();
	Xextern	int target();
	Xextern	int plus(),times(),minus(),divide();
	Xextern	int numchildren(),numtls(),numpanes();
	Xextern	int numitems();
	Xextern	int getnthobject(),getnthitem(),getnthtl(),getnthpane();
	Xextern	int getitemval(),getitemmin(),getitemmax(),getitemlux(),getitemdef();
	Xextern	int getitemluy(),getitemname(),getitemicon(),getitemform(),getitemscript();
	Xextern	int setitemval(),setitemmin(),setitemmax(),setitemlux(),setitemdef();
	Xextern	int setitemluy(),setitemname(),setitemicon(),setitemform(),setitemscript();
	X
	Xextern	int setitemmin();
	Xextern	int numval();
	Xextern	int sformat();
	Xextern	int addbutton(),addslider(),addtext();
	Xextern	int delitem();
	X
	Xextern	int nthword(),nthchar(),nthitem(),nthline();
	Xextern	int settlcolor(),setobjcolor();
	Xextern	int gettlcolor(),getobjcolor();
	Xextern	int setitemlabel();
	Xextern	int setitemtoggles(),getitemtoggles();
	Xextern	int getobjname(),setobjname();
	Xextern  int getitemlabel();
	Xextern	int iamstrlen(),mysubstring();
	Xextern	int setitemtype(),getitemtype();
	Xextern  int makenewchild(),delobject(),makenewsibling();
	Xextern	int unixbg();
	Xextern	int mysetenv(),mygetenv();
	Xextern	int addtoggle(),addtextsw();
	Xextern  int myrefresh();
	Xextern	int gettlscript();
	Xextern	int settlscript();
	Xextern	int iamnumchars(),iamnumwords(),iamnumlines(),iamnumclauses();
	Xextern	int pass(),broadsend();
	Xextern	int self();
	Xextern	int pasteitemfromCB(),copyitemtoCB(),copyobjecttoCB();
	Xextern	int myexit(),myabort(),mychdir(),mykill(),mygetcwd();
	Xextern	int mypread(),mypwrite();
	Xextern	int refreshitem(),exectext(),myloadbelow(),myloadover(),mysaveobj();
	Xextern	int gettlbgtext(),settlbgtext();
	Xextern	int pasteitemfromCB(),pastetlfromCB(),pasteobjfromCB(),pastetreefromCB();
	Xextern	int copyitemtoCB(),copyobjtoCB(),copytltoCB();
	Xextern	int my_menu(),my_multi_select();
	Xextern	int setobjlabel(),getobjlabel(),setobjscript(),getobjscript();
	Xextern	int abort(),mysavestate();
	Xextern  int setglob(),getglob();
	X
	Xstatic struct {
	X    char *name;
	X    int  (*func)();
	X} builtins[] = {
	X
	X/* Basic math functions */
	X    "plus",		plus,
	X    "minus",		minus,
	X    "times",		times,
	X    "divide",		divide,
	X/*  "exp",		myexp,
	X    "remain",		myremain,
	X*/
	X
	X/* Global variables */
	X    "setglob",		setglob,
	X    "getglob",		getglob,
	X
	X/* Open, close, redraw objects */
	X    "open",		opencom,
	X    "close",		closecom,
	X    "refresh",		myrefresh,
	X
	X/* Object data manipulators */
	X    "getnthobject",	getnthobject,
	X    "getnthpane",	getnthtl,
	X    "getnthtl",		getnthtl,
	X    "getobjname",	getobjname,
	X    "setobjname",	setobjname,
	X    "setobjcolor",	setobjcolor,
	X    "getobjcolor",	getobjcolor,
	X    "setobjlabel",	setobjlabel,
	X    "getobjlabel",	getobjlabel,
	X    "setobjscript",	setobjscript,
	X    "getobjscript",	getobjscript,
	X    "delobject",	delobject,
	X    "numchildren",	numchildren,
	X    "numpanes",		numpanes,
	X    "numtls",		numtls,
	X    "makenewchild",	makenewchild,
	X    "makenewsibling",	makenewsibling,
	X
	X
	X/* Item data extractors */
	X    "getitemname",	getitemname,
	X    "getitemval",	getitemval,
	X    "getitemmin",	getitemmin,
	X    "getitemmax",	getitemmax,
	X    "getitemicon",	getitemicon,
	X    "getitemform",	getitemform,
	X    "getitemscript",	getitemscript,
	X    "getitemlux",	getitemlux,
	X    "getitemluy",	getitemluy,
	X    "getitemlabel",	getitemlabel,
	X    "getitemtype",	getitemtype,
	X
	X
	X/* Item data manipulators */
	X    "setitemmin",	setitemmin,
	X    "setitemname",	setitemname,
	X    "setitemmax",	setitemmax,
	X    "setitemicon",	setitemicon,
	X    "setitemform",	setitemform,
	X    "setitemscript",	setitemscript,
	X    "setitemdef",	setitemdef,
	X    "setitemlux",	setitemlux,
	X    "setitemluy",	setitemluy,
	X    "setitemval",	setitemval,
	X    "setitemlabel",	setitemlabel,
	X    "setitemtype",	setitemtype,
	X    "refreshitem",	refreshitem,
	X
	X/* Template shapers */
	X    "getnthitem",	getnthitem,
	X    "numitems",		numitems,
	X    "addbutton",	addbutton,
	X    "addtext",		addtext,
	X    "addslider",	addslider,
	X    "addtoggle",	addtoggle,
	X    "addtextsw",	addtextsw,
	X    "delitem",		delitem,
	X    "settlcolor",	settlcolor,
	X    "gettlcolor",	gettlcolor,
	X    "settlscript",	settlscript,
	X    "gettlscript",	gettlscript,
	X    "gettlbgtext",	gettlbgtext,
	X    "settlbgtext",	settlbgtext,
	X
	X/* Communication functions */
	X    "ask",		ask,
	X    "choose",		choose,
	X    "stderr",		stderrcom,
	X    "stdout",		stdoutcom,
	X    "menu",		my_menu,
	X    "select",		my_multi_select,
	X
	X/* Clipboard manipulators */
	X    "pasteitem",	pasteitemfromCB,
	X    "pastetl",		pastetlfromCB,
	X    "pasteobj",		pasteobjfromCB,
	X    "pasteobjtree",	pastetreefromCB,
	X    "copyitem",		copyitemtoCB,
	X    "copyobj",		copyobjtoCB,
	X    "copytl",		copytltoCB,
	X
	X/* Hype format file functions */
	X    "saveobj",		mysaveobj,
	X    "loadover",		myloadover,
	X    "loadbelow",	myloadbelow,
	X    "exectext",		exectext,
	X/*    "execfile",		execfile,
	X    "execfileincontext",execfileincontext,
	X    "exectextincontext",exectextincontext,
	X*/
	X/* Special script utility functions */
	X    "self",		self,
	X    "param",		param,
	X    "target",		target,
	X/*  "findhandlers",	findhandlers,
	X    "findpanes",	findpanes,
	X    "alarm",		myalarm,
	X    "signal",		mysignal,
	X    "sort",		sort,
	X*/
	X
	X/*  Message manipulation commands */
	X    "send",		send,
	X    "pass",		pass,
	X    "broadcast",	broadsend,
	X
	X/*  Operate on strings in a reasonable way */
	X    "numval",		numval,
	X    "concat",		concat,
	X    "strlen",		iamstrlen,
	X    "numlines",		iamnumlines,
	X    "numclauses",	iamnumclauses,
	X    "numwords",		iamnumwords,
	X    "numchars",		iamnumchars,
	X    "nthword",		nthword,
	X    "nthchar",		nthchar,
	X    "nthclause",	nthitem,
	X    "nthline",		nthline,
	X    "sformat",		sformat,
	X    "substring",	mysubstring,
	X/*
	X    "search",		searchstring,
	X*/
	X
	X
	X/* These functions are the main hooks into the operating system. */
	X    "putenv",		mysetenv,
	X    "getenv",		mygetenv,
	X    "unix",		unixcom,
	X    "unixbg",		unixbg,
	X    "exit",		myexit,
	X    "abort",		myabort,
	X    "savestate",	mysavestate,
	X    "getcwd",		mygetcwd,
	X    "kill",		mykill,
	X    "chdir",		mychdir,
	X    "pwrite",		mypwrite,
	X    "pread",		mypread,
	X/*  "prandw",		prandw,
	X*/
	X    0,		NULL
	X};
	X
	X
	Xinit_builtins()
	X{
	X    int i;
	X    for (i = 0; builtins[i].name; i++) {
	X	install(builtins[i].name,builtins[i].func);
	X    }
	X}
	X
SHAR_EOF
if test 6337 -ne "`wc -c < 'init.c'`"
then
	echo shar: error transmitting "'init.c'" '(should have been 6337 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'init.h'" '(4 characters)'
if test -f 'init.h'
then
	echo shar: will not over-write existing file "'init.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'init.h'
	X   
SHAR_EOF
if test 4 -ne "`wc -c < 'init.h'`"
then
	echo shar: error transmitting "'init.h'" '(should have been 4 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'init.script'" '(22 characters)'
if test -f 'init.script'
then
	echo shar: will not over-write existing file "'init.script'"
else
sed 's/^	X//' << \SHAR_EOF > 'init.script'
	Xunixbg("colortool"); 
SHAR_EOF
if test 22 -ne "`wc -c < 'init.script'`"
then
	echo shar: error transmitting "'init.script'" '(should have been 22 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'itemmod.c'" '(6362 characters)'
if test -f 'itemmod.c'
then
	echo shar: will not over-write existing file "'itemmod.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'itemmod.c'
	X#include "util.h"
	X#include "../archives/hash/shash.h"
	X#include "map.h"
	X#include "color.h"
	X#include "tlmod.h"
	X#include "attr.h"
	X#include "../archives/container/container.h"
	Xstatic itemnumber = 0;
	X
	Xtypedef struct it {
	X    int			itype;
	X    String		name;
	X    String		label;
	X    Container		script;
	X    MapPtr		msgsmap;
	X    SHashTPtr		msgstab;
	X    Container		def;	
	X    Container		dlen;
	X    Container		minval;
	X    Container		maxval;
	X    Container		icon;
	X    Container		format;
	X    int			numc;
	X    Container		data;
	X    Container		labels;
	X    AttrPtr		attr;
	X    TLPtr		owner;
	X} IT,*ITPtr;
	X
	XMapPtr item_get_msgsmap(it)
	XITPtr it;
	X{
	X    return it->msgsmap;
	X}
	XSHashTPtr item_get_msgstab(it)
	XITPtr it;
	X{
	X    return it->msgstab;
	X}
	Xvoid item_set_msgsmap(it,map)
	XITPtr it;
	XMapPtr map;
	X{
	X    it->msgsmap = map;
	X}
	Xvoid item_set_msgstab(it,tab)
	XITPtr it;
	XSHashTPtr tab;
	X{
	X    it->msgstab = tab;
	X}
	Xint item_get_type(it)
	XITPtr it;
	X{
	X    return it->itype;    
	X
	X}
	Xint item_set_type(it,itype)
	Xint itype;
	XITPtr it;
	X{
	X    it->itype = itype;
	X}
	Xchar *item_get_label(it)
	XITPtr it;
	X{
	X    return it->label;    
	X}
	X
	XITPtr new_item(itype,def,owner)
	XContainer	def;
	Xint	itype;
	XTLPtr owner;
	X{
	X    ITPtr temp;
	X    temp = (ITPtr) malloc(sizeof(IT) * 1);
	X    temp->itype = itype;
	X    temp->name = mystrcat("itemname",int_to_string(itemnumber++));
	X    temp->label = mystrcpy(temp->name);
	X    temp->def = ccpy_con(def);
	X    temp->script = cnew_con();
	X    temp->msgsmap = make_map();
	X    temp->msgstab = smake_hash();
	X    Sinit_hash(3,temp->msgstab);
	X    if (temp->itype == HYPE_TEXT) {
	X	temp->dlen = cnew_constring("30");	
	X    } else if (temp->itype == HYPE_SLIDER) {
	X	temp->dlen = cnew_constring("200");
	X    } else {
	X	temp->dlen = cnew_con();	
	X    }
	X    temp->minval = cnew_con();
	X    temp->maxval = cnew_con();
	X    temp->icon	 = cnew_con();
	X    temp->format = cnew_con();
	X    temp->numc = 0;
	X    temp->labels = cnew_con();
	X    temp->data	 = cnew_con();
	X    temp->owner = owner;
	X    temp->attr = make_attr();
	X    return temp;
	X}
	XITPtr item_copy(it)
	XITPtr it;
	X{
	X    ITPtr new;
	X    new = new_item(it->itype,(it->def),NULL);
	X    free(new->name);
	X    new->name = mystrcpy(it->name);
	X    new->script = ccpy_con(it->script);
	X    new->label = mystrcpy(it->label);
	X    new->minval = ccpy_con(it->minval);
	X    new->maxval = ccpy_con(it->maxval);
	X    new->icon = ccpy_con(it->icon);
	X    new->format = ccpy_con(it->format);
	X    new->data = ccpy_con(it->data);
	X    new->dlen = ccpy_con(it->dlen);
	X    new->numc = it->numc;
	X    new->attr = copy_attr(it->attr);
	X    compile_item_script(new,0);
	X    return new;
	X}
	X
	Xvoid unmake_item(item)
	XITPtr item;
	X{
	X    clipboard_report_dealloc(item);
	X    free(item->name);
	X    cdestroy(item->def);
	X    cdestroy(item->minval);
	X    cdestroy(item->maxval);
	X    cdestroy(item->icon);
	X    cdestroy(item->format);
	X    cdestroy(item->labels);
	X    cdestroy(item->data);
	X    unmake_attr(item->attr);
	X    unmake_map(item->msgsmap);
	X    sunmake_hash(item->msgstab);
	X    free(item);
	X}
	XAttrPtr item_get_attr(item)
	XITPtr item;
	X{
	X    return item->attr;
	X}
	Xvoid item_set_attr(item,attr)
	XITPtr item;
	XAttrPtr attr;
	X{
	X    item->attr = attr;
	X}
	XTLPtr item_get_owner(item)
	XITPtr item;
	X{
	X    return item->owner;
	X}
	Xvoid item_set_owner(it,tl)
	XITPtr it;
	XTLPtr tl;
	X{
	X    it->owner = tl;
	X}
	XContainer item_get_dlen(item)
	XITPtr item;
	X{  
	X    return item->dlen;
	X}
	X
	Xint item_get_numc(item)
	XITPtr item;
	X{  
	X    return item->numc;
	X}
	Xint item_get_lux(item)
	XITPtr item;
	X{  
	X    return attr_get_lux(item->attr);
	X}
	Xint item_get_luy(item)
	XITPtr item;
	X{  
	X    return attr_get_luy(item->attr);
	X}
	Xvoid item_set_dlen(item,c)
	XITPtr item;
	XContainer c;
	X{
	X    item->dlen = c;
	X}
	Xvoid item_set_numc(item,i)
	XITPtr item;
	Xint i;
	X{
	X    item->numc = i;
	X}
	Xvoid item_set_lux(item,i)
	XITPtr item;
	Xint i;
	X{
	X    attr_set_lux(item->attr,i);
	X}
	X
	Xvoid item_set_luy(item,i)
	XITPtr item;
	Xint i;
	X{
	X    attr_set_luy(item->attr,i);
	X}
	XContainer item_get_min(item)
	XITPtr item;
	X{  
	X    return item->minval;
	X}
	XContainer item_get_labels(item)
	XITPtr item;
	X{  
	X    return item->labels;
	X}
	XContainer item_get_max(item)
	XITPtr item;
	X{  
	X    return item->maxval;
	X}
	XContainer item_get_icon(item)
	XITPtr item;
	X{  
	X    return item->icon;
	X}
	XContainer item_get_form(item)
	XITPtr item;
	X{  
	X    return item->format;
	X}
	XContainer item_get_script(item)
	XITPtr item;
	X{
	X    return item->script;
	X}
	XContainer item_get_def(item)
	XITPtr item;
	X{
	X    return item->def;
	X}
	XString item_get_name(item)
	XITPtr item;
	X{
	X    return item->name;    
	X}
	Xvoid  item_set_name(item,str)
	XITPtr item;
	XString str;
	X{
	X    item->name = mystrcpy(str);    
	X}
	Xvoid  item_set_label(item,str)
	XITPtr item;
	XString str;
	X{
	X    item->label = mystrcpy(str);    
	X}
	Xvoid  item_set_min(item,str)
	XITPtr item;
	XContainer str;
	X{
	X    cdestroy(item->minval);
	X    item->minval = ccpy_con(str);
	X}
	X
	Xvoid  item_set_labels(item,str)
	XITPtr item;
	XContainer str;
	X{
	X    cdestroy(item->labels);
	X    item->labels = ccpy_con(str);
	X}
	Xvoid  item_set_data(item,str)
	XITPtr item;
	XContainer str;
	X{
	X    cdestroy(item->data);
	X    item->data = ccpy_con(str);
	X}
	Xvoid  item_set_max(item,str)
	XITPtr item;
	XContainer str;
	X{
	X    cdestroy(item->maxval);
	X    item->maxval = ccpy_con(str);
	X}
	Xvoid  item_set_icon(item,str)
	XITPtr item;
	XContainer str;
	X{
	X    cdestroy(item->icon);
	X    item->icon = ccpy_con(str);
	X}
	Xvoid  item_set_form(item,str)
	XITPtr item;
	XContainer str;
	X{
	X    cdestroy(item->format);
	X    item->format = ccpy_con(str);
	X}
	Xvoid  item_set_script(item,str)
	XITPtr item;
	XContainer str;
	X{
	X    cdestroy(item->script);
	X    item->script = ccpy_con(str);
	X}
	Xvoid  item_set_def(item,str)
	XITPtr item;
	XContainer str;
	X{
	X    cdestroy(item->def);
	X    item->def = ccpy_con(str);
	X}
	XITPtr read_item(fd)
	XFILE *fd;
	X{
	X    ITPtr it;
	X    int type;
	X    char *name,*label;
	X    int r,g,b;
	X    int itype,lux,luy,numc;
	X    Container def;
	X    itemnumber++;
	X    def = cnew_con();
	X    name = fgetline(fd);
	X    label = fgetline(fd);
	X    fscanf(fd,"%d\n",&type);
	X    itype = type;
	X    fscanf(fd,"%d\n", &numc);
	X    it = new_item(itype,def);
	X    it->itype = itype;
	X    it->numc = numc;
	X    it->name = mystrcpy(name);
	X    it->label = mystrcpy(label);
	X    read_script(fd,it->script);
	X    compile_item_script(it,NO_REPORT);
	X    read_script(fd,it->def);
	X    read_script(fd,it->minval);
	X    read_script(fd,it->maxval);
	X    read_script(fd,it->labels);
	X    read_script(fd,it->icon);
	X    read_script(fd,it->format);
	X    read_script(fd,it->dlen);
	X    it->attr = read_attr(fd);
	X    return it;
	X}
SHAR_EOF
if test 6362 -ne "`wc -c < 'itemmod.c'`"
then
	echo shar: error transmitting "'itemmod.c'" '(should have been 6362 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'itemmod.h'" '(469 characters)'
if test -f 'itemmod.h'
then
	echo shar: will not over-write existing file "'itemmod.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'itemmod.h'
	Xtypedef	    void    *ITPtr;
	X
	XITPtr new_item();
	X
	Xvoid unmake_item();
	X
	Xvoid *item_get_def();
	X
	XString item_get_name();
	X
	Xvoid  item_set_name();
	X
	Xvoid  item_set_def();
	Xint	item_get_type();
	X
	Xint item_get_lux();
	Xint item_get_luy();
	Xvoid *item_get_color();
	Xvoid *item_get_min();
	Xvoid *item_get_max();
	Xvoid *item_get_icon();
	Xvoid *item_get_form();
	Xvoid	item_set_form();
	Xvoid	item_set_min();
	Xvoid	item_set_max();
	Xvoid	item_set_icon();
	X
	Xvoid *item_copy();
	Xvoid *item_get_owner();
SHAR_EOF
if test 469 -ne "`wc -c < 'itemmod.h'`"
then
	echo shar: error transmitting "'itemmod.h'" '(should have been 469 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'lex.c'" '(14053 characters)'
if test -f 'lex.c'
then
	echo shar: will not over-write existing file "'lex.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'lex.c'
	X# include "stdio.h"
	X# define U(x) x
	X# define NLSTATE yyprevious=YYNEWLINE
	X# define BEGIN yybgin = yysvec + 1 +
	X# define INITIAL 0
	X# define YYLERR yysvec
	X# define YYSTATE (yyestate-yysvec-1)
	X# define YYOPTIM 1
	X# define YYLMAX BUFSIZ
	X# define output(c) putc(c,yyout)
	X# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
	X# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
	X# define yymore() (yymorfg=1)
	X# define ECHO fprintf(yyout, "%s",yytext)
	X# define REJECT { nstr = yyreject(); goto yyfussy;}
	Xint yyleng; extern char yytext[];
	Xint yymorfg;
	Xextern char *yysptr, yysbuf[];
	Xint yytchar;
	XFILE *yyin = {stdin}, *yyout = {stdout};
	Xextern int yylineno;
	Xstruct yysvf { 
	X	struct yywork *yystoff;
	X	struct yysvf *yyother;
	X	int *yystops;};
	Xstruct yysvf *yyestate;
	Xextern struct yysvf yysvec[], *yybgin;
	X#include "scripter.h"
	X#include "../archives/container/container.h"
	X#include "y.tab.h"
	X#include "symbol.h"
	X#include "util.h"
	X#include <strings.h>
	X# define YYNEWLINE 10
	Xyylex(){
	Xint nstr; extern int yyprevious;
	Xwhile((nstr = yylook()) >= 0)
	Xyyfussy: switch(nstr){
	Xcase 0:
	Xif(yywrap()) return(0); break;
	Xcase 1:
	X  {	    ;		    }
	Xbreak;
	Xcase 2:
	X    {	    ;		    }
	Xbreak;
	Xcase 3:
	X    {   inc_lineno();	    }
	Xbreak;
	Xcase 4:
	X    {	return PLUSPLUS;    }
	Xbreak;
	Xcase 5:
	X    {	return MINUSMINUS;  }
	Xbreak;
	Xcase 6:
	X    {	return LBRACE;	    }
	Xbreak;
	Xcase 7:
	X    {	return RBRACE;	    }
	Xbreak;
	Xcase 8:
	X    {	return SC;	    }
	Xbreak;
	Xcase 9:
	X    {	return EQUAL;	    }
	Xbreak;
	Xcase 10:
	X    {	return PLUS;	    }
	Xbreak;
	Xcase 11:
	X    {	return MINUS;	    }
	Xbreak;
	Xcase 12:
	X    {	return STAR;	    }
	Xbreak;
	Xcase 13:
	X    {	return SLASH;	    }
	Xbreak;
	Xcase 14:
	X    {	return LTOREQ;	    }
	Xbreak;
	Xcase 15:
	X    {	return GTOREQ;	    }
	Xbreak;
	Xcase 16:
	X    {	return GREATERTHAN; }
	Xbreak;
	Xcase 17:
	X    {	return LESSTHAN;    }
	Xbreak;
	Xcase 18:
	X    {	return CEQUAL;	    }
	Xbreak;
	Xcase 19:
	X    {	return NEQUAL;	    }
	Xbreak;
	Xcase 20:
	X    {	return CONCAT;	    }
	Xbreak;
	Xcase 21:
	X    {	return AND;	    }
	Xbreak;
	Xcase 22:
	X    {	return OR;	    }
	Xbreak;
	Xcase 23:
	X    {	return NOT;	    }
	Xbreak;
	Xcase 24:
	X    {	return COMMA;	    }
	Xbreak;
	Xcase 25:
	X    {	return FOR;	    }
	Xbreak;
	Xcase 26:
	X    {   return IF;	    }
	Xbreak;
	Xcase 27:
	X    {   return THEN;	    }
	Xbreak;
	Xcase 28:
	X    {	return ELSE;	    }
	Xbreak;
	Xcase 29:
	X    {   return WHILE;	    }
	Xbreak;
	Xcase 30:
	X    {	return RETURN;	    }
	Xbreak;
	Xcase 31:
	X    {	return BREAK;	    }
	Xbreak;
	Xcase 32:
	X   {	return CONTINUE;    }
	Xbreak;
	Xcase 33:
	X    {	return LPAREN;	    }
	Xbreak;
	Xcase 34:
	X    {	return RPAREN;	    }
	Xbreak;
	Xcase 35:
	X    {
	X		yylval.text = yytext;
	X		return NUMBER;
	X	    }
	Xbreak;
	Xcase 36:
	X  { 
	X		yylval.text = yytext+1;
	X		yylval.text[yyleng-2] = '\0';
	X		return SQSTRING;
	X	    }
	Xbreak;
	Xcase 37:
	X  { 
	X		yylval.text = yytext+1;
	X		yylval.text[yyleng-2] = '\0';
	X		yylval.text = escapesout(yylval.text);
	X		return DQSTRING;
	X	    }
	Xbreak;
	Xcase 38:
	X
	X	    {
	X		void *temp;
	X		temp = symlookup(yytext);
	X		if ((int) temp == 0) {
	X		    yylval.text = mystrcpy(yytext);
	X		    return STRING;
	X		}
	X		if (((int) temp > 0) && ((int) temp < 1024)) {
	X		    yylval.pc = (int) temp;
	X		    return VAR;
	X		} else {
	X		    yylval.inst = (Inst) temp;
	X		    return BUILTIN;
	X		}
	X	    }
	Xbreak;
	Xcase 39:
	X    {
	X		    return LONEQUOTE;
	X	    }
	Xbreak;
	Xcase -1:
	Xbreak;
	Xdefault:
	Xfprintf(yyout,"bad switch yylook %d",nstr);
	X} return(0); }
	X/* end of yylex */
	X#undef input()
	X#undef output()
	X#undef unput()
	Xextern Container mfin;
	Xchar input()
	X{
	X    char c;
	X    c = mfgetc(mfin);
	X    if ((c == EOF) || getgloberror())
	X	return 0;
	X    return c;
	X}
	Xchar output(c)
	Xchar c;
	X{
	X   putchar(c);
	X}
	Xchar unput()
	X{
	X    mfungetc(mfin);
	X}
	Xint yyvstop[] = {
	X0,
	X
	X2,
	X0,
	X
	X3,
	X0,
	X
	X23,
	X0,
	X
	X39,
	X0,
	X
	X1,
	X0,
	X
	X33,
	X0,
	X
	X34,
	X0,
	X
	X12,
	X0,
	X
	X10,
	X0,
	X
	X24,
	X0,
	X
	X11,
	X0,
	X
	X13,
	X0,
	X
	X35,
	X0,
	X
	X8,
	X0,
	X
	X17,
	X0,
	X
	X9,
	X0,
	X
	X16,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X6,
	X0,
	X
	X7,
	X0,
	X
	X19,
	X0,
	X
	X37,
	X0,
	X
	X20,
	X0,
	X
	X21,
	X0,
	X
	X36,
	X0,
	X
	X4,
	X0,
	X
	X5,
	X0,
	X
	X35,
	X0,
	X
	X14,
	X0,
	X
	X18,
	X0,
	X
	X15,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X26,
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X22,
	X0,
	X
	X37,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X25,
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X28,
	X38,
	X0,
	X
	X38,
	X0,
	X
	X27,
	X38,
	X0,
	X
	X38,
	X0,
	X
	X31,
	X38,
	X0,
	X
	X38,
	X0,
	X
	X38,
	X0,
	X
	X29,
	X38,
	X0,
	X
	X38,
	X0,
	X
	X30,
	X38,
	X0,
	X
	X38,
	X0,
	X
	X32,
	X38,
	X0,
	X0};
	X# define YYTYPE char
	Xstruct yywork { YYTYPE verify, advance; } yycrank[] = {
	X0,0,	0,0,	1,0,	1,0,	
	X1,0,	1,0,	1,0,	1,0,	
	X1,0,	1,0,	1,3,	1,4,	
	X1,0,	1,0,	1,0,	1,0,	
	X1,0,	1,0,	1,0,	1,0,	
	X1,0,	1,0,	1,0,	1,0,	
	X1,0,	1,0,	1,0,	1,0,	
	X1,0,	1,0,	1,0,	1,0,	
	X1,0,	0,0,	1,5,	1,6,	
	X1,7,	1,8,	1,0,	1,9,	
	X1,10,	1,11,	1,12,	1,13,	
	X1,14,	1,15,	1,16,	1,0,	
	X1,17,	1,18,	8,39,	9,40,	
	X0,0,	14,42,	0,0,	16,43,	
	X0,0,	0,0,	0,0,	1,0,	
	X1,19,	1,20,	1,21,	1,22,	
	X1,0,	1,0,	1,23,	0,0,	
	X0,0,	0,0,	0,0,	5,35,	
	X20,45,	21,46,	7,7,	22,47,	
	X0,0,	0,0,	0,0,	0,0,	
	X0,0,	0,0,	7,7,	7,0,	
	X0,0,	0,0,	0,0,	0,0,	
	X0,0,	0,0,	0,0,	0,0,	
	X1,0,	1,0,	1,0,	1,0,	
	X0,0,	1,0,	0,0,	1,24,	
	X1,25,	36,0,	1,26,	1,27,	
	X0,0,	0,0,	1,28,	7,7,	
	X0,0,	0,0,	0,0,	0,0,	
	X7,7,	7,7,	7,7,	1,29,	
	X57,0,	1,30,	0,0,	7,7,	
	X1,31,	7,7,	0,0,	0,0,	
	X1,32,	1,33,	1,34,	1,0,	
	X1,0,	2,0,	2,0,	2,0,	
	X2,0,	2,0,	2,0,	2,0,	
	X2,0,	24,48,	7,7,	2,0,	
	X2,0,	2,0,	2,0,	2,0,	
	X2,0,	2,0,	2,0,	2,0,	
	X2,0,	2,0,	2,0,	2,0,	
	X2,0,	2,0,	2,0,	2,0,	
	X2,0,	2,0,	2,0,	2,0,	
	X25,49,	2,5,	26,50,	2,7,	
	X2,8,	2,0,	2,9,	27,51,	
	X6,36,	28,52,	2,13,	2,14,	
	X2,15,	2,16,	2,0,	2,17,	
	X6,36,	6,0,	29,53,	30,54,	
	X31,55,	33,56,	48,58,	36,38,	
	X49,59,	50,60,	2,0,	2,19,	
	X2,20,	2,21,	2,22,	2,0,	
	X2,0,	51,61,	53,62,	54,63,	
	X55,64,	58,65,	57,38,	59,66,	
	X60,67,	6,37,	62,68,	63,69,	
	X64,70,	65,71,	6,36,	6,36,	
	X6,36,	66,72,	68,73,	70,74,	
	X72,75,	6,36,	73,76,	6,36,	
	X75,77,	77,78,	0,0,	2,0,	
	X2,0,	2,0,	2,0,	0,0,	
	X2,0,	38,0,	2,24,	2,25,	
	X10,10,	2,26,	2,27,	0,0,	
	X6,36,	2,28,	0,0,	0,0,	
	X10,10,	10,0,	0,0,	0,0,	
	X0,0,	0,0,	2,29,	0,0,	
	X2,30,	0,0,	0,0,	2,31,	
	X0,0,	38,57,	0,0,	2,32,	
	X2,33,	2,34,	2,0,	2,0,	
	X0,0,	0,0,	0,0,	6,38,	
	X0,0,	10,10,	0,0,	0,0,	
	X0,0,	0,0,	10,41,	10,10,	
	X10,10,	0,0,	0,0,	0,0,	
	X0,0,	10,10,	18,44,	10,10,	
	X18,18,	18,18,	18,18,	18,18,	
	X18,18,	18,18,	18,18,	18,18,	
	X18,18,	18,18,	0,0,	0,0,	
	X0,0,	0,0,	0,0,	0,0,	
	X10,10,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	0,0,	
	X0,0,	0,0,	0,0,	38,38,	
	X0,0,	0,0,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X0,0,	0,0,	0,0,	0,0,	
	X23,23,	0,0,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X23,23,	23,23,	23,23,	23,23,	
	X44,44,	44,44,	44,44,	44,44,	
	X44,44,	44,44,	44,44,	44,44,	
	X44,44,	44,44,	0,0,	0,0,	
	X0,0};
	Xstruct yysvf yysvec[] = {
	X0,	0,	0,
	Xyycrank+-1,	0,		0,	
	Xyycrank+-128,	yysvec+1,	0,	
	Xyycrank+0,	0,		yyvstop+1,
	Xyycrank+0,	0,		yyvstop+3,
	Xyycrank+10,	0,		yyvstop+5,
	Xyycrank+-167,	0,		yyvstop+7,
	Xyycrank+-73,	0,		yyvstop+9,
	Xyycrank+14,	0,		0,	
	Xyycrank+13,	0,		0,	
	Xyycrank+-227,	0,		0,	
	Xyycrank+0,	0,		yyvstop+11,
	Xyycrank+0,	0,		yyvstop+13,
	Xyycrank+0,	0,		yyvstop+15,
	Xyycrank+10,	0,		yyvstop+17,
	Xyycrank+0,	0,		yyvstop+19,
	Xyycrank+10,	0,		yyvstop+21,
	Xyycrank+0,	0,		yyvstop+23,
	Xyycrank+228,	0,		yyvstop+25,
	Xyycrank+0,	0,		yyvstop+27,
	Xyycrank+11,	0,		yyvstop+29,
	Xyycrank+12,	0,		yyvstop+31,
	Xyycrank+14,	0,		yyvstop+33,
	Xyycrank+245,	0,		yyvstop+35,
	Xyycrank+23,	yysvec+23,	yyvstop+37,
	Xyycrank+49,	yysvec+23,	yyvstop+39,
	Xyycrank+54,	yysvec+23,	yyvstop+41,
	Xyycrank+56,	yysvec+23,	yyvstop+43,
	Xyycrank+67,	yysvec+23,	yyvstop+45,
	Xyycrank+77,	yysvec+23,	yyvstop+47,
	Xyycrank+75,	yysvec+23,	yyvstop+49,
	Xyycrank+76,	yysvec+23,	yyvstop+51,
	Xyycrank+0,	0,		yyvstop+53,
	Xyycrank+57,	0,		0,	
	Xyycrank+0,	0,		yyvstop+55,
	Xyycrank+0,	0,		yyvstop+57,
	Xyycrank+-91,	yysvec+6,	0,	
	Xyycrank+0,	0,		yyvstop+59,
	Xyycrank+-215,	yysvec+6,	0,	
	Xyycrank+0,	0,		yyvstop+61,
	Xyycrank+0,	0,		yyvstop+63,
	Xyycrank+0,	0,		yyvstop+65,
	Xyycrank+0,	0,		yyvstop+67,
	Xyycrank+0,	0,		yyvstop+69,
	Xyycrank+320,	0,		yyvstop+71,
	Xyycrank+0,	0,		yyvstop+73,
	Xyycrank+0,	0,		yyvstop+75,
	Xyycrank+0,	0,		yyvstop+77,
	Xyycrank+81,	yysvec+23,	yyvstop+79,
	Xyycrank+74,	yysvec+23,	yyvstop+81,
	Xyycrank+70,	yysvec+23,	yyvstop+83,
	Xyycrank+79,	yysvec+23,	yyvstop+85,
	Xyycrank+0,	yysvec+23,	yyvstop+87,
	Xyycrank+78,	yysvec+23,	yyvstop+90,
	Xyycrank+94,	yysvec+23,	yyvstop+92,
	Xyycrank+91,	yysvec+23,	yyvstop+94,
	Xyycrank+0,	0,		yyvstop+96,
	Xyycrank+-106,	yysvec+6,	yyvstop+98,
	Xyycrank+100,	yysvec+23,	yyvstop+100,
	Xyycrank+83,	yysvec+23,	yyvstop+102,
	Xyycrank+99,	yysvec+23,	yyvstop+104,
	Xyycrank+0,	yysvec+23,	yyvstop+106,
	Xyycrank+85,	yysvec+23,	yyvstop+109,
	Xyycrank+93,	yysvec+23,	yyvstop+111,
	Xyycrank+96,	yysvec+23,	yyvstop+113,
	Xyycrank+98,	yysvec+23,	yyvstop+115,
	Xyycrank+104,	yysvec+23,	yyvstop+117,
	Xyycrank+0,	yysvec+23,	yyvstop+119,
	Xyycrank+96,	yysvec+23,	yyvstop+122,
	Xyycrank+0,	yysvec+23,	yyvstop+124,
	Xyycrank+110,	yysvec+23,	yyvstop+127,
	Xyycrank+0,	yysvec+23,	yyvstop+129,
	Xyycrank+102,	yysvec+23,	yyvstop+132,
	Xyycrank+104,	yysvec+23,	yyvstop+134,
	Xyycrank+0,	yysvec+23,	yyvstop+136,
	Xyycrank+99,	yysvec+23,	yyvstop+139,
	Xyycrank+0,	yysvec+23,	yyvstop+141,
	Xyycrank+116,	yysvec+23,	yyvstop+144,
	Xyycrank+0,	yysvec+23,	yyvstop+146,
	X0,	0,	0};
	Xstruct yywork *yytop = yycrank+377;
	Xstruct yysvf *yybgin = yysvec+1;
	Xchar yymatch[] = {
	X00  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
	X01  ,011 ,012 ,01  ,01  ,01  ,01  ,01  ,
	X01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
	X01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
	X011 ,01  ,'"' ,01  ,01  ,01  ,01  ,047 ,
	X'(' ,')' ,01  ,01  ,01  ,01  ,'.' ,01  ,
	X'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,
	X'0' ,'0' ,01  ,01  ,01  ,01  ,01  ,01  ,
	X01  ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
	X'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
	X'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
	X'A' ,'A' ,'A' ,01  ,01  ,01  ,01  ,'A' ,
	X01  ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
	X'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
	X'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
	X'A' ,'A' ,'A' ,01  ,01  ,01  ,01  ,01  ,
	X0};
	Xchar yyextra[] = {
	X0,0,0,0,0,0,0,0,
	X0,0,0,0,0,0,0,0,
	X0,0,0,0,0,0,0,0,
	X0,0,0,0,0,0,0,0,
	X0,0,0,0,0,0,0,0,
	X0};
	X#ifndef lint
	Xstatic	char ncform_sccsid[] = "@(#)ncform 1.6 88/02/08 SMI"; /* from S5R2 1.2 */
	X#endif
	X
	Xint yylineno =1;
	X# define YYU(x) x
	X# define NLSTATE yyprevious=YYNEWLINE
	Xchar yytext[YYLMAX];
	Xstruct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
	Xchar yysbuf[YYLMAX];
	Xchar *yysptr = yysbuf;
	Xint *yyfnd;
	Xextern struct yysvf *yyestate;
	Xint yyprevious = YYNEWLINE;
	Xyylook(){
	X	register struct yysvf *yystate, **lsp;
	X	register struct yywork *yyt;
	X	struct yysvf *yyz;
	X	int yych, yyfirst;
	X	struct yywork *yyr;
	X# ifdef LEXDEBUG
	X	int debug;
	X# endif
	X	char *yylastch;
	X	/* start off machines */
	X# ifdef LEXDEBUG
	X	debug = 0;
	X# endif
	X	yyfirst=1;
	X	if (!yymorfg)
	X		yylastch = yytext;
	X	else {
	X		yymorfg=0;
	X		yylastch = yytext+yyleng;
	X		}
	X	for(;;){
	X		lsp = yylstate;
	X		yyestate = yystate = yybgin;
	X		if (yyprevious==YYNEWLINE) yystate++;
	X		for (;;){
	X# ifdef LEXDEBUG
	X			if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
	X# endif
	X			yyt = yystate->yystoff;
	X			if(yyt == yycrank && !yyfirst){  /* may not be any transitions */
	X				yyz = yystate->yyother;
	X				if(yyz == 0)break;
	X				if(yyz->yystoff == yycrank)break;
	X				}
	X			*yylastch++ = yych = input();
	X			yyfirst=0;
	X		tryagain:
	X# ifdef LEXDEBUG
	X			if(debug){
	X				fprintf(yyout,"char ");
	X				allprint(yych);
	X				putchar('\n');
	X				}
	X# endif
	X			yyr = yyt;
	X			if ( (int)yyt > (int)yycrank){
	X				yyt = yyr + yych;
	X				if (yyt <= yytop && yyt->verify+yysvec == yystate){
	X					if(yyt->advance+yysvec == YYLERR)	/* error transitions */
	X						{unput(*--yylastch);break;}
	X					*lsp++ = yystate = yyt->advance+yysvec;
	X					goto contin;
	X					}
	X				}
	X# ifdef YYOPTIM
	X			else if((int)yyt < (int)yycrank) {		/* r < yycrank */
	X				yyt = yyr = yycrank+(yycrank-yyt);
	X# ifdef LEXDEBUG
	X				if(debug)fprintf(yyout,"compressed state\n");
	X# endif
	X				yyt = yyt + yych;
	X				if(yyt <= yytop && yyt->verify+yysvec == yystate){
	X					if(yyt->advance+yysvec == YYLERR)	/* error transitions */
	X						{unput(*--yylastch);break;}
	X					*lsp++ = yystate = yyt->advance+yysvec;
	X					goto contin;
	X					}
	X				yyt = yyr + YYU(yymatch[yych]);
	X# ifdef LEXDEBUG
	X				if(debug){
	X					fprintf(yyout,"try fall back character ");
	X					allprint(YYU(yymatch[yych]));
	X					putchar('\n');
	X					}
	X# endif
	X				if(yyt <= yytop && yyt->verify+yysvec == yystate){
	X					if(yyt->advance+yysvec == YYLERR)	/* error transition */
	X						{unput(*--yylastch);break;}
	X					*lsp++ = yystate = yyt->advance+yysvec;
	X					goto contin;
	X					}
	X				}
	X			if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
	X# ifdef LEXDEBUG
	X				if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
	X# endif
	X				goto tryagain;
	X				}
	X# endif
	X			else
	X				{unput(*--yylastch);break;}
	X		contin:
	X# ifdef LEXDEBUG
	X			if(debug){
	X				fprintf(yyout,"state %d char ",yystate-yysvec-1);
	X				allprint(yych);
	X				putchar('\n');
	X				}
	X# endif
	X			;
	X			}
	X# ifdef LEXDEBUG
	X		if(debug){
	X			fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
	X			allprint(yych);
	X			putchar('\n');
	X			}
	X# endif
	X		while (lsp-- > yylstate){
	X			*yylastch-- = 0;
	X			if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
	X				yyolsp = lsp;
	X				if(yyextra[*yyfnd]){		/* must backup */
	X					while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
	X						lsp--;
	X						unput(*yylastch--);
	X						}
	X					}
	X				yyprevious = YYU(*yylastch);
	X				yylsp = lsp;
	X				yyleng = yylastch-yytext+1;
	X				yytext[yyleng] = 0;
	X# ifdef LEXDEBUG
	X				if(debug){
	X					fprintf(yyout,"\nmatch ");
	X					sprint(yytext);
	X					fprintf(yyout," action %d\n",*yyfnd);
	X					}
	X# endif
	X				return(*yyfnd++);
	X				}
	X			unput(*yylastch);
	X			}
	X		if (yytext[0] == 0  /* && feof(yyin) */)
	X			{
	X			yysptr=yysbuf;
	X			return(0);
	X			}
	X		yyprevious = yytext[0] = input();
	X		if (yyprevious>0)
	X			output(yyprevious);
	X		yylastch=yytext;
	X# ifdef LEXDEBUG
	X		if(debug)putchar('\n');
	X# endif
	X		}
	X	}
	Xyyback(p, m)
	X	int *p;
	X{
	Xif (p==0) return(0);
	Xwhile (*p)
	X	{
	X	if (*p++ == m)
	X		return(1);
	X	}
	Xreturn(0);
	X}
	X	/* the following are only used in the lex library */
	Xyyinput(){
	X	return(input());
	X	}
	Xyyoutput(c)
	X  int c; {
	X	output(c);
	X	}
	Xyyunput(c)
	X   int c; {
	X	unput(c);
	X	}
SHAR_EOF
if test 14053 -ne "`wc -c < 'lex.c'`"
then
	echo shar: error transmitting "'lex.c'" '(should have been 14053 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'lex.l'" '(2164 characters)'
if test -f 'lex.l'
then
	echo shar: will not over-write existing file "'lex.l'"
else
sed 's/^	X//' << \SHAR_EOF > 'lex.l'
	X%{
	X#include "scripter.h"
	X#include "../archives/container/container.h"
	X#include "y.tab.h"
	X#include "symbol.h"
	X#include "util.h"
	X#include <strings.h>
	X%}
	X%%
	X
	X"#"[^\n]*   {	    ;		    }
	X[ \t]	    {	    ;		    }
	X[\n]	    {   inc_lineno();	    }
	X"++"	    {	return PLUSPLUS;    }
	X"--"	    {	return MINUSMINUS;  }
	X"{"	    {	return LBRACE;	    }
	X"}"	    {	return RBRACE;	    }
	X";"	    {	return SC;	    }
	X"="	    {	return EQUAL;	    }
	X"+"	    {	return PLUS;	    }
	X"-"	    {	return MINUS;	    }
	X"*"	    {	return STAR;	    }
	X"/"	    {	return SLASH;	    }
	X"<="	    {	return LTOREQ;	    }
	X">="	    {	return GTOREQ;	    }
	X">"	    {	return GREATERTHAN; }
	X"<"	    {	return LESSTHAN;    }
	X"=="	    {	return CEQUAL;	    }
	X"!="	    {	return NEQUAL;	    }
	X"$$"	    {	return CONCAT;	    }
	X"&&"	    {	return AND;	    }
	X"||"	    {	return OR;	    }
	X"!"	    {	return NOT;	    }
	X","	    {	return COMMA;	    }
	Xfor	    {	return FOR;	    }
	Xif	    {   return IF;	    }
	Xthen	    {   return THEN;	    }
	Xelse	    {	return ELSE;	    }
	Xwhile	    {   return WHILE;	    }
	Xreturn	    {	return RETURN;	    }
	Xbreak	    {	return BREAK;	    }
	Xcontinue    {	return CONTINUE;    }
	X[(]	    {	return LPAREN;	    }
	X[)]	    {	return RPAREN;	    }
	X
	X
	X[0-9]+[.]?[0-9]*	    {
	X		yylval.text = yytext;
	X		return NUMBER;
	X	    }
	X
	X
	X
	X'[^'\n]*'   { 
	X		yylval.text = yytext+1;
	X		yylval.text[yyleng-2] = '\0';
	X		return SQSTRING;
	X	    }
	X
	X\"(\\\"|[^"\n])*\"   { 
	X		yylval.text = yytext+1;
	X		yylval.text[yyleng-2] = '\0';
	X		yylval.text = escapesout(yylval.text);
	X		return DQSTRING;
	X	    }
	X
	X[_a-zA-Z][_a-zA-Z0-9]* 
	X	    {
	X		void *temp;
	X		temp = symlookup(yytext);
	X		if ((int) temp == 0) {
	X		    yylval.text = mystrcpy(yytext);
	X		    return STRING;
	X		}
	X		if (((int) temp > 0) && ((int) temp < 1024)) {
	X		    yylval.pc = (int) temp;
	X		    return VAR;
	X		} else {
	X		    yylval.inst = (Inst) temp;
	X		    return BUILTIN;
	X		}
	X	    }
	X\"	    {
	X		    return LONEQUOTE;
	X	    }
	X%%
	X#undef input()
	X#undef output()
	X#undef unput()
	Xextern Container mfin;
	Xchar input()
	X{
	X    char c;
	X    c = mfgetc(mfin);
	X    if ((c == EOF) || getgloberror())
	X	return 0;
	X    return c;
	X}
	Xchar output(c)
	Xchar c;
	X{
	X   putchar(c);
	X}
	Xchar unput()
	X{
	X    mfungetc(mfin);
	X}
SHAR_EOF
if test 2164 -ne "`wc -c < 'lex.l'`"
then
	echo shar: error transmitting "'lex.l'" '(should have been 2164 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'objmod.c'" '(15231 characters)'
if test -f 'objmod.c'
then
	echo shar: will not over-write existing file "'objmod.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'objmod.c'
	X#include <stdio.h>
	X#include <sunwindow/rect.h>
	X#include "util.h"
	X#include "string.h"
	X#include "../archives/hash/shash.h"
	X#include "../archives/hash/hash.h"
	X#include "map.h"
	X#include "itemmod.h"
	X#include "tlmod.h"
	X#include "info.h"
	X#include "attr.h"
	X#include "../archives/container/container.h"
	X#include "pathname.h"
	X#include "color.h"
	X#include "clipboard.h"
	X
	X#define	OBJECT_MAGIC (9543)
	X
	Xtypedef struct obj {
	X    int			magic;
	X    int			level;
	X    struct obj		*ancestor;
	X    String		name;
	X    Container		script;
	X    Container		label;
	X    MapPtr		msgsmap;
	X    SHashTPtr		msgstab;
	X    MapPtr		objmap;
	X    SHashTPtr		objtable;
	X    MapPtr		tlmap;
	X    SHashTPtr		tltable;
	X    MapPtr		objtls;
	X    InfoList		info;
	X    AttrPtr		attr;
	X} OB,*OBPtr;
	X
	Xtypedef struct temp {
	X    AttrPtr		attr;
	X    char		*pname;
	X    TLPtr		tl;
	X} TP,*TPPtr;
	X
	X
	X#define CHECK(obj)  (if (obj == NULL) \
	X			return NULL;)
	X
	Xstatic HashTPtr deltable;
	X
	Xstatic int objnumber;
	X
	Xchar *obj_number()
	X{
	X    return int_to_string(objnumber++);
	X}
	XTPPtr new_temp(tl)
	XTLPtr tl;
	X{
	X    TPPtr temp;
	X    temp = (TPPtr) malloc(sizeof(TP) * 1);
	X    temp->tl = tl;
	X    temp->attr = make_attr();
	X    return temp;
	X}
	Xvoid set_temp_pane(temp,pname)
	XTPPtr temp;
	Xchar *pname;
	X{
	X    temp->pname = pname;
	X}
	XTPPtr copy_temp(temp,tl)
	XTPPtr temp;
	XTLPtr tl;
	X{
	X    TPPtr t;
	X    t = new_temp(tl);
	X    t->attr = copy_attr(temp->attr); 
	X    return t;
	X}
	Xvoid unmake_temp(t)
	XTPPtr t;
	X{
	X    unmake_attr(t->attr);
	X    free(t);    
	X}
	XAttrPtr object_get_attr(obj)
	XOBPtr obj;
	X{
	X    return obj->attr;
	X}
	X
	X
	XOBPtr new_object(name,owner)
	XString name;
	XOBPtr owner;
	X{
	X    OBPtr   temp;
	X    temp = (OBPtr) malloc(sizeof(OB) * 1);
	X    temp->magic = OBJECT_MAGIC;
	X    temp->ancestor = owner;
	X    temp->name = mystrcpy(name);
	X    temp->objmap = make_map();
	X    temp->objtable = smake_hash();
	X    temp->msgsmap = make_map();
	X    temp->msgstab = smake_hash();
	X    Sinit_hash(1,temp->msgstab);
	X    temp->tlmap = make_map();
	X    temp->tltable = smake_hash();
	X    temp->objtls = make_map();
	X    temp->info = NULL;
	X    temp->attr = make_attr();
	X    temp->script = cnew_con();
	X    if (owner != NULL) {
	X	temp->level = owner->level;
	X    }
	X    Sinit_hash(4,temp->objtable);
	X
	X    Sinit_hash(4,temp->tltable);
	X    temp->label = cnew_con();
	X    return temp;
	X}
	XMapPtr object_get_msgsmap(obj)
	XOBPtr obj;
	X{
	X    return obj->msgsmap;
	X}
	XSHashTPtr object_get_msgstab(obj)
	XOBPtr obj;
	X{
	X    return obj->msgstab;
	X}
	Xvoid object_set_msgsmap(obj,map)
	XOBPtr obj;
	XMapPtr map;
	X{
	X    obj->msgsmap = map;
	X}
	Xvoid object_set_msgstab(obj,tab)
	XOBPtr obj;
	XSHashTPtr tab;
	X{
	X    obj->msgstab = tab;
	X}
	Xvoid unmake_object(obj)
	XOBPtr obj;
	X{
	X    clipboard_report_dealloc(obj);
	X    unmake_map(obj->objmap);
	X    sunmake_hash(obj->objtable);
	X    unmake_map(obj->msgsmap);
	X    sunmake_hash(obj->msgstab);
	X    unmake_map(obj->tlmap);
	X    sunmake_hash(obj->tltable);
	X    unmake_map(obj->objtls);
	X    unmake_infolist(obj->info);
	X    unmake_attr(obj->attr);
	X    cdestroy(obj->label);
	X    cdestroy(obj->script);
	X    free(obj);
	X}
	XTPPtr object_get_nthtemp(obj,n)
	XOBPtr obj;
	Xint n;
	X{
	X    TPPtr t;
	X    t = (TPPtr) map_get_nth(n,obj->objtls);
	X    return t;
	X}
	Xobject_add_temp(obj,tl,ord)
	XOBPtr obj;
	XTLPtr tl;
	Xint ord;
	X{
	X    TPPtr t;	
	X    t = new_temp(tl);
	X    add_to_map(ord,t,obj->objtls);
	X    tl_inc_ref_cnt(tl);
	X}
	Xobject_add_half_temp(obj,pname,ord)
	XOBPtr obj;
	Xchar *pname;
	Xint ord;
	X{
	X    TPPtr t;	
	X    t = new_temp(NULL);
	X    t->pname = pname;
	X    add_to_map(ord,t,obj->objtls);
	X}
	Xobject_add_pane(obj,t,ord)
	XOBPtr obj;
	XTPPtr t;
	Xint ord;
	X{
	X    add_to_map(ord,t,obj->objtls);
	X    tl_inc_ref_cnt(t->tl);
	X}
	Xobject_write_temp(obj,ord,fd)
	XOBPtr obj;
	Xint ord;
	XFILE *fd;
	X{
	X    TPPtr t;
	X    t = object_get_nthtemp(obj,ord);
	X    fprintf(fd,"%s\n",gen_anc_tlpname(t->tl,obj));
	X    write_attr(t->attr); 
	X}
	Xobject_del_temp(obj,ord)
	XOBPtr obj;
	Xint ord;
	X{
	X    TPPtr t;
	X    t = object_get_nthtemp(obj,ord);
	X    del_from_map(ord,obj->objtls);
	X    tl_dec_ref_cnt(t->tl);
	X    unmake_temp(t);
	X}
	XAttrPtr temp_get_attr(temp)
	XTPPtr temp;
	X{
	X    return temp->attr;
	X}
	X
	XTLPtr object_get_nthtemptl(obj,n)
	XOBPtr obj;
	Xint n;
	X{
	X    TPPtr t;
	X    t = (TPPtr) map_get_nth(n,obj->objtls);
	X    return t->tl;
	X}
	X
	XRect *object_get_temp_rect(temp)
	XTPPtr temp;
	X{
	X    return attr_get_rect(temp->attr);
	X}
	Xobject_set_tempcoords(obj,tl,r)
	XOBPtr obj;
	XTLPtr tl;
	XRect *r;
	X{
	X    int n,i;
	X    TPPtr t;
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	if (tl == object_get_nthtemptl(obj,i)) {
	X	    t = object_get_nthtemp(obj,i);
	X	    attr_set_rect(t->attr,r);
	X	    break;
	X	}
	X    }
	X    
	X}
	XTLPtr object_get_temp_tl(temp)
	XTPPtr temp;
	X{
	X    return temp->tl;
	X}
	X
	Xvoid object_del_temp_ptr(obj,tl)
	XOBPtr obj;
	XTLPtr tl;
	X{
	X    int n,i;
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	if (tl == object_get_nthtemptl(obj,i)) {
	X	    object_del_temp(obj,i);
	X	    break;
	X	}
	X    }
	X    
	X}
	Xint object_has_panetl(obj,tl)
	XOBPtr obj;
	XTLPtr tl;
	X{
	X    int n,i;
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	if (tl == object_get_nthtemptl(obj,i)) {
	X	    return 1;
	X	}
	X    }
	X    return 0;
	X    
	X}
	X
	X
	Xint object_get_numtemps(obj)
	XOBPtr obj;
	X{
	X    return map_get_size(obj->objtls);
	X}
	Xobject_add(obj,owner,ord)
	XOBPtr	obj;
	XOBPtr	owner;
	Xint	ord;
	X{
	X    obj->ancestor = owner;
	X    add_to_map(ord,obj,owner->objmap);
	X    sadd_to_hash(obj->name,owner->objtable,obj);
	X}
	Xint  object_get_ord(owner,obj)
	XOBPtr	owner;
	XOBPtr	obj;
	X{
	X    int i;
	X    int n;
	X    OBPtr   object_get_nthobj();
	X    n = object_get_numchild(owner);
	X    for (i = 0; i < n; i++) {
	X	if (object_get_nthobj(i,owner) == obj) 
	X	    break;
	X    }
	X    if (i >= n) {
	X	mywarning("major error about heredity\n");
	X    }
	X    return i;    
	X}
	Xvoid object_del(owner,ord)
	XOBPtr	owner;
	Xint	ord;
	X{
	X    int i,n;
	X    OBPtr obj,object_get_nthobj();
	X    obj = object_get_nthobj(ord,owner);
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	object_del_temp(obj,0);
	X    }
	X    del_from_map(ord,owner->objmap);
	X    sdelete_from_hash(obj->name,owner->objtable,obj);
	X}
	XOBPtr object_get_owner(obj)
	XOBPtr obj;
	X{
	X    return obj->ancestor;
	X}
	Xvoid object_set_owner(obj,owner)
	XOBPtr obj,owner;
	X{
	X    obj->ancestor = owner;
	X}
	Xchar *object_get_name(obj)
	XOBPtr obj;
	X{
	X    return obj->name;
	X}
	XOBPtr object_get_firstobj(obj)
	XOBPtr obj;
	X{
	X    return object_get_nthobj(0,obj);
	X}
	XOBPtr object_get_nthobj(n,obj)
	Xint n;
	XOBPtr obj;
	X{
	X    return (OBPtr) map_get_nth(n,obj->objmap);
	X}
	XTLPtr object_get_nthtl(n,obj)
	Xint n;
	XOBPtr obj;
	X{
	X    return (TLPtr) map_get_nth(n,obj->tlmap);
	X}
	Xint object_get_numchild(obj)
	XOBPtr obj;
	X{
	X    return map_get_size(obj->objmap);
	X}
	Xint object_get_numtl(obj)
	XOBPtr obj;
	X{
	X    return map_get_size(obj->tlmap);
	X}
	XSHashTPtr object_get_ctable(obj)
	XOBPtr obj;
	X{
	X    return obj->objtable;
	X}
	XSHashTPtr object_get_btable(obj)
	XOBPtr obj;
	X{
	X    return obj->tltable;
	X}
	Xint object_get_numtls(obj)
	XOBPtr obj;
	X{
	X    return map_get_size(obj->tlmap);
	X}
	X
	X/*
	X**	FIX 8/16/88 decl of get_treerot
	X*/
	XOBPtr get_treeroot();
	X
	Xvoid object_set_name(obj,name)
	XOBPtr obj;
	XString name;
	X{
	X    OBPtr owner;
	X    if (obj == get_treeroot()) {
	X	return;
	X    }
	X    owner = obj->ancestor;
	X    sdelete_from_hash(obj->name,owner->objtable,obj);
	X    free(obj->name);
	X    obj->name = mystrcpy(name);
	X    sadd_to_hash(obj->name,owner->objtable,obj);
	X}
	XContainer object_get_script(obj)
	XOBPtr obj;
	X{
	X    return obj->script;
	X}
	XContainer object_get_label(obj)
	XOBPtr obj;
	X{
	X    return obj->label;
	X}
	Xvoid object_set_label(obj,label)
	XOBPtr obj;
	XContainer label;
	X{
	X    obj->label = label;
	X}
	XContainer object_get_color(obj)
	XOBPtr obj;
	X{
	X    return attr_get_col(obj->attr);
	X}
	X
	Xvoid object_set_level(obj,level)
	XOBPtr obj;
	Xint level;
	X{
	X    obj->level = level;
	X}
	Xint object_get_level(obj)
	XOBPtr obj;
	X{
	X    return obj->level;
	X}
	Xvoid object_set_script(obj,script)
	XOBPtr obj;
	XContainer script;
	X{
	X    obj->script = script;
	X}
	Xvoid object_set_color(obj,color)
	XOBPtr obj;
	XContainer color;
	X{
	X    attr_set_col(obj->attr,color);
	X}
	XInfoList object_get_info(obj)
	XOBPtr obj;
	X{
	X    return obj->info;
	X}
	Xvoid object_set_info(obj,ilist)
	XOBPtr obj;
	XInfoList ilist;
	X{
	X    obj->info = ilist;    
	X}
	Xvoid object_add_tl(ord,tl,obj)
	Xint ord;
	XTLPtr tl;
	XOBPtr obj;
	X{
	X    tl_set_owner(tl,obj);
	X    add_to_map(ord,tl,obj->tlmap);
	X    sadd_to_hash(tl_get_name(tl),obj->tltable,tl);
	X}
	Xvoid object_del_tl(tl)
	XTLPtr tl;
	X{
	X    OBPtr obj;
	X    int ord;
	X    int n;
	X    char x[128];
	X    if (tl_get_ref_cnt(tl) != 0) {
	X	sprintf(x,"\"%s\" used by some object, so cannot be deleted.\n",
	X	    tl_get_name(tl));
	X	confirm_ok(x);
	X	open_tl(tl);
	X	return;
	X    }
	X    obj = tl_get_owner(tl);
	X    n = object_get_numtls(obj);    
	X    for (ord = 0;ord < n;ord++) {
	X	if (object_get_nthtl(ord,obj) == tl) 
	X	    break;
	X    }
	X    if (ord >= n) {
	X	mywarning("tl not found \n");
	X	return;
	X    }
	X    del_from_map(ord,obj->tlmap);
	X    sdelete_from_hash(tl_get_name(tl),obj->tltable,tl);
	X/*    put_tl_clipboard(tl,ONLY_REF);*/
	X/*    tl_unmake(tl);*/
	X}
	Xint object_get_tl_ord(obj,tl)
	XOBPtr obj;
	XTLPtr tl;
	X{
	X    int i,n;
	X    n = object_get_numtls(obj);
	X    for (i = 0; i < n; i++) {
	X	if (object_get_nthtl(i,obj) == tl) {
	X	    return i;
	X	}
	X    }
	X    return -1;
	X}
	XOBPtr copy_object(obj)
	XOBPtr obj;
	X{
	X    OBPtr new;
	X    TPPtr temp;
	X    TLPtr tl;
	X    int i,n,j;
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	temp = object_get_nthtemp(obj,i);
	X	j = object_get_tl_ord(obj,temp->tl);
	X	if (j == -1) {
	X	    mywarning(
	X"Attempt to copy an object which is not self-contained!");
	X	    return NULL;
	X	}
	X    }
	X    new = new_object(mystrcpy(
	X	object_get_name(obj)),
	X	object_get_owner(obj));
	X    n = object_get_numtls(obj);
	X    for (i = 0; i < n; i++) {
	X	tl = object_get_nthtl(i,obj);
	X	object_add_tl(i,tl_copy(tl),new);
	X    }
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	temp = object_get_nthtemp(obj,i);
	X	j = object_get_tl_ord(obj,temp->tl);
	X	tl = object_get_nthtl(j,new);
	X	object_add_pane(new,copy_temp(temp,tl),i);
	X    }
	X    new->attr = copy_attr(obj->attr);
	X    new->script = ccpy_con(obj->script);
	X    compile_object_script(obj);
	X    return new;
	X}
	Xint check_tree_for_self_containment(obj)
	XOBPtr obj;
	X{
	X    int i,n,j;
	X    TPPtr temp;
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	temp = object_get_nthtemp(obj,i);
	X	j = object_get_tl_ord(obj,temp->tl);
	X	if (j == -1) {
	X	    return -1;
	X	}
	X    }
	X    n = object_get_numchild(obj);
	X    for (i = 0; i < n; i++) {
	X	if (check_tree_for_self_containment(object_get_nthobj(i,obj)) == -1) {
	X	    return -1;
	X	}
	X    }
	X
	X}
	XOBPtr copy_tree(obj)
	XOBPtr obj;
	X{
	X    OBPtr new;
	X    OBPtr cur;
	X    TPPtr temp;
	X    TLPtr tl;
	X    int i,n,j;
	X    if (check_tree_for_self_containment(obj) == -1) {
	X	mywarning("Attempt to copy an object which is not self-contained!");
	X	return NULL;
	X    }
	X    new = new_object(mystrcpy(
	X	object_get_name(obj)),object_get_owner(obj));
	X    n = object_get_numtls(obj);
	X    for (i = 0; i < n; i++) {
	X	tl = object_get_nthtl(i,obj);
	X	object_add_tl(i,tl_copy(tl),new);
	X    }
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	temp = object_get_nthtemp(obj,i);
	X	tl = object_get_nthtl(object_get_tl_ord(obj,temp->tl),new);
	X	object_add_pane(new,copy_temp(temp,tl),i);
	X    }
	X    n = object_get_numchild(obj);
	X    for (i = 0; i < n; i++) {
	X	cur = object_get_nthobj(i,obj);
	X	object_add(copy_tree(cur),new,i);
	X    }
	X    new->attr = copy_attr(obj->attr);
	X    new->script = ccpy_con(obj->script);
	X    compile_object_script(obj,NO_REPORT);
	X    return new;
	X}
	X
	XOBPtr read_object(fd,owner,level)
	XFILE *fd;
	XOBPtr owner;
	Xint level;
	X{
	X    char *name;
	X    OBPtr obj;
	X    TLPtr tl;
	X    int numtl,numkid;
	X    int i;
	X    int numtemp;
	X    if (fd == NULL) {
	X	mywarning("yikes!!!\n");
	X    }
	X    obj_number();
	X    name = fgetline(fd);
	X    obj = new_object(name,owner);
	X    read_script(fd,object_get_label(obj)); 
	X    obj->level = level;
	X    object_add(obj,owner,0);
	X    read_script(fd,object_get_script(obj));
	X    compile_object_script(obj,NO_REPORT);
	X    fscanf(fd,"%d\n",&numtl);
	X    for (i = 0; i < numtl; i++) {
	X	tl = read_tl(fd,obj);
	X	if (tl != NULL) {
	X	    object_add_tl(i,tl,obj);
	X	}
	X    }
	X    fscanf(fd,"%d\n",&numtemp);
	X    for (i = 0; i < numtemp; i++) {
	X	AttrPtr at;
	X	TPPtr t;
	X	name = fgetline(fd);
	X	at = read_attr(fd);
	X	object_add_half_temp(obj,name,i);
	X/*	object_add_temp(obj,tl,i);*/
	X	t = object_get_nthtemp(obj,i);
	X	t->attr = at;
	X	if (tl != NULL) {
	X	} else {
	X	    mywarning("file corrupt!\n");
	X	}
	X    }
	X    fscanf(fd,"%d\n",&numkid);
	X    for (i = 0; i < numkid; i++) {
	X	read_object(fd,obj,level);
	X    }
	X    obj->attr = read_attr(fd);
	X    obj->info = read_info(fd,obj);
	X    return obj;
	X}
	XOBPtr create_master(name)
	Xchar *name;
	X{
	X    
	X    OBPtr obj;
	X    TLPtr tl;
	X    obj = new_object(name,NULL);
	X    return obj;
	X}
	Xvoid init_objmod()
	X{
	X    deltable = make_hash();
	X    init_hash(40,deltable);    
	X}
	Xvoid init_deltable()
	X{
	X    unmake_hash(deltable);
	X    deltable = make_hash();
	X    init_hash(40,deltable);
	X}
	X
	X/*
	X**	FIX  8/16/88 decl for get_distinguished
	X*/
	XOBPtr get_distinguished();
	X
	Xvoid delete_object1(obj)
	XOBPtr obj;
	X{
	X    int i,n,k;
	X    OBPtr father;
	X    check_delete_aux(obj);    
	X    if (check_delete_object(obj) != 0) {
	X	return;
	X    }
	X    if (obj == get_distinguished()) {
	X	set_distinguished(NULL);
	X    }
	X    father = object_get_owner(obj);
	X    n = object_get_numchild(obj);
	X    for (i = 0; i < n; i++) {
	X	delete_object1(object_get_firstobj(obj));
	X    }
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	object_del_temp(obj,0);
	X    }
	X    k = object_get_numtls(obj);
	X    for (i = 0; i < k; i++) {
	X	object_del_tl(object_get_nthtl(0,obj));	
	X    }
	X    if (father != NULL) {
	X	n = object_get_ord(father,obj);
	X	object_del(father,n);	
	X	close_obj(obj);
	X	unmake_object(obj);
	X    }
	X}
	Xvoid delete_object(obj)
	XOBPtr obj;
	X{
	X    int i,n,k;
	X    OBPtr father;
	X    
	X    init_deltable();
	X    delete_object1(obj);
	X    
	X}
	Xint check_delete_object(obj)
	XOBPtr obj;
	X{
	X    int i,n,k;
	X    int failed;
	X    int val;
	X    char x[128];
	X    TLPtr tl;
	X    n = object_get_numtemps(obj);
	X
	X    n = object_get_numchild(obj);
	X    failed = 0;
	X    for (i = 0; i < n; i++) {
	X	failed = check_delete_object(object_get_nthobj(i,obj));
	X	if (failed) {
	X	    return failed;
	X	}
	X    }
	X    k = object_get_numtls(obj);
	X    for (i = 0; i < k; i++) {
	X	n = (int) hlookup(object_get_nthtl(i,obj),deltable);
	X	if (tl_get_ref_cnt(object_get_nthtl(i,obj)) > n) {
	X	    sprintf(x,"%s used by some object, so cannot be deleted.\n",
	X		tl_get_name(object_get_nthtl(i,obj)));
	X	    confirm_ok(x);
	X	    return 1;
	X	}
	X    }
	X    return 0;
	X}
	Xint check_delete_aux(obj)
	XOBPtr obj;
	X{
	X    int i,n,k;
	X    int failed;
	X    int val;
	X    TLPtr tl;
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	tl = object_get_nthtemptl(obj,i);
	X	val = (int) hlookup(tl,deltable);
	X	if (val == NULL) {
	X	    val = 0;
	X	} else {
	X	    delete_from_hash(tl,deltable);
	X	}
	X	val++;
	X	add_to_hash(tl,deltable,val);
	X    }
	X    n = object_get_numchild(obj);
	X    for (i = 0; i < n; i++) {
	X	check_delete_aux(object_get_nthobj(i,obj));
	X    }
	X}
	Xvoid fill_in_tree(obj)
	XOBPtr obj;
	X{
	X    OBPtr new;
	X    OBPtr cur;
	X    TPPtr temp;
	X    TLPtr tl;
	X    int i,n;
	X    n = object_get_numtemps(obj);
	X    for (i = 0; i < n; i++) {
	X	temp = object_get_nthtemp(obj,i);
	X	temp->tl = tl_ofpname(temp->pname,obj);
	X	tl_inc_ref_cnt(temp->tl);
	X    }
	X    n = object_get_numchild(obj);
	X    for (i = 0; i < n; i++) {
	X	cur = object_get_nthobj(i,obj);
	X	fill_in_tree(cur);
	X    }
	X}
	X
SHAR_EOF
if test 15231 -ne "`wc -c < 'objmod.c'`"
then
	echo shar: error transmitting "'objmod.c'" '(should have been 15231 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'objmod.h'" '(1105 characters)'
if test -f 'objmod.h'
then
	echo shar: will not over-write existing file "'objmod.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'objmod.h'
	X#define	CHECK_OBJECT(x)	if ((*(int *) x) != 9543) { \
	X				mywarning("bad object magic number!\n"); \
	X				return; \
	X			} 		    
	Xtypedef	    void    *OBPtr;
	Xtypedef	    void    *TPPtr;
	X
	Xvoid	    *object_get_attr();
	X
	Xvoid	    *object_get_temp_tl();
	X
	XOBPtr	    new_object();
	X
	Xvoid	    unmake_object();
	X
	Xint	    object_add();
	X
	XOBPtr	    object_get_owner();
	X
	Xchar	    *object_get_name();
	X
	XOBPtr	    object_get_nthobj();
	XOBPtr	    copy_object();
	X
	Xvoid	    *object_get_nthtl();
	X
	Xint	    object_get_numchild();
	X
	Xint	    object_get_numtl();
	X
	Xvoid	    *object_get_ctable();
	X
	Xvoid	    *object_get_btable();
	X
	Xint	    object_get_numtls();
	X
	Xvoid	    object_set_name();
	X
	Xvoid	    *object_get_info();
	X
	Xvoid	    object_set_info();
	X
	Xvoid	    object_add_tl();
	X
	XOBPtr	    create_master();
	X
	Xint	    object_get_ord();
	X
	Xvoid	    object_del();
	X
	XOBPtr	    read_object();
	X
	Xvoid	    *object_get_nthtemp();
	Xvoid	    *object_get_nthtemptl();
	Xvoid	    object_add_temp();
	Xvoid	    object_del_temp();
	Xvoid	    object_del_temp_ptr();
	X
	Xvoid	    *object_get_label();
	Xvoid	    object_set_label();
	Xvoid	    *copy_obj();
	Xvoid	    *copy_tree();
SHAR_EOF
if test 1105 -ne "`wc -c < 'objmod.h'`"
then
	echo shar: error transmitting "'objmod.h'" '(should have been 1105 characters)'
fi
fi # end of overwriting check
echo shar: done with directory "'src'"
cd ..
#	End of shell archive
exit 0



More information about the Comp.sources.sun mailing list