ack.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #ifndef UTILS_ACK_ACK_H
  6. #define UTILS_ACK_ACK_H
  7. #include "trans.h"
  8. #include "grows.h"
  9. #ifndef NORCSID
  10. #define RCS_ACK "$Id$"
  11. #endif
  12. /****************************************************************************/
  13. /* User settable options */
  14. /****************************************************************************/
  15. #define FRONTENDS "fe" /* The front-end definitions */
  16. #define TMPNAME "Ack_%x" /* Naming of temp. files */
  17. /****************************************************************************/
  18. /* Internal mnemonics, should not be tinkered with */
  19. /****************************************************************************/
  20. /* The names of some string variables */
  21. #define HOME "EM"
  22. #define RTS "RTS"
  23. #define HEAD "HEAD"
  24. #define TAIL "TAIL"
  25. #define SRC "SOURCE"
  26. #define LIBVAR "LNAME"
  27. #define SUFFIX "SUFFIX"
  28. /* Intended for flags, possibly in bit fields */
  29. #define YES (1)
  30. #define NO (0)
  31. #define MAYBE (2)
  32. #define EXTERN extern
  33. #define SUFCHAR '.' /* Start of SUFFIX in file name */
  34. #define SPACE ' '
  35. #define TAB '\t'
  36. #define EQUAL '='
  37. #define S_VAR '{' /* Start of variable */
  38. #define C_VAR '}' /* End of variable */
  39. #define A_VAR '?' /* Variable alternative */
  40. #define BSLASH '\\' /* Backslash */
  41. #define STAR '*' /* STAR */
  42. #define C_IN '<' /* Token specifying input */
  43. #define C_OUT '>' /* Token specifying output */
  44. #define S_EXPR '(' /* Start of expression */
  45. #define C_EXPR ')' /* End of expression */
  46. #define M_EXPR ':' /* Middle of two suffix lists */
  47. #define T_EXPR '=' /* Start of tail */
  48. #define NO_SCAN 0200 /* Bit set in character to defeat recogn. */
  49. typedef struct {
  50. char *p_path; /* points to the full pathname */
  51. int p_keeps:1; /* The string should be thrown when unused */
  52. int p_keep:1; /* The file should be thrown away after use */
  53. } path ;
  54. #define p_cont(elem) ((path *)l_content(elem))
  55. /* Return values of setpath() */
  56. enum f_path { FP_OK, FP_NOMATCH, FP_NOPATH } ;
  57. /* Own routines */
  58. enum f_path getpath(trf **first);
  59. enum f_path scan_end(trf **first);
  60. void noodstop();
  61. char *getvar(char *name);
  62. char *keeps(char *str);
  63. char *basename(char *string);
  64. char *skipblank(char *str);
  65. char *firstblank(char *str);
  66. char *getcore(unsigned size);
  67. char *changecore(char *ptr, unsigned int size);
  68. #define freecore(area) free(area)
  69. growstring scanb(char *line);
  70. growstring scanvars(char *line);
  71. void throws(char *str);
  72. void start_scan();
  73. void scan_found();
  74. void find_cpp();
  75. void try(list_elem *f_scan, char *suffix);
  76. void setlist(char *name);
  77. void fuerror(const char *fmt, ...);
  78. void transini();
  79. int process(char *arg);
  80. void setsvar(char *name, char *str);
  81. void getmapflags(trf *phase);
  82. void vprint(const char* fmt, ...);
  83. void disc_inputs(trf *phase);
  84. int startrf(trf *first);
  85. void setpvar(char *name,char *(*rout)(void));
  86. void l_add(list_head *header, char *string);
  87. void error(const char *fmt, ...);
  88. void do_Rflag(char *argp);
  89. void werror(const char *fmt, ...);
  90. void add_input(path *file, trf *phase);
  91. void add_head(char *str);
  92. void add_tail(char *str);
  93. int mayprep();
  94. int transform(trf *phase);
  95. void fatal(const char* fmt, ...);
  96. void l_clear(list_head *header);
  97. int satisfy(trf *trafo, char *suffix);
  98. int setfiles(trf *phase);
  99. void disc_files(trf *phase);
  100. int runphase(trf *phase);
  101. void rmfile(path *file);
  102. int mapflag(list_head *maplist, char *cflag);
  103. void clr_noscan(char *str);
  104. void l_throw(list_head *header);
  105. int mapexpand(char *mapentry, char *cflag);
  106. void prns(char *s);
  107. void set_Rflag(char *argp);
  108. void condit(growstring *line, list_head *fsuff, list_head *lsuff, char *tailval);
  109. void doassign(char *line, char *star, int length);
  110. void getcallargs(trf *phase);
  111. void discardargs(trf *phase);
  112. void quit(int code);
  113. void rmtemps();
  114. void intrf();
  115. void open_in(char *name);
  116. void close_in();
  117. int getinchar();
  118. int getln();
  119. void keephead(char *suffix);
  120. void varinit();
  121. void vieuwargs(int argc, char *argv[]);
  122. void firstarg(char *argp);
  123. void block(trf *first);
  124. void keeptail(char *suffix);
  125. void scanneeds();
  126. void setneeds(char *suffix, int tail);
  127. int run_exec(trf *phase, char *prog);
  128. void do_flush();
  129. void file_final(path *file);
  130. #define DEBUG 1 /* Allow debugging of Ack */
  131. #ifndef DEBUG
  132. # define debug 0 /* To surprise all these 'if ( debug ) 's */
  133. #else
  134. extern int debug ;
  135. #endif
  136. #endif /* UTILS_ACK_ACK_H */