parsehdr.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #pragma once
  2. #include "Enums.h"
  3. /*
  4. *$Log: parsehdr.h,v $
  5. */
  6. /* Header file for parsehdr.c */
  7. typedef unsigned long dword; /* 32 bits */
  8. typedef unsigned char byte; /* 8 bits */
  9. typedef unsigned short word; /* 16 bits */
  10. typedef unsigned char boolT; /* 8 bits */
  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. //#include "locident.h" /* For the hlType enum */
  33. //#define bool unsigned char /* For internal use */
  34. typedef
  35. struct ph_func_tag
  36. {
  37. char name[SYMLEN]; /* Name of function or arg */
  38. hlType typ; /* Return type */
  39. int numArg; /* Number of args */
  40. int firstArg; /* Index of first arg in chain */
  41. int next; /* Index of next function in chain */
  42. bool bVararg; /* True if variable num args */
  43. } PH_FUNC_STRUCT;
  44. typedef
  45. struct ph_arg_tag
  46. {
  47. char name[SYMLEN]; /* Name of function or arg */
  48. hlType typ; /* Parameter type */
  49. } PH_ARG_STRUCT;
  50. #define DELTA_FUNC 32 /* Number to alloc at once */
  51. #define PH_JUNK 0 /* LPSTR buffer, nothing happened */
  52. #define PH_PROTO 1 /* LPPH_FUNC ret val, func name, args */
  53. #define PH_FUNCTION 2 /* LPPH_FUNC ret val, func name, args */
  54. #define PH_TYPEDEF 3 /* LPPH_DEF definer and definee */
  55. #define PH_DEFINE 4 /* LPPH_DEF definer and definee */
  56. #define PH_ERROR 5 /* LPSTR error string */
  57. #define PH_WARNING 6 /* LPSTR warning string */
  58. #define PH_MPROTO 7 /* ????? multi proto???? */
  59. #define PH_VAR 8 /* ????? var decl */
  60. /* PROTOS */
  61. boolT phData(char *buff, int ndata);
  62. boolT phPost(void);
  63. boolT phFree(void);
  64. void checkHeap(char *msg); /* For debugging only */
  65. void phBuffToFunc(char *buff);
  66. void phBuffToDef(char *buff);
  67. #define TOK_TYPE 256 /* A type name (e.g. "int") */
  68. #define TOK_NAME 257 /* A function or parameter name */
  69. #define TOK_DOTS 258 /* "..." */
  70. #define TOK_EOL 259 /* End of line */
  71. typedef enum
  72. {
  73. BT_INT, BT_CHAR, BT_FLOAT, BT_DOUBLE, BT_STRUCT, BT_VOID, BT_UNKWN
  74. } baseType;