b311480e |
1 | // Created on: 1997-10-22 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | #ifdef DEB |
23 | |
24 | #include <Standard_Type.hxx> |
25 | #include <TCollection_AsciiString.hxx> |
26 | #include <TColStd_ListOfInteger.hxx> |
27 | #include <TColStd_ListIteratorOfListOfInteger.hxx> |
28 | #include <TopOpeBRepTool_define.hxx> |
29 | |
30 | #define AS(x) (Standard_PCharacter)TCollection_AsciiString((x)).ToCString(); |
31 | #define I 10 |
32 | #define J 10 |
33 | #define OK(x,y) (x)<I&&(y)<J |
34 | #define T(x,y) myT[(x)][(y)] |
35 | #define L0(x,y) for((x)=0;(x)<(y);(x)++) |
36 | #define A(v) (atoi(a[(v)])) |
37 | |
38 | class BOOPNINTL{ |
39 | public:BOOPNINTL(); |
40 | Standard_Boolean Get(Standard_Integer n,char**a); |
41 | Standard_Integer Set(const Standard_Boolean b,Standard_Integer n,char**a); |
42 | private: |
43 | TColStd_ListOfInteger myTL[I]; |
44 | Standard_Boolean myTB[I]; |
45 | Standard_Integer mynl; |
46 | }; |
47 | |
48 | BOOPNINTL::BOOPNINTL(){Set(Standard_False,0,NULL);} |
49 | |
50 | Standard_Integer BOOPNINTL::Set(const Standard_Boolean b,Standard_Integer n,char**a) |
51 | { |
52 | if(n == 0) { |
53 | Standard_Integer i; L0(i,I) { myTB[i] = Standard_False; myTL[i].Clear(); } |
54 | mynl = 0; |
55 | return 0; |
56 | } |
57 | else if (mynl + 1 < I) { |
58 | myTB[mynl] = b; Standard_Integer i; L0(i,n) myTL[mynl].Append(atoi(a[i])); |
59 | mynl++; |
60 | return 0; |
61 | } |
62 | else { |
63 | return 1; |
64 | } |
7fd59977 |
65 | } |
66 | |
67 | Standard_Boolean BOOPNINTL::Get(Standard_Integer n,char**a){ |
68 | if(!n)return Standard_False; |
69 | Standard_Integer il; |
70 | L0(il,mynl) { |
71 | const TColStd_ListOfInteger& L = myTL[il]; |
72 | if (L.IsEmpty()) continue; |
73 | TColStd_ListIteratorOfListOfInteger itL(L); |
74 | Standard_Integer ia = 0; |
75 | Standard_Boolean found = Standard_True; |
76 | for (;itL.More() && (ia < n); itL.Next(),ia++) { |
77 | Standard_Integer Lval = itL.Value(); |
78 | Standard_Integer aval = atoi(a[ia]); |
79 | if (Lval != aval) { |
80 | found = Standard_False; |
81 | break; |
82 | } |
83 | } |
84 | if (found) { |
85 | return myTB[il]; |
86 | } |
87 | } |
88 | return Standard_False; |
89 | } |
90 | |
91 | // =========== |
92 | static Standard_Boolean TopOpeBRep_traceEEFF = Standard_False; |
93 | Standard_EXPORT void TopOpeBRep_SettraceEEFF(const Standard_Boolean b) { TopOpeBRep_traceEEFF = b; } |
94 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF() { return TopOpeBRep_traceEEFF; } |
95 | |
96 | BOOPNINTL BOOPEEFF; |
97 | Standard_EXPORT Standard_Integer TopOpeBRep_SettraceEEFF(const Standard_Boolean b,Standard_Integer n,char**a) |
98 | { |
99 | Standard_Integer err = BOOPEEFF.Set(b,n,a); if (n==0) TopOpeBRep_SettraceEEFF(b); return err; |
100 | } |
101 | |
102 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF(Standard_Integer n,char**a) |
103 | { Standard_Boolean b = BOOPEEFF.Get(n,a); return b; } |
104 | |
105 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF(const Standard_Integer i1,const Standard_Integer i2,const Standard_Integer i3,const Standard_Integer i4) |
106 | { |
107 | char* t[4]; t[0]=AS(i1);t[1]=AS(i2);t[2]=AS(i3);t[3]=AS(i4); |
108 | Standard_Boolean b = BOOPEEFF.Get(4,t); return b; |
109 | } |
110 | |
111 | // =========== |
112 | static Standard_Boolean TopOpeBRep_traceNVP = Standard_False; |
113 | Standard_EXPORT void TopOpeBRep_SettraceNVP(const Standard_Boolean b) { TopOpeBRep_traceNVP = b; } |
114 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP() { return TopOpeBRep_traceNVP; } |
115 | |
116 | BOOPNINTL BOOPNVP; |
117 | Standard_EXPORT Standard_Integer TopOpeBRep_SettraceNVP(const Standard_Boolean b,Standard_Integer n,char**a) |
118 | { |
119 | Standard_Integer err = BOOPNVP.Set(b,n,a); if (n==0) TopOpeBRep_SettraceNVP(b); return err; |
120 | } |
121 | |
122 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP(Standard_Integer n,char**a) |
123 | { Standard_Integer b = BOOPNVP.Get(n,a); return b; } |
124 | |
125 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP(Standard_Integer i1,Standard_Integer i2,Standard_Integer i3,Standard_Integer i4,Standard_Integer i5) |
126 | { |
127 | char* t[5]; t[0]=AS(i1);t[1]=AS(i2);t[2]=AS(i3);t[3]=AS(i4);t[4]=AS(i5); |
128 | Standard_Boolean b = BOOPNVP.Get(5,t);return b; |
129 | } |
130 | |
131 | // =========== |
132 | static Standard_Boolean TopOpeBRep_traceSHA = Standard_False; |
133 | Standard_EXPORT void TopOpeBRep_SettraceSHA(const Standard_Boolean b) { TopOpeBRep_traceSHA = b; } |
134 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA() { return TopOpeBRep_traceSHA; } |
135 | |
136 | BOOPNINTL BOOPSHA; |
137 | Standard_EXPORT Standard_Integer TopOpeBRep_SettraceSHA(const Standard_Boolean b,Standard_Integer n,char**a) |
138 | { |
139 | Standard_Integer err = BOOPSHA.Set(b,n,a); if (n==0) TopOpeBRep_SettraceSHA(b); return err; |
140 | } |
141 | |
142 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA(Standard_Integer n,char**a) |
143 | { Standard_Integer b = BOOPSHA.Get(n,a); return b; } |
144 | |
145 | Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA(const Standard_Integer i1) |
146 | { |
147 | char* t[1]; t[0]=AS(i1); |
148 | Standard_Boolean b = BOOPSHA.Get(1,t);return b; |
149 | } |
150 | |
151 | // #ifdef DEB |
152 | #endif |