2 Copyright (c) 1999-2014 OPEN CASCADE SAS
4 This file is part of Open CASCADE Technology software library.
6 This library is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License version 2.1 as published
8 by the Free Software Foundation, with special exception defined in the file
9 OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 distribution for complete text of the license and disclaimer of any warranty.
12 Alternatively, this file may be used under the terms of Open CASCADE
13 commercial license or contractual agreement.
16 /* Regroupement des sources "C" pour compilation */
21 void IGESFile_Check21 (int mode,char * code, int num, char * str);
23 void IGESFile_Check3 (int mode,char * code);
24 void IGESFile_Check2 (int mode,char * code, int num, char * str);
26 /* #include "structiges.c" ... fait par analiges qui en a l'usage ... */
28 int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes);
29 void iges_newparam(int typarg,int longval, char *parval);
30 void iges_param(int *Pstat,char *ligne,char c_separ,char c_fin,int lonlin);
31 void iges_Dsect (int *Dstat,int numsec,char* ligne);
32 void iges_Psect(int numsec,char ligne[80]);
36 /* Routine de lecture generale d'un fichier IGES
37 Assure l'enchainement des appels necessaires
38 Il en resulte un ensemble de donnees (struct C) interrogeables par
39 routines ad hoc (cf igesread.h qui les recapitule pour appel par C++)
41 Retourne : 0 si OK, 1 si fichier pas pu etre ouvert
47 /*#include <string.h>*/
48 /* To use Msg class */
49 /*#include <MoniTool_Msg.hxx>*/
51 static char sects [] = " SGDPT ";
54 int igesread (char* nomfic, int lesect[6], int modefnes)
58 FILE* lefic; char ligne[100]; int numsec, numl; int i; int i0;int j;
61 int Dstat = 0; int Pstat = 0; char c_separ = ','; char c_fin = ';';
63 lefic = stdin; i0 = numsec = 0; numl = 0;
64 if (nomfic[1] != '\0') lefic = fopen(nomfic,"r");
65 if (lefic == NULL) return -1; /* fichier pas pu etre ouvert */
66 for (i = 1; i < 6; i++) lesect[i] = 0;
67 for (j = 0; j < 100; j++) ligne[j] = 0;
70 i = iges_lire(lefic,&numsec,ligne,modefnes);
73 /* Sending of message : Syntax error */
77 IGESFile_Check2 (0,"XSTEP_18",numl,str); /* //gka 15 Sep 98: str instead of sects[i0]); */
80 if (i0 == 0) return -1;
85 if (numsec != lesect[i]) {
86 /* Sending of message : Syntax error */
89 IGESFile_Check2 (0,"XSTEP_19",numl,str); /* //gka 15 Sep 98: str instead of sects[i0]); */
92 if (i == 1) { /* Start Section (comm.) */
94 iges_newparam (0,72,ligne);
96 if (i == 2) { /* Header (Global sect) */
99 if (lesect[i] == 1) { /* Separation specifique */
101 if (ligne[0] != ',') { c_separ = ligne[2]; n0 = 3; }
102 if (ligne[n0+1] != c_separ) { c_fin = ligne[n0+3]; }
104 iges_param(&Pstat,ligne,c_separ,c_fin,72);
105 if (Pstat != 2) break;
108 if (i == 3) iges_Dsect(&Dstat,numsec,ligne); /* Directory (Dsect) */
109 if (i == 4) { /* Parametres (Psect) */
110 iges_Psect(numsec,ligne);
112 iges_param(&Pstat,ligne,c_separ,c_fin,64);
113 if (Pstat != 2) break;
118 /* Sending of message : No Terminal Section */
119 if (lesect[5] == 0) {
120 IGESFile_Check3 (1, "XSTEP_20");