 
#ifndef bush_DEFINED
#define bush_DEFINED 1
 
#ifndef class_DEFINED
#include <class.h>
#endif /* class_DEFINED */
/* 
 * This file was generated by the Andrew class system preprocessor.
 * Don't make changes to this file as it is created from bush.ch and will be
 * overwritten.  Make changes to bush.ch instead.
 */ 
 
#ifndef class_StaticInfoOnly
/* 
 * The following information was copied, as-is, from bush.ch.
 */ 
 
/* ********************************************************************** *\
 *         Copyright IBM Corporation 1988,1991 - All Rights Reserved      *
 *        For full copyright information see:'andrew/config/COPYRITE'     *
\* ********************************************************************** */

/*
	$Disclaimer: 
*Permission to use, copy, modify, and distribute this software and its 
*documentation for any purpose is hereby granted without fee, 
*provided that the above copyright notice appear in all copies and that 
*both that copyright notice, this permission notice, and the following 
*disclaimer appear in supporting documentation, and that the names of 
*IBM, Carnegie Mellon University, and other copyright holders, not be 
*used in advertising or publicity pertaining to distribution of the software 
*without specific, written prior permission.
*
*IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS 
*DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
*ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT 
*SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER 
*BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
*DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
*WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
*ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
*OF THIS SOFTWARE.
* $
*/

/**  SPECIFICATION -- External Facility Suite  *********************************

TITLE	The Bush Data-object

MODULE	bush.ch

VERSION	0.0

AUTHOR	TC Peters & GW Keim
	Information Technology Center, Carnegie-Mellon University 

DESCRIPTION
	This is the suite of Methods that support the Bush Data-object.

    NB: The comment-symbol "===" indicates areas which are:
	    1 - Questionable
	    OR
	    2 - Arbitrary
	    OR
	    3 - Temporary Hacks
    Such curiosities need be resolved prior to Project Completion...


HISTORY
  08/21/85	Created (TCP)
  01/15/89	Convert to ATK (GW Keim)

END-SPECIFICATION  ************************************************************/


#include <tree.ih>

struct entry_mode {
    unsigned int do_rescan:1;
    unsigned int destroyed:1;
    unsigned int selected:1;
    unsigned int detailed:1;
    unsigned int stat_failed:1;
    unsigned int scan_failed:1;
};

struct entry_kind {
    unsigned int dir:1;
    unsigned int soft_link:1;
    unsigned int file:1;
};

struct Dir_Entry {
    char *name;
    char *link_name;
    struct entry_kind type;
    struct entry_mode mode;
    size_t size;
    time_t time_stamp;
    char *owner;
    int nlinks;
    unsigned permissions;
    int position;
    tree_type_node parent, instance;
};

struct Dir_Entries {
    int count;
    struct Dir_Entry **Entry;
};

struct Dir_ {
    time_t time_stamp;
    char *path, *name;
    struct entry_mode mode;
    tree_type_node tn;
    struct Dir_Entries *Dir_Entries;
};






/* 
 * End of information copied from bush.ch.
 */ 
 
#endif /* class_StaticInfoOnly *//* 
 * Include the superclass information
 */ 
#define dontDefineRoutinesFor_apt
#include "apt.ih"
#undef dontDefineRoutinesFor_apt

 
 
#ifndef class_StaticInfoOnly
/* 
 * Data structure for bush 
 */ 
struct bush { 
    union {
	struct basicobject_methods *bush_methods;
	struct traced traced;
	struct observable observable;
	struct dataobject dataobject;
	struct apt apt;
    } header;

	char		 given_dir_name[1025];
	struct tree	*tree;
	char		*root_pathname;
	struct vector	*uid_uname_map;
	char		 mycellname[1000];
	int		 debug;

};

 
/* 
 * End of data structure for bush.
 */ 
 

#endif /* class_StaticInfoOnly */

#ifndef class_StaticInfoOnly

#ifndef bush_PROGRAMMERVERSION
#define bush_PROGRAMMERVERSION 1
#endif /* bush_PROGRAMMERVERSION */

#ifdef bush_VERSION
#undef bush_VERSION
#endif /* bush_VERSION */
#define bush_VERSION ((((bush_PROGRAMMERVERSION << 16) ^ (47 << 8) ^ sizeof(struct bush)) & 0x7ffff) + 0x80000 + (64 << 20))


#endif /* class_StaticInfoOnly */
#define bush_StaticLoadOnlyThisClass()  \
{ extern struct classinfo *bush__GetClassInfo(); \
 extern struct classheader *bush_classheader_StaticExport; \
  (void) class_EnterInfo(NULL, bush_classheader_StaticExport->name, bush__GetClassInfo, NULL, bush_classheader_StaticExport->namekey); } 
 
#define bush_StaticLoad()  \
    { \
    apt_StaticLoad(); \
    bush_StaticLoadOnlyThisClass();  \
    } 
 
#define bush_StaticEntry  {bush_StaticLoad()} 
 
#ifndef class_StaticInfoOnly
static struct classheader bush_classheader = {
    bush_VERSION,
    "bush",
    "bush",
    (struct basicobject_methods *) &class_RoutineStruct,
};

#define bush_CLASSPROCEDURES (bush_classheader.classprocedures)
int bush_classref_;
#endif /* class_StaticInfoOnly */

#endif /* bush_DEFINED */

#if !defined(bush_ROUTINESDEFINED) && !defined(dontDefineRoutinesFor_bush) && !defined(class_StaticEntriesOnly)
#define bush_ROUTINESDEFINED

#define bush_Reference(self) \
 (((&(self)->header.traced))->refcount++)
#define bush_UnReference(self) \
 ((((&(self)->header.traced))->refcount>0)?((&(self)->header.traced))->refcount--:0)
#define bush_ReferenceCount(self) \
 (((&(self)->header.traced))->refcount)
#define bush_AddObserver(self,observer) \
    ((* ((void (*)())((self)->header.bush_methods->routines[0]))) (self,observer))
#define bush_IsObserver(self,observer) \
    ((* ((boolean (*)())((self)->header.bush_methods->routines[1]))) (self,observer))
#define bush_RemoveObserver(self,observer) \
    ((* ((void (*)())((self)->header.bush_methods->routines[2]))) (self,observer))
#define bush_NotifyObservers(self,value) \
    ((* ((void (*)())((self)->header.bush_methods->routines[3]))) (self,value))
#define bush_ObservedChanged(self,changed,value) \
    ((* ((void (*)())((self)->header.bush_methods->routines[4]))) (self,changed,value))
#define bush_AddRecipient(self,trigger,rcvr,func,rock) \
    ((* ((boolean (*)())((self)->header.bush_methods->routines[5]))) (self,trigger,rcvr,func,rock))
#define bush_DeleteRecipient(self,trigger,rcvr) \
    ((* ((void (*)())((self)->header.bush_methods->routines[6]))) (self,trigger,rcvr))
#define bush_PullTrigger(self,trigger) \
    ((* ((void (*)())((self)->header.bush_methods->routines[7]))) (self,trigger))
#define bush_DisableTrigger(self,trigger) \
    ((* ((void (*)())((self)->header.bush_methods->routines[8]))) (self,trigger))
#define bush_EnableTrigger(self,trigger) \
    ((* ((void (*)())((self)->header.bush_methods->routines[9]))) (self,trigger))
#define bush_DisableCount(self,trigger) \
    ((* ((long (*)())((self)->header.bush_methods->routines[10]))) (self,trigger))
#define bush_Read(self,file,id) \
    ((* ((long (*)())((self)->header.bush_methods->routines[11]))) (self,file,id))
#define bush_Write(self,file,writeid,level) \
    ((* ((long (*)())((self)->header.bush_methods->routines[12]))) (self,file,writeid,level))
#define bush_ReadOtherFormat(self,file,fmt,encoding,description) \
    ((* ((boolean (*)())((self)->header.bush_methods->routines[13]))) (self,file,fmt,encoding,description))
#define bush_WriteOtherFormat(self,file,writeid,level,usagetype,boundary) \
    ((* ((long (*)())((self)->header.bush_methods->routines[14]))) (self,file,writeid,level,usagetype,boundary))
#define bush_GetModified(self) \
    ((* ((long (*)())((self)->header.bush_methods->routines[15]))) (self))
#define bush_SetModified(self) \
    ((* ((void (*)())((self)->header.bush_methods->routines[16]))) (self))
#define bush_ViewName(self) \
    ((* ((char * (*)())((self)->header.bush_methods->routines[17]))) (self))
#define bush_SetAttributes(self,attributes) \
    ((* ((void (*)())((self)->header.bush_methods->routines[18]))) (self,attributes))
#define bush_Put(self,property,type,rock) \
    ((* ((void (*)())((self)->header.bush_methods->routines[19]))) (self,property,type,rock))
#define bush_Get(self,property,type,rock) \
    ((* ((short (*)())((self)->header.bush_methods->routines[20]))) (self,property,type,rock))
#define bush_ListCurrentViews(self,array,size) \
    ((* ((int (*)())((self)->header.bush_methods->routines[21]))) (self,array,size))
#define bush_RestoreModified(self,oldmodified) \
    ((* ((void (*)())((self)->header.bush_methods->routines[22]))) (self,oldmodified))
#define bush_UniqueID(self) \
 ((long)((&(self)->header.dataobject)))
#define bush_GetWriteID(self) \
 ( ((&(self)->header.dataobject))->writeID )
#define bush_SetWriteID(self,newValue) \
 ( (((&(self)->header.dataobject))->writeID) = (newValue) )
#define bush_GetID(self) \
      ( ((&(self)->header.dataobject))->id )
#define bush_SetID(self,newValue) \
      ( (((&(self)->header.dataobject))->id) = (newValue) )
#define bush_SetAreaTitle(self,title,area) \
    ((* ((void (*)())((self)->header.bush_methods->routines[23]))) (self,title,area))
#define bush_SetAreaSpreadTitle(self,title,count,area,mode) \
    ((* ((void (*)())((self)->header.bush_methods->routines[24]))) (self,title,count,area,mode))
#define bush_SetAreaTitleFontName(self,font,area) \
    ((* ((void (*)())((self)->header.bush_methods->routines[25]))) (self,font,area))
#define bush_SetAreaLegend(self,legend,area) \
    ((* ((void (*)())((self)->header.bush_methods->routines[26]))) (self,legend,area))
#define bush_SetAreaSpreadLegend(self,legend,count,area,mode) \
    ((* ((void (*)())((self)->header.bush_methods->routines[27]))) (self,legend,count,area,mode))
#define bush_SetAreaLegendFontName(self,font,area) \
    ((* ((void (*)())((self)->header.bush_methods->routines[28]))) (self,font,area))
#define bush_ReadObject(self,file,id,reader) \
    ((* ((long (*)())((self)->header.bush_methods->routines[29]))) (self,file,id,reader))
#define bush_ReadObjectField(self) \
    ((* ((struct apt_field * (*)())((self)->header.bush_methods->routines[30]))) (self))
#define bush_ParseFieldContent(self,string) \
    ((* ((char ** (*)())((self)->header.bush_methods->routines[31]))) (self,string))
#define bush_ParseFieldContents(self,string) \
    ((* ((struct apt_field_contents * (*)())((self)->header.bush_methods->routines[32]))) (self,string))
#define bush_WriteObject(self,file,id,level,writer) \
    ((* ((void (*)())((self)->header.bush_methods->routines[33]))) (self,file,id,level,writer))
#define bush_WriteObjectField(self,field) \
    ((* ((void (*)())((self)->header.bush_methods->routines[34]))) (self,field))
#define bush_AreaTitlesAnchor(self,area) \
	    (((&(self)->header.apt))->titles[area].strings)
#define bush_AreaTitlesCount(self,area) \
	    (((&(self)->header.apt))->titles[area].strings_count)
#define bush_AreaTitle(self,area) \
		    ((((&(self)->header.apt))->titles[area].strings) ?					 (*((&(self)->header.apt))->titles[area].strings)[0] : NULL)
#define bush_AreaTitles(self,area,i) \
		    ((*((&(self)->header.apt))->titles[area].strings)[i])
#define bush_AreaTitleFontName(self,area) \
	    (((&(self)->header.apt))->titles[area].font_name)
#define bush_AreaLegendsAnchor(self,area) \
	    (((&(self)->header.apt))->legends[area].strings)
#define bush_AreaLegendsCount(self,area) \
	    (((&(self)->header.apt))->legends[area].strings_count)
#define bush_AreaLegend(self,area) \
		    ((((&(self)->header.apt))->legends[area].strings) ?					 (*((&(self)->header.apt))->legends[area].strings)[0] : NULL)
#define bush_AreaLegends(self,area,i) \
	    ((*((&(self)->header.apt))->legends[area].strings)[i])
#define bush_AreaLegendFontName(self,area) \
	    (((&(self)->header.apt))->legends[area].font_name)
#define bush_InitTree(self,root_path) \
    ((* ((void (*)())((self)->header.bush_methods->routines[35]))) (self,root_path))
#define bush_ScanDir(self,tn) \
    ((* ((int (*)())((self)->header.bush_methods->routines[36]))) (self,tn))
#define bush_BuildSubDirs(self,tn) \
    ((* ((void (*)())((self)->header.bush_methods->routines[37]))) (self,tn))
#define bush_DestroySubDirs(self,tn) \
    ((* ((void (*)())((self)->header.bush_methods->routines[38]))) (self,tn))
#define bush_DestroyDirEntries(self,tn) \
    ((* ((void (*)())((self)->header.bush_methods->routines[39]))) (self,tn))
#define bush_DestroyDirEntry(self,tn) \
    ((* ((void (*)())((self)->header.bush_methods->routines[40]))) (self,tn))
#define bush_FreeSubDirs(self,tn) \
    ((* ((void (*)())((self)->header.bush_methods->routines[41]))) (self,tn))
#define bush_DestroyEntry(self,tn,Entry) \
    ((* ((int (*)())((self)->header.bush_methods->routines[42]))) (self,tn,Entry))
#define bush_ScanRequired(self,tn) \
    ((* ((boolean (*)())((self)->header.bush_methods->routines[43]))) (self,tn))
#define bush_RenameDir(self,tn,newPath,newName) \
    ((* ((int (*)())((self)->header.bush_methods->routines[44]))) (self,tn,newPath,newName))
#define bush_MoveEntry(self,tn,Entry,newName) \
    ((* ((int (*)())((self)->header.bush_methods->routines[45]))) (self,tn,Entry,newName))
#define bush_PerformSystemAction(self,name,argv) \
    ((* ((int (*)())((self)->header.bush_methods->routines[46]))) (self,name,argv))
#define bush_Tree(self) \
 ((self)->tree)
#define bush_TreeRoot(self) \
 (tree_RootNode(bush_Tree((self))))
#define bush_RootPathName(self) \
 ((self)->root_pathname)
#define bush_GivenRootPathName(self) \
 ((self)->given_dir_name)
#define bush_Dir(self,tn) \
 ((struct Dir_ *)tree_NodeDatum(bush_Tree((self)),tn))
#define bush_DirMode(self,tn) \
 (bush_Dir((self),tn)->mode)
#define bush_DirPath(self,tn) \
 (bush_Dir((self),tn)->path)
#define bush_DirName(self,tn) \
 (bush_Dir((self),tn)->name)
#define bush_DirTimeStamp(self,tn) \
 (bush_Dir((self),tn)->time_stamp)
#define bush_RootDirPath(self) \
 (bush_DirPath((self),bush_TreeRoot((self))))
#define bush_DirEntries(self,tn) \
 (bush_Dir((self),tn)->Dir_Entries)
#define bush_DirEntriesCount(self,tn) \
 (bush_DirEntries((self),tn)->count)
#define bush_DirEntryPtr(self,tn) \
 (bush_DirEntries((self),tn)->Entry)
#define bush_DirEntry(self,tn,i) \
 (bush_DirEntries((self),tn)->Entry[i])
#define bush_DirEntryMode(self,tn,i) \
 (bush_DirEntry((self),tn,i)->mode)
#define bush_DirEntryPos(self,tn,i) \
 (bush_DirEntry((self),tn,i)->position)
#define bush_DirEntryName(self,tn,i) \
 (bush_DirEntry((self),tn,i)->name)
#define bush_DirEntryLinkName(self,tn,i) \
 (bush_DirEntry((self),tn,i)->link_name)
#define bush_DirEntryType(self,tn,i) \
 (bush_DirEntry((self),tn,i)->type)
#define bush_DirEntryOwner(self,tn,i) \
 (bush_DirEntry((self),tn,i)->owner)
#define bush_DirEntryNLinks(self,tn,i) \
 (bush_DirEntry((self),tn,i)->nlinks)
#define bush_DirEntryTimeStamp(self,tn,i) \
 (bush_DirEntry((self),tn,i)->time_stamp)
#define bush_DirEntrySize(self,tn,i) \
 (bush_DirEntry((self),tn,i)->size)
#define bush_DirEntryPerms(self,tn,i) \
 (bush_DirEntry((self),tn,i)->permissions)
#define bush_DirEntryParent(self,tn,i) \
 (bush_DirEntry((self),tn,i)->parent)
#define bush_DirEntryInstance(self,tn,i) \
 (bush_DirEntry((self),tn,i)->instance)
#define bush_DirEntryParentDir(self,tn,i) \
 (bush_Dir((self),bush_DirEntryParent((self),tn,i)))
#define bush_RootDir(self) \
 (bush_Dir((self),bush_TreeRoot((self))))
#define bush_Parent(self,tn) \
 (tree_ParentNode(bush_Tree((self)),tn))
#define bush_Child(self,tn) \
 (tree_ChildNode(bush_Tree((self)),tn))
#define bush_Left(self,tn) \
 (tree_LeftNode(bush_Tree((self)),tn))
#define bush_Right(self,tn) \
 (tree_RightNode(bush_Tree((self)),tn))
#define bush_ParentDir(self,tn) \
 (bush_Dir((self),bush_Parent((self),tn)))
#define bush_ChildDir(self,tn) \
 (bush_Dir((self),bush_Child((self),tn)))
#define bush_LeftDir(self,tn) \
 (bush_Dir((self),bush_Left((self),tn)))
#define bush_RightDir(self,tn) \
 (bush_Dir((self),bush_Right((self),tn)))

#define bush_NewFromObject(self) \
    ((* ((struct bush * (*)())((self)->header.bush_methods->info->procs->routines[0]))) (&bush_classheader, (self)->header.bush_methods->info->versionnumber))
#define bush_New() \
    (*((struct bush * (*)()) (bush_CLASSPROCEDURES->routines[0])))(&bush_classheader,bush_VERSION)
#define bush_Initialize(self) \
    (*((void (*)()) (bush_CLASSPROCEDURES->routines[2])))(&bush_classheader,self, bush_VERSION)

#define bush_Destroy(self) \
    ((* ((void (*)()) ((self)->header.bush_methods->info->procs->routines[1]))) (&bush_classheader, self))
#define bush_Finalize(self) \
    (*((void (*)()) (bush_CLASSPROCEDURES->routines[3])))(&bush_classheader,self)

#define bush_Create(init_dir) \
    (*((struct bush * (*)()) (bush_CLASSPROCEDURES->routines[5])))(&bush_classheader,init_dir)


#endif /* !defined(bush_ROUTINESDEFINED) && !defined(dontDefineRoutinesFor_bush ) && !defined(class_StaticEntriesOnly)*/

