diff options
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 218 |
1 files changed, 95 insertions, 123 deletions
@@ -3,10 +3,10 @@ /*\ * - * COPYRIGHT 1990 - * DIGITAL EQUIPMENT CORPORATION - * MAYNARD, MASSACHUSETTS - * ALL RIGHTS RESERVED. + * COPYRIGHT 1990 + * DIGITAL EQUIPMENT CORPORATION + * MAYNARD, MASSACHUSETTS + * ALL RIGHTS RESERVED. * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. @@ -25,7 +25,7 @@ * documentation, and that the name of Digital Equipment Corporation not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. - \*/ + \*/ /***====================================================================***/ @@ -43,14 +43,14 @@ /***====================================================================***/ #ifndef OPAQUE_DEFINED -typedef void *Opaque; +typedef void *Opaque; #endif #ifndef NullOpaque #define NullOpaque ((Opaque)NULL) #endif #ifndef BOOLEAN_DEFINED -typedef char Boolean; +typedef char Boolean; #endif #ifndef True @@ -60,7 +60,7 @@ typedef char Boolean; #define booleanText(b) ((b)?"True":"False") #ifndef COMPARISON_DEFINED -typedef int Comparison; +typedef int Comparison; #define Greater ((Comparison)1) #define Equal ((Comparison)0) @@ -70,36 +70,32 @@ typedef int Comparison; #endif #if 0 -typedef union { - int i; - unsigned u; - void *p; - void *(*fp)(); +typedef union +{ + int i; + unsigned u; + void *p; + void *(*fp) (); } Union; #endif /***====================================================================***/ -extern Opaque uAlloc( - unsigned /* size */ -); -extern Opaque uCalloc( - unsigned /* n */, - unsigned /* size */ -); -extern Opaque uRealloc( - Opaque /* old */, - unsigned /* newSize */ -); -extern Opaque uRecalloc( - Opaque /* old */, - unsigned /* nOld */, - unsigned /* nNew */, - unsigned /* newSize */ -); -extern void uFree( - Opaque /* ptr */ -); +extern Opaque uAlloc(unsigned /* size */ + ); +extern Opaque uCalloc(unsigned /* n */ , + unsigned /* size */ + ); +extern Opaque uRealloc(Opaque /* old */ , + unsigned /* newSize */ + ); +extern Opaque uRecalloc(Opaque /* old */ , + unsigned /* nOld */ , + unsigned /* nNew */ , + unsigned /* newSize */ + ); +extern void uFree(Opaque /* ptr */ + ); #define uTypedAlloc(t) ((t *)uAlloc((unsigned)sizeof(t))) #define uTypedCalloc(n,t) ((t *)uCalloc((unsigned)n,(unsigned)sizeof(t))) @@ -115,9 +111,8 @@ extern void uFree( /***====================================================================***/ -extern Boolean uSetErrorFile( - char * /* name */ -); +extern Boolean uSetErrorFile(char * /* name */ + ); #define INFO6 uInformation #define INFO5 uInformation @@ -127,14 +122,14 @@ extern Boolean uSetErrorFile( #define INFO1 uInformation #define INFO uInformation -extern void uInformation( - const char * /* s */, ... -) +extern void +uInformation(const char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 1, 2))) + __attribute__ ((format(printf, 1, 2))) #endif -; + ; #define ACTION6 uAction #define ACTION5 uAction @@ -144,14 +139,13 @@ __attribute__((format(printf, 1, 2))) #define ACTION1 uAction #define ACTION uAction -extern void uAction( - const char * /* s */, ... -) + extern void uAction(const char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 1, 2))) + __attribute__ ((format(printf, 1, 2))) #endif -; + ; #define WARN6 uWarning #define WARN5 uWarning @@ -161,14 +155,13 @@ __attribute__((format(printf, 1, 2))) #define WARN1 uWarning #define WARN uWarning -extern void uWarning( - const char * /* s */, ... -) + extern void uWarning(const char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 1, 2))) + __attribute__ ((format(printf, 1, 2))) #endif -; + ; #define ERROR6 uError #define ERROR5 uError @@ -178,14 +171,13 @@ __attribute__((format(printf, 1, 2))) #define ERROR1 uError #define ERROR uError -extern void uError( - const char * /* s */, ... -) + extern void uError(const char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 1, 2))) + __attribute__ ((format(printf, 1, 2))) #endif -; + ; #define FATAL6 uFatalError #define FATAL5 uFatalError @@ -195,14 +187,13 @@ __attribute__((format(printf, 1, 2))) #define FATAL1 uFatalError #define FATAL uFatalError -extern void uFatalError( - const char * /* s */, ... -) + extern void uFatalError(const char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 1, 2))) + __attribute__ ((format(printf, 1, 2))) #endif -; + ; /* WSGO stands for "Weird Stuff Going On" */ #define WSGO6 uInternalError @@ -213,30 +204,24 @@ __attribute__((format(printf, 1, 2))) #define WSGO1 uInternalError #define WSGO uInternalError -extern void uInternalError( - const char * /* s */, ... -) + extern void uInternalError(const char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 1, 2))) + __attribute__ ((format(printf, 1, 2))) #endif -; + ; -extern void uSetPreErrorMessage( - char * /* msg */ -); + extern void uSetPreErrorMessage(char * /* msg */ + ); -extern void uSetPostErrorMessage( - char * /* msg */ -); + extern void uSetPostErrorMessage(char * /* msg */ + ); -extern void uSetErrorPrefix( - char * /* void */ -); + extern void uSetErrorPrefix(char * /* void */ + ); -extern void uFinishUp( - void -); + extern void uFinishUp(void); /***====================================================================***/ @@ -253,21 +238,18 @@ extern void uFinishUp( #define uStrCaseCmp(s1,s2) (strcasecmp(s1,s2)) #define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0) #else -extern int uStrCaseCmp( - const char * /* s1 */, - const char * /* s2 */ -); -extern int uStrCasePrefix( - const char * /* p */, - char * /* str */ -); + extern int uStrCaseCmp(const char * /* s1 */ , + const char * /* s2 */ + ); + extern int uStrCasePrefix(const char * /* p */ , + char * /* str */ + ); #endif #ifdef HAVE_STRDUP #define uStringDup(s1) (strdup(s1)) #else -extern char *uStringDup( - const char * /* s1 */ -); + extern char *uStringDup(const char * /* s1 */ + ); #endif /***====================================================================***/ @@ -286,35 +268,32 @@ extern char *uStringDup( #endif #ifdef DEBUG_VAR_NOT_LOCAL -extern + extern #endif -unsigned int DEBUG_VAR; + unsigned int DEBUG_VAR; -extern void uDebug( - char * /* s */, ... -) + extern void uDebug(char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 1, 2))) + __attribute__ ((format(printf, 1, 2))) #endif -; + ; -extern void uDebugNOI( /* no indent */ - char * /* s */, ... -) + extern void uDebugNOI( /* no indent */ + char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 1, 2))) + __attribute__ ((format(printf, 1, 2))) #endif -; + ; -extern Boolean uSetDebugFile( - char *name -); + extern Boolean uSetDebugFile(char *name); -extern FILE *uDebugFile; -extern int uDebugIndentLevel; -extern int uDebugIndentSize; + extern FILE *uDebugFile; + extern int uDebugIndentLevel; + extern int uDebugIndentSize; #define uDebugIndent(l) (uDebugIndentLevel+=(l)) #define uDebugOutdent(l) (uDebugIndentLevel-=(l)) #ifdef DEBUG_ON @@ -345,29 +324,24 @@ extern int uDebugIndentSize; #define uDEBUG_NOI5(f,s,a,b,c,d,e) #endif -extern Boolean uSetEntryFile( - char *name -); -extern void uEntry( - int /* l */, - char * /* s */, ... -) + extern Boolean uSetEntryFile(char *name); + extern void uEntry(int /* l */ , + char * /* s */ , ... + ) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6))) -__attribute__((format(printf, 2, 3))) + __attribute__ ((format(printf, 2, 3))) #endif -; + ; -extern void uExit( - int l,char *rtVal -); + extern void uExit(int l, char *rtVal); #ifdef ENTRY_TRACKING_ON #define ENTRY_BIT 0x10 #define LOW_ENTRY_BIT 0x1000 #define ENTER (DEBUG_VAR&ENTRY_BIT) #define FLAG(fLag) (DEBUG_VAR&(fLag)) -extern int uEntryLevel; + extern int uEntryLevel; #define uENTRY(s) { if (ENTER) uEntry(1,s);} #define uENTRY1(s,a) { if (ENTER) uEntry(1,s,a);} @@ -412,9 +386,7 @@ extern int uEntryLevel; #define uFLAG_ENTRY7(f,s,a,b,c,d,e,g,h) #define uFLAG_RETURN(v) { return(v);} #define uFLAG_VOIDRETURN { return; } -#endif +#endif #endif /* UTILS_H */ - - |