home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
TIMEXSRC.ZIP
/
TIMEX.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-28
|
6KB
|
181 lines
/* timex.h -- global definitions for timex program.
February 1990 Mark E. Mallett, Personal Workstation Magazine.
This file contains definitions that are used in interaction with
the TIMEX program.
*/
#ifndef H_TIMEX /* Ordain multiple inclusions */
#define H_TIMEX
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif /* TRUE */
#ifndef NUL
#define NUL '\0'
#endif /* NUL */
/* Configuration */
#define DBFNAME "\\TIMEX\\TIMEX.DB"
#define LOGFNAME "\\TIMEX\\TIMEX.LOG"
#define REQPIPE "\\PIPE\\TIMEX" /* Name of the request pipe */
/* Alignment control. */
#define WORDALIGN sizeof(WORD) /* Align words to this many bytes */
#define LONGALIGN sizeof(LONG) /* longs */
/* Portable type definitions: adjust these to your machine. */
typedef unsigned char UBYTE;
typedef signed char SBYTE;
typedef short int WORD; /* 16 bit */
typedef unsigned short int UWORD;
#ifdef OUT
typedef long int LONG; /* 32 bit */
typedef unsigned long int ULONG;
#endif
typedef long int LONGINT; /* 32 bit */
typedef unsigned long int ULONGINT;
/* Error and status codes */
#define EC_OK 0 /* OK... */
#define EC_NOTOK 1 /* General error */
#define EC_MEMORY 2 /* Memory allocation */
#define EC_OPEN 3 /* File open */
#define EC_OTHER 0x100 /* Local error codes start here */
typedef /* Action classifications */
enum {
ACTION_RUN, /* Run a program */
} ACTTYPE;
typedef /* Day-of classifications */
enum {
DAYOF_MONTH,
DAYOF_WEEK
} DAYOF;
typedef /* Request and response codes */
enum {
REQ_ADD=0, /* Add an event */
REQ_MODIFY, /* Modify an event */
REQ_DEL, /* Delete an event */
REQ_GET, /* Get an event */
REQ_GETNEXT, /* Get next event */
RSP_OK=0x100, /* General OK response */
RSP_ERROR, /* Error happened */
RSP_EVENT /* Body of an event */
} TMXMSGCODE;
typedef /* Tags for transmitting events */
enum {
ETAG_NAME, /* Name */
ETAG_YEARS, /* Year list */
ETAG_MONTHS, /* Mask of months */
ETAG_DAYOF, /* Day-of type */
ETAG_HOURS, /* Hours mask */
ETAG_MINS, /* Minutes mask */
ETAG_PRIO, /* Priority class and value */
ETAG_ACTTYPE, /* Action type */
ETAG_ACTARG, /* Action arg */
ETAG_END=0xff /* End of packed event */
} ETAG;
/*
*//* structures */
typedef /* A year specification */
struct {
int y_first; /* First (inclusive) */
int y_last; /* Last (inclusive) */
} YEARSPEC;
typedef /* Event fields */
struct {
char *ev_nameP; /* Ptr to event name */
int ev_yearC; /* Number of specified years */
YEARSPEC *ev_yearP; /* Ptr to list of years. */
UWORD ev_months; /* Which months apply (mask) */
DAYOF ev_dayof; /* Day-of classification */
ULONG ev_dayofs; /* Day-of mask */
ULONG ev_hours; /* Hour mask */
ULONG ev_mins[2]; /* Minutes mask */
SBYTE ev_priclass; /* Priority class */
SBYTE ev_prival; /* Priority value */
ACTTYPE ev_acttype; /* Action classification */
char *ev_actargP; /* Ptr to action argument */
} EVENT;
typedef /* Format of a message */
struct {
TMXMSGCODE m_code; /* Message code */
int m_len; /* Message length */
} TMXMSG;
typedef /* Format of a REQ_GET request */
struct {
TMXMSG g_msghdr; /* Message header */
char g_evname[1]; /* NUL-terminated event name. */
} TMXREQ_GET;
typedef /* Format of REQ_GETNEXT request */
struct {
TMXMSG g_msghdr; /* Message header */
char g_evname[1]; /* NUL-terminated event name. */
} TMXREQ_GETNEXT;
typedef /* Format of REQ_DEL request */
struct {
TMXMSG d_msghdr; /* Message header */
char d_evname[1]; /* Name of event to delete. */
} TMXREQ_DEL;
typedef /* Format of an error response */
struct {
TMXMSG e_msghdr; /* Message header */
int e_code; /* Code, if any */
char e_msg[1]; /* Error message text */
} TMXRSP_ERR;
/* Prototypes for functions used in TIMEXUA and TIMEXBA */
void *emalloc( char *facP, char *itemP, int size );
void *erealloc( char *facP, char *itemP, char *oldP, int size );
void error( int errcode, char *fmtP, ... );
char *gettoken( char *stringP, char *bufP, int buflen,
char *vsepP, char *isepP );
char *newstr( char *facP, char *itemP, char *oldP );
int tkline( char *bufP, char *tbufP, char **tokv, int tokmax,
char *vsepP, char *isepP );
void warning( int errcode, char *fmtP, ... );
#endif /* H_TIMEX */