summaryrefslogtreecommitdiff
path: root/srcpos.h
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2008-01-03 17:43:31 -0600
committerJon Loeliger <jdl@freescale.com>2008-01-04 08:20:10 -0600
commit910efac4b49f43cb1b66eef5aa0bbd020920bf2a (patch)
tree0e6c49941be4b2003d0bc1dae80849a236abc9ad /srcpos.h
parentf77fe6a20e75a2289faf86f9b6b529044a07b072 (diff)
downloaddtc-910efac4b49f43cb1b66eef5aa0bbd020920bf2a.tar.gz
Look for include files in the directory of the including file.
Looking in the diretory dtc is invoked from is not very useful behavior. As part of the code reorganization to implement this, I removed the uniquifying of name storage -- it seemed a rather dubious optimization given likely usage, and some aspects of it would have been mildly awkward to integrate with the new code. Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'srcpos.h')
-rw-r--r--srcpos.h28
1 files changed, 20 insertions, 8 deletions
diff --git a/srcpos.h b/srcpos.h
index e59c788..8108539 100644
--- a/srcpos.h
+++ b/srcpos.h
@@ -22,13 +22,21 @@
* array of all opened filenames.
*/
+#include <stdio.h>
+
+struct dtc_file {
+ const char *dir;
+ const char *name;
+ FILE *file;
+};
+
#if ! defined(YYLTYPE) && ! defined(YYLTYPE_IS_DECLARED)
typedef struct YYLTYPE {
int first_line;
int first_column;
int last_line;
int last_column;
- int filenum;
+ struct dtc_file *file;
} YYLTYPE;
#define YYLTYPE_IS_DECLARED 1
@@ -48,7 +56,7 @@ typedef struct YYLTYPE {
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- (Current).filenum = YYRHSLOC (Rhs, N).filenum; \
+ (Current).file = YYRHSLOC (Rhs, N).file; \
} \
else \
{ \
@@ -56,7 +64,7 @@ typedef struct YYLTYPE {
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
- (Current).filenum = YYRHSLOC (Rhs, 0).filenum; \
+ (Current).file = YYRHSLOC (Rhs, 0).file; \
} \
while (YYID (0))
@@ -65,12 +73,16 @@ typedef struct YYLTYPE {
extern void yyerror(char const *);
extern void yyerrorf(char const *, ...) __attribute__((format(printf, 1, 2)));
-extern int srcpos_filenum;
+extern struct dtc_file *srcpos_file;
extern int push_input_file(const char *filename);
extern int pop_input_file(void);
-extern FILE *dtc_open_file(const char *fname);
-extern int lookup_file_name(const char *fname, int add_it);
-extern const char *srcpos_filename_for_num(int filenum);
-const char *srcpos_get_filename(void);
+struct search_path {
+ const char *dir; /* NULL for current directory */
+ struct search_path *prev, *next;
+};
+
+extern struct dtc_file *dtc_open_file(const char *fname,
+ const struct search_path *search);
+extern void dtc_close_file(struct dtc_file *file);