|
|
coherent
/usr/src/cmd/bc/Changes 1/29/90 Tue Jan 30 09:01:56 1990 PST getnum.c The bc lexer requires a number to start with a digit. It formerly recognized leading "0" and "0x" as escapes. But if ibase > 10 and the leading digit of a number is alphabetic (e.g. hex "A000"), a leading "0" is required and ambiguity about the base results (octal?). Similarly, if ibase > 33, leading "0x" is ambiguous (hex?). rec (I think) ripped out the leading "0" and "0x" code to avoid this ambiguity. Since I find hex escapes very convenient while leaving the default ibase==10 (just type "0x1234" to see its decimal value), I changed getnum() to recognize C escapes "0" and "0x" as prefixes for octal and hex numbers if ibase<=10.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.