home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
useful
/
util
/
moni
/
snoopdos
/
source
/
snoopdos.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-17
|
41KB
|
1,123 lines
/*
* SNOOPDOS.H vi:ts=4
*
* Copyright (c) Eddy Carroll, September 1994.
*
* This header file defines all the global variables and structures
* used by the various SnoopDos code modules.
*
* Exactly one module should #define MAIN before including this file,
* to ensure that the variables are defined (as opposed to declared).
*/
#undef GLOBAL
#undef INIT
#ifdef MAIN
# define GLOBAL
# define INIT(x) = x
#else
# define GLOBAL extern
# define INIT(x)
#endif
#ifndef SNOOPTEXT_H
#define CATCOMP_NUMBERS
#include "snooptext.h"
#endif
#define MSG(x) TextTable[x]
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define BTOC(addr) ((void *)(((ULONG)(addr)) << 2))
#define SETTINGS_BASENAME "SnoopDos.prefs"
#define LOGFILE_NAME "SnoopDos.log"
#define PORT_NAME "SNOOPDOS"
// #define PATCHES_NAME "SnoopDos Patches" /* Up to beta 11 */
#define PATCHES_NAME "SnoopDos Patchlist" /* Beta 12 onwards */
#define HELP_BASENAME "SnoopDos"
#define HELP_AREXX_PORT "SNOOPDOS_HELP"
#define APPICON_NAME "SnoopDos"
#define BACKGROUND_NAME "SnoopDos Support Process"
#define MINSTACKSIZE 12288 /* Minimum stack size we can run with */
/*
* Global constants
*/
#define MAX_STR_LEN 200 /* Max. string length for misc stuff */
#define MAX_SHORT_LEN 40 /* Max. short string len for misc stuff */
#define MAX_LOCK_LEN 100 /* Max. length of a lock string */
#define MIN_BUF_SIZE 4096 /* Min. size of history buffer */
#define PC_NAMELEN 40 /* Max. length of cached task names */
#define MAX_SEGTRACKER_LEN 50 /* Max. len of segtracker module name */
#define MAX_FORM_LEN 50 /* Max number of format %'s in form str */
#define NUM_PCACHE_ENTRIES 16 /* No. of task IDs to cache */
#define NUM_PACKET_ENTRIES 5 /* No. of outstanding packets to cache */
#define NUM_CACHED_TASKS 10 /* No. of task entries to cache */
#define MAX_DOS_DEVICES 100 /* Maximum no of DOS devs we recognise */
#define LOGBUFFER_SIZE 8192 /* Size of buffer for file logging */
#define SAVEBUFFER_SIZE 4096 /* Size of i/o buffer for saving buffer */
#define MAX_LOAD_NESTING 3 /* Only 3 levels of nested config files */
#define MAX_FIELD_LEN 99 /* Maximum width of a format field */
/*
* Constants associated with specific functions
*/
#define SETBUF_KEEPOLD 0 /* Keep old buffer when allocating new */
#define SETBUF_FORCENEW 1 /* Force new, even if means losing old */
/* --- for ShowBuffer() --- */
#define DISPLAY_QUICK 1 /* Redraw buffer using quickest method */
#define DISPLAY_ALL 2 /* Force redraw of all lines in buffer */
#define DISPLAY_NONE 4 /* Only update vars, don't refresh */
/* --- for CreateEvent() --- */
#define NO_EXPAND 0 /* Don't expand filenames to full paths */
#define EXPAND_NAME 1 /* Do expand filenames to full paths */
/* --- for InstallNewFormat() --- */
#define NEW_LISTVIEW 0 /* Indicates new listview format */
#define NEW_STRING 1 /* Indicates new string format */
/* -- for MainLoop() -- */
#define DEFAULT_WIDTH 832 /* Default window width */
#define DEFAULT_HEIGHT 300 /* Default window height */
/* -- CurrentLogType -- */
#define LT_FILE 0 /* Currently logging to a file */
#define LT_DEVICE 1 /* Currently logging to a device */
#define LT_DEBUG 2 /* Currently logging to debug device */
/* -- MonitorMode -- */
#define MONITOR_NORMAL 0 /* Monitoring normal activity */
#define MONITOR_PAUSED 1 /* Currently paused */
#define MONITOR_DISABLED 2 /* Currently disabled */
/* -- ShowGadget() -- */
#define GADGET_DOWN 0 /* Show gadget in selected state */
#define GADGET_UP 1 /* Show gadget in unselected state */
/* -- SelectFont() -- */
#define FONTSEL_WINDOW 0 /* Request new window font */
#define FONTSEL_BUFFER 1 /* Request new buffer font */
/* -- SelectFile() -- */
#define FILESEL_LOADCONFIG 0 /* Request name of existing config file */
#define FILESEL_SAVECONFIG 1 /* Request name of new config file */
#define FILESEL_DEFLOGNAME 2 /* Request name of default log file */
#define FILESEL_NEWLOGNAME 3 /* Request name of new log file */
#define FILESEL_SAVEBUFFER 4 /* Request name of save buffer file */
#define FILESEL_SAVEWINDOW 5 /* Request name of save window file */
/* -- SaveConfig() -- */
#define SAVE_NOICON 0 /* Don't save icon with settings file */
#define SAVE_ICON 1 /* Try and save icon with settings file */
/* -- SetLogGadget() -- */
#define LG_NOREFRESH 0 /* Don't refresh main log mode gadgets */
#define LG_REFRESH 1 /* Do refresh main win log mode gadgets */
/* -- RecalcMainWindow() -- */
#define NOREDRAW_GADGETS 0 /* Don't redraw gadgets after recalc */
#define REDRAW_GADGETS 1 /* Do redraw gadgets after recalc */
/* -- UpdateDeviceList() -- */
#define SCANDEV_DELAY 0 /* Wait before checking for new devices */
#define SCANDEV_IMMEDIATE 1 /* Check for new devices immediately */
/* -- CreateCustomImage() -- */
#define IMAGE_FONT 0 /* Request image for font button */
#define IMAGE_FILE 1 /* Request image for file button */
/* -- SaveBuffer() -- */
#define SAVEBUF_WINDOW 0 /* Save only visible portion of buffer */
#define SAVEBUF_ALL 1 /* Save entire buffer */
#define SAVEBUF_CLIPBOARD ((char *)(-1)) /* Indicates saving to clipboard */
#define SAVEBUF_PROMPT 0 /* Prompt user before overwriting file */
#define SAVEBUF_OVERWRITE 1 /* Always verwrite existing file */
#define KB_SHORTCUT_SIZE 256 /* Size of array for keyboard shortcuts */
/*
* Macro (courtesy of Doug Walker) used to allocate longword-aligned
* data on the stack. We can't use __aligned inside our patches
* because the caller may not have a longword-aligned stack.
*/
#define D_S(name, type) char c_##name[sizeof(type)+3];\
type *name = (type *)((long)(c_##name+3) & ~3)
/*
* This is the template used to match tasks, when we exclude the
* Workbench and Shell tasks from the list. %s refers to the user's
* chosen pattern. We really want to use a pattern of (A & B) where
* A is the pattern that excludes Workbench/Shell and B is the
* user pattern. Since AmigaDOS doesn't support an & operator, we
* need to use boolean logic to transform this to ~(~A | ~B) which
* produces the string below.
*
* PAT_EASY_EXCLUDE is used when there is no match string -- it's a
* slightly simpler (and hopefully faster) version of the exclude
* system tasks string.
*/
#define PAT_COMPLEX_EXCLUDE "~((Workbench|Shell Process|Background CLI)|~(%s))"
#define PAT_EASY_EXCLUDE "~(Workbench|Shell Process|Background CLI)"
/*
* Some list stuff
*/
typedef struct List List;
typedef struct MsgPort MsgPort;
typedef struct Node Node;
typedef struct SignalSemaphore Semaphore;
typedef struct Task Task;
typedef struct Process Process;
typedef struct Requester Requester;
#define HeadNode(list) ((void *)((list)->lh_Head))
#define TailNode(list) ((void *)((list)->lh_TailPred))
#define NextNode(node) ((void *)((Node *)(node))->ln_Succ)
#define PrevNode(node) ((void *)((Node *)(node))->ln_Pred)
#define FORLIST(list,p) for ((p) = (void *)(list)->lh_Head; \
((Node *)(p))->ln_Succ; \
(p) = (void *)((Node *)(p))->ln_Succ)
/*
* Now our gadget IDs
*
* If you're changing the order of the first 20-30 boolean gadgets,
* then be sure to make corresponding changes to the tables contained
* in PATCHES.C and SETTINGS.C.
*/
typedef enum {
GID_DUMMY, /* Make sure gadget ID never equals zero */
#define FIRST_BOOL_GADGET GID_FINDPORT
#define FIRST_SYS_GADGET GID_FINDPORT
GID_FINDPORT,
GID_FINDRESIDENT,
GID_FINDSEMAPHORE,
GID_FINDTASK,
GID_LOCKSCREEN,
GID_OPENDEVICE,
GID_OPENFONT,
GID_OPENLIBRARY,
GID_OPENRESOURCE,
GID_READTOOLTYPES,
GID_SENDREXX,
#define LAST_SYS_GADGET GID_SENDREXX