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@imag.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.0 */ |
---|
34 | /******************************************************************************/ |
---|
35 | #include <stdio.h> |
---|
36 | #include <stdlib.h> |
---|
37 | #include <string.h> |
---|
38 | #include "decl.h" |
---|
39 | |
---|
40 | |
---|
41 | /******************************************************************************/ |
---|
42 | /* associate */ |
---|
43 | /******************************************************************************/ |
---|
44 | /* This subroutine is used to open a file */ |
---|
45 | /******************************************************************************/ |
---|
46 | FILE * associate (char *filename) |
---|
47 | { |
---|
48 | char filefich[LONGNOM]; |
---|
49 | sprintf(filefich,"%s/%s",nomdir,filename); |
---|
50 | return fopen (filefich, "w"); |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | /******************************************************************************/ |
---|
55 | /* associateaplus */ |
---|
56 | /******************************************************************************/ |
---|
57 | /* This subroutine is used to open a file with option a+ */ |
---|
58 | /******************************************************************************/ |
---|
59 | FILE * associateaplus (char *filename) |
---|
60 | { |
---|
61 | char filefich[LONGNOM]; |
---|
62 | sprintf(filefich,"%s/%s",nomdir,filename); |
---|
63 | return fopen (filefich, "a+"); |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | /******************************************************************************/ |
---|
68 | /* setposcur */ |
---|
69 | /******************************************************************************/ |
---|
70 | /* This subroutine is used to know the current position in the file */ |
---|
71 | /******************************************************************************/ |
---|
72 | /* */ |
---|
73 | /* setposcur ---------> position in file */ |
---|
74 | /* */ |
---|
75 | /******************************************************************************/ |
---|
76 | long int setposcur() |
---|
77 | { |
---|
78 | fflush(fortranout); |
---|
79 | return ftell(fortranout); |
---|
80 | } |
---|
81 | |
---|
82 | /******************************************************************************/ |
---|
83 | /* setposcurinoldfortranout */ |
---|
84 | /******************************************************************************/ |
---|
85 | /* This subroutine is used to know the position in the oldfortranout */ |
---|
86 | /******************************************************************************/ |
---|
87 | /* */ |
---|
88 | /* setposcurinoldfortranout ---------> position in file */ |
---|
89 | /* */ |
---|
90 | /******************************************************************************/ |
---|
91 | long int setposcurinoldfortranout() |
---|
92 | { |
---|
93 | fflush(oldfortranout); |
---|
94 | return ftell(oldfortranout); |
---|
95 | } |
---|
96 | |
---|
97 | /******************************************************************************/ |
---|
98 | /* copyuse_0 */ |
---|
99 | /******************************************************************************/ |
---|
100 | /* Firstpass 0 */ |
---|
101 | /* We should write in the fortranout the USE tok_name */ |
---|
102 | /* read in the original file */ |
---|
103 | /******************************************************************************/ |
---|
104 | /* */ |
---|
105 | /******************************************************************************/ |
---|
106 | void copyuse_0(char *namemodule) |
---|
107 | { |
---|
108 | if (firstpass == 0 && IsTabvarsUseInArgument_0() == 1 ) |
---|
109 | { |
---|
110 | /* We should write this declaration into the original subroutine too */ |
---|
111 | fprintf(oldfortranout," USE %s \n",namemodule); |
---|
112 | } |
---|
113 | } |
---|
114 | |
---|
115 | /******************************************************************************/ |
---|
116 | /* copyuseonly_0 */ |
---|
117 | /******************************************************************************/ |
---|
118 | /* Firstpass 0 */ |
---|
119 | /* We should write in the fortranout the USE tok_name, only */ |
---|
120 | /* read in the original file */ |
---|
121 | /******************************************************************************/ |
---|
122 | /* */ |
---|
123 | /******************************************************************************/ |
---|
124 | void copyuseonly_0(char *namemodule) |
---|
125 | { |
---|
126 | if (firstpass == 0 && IsTabvarsUseInArgument_0() == 1 ) |
---|
127 | { |
---|
128 | /* We should write this declaration into the original subroutine too */ |
---|
129 | fprintf(oldfortranout," USE %s , ONLY : \n",namemodule); |
---|
130 | } |
---|
131 | } |
---|