PIPS
text-util.h
Go to the documentation of this file.
1 /* Warning! Do not modify this file that is automatically generated! */
2 /* Modify src/Libs/text-util/text-util-local.h instead, to add your own modifications. */
3 
4 /* header file built by cproto */
5 
6 #ifndef text_util_header_included
7 #define text_util_header_included
8 /* text_util-local.h */
9 /*
10 
11  $Id: text-util-local.h 23065 2016-03-02 09:05:50Z coelho $
12 
13  Copyright 1989-2016 MINES ParisTech
14 
15  This file is part of PIPS.
16 
17  PIPS is free software: you can redistribute it and/or modify it
18  under the terms of the GNU General Public License as published by
19  the Free Software Foundation, either version 3 of the License, or
20  any later version.
21 
22  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
23  WARRANTY; without even the implied warranty of MERCHANTABILITY or
24  FITNESS FOR A PARTICULAR PURPOSE.
25 
26  See the GNU General Public License for more details.
27 
28  You should have received a copy of the GNU General Public License
29  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
30 
31 */
32 
33 #include "text.h"
34 #include "linear.h" // needed for ri.h
35 #include "ri.h" // FC: bad, for "language", to avoid a cycle on ri-util
36 
37 #define FORESYS_CONTINUATION_PREFIX "C$&" " "
38 
39 #define MAKE_SWORD(s) strdup(s)
40 #define MAKE_IWORD(i) int2a(i)
41 #define MAKE_FWORD(f) f2a(f)
42 
43 #define CHAIN_SWORD(l,s) gen_nconc(l, CONS(STRING, MAKE_SWORD(s), NIL))
44 #define CHAIN_IWORD(l,i) gen_nconc(l, CONS(STRING, MAKE_IWORD(i), NIL))
45 #define CHAIN_FWORD(l,f) gen_nconc(l, CONS(STRING, MAKE_FWORD(f), NIL))
46 
47 #define MAKE_ONE_WORD_SENTENCE(m, s) \
48  make_sentence(is_sentence_unformatted, \
49  make_unformatted((char *) NULL, 0, m, CHAIN_SWORD(NIL, s)))
50 
51 #define ADD_SENTENCE_TO_TEXT(t,p) \
52  do { \
53  text _t_ = (t); \
54  text_sentences(_t_) = \
55  gen_nconc(text_sentences(_t_), CONS(SENTENCE, (p), NIL)); \
56  } while(0)
57 
58 #define MERGE_TEXTS(r,t) \
59  do { \
60  text _r_ = (r); text _t_ = (t); \
61  text_sentences(_r_) = \
62  gen_nconc(text_sentences(_r_), text_sentences(_t_)); \
63  text_sentences(_t_) = NIL; \
64  free_text(_t_); \
65  } while(0)
66 
67 /* maximum length of a line when prettyprinting...
68  * from 0 to 69, i.e. 70 chars, plus "\n\0"
69  */
70 #define MAX_LINE_LENGTH 72
71 /* cproto-generated files */
72 /* text_print.c */
73 extern void print_sentence(FILE */*fd*/, sentence /*s*/);
74 extern void print_text(FILE */*fd*/, text /*t*/);
75 extern void dump_sentence(sentence /*s*/);
76 extern void dump_text(text /*t*/);
77 extern string words_join(list /*ls*/, const char */*sep*/);
78 extern string words_to_string(list /*ls*/);
79 extern string sentence_to_string(sentence /*sen*/);
80 extern string text_to_string_gen(text /*t*/, bool /*with_newline*/);
81 extern string text_to_string(text /*t*/);
82 extern string text_to_string_nl(text /*t*/);
83 extern void print_words(FILE */*fd*/, list /*lw*/);
84 extern void dump_words(list /*lw*/);
85 extern void debug_words(list /*l*/);
86 extern void debug_sentence(sentence /*s*/);
87 extern void debug_text(text /*t*/);
88 /* util.c */
89 extern char *int2a(int /*i*/);
90 extern char *f2a(float /*f*/);
91 extern void add_one_unformated_printf_to_text(text /*r*/, string /*a_format*/, ...);
92 extern string first_word_of_sentence(sentence /*s*/);
93 extern string last_word_of_sentence(sentence /*s*/);
94 extern void add_to_current_line(string /*buffer*/, const char */*append*/, string /*continuation*/, text /*txt*/);
95 extern void close_current_line(string /*buffer*/, text /*txt*/, string /*continuation*/);
96 extern void add_words_to_text(text /*t*/, list /*wl*/);
97 /* language.c */
100 extern bool prettyprint_language_is_fortran_p(void);
101 extern bool prettyprint_language_is_fortran95_p(void);
102 extern bool prettyprint_language_is_c_p(void);
103 extern void set_prettyprint_language_from_property(enum language_utype /*native*/);
104 extern void set_prettyprint_language(language /*lang*/);
105 extern void set_prettyprint_language_tag(enum language_utype /*lang*/);
106 extern string get_C_label_printf_format(const char */*label*/);
107 /* attachment_pretty_print.c */
109 extern void begin_attachment_prettyprint(void);
110 extern void end_attachment_prettyprint(void);
111 extern void attach_loop_to_sentence_up_to_end_of_text(sentence /*s*/, text /*t*/, loop /*l*/);
112 extern sentence attach_head_to_sentence(sentence /*s*/, entity /*module*/);
113 extern void attach_reference_to_word_list(string /*begin_word*/, string /*end_word*/, reference /*r*/);
114 extern void attach_regular_call_to_word(string /*word*/, call /*c*/);
115 extern void attach_declaration_to_words(list /*l*/, entity /*e*/);
116 extern void attach_declaration_type_to_words(list /*l*/, string /*declaration_type*/);
117 extern void attach_declaration_size_type_to_words(list /*l*/, string /*declaration_type*/, int /*size*/);
118 extern void attach_statement_information_to_text(text /*t*/, statement /*s*/);
119 extern void attach_decoration_to_text(text /*t*/);
125 extern void deal_with_attachments_at_this_character(char */*a_character*/, int /*position_in_the_output*/);
126 extern void deal_with_attachments_in_this_string(string /*a_string*/, int /*position_in_the_output*/);
127 extern void deal_with_attachments_in_this_string_length(string /*a_string*/, int /*position_in_the_output*/, int /*a_length*/);
128 extern void relocate_attachments(char */*source*/, char */*new_position*/);
129 extern char *strcat_word_and_migrate_attachments(char */*target*/, const char */*source*/);
130 extern char *strdup_and_migrate_attachments(char */*a_string*/);
131 extern void write_an_attachment_file(string /*file_name*/);
132 #endif /* text_util_header_included */
language_utype
Definition: ri.h:1565
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
sentence attach_head_to_sentence(sentence, entity)
Attach the PROGRAM/FUNCTION head:
void relocate_attachments(char *, char *)
Many pretty-printers format their own pseudo-comment by their own and move in memory words that have ...
char * strdup_and_migrate_attachments(char *)
Duplicate a string and update the attachments to point to the new returned string:
bool prettyprint_language_is_fortran_p(void)
Definition: language.c:75
char * f2a(float)
Definition: util.c:51
void close_current_line(string, text, string)
Definition: util.c:235
void attach_proper_effects_decoration_to_text(text)
Attach a proper effects decoration:
char * int2a(int)
util.c
Definition: util.c:42
void deal_with_attachments_in_this_string_length(string, int, int)
Try to find some attachments in the a_length first characters of the given string.
void set_prettyprint_language_from_property(enum language_utype)
set the prettyprint language according to the property PRETTYPRINT_LANGUAGE @description If the prope...
Definition: language.c:103
language get_prettyprint_language(void)
language.c
Definition: language.c:57
void debug_sentence(sentence)
Definition: text_print.c:501
void debug_text(text)
Definition: text_print.c:519
string get_C_label_printf_format(const char *)
Get the prettyprint format of a C label.
Definition: language.c:155
void add_one_unformated_printf_to_text(text, string,...)
Definition: util.c:59
void attach_declaration_size_type_to_words(list, string, int)
Attach a declaration type with its size to all the words of the given list.
string words_to_string(list)
Convert a word list into a string and translate the position of eventual attachment accordingly:
Definition: text_print.c:412
void dump_text(text)
FI: print_text() should be fprint_text() and dump_text(), print_text()
Definition: print.c:205
void attach_declaration_type_to_words(list, string)
Attach a declaration type to all the words of the given list.
string words_join(list, const char *)
Definition: text_print.c:385
void deal_with_attachments_in_this_string(string, int)
Try to find some attachments in the given string.
void write_an_attachment_file(string)
Add the attachment in Emacs mode by creating a twin file that is decorated with Emacs properties:
void attach_statement_information_to_text(text, statement)
Attach some statement information to text:
void begin_attachment_prettyprint(void)
The translation functions between unique names and objects:
bool prettyprint_language_is_fortran95_p(void)
Definition: language.c:83
void dump_sentence(sentence)
Definition: print.c:190
void add_to_current_line(string, const char *, string, text)
Definition: util.c:140
void end_attachment_prettyprint(void)
Clean the things related with the attachment of properties:
char * strcat_word_and_migrate_attachments(char *, const char *)
Concatenate source to target and update the source attachments to point to the new location:
string text_to_string(text)
SG: moved here from ricedg.
Definition: print.c:239
string first_word_of_sentence(sentence)
Return the first word of a sentence:
Definition: util.c:76
void deal_with_attachments_at_this_character(char *, int)
Try to find some attachments in the given character that are printed out.
void attach_reference_to_word_list(string, string, reference)
Attach a module usage (CALL or function call):
void attach_total_preconditions_decoration_to_text(text)
string text_to_string_gen(text, bool)
Definition: text_print.c:428
string sentence_to_string(sentence)
SG: moved here from icfdg.
Definition: print.c:230
void attach_loop_to_sentence_up_to_end_of_text(sentence, text, loop)
The user interface:
void print_text(FILE *, text)
Definition: print.c:195
void set_prettyprint_language(language)
set the prettyprint language from a newgen language object
Definition: language.c:130
void add_words_to_text(text, list)
Add the word list wl to the end of the last sentence of text t.
Definition: util.c:273
void attach_regular_call_to_word(string, call)
Attach a reference:
void print_words(FILE *, list)
Definition: text_print.c:460
void set_prettyprint_language_tag(enum language_utype)
set the prettyprint language from a language_utype argument
Definition: language.c:143
list attachments_before_sorting
attachment_pretty_print.c
string last_word_of_sentence(sentence)
Return the last word of a sentence:
Definition: util.c:101
void debug_words(list)
Definition: text_print.c:481
void attach_transformers_decoration_to_text(text)
Attach a transformers decoration:
void attach_preconditions_decoration_to_text(text)
Attach a preconditions decoration:
bool prettyprint_language_is_c_p(void)
Definition: language.c:91
void print_sentence(FILE *, sentence)
cproto-generated files
Definition: print.c:53
enum language_utype get_prettyprint_language_tag(void)
Definition: language.c:67
void dump_words(list)
Definition: print.c:251
void attach_cumulated_effects_decoration_to_text(text)
Attach a cumulated effects decoration:
void attach_decoration_to_text(text)
Attach a decoration:
void attach_declaration_to_words(list, entity)
Attach a declaration to all the words of the given list:
string text_to_string_nl(text)
Definition: text_print.c:455