[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 | /******************************************************************************/ |
---|
| 35 | #define LONGNOM 8000 |
---|
| 36 | |
---|
| 37 | #define LONG_C 3000 |
---|
| 38 | #define LONG_4C 4000 |
---|
| 39 | #define LONG_4M 4000 |
---|
[2715] | 40 | #define LONG_40M 4000000 |
---|
[1901] | 41 | |
---|
| 42 | /******************************************************************************/ |
---|
| 43 | /*********** Declaration of structures used in conv ***************************/ |
---|
| 44 | /******************************************************************************/ |
---|
| 45 | |
---|
| 46 | typedef struct |
---|
| 47 | { |
---|
| 48 | char first[LONG_C]; |
---|
| 49 | char last[LONG_C]; |
---|
| 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 variable |
---|
| 59 | { |
---|
| 60 | char v_typevar[LONG_C]; |
---|
| 61 | char v_nomvar[LONG_C] ; |
---|
| 62 | char v_oldname[LONG_C] ; |
---|
| 63 | char v_dimchar[LONG_C]; |
---|
| 64 | char v_modulename[LONG_C]; |
---|
| 65 | char v_commonname[LONG_C]; |
---|
| 66 | char v_vallengspec[LONG_C]; |
---|
| 67 | char v_nameinttypename[LONG_C]; |
---|
| 68 | char v_commoninfile[LONG_C]; |
---|
| 69 | char v_subroutinename[LONG_C]; |
---|
| 70 | char v_precision[LONG_C]; |
---|
| 71 | char v_initialvalue[LONG_4C]; |
---|
| 72 | char v_IntentSpec[LONG_C]; |
---|
| 73 | char v_readedlistdimension[LONG_C]; |
---|
| 74 | int v_nbdim; |
---|
| 75 | int v_common; |
---|
| 76 | int v_positioninblock; |
---|
| 77 | int v_module; |
---|
| 78 | int v_save; |
---|
| 79 | int v_VariableIsParameter; |
---|
| 80 | int v_PublicDeclare; |
---|
| 81 | int v_PrivateDeclare; |
---|
| 82 | int v_ExternalDeclare; |
---|
| 83 | int v_pointedvar; |
---|
| 84 | int v_notgrid; |
---|
| 85 | int v_dimensiongiven; |
---|
| 86 | int v_c_star; |
---|
| 87 | int v_indicetabvars; |
---|
| 88 | int v_pointerdeclare; |
---|
| 89 | int v_optionaldeclare; |
---|
| 90 | int v_allocatable; |
---|
[2715] | 91 | int v_target; |
---|
[1901] | 92 | int v_dimsempty; |
---|
| 93 | listdim *v_dimension; |
---|
| 94 | } variable ; /* type of a variable */ |
---|
| 95 | /* v_typevar : type (integer, real, ...) */ |
---|
| 96 | /* v_nomvar : name of the variable */ |
---|
| 97 | /* v_dimension : list of dimensions of the variable*/ |
---|
| 98 | /* v_nbdim: 1 if the variable is 1d, etc ... */ |
---|
| 99 | /* precision : Name of the variable which */ |
---|
| 100 | /* determine the precision. example : wp in the */ |
---|
| 101 | /* case where REAL(wp) */ |
---|
| 102 | |
---|
| 103 | typedef struct listvar |
---|
| 104 | { |
---|
| 105 | variable *var ; |
---|
| 106 | struct listvar * suiv; |
---|
| 107 | } listvar ; /* list of variables */ |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | typedef struct listusemodule |
---|
| 111 | { |
---|
| 112 | char u_usemodule[LONG_C]; |
---|
| 113 | char u_charusemodule[LONG_C]; |
---|
| 114 | char u_cursubroutine[LONG_C]; |
---|
| 115 | char u_modulename[LONG_C]; |
---|
| 116 | int u_firstuse; |
---|
| 117 | struct listusemodule * suiv; |
---|
| 118 | } listusemodule; /* list of names */ |
---|
| 119 | |
---|
| 120 | typedef struct listparameter |
---|
| 121 | { |
---|
| 122 | char p_name[LONG_C]; |
---|
| 123 | char p_modulename[LONG_C]; |
---|
| 124 | struct listparameter * suiv; |
---|
| 125 | } listparameter ; /* list of names */ |
---|
| 126 | |
---|
| 127 | typedef struct listname |
---|
| 128 | { |
---|
| 129 | char n_name[LONG_C]; |
---|
| 130 | struct listname* suiv; |
---|
| 131 | } listname ; /* list of names */ |
---|
| 132 | |
---|
| 133 | typedef struct listcouple |
---|
| 134 | { |
---|
| 135 | char c_namevar[LONG_C]; |
---|
| 136 | char c_namepointedvar[LONG_C]; |
---|
| 137 | struct listcouple * suiv; |
---|
| 138 | } listcouple; /* list of names */ |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | typedef struct listnom |
---|
| 142 | { |
---|
| 143 | char o_nom[LONG_C]; |
---|
| 144 | char o_module[LONG_C]; |
---|
[2715] | 145 | char o_subroutinename[LONG_C]; |
---|
[1901] | 146 | int o_val; |
---|
| 147 | listcouple *couple; |
---|
| 148 | struct listnom * suiv; |
---|
| 149 | } listnom; /* list of names */ |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | typedef struct listallocate |
---|
| 153 | { |
---|
| 154 | char a_nomvar[LONG_C]; |
---|
| 155 | char a_subroutine[LONG_C]; |
---|
| 156 | char a_module[LONG_C]; |
---|
| 157 | struct listallocate * suiv; |
---|
| 158 | } listallocate ; |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | typedef struct listvarpointtovar |
---|
| 162 | { |
---|
| 163 | char t_usemodule[LONG_C]; |
---|
| 164 | char t_cursubroutine[LONG_C]; |
---|
| 165 | listcouple *t_couple; |
---|
| 166 | struct listvarpointtovar* suiv; |
---|
| 167 | }listvarpointtovar ; /* list of names */ |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | typedef struct listindice |
---|
| 171 | { |
---|
| 172 | int i_indice; |
---|
| 173 | struct listindice * suiv; |
---|
| 174 | } listindice; /* list of indiced */ |
---|
| 175 | |
---|
| 176 | variable *curvar; |
---|
| 177 | |
---|
| 178 | listvar *List_ModuleUsedInModuleUsed_Var; |
---|
| 179 | listvar *List_ModuleUsed_Var; |
---|
| 180 | listvar *listduplicated; |
---|
| 181 | |
---|
| 182 | listvar *List_GlobalParameter_Var; |
---|
| 183 | listvar *List_Global_Var; |
---|
| 184 | listvar *List_Data_Var; |
---|
[2715] | 185 | listvar *List_Data_Var_Cur; |
---|
[1901] | 186 | listvar *List_Save_Var; |
---|
| 187 | listvar *List_SubroutineArgument_Var; |
---|
| 188 | listvar *List_SubroutineDeclaration_Var; |
---|
| 189 | listvar *List_UsedInSubroutine_Var; |
---|
| 190 | listvar *List_Parameter_Var; |
---|
| 191 | listvar *List_Dimension_Var; |
---|
| 192 | listvar *List_FunctionType_Var; |
---|
| 193 | listvar *List_NotGridDepend_Var; |
---|
| 194 | listvar *List_Common_Var; |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | listname *List_Pointer_Var; |
---|
| 198 | listname *List_ImplicitNoneSubroutine; |
---|
| 199 | |
---|
| 200 | listusemodule *List_NameOfModuleUsed; |
---|
| 201 | listusemodule *List_Include; |
---|
| 202 | listusemodule *listofmoduletmp; |
---|
| 203 | listusemodule *tmpuselocallist; |
---|
| 204 | |
---|
| 205 | listparameter *List_GlobParamModuleUsedInModuleUsed_Var; |
---|
| 206 | listparameter *List_GlobParamModuleUsed_Var; |
---|
| 207 | |
---|
| 208 | listnom *List_ContainsSubroutine; |
---|
| 209 | listnom *List_Subroutine_For_Alloc; |
---|
| 210 | listnom *listofmodules; |
---|
| 211 | listnom *List_NameOfModule; |
---|
| 212 | listnom *List_NameOfCommon; |
---|
| 213 | listnom *List_SubroutineWhereAgrifUsed; |
---|
| 214 | |
---|
| 215 | listallocate *List_Allocate_Var; |
---|
| 216 | |
---|
| 217 | listvarpointtovar *List_CouplePointed_Var; |
---|
| 218 | /* variables which are pointed to an other one */ |
---|
| 219 | |
---|
| 220 | listindice *Listofavailableindices; |
---|
| 221 | /* List of available indices in the tabvars table */ |
---|
| 222 | |
---|
| 223 | listdim *curdim; |
---|
| 224 | listdim *commondim; |
---|
| 225 | |
---|
| 226 | /******************************************************************************/ |
---|
| 227 | /**************** *** COMMON Variables *** *********************************/ |
---|
| 228 | /******************************************************************************/ |
---|
| 229 | |
---|
| 230 | int positioninblock; |
---|
| 231 | char commonvar[LONG_C]; |
---|
| 232 | char commonblockname[LONG_C]; |
---|
| 233 | |
---|
| 234 | /******************************************************************************/ |
---|
| 235 | /**************** *** AGRIF Variables *** *********************************/ |
---|
| 236 | /******************************************************************************/ |
---|
| 237 | int inagrifcallargument; |
---|
[2715] | 238 | int afterpercent; |
---|
[1901] | 239 | int sameagrifargument; |
---|
| 240 | int InAgrifParentDef; |
---|
| 241 | char sameagrifname[LONG_C]; |
---|
| 242 | /******************************************************************************/ |
---|
| 243 | /**************** *** VAR DEF Variables *** *******************************/ |
---|
| 244 | /******************************************************************************/ |
---|
| 245 | int indicemaxtabvars; /* Number of variables in the model i.e. last */ |
---|
| 246 | /* indice used in the tabvars table */ |
---|
| 247 | int PublicDeclare; /* Variable has been declared as PUBLIC */ |
---|
| 248 | int PrivateDeclare; /* Variable has been declared as PRIVATE */ |
---|
| 249 | int ExternalDeclare; /* Variable has been declared as EXTERNAL */ |
---|
[3294] | 250 | char InitialValueGiven[LONG_C]; |
---|
[1901] | 251 | int Allocatabledeclare; |
---|
[2715] | 252 | int Targetdeclare; |
---|
[1901] | 253 | int SaveDeclare; |
---|
| 254 | int functiondeclarationisdone; |
---|
| 255 | int pointerdeclare; |
---|
| 256 | int optionaldeclare; |
---|
| 257 | int VarType; |
---|
| 258 | int VarTypepar; |
---|
| 259 | int VariableIsParameter; |
---|
| 260 | int dimsgiven; |
---|
| 261 | int shouldincludempif; |
---|
| 262 | int c_star; |
---|
| 263 | char DeclType[LONG_C]; |
---|
| 264 | char nameinttypename[LONG_C]; |
---|
| 265 | char nameinttypenameback[LONG_C]; |
---|
| 266 | int GlobalDeclaration; |
---|
[3294] | 267 | int GlobalDeclarationType; |
---|
[1901] | 268 | char InitValue[LONG_4C]; |
---|
| 269 | char IntentSpec[LONG_C]; |
---|
| 270 | char NamePrecision[LONG_C]; |
---|
| 271 | char CharacterSize[LONG_C]; |
---|
| 272 | char curmodulename[LONG_C]; |
---|
| 273 | char vallengspec[LONG_C]; |
---|
| 274 | char subroutinename[LONG_C]; |
---|
[2715] | 275 | int isrecursive; |
---|
| 276 | char previoussubroutinename[LONG_C]; |
---|
[1901] | 277 | |
---|
| 278 | /******************************************************************************/ |
---|
| 279 | /**************** *** CONV Variables *** **********************************/ |
---|
| 280 | /******************************************************************************/ |
---|
| 281 | int dimprob ; /* dimension of the problem : 1 for 1D,2 for 2D, */ |
---|
| 282 | /* 3 for 3D */ |
---|
| 283 | int onlyfixedgrids; /* = 1 if onlyfixedgrids is true */ |
---|
| 284 | int todebug; |
---|
| 285 | int mark; |
---|
| 286 | int todebugfree; |
---|
| 287 | int fixedgrids; /* = 1 if fixedgrids is true */ |
---|
| 288 | char nbmaillesX[LONG_C]; /* number of cells in the x direction */ |
---|
| 289 | char nbmaillesY[LONG_C]; /* number of cells in the y direction */ |
---|
| 290 | char nbmaillesZ[LONG_C]; /* number of cells in the z direction */ |
---|
| 291 | int IndicenbmaillesX; |
---|
| 292 | int IndicenbmaillesY; |
---|
| 293 | int IndicenbmaillesZ; |
---|
| 294 | |
---|
| 295 | int inmodulemeet; |
---|
| 296 | int incalldeclare; |
---|
| 297 | int aftercontainsdeclare; /* Signale si l'on vient d'un contains ou non */ |
---|
| 298 | int retour77; |
---|
| 299 | int colnum; |
---|
| 300 | int callagrifinitgrids; |
---|
| 301 | int callmpiinit; |
---|
| 302 | int firstpass; |
---|
| 303 | int couldaddvariable; |
---|
| 304 | int pointedvar; |
---|
| 305 | int NbMailleXDefined; |
---|
| 306 | int agrif_parentcall; |
---|
| 307 | int didvariableadded; |
---|
| 308 | int SubloopScalar; /* = 1 we should put in argument of sub_loop */ |
---|
| 309 | /* only */ |
---|
| 310 | /* scalar and not table u(1,1,1) in place of u */ |
---|
| 311 | int checkexistcommon; |
---|
| 312 | int insubroutinedeclare; |
---|
[2715] | 313 | int ininterfacedeclare; |
---|
[1901] | 314 | int inmoduledeclare; |
---|
| 315 | int dimsempty; |
---|
| 316 | int created_dimensionlist; |
---|
[2715] | 317 | int incontainssubroutine; |
---|
[1901] | 318 | |
---|
| 319 | char meetagrifinitgrids[LONG_C]; |
---|
| 320 | char mpiinitvar[LONG_C]; |
---|
| 321 | char *NameTamponfile; |
---|
| 322 | char toprintglob[LONG_4C]; |
---|
| 323 | char tmpvargridname[LONG_4C]; |
---|
| 324 | char EmptyChar[2]; /* An empty char */ |
---|
| 325 | char curfilename[LONG_C]; |
---|
| 326 | char nomfileoutput[LONG_C]; |
---|
| 327 | char curbuf[LONG_40M]; |
---|
| 328 | char motparse[LONG_4C]; |
---|
| 329 | char motparse1[LONG_4C]; |
---|
| 330 | char charusemodule[LONG_C]; |
---|
| 331 | char subofagrifinitgrids[LONG_C]; |
---|
| 332 | char curfile[LONG_C]; |
---|
| 333 | char mainfile[LONG_C]; |
---|
| 334 | char nomdir[LONG_C]; |
---|
| 335 | char commondirout[LONG_C]; |
---|
| 336 | char commondirin[LONG_C]; |
---|
| 337 | char filetoparse[LONG_C]; |
---|
| 338 | |
---|
| 339 | FILE *fortranout; /* Output File */ |
---|
| 340 | FILE *fortranin; /* Input File */ |
---|
| 341 | FILE *oldfortranout; |
---|
| 342 | FILE *subloop; |
---|
| 343 | FILE *module_declar; |
---|
[3294] | 344 | FILE *module_declar_type; |
---|
[1901] | 345 | FILE *allocationagrif; |
---|
| 346 | FILE *paramout; |
---|
| 347 | |
---|
| 348 | long int pos_cur; /* current position in the output file */ |
---|
| 349 | long int pos_curagrifparent; |
---|
| 350 | /* current position in the output file */ |
---|
| 351 | long int pos_curcall; /* current position in the output file */ |
---|
| 352 | long int pos_curuse; /* current position in the output file */ |
---|
| 353 | long int pos_curuseold; /* current position in the output file */ |
---|
| 354 | long int pos_curfunction; /* current position in the output file */ |
---|
| 355 | long int pos_cur_decl; /* current position in the output file */ |
---|
| 356 | long int pos_curdata; /* current position in the output file */ |
---|
| 357 | long int pos_curparameter;/* current position in the output file */ |
---|
| 358 | long int pos_curcommon; /* current position in the output file */ |
---|
| 359 | long int pos_cursave; /* current position in the output file */ |
---|
| 360 | long int pos_curdimension;/* current position in the output file */ |
---|
| 361 | long int pos_curinit; /* current position in the output file */ |
---|
| 362 | long int pos_curinclude; /* final position of a line in file */ |
---|
| 363 | long int pos_end; /* final position of a line in file */ |
---|
| 364 | long int pos_endsubroutine; |
---|
| 365 | /* final position of a line in file */ |
---|
| 366 | |
---|
| 367 | /* v_oldname = v_nomvar; */ |
---|
| 368 | /* commonvar = v_nomvar; */ |
---|
| 369 | /* commonblockname = v_commonname;*/ |
---|
| 370 | /* sameagrifname = v_nomvar ; */ |
---|
| 371 | /* DeclType = v_typevar; */ |
---|
| 372 | /* nameinttypename = v_nameinttypename; */ |
---|
| 373 | /* IntentSpec = v_IntentSpec; */ |
---|
| 374 | /* NamePrecision = v_precision; */ |
---|
| 375 | /* CharacterSize = v_dimchar; */ |
---|
| 376 | /* curmodulename = v_modulename; */ |
---|
| 377 | /* vallengspec = v_vallengspec; */ |
---|
| 378 | /* subroutinename = v_subroutinename; */ |
---|
| 379 | /* meetagrifinitgrids = v_subroutinename; */ |
---|
| 380 | /* nbmaillesX = v_nomvar; */ |
---|
| 381 | /* nbmaillesY = v_nomvar; */ |
---|
| 382 | /* nbmaillesZ = v_nomvar; */ |
---|
| 383 | /* mpiinitvar = v_nomvar; */ |
---|
| 384 | /* EmptyChar = 2; */ |
---|
| 385 | /* motparse1 = motparse;*/ |
---|
| 386 | /* charusemodule = p_modulename; */ |
---|
| 387 | /* subofagrifinitgrids = v_subroutinename; */ |
---|
| 388 | /* curfile = mainfile; */ |
---|
| 389 | /* InitValue = v_initialvalue; */ |
---|
| 390 | |
---|
| 391 | /* p_name;???????? */ |
---|
| 392 | /* p_modulename; ?????????????*/ |
---|
| 393 | |
---|
| 394 | int length_last; |
---|
| 395 | int length_first; |
---|
| 396 | int length_v_typevar; |
---|
| 397 | int length_v_nomvar; |
---|
| 398 | int length_v_dimchar; |
---|
| 399 | int length_v_modulename; |
---|
| 400 | int length_v_commonname; |
---|
| 401 | int length_v_vallengspec; |
---|
| 402 | int length_v_nameinttypename; |
---|
| 403 | int length_v_commoninfile; |
---|
| 404 | int length_v_subroutinename; |
---|
| 405 | int length_v_precision; |
---|
| 406 | int length_v_IntentSpec; |
---|
| 407 | int length_v_initialvalue; |
---|
| 408 | int length_v_readedlistdimension; |
---|
| 409 | int length_u_usemodule; |
---|
| 410 | int length_u_charusemodule; |
---|
| 411 | int length_u_cursubroutine; |
---|
| 412 | int length_u_modulename; |
---|
| 413 | int length_n_name; |
---|
| 414 | int length_c_namevar; |
---|
| 415 | int length_c_namepointedvar; |
---|
| 416 | int length_o_nom; |
---|
| 417 | int length_o_module; |
---|
| 418 | int length_a_nomvar; |
---|
| 419 | int length_a_subroutine; |
---|
| 420 | int length_a_module; |
---|
| 421 | int length_t_usemodule; |
---|
| 422 | int length_t_cursubroutine; |
---|
| 423 | int length_curfilename; |
---|
| 424 | int length_nomfileoutput; |
---|
| 425 | int length_motparse; |
---|
| 426 | int length_mainfile; |
---|
| 427 | int length_nomdir; |
---|
| 428 | int length_commondirout; |
---|
| 429 | int length_commondirin; |
---|
| 430 | int length_filetoparse; |
---|
| 431 | int length_curbuf; |
---|
| 432 | int length_toprintglob; |
---|
| 433 | int length_tmpvargridname; |
---|
| 434 | int length_ligne_Subloop; |
---|
| 435 | int length_lvargridname_toamr; |
---|
| 436 | int length_toprint_utilagrif; |
---|
| 437 | int length_toprinttmp_utilchar; |
---|
| 438 | int length_ligne_writedecl; |
---|
| 439 | int length_newname_toamr; |
---|
| 440 | int length_newname_writedecl; |
---|
| 441 | int length_ligne_toamr; |
---|
| 442 | int length_tmpligne_writedecl; |
---|
| 443 | int value_char_size; |
---|
| 444 | int value_char_size1; |
---|
| 445 | int value_char_size2; |
---|
| 446 | int value_char_size3; |
---|
| 447 | |
---|
| 448 | |
---|
| 449 | int inallocate; |
---|
| 450 | int infixed; |
---|
| 451 | int infree; |
---|
| 452 | /******************************************************************************/ |
---|
| 453 | /*********** Declaration of externals subroutines *****************************/ |
---|
| 454 | /***************************************************** ************************/ |
---|
| 455 | /******************************************************************************/ |
---|
| 456 | /*********** convert.y ********************************************************/ |
---|
| 457 | /******************************************************************************/ |
---|
| 458 | extern int main(int argc,char *argv[]); |
---|
| 459 | /******************************************************************************/ |
---|
| 460 | /*********** fortran.y ********************************************************/ |
---|
| 461 | /******************************************************************************/ |
---|
| 462 | extern void processfortran(char *fichier_entree); |
---|
| 463 | /******************************************************************************/ |
---|
| 464 | /*********** dependfile.c *****************************************************/ |
---|
| 465 | /******************************************************************************/ |
---|
| 466 | extern void Writethedependnbxnbyfile(); |
---|
| 467 | extern void Readthedependnbxnbyfile(); |
---|
| 468 | extern void Writethedependlistofmoduleused(char *NameTampon ); |
---|
| 469 | extern void Readthedependlistofmoduleused(char *NameTampon); |
---|
| 470 | extern void WritedependParameterList(char *NameTampon ); |
---|
| 471 | extern listparameter *ReaddependParameterList(char *NameTampon, |
---|
| 472 | listparameter *listout); |
---|
| 473 | extern void Writethedependfile(char *NameTampon, listvar *input ); |
---|
| 474 | extern listvar *Readthedependfile( char *NameTampon , listvar *listout); |
---|
| 475 | extern void Write_Subroutine_For_Alloc(); |
---|
| 476 | extern void Read_Subroutine_For_Alloc(); |
---|
| 477 | extern void Writethedependavailablefile(); |
---|
| 478 | extern void Readthedependavailablefile(); |
---|
| 479 | extern int Did_filetoparse_readed(char *NameTampon); |
---|
| 480 | extern int Did_module_common_treaded(char *NameTampon); |
---|
| 481 | extern void Write_val_max(); |
---|
| 482 | extern void Read_val_max(); |
---|
| 483 | /******************************************************************************/ |
---|
| 484 | /*********** DiversListe.c ****************************************************/ |
---|
| 485 | /******************************************************************************/ |
---|
| 486 | extern void Add_Common_var_1(); |
---|
| 487 | extern listnom *Addtolistnom(char *nom, listnom *listin,int value); |
---|
| 488 | extern listname *Addtolistname(char *nom,listname *input); |
---|
| 489 | extern int ModuleIsDefineInInputFile(char *name); |
---|
| 490 | extern void Addmoduletothelisttmp(char *name); |
---|
| 491 | extern void Add_NameOfModule_1(char *nom); |
---|
[2715] | 492 | extern void Add_NameOfCommon_1(char *nom,char *cursubroutinename); |
---|
[1901] | 493 | extern void Add_CouplePointed_Var_1(char *namemodule,listcouple *couple); |
---|
| 494 | extern void Add_Include_1(char *name); |
---|
| 495 | extern void Add_ImplicitNoneSubroutine_1(); |
---|
| 496 | extern void WriteIncludeDeclaration(); |
---|
| 497 | extern void Add_Save_Var_1 (char *name,listdim *d); |
---|
| 498 | extern void Add_Save_Var_dcl_1 (listvar *var); |
---|
| 499 | /******************************************************************************/ |
---|
| 500 | /*********** SubLoopCreation.c ************************************************/ |
---|
| 501 | /******************************************************************************/ |
---|
| 502 | extern void writeheadnewsub_0(); |
---|
[2715] | 503 | extern void WriteVariablelist_subloop(FILE *outputfile,char *ligne); |
---|
| 504 | extern void WriteVariablelist_subloop_Call(FILE *outputfile,char *ligne); |
---|
| 505 | extern void WriteVariablelist_subloop_Def(FILE *outputfile,char *ligne); |
---|
[1901] | 506 | extern void WriteHeadofSubroutineLoop(); |
---|
| 507 | extern void closeandcallsubloopandincludeit_0(int suborfun); |
---|
| 508 | extern void closeandcallsubloop_contains_0(); |
---|
| 509 | /******************************************************************************/ |
---|
| 510 | /*********** toamr.c **********************************************************/ |
---|
| 511 | /******************************************************************************/ |
---|
| 512 | extern char *variablenameroottabvars (variable * var); |
---|
| 513 | extern char *variablenametabvars (variable * var, int iorindice); |
---|
| 514 | extern char *variablecurgridtabvars (variable * var,int ParentOrCurgrid); |
---|
| 515 | extern void WARNING_CharSize(variable *var); |
---|
| 516 | extern char *vargridnametabvars (variable * var,int iorindice); |
---|
| 517 | extern char *vargridcurgridtabvars (variable * var,int ParentOrCurgrid); |
---|
| 518 | extern char *vargridcurgridtabvarswithoutAgrif_Gr (variable * var); |
---|
| 519 | extern char *vargridparam (variable * v, int whichone); |
---|
| 520 | extern void write_probdimagrif_file(); |
---|
| 521 | extern void write_keysagrif_file(); |
---|
| 522 | extern void write_modtypeagrif_file(); |
---|
| 523 | extern void write_createvarnameagrif_file(variable *v,FILE *createvarname, |
---|
| 524 | int *InitEmpty); |
---|
| 525 | extern void write_Setnumberofcells_file(); |
---|
| 526 | extern void write_Getnumberofcells_file(); |
---|
| 527 | extern void write_initialisationsagrif_file(variable *v,FILE *initproc, |
---|
| 528 | int *VarnameEmpty); |
---|
| 529 | extern void Write_Alloc_Agrif_Files(); |
---|
| 530 | extern int IndiceInlist(int indic, listindice *listin); |
---|
| 531 | extern void write_allocation_Common_0(); |
---|
| 532 | extern void write_allocation_Global_0(); |
---|
| 533 | extern void creefichieramr (char *NameTampon); |
---|
| 534 | /******************************************************************************/ |
---|
| 535 | /*********** UtilAgrif.c ******************************************************/ |
---|
| 536 | /******************************************************************************/ |
---|
| 537 | extern int Vartonumber(char *tokname); |
---|
| 538 | extern int Agrif_in_Tok_NAME(char *tokname); |
---|
| 539 | extern void ModifyTheVariableName_0(char *ident,int lengthname); |
---|
| 540 | extern void Add_SubroutineWhereAgrifUsed_1(char *sub,char *mod); |
---|
| 541 | extern void AddUseAgrifUtil_0(FILE *fileout); |
---|
| 542 | extern void AddUseAgrifUtilBeforeCall_0(FILE *fileout); |
---|
| 543 | extern void NotifyAgrifFunction_0(char *ident); |
---|
| 544 | extern void ModifyTheAgrifFunction_0(char *ident); |
---|
| 545 | extern void AgriffunctionModify_0(char *ident,int whichone); |
---|
| 546 | extern void Instanciation_0(char *ident); |
---|
| 547 | /******************************************************************************/ |
---|
| 548 | /*********** UtilCharacter.c **************************************************/ |
---|
| 549 | /******************************************************************************/ |
---|
| 550 | extern void FindAndChangeNameToTabvars(char name[LONG_C],char toprint[LONG_4C], |
---|
| 551 | listvar * listtosee, int whichone); |
---|
| 552 | extern char *ChangeTheInitalvaluebyTabvarsName(char *nom,listvar *listtoread, |
---|
| 553 | int whichone); |
---|
| 554 | extern int IsVariableReal(char *nom); |
---|
| 555 | extern void IsVarInUseFile(char *nom); |
---|
| 556 | extern listnom *DecomposeTheNameinlistnom(char *nom, listnom * listout); |
---|
| 557 | extern void DecomposeTheName(char *nom); |
---|
| 558 | extern void convert2lower(char *name); |
---|
| 559 | extern int convert2int(char *name); |
---|
| 560 | /******************************************************************************/ |
---|
| 561 | /*********** UtilFile.c *******************************************************/ |
---|
| 562 | /******************************************************************************/ |
---|
| 563 | extern FILE * associate (char *filename); |
---|
| 564 | extern FILE * associateaplus (char *filename); |
---|
| 565 | extern long int setposcur(); |
---|
| 566 | extern long int setposcurname(FILE *fileout); |
---|
| 567 | extern long int setposcurinoldfortranout(); |
---|
| 568 | extern void copyuse_0(char *namemodule); |
---|
| 569 | extern void copyuseonly_0(char *namemodule); |
---|
| 570 | /******************************************************************************/ |
---|
| 571 | /*********** UtilFortran.c ****************************************************/ |
---|
| 572 | /******************************************************************************/ |
---|
| 573 | extern void initdimprob(int dimprobmod, char * nx, char * ny,char* nz); |
---|
| 574 | extern int Variableshouldberemove(char *nom); |
---|
| 575 | extern int variableisglobal(listvar *curvar, listvar *listin); |
---|
| 576 | extern int VariableIsInListCommon(listvar *curvar,listvar *listin); |
---|
| 577 | extern int VariableIsInList(listvar *curvar,listvar *listin); |
---|
| 578 | extern void variableisglobalinmodule(listcouple *listin, char *module, |
---|
| 579 | FILE *fileout,long int oldposcuruse); |
---|
| 580 | extern void Remove_Word_Contains_0(); |
---|
| 581 | extern void Remove_Word_end_module_0(int modulenamelength); |
---|
| 582 | extern void Write_Word_Contains_0(); |
---|
| 583 | extern void Write_Word_end_module_0(); |
---|
| 584 | extern void Add_Subroutine_For_Alloc(char *nom); |
---|
| 585 | extern void Write_Alloc_Subroutine_0(); |
---|
| 586 | extern void Write_Alloc_Subroutine_For_End_0(); |
---|
| 587 | extern void Write_GlobalParameter_Declaration_0(); |
---|
| 588 | extern void Write_GlobalType_Declaration_0(); |
---|
| 589 | extern void Write_NotGridDepend_Declaration_0(); |
---|
| 590 | extern int IsTabvarsUseInArgument_0(); |
---|
| 591 | extern int ImplicitNoneInSubroutine(); |
---|
| 592 | extern void Add_Pointer_Var_From_List_1(listvar *listin); |
---|
| 593 | extern void Add_Pointer_Var_1(char *nom); |
---|
| 594 | extern int varispointer_0(char *ident); |
---|
| 595 | extern int VariableIsNotFunction(char *ident); |
---|
| 596 | extern int varistyped_0(char *ident); |
---|
| 597 | /******************************************************************************/ |
---|
| 598 | /*********** UtilListe.c ******************************************************/ |
---|
| 599 | /******************************************************************************/ |
---|
| 600 | extern void Init_Variable(variable *var); |
---|
| 601 | extern listvar * AddListvarToListvar(listvar *l,listvar *glob, |
---|
| 602 | int ValueFirstpass); |
---|
| 603 | extern void CreateAndFillin_Curvar(char *type,variable *curvar); |
---|
| 604 | extern void duplicatelistvar(listvar *orig); |
---|
| 605 | extern listdim * insertdim(listdim *lin,typedim nom); |
---|
| 606 | extern void change_dim_char(listdim *lin,listvar * l); |
---|
| 607 | extern int num_dims(listdim *d); |
---|
| 608 | extern variable * createvar(char *nom,listdim *d); |
---|
| 609 | extern listvar * insertvar(listvar *lin,variable *v); |
---|
| 610 | extern listvar *settype(char *nom,listvar *lin); |
---|
| 611 | extern void printliste(listvar * lin); |
---|
| 612 | extern int IsinListe(listvar *lin,char *nom); |
---|
[2715] | 613 | extern listname *Insertname(listname *lin,char *nom,int sens); |
---|
| 614 | extern listname *concat_listname(listname *l1, listname *l2); |
---|
| 615 | extern void *createstringfromlistname(char *ligne, listname *lin); |
---|
[1901] | 616 | extern void printname(listname * lin); |
---|
| 617 | extern void removeglobfromlist(listname **lin); |
---|
| 618 | extern void writelistpublic(listname *lin); |
---|
[2715] | 619 | extern void Init_List_Data_Var(); |
---|
[1901] | 620 | /******************************************************************************/ |
---|
| 621 | /*********** UtilNotGridDep.c *************************************************/ |
---|
| 622 | /******************************************************************************/ |
---|
| 623 | extern void Add_NotGridDepend_Var_1 (char *name); |
---|
| 624 | extern int VarIsNonGridDepend(char *name); |
---|
| 625 | /******************************************************************************/ |
---|
| 626 | /*********** WorkWithAllocatelist.c *******************************************/ |
---|
| 627 | /******************************************************************************/ |
---|
| 628 | extern void Add_Allocate_Var_1(char *nom,char *nommodule); |
---|
| 629 | extern int IsVarAllocatable_0(char *ident); |
---|
| 630 | extern int varisallocatable_0(char *ident); |
---|
| 631 | /******************************************************************************/ |
---|
| 632 | /*********** WorkWithglobliste.c **********************************************/ |
---|
| 633 | /******************************************************************************/ |
---|
| 634 | extern void Add_Globliste_1(listvar *listtoadd); |
---|
| 635 | extern void Add_SubroutineDeclarationSave_Var_1(listvar *listtoadd); |
---|
| 636 | extern void checkandchangedims(listvar *listsecondpass); |
---|
| 637 | /******************************************************************************/ |
---|
| 638 | /*********** WorkWithlistdatavariable.c ***************************************/ |
---|
| 639 | /******************************************************************************/ |
---|
[2715] | 640 | extern void Add_Data_Var_1 (listvar **curlist,char *name,char *values); |
---|
| 641 | extern void Add_Data_Var_Names_01 (listvar **curlist,listname *l1, listname *l2); |
---|
[1901] | 642 | /******************************************************************************/ |
---|
| 643 | /*********** WorkWithlistmoduleinfile.c ***************************************/ |
---|
| 644 | /******************************************************************************/ |
---|
| 645 | extern void Save_Length(char *nom, int whichone); |
---|
| 646 | extern void Save_Length_int(int val, int whichone); |
---|
| 647 | /******************************************************************************/ |
---|
| 648 | /*********** WorkWithlistofmodulebysubroutine.c *******************************/ |
---|
| 649 | /******************************************************************************/ |
---|
| 650 | extern void RecordUseModulesVariables(); |
---|
| 651 | extern void RecordUseModulesUseModulesVariables(); |
---|
| 652 | extern void Add_NameOfModuleUsed_1(char *name); |
---|
| 653 | extern void Addmoduletothelist(char *name); |
---|
[2715] | 654 | extern void WriteUsemoduleDeclaration(char *cursubroutinename); |
---|
[1901] | 655 | /******************************************************************************/ |
---|
| 656 | /*********** WorkWithlistvarindoloop.c ****************************************/ |
---|
| 657 | /******************************************************************************/ |
---|
| 658 | extern void Add_UsedInSubroutine_Var_1 (char *ident); |
---|
| 659 | extern void ajoutevarindoloop_definedimension (char *name); |
---|
| 660 | extern void ModifyThelistvarindoloop(); |
---|
| 661 | extern void CompleteThelistvarindoloop(); |
---|
| 662 | extern void CopyRecord(variable *var1,variable *var2); |
---|
| 663 | extern void Update_List_Subroutine_Var(listvar *list_to_modify); |
---|
| 664 | extern void Update_List_Global_Var_From_List_Save_Var(); |
---|
| 665 | extern void Update_List_From_Common_Var(listvar *list_to_modify); |
---|
| 666 | extern void Update_List_Var(listvar *list_to_modify); |
---|
| 667 | extern void List_UsedInSubroutine_Var_Update_From_Module_Used(); |
---|
| 668 | extern void Update_NotGridDepend_Var(listvar *list_to_modify); |
---|
| 669 | extern int LookingForVariableInList(listvar *listin,variable *var); |
---|
| 670 | extern int LookingForVariableInListGlobal(listvar *listin,variable *var); |
---|
| 671 | extern int LookingForVariableInListName(listvar *listin,char *var); |
---|
| 672 | extern int LookingForVariableInListGlob(listvar *listin,variable *var); |
---|
| 673 | extern int LookingForVariableInListParamGlob(listparameter *listin, |
---|
| 674 | variable *var); |
---|
| 675 | extern void UpdateListDeclarationWithDimensionList(); |
---|
| 676 | extern void Clean_List_UsedInSubroutine_Var(); |
---|
| 677 | extern void Clean_List_SubroutineDeclaration_Var(); |
---|
| 678 | extern void Clean_List_Global_Var(); |
---|
| 679 | extern void ListClean(); |
---|
| 680 | extern void ListUpdate(); |
---|
| 681 | extern void GiveTypeOfVariables(); |
---|
| 682 | extern void Sort_List_SubroutineArgument_Var(); |
---|
| 683 | extern void IndiceTabvars_Global_Var_Treated(char *nom); |
---|
| 684 | extern void IndiceTabvars_Global_Var_No_Treated(char *nom); |
---|
| 685 | extern void UpdateTheRemainingList(listvar *record); |
---|
| 686 | extern void IndiceTabvars_Common_Var_Treated(char *nom); |
---|
| 687 | extern void IndiceTabvars_Common_Var_No_Treated(char *nom); |
---|
| 688 | extern void IndiceTabvarsIdentification(); |
---|
| 689 | extern void New_Allocate_Subroutine_Is_Necessary(); |
---|
| 690 | extern void New_Allocate_Subroutine_For_Common_Is_Necessary(); |
---|
| 691 | extern void NewModule_Creation_0(); |
---|
| 692 | extern void UpdateList_SubroutineWhereAgrifUsed(); |
---|
| 693 | extern void UpdateList_UsedInSubroutine_With_dimension(); |
---|
| 694 | extern void Affiche(); |
---|
| 695 | extern int SubInList_ContainsSubroutine(); |
---|
| 696 | /******************************************************************************/ |
---|
| 697 | /*********** WorkWithParameterlist.c ******************************************/ |
---|
| 698 | /******************************************************************************/ |
---|
| 699 | extern void Add_GlobalParameter_Var_1(listvar *listin); |
---|
| 700 | extern void Add_Parameter_Var_1(listvar *listin); |
---|
| 701 | extern void Add_Dimension_Var_1(listvar *listin); |
---|
| 702 | /******************************************************************************/ |
---|
| 703 | /*********** WorkWithvarofsubroutineliste.c ***********************************/ |
---|
| 704 | /******************************************************************************/ |
---|
| 705 | extern void Add_SubroutineArgument_Var_1(listvar *listtoadd); |
---|
| 706 | extern void Add_FunctionType_Var_1(char *nom); |
---|
| 707 | extern void Add_SubroutineDeclaration_Var_1 (listvar *listtoadd); |
---|
| 708 | /******************************************************************************/ |
---|
| 709 | /*********** Writedeclarations.c **********************************************/ |
---|
| 710 | /******************************************************************************/ |
---|
| 711 | extern void WriteBeginDeclaration(variable *v,char ligne[LONG_4C],int visibility); |
---|
| 712 | extern void WriteScalarDeclaration(variable *v,char ligne[LONG_4C]); |
---|
| 713 | extern void WriteTableDeclaration(variable * v,char ligne[LONG_4C],int tmpok); |
---|
| 714 | extern void writevardeclaration (listvar * var_record, FILE *fileout, |
---|
| 715 | int value,int visibility); |
---|
| 716 | extern void WriteLocalParamDeclaration(); |
---|
| 717 | extern void WriteFunctionDeclaration(int value); |
---|
| 718 | extern void WriteSubroutineDeclaration(int value); |
---|
| 719 | extern void WriteArgumentDeclaration_beforecall(); |
---|
| 720 | extern void WriteArgumentDeclaration_Sort(); |
---|
| 721 | extern listnom *writedeclarationintoamr (listvar * deb_common, FILE *fileout, |
---|
| 722 | variable *var , char commonname[LONG_C], |
---|
| 723 | listnom *neededparameter, char name_common[LONG_C]); |
---|
| 724 | extern void writesub_loopdeclaration_scalar (listvar * deb_common, |
---|
| 725 | FILE *fileout); |
---|
| 726 | extern void writesub_loopdeclaration_tab (listvar * deb_common, FILE *fileout); |
---|
| 727 | extern void ReWriteDeclarationAndAddTosubroutine_01(listvar *listdecl); |
---|
[2715] | 728 | extern void ReWriteDataStatement_0(FILE * filout); |
---|
[1901] | 729 | /******************************************************************************/ |
---|
| 730 | /*********** WriteInFile.c ****************************************************/ |
---|
| 731 | /******************************************************************************/ |
---|
| 732 | extern void tofich_reste (FILE * filout, char *s,int returnlineornot); |
---|
| 733 | extern void tofich (FILE * filout, char *s, int returnlineornot); |
---|
| 734 | extern void tofich_blanc (FILE * filout, int size); |
---|
| 735 | extern void tofich_line (FILE * filout, int size, int long position); |
---|
| 736 | extern void RemoveWordSET_0(FILE * filout, long int position, |
---|
| 737 | long int sizetoremove); |
---|
| 738 | extern void RemoveWordCUR_0(FILE * filout, long int position, |
---|
| 739 | long int sizetoremove); |
---|
| 740 | |
---|
| 741 | /******************************************************************************/ |
---|
| 742 | /*********** WorkWithlistofcoupled.c **********************************************/ |
---|
| 743 | /******************************************************************************/ |
---|
| 744 | extern int variscoupled_0(char *ident) ; |
---|
| 745 | extern char * getcoupledname_0(char *ident); |
---|
| 746 | extern void ModifyTheVariableNamecoupled_0(char *ident, char* coupledident); |
---|