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.
WorkWithAllocatelist.c in branches/dev_001_GM/AGRIF/LIB – NEMO

source: branches/dev_001_GM/AGRIF/LIB/WorkWithAllocatelist.c @ 2520

Last change on this file since 2520 was 663, checked in by opalod, 17 years ago

RB: update CONV

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.6 KB
Line 
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.6                                                                */
34/******************************************************************************/
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>
38#include "decl.h"
39
40/******************************************************************************/
41/*                               Add_Allocate_Var_1                           */
42/******************************************************************************/
43/* Firstpass 1                                                                */
44/******************************************************************************/
45/*                                                                            */
46/******************************************************************************/
47void Add_Allocate_Var_1(char *nom,char *nommodule)
48{
49   listallocate *newvar;
50   listallocate *parcours;
51   int out;
52
53   if ( firstpass == 1 )
54   {
55      if ( !List_Allocate_Var )
56      {
57         newvar = (listallocate *)malloc(sizeof(listallocate));
58         strcpy(newvar->a_nomvar,nom);
59         strcpy(newvar->a_subroutine,subroutinename);
60         strcpy(newvar->a_module,nommodule);
61         newvar->suiv = NULL;
62         List_Allocate_Var = newvar;
63      }
64      else
65      {
66         parcours = List_Allocate_Var;
67         out = 0 ;
68         while ( parcours->suiv && out == 0 )
69         {
70            if (  !strcasecmp(parcours->a_nomvar,nom) &&
71                  !strcasecmp(parcours->a_subroutine,subroutinename) &&
72                  !strcasecmp(parcours->a_module,nommodule) ) out = 1;
73            else
74               parcours=parcours->suiv;
75         }
76         if ( out == 0 )
77         {
78            if (  !strcasecmp(parcours->a_nomvar,nom) &&
79                  !strcasecmp(parcours->a_subroutine,subroutinename) &&
80                  !strcasecmp(parcours->a_module,nommodule) ) out = 1;
81            else
82            {
83               /* add the record                                              */
84              newvar = (listallocate *)malloc(sizeof(listallocate));
85              strcpy(newvar->a_nomvar,nom);
86              strcpy(newvar->a_subroutine,subroutinename);
87              strcpy(newvar->a_module,nommodule);
88              newvar->suiv = NULL;
89              parcours->suiv = newvar;
90            }
91         }
92      }
93   }
94}
95
96
97/******************************************************************************/
98/*                            IsVarAllocatable_0                              */
99/******************************************************************************/
100/* Firstpass 0                                                                */
101/******************************************************************************/
102/*                                                                            */
103/******************************************************************************/
104int IsVarAllocatable_0(char *ident)
105{
106   listallocate *parcours;
107   int out;
108
109   out = 0 ;
110   if ( firstpass == 0 )
111   {
112      parcours = List_Allocate_Var;
113      while ( parcours && out == 0 )
114      {
115         if ( !strcasecmp(parcours->a_nomvar,ident)  ) out = 1 ;
116         else parcours=parcours->suiv;
117      }
118   }
119   return out;
120}
121
122
123/******************************************************************************/
124/*                          varisallocatable_0                                */
125/******************************************************************************/
126/* Firstpass 0                                                                */
127/******************************************************************************/
128/*                                                                            */
129/******************************************************************************/
130int varisallocatable_0(char *ident)
131{
132   listallocate *newvaralloc;
133   int out;
134
135   out =0;
136   if (firstpass == 0 )
137   {
138         newvaralloc = List_Allocate_Var;
139         while ( newvaralloc && out == 0 )
140         {
141            if ( !strcasecmp(ident,newvaralloc->a_nomvar) )  out = 1;
142            else newvaralloc = newvaralloc->suiv;
143         }
144   }
145   return out;
146}
Note: See TracBrowser for help on using the repository browser.