aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/mk
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-04-20 22:54:18 +0000
committerrsc <devnull@localhost>2006-04-20 22:54:18 +0000
commit3fe9465ac99f9aa3a23f71f01df9e097f0c1da87 (patch)
tree486352b9cfea79077a514371ada42f2c61e79292 /src/cmd/mk
parentc9ee9e62f63bb875d2e49c455cbba97fc471b814 (diff)
downloadplan9port-3fe9465ac99f9aa3a23f71f01df9e097f0c1da87.tar.gz
plan9port-3fe9465ac99f9aa3a23f71f01df9e097f0c1da87.tar.bz2
plan9port-3fe9465ac99f9aa3a23f71f01df9e097f0c1da87.zip
64-bit
Diffstat (limited to 'src/cmd/mk')
-rw-r--r--src/cmd/mk/arc.c2
-rw-r--r--src/cmd/mk/archive.c10
-rw-r--r--src/cmd/mk/env.c2
-rw-r--r--src/cmd/mk/file.c4
-rw-r--r--src/cmd/mk/graph.c4
-rw-r--r--src/cmd/mk/mk.c4
-rw-r--r--src/cmd/mk/mk.h5
-rw-r--r--src/cmd/mk/recipe.c2
-rw-r--r--src/cmd/mk/rule.c4
-rw-r--r--src/cmd/mk/run.c4
-rw-r--r--src/cmd/mk/symtab.c2
-rw-r--r--src/cmd/mk/unix.c2
-rw-r--r--src/cmd/mk/var.c6
-rw-r--r--src/cmd/mk/varsub.c6
14 files changed, 30 insertions, 27 deletions
diff --git a/src/cmd/mk/arc.c b/src/cmd/mk/arc.c
index 521ef7a7..5e0267ff 100644
--- a/src/cmd/mk/arc.c
+++ b/src/cmd/mk/arc.c
@@ -41,7 +41,7 @@ nrep(void)
sym = symlook("NREP", S_VAR, 0);
if(sym){
- w = (Word *) sym->value;
+ w = sym->u.ptr;
if (w && w->s && *w->s)
nreps = atoi(w->s);
}
diff --git a/src/cmd/mk/archive.c b/src/cmd/mk/archive.c
index 9955b3fd..01288908 100644
--- a/src/cmd/mk/archive.c
+++ b/src/cmd/mk/archive.c
@@ -55,15 +55,15 @@ atimeof(int force, char *name)
t = mtime(archive);
sym = symlook(archive, S_AGG, 0);
if(sym){
- if(force || (t > (long)sym->value)){
+ if(force || (t > sym->u.value)){
atimes(archive);
- sym->value = (void *)t;
+ sym->u.value = t;
}
}
else{
atimes(archive);
/* mark the aggegate as having been done */
- symlook(strdup(archive), S_AGG, "")->value = (void *)t;
+ symlook(strdup(archive), S_AGG, "")->u.value = t;
}
/* truncate long member name to sizeof of name field in archive header */
if(dolong)
@@ -72,7 +72,7 @@ atimeof(int force, char *name)
snprint(buf, sizeof(buf), "%s(%.*s)", archive, SARNAME, member);
sym = symlook(buf, S_TIME, 0);
if (sym)
- return (long)sym->value; /* uggh */
+ return sym->u.value;
return 0;
}
@@ -196,7 +196,7 @@ atimes(char *ar)
}
snprint(buf, sizeof buf, "%s(%s)", ar, name);
sym = symlook(strdup(buf), S_TIME, (void *)t);
- sym->value = (void *)t;
+ sym->u.value = t;
skip:
t = atol(h.size);
if(t&01) t++;
diff --git a/src/cmd/mk/env.c b/src/cmd/mk/env.c
index ffb2762e..11df34e3 100644
--- a/src/cmd/mk/env.c
+++ b/src/cmd/mk/env.c
@@ -79,7 +79,7 @@ ecopy(Symtab *s)
for(p = myenv; *p; p++)
if(strcmp(*p, s->name) == 0)
return;
- envinsert(s->name, (Word *) s->value);
+ envinsert(s->name, s->u.ptr);
}
void
diff --git a/src/cmd/mk/file.c b/src/cmd/mk/file.c
index 2533343f..d9409ba7 100644
--- a/src/cmd/mk/file.c
+++ b/src/cmd/mk/file.c
@@ -23,7 +23,7 @@ timeof(char *name, int force)
sym = symlook(name, S_TIME, 0);
if (sym)
- return (long) sym->value; /* uggh */
+ return sym->u.value;
t = mtime(name);
if(t == 0)
@@ -77,7 +77,7 @@ timeinit(char *s)
} while(*s);
c = *s;
*s = 0;
- symlook(strdup(cp), S_TIME, (void *)t)->value = (void *)t;
+ symlook(strdup(cp), S_TIME, (void *)t)->u.value = t;
if (c)
*s++ = c;
while(*s){
diff --git a/src/cmd/mk/graph.c b/src/cmd/mk/graph.c
index da346c03..4c46f7bb 100644
--- a/src/cmd/mk/graph.c
+++ b/src/cmd/mk/graph.c
@@ -40,14 +40,14 @@ applyrules(char *target, char *cnt)
/* print("applyrules(%lux='%s')\n", target, target); */
sym = symlook(target, S_NODE, 0);
if(sym)
- return (Node *)(sym->value);
+ return sym->u.ptr;
target = strdup(target);
node = newnode(target);
head.n = 0;
head.next = 0;
sym = symlook(target, S_TARGET, 0);
memset((char*)rmatch, 0, sizeof(rmatch));
- for(r = sym? (Rule *)(sym->value):0; r; r = r->chain){
+ for(r = sym? sym->u.ptr:0; r; r = r->chain){
if(r->attr&META) continue;
if(strcmp(target, r->target)) continue;
if((!r->recipe || !*r->recipe) && (!r->tail || !r->tail->s || !*r->tail->s)) continue; /* no effect; ignore */
diff --git a/src/cmd/mk/mk.c b/src/cmd/mk/mk.c
index 5ae4fc21..654d0634 100644
--- a/src/cmd/mk/mk.c
+++ b/src/cmd/mk/mk.c
@@ -221,11 +221,11 @@ outofdate(Node *node, Arc *arc, int eval)
str = strdup(buf);
ret = pcmp(arc->prog, node->name, arc->n->name, arc->r->shellt, arc->r->shellcmd);
if(sym)
- sym->value = (void *)ret;
+ sym->u.value = ret;
else
symlook(str, S_OUTOFDATE, (void *)ret);
} else
- ret = (int)sym->value;
+ ret = sym->u.value;
return(ret-1);
} else if(strchr(arc->n->name, '(') && arc->n->time == 0) /* missing archive member */
return 1;
diff --git a/src/cmd/mk/mk.h b/src/cmd/mk/mk.h
index 81f9d70c..a40e9ded 100644
--- a/src/cmd/mk/mk.h
+++ b/src/cmd/mk/mk.h
@@ -129,7 +129,10 @@ typedef struct Symtab
{
short space;
char *name;
- void *value;
+ union {
+ void *ptr;
+ uintptr value;
+ } u;
struct Symtab *next;
} Symtab;
diff --git a/src/cmd/mk/recipe.c b/src/cmd/mk/recipe.c
index bf7f8ab1..7993e091 100644
--- a/src/cmd/mk/recipe.c
+++ b/src/cmd/mk/recipe.c
@@ -59,7 +59,7 @@ dorecipe(Node *node)
aw = aw->next;
if((s = symlook(buf, S_NODE, 0)) == 0)
continue; /* not a node we are interested in */
- n = (Node *)s->value;
+ n = s->u.ptr;
if(aflag == 0 && n->time) {
for(a = n->prereqs; a; a = a->next)
if(a->n && outofdate(n, a, 0))
diff --git a/src/cmd/mk/rule.c b/src/cmd/mk/rule.c
index d73595d2..439d6114 100644
--- a/src/cmd/mk/rule.c
+++ b/src/cmd/mk/rule.c
@@ -15,7 +15,7 @@ addrule(char *head, Word *tail, char *body, Word *ahead, int attr, int hline, ch
r = 0;
reuse = 0;
if(sym = symlook(head, S_TARGET, 0)){
- for(r = (Rule *)sym->value; r; r = r->chain)
+ for(r = sym->u.ptr; r; r = r->chain)
if(rcmp(r, head, tail) == 0){
reuse = 1;
break;
@@ -35,7 +35,7 @@ addrule(char *head, Word *tail, char *body, Word *ahead, int attr, int hline, ch
r->prog = prog;
r->rule = nrules++;
if(!reuse){
- rr = (Rule *)symlook(head, S_TARGET, (void *)r)->value;
+ rr = symlook(head, S_TARGET, (void *)r)->u.ptr;
if(rr != r){
r->chain = rr->chain;
rr->chain = r;
diff --git a/src/cmd/mk/run.c b/src/cmd/mk/run.c
index 439cc0a5..dd225c0d 100644
--- a/src/cmd/mk/run.c
+++ b/src/cmd/mk/run.c
@@ -168,7 +168,7 @@ again: /* rogue processes */
for(w = j->t; w; w = w->next){
if((s = symlook(w->s, S_NODE, 0)) == 0)
continue; /* not interested in this node */
- update(uarg, (Node *)s->value);
+ update(uarg, s->u.ptr);
}
if(nrunning < nproclimit)
sched();
@@ -182,7 +182,7 @@ nproc(void)
Word *w;
if(sym = symlook("NPROC", S_VAR, 0)) {
- w = (Word *) sym->value;
+ w = sym->u.ptr;
if (w && w->s && w->s[0])
nproclimit = atoi(w->s);
}
diff --git a/src/cmd/mk/symtab.c b/src/cmd/mk/symtab.c
index 06a4d146..17674c43 100644
--- a/src/cmd/mk/symtab.c
+++ b/src/cmd/mk/symtab.c
@@ -38,7 +38,7 @@ symlook(char *sym, int space, void *install)
s = (Symtab *)Malloc(sizeof(Symtab));
s->space = space;
s->name = sym;
- s->value = install;
+ s->u.ptr = install;
s->next = hash[h];
hash[h] = s;
return(s);
diff --git a/src/cmd/mk/unix.c b/src/cmd/mk/unix.c
index 7ecce69f..c63d3cef 100644
--- a/src/cmd/mk/unix.c
+++ b/src/cmd/mk/unix.c
@@ -41,7 +41,7 @@ readenv(void)
continue;
s = strdup(*p);
setvar(s, (void *)w);
- symlook(s, S_EXPORTED, (void*)"")->value = (void*)"";
+ symlook(s, S_EXPORTED, (void*)"")->u.ptr = "";
}
}
diff --git a/src/cmd/mk/var.c b/src/cmd/mk/var.c
index 8429918d..3efe3827 100644
--- a/src/cmd/mk/var.c
+++ b/src/cmd/mk/var.c
@@ -1,9 +1,9 @@
#include "mk.h"
void
-setvar(char *name, void *value)
+setvar(char *name, void *ptr)
{
- symlook(name, S_VAR, value)->value = value;
+ symlook(name, S_VAR, ptr)->u.ptr = ptr;
symlook(name, S_MAKEVAR, (void*)"");
}
@@ -13,7 +13,7 @@ print1(Symtab *s)
Word *w;
Bprint(&bout, "\t%s=", s->name);
- for (w = (Word *) s->value; w; w = w->next)
+ for (w = s->u.ptr; w; w = w->next)
Bprint(&bout, "'%s'", w->s);
Bprint(&bout, "\n");
}
diff --git a/src/cmd/mk/varsub.c b/src/cmd/mk/varsub.c
index 5b7c984a..223ba78d 100644
--- a/src/cmd/mk/varsub.c
+++ b/src/cmd/mk/varsub.c
@@ -66,7 +66,7 @@ varmatch(char *name, char **s)
sym = symlook(name, S_VAR, 0);
if(sym){
/* check for at least one non-NULL value */
- for (w = (Word*)sym->value; w; w = w->next)
+ for (w = sym->u.ptr; w; w = w->next)
if(w->s && *w->s)
return wdup(w);
}
@@ -113,10 +113,10 @@ expandvar(char **s)
*s = end+1;
sym = symlook(buf->start, S_VAR, 0);
- if(sym == 0 || sym->value == 0)
+ if(sym == 0 || sym->u.ptr == 0)
w = newword(buf->start);
else
- w = subsub((Word*) sym->value, cp, end);
+ w = subsub(sym->u.ptr, cp, end);
freebuf(buf);
return w;
}