decl.h 32 KB

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