summaryrefslogtreecommitdiff
path: root/utils/c2l
diff options
context:
space:
mode:
Diffstat (limited to 'utils/c2l')
-rw-r--r--utils/c2l/Posix.c1
-rw-r--r--utils/c2l/c2l.c9
-rw-r--r--utils/c2l/cc.h14
-rw-r--r--utils/c2l/cc.y12
-rw-r--r--utils/c2l/lex.c4
-rw-r--r--utils/c2l/out.c2
6 files changed, 23 insertions, 19 deletions
diff --git a/utils/c2l/Posix.c b/utils/c2l/Posix.c
index e572e5da..aba318fd 100644
--- a/utils/c2l/Posix.c
+++ b/utils/c2l/Posix.c
@@ -1,4 +1,5 @@
#include "cc.h"
+#include <sys/wait.h>
void*
mysbrk(ulong size)
diff --git a/utils/c2l/c2l.c b/utils/c2l/c2l.c
index 83409dbb..42897ce3 100644
--- a/utils/c2l/c2l.c
+++ b/utils/c2l/c2l.c
@@ -1263,7 +1263,7 @@ static int hasbrk(Node*);
static int isgen(char*);
static int simple(Node*);
static void pfmt(char*);
-static void lpfmt(ushort*);
+static void lpfmt(Rune*);
static int lline(Node*);
static void args(Node*);
static void addmodn(Sym*);
@@ -2095,6 +2095,7 @@ etseq(Syml *syml)
pio = io = ARITH|GEOM;
e = 0;
dd = 0;
+ d = 0;
for(sl = syml; sl != nil; sl = sl->nxt){
s = sl->sym;
if(isreal(s->tenum) || s->tenum->etype == TIND)
@@ -2782,7 +2783,7 @@ stob(Node *n)
{
int m;
char *s = nil, buf[UTFmax];
- ushort *u = nil;
+ Rune *u = nil;
while(n->op == ONAME)
n = n->sym->nconst;
@@ -4689,9 +4690,9 @@ pfmt(char *s)
}
static void
-lpfmt(ushort *s)
+lpfmt(Rune *s)
{
- ushort*t = s;
+ Rune*t = s;
while(*s != '\0'){
if(*s == '%'){
diff --git a/utils/c2l/cc.h b/utils/c2l/cc.h
index 2d16efb7..5f9ae578 100644
--- a/utils/c2l/cc.h
+++ b/utils/c2l/cc.h
@@ -16,6 +16,8 @@ typedef struct Term Term;
typedef struct Init Init;
typedef struct Bits Bits;
+typedef Rune TRune;
+
#define NHUNK 50000L
#define BUFSIZ 8192
#define NSYMB 500
@@ -26,7 +28,7 @@ typedef struct Bits Bits;
#define NTERM 10
#define MAXALIGN 7
-#define SIGN(n) ((vlong)1<<(n-1))
+#define SIGN(n) ((uvlong)1<<(n-1))
#define MASK(n) (SIGN(n)|(SIGN(n)-1))
#define BITS 5
@@ -54,7 +56,7 @@ struct Node
double fconst; /* fp constant */
vlong vconst; /* non fp const */
char* cstring; /* character string */
- ushort* rstring; /* rune string */
+ Rune* rstring; /* rune string */
Sym* sym;
Type* type;
@@ -665,8 +667,8 @@ void constas(Node*, Type*, Type*);
void acom(Node*);
void acom1(vlong, Node*);
void acom2(Node*, Type*);
-int acomcmp1(const void*, const void*);
-int acomcmp2(const void*, const void*);
+int acomcmp1(void*, void*);
+int acomcmp2(void*, void*);
int addo(Node*);
void evconst(Node*);
@@ -744,7 +746,7 @@ void gclean(void);
void gextern(Sym*, Node*, long, long);
void ginit(void);
long outstring(char*, long);
-long outlstring(ushort*, long);
+long outlstring(Rune*, long);
void sextern(Sym*, Node*, long, long);
void xcom(Node*);
long exreg(Type*);
@@ -779,7 +781,7 @@ vlong convvtox(vlong, int);
void prline(char*);
void prstr(char *);
-void prlstr(ushort *);
+void prlstr(Rune *);
void prkeywd(char *);
void prid(char *);
void prsym(Sym*, int);
diff --git a/utils/c2l/cc.y b/utils/c2l/cc.y
index 22dc6c0c..c66fdb4b 100644
--- a/utils/c2l/cc.y
+++ b/utils/c2l/cc.y
@@ -887,8 +887,8 @@ slstring:
{
$$ = new(OLSTRING, Z, Z);
$$->type = typ(TARRAY, types[TUSHORT]);
- $$->type->width = $1.l + sizeof(ushort);
- $$->rstring = (ushort*)$1.s;
+ $$->type->width = $1.l + sizeof(TRune);
+ $$->rstring = (TRune*)$1.s;
$$->sym = symstring;
}
@@ -902,19 +902,19 @@ lstring:
char *s;
int n1, n2;
- n1 = $1->type->width - sizeof(ushort);
- n2 = $2->type->width - sizeof(ushort);
+ n1 = $1->type->width - sizeof(TRune);
+ n2 = $2->type->width - sizeof(TRune);
s = alloc(n1+n2+MAXALIGN);
memcpy(s, $1->rstring, n1);
memcpy(s+n1, $2->rstring, n2);
- *(ushort*)(s+n1+n2) = 0;
+ *(TRune*)(s+n1+n2) = 0;
$1->left = new(OCAT, ncopy($1), $2);
$$ = $1;
$$->type->width += n2;
- $$->rstring = (ushort*)s;
+ $$->rstring = (TRune*)s;
}
zelist:
diff --git a/utils/c2l/lex.c b/utils/c2l/lex.c
index 574ecfc6..3525fbe3 100644
--- a/utils/c2l/lex.c
+++ b/utils/c2l/lex.c
@@ -266,7 +266,7 @@ void
newio(void)
{
Io *i;
- static pushdepth = 0;
+ static int pushdepth = 0;
i = iofree;
if(i == I) {
@@ -1206,7 +1206,7 @@ cinit(void)
if(mygetwd(pathname, 99) == 0) {
pathname = allocn(pathname, 100, 900);
if(mygetwd(pathname, 999) == 0)
- strcpy(pathname, "/???");
+ strcpy(pathname, "/?");
}
fmtinstall('f', gfltconv);
diff --git a/utils/c2l/out.c b/utils/c2l/out.c
index ab81a995..f4e0e560 100644
--- a/utils/c2l/out.c
+++ b/utils/c2l/out.c
@@ -603,7 +603,7 @@ prstr(char *s)
}
void
-prlstr(ushort *s)
+prlstr(Rune *s)
{
lprint("\"");
while(*s != 0)