PIPS
text-util-local.h
Go to the documentation of this file.
1 /*
2 
3  $Id: text-util-local.h 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25 #include "text.h"
26 #include "linear.h" // needed for ri.h
27 #include "ri.h" // FC: bad, for "language", to avoid a cycle on ri-util
28 
29 #define FORESYS_CONTINUATION_PREFIX "C$&" " "
30 
31 #define MAKE_SWORD(s) strdup(s)
32 #define MAKE_IWORD(i) int2a(i)
33 #define MAKE_FWORD(f) f2a(f)
34 
35 #define CHAIN_SWORD(l,s) gen_nconc(l, CONS(STRING, MAKE_SWORD(s), NIL))
36 #define CHAIN_IWORD(l,i) gen_nconc(l, CONS(STRING, MAKE_IWORD(i), NIL))
37 #define CHAIN_FWORD(l,f) gen_nconc(l, CONS(STRING, MAKE_FWORD(f), NIL))
38 
39 #define MAKE_ONE_WORD_SENTENCE(m, s) \
40  make_sentence(is_sentence_unformatted, \
41  make_unformatted((char *) NULL, 0, m, CHAIN_SWORD(NIL, s)))
42 
43 #define ADD_SENTENCE_TO_TEXT(t,p) \
44  do { \
45  text _t_ = (t); \
46  text_sentences(_t_) = \
47  gen_nconc(text_sentences(_t_), CONS(SENTENCE, (p), NIL)); \
48  } while(0)
49 
50 #define MERGE_TEXTS(r,t) \
51  do { \
52  text _r_ = (r); text _t_ = (t); \
53  text_sentences(_r_) = \
54  gen_nconc(text_sentences(_r_), text_sentences(_t_)); \
55  text_sentences(_t_) = NIL; \
56  free_text(_t_); \
57  } while(0)
58 
59 /* maximum length of a line when prettyprinting...
60  * from 0 to 69, i.e. 70 chars, plus "\n\0"
61  */
62 #define MAX_LINE_LENGTH 72