Graphviz 13.0.0~dev.20250204.0809
Loading...
Searching...
No Matches
tclpathplan.c File Reference
#include "config.h"
#include <sys/types.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include "makecw.h"
#include <math.h>
#include <pathplan/pathutil.h>
#include <pathplan/vispath.h>
#include <pathplan/tri.h>
#include "Plegal_arrangement.h"
#include <tcl.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/list.h>
#include <util/prisize_t.h>
Include dependency graph for tclpathplan.c:

Go to the source code of this file.

Data Structures

struct  poly_s
 
struct  vgpane_t
 

Macros

#define Tcl_GetStringResult(interp)   interp->result
 
#define HANDLE_FORMAT   ("vgpane%" PRISIZE_T)
 printf format for TCL handles
 

Typedefs

typedef Ppoint_t point
 
typedef struct poly_s poly
 

Functions

static polyallocpoly (vgpane_t *vgp, int id, int npts)
 
static void vc_stale (vgpane_t *vgp)
 
static int vc_refresh (vgpane_t *vgp)
 
static void dgsprintxy (agxbuf *result, int npts, const point p[])
 
static void expandPercentsEval (Tcl_Interp *interp, char *before, size_t vgcanvasHandle, int npts, const point *ppos)
 
static void triangle_callback (void *vgparg, const point pqr[])
 
static char * buildBindings (char *s1, const char *s2)
 
static int scanpoint (Tcl_Interp *interp, const char *argv[], point *p)
 
static point center (point vertex[], size_t n)
 
static double distance (point p, point q)
 
static point rotate (point c, point p, double alpha)
 
static point scale (point c, point p, double gain)
 
static bool remove_poly (vgpane_t *vgp, int id)
 
static int insert_poly (Tcl_Interp *interp, vgpane_t *vgp, int id, const char *vargv[], int vargc)
 
static void make_barriers (vgpane_t *vgp, int pp, int qp, Pedge_t **barriers, size_t *n_barriers)
 
static void appendpoint (Tcl_Interp *interp, point p)
 
static vgpane_tfind_vgpane (vgpanes_t *panes, const char *handle)
 
static void garbage_collect_vgpanes (vgpanes_t *panes)
 
static int vgpanecmd (ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
 
static int vgpane (ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
 
int Tclpathplan_Init (Tcl_Interp *interp)
 
int Tclpathplan_SafeInit (Tcl_Interp *interp)
 

Variables

static vgpanes_t vgpaneTable
 
static int polyid = 0
 

Macro Definition Documentation

◆ HANDLE_FORMAT

#define HANDLE_FORMAT   ("vgpane%" PRISIZE_T)

Definition at line 57 of file tclpathplan.c.

◆ Tcl_GetStringResult

#define Tcl_GetStringResult (   interp)    interp->result

Definition at line 43 of file tclpathplan.c.

Typedef Documentation

◆ point

typedef Ppoint_t point

Definition at line 47 of file tclpathplan.c.

◆ poly

typedef struct poly_s poly

Function Documentation

◆ allocpoly()

static poly * allocpoly ( vgpane_t vgp,
int  id,
int  npts 
)
static

Definition at line 74 of file tclpathplan.c.

References poly_s::boundary, gv_calloc(), Ppoly_t::pn, and Ppoly_t::ps.

Referenced by insert_poly().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendpoint()

static void appendpoint ( Tcl_Interp *  interp,
point  p 
)
static

Definition at line 353 of file tclpathplan.c.

References point::x, and point::y.

Referenced by vgpanecmd().

Here is the caller graph for this function:

◆ buildBindings()

static char * buildBindings ( char *  s1,
const char *  s2 
)
static

Definition at line 181 of file tclpathplan.c.

References agxbdisown(), agxbprint(), free(), gv_strdup(), NULL, and s1().

Referenced by vgpanecmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ center()

◆ dgsprintxy()

static void dgsprintxy ( agxbuf result,
int  npts,
const point  p[] 
)
static

Definition at line 106 of file tclpathplan.c.

References agxblen(), agxbprint(), and agxbputc().

Referenced by expandPercentsEval().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distance()

static double distance ( point  p,
point  q 
)
static

Definition at line 252 of file tclpathplan.c.

References dx, dy, point::x, and point::y.

Referenced by rotate().

Here is the caller graph for this function:

◆ expandPercentsEval()

static void expandPercentsEval ( Tcl_Interp *  interp,
char *  before,
size_t  vgcanvasHandle,
int  npts,
const point ppos 
)
static
Parameters
interpInterpreter context
beforeCommand with percent expressions
vgcanvasHandleIndex to use in "%r" substitution
nptsNumber of coordinates
pposCoordinates to substitute for t

Definition at line 127 of file tclpathplan.c.

References agxbfree(), agxbprint(), agxbput_n(), agxbputc(), agxbuse(), dgsprintxy(), HANDLE_FORMAT, NULL, and Tcl_GetStringResult.

Referenced by triangle_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_vgpane()

static vgpane_t * find_vgpane ( vgpanes_t *  panes,
const char *  handle 
)
static

lookup an existing pane

Parameters
panesCollection to search
handleText descriptor of the pane
Returns
A pointer to the pane or NULL if there is no such pane

Definition at line 368 of file tclpathplan.c.

References HANDLE_FORMAT, NULL, and vgpane_t::valid.

Referenced by vgpanecmd().

Here is the caller graph for this function:

◆ garbage_collect_vgpanes()

static void garbage_collect_vgpanes ( vgpanes_t *  panes)
static

cleanup unused panes where possible

Panes need to have a stable identifier (index) for their lifetime. Thus they cannot be removed from a vgpanes_t when deallocated because removing them would alter the index of any still-live panes that comes after them. Instead, panes are marked ->valid = false when deallocated and then later removed here.

It is only safe to remove deallocated panes that have no live panes following them, which is exactly what this function does.

Parameters
panesCollection to sweep

Definition at line 399 of file tclpathplan.c.

References NULL.

Referenced by vgpanecmd().

Here is the caller graph for this function:

◆ insert_poly()

static int insert_poly ( Tcl_Interp *  interp,
vgpane_t vgp,
int  id,
const char *  vargv[],
int  vargc 
)
static

Definition at line 300 of file tclpathplan.c.

References allocpoly(), poly_s::boundary, make_CW(), Ppoly_t::pn, Ppoly_t::ps, scanpoint(), and vc_stale().

Referenced by vgpanecmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_barriers()

static void make_barriers ( vgpane_t vgp,
int  pp,
int  qp,
Pedge_t **  barriers,
size_t *  n_barriers 
)
static

Definition at line 320 of file tclpathplan.c.

References Pedge_t::a, Pedge_t::b, gv_calloc(), and vgpane_t::poly.

Referenced by vgpanecmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_poly()

static bool remove_poly ( vgpane_t vgp,
int  id 
)
static

Definition at line 284 of file tclpathplan.c.

References free(), id, vgpane_t::poly, and vc_stale().

Referenced by vgpanecmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotate()

static point rotate ( point  c,
point  p,
double  alpha 
)
static

Definition at line 261 of file tclpathplan.c.

References alpha, distance(), point::x, and point::y.

Referenced by vgpanecmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale()

static point scale ( point  c,
point  p,
double  gain 
)
static

Definition at line 275 of file tclpathplan.c.

References point::x, and point::y.

Referenced by vgpanecmd().

Here is the caller graph for this function:

◆ scanpoint()

static int scanpoint ( Tcl_Interp *  interp,
const char *  argv[],
point p 
)
static

Definition at line 226 of file tclpathplan.c.

References NULL, point::x, and point::y.

Referenced by insert_poly(), and vgpanecmd().

Here is the caller graph for this function:

◆ Tclpathplan_Init()

int Tclpathplan_Init ( Tcl_Interp *  interp)

Definition at line 891 of file tclpathplan.c.

References NULL, and vgpane().

Referenced by Tclpathplan_SafeInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tclpathplan_SafeInit()

int Tclpathplan_SafeInit ( Tcl_Interp *  interp)

Definition at line 921 of file tclpathplan.c.

References Tclpathplan_Init().

Here is the call graph for this function:

◆ triangle_callback()

static void triangle_callback ( void *  vgparg,
const point  pqr[] 
)
static

Definition at line 173 of file tclpathplan.c.

References expandPercentsEval(), vgpane_t::index, vgpane_t::interp, and vgpane_t::triangle_cmd.

Referenced by vgpanecmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vc_refresh()

static int vc_refresh ( vgpane_t vgp)
static

Definition at line 91 of file tclpathplan.c.

References free(), gv_calloc(), NULL, Plegal_arrangement(), Pobsopen(), vgpane_t::poly, and vgpane_t::vc.

Referenced by vgpanecmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vc_stale()

static void vc_stale ( vgpane_t vgp)
static

Definition at line 83 of file tclpathplan.c.

References NULL, Pobsclose(), and vgpane_t::vc.

Referenced by insert_poly(), and remove_poly().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vgpane()

static int vgpane ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
const char *  argv[] 
)
static

Definition at line 868 of file tclpathplan.c.

References agxbfree(), agxbprint(), agxbuse(), HANDLE_FORMAT, vgpane_t::index, vgpane_t::interp, NULL, vgpane_t::valid, vgpanecmd(), and vgpaneTable.

Referenced by Tclpathplan_Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vgpanecmd()

static int vgpanecmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
const char *  argv[] 
)
static

Definition at line 417 of file tclpathplan.c.

References alpha, appendpoint(), poly_s::boundary, buildBindings(), center(), find_vgpane(), free(), garbage_collect_vgpanes(), in_poly(), insert_poly(), make_barriers(), NULL, Ppoly_t::pn, Pobsclose(), Pobspath(), vgpane_t::poly, polyid, POLYID_NONE, POLYID_UNKNOWN, Proutespline(), ps, Ppoly_t::ps, Ptriangulate(), remove_poly(), rotate(), scale(), scanpoint(), triangle_callback(), vgpane_t::triangle_cmd, vgpane_t::valid, vgpane_t::vc, vc_refresh(), vgpaneTable, point::x, Pxy_t::x, point::y, and Pxy_t::y.

Referenced by vgpane().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ polyid

int polyid = 0
static

Definition at line 72 of file tclpathplan.c.

Referenced by vgpanecmd().

◆ vgpaneTable

vgpanes_t vgpaneTable
static

Definition at line 70 of file tclpathplan.c.

Referenced by vgpane(), and vgpanecmd().