PIPS
|
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "text.h"
#include "misc.h"
#include "properties.h"
#include "text-util.h"
Go to the source code of this file.
Macros | |
#define | MAX_END_COLUMN_F77 (72) |
print_sentence: More... | |
#define | MAX_END_COLUMN_F95 (132) |
#define | MAX_END_COLUMN_DEFAULT (INT_MAX/2) |
Define a huge line size value because the previous one (999) was too small for PIPS generated declarations after the outliner. More... | |
#define | MAX_START_COLUMN (42) |
#define | C_STATEMENT_LINE_COLUMN (71) |
#define | C_STATEMENT_LINE_STEP (15) |
Functions | |
static void | print_sentence_init () |
Before using print_sentence: More... | |
static char | putc_sentence (char c, FILE *fd) |
Output functions that tracks the number of output characters: More... | |
static int | fprintf_sentence (FILE *fd, char *a_format,...) |
void | print_sentence (FILE *fd, sentence s) |
cproto-generated files More... | |
void | print_text (FILE *fd, text t) |
void | dump_sentence (sentence s) |
void | dump_text (text t) |
FI: print_text() should be fprint_text() and dump_text(), print_text() More... | |
string | words_join (list ls, const char *sep) |
string | words_to_string (list ls) |
Convert a word list into a string and translate the position of eventual attachment accordingly: More... | |
string | sentence_to_string (sentence sen) |
SG: moved here from icfdg BUG (FC): words_to_string is malloced, but sentence_formatted is not:-(. More... | |
string | text_to_string_gen (text t, bool with_newline) |
string | text_to_string (text t) |
SG: moved here from ricedg. More... | |
string | text_to_string_nl (text t) |
void | print_words (FILE *fd, list lw) |
void | dump_words (list lw) |
static void | debug_word (string w) |
void | debug_words (list l) |
static void | debug_formatted (string s) |
static void | debug_unformatted (unformatted u) |
void | debug_sentence (sentence s) |
void | debug_text (text t) |
Variables | |
static int | position_in_the_output = 0 |
FI: just to make sure that text.h is built; pips-makemake -l does not take into account a library whose modules do not use the library header. More... | |
#define C_STATEMENT_LINE_COLUMN (71) |
Definition at line 102 of file text_print.c.
#define C_STATEMENT_LINE_STEP (15) |
Definition at line 103 of file text_print.c.
#define MAX_END_COLUMN_DEFAULT (INT_MAX/2) |
Define a huge line size value because the previous one (999) was too small for PIPS generated declarations after the outliner.
Do not use INT_MAX because there are some assertions such as (... < MAX_END_COLUMN_DEFAULT + 1). So (INT_MAX/2) is a rough approximation. :-)
Definition at line 100 of file text_print.c.
#define MAX_END_COLUMN_F77 (72) |
print_sentence:
FI: I had to change this module to handle string longer than the space available on one line; I tried to preserve as much as I could of the previous behavior to avoid pseudo-hyphenation at the wrong place and to avoid extensicve problems with validate; the resulting code is lousy, of course; FI, 15 March 1993
RK: the print_sentence could print lower case letter according to a property... 17/12/1993.
Definition at line 93 of file text_print.c.
#define MAX_END_COLUMN_F95 (132) |
Definition at line 94 of file text_print.c.
#define MAX_START_COLUMN (42) |
Definition at line 101 of file text_print.c.
|
static |
Definition at line 487 of file text_print.c.
References fprintf().
Referenced by debug_sentence().
void debug_sentence | ( | sentence | s | ) |
Definition at line 501 of file text_print.c.
References debug_formatted(), debug_unformatted(), fprintf(), is_sentence_formatted, is_sentence_unformatted, pips_internal_error, sentence_formatted, sentence_tag, and sentence_unformatted.
Referenced by debug_text().
void debug_text | ( | text | t | ) |
Definition at line 519 of file text_print.c.
References debug_sentence(), fprintf(), gen_map(), and text_sentences.
|
static |
Definition at line 492 of file text_print.c.
References debug_words(), fprintf(), unformatted_extra_margin, unformatted_label, unformatted_number, and unformatted_words.
Referenced by debug_sentence().
|
static |
Definition at line 475 of file text_print.c.
References fprintf().
Referenced by debug_words().
void debug_words | ( | list | l | ) |
l | of string |
Definition at line 481 of file text_print.c.
References debug_word(), and gen_map().
Referenced by debug_unformatted().
void dump_sentence | ( | sentence | s | ) |
Definition at line 373 of file text_print.c.
References print_sentence().
void dump_text | ( | text | t | ) |
FI: print_text() should be fprint_text() and dump_text(), print_text()
Definition at line 380 of file text_print.c.
References print_text().
void dump_words | ( | list | lw | ) |
lw | w |
Definition at line 467 of file text_print.c.
References print_words().
|
static |
Definition at line 65 of file text_print.c.
References position_in_the_output.
Referenced by print_sentence().
void print_sentence | ( | FILE * | fd, |
sentence | s | ||
) |
cproto-generated files
cproto-generated files
print_sentence:
FI: I had to change this module to handle string longer than the space available on one line; I tried to preserve as much as I could of the previous behavior to avoid pseudo-hyphenation at the wrong place and to avoid extensicve problems with validate; the resulting code is lousy, of course; FI, 15 March 1993
RK: the print_sentence could print lower case letter according to a property... 17/12/1993.
col: the next column number, starting from 1. it means tha columns 1 to col-1 have been output. I guess. FC.
first 6 columns (0-5)
05/08/2003 - Nga Nguyen - Add code for C prettyprinter
Keep track of the attachment against the padding:
C prettyprinter: a label cannot begin with a number so "l" is added for this case
FI: do not indent too much (9 June 1995)
Initial tabulation, if needed: do not put useless SPACEs in output file. Well, it's difficult to know if it is useful or not. The test below leads to misplaced opening braces.
& gen_length(lw)>1 && !same_string_p(STRING(CAR(lw)), "\n")
Fortran77 start on 7th column
if the string fits on the current line: no problem
if the string fits on one line: use the 88 algorithm to break as few syntactic constructs as possible
Complete current line with the statement line number, if it is significative:
prepare to cut the line
start a new line with its prefix
Special label for Cray directives
if the string has to be broken in at least two lines: new algorithmic part to avoid line overflow (FI, March 1993)
Complete the current line, but not after :-)
start a new line with its prefix but no indentation since string constants may be broken onto two lines
prepare to cut the line
Special label for Cray directives
statement line number starts at different column depending on the used language : C or fortran
fortran case right the line number on the right where characters are ignored by a f77 parser
C and F95 case, try to align the line number on the right using commentaries. The alignment is done modulo C_STATEMENT_LINE_STEP
Output the statement line number on the right end of the line:
fd | d |
Definition at line 105 of file text_print.c.
References C_STATEMENT_LINE_COLUMN, C_STATEMENT_LINE_STEP, deal_with_attachments_at_this_character(), deal_with_attachments_in_this_string(), deal_with_attachments_in_this_string_length(), ENDP, FOREACH, fprintf_sentence(), get_bool_property(), get_C_label_printf_format(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, line, MAX_END_COLUMN_DEFAULT, MAX_END_COLUMN_F77, MAX_END_COLUMN_F95, MAX_START_COLUMN, MIN, pips_assert, pips_debug, pips_internal_error, position_in_the_output, putc_sentence(), sentence_formatted, sentence_formatted_p, sentence_unformatted, string_undefined_p, unformatted_extra_margin, unformatted_label, unformatted_number, and unformatted_words.
Referenced by dump_sentence(), and print_text().
|
static |
Before using print_sentence:
Definition at line 49 of file text_print.c.
References position_in_the_output.
Referenced by print_text().
void print_text | ( | FILE * | fd, |
text | t | ||
) |
fd | d |
Definition at line 367 of file text_print.c.
References MAP, print_sentence(), print_sentence_init(), SENTENCE, and text_sentences.
Referenced by dump_text().
void print_words | ( | FILE * | fd, |
list | lw | ||
) |
fd | d |
lw | w |
Definition at line 460 of file text_print.c.
References free(), and words_to_string().
Referenced by dump_words().
|
static |
Output functions that tracks the number of output characters:
Definition at line 57 of file text_print.c.
References position_in_the_output.
Referenced by print_sentence().
SG: moved here from icfdg BUG (FC): words_to_string is malloced, but sentence_formatted is not:-(.
SG: moved here from icfdg.
sen | en |
Definition at line 420 of file text_print.c.
References sentence_formatted, sentence_formatted_p, sentence_unformatted, unformatted_words, and words_to_string().
Referenced by text_to_string_gen().
SG: moved here from ricedg.
Definition at line 450 of file text_print.c.
References text_to_string_gen().
with_newline | ith_newline |
Definition at line 428 of file text_print.c.
References FOREACH, free(), sentence_to_string(), sentence_unformatted_p, string_buffer_append(), string_buffer_free(), string_buffer_make(), string_buffer_to_string(), and text_sentences.
Referenced by text_to_string(), and text_to_string_nl().
Definition at line 455 of file text_print.c.
References text_to_string_gen().
Referenced by ensure_comment_consistency().
1 for null termination.
computes the buffer length.
appends to the buffer...
ls | s |
sep | ep |
Definition at line 385 of file text_print.c.
References buffer, FOREACH, malloc(), MAP, pips_assert, strcat_word_and_migrate_attachments(), and STRING.
Referenced by words_to_string().
Convert a word list into a string and translate the position of eventual attachment accordingly:
ls | s |
Definition at line 412 of file text_print.c.
References words_join().
Referenced by print_words(), and sentence_to_string().
|
static |
FI: just to make sure that text.h is built; pips-makemake -l does not take into account a library whose modules do not use the library header.
Definition at line 45 of file text_print.c.
Referenced by deal_with_attachment_boundary(), deal_with_attachments_at_this_character(), deal_with_attachments_in_this_string(), deal_with_attachments_in_this_string_length(), fprintf_sentence(), print_sentence(), print_sentence_init(), and putc_sentence().