25 #include "pips_config.h"
69 va_list some_arguments;
70 int number_of_printed_char;
72 va_start(some_arguments, a_format);
73 number_of_printed_char = vfprintf(fd, a_format, some_arguments);
74 va_end(some_arguments);
77 return number_of_printed_char;
93 #define MAX_END_COLUMN_F77 (72)
94 #define MAX_END_COLUMN_F95 (132)
100 #define MAX_END_COLUMN_DEFAULT (INT_MAX/2)
101 #define MAX_START_COLUMN (42)
102 #define C_STATEMENT_LINE_COLUMN (71)
103 #define C_STATEMENT_LINE_STEP (15)
160 if (strlen(label) > 0)
181 for (i = 0; i < em; i++)
198 int max_space_on_a_line = max_line_size - em;
200 max_space_on_a_line -= 7;
205 if (
col + (
int) strlen(w) <= max_line_size - 2) {
212 else if ((
int)strlen(w) < max_space_on_a_line) {
216 for (i =
col; i <= max_line_size; i++) {
235 && (strcmp(label,
"CDIR$") == 0 || strcmp(label,
"CDIR@")
236 == 0 || strcmp(label,
"CMIC$") == 0)) {
245 for (i = 0; i < em; i++)
264 ncar =
MIN(max_line_size -
col + 1, (
int) strlen(
line));
275 while(strlen(
line) != 0) {
276 ncar =
MIN(max_line_size - 7 + 1, (
int) strlen(
line));
288 if (label != (
char *)NULL
289 && (strcmp(label,
"CDIR$") == 0 || strcmp(label,
"CDIR@")
290 == 0 || strcmp(label,
"CMIC$") == 0)) {
321 int column_start = 0;
326 column_start = max_line_size;
334 while(column_start <=
col)
345 for (
int i =
col; i <= column_start; i++) {
388 size_t sep_sz = strlen(sep);
393 MAP(
STRING, s, size+=strlen(s)+sep_sz, ls);
477 fprintf(stderr,
"# string--%s--\n", w? w:
"<null>");
489 fprintf(stderr,
"# formatted\n%s\n# end formatted\n", s);
494 fprintf(stderr,
"# unformatted\n# label %s, %td, %td\n",
498 fprintf(stderr,
"# end unformatted\n");
503 fprintf(stderr,
"# sentence\n");
516 fprintf(stderr,
"# end sentence\n");
523 fprintf(stderr,
"# end text\n");
#define MIN(x, y)
minimum and maximum if they are defined somewhere else, they are very likely to be defined the same w...
char * strcat_word_and_migrate_attachments(char *target, const char *source)
Concatenate source to target and update the source attachments to point to the new location:
void deal_with_attachments_in_this_string(string a_string, int position_in_the_output)
Try to find some attachments in the given string.
void deal_with_attachments_in_this_string_length(string a_string, int position_in_the_output, int a_length)
Try to find some attachments in the a_length first characters of the given string.
void deal_with_attachments_at_this_character(char *a_character, int position_in_the_output)
Try to find some attachments in the given character that are printed out.
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define ENDP(l)
Test if a list is empty.
void gen_map(gen_iter_func_t fp, const list l)
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
enum language_utype get_prettyprint_language_tag()
string get_C_label_printf_format(const char *label)
Get the prettyprint format of a C label.
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
void string_buffer_append(string_buffer, const string)
append string s (if non empty) to string buffer sb, the duplication is done if needed according to th...
string string_buffer_to_string(const string_buffer)
return malloc'ed string from string buffer sb
void string_buffer_free(string_buffer *)
free string buffer structure, also free string contents according to the dup field
string_buffer string_buffer_make(bool dup)
allocate a new string buffer
void(* gen_iter_func_t)(void *)
#define string_undefined_p(s)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static int line
FLEX_SCANNER.
internally defined structure.
The structure used to build lists in NewGen.
#define sentence_unformatted_p(x)
#define unformatted_number(x)
#define SENTENCE(x)
newgen_unformatted_domain_defined
#define unformatted_extra_margin(x)
#define sentence_unformatted(x)
#define sentence_formatted(x)
#define text_sentences(x)
#define unformatted_words(x)
#define unformatted_label(x)
@ is_sentence_unformatted
#define sentence_formatted_p(x)
void print_words(FILE *fd, list lw)
void dump_sentence(sentence s)
string text_to_string_nl(text t)
string words_to_string(list ls)
Convert a word list into a string and translate the position of eventual attachment accordingly:
void print_sentence(FILE *fd, sentence s)
cproto-generated files
static char putc_sentence(char c, FILE *fd)
Output functions that tracks the number of output characters:
#define MAX_END_COLUMN_F77
print_sentence:
string sentence_to_string(sentence sen)
SG: moved here from icfdg BUG (FC): words_to_string is malloced, but sentence_formatted is not:-(.
static void debug_unformatted(unformatted u)
static void print_sentence_init()
Before using print_sentence:
void print_text(FILE *fd, text t)
#define MAX_END_COLUMN_F95
string text_to_string_gen(text t, bool with_newline)
static void debug_formatted(string s)
string text_to_string(text t)
SG: moved here from ricedg.
#define C_STATEMENT_LINE_STEP
static int fprintf_sentence(FILE *fd, char *a_format,...)
static void debug_word(string w)
static int position_in_the_output
FI: just to make sure that text.h is built; pips-makemake -l does not take into account a library who...
#define C_STATEMENT_LINE_COLUMN
void debug_sentence(sentence s)
void dump_text(text t)
FI: print_text() should be fprint_text() and dump_text(), print_text()
string words_join(list ls, const char *sep)
#define MAX_END_COLUMN_DEFAULT
Define a huge line size value because the previous one (999) was too small for PIPS generated declara...