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