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

View File

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

View File

@ -353,7 +353,7 @@ struct yy_trans_info
flex_int32_t yy_verify; flex_int32_t yy_verify;
flex_int32_t yy_nxt; flex_int32_t yy_nxt;
}; };
static const flex_int16_t yy_acclist[213] = static const flex_int16_t yy_acclist[167] =
{ 0, { 0,
2, 2, 45, 42, 44, 10, 42, 44, 12, 42, 2, 2, 45, 42, 44, 10, 42, 44, 12, 42,
44, 13, 42, 44, 11, 42, 44, 42, 44, 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, 42, 44, 42, 44, 37, 42, 44, 18, 40, 42,
44, 28, 42, 44, 27, 42, 44, 40, 42, 44, 44, 28, 42, 44, 27, 42, 44, 40, 42, 44,
40, 42, 44, 40, 42, 44, 40, 42, 44, 40, 40, 42, 44, 40, 42, 44, 40, 42, 44, 40,
42, 44, 40, 42, 44, 40, 42, 44, 40, 42, 42, 44, 40, 42, 44, 14, 42, 44, 2, 44,
44, 40, 42, 44, 40, 42, 44, 40, 42, 44, 12, 44, 3, 44, 43, 44, 8, 44, 6, 12,
40, 42, 44, 14, 42, 44, 2, 44, 12, 44, 44, 7, 44, 41, 17,16400, 19, 18, 19, 19,
3, 44, 43, 44, 8, 44, 6, 12, 44, 7, 19, 1, 19, 22, 18, 19, 40, 40, 22, 40,
44, 41, 17,16400, 19, 18, 19, 19, 19, 1, 40, 40, 40, 40, 14, 2, 3, 3, 4, 8,
19, 22, 18, 19, 40, 40, 40, 22, 40, 40, 9, 21, 15, 8208, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 14, 2, 8208, 20, 20, 20, 40, 40, 40, 40, 40, 36,
3, 3, 4, 8, 9, 21, 15, 8208, 40, 40, 40, 20, 20, 20, 40, 32, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 8208, 29, 38, 40, 40, 40, 40, 40, 31, 40, 30,
20, 20, 20, 40, 40, 40, 40, 40, 40, 40, 35, 39, 40, 33, 34, 34
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
} ; } ;
static const flex_int16_t yy_accept[158] = static const flex_int16_t yy_accept[125] =
{ 0, { 0,
1, 1, 1, 2, 3, 3, 3, 3, 3, 4, 1, 1, 1, 2, 3, 3, 3, 3, 3, 4,
6, 9, 12, 15, 18, 20, 22, 24, 27, 29, 6, 9, 12, 15, 18, 20, 22, 24, 27, 29,
32, 35, 37, 40, 43, 45, 48, 52, 55, 58, 32, 35, 37, 40, 43, 45, 48, 52, 55, 58,
61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 61, 64, 67, 70, 73, 76, 79, 81, 83, 85,
91, 94, 97, 99, 101, 103, 105, 107, 110, 112, 87, 89, 92, 94, 95, 95, 97, 97, 98, 100,
113, 113, 115, 115, 116, 118, 119, 120, 120, 121, 101, 102, 102, 103, 105, 108, 109, 110, 111, 112,
123, 126, 127, 128, 129, 130, 131, 132, 133, 134, 113, 114, 115, 116, 117, 118, 119, 120, 121, 121,
135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 122, 123, 123, 125, 125, 125, 125, 126, 127, 128,
145, 145, 146, 147, 147, 149, 149, 149, 149, 150, 129, 130, 131, 132, 132, 133, 134, 136, 137, 137,
151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 138, 139, 139, 140, 141, 142, 142, 143, 144, 146,
161, 161, 162, 163, 165, 166, 167, 167, 168, 169, 147, 147, 148, 149, 150, 151, 152, 153, 153, 154,
170, 171, 171, 172, 173, 174, 175, 176, 176, 177, 155, 156, 157, 157, 158, 159, 160, 161, 161, 162,
178, 180, 181, 181, 182, 183, 184, 185, 186, 187, 164, 166, 167, 167
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
} ; } ;
static const YY_CHAR yy_ec[256] = 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, 22, 1, 1, 1, 23, 24, 25, 26, 27, 24,
28, 29, 30, 28, 28, 28, 28, 31, 32, 33, 28, 29, 30, 28, 28, 28, 28, 31, 32, 33,
28, 34, 35, 36, 28, 28, 28, 28, 28, 28, 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, 40, 24, 28, 41, 42, 28, 28, 28, 28, 43,
45, 46, 38, 47, 48, 49, 38, 38, 38, 38, 44, 45, 28, 46, 47, 48, 28, 28, 28, 28,
38, 38, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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 1, 1, 1, 1, 1
} ; } ;
static const YY_CHAR yy_meta[51] = static const YY_CHAR yy_meta[50] =
{ 0, { 0,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
3, 1, 1, 4, 1, 1, 1, 5, 1, 6, 3, 1, 1, 4, 1, 1, 1, 5, 1, 6,
1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 6, 6, 6, 6, 6, 7, 7, 7,
6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 1 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, 0, 48, 49, 310, 307, 50, 53, 306, 452, 0, 0, 47, 48, 255, 252, 49, 52, 253, 323,
452, 452, 452, 452, 0, 45, 281, 452, 19, 452, 323, 323, 323, 323, 0, 0, 221, 323, 18, 323,
452, 452, 37, 452, 40, 272, 55, 452, 452, 56, 323, 323, 36, 323, 39, 223, 46, 323, 323, 211,
87, 88, 93, 94, 97, 0, 86, 87, 89, 87, 49, 40, 50, 52, 55, 148, 0, 323, 55, 323,
89, 175, 0, 452, 107, 452, 0, 452, 136, 0, 0, 323, 89, 0, 183, 93, 50, 89, 90, 94,
130, 142, 120, 140, 143, 148, 151, 204, 452, 154, 100, 139, 323, 104, 105, 138, 323, 101, 58, 110,
174, 159, 0, 452, 162, 137, 165, 125, 169, 153, 118, 108, 90, 0, 66, 87, 323, 0, 148, 323,
175, 152, 176, 161, 150, 0, 185, 194, 452, 0, 323, 136, 323, 110, 148, 152, 156, 157, 142, 160,
211, 452, 452, 207, 452, 178, 211, 215, 219, 220, 61, 148, 323, 146, 91, 164, 165, 125, 158, 177,
218, 227, 225, 228, 223, 249, 244, 238, 226, 452, 169, 186, 201, 323, 180, 165, 84, 190, 194, 323,
241, 128, 201, 232, 258, 115, 247, 273, 256, 262, 176, 198, 202, 206, 210, 323, 323, 194, 214, 213,
258, 287, 298, 452, 300, 305, 107, 261, 107, 233, 217, 218, 228, 225, 323, 233, 323, 240, 323, 82,
276, 452, 276, 309, 310, 316, 299, 307, 306, 319, 0, 0, 323, 265, 272, 279, 281, 83, 284, 287,
304, 452, 452, 310, 330, 312, 341, 56, 347, 323, 294, 301, 308, 315
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
} ; } ;
static const flex_int16_t yy_def[167] = static const flex_int16_t yy_def[135] =
{ 0, { 0,
156, 1, 157, 157, 158, 158, 159, 159, 156, 156, 123, 1, 124, 124, 125, 125, 126, 126, 123, 123,
156, 156, 156, 156, 160, 156, 156, 156, 156, 156, 123, 123, 123, 123, 127, 128, 123, 123, 123, 123,
156, 156, 156, 156, 161, 156, 156, 156, 156, 27, 123, 123, 123, 123, 129, 123, 130, 123, 123, 130,
27, 27, 27, 27, 27, 162, 162, 162, 162, 162, 130, 130, 130, 130, 130, 123, 131, 123, 132, 123,
162, 156, 163, 156, 164, 156, 165, 156, 156, 160, 133, 123, 123, 127, 128, 123, 123, 123, 123, 129,
156, 156, 156, 156, 156, 161, 161, 161, 156, 156, 129, 129, 123, 123, 130, 130, 123, 130, 130, 130,
27, 27, 162, 156, 27, 162, 27, 162, 27, 162, 130, 130, 123, 131, 132, 132, 123, 133, 123, 123,
27, 162, 27, 162, 156, 163, 164, 164, 156, 165, 123, 123, 123, 123, 123, 129, 130, 130, 130, 130,
156, 156, 156, 156, 156, 156, 156, 161, 27, 27, 130, 130, 123, 123, 123, 129, 130, 130, 123, 130,
162, 27, 162, 27, 162, 27, 162, 27, 162, 156, 130, 123, 130, 123, 130, 123, 123, 129, 130, 123,
156, 156, 161, 27, 27, 162, 156, 27, 162, 27, 123, 130, 130, 130, 130, 123, 123, 123, 130, 130,
162, 156, 27, 156, 162, 27, 162, 156, 156, 161, 130, 130, 123, 130, 123, 130, 123, 123, 123, 130,
27, 156, 156, 27, 27, 27, 162, 162, 162, 27, 134, 134, 0, 123, 123, 123, 123, 123, 123, 123,
162, 156, 156, 156, 27, 162, 27, 162, 27, 162, 123, 123, 123, 123
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
} ; } ;
static const flex_int16_t yy_nxt[503] = static const flex_int16_t yy_nxt[373] =
{ 0, { 0,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 10, 23, 24, 23, 25, 26, 27, 20, 21, 22, 10, 23, 24, 23, 25, 26, 27,
28, 29, 30, 30, 30, 31, 32, 30, 33, 34, 28, 29, 30, 30, 30, 31, 32, 30, 33, 34,
30, 30, 30, 30, 35, 30, 36, 36, 36, 37, 30, 30, 30, 30, 35, 30, 30, 30, 31, 32,
38, 39, 40, 36, 36, 36, 36, 41, 36, 42, 33, 34, 30, 30, 30, 30, 35, 30, 36, 38,
44, 44, 48, 53, 54, 48, 55, 56, 154, 57, 38, 42, 47, 48, 42, 49, 50, 57, 51, 43,
49, 45, 45, 49, 51, 149, 53, 51, 51, 51, 39, 39, 43, 54, 47, 55, 57, 57, 66, 57,
51, 51, 60, 64, 61, 62, 146, 62, 62, 62, 59, 58, 57, 67, 74, 57, 60, 92, 57, 123,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 93, 94, 59, 79, 123, 58, 61, 74, 45, 60,
62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 69, 69, 69, 72, 69, 79, 72, 61, 57,
63, 63, 63, 63, 64, 64, 62, 62, 66, 65, 66, 70, 62, 97, 70, 67, 48, 48, 48, 49,
64, 64, 62, 62, 64, 70, 62, 68, 67, 69, 97, 50, 46, 51, 73, 75, 75, 54, 57, 51,
78, 72, 66, 66, 74, 79, 119, 132, 71, 70, 76, 48, 54, 48, 55, 57, 76, 57, 75, 75,
68, 68, 73, 70, 72, 122, 83, 74, 81, 81, 75, 77, 80, 76, 82, 57, 78, 72, 63, 76,
81, 72, 81, 84, 86, 74, 84, 119, 82, 51, 72, 84, 57, 75, 77, 100, 80, 82, 78, 81,
93, 82, 51, 51, 51, 51, 51, 54, 86, 54, 69, 69, 69, 84, 69, 57, 57, 83, 89, 57,
54, 52, 55, 85, 93, 56, 87, 57, 60, 87, 70, 81, 85, 70, 85, 57, 85, 85, 85, 57,
57, 54, 91, 54, 88, 95, 64, 88, 62, 64, 85, 86, 85, 57, 57, 87, 90, 57, 96, 88,
87, 62, 64, 97, 62, 91, 64, 99, 62, 95, 95, 57, 57, 98, 99, 91, 57, 101, 90, 71,
92, 94, 64, 64, 62, 62, 97, 90, 156, 75, 96, 107, 95, 88, 57, 105, 63, 57, 91, 101,
89, 99, 98, 156, 93, 95, 96, 78, 84, 101, 106, 102, 92, 103, 107, 92, 94, 57, 105, 98,
91, 84, 79, 81, 81, 81, 99, 81, 64, 97, 108, 57, 104, 99, 102, 57, 103, 92, 57, 57,
120, 64, 101, 82, 75, 102, 82, 102, 100, 102, 93, 94, 108, 57, 104, 113, 110, 57, 57, 109,
102, 102, 64, 102, 103, 102, 64, 64, 104, 62, 57, 57, 111, 115, 57, 57, 53, 113, 117, 110,
106, 107, 105, 107, 64, 64, 62, 62, 111, 64, 46, 109, 57, 112, 118, 111, 114, 118, 119, 116,
64, 121, 120, 110, 106, 64, 106, 62, 117, 109, 57, 120, 123, 121, 38, 112, 118, 38, 114, 118,
112, 108, 111, 115, 114, 112, 64, 111, 113, 114, 119, 116, 123, 123, 120, 37, 37, 37, 37, 37,
116, 117, 109, 118, 109, 64, 123, 62, 122, 64, 37, 37, 40, 40, 40, 40, 40, 40, 40, 41,
127, 62, 128, 117, 131, 59, 118, 133, 130, 123, 41, 41, 41, 41, 41, 41, 44, 44, 52, 52,
64, 129, 62, 64, 127, 121, 128, 124, 131, 125, 52, 56, 56, 56, 64, 123, 64, 123, 64, 64,
52, 133, 131, 112, 129, 156, 112, 114, 126, 44, 64, 65, 123, 65, 65, 65, 65, 65, 68, 123,
134, 127, 44, 128, 112, 64, 112, 113, 114, 115, 123, 68, 68, 68, 68, 122, 123, 122, 122, 122,
114, 129, 64, 134, 62, 132, 64, 64, 62, 62, 122, 122, 9, 123, 123, 123, 123, 123, 123, 123,
136, 138, 140, 64, 137, 62, 64, 142, 62, 156, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
135, 143, 139, 136, 145, 138, 140, 64, 138, 62, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
142, 156, 141, 136, 143, 148, 140, 145, 64, 156, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
62, 146, 144, 156, 64, 142, 62, 64, 148, 62, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
149, 153, 64, 150, 62, 145, 150, 151, 156, 147, 123, 123
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
} ; } ;
static const flex_int16_t yy_chk[503] = static const flex_int16_t yy_chk[373] =
{ 0, { 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, 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,
3, 4, 7, 19, 23, 8, 23, 25, 148, 25, 4, 7, 19, 23, 8, 23, 25, 32, 25, 7,
7, 3, 4, 8, 16, 142, 19, 16, 16, 16, 3, 4, 8, 27, 19, 27, 31, 33, 39, 34,
16, 16, 27, 30, 27, 30, 138, 27, 27, 27, 32, 31, 35, 39, 47, 59, 33, 81, 81, 65,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 81, 81, 32, 59, 65, 31, 34, 47, 128, 33,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 35, 43, 43, 43, 46, 43, 59, 46, 34, 120,
27, 27, 27, 27, 31, 32, 31, 32, 37, 31, 66, 43, 35, 97, 43, 66, 48, 49, 48, 49,
33, 34, 33, 34, 35, 39, 35, 38, 32, 33, 85, 50, 46, 50, 46, 48, 49, 51, 58, 51,
45, 40, 37, 31, 41, 45, 119, 117, 34, 39, 50, 54, 55, 54, 55, 62, 51, 60, 48, 49,
38, 32, 35, 33, 40, 106, 51, 41, 49, 49, 54, 55, 60, 50, 62, 61, 58, 72, 63, 51,
49, 34, 49, 52, 53, 35, 52, 102, 49, 51, 72, 74, 88, 54, 55, 88, 60, 62, 58, 61,
68, 49, 51, 51, 51, 51, 51, 54, 53, 54, 69, 69, 69, 74, 69, 56, 52, 72, 79, 79,
55, 52, 55, 52, 68, 56, 54, 56, 57, 55, 69, 61, 75, 69, 75, 82, 76, 75, 76, 76,
57, 60, 66, 60, 56, 70, 62, 57, 62, 65, 77, 76, 77, 77, 78, 77, 79, 80, 84, 78,
60, 65, 67, 72, 67, 66, 69, 74, 69, 70, 82, 86, 87, 86, 87, 80, 91, 89, 79, 45,
67, 69, 71, 73, 71, 73, 72, 65, 77, 75, 84, 96, 82, 78, 90, 91, 36, 95, 80, 89,
61, 74, 73, 77, 67, 69, 71, 78, 84, 86, 95, 90, 92, 90, 96, 92, 92, 98, 91, 98,
65, 84, 78, 81, 81, 81, 73, 81, 103, 71, 101, 99, 90, 99, 90, 102, 90, 93, 93, 103,
103, 58, 86, 81, 42, 87, 81, 87, 84, 88, 93, 93, 101, 104, 90, 108, 103, 105, 30, 102,
87, 88, 88, 89, 88, 89, 89, 90, 89, 90, 110, 109, 104, 110, 111, 112, 26, 108, 112, 103,
91, 93, 90, 92, 92, 94, 92, 94, 95, 104, 17, 102, 114, 105, 113, 104, 109, 113, 113, 111,
120, 104, 120, 94, 91, 98, 90, 98, 99, 93, 116, 114, 9, 116, 6, 105, 118, 5, 109, 118,
97, 92, 95, 97, 97, 96, 96, 94, 96, 96, 118, 111, 0, 0, 114, 124, 124, 124, 124, 124,
98, 99, 93, 101, 92, 105, 107, 105, 105, 110, 124, 124, 125, 125, 125, 125, 125, 125, 125, 126,
109, 110, 109, 98, 111, 26, 101, 118, 110, 107, 126, 126, 126, 126, 126, 126, 127, 127, 129, 129,
108, 109, 108, 121, 109, 121, 109, 108, 111, 108, 129, 130, 130, 130, 131, 0, 131, 0, 131, 131,
17, 118, 110, 112, 109, 9, 112, 112, 108, 6, 131, 132, 0, 132, 132, 132, 132, 132, 133, 0,
123, 108, 5, 108, 113, 113, 115, 113, 113, 115, 0, 133, 133, 133, 133, 134, 0, 134, 134, 134,
115, 108, 116, 123, 116, 116, 124, 125, 124, 125, 134, 134, 123, 123, 123, 123, 123, 123, 123, 123,
127, 128, 129, 126, 125, 126, 130, 131, 130, 0, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
124, 134, 126, 127, 136, 128, 129, 135, 125, 135, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
131, 0, 130, 124, 134, 140, 126, 136, 137, 0, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
137, 137, 135, 0, 139, 130, 139, 141, 140, 141, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
141, 145, 144, 143, 144, 135, 143, 143, 0, 139, 123, 123
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
} ; } ;
#define YY_TRAILING_MASK 0x2000 #define YY_TRAILING_MASK 0x2000
@ -645,6 +600,9 @@ goto find_rule; \
noinput disables the generation of code for reading input from standard input noinput disables the generation of code for reading input from standard input
noyywrap don't use yywrap() function noyywrap don't use yywrap() function
yyclass define name of the scanner class 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 #define YY_NO_INPUT 1
@ -872,14 +830,14 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[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_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
*(yy_state_ptr)++ = yy_current_state; *(yy_state_ptr)++ = yy_current_state;
++yy_cp; ++yy_cp;
} }
while ( yy_base[yy_current_state] != 452 ); while ( yy_base[yy_current_state] != 323 );
yy_find_action: yy_find_action:
yy_current_state = *--(yy_state_ptr); 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 ) 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 ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[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_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + 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; 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 ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[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_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + 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 ) if ( ! yy_is_jam )
*(yy_state_ptr)++ = yy_current_state; *(yy_state_ptr)++ = yy_current_state;
@ -2018,31 +1976,25 @@ static int yy_flex_strlen (const char * s )
} }
#endif #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" #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) step::scanner::scanner(StepFile_ReadData* theDataModel, std::istream* in, std::ostream* out)
: stepFlexLexer(in, out), myDataModel(theDataModel) : stepFlexLexer(in, out), myDataModel(theDataModel)
{ {

View File

@ -21,12 +21,18 @@
noinput disables the generation of code for reading input from standard input noinput disables the generation of code for reading input from standard input
noyywrap don't use yywrap() function noyywrap don't use yywrap() function
yyclass define name of the scanner class 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 c++
%option 8bit warn nodefault %option 8bit warn nodefault
%option noyywrap %option noyywrap
%option noinput %option noinput
%option yyclass="step::scanner" %option yyclass="step::scanner"
%option noyyalloc noyyfree noyyrealloc
%option case-insensitive
%top{ %top{
// This file is part of Open CASCADE Technology software library. // This file is part of Open CASCADE Technology software library.
@ -52,7 +58,6 @@
#ifdef YY_INTERACTIVE #ifdef YY_INTERACTIVE
#undef YY_INTERACTIVE #undef YY_INTERACTIVE
#endif #endif
#define YY_INTERACTIVE 0
typedef step::parser::token token; 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) step::scanner::scanner(StepFile_ReadData* theDataModel, std::istream* in, std::ostream* out)
: stepFlexLexer(in, out), myDataModel(theDataModel) : stepFlexLexer(in, out), myDataModel(theDataModel)
{ {

View File

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

View File

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