/* Loop over pattern commands. */
while (p < pend)
{
+ printf ("%d:\t", p - start);
+
switch ((re_opcode_t) *p++)
{
case no_op:
case charset:
case charset_not:
{
- register int c;
+ register int c, last = -100;
+ register int in_range = 0;
- printf ("/charset%s",
- (re_opcode_t) *(p - 1) == charset_not ? "_not" : "");
+ printf ("/charset [%s",
+ (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
assert (p + *p < pend);
- for (c = 0; c < *p; c++)
+ for (c = 0; c < 256; c++)
+ if (c / 8 < *p
+ && (p[1 + (c/8)] & (1 << (c % 8))))
+ {
+ /* Are we starting a range? */
+ if (last + 1 == c && ! in_range)
+ {
+ putchar ('-');
+ in_range = 1;
+ }
+ /* Have we broken a range? */
+ else if (last + 1 != c && in_range)
{
- unsigned bit;
- unsigned char map_byte = p[1 + c];
+ printchar (last);
+ in_range = 0;
+ }
- putchar ('/');
+ if (! in_range)
+ printchar (c);
- for (bit = 0; bit < BYTEWIDTH; bit++)
- if (map_byte & (1 << bit))
- printchar (c * BYTEWIDTH + bit);
+ last = c;
}
+
+ if (in_range)
+ printchar (last);
+
+ putchar (']');
+
p += 1 + *p;
- break;
}
+ break;
case begline:
printf ("/begline");
case on_failure_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_jump/0/%d", mcnt);
+ printf ("/on_failure_jump to %d", p + mcnt - start);
break;
case on_failure_keep_string_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/on_failure_keep_string_jump/0/%d", mcnt);
+ printf ("/on_failure_keep_string_jump to %d", p + mcnt - start);
break;
case dummy_failure_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/dummy_failure_jump/0/%d", mcnt);
+ printf ("/dummy_failure_jump to %d", p + mcnt - start);
break;
case push_dummy_failure:
case maybe_pop_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/maybe_pop_jump/0/%d", mcnt);
+ printf ("/maybe_pop_jump to %d", p + mcnt - start);
break;
case pop_failure_jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/pop_failure_jump/0/%d", mcnt);
+ printf ("/pop_failure_jump to %d", p + mcnt - start);
break;
case jump_past_alt:
extract_number_and_incr (&mcnt, &p);
- printf ("/jump_past_alt/0/%d", mcnt);
+ printf ("/jump_past_alt to %d", p + mcnt - start);
break;
case jump:
extract_number_and_incr (&mcnt, &p);
- printf ("/jump/0/%d", mcnt);
+ printf ("/jump to %d", p + mcnt - start);
break;
case succeed_n:
extract_number_and_incr (&mcnt, &p);
extract_number_and_incr (&mcnt2, &p);
- printf ("/succeed_n/0/%d/0/%d", mcnt, mcnt2);
+ printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2);
break;
case jump_n:
extract_number_and_incr (&mcnt, &p);
extract_number_and_incr (&mcnt2, &p);
- printf ("/jump_n/0/%d/0/%d", mcnt, mcnt2);
+ printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2);
break;
case set_number_at:
extract_number_and_incr (&mcnt, &p);
extract_number_and_incr (&mcnt2, &p);
- printf ("/set_number_at/0/%d/0/%d", mcnt, mcnt2);
+ printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2);
break;
case wordbound:
default:
printf ("?%d", *(p-1));
}
+
+ putchar ('\n');
}
- printf ("/\n");
+
+ printf ("%d:\tend of pattern.\n", p - start);
}
#ifdef DEBUG
if (debug)
{
- DEBUG_PRINT1 ("\nCompiled pattern: ");
+ DEBUG_PRINT1 ("\nCompiled pattern: \n");
print_compiled_pattern (bufp);
}
#endif /* DEBUG */
+Sat May 1 09:03:19 1993 Jim Meyering (meyering@comco.com)
+
+ * uniq.c (main.c): Interpret non-option arguments with a leading `+'
+ only if we haven't seen `--'.
+
+Fri Apr 30 20:16:03 1993 Jim Meyering (meyering@comco.com)
+
+ * configure.in [AC_HAVE_HEADERS]: Add limits.h and unistd.h.
+
+ * configure.in [CFLAGS, LDFLAGS]: Assign reasonable defaults.
+
+ * od.c (parse_old_offset): Don't use prototype in function
+ definition. Remove unnecessary conjunct from test for hexadecimal
+ prefix.
+
+ * od.c: Depend on __GNUC__ || HAVE_LONG_DOUBLE rather than __STDC__
+ for long double support; there are compilers (Stardent Vistra svr4)
+ without long double but still define __STDC__.
+
Thu Apr 29 02:01:27 1993 Jim Meyering (meyering@comco.com)
* src/*.c and man/*.c except for sort: Add --help and --version
#include <float.h>
#endif
-#ifdef __STDC__
+#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
typedef long double LONG_DOUBLE;
#else
typedef double LONG_DOUBLE;
}
}
-#ifdef __STDC__
+#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
static void
print_long_double (n_bytes, block, fmt_string)
long unsigned int n_bytes;
DBL_DIG + 8, DBL_DIG);
break;
-#ifdef __STDC__
+#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
case FP_LONG_DOUBLE:
print_function = print_long_double;
pre_fmt_string = "%%%d.%dle%%c";
return the offset it denotes. Otherwise, return -1. */
long int
-parse_old_offset (const char *s)
+parse_old_offset (s)
+ const char *s;
{
int radix;
char *suffix;
++s;
/* Determine the radix we'll use to interpret S. If there is a `.',
- it's decimal, otherwise, if the string begins with `0x', it's
- hexadecimal, else octal. */
+ it's decimal, otherwise, if the string begins with `0X'or `0x',
+ it's hexadecimal, else octal. */
if (index (s, '.') != NULL)
radix = 10;
else
{
- if (strlen (s) >= 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
+ if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
radix = 16;
else
radix = 8;