This commit is contained in:
rickg%netscape.com 1999-02-19 00:54:01 +00:00
Родитель d1fb344418
Коммит 12e959c3a4
2 изменённых файлов: 64 добавлений и 68 удалений

Просмотреть файл

@ -54,6 +54,7 @@ static const char* kNullToken = "Error: Null token given";
static const char* kInvalidTagStackPos = "Error: invalid tag stack position";
static char* kVerificationDir = "c:/temp";
static const char* kViewSourceCommand= "view-source";
static char gShowCRC=0;
static nsAutoString gEmpty;
@ -356,12 +357,8 @@ CNavDTD::CNavDTD() : nsIDTD(){
mFormContext=0;
mMapContext=0;
mTokenizer=0;
#ifdef NS_DEBUG
mComputedCRC32=0;
mExpectedCRC32=0;
#endif
// DebugDumpContainmentRules2(*this,"c:/temp/DTDRules.new","New CNavDTD Containment Rules");
}
@ -478,12 +475,8 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsIParse
if((aNotifySink) && (mSink)) {
result = mSink->WillBuildModel();
}
#ifdef NS_DEBUG
mComputedCRC32=0;
mExpectedCRC32=0;
#endif
}
return result;
}
@ -547,10 +540,21 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
result = CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE);
}
#ifdef NS_DEBUG
//let's only grab this state once!
if(!gShowCRC) {
gShowCRC=1; //this only indicates we'll not initialize again.
char* theEnvString = PR_GetEnv("RICKG_CRC");
if(theEnvString){
if(('1'==theEnvString[0]) || ('Y'==theEnvString[0]) || ('y'==theEnvString[0])){
gShowCRC=2; //this indicates that the CRC flag was found in the environment.
}
}
}
if(2==gShowCRC) {
if(mComputedCRC32!=mExpectedCRC32) {
if(mExpectedCRC32!=0) {
printf("Expected CRC: %u,",mExpectedCRC32);
printf("CRC Computed: %u Expected CRC: %u\n,",mComputedCRC32,mExpectedCRC32);
result = mSink->DidBuildModel(2);
}
else {
@ -559,9 +563,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
}
}
else result = mSink->DidBuildModel(0);
#else
result = mSink->DidBuildModel(3);
#endif
}
if(mDTDDebug) {
mDTDDebug->DumpVectorRecord();
}
@ -946,7 +948,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
} //if
}
} //if
#ifdef NS_DEBUG
else if(theKey.EqualsIgnoreCase("NAME")) {
const nsString& theValue1=aNode.GetValueAt(0);
if(theValue1.EqualsIgnoreCase("\"CRC\"")) {
@ -958,7 +960,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
} //if
} //if
} //else
#endif
} //if
}//if
@ -2263,11 +2265,9 @@ CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
nsresult result=NS_OK;
eHTMLTags nodeType=(eHTMLTags)aNode.GetNodeType();
#ifdef NS_DEBUG
#define K_OPENOP 100
#define K_OPENOP 100
CRCStruct theStruct(nodeType,K_OPENOP);
mComputedCRC32=AccumulateCRC(mComputedCRC32,(char*)&theStruct,sizeof(theStruct));
#endif
switch(nodeType) {
@ -2350,11 +2350,9 @@ CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,
nsresult result=NS_OK;
eHTMLTags nodeType=(eHTMLTags)aNode.GetNodeType();
#ifdef NS_DEBUG
#define K_CLOSEOP 200
#define K_CLOSEOP 200
CRCStruct theStruct(nodeType,K_CLOSEOP);
mComputedCRC32=AccumulateCRC(mComputedCRC32,(char*)&theStruct,sizeof(theStruct));
#endif
switch(nodeType) {

Просмотреть файл

@ -54,6 +54,7 @@ static const char* kNullToken = "Error: Null token given";
static const char* kInvalidTagStackPos = "Error: invalid tag stack position";
static char* kVerificationDir = "c:/temp";
static const char* kViewSourceCommand= "view-source";
static char gShowCRC=0;
static nsAutoString gEmpty;
@ -356,12 +357,8 @@ CNavDTD::CNavDTD() : nsIDTD(){
mFormContext=0;
mMapContext=0;
mTokenizer=0;
#ifdef NS_DEBUG
mComputedCRC32=0;
mExpectedCRC32=0;
#endif
// DebugDumpContainmentRules2(*this,"c:/temp/DTDRules.new","New CNavDTD Containment Rules");
}
@ -478,12 +475,8 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsIParse
if((aNotifySink) && (mSink)) {
result = mSink->WillBuildModel();
}
#ifdef NS_DEBUG
mComputedCRC32=0;
mExpectedCRC32=0;
#endif
}
return result;
}
@ -547,10 +540,21 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
result = CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE);
}
#ifdef NS_DEBUG
//let's only grab this state once!
if(!gShowCRC) {
gShowCRC=1; //this only indicates we'll not initialize again.
char* theEnvString = PR_GetEnv("RICKG_CRC");
if(theEnvString){
if(('1'==theEnvString[0]) || ('Y'==theEnvString[0]) || ('y'==theEnvString[0])){
gShowCRC=2; //this indicates that the CRC flag was found in the environment.
}
}
}
if(2==gShowCRC) {
if(mComputedCRC32!=mExpectedCRC32) {
if(mExpectedCRC32!=0) {
printf("Expected CRC: %u,",mExpectedCRC32);
printf("CRC Computed: %u Expected CRC: %u\n,",mComputedCRC32,mExpectedCRC32);
result = mSink->DidBuildModel(2);
}
else {
@ -559,9 +563,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
}
}
else result = mSink->DidBuildModel(0);
#else
result = mSink->DidBuildModel(3);
#endif
}
if(mDTDDebug) {
mDTDDebug->DumpVectorRecord();
}
@ -946,7 +948,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
} //if
}
} //if
#ifdef NS_DEBUG
else if(theKey.EqualsIgnoreCase("NAME")) {
const nsString& theValue1=aNode.GetValueAt(0);
if(theValue1.EqualsIgnoreCase("\"CRC\"")) {
@ -958,7 +960,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
} //if
} //if
} //else
#endif
} //if
}//if
@ -2263,11 +2265,9 @@ CNavDTD::OpenContainer(const nsIParserNode& aNode,PRBool aUpdateStyleStack){
nsresult result=NS_OK;
eHTMLTags nodeType=(eHTMLTags)aNode.GetNodeType();
#ifdef NS_DEBUG
#define K_OPENOP 100
#define K_OPENOP 100
CRCStruct theStruct(nodeType,K_OPENOP);
mComputedCRC32=AccumulateCRC(mComputedCRC32,(char*)&theStruct,sizeof(theStruct));
#endif
switch(nodeType) {
@ -2350,11 +2350,9 @@ CNavDTD::CloseContainer(const nsIParserNode& aNode,eHTMLTags aTag,
nsresult result=NS_OK;
eHTMLTags nodeType=(eHTMLTags)aNode.GetNodeType();
#ifdef NS_DEBUG
#define K_CLOSEOP 200
#define K_CLOSEOP 200
CRCStruct theStruct(nodeType,K_CLOSEOP);
mComputedCRC32=AccumulateCRC(mComputedCRC32,(char*)&theStruct,sizeof(theStruct));
#endif
switch(nodeType) {