8a/a.h:
. Removed <u.h> and <libc.h> includes as they work better in "a.y".
. Made definition of EOF conditional as it's defined in the Plan 9
header files, but not elsewhere.
8a/a.y:
. Added <u.h> and <libc.h> because <stdio.h> in Plan 9 needs them.
Sequence <u.h>, <stdio.h>, <libc.h> recommended by RSC.
8a/lex.c:
. Added <u.h> and <libc.h> as now needed by "a.h".
. Dropped <ctype.h>.
cc/lexbody:
. exit() -> exits().
. Dropped unwanted incrementation.
cc/macbody:
. Adjusted a few format specifications.
R=rsc
CC=golang-dev
https://golang.org/cl/
4644047
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#include <u.h>
-#include <libc.h>
#include <bio.h>
#include "../8l/8.out.h"
#define NSYMB 500
#define BUFSIZ 8192
#define HISTSZ 20
+#ifndef EOF
#define EOF (-1)
+#endif
#define IGN (-2)
#define GETC() ((--fi.c < 0)? filbuf(): *fi.p++ & 0xff)
#define NHASH 503
// THE SOFTWARE.
%{
+#include <u.h>
#include <stdio.h> /* if we don't, bison will, and a.h re-#defines getc */
+#include <libc.h>
#include "a.h"
%}
%union {
// THE SOFTWARE.
#define EXTERN
+#include <u.h>
+#include <libc.h>
#include "a.h"
#include "y.tab.h"
-#include <ctype.h>
enum
{
p = malloc(n);
if(p == nil) {
print("alloc out of mem\n");
- exit(1);
+ exits("alloc: out of mem");
}
memset(p, 0, n);
return p;
p = realloc(p, n+d);
if(p == nil) {
print("allocn out of mem\n");
- exit(1);
+ exits("allocn: out of mem");
}
if(d > 0)
memset((char*)p+n, 0, d);
}else
*w++ = *r;
}
- *w++ = '\0';
+ *w = '\0';
h = 0;
for(p=symb; c = *p; p++)
if(debug['f'])
if(f) {
if(offset)
- print("%4ld: %s (#line %d)\n", lineno, f, offset);
+ print("%4d: %s (#line %d)\n", lineno, f, offset);
else
- print("%4ld: %s\n", lineno, f);
+ print("%4d: %s\n", lineno, f);
} else
- print("%4ld: <pop>\n", lineno);
+ print("%4d: <pop>\n", lineno);
newflag = 0;
h = alloc(sizeof(Hist));