~ubuntu-branches/ubuntu/jaunty/9base/jaunty

« back to all changes in this revision

Viewing changes to mk/arc.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2006-01-25 15:33:00 UTC
  • Revision ID: james.westby@ubuntu.com-20060125153300-6hh4p9wx8iqqply5
Tags: upstream-2
ImportĀ upstreamĀ versionĀ 2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 = (Word *) sym->value;
 
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
}