1 /***********************************************************************
2 *
3 * ***** *** ***
4 * * * * * *
5 * * *** ***
6 * * * * * *
7 * ***** *** ***
8 *
9 * A FREE Finite Elements Analysis Program in ANSI C for the Windows &
10 * the UNIX OS.
11 *
12 * Composed and edited and copyright by
13 * Professor Dr.-Ing. Frank Rieg, University of Bayreuth, Germany
14 *
15 * eMail:
16 * frank.rieg@uni-bayreuth.de
17 * dr.frank.rieg@t-online.de
18 *
19 * V15.0 November 18, 2015
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2, or (at your option)
24 * any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License
32 * along with this program; see the file COPYING. If not, write to
33 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
34 ***********************************************************************/
35 /***********************************************************************
36 * Function rdy88h liest z88.dyn aus und definiert MAXGRA und MAXNDL
37 * hier wird File Z88.DYN geoffnet
38 * 30.7.2011 Rieg
39 ***********************************************************************/
40
41 /***********************************************************************
42 * Fuer UNIX
43 ***********************************************************************/
44 #ifdef FR_UNIX
45 #include <z88h.h>
46 #include <stdio.h> /* FILE,NULL,fopen,fclose,fgets */
47 #include <string.h> /* strstr */
48 #endif
49
50 /***********************************************************************
51 * Fuer Windows
52 ***********************************************************************/
53 #ifdef FR_WIN
54 #include <z88h.h>
55 #include <stdio.h> /* FILE,NULL,fopen,fclose,fgets */
56 #include <string.h> /* strstr */
57 #endif
58
59 /***********************************************************************
60 * Formatbeschreiber
61 ***********************************************************************/
62 #ifdef FR_XINT
63 #define PD "%d"
64 #endif
65
66 #ifdef FR_XLONG
67 #define PD "%ld"
68 #endif
69
70 #ifdef FR_XLOLO
71 #define PD "%lld"
72 #endif
73
74 /***********************************************************************
75 * Functions
76 ***********************************************************************/
77 int wlog88h(FR_INT4,int);
78
79 /***********************************************************************
80 * hier beginnt Function rdy88h
81 ***********************************************************************/
rdy88h(void)82 int rdy88h(void)
83 {
84 extern FILE *fdyn, *fwlo;
85 extern char cdyn[];
86
87 extern FR_INT4 MAXGRA,MAXNDL;
88
89 char cline[256], cdummy[80];
90
91 /*----------------------------------------------------------------------
92 * Dyn- Datei z88.dyn oeffnen
93 *---------------------------------------------------------------------*/
94 wlog88h(0,LOG_OPENDYN);
95 fdyn= fopen(cdyn,"r");
96 if(fdyn == NULL)
97 {
98 wlog88h(0,LOG_NODYN);
99 fclose(fwlo);
100 return(AL_NODYN);
101 }
102 rewind(fdyn);
103
104 /*----------------------------------------------------------------------
105 * Dyn- Datei z88.dyn lesen
106 *---------------------------------------------------------------------*/
107 fgets(cline,256,fdyn);
108
109 if( (strstr(cline,"DYNAMIC START"))!= NULL) /* Lesen File */
110 {
111 do
112 {
113 fgets(cline,256,fdyn);
114
115 if( (strstr(cline,"CUTKEE START"))!= NULL) /* Lesen CUTKEE */
116 {
117 do
118 {
119 fgets(cline,256,fdyn);
120 if( (strstr(cline,"MAXGRA"))!= NULL) /* Lesen MAXGRA */
121 sscanf(cline,"%s " PD,cdummy,&MAXGRA);
122 if( (strstr(cline,"MAXNDL"))!= NULL) /* Lesen MAXNDL */
123 sscanf(cline,"%s " PD,cdummy,&MAXNDL);
124 }
125 while( (strstr(cline,"CUTKEE END"))== NULL);
126 }
127
128 }
129 while( (strstr(cline,"DYNAMIC END"))== NULL);
130
131 } /* end if DYNAMIC START */
132 else
133 {
134 wlog88h(0,LOG_WRONGDYN);
135 fclose(fwlo);
136 return(AL_WRONGDYN);
137 }
138
139 if(MAXGRA <= 0 || MAXNDL <= 0 )
140 {
141 wlog88h(0,LOG_WRONGDYN);
142 fclose(fwlo);
143 return(AL_WRONGDYN);
144 }
145
146 /*----------------------------------------------------------------------
147 * korrekt gelesen, File fdyn schliessen
148 *---------------------------------------------------------------------*/
149 fclose(fdyn);
150
151 wlog88h(0,LOG_OKDYN);
152
153 return(0);
154 }
155