[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 | /* Add_Data_Var_1 */ |
---|
| 41 | /******************************************************************************/ |
---|
| 42 | /* This subroutine is used to add a record to List_Data_Var */ |
---|
| 43 | /******************************************************************************/ |
---|
| 44 | /* _______ _______ _______ _______ _______ */ |
---|
| 45 | /* + + + + + + + + + + */ |
---|
| 46 | /* + NEW +--->+ data +--->+ data +--->+ data +--->+ data+ */ |
---|
| 47 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
| 48 | /* */ |
---|
| 49 | /******************************************************************************/ |
---|
[2715] | 50 | void Add_Data_Var_1 (listvar **curlist,char *name,char *values) |
---|
[1901] | 51 | { |
---|
| 52 | listvar *newvar; |
---|
[2715] | 53 | char ligne[LONG_C]; |
---|
[1901] | 54 | |
---|
[2715] | 55 | // if ( firstpass == 1 ) |
---|
| 56 | // { |
---|
[1901] | 57 | newvar=(listvar *)malloc(sizeof(listvar)); |
---|
| 58 | newvar->var=(variable *)malloc(sizeof(variable)); |
---|
| 59 | /* */ |
---|
| 60 | Init_Variable(newvar->var); |
---|
| 61 | /* */ |
---|
| 62 | if ( inmoduledeclare == 1 ) newvar->var->v_module=1; |
---|
| 63 | strcpy(newvar->var->v_nomvar,name); |
---|
| 64 | Save_Length(name,4); |
---|
| 65 | strcpy(newvar->var->v_subroutinename,subroutinename); |
---|
| 66 | Save_Length(subroutinename,11); |
---|
| 67 | strcpy(newvar->var->v_modulename,curmodulename); |
---|
| 68 | Save_Length(curmodulename,6); |
---|
| 69 | strcpy(newvar->var->v_commoninfile,mainfile); |
---|
| 70 | Save_Length(mainfile,10); |
---|
[2715] | 71 | if (strchr(values,',') && strncasecmp(values,"'",1)) |
---|
| 72 | { |
---|
| 73 | sprintf(ligne,"(/%s/)",values); |
---|
| 74 | } |
---|
| 75 | else |
---|
| 76 | strcpy(ligne,values); |
---|
| 77 | |
---|
| 78 | strcpy(newvar->var->v_initialvalue,ligne); |
---|
| 79 | Save_Length(ligne,14); |
---|
[1901] | 80 | newvar->suiv = NULL; |
---|
[2715] | 81 | if ( ! (*curlist) ) |
---|
| 82 | { |
---|
| 83 | *curlist = newvar ; |
---|
| 84 | } |
---|
| 85 | else |
---|
| 86 | { |
---|
| 87 | newvar->suiv = *curlist; |
---|
| 88 | *curlist = newvar; |
---|
| 89 | } |
---|
| 90 | // } |
---|
| 91 | } |
---|
[1901] | 92 | |
---|
[2715] | 93 | void Add_Data_Var_Names_01 (listvar **curlist,listname *l1,listname *l2) |
---|
| 94 | { |
---|
| 95 | listvar *newvar; |
---|
| 96 | listvar *tmpvar; |
---|
| 97 | listname *tmpvar1; |
---|
| 98 | listname *tmpvar2; |
---|
| 99 | char ligne[LONG_C]; |
---|
| 100 | |
---|
| 101 | tmpvar1 = l1; |
---|
| 102 | tmpvar2 = l2; |
---|
| 103 | |
---|
| 104 | while (tmpvar1) |
---|
[1901] | 105 | { |
---|
[2715] | 106 | newvar=(listvar *)malloc(sizeof(listvar)); |
---|
| 107 | newvar->var=(variable *)malloc(sizeof(variable)); |
---|
| 108 | /* */ |
---|
| 109 | Init_Variable(newvar->var); |
---|
| 110 | /* */ |
---|
| 111 | if ( inmoduledeclare == 1 ) newvar->var->v_module=1; |
---|
| 112 | strcpy(newvar->var->v_nomvar,tmpvar1->n_name); |
---|
| 113 | Save_Length(tmpvar1->n_name,4); |
---|
| 114 | strcpy(newvar->var->v_subroutinename,subroutinename); |
---|
| 115 | Save_Length(subroutinename,11); |
---|
| 116 | strcpy(newvar->var->v_modulename,curmodulename); |
---|
| 117 | Save_Length(curmodulename,6); |
---|
| 118 | strcpy(newvar->var->v_commoninfile,mainfile); |
---|
| 119 | Save_Length(mainfile,10); |
---|
| 120 | |
---|
| 121 | strcpy(newvar->var->v_initialvalue,tmpvar2->n_name); |
---|
| 122 | Save_Length(tmpvar2->n_name,14); |
---|
| 123 | newvar->suiv = NULL; |
---|
| 124 | |
---|
| 125 | if ( ! (*curlist) ) |
---|
| 126 | { |
---|
| 127 | *curlist = newvar ; |
---|
[1901] | 128 | } |
---|
| 129 | else |
---|
| 130 | { |
---|
[2715] | 131 | tmpvar = *curlist; |
---|
| 132 | while (tmpvar->suiv) |
---|
| 133 | tmpvar=tmpvar->suiv; |
---|
| 134 | tmpvar->suiv = newvar; |
---|
[1901] | 135 | } |
---|
[2715] | 136 | |
---|
| 137 | tmpvar1 = tmpvar1->suiv; |
---|
| 138 | tmpvar2 = tmpvar2->suiv; |
---|
[1901] | 139 | } |
---|
[2715] | 140 | return; |
---|
| 141 | |
---|
| 142 | |
---|
[1901] | 143 | } |
---|