WorkWithAllocatelist.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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_Allocate_Var_1 */
  41. /******************************************************************************/
  42. /* Firstpass 1 */
  43. /******************************************************************************/
  44. /* */
  45. /******************************************************************************/
  46. void Add_Allocate_Var_1(const char *nom, const char *nommodule)
  47. {
  48. listallocate *newvar;
  49. listallocate *parcours;
  50. int out;
  51. if ( firstpass == 1 )
  52. {
  53. if ( !List_Allocate_Var )
  54. {
  55. newvar = (listallocate *)calloc(1,sizeof(listallocate));
  56. strcpy(newvar->a_nomvar,nom);
  57. strcpy(newvar->a_subroutine,subroutinename);
  58. strcpy(newvar->a_module,nommodule);
  59. Save_Length(nom,25);
  60. newvar->suiv = NULL;
  61. List_Allocate_Var = newvar;
  62. }
  63. else
  64. {
  65. parcours = List_Allocate_Var;
  66. out = 0 ;
  67. while ( parcours->suiv && out == 0 )
  68. {
  69. if ( !strcasecmp(parcours->a_nomvar, nom) &&
  70. !strcasecmp(parcours->a_subroutine, subroutinename) &&
  71. !strcasecmp(parcours->a_module, nommodule) ) out = 1;
  72. else
  73. parcours=parcours->suiv;
  74. }
  75. if ( out == 0 )
  76. {
  77. if ( !strcasecmp(parcours->a_nomvar,nom) &&
  78. !strcasecmp(parcours->a_subroutine,subroutinename) &&
  79. !strcasecmp(parcours->a_module,nommodule) ) out = 1;
  80. else
  81. {
  82. /* add the record */
  83. newvar = (listallocate *)calloc(1,sizeof(listallocate));
  84. strcpy(newvar->a_nomvar, nom);
  85. strcpy(newvar->a_subroutine, subroutinename);
  86. strcpy(newvar->a_module, nommodule);
  87. Save_Length(nom,25);
  88. newvar->suiv = NULL;
  89. parcours->suiv = newvar;
  90. }
  91. }
  92. }
  93. }
  94. }
  95. /******************************************************************************/
  96. /* IsVarAllocatable_0 */
  97. /******************************************************************************/
  98. /* Firstpass 0 */
  99. /******************************************************************************/
  100. /* */
  101. /******************************************************************************/
  102. // int IsVarAllocatable_0(const char *ident)
  103. // {
  104. // listallocate *parcours;
  105. // int out;
  106. //
  107. // out = 0 ;
  108. // if ( firstpass == 0 )
  109. // {
  110. // parcours = List_Allocate_Var;
  111. // while ( parcours && out == 0 )
  112. // {
  113. // if ( !strcasecmp(parcours->a_nomvar,ident) ) out = 1 ;
  114. // else parcours=parcours->suiv;
  115. // }
  116. // }
  117. // return out;
  118. // }