]> granicus.if.org Git - graphviz/commitdiff
Replace INT, CHAR, VOID token names since they are exported because expr.h
authorerg <devnull@localhost>
Mon, 29 Jun 2009 16:41:28 +0000 (16:41 +0000)
committererg <devnull@localhost>
Mon, 29 Jun 2009 16:41:28 +0000 (16:41 +0000)
includes exparse.h;
extend types of user-supplied functions to include Exdisc_t*.

lib/expr/exdata.c
lib/expr/exeval.c
lib/expr/exexpr.c
lib/expr/exgram.h
lib/expr/exparse.y
lib/expr/expr.h
lib/expr/extoken.c

index 18982558a778c4c9892a8ca1bad83b7fceaff584..dc966772b7df06a1fd38e0afa899cd583c385d5b 100644 (file)
@@ -38,7 +38,7 @@ Exid_t exbuiltin[] = {
 
     EX_ID("break", BREAK, BREAK, 0, 0),
     EX_ID("case", CASE, CASE, 0, 0),
-    EX_ID("char", DECLARE, CHAR, CHAR, 0),
+    EX_ID("char", DECLARE, CHARACTER, CHARACTER, 0),
     EX_ID("continue", CONTINUE, CONTINUE, 0, 0),
     EX_ID("default", DEFAULT, DEFAULT, 0, 0),
     EX_ID("double", DECLARE, FLOATING, FLOATING, 0),
@@ -63,7 +63,7 @@ Exid_t exbuiltin[] = {
     EX_ID("substr", SUBSTR, SUBSTR, STRING, 0),
     EX_ID("switch", SWITCH, SWITCH, 0, 0),
     EX_ID("unsigned", DECLARE, UNSIGNED, UNSIGNED, 0),
-    EX_ID("void", DECLARE, VOID, 0, 0),
+    EX_ID("void", DECLARE, VOIDTYPE, 0, 0),
     EX_ID("while", WHILE, WHILE, 0, 0),
     EX_ID({0}, 0, 0, 0, 0)
 
index 5badc1c8b511f15f2e682310e52f925f2980cedf..307be7ae89dca86c28dce5753251de847327ee8d 100644 (file)
@@ -416,7 +416,7 @@ static int scformat(Sfio_t * sp, void *vp, Sffmt_t * dp)
                    string, char, fmt->fmt.size, 0);
        break;
     case 'c':
-       if (node->type != CHAR) {
+       if (node->type != CHARACTER) {
            exerror("scanf: %s: char variable address argument expected",
                    node->data.variable.symbol->name);
            return -1;
@@ -740,7 +740,7 @@ xPrint(Expr_t * ex, Exnode_t * expr, Extype_t v, Exnode_t * tmp)
 {
     *tmp = *expr->data.operand.left;
     tmp->data.constant.value = v;
-    if ((*ex->disc->stringof) (ex, tmp, 0))
+    if ((*ex->disc->stringof) (ex, tmp, 0, ex->disc))
        exerror("%s: no string representation of %s value",
                expr->data.operand.left->data.variable.symbol->name,
                extypename(ex, expr->data.operand.left->type));
index 0c5108e9c4074b79afbe94be778a65b11b3bee3d..07689e614bc98a22e0ad2f4e235c3a8bb52949bd 100644 (file)
@@ -33,7 +33,7 @@ Exnode_t *exexpr(Expr_t * ex, const char *name, Exid_t * sym, int type)
        if (!sym)
            sym = name ? (Exid_t *) dtmatch(ex->symbols, name) : &ex->main;
        if (sym && sym->lex == PROCEDURE && sym->value) {
-           if (type != DELETE)
+           if (type != DELETE_T)
                return excast(ex, sym->value->data.procedure.body, type,
                              NiL, 0);
            exfreenode(ex, sym->value);
index 82960572017f54222fab67aa320ae29d6ee681c8..fc590d1e138024522accfaac5cccf44b9c15713f 100644 (file)
@@ -248,7 +248,7 @@ extern "C" {
            exerror("cannot convert %s to STRING", extypename(p, type));
        if (x->op != CONSTANT) {
            if (!BUILTIN(type)) {
-               if ((*p->disc->stringof) (p, x, 1) < 0) {
+               if ((*p->disc->stringof) (p, x, 1, p->disc) < 0) {
                    exerror("cannot convert %s to STRING",
                            extypename(p, type));
                }
@@ -264,7 +264,7 @@ extern "C" {
                }
            x = exnewnode(p, cvt, 0, STRING, x, 0);
        } else if (!BUILTIN(type)) {
-           if ((*p->disc->stringof) (p, x, 0) < 0)
+           if ((*p->disc->stringof) (p, x, 0, p->disc) < 0)
                exerror("cannot convert constant %s to STRING",
                        extypename(p, x->type));
        } else
@@ -396,7 +396,7 @@ extern "C" {
        char *s;
        char *e;
 
-       if (x && x->type != type && type && type != VOID) {
+       if (x && x->type != type && type && type != VOIDTYPE) {
            if (!x->type) {
                x->type = type;
                return x;
index e4ee3875e76b3e4039a9e77d38c6a3ddbb42eed4..ab4481001b016d4bffffaebbc47097e08c8906b9 100644 (file)
 
 %token MINTOKEN
 
-%token INT
 %token INTEGER
 %token UNSIGNED
-%token CHAR
+%token CHARACTER
 %token FLOATING
 %token STRING
-%token VOID
+%token VOIDTYPE
 
 %token  ADDRESS
 %token ARRAY
index 5351e35c03f687f4c932732cb7fa87536085e168..dddeb5dcdaecd18ff4cc0917ecc441e2d2f78545 100644 (file)
@@ -76,9 +76,9 @@ extern "C" {
 /* previously known as EXID, but EXID is also defined by bison in y.tab.h */
 #define EX_ID(n,l,i,t,f)       {{0},(l),(i),(t),0,(f),0,{0},n}
 
-#define DELETE         BREAK   /* exexpr() delete `type'       */
+#define DELETE_T               BREAK   /* exexpr() delete `type'       */
 
-#define INTEGRAL(t)    ((t)>=INT&&(t)<=CHAR)
+#define INTEGRAL(t)    ((t)>=INTEGER&&(t)<=CHARACTER)
 #define BUILTIN(t)  ((t) > MINTOKEN)
 
 /* function type mechanism
@@ -222,7 +222,7 @@ extern "C" {
        /* binary operator function     */
        char *(*typename) (Expr_t *, int);
        /* application type names       */
-       int (*stringof) (Expr_t *, Exnode_t *, int);
+       int (*stringof) (Expr_t *, Exnode_t *, int, Exdisc_t *);
        /* value to string conversion   */
         Extype_t(*keyf) (Expr_t *, Extype_t, int, Exdisc_t *);
        /* dictionary key for external type objects     */
index 36624764015fb604900838bead143968c85725f4..ace4b640f2f2e2010af7d88a7d9a9e9ad552acc4 100644 (file)
@@ -641,7 +641,7 @@ int extoken_fn(register Expr_t * ex)
 
                switch (exlval.id->lex) {
                case DECLARE:
-                   if (exlval.id->index == CHAR) {
+                   if (exlval.id->index == CHARACTER) {
                        /*
                         * `char*' === `string'
                         * the * must immediately follow char