GHSRC = errout.h idfsize.h ifdepth.h lapbuf.h \
nparams.h numsize.h obufsize.h \
parbufsize.h pathlength.h strsize.h textsize.h \
- botch_free.h debug.h inputtype.h dobits.h line_prefix.h
+ botch_free.h debug.h inputtype.h dobits.h line_prefix.h mkdep.h
# Other generated files, for 'make clean' only
GENERATED = tokenfile.g Lpars.h LLfiles LL.output lint.out \
domacro.o: inputtype.h
domacro.o: interface.h
domacro.o: macro.h
+domacro.o: mkdep.h
domacro.o: nparams.h
domacro.o: parbufsize.h
domacro.o: textsize.h
input.o: input.h
input.o: inputtype.h
main.o: file_info.h
+main.o: idf.h
main.o: idfsize.h
+main.o: macro.h
+main.o: mkdep.h
options.o: charoffset.h
options.o: class.h
options.o: idf.h
preprocess.o: input.h
preprocess.o: inputtype.h
preprocess.o: line_prefix.h
+preprocess.o: mkdep.h
preprocess.o: obufsize.h
replace.o: LLlex.h
replace.o: charoffset.h
#define LINE_PREFIX "#" /* prefix for generated line directives,
either "#" or "#line"
*/
+
+
+!File: mkdep.h
+#undef MKDEP 1 /* if defined, preprocessor only outputs
+ names of files included (not finished yet)
+ */
+
+
+
#include "class.h"
#include "macro.h"
#include "bits.h"
+#include "mkdep.h"
IMPORT char **inctable; /* list of include directories */
IMPORT char *getwdir();
inctable[0] = WorkingDir;
if (filenm) {
if (!InsertFile(filenm, &inctable[tok==FILESPECIFIER],&result)){
+#ifndef MKDEP
error("cannot find include file \"%s\"", filenm);
+#else
+ warning("cannot find include file \"%s\"", filenm);
+ add_file(filenm);
+#endif
}
else {
+#ifdef MKDEP
+ add_file(result);
+#endif
WorkingDir = getwdir(result);
svnestlevel[++nestcount] = nestlevel;
FileName = result;
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
struct id_usr {
- struct macro *idu_macro;
+ union {
+ struct macro *idu_macro;
+ struct idf *idu_file;
+ } idu_x;
int idu_resmac;
};
#define IDF_TYPE struct id_usr
#define IDF_HSIZE 6
-#define id_macro id_user.idu_macro
+#define id_macro id_user.idu_x.idu_macro
+#define id_file id_user.idu_x.idu_file
#define id_resmac id_user.idu_resmac
#include <idf_pkg.spec>
#define K_LINE 9
#define K_UNDEF 10
#define K_PRAGMA 11
+#define K_FILE 100 /* for dependency generator */
#include <alloc.h>
#include <em_arith.h>
+#include <assert.h>
#include "file_info.h"
#include "idfsize.h"
+#include "mkdep.h"
+#ifdef MKDEP
+#include "idf.h"
+#include "macro.h"
+#endif
extern char *symbol2str();
extern char *getwdir();
extern int err_occurred;
int idfsize = IDFSIZE;
+extern char options[];
arith ifval;
do_option(par);
argc--, argv++;
}
+#ifdef MKDEP
+ options['P'] = 1;
+#endif
compile(argc - 1, &argv[1]);
exit(err_occurred);
}
source ? source : "stdin");
if (source) WorkingDir = getwdir(dummy);
preprocess(source);
+#ifdef MKDEP
+ list_files();
+#endif
}
+
+#ifdef MKDEP
+struct idf *file_head;
+
+list_files()
+{
+ register struct idf *p = file_head;
+
+ while (p) {
+ assert(p->id_resmac == K_FILE);
+ print("%s\n", p->id_text);
+ p = p->id_file;
+ }
+}
+
+add_file(s)
+ char *s;
+{
+ register struct idf *p = str2idf(s, 0);
+
+ if (! p->id_resmac) {
+ p->id_resmac = K_FILE;
+ p->id_file = file_head;
+ file_head = p;
+ }
+}
+#endif
#include "idfsize.h"
#include "bits.h"
#include "line_prefix.h"
-
-char _obuf[OBUFSIZE];
+#include "mkdep.h"
#ifdef DOBITS
char bits[128];
#endif
+#ifndef MKDEP
+char _obuf[OBUFSIZE];
+
Xflush()
{
sys_write(STDOUT, _obuf, OBUFSIZE);
}
+#endif
preprocess(fn)
char *fn;
{
register int c;
+#ifndef MKDEP
register char *op = _obuf;
register char *ob = &_obuf[OBUFSIZE];
+#endif
char Xbuf[256];
int lineno = 0;
extern char options[];
+#ifndef MKDEP
#define flush(X) (sys_write(STDOUT,_obuf,X))
#define echo(ch) if (op == ob) { Xflush(); op = _obuf; } *op++ = (ch);
#define newline() echo('\n')
+#else
+#define flush(X)
+#define echo(ch) (ch)
+#define newline()
+#endif
if (! options['P']) {
/* Generate a line directive communicating the
struct idf *param;
char *nam;
extern char *GetIdentifier();
- extern struct idf *str2idf();
UnknownIdIsZero = 0;
nam = GetIdentifier();