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 | /******************************************************************************/ |
---|
50 | void Add_Data_Var_1 (listvar **curlist,char *name,char *values) |
---|
51 | { |
---|
52 | listvar *newvar; |
---|
53 | char ligne[LONG_M]; |
---|
54 | |
---|
55 | // if ( firstpass == 1 ) |
---|
56 | // { |
---|
57 | newvar=(listvar *)calloc(1,sizeof(listvar)); |
---|
58 | newvar->var=(variable *)calloc(1,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 | strcpy(newvar->var->v_subroutinename,subroutinename); |
---|
65 | strcpy(newvar->var->v_modulename,curmodulename); |
---|
66 | strcpy(newvar->var->v_commoninfile,cur_filename); |
---|
67 | if (strchr(values,',') && strncasecmp(values,"'",1)) |
---|
68 | sprintf(ligne,"(/%s/)",values); |
---|
69 | else |
---|
70 | strcpy(ligne,values); |
---|
71 | |
---|
72 | strcpy(newvar->var->v_initialvalue,ligne); |
---|
73 | Save_Length(ligne,14); |
---|
74 | newvar->suiv = NULL; |
---|
75 | if ( ! (*curlist) ) |
---|
76 | { |
---|
77 | *curlist = newvar ; |
---|
78 | } |
---|
79 | else |
---|
80 | { |
---|
81 | newvar->suiv = *curlist; |
---|
82 | *curlist = newvar; |
---|
83 | } |
---|
84 | // } |
---|
85 | } |
---|
86 | |
---|
87 | void Add_Data_Var_Names_01 (listvar **curlist,listname *l1,listname *l2) |
---|
88 | { |
---|
89 | listvar *newvar; |
---|
90 | listvar *tmpvar; |
---|
91 | listname *tmpvar1; |
---|
92 | listname *tmpvar2; |
---|
93 | variable *found_var = NULL; |
---|
94 | |
---|
95 | tmpvar1 = l1; |
---|
96 | tmpvar2 = l2; |
---|
97 | |
---|
98 | while (tmpvar1) |
---|
99 | { |
---|
100 | newvar = (listvar *) calloc(1,sizeof(listvar)); |
---|
101 | newvar->var = (variable *) calloc(1,sizeof(variable)); |
---|
102 | |
---|
103 | Init_Variable(newvar->var); |
---|
104 | |
---|
105 | if ( inmoduledeclare == 1 ) newvar->var->v_module=1; |
---|
106 | |
---|
107 | found_var = get_variable_in_list_from_name(List_Common_Var, tmpvar1->n_name); |
---|
108 | if ( ! found_var ) found_var = get_variable_in_list_from_name(List_Global_Var,tmpvar1->n_name); |
---|
109 | if ( ! found_var ) found_var = get_variable_in_list_from_name(List_SubroutineDeclaration_Var,tmpvar1->n_name); |
---|
110 | |
---|
111 | if ( found_var && found_var->v_nbdim > 0 ) |
---|
112 | { |
---|
113 | printf("##############################################################################################################\n"); |
---|
114 | printf("## CONV Error : arrays in data_stmt_object lists not yet supported. Please complain to the proper authorities.\n"); |
---|
115 | printf("## variable name : %s (in %s:%s:%s)\n", found_var->v_nomvar, found_var->v_modulename, |
---|
116 | found_var->v_subroutinename, found_var->v_commonname); |
---|
117 | exit(1); |
---|
118 | } |
---|
119 | |
---|
120 | strcpy(newvar->var->v_nomvar,tmpvar1->n_name); |
---|
121 | strcpy(newvar->var->v_subroutinename,subroutinename); |
---|
122 | strcpy(newvar->var->v_modulename,curmodulename); |
---|
123 | strcpy(newvar->var->v_commoninfile,cur_filename); |
---|
124 | strcpy(newvar->var->v_initialvalue,tmpvar2->n_name); |
---|
125 | |
---|
126 | Save_Length(tmpvar2->n_name,14); |
---|
127 | |
---|
128 | newvar->suiv = NULL; |
---|
129 | |
---|
130 | if ( *curlist != NULL ) |
---|
131 | { |
---|
132 | tmpvar = *curlist; |
---|
133 | while (tmpvar->suiv) |
---|
134 | tmpvar = tmpvar->suiv; |
---|
135 | tmpvar->suiv = newvar; |
---|
136 | } |
---|
137 | else |
---|
138 | { |
---|
139 | *curlist = newvar ; |
---|
140 | } |
---|
141 | |
---|
142 | tmpvar1 = tmpvar1->suiv; |
---|
143 | tmpvar2 = tmpvar2->suiv; |
---|
144 | } |
---|
145 | } |
---|