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