tarc.c - plan9port - [fork] Plan 9 from user space | |
git clone git://src.adamsgaard.dk/plan9port | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
tarc.c (826B) | |
--- | |
1 #include "mk.h" | |
2 | |
3 Arc * | |
4 newarc(Node *n, Rule *r, char *stem, Resub *match) | |
5 { | |
6 Arc *a; | |
7 | |
8 a = (Arc *)Malloc(sizeof(Arc)); | |
9 a->n = n; | |
10 a->r = r; | |
11 a->stem = strdup(stem); | |
12 rcopy(a->match, match, NREGEXP); | |
13 a->next = 0; | |
14 a->flag = 0; | |
15 a->prog = r->prog; | |
16 return(a); | |
17 } | |
18 | |
19 void | |
20 dumpa(char *s, Arc *a) | |
21 { | |
22 char buf[1024]; | |
23 | |
24 Bprint(&bout, "%sArc@%p: n=%p r=%p flag=0x%x stem='%s'", | |
25 s, a, a->n, a->r, a->flag, a->stem); | |
26 if(a->prog) | |
27 Bprint(&bout, " prog='%s'", a->prog); | |
28 Bprint(&bout, "\n"); | |
29 | |
30 if(a->n){ | |
31 snprint(buf, sizeof(buf), "%s ", (*s == ' ')? s:""); | |
32 dumpn(buf, a->n); | |
33 } | |
34 } | |
35 | |
36 void | |
37 nrep(void) | |
38 { | |
39 Symtab *sym; | |
40 Word *w; | |
41 | |
42 sym = symlook("NREP", S_VAR, 0); | |
43 if(sym){ | |
44 w = sym->u.ptr; | |
45 if (w && w->s && *w->s) | |
46 nreps = atoi(w->s); | |
47 } | |
48 if(nreps < 1) | |
49 nreps = 1; | |
50 if(DEBUG(D_GRAPH)) | |
51 Bprint(&bout, "nreps = %d\n", nreps); | |
52 } |