1 | /******************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */ |
---|
4 | /* */ |
---|
5 | /* Copyright or or Copr. Laurent Debreu (Laurent.Debreu@imag.fr) */ |
---|
6 | /* Cyril Mazauric (Cyril_Mazauric@yahoo.fr) */ |
---|
7 | /* This software is governed by the CeCILL-C license under French law and */ |
---|
8 | /* abiding by the rules of distribution of free software. You can use, */ |
---|
9 | /* modify and/ or redistribute the software under the terms of the CeCILL-C */ |
---|
10 | /* license as circulated by CEA, CNRS and INRIA at the following URL */ |
---|
11 | /* "http://www.cecill.info". */ |
---|
12 | /* */ |
---|
13 | /* As a counterpart to the access to the source code and rights to copy, */ |
---|
14 | /* modify and redistribute granted by the license, users are provided only */ |
---|
15 | /* with a limited warranty and the software's author, the holder of the */ |
---|
16 | /* economic rights, and the successive licensors have only limited */ |
---|
17 | /* liability. */ |
---|
18 | /* */ |
---|
19 | /* In this respect, the user's attention is drawn to the risks associated */ |
---|
20 | /* with loading, using, modifying and/or developing or reproducing the */ |
---|
21 | /* software by the user in light of its specific status of free software, */ |
---|
22 | /* that may mean that it is complicated to manipulate, and that also */ |
---|
23 | /* therefore means that it is reserved for developers and experienced */ |
---|
24 | /* professionals having in-depth computer knowledge. Users are therefore */ |
---|
25 | /* encouraged to load and test the software's suitability as regards their */ |
---|
26 | /* requirements in conditions enabling the security of their systems and/or */ |
---|
27 | /* data to be ensured and, more generally, to use and operate it in the */ |
---|
28 | /* same conditions as regards security. */ |
---|
29 | /* */ |
---|
30 | /* The fact that you are presently reading this means that you have had */ |
---|
31 | /* knowledge of the CeCILL-C license and that you accept its terms. */ |
---|
32 | /******************************************************************************/ |
---|
33 | /* version 1.7 */ |
---|
34 | /******************************************************************************/ |
---|
35 | #define LONG_VNAME 80 // Max length for a variable name |
---|
36 | #define LONG_FNAME 1000 // Max length for a file name |
---|
37 | #define LONG_C 200 |
---|
38 | #define LONG_M 1500 |
---|
39 | |
---|
40 | #define NB_CAT_VARIABLES 5 |
---|
41 | |
---|
42 | /******************************************************************************/ |
---|
43 | /*********** Declaration of structures used in conv ***************************/ |
---|
44 | /******************************************************************************/ |
---|
45 | |
---|
46 | typedef struct |
---|
47 | { |
---|
48 | char first[LONG_M]; |
---|
49 | char last[LONG_M]; |
---|
50 | } typedim ; /* fortran dimension as 'ndeb:nfin' */ |
---|
51 | |
---|
52 | typedef struct listdim |
---|
53 | { |
---|
54 | typedim dim; |
---|
55 | struct listdim *suiv; |
---|
56 | } listdim; /* list of the dimensions of a variable */ |
---|
57 | |
---|
58 | typedef struct listname |
---|
59 | { |
---|
60 | char n_name[LONG_M]; |
---|
61 | struct listname* suiv; |
---|
62 | } listname ; /* list of names */ |
---|
63 | |
---|
64 | typedef struct do_loop |
---|
65 | { |
---|
66 | char do_variable[LONG_VNAME]; |
---|
67 | char do_begin[LONG_VNAME]; |
---|
68 | char do_end[LONG_VNAME]; |
---|
69 | char do_step[LONG_VNAME]; |
---|
70 | } do_loop ; |
---|
71 | |
---|
72 | typedef struct listdoloop |
---|
73 | { |
---|
74 | do_loop *cur_do_loop; |
---|
75 | struct listdoloop* suiv; |
---|
76 | } listdoloop; |
---|
77 | |
---|
78 | typedef struct variable |
---|
79 | { |
---|
80 | char v_typevar[LONG_VNAME]; |
---|
81 | char v_nomvar[LONG_VNAME] ; |
---|
82 | char v_oldname[LONG_VNAME] ; |
---|
83 | char v_dimchar[LONG_VNAME]; |
---|
84 | char v_modulename[LONG_VNAME]; |
---|
85 | char v_commonname[LONG_VNAME]; |
---|
86 | char v_vallengspec[LONG_VNAME]; |
---|
87 | char v_nameinttypename[LONG_VNAME]; |
---|
88 | char v_commoninfile[LONG_FNAME]; |
---|
89 | char v_subroutinename[LONG_VNAME]; |
---|
90 | listdoloop *v_do_loop; |
---|
91 | char v_precision[LONG_C]; |
---|
92 | listname *v_initialvalue; |
---|
93 | listname *v_initialvalue_array; |
---|
94 | char v_IntentSpec[LONG_M]; |
---|
95 | char v_readedlistdimension[LONG_M]; |
---|
96 | int v_nbdim; |
---|
97 | int v_common; |
---|
98 | int v_positioninblock; |
---|
99 | int v_module; |
---|
100 | int v_save; |
---|
101 | int v_catvar; |
---|
102 | int v_VariableIsParameter; |
---|
103 | int v_PublicDeclare; |
---|
104 | int v_PrivateDeclare; |
---|
105 | int v_ExternalDeclare; |
---|
106 | int v_pointedvar; |
---|
107 | int v_notgrid; |
---|
108 | int v_dimensiongiven; |
---|
109 | int v_c_star; |
---|
110 | int v_indicetabvars; |
---|
111 | int v_pointerdeclare; |
---|
112 | int v_contiguousdeclare; |
---|
113 | int v_optionaldeclare; |
---|
114 | int v_allocatable; |
---|
115 | int v_target; |
---|
116 | int v_dimsempty; |
---|
117 | listdim *v_dimension; |
---|
118 | } variable ; /* type of a variable */ |
---|
119 | /* v_typevar : type (integer, real, ...) */ |
---|
120 | /* v_nomvar : name of the variable */ |
---|
121 | /* v_dimension : list of dimensions of the variable*/ |
---|
122 | /* v_nbdim: 1 if the variable is 1d, etc ... */ |
---|
123 | /* precision : Name of the variable which */ |
---|
124 | /* determine the precision. example : wp in the */ |
---|
125 | /* case where REAL(wp) */ |
---|
126 | |
---|
127 | typedef struct listvar |
---|
128 | { |
---|
129 | variable *var ; |
---|
130 | struct listvar * suiv; |
---|
131 | } listvar ; /* list of variables */ |
---|
132 | |
---|
133 | |
---|
134 | typedef struct listusemodule |
---|
135 | { |
---|
136 | char u_usemodule[LONG_VNAME]; |
---|
137 | char u_charusemodule[LONG_VNAME]; |
---|
138 | char u_cursubroutine[LONG_VNAME]; |
---|
139 | char u_modulename[LONG_VNAME]; |
---|
140 | int u_firstuse; |
---|
141 | struct listusemodule * suiv; |
---|
142 | } listusemodule; /* list of names */ |
---|
143 | |
---|
144 | typedef struct listparameter |
---|
145 | { |
---|
146 | char p_name[LONG_M]; |
---|
147 | char p_modulename[LONG_M]; |
---|
148 | struct listparameter * suiv; |
---|
149 | } listparameter ; /* list of names */ |
---|
150 | |
---|
151 | typedef struct listcouple |
---|
152 | { |
---|
153 | char c_namevar[LONG_VNAME]; |
---|
154 | char c_namepointedvar[LONG_VNAME]; |
---|
155 | struct listcouple * suiv; |
---|
156 | } listcouple; /* list of names */ |
---|
157 | |
---|
158 | |
---|
159 | typedef struct listnom |
---|
160 | { |
---|
161 | char o_nom[LONG_C]; |
---|
162 | char o_module[LONG_VNAME]; |
---|
163 | char o_subroutinename[LONG_M]; |
---|
164 | int o_val; |
---|
165 | listcouple *couple; |
---|
166 | struct listnom * suiv; |
---|
167 | } listnom; /* list of names */ |
---|
168 | |
---|
169 | |
---|
170 | typedef struct listallocate |
---|
171 | { |
---|
172 | char a_nomvar[LONG_C]; |
---|
173 | char a_subroutine[LONG_VNAME]; |
---|
174 | char a_module[LONG_VNAME]; |
---|
175 | struct listallocate * suiv; |
---|
176 | } listallocate ; |
---|
177 | |
---|
178 | |
---|
179 | typedef struct listvarpointtovar |
---|
180 | { |
---|
181 | char t_usemodule[LONG_VNAME]; |
---|
182 | char t_cursubroutine[LONG_VNAME]; |
---|
183 | listcouple *t_couple; |
---|
184 | struct listvarpointtovar* suiv; |
---|
185 | }listvarpointtovar ; /* list of names */ |
---|
186 | |
---|
187 | |
---|
188 | typedef struct listindice |
---|
189 | { |
---|
190 | int i_indice; |
---|
191 | struct listindice * suiv; |
---|
192 | } listindice; /* list of indiced */ |
---|
193 | |
---|
194 | variable *curvar; |
---|
195 | |
---|
196 | listvar *List_ModuleUsedInModuleUsed_Var; |
---|
197 | listvar *List_ModuleUsed_Var; |
---|
198 | listvar *listduplicated; |
---|
199 | |
---|
200 | listvar *List_GlobalParameter_Var; |
---|
201 | listvar *List_Global_Var; |
---|
202 | listvar *List_Data_Var; |
---|
203 | listvar *List_Data_Var_Cur; |
---|
204 | listvar *List_Save_Var; |
---|
205 | listvar *List_SubroutineArgument_Var; |
---|
206 | listvar *List_SubroutineDeclaration_Var; |
---|
207 | listvar *List_UsedInSubroutine_Var; |
---|
208 | listvar *List_Parameter_Var; |
---|
209 | listvar *List_Dimension_Var; |
---|
210 | listvar *List_FunctionType_Var; |
---|
211 | listvar *List_NotGridDepend_Var; |
---|
212 | listvar *List_Common_Var; |
---|
213 | |
---|
214 | |
---|
215 | listname *List_Pointer_Var; |
---|
216 | listname *List_ImplicitNoneSubroutine; |
---|
217 | |
---|
218 | listname *List_Do_labels; |
---|
219 | /* A list that contains the do labels if any */ |
---|
220 | |
---|
221 | listusemodule *List_NameOfModuleUsed; |
---|
222 | listusemodule *List_Include; |
---|
223 | listusemodule *listofmoduletmp; |
---|
224 | listusemodule *tmpuselocallist; |
---|
225 | |
---|
226 | listparameter *List_GlobParamModuleUsedInModuleUsed_Var; |
---|
227 | listparameter *List_GlobParamModuleUsed_Var; |
---|
228 | |
---|
229 | listnom *List_ContainsSubroutine; |
---|
230 | listnom *List_Subroutine_For_Alloc; |
---|
231 | listnom *listofmodules; |
---|
232 | listnom *listofkind; |
---|
233 | listnom *List_NameOfModule; |
---|
234 | listnom *List_NameOfCommon; |
---|
235 | listnom *List_SubroutineWhereAgrifUsed; |
---|
236 | |
---|
237 | listallocate *List_Allocate_Var; |
---|
238 | |
---|
239 | listvarpointtovar *List_CouplePointed_Var; |
---|
240 | /* variables which are pointed to an other one */ |
---|
241 | |
---|
242 | listindice *Listofavailableindices; |
---|
243 | /* List of available indices in the tabvars table */ |
---|
244 | listindice **Listofavailableindices_glob; |
---|
245 | |
---|
246 | listdim *curdim; |
---|
247 | listdim *commondim; |
---|
248 | |
---|
249 | /******************************************************************************/ |
---|
250 | /**************** *** COMMON Variables *** *********************************/ |
---|
251 | /******************************************************************************/ |
---|
252 | |
---|
253 | int positioninblock; |
---|
254 | char commonvar[LONG_VNAME]; |
---|
255 | char commonblockname[LONG_VNAME]; |
---|
256 | |
---|
257 | /******************************************************************************/ |
---|
258 | /**************** *** AGRIF Variables *** *********************************/ |
---|
259 | /******************************************************************************/ |
---|
260 | int inagrifcallargument; |
---|
261 | int afterpercent; |
---|
262 | int sameagrifargument; |
---|
263 | int InAgrifParentDef; |
---|
264 | char sameagrifname[LONG_VNAME]; |
---|
265 | /******************************************************************************/ |
---|
266 | /**************** *** VAR DEF Variables *** *******************************/ |
---|
267 | /******************************************************************************/ |
---|
268 | int indicemaxtabvars[NB_CAT_VARIABLES]; /* Number of variables in the model i.e. last */ |
---|
269 | /* indice used in the tabvars table */ |
---|
270 | int PublicDeclare; /* Variable has been declared as PUBLIC */ |
---|
271 | int PrivateDeclare; /* Variable has been declared as PRIVATE */ |
---|
272 | int ExternalDeclare; /* Variable has been declared as EXTERNAL */ |
---|
273 | int InitialValueGiven; /* An initial value has been given */ |
---|
274 | int Allocatabledeclare; |
---|
275 | int Targetdeclare; |
---|
276 | int SaveDeclare; |
---|
277 | int functiondeclarationisdone; |
---|
278 | int pointerdeclare; |
---|
279 | int contiguousdeclare; |
---|
280 | int optionaldeclare; |
---|
281 | int inside_type_declare; |
---|
282 | int VariableIsParameter; |
---|
283 | int dimsgiven; |
---|
284 | int shouldincludempif; |
---|
285 | int c_star; |
---|
286 | char DeclType[LONG_VNAME]; |
---|
287 | char nameinttypename[LONG_VNAME]; |
---|
288 | char nameinttypenameback[LONG_VNAME]; |
---|
289 | int GlobalDeclaration; |
---|
290 | int GlobalDeclarationType; |
---|
291 | char InitValue[LONG_M]; |
---|
292 | char IntentSpec[LONG_M]; |
---|
293 | char NamePrecision[LONG_C]; |
---|
294 | char CharacterSize[LONG_VNAME]; |
---|
295 | char vallengspec[LONG_VNAME]; |
---|
296 | int isrecursive; |
---|
297 | int is_result_present; |
---|
298 | |
---|
299 | /******************************************************************************/ |
---|
300 | /**************** *** CONV Variables *** **********************************/ |
---|
301 | /******************************************************************************/ |
---|
302 | int dimprob ; /* dimension of the problem : 1 for 1D,2 for 2D, */ |
---|
303 | /* 3 for 3D */ |
---|
304 | int onlyfixedgrids; /* = 1 if onlyfixedgrids is true */ |
---|
305 | int todebug; |
---|
306 | int fixedgrids; /* = 1 if fixedgrids is true */ |
---|
307 | char nbmaillesX[LONG_VNAME]; // number of cells in the x direction |
---|
308 | char nbmaillesY[LONG_VNAME]; // number of cells in the y direction |
---|
309 | char nbmaillesZ[LONG_VNAME]; // number of cells in the z direction |
---|
310 | int IndicenbmaillesX; |
---|
311 | int IndicenbmaillesY; |
---|
312 | int IndicenbmaillesZ; |
---|
313 | |
---|
314 | int inmodulemeet; |
---|
315 | int incalldeclare; |
---|
316 | int aftercontainsdeclare; /* Signale si l'on vient d'un contains ou non */ |
---|
317 | int retour77; |
---|
318 | int callagrifinitgrids; |
---|
319 | int callmpiinit; |
---|
320 | int firstpass; |
---|
321 | int pointedvar; |
---|
322 | int NbMailleXDefined; |
---|
323 | int agrif_parentcall; |
---|
324 | int didvariableadded; |
---|
325 | int SubloopScalar; /* = 1 we should put in argument of sub_loop */ |
---|
326 | /* only */ |
---|
327 | /* scalar and not table u(1,1,1) in place of u */ |
---|
328 | int inprogramdeclare; |
---|
329 | int insubroutinedeclare; |
---|
330 | int inmoduledeclare; |
---|
331 | int dimsempty; |
---|
332 | int created_dimensionlist; |
---|
333 | int incontainssubroutine; |
---|
334 | |
---|
335 | char meetagrifinitgrids[LONG_M]; |
---|
336 | char mpiinitvar[LONG_M]; |
---|
337 | char toprintglob[LONG_M]; |
---|
338 | char tmpvargridname[LONG_M]; |
---|
339 | char dependfilename[LONG_FNAME]; |
---|
340 | char charusemodule[LONG_VNAME]; |
---|
341 | char subofagrifinitgrids[LONG_M]; |
---|
342 | char curmodulename[LONG_VNAME]; |
---|
343 | char subroutinename[LONG_VNAME]; |
---|
344 | char old_subroutinename[LONG_VNAME]; // For internal subprogramm |
---|
345 | char cur_filename[LONG_FNAME]; // Name of the current parsed Fortran file |
---|
346 | char config_file[LONG_FNAME]; // Name of conv configuration file (ex: amr.in) |
---|
347 | char work_dir[LONG_FNAME]; // Work directory (default: './') |
---|
348 | char include_dir[LONG_FNAME]; // Include directory (default: './AGRIF_INC') |
---|
349 | char output_dir[LONG_FNAME]; // output directory (default: './AGRIF_MODELFILES') |
---|
350 | char input_dir[LONG_FNAME]; // source input directory (default: './') |
---|
351 | |
---|
352 | FILE *fortran_out; /* Output File */ |
---|
353 | FILE *fortran_in; /* Input File */ |
---|
354 | FILE *oldfortran_out; |
---|
355 | FILE *old_oldfortran_out; // For internal subprogramm |
---|
356 | FILE *subloop; |
---|
357 | FILE *module_declar; |
---|
358 | FILE *allocationagrif; |
---|
359 | |
---|
360 | long int pos_cur; /* current position in the output file */ |
---|
361 | long int pos_curagrifparent; |
---|
362 | /* current position in the output file */ |
---|
363 | long int pos_curcall; /* current position in the output file */ |
---|
364 | long int pos_curuse; /* current position in the output file */ |
---|
365 | long int pos_curuseold; /* current position in the output file */ |
---|
366 | long int pos_curfunction; /* current position in the output file */ |
---|
367 | long int pos_cur_decl; /* current position in the output file */ |
---|
368 | long int pos_curdata; /* current position in the output file */ |
---|
369 | long int pos_curparameter;/* current position in the output file */ |
---|
370 | long int pos_curcommon; /* current position in the output file */ |
---|
371 | long int pos_cursave; /* current position in the output file */ |
---|
372 | long int pos_curdimension;/* current position in the output file */ |
---|
373 | long int pos_curinclude; /* final position of a line in file */ |
---|
374 | long int pos_end; /* final position of a line in file */ |
---|
375 | long int pos_endsubroutine; |
---|
376 | /* final position of a line in file */ |
---|
377 | |
---|
378 | size_t length_last; |
---|
379 | size_t length_first; |
---|
380 | size_t length_v_vallengspec; |
---|
381 | size_t length_v_commoninfile; |
---|
382 | size_t length_v_precision; |
---|
383 | size_t length_v_IntentSpec; |
---|
384 | size_t length_v_initialvalue; |
---|
385 | size_t length_v_readedlistdimension; |
---|
386 | size_t length_a_nomvar; |
---|
387 | size_t length_toprintglob; |
---|
388 | size_t length_tmpvargridname; |
---|
389 | size_t length_ligne_Subloop; |
---|
390 | size_t length_toprint_utilagrif; |
---|
391 | size_t length_toprinttmp_utilchar; |
---|
392 | size_t length_ligne_writedecl; |
---|
393 | size_t length_newname_toamr; |
---|
394 | size_t length_newname_writedecl; |
---|
395 | size_t length_ligne_toamr; |
---|
396 | size_t length_tmpligne_writedecl; |
---|
397 | int value_char_size; |
---|
398 | int value_char_size1; |
---|
399 | int value_char_size2; |
---|
400 | int value_char_size3; |
---|
401 | |
---|
402 | |
---|
403 | int inallocate; |
---|
404 | int infixed; |
---|
405 | int infree; |
---|
406 | /******************************************************************************/ |
---|
407 | /*********** Declaration of externals subroutines *****************************/ |
---|
408 | /***************************************************** ************************/ |
---|
409 | extern char *fortran_text; |
---|
410 | /******************************************************************************/ |
---|
411 | /*********** convert.y ********************************************************/ |
---|
412 | /******************************************************************************/ |
---|
413 | extern int main(int argc,char *argv[]); |
---|
414 | extern int convert_error(const char *s); |
---|
415 | /******************************************************************************/ |
---|
416 | /*********** fortran.y ********************************************************/ |
---|
417 | /******************************************************************************/ |
---|
418 | extern void process_fortran(const char *input_file); |
---|
419 | extern int fortran_error(const char *s); |
---|
420 | /******************************************************************************/ |
---|
421 | /*********** dependfile.c *****************************************************/ |
---|
422 | /******************************************************************************/ |
---|
423 | extern void Writethedependnbxnbyfile(); |
---|
424 | extern void Readthedependnbxnbyfile(); |
---|
425 | extern void Writethedependlistofmoduleused(const char *NameTampon ); |
---|
426 | extern void Readthedependlistofmoduleused(const char *NameTampon); |
---|
427 | extern void WritedependParameterList(const char *NameTampon ); |
---|
428 | extern listparameter *ReaddependParameterList(const char *NameTampon, listparameter *listout); |
---|
429 | extern void Writethedependfile(const char *NameTampon, listvar *input ); |
---|
430 | extern listvar *Readthedependfile(const char *NameTampon , listvar *listout); |
---|
431 | extern void Write_Subroutine_For_Alloc(); |
---|
432 | extern void Read_Subroutine_For_Alloc(); |
---|
433 | extern void Writethedependavailablefile(); |
---|
434 | extern void Readthedependavailablefile(); |
---|
435 | extern int is_dependfile_created(const char *NameTampon); |
---|
436 | extern void Write_val_max(); |
---|
437 | extern void Read_val_max(); |
---|
438 | /******************************************************************************/ |
---|
439 | /*********** DiversListe.c ****************************************************/ |
---|
440 | /******************************************************************************/ |
---|
441 | extern void Add_Common_var_1(); |
---|
442 | extern listnom *Addtolistnom(const char *nom, listnom *listin, int value); |
---|
443 | extern listname *Addtolistname(const char *nom, listname *input); |
---|
444 | extern int ModuleIsDefineInInputFile(const char *name); |
---|
445 | extern void Addmoduletothelisttmp(const char *name); |
---|
446 | extern void Add_NameOfModule_1(const char *nom); |
---|
447 | extern void Add_NameOfCommon_1(const char *nom, const char *cursubroutinename); |
---|
448 | extern void Add_CouplePointed_Var_1(const char *namemodule, listcouple *couple); |
---|
449 | extern void Add_Include_1(const char *name); |
---|
450 | extern void Add_ImplicitNoneSubroutine_1(); |
---|
451 | extern void WriteIncludeDeclaration(FILE* tofile); |
---|
452 | extern void Add_Save_Var_1 (const char *name,listdim *d); |
---|
453 | extern void Add_Save_Var_dcl_1 (listvar *var); |
---|
454 | /******************************************************************************/ |
---|
455 | /*********** SubLoopCreation.c ************************************************/ |
---|
456 | /******************************************************************************/ |
---|
457 | extern void WriteBeginof_SubLoop(); |
---|
458 | extern void WriteVariablelist_subloop(char **ligne, size_t *line_length); |
---|
459 | extern void WriteVariablelist_subloop_Call(char **ligne, size_t *line_length); |
---|
460 | extern void WriteVariablelist_subloop_Def(char **ligne, size_t *line_length); |
---|
461 | extern void WriteHeadofSubroutineLoop(); |
---|
462 | extern void closeandcallsubloopandincludeit_0(int suborfun); |
---|
463 | extern void closeandcallsubloop_contains_0(); |
---|
464 | /******************************************************************************/ |
---|
465 | /*********** toamr.c **********************************************************/ |
---|
466 | /******************************************************************************/ |
---|
467 | extern void WARNING_CharSize(const variable *var); |
---|
468 | extern const char * tabvarsname(const variable *var); |
---|
469 | extern const char * variablecurgridtabvars(int which_grid); |
---|
470 | extern const char * vargridnametabvars(const variable *var, int iorindice); |
---|
471 | extern const char * vargridcurgridtabvars(const variable *var, int which_grid); |
---|
472 | extern const char * vargridcurgridtabvarswithoutAgrif_Gr(const variable *var); |
---|
473 | extern const char * vargridparam(const variable *var); |
---|
474 | extern void write_probdimagrif_file(); |
---|
475 | extern void write_keysagrif_file(); |
---|
476 | extern void write_modtypeagrif_file(); |
---|
477 | extern void write_createvarnameagrif_file(variable *v,FILE *createvarname,int *InitEmpty); |
---|
478 | extern void write_initialisationsagrif_file(variable *v,FILE *initproc,int *VarnameEmpty); |
---|
479 | extern void write_Setnumberofcells_file(); |
---|
480 | extern void write_Getnumberofcells_file(); |
---|
481 | extern void Write_Alloc_Agrif_Files(); |
---|
482 | extern int IndiceInlist(int indic, listindice *listin); |
---|
483 | extern void write_allocation_Common_0(); |
---|
484 | extern void write_allocation_Global_0(); |
---|
485 | extern void creefichieramr(); |
---|
486 | /******************************************************************************/ |
---|
487 | /*********** UtilAgrif.c ******************************************************/ |
---|
488 | /******************************************************************************/ |
---|
489 | extern int Vartonumber(const char *tokname); |
---|
490 | extern int Agrif_in_Tok_NAME(const char *tokname); |
---|
491 | extern void ModifyTheVariableName_0(const char *ident,int lengthname); |
---|
492 | extern void Add_SubroutineWhereAgrifUsed_1(const char *sub, const char *mod); |
---|
493 | extern void AddUseAgrifUtil_0(FILE *fileout); |
---|
494 | extern void AddUseAgrifUtilBeforeCall_0(FILE *fileout); |
---|
495 | extern void NotifyAgrifFunction_0(const char *ident); |
---|
496 | extern void ModifyTheAgrifFunction_0(const char *ident); |
---|
497 | extern void AgriffunctionModify_0(const char *ident,int whichone); |
---|
498 | extern void Instanciation_0(const char *ident); |
---|
499 | /******************************************************************************/ |
---|
500 | /*********** UtilCharacter.c **************************************************/ |
---|
501 | /******************************************************************************/ |
---|
502 | extern void FindAndChangeNameToTabvars(const char name[LONG_M],char toprint[LONG_M], |
---|
503 | listvar * listtosee, int whichone); |
---|
504 | extern const char *ChangeTheInitalvaluebyTabvarsName(const char *nom,listvar *listtoread); |
---|
505 | extern int IsVariableReal(const char *nom); |
---|
506 | extern void IsVarInUseFile(const char *nom); |
---|
507 | extern listnom *DecomposeTheNameinlistnom(const char *nom, listnom * listout); |
---|
508 | extern void DecomposeTheName(const char *nom); |
---|
509 | extern void convert2lower(char *lowername, const char* inputname); |
---|
510 | extern int convert2int(const char *name); |
---|
511 | /******************************************************************************/ |
---|
512 | /*********** UtilFile.c *******************************************************/ |
---|
513 | /******************************************************************************/ |
---|
514 | extern FILE * open_for_write (const char *filename); |
---|
515 | extern FILE * open_for_append (const char *filename); |
---|
516 | extern long int setposcur(); |
---|
517 | extern long int setposcurname(FILE *fileout); |
---|
518 | extern void copyuse_0(const char *namemodule); |
---|
519 | extern void copyuseonly_0(const char *namemodule); |
---|
520 | /******************************************************************************/ |
---|
521 | /*********** UtilFortran.c ****************************************************/ |
---|
522 | /******************************************************************************/ |
---|
523 | extern void initdimprob(int dimprobmod, const char *nx, const char *ny, const char *nz); |
---|
524 | extern int Variableshouldberemoved(const char *nom); |
---|
525 | extern int variableisglobal(listvar *curvar, listvar *listin); |
---|
526 | extern int VariableIsInListCommon(listvar *curvar,listvar *listin); |
---|
527 | extern int VariableIsInList(listvar *curvar,listvar *listin); |
---|
528 | extern void variableisglobalinmodule(listcouple *listin, const char *module, |
---|
529 | FILE *fileout,long int oldposcuruse); |
---|
530 | extern void Write_Word_end_module_0(); |
---|
531 | extern void Add_Subroutine_For_Alloc(const char *nom); |
---|
532 | extern void Write_Closing_Module(); |
---|
533 | extern int IsTabvarsUseInArgument_0(); |
---|
534 | extern int ImplicitNoneInSubroutine(); |
---|
535 | extern void Add_Pointer_Var_From_List_1(listvar *listin); |
---|
536 | extern void Add_Pointer_Var_1(char *nom); |
---|
537 | extern int varispointer_0(char *ident); |
---|
538 | extern int VariableIsFunction(const char *ident); |
---|
539 | extern int varistyped_0(char *ident); |
---|
540 | extern void dump_var(const variable* var); |
---|
541 | extern void removenewline(char *nom); |
---|
542 | /******************************************************************************/ |
---|
543 | /*********** UtilListe.c ******************************************************/ |
---|
544 | /******************************************************************************/ |
---|
545 | extern void Init_Variable(variable *var); |
---|
546 | extern listvar * AddListvarToListvar(listvar *l,listvar *glob, int ValueFirstpass); |
---|
547 | extern void CreateAndFillin_Curvar(const char *type, variable *curvar); |
---|
548 | // extern void duplicatelistvar(listvar *orig); |
---|
549 | extern listdim * insertdim(listdim *lin,typedim nom); |
---|
550 | extern void change_dim_char(listdim *lin,listvar * l); |
---|
551 | extern int get_num_dims(const listdim *d); |
---|
552 | extern variable * createvar(const char *nom, listdim *d); |
---|
553 | extern listvar * insertvar(listvar *lin,variable *v); |
---|
554 | extern listvar * settype(const char *nom,listvar *lin); |
---|
555 | extern void printliste(listvar * lin); |
---|
556 | extern int IsinListe(listvar *lin,char *nom); |
---|
557 | extern listname *Insertname(listname *lin,char *nom,int sens); |
---|
558 | extern int testandextractfromlist(listname **lin, char*nom); |
---|
559 | extern void removefromlist(listname **lin, char*nom); |
---|
560 | extern listname *concat_listname(listname *l1, listname *l2); |
---|
561 | extern void createstringfromlistname(char *ligne, listname *lin); |
---|
562 | extern void printname(listname * lin); |
---|
563 | extern void removeglobfromlist(listname **lin); |
---|
564 | extern void writelistpublic(listname *lin); |
---|
565 | extern void Init_List_Data_Var(); |
---|
566 | extern void addprecision_derivedfromkind(variable *curvar); |
---|
567 | extern int get_cat_var(variable *var); |
---|
568 | extern void Insertdoloop(variable *var,char *do_var, char *do_begin, char *do_end, char *do_step); |
---|
569 | /******************************************************************************/ |
---|
570 | /*********** UtilNotGridDep.c *************************************************/ |
---|
571 | /******************************************************************************/ |
---|
572 | extern void Add_NotGridDepend_Var_1 (char *name); |
---|
573 | extern int VarIsNonGridDepend(char *name); |
---|
574 | /******************************************************************************/ |
---|
575 | /*********** WorkWithAllocatelist.c *******************************************/ |
---|
576 | /******************************************************************************/ |
---|
577 | extern void Add_Allocate_Var_1(const char *nom, const char *nommodule); |
---|
578 | extern int IsVarAllocatable_0(const char *ident); |
---|
579 | /******************************************************************************/ |
---|
580 | /*********** WorkWithglobliste.c **********************************************/ |
---|
581 | /******************************************************************************/ |
---|
582 | extern void Add_Globliste_1(listvar *listtoadd); |
---|
583 | extern void Add_SubroutineDeclarationSave_Var_1(listvar *listtoadd); |
---|
584 | extern void checkandchangedims(listvar *listsecondpass); |
---|
585 | /******************************************************************************/ |
---|
586 | /*********** WorkWithlistdatavariable.c ***************************************/ |
---|
587 | /******************************************************************************/ |
---|
588 | extern void Add_Data_Var_1 (listvar **curlist,char *name,char *values); |
---|
589 | extern void Add_Data_Var_Names_01 (listvar **curlist,listvar *l1, listname *l2); |
---|
590 | /******************************************************************************/ |
---|
591 | /*********** WorkWithlistmoduleinfile.c ***************************************/ |
---|
592 | /******************************************************************************/ |
---|
593 | extern void Save_Length(const char *nom, int whichone); |
---|
594 | extern void Save_Length_int(int val, int whichone); |
---|
595 | /******************************************************************************/ |
---|
596 | /*********** WorkWithlistofmodulebysubroutine.c *******************************/ |
---|
597 | /******************************************************************************/ |
---|
598 | extern void RecordUseModulesVariables(); |
---|
599 | extern void RecordUseModulesUseModulesVariables(); |
---|
600 | extern void Add_NameOfModuleUsed_1(char *name); |
---|
601 | extern void Addmoduletothelist(const char *name); |
---|
602 | extern void WriteUsemoduleDeclaration(const char *cursubroutinename); |
---|
603 | /******************************************************************************/ |
---|
604 | /*********** WorkWithlistvarindoloop.c ****************************************/ |
---|
605 | /******************************************************************************/ |
---|
606 | extern void Add_UsedInSubroutine_Var_1 (const char *ident); |
---|
607 | extern void ajoutevarindoloop_definedimension (char *name); |
---|
608 | extern void ModifyThelistvarindoloop(); |
---|
609 | extern void CompleteThelistvarindoloop(); |
---|
610 | extern void Merge_Variables(variable *var1,variable *var2); |
---|
611 | extern void Update_List_Subroutine_Var(listvar *list_to_modify); |
---|
612 | extern void Update_List_Global_Var_From_List_Save_Var(); |
---|
613 | extern void Update_List_From_Common_Var(listvar *list_to_modify); |
---|
614 | extern void Update_List_Var(listvar *list_to_modify); |
---|
615 | extern void List_UsedInSubroutine_Var_Update_From_Module_Used(); |
---|
616 | extern void Update_NotGridDepend_Var(listvar *list_to_modify); |
---|
617 | extern int LookingForVariableInList(listvar *listin,variable *var); |
---|
618 | extern int LookingForVariableInListGlobal(listvar *listin,variable *var); |
---|
619 | extern int LookingForVariableInListName(listvar *listin,const char *var); |
---|
620 | extern int LookingForVariableInListGlob(listvar *listin,variable *var); |
---|
621 | extern int LookingForVariableInListParamGlob(listparameter *listin, variable *var); |
---|
622 | extern variable *get_variable_in_list_from_name(listvar *listin, const char *name); |
---|
623 | extern void UpdateListDeclarationWithDimensionList(); |
---|
624 | extern void Clean_List_UsedInSubroutine_Var(); |
---|
625 | extern void Clean_List_ModuleUsed_Var(); |
---|
626 | extern void Clean_List_SubroutineDeclaration_Var(); |
---|
627 | extern void Clean_List_Global_Var(); |
---|
628 | extern void ListClean(); |
---|
629 | extern void ListUpdate(); |
---|
630 | extern void GiveTypeOfVariables(); |
---|
631 | extern void Sort_List_SubroutineArgument_Var(); |
---|
632 | extern void IndiceTabvars_Global_Var_Treated(char *nom); |
---|
633 | extern void IndiceTabvars_Global_Var_No_Treated(char *nom); |
---|
634 | extern void UpdateTheRemainingList(listvar *record); |
---|
635 | extern void IndiceTabvars_Common_Var_Treated(char *nom); |
---|
636 | extern void IndiceTabvars_Common_Var_No_Treated(char *nom); |
---|
637 | extern void IndiceTabvarsIdentification(); |
---|
638 | extern void New_Allocate_Subroutine_Is_Necessary(); |
---|
639 | extern void New_Allocate_Subroutine_For_Common_Is_Necessary(); |
---|
640 | extern void NewModule_Creation_0(); |
---|
641 | extern void UpdateList_SubroutineWhereAgrifUsed(); |
---|
642 | extern void UpdateList_UsedInSubroutine_With_dimension(); |
---|
643 | extern void Affiche(listvar *parcours); |
---|
644 | extern int SubInList_ContainsSubroutine(); |
---|
645 | extern void update_indicemaxtabvars(variable *var,listindice **Listofindices); |
---|
646 | /******************************************************************************/ |
---|
647 | /*********** WorkWithParameterlist.c ******************************************/ |
---|
648 | /******************************************************************************/ |
---|
649 | extern void Add_GlobalParameter_Var_1(listvar *listin); |
---|
650 | extern void Add_Parameter_Var_1(listvar *listin); |
---|
651 | extern void Add_Dimension_Var_1(listvar *listin); |
---|
652 | /******************************************************************************/ |
---|
653 | /*********** WorkWithvarofsubroutineliste.c ***********************************/ |
---|
654 | /******************************************************************************/ |
---|
655 | extern void Add_SubroutineArgument_Var_1(listvar *listtoadd); |
---|
656 | extern void Add_FunctionType_Var_1(const char *nom); |
---|
657 | // extern void Add_SubroutineDeclaration_Var_1 (listvar *listtoadd); |
---|
658 | /******************************************************************************/ |
---|
659 | /*********** Writedeclarations.c **********************************************/ |
---|
660 | /******************************************************************************/ |
---|
661 | extern void WriteBeginDeclaration(variable *v,char ligne[LONG_M],int visibility); |
---|
662 | extern void WriteScalarDeclaration(variable *v,char ligne[LONG_M]); |
---|
663 | extern void WriteTableDeclaration(variable * v,char ligne[LONG_M],int tmpok); |
---|
664 | extern void WriteVarDeclaration( variable *v, FILE *fileout, int value, int visibility ); |
---|
665 | extern void WriteLocalParamDeclaration(FILE* tofile); |
---|
666 | extern void WriteFunctionDeclaration(FILE* tofile, int value); |
---|
667 | extern void WriteSubroutineDeclaration(int value); |
---|
668 | extern void WriteArgumentDeclaration_beforecall(); |
---|
669 | extern void WriteArgumentDeclaration_Sort(FILE* tofile); |
---|
670 | extern int writedeclarationintoamr(listvar *deb_common, FILE *fileout, variable *var, |
---|
671 | const char *commonname, listnom **neededparameter, const char *name_common, int global_check); |
---|
672 | extern void writesub_loopdeclaration_scalar(listvar *deb_common, FILE *fileout); |
---|
673 | extern void writesub_loopdeclaration_tab(listvar *deb_common, FILE *fileout); |
---|
674 | extern void ReWriteDeclarationAndAddTosubroutine_01(listvar *listdecl); |
---|
675 | extern void ReWriteDataStatement_0(FILE * filout); |
---|
676 | /******************************************************************************/ |
---|
677 | /*********** WriteInFile.c ****************************************************/ |
---|
678 | /******************************************************************************/ |
---|
679 | extern void tofich_reste (FILE * filout, const char *s, int do_returnline); |
---|
680 | extern void tofich (FILE * filout, const char *s, int do_returnline); |
---|
681 | extern void tofich_blanc (FILE * filout, int size); |
---|
682 | extern void RemoveWordSET_0(FILE * filout, long int position, int sizetoremove); |
---|
683 | extern void RemoveWordCUR_0(FILE * filout, int sizetoremove); |
---|
684 | |
---|
685 | /******************************************************************************/ |
---|
686 | /*********** WorkWithlistofcoupled.c **********************************************/ |
---|
687 | /******************************************************************************/ |
---|
688 | extern int variscoupled_0(const char *ident) ; |
---|
689 | extern const char * getcoupledname_0(const char *ident); |
---|