Graphviz 13.1.2~dev.20250722.1051
|
#include "builddate.h"
#include <assert.h>
#include <ast/error.h>
#include <cgraph/cgraph.h>
#include <cgraph/ingraphs.h>
#include <common/globals.h>
#include <getopt.h>
#include <gvpr/actions.h>
#include <gvpr/compile.h>
#include <gvpr/gprstate.h>
#include <gvpr/gvpr.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/exit.h>
#include <util/gv_ctype.h>
#include <util/gv_find_me.h>
#include <util/list.h>
#include <util/path.h>
#include <util/unreachable.h>
Go to the source code of this file.
Data Structures | |
struct | options |
struct | nodestream |
struct | trav_fns |
struct | gvpr_state_t |
collective managed state used in gvpr_core More... | |
Macros | |
#define | NUM_ARGS 100 |
#define | LISTSEP ':' |
#define | MARKED(x) (((x)->iu.integer) & 1) |
#define | MARK(x) (((x)->iu.integer) = 1) |
#define | ONSTACK(x) (((x)->iu.integer) & 2) |
#define | PUSH(x, e) (((x)->iu.integer) |= 2, (x)->ine = (e)) |
#define | POP(x) (((x)->iu.integer) &= (~2)) |
#define | PRE_VISIT 1 |
#define | POST_VISIT 2 |
Typedefs | |
typedef Agedge_t *(* | fstedgefn_t) (Agraph_t *, Agnode_t *) |
typedef Agedge_t *(* | nxttedgefn_t) (Agraph_t *, Agedge_t *, Agnode_t *) |
Functions | |
static FILE * | openOut (char *name) |
static char * | gettok (char **sp) |
static int | parseArgs (char *s, int argc, char ***argv) |
static char * | concat (char *pfx, char *sfx) |
static char * | dflt_gvprpath (void) |
static char * | resolve (char *arg, int verbose) |
static char * | getOptarg (int c, char **argp, int *argip, int argc, char **argv) |
static int | doFlags (char *arg, int argi, int argc, char **argv, options *opts) |
static void | freeOpts (options opts) |
static options | scanArgs (int argc, char **argv) |
static Agobj_t * | evalEdge (Gpr_t *state, Expr_t *prog, comp_block *xprog, Agedge_t *e) |
static Agobj_t * | evalNode (Gpr_t *state, Expr_t *prog, comp_block *xprog, Agnode_t *n) |
static Agnode_t * | nextNode (Gpr_t *state, nodestream *nodes) |
static Agedge_t * | agnxtout_ (Agraph_t *g, Agedge_t *e, Agnode_t *ignored) |
agnxtout wrapper to tweak calling convention | |
static Agedge_t * | agnxtin_ (Agraph_t *g, Agedge_t *e, Agnode_t *ignored) |
agnxtin wrapper to tweak calling convention | |
static void | travBFS (Gpr_t *state, Expr_t *prog, comp_block *xprog) |
static void | travDFS (Gpr_t *state, Expr_t *prog, comp_block *xprog, trav_fns *fns) |
static void | travNodes (Gpr_t *state, Expr_t *prog, comp_block *xprog) |
static void | travEdges (Gpr_t *state, Expr_t *prog, comp_block *xprog) |
static void | travFlat (Gpr_t *state, Expr_t *prog, comp_block *xprog) |
static void | doCleanup (Agraph_t *g) |
static bool | traverse (Gpr_t *state, Expr_t *prog, comp_block *bp, bool cleanup) |
static void | addOutputGraph (Gpr_t *state, gvpropts *uopts) |
static void | chkClose (Agraph_t *g) |
static Agraph_t * | ing_read (const char *filename, void *fp) |
static void | gvexitf (void *env, int v) |
static void | gverrorf (Expr_t *handle, Exdisc_t *discipline, int level, const char *fmt,...) |
static int | gvpr_core (int argc, char *argv[], gvpropts *uopts, gvpr_state_t *gs) |
int | gvpr (int argc, char *argv[], gvpropts *uopts) |
Variables | |
static char * | Info [] |
static const char * | usage |
static trav_fns | DFSfns = {agfstedge, agnxtedge, 1, 0} |
static trav_fns | FWDfns = {agfstout, agnxtout_, 0, 0} |
static trav_fns | REVfns = {agfstin, agnxtin_, 0, 0} |
#define PUSH | ( | x, | |
e | |||
) | (((x)->iu.integer) |= 2, (x)->ine = (e)) |
Definition at line 869 of file gvpr.c.
References agroot(), cloneO(), Gpr_t::curgraph, gv_recalloc(), gvpropts::ingraphs, gvpropts::n_outgraphs, Gpr_t::outgraph, and gvpropts::outgraphs.
Referenced by gvpr_core().
Definition at line 552 of file gvpr.c.
References agnxtout().
|
static |
Definition at line 881 of file gvpr.c.
References agclose(), and gData.
Referenced by gvpr_core().
|
static |
Definition at line 180 of file gvpr.c.
References agxbdisown(), and agxbprint().
Referenced by resolve().
|
static |
get gvpr’s default paths to search for scripts
The content returned is a list of paths separated by the platform’s native $PATH
separator, either ':' or ';'. The caller is responsible for freeing the returned string.
NULL
on failure Definition at line 193 of file gvpr.c.
References free(), gv_find_me(), LISTSEP, malloc(), NULL, and PATH_SEPARATOR.
Referenced by resolve().
|
static |
Definition at line 741 of file gvpr.c.
References agfstnode(), agnxtnode(), nData, and NULL.
Referenced by traverse().
|
static |
Definition at line 336 of file gvpr.c.
References error, ERROR_ERROR, ERROR_USAGE, ERROR_WARNING, getOptarg(), Info, openOut(), opts, parseArgs(), resolve(), setTraceLevel(), and usage.
Referenced by scanArgs().
|
static |
Definition at line 467 of file gvpr.c.
References case_stmt::action, agsubedge(), Gpr_t::curobj, comp_block::edge_stmts, exeval(), case_stmt::guard, EX_STYPE::integer, comp_block::n_estmts, and Gpr_t::target.
Referenced by travBFS(), travDFS(), travEdges(), and travFlat().
|
static |
Definition at line 489 of file gvpr.c.
References case_stmt::action, agsubnode(), Gpr_t::curobj, exeval(), case_stmt::guard, EX_STYPE::integer, comp_block::n_nstmts, comp_block::node_stmts, and Gpr_t::target.
Referenced by travBFS(), travDFS(), travFlat(), and travNodes().
|
static |
|
static |
|
static |
Definition at line 96 of file gvpr.c.
References error, ERROR_WARNING, gv_isspace(), and NULL.
Referenced by parseArgs().
|
static |
Definition at line 920 of file gvpr.c.
References ERROR_ERROR, errorv(), Gpr_t::flags, graphviz_exit(), GV_USE_EXIT, GV_USE_JUMP, Gpr_t::jbuf, and Exdisc_s::user.
Referenced by gvpr_core().
|
static |
Definition at line 914 of file gvpr.c.
References Gpr_t::jbuf, and gvpr_state_t::state.
Referenced by gvpr_core().
int gvpr | ( | int | argc, |
char * | argv[], | ||
gvpropts * | uopts | ||
) |
main loop for gvpr
Definition at line 1100 of file gvpr.c.
References closeGPRState(), closeIngraph(), freeCompileProg(), freeOpts(), freeParseProg(), gvpr_core(), gvpr_state_t::ing, NULL, gvpr_state_t::opts, options::outFile, gvpr_state_t::prog, gvpr_state_t::state, and gvpr_state_t::xprog.
Referenced by main(), and run_gvpr().
|
static |
Definition at line 948 of file gvpr.c.
References addBindings(), addOutputGraph(), agdelete(), agnnodes(), options::argc, options::argv, Agraph_s::base, comp_block::begg_stmt, comp_prog::begin_stmt, gvpropts::bindings, comp_prog::blocks, chkClose(), cleanup(), compflags_t::clone, cloneO(), options::compflags, compileProg(), Gpr_t::curgraph, Gpr_t::curobj, comp_block::does_walk_graph, comp_prog::end_stmt, comp_prog::endg_stmt, exeval(), fileName(), Gpr_t::flags, gvpropts::flags, GV_USE_EXIT, GV_USE_JUMP, GV_USE_OUTGRAPH, gvelapsed_sec(), gverrorf(), gvexitf(), gvstart_timer(), options::inFiles, Gpr_t::infname, gvpr_state_t::ing, ing_read(), gvpropts::ingraphs, initGPRState(), Gpr_t::jbuf, comp_prog::n_blocks, gvpropts::n_outgraphs, newIng(), newIngGraphs(), nextGraph(), Gpr_t::nextgraph, NULL, openGPRState(), gvpr_state_t::opts, options::outFile, Gpr_t::outgraph, gvpropts::outgraphs, parseProg(), comp_prog::prog, gvpr_state_t::prog, options::program, options::readAhead, scanArgs(), setErrorErrors(), sfioWrite(), compflags_t::srcout, options::state, gvpr_state_t::state, Gpr_t::target, traverse(), Gpr_t::tvroot, options::useFile, comp_prog::uses_graph, options::verbose, and gvpr_state_t::xprog.
Referenced by gvpr().
|
static |
Definition at line 891 of file gvpr.c.
References agconcat(), AGEDGE, aginit(), AGNODE, AGRAPH, NULL, and UDATA.
Referenced by gvpr_core().
|
static |
Definition at line 516 of file gvpr.c.
References agfstnode(), agnxtnode(), Gpr_t::curgraph, Gpr_t::flags, GV_NEXT_SET, nodestream::oldroot, nodestream::prev, Gpr_t::tvnext, and Gpr_t::tvroot.
Referenced by travBFS(), and travDFS().
|
static |
Definition at line 77 of file gvpr.c.
References error, and ERROR_ERROR.
Referenced by doFlags().
|
static |
Definition at line 145 of file gvpr.c.
References cnt(), error, ERROR_WARNING, gettok(), gv_recalloc(), gv_strdup(), and NUM_ARGS.
Referenced by doFlags().
|
static |
Definition at line 238 of file gvpr.c.
References agxbfree(), agxbprint(), agxbput(), agxbput_n(), agxbuse(), concat(), dflt_gvprpath(), error, ERROR_ERROR, fname, free(), gv_strdup(), LISTSEP, NULL, PATH_SEPARATOR, and verbose.
Referenced by doFlags().
|
static |
Definition at line 412 of file gvpr.c.
References doFlags(), error, ERROR_ERROR, ERROR_USAGE, NULL, opts, setErrorId(), and usage.
Referenced by gvpr_core().
|
static |
Definition at line 569 of file gvpr.c.
References agfstedge(), agnxtedge(), evalEdge(), evalNode(), MARK, MARKED, nData, nextNode(), Agedge_s::node, nodestream::oldroot, ONSTACK, POP, nodestream::prev, and PUSH.
Referenced by traverse().
|
static |
Definition at line 614 of file gvpr.c.
References agopp, evalEdge(), evalNode(), MARK, MARKED, nData, nextNode(), Agedge_s::node, NULL, nodestream::oldroot, ONSTACK, POP, POST_VISIT, PRE_VISIT, nodestream::prev, PUSH, and seed.
Referenced by traverse().
|
static |
Definition at line 704 of file gvpr.c.
References agfstnode(), agfstout(), agnxtnode(), agnxtout(), Gpr_t::curgraph, and evalEdge().
Referenced by traverse().
|
static |
Definition at line 755 of file gvpr.c.
References agsubg(), agxbfree(), agxbprint(), agxbuse(), cleanup(), Gpr_t::curgraph, DFSfns, doCleanup(), FWDfns, Gpr_t::name_used, openSubg(), Gpr_t::outgraph, POST_VISIT, PRE_VISIT, REVfns, Gpr_t::target, Gpr_t::tgtname, travBFS(), travDFS(), travEdges(), travFlat(), travNodes(), TV_bfs, TV_dfs, TV_en, TV_flat, TV_fwd, TV_ne, TV_postdfs, TV_postfwd, TV_postrev, TV_prepostdfs, TV_prepostfwd, TV_prepostrev, TV_rev, Gpr_t::tvt, UNREACHABLE, and trav_fns::visit.
Referenced by gvpr_core().
|
static |
Definition at line 719 of file gvpr.c.
References agfstnode(), agfstout(), agnxtnode(), agnxtout(), Gpr_t::curgraph, evalEdge(), evalNode(), and comp_block::n_estmts.
Referenced by traverse().
|
static |
Definition at line 694 of file gvpr.c.
References agfstnode(), agnxtnode(), Gpr_t::curgraph, and evalNode().
Referenced by traverse().
Definition at line 563 of file gvpr.c.
Referenced by traverse().
Definition at line 564 of file gvpr.c.
Referenced by traverse().
|
static |
Definition at line 565 of file gvpr.c.
Referenced by traverse().
|
static |
Definition at line 49 of file gvpr.c.
Referenced by doFlags(), errexit(), gdCmd(), init(), init(), init(), init(), init(), init(), init(), init(), init(), init(), init(), init(), init(), init(), init(), initargs(), initargs(), initargs(), main(), parseArgs(), scanArgs(), scanArgs(), scanargs(), setAction(), and tclGdColorCmd().