X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=appdef.h;fp=appdef.h;h=cc82ae86da1172a5c606b8c889b7ac06a9637b63;hb=c208f01c6a4c8d896c81692f65a302b426cb7c5f;hp=0000000000000000000000000000000000000000;hpb=2df2fbe518d5a221ce6e3ee88a3fb23fb1b94b27;p=codemux.git diff --git a/appdef.h b/appdef.h new file mode 100644 index 0000000..cc82ae8 --- /dev/null +++ b/appdef.h @@ -0,0 +1,53 @@ +#ifndef _APPDEF_H_ +#define _APPDEF_H_ + +/* useful definitions */ +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef SUCCESS +#define SUCCESS 0 +#endif + +#ifndef FAILURE +#define FAILURE (-1) +#endif + +#ifndef INT_MAX +#ifdef MAX_INT +#define INT_MAX MAXINT +#endif +#endif + +#ifndef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +#endif + +#ifndef MIN +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +#endif + +#ifndef NELEMS +#define NELEMS(x) (sizeof(x)/sizeof(x[0])) +#endif + +#ifndef SKIP_CHARS +#define SKIP_CHARS(x) while(!isspace((int)*x)) (x)++ +#endif + +#ifndef SKIP_SPACES +#define SKIP_SPACES(x) while (isspace((int)*x)) (x)++ +#endif + +#ifndef SKIP_WORD +#define SKIP_WORD(x) do { SKIP_SPACES(x); \ + SKIP_CHARS(x); \ + SKIP_SPACES(x);} while(0) +#endif + +#endif //_APPDEF_H_