PIPS
graph.c
Go to the documentation of this file.
1 /*
2  * THIS FILE HAS BEEN AUTOMATICALLY GENERATED BY NEWGEN.
3  *
4  * PLEASE DO NOT MODIFY IT.
5  */
6 
7 typedef void * vertex_label;
8 typedef void * arc_label;
9 
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include "genC.h"
14 #include "graph.h"
15 
16 
17 
18 /* GRAPH
19  */
21  return (graph) gen_copy_tree((gen_chunk*) p);
22 }
23 void free_graph(graph p) {
24  gen_free((gen_chunk*) p);
25 }
27  return (graph) gen_check((gen_chunk*) p, graph_domain);
28 }
30  check_graph(p);
31  return gen_consistent_p((gen_chunk*) p);
32 }
34  return gen_defined_p((gen_chunk*) p);
35 }
37  return gen_typed_cons(GRAPH_NEWGEN_DOMAIN, p, l);
38 }
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 }
47  // should clear up contents...
48  free(p);
49 }
50 void write_graph(FILE* f, graph p) {
51  gen_write(f, (gen_chunk*) p);
52 }
53 graph read_graph(FILE* f) {
54  return (graph) gen_read(f);
55 }
57  return (graph) gen_alloc(2*sizeof(gen_chunk), GEN_CHECK_ALLOC, graph_domain, a);
58 }
59 
60 /* SUCCESSOR
61  */
63  return (successor) gen_copy_tree((gen_chunk*) p);
64 }
66  gen_free((gen_chunk*) p);
67 }
70 }
72  check_successor(p);
73  return gen_consistent_p((gen_chunk*) p);
74 }
76  return gen_defined_p((gen_chunk*) p);
77 }
80 }
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 }
89  // should clear up contents...
90  free(p);
91 }
92 void write_successor(FILE* f, successor p) {
93  gen_write(f, (gen_chunk*) p);
94 }
96  return (successor) gen_read(f);
97 }
99  return (successor) gen_alloc(3*sizeof(gen_chunk), GEN_CHECK_ALLOC, successor_domain, a1, a2);
100 }
101 
102 /* VERTEX
103  */
105  return (vertex) gen_copy_tree((gen_chunk*) p);
106 }
108  gen_free((gen_chunk*) p);
109 }
111  return (vertex) gen_check((gen_chunk*) p, vertex_domain);
112 }
114  check_vertex(p);
115  return gen_consistent_p((gen_chunk*) p);
116 }
118  return gen_defined_p((gen_chunk*) p);
119 }
121  return gen_typed_cons(VERTEX_NEWGEN_DOMAIN, p, l);
122 }
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 }
131  // should clear up contents...
132  free(p);
133 }
134 void write_vertex(FILE* f, vertex p) {
135  gen_write(f, (gen_chunk*) p);
136 }
138  return (vertex) gen_read(f);
139 }
141  return (vertex) gen_alloc(3*sizeof(gen_chunk), GEN_CHECK_ALLOC, vertex_domain, a1, a2);
142 }
143 
successor check_successor(successor p)
Definition: graph.c:68
bool successor_defined_p(successor p)
Definition: graph.c:75
bool vertex_consistent_p(vertex p)
Definition: graph.c:113
void write_graph(FILE *f, graph p)
Definition: graph.c:50
void vertex_non_recursive_free(vertex p)
Definition: graph.c:130
vertex check_vertex(vertex p)
Definition: graph.c:110
void write_vertex(FILE *f, vertex p)
Definition: graph.c:134
successor read_successor(FILE *f)
Definition: graph.c:95
graph make_graph(list a)
Definition: graph.c:56
void free_vertex(vertex p)
Definition: graph.c:107
void successor_assign_contents(successor r, successor v)
Definition: graph.c:81
list gen_graph_cons(graph p, list l)
Definition: graph.c:36
graph read_graph(FILE *f)
Definition: graph.c:53
void graph_non_recursive_free(graph p)
Definition: graph.c:46
successor make_successor(arc_label a1, vertex a2)
Definition: graph.c:98
bool graph_consistent_p(graph p)
Definition: graph.c:29
vertex make_vertex(vertex_label a1, list a2)
Definition: graph.c:140
void write_successor(FILE *f, successor p)
Definition: graph.c:92
void vertex_assign_contents(vertex r, vertex v)
Definition: graph.c:123
void free_graph(graph p)
Definition: graph.c:23
graph check_graph(graph p)
Definition: graph.c:26
void successor_non_recursive_free(successor p)
Definition: graph.c:88
list gen_vertex_cons(vertex p, list l)
Definition: graph.c:120
bool vertex_defined_p(vertex p)
Definition: graph.c:117
void free_successor(successor p)
Definition: graph.c:65
vertex copy_vertex(vertex p)
VERTEX.
Definition: graph.c:104
graph copy_graph(graph p)
GRAPH.
Definition: graph.c:20
void graph_assign_contents(graph r, graph v)
Definition: graph.c:39
list gen_successor_cons(successor p, list l)
Definition: graph.c:78
bool successor_consistent_p(successor p)
Definition: graph.c:71
void * arc_label
Definition: graph.c:8
void * vertex_label
Definition: graph.c:7
vertex read_vertex(FILE *f)
Definition: graph.c:137
bool graph_defined_p(graph p)
Definition: graph.c:33
successor copy_successor(successor p)
SUCCESSOR.
Definition: graph.c:62
#define VERTEX_NEWGEN_DOMAIN
Definition: dg.h:26
#define GEN_CHECK_ALLOC
Definition: genC.h:307
void gen_free(gen_chunk *obj)
version without shared_pointers.
Definition: genClib.c:992
gen_chunk * gen_alloc(int size, int gen_check_p, int dom,...)
allocates something in newgen.
Definition: genClib.c:298
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
Definition: genClib.c:2398
int gen_defined_p(gen_chunk *obj)
Definition: genClib.c:2438
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
gen_chunk * gen_read(FILE *file)
GEN_READ reads any object from the FILE stream.
Definition: genClib.c:2323
gen_chunk * gen_copy_tree(gen_chunk *obj)
Definition: genClib.c:1429
void gen_write(FILE *fd, gen_chunk *obj)
GEN_WRITE writes the OBJect on the stream FD.
Definition: genClib.c:1745
void free(void *)
#define successor_domain
newgen_graph_domain_defined
Definition: graph.h:34
#define vertex_domain
newgen_successor_domain_defined
Definition: graph.h:42
#define GRAPH_NEWGEN_DOMAIN
Definition: graph.h:29
#define graph_domain
newgen_arc_label_domain_defined
Definition: graph.h:26
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
#define SUCCESSOR_NEWGEN_DOMAIN
Definition: hierarchize.c:76
#define message_assert(msg, ex)
Definition: newgen_assert.h:47
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
A gen_chunk is used to store every object.
Definition: genC.h:58