Graphviz
13.0.0~dev.20241220.2304
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 v1.0
5
* which accompanies this distribution, and is available at
6
* https://www.eclipse.org/legal/epl-v10.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 <
expr/exlib.h
>
19
#include <stddef.h>
20
21
/*
22
* return the expression for name or sym coerced to type
23
*/
24
25
Exnode_t
*
26
exexpr
(
Expr_t
* ex,
const
char
* name,
Exid_t
* sym,
int
type
)
27
{
28
if
(ex)
29
{
30
if
(!sym)
31
sym = name ?
dtmatch
(ex->
symbols
, name) : &ex->main;
32
if
(sym && sym->
lex
==
PROCEDURE
&& sym->
value
)
33
{
34
if
(
type
!=
DELETE_T
)
35
return
excast
(ex, sym->
value
->
data
.procedure.body,
type
,
NULL
, 0);
36
exfreenode
(ex, sym->
value
);
37
sym->
lex
=
NAME
;
38
sym->
value
= 0;
39
}
40
}
41
return
0;
42
}
43
dtmatch
#define dtmatch(d, o)
Definition
cdt.h:184
exexpr
Exnode_t * exexpr(Expr_t *ex, const char *name, Exid_t *sym, int type)
Definition
exexpr.c:26
exlib.h
PROCEDURE
#define PROCEDURE
Definition
exparse.c:269
type
expr procedure type
Definition
exparse.y:208
DELETE_T
#define DELETE_T
Definition
expr.h:55
excast
Exnode_t * excast(Expr_t *, Exnode_t *, long, Exnode_t *, int)
exfreenode
void exfreenode(Expr_t *, Exnode_t *)
NAME
#define NAME
Definition
gmlparse.c:377
NULL
node NULL
Definition
grammar.y:163
Exid_s
Definition
expr.h:93
Exid_s::lex
long lex
Definition
expr.h:95
Exid_s::value
Exnode_t * value
Definition
expr.h:100
Exnode_s
Definition
expr.h:150
Exnode_s::data
Exdata_t data
Definition
expr.h:160
Expr_s
Definition
expr.h:200
Expr_s::symbols
Dt_t * symbols
Definition
expr.h:202
lib
expr
exexpr.c
Generated by
1.9.8