Debian Codegraph @

src/medit/parsar.c

raw symbols SCIP
1 /****************************************************************************/cxx . . $ `<file>/src/medit/parsar.c`/
2 /* This file is part of FreeFEM. */
3 /* */
4 /* FreeFEM is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU Lesser General Public License as */
6 /* published by the Free Software Foundation, either version 3 of */
7 /* the License, or (at your option) any later version. */
8 /* */
9 /* FreeFEM is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU Lesser General Public License for more details. */
13 /* */
14 /* You should have received a copy of the GNU Lesser General Public License */
15 /* along with FreeFEM. If not, see <http://www.gnu.org/licenses/>. */
16 /****************************************************************************/
17 /* SUMMARY : ... parse arguments from command line */
18 /* LICENSE : LGPLv3 */
19 /* ORG : LJLL Universite Pierre et Marie Curie, Paris, FRANCE */
20 /* AUTHORS : Pascal Frey */
21 /* E-MAIL : [email protected] */
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include "medit.h"cxx . . $ `<file>/src/medit/medit.h`/
28 #include "extern.h"cxx . . $ `<file>/src/medit/extern.h`/
29 #include "sproto.h"cxx . . $ `<file>/src/medit/sproto.h`/
30
31 short schwcxx . . $ schw., schhcxx . . $ schh.;
32 extern ubytecxx . . $ ubyte# optioncxx . . $ option., infoglcxx . . $ infogl., fullscreencxx . . $ fullscreen., dosurfcxx . . $ dosurf., stereoModecxx . . $ stereoMode.;
33
34 /* rajout popen */
35 extern ubytecxx . . $ ubyte# dpopencxx . . $ dpopen.;
36 extern ubytecxx . . $ ubyte# dpopenbincxx . . $ dpopenbin.;
37 extern ubytecxx . . $ ubyte# dpopensolcxx . . $ dpopensol.;
38
39 void usagecxx . . $ usage(d878ad36e69247c7).( ) {
40 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "Usage: medit [options] [f1 .. fn]\n");
41 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "\n** Generic options :\n");
42 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-d \t Debug mode (lot of info)\n");
43 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-fs\t Fullscreen mode\n");
44 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-h \t Print this message\n");
45 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-i \t Print info on OpenGL configuration\n");
46 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-l \t Process very large files\n");
47 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-s \t Do no build surface\n");
48 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-v \t Turn off quiet mode\n");
49 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "f1..fn\t Input data file(s)\n");
50 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "\n** Graphic options\n");
51 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-a start stop\t Animation sequence\n");
52 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-m Morphing\n");
53 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-xv width height\t Visual Schnauzer\n");
54 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "-stereo\t Stereo mode\n");
55 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "\n");
56 exitcxx . . $ exit(3ca292c338df9bb3).(1);
57 }
58
59 int parsarcxx . . $ parsar(afcd3168fc1188a4).(int argc, char *argv[]) {
60 pMeshcxx . . $ pMesh# mesh;
61 int i;
62 int k;
63
64 /* default*/
65 cvcxx . . $ cv..nbmcxx . . $ canvas#nbm. = cvcxx . . $ cv..nbscxx . . $ canvas#nbs. = 0;
66 i = 1;
67 infoglcxx . . $ infogl. = FALSEcxx . . $ `src/medit/medit.h:77:9`!;
68 dosurfcxx . . $ dosurf. = 1;
69 stereoModecxx . . $ stereoMode. = MONOcxx . . $ `src/medit/grafic.h:51:9`!;
70
71 while (i < argc) {
72 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-h") || !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-help")) {
73 usagecxx . . $ usage(d878ad36e69247c7).( );
74 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-d") || !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-debug")) {
75 ddebugcxx . . $ ddebug. = TRUEcxx . . $ `src/medit/medit.h:76:9`!;
76 }
77 // Rajout de l option popen
78 else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-popen")) {
79 dpopencxx . . $ dpopen. = TRUEcxx . . $ `src/medit/medit.h:76:9`!;
80
81 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i + 1], "-filebin")) {
82 dpopenbincxx . . $ dpopenbin. = TRUEcxx . . $ `src/medit/medit.h:76:9`!;
83 i = i + 1;
84 }
85
86 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i + 1], "-addsol")) {
87 dpopensolcxx . . $ dpopensol. = TRUEcxx . . $ `src/medit/medit.h:76:9`!;
88 i = i + 1;
89 }
90
91 if (dpopensolcxx . . $ dpopensol. == TRUEcxx . . $ `src/medit/medit.h:76:9`! && dpopenbincxx . . $ dpopenbin. == TRUEcxx . . $ `src/medit/medit.h:76:9`!)
92 printfcxx . . $ printf(581fddd72a8db8fc).("medit with binary version of popen : mesh(es) and solution(s) \n");
93 else if (dpopensolcxx . . $ dpopensol. == FALSEcxx . . $ `src/medit/medit.h:77:9`! && dpopenbincxx . . $ dpopenbin. == TRUEcxx . . $ `src/medit/medit.h:76:9`!)
94 printfcxx . . $ printf(581fddd72a8db8fc).("medit with binary version of popen : mesh(es) \n");
95 else if (dpopensolcxx . . $ dpopensol. == TRUEcxx . . $ `src/medit/medit.h:76:9`! && dpopenbincxx . . $ dpopenbin. == FALSEcxx . . $ `src/medit/medit.h:77:9`!)
96 printfcxx . . $ printf(581fddd72a8db8fc).("medit with popen : mesh(es) and solution(s) \n");
97 else
98 printfcxx . . $ printf(581fddd72a8db8fc).("medit with popen : mesh(es) \n");
99
100 if (i + 1 != argc) {
101 cvcxx . . $ cv..nbmcxx . . $ canvas#nbm. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[i + 1]);
102 i++;
103 if (cvcxx . . $ cv..nbmcxx . . $ canvas#nbm. == 0) return (0);
104 }
105
106 for (k = 0; k < cvcxx . . $ cv..nbmcxx . . $ canvas#nbm.; k++) {
107 cvcxx . . $ cv..meshcxx . . $ canvas#mesh.[k] = (pMeshcxx . . $ pMesh#)M_calloccxx . . $ M_calloc(bd9d5902f7a1c84b).(1, sizeof(Meshcxx . . $ Mesh#), "parsar.mesh");
108 if (!cvcxx . . $ cv..meshcxx . . $ canvas#mesh.[k]) return (0);
109
110 mesh = cvcxx . . $ cv..meshcxx . . $ canvas#mesh.[k];
111 strcpycxx . . $ strcpy(b7b3a83273496486).(mesh->namecxx . . $ mesh#name., argv[i + 1]);
112 printfcxx . . $ printf(581fddd72a8db8fc).("mesh_name= %s\n", mesh->namecxx . . $ mesh#name.);
113 i++;
114 }
115
116 }
117 // Fin Rajout de popen
118 else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-i")) {
119 infoglcxx . . $ infogl. = TRUEcxx . . $ `src/medit/medit.h:76:9`!;
120 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-fs")) {
121 fullscreencxx . . $ fullscreen. = TRUEcxx . . $ `src/medit/medit.h:76:9`!;
122 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-l")) {
123 optioncxx . . $ option. = VERYBIGcxx . . $ VERYBIG.;
124 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-m")) {
125 optioncxx . . $ option. = MORPHINGcxx . . $ MORPHING.;
126 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-iso")) {
127 optioncxx . . $ option. = ISOSURFcxx . . $ ISOSURF.;
128 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-stereo")) {
129 stereoModecxx . . $ stereoMode. = LEFTcxx . . $ `src/medit/grafic.h:52:9`! + RIGHTcxx . . $ `src/medit/grafic.h:53:9`!;
130 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-s")) {
131 dosurfcxx . . $ dosurf. = 0;
132 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-v")) {
133 quietcxx . . $ quiet. = 0;
134 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-xv")) {
135 if (++i < argc && isdigitcxx . . $ `<external>/17904084882347303253/ctype.h:192:10`!(argv[i][0]))
136 schwcxx . . $ schw. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[i]);
137 else
138 usagecxx . . $ usage(d878ad36e69247c7).( );
139
140 if (++i < argc && isdigitcxx . . $ `<external>/17904084882347303253/ctype.h:192:10`!(argv[i][0]))
141 schhcxx . . $ schh. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[i]);
142 else
143 usagecxx . . $ usage(d878ad36e69247c7).( );
144
145 optioncxx . . $ option. = SCHNAUZERcxx . . $ SCHNAUZER.;
146 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-a")) {
147 optioncxx . . $ option. = SEQUENCEcxx . . $ SEQUENCE.;
148 if (++i < argc && isdigitcxx . . $ `<external>/17904084882347303253/ctype.h:192:10`!(argv[i][0])) animdepcxx . . $ animdep. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[i]);
149
150 if (++i < argc && isdigitcxx . . $ `<external>/17904084882347303253/ctype.h:192:10`!(argv[i][0])) animfincxx . . $ animfin. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[i]);
151 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "-p")) {
152 optioncxx . . $ option. = SEQUENCEcxx . . $ SEQUENCE. + PARTICLEcxx . . $ PARTICLE.;
153 if (++i < argc && isdigitcxx . . $ `<external>/17904084882347303253/ctype.h:192:10`!(argv[i][0])) animdepcxx . . $ animdep. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[i]);
154
155 if (++i < argc && isdigitcxx . . $ `<external>/17904084882347303253/ctype.h:192:10`!(argv[i][0])) animfincxx . . $ animfin. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[i]);
156 } else {
157 if (!cvcxx . . $ cv..meshcxx . . $ canvas#mesh.[cvcxx . . $ cv..nbmcxx . . $ canvas#nbm.]) {
158 cvcxx . . $ cv..meshcxx . . $ canvas#mesh.[cvcxx . . $ cv..nbmcxx . . $ canvas#nbm.] = (pMeshcxx . . $ pMesh#)M_calloccxx . . $ M_calloc(bd9d5902f7a1c84b).(1, sizeof(Meshcxx . . $ Mesh#), "parsar.mesh");
159 if (!cvcxx . . $ cv..meshcxx . . $ canvas#mesh.[cvcxx . . $ cv..nbmcxx . . $ canvas#nbm.]) return (0);
160 }
161
162 mesh = cvcxx . . $ cv..meshcxx . . $ canvas#mesh.[cvcxx . . $ cv..nbmcxx . . $ canvas#nbm.];
163 strcpycxx . . $ strcpy(b7b3a83273496486).(mesh->namecxx . . $ mesh#name., argv[i]);
164 if (ddebugcxx . . $ ddebug.) printfcxx . . $ printf(581fddd72a8db8fc).("parsar: mesh[%d] %s\n", cvcxx . . $ cv..nbmcxx . . $ canvas#nbm., mesh->namecxx . . $ mesh#name.);
165
166 if (++cvcxx . . $ cv..nbmcxx . . $ canvas#nbm. == MAX_MESHcxx . . $ `src/medit/medit.h:64:9`!) return (1);
167 }
168
169 i++;
170 }
171
172 return (1);
173 }
174
175 #ifdef __cplusplus
176 }
177 #endif