home *** CD-ROM | disk | FTP | other *** search
- /*
- * RevRdist.h - #defines and declarations needed for most of the
- * other files making up RevRdist
- */
-
- #include <HFS.h>
- #include <C_config.h>
-
- typedef StringPtr SP;
-
- #define ROOTDIRID 2L /* DirID of Mac root folder */
-
- /*
- * e_action - the list of possible actions to apply to a file/folder
- * note: order is important
- */
-
- enum e_action
- {
- A_DEFAULT = 0 /* not specified */
- ,A_PASS /* ignore this criterion */
- ,A_IGNORE /* leave alone */
- ,A_JUNK /* move to "junk" folder */
- ,A_DISCARD /* remove permanently */
- ,A_UPDATE /* copy from server */
- };
- typedef enum e_action action_t;
-
- /*
- * e_ctype - the types of cat_nodes
- */
- enum e_ctype
- {
- C_FOLDER /* node represents folder */
- ,C_FILE /* node represents file */
- };
- typedef enum e_ctype ctype_t;
-
- /*
- * e_dtype - the types of dist_nodes
- */
-
- enum e_dtype
- {
- D_FOLDER /* node represents a folder */
- ,D_FILE /* node represents a file */
- ,D_FOLDERDEF /* node holds folder defaults */
- };
- typedef enum e_dtype dtype_t;
-
- /*
- * actions - list of actions to apply under given conditions
- */
-
- struct actions
- {
- action_t ifclient; /* C if on client but not server */
- action_t ifserver; /* S if on server but not client */
- action_t ifcreate; /* V if server copy has different creation date */
- action_t ifnewer; /* N if server copy is newer */
- action_t ifolder; /* O if server copy is older */
- action_t ifsize; /* Z if server copy is different size */
- action_t otherwise; /* E if none of the above apply */
- action_t copywindow; /* W set client window posn from server*/
- action_t invisible; /* H set client object invisible */
- action_t locked; /* L set client object locked */
- };
- typedef struct actions actions_t;
-
- /*
- * dist_node - the structure of an entry read from the control file.
- * These are linked into a tree which mimics the significant subset
- * of the folder structure on the client disk.
- */
-
- struct dist_node
- {
- struct dist_node * sibp; /* sibling node */
- struct dist_node * childp; /* child node */
- struct dist_node * parentp; /* parent node */
- struct type_node * tlistp; /* start of file type list */
- StringPtr altname; /* name on server (when different) */
- struct actions actions; /* condition/action list for node */
- dtype_t d_type; /* type of node */
- unsigned char name[32]; /* component of path name */
- };
- typedef struct dist_node dnode_t;
-
- /*
- * type_node - a list of file types/creators also read from the
- * control file. Used to select files by type/creator instead of name.
- * These are linked into a tree in which the leaves and intermediate
- * nodes point back toward the root. The tlistp pointer in a directory
- * dist_node gives the start of a type_node chain which applies to files
- * in that directory.
- */
-
- struct type_node
- {
- struct type_node * morep; /* upward link */
- OsType ftype; /* file type */
- OsType fcreator; /* file creator */
- struct actions actions; /* actions to apply if file type/
- * creator match above */
- };
- typedef struct type_node tnode_t;
-
- /*
- * cat_node - the structure for saving information from GetCatInfo
- */
-
- struct cat_node
- {
- struct cat_node * link; /* next file/folder in list */
- Longint dirID; /* file/folder directory id */
- Longint parID; /* dirID of containing folder */
- unsigned long crDate; /* (file) creation date */
- unsigned long mdDate; /* (file) modification date */
- union
- {
- struct
- {
- FInfo finfo; /* (file) Finder info */
- Longint fileLen; /* (file) data fork length */
- Longint rsrcLen; /* (file) resource fork length */
- } f;
- struct
- {
- DInfo dinfo; /* (folder) Finder info */
- Point frScroll; /* (folder) scroll posn */
- Longint frOChain; /* (folder) open chain */
- } d;
- } in;
- Byte attrib; /* file/folder attribute byte */
- Byte access; /* (AppleShare) access rights */
- ctype_t ctype; /* file/folder */
- unsigned char name[32]; /* the component name */
- };
- typedef struct cat_node cnode_t;
-
- #include "junkp.h"
-
- /*
- * e_psind - index into preferences string array
- */
- enum e_psind
- {
- PS_ZONE /* name of AppleShare server zone */
- ,PS_SRVR /* name of AppleShare server */
- ,PS_USER /* user name on server */
- ,PS_PASS /* user's password */
- ,PS_DISTF /* path to distribution control file */
- ,PS_MASTF /* full path to master folder */
- ,PS_JUNKF /* name of junk folder */
- ,PS_MAX /* count of number of strings */
- ,PS_TIME /* boot-time run interval */
- };
- typedef enum e_psind psind_t;
- /* NOTE: any changes to the above must be reflected in the prefinfo
- * structure in pref.c
- */
-
- /*
- * prefs - Preferences information
- */
-
- struct prefs
- {
- StringHandle p[PS_MAX]; /* handles to preference strings */
- unsigned long p_interval; /* running interval */
- junkp_t p_jparam; /* junking parameters */
- Boolean p_modified; /* values have changed */
- };
- typedef struct prefs prefs_t;
-
- /*
- * e_pindex - index into preferences array
- */
-
- enum e_pindex
- {
- P_WORK = 0 /* the preference values to use */
- ,P_FILE /* preference values from pref file */
- };
- typedef enum e_pindex pindex_t;
-
- /*
- * file_info - information about important files/folders
- */
-
- struct file_info
- {
- StringHandle f_path; /* full path name of file/folder */
- Integer f_vol; /* vRefNum giving vol for file */
- Integer f_ref; /* refNum of file/working dir if open */
- Boolean f_launch; /* true if supplied at launch */
- Boolean f_set; /* true if list entry initialized */
- cnode_t f_info; /* the bulk of the information */
- };
- typedef struct file_info file_info_t;
-
- /*
- * f_index - index of file info in file_info array
- */
-
- enum f_index
- {
- FL_APPL /* the Application */
- ,FL_PREF /* preference file */
- ,FL_DIST /* dist control file */
- ,FL_MAST /* master folder */
- ,FL_JUNK /* junk folder */
- ,FL_ROOT /* client root folder */
- ,FL_TEMP /* temp file */
- ,FL_MAX /* how many files */
- };
- typedef enum f_index findex_t;
-
-
- /*
- * e_pending - Pending action to perform (values for Pending)
- */
- enum e_pending
- {
- PA_NULL = 0 /* nothing pending */
- ,PA_PREF /* invoke preferences dialog */
- ,PA_GO /* (try to) go to it */
- };
- typedef enum e_pending pending_t;
-
-
- /*
- * e_rstat - Running state
- */
- enum e_rstat
- {
- S_IDLE = 0 /* idle, accepting commands */
- ,S_RUNNING /* scanning & matching */
- ,S_PAUSED /* paused while scanning */
- };
- typedef enum e_rstat rstat_t;
-
- /*
- * Useful macros
- */
- #define COPYPS(s,d) BlockMove (s, d, (Size)(((s)[0]) + 1)) /* copy pas. str */
- #define DISPLAY(s) DisplayString ((StringPtr) s)
- #define ZERO(s) setmem ((char *)&(s), sizeof (s), 0) /* zero struct */
- #define ZEROAT(s) setmem ((char *)(s), sizeof (*(s)), 0) /* zero *struct * */
- #define fLocked 0x01 /* Finder locked flag */
-
- /*
- * Declarations for global variables
- */
- extern WindowPtr ActivityWind; /* window for listing actions */
- extern AppFile Ap_file; /* our argument file */
- extern Integer Ap_refNum; /* file refNum of application */
- extern Str255 Ap_volName; /* name of volume Ap is running from */
- extern Integer BlessedWD; /* current system folder */
- extern Longint ClientRoot; /* directory id of client root */
- extern unsigned long ClientSp; /* client volume space remaining */
- extern Integer ClientVol; /* client volume VRefNum */
- extern OSErr ClueID; /* error message STR# index */
- extern StringPtr Clue0; /* name of RevRdist routine detecting
- * error */
- extern StringPtr Clue1; /* name of MacOS routine detecting
- * error, or other error hint */
- extern StringPtr Clue2, Clue3; /* more hints */
- extern short Depth; /* folder depth */
- extern Integer Deskrefnum; /* refnum for Desktop file */
- extern short ErrorMsgs; /* count of messages in ErrorWind */
- extern WindowPtr ErrorWind; /* error message window */
- extern file_info_t * File_list; /* pointer to array of file info */
- extern long Flags; /* processing flags */
- #define DB_ECHODIST 0x00000001 /* echo control file as read */
- #define DB_LISTONLY 0x00000002 /* list actions without doing them */
- #define DB_STARTUP 0x00000004 /* running as startup application */
- #define DB_VERBOSE 0x00000008 /* list everything */
- #define DB_LOCKED 0x00000010 /* disallow preference changes */
- #define DB_DIALOG 0x00000020 /* bring up Debug dialog at start */
-
- extern unsigned char HighValue[];/* string lexically after any file name */
- extern Byte Junksuf[1+8];/* suffix to handle junk name conflicts */
- extern Str255 Mbuf; /* temp string, often used for msgs */
- extern StringPtr NullStr; /* constant empty string */
- extern rstat_t Pause; /* running state */
- extern pending_t Pending; /* pending action */
- extern DialogPtr PrefDialog; /* preferences dialog window */
- extern prefs_t Prefs[]; /* preferences values */
- extern Boolean Quit; /* true if requested to quit */
- extern Longint ServerRoot; /* ioDirID of master folder on server */
- extern Integer ServerVol; /* vRefNum of server volume */
- extern DialogPtr StatusDialog; /* status window */
- extern StringHandle Untitled; /* anonymous document name */
- extern CursHandle Watch; /* "busy" cursor */
-
- #include "rsrc.h"
- /*
- * prototypes for cross-file RevRdist functions
- */
- extern OSErr createFolder (StringPtr, Integer, Longint, cnode_t *);
- extern OSErr discard (cnode_t *, Boolean);
- extern void dispIndStr (WindowPtr, Integer, ...);
- extern void doPref (void);
- extern void doWindowMenu (Integer);
- extern void freeDist (dnode_t *);
- extern void freeInfo (file_info_t *);
- extern void freeList (cnode_t *);
- extern StringPtr fullpath (StringPtr, Integer, Longint);
- extern OSErr getInfo (StringPtr, Integer, Longint, cnode_t *);
- extern OSErr getInfoByPath (StringPtr, file_info_t *);
- extern OSErr getSet (void);
- extern void initGlobals (void);
- extern cnode_t * listFolder (Integer, Longint);
- extern OSErr makeJunk (void);
- extern OSErr moveToJunk (cnode_t *);
- extern void notice (Integer, ...);
- extern void panic (Boolean, Integer, ...);
- extern void prefDoFMenu (Integer);
- extern OSErr prefFetch (Integer);
- extern OSErr prefFFetch (file_info_t *);
- extern void prefMerge (pindex_t, Boolean);
- extern StringPtr pstrcat (StringPtr dest, StringPtr src);
- extern StringPtr pstrcat2 (StringPtr dest, StringPtr, StringPtr);
- extern OSErr relock (cnode_t *);
- extern void saveCatInfo (CInfoPBRec *, cnode_t *);
- extern void setDebug (void);
- extern void setmem (char *p, unsigned n, char c);
- extern void setStat (void);
- extern void statMsg (StringPtr);
- extern void statMsgClr (void);
- extern void showstat (void);
- extern void TextDialog (int dlogNum, Handle textHandle,
- int fontNum, int fontSize, Boolean wrap);
- extern void tidyUp (void);
- extern OSErr unlock (cnode_t *);
- extern void updateRoot (dnode_t *);
- extern void verifyBlessed (void);
- extern void warning (Integer, ...);
-
- #include <MacProto.h>