Date:2012-05-21 19:44:33 (11 years 10 months ago)
Author:Werner Almesberger
Commit:061e8f5872256d346761dec4d82697b024a1e847
Message:b2/: rename "name" field in struct value to more generic "s", for better sharing

Files: b2/chr.c (2 diffs)
b2/comp.c (1 diff)
b2/db.c (1 diff)
b2/dump.c (1 diff)
b2/eval.c (1 diff)
b2/lang.y (1 diff)
b2/param.h (1 diff)

Change Details

b2/chr.c
7070    struct condition *cond;
7171
7272    cond = alloc_type(struct condition);
73    cond->value.u.name = word;
73    cond->value.u.s = word;
7474    cond->relop = relop;
7575    cond->next = NULL;
7676    return cond;
...... 
8484
8585    for (sel = field->sel; sel; sel = sel->next)
8686        for (cond = sel->cond; cond; cond = cond->next)
87            if (!evaluate(field->fmt, cond->value.u.name,
87            if (!evaluate(field->fmt, cond->value.u.s,
8888                &cond->value))
8989                yyerrorf("invalid value in selection");
9090                /* @@@ indicate exact location */
b2/comp.c
4040
4141int comp_name(const struct value *a, enum relop relop, const struct value *b)
4242{
43    return do_comp_name(a->u.name, relop, b->u.name);
43    return do_comp_name(a->u.s, relop, b->u.s);
4444}
4545
4646
b2/db.c
110110
111111        /* convert parameter */
112112        prm->u.field = f;
113        if (!evaluate(f->fmt, prm->value.u.name, &prm->value))
113        if (!evaluate(f->fmt, prm->value.u.s, &prm->value))
114114            yyerrorf("invalid value for %s", f->name);
115115
116116        /* add to result list */
b2/dump.c
1818
1919void dump_name(FILE *file, const struct format *fmt, const struct value *v)
2020{
21    fprintf(file, "%s", v->u.name);
21    fprintf(file, "%s", v->u.s);
2222}
2323
2424
b2/eval.c
2020
2121int eval_name(const struct format *fmt, const char *s, struct value *res)
2222{
23    res->u.name = s;
23    res->u.s = s;
2424    return 1;
2525}
2626
b2/lang.y
425425            $$ = alloc_type(struct param);
426426            $$->u.name = $1;
427427            $$->op = rel_eq;
428            $$->value.u.name = $3;
428            $$->value.u.s = $3;
429429        }
430430    ;
431431
b2/param.h
5252
5353struct value {
5454    union {
55        const char *name;
55        const char *s;
5656        struct bitset set;
5757        double abs;
5858        struct rel_value {

Archive Download the corresponding diff file

Branches:
master



interactive