b311480e |
1 | // Created on: 1997-10-22 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
0797d9d3 |
17 | #ifdef OCCT_DEBUG |
7fd59977 |
18 | |
19 | #include <Standard_Type.hxx> |
20 | #include <TCollection_AsciiString.hxx> |
21 | #include <TColStd_ListOfInteger.hxx> |
22 | #include <TColStd_ListIteratorOfListOfInteger.hxx> |
23 | #include <TopOpeBRepTool_define.hxx> |
24 | |
25 | #define AS(x) (Standard_PCharacter)TCollection_AsciiString((x)).ToCString(); |
26 | #define I 10 |
27 | #define J 10 |
28 | #define OK(x,y) (x)<I&&(y)<J |
29 | #define T(x,y) myT[(x)][(y)] |
30 | #define L0(x,y) for((x)=0;(x)<(y);(x)++) |
31 | #define A(v) (atoi(a[(v)])) |
32 | |
33 | class BOOPNINTL{ |
34 | public:BOOPNINTL(); |
35 | Standard_Boolean Get(Standard_Integer n,char**a); |
36 | Standard_Integer Set(const Standard_Boolean b,Standard_Integer n,char**a); |
37 | private: |
38 | TColStd_ListOfInteger myTL[I]; |
39 | Standard_Boolean myTB[I]; |
40 | Standard_Integer mynl; |
41 | }; |
42 | |
43 | BOOPNINTL::BOOPNINTL(){Set(Standard_False,0,NULL);} |
44 | |
45 | Standard_Integer BOOPNINTL::Set(const Standard_Boolean b,Standard_Integer n,char**a) |
46 | { |
47 | if(n == 0) { |
48 | Standard_Integer i; L0(i,I) { myTB[i] = Standard_False; myTL[i].Clear(); } |
49 | mynl = 0; |
50 | return 0; |
51 | } |
52 | else if (mynl + 1 < I) { |
53 | myTB[mynl] = b; Standard_Integer i; L0(i,n) myTL[mynl].Append(atoi(a[i])); |
54 | mynl++; |
55 | return 0; |
56 | } |
57 | else { |
58 | return 1; |
59 | } |
7fd59977 |
60 | } |
61 | |
62 | Standard_Boolean BOOPNINTL::Get(Standard_Integer n,char**a){ |
63 | if(!n)return Standard_False; |
64 | Standard_Integer il; |
65 | L0(il,mynl) { |
66 | const TColStd_ListOfInteger& L = myTL[il]; |
67 | if (L.IsEmpty()) continue; |
68 | TColStd_ListIteratorOfListOfInteger itL(L); |
69 | Standard_Integer ia = 0; |
70 | Standard_Boolean found = Standard_True; |
71 | for (;itL.More() && (ia < n); itL.Next(),ia++) { |
72 | Standard_Integer Lval = itL.Value(); |
73 | Standard_Integer aval = atoi(a[ia]); |
74 | if (Lval != aval) { |
75 | found = Standard_False; |
76 | break; |
77 | } |
78 | } |
79 | if (found) { |
80 | return myTB[il]; |
81 | } |
82 | } |
83 | return Standard_False; |
84 | } |
85 | |
86 | // =========== |
87 | static Standard_Boolean TopOpeBRep_traceEEFF = Standard_False; |
88 | Standard_EXPORT void TopOpeBRep_SettraceEEFF(const Standard_Boolean b) { TopOpeBRep_traceEEFF = b; } |
89 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF() { return TopOpeBRep_traceEEFF; } |
90 | |
91 | BOOPNINTL BOOPEEFF; |
92 | Standard_EXPORT Standard_Integer TopOpeBRep_SettraceEEFF(const Standard_Boolean b,Standard_Integer n,char**a) |
93 | { |
94 | Standard_Integer err = BOOPEEFF.Set(b,n,a); if (n==0) TopOpeBRep_SettraceEEFF(b); return err; |
95 | } |
96 | |
97 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF(Standard_Integer n,char**a) |
98 | { Standard_Boolean b = BOOPEEFF.Get(n,a); return b; } |
99 | |
100 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF(const Standard_Integer i1,const Standard_Integer i2,const Standard_Integer i3,const Standard_Integer i4) |
101 | { |
102 | char* t[4]; t[0]=AS(i1);t[1]=AS(i2);t[2]=AS(i3);t[3]=AS(i4); |
103 | Standard_Boolean b = BOOPEEFF.Get(4,t); return b; |
104 | } |
105 | |
106 | // =========== |
107 | static Standard_Boolean TopOpeBRep_traceNVP = Standard_False; |
108 | Standard_EXPORT void TopOpeBRep_SettraceNVP(const Standard_Boolean b) { TopOpeBRep_traceNVP = b; } |
109 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP() { return TopOpeBRep_traceNVP; } |
110 | |
111 | BOOPNINTL BOOPNVP; |
112 | Standard_EXPORT Standard_Integer TopOpeBRep_SettraceNVP(const Standard_Boolean b,Standard_Integer n,char**a) |
113 | { |
114 | Standard_Integer err = BOOPNVP.Set(b,n,a); if (n==0) TopOpeBRep_SettraceNVP(b); return err; |
115 | } |
116 | |
117 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP(Standard_Integer n,char**a) |
dde68833 |
118 | { |
119 | return BOOPNVP.Get(n,a); |
120 | } |
7fd59977 |
121 | |
122 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP(Standard_Integer i1,Standard_Integer i2,Standard_Integer i3,Standard_Integer i4,Standard_Integer i5) |
123 | { |
124 | char* t[5]; t[0]=AS(i1);t[1]=AS(i2);t[2]=AS(i3);t[3]=AS(i4);t[4]=AS(i5); |
125 | Standard_Boolean b = BOOPNVP.Get(5,t);return b; |
126 | } |
127 | |
128 | // =========== |
129 | static Standard_Boolean TopOpeBRep_traceSHA = Standard_False; |
130 | Standard_EXPORT void TopOpeBRep_SettraceSHA(const Standard_Boolean b) { TopOpeBRep_traceSHA = b; } |
131 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA() { return TopOpeBRep_traceSHA; } |
132 | |
133 | BOOPNINTL BOOPSHA; |
134 | Standard_EXPORT Standard_Integer TopOpeBRep_SettraceSHA(const Standard_Boolean b,Standard_Integer n,char**a) |
135 | { |
136 | Standard_Integer err = BOOPSHA.Set(b,n,a); if (n==0) TopOpeBRep_SettraceSHA(b); return err; |
137 | } |
138 | |
139 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA(Standard_Integer n,char**a) |
dde68833 |
140 | { |
141 | return BOOPSHA.Get(n,a); |
142 | } |
7fd59977 |
143 | |
144 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA(const Standard_Integer i1) |
145 | { |
146 | char* t[1]; t[0]=AS(i1); |
dde68833 |
147 | return BOOPSHA.Get(1,t); |
7fd59977 |
148 | } |
149 | |
0797d9d3 |
150 | // #ifdef OCCT_DEBUG |
7fd59977 |
151 | #endif |