Graphviz 13.1.3~dev.20250829.0113
Loading...
Searching...
No Matches
tclpathplan.c File Reference
#include "config.h"
#include "../tcl-compat.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/itos.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

typedef LIST (vgpane_t)
 
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[], Tcl_Size 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)
 

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 45 of file tclpathplan.c.

Typedef Documentation

◆ point

typedef Ppoint_t point

Definition at line 49 of file tclpathplan.c.

◆ poly

typedef struct poly_s poly

Function Documentation

◆ appendpoint()

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

Definition at line 348 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 180 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 105 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 251 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 126 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 363 of file tclpathplan.c.

References HANDLE_FORMAT, LIST_AT, LIST_SIZE, and NULL.

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 394 of file tclpathplan.c.

References LIST_BACK, LIST_FREE, LIST_IS_EMPTY, LIST_POP_BACK, and 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[],
Tcl_Size  vargc 
)
static

Definition at line 298 of file tclpathplan.c.

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

Referenced by vgpanecmd().

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

◆ LIST()

typedef LIST ( vgpane_t  )

Definition at line 68 of file tclpathplan.c.

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

Here is the call 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 315 of file tclpathplan.c.

References Pedge_t::a, Pedge_t::b, gv_calloc(), LIST_GET, and LIST_SIZE.

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 283 of file tclpathplan.c.

References free(), id, LIST_GET, LIST_POP_BACK, LIST_SET, LIST_SIZE, 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 260 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 274 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 225 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 925 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 955 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 172 of file tclpathplan.c.

References expandPercentsEval().

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 90 of file tclpathplan.c.

References free(), gv_calloc(), LIST_AT, LIST_SIZE, NULL, Plegal_arrangement(), and Pobsopen().

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 82 of file tclpathplan.c.

References NULL, and Pobsclose().

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 902 of file tclpathplan.c.

References agxbfree(), agxbprint(), agxbuse(), HANDLE_FORMAT, LIST_APPEND, LIST_BACK, LIST_SIZE, NULL, and vgpanecmd().

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 412 of file tclpathplan.c.

References alpha, appendpoint(), poly_s::boundary, buildBindings(), center(), find_vgpane(), free(), garbage_collect_vgpanes(), in_poly(), insert_poly(), ITOS, LIST_AT, LIST_FREE, LIST_GET, LIST_SIZE, make_barriers(), NULL, Ppoly_t::pn, Pobsclose(), Pobspath(), POLYID_NONE, POLYID_UNKNOWN, Proutespline(), ps, Ppoly_t::ps, Ptriangulate(), remove_poly(), rotate(), scale(), scanpoint(), Tcl_Size, triangle_callback(), vc_refresh(), 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: