1 /* Regroupement des sources "C" pour compilation */
7 void IGESFile_Check21 (int mode,char * code, int num, char * str);
9 void IGESFile_Check3 (int mode,char * code);
10 void IGESFile_Check2 (int mode,char * code, int num, char * str);
12 /* #include "structiges.c" ... fait par analiges qui en a l'usage ... */
14 int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes);
15 void iges_newparam(int typarg,int longval, char *parval);
16 void iges_param(int *Pstat,char *ligne,char c_separ,char c_fin,int lonlin);
17 void iges_Dsect (int *Dstat,int numsec,char* ligne);
18 void iges_Psect(int *Pstat,int numsec,char ligne[80]);
22 /* Routine de lecture generale d'un fichier IGES
23 Assure l'enchainement des appels necessaires
24 Il en resulte un ensemble de donnees (struct C) interrogeables par
25 routines ad hoc (cf igesread.h qui les recapitule pour appel par C++)
27 Retourne : 0 si OK, 1 si fichier pas pu etre ouvert
33 /*#include <string.h>*/
34 /* To use Msg class */
35 /*#include <MoniTool_Msg.hxx>*/
37 static char sects [] = " SGDPT ";
40 int igesread(nomfic,lesect,modefnes)
41 char* nomfic; int lesect[6]; int modefnes;
45 FILE* lefic; char ligne[100]; int numsec, numl; int i; int i0;int j;
48 int Dstat = 0; int Pstat = 0; char c_separ = ','; char c_fin = ';';
50 lefic = stdin; i0 = numsec = 0; numl = 0;
51 if (nomfic[1] != '\0') lefic = fopen(nomfic,"r");
52 if (lefic == NULL) return -1; /* fichier pas pu etre ouvert */
53 for (i = 1; i < 6; i++) lesect[i] = 0;
54 for (j = 0; j < 100; j++) ligne[j] = 0;
57 i = iges_lire(lefic,&numsec,ligne,modefnes);
60 /* Sending of message : Syntax error */
64 IGESFile_Check2 (0,"XSTEP_18",numl,str); /* //gka 15 Sep 98: str instead of sects[i0]); */
67 if (i0 == 0) return -1;
72 if (numsec != lesect[i]) {
73 /* Sending of message : Syntax error */
76 IGESFile_Check2 (0,"XSTEP_19",numl,str); /* //gka 15 Sep 98: str instead of sects[i0]); */
79 if (i == 1) { /* Start Section (comm.) */
81 iges_newparam (0,72,ligne);
83 if (i == 2) { /* Header (Global sect) */
86 if (lesect[i] == 1) { /* Separation specifique */
88 if (ligne[0] != ',') { c_separ = ligne[2]; n0 = 3; }
89 if (ligne[n0+1] != c_separ) { c_fin = ligne[n0+3]; }
91 iges_param(&Pstat,ligne,c_separ,c_fin,72);
92 if (Pstat != 2) break;
95 if (i == 3) iges_Dsect(&Dstat,numsec,ligne); /* Directory (Dsect) */
96 if (i == 4) { /* Parametres (Psect) */
97 iges_Psect(&Pstat,numsec,ligne);
99 iges_param(&Pstat,ligne,c_separ,c_fin,64);
100 if (Pstat != 2) break;
105 /* Sending of message : No Terminal Section */
106 if (lesect[5] == 0) {
107 IGESFile_Check3 (0,"XSTEP_20");