[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 | #include <stdio.h> |
---|
| 36 | #include <stdlib.h> |
---|
| 37 | #include <string.h> |
---|
| 38 | #include "decl.h" |
---|
| 39 | |
---|
| 40 | /******************************************************************************/ |
---|
| 41 | /* Add_Globliste_1 */ |
---|
| 42 | /******************************************************************************/ |
---|
| 43 | /* Firstpass 1 */ |
---|
| 44 | /* We should add this declaration to the List_Global_Var */ |
---|
| 45 | /******************************************************************************/ |
---|
| 46 | void Add_Globliste_1(listvar *listtoadd) |
---|
| 47 | { |
---|
| 48 | if ( firstpass == 1 ) |
---|
| 49 | { |
---|
| 50 | if ( aftercontainsdeclare == 0 && |
---|
| 51 | VariableIsParameter == 0 ) |
---|
| 52 | { |
---|
| 53 | List_Global_Var = AddListvarToListvar(listtoadd,List_Global_Var,1); |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | /******************************************************************************/ |
---|
| 59 | /* Add_SubroutineDeclarationSave_Var_1 */ |
---|
| 60 | /******************************************************************************/ |
---|
| 61 | /* Firstpass 1 */ |
---|
| 62 | /* We should add this declaration to the List_Global_Var. case SAVE */ |
---|
| 63 | /******************************************************************************/ |
---|
| 64 | void Add_SubroutineDeclarationSave_Var_1(listvar *listtoadd) |
---|
| 65 | { |
---|
| 66 | if ( firstpass == 1 ) |
---|
| 67 | { |
---|
| 68 | if ( VariableIsParameter == 0 && |
---|
| 69 | SaveDeclare == 1 ) |
---|
| 70 | { |
---|
| 71 | List_Global_Var = AddListvarToListvar(listtoadd,List_Global_Var,1); |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | void checkandchangedims(listvar *listsecondpass) |
---|
| 77 | { |
---|
| 78 | listvar *parcours; |
---|
| 79 | listvar *parcours1; |
---|
| 80 | variable * newvar; |
---|
| 81 | variable * oldvar; |
---|
| 82 | |
---|
| 83 | int out ; |
---|
| 84 | |
---|
| 85 | printliste(List_Global_Var); |
---|
| 86 | printliste(List_SubroutineDeclaration_Var); |
---|
| 87 | |
---|
| 88 | parcours = listsecondpass; |
---|
| 89 | while (parcours) |
---|
| 90 | { |
---|
| 91 | newvar = parcours->var; |
---|
| 92 | parcours1 = List_SubroutineDeclaration_Var; |
---|
| 93 | out = 0; |
---|
| 94 | while (parcours1 && out == 0) |
---|
| 95 | { |
---|
| 96 | oldvar = parcours1->var; |
---|
| 97 | if (!strcasecmp(newvar->v_nomvar,oldvar->v_nomvar) && !strcasecmp(newvar->v_subroutinename,subroutinename)) |
---|
| 98 | { |
---|
| 99 | if (newvar->v_dimensiongiven == 1) |
---|
| 100 | { |
---|
| 101 | strcpy(oldvar->v_dimension->dim.last,newvar->v_dimension->dim.last); |
---|
| 102 | strcpy(oldvar->v_dimension->dim.first,newvar->v_dimension->dim.first); |
---|
| 103 | } |
---|
| 104 | out = 1; |
---|
| 105 | } |
---|
| 106 | parcours1 = parcours1->suiv; |
---|
| 107 | } |
---|
| 108 | parcours = parcours->suiv; |
---|
| 109 | } |
---|
| 110 | printliste(List_SubroutineDeclaration_Var); |
---|
| 111 | } |
---|