1
0
mirror of https://github.com/golang/go synced 2024-11-19 15:34:47 -07:00

8a: fixes for Plan 9 build

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
This commit is contained in:
Lucio De Re 2011-06-27 14:42:18 -04:00 committed by Russ Cox
parent 10d0dffd76
commit 6bcfb95168
5 changed files with 12 additions and 9 deletions

View File

@ -28,8 +28,6 @@
// 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"
@ -57,7 +55,9 @@ typedef struct Gen2 Gen2;
#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

View File

@ -29,7 +29,9 @@
// 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 {

View File

@ -29,9 +29,10 @@
// THE SOFTWARE.
#define EXTERN
#include <u.h>
#include <libc.h>
#include "a.h"
#include "y.tab.h"
#include <ctype.h>
enum
{

View File

@ -96,7 +96,7 @@ alloc(int32 n)
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;
@ -110,7 +110,7 @@ allocn(void *p, int32 n, int32 d)
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);
@ -245,7 +245,7 @@ lookup(void)
}else
*w++ = *r;
}
*w++ = '\0';
*w = '\0';
h = 0;
for(p=symb; c = *p; p++)

View File

@ -830,11 +830,11 @@ linehist(char *f, int offset)
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));