PIPS
text.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 
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include "genC.h"
12 #include "text.h"
13 
14 /* SENTENCE
15  */
17  return (sentence) gen_copy_tree((gen_chunk*) p);
18 }
20  gen_free((gen_chunk*) p);
21 }
24 }
26  check_sentence(p);
27  return gen_consistent_p((gen_chunk*) p);
28 }
30  return gen_defined_p((gen_chunk*) p);
31 }
34 }
36  check_sentence(r);
37  check_sentence(v);
38  message_assert("defined references to domain sentence",
40  memcpy(r, v, sizeof(struct _newgen_struct_sentence_));
41 }
43  // should clear up contents...
44  free(p);
45 }
46 void write_sentence(FILE* f, sentence p) {
47  gen_write(f, (gen_chunk*) p);
48 }
50  return (sentence) gen_read(f);
51 }
53  switch (tag) {
54  case is_sentence_formatted: return "formatted";
55  case is_sentence_unformatted: return "unformatted";
56  default: return string_undefined;
57  }
58 }
60  return (sentence) gen_alloc(3*sizeof(gen_chunk), GEN_CHECK_ALLOC, sentence_domain, tag, val);
61 }
63  return make_sentence(is_sentence_formatted, (void*)(intptr_t) _field_);
64 }
66  return make_sentence(is_sentence_unformatted, (void*)(intptr_t) _field_);
67 }
68 
69 /* TEXT
70  */
72  return (text) gen_copy_tree((gen_chunk*) p);
73 }
74 void free_text(text p) {
75  gen_free((gen_chunk*) p);
76 }
78  return (text) gen_check((gen_chunk*) p, text_domain);
79 }
81  check_text(p);
82  return gen_consistent_p((gen_chunk*) p);
83 }
85  return gen_defined_p((gen_chunk*) p);
86 }
88  return gen_typed_cons(TEXT_NEWGEN_DOMAIN, p, l);
89 }
91  check_text(r);
92  check_text(v);
93  message_assert("defined references to domain text",
95  memcpy(r, v, sizeof(struct _newgen_struct_text_));
96 }
98  // should clear up contents...
99  free(p);
100 }
101 void write_text(FILE* f, text p) {
102  gen_write(f, (gen_chunk*) p);
103 }
104 text read_text(FILE* f) {
105  return (text) gen_read(f);
106 }
108  return (text) gen_alloc(2*sizeof(gen_chunk), GEN_CHECK_ALLOC, text_domain, a);
109 }
110 
111 /* UNFORMATTED
112  */
114  return (unformatted) gen_copy_tree((gen_chunk*) p);
115 }
117  gen_free((gen_chunk*) p);
118 }
121 }
124  return gen_consistent_p((gen_chunk*) p);
125 }
127  return gen_defined_p((gen_chunk*) p);
128 }
131 }
135  message_assert("defined references to domain unformatted",
137  memcpy(r, v, sizeof(struct _newgen_struct_unformatted_));
138 }
140  // should clear up contents...
141  free(p);
142 }
144  gen_write(f, (gen_chunk*) p);
145 }
147  return (unformatted) gen_read(f);
148 }
150  return (unformatted) gen_alloc(5*sizeof(gen_chunk), GEN_CHECK_ALLOC, unformatted_domain, a1, a2, a3, a4);
151 }
152 
bool sentence_defined_p(sentence p)
Definition: text.c:29
sentence make_sentence_formatted(string _field_)
Definition: text.c:62
text check_text(text p)
Definition: text.c:77
void write_unformatted(FILE *f, unformatted p)
Definition: text.c:143
bool text_defined_p(text p)
Definition: text.c:84
string sentence_tag_as_string(enum sentence_utype tag)
Definition: text.c:52
sentence copy_sentence(sentence p)
SENTENCE.
Definition: text.c:16
list gen_text_cons(text p, list l)
Definition: text.c:87
bool unformatted_consistent_p(unformatted p)
Definition: text.c:122
void sentence_assign_contents(sentence r, sentence v)
Definition: text.c:35
void free_unformatted(unformatted p)
Definition: text.c:116
void text_assign_contents(text r, text v)
Definition: text.c:90
unformatted make_unformatted(string a1, intptr_t a2, intptr_t a3, list a4)
Definition: text.c:149
void unformatted_non_recursive_free(unformatted p)
Definition: text.c:139
bool sentence_consistent_p(sentence p)
Definition: text.c:25
unformatted read_unformatted(FILE *f)
Definition: text.c:146
sentence make_sentence_unformatted(unformatted _field_)
Definition: text.c:65
bool text_consistent_p(text p)
Definition: text.c:80
text copy_text(text p)
TEXT.
Definition: text.c:71
bool unformatted_defined_p(unformatted p)
Definition: text.c:126
sentence make_sentence(enum sentence_utype tag, void *val)
Definition: text.c:59
list gen_unformatted_cons(unformatted p, list l)
Definition: text.c:129
void unformatted_assign_contents(unformatted r, unformatted v)
Definition: text.c:132
sentence check_sentence(sentence p)
Definition: text.c:22
unformatted check_unformatted(unformatted p)
Definition: text.c:119
void free_sentence(sentence p)
Definition: text.c:19
text read_text(FILE *f)
Definition: text.c:104
list gen_sentence_cons(sentence p, list l)
Definition: text.c:32
sentence read_sentence(FILE *f)
Definition: text.c:49
void sentence_non_recursive_free(sentence p)
Definition: text.c:42
text make_text(list a)
Definition: text.c:107
unformatted copy_unformatted(unformatted p)
UNFORMATTED.
Definition: text.c:113
void text_non_recursive_free(text p)
Definition: text.c:97
void write_text(FILE *f, text p)
Definition: text.c:101
void free_text(text p)
Definition: text.c:74
void write_sentence(FILE *f, sentence p)
Definition: text.c:46
#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 *)
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 message_assert(msg, ex)
Definition: newgen_assert.h:47
int tag
TAG.
Definition: newgen_types.h:92
#define string_undefined
Definition: newgen_types.h:40
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
#define intptr_t
Definition: stdint.in.h:294
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
#define unformatted_domain
newgen_text_domain_defined
Definition: text.h:26
#define UNFORMATTED_NEWGEN_DOMAIN
Definition: text.h:29
#define TEXT_NEWGEN_DOMAIN
Definition: text.h:21
#define sentence_domain
Definition: text.h:10
sentence_utype
Definition: text.h:56
@ is_sentence_formatted
Definition: text.h:57
@ is_sentence_unformatted
Definition: text.h:58
#define text_domain
newgen_sentence_domain_defined
Definition: text.h:18
#define SENTENCE_NEWGEN_DOMAIN
Definition: text.h:13
A gen_chunk is used to store every object.
Definition: genC.h:58