[396] | 1 | /******************************************************************************/ |
---|
| 2 | /* */ |
---|
| 3 | /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */ |
---|
| 4 | /* */ |
---|
| 5 | /* Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr) */ |
---|
| 6 | /* Cyril Mazauric (Cyril.Mazauric@imag.fr) */ |
---|
| 7 | /* */ |
---|
| 8 | /* This program is free software; you can redistribute it and/or modify */ |
---|
| 9 | /* it */ |
---|
| 10 | /* */ |
---|
| 11 | /* This program is distributed in the hope that it will be useful, */ |
---|
| 12 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
---|
| 13 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
---|
| 14 | /* GNU General Public License for more details. */ |
---|
| 15 | /* */ |
---|
| 16 | /******************************************************************************/ |
---|
| 17 | #include <stdio.h> |
---|
| 18 | #include <stdlib.h> |
---|
| 19 | #include <string.h> |
---|
| 20 | #include "decl.h" |
---|
| 21 | /******************************************************************************/ |
---|
| 22 | /* DATA_n_COMPLETEDATALIST */ |
---|
| 23 | /******************************************************************************/ |
---|
| 24 | /* This subroutine is used to add a record to listdatavariable */ |
---|
| 25 | /******************************************************************************/ |
---|
| 26 | /* _______ _______ _______ _______ _______ */ |
---|
| 27 | /* + + + + + + + + + + */ |
---|
| 28 | /* + NEW +--->+ data +--->+ data +--->+ data +--->+ data+ */ |
---|
| 29 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
| 30 | /* */ |
---|
| 31 | /******************************************************************************/ |
---|
| 32 | void DATA_n_CompleteDataList (char *name,char *values) |
---|
| 33 | { |
---|
| 34 | listvar *newvar; |
---|
| 35 | |
---|
| 36 | newvar=(listvar *)malloc(sizeof(listvar)); |
---|
| 37 | newvar->var=(variable *)malloc(sizeof(variable)); |
---|
| 38 | strcpy(newvar->var->nomvar,name); |
---|
| 39 | strcpy(newvar->var->initialvalue,values); |
---|
| 40 | newvar->suiv = NULL; |
---|
| 41 | |
---|
| 42 | if ( !listdatavariable ) |
---|
| 43 | { |
---|
| 44 | listdatavariable = newvar ; |
---|
| 45 | } |
---|
| 46 | else |
---|
| 47 | { |
---|
| 48 | newvar->suiv = listdatavariable; |
---|
| 49 | listdatavariable = newvar; |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | /******************************************************************************/ |
---|
| 55 | /* DATA_1_COMPLETEGLOBLISTEWITHDATALIST */ |
---|
| 56 | /******************************************************************************/ |
---|
| 57 | /* This subroutine is used to complete the variable initialisation */ |
---|
| 58 | /* in the globliste with the listdatavariable */ |
---|
| 59 | /******************************************************************************/ |
---|
| 60 | /* _______ _______ _______ _______ _______ */ |
---|
| 61 | /* + + + + + + + + + + */ |
---|
| 62 | /* + data +--->+ data +--->+ data +--->+ data +--->+ data + */ |
---|
| 63 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
| 64 | /* || */ |
---|
| 65 | /* || */ |
---|
| 66 | /* || */ |
---|
| 67 | /* || */ |
---|
| 68 | /* initialvalue */ |
---|
| 69 | /* || */ |
---|
| 70 | /* || */ |
---|
| 71 | /* _______ _______ __\/___ _______ _______ */ |
---|
| 72 | /* + + + + + + + + + + */ |
---|
| 73 | /* + glob +--->+ glob +--->+ glob +--->+ glob +--->+ glob + */ |
---|
| 74 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
| 75 | /* */ |
---|
| 76 | /******************************************************************************/ |
---|
| 77 | void DATA_1_CompleteGlobListeWithDatalist () |
---|
| 78 | { |
---|
| 79 | listvar *newvar; |
---|
| 80 | listvar *globlistetmp; |
---|
| 81 | int out; |
---|
| 82 | |
---|
| 83 | /* We are looking for each variable of the listdatavariable where */ |
---|
| 84 | /* are they located in the globliste */ |
---|
| 85 | newvar = listdatavariable; |
---|
| 86 | while ( newvar ) |
---|
| 87 | { |
---|
| 88 | globlistetmp = globliste; |
---|
| 89 | out = 0 ; |
---|
| 90 | while( globlistetmp && out == 0 ) |
---|
| 91 | { |
---|
| 92 | if ( !strcasecmp(newvar->var->nomvar,globlistetmp->var->nomvar) ) |
---|
| 93 | { |
---|
| 94 | out = 1; |
---|
| 95 | if ( strcasecmp(globlistetmp->var->initialvalue,"") ) |
---|
| 96 | { |
---|
| 97 | printf("The variable %s has ever a initial value \n" |
---|
| 98 | , newvar->var->nomvar); |
---|
| 99 | printf("Error in the CompleteGlobListeWithDatalist routine \n"); |
---|
| 100 | exit(0); |
---|
| 101 | } |
---|
| 102 | else |
---|
| 103 | { |
---|
| 104 | strcpy(globlistetmp->var->initialvalue,newvar->var->initialvalue); |
---|
| 105 | } |
---|
| 106 | } |
---|
| 107 | else |
---|
| 108 | { |
---|
| 109 | globlistetmp = globlistetmp->suiv; |
---|
| 110 | } |
---|
| 111 | } |
---|
| 112 | if ( !globlistetmp ) |
---|
| 113 | { |
---|
| 114 | printf("The variable %s has not bee found in the globliste \n" |
---|
| 115 | , newvar->var->nomvar); |
---|
| 116 | printf("Error in the CompleteGlobListeWithDatalist routine \n"); |
---|
| 117 | exit(0); |
---|
| 118 | } |
---|
| 119 | newvar = newvar->suiv; |
---|
| 120 | } |
---|
| 121 | } |
---|
| 122 | |
---|