Graphviz 13.0.0~dev.20241222.1117
Loading...
Searching...
No Matches
grid.c File Reference
#include <fdpgen/fdp.h>
#include <fdpgen/grid.h>
#include <common/macros.h>
#include <stddef.h>
#include <string.h>
#include <util/alloc.h>
Include dependency graph for grid.c:

Go to the source code of this file.

Data Structures

struct  _block
 
struct  _grid
 

Macros

#define FDP_PRIVATE   1
 

Typedefs

typedef struct _block block_t
 
typedef int(* walkfn_t) (void *, void *)
 

Functions

static block_tnewBlock (int size)
 
static void freeBlock (block_t *b)
 
static cellgetCell (Grid *g)
 
static int ijcmpf (void *point1, void *point2)
 
static void * newCell (void *obj, Dtdisc_t *disc)
 
static node_listnewNode (Grid *g, Agnode_t *n, node_list *nxt)
 
GridmkGrid (int cellHint)
 
void adjustGrid (Grid *g, int nnodes)
 
void clearGrid (Grid *g)
 
void delGrid (Grid *g)
 
void addGrid (Grid *g, int i, int j, Agnode_t *n)
 
void walkGrid (Grid *g, int(*walkf)(cell *, Grid *))
 
cellfindGrid (Grid *g, int i, int j)
 
int gLength (cell *p)
 

Variables

static Grid _grid
 
static Dtdisc_t gridDisc
 

Macro Definition Documentation

◆ FDP_PRIVATE

#define FDP_PRIVATE   1

Definition at line 22 of file grid.c.

Typedef Documentation

◆ block_t

typedef struct _block block_t

◆ walkfn_t

typedef int(* walkfn_t) (void *, void *)

Definition at line 230 of file grid.c.

Function Documentation

◆ addGrid()

void addGrid ( Grid g,
int  i,
int  j,
Agnode_t n 
)

Definition at line 216 of file grid.c.

References agnameof(), _grid::data, dtinsert, gridpt::i, gridpt::j, newNode(), cell::nodes, cell::p, and Verbose.

Referenced by gAdjust().

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

◆ adjustGrid()

void adjustGrid ( Grid g,
int  nnodes 
)

Definition at line 178 of file grid.c.

References free(), gv_calloc(), _grid::listMem, _grid::listSize, and MAX.

Referenced by fdp_tLayout().

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

◆ clearGrid()

void clearGrid ( Grid g)

◆ delGrid()

void delGrid ( Grid g)

Definition at line 206 of file grid.c.

References _grid::cellMem, _grid::data, dtclose(), free(), freeBlock(), and _grid::listMem.

Referenced by fdp_tLayout().

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

◆ findGrid()

cell * findGrid ( Grid g,
int  i,
int  j 
)

Definition at line 247 of file grid.c.

References _grid::data, dtsearch, gridpt::i, gridpt::j, and cell::p.

Referenced by doNeighbor().

Here is the caller graph for this function:

◆ freeBlock()

static void freeBlock ( block_t b)
static

Definition at line 57 of file grid.c.

References free(), freeBlock(), block::next, and _block::next.

Referenced by delGrid(), and freeBlock().

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

◆ getCell()

static cell * getCell ( Grid g)
static

Definition at line 79 of file grid.c.

References _grid::cellCur, newBlock(), and block::next.

Referenced by newCell().

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

◆ gLength()

int gLength ( cell p)

Definition at line 259 of file grid.c.

References len(), _node_list::next, and cell::nodes.

Referenced by doNeighbor(), and gridRepulse().

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

◆ ijcmpf()

static int ijcmpf ( void *  point1,
void *  point2 
)
static

Definition at line 95 of file grid.c.

References gridpt::i, and gridpt::j.

◆ mkGrid()

Grid * mkGrid ( int  cellHint)

Definition at line 163 of file grid.c.

References _grid::cellMem, _grid::data, dtopen(), Dtoset, gridDisc, and newBlock().

Referenced by fdp_tLayout().

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

◆ newBlock()

static block_t * newBlock ( int  size)
static

Definition at line 42 of file grid.c.

References gv_alloc(), gv_calloc(), and block::next.

Referenced by getCell(), and mkGrid().

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

◆ newCell()

static void * newCell ( void *  obj,
Dtdisc_t disc 
)
static

Definition at line 119 of file grid.c.

References disc, getCell(), gridpt::i, gridpt::j, cell::nodes, and cell::p.

Here is the call graph for this function:

◆ newNode()

static node_list * newNode ( Grid g,
Agnode_t n,
node_list nxt 
)
static

Definition at line 138 of file grid.c.

References _grid::listCur, _node_list::next, and _node_list::node.

Referenced by addGrid(), main(), and RBTreeInsert().

Here is the caller graph for this function:

◆ walkGrid()

void walkGrid ( Grid g,
int(*)(cell *, Grid *)  walkf 
)

Definition at line 238 of file grid.c.

References _grid::data, and dtwalk().

Referenced by gAdjust().

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

Variable Documentation

◆ _grid

Grid _grid
static

Definition at line 113 of file grid.c.

◆ gridDisc

Dtdisc_t gridDisc
static
Initial value:
= {
offsetof(cell, p),
sizeof(gridpt),
offsetof(cell, link),
}
node NULL
Definition grammar.y:163
static void * newCell(void *obj, Dtdisc_t *disc)
Definition grid.c:119
static int ijcmpf(void *point1, void *point2)
Definition grid.c:95
result of partitioning available space, part of maze
Definition grid.h:33
Definition grid.h:29

Definition at line 149 of file grid.c.

Referenced by mkGrid().