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

Go to the source code of this file.

Functions

sentence copy_sentence (sentence p)
 SENTENCE. More...
 
void free_sentence (sentence p)
 
sentence check_sentence (sentence p)
 
bool sentence_consistent_p (sentence p)
 
bool sentence_defined_p (sentence p)
 
list gen_sentence_cons (sentence p, list l)
 
void sentence_assign_contents (sentence r, sentence v)
 
void sentence_non_recursive_free (sentence p)
 
void write_sentence (FILE *f, sentence p)
 
sentence read_sentence (FILE *f)
 
string sentence_tag_as_string (enum sentence_utype tag)
 
sentence make_sentence (enum sentence_utype tag, void *val)
 
sentence make_sentence_formatted (string _field_)
 
sentence make_sentence_unformatted (unformatted _field_)
 
text copy_text (text p)
 TEXT. More...
 
void free_text (text p)
 
text check_text (text p)
 
bool text_consistent_p (text p)
 
bool text_defined_p (text p)
 
list gen_text_cons (text p, list l)
 
void text_assign_contents (text r, text v)
 
void text_non_recursive_free (text p)
 
void write_text (FILE *f, text p)
 
text read_text (FILE *f)
 
text make_text (list a)
 
unformatted copy_unformatted (unformatted p)
 UNFORMATTED. More...
 
void free_unformatted (unformatted p)
 
unformatted check_unformatted (unformatted p)
 
bool unformatted_consistent_p (unformatted p)
 
bool unformatted_defined_p (unformatted p)
 
list gen_unformatted_cons (unformatted p, list l)
 
void unformatted_assign_contents (unformatted r, unformatted v)
 
void unformatted_non_recursive_free (unformatted p)
 
void write_unformatted (FILE *f, unformatted p)
 
unformatted read_unformatted (FILE *f)
 
unformatted make_unformatted (string a1, intptr_t a2, intptr_t a3, list a4)
 

Function Documentation

◆ check_sentence()

sentence check_sentence ( sentence  p)

Definition at line 22 of file text.c.

22  {
24 }
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 sentence_domain
Definition: text.h:10
A gen_chunk is used to store every object.
Definition: genC.h:58

References gen_check(), and sentence_domain.

Referenced by sentence_assign_contents(), and sentence_consistent_p().

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

◆ check_text()

text check_text ( text  p)

Definition at line 77 of file text.c.

77  {
78  return (text) gen_check((gen_chunk*) p, text_domain);
79 }
#define text_domain
newgen_sentence_domain_defined
Definition: text.h:18

References gen_check(), and text_domain.

Referenced by text_assign_contents(), and text_consistent_p().

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

◆ check_unformatted()

unformatted check_unformatted ( unformatted  p)

Definition at line 119 of file text.c.

119  {
121 }
#define unformatted_domain
newgen_text_domain_defined
Definition: text.h:26

References gen_check(), and unformatted_domain.

Referenced by unformatted_assign_contents(), and unformatted_consistent_p().

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

◆ copy_sentence()

sentence copy_sentence ( sentence  p)

SENTENCE.

Definition at line 16 of file text.c.

16  {
17  return (sentence) gen_copy_tree((gen_chunk*) p);
18 }
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_text()

text copy_text ( text  p)

TEXT.

Definition at line 71 of file text.c.

71  {
72  return (text) gen_copy_tree((gen_chunk*) p);
73 }

References gen_copy_tree().

Referenced by test_rwt().

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

◆ copy_unformatted()

unformatted copy_unformatted ( unformatted  p)

UNFORMATTED.

Definition at line 113 of file text.c.

113  {
114  return (unformatted) gen_copy_tree((gen_chunk*) p);
115 }

References gen_copy_tree().

+ Here is the call graph for this function:

◆ free_sentence()

void free_sentence ( sentence  p)

Definition at line 19 of file text.c.

19  {
20  gen_free((gen_chunk*) p);
21 }
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_text()

◆ free_unformatted()

void free_unformatted ( unformatted  p)

Definition at line 116 of file text.c.

116  {
117  gen_free((gen_chunk*) p);
118 }

References gen_free().

+ Here is the call graph for this function:

◆ gen_sentence_cons()

list gen_sentence_cons ( sentence  p,
list  l 
)

Definition at line 32 of file text.c.

32  {
34 }
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 SENTENCE_NEWGEN_DOMAIN
Definition: text.h:13

References gen_typed_cons(), and SENTENCE_NEWGEN_DOMAIN.

+ Here is the call graph for this function:

◆ gen_text_cons()

list gen_text_cons ( text  p,
list  l 
)

Definition at line 87 of file text.c.

87  {
88  return gen_typed_cons(TEXT_NEWGEN_DOMAIN, p, l);
89 }
#define TEXT_NEWGEN_DOMAIN
Definition: text.h:21

References gen_typed_cons(), and TEXT_NEWGEN_DOMAIN.

+ Here is the call graph for this function:

◆ gen_unformatted_cons()

list gen_unformatted_cons ( unformatted  p,
list  l 
)

Definition at line 129 of file text.c.

129  {
131 }
#define UNFORMATTED_NEWGEN_DOMAIN
Definition: text.h:29

References gen_typed_cons(), and UNFORMATTED_NEWGEN_DOMAIN.

+ Here is the call graph for this function:

◆ make_sentence()

sentence make_sentence ( enum sentence_utype  tag,
void *  val 
)

Definition at line 59 of file text.c.

59  {
60  return (sentence) gen_alloc(3*sizeof(gen_chunk), GEN_CHECK_ALLOC, sentence_domain, tag, val);
61 }
#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
int tag
TAG.
Definition: newgen_types.h:92

References gen_alloc(), GEN_CHECK_ALLOC, and sentence_domain.

Referenced by add_one_unformated_printf_to_text(), add_to_current_line(), aliases_text(), append_marged_text(), C_any_comment_to_text(), c_text_related_entities(), close_current_line(), compilation_unit_text(), create_HRE_module(), ensure_comment_consistency(), generate_alternate_return_targets(), get_declaration_comments(), get_header_comments(), include(), init_text_statement(), make_sentence_formatted(), make_sentence_unformatted(), sentence_area(), sentence_basic_declaration(), sentence_data(), sentence_data_statement(), sentence_external(), sentence_f95use_declaration(), sentence_goto_label(), sentence_head(), sentence_symbolic(), sentence_tail(), sentence_variable(), store_sc_text_line(), stub_head(), stub_text(), stub_var_decl(), text_array_comp_regions(), text_block(), text_block_elseif(), text_block_ifthen(), text_complexity(), text_continuation_conditions(), text_entity_declaration(), text_initializations(), text_instruction(), text_io_block_if(), text_logical_if(), text_loop(), text_loop_cmf(), text_loop_craft(), text_loop_default(), text_pointer_value(), text_pointer_values(), text_points_to_relation(), text_points_to_relations(), text_region_no_action(), text_summary_complexity(), text_trail(), text_transformer(), text_unstructured(), and text_whileloop().

+ Here is the call graph for this function:

◆ make_sentence_formatted()

sentence make_sentence_formatted ( string  _field_)

Definition at line 62 of file text.c.

62  {
63  return make_sentence(is_sentence_formatted, (void*)(intptr_t) _field_);
64 }
sentence make_sentence(enum sentence_utype tag, void *val)
Definition: text.c:59
#define intptr_t
Definition: stdint.in.h:294
@ is_sentence_formatted
Definition: text.h:57

References intptr_t, is_sentence_formatted, and make_sentence().

Referenced by make_pred_commentary_sentence().

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

◆ make_sentence_unformatted()

sentence make_sentence_unformatted ( unformatted  _field_)

Definition at line 65 of file text.c.

65  {
66  return make_sentence(is_sentence_unformatted, (void*)(intptr_t) _field_);
67 }
@ is_sentence_unformatted
Definition: text.h:58

References intptr_t, is_sentence_unformatted, and make_sentence().

+ Here is the call graph for this function:

◆ make_text()

text make_text ( list  a)

Definition at line 107 of file text.c.

107  {
108  return (text) gen_alloc(2*sizeof(gen_chunk), GEN_CHECK_ALLOC, text_domain, a);
109 }

References gen_alloc(), GEN_CHECK_ALLOC, and text_domain.

Referenced by __attribute__(), add_new_compilation_unit(), aliases_text(), anyloop_rwt(), C_any_comment_to_text(), C_standard_comment_to_text(), c_text_entities(), c_text_related_entities(), callgraph_module_name(), compilation_unit_text(), empty_text(), ensure_comment_consistency(), generate_alternate_return_targets(), generic_print_code_pv(), get_any_comp_regions_text(), get_continuation_condition_text(), get_semantic_text(), include(), init_text_statement(), instruction_rwt(), print_code_or_source(), print_code_or_source_comp(), print_code_points_to(), print_code_static_control(), print_loops(), print_module_icfg(), print_parallelized_code_common(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), statement_flt(), store_sc_text_line(), string_predicate_to_commentary(), stub_text(), test_rwt(), text_all_comp_regions(), text_array_comp_regions(), text_block(), text_block_else(), text_block_elseif(), text_block_if(), text_block_ifthen(), text_comp_region(), text_comp_regions(), text_complexity(), text_continuation(), text_continuation_conditions(), text_directive(), text_entity_declaration(), text_equivalence_class(), text_equivalences(), text_initializations(), text_instruction(), text_io_block_if(), text_logical_if(), text_loop(), text_loop_cmf(), text_loop_craft(), text_loop_default(), text_of_parameters(), text_pointer_value(), text_pointer_values(), text_points_to_relation(), text_points_to_relations(), text_reductions(), text_region_no_action(), text_summary_complexity(), text_trail(), text_transformer(), text_unstructured(), and text_whileloop().

+ Here is the call graph for this function:

◆ make_unformatted()

◆ read_sentence()

sentence read_sentence ( FILE *  f)

Definition at line 49 of file text.c.

49  {
50  return (sentence) gen_read(f);
51 }
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_text()

text read_text ( FILE *  f)

Definition at line 104 of file text.c.

104  {
105  return (text) gen_read(f);
106 }

References f(), and gen_read().

+ Here is the call graph for this function:

◆ read_unformatted()

unformatted read_unformatted ( FILE *  f)

Definition at line 146 of file text.c.

146  {
147  return (unformatted) gen_read(f);
148 }

References f(), and gen_read().

+ Here is the call graph for this function:

◆ sentence_assign_contents()

void sentence_assign_contents ( sentence  r,
sentence  v 
)

Definition at line 35 of file text.c.

35  {
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 }
bool sentence_defined_p(sentence p)
Definition: text.c:29
sentence check_sentence(sentence p)
Definition: text.c:22
#define message_assert(msg, ex)
Definition: newgen_assert.h:47

References check_sentence(), message_assert, and sentence_defined_p().

+ Here is the call graph for this function:

◆ sentence_consistent_p()

bool sentence_consistent_p ( sentence  p)

Definition at line 25 of file text.c.

25  {
26  check_sentence(p);
27  return gen_consistent_p((gen_chunk*) p);
28 }
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
Definition: genClib.c:2398

References check_sentence(), and gen_consistent_p().

+ Here is the call graph for this function:

◆ sentence_defined_p()

bool sentence_defined_p ( sentence  p)

Definition at line 29 of file text.c.

29  {
30  return gen_defined_p((gen_chunk*) p);
31 }
int gen_defined_p(gen_chunk *obj)
Definition: genClib.c:2438

References gen_defined_p().

Referenced by sentence_assign_contents().

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

◆ sentence_non_recursive_free()

void sentence_non_recursive_free ( sentence  p)

Definition at line 42 of file text.c.

42  {
43  // should clear up contents...
44  free(p);
45 }
void free(void *)

References free().

+ Here is the call graph for this function:

◆ sentence_tag_as_string()

string sentence_tag_as_string ( enum sentence_utype  tag)

Definition at line 52 of file text.c.

52  {
53  switch (tag) {
54  case is_sentence_formatted: return "formatted";
55  case is_sentence_unformatted: return "unformatted";
56  default: return string_undefined;
57  }
58 }
#define string_undefined
Definition: newgen_types.h:40

References is_sentence_formatted, is_sentence_unformatted, and string_undefined.

◆ text_assign_contents()

void text_assign_contents ( text  r,
text  v 
)

Definition at line 90 of file text.c.

90  {
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 }
text check_text(text p)
Definition: text.c:77
bool text_defined_p(text p)
Definition: text.c:84

References check_text(), message_assert, and text_defined_p().

+ Here is the call graph for this function:

◆ text_consistent_p()

bool text_consistent_p ( text  p)

Definition at line 80 of file text.c.

80  {
81  check_text(p);
82  return gen_consistent_p((gen_chunk*) p);
83 }

References check_text(), and gen_consistent_p().

Referenced by add_words_to_text(), and get_semantic_text().

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

◆ text_defined_p()

bool text_defined_p ( text  p)

Definition at line 84 of file text.c.

84  {
85  return gen_defined_p((gen_chunk*) p);
86 }

References gen_defined_p().

Referenced by text_assign_contents().

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

◆ text_non_recursive_free()

void text_non_recursive_free ( text  p)

Definition at line 97 of file text.c.

97  {
98  // should clear up contents...
99  free(p);
100 }

References free().

+ Here is the call graph for this function:

◆ unformatted_assign_contents()

void unformatted_assign_contents ( unformatted  r,
unformatted  v 
)

Definition at line 132 of file text.c.

132  {
135  message_assert("defined references to domain unformatted",
137  memcpy(r, v, sizeof(struct _newgen_struct_unformatted_));
138 }
bool unformatted_defined_p(unformatted p)
Definition: text.c:126
unformatted check_unformatted(unformatted p)
Definition: text.c:119

References check_unformatted(), message_assert, and unformatted_defined_p().

+ Here is the call graph for this function:

◆ unformatted_consistent_p()

bool unformatted_consistent_p ( unformatted  p)

Definition at line 122 of file text.c.

122  {
124  return gen_consistent_p((gen_chunk*) p);
125 }

References check_unformatted(), and gen_consistent_p().

+ Here is the call graph for this function:

◆ unformatted_defined_p()

bool unformatted_defined_p ( unformatted  p)

Definition at line 126 of file text.c.

126  {
127  return gen_defined_p((gen_chunk*) p);
128 }

References gen_defined_p().

Referenced by unformatted_assign_contents().

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

◆ unformatted_non_recursive_free()

void unformatted_non_recursive_free ( unformatted  p)

Definition at line 139 of file text.c.

139  {
140  // should clear up contents...
141  free(p);
142 }

References free().

+ Here is the call graph for this function:

◆ write_sentence()

void write_sentence ( FILE *  f,
sentence  p 
)

Definition at line 46 of file text.c.

46  {
47  gen_write(f, (gen_chunk*) p);
48 }
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_text()

void write_text ( FILE *  f,
text  p 
)

Definition at line 101 of file text.c.

101  {
102  gen_write(f, (gen_chunk*) p);
103 }

References f(), and gen_write().

+ Here is the call graph for this function:

◆ write_unformatted()

void write_unformatted ( FILE *  f,
unformatted  p 
)

Definition at line 143 of file text.c.

143  {
144  gen_write(f, (gen_chunk*) p);
145 }

References f(), and gen_write().

+ Here is the call graph for this function: