[Mp4h-devel]CVS: mp4h/src input.c,1.52,1.53 macro.c,1.61,1.62 mp4h.h,1.65,1.66
Brought to you by:
barbier
|
From: Denis B. <ba...@us...> - 2001-12-11 00:27:56
|
Update of /cvsroot/mp4h/mp4h/src
In directory usw-pr-cvs1:/tmp/cvs-serv3356/src
Modified Files:
input.c macro.c mp4h.h
Log Message:
Fix line numbers and filenames in error messages
Index: input.c
===================================================================
RCS file: /cvsroot/mp4h/mp4h/src/input.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- input.c 2001/11/08 22:54:48 1.52
+++ input.c 2001/12/11 00:27:53 1.53
@@ -158,6 +158,7 @@
/* Current input file name. */
char *current_file;
+char **array_current_file;
/* Current input line number. */
int current_line;
@@ -812,9 +813,14 @@
void
input_init (void)
{
+ int i;
+
current_file = xstrdup ("NONE");
current_line = 0;
array_current_line = (int *) xmalloc (sizeof (int) * nesting_limit);
+ array_current_file = (char **) xmalloc (sizeof (char *) * nesting_limit);
+ for (i = 0; i < nesting_limit; i++)
+ array_current_file[i] = (char *) NULL;
obstack_init (&token_stack);
obstack_init (&input_stack);
@@ -877,7 +883,12 @@
void
input_deallocate (void)
{
+ int i;
+
xfree ((voidstar) array_current_line);
+ for (i = 0; i < nesting_limit; i++)
+ xfree(array_current_file[i]);
+ xfree ((voidstar) array_current_file);
xfree ((voidstar) eolcomm.string);
xfree ((voidstar) lquote.string);
xfree ((voidstar) rquote.string);
Index: macro.c
===================================================================
RCS file: /cvsroot/mp4h/mp4h/src/macro.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- macro.c 2001/12/10 21:30:10 1.61
+++ macro.c 2001/12/11 00:27:53 1.62
@@ -575,12 +575,15 @@
read_type attr_expansion;
expansion_level++;
- array_current_line[expansion_level] = current_line;
if (expansion_level > nesting_limit)
MP4HERROR ((EXIT_FAILURE, 0,
_("ERROR: Recursion limit of %d exceeded, use -L<N> to change it"),
nesting_limit));
+ array_current_line[expansion_level] = current_line;
+ xfree((voidstar) array_current_file[expansion_level]);
+ array_current_file[expansion_level] = xstrdup(current_file);
+
macro_call_id++;
my_call_id = macro_call_id;
@@ -713,12 +716,15 @@
boolean slash, single;
expansion_level++;
- array_current_line[expansion_level] = current_line;
if (expansion_level > nesting_limit)
MP4HERROR ((EXIT_FAILURE, 0,
_("ERROR: Recursion limit of %d exceeded, use -L<N> to change it"),
nesting_limit));
+ array_current_line[expansion_level] = current_line;
+ xfree((voidstar) array_current_file[expansion_level]);
+ array_current_file[expansion_level] = xstrdup(current_file);
+
symbol_name = xstrdup (name);
obstack_init (&arguments);
@@ -834,11 +840,14 @@
int my_call_id;
expansion_level++;
- array_current_line[expansion_level] = current_line;
if (expansion_level > nesting_limit)
MP4HERROR ((EXIT_FAILURE, 0,
_("ERROR: Recursion limit of %d exceeded, use -L<N> to change it"),
nesting_limit));
+
+ array_current_line[expansion_level] = current_line;
+ xfree((voidstar) array_current_file[expansion_level]);
+ array_current_file[expansion_level] = xstrdup(current_file);
macro_call_id++;
my_call_id = macro_call_id;
Index: mp4h.h
===================================================================
RCS file: /cvsroot/mp4h/mp4h/src/mp4h.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- mp4h.h 2001/10/16 22:21:56 1.65
+++ mp4h.h 2001/12/11 00:27:53 1.66
@@ -390,9 +390,13 @@
/* current input file, and line */
extern char *current_file;
extern int current_line;
+extern char **array_current_file;
extern int *array_current_line;
-#define CURRENT_FILE_LINE current_file, (expansion_level == 0 ? current_line: \
- array_current_line[expansion_level])
+#define CURRENT_FILE_LINE \
+ (expansion_level == 0 ? current_file : \
+ array_current_file[expansion_level]), \
+ (expansion_level == 0 ? current_line : \
+ array_current_line[expansion_level])
/* Begin and end quote */
extern STRING lquote, rquote;
|