aboutsummaryrefslogtreecommitdiff
path: root/srcpos.h
AgeCommit message (Collapse)AuthorFilesLines
2010-01-14dtc: Simpler interface to source file managementDavid Gibson1-15/+12
This patch cleans up our handling of input files, particularly dts source files, but also (to an extent) other input files such as those used by /incbin/ and those used in -I dtb and -I fs modes. We eliminate the current clunky mechanism which combines search paths (which we don't actually use at present) with the open relative to current source file behaviour, which we do. Instead there's a single srcfile_relative_open() entry point for callers which opens a new input file relative to the current source file (which the srcpos code tracks internally). It doesn't currently do search paths, but we can add that later without messing with the callers, by drawing the search path from a global (which makes sense anyway, rather than shuffling it around the rest of the processing code). That suffices for non-dts input files. For the actual dts files, srcfile_push() and srcfile_pop() wrappers open the file while also keeping track of it as the current source file for future opens. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-10-03Enhance source position implementation.Jon Loeliger1-2/+21
Implemented some print and copy routines. Made empty srcpos objects that will be used later. Protected .h file from multiple #include's. Added srcpos_error() and srcpos_warn(). Signed-off-by: Jon Loeliger <jdl@freescale.com>
2008-03-23dtc: Remove ugly include stack abuseDavid Gibson1-3/+0
Currently, dt_from_source() uses push_input_file() to set up the initial input file for the lexer. That sounds sensible - put the outermost input file at the bottom of the stack - until you realise that what it *actually* does is pushes the current, uninitialized, lexer input state onto the stack, then sets up the new lexer input. That necessitates an extra check in pop_input_file(), rather than signalling termination in the natural way when the include stack is empty, it has to check when it pops the bogus uninitialized state off the stack. Ick. With that fixed, push_input_file(), pop_input_file() and incl_file_stack itself become local to the lexer, so make them static. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-03-23dtc: Fix error reporting in push_input_file()David Gibson1-1/+1
Error reporting in push_input_file() is a mess. One error results in a message and exit(1), others result in a message and return 0 - which is turned into an exit(1) at one callsite. The other callsite doesn't check errors, but probably should. One of the error conditions gives a message, but can only be the result of an internal programming error, not a user error. So. Clean that up by making push_input_file() a void function, using die() to report errors and quit. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-01-11Remove const from dtc_file::dir.Scott Wood1-1/+1
Signed-off-by: Scott Wood <scottwood@freescale.com>
2008-01-04Look for include files in the directory of the including file.Scott Wood1-8/+20
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>
2008-01-04Add yyerrorf() for formatted error messages.Scott Wood1-0/+1
Signed-off-by: Scott Wood <scottwood@freescale.com>
2007-07-07dtc: move declaration of yyerrorMilton Miller1-0/+1
yyerror() is used by both dtc-parser.y and dtc-lexer.l, so move the declaration to srcpos.h. Signed-off-by: Milton Miller <miltonm@bga.com>
2007-03-28DTC: Incorporate some review suggestions.Jon Loeliger1-2/+5
- Change include syntax to: /include/ "filename" - Move private functions directly into dtc-lexer.l - Define YYID for some older parser templates Also fix a #include ordering problem around YYLTPE. Signed-off-by; Jon Loeliger <jdl@freescale.com> Acked-by: Haiying Wang <Haiying.Wang@freescale.com>
2007-03-26DTC: Add support for a C-like #include "file" mechanism.Jon Loeliger1-0/+71
Keeps track of open files in a stack, and assigns a filenum to source positions for each lexical token. Modified error reporting to show source file as well. No policy on file directory basis has been decided. Still handles stdin. Tested on all arch/powerpc/boot/dts DTS files Signed-off-by: Jon Loeliger <jdl@freescale.com>