~ubuntu-branches/ubuntu/intrepid/gmsh/intrepid

« back to all changes in this revision

Viewing changes to Geo/GeoStringInterface.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Emmet Hikory
  • Date: 2007-05-07 10:01:37 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070507100137-6j0rzz1ucbn0m2jt
Tags: 2.0.7-1ubuntu1
* Merged with Debian unstable.  Remaining Ubuntu changes:
  - Add .desktop file
  - Add icon
* Added XSBC-Original-Maintainer
* Removed Application Category from gmsh.desktop
* Link against GLU (fixes FTBFS)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// $Id: GeoStringInterface.cpp,v 1.8 2007/02/07 13:06:49 geuzaine Exp $
 
2
//
 
3
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 
4
//
 
5
// This program is free software; you can redistribute it and/or modify
 
6
// it under the terms of the GNU General Public License as published by
 
7
// the Free Software Foundation; either version 2 of the License, or
 
8
// (at your option) any later version.
 
9
//
 
10
// This program is distributed in the hope that it will be useful,
 
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
// GNU General Public License for more details.
 
14
//
 
15
// You should have received a copy of the GNU General Public License
 
16
// along with this program; if not, write to the Free Software
 
17
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
18
// USA.
 
19
// 
 
20
// Please report all bugs and problems to <gmsh@geuz.org>.
 
21
 
 
22
#include "Gmsh.h"
 
23
#include "Numeric.h"
 
24
#include "Geo.h"
 
25
#include "GeoStringInterface.h"
 
26
#include "Parser.h"
 
27
#include "OpenFile.h"
 
28
#include "Context.h"
 
29
#include "GModel.h"
 
30
 
 
31
extern Context_T CTX;
 
32
extern GModel *GMODEL;
 
33
 
 
34
#define BUFFSIZE 128000
 
35
 
 
36
// Some old systems don't have snprintf... Just call sprintf instead.
 
37
 
 
38
#if defined(HAVE_NO_SNPRINTF)
 
39
int snprintf(char *str, size_t size, const char* fmt, ...){
 
40
  va_list args;
 
41
  va_start(args, fmt);
 
42
  int ret = vsprintf(str, fmt, args);
 
43
  va_end(args);
 
44
  return ret;
 
45
}
 
46
#endif
 
47
 
 
48
double evaluate_scalarfunction(char *var, double val, char *funct)
 
49
{
 
50
  FILE *tempf;
 
51
  tempf = yyin;
 
52
 
 
53
  if(!(yyin = fopen(CTX.tmp_filename_fullpath, "w"))) {
 
54
    Msg(GERROR, "Unable to open temporary file '%s'", CTX.tmp_filename_fullpath);
 
55
    return 0.;
 
56
  }
 
57
 
 
58
  // pose "variable = function" and evaluate function
 
59
  fprintf(yyin, "%s = %.16g ;\n", var, val);
 
60
  fprintf(yyin, "ValeurTemporaire__ = %s ;\n", funct);
 
61
  fclose(yyin);
 
62
  yyin = fopen(CTX.tmp_filename_fullpath, "r");
 
63
  while(!feof(yyin)) {
 
64
    yyparse();
 
65
  }
 
66
  fclose(yyin);
 
67
  yyin = tempf;
 
68
 
 
69
  // retreive value
 
70
  Symbol TheSymbol, *TheSymbol_P;
 
71
  TheSymbol.Name = (char *)Malloc(100*sizeof(char));
 
72
  strcpy(TheSymbol.Name, "ValeurTemporaire__");
 
73
  if(!(TheSymbol_P = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
 
74
    Free(TheSymbol.Name);
 
75
    return 0.0;
 
76
  }
 
77
  Free(TheSymbol.Name);
 
78
  return *(double *)List_Pointer(TheSymbol_P->val, 0);
 
79
}
 
80
 
 
81
void add_infile(char *text, char *fich, bool deleted_something)
 
82
{
 
83
  if(!(yyin = fopen(CTX.tmp_filename_fullpath, "w"))) {
 
84
    Msg(GERROR, "Unable to open temporary file '%s'", CTX.tmp_filename_fullpath);
 
85
    return;
 
86
  }
 
87
 
 
88
  fprintf(yyin, "%s\n", text);
 
89
  Msg(STATUS2, "%s", text);
 
90
  fclose(yyin);
 
91
  yyin = fopen(CTX.tmp_filename_fullpath, "r");
 
92
  while(!feof(yyin)) {
 
93
    yyparse();
 
94
  }
 
95
  fclose(yyin);
 
96
 
 
97
  if(deleted_something){
 
98
    // we need to start from scratch since the command just parsed
 
99
    // could have deleted some entities
 
100
    GMODEL->destroy();
 
101
  }
 
102
  GMODEL->importTHEM();
 
103
  CTX.mesh.changed = ENT_ALL;
 
104
 
 
105
  FILE *file;
 
106
  if(!(file = fopen(fich, "a"))) {
 
107
    Msg(GERROR, "Unable to open file '%s'", fich);
 
108
    return;
 
109
  }
 
110
  
 
111
  if(!CTX.expert_mode) {
 
112
    char base[256], ext[256];
 
113
    SplitFileName(fich, base, ext);
 
114
    if(strlen(ext) && strcmp(ext, ".geo") && strcmp(ext, ".GEO")){
 
115
      char question[1024];
 
116
      sprintf(question, 
 
117
              "A scripting command is going to be appended to a non-`.geo' file.\n\n"
 
118
              "Are you sure you want to proceed?\n\n"
 
119
              "(You might want to create a new `.geo' file containing the command\n\n"
 
120
              "Merge \"%s\";\n\n"
 
121
              "and use that file instead. To disable this warning in the future, select\n"
 
122
              "`Enable expert mode' in the option dialog.)", fich);
 
123
      if(!GetBinaryAnswer(question, "Proceed", "Cancel", false)){
 
124
        fclose(file);
 
125
        return;
 
126
      }
 
127
    }
 
128
  }
 
129
 
 
130
  fprintf(file, "%s\n", text);
 
131
  fclose(file);
 
132
}
 
133
 
 
134
void coherence(char *fich)
 
135
{
 
136
  add_infile("Coherence;", fich, true);
 
137
}
 
138
 
 
139
void strncat_list(char *text, List_T *list)
 
140
{
 
141
  char text2[BUFFSIZE];
 
142
  for(int i = 0; i < List_Nbr(list); i++){
 
143
    int num;
 
144
    List_Read(list, i, &num);
 
145
    if(!i)
 
146
      snprintf(text2, BUFFSIZE, "%d", num);
 
147
    else
 
148
      snprintf(text2, BUFFSIZE, ",%d", num);
 
149
    strncat(text, text2, BUFFSIZE-strlen(text));
 
150
  }
 
151
}
 
152
 
 
153
void delet(List_T *list, char *fich, char *what)
 
154
{
 
155
  char text[BUFFSIZE];
 
156
 
 
157
  snprintf(text, BUFFSIZE, "Delete {\n  %s{", what);
 
158
  strncat_list(text, list);
 
159
  strncat(text, "};\n}", BUFFSIZE-strlen(text));
 
160
  add_infile(text, fich, true);
 
161
}
 
162
 
 
163
void add_trsfsurf(int N, int *l, char *fich, char *dir)
 
164
{
 
165
  char text[BUFFSIZE], text2[BUFFSIZE];
 
166
 
 
167
  snprintf(text, BUFFSIZE, "Transfinite Surface {%d} = {", l[0]);
 
168
  for(int i = 1; i < N; i++) {
 
169
    if(i == 1)
 
170
      snprintf(text2, BUFFSIZE, "%d", l[i]);
 
171
    else
 
172
      snprintf(text2, BUFFSIZE, ",%d", l[i]);
 
173
    strncat(text, text2, BUFFSIZE-strlen(text));
 
174
  }
 
175
  if (!strcmp(dir,"Left"))
 
176
    snprintf(text2, BUFFSIZE, "};");
 
177
  else
 
178
    snprintf(text2, BUFFSIZE, "} %s;",dir);
 
179
 
 
180
  strncat(text, text2, BUFFSIZE-strlen(text));
 
181
  add_infile(text, fich);
 
182
}
 
183
 
 
184
void add_charlength(List_T *list, char *fich, char *lc)
 
185
{
 
186
  char text[BUFFSIZE];
 
187
 
 
188
  snprintf(text, BUFFSIZE, "Characteristic Length {");
 
189
  strncat_list(text, list);
 
190
  strncat(text, "} = ", BUFFSIZE-strlen(text));
 
191
  strncat(text, lc, BUFFSIZE-strlen(text));
 
192
  strncat(text, ";", BUFFSIZE-strlen(text));
 
193
  add_infile(text, fich);
 
194
}
 
195
 
 
196
void add_recosurf(List_T *list, char *fich)
 
197
{
 
198
  char text[BUFFSIZE];
 
199
 
 
200
  snprintf(text, BUFFSIZE, "Recombine Surface {");
 
201
  strncat_list(text, list);
 
202
  strncat(text, "};", BUFFSIZE-strlen(text));
 
203
  add_infile(text, fich);
 
204
}
 
205
 
 
206
void add_trsfline(int N, int *l, char *fich, char *type, char *typearg, char *pts)
 
207
{
 
208
  char text[BUFFSIZE], text2[BUFFSIZE];
 
209
 
 
210
  snprintf(text, BUFFSIZE, "Transfinite Line {");
 
211
  for(int i = 0; i < N; i++) {
 
212
    if(!i)
 
213
      snprintf(text2, BUFFSIZE, "%d", l[i]);
 
214
    else
 
215
      snprintf(text2, BUFFSIZE, ",%d", l[i]);
 
216
    strncat(text, text2, BUFFSIZE-strlen(text));
 
217
  }
 
218
  if(strlen(typearg))
 
219
    snprintf(text2, BUFFSIZE, "} = %s Using %s %s;", pts, type, typearg);
 
220
  else
 
221
    snprintf(text2, BUFFSIZE, "} = %s;", pts);
 
222
  strncat(text, text2, BUFFSIZE-strlen(text));
 
223
  add_infile(text, fich);
 
224
}
 
225
 
 
226
void add_param(char *par, char *value, char *fich)
 
227
{
 
228
  char text[BUFFSIZE];
 
229
  snprintf(text, BUFFSIZE, "%s = %s;", par, value);
 
230
  add_infile(text, fich);
 
231
}
 
232
 
 
233
void add_point(char *fich, char *x, char *y, char *z, char *lc)
 
234
{
 
235
  char text[BUFFSIZE];
 
236
  int ip = NEWPOINT();
 
237
  snprintf(text, BUFFSIZE, "Point(%d) = {%s,%s,%s,%s};", ip, x, y, z, lc);
 
238
  add_infile(text, fich);
 
239
}
 
240
 
 
241
void add_attractor(char *fich, int ip, int typ, char *ax, char *ay, char *ad)
 
242
{
 
243
  char text[BUFFSIZE];
 
244
  if(typ == 0) {
 
245
    snprintf(text, BUFFSIZE, "Attractor Point {%d} = {%s,%s,%s} = ;", ip, ax, ay, ad);
 
246
  }
 
247
  else if(typ == 1) {
 
248
    snprintf(text, BUFFSIZE, "Attractor Line {%d} = {%s,%s,%s};", ip, ax, ay, ad);
 
249
  }
 
250
  else if(typ == 2) {
 
251
    snprintf(text, BUFFSIZE, "Attractor Surface {%d} = {%s,%s,%s};", ip, ax, ay, ad);
 
252
  }
 
253
  add_infile(text, fich);
 
254
}
 
255
 
 
256
 
 
257
void add_line(int p1, int p2, char *fich)
 
258
{
 
259
  char text[BUFFSIZE];
 
260
  int iseg;
 
261
  List_T *list = List_Create(2, 2, sizeof(int));
 
262
  List_Add(list, &p1);
 
263
  List_Add(list, &p2);
 
264
  if((recognize_seg(MSH_SEGM_LINE, list, &iseg))) {
 
265
    List_Delete(list);
 
266
    return;
 
267
  }
 
268
  List_Delete(list);
 
269
 
 
270
  snprintf(text, BUFFSIZE, "Line(%d) = {%d,%d};", NEWLINE(), p1, p2);
 
271
  add_infile(text, fich);
 
272
}
 
273
 
 
274
void add_circ(int p1, int p2, int p3, char *fich)
 
275
{
 
276
  char text[BUFFSIZE];
 
277
 
 
278
  snprintf(text, BUFFSIZE, "Circle(%d) = {%d,%d,%d};", NEWLINE(), p1, p2, p3);
 
279
  add_infile(text, fich);
 
280
}
 
281
 
 
282
void add_ell(int p1, int p2, int p3, int p4, char *fich)
 
283
{
 
284
  char text[BUFFSIZE];
 
285
 
 
286
  snprintf(text, BUFFSIZE, "Ellipse(%d) = {%d,%d,%d,%d};", NEWLINE(), p1, p2,
 
287
           p3, p4);
 
288
  add_infile(text, fich);
 
289
}
 
290
 
 
291
void add_spline(int N, int *p, char *fich)
 
292
{
 
293
  char text[BUFFSIZE], text2[BUFFSIZE];
 
294
 
 
295
  snprintf(text, BUFFSIZE, "CatmullRom(%d) = {", NEWLINE());
 
296
  for(int i = 0; i < N; i++) {
 
297
    if(i != N - 1)
 
298
      snprintf(text2, BUFFSIZE, "%d,", p[i]);
 
299
    else
 
300
      snprintf(text2, BUFFSIZE, "%d};", p[i]);
 
301
    strncat(text, text2, BUFFSIZE-strlen(text));
 
302
  }
 
303
  add_infile(text, fich);
 
304
}
 
305
 
 
306
void add_bezier(int N, int *p, char *fich)
 
307
{
 
308
  char text[BUFFSIZE], text2[BUFFSIZE];
 
309
 
 
310
  snprintf(text, BUFFSIZE, "Bezier(%d) = {", NEWLINE());
 
311
  for(int i = 0; i < N; i++) {
 
312
    if(i != N - 1)
 
313
      snprintf(text2, BUFFSIZE, "%d,", p[i]);
 
314
    else
 
315
      snprintf(text2, BUFFSIZE, "%d};", p[i]);
 
316
    strncat(text, text2, BUFFSIZE-strlen(text));
 
317
  }
 
318
  add_infile(text, fich);
 
319
}
 
320
 
 
321
 
 
322
void add_bspline(int N, int *p, char *fich)
 
323
{
 
324
  char text[BUFFSIZE], text2[BUFFSIZE];
 
325
 
 
326
  snprintf(text, BUFFSIZE, "BSpline(%d) = {", NEWLINE());
 
327
  for(int i = 0; i < N; i++) {
 
328
    if(i != N - 1)
 
329
      snprintf(text2, BUFFSIZE, "%d,", p[i]);
 
330
    else
 
331
      snprintf(text2, BUFFSIZE, "%d};", p[i]);
 
332
    strncat(text, text2, BUFFSIZE-strlen(text));
 
333
  }
 
334
  add_infile(text, fich);
 
335
}
 
336
 
 
337
void add_multline(int N, int *p, char *fich)
 
338
{
 
339
  char text[BUFFSIZE], text2[BUFFSIZE];
 
340
  int iseg;
 
341
 
 
342
  List_T *list = List_Create(N, 2, sizeof(int));
 
343
  for(int i = 0; i < N; i++)
 
344
    List_Add(list, &p[i]);
 
345
  if((recognize_seg(MSH_SEGM_LINE, list, &iseg))) {
 
346
    List_Delete(list);
 
347
    return;
 
348
  }
 
349
  List_Delete(list);
 
350
 
 
351
  snprintf(text, BUFFSIZE, "Line(%d) = {", NEWLINE());
 
352
  for(int i = 0; i < N; i++) {
 
353
    if(i != N - 1)
 
354
      snprintf(text2, BUFFSIZE, "%d,", p[i]);
 
355
    else
 
356
      snprintf(text2, BUFFSIZE, "%d};", p[i]);
 
357
    strncat(text, text2, BUFFSIZE-strlen(text));
 
358
  }
 
359
  add_infile(text, fich);
 
360
}
 
361
 
 
362
void add_lineloop(List_T *list, char *fich, int *numloop)
 
363
{
 
364
  char text[BUFFSIZE];
 
365
 
 
366
  if((recognize_loop(list, numloop)))
 
367
    return;
 
368
 
 
369
  *numloop = NEWLINELOOP();
 
370
  snprintf(text, BUFFSIZE, "Line Loop(%d) = {", *numloop);
 
371
  strncat_list(text, list);
 
372
  strncat(text, "};", BUFFSIZE-strlen(text));
 
373
  add_infile(text, fich);
 
374
}
 
375
 
 
376
 
 
377
void add_surf(List_T *list, char *fich, int support, int typ)
 
378
{
 
379
  char text[BUFFSIZE];
 
380
 
 
381
  if(typ == 1) {
 
382
    snprintf(text, BUFFSIZE, "Ruled Surface(%d) = {", NEWSURFACE());
 
383
  }
 
384
  else {
 
385
    snprintf(text, BUFFSIZE, "Plane Surface(%d) = {", NEWSURFACE());
 
386
  }
 
387
  strncat_list(text, list);
 
388
  strncat(text, "};", BUFFSIZE-strlen(text));
 
389
  add_infile(text, fich);
 
390
}
 
391
 
 
392
void add_surfloop(List_T *list, char *fich, int *numvol)
 
393
{
 
394
  char text[BUFFSIZE];
 
395
 
 
396
  if((recognize_surfloop(list, numvol)))
 
397
    return;
 
398
 
 
399
  *numvol = NEWSURFACELOOP();
 
400
  snprintf(text, BUFFSIZE, "Surface Loop(%d) = {", *numvol);
 
401
  strncat_list(text, list);
 
402
  strncat(text, "};", BUFFSIZE-strlen(text));
 
403
  add_infile(text, fich);
 
404
}
 
405
 
 
406
void add_vol(List_T *list, char *fich)
 
407
{
 
408
  char text[BUFFSIZE];
 
409
 
 
410
  snprintf(text, BUFFSIZE, "Volume(%d) = {", NEWVOLUME());
 
411
  strncat_list(text, list);
 
412
  strncat(text, "};", BUFFSIZE-strlen(text));
 
413
  add_infile(text, fich);
 
414
}
 
415
 
 
416
void add_trsfvol(int N, int *l, char *fich)
 
417
{
 
418
  char text[BUFFSIZE], text2[BUFFSIZE];
 
419
 
 
420
  snprintf(text, BUFFSIZE, "Transfinite Volume{%d} = {", l[0]);
 
421
  for(int i = 1; i < N; i++) {
 
422
    if(i == 1)
 
423
      snprintf(text2, BUFFSIZE, "%d", l[i]);
 
424
    else
 
425
      snprintf(text2, BUFFSIZE, ",%d", l[i]);
 
426
    strncat(text, text2, BUFFSIZE-strlen(text));
 
427
  }
 
428
  snprintf(text2, BUFFSIZE, "};");
 
429
  strncat(text, text2, BUFFSIZE-strlen(text));
 
430
  add_infile(text, fich);
 
431
}
 
432
 
 
433
int add_physical(List_T *list, char *fich, int type)
 
434
{
 
435
  char text[BUFFSIZE];
 
436
  int num = NEWPHYSICAL();
 
437
  
 
438
  switch (type) {
 
439
  case ENT_POINT:
 
440
    snprintf(text, BUFFSIZE, "Physical Point(%d) = {", num);
 
441
    break;
 
442
  case ENT_LINE:
 
443
    snprintf(text, BUFFSIZE, "Physical Line(%d) = {", num);
 
444
    break;
 
445
  case ENT_SURFACE:
 
446
    snprintf(text, BUFFSIZE, "Physical Surface(%d) = {", num);
 
447
    break;
 
448
  case ENT_VOLUME:
 
449
    snprintf(text, BUFFSIZE, "Physical Volume(%d) = {", num);
 
450
    break;
 
451
  }
 
452
 
 
453
  strncat_list(text, list);
 
454
  strncat(text, "};", BUFFSIZE-strlen(text));
 
455
  add_infile(text, fich);
 
456
  
 
457
  return num;
 
458
}
 
459
 
 
460
void translate(int add, List_T *list, char *fich, char *what, char *tx, char *ty, char *tz)
 
461
{
 
462
  char text[BUFFSIZE];
 
463
 
 
464
  if(add)
 
465
    snprintf(text, BUFFSIZE, "Translate {%s,%s,%s} {\n  Duplicata { %s{", tx, ty, tz, what);
 
466
  else
 
467
    snprintf(text, BUFFSIZE, "Translate {%s,%s,%s} {\n  %s{", tx, ty, tz, what);
 
468
 
 
469
  strncat_list(text, list);
 
470
  
 
471
  if(add)
 
472
    strncat(text, "}; }\n}", BUFFSIZE-strlen(text));
 
473
  else
 
474
    strncat(text, "};\n}", BUFFSIZE-strlen(text));
 
475
 
 
476
  add_infile(text, fich);
 
477
}
 
478
 
 
479
void rotate(int add, List_T *list, char *fich, char *what, char *ax, char *ay, char *az,
 
480
            char *px, char *py, char *pz, char *angle)
 
481
{
 
482
  char text[BUFFSIZE];
 
483
 
 
484
  if(add)
 
485
    snprintf(text, BUFFSIZE, "Rotate {{%s,%s,%s}, {%s,%s,%s}, %s} {\n  Duplicata { %s{",
 
486
             ax, ay, az, px, py, pz, angle, what);
 
487
  else
 
488
    snprintf(text, BUFFSIZE, "Rotate {{%s,%s,%s}, {%s,%s,%s}, %s} {\n  %s{",
 
489
             ax, ay, az, px, py, pz, angle, what);
 
490
 
 
491
  strncat_list(text, list);
 
492
 
 
493
  if(add)
 
494
    strncat(text, "}; }\n}", BUFFSIZE-strlen(text));
 
495
  else
 
496
    strncat(text, "};\n}", BUFFSIZE-strlen(text));
 
497
 
 
498
  add_infile(text, fich);
 
499
}
 
500
 
 
501
void dilate(int add, List_T *list, char *fich, char *what, char *dx, char *dy, char *dz, char *df)
 
502
{
 
503
  char text[BUFFSIZE];
 
504
 
 
505
  if(add)
 
506
    snprintf(text, BUFFSIZE, "Dilate {{%s,%s,%s}, %s} {\n  Duplicata { %s{",
 
507
             dx, dy, dz, df, what);
 
508
  else
 
509
    snprintf(text, BUFFSIZE, "Dilate {{%s,%s,%s}, %s} {\n  %s{",
 
510
             dx, dy, dz, df, what);
 
511
 
 
512
  strncat_list(text, list);
 
513
 
 
514
  if(add)
 
515
    strncat(text, "}; }\n}", BUFFSIZE-strlen(text));
 
516
  else
 
517
    strncat(text, "};\n}", BUFFSIZE-strlen(text));
 
518
 
 
519
  add_infile(text, fich);
 
520
}
 
521
 
 
522
void symmetry(int add, List_T *list, char *fich, char *what, char *sa, char *sb, char *sc, char *sd)
 
523
{
 
524
  char text[BUFFSIZE];
 
525
 
 
526
  if(add)
 
527
    snprintf(text, BUFFSIZE, "Symmetry {%s,%s,%s,%s} {\n  Duplicata { %s{",
 
528
             sa, sb, sc, sd, what);
 
529
  else
 
530
    snprintf(text, BUFFSIZE, "Symmetry {%s,%s,%s,%s} {\n  %s{",
 
531
             sa, sb, sc, sd, what);
 
532
 
 
533
  strncat_list(text, list);
 
534
 
 
535
  if(add)
 
536
    strncat(text, "}; }\n}", BUFFSIZE-strlen(text));
 
537
  else
 
538
    strncat(text, "};\n}", BUFFSIZE-strlen(text));
 
539
 
 
540
  add_infile(text, fich);
 
541
}
 
542
 
 
543
void extrude(List_T *list, char *fich, char *what, char *tx, char *ty, char *tz)
 
544
{
 
545
  char text[BUFFSIZE];
 
546
 
 
547
  snprintf(text, BUFFSIZE, "Extrude {%s,%s,%s} {\n  %s{", tx, ty, tz, what);
 
548
  strncat_list(text, list);
 
549
  strncat(text, "};\n}", BUFFSIZE-strlen(text));
 
550
  add_infile(text, fich);
 
551
}
 
552
 
 
553
void protude(List_T *list, char *fich, char *what, char *ax, char *ay, char *az,
 
554
             char *px, char *py, char *pz, char *angle)
 
555
{
 
556
  char text[BUFFSIZE];
 
557
 
 
558
  snprintf(text, BUFFSIZE, "Extrude {{%s,%s,%s}, {%s,%s,%s}, %s} {\n  %s{",
 
559
           ax, ay, az, px, py, pz, angle, what);
 
560
  strncat_list(text, list);
 
561
  strncat(text, "};\n}", BUFFSIZE-strlen(text));
 
562
  add_infile(text, fich);
 
563
}