New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 4777 for vendors/AGRIF/current/LIB/DiversListe.c – NEMO

Ignore:
Timestamp:
2014-09-19T15:51:42+02:00 (10 years ago)
Author:
rblod
Message:

Load working_directory into vendors/AGRIF/current.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendors/AGRIF/current/LIB/DiversListe.c

    r2671 r4777  
    4848void Add_Common_var_1() 
    4949{ 
    50    listvar *newvar; 
    51    listvar *newvar2; 
    52    variable *newvariable; 
    53    listdim *dims; 
    54    char listdimension[LONG_C]; 
    55    char ligne[LONG_C]; 
    56    int out; 
    57  
    58    if ( firstpass == 1 ) 
    59    { 
    60  
    61    newvar = (listvar *)malloc(sizeof(listvar)); 
    62    newvariable = (variable *)malloc(sizeof(variable)); 
    63    /*                                                                         */ 
    64    Init_Variable(newvariable); 
    65    /*                                                                         */ 
    66    strcpy(newvariable->v_nomvar,commonvar); 
    67    Save_Length(commonvar,4); 
    68    strcpy(newvariable->v_commonname,commonblockname); 
    69    Save_Length(commonblockname,7); 
    70    strcpy(newvariable->v_modulename,curmodulename); 
    71    Save_Length(curmodulename,6); 
    72    strcpy(newvariable->v_subroutinename,subroutinename); 
    73    Save_Length(subroutinename,11); 
    74    newvariable->v_positioninblock= positioninblock; 
    75    newvariable->v_common=1; 
    76    strcpy(newvariable->v_commoninfile,mainfile); 
    77    Save_Length(mainfile,10); 
    78  
    79    newvar->var = newvariable; 
    80  
    81    if ( commondim ) 
    82    { 
    83       newvariable->v_dimension=commondim; 
    84       newvariable->v_dimensiongiven=1; 
    85       newvariable->v_nbdim=num_dims(commondim); 
    86       /* Creation of the string for the dimension of this variable            */ 
    87       dimsempty = 1; 
    88       strcpy(listdimension,""); 
    89  
    90       if ( commondim ) 
    91       { 
    92          dims = commondim; 
    93          while (dims) 
    94          { 
    95             if ( strcasecmp(dims->dim.first,"") || 
    96                  strcasecmp(dims->dim.last,""))  dimsempty = 0; 
    97             sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last); 
    98             strcat(listdimension,ligne); 
    99             if ( dims->suiv ) strcat(listdimension,","); 
    100             dims = dims->suiv; 
    101          } 
    102          if ( dimsempty == 1 ) newvariable->v_dimsempty=1; 
    103       } 
    104       strcpy(newvariable->v_readedlistdimension,listdimension); 
    105       Save_Length(listdimension,15); 
    106    } 
    107  
    108  
    109    newvar->suiv = NULL; 
    110  
    111    if ( !List_Common_Var ) 
    112    { 
    113       List_Common_Var = newvar; 
    114    } 
    115    else 
    116    { 
    117       newvar2 = List_Common_Var; 
    118       out = 0 ; 
    119       while ( newvar2 && out == 0 ) 
    120       { 
    121          if ( !strcasecmp(newvar2->var->v_nomvar,commonvar) && 
    122               !strcasecmp(newvar2->var->v_commonname,commonblockname) && 
    123               !strcasecmp(newvar2->var->v_subroutinename,subroutinename) 
    124                           ) out = 1 ; 
    125          else newvar2 = newvar2->suiv; 
    126       } 
    127       if ( out == 0 ) 
    128       { 
    129          newvar->suiv = List_Common_Var; 
    130          List_Common_Var = newvar; 
    131       } 
    132       else 
    133       { 
    134          free(newvar); 
    135       } 
    136    } 
    137    } 
     50    listvar *newvar; 
     51    listvar *newvar2; 
     52    variable *newvariable; 
     53    listdim *dims; 
     54    char listdimension[LONG_M]; 
     55    char ligne[LONG_M]; 
     56    int out; 
     57 
     58    if ( firstpass == 1 ) 
     59    { 
     60        newvar = (listvar *) calloc(1,sizeof(listvar)); 
     61        newvariable = (variable *) calloc(1,sizeof(variable)); 
     62 
     63        Init_Variable(newvariable); 
     64 
     65        strcpy(newvariable->v_nomvar,commonvar); 
     66        strcpy(newvariable->v_commonname,commonblockname); 
     67        strcpy(newvariable->v_modulename,curmodulename); 
     68        strcpy(newvariable->v_subroutinename,subroutinename); 
     69        strcpy(newvariable->v_commoninfile,cur_filename); 
     70        newvariable->v_positioninblock = positioninblock; 
     71        newvariable->v_common = 1; 
     72        newvar->var = newvariable; 
     73 
     74        if ( commondim ) 
     75        { 
     76            newvariable->v_dimension = commondim; 
     77            newvariable->v_dimensiongiven = 1; 
     78            newvariable->v_nbdim = get_num_dims(commondim); 
     79 
     80            /* Creation of the string for the dimension of this variable            */ 
     81            dimsempty = 1; 
     82            strcpy(listdimension,""); 
     83 
     84            dims = commondim; 
     85            while (dims) 
     86            { 
     87                if ( strcasecmp(dims->dim.first,"") || 
     88                     strcasecmp(dims->dim.last,""))  dimsempty = 0; 
     89                sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last); 
     90                strcat(listdimension,ligne); 
     91                if ( dims->suiv ) strcat(listdimension,","); 
     92                dims = dims->suiv; 
     93            } 
     94            if ( dimsempty == 1 ) newvariable->v_dimsempty = 1; 
     95 
     96            strcpy(newvariable->v_readedlistdimension,listdimension); 
     97            Save_Length(listdimension,15); 
     98        } 
     99 
     100        newvar->suiv = NULL; 
     101 
     102        if ( !List_Common_Var ) 
     103        { 
     104            List_Common_Var = newvar; 
     105        } 
     106        else 
     107        { 
     108            newvar2 = List_Common_Var; 
     109            out = 0 ; 
     110            while ( newvar2 && out == 0 ) 
     111            { 
     112                if ( !strcasecmp(newvar2->var->v_nomvar,commonvar) && 
     113                     !strcasecmp(newvar2->var->v_commonname,commonblockname) && 
     114                     !strcasecmp(newvar2->var->v_subroutinename,subroutinename) 
     115                   ) out = 1 ; 
     116                else newvar2 = newvar2->suiv; 
     117            } 
     118            if ( out == 0 ) 
     119            { 
     120                newvar->suiv = List_Common_Var; 
     121                List_Common_Var = newvar; 
     122            } 
     123            else 
     124            { 
     125                free(newvar); 
     126            } 
     127        } 
     128    } 
    138129} 
    139130 
     
    145136/*                                                                            */ 
    146137/******************************************************************************/ 
    147 listnom *Addtolistnom(char *nom, listnom *listin,int value) 
    148 { 
    149    listnom *newnom; 
    150    listnom *parcours; 
    151    int out; 
    152  
    153    newnom=(listnom *) malloc (sizeof (listnom)); 
    154    strcpy(newnom->o_nom,nom); 
    155    Save_Length(nom,23); 
    156    newnom->o_val = value; 
    157    newnom->suiv = NULL; 
    158  
    159    if ( !listin ) listin = newnom; 
    160    else 
    161    { 
    162       parcours = listin; 
    163       out = 0 ; 
    164       while ( parcours && out == 0 ) 
    165       { 
    166          if ( !strcasecmp(parcours->o_nom,nom) ) out = 1 ; 
    167          else parcours=parcours->suiv; 
    168       } 
    169       if ( out == 0 ) 
    170       { 
    171           newnom->suiv = listin; 
    172           listin = newnom; 
    173       } 
    174       else 
    175       { 
    176          free(newnom); 
    177       } 
    178    } 
    179    return listin; 
     138listnom *Addtolistnom(const char *nom, listnom *listin, int value) 
     139{ 
     140    listnom *newnom; 
     141    listnom *parcours; 
     142    int out; 
     143 
     144    newnom = (listnom*) calloc(1, sizeof(listnom)); 
     145    strcpy(newnom->o_nom, nom); 
     146    newnom->o_val = value; 
     147    newnom->suiv = NULL; 
     148 
     149    if ( listin == NULL ) 
     150    { 
     151        listin = newnom; 
     152    } 
     153    else 
     154    { 
     155        parcours = listin; 
     156        out = 0 ; 
     157        while ( parcours && out == 0 ) 
     158        { 
     159            if ( !strcasecmp(parcours->o_nom, nom) ) out = 1 ; 
     160            else parcours = parcours->suiv; 
     161        } 
     162        if ( out == 0 ) 
     163        { 
     164            newnom->suiv = listin; 
     165            listin = newnom; 
     166        } 
     167        else 
     168        { 
     169            free(newnom); 
     170        } 
     171    } 
     172    return listin; 
    180173} 
    181174 
     
    193186/*                                                                            */ 
    194187/******************************************************************************/ 
    195 listname *Addtolistname(char *nom,listname *input) 
    196 { 
    197    listname *newnom; 
    198    listname *parcours; 
    199    int out; 
    200  
    201    if ( !input ) 
    202    { 
    203       newnom=(listname *) malloc (sizeof (listname)); 
    204       strcpy(newnom->n_name,nom); 
    205       Save_Length(nom,20); 
    206       newnom->suiv = NULL; 
    207       input = newnom; 
    208    } 
    209    else 
    210    { 
    211       parcours = input; 
    212       out = 0 ; 
    213       while ( parcours && out == 0 ) 
    214       { 
    215          if ( !strcasecmp(parcours->n_name,nom) ) out = 1; 
    216          else parcours=parcours->suiv; 
    217       } 
    218       if ( out == 0 ) 
    219       { 
    220          newnom=(listname *) malloc (sizeof (listname)); 
    221          strcpy(newnom->n_name,nom); 
    222          Save_Length(nom,20); 
    223          newnom->suiv = input; 
    224          input = newnom; 
    225       } 
    226    } 
    227    return input; 
     188listname *Addtolistname(const char *nom, listname *input) 
     189{ 
     190    listname *newnom; 
     191    listname *parcours; 
     192    int out; 
     193 
     194    if ( !input ) 
     195    { 
     196        newnom = (listname*) calloc(1, sizeof(listname)); 
     197        strcpy(newnom->n_name, nom); 
     198        newnom->suiv = NULL; 
     199        input = newnom; 
     200    } 
     201    else 
     202    { 
     203        parcours = input; 
     204        out = 0 ; 
     205        while ( parcours && out == 0 ) 
     206        { 
     207            if ( !strcasecmp(parcours->n_name,nom) ) out = 1; 
     208            else parcours=parcours->suiv; 
     209        } 
     210        if ( out == 0 ) 
     211        { 
     212            newnom = (listname*) calloc(1,sizeof(listname)); 
     213            strcpy(newnom->n_name, nom); 
     214            newnom->suiv = input; 
     215            input = newnom; 
     216        } 
     217    } 
     218    return input; 
    228219} 
    229220 
     
    236227/*                                                                            */ 
    237228/******************************************************************************/ 
    238 int ModuleIsDefineInInputFile(char *name) 
    239 { 
    240    listnom *newnom; 
    241    int out; 
    242  
    243    out = 0; 
    244    if ( listofmodules ) 
    245    { 
    246       newnom = listofmodules; 
    247       while( newnom && out == 0 ) 
    248       { 
    249          if ( !strcasecmp(newnom->o_nom,name) ) out = 1 ; 
    250          else newnom=newnom->suiv; 
    251       } 
    252    } 
    253    return out; 
     229int ModuleIsDefineInInputFile(const char *name) 
     230{ 
     231    listnom *newnom; 
     232    int out; 
     233 
     234    out = 0; 
     235    if ( listofmodules ) 
     236    { 
     237        newnom = listofmodules; 
     238        while( newnom && out == 0 ) 
     239        { 
     240            if ( !strcasecmp(newnom->o_nom,name) ) out = 1 ; 
     241            else newnom = newnom->suiv; 
     242        } 
     243    } 
     244    return out; 
    254245} 
    255246 
     
    270261/*                                                                            */ 
    271262/******************************************************************************/ 
    272 void Addmoduletothelisttmp(char *name) 
    273 { 
    274   listusemodule *newmodule; 
    275   listusemodule *parcours; 
    276   int out; 
    277  
    278   if ( !listofmoduletmp) 
    279   { 
    280     newmodule =(listusemodule *)malloc(sizeof(listusemodule)); 
    281     strcpy(newmodule->u_usemodule,name); 
    282     Save_Length(name,16); 
    283     strcpy(newmodule->u_cursubroutine,subroutinename); 
    284     Save_Length(subroutinename,18); 
    285     newmodule->suiv = NULL; 
    286     listofmoduletmp = newmodule ; 
    287   } 
    288   else 
    289   { 
    290     parcours = listofmoduletmp; 
    291     out = 0; 
    292     while( parcours && out == 0 ) 
    293     { 
    294        if ( !strcasecmp(parcours->u_usemodule,name) ) out = 1; 
    295        else parcours = parcours->suiv; 
    296     } 
    297     if ( out == 0 ) 
    298     { 
    299        newmodule =(listusemodule *)malloc(sizeof(listusemodule)); 
    300        strcpy(newmodule->u_usemodule,name); 
    301        Save_Length(name,16); 
    302        strcpy(newmodule->u_cursubroutine,subroutinename); 
    303        Save_Length(subroutinename,18); 
    304        newmodule->suiv = listofmoduletmp; 
    305        listofmoduletmp = newmodule; 
    306     } 
    307   } 
     263void Addmoduletothelisttmp(const char *name) 
     264{ 
     265    listusemodule *newmodule; 
     266    listusemodule *parcours; 
     267    int out; 
     268 
     269    if ( !listofmoduletmp ) 
     270    { 
     271        newmodule = (listusemodule*) calloc(1, sizeof(listusemodule)); 
     272        strcpy(newmodule->u_usemodule, name); 
     273        strcpy(newmodule->u_cursubroutine, subroutinename); 
     274        newmodule->suiv = NULL; 
     275        listofmoduletmp = newmodule ; 
     276    } 
     277    else 
     278    { 
     279        parcours = listofmoduletmp; 
     280        out = 0; 
     281        while( parcours && out == 0 ) 
     282        { 
     283            if ( !strcasecmp(parcours->u_usemodule, name) ) out = 1; 
     284            else parcours = parcours->suiv; 
     285        } 
     286        if ( out == 0 ) 
     287        { 
     288            newmodule = (listusemodule*) calloc(1, sizeof(listusemodule)); 
     289            strcpy(newmodule->u_usemodule, name); 
     290            strcpy(newmodule->u_cursubroutine, subroutinename); 
     291            newmodule->suiv = listofmoduletmp; 
     292            listofmoduletmp = newmodule; 
     293        } 
     294    } 
    308295} 
    309296 
     
    321308/*                                                                            */ 
    322309/******************************************************************************/ 
    323 void Add_NameOfModule_1(char *nom) 
    324 { 
    325    listnom *newnom; 
    326  
    327    if ( firstpass == 1 ) 
    328    { 
    329       newnom=(listnom *) malloc (sizeof (listnom)); 
    330       strcpy(newnom->o_nom,nom); 
    331       Save_Length(nom,23); 
    332       newnom->suiv = List_NameOfModule; 
    333       List_NameOfModule = newnom; 
    334    } 
     310void Add_NameOfModule_1(const char *nom) 
     311{ 
     312    listnom *newnom; 
     313 
     314    if ( firstpass == 1 ) 
     315    { 
     316        newnom = (listnom *) calloc(1,sizeof(listnom)); 
     317        strcpy(newnom->o_nom,nom); 
     318        newnom->suiv = List_NameOfModule; 
     319        List_NameOfModule = newnom; 
     320    } 
    335321} 
    336322 
     
    348334/*                                                                            */ 
    349335/******************************************************************************/ 
    350 void Add_NameOfCommon_1(char *nom,char *cursubroutinename) 
    351 { 
    352    listnom *newnom; 
    353    listnom *parcours; 
    354  
    355    if ( firstpass == 1 ) 
    356    { 
    357       parcours = List_NameOfCommon; 
    358       while ( parcours && strcasecmp(parcours->o_nom,nom) ) 
    359                                                       parcours = parcours->suiv; 
    360       if ( !parcours ) 
    361       { 
    362          newnom=(listnom *) malloc (sizeof (listnom)); 
    363          strcpy(newnom->o_nom,nom); 
    364          strcpy(newnom->o_subroutinename,cursubroutinename); 
    365          Save_Length(nom,23); 
    366          newnom->suiv = List_NameOfCommon; 
    367          List_NameOfCommon = newnom; 
    368       } 
    369    } 
     336void Add_NameOfCommon_1(const char *nom, const char *cursubroutinename) 
     337{ 
     338    listnom *newnom; 
     339    listnom *parcours; 
     340 
     341    if ( firstpass == 1 ) 
     342    { 
     343        parcours = List_NameOfCommon; 
     344        while ( parcours && strcasecmp(parcours->o_nom,nom) ) 
     345            parcours = parcours->suiv; 
     346        if ( !parcours ) 
     347        { 
     348            newnom = (listnom *) calloc(1,sizeof(listnom)); 
     349            strcpy(newnom->o_nom,nom); 
     350            strcpy(newnom->o_subroutinename,cursubroutinename); 
     351            newnom->suiv = List_NameOfCommon; 
     352            List_NameOfCommon = newnom; 
     353        } 
     354    } 
    370355} 
    371356 
     
    378363/*                                                                            */ 
    379364/******************************************************************************/ 
    380 void Add_CouplePointed_Var_1(char *namemodule,listcouple *couple) 
    381 { 
    382    listvarpointtovar *pointtmp; 
    383  
    384    if ( firstpass == 1 ) 
    385    { 
    386       /* we should complete the List_CouplePointed_Var                        */ 
    387       pointtmp=(listvarpointtovar *)malloc(sizeof(listvarpointtovar)); 
    388       strcpy(pointtmp->t_usemodule,namemodule); 
    389       Save_Length(namemodule,28); 
    390       strcpy(pointtmp->t_cursubroutine,subroutinename); 
    391       Save_Length(subroutinename,29); 
    392       pointtmp->t_couple = couple; 
    393       if ( List_CouplePointed_Var ) 
    394       { 
    395          pointtmp->suiv = List_CouplePointed_Var; 
    396          List_CouplePointed_Var = pointtmp; 
    397       } 
    398       else 
    399       { 
    400          pointtmp->suiv = NULL; 
    401          List_CouplePointed_Var = pointtmp; 
    402       } 
    403    } 
     365void Add_CouplePointed_Var_1(const char *namemodule, listcouple *couple) 
     366{ 
     367    listvarpointtovar *pointtmp; 
     368 
     369    /* we should complete the List_CouplePointed_Var                        */ 
     370    pointtmp = (listvarpointtovar*) calloc(1, sizeof(listvarpointtovar)); 
     371    strcpy(pointtmp->t_usemodule, namemodule); 
     372    strcpy(pointtmp->t_cursubroutine, subroutinename); 
     373    pointtmp->t_couple = couple; 
     374    if ( List_CouplePointed_Var ) 
     375    { 
     376        pointtmp->suiv = List_CouplePointed_Var; 
     377    } 
     378    else 
     379    { 
     380        pointtmp->suiv = NULL; 
     381    } 
     382    List_CouplePointed_Var = pointtmp; 
    404383} 
    405384 
     
    420399/*                                                                            */ 
    421400/******************************************************************************/ 
    422 void Add_Include_1(char *name) 
     401void Add_Include_1(const char *name) 
     402{ 
     403    listusemodule *newinclude; 
     404 
     405    if ( firstpass == 1 ) 
     406    { 
     407        newinclude = (listusemodule*) calloc(1, sizeof(listusemodule)); 
     408        strcpy(newinclude->u_usemodule,name); 
     409        strcpy(newinclude->u_cursubroutine,subroutinename); 
     410 
     411        newinclude->suiv = List_Include; 
     412        List_Include  = newinclude ; 
     413    } 
     414} 
     415 
     416/******************************************************************************/ 
     417/*                     Add_ImplicitNoneSubroutine_1                           */ 
     418/******************************************************************************/ 
     419/* This subroutine is used to add a record to a list of struct                */ 
     420/******************************************************************************/ 
     421/*                                                                            */ 
     422/*                                                                            */ 
     423/******************************************************************************/ 
     424void Add_ImplicitNoneSubroutine_1() 
     425{ 
     426    if ( firstpass == 1 ) 
     427        List_ImplicitNoneSubroutine = Addtolistname(subroutinename,List_ImplicitNoneSubroutine); 
     428} 
     429 
     430/******************************************************************************/ 
     431/*                        WriteIncludeDeclaration                             */ 
     432/******************************************************************************/ 
     433/* Firstpass 0                                                                */ 
     434/******************************************************************************/ 
     435/*                                                                            */ 
     436/******************************************************************************/ 
     437void WriteIncludeDeclaration(FILE* tofile) 
    423438{ 
    424439  listusemodule *newinclude; 
    425440 
    426   if ( firstpass == 1 ) 
    427   { 
    428   newinclude =(listusemodule *)malloc(sizeof(listusemodule)); 
    429   strcpy(newinclude->u_usemodule,name); 
    430   Save_Length(name,16); 
    431   strcpy(newinclude->u_cursubroutine,subroutinename); 
    432   Save_Length(subroutinename,18); 
    433   newinclude->suiv = NULL; 
    434  
    435   if ( !List_Include) 
    436   { 
    437      List_Include  = newinclude ; 
    438   } 
    439   else 
    440   { 
    441     newinclude->suiv = List_Include; 
    442     List_Include = newinclude; 
    443   } 
    444   } 
    445 } 
    446  
    447 /******************************************************************************/ 
    448 /*                     Add_ImplicitNoneSubroutine_1                           */ 
    449 /******************************************************************************/ 
    450 /* This subroutine is used to add a record to a list of struct                */ 
    451 /******************************************************************************/ 
    452 /*                                                                            */ 
    453 /*                                                                            */ 
    454 /******************************************************************************/ 
    455 void Add_ImplicitNoneSubroutine_1() 
    456 { 
    457  
    458   if ( firstpass == 1 ) 
    459   { 
    460      List_ImplicitNoneSubroutine = Addtolistname(subroutinename, 
    461                                                    List_ImplicitNoneSubroutine); 
    462   } 
    463 } 
    464  
    465  
    466 /******************************************************************************/ 
    467 /*                        WriteIncludeDeclaration                             */ 
    468 /******************************************************************************/ 
    469 /* Firstpass 0                                                                */ 
    470 /******************************************************************************/ 
    471 /*                                                                            */ 
    472 /******************************************************************************/ 
    473 void WriteIncludeDeclaration() 
    474 { 
    475   listusemodule *newinclude; 
    476  
    477441  newinclude = List_Include; 
    478   fprintf(fortranout,"\n"); 
     442  fprintf(tofile,"\n"); 
    479443  while ( newinclude ) 
    480444  { 
    481445     if ( !strcasecmp(newinclude->u_cursubroutine,subroutinename) ) 
    482446     { 
    483         fprintf(fortranout,"      INCLUDE %s \n",newinclude->u_usemodule); 
     447        fprintf(tofile, "      include %s\n",newinclude->u_usemodule); 
    484448     } 
    485449     newinclude = newinclude ->suiv; 
     
    498462/*                                                                            */ 
    499463/******************************************************************************/ 
    500 void Add_Save_Var_1 (char *name,listdim *d) 
    501 { 
    502   listvar *newvar; 
    503   listdim *dims; 
    504   char ligne[LONG_C]; 
    505   char listdimension[LONG_C]; 
    506  
    507   if ( firstpass == 1 ) 
    508   { 
    509      newvar=(listvar *)malloc(sizeof(listvar)); 
    510      newvar->var=(variable *)malloc(sizeof(variable)); 
    511      /*                                                                       */ 
    512      Init_Variable(newvar->var); 
    513      /*                                                                       */ 
    514      newvar->var->v_save=1; 
    515      strcpy(newvar->var->v_nomvar,name); 
    516      Save_Length(name,4); 
    517      strcpy(newvar->var->v_modulename,curmodulename); 
    518      Save_Length(curmodulename,6); 
    519      strcpy(newvar->var->v_subroutinename,subroutinename); 
    520      Save_Length(subroutinename,11); 
    521      strcpy(newvar->var->v_commoninfile,mainfile); 
    522      Save_Length(mainfile,10); 
    523  
    524      newvar->var->v_dimension=d; 
    525      /* Creation of the string for the dimension of this variable             */ 
    526      dimsempty = 1; 
    527  
    528      if ( d ) 
    529      { 
    530         newvar->var->v_dimensiongiven=1; 
    531         dims = d; 
    532         while (dims) 
    533         { 
    534            if ( strcasecmp(dims->dim.first,"") || strcasecmp(dims->dim.last,"")) 
    535                                                                   dimsempty = 0; 
    536            sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last); 
    537            strcat(listdimension,ligne); 
    538            if ( dims->suiv ) 
    539            { 
    540               strcat(listdimension,","); 
    541            } 
    542            dims = dims->suiv; 
    543         } 
    544         if ( dimsempty == 1 ) newvar->var->v_dimsempty=1; 
    545      } 
    546  
    547 /*     strcpy(newvar->var->v_readedlistdimension,listdimension); 
    548      Save_Length(listdimension,15);*/ 
    549      /*                                                                       */ 
    550      newvar->suiv = NULL; 
    551  
    552      if ( !List_Save_Var ) 
    553      { 
    554         List_Save_Var  = newvar ; 
    555      } 
    556      else 
    557      { 
     464void Add_Save_Var_1 (const char *name, listdim *d) 
     465{ 
     466    listvar *newvar; 
     467    listdim *dims; 
     468    char ligne[LONG_M]; 
     469    char listdimension[LONG_M]; 
     470 
     471    if ( firstpass == 1 ) 
     472    { 
     473        newvar = (listvar *) calloc(1,sizeof(listvar)); 
     474        newvar->var = (variable *) calloc(1,sizeof(variable)); 
     475 
     476        Init_Variable(newvar->var); 
     477 
     478        newvar->var->v_save = 1; 
     479        strcpy(newvar->var->v_nomvar,name); 
     480        strcpy(newvar->var->v_modulename,curmodulename); 
     481        strcpy(newvar->var->v_subroutinename,subroutinename); 
     482        strcpy(newvar->var->v_commoninfile,cur_filename); 
     483 
     484        newvar->var->v_dimension = d; 
     485 
     486        /* Creation of the string for the dimension of this variable             */ 
     487        dimsempty = 1; 
     488 
     489        if ( d ) 
     490        { 
     491            newvar->var->v_dimensiongiven = 1; 
     492            dims = d; 
     493            while (dims) 
     494            { 
     495                if ( strcasecmp(dims->dim.first,"") || strcasecmp(dims->dim.last,"")) 
     496                    dimsempty = 0; 
     497                sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last); 
     498                strcat(listdimension,ligne); 
     499                if ( dims->suiv )   strcat(listdimension,","); 
     500                dims = dims->suiv; 
     501            } 
     502            if ( dimsempty == 1 ) newvar->var->v_dimsempty = 1; 
     503        } 
     504 
    558505        newvar->suiv = List_Save_Var; 
    559506        List_Save_Var = newvar; 
    560      } 
    561   } 
     507    } 
    562508} 
    563509 
    564510void Add_Save_Var_dcl_1 (listvar *var) 
    565511{ 
    566   listvar *newvar; 
    567   listvar *parcours; 
    568  
    569   if ( firstpass == 1 ) 
    570   { 
    571      parcours = var; 
    572      while ( parcours ) 
    573      { 
    574         newvar=(listvar *)malloc(sizeof(listvar)); 
    575         newvar->var=(variable *)malloc(sizeof(variable)); 
    576         /*                                                                    */ 
    577         Init_Variable(newvar->var); 
    578         /*                                                                    */ 
    579         newvar->var->v_save=1; 
    580         strcpy(newvar->var->v_nomvar,parcours->var->v_nomvar); 
    581         strcpy(newvar->var->v_modulename,curmodulename); 
    582         Save_Length(curmodulename,6); 
    583         strcpy(newvar->var->v_subroutinename,subroutinename); 
    584         Save_Length(subroutinename,11); 
    585         strcpy(newvar->var->v_commoninfile,mainfile); 
    586         Save_Length(mainfile,10); 
    587         /*                                                                    */ 
    588         strcpy(newvar->var->v_readedlistdimension, 
    589              parcours->var->v_readedlistdimension); 
    590         newvar->var->v_nbdim = parcours->var->v_nbdim; 
    591         newvar->var->v_dimension = parcours->var->v_dimension; 
    592         /*                                                                    */ 
    593         newvar->var->v_dimensiongiven=parcours->var->v_dimensiongiven; 
    594         /*                                                                    */ 
    595         newvar->suiv = NULL; 
    596  
    597         if ( !List_Save_Var ) List_Save_Var  = newvar ; 
    598         else 
    599         { 
    600            newvar->suiv = List_Save_Var; 
    601            List_Save_Var = newvar; 
    602         } 
    603         parcours = parcours->suiv; 
    604      } 
    605   } 
    606 } 
     512    listvar *newvar; 
     513    listvar *parcours; 
     514 
     515    if ( firstpass == 1 ) 
     516    { 
     517        parcours = var; 
     518        while ( parcours ) 
     519        { 
     520            newvar = (listvar *) calloc(1,sizeof(listvar)); 
     521            newvar->var = (variable *) calloc(1,sizeof(variable)); 
     522 
     523            Init_Variable(newvar->var); 
     524 
     525            newvar->var->v_save = 1; 
     526            strcpy(newvar->var->v_nomvar,parcours->var->v_nomvar); 
     527            strcpy(newvar->var->v_modulename,curmodulename); 
     528            strcpy(newvar->var->v_subroutinename,subroutinename); 
     529            strcpy(newvar->var->v_commoninfile,cur_filename); 
     530            strcpy(newvar->var->v_readedlistdimension,parcours->var->v_readedlistdimension); 
     531 
     532            newvar->var->v_nbdim = parcours->var->v_nbdim; 
     533            newvar->var->v_catvar = parcours->var->v_catvar; 
     534            newvar->var->v_dimension = parcours->var->v_dimension; 
     535            newvar->var->v_dimensiongiven=parcours->var->v_dimensiongiven; 
     536            newvar->suiv = List_Save_Var; 
     537            List_Save_Var = newvar; 
     538 
     539            parcours = parcours->suiv; 
     540        } 
     541    } 
     542} 
Note: See TracChangeset for help on using the changeset viewer.