Graphviz 15.1.1~dev.20260628.0906
Loading...
Searching...
No Matches
exexpr.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11/*
12 * Glenn Fowler
13 * AT&T Research
14 *
15 * expression library
16 */
17
18#include "config.h"
19
20#include <expr/exlib.h>
21#include <stddef.h>
22
24Exnode_t *exexpr(Expr_t *ex, const char *name, int type) {
25 if (ex)
26 {
27 Exid_t *const sym = name ? dtmatch(ex->symbols, name) : &ex->main;
28 if (sym && sym->lex == PROCEDURE && sym->value)
29 {
30 if (type != DELETE_T)
31 return excast(ex, sym->value->data.procedure.body, type, NULL, 0);
32 exfreenode(ex, sym->value);
33 sym->lex = NAME;
34 sym->value = 0;
35 }
36 }
37 return 0;
38}
39
#define dtmatch(d, o)
Definition cdt.h:185
Exnode_t * exexpr(Expr_t *ex, const char *name, int type)
return the expression for name coerced to type
Definition exexpr.c:24
#define PROCEDURE
Definition exparse.h:185
expr procedure type
Definition exparse.y:208
#define DELETE_T
Definition expr.h:55
Exnode_t * excast(Expr_t *, Exnode_t *, long, Exnode_t *, int)
void exfreenode(Expr_t *, Exnode_t *)
#define NAME
Definition gmlparse.h:135
node NULL
Definition grammar.y:181
Definition expr.h:91
long lex
Definition expr.h:93
Exnode_t * value
Definition expr.h:97
Exdata_t data
Definition expr.h:144
Definition expr.h:207
Dt_t * symbols
Definition expr.h:209