parsehdr.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. *$Log: parsehdr.h,v $
  3. */
  4. /* Header file for parsehdr.c */
  5. typedef unsigned long dword; /* 32 bits */
  6. typedef unsigned char byte; /* 8 bits */
  7. typedef unsigned short word; /* 16 bits */
  8. typedef unsigned char boolT; /* 8 bits */
  9. #define TRUE 1
  10. #define FALSE 0
  11. #define BUFF_SIZE 8192 /* Holds a declaration */
  12. #define FBUF_SIZE 32700 /* Holds part of a header file */
  13. #define NARGS 15
  14. #define NAMES_L 160
  15. #define TYPES_L 160
  16. #define FUNC_L 160
  17. #define ERRF stdout
  18. void phError(char *errmsg);
  19. void phWarning(char *errmsg);
  20. #define ERR(msg) phError(msg)
  21. #ifdef DEBUG
  22. #define DBG(str) printf(str);
  23. #else
  24. #define DBG(str) ;
  25. #endif
  26. #define WARN(msg) phWarning(msg)
  27. #define OUT(str) fprintf(outfile, str)
  28. #define PH_PARAMS 32
  29. #define PH_NAMESZ 15
  30. #define SYMLEN 16 /* Including the null */
  31. #define Int long /* For locident.h */
  32. #define int16 short int /* For locident.h */
  33. #include "locident.h" /* For the hlType enum */
  34. #define bool unsigned char /* For internal use */
  35. #define TRUE 1
  36. #define FALSE 0
  37. typedef
  38. struct ph_func_tag
  39. {
  40. char name[SYMLEN]; /* Name of function or arg */
  41. hlType typ; /* Return type */
  42. int numArg; /* Number of args */
  43. int firstArg; /* Index of first arg in chain */
  44. int next; /* Index of next function in chain */
  45. bool bVararg; /* True if variable num args */
  46. } PH_FUNC_STRUCT;
  47. typedef
  48. struct ph_arg_tag
  49. {
  50. char name[SYMLEN]; /* Name of function or arg */
  51. hlType typ; /* Parameter type */
  52. } PH_ARG_STRUCT;
  53. #define DELTA_FUNC 32 /* Number to alloc at once */
  54. #define PH_JUNK 0 /* LPSTR buffer, nothing happened */
  55. #define PH_PROTO 1 /* LPPH_FUNC ret val, func name, args */
  56. #define PH_FUNCTION 2 /* LPPH_FUNC ret val, func name, args */
  57. #define PH_TYPEDEF 3 /* LPPH_DEF definer and definee */
  58. #define PH_DEFINE 4 /* LPPH_DEF definer and definee */
  59. #define PH_ERROR 5 /* LPSTR error string */
  60. #define PH_WARNING 6 /* LPSTR warning string */
  61. #define PH_MPROTO 7 /* ????? multi proto???? */
  62. #define PH_VAR 8 /* ????? var decl */
  63. /* PROTOS */
  64. boolT phData(char *buff, int ndata);
  65. boolT phPost(void);
  66. boolT phFree(void);
  67. void checkHeap(char *msg); /* For debugging only */
  68. void phBuffToFunc(char *buff);
  69. void phBuffToDef(char *buff);
  70. #define TOK_TYPE 256 /* A type name (e.g. "int") */
  71. #define TOK_NAME 257 /* A function or parameter name */
  72. #define TOK_DOTS 258 /* "..." */
  73. #define TOK_EOL 259 /* End of line */
  74. typedef enum
  75. {
  76. BT_INT, BT_CHAR, BT_FLOAT, BT_DOUBLE, BT_STRUCT, BT_VOID, BT_UNKWN
  77. } baseType;