1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-06 18:26:22 +03:00

0033529: Data Exchange, Step - Move on IncAllocator functionality

Update allocation mechanism for StepParser
Decrease the table size for parsing
This commit is contained in:
dpasukhi 2023-11-13 21:46:25 +00:00
parent 1103eb60af
commit ed85665b55
6 changed files with 216 additions and 390 deletions

View File

@ -31,38 +31,8 @@ namespace TextValue
static char IdZero[] = "#0";
}
class StepFile_ReadData::CharactersPage {
public:
CharactersPage(const Standard_Integer theMaxCar) :myNext(nullptr), myUsed(0)
class StepFile_ReadData::Argument
{
myCharacters = new char[theMaxCar];
}
~CharactersPage()
{
if (myCharacters != nullptr)
{
delete[] myCharacters;
myCharacters = nullptr;
}
}
DEFINE_STANDARD_ALLOC
public:
CharactersPage* myNext; //!< Chaining of character pages
char* myCharacters; //!< Own characters page
int myUsed; //!< Counter employed characters
};
class StepFile_ReadData::Argument {
public:
// Standard OCCT memory allocation stuff
DEFINE_STANDARD_ALLOC
public:
Argument() :myNext(nullptr), myValue(nullptr), myType(Interface_ParamSub) {}
@ -76,38 +46,8 @@ public:
Interface_ParamType myType; //!< Type of the argument
};
class StepFile_ReadData::ArgumentsPage {
public:
// Standard OCCT memory allocation stuff
DEFINE_STANDARD_ALLOC
public:
ArgumentsPage(Standard_Integer theMaxArg) :myNext(nullptr), myUsed(0)
class StepFile_ReadData::Record
{
myArgs = new Argument[theMaxArg];
}
~ArgumentsPage()
{
delete[] myArgs;
myArgs = nullptr;
}
public:
ArgumentsPage* myNext; //!< Chaining of arguments pages
Argument* myArgs; //!< Own arguments page
int myUsed; //!< Counter employed arguments
};
class StepFile_ReadData::Record {
public:
// Standard OCCT memory allocation stuff
DEFINE_STANDARD_ALLOC
public:
Record() :myNext(nullptr), myFirst(nullptr), myLast(nullptr), myIdent(nullptr), myType(nullptr) {}
@ -123,8 +63,8 @@ public:
char* myType; //!< Type of the record
};
class StepFile_ReadData::Scope {
class StepFile_ReadData::Scope
{
public:
// Standard OCCT memory allocation stuff
DEFINE_STANDARD_ALLOC
@ -137,7 +77,6 @@ public:
{
if (myRecord != nullptr)
{
delete[] myRecord;
myRecord = nullptr;
}
}
@ -148,35 +87,8 @@ public:
Record* myRecord; //!< Record interrupted by the scope (to resume)
};
class StepFile_ReadData::RecordsPage
{
public:
RecordsPage(const Standard_Integer theMaxRec) :myNext(nullptr), myUsed(0)
{
myRecords = new Record[theMaxRec];
}
~RecordsPage()
{
if (myRecords != nullptr)
{
delete[] myRecords;
myRecords = nullptr;
}
}
DEFINE_STANDARD_ALLOC
public:
RecordsPage* myNext; //!< Chaining of records pages
Record* myRecords; //!< Own records page
int myUsed; //!< Counter employed records
};
class StepFile_ReadData::ErrorsPage
{
public:
ErrorsPage(Standard_CString theError) :myNext(nullptr), myError(theError)
@ -203,17 +115,13 @@ private:
//purpose :
//=======================================================================
StepFile_ReadData::StepFile_ReadData()
:myMaxChar(50000), myMaxRec(5000), myMaxArg(10000), myModePrint(0),
myNbRec(0), myNbHead(0), myNbPar(0), myYaRec(0),
StepFile_ReadData::StepFile_ReadData() :
myTextAlloc(), myOtherAlloc(),
myModePrint(0), myNbRec(0), myNbHead(0), myNbPar(0), myYaRec(0),
myNumSub(0), myErrorArg(Standard_False), myResText(nullptr), myCurrType(TextValue::SubList),
mySubArg(nullptr), myTypeArg(Interface_ParamSub), myCurrArg(nullptr), myFirstRec(nullptr),
myCurRec(nullptr), myLastRec(nullptr), myCurScope(nullptr), myFirstError(nullptr), myCurError(nullptr)
{
myOneCharPage = new CharactersPage(myMaxChar);
myOneArgPage = new ArgumentsPage(myMaxArg);
myOneRecPage = new RecordsPage(myMaxRec);
};
{};
//=======================================================================
//function : CreateNewText
@ -229,22 +137,11 @@ void StepFile_ReadData::CreateNewText(const char* theNewText, int theLenText)
return;
}
// If error argument exists - prepare size to new text value and old result text
int aLength = (myErrorArg) ? theLenText + (int)strlen(myResText) : theLenText;
if (myOneCharPage->myUsed > myMaxChar - aLength - 1)
{
int aSizeOfPage = myMaxChar + 1;
if (aLength >= myMaxChar) aSizeOfPage += (aLength + 1 - myMaxChar);
CharactersPage* aNewPage = new CharactersPage(aSizeOfPage);
aNewPage->myNext = myOneCharPage;
myOneCharPage = aNewPage;
myOneCharPage->myUsed = 0;
}
const int aLength = (myErrorArg) ? theLenText + (int)strlen(myResText) : theLenText;
char* anOldResText = myResText;
myResText = myOneCharPage->myCharacters + myOneCharPage->myUsed;
myOneCharPage->myUsed += (aLength + 1);
myResText = static_cast<char*>(myTextAlloc.AllocateOptimal(aLength + 1));
// If error argument exists - append new text to old result text
// Else create new result text
@ -350,17 +247,8 @@ void StepFile_ReadData::RecordListStart()
void StepFile_ReadData::CreateNewArg()
{
Argument* aNewArg;
Argument* aNewArg = static_cast<Argument*>(myOtherAlloc.AllocateOptimal(sizeof(Argument)));
myNbPar++;
if (myOneArgPage->myUsed >= myMaxArg)
{
ArgumentsPage* aNewArgPage;
aNewArgPage = new ArgumentsPage(myMaxArg);
aNewArgPage->myNext = myOneArgPage;
myOneArgPage = aNewArgPage;
}
aNewArg = &myOneArgPage->myArgs[myOneArgPage->myUsed];
myOneArgPage->myUsed++;
aNewArg->myType = myTypeArg;
if (myTypeArg == Interface_ParamSub)
aNewArg->myValue = mySubArg;
@ -419,7 +307,7 @@ void StepFile_ReadData::AddNewScope()
{
Scope* aNewScope;
Record* aRecord;
aNewScope = new Scope;
aNewScope = new(myOtherAlloc.AllocateOptimal(sizeof(Scope))) Scope;
aNewScope->myRecord = myCurRec;
aNewScope->myPrevious = myCurScope;
myCurScope = aNewScope;
@ -466,7 +354,6 @@ void StepFile_ReadData::FinalOfScope()
myYaRec = 1;
anOldScope = myCurScope;
myCurScope = anOldScope->myPrevious;
delete anOldScope;
}
//=======================================================================
@ -478,32 +365,19 @@ void StepFile_ReadData::ClearRecorder(const Standard_Integer theMode)
{
if (theMode & 1)
{
while (myOneRecPage != nullptr)
{
RecordsPage* aNewPage = myOneRecPage->myNext;
delete myOneRecPage;
myOneRecPage = aNewPage;
}
while (myOneArgPage != nullptr) {
ArgumentsPage* aNewPage = myOneArgPage->myNext;
delete myOneArgPage;
myOneArgPage = aNewPage;
}
while (myFirstError != nullptr)
{
ErrorsPage* aNewErrorPage = myFirstError->NextErrorPage();
delete myFirstError;
myFirstError = aNewErrorPage;
}
myCurrType = nullptr;
mySubArg = nullptr;
myCurrArg = nullptr;
myFirstRec = nullptr;
myCurRec = nullptr;
myLastRec = nullptr;
myCurScope = nullptr;
myOtherAlloc.Reset(true);
}
if (theMode & 2)
{
while (myOneCharPage != nullptr)
{
CharactersPage* aNewPage = myOneCharPage->myNext;
delete myOneCharPage;
myOneCharPage = aNewPage;
}
myResText = nullptr;
myTextAlloc.Reset(true);
}
}
@ -653,12 +527,12 @@ void StepFile_ReadData::AddError(Standard_CString theErrorMessage)
{
if (myFirstError == nullptr)
{
myFirstError = new ErrorsPage(theErrorMessage);
myFirstError = new(myOtherAlloc.AllocateOptimal(sizeof(ErrorsPage))) ErrorsPage(theErrorMessage);
myCurError = myFirstError;
}
else
{
myCurError->SetNextErrorPage(new ErrorsPage(theErrorMessage));
myCurError->SetNextErrorPage(new(myOtherAlloc.AllocateOptimal(sizeof(ErrorsPage))) ErrorsPage(theErrorMessage));
myCurError = myCurError->NextErrorPage();
}
}
@ -736,18 +610,7 @@ void StepFile_ReadData::AddNewRecord(Record* theNewRecord)
StepFile_ReadData::Record* StepFile_ReadData::CreateNewRecord()
{
Record* aNewRecord;
if (myOneRecPage->myUsed >= myMaxRec)
{
RecordsPage* aNewRecPage;
aNewRecPage = new RecordsPage(myMaxRec);
aNewRecPage->myNext = myOneRecPage;
myOneRecPage = aNewRecPage;
}
aNewRecord = &myOneRecPage->myRecords[myOneRecPage->myUsed];
myOneRecPage->myUsed++;
return aNewRecord;
return static_cast<Record*>(myOtherAlloc.AllocateOptimal(sizeof(Record)));
}
//=======================================================================

View File

@ -19,6 +19,7 @@
#include <Standard.hxx>
#include <Standard_Handle.hxx>
#include <Standard_DefineAlloc.hxx>
#include <NCollection_IncAllocator.hxx>
#include <Interface_ParamType.hxx>
@ -113,12 +114,9 @@ public:
private:
class CharactersPage; //!< List of characters pages, contains all text derived from Flex
class Record; //!< List of records, contains all text processed by Bison
class Argument; //!< List of arguments, contains all argument descriptions
class ArgumentsPage; //!< List of arguments pages, contains all text derived from Flex
class Scope; //!< List of scopes pages, contains all records for external processing
class RecordsPage; //!< List of records pages, contains all records
class ErrorsPage; //!< List of errors messages, contains all errors
public:
@ -237,10 +235,8 @@ private:
void PrintRecord(Record* theRecord);
private:
Standard_Integer myMaxChar; //!< Maximum number of characters in a characters page
Standard_Integer myMaxRec; //!< Maximum number of records in a records page
Standard_Integer myMaxArg; //!< Maximum number of arguments in a arguments page
NCollection_IncAllocator myTextAlloc; //!< Allocator for store text
NCollection_IncAllocator myOtherAlloc; //!< Allocator for internal tools
Standard_Integer myModePrint; //!< Control print output (for call from yacc)
Standard_Integer myNbRec; //!< Total number of data records read
Standard_Integer myNbHead; //!< Number of records taken by the Header
@ -259,9 +255,6 @@ private:
Scope* myCurScope; //!< Current node of the scopes list
ErrorsPage* myFirstError; //!< First node of the errors pages list
ErrorsPage* myCurError; //!< Current node of the errors pages list
RecordsPage* myOneRecPage; //!< Current node of the records pages list
CharactersPage* myOneCharPage; //!< Current node of the characters pages list
ArgumentsPage* myOneArgPage; //!< Current node of the arguments pages list
};
#endif // _StepFile_ReadData_HeaderFile

View File

@ -353,7 +353,7 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static const flex_int16_t yy_acclist[213] =
static const flex_int16_t yy_acclist[167] =
{ 0,
2, 2, 45, 42, 44, 10, 42, 44, 12, 42,
44, 13, 42, 44, 11, 42, 44, 42, 44, 42,
@ -362,44 +362,35 @@ static const flex_int16_t yy_acclist[213] =
42, 44, 42, 44, 37, 42, 44, 18, 40, 42,
44, 28, 42, 44, 27, 42, 44, 40, 42, 44,
40, 42, 44, 40, 42, 44, 40, 42, 44, 40,
42, 44, 40, 42, 44, 40, 42, 44, 40, 42,
44, 40, 42, 44, 40, 42, 44, 40, 42, 44,
40, 42, 44, 14, 42, 44, 2, 44, 12, 44,
42, 44, 40, 42, 44, 14, 42, 44, 2, 44,
12, 44, 3, 44, 43, 44, 8, 44, 6, 12,
44, 7, 44, 41, 17,16400, 19, 18, 19, 19,
3, 44, 43, 44, 8, 44, 6, 12, 44, 7,
44, 41, 17,16400, 19, 18, 19, 19, 19, 1,
19, 22, 18, 19, 40, 40, 40, 22, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 14, 2,
3, 3, 4, 8, 9, 21, 15, 8208, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 8208,
20, 20, 20, 40, 40, 40, 40, 40, 40, 40,
40, 36, 40, 40, 40, 20, 20, 20, 40, 32,
40, 40, 40, 40, 40, 40, 40, 40, 29, 38,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
31, 40, 40, 30, 35, 39, 40, 39, 40, 33,
34, 34
19, 1, 19, 22, 18, 19, 40, 40, 22, 40,
40, 40, 40, 40, 14, 2, 3, 3, 4, 8,
9, 21, 15, 8208, 40, 40, 40, 40, 40, 40,
8208, 20, 20, 20, 40, 40, 40, 40, 40, 36,
40, 20, 20, 20, 40, 32, 40, 40, 40, 40,
29, 38, 40, 40, 40, 40, 40, 31, 40, 30,
35, 39, 40, 33, 34, 34
} ;
static const flex_int16_t yy_accept[158] =
static const flex_int16_t yy_accept[125] =
{ 0,
1, 1, 1, 2, 3, 3, 3, 3, 3, 4,
6, 9, 12, 15, 18, 20, 22, 24, 27, 29,
32, 35, 37, 40, 43, 45, 48, 52, 55, 58,
61, 64, 67, 70, 73, 76, 79, 82, 85, 88,
91, 94, 97, 99, 101, 103, 105, 107, 110, 112,
113, 113, 115, 115, 116, 118, 119, 120, 120, 121,
123, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
145, 145, 146, 147, 147, 149, 149, 149, 149, 150,
151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
61, 64, 67, 70, 73, 76, 79, 81, 83, 85,
87, 89, 92, 94, 95, 95, 97, 97, 98, 100,
101, 102, 102, 103, 105, 108, 109, 110, 111, 112,
113, 114, 115, 116, 117, 118, 119, 120, 121, 121,
122, 123, 123, 125, 125, 125, 125, 126, 127, 128,
129, 130, 131, 132, 132, 133, 134, 136, 137, 137,
138, 139, 139, 140, 141, 142, 142, 143, 144, 146,
161, 161, 162, 163, 165, 166, 167, 167, 168, 169,
170, 171, 171, 172, 173, 174, 175, 176, 176, 177,
178, 180, 181, 181, 182, 183, 184, 185, 186, 187,
188, 189, 190, 191, 191, 192, 193, 194, 195, 196,
197, 198, 199, 199, 200, 201, 202, 203, 204, 205,
205, 206, 208, 210, 212, 213, 213
147, 147, 148, 149, 150, 151, 152, 153, 153, 154,
155, 156, 157, 157, 158, 159, 160, 161, 161, 162,
164, 166, 167, 167
} ;
static const YY_CHAR yy_ec[256] =
@ -413,11 +404,11 @@ static const YY_CHAR yy_ec[256] =
22, 1, 1, 1, 23, 24, 25, 26, 27, 24,
28, 29, 30, 28, 28, 28, 28, 31, 32, 33,
28, 34, 35, 36, 28, 28, 28, 28, 28, 28,
1, 1, 1, 1, 28, 1, 37, 38, 39, 40,
1, 1, 1, 1, 28, 1, 37, 24, 38, 39,
41, 38, 38, 42, 43, 38, 38, 38, 38, 44,
45, 46, 38, 47, 48, 49, 38, 38, 38, 38,
38, 38, 1, 1, 1, 1, 1, 1, 1, 1,
40, 24, 28, 41, 42, 28, 28, 28, 28, 43,
44, 45, 28, 46, 47, 48, 28, 28, 28, 28,
28, 28, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -434,177 +425,141 @@ static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1
} ;
static const YY_CHAR yy_meta[51] =
static const YY_CHAR yy_meta[50] =
{ 0,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
3, 1, 1, 4, 1, 1, 1, 5, 1, 6,
1, 1, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 1
1, 1, 6, 6, 6, 6, 6, 7, 7, 7,
7, 7, 7, 7, 7, 7, 6, 6, 6, 6,
7, 7, 7, 7, 7, 7, 7, 7, 1
} ;
static const flex_int16_t yy_base[167] =
static const flex_int16_t yy_base[135] =
{ 0,
0, 0, 48, 49, 310, 307, 50, 53, 306, 452,
452, 452, 452, 452, 0, 45, 281, 452, 19, 452,
452, 452, 37, 452, 40, 272, 55, 452, 452, 56,
87, 88, 93, 94, 97, 0, 86, 87, 89, 87,
89, 175, 0, 452, 107, 452, 0, 452, 136, 0,
130, 142, 120, 140, 143, 148, 151, 204, 452, 154,
174, 159, 0, 452, 162, 137, 165, 125, 169, 153,
175, 152, 176, 161, 150, 0, 185, 194, 452, 0,
211, 452, 452, 207, 452, 178, 211, 215, 219, 220,
218, 227, 225, 228, 223, 249, 244, 238, 226, 452,
0, 0, 47, 48, 255, 252, 49, 52, 253, 323,
323, 323, 323, 323, 0, 0, 221, 323, 18, 323,
323, 323, 36, 323, 39, 223, 46, 323, 323, 211,
49, 40, 50, 52, 55, 148, 0, 323, 55, 323,
0, 323, 89, 0, 183, 93, 50, 89, 90, 94,
100, 139, 323, 104, 105, 138, 323, 101, 58, 110,
118, 108, 90, 0, 66, 87, 323, 0, 148, 323,
323, 136, 323, 110, 148, 152, 156, 157, 142, 160,
61, 148, 323, 146, 91, 164, 165, 125, 158, 177,
169, 186, 201, 323, 180, 165, 84, 190, 194, 323,
241, 128, 201, 232, 258, 115, 247, 273, 256, 262,
258, 287, 298, 452, 300, 305, 107, 261, 107, 233,
276, 452, 276, 309, 310, 316, 299, 307, 306, 319,
304, 452, 452, 310, 330, 312, 341, 56, 347, 323,
350, 45, 357, 355, 345, 452, 363, 38, 452, 368,
452, 372, 0, 0, 0, 452, 396, 403, 410, 412,
415, 416, 423, 430, 437, 444
176, 198, 202, 206, 210, 323, 323, 194, 214, 213,
217, 218, 228, 225, 323, 233, 323, 240, 323, 82,
0, 0, 323, 265, 272, 279, 281, 83, 284, 287,
294, 301, 308, 315
} ;
static const flex_int16_t yy_def[167] =
static const flex_int16_t yy_def[135] =
{ 0,
156, 1, 157, 157, 158, 158, 159, 159, 156, 156,
156, 156, 156, 156, 160, 156, 156, 156, 156, 156,
156, 156, 156, 156, 161, 156, 156, 156, 156, 27,
27, 27, 27, 27, 27, 162, 162, 162, 162, 162,
162, 156, 163, 156, 164, 156, 165, 156, 156, 160,
156, 156, 156, 156, 156, 161, 161, 161, 156, 156,
27, 27, 162, 156, 27, 162, 27, 162, 27, 162,
27, 162, 27, 162, 156, 163, 164, 164, 156, 165,
156, 156, 156, 156, 156, 156, 156, 161, 27, 27,
162, 27, 162, 27, 162, 27, 162, 27, 162, 156,
123, 1, 124, 124, 125, 125, 126, 126, 123, 123,
123, 123, 123, 123, 127, 128, 123, 123, 123, 123,
123, 123, 123, 123, 129, 123, 130, 123, 123, 130,
130, 130, 130, 130, 130, 123, 131, 123, 132, 123,
133, 123, 123, 127, 128, 123, 123, 123, 123, 129,
129, 129, 123, 123, 130, 130, 123, 130, 130, 130,
130, 130, 123, 131, 132, 132, 123, 133, 123, 123,
123, 123, 123, 123, 123, 129, 130, 130, 130, 130,
130, 130, 123, 123, 123, 129, 130, 130, 123, 130,
130, 123, 130, 123, 130, 123, 123, 129, 130, 123,
156, 156, 161, 27, 27, 162, 156, 27, 162, 27,
162, 156, 27, 156, 162, 27, 162, 156, 156, 161,
27, 156, 156, 27, 27, 27, 162, 162, 162, 27,
162, 156, 156, 156, 27, 162, 27, 162, 27, 162,
27, 162, 156, 27, 162, 156, 27, 162, 156, 156,
156, 27, 162, 166, 166, 0, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156
123, 130, 130, 130, 130, 123, 123, 123, 130, 130,
130, 130, 123, 130, 123, 130, 123, 123, 123, 130,
134, 134, 0, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123
} ;
static const flex_int16_t yy_nxt[503] =
static const flex_int16_t yy_nxt[373] =
{ 0,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 10, 23, 24, 23, 25, 26, 27,
28, 29, 30, 30, 30, 31, 32, 30, 33, 34,
30, 30, 30, 30, 35, 30, 36, 36, 36, 37,
38, 39, 40, 36, 36, 36, 36, 41, 36, 42,
44, 44, 48, 53, 54, 48, 55, 56, 154, 57,
49, 45, 45, 49, 51, 149, 53, 51, 51, 51,
51, 51, 60, 64, 61, 62, 146, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 63, 63, 63, 63, 63, 63, 63, 63, 63,
30, 30, 30, 30, 35, 30, 30, 30, 31, 32,
33, 34, 30, 30, 30, 30, 35, 30, 36, 38,
38, 42, 47, 48, 42, 49, 50, 57, 51, 43,
39, 39, 43, 54, 47, 55, 57, 57, 66, 57,
59, 58, 57, 67, 74, 57, 60, 92, 57, 123,
93, 94, 59, 79, 123, 58, 61, 74, 45, 60,
62, 69, 69, 69, 72, 69, 79, 72, 61, 57,
63, 63, 63, 63, 64, 64, 62, 62, 66, 65,
64, 64, 62, 62, 64, 70, 62, 68, 67, 69,
78, 72, 66, 66, 74, 79, 119, 132, 71, 70,
68, 68, 73, 70, 72, 122, 83, 74, 81, 81,
81, 72, 81, 84, 86, 74, 84, 119, 82, 51,
93, 82, 51, 51, 51, 51, 51, 54, 86, 54,
54, 52, 55, 85, 93, 56, 87, 57, 60, 87,
57, 54, 91, 54, 88, 95, 64, 88, 62, 64,
87, 62, 64, 97, 62, 91, 64, 99, 62, 95,
92, 94, 64, 64, 62, 62, 97, 90, 156, 75,
66, 70, 62, 97, 70, 67, 48, 48, 48, 49,
97, 50, 46, 51, 73, 75, 75, 54, 57, 51,
76, 48, 54, 48, 55, 57, 76, 57, 75, 75,
75, 77, 80, 76, 82, 57, 78, 72, 63, 76,
72, 84, 57, 75, 77, 100, 80, 82, 78, 81,
69, 69, 69, 84, 69, 57, 57, 83, 89, 57,
70, 81, 85, 70, 85, 57, 85, 85, 85, 57,
85, 86, 85, 57, 57, 87, 90, 57, 96, 88,
95, 57, 57, 98, 99, 91, 57, 101, 90, 71,
96, 107, 95, 88, 57, 105, 63, 57, 91, 101,
89, 99, 98, 156, 93, 95, 96, 78, 84, 101,
91, 84, 79, 81, 81, 81, 99, 81, 64, 97,
120, 64, 101, 82, 75, 102, 82, 102, 100, 102,
102, 102, 64, 102, 103, 102, 64, 64, 104, 62,
106, 107, 105, 107, 64, 64, 62, 62, 111, 64,
64, 121, 120, 110, 106, 64, 106, 62, 117, 109,
112, 108, 111, 115, 114, 112, 64, 111, 113, 114,
116, 117, 109, 118, 109, 64, 123, 62, 122, 64,
127, 62, 128, 117, 131, 59, 118, 133, 130, 123,
64, 129, 62, 64, 127, 121, 128, 124, 131, 125,
106, 102, 92, 103, 107, 92, 94, 57, 105, 98,
108, 57, 104, 99, 102, 57, 103, 92, 57, 57,
93, 94, 108, 57, 104, 113, 110, 57, 57, 109,
57, 57, 111, 115, 57, 57, 53, 113, 117, 110,
46, 109, 57, 112, 118, 111, 114, 118, 119, 116,
57, 120, 123, 121, 38, 112, 118, 38, 114, 118,
119, 116, 123, 123, 120, 37, 37, 37, 37, 37,
37, 37, 40, 40, 40, 40, 40, 40, 40, 41,
41, 41, 41, 41, 41, 41, 44, 44, 52, 52,
52, 56, 56, 56, 64, 123, 64, 123, 64, 64,
52, 133, 131, 112, 129, 156, 112, 114, 126, 44,
134, 127, 44, 128, 112, 64, 112, 113, 114, 115,
114, 129, 64, 134, 62, 132, 64, 64, 62, 62,
136, 138, 140, 64, 137, 62, 64, 142, 62, 156,
135, 143, 139, 136, 145, 138, 140, 64, 138, 62,
142, 156, 141, 136, 143, 148, 140, 145, 64, 156,
62, 146, 144, 156, 64, 142, 62, 64, 148, 62,
149, 153, 64, 150, 62, 145, 150, 151, 156, 147,
64, 152, 62, 154, 150, 153, 156, 150, 151, 64,
156, 62, 148, 156, 156, 153, 43, 43, 43, 43,
43, 43, 43, 46, 46, 46, 46, 46, 46, 46,
47, 47, 47, 47, 47, 47, 47, 50, 50, 58,
58, 63, 63, 76, 156, 76, 156, 76, 76, 76,
77, 156, 77, 77, 77, 77, 77, 80, 156, 156,
80, 80, 80, 80, 155, 156, 155, 155, 155, 155,
155, 9, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156
64, 65, 123, 65, 65, 65, 65, 65, 68, 123,
123, 68, 68, 68, 68, 122, 123, 122, 122, 122,
122, 122, 9, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123
} ;
static const flex_int16_t yy_chk[503] =
static const flex_int16_t yy_chk[373] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3, 4, 7, 19, 23, 8, 23, 25, 148, 25,
7, 3, 4, 8, 16, 142, 19, 16, 16, 16,
16, 16, 27, 30, 27, 30, 138, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
4, 7, 19, 23, 8, 23, 25, 32, 25, 7,
3, 4, 8, 27, 19, 27, 31, 33, 39, 34,
32, 31, 35, 39, 47, 59, 33, 81, 81, 65,
81, 81, 32, 59, 65, 31, 34, 47, 128, 33,
35, 43, 43, 43, 46, 43, 59, 46, 34, 120,
27, 27, 27, 27, 31, 32, 31, 32, 37, 31,
33, 34, 33, 34, 35, 39, 35, 38, 32, 33,
45, 40, 37, 31, 41, 45, 119, 117, 34, 39,
38, 32, 35, 33, 40, 106, 51, 41, 49, 49,
49, 34, 49, 52, 53, 35, 52, 102, 49, 51,
68, 49, 51, 51, 51, 51, 51, 54, 53, 54,
55, 52, 55, 52, 68, 56, 54, 56, 57, 55,
57, 60, 66, 60, 56, 70, 62, 57, 62, 65,
60, 65, 67, 72, 67, 66, 69, 74, 69, 70,
67, 69, 71, 73, 71, 73, 72, 65, 77, 75,
66, 43, 35, 97, 43, 66, 48, 49, 48, 49,
85, 50, 46, 50, 46, 48, 49, 51, 58, 51,
50, 54, 55, 54, 55, 62, 51, 60, 48, 49,
54, 55, 60, 50, 62, 61, 58, 72, 63, 51,
72, 74, 88, 54, 55, 88, 60, 62, 58, 61,
69, 69, 69, 74, 69, 56, 52, 72, 79, 79,
69, 61, 75, 69, 75, 82, 76, 75, 76, 76,
77, 76, 77, 77, 78, 77, 79, 80, 84, 78,
82, 86, 87, 86, 87, 80, 91, 89, 79, 45,
84, 96, 82, 78, 90, 91, 36, 95, 80, 89,
61, 74, 73, 77, 67, 69, 71, 78, 84, 86,
65, 84, 78, 81, 81, 81, 73, 81, 103, 71,
103, 58, 86, 81, 42, 87, 81, 87, 84, 88,
87, 88, 88, 89, 88, 89, 89, 90, 89, 90,
91, 93, 90, 92, 92, 94, 92, 94, 95, 104,
120, 104, 120, 94, 91, 98, 90, 98, 99, 93,
97, 92, 95, 97, 97, 96, 96, 94, 96, 96,
98, 99, 93, 101, 92, 105, 107, 105, 105, 110,
109, 110, 109, 98, 111, 26, 101, 118, 110, 107,
108, 109, 108, 121, 109, 121, 109, 108, 111, 108,
95, 90, 92, 90, 96, 92, 92, 98, 91, 98,
101, 99, 90, 99, 90, 102, 90, 93, 93, 103,
93, 93, 101, 104, 90, 108, 103, 105, 30, 102,
110, 109, 104, 110, 111, 112, 26, 108, 112, 103,
17, 102, 114, 105, 113, 104, 109, 113, 113, 111,
116, 114, 9, 116, 6, 105, 118, 5, 109, 118,
118, 111, 0, 0, 114, 124, 124, 124, 124, 124,
124, 124, 125, 125, 125, 125, 125, 125, 125, 126,
126, 126, 126, 126, 126, 126, 127, 127, 129, 129,
129, 130, 130, 130, 131, 0, 131, 0, 131, 131,
17, 118, 110, 112, 109, 9, 112, 112, 108, 6,
123, 108, 5, 108, 113, 113, 115, 113, 113, 115,
115, 108, 116, 123, 116, 116, 124, 125, 124, 125,
127, 128, 129, 126, 125, 126, 130, 131, 130, 0,
124, 134, 126, 127, 136, 128, 129, 135, 125, 135,
131, 0, 130, 124, 134, 140, 126, 136, 137, 0,
137, 137, 135, 0, 139, 130, 139, 141, 140, 141,
141, 145, 144, 143, 144, 135, 143, 143, 0, 139,
147, 144, 147, 147, 150, 145, 0, 150, 150, 152,
0, 152, 139, 0, 0, 144, 157, 157, 157, 157,
157, 157, 157, 158, 158, 158, 158, 158, 158, 158,
159, 159, 159, 159, 159, 159, 159, 160, 160, 161,
161, 162, 162, 163, 0, 163, 0, 163, 163, 163,
164, 0, 164, 164, 164, 164, 164, 165, 0, 0,
165, 165, 165, 165, 166, 0, 166, 166, 166, 166,
166, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156
131, 132, 0, 132, 132, 132, 132, 132, 133, 0,
0, 133, 133, 133, 133, 134, 0, 134, 134, 134,
134, 134, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123
} ;
#define YY_TRAILING_MASK 0x2000
@ -645,6 +600,9 @@ goto find_rule; \
noinput disables the generation of code for reading input from standard input
noyywrap don't use yywrap() function
yyclass define name of the scanner class
noyyalloc disables default allocation function
noyyfree disables default deallocation function
noyyrealloc disables default reallocation function
*/
#define YY_NO_INPUT 1
@ -872,14 +830,14 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 157 )
if ( yy_current_state >= 124 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
*(yy_state_ptr)++ = yy_current_state;
++yy_cp;
}
while ( yy_base[yy_current_state] != 452 );
while ( yy_base[yy_current_state] != 323 );
yy_find_action:
yy_current_state = *--(yy_state_ptr);
@ -1496,11 +1454,11 @@ int yyFlexLexer::yy_get_next_buffer()
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 50);
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 49);
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 157 )
if ( yy_current_state >= 124 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@ -1519,15 +1477,15 @@ int yyFlexLexer::yy_get_next_buffer()
{
int yy_is_jam;
YY_CHAR yy_c = 50;
YY_CHAR yy_c = 49;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 157 )
if ( yy_current_state >= 124 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 156);
yy_is_jam = (yy_current_state == 123);
if ( ! yy_is_jam )
*(yy_state_ptr)++ = yy_current_state;
@ -2018,31 +1976,25 @@ static int yy_flex_strlen (const char * s )
}
#endif
void *yyalloc (yy_size_t size )
{
return malloc(size);
}
void *yyrealloc (void * ptr, yy_size_t size )
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return realloc(ptr, size);
}
void yyfree (void * ptr )
{
free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
#include <Standard.hxx>
void* yyalloc (size_t theNbBytes)
{
return Standard::AllocateOptimal (theNbBytes);
}
void* yyrealloc (void * thePnt, size_t theNbBytes)
{
return Standard::Reallocate (thePnt, theNbBytes);
}
void yyfree (void* thePnt)
{
Standard::Free (thePnt);
}
step::scanner::scanner(StepFile_ReadData* theDataModel, std::istream* in, std::ostream* out)
: stepFlexLexer(in, out), myDataModel(theDataModel)
{

View File

@ -21,12 +21,18 @@
noinput disables the generation of code for reading input from standard input
noyywrap don't use yywrap() function
yyclass define name of the scanner class
noyyalloc disables default allocation function
noyyfree disables default deallocation function
noyyrealloc disables default reallocation function
case-insensitive enable case insensitive parsing(any ?i: and other case setting will be ignored)
*/
%option c++
%option 8bit warn nodefault
%option noyywrap
%option noinput
%option yyclass="step::scanner"
%option noyyalloc noyyfree noyyrealloc
%option case-insensitive
%top{
// This file is part of Open CASCADE Technology software library.
@ -52,7 +58,6 @@
#ifdef YY_INTERACTIVE
#undef YY_INTERACTIVE
#endif
#define YY_INTERACTIVE 0
typedef step::parser::token token;
@ -148,6 +153,23 @@ long string in files Henri.stp and 401.stp*/
%%
#include <Standard.hxx>
void* yyalloc (size_t theNbBytes)
{
return Standard::AllocateOptimal (theNbBytes);
}
void* yyrealloc (void * thePnt, size_t theNbBytes)
{
return Standard::Reallocate (thePnt, theNbBytes);
}
void yyfree (void* thePnt)
{
Standard::Free (thePnt);
}
step::scanner::scanner(StepFile_ReadData* theDataModel, std::istream* in, std::ostream* out)
: stepFlexLexer(in, out), myDataModel(theDataModel)
{

View File

@ -57,8 +57,6 @@
// disable MSVC warnings in bison code
#ifdef _MSC_VER
#pragma warning(disable:4065 4244 4131 4127 4702)
#define YYMALLOC malloc
#define YYFREE free
#endif
void StepFile_Interrupt (Standard_CString theErrorMessage, const Standard_Boolean theIsFail);
@ -1130,11 +1128,11 @@ namespace step {
const unsigned char
parser::yyrline_[] =
{
0, 98, 98, 99, 100, 101, 102, 103, 104, 105,
105, 105, 108, 109, 111, 112, 114, 117, 118, 119,
120, 121, 124, 127, 130, 135, 136, 138, 139, 141,
142, 144, 145, 146, 147, 149, 150, 152, 153, 155,
158, 161, 162, 164, 167, 169, 174, 177
0, 96, 96, 97, 98, 99, 100, 101, 102, 103,
103, 103, 106, 107, 109, 110, 112, 115, 116, 117,
118, 119, 122, 125, 128, 133, 134, 136, 137, 139,
140, 142, 143, 144, 145, 147, 148, 150, 151, 153,
156, 159, 160, 162, 165, 167, 172, 175
};
void

View File

@ -57,8 +57,6 @@ namespace step {
// disable MSVC warnings in bison code
#ifdef _MSC_VER
#pragma warning(disable:4065 4244 4131 4127 4702)
#define YYMALLOC malloc
#define YYFREE free
#endif
void StepFile_Interrupt (Standard_CString theErrorMessage, const Standard_Boolean theIsFail);
}