forked from FreeFem/FreeFem-sources
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rgraph.hpp
250 lines (203 loc) · 6.86 KB
/
rgraph.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
// SUMMARY :
// USAGE :
// ORG :
// AUTHOR : Frederic Hecht
// E-MAIL : [email protected]
/* ------------------- */
/* (e-mail) [email protected] */
/* (e-mail) [email protected] */
/******************************************************/
/*
This file is part of Freefem++
Freefem++ is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Freefem++ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Freefem++; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// E-MAIL : [email protected]
//
// ORIG-DATE: Dec 97
#ifndef RGRAPH_H_
#define RGRAPH_H_
// Modif F Hecht for dll on win32
// pass all the graphic function via pointeur
// now the real graphic function of a pointeur xxxx is call xxxx_
// We just need to add <<FF_GRAPH_SET_PTR>> in all graphic.cpp version
// the dcl of xxxx pointeur is done via GRAPH_PTR_DCL macro (set one time )
//
// -----
#ifdef FF_GRAPH_SET_PTR
#define EXTERNFF(t,f,arg) t f##_ arg; extern t (*f) arg
#else
#ifdef FF_GRAPH_PTR_DCL
#define EXTERNFF(t,f,arg) t (*f) arg
#else
#define EXTERNFF(t,f,arg) extern t (*f) arg
#endif
#endif
//#define EXTERN
#ifdef __cplusplus
#include "config-wrapper.h"
//extern "C" {
EXTERNFF( void ,getcadre,(float &xmin,float &xmax, float &ymin, float &ymax)) ;
EXTERNFF( void ,GetScreenSize,(int &ix,int &iy)) ; // unused
EXTERNFF( char ,Getxyc,(float &x,float &y)) ;
EXTERNFF( void ,ShowHelp,(const char * s,int k)) ; // k=1 ??//tlr: deplace ici
#endif
EXTERNFF( void ,erreur,(char *s)) ;
EXTERNFF( void ,initgraphique,()) ; // only in main
EXTERNFF( void ,closegraphique,()) ;
EXTERNFF( void ,showgraphic,()) ;
EXTERNFF( void ,rattente,(int waitm)) ;
EXTERNFF( void ,cadre,(float xmin,float xmax, float ymin, float ymax)) ;
EXTERNFF( void ,cadreortho,(float centrex, float centrey, float rayon)) ;
EXTERNFF( void ,couleur,(int c)) ;
EXTERNFF( int ,LaCouleur,()) ;
EXTERNFF( void ,pointe,(float x, float y)) ;
EXTERNFF( int ,InPtScreen,(float x, float y)) ;
EXTERNFF( int ,InRecScreen,(float x1, float y1,float x2, float y2)) ;
EXTERNFF( void ,plotstring,(const char *s)) ;
EXTERNFF( void ,rmoveto,(float x, float y)) ;
EXTERNFF( void ,rlineto,(float x, float y)) ;
EXTERNFF( void ,penthickness,(int )) ;
EXTERNFF( int ,execute,(const char* s)) ;
EXTERNFF( void ,reffecran,()) ;
EXTERNFF( void ,fillpoly,(int n, float *poly)) ;
EXTERNFF( void ,SetColorTable,(int nb)) ;
EXTERNFF( void ,SetColorTable1,(int nb,bool hsv,int nbcolors,float *colors)) ;
EXTERNFF( float ,GetHeigthFont,()) ;
// old function for freefem+
//EXTERNFF( void ,compile,(char *fname)) ;
//EXTERNFF( void ,compileString,(char *texte)) ;/*tlr: add a string stream */
EXTERNFF( void ,openPS,(const char * )) ;
EXTERNFF( void ,closePS,(void)) ;
EXTERNFF( void ,coutmode,(short i)) ;
EXTERNFF( void ,myexit,(int err)) ; // err=0 ??
EXTERNFF( void ,viderbuff,()) ;
EXTERNFF( void ,Commentaire,(const char *)) ;
EXTERNFF( void ,NoirEtBlanc,(int NB)) ;
EXTERNFF( void ,MettreDansPostScript,(int in)) ;// oui=1 ou non=0
EXTERNFF( int ,getprog,(char* fn,int , char** argvptr)) ;
EXTERNFF( void ,setgrey,(bool )) ;
EXTERNFF( int ,getgrey,( )) ;
// wrapping of function -----
#ifdef FF_GRAPH_SET_PTR
static int init_ff_graph_ptr_func()
{ // a small function to set all pointeur
getcadre=getcadre_;
GetScreenSize=GetScreenSize_;
Getxyc=Getxyc_;
ShowHelp=ShowHelp_;
erreur=erreur_;
initgraphique=initgraphique_;
closegraphique=closegraphique_;
showgraphic=showgraphic_;
rattente=rattente_;
cadre=cadre_;
cadreortho=cadreortho_;
couleur=couleur_;
LaCouleur=LaCouleur_;
pointe=pointe_;
InPtScreen=InPtScreen_;
InRecScreen=InRecScreen_;
plotstring=plotstring_;
rmoveto=rmoveto_;
rlineto=rlineto_;
penthickness=penthickness_;
execute=execute_;
reffecran=reffecran_;
fillpoly=fillpoly_;
SetColorTable=SetColorTable_;
SetColorTable1=SetColorTable1_;
GetHeigthFont=GetHeigthFont_;
//compile=compile_;
//compileString=compileString_;
openPS=openPS_;
closePS=closePS_;
coutmode=coutmode_;
myexit=myexit_;
viderbuff=viderbuff_;
Commentaire=Commentaire_;
NoirEtBlanc=NoirEtBlanc_;
MettreDansPostScript=MettreDansPostScript_;
getprog=getprog_;
setgrey=setgrey_;
getgrey=getgrey_;
return 1;
}
// to call the init function before main
static int init_ff_graph_ptr_func_call = init_ff_graph_ptr_func();
#define getcadre getcadre_
#define GetScreenSize GetScreenSize_
#define Getxyc Getxyc_
#define ShowHelp ShowHelp_
#define erreur erreur_
#define initgraphique initgraphique_
#define closegraphique closegraphique_
#define showgraphic showgraphic_
#define rattente rattente_
#define cadre cadre_
#define cadreortho cadreortho_
#define couleur couleur_
#define LaCouleur LaCouleur_
#define pointe pointe_
#define InPtScreen InPtScreen_
#define InRecScreen InRecScreen_
#define plotstring plotstring_
#define rmoveto rmoveto_
#define rlineto rlineto_
#define penthickness penthickness_
#define execute execute_
#define reffecran reffecran_
#define fillpoly fillpoly_
#define SetColorTable SetColorTable_
#define SetColorTable1 SetColorTable1_
#define GetHeigthFont GetHeigthFont_
//#define compile compile_
//#define compileString compileString_
#define openPS openPS_
#define closePS closePS_
#define coutmode coutmode_
#define myexit myexit_
#define viderbuff viderbuff_
#define Commentaire Commentaire_
#define NoirEtBlanc NoirEtBlanc_
#define MettreDansPostScript MettreDansPostScript_
#define getprog getprog_
#define setgrey setgrey_
#define getgrey getgrey_
#endif
// end wrapping ----
#ifdef __cplusplus
//}
#ifdef TERM_USED
/** Ouput on the terminal window */
class myostream {
int channel;
public:
myostream(int ch) { channel = ch; }
myostream& operator<<(char c);
myostream& operator<<(const char *s);
myostream& operator<<(const void *p);
myostream& operator<<(int n);
myostream& operator<<(unsigned int n) { return *this << (int)n; }
myostream& operator<<(long n);
myostream& operator<<(unsigned long n) { return *this << (long)n; }
myostream& operator<<(double n);
myostream& operator<<(float n) { return *this << (double)n; }
myostream& operator<<(__omanip func);
};
extern myostream termout; // could be cout, or another thing
extern myostream termerr; // could be cerr, or another thing
#define cout termout
#define cerr termerr
#endif /* TERM_USED */
#endif /* __cplusplus */
#endif /* RGRAPH_H_ */