/* chew
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
- 2002, 2003, 2005, 2007, 2009, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1990-2015 Free Software Foundation, Inc.
Contributed by steve chamberlain @cygnus
This file is part of BFD, the Binary File Descriptor library.
return idx;
}
+static unsigned int
+skip_past_newline_1 (ptr, idx)
+ string_type *ptr;
+ unsigned int idx;
+{
+ while (at (ptr, idx)
+ && at (ptr, idx) != '\n')
+ idx++;
+ if (at (ptr, idx) == '\n')
+ return idx + 1;
+ return idx;
+}
+
/***********************************************************************/
string_type stack[STACK];
static void
print_stack_level ()
{
- fprintf (stderr, "current string stack depth = %ld, ", tos - stack);
- fprintf (stderr, "current integer stack depth = %ld\n", isp - istack);
+ fprintf (stderr, "current string stack depth = %ld, ",
+ (long) (tos - stack));
+ fprintf (stderr, "current integer stack depth = %ld\n",
+ (long) (isp - istack));
pc++;
}
while (at (tos, idx))
{
- if (at (tos, idx) == '\n' && at (tos, idx + 1) == '.')
+ /* Every iteration begins at the start of a line. */
+ if (at (tos, idx) == '.')
{
char c;
- idx += 2;
+
+ idx++;
while ((c = at (tos, idx)) && c != '\n')
{
idx++;
}
}
+ if (c == '\n')
+ idx++;
catchar (&out, '\n');
}
else
{
- idx++;
+ idx = skip_past_newline_1 (tos, idx);
}
}
static void
skip_past_newline ()
{
- while (at (ptr, idx)
- && at (ptr, idx) != '\n')
- idx++;
- idx++;
+ idx = skip_past_newline_1 (ptr, idx);
pc++;
}
fprintf (stderr, "warning, %s is not recognised\n", next);
skip_past_newline ();
}
-
+ free (next);
}
else
skip_past_newline ();
if (tos != stack)
{
fprintf (stderr, "finishing with current stack level %ld\n",
- tos - stack);
+ (long) (tos - stack));
return 1;
}
return 0;