[1901] | 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 | |
---|
| 41 | /******************************************************************************/ |
---|
[5656] | 42 | /* open_for_write */ |
---|
[1901] | 43 | /******************************************************************************/ |
---|
| 44 | /* This subroutine is used to open a file */ |
---|
| 45 | /******************************************************************************/ |
---|
[5656] | 46 | FILE* open_for_write (const char *filename) |
---|
[1901] | 47 | { |
---|
[5656] | 48 | char filefich[LONG_FNAME]; |
---|
| 49 | sprintf(filefich,"%s/%s",include_dir,filename); |
---|
| 50 | return fopen(filefich, "w"); |
---|
[1901] | 51 | } |
---|
| 52 | |
---|
| 53 | /******************************************************************************/ |
---|
[5656] | 54 | /* open_for_append */ |
---|
[1901] | 55 | /******************************************************************************/ |
---|
| 56 | /* This subroutine is used to open a file with option a+ */ |
---|
| 57 | /******************************************************************************/ |
---|
[5656] | 58 | FILE* open_for_append (const char *filename) |
---|
[1901] | 59 | { |
---|
[5656] | 60 | char filefich[LONG_M]; |
---|
| 61 | sprintf(filefich,"%s/%s",include_dir,filename); |
---|
| 62 | return fopen(filefich, "a+"); |
---|
[1901] | 63 | } |
---|
| 64 | |
---|
| 65 | /******************************************************************************/ |
---|
[5656] | 66 | /* setposcurname */ |
---|
[1901] | 67 | /******************************************************************************/ |
---|
| 68 | /* This subroutine is used to know the current position in the file in argument */ |
---|
| 69 | /******************************************************************************/ |
---|
| 70 | /* */ |
---|
| 71 | /* setposcur ---------> position in file */ |
---|
| 72 | /* */ |
---|
| 73 | /******************************************************************************/ |
---|
| 74 | long int setposcurname(FILE *fileout) |
---|
| 75 | { |
---|
[5656] | 76 | fflush(fileout); |
---|
| 77 | return ftell(fileout); |
---|
[1901] | 78 | } |
---|
| 79 | |
---|
| 80 | /******************************************************************************/ |
---|
| 81 | /* setposcur */ |
---|
| 82 | /******************************************************************************/ |
---|
| 83 | /* This subroutine is used to know the current position in the file */ |
---|
| 84 | /******************************************************************************/ |
---|
| 85 | /* */ |
---|
| 86 | /* setposcur ---------> position in file */ |
---|
| 87 | /* */ |
---|
| 88 | /******************************************************************************/ |
---|
| 89 | long int setposcur() |
---|
| 90 | { |
---|
[5656] | 91 | return setposcurname(fortran_out); |
---|
[1901] | 92 | } |
---|
| 93 | |
---|
| 94 | /******************************************************************************/ |
---|
| 95 | /* copyuse_0 */ |
---|
| 96 | /******************************************************************************/ |
---|
| 97 | /* Firstpass 0 */ |
---|
[5656] | 98 | /* We should write in the fortran_out the USE tok_name */ |
---|
[1901] | 99 | /* read in the original file */ |
---|
| 100 | /******************************************************************************/ |
---|
| 101 | /* */ |
---|
| 102 | /******************************************************************************/ |
---|
[5656] | 103 | void copyuse_0(const char *namemodule) |
---|
[1901] | 104 | { |
---|
[5656] | 105 | if ( IsTabvarsUseInArgument_0() == 1 ) |
---|
| 106 | { |
---|
| 107 | /* We should write this declaration into the original subroutine too */ |
---|
| 108 | fprintf(oldfortran_out," use %s\n", namemodule); |
---|
| 109 | } |
---|
[1901] | 110 | } |
---|
| 111 | |
---|
| 112 | /******************************************************************************/ |
---|
| 113 | /* copyuseonly_0 */ |
---|
| 114 | /******************************************************************************/ |
---|
| 115 | /* Firstpass 0 */ |
---|
[5656] | 116 | /* We should write in the fortran_out the USE tok_name, only */ |
---|
[1901] | 117 | /* read in the original file */ |
---|
| 118 | /******************************************************************************/ |
---|
| 119 | /* */ |
---|
| 120 | /******************************************************************************/ |
---|
[5656] | 121 | void copyuseonly_0(const char *namemodule) |
---|
[1901] | 122 | { |
---|
| 123 | if (firstpass == 0 && IsTabvarsUseInArgument_0() == 1 ) |
---|
| 124 | { |
---|
| 125 | /* We should write this declaration into the original subroutine too */ |
---|
[5656] | 126 | fprintf(oldfortran_out," use %s , only : \n", namemodule); |
---|
[1901] | 127 | } |
---|
| 128 | } |
---|