Graphviz 13.0.0~dev.20241220.2304
|
#include <ast/ast.h>
#include <inttypes.h>
#include <expr/exparse.h>
#include <assert.h>
#include <cdt.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <util/agxbuf.h>
#include <vmalloc/vmalloc.h>
Go to the source code of this file.
Data Structures | |
struct | Exid_s |
struct | Exref_s |
union | Exdata_u |
struct | Exnode_s |
struct | Exdisc_s |
struct | Expr_s |
Macros | |
#define | EX_VERSION 20000101L |
#define | EX_CHARSTRING (1<<0) /* '...' same as "..." */ |
#define | EX_UNDECLARED (1<<9) /* allow undeclared identifiers */ |
#define | EX_ARRAY (-3) /* getval() array elt */ |
#define | EX_CALL (-2) /* getval() function call elt */ |
#define | EX_SCALAR (-1) /* getval() scalar elt */ |
#define | EX_NAMELEN 32 /* default Exid_t.name length */ |
#define | EX_ID(n, l, i, t) {{0}, (l), (i), (t), 0, 0, 0, 0, n} |
#define | DELETE_T MINTOKEN /* exexpr() delete `type' */ |
#define | INTEGRAL(t) ((t)>=INTEGER&&(t)<=CHARACTER) |
#define | BUILTIN(t) ((t) > MINTOKEN) |
#define | F 01 /* FLOATING */ |
#define | I 02 /* INTEGER */ |
#define | S 03 /* STRING */ |
#define | TBITS 4 |
#define | TMASK ((1<<TBITS)-1) |
#define | A(n, t) ((t)<<((n)*TBITS)) /* function arg n is type t */ |
#define | N(t) ((t)>>=TBITS) /* shift for next arg */ |
#define | exalloc(p, n) vmalloc((p)->vm, (n)) |
Typedefs | |
typedef EX_STYPE | Extype_t |
typedef union Exdata_u | Exdata_t |
typedef struct Exdisc_s | Exdisc_t |
typedef struct Exnode_s | Exnode_t |
typedef struct Expr_s | Expr_t |
typedef struct Exref_s | Exref_t |
typedef void(* | Exerror_f) (Expr_t *, Exdisc_t *, int, const char *,...) |
typedef void(* | Exexit_f) (void *, int) |
typedef struct Exid_s | Exid_t |
Functions | |
Exnode_t * | excast (Expr_t *, Exnode_t *, long, Exnode_t *, int) |
Exnode_t * | exnoncast (Exnode_t *) |
void | exclose (Expr_t *, int) |
int | excomp (Expr_t *p, const char *name, int line, FILE *fp, char *prefix) |
char * | excontext (Expr_t *, char *, int) |
void | exdump (Expr_t *, Exnode_t *, agxbuf *) |
void | exerror (const char *,...) |
void | exwarn (const char *,...) |
Extype_t | exeval (Expr_t *, Exnode_t *, void *) |
Exnode_t * | exexpr (Expr_t *, const char *, Exid_t *, int) |
void | exfreenode (Expr_t *, Exnode_t *) |
Exnode_t * | exnewnode (Expr_t *, long, bool, long, Exnode_t *, Exnode_t *) |
char * | exnospace (void) |
Expr_t * | exopen (Exdisc_t *) |
int | expop (Expr_t *) |
int | expush (Expr_t *, const char *, int, FILE *) |
int | extoken_fn (Expr_t *) |
char * | exstring (Expr_t *, char *) |
void * | exstralloc (Expr_t *, size_t) |
char * | extype (long int) |
Extype_t | exzero (long int) |
char * | exopname (long) |
void | exinit (void) |
char * | extypename (Expr_t *p, long) |
int | exisAssign (Exnode_t *) |
static char * | exprintf (Vmalloc_t *vm, const char *fmt,...) |
#define EX_ID | ( | n, | |
l, | |||
i, | |||
t | |||
) | {{0}, (l), (i), (t), 0, 0, 0, 0, n} |
#define EX_UNDECLARED (1<<9) /* allow undeclared identifiers */ |
|
extern |
|
extern |
Compile an expression
The callee takes ownership of the pointer prefix
and will free it during expop
or exclose
.
p | Program structure to store result in |
name | Filename of originating source file |
line | Line number of originating source file |
fp | Handle to source file |
prefix | Optional program text to include ahead of the file content |
Referenced by compile().
|
extern |
Definition at line 27 of file excontext.c.
References gv_isspace().
Referenced by make_msg().
Definition at line 629 of file excc.c.
References agxbprint(), agxbputc(), dtfirst, dtnext, Excc_t::expr, gen(), PROCEDURE, and Expr_s::symbols.
Referenced by deparse().
|
extern |
Definition at line 62 of file exerror.c.
References expr, format, free(), make_msg(), and Exstate_s::program.
Referenced by addItem(), assignable(), cloneGraph(), cloneO(), cloneSubg(), closeFile(), convert(), copy(), deref(), eval(), ex_error(), exnospace(), exsubstr(), extoken_fn(), freadFile(), fwriteFile(), getArg(), getval(), lookup(), nxtAttr(), openFile(), prformat(), print(), readFile(), readLine(), refval(), scan(), scformat(), setval(), stringOf(), strToTvtype(), toKind(), tvtypeToStr(), typeChk(), writeFile(), xConvert(), and xPrint().
Definition at line 1965 of file exeval.c.
References Exnode_s::compiled, eval(), FLOATING, EX_STYPE::floating, Exnode_s::floating, EX_STYPE::integer, Exnode_s::integer, RETURN, STRING, EX_STYPE::string, Exnode_s::string, and Exnode_s::type.
Referenced by eval(), evalEdge(), evalNode(), gvpr_core(), and prformat().
Definition at line 26 of file exexpr.c.
References Exnode_s::data, DELETE_T, dtmatch, excast(), exfreenode(), Exid_s::lex, NAME, NULL, PROCEDURE, Expr_s::symbols, type, and Exid_s::value.
Referenced by compile().
|
extern |
|
extern |
|
extern |
Definition at line 25 of file exnospace.c.
References exerror().
Referenced by eval(), exprintf(), exsplit(), extoken_fn(), extokens(), getdyn(), if(), str_add(), str_and(), str_ior(), str_mod(), str_mpy(), and str_xor().
Definition at line 28 of file exopen.c.
References disc, dtinsert, dtopen(), Dtset, exbuiltin, exclose(), Expr_s::file, Expr_s::id, Exid_s::name, PROCEDURE, setcontext, Expr_s::symbols, Expr_s::vm, and vmopen().
Referenced by compileProg().
|
extern |
|
inlinestatic |
Construct a vmalloc-backed string.
vm | Allocator to use. |
fmt | printf-style format sting. |
... | printf-style varargs. |
Definition at line 269 of file expr.h.
References exnospace(), len(), NULL, and vmalloc().
Referenced by eval().
|
extern |
|
extern |
|
extern |
Definition at line 2000 of file exeval.c.
References vmstrdup().
Referenced by bbOf(), canon(), colorx(), nameOf(), readLine(), and xyOf().
|
extern |
Definition at line 311 of file extoken.c.
References agxbclear(), agxbput(), agxbputc(), agxbuse(), AND, CHARACTER, chrtoi(), DEC, DECLARE, dtinsert, dtmatch, dtview(), DYNAMIC, EQ, error_info, EX_CHARSTRING, ex_lval, EX_NAMELEN, exerror(), exnospace(), expr, expush(), extoken_fn(), exunlex, FLOATING, EX_STYPE::floating, GE, gv_isalnum(), gv_isalpha(), gv_isdigit(), gv_isspace(), gv_isxdigit(), ID, EX_STYPE::id, id_string, INC, Exid_s::index, INTEGER, EX_STYPE::integer, LABEL, LE, lex, Exid_s::lex, Error_info_s::line, LSH, NAME, Exid_s::name, NE, Exstate_s::nolabel, NULL, EX_STYPE::op, OR, PRAGMA, RSH, setcontext, streq(), stresc(), STRING, EX_STYPE::string, Expr_s::symbols, UNREACHABLE, UNSIGNED, Expr_s::vm, vmalloc(), and vmstrdup().
Referenced by extoken_fn().
|
extern |
|
extern |
|
extern |
Definition at line 79 of file exerror.c.
References ERROR_WARNING, expr, format, free(), make_msg(), and Exstate_s::program.
Referenced by exsub(), readFile(), and writeFile().
|
extern |
Definition at line 24 of file exzero.c.
References expr, FLOATING, EX_STYPE::floating, INTEGER, EX_STYPE::integer, Exstate_s::nullstring, STRING, EX_STYPE::string, type, and UNSIGNED.
Referenced by eval(), getdyn(), and refval().