From: Steve Chamberlain Date: Tue, 1 Aug 1995 03:35:23 +0000 (+0000) Subject: * gasp.c (main): Parse -I option. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f2f30116bbef513af63b7b45bd7ef13bd7b4673;p=binutils-gdb.git * gasp.c (main): Parse -I option. (do_include): Look through include list. * gasp.c (change_base): Don't modify numbers in strings. (pr7583) * testsuite/gasp/*: New. * testsuite/Makefile.in: Use gasp tests. * testsuite/config/default.exp: Add gasp stuff. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index d5c4f85f3cd..0d13df4fc30 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -9,8 +9,14 @@ Mon Jul 31 21:40:47 1995 Ken Raeburn Mon Jul 31 18:19:26 1995 steve chamberlain - * gasp.c (change_base): Don't modify numbers in strings. (pr7583) - * testsuite/gas/gasp/*: New. + * gasp.c (main): Parse -I option. + (do_include): Look through include list. + * gasp.c (change_base): Don't modify numbers in strings. + (pr7583) + + * testsuite/gasp/*: New. + * testsuite/Makefile.in: Use gasp tests. + * testsuite/config/default.exp: Add gasp stuff. Mon Jul 31 12:16:21 1995 Ian Lance Taylor diff --git a/gas/gasp.c b/gas/gasp.c index c164412a89a..3d1f588d573 100644 --- a/gas/gasp.c +++ b/gas/gasp.c @@ -37,6 +37,7 @@ suitable for gas to consume. -a use alternate syntax Pseudo ops can start with or without a . Labels have to be in first column. + -I specify include dir Macro arg parameters subsituted by name, don't need the &. String can start with ' too. Strings can be surrounded by <..> @@ -311,6 +312,19 @@ struct include_stack *sp; #define dsize 5 + +/* Include file list */ + +typedef struct include_path +{ + struct include_path *next; + sb path; +} include_path; + +include_path *paths_head; +include_path *paths_tail; + + void include_print_where_line (); @@ -3316,14 +3330,30 @@ do_include (idx, in) sb *in; { sb t; + sb cat; char *text; + include_path *includes; sb_new (&t); + sb_new (&cat); + idx = getstring (idx, in, &t); - text = sb_name (&t); - if (!new_file (text)) + + for (includes = paths_head; includes; includes = includes->next) + { + sb_reset (&cat); + sb_add_sb (&cat, &includes->path); + sb_add_char (&cat, '/'); + sb_add_sb (&cat, &t); + if (new_file (sb_name (&cat))) + { + break; + } + } + if (!includes) { FATAL ((stderr, "Can't open include file `%s'.\n", text)); } + sb_kill (&cat); sb_kill (&t); } @@ -3827,6 +3857,7 @@ char *program_name; static struct option long_options[] = { { "alternate", no_argument, 0, 'a' }, + { "include", required_argument, 0, 'I' }, { "commentchar", required_argument, 0, 'c' }, { "copysource", no_argument, 0, 's' }, { "debug", no_argument, 0, 'd' }, @@ -3857,6 +3888,7 @@ Usage: %s \n\ [-u] [--unreasonable] allow unreasonable nesting\n\ [-v] [--version] print the program version\n\ [-Dname=value] create preprocessor variable called name, with value\n\ + [-Ipath] add to include path list\n\ [in-file]\n", program_name); exit (status); } @@ -3895,7 +3927,7 @@ main (argc, argv) sb_new (&label); process_init (); - while ((opt = getopt_long (argc, argv, "sdhavc:upo:D:", long_options, + while ((opt = getopt_long (argc, argv, "I:sdhavc:upo:D:", long_options, (int *) NULL)) != EOF) { @@ -3907,6 +3939,18 @@ main (argc, argv) case 'u': unreasonable = 1; break; + case 'I': + { + include_path *p = (include_path *) xmalloc (sizeof (include_path)); + sb_new (&p->path); + sb_add_string (&p->path, optarg); + if (paths_tail) + paths_tail->next = p; + else + paths_head = p; + paths_tail = p; + } + break; case 'p': print_line_number = 1; break;