PIPS
graph.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "genC.h"
#include "graph.h"
+ Include dependency graph for graph.c:

Go to the source code of this file.

Typedefs

typedef void * vertex_label
 
typedef void * arc_label
 

Functions

graph copy_graph (graph p)
 GRAPH. More...
 
void free_graph (graph p)
 
graph check_graph (graph p)
 
bool graph_consistent_p (graph p)
 
bool graph_defined_p (graph p)
 
list gen_graph_cons (graph p, list l)
 
void graph_assign_contents (graph r, graph v)
 
void graph_non_recursive_free (graph p)
 
void write_graph (FILE *f, graph p)
 
graph read_graph (FILE *f)
 
graph make_graph (list a)
 
successor copy_successor (successor p)
 SUCCESSOR. More...
 
void free_successor (successor p)
 
successor check_successor (successor p)
 
bool successor_consistent_p (successor p)
 
bool successor_defined_p (successor p)
 
list gen_successor_cons (successor p, list l)
 
void successor_assign_contents (successor r, successor v)
 
void successor_non_recursive_free (successor p)
 
void write_successor (FILE *f, successor p)
 
successor read_successor (FILE *f)
 
successor make_successor (arc_label a1, vertex a2)
 
vertex copy_vertex (vertex p)
 VERTEX. More...
 
void free_vertex (vertex p)
 
vertex check_vertex (vertex p)
 
bool vertex_consistent_p (vertex p)
 
bool vertex_defined_p (vertex p)
 
list gen_vertex_cons (vertex p, list l)
 
void vertex_assign_contents (vertex r, vertex v)
 
void vertex_non_recursive_free (vertex p)
 
void write_vertex (FILE *f, vertex p)
 
vertex read_vertex (FILE *f)
 
vertex make_vertex (vertex_label a1, list a2)
 

Typedef Documentation

◆ arc_label

typedef void* arc_label

Definition at line 8 of file graph.c.

◆ vertex_label

typedef void* vertex_label

Definition at line 7 of file graph.c.

Function Documentation

◆ check_graph()

graph check_graph ( graph  p)

Definition at line 26 of file graph.c.

26  {
27  return (graph) gen_check((gen_chunk*) p, graph_domain);
28 }
gen_chunk * gen_check(gen_chunk *obj, int t)
GEN_CHECK checks that the gen_chunk received OBJ is of the appropriate TYPE.
Definition: genClib.c:2356
#define graph_domain
newgen_arc_label_domain_defined
Definition: graph.h:26
A gen_chunk is used to store every object.
Definition: genC.h:58

References gen_check(), and graph_domain.

+ Here is the call graph for this function:

◆ check_successor()

successor check_successor ( successor  p)

Definition at line 68 of file graph.c.

68  {
70 }
#define successor_domain
newgen_graph_domain_defined
Definition: graph.h:34

References gen_check(), and successor_domain.

+ Here is the call graph for this function:

◆ check_vertex()

vertex check_vertex ( vertex  p)

Definition at line 110 of file graph.c.

110  {
111  return (vertex) gen_check((gen_chunk*) p, vertex_domain);
112 }
#define vertex_domain
newgen_successor_domain_defined
Definition: graph.h:42

References gen_check(), and vertex_domain.

+ Here is the call graph for this function:

◆ copy_graph()

graph copy_graph ( graph  p)

GRAPH.

Definition at line 20 of file graph.c.

20  {
21  return (graph) gen_copy_tree((gen_chunk*) p);
22 }
gen_chunk * gen_copy_tree(gen_chunk *obj)
Definition: genClib.c:1429

References gen_copy_tree().

+ Here is the call graph for this function:

◆ copy_successor()

successor copy_successor ( successor  p)

SUCCESSOR.

Definition at line 62 of file graph.c.

62  {
63  return (successor) gen_copy_tree((gen_chunk*) p);
64 }

References gen_copy_tree().

+ Here is the call graph for this function:

◆ copy_vertex()

vertex copy_vertex ( vertex  p)

VERTEX.

Definition at line 104 of file graph.c.

104  {
105  return (vertex) gen_copy_tree((gen_chunk*) p);
106 }

References gen_copy_tree().

+ Here is the call graph for this function:

◆ free_graph()

void free_graph ( graph  p)

Definition at line 23 of file graph.c.

23  {
24  gen_free((gen_chunk*) p);
25 }
void gen_free(gen_chunk *obj)
version without shared_pointers.
Definition: genClib.c:992

References gen_free().

+ Here is the call graph for this function:

◆ free_successor()

void free_successor ( successor  p)

Definition at line 65 of file graph.c.

65  {
66  gen_free((gen_chunk*) p);
67 }

References gen_free().

+ Here is the call graph for this function:

◆ free_vertex()

void free_vertex ( vertex  p)

Definition at line 107 of file graph.c.

107  {
108  gen_free((gen_chunk*) p);
109 }

References gen_free().

+ Here is the call graph for this function:

◆ gen_graph_cons()

list gen_graph_cons ( graph  p,
list  l 
)

Definition at line 36 of file graph.c.

36  {
37  return gen_typed_cons(GRAPH_NEWGEN_DOMAIN, p, l);
38 }
#define GRAPH_NEWGEN_DOMAIN
Definition: graph.h:29
list gen_typed_cons(_int type, const void *item, const list next)
CONS a list with minimal type checking this cannot be done within the CONS macro because possible fun...
Definition: list.c:900

References gen_typed_cons(), and GRAPH_NEWGEN_DOMAIN.

+ Here is the call graph for this function:

◆ gen_successor_cons()

list gen_successor_cons ( successor  p,
list  l 
)

Definition at line 78 of file graph.c.

78  {
80 }
#define SUCCESSOR_NEWGEN_DOMAIN
Definition: hierarchize.c:76

References gen_typed_cons(), and SUCCESSOR_NEWGEN_DOMAIN.

+ Here is the call graph for this function:

◆ gen_vertex_cons()

list gen_vertex_cons ( vertex  p,
list  l 
)

Definition at line 120 of file graph.c.

120  {
121  return gen_typed_cons(VERTEX_NEWGEN_DOMAIN, p, l);
122 }
#define VERTEX_NEWGEN_DOMAIN
Definition: dg.h:26

References gen_typed_cons(), and VERTEX_NEWGEN_DOMAIN.

+ Here is the call graph for this function:

◆ graph_assign_contents()

void graph_assign_contents ( graph  r,
graph  v 
)

Definition at line 39 of file graph.c.

39  {
40  check_graph(r);
41  check_graph(v);
42  message_assert("defined references to domain graph",
44  memcpy(r, v, sizeof(struct _newgen_struct_graph_));
45 }
graph check_graph(graph p)
Definition: graph.c:26
bool graph_defined_p(graph p)
Definition: graph.c:33
#define message_assert(msg, ex)
Definition: newgen_assert.h:47

References check_graph(), graph_defined_p(), and message_assert.

+ Here is the call graph for this function:

◆ graph_consistent_p()

bool graph_consistent_p ( graph  p)

Definition at line 29 of file graph.c.

29  {
30  check_graph(p);
31  return gen_consistent_p((gen_chunk*) p);
32 }
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
Definition: genClib.c:2398

References check_graph(), and gen_consistent_p().

+ Here is the call graph for this function:

◆ graph_defined_p()

bool graph_defined_p ( graph  p)

Definition at line 33 of file graph.c.

33  {
34  return gen_defined_p((gen_chunk*) p);
35 }
int gen_defined_p(gen_chunk *obj)
Definition: genClib.c:2438

References gen_defined_p().

+ Here is the call graph for this function:

◆ graph_non_recursive_free()

void graph_non_recursive_free ( graph  p)

Definition at line 46 of file graph.c.

46  {
47  // should clear up contents...
48  free(p);
49 }
void free(void *)

References free().

+ Here is the call graph for this function:

◆ make_graph()

graph make_graph ( list  a)

Definition at line 56 of file graph.c.

56  {
57  return (graph) gen_alloc(2*sizeof(gen_chunk), GEN_CHECK_ALLOC, graph_domain, a);
58 }
#define GEN_CHECK_ALLOC
Definition: genC.h:307
gen_chunk * gen_alloc(int size, int gen_check_p, int dom,...)
allocates something in newgen.
Definition: genClib.c:298

References gen_alloc(), GEN_CHECK_ALLOC, and graph_domain.

+ Here is the call graph for this function:

◆ make_successor()

successor make_successor ( arc_label  a1,
vertex  a2 
)

Definition at line 98 of file graph.c.

98  {
99  return (successor) gen_alloc(3*sizeof(gen_chunk), GEN_CHECK_ALLOC, successor_domain, a1, a2);
100 }

References gen_alloc(), GEN_CHECK_ALLOC, and successor_domain.

+ Here is the call graph for this function:

◆ make_vertex()

vertex make_vertex ( vertex_label  a1,
list  a2 
)

Definition at line 140 of file graph.c.

140  {
141  return (vertex) gen_alloc(3*sizeof(gen_chunk), GEN_CHECK_ALLOC, vertex_domain, a1, a2);
142 }

References gen_alloc(), GEN_CHECK_ALLOC, and vertex_domain.

+ Here is the call graph for this function:

◆ read_graph()

graph read_graph ( FILE *  f)

Definition at line 53 of file graph.c.

53  {
54  return (graph) gen_read(f);
55 }
gen_chunk * gen_read(FILE *file)
GEN_READ reads any object from the FILE stream.
Definition: genClib.c:2323
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15

References f(), and gen_read().

+ Here is the call graph for this function:

◆ read_successor()

successor read_successor ( FILE *  f)

Definition at line 95 of file graph.c.

95  {
96  return (successor) gen_read(f);
97 }

References f(), and gen_read().

+ Here is the call graph for this function:

◆ read_vertex()

vertex read_vertex ( FILE *  f)

Definition at line 137 of file graph.c.

137  {
138  return (vertex) gen_read(f);
139 }

References f(), and gen_read().

+ Here is the call graph for this function:

◆ successor_assign_contents()

void successor_assign_contents ( successor  r,
successor  v 
)

Definition at line 81 of file graph.c.

81  {
82  check_successor(r);
83  check_successor(v);
84  message_assert("defined references to domain successor",
86  memcpy(r, v, sizeof(struct _newgen_struct_successor_));
87 }
successor check_successor(successor p)
Definition: graph.c:68
bool successor_defined_p(successor p)
Definition: graph.c:75

References check_successor(), message_assert, and successor_defined_p().

+ Here is the call graph for this function:

◆ successor_consistent_p()

bool successor_consistent_p ( successor  p)

Definition at line 71 of file graph.c.

71  {
72  check_successor(p);
73  return gen_consistent_p((gen_chunk*) p);
74 }

References check_successor(), and gen_consistent_p().

+ Here is the call graph for this function:

◆ successor_defined_p()

bool successor_defined_p ( successor  p)

Definition at line 75 of file graph.c.

75  {
76  return gen_defined_p((gen_chunk*) p);
77 }

References gen_defined_p().

+ Here is the call graph for this function:

◆ successor_non_recursive_free()

void successor_non_recursive_free ( successor  p)

Definition at line 88 of file graph.c.

88  {
89  // should clear up contents...
90  free(p);
91 }

References free().

+ Here is the call graph for this function:

◆ vertex_assign_contents()

void vertex_assign_contents ( vertex  r,
vertex  v 
)

Definition at line 123 of file graph.c.

123  {
124  check_vertex(r);
125  check_vertex(v);
126  message_assert("defined references to domain vertex",
128  memcpy(r, v, sizeof(struct _newgen_struct_vertex_));
129 }
vertex check_vertex(vertex p)
Definition: graph.c:110
bool vertex_defined_p(vertex p)
Definition: graph.c:117

References check_vertex(), message_assert, and vertex_defined_p().

+ Here is the call graph for this function:

◆ vertex_consistent_p()

bool vertex_consistent_p ( vertex  p)

Definition at line 113 of file graph.c.

113  {
114  check_vertex(p);
115  return gen_consistent_p((gen_chunk*) p);
116 }

References check_vertex(), and gen_consistent_p().

+ Here is the call graph for this function:

◆ vertex_defined_p()

bool vertex_defined_p ( vertex  p)

Definition at line 117 of file graph.c.

117  {
118  return gen_defined_p((gen_chunk*) p);
119 }

References gen_defined_p().

+ Here is the call graph for this function:

◆ vertex_non_recursive_free()

void vertex_non_recursive_free ( vertex  p)

Definition at line 130 of file graph.c.

130  {
131  // should clear up contents...
132  free(p);
133 }

References free().

+ Here is the call graph for this function:

◆ write_graph()

void write_graph ( FILE *  f,
graph  p 
)

Definition at line 50 of file graph.c.

50  {
51  gen_write(f, (gen_chunk*) p);
52 }
void gen_write(FILE *fd, gen_chunk *obj)
GEN_WRITE writes the OBJect on the stream FD.
Definition: genClib.c:1745

References f(), and gen_write().

+ Here is the call graph for this function:

◆ write_successor()

void write_successor ( FILE *  f,
successor  p 
)

Definition at line 92 of file graph.c.

92  {
93  gen_write(f, (gen_chunk*) p);
94 }

References f(), and gen_write().

+ Here is the call graph for this function:

◆ write_vertex()

void write_vertex ( FILE *  f,
vertex  p 
)

Definition at line 134 of file graph.c.

134  {
135  gen_write(f, (gen_chunk*) p);
136 }

References f(), and gen_write().

+ Here is the call graph for this function: