зеркало из https://github.com/mozilla/pjs.git
use prefix ++, not postfix ++. Bug 82615, r=heikki, sr=jst
This commit is contained in:
Родитель
a3e75c951e
Коммит
911d2fa2e8
|
@ -153,7 +153,7 @@ class CToken {
|
|||
* Make a note on number of times you have been referenced
|
||||
* @update harishd 08/02/00
|
||||
*/
|
||||
void AddRef() { mUseCount++; }
|
||||
void AddRef() { ++mUseCount; }
|
||||
|
||||
/**
|
||||
* Free yourself if no one is holding you.
|
||||
|
|
|
@ -112,7 +112,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|||
PRInt32 nCount = g_duplicateList->Count();
|
||||
if (nCount > 0)
|
||||
{
|
||||
for (PRInt32 n = 0; n < nCount; n++)
|
||||
for (PRInt32 n = 0; n < nCount; ++n)
|
||||
{
|
||||
nsString * pstr = (nsString *)g_duplicateList->ElementAt(n);
|
||||
if (pstr->Equals(aURLSpec)) {
|
||||
|
@ -127,7 +127,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|||
str.Truncate();
|
||||
nsString(aURLSpec).Left(str,5);
|
||||
if (str.Equals(NS_LITERAL_STRING("http:"))) {
|
||||
g_iProcessed++;
|
||||
++g_iProcessed;
|
||||
if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0))
|
||||
g_bHitTop = PR_TRUE;
|
||||
g_workList->AppendElement(new nsString(aURLSpec));
|
||||
|
|
|
@ -144,7 +144,7 @@ RobotSink::~RobotSink()
|
|||
{
|
||||
NS_IF_RELEASE(mDocumentURL);
|
||||
PRInt32 i, n = mObservers.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
for (i = 0; i < n; ++i) {
|
||||
nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i);
|
||||
NS_RELEASE(cop);
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
|
|||
if (tmp.Equals(NS_LITERAL_STRING("a"))) {
|
||||
nsAutoString k, v;
|
||||
PRInt32 ac = aNode.GetAttributeCount();
|
||||
for (PRInt32 i = 0; i < ac; i++) {
|
||||
for (PRInt32 i = 0; i < ac; ++i) {
|
||||
// Get upper-cased key
|
||||
const nsAString& key = aNode.GetKeyAt(i);
|
||||
k.Assign(key);
|
||||
|
@ -388,7 +388,7 @@ void RobotSink::ProcessLink(const nsString& aLink)
|
|||
|
||||
// Now give link to robot observers
|
||||
PRInt32 i, n = mObservers.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
for (i = 0; i < n; ++i) {
|
||||
nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i);
|
||||
cop->ProcessLink(absURLSpec);
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
#include "nsXPCOM.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsString.h"
|
||||
class nsIWebShell;
|
||||
|
||||
extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebShell * ww);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("NS_InitXPCOM2 failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
nsVoidArray * gWorkList = new nsVoidArray();
|
||||
if(gWorkList) {
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
nsString *tempString = new nsString;
|
||||
tempString->AssignWithConversion(argv[i]);
|
||||
gWorkList->AppendElement(tempString);
|
||||
}
|
||||
}
|
||||
|
||||
return DebugRobot(gWorkList, nsnull);
|
||||
}
|
||||
|
|
@ -704,7 +704,7 @@ PRBool DoesRequireBody(CToken* aToken,nsITokenizer* aTokenizer) {
|
|||
if(theTag==eHTMLTag_input) {
|
||||
// IE & Nav4x opens up a body for type=text - Bug 66985
|
||||
PRInt32 ac=aToken->GetAttributeCount();
|
||||
for(PRInt32 i=0; i<ac; i++) {
|
||||
for(PRInt32 i=0; i<ac; ++i) {
|
||||
CAttributeToken* attr=NS_STATIC_CAST(CAttributeToken*,aTokenizer->GetTokenAt(i));
|
||||
const nsAString& name=attr->GetKey();
|
||||
const nsAString& value=attr->GetValue();
|
||||
|
@ -1032,7 +1032,7 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
|
|||
|
||||
if(theCount) {
|
||||
PRInt32 theIndex=0;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
const nsAString& theKey = aNode.GetKeyAt(theIndex);
|
||||
if(theKey.Equals(NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
|
||||
const nsAString& theName=aNode.GetValueAt(theIndex);
|
||||
|
@ -1894,7 +1894,7 @@ static void StripWSFollowingTag(eHTMLTags aChildTag,nsITokenizer* aTokenizer,nsT
|
|||
while(theToken) {
|
||||
eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType());
|
||||
switch(theType) {
|
||||
case eToken_newline: aNewlineCount++;
|
||||
case eToken_newline: ++aNewlineCount;
|
||||
case eToken_whitespace:
|
||||
theToken=aTokenizer->PopToken();
|
||||
IF_FREE(theToken, aTokenAllocator);
|
||||
|
@ -2071,7 +2071,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) {
|
|||
// considered as a leaf. However, in the sink FORM can either
|
||||
// be a container or a leaf. Therefore, we have to check
|
||||
// with the sink -- Ref: Bug 20087.
|
||||
anIndex++;
|
||||
++anIndex;
|
||||
}
|
||||
|
||||
STOP_TIMER()
|
||||
|
@ -2085,7 +2085,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) {
|
|||
PRInt32 i=0;
|
||||
nsEntryStack* theChildStyleStack=0;
|
||||
|
||||
for(i=0; i<(theTagCount - theTopIndex); i++) {
|
||||
for(i=0; i<(theTagCount - theTopIndex); ++i) {
|
||||
nsCParserNode* node=mBodyContext->Pop(theChildStyleStack);
|
||||
mTempContext->Push(node);
|
||||
IF_FREE(node, &mNodeAllocator); //release the popped node since push will addref for us.
|
||||
|
@ -2098,7 +2098,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) {
|
|||
theTag = (eHTMLTags)theToken->GetTypeID();
|
||||
attrCount = (gHTMLElements[theTag].mSkipTarget)? 0:theToken->GetAttributeCount();
|
||||
// Put back attributes, which once got popped out, into the tokenizer
|
||||
for(PRInt32 j=0;j<attrCount; j++){
|
||||
for(PRInt32 j=0;j<attrCount; ++j){
|
||||
CToken* theAttrToken = (CToken*)mMisplacedContent.PopFront();
|
||||
if(theAttrToken) {
|
||||
mTokenizer->PushTokenFront(theAttrToken);
|
||||
|
@ -2128,7 +2128,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) {
|
|||
|
||||
// Bad-contents were successfully processed. Now, itz time to get
|
||||
// back to the original body context state.
|
||||
for(PRInt32 k=0; k<(theTagCount - theTopIndex); k++) {
|
||||
for(PRInt32 k=0; k<(theTagCount - theTopIndex); ++k) {
|
||||
nsCParserNode* node=mTempContext->Pop(theChildStyleStack);
|
||||
mBodyContext->Push(node);
|
||||
IF_FREE(node, &mNodeAllocator);
|
||||
|
@ -2380,7 +2380,7 @@ nsresult CNavDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt32
|
|||
if(aCount<=theAvailTokenCount) {
|
||||
CToken* theToken=0;
|
||||
eHTMLTags theSkipTarget=gHTMLElements[aTag].mSkipTarget;
|
||||
for(attr=0;attr<aCount;attr++){
|
||||
for(attr=0;attr<aCount;++attr){
|
||||
if((eHTMLTag_unknown!=theSkipTarget) && mSkippedContent.GetSize())
|
||||
theToken=NS_STATIC_CAST(CToken*,mSkippedContent.PopFront());
|
||||
else
|
||||
|
@ -2448,7 +2448,7 @@ CNavDTD::CollectSkippedContent(PRInt32 aTag, nsAString& aContent, PRInt32 &aLine
|
|||
|
||||
PRInt32 i = 0;
|
||||
PRInt32 tagCount = mSkippedContent.GetSize();
|
||||
for (i = 0; i< tagCount; i++){
|
||||
for (i = 0; i< tagCount; ++i){
|
||||
CHTMLToken* theNextToken = (CHTMLToken*)mSkippedContent.PopFront();
|
||||
|
||||
if (theNextToken) {
|
||||
|
@ -2932,14 +2932,14 @@ nsresult CNavDTD::OpenTransientStyles(eHTMLTags aChildTag){
|
|||
}
|
||||
|
||||
mFlags &= ~NS_DTD_FLAG_ENABLE_RESIDUAL_STYLE;
|
||||
for(;theLevel<theCount;theLevel++){
|
||||
for(;theLevel<theCount;++theLevel){
|
||||
nsEntryStack* theStack=mBodyContext->GetStylesAt(theLevel);
|
||||
if(theStack){
|
||||
|
||||
PRInt32 sindex=0;
|
||||
|
||||
nsTagEntry *theEntry=theStack->mEntries;
|
||||
for(sindex=0;sindex<theStack->mCount;sindex++){
|
||||
for(sindex=0;sindex<theStack->mCount;++sindex){
|
||||
nsCParserNode* theNode=(nsCParserNode*)theEntry->mNode;
|
||||
if(1==theNode->mUseCount) {
|
||||
eHTMLTags theNodeTag=(eHTMLTags)theNode->GetNodeType();
|
||||
|
@ -2965,10 +2965,10 @@ nsresult CNavDTD::OpenTransientStyles(eHTMLTags aChildTag){
|
|||
//if the node tag can't contain the child tag, then remove the child tag from the style stack
|
||||
nsCParserNode* node=theStack->Remove(sindex,theNodeTag);
|
||||
IF_FREE(node, &mNodeAllocator);
|
||||
theEntry--; //back up by one
|
||||
--theEntry; //back up by one
|
||||
}
|
||||
} //if
|
||||
theEntry++;
|
||||
++theEntry;
|
||||
} //for
|
||||
} //if
|
||||
} //for
|
||||
|
@ -3269,7 +3269,7 @@ nsresult CNavDTD::OpenMap(const nsCParserNode *aNode){
|
|||
|
||||
if(NS_OK==result) {
|
||||
mBodyContext->Push(aNode);
|
||||
mOpenMapCount++;
|
||||
++mOpenMapCount;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -581,7 +581,7 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
|
|||
if(theNextToken) {
|
||||
eHTMLTokenTypes theType=eHTMLTokenTypes(theNextToken->GetTokenType());
|
||||
if(eToken_newline==theType){
|
||||
mLineNumber++;
|
||||
++mLineNumber;
|
||||
mTokenizer->PopToken(); //skip 1st newline inside PRE and LISTING
|
||||
}//if
|
||||
}//if
|
||||
|
@ -599,7 +599,7 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
|
|||
|
||||
if(theCount) {
|
||||
PRInt32 theIndex=0;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
const nsAString& theKey = aNode.GetKeyAt(theIndex);
|
||||
if(theKey.Equals(NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
|
||||
const nsAString& theName=aNode.GetValueAt(theIndex);
|
||||
|
@ -662,7 +662,7 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNo
|
|||
|
||||
switch(aTag) {
|
||||
case eHTMLTag_newline:
|
||||
mLineNumber++;
|
||||
++mLineNumber;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -815,7 +815,7 @@ nsresult COtherDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt3
|
|||
if(aCount<=theAvailTokenCount) {
|
||||
//gElementTable->mElements[aTag]->GetSkipTarget();
|
||||
CToken* theToken=0;
|
||||
for(attr=0;attr<aCount;attr++){
|
||||
for(attr=0;attr<aCount;++attr){
|
||||
theToken=mTokenizer->PopToken();
|
||||
if(theToken) {
|
||||
// Sanitize the key for it might contain some non-alpha-non-digit characters
|
||||
|
|
|
@ -104,7 +104,7 @@ inline PRBool ListContainsTag(eHTMLTags* aTagList,eHTMLTags aTag) {
|
|||
if(aTag==*theNextTag) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
theNextTag++;
|
||||
++theNextTag;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -2109,7 +2109,7 @@ void CElementTable::InitializeElements() {
|
|||
|
||||
int max=sizeof(mElements)/sizeof(mElements[0]);
|
||||
int index=0;
|
||||
for(index=0;index<max;index++){
|
||||
for(index=0;index<max;++index){
|
||||
mElements[index]=&mDfltElements[index];
|
||||
}
|
||||
|
||||
|
@ -2465,12 +2465,12 @@ void CElementTable::DebugDumpContainment(CElement* anElement){
|
|||
|
||||
int count=0;
|
||||
int i=0;
|
||||
for(i=0;i<NS_HTML_TAG_MAX;i++){
|
||||
for(i=0;i<NS_HTML_TAG_MAX;++i){
|
||||
CElement* theChild=mElements[i];
|
||||
if(anElement->CanContain(theChild,0)){
|
||||
const PRUnichar *t = nsHTMLTags::GetStringValue(theChild->mTag);
|
||||
printf("%s ", NS_ConvertUCS2toUTF8(t).get());
|
||||
count++;
|
||||
++count;
|
||||
if(18==count) {
|
||||
count=0;
|
||||
printf("\n%s",prefix);
|
||||
|
@ -2528,7 +2528,7 @@ void CElementTable::DebugDumpContainment(const char* aTitle){
|
|||
printf("==================================================\n");
|
||||
int i=0;
|
||||
|
||||
for(i=1;i<NS_HTML_TAG_MAX;i++){
|
||||
for(i=1;i<NS_HTML_TAG_MAX;++i){
|
||||
DebugDumpContainment(mElements[i]);
|
||||
//DebugDumpGroups(mElements[i]);
|
||||
} //for
|
||||
|
|
|
@ -1,232 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
//Testing stream crap...
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <io.h>
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsTokenizer.h"
|
||||
#include "nsHTMLDelegate.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsHTMLContentSink.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsParserCIID.h"
|
||||
|
||||
|
||||
PRBool compareFiles(const char* file1,const char* file2,int& failpos) {
|
||||
PRBool result=PR_TRUE;
|
||||
PRBool done=PR_FALSE;
|
||||
char ch1,ch2;
|
||||
int eof1,eof2;
|
||||
|
||||
#if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX)
|
||||
/* HAVE_IOS_BINARY needs to be set for mac & win */
|
||||
ifstream input1(file1,ios::in && ios::binary,filebuf::openprot);
|
||||
ifstream input2(file2,ios::in && ios::binary,filebuf::openprot);
|
||||
#else
|
||||
ifstream input1(file1,ios::in && ios::bin,filebuf::openprot);
|
||||
ifstream input2(file2,ios::in && ios::bin,filebuf::openprot);
|
||||
#endif
|
||||
input1.setmode(filebuf::binary);
|
||||
input2.setmode(filebuf::binary);
|
||||
failpos=-1;
|
||||
|
||||
while(!done) {
|
||||
|
||||
while(!(eof1=input1.eof())) {
|
||||
input1.read(&ch1,1);
|
||||
if(failpos>4225) {
|
||||
int x=failpos;
|
||||
}
|
||||
failpos++;
|
||||
char* p=strchr(" \t\r\n\b",ch1);
|
||||
if(!p)
|
||||
break;
|
||||
}
|
||||
|
||||
while(!(eof2=input2.eof())) {
|
||||
input2.read(&ch2,1);
|
||||
char* p=strchr(" \t\r\n\b",ch2);
|
||||
if(!p)
|
||||
break;
|
||||
}
|
||||
|
||||
if(eof1==eof2) {
|
||||
if(eof1)
|
||||
done=PR_TRUE;
|
||||
else if(ch1!=ch2) {
|
||||
done=PR_TRUE;
|
||||
result=PR_FALSE;
|
||||
|
||||
}
|
||||
}
|
||||
else done=PR_TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* LAST MODS: gess
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*------------------------------------------------------*/
|
||||
void parseFile (const char* aFilename,int size)
|
||||
{
|
||||
//debug
|
||||
//aFilename="s:\\ns\\raptor\\parser\\tests\\html\\home01.html";
|
||||
//aFilename="c:\\temp\\sun\\test00000.html";
|
||||
//aFilename="c:\\windows\\temp\\test.html";
|
||||
aFilename="s:\\readHTML-VC\\test.html";
|
||||
//aFilename="c:\\temp\\sun\\commentbug.html";
|
||||
|
||||
|
||||
char filename[_MAX_PATH];
|
||||
strcpy(filename,aFilename);
|
||||
strcat(filename,".tokens");
|
||||
{
|
||||
nsIParser* parser;
|
||||
|
||||
static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID);
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCParserCID,
|
||||
nsnull,
|
||||
kCParserIID,
|
||||
(void **)&parser);
|
||||
|
||||
CHTMLContentSink theSink;
|
||||
parser->setContentSink(&theSink);
|
||||
parser->parse(aFilename);
|
||||
NS_RELEASE(parser);
|
||||
}
|
||||
|
||||
int failpos=0;
|
||||
|
||||
if(!compareFiles(aFilename,filename,failpos)) {
|
||||
char buffer[100];
|
||||
printf("FAILED: %s [%i]\n",aFilename,failpos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* LAST MODS: gess
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*------------------------------------------------------*/
|
||||
int walkDirectoryTree(char* aPath) {
|
||||
int result=0;
|
||||
char fullPath[_MAX_PATH];
|
||||
struct _finddata_t c_file;
|
||||
long hFile;
|
||||
|
||||
strcpy(fullPath,aPath);
|
||||
strcat(fullPath,"\\*.*");
|
||||
/* Find first .c file in current directory */
|
||||
if((hFile = _findfirst( fullPath, &c_file )) == -1L )
|
||||
printf( "No matching files in current directory!\n" );
|
||||
else {
|
||||
|
||||
PRBool done=PR_FALSE;
|
||||
while(!done) {
|
||||
if(c_file.attrib & _A_SUBDIR) {
|
||||
if(strlen(c_file.name)>2){
|
||||
char newPath[_MAX_PATH];
|
||||
strcpy(newPath,aPath);
|
||||
strcat(newPath,"\\");
|
||||
strcat(newPath,c_file.name);
|
||||
walkDirectoryTree(newPath);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int len=strlen(c_file.name);
|
||||
if(len>5) {
|
||||
if(0==strnicmp(&c_file.name[len-5],".HTML",5)) {
|
||||
char filepath[_MAX_PATH];
|
||||
strcpy(filepath,aPath);
|
||||
strcat(filepath,"\\");
|
||||
strcat(filepath,c_file.name);
|
||||
parseFile(filepath,c_file.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_findnext( hFile, &c_file )!=0)
|
||||
done=PR_TRUE;
|
||||
}
|
||||
_findclose( hFile );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* LAST MODS: gess
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*------------------------------------------------------*/
|
||||
int main(int argc, char* argv [])
|
||||
{
|
||||
int result=0;
|
||||
char buffer[_MAX_PATH];
|
||||
|
||||
if(argc==2)
|
||||
strcpy(buffer,argv[1]);
|
||||
else _getcwd(buffer,_MAX_PATH);
|
||||
|
||||
nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("NS_InitXPCOM2 failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
walkDirectoryTree(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ void nsEntryStack::EnsureCapacityFor(PRInt32 aNewMax,PRInt32 aShiftOffset) {
|
|||
|
||||
if(temp){
|
||||
PRInt32 index=0;
|
||||
for(index=0;index<mCount;index++) {
|
||||
for(index=0;index<mCount;++index) {
|
||||
temp[aShiftOffset+index]=mEntries[index];
|
||||
}
|
||||
if(mEntries) delete [] mEntries;
|
||||
|
@ -199,7 +199,7 @@ void nsEntryStack::PushFront(const nsCParserNode* aNode,nsEntryStack* aStyleStac
|
|||
|
||||
mEntries[0].mParent=aStyleStack;
|
||||
mEntries[0].mStyles=0;
|
||||
mCount++;
|
||||
++mCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ void nsEntryStack::Append(nsEntryStack *aStack) {
|
|||
EnsureCapacityFor(mCount+aStack->mCount,0);
|
||||
|
||||
PRInt32 theIndex=0;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
mEntries[mCount]=aStack->mEntries[theIndex];
|
||||
mEntries[mCount++].mParent=0;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ nsCParserNode* nsEntryStack::Remove(PRInt32 anIndex,eHTMLTags aTag) {
|
|||
|
||||
PRInt32 theIndex=0;
|
||||
mCount-=1;
|
||||
for(theIndex=anIndex;theIndex<mCount;theIndex++){
|
||||
for(theIndex=anIndex;theIndex<mCount;++theIndex){
|
||||
mEntries[theIndex]=mEntries[theIndex+1];
|
||||
}
|
||||
|
||||
|
@ -261,12 +261,12 @@ nsCParserNode* nsEntryStack::Remove(PRInt32 anIndex,eHTMLTags aTag) {
|
|||
PRUint32 sindex=0;
|
||||
|
||||
nsTagEntry *theStyleEntry=theStyleStack->mEntries;
|
||||
for(sindex=scount-1;sindex>0;sindex--){
|
||||
for(sindex=scount-1;sindex>0;--sindex){
|
||||
if(theStyleEntry->mTag==aTag) {
|
||||
theStyleEntry->mParent=0; //this tells us that the style is not open at any level
|
||||
break;
|
||||
}
|
||||
theStyleEntry++;
|
||||
++theStyleEntry;
|
||||
} //for
|
||||
}
|
||||
}
|
||||
|
@ -299,12 +299,12 @@ nsCParserNode* nsEntryStack::Pop(void) {
|
|||
PRUint32 sindex=0;
|
||||
|
||||
nsTagEntry *theStyleEntry=theStyleStack->mEntries;
|
||||
for(sindex=scount-1;sindex>0;sindex--){
|
||||
for(sindex=scount-1;sindex>0;--sindex){
|
||||
if(theStyleEntry->mTag==mEntries[mCount].mTag) {
|
||||
theStyleEntry->mParent=0; //this tells us that the style is not open at any level
|
||||
break;
|
||||
}
|
||||
theStyleEntry++;
|
||||
++theStyleEntry;
|
||||
} //for
|
||||
}
|
||||
}
|
||||
|
@ -465,12 +465,12 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const {
|
|||
|
||||
// skip past leading and trailing quotes/etc
|
||||
if(kQuote==*start) {
|
||||
start++;
|
||||
++start;
|
||||
}
|
||||
|
||||
if(kSemicolon==theChar ||
|
||||
kQuote == theChar) {
|
||||
end--;
|
||||
--end;
|
||||
}
|
||||
|
||||
|
||||
|
@ -478,7 +478,7 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const {
|
|||
|
||||
PRInt32 theCount=mEntities.GetSize();
|
||||
PRInt32 theIndex=0;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++) {
|
||||
for(theIndex=0;theIndex<theCount;++theIndex) {
|
||||
CNamedEntity *theResult=(CNamedEntity*)mEntities.ObjectAt(theIndex);
|
||||
if(theResult &&
|
||||
theResult->mName.Equals(entityName,
|
||||
|
@ -592,7 +592,7 @@ public:
|
|||
while(next<=aValue) { // scale up in baseN; exceed current value.
|
||||
root=next;
|
||||
next*=base;
|
||||
expn++;
|
||||
++expn;
|
||||
}
|
||||
|
||||
while(expn--) {
|
||||
|
@ -735,7 +735,7 @@ public:
|
|||
int digitPos=0;
|
||||
int n=0;
|
||||
|
||||
for(digitPos=0;digitPos<len;digitPos++) {
|
||||
for(digitPos=0;digitPos<len;++digitPos) {
|
||||
romanPos--;
|
||||
switch(decStr[digitPos]) {
|
||||
case '0': break;
|
||||
|
@ -747,7 +747,7 @@ public:
|
|||
case '5': case '6':
|
||||
case '7': case '8':
|
||||
aString.Append(digitsB[romanPos]);
|
||||
for(n=0;n<(decStr[digitPos]-'5');n++)
|
||||
for(n=0;n<(decStr[digitPos]-'5');++n)
|
||||
aString.Append(digitsA[romanPos]);
|
||||
break;
|
||||
case '9':
|
||||
|
@ -795,7 +795,7 @@ public:
|
|||
repCount=((aValue-1)/seriesLen);
|
||||
modChar=aValue-(repCount*seriesLen);
|
||||
|
||||
for(count=0;count<=repCount;count++) {
|
||||
for(count=0;count<=repCount;++count) {
|
||||
aString.Append(PRUnichar(kFootnoteSet[modChar]));
|
||||
}
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsStr
|
|||
|
||||
CAbacus::eNumFormat theNumFormat=CAbacus::eDecimal;
|
||||
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
const nsAString& theKey=aNode.GetKeyAt(theIndex);
|
||||
const nsAString& theValue=aNode.GetValueAt(theIndex);
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ void nsDTDContext::PushStyle(const nsCParserNode* aNode){
|
|||
}
|
||||
if(theStack) {
|
||||
theStack->Push(aNode);
|
||||
mResidualStyleCount++;
|
||||
++mResidualStyleCount;
|
||||
}
|
||||
} //if
|
||||
}
|
||||
|
@ -1076,10 +1076,10 @@ void nsDTDContext::PushStyles(nsEntryStack *aStyles){
|
|||
PRUint32 sindex=0;
|
||||
|
||||
theEntry=aStyles->mEntries;
|
||||
for(sindex=0;sindex<scount;sindex++){
|
||||
for(sindex=0;sindex<scount;++sindex){
|
||||
theEntry->mParent=0; //this tells us that the style is not open at any level
|
||||
theEntry++;
|
||||
mResidualStyleCount++;
|
||||
++theEntry;
|
||||
++mResidualStyleCount;
|
||||
} //for
|
||||
|
||||
}
|
||||
|
@ -1202,7 +1202,7 @@ nsTokenAllocator::nsTokenAllocator() {
|
|||
|
||||
#ifdef NS_DEBUG
|
||||
int i=0;
|
||||
for(i=0;i<eToken_last-1;i++) {
|
||||
for(i=0;i<eToken_last-1;++i) {
|
||||
mTotals[i]=0;
|
||||
}
|
||||
#endif
|
||||
|
@ -1319,7 +1319,7 @@ static int gAllNodeCount=0;
|
|||
|
||||
int FindNode(nsCParserNode *aNode) {
|
||||
int theIndex=0;
|
||||
for(theIndex=0;theIndex<gAllNodeCount;theIndex++) {
|
||||
for(theIndex=0;theIndex<gAllNodeCount;++theIndex) {
|
||||
if(gAllNodes[theIndex]==aNode) {
|
||||
return theIndex;
|
||||
}
|
||||
|
@ -1402,7 +1402,7 @@ nsCParserNode* nsNodeAllocator::CreateNode(CToken* aToken,
|
|||
else{
|
||||
result=nsCParserNode::Create(aToken, aTokenAllocator,this);
|
||||
#ifdef DEBUG_TRACK_NODES
|
||||
mCount++;
|
||||
++mCount;
|
||||
AddNode(NS_STATIC_CAST(nsCParserNode*,result));
|
||||
#endif
|
||||
IF_HOLD(result);
|
||||
|
@ -1427,13 +1427,13 @@ void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char*
|
|||
out << "==================================================";
|
||||
int i,j=0;
|
||||
int written;
|
||||
for(i=1;i<eHTMLTag_text;i++){
|
||||
for(i=1;i<eHTMLTag_text;++i){
|
||||
const char* tag=nsHTMLTags::GetCStringValue((eHTMLTags)i);
|
||||
out << endl << endl << "Tag: <" << tag << ">" << endl;
|
||||
out << prefix;
|
||||
written=0;
|
||||
if(theDTD.IsContainer(i)) {
|
||||
for(j=1;j<eHTMLTag_text;j++){
|
||||
for(j=1;j<eHTMLTag_text;++j){
|
||||
if(15==written) {
|
||||
out << endl << prefix;
|
||||
written=0;
|
||||
|
@ -1442,7 +1442,7 @@ void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char*
|
|||
tag=nsHTMLTags::GetCStringValue((eHTMLTags)j);
|
||||
if(tag) {
|
||||
out<< tag << ", ";
|
||||
written++;
|
||||
++written;
|
||||
}
|
||||
}
|
||||
}//for
|
||||
|
@ -1509,10 +1509,10 @@ nsObserverEntry::nsObserverEntry(const nsAString& aTopic) : mTopic(aTopic)
|
|||
}
|
||||
|
||||
nsObserverEntry::~nsObserverEntry() {
|
||||
for (PRInt32 i = 0; i <= NS_HTML_TAG_MAX; i++){
|
||||
for (PRInt32 i = 0; i <= NS_HTML_TAG_MAX; ++i){
|
||||
if (mObservers[i]) {
|
||||
PRInt32 count = mObservers[i]->Count();
|
||||
for (PRInt32 j = 0; j < count; j++) {
|
||||
for (PRInt32 j = 0; j < count; ++j) {
|
||||
nsISupports* obs = (nsISupports*)mObservers[i]->ElementAt(j);
|
||||
NS_IF_RELEASE(obs);
|
||||
}
|
||||
|
@ -1550,7 +1550,7 @@ nsObserverEntry::Notify(nsIParserNode* aNode,
|
|||
// least 2 allocations for mImpl, usually more, plus at least 1 per
|
||||
// string (total = 2*(keys+3) + 2(or more) array allocations )).
|
||||
PRInt32 index;
|
||||
for (index = 0; index < theAttrCount; index++) {
|
||||
for (index = 0; index < theAttrCount; ++index) {
|
||||
keys.AppendString(aNode->GetKeyAt(index));
|
||||
values.AppendString(aNode->GetValueAt(index));
|
||||
}
|
||||
|
@ -1570,7 +1570,7 @@ nsObserverEntry::Notify(nsIParserNode* aNode,
|
|||
nsCOMPtr<nsIChannel> channel;
|
||||
aParser->GetChannel(getter_AddRefs(channel));
|
||||
|
||||
for (index=0;index<theObserversCount;index++) {
|
||||
for (index=0;index<theObserversCount;++index) {
|
||||
nsIElementObserver* observer = NS_STATIC_CAST(nsIElementObserver*,theObservers->ElementAt(index));
|
||||
if (observer) {
|
||||
result = observer->Notify(aWebShell, channel,
|
||||
|
@ -1613,7 +1613,7 @@ nsObserverEntry::AddObserver(nsIElementObserver *aObserver,
|
|||
void
|
||||
nsObserverEntry::RemoveObserver(nsIElementObserver *aObserver)
|
||||
{
|
||||
for (PRInt32 i=0; i <= NS_HTML_TAG_MAX; i++){
|
||||
for (PRInt32 i=0; i <= NS_HTML_TAG_MAX; ++i){
|
||||
if (mObservers[i]) {
|
||||
nsISupports* obs = aObserver;
|
||||
PRBool removed = mObservers[i]->RemoveElement(obs);
|
||||
|
|
|
@ -446,7 +446,7 @@ inline PRInt32 IndexOfTagInSet(PRInt32 aTag,const eHTMLTags* aTagSet,PRInt32 aCo
|
|||
if(aTag==*theTag) {
|
||||
return theTag-aTagSet;
|
||||
}
|
||||
theTag++;
|
||||
++theTag;
|
||||
}
|
||||
|
||||
return kNotFound;
|
||||
|
@ -622,7 +622,7 @@ inline PRInt32 LastOf(nsDTDContext& aContext,TagList& aTagList){
|
|||
inline PRInt32 FirstOf(nsDTDContext& aContext,PRInt32 aStartOffset,TagList& aTagList){
|
||||
int max = aContext.GetCount();
|
||||
int index;
|
||||
for(index=aStartOffset;index<max;index++){
|
||||
for(index=aStartOffset;index<max;++index){
|
||||
PRBool result=FindTagInSet(aContext[index],aTagList.mTags,aTagList.mCount);
|
||||
if(result) {
|
||||
return index;
|
||||
|
|
|
@ -2313,7 +2313,7 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
|
|||
int i,j=0;
|
||||
int written;
|
||||
int linenum=5;
|
||||
for(i=1;i<eHTMLTag_text;i++){
|
||||
for(i=1;i<eHTMLTag_text;++i){
|
||||
|
||||
const char* tag=nsHTMLTags::GetStringValue((eHTMLTags)i);
|
||||
out << endl << endl << "Tag: <" << tag << ">" << endl;
|
||||
|
@ -2322,25 +2322,25 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
|
|||
written=0;
|
||||
char startChar=0;
|
||||
if(IsContainer((eHTMLTags)i)) {
|
||||
for(j=1;j<eHTMLTag_text;j++){
|
||||
for(j=1;j<eHTMLTag_text;++j){
|
||||
tag=nsHTMLTags::GetStringValue((eHTMLTags)j);
|
||||
if(tag) {
|
||||
if(!startChar)
|
||||
startChar=tag[0];
|
||||
if(12==written){
|
||||
out << endl << prefix;
|
||||
linenum++;
|
||||
++linenum;
|
||||
written=0;
|
||||
}
|
||||
if(CanContain((eHTMLTags)i,(eHTMLTags)j)){
|
||||
if(tag[0]!=startChar){
|
||||
out << endl << prefix;
|
||||
linenum++;
|
||||
++linenum;
|
||||
written=0;
|
||||
startChar=tag[0];
|
||||
}
|
||||
out<< tag << ", ";
|
||||
written++;
|
||||
++written;
|
||||
}
|
||||
|
||||
}//if
|
||||
|
@ -2348,7 +2348,7 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
|
|||
}
|
||||
else {
|
||||
out<<"(not container)" << endl;
|
||||
linenum++;
|
||||
++linenum;
|
||||
}
|
||||
} //for
|
||||
#endif
|
||||
|
@ -2374,7 +2374,7 @@ void nsHTMLElement::DebugDumpMembership(const char* aFilename){
|
|||
|
||||
char* answer[]={".","Y"};
|
||||
char startChar=0;
|
||||
for(i=1;i<eHTMLTag_text;i++){
|
||||
for(i=1;i<eHTMLTag_text;++i){
|
||||
const char* tag=nsHTMLTags::GetStringValue((eHTMLTags)i);
|
||||
out << tag;
|
||||
int len=strlen(tag);
|
||||
|
@ -2433,7 +2433,7 @@ void nsHTMLElement::DebugDumpContainType(const char* aFilename){
|
|||
|
||||
char* answer[]={".","Y"};
|
||||
char startChar=0;
|
||||
for(i=1;i<eHTMLTag_text;i++){
|
||||
for(i=1;i<eHTMLTag_text;++i){
|
||||
const char* tag=nsHTMLTags::GetStringValue((eHTMLTags)i);
|
||||
out << tag;
|
||||
int len=strlen(tag);
|
||||
|
|
|
@ -409,7 +409,7 @@ nsExpatDriver::HandleXMLDeclaration(const PRUnichar *aValue,
|
|||
// <?xml version='a'?>
|
||||
// 0123456789012345678
|
||||
PRUint32 i = 17; // ?> can start at position 17 at the earliest
|
||||
for (; i < aLength; i++) {
|
||||
for (; i < aLength; ++i) {
|
||||
if (aValue[i] == '?')
|
||||
break;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ CreateSourceText(const PRInt32 aColNumber,
|
|||
|
||||
aSourceString.Append(aSourceLine);
|
||||
aSourceString.Append(PRUnichar('\n'));
|
||||
for (PRInt32 i = 0; i < errorPosition - 1; i++) {
|
||||
for (PRInt32 i = 0; i < errorPosition - 1; ++i) {
|
||||
aSourceString.Append(PRUnichar('-'));
|
||||
}
|
||||
aSourceString.Append(PRUnichar('^'));
|
||||
|
|
|
@ -235,7 +235,7 @@ public:
|
|||
nsHTMLEntities::AddRefTable();
|
||||
|
||||
// Make sure we can find everything we are supposed to
|
||||
for (int i = 0; i < NS_HTML_ENTITY_COUNT; i++) {
|
||||
for (int i = 0; i < NS_HTML_ENTITY_COUNT; ++i) {
|
||||
nsAutoString entity; entity.AssignWithConversion(gEntityArray[i].mStr);
|
||||
|
||||
value = nsHTMLEntities::EntityToUnicode(entity);
|
||||
|
|
|
@ -153,7 +153,7 @@ nsHTMLNullSink::~nsHTMLNullSink() {
|
|||
|
||||
#ifdef VERBOSE_DEBUG
|
||||
static void DebugDump(const char* str1,const nsAString& str2,PRInt32 tabs) {
|
||||
for(PRInt32 i=0;i<tabs;i++) {
|
||||
for(PRInt32 i=0;i<tabs;++i) {
|
||||
PR_fprintf(PR_STDOUT, " "); //add some tabbing to debug output...
|
||||
}
|
||||
|
||||
|
|
|
@ -482,7 +482,7 @@ public:
|
|||
|
||||
nsHTMLTags::AddRefTable();
|
||||
// Make sure we can find everything we are supposed to
|
||||
for (int i = 0; i < NS_HTML_TAG_MAX; i++) {
|
||||
for (int i = 0; i < NS_HTML_TAG_MAX; ++i) {
|
||||
tag = kTagUnicodeTable[i];
|
||||
id = nsHTMLTags::LookupTag(nsDependentString(tag));
|
||||
NS_ASSERTION(id != eHTMLTag_userdefined, "can't find tag id");
|
||||
|
|
|
@ -304,7 +304,7 @@ void nsHTMLTokenizer::PrependTokens(nsDeque& aDeque){
|
|||
//last but not least, let's check the misplaced content list.
|
||||
//if we find it, then we have to push it all into the body before continuing...
|
||||
PRInt32 anIndex=0;
|
||||
for(anIndex=0;anIndex<aCount;anIndex++){
|
||||
for(anIndex=0;anIndex<aCount;++anIndex){
|
||||
CToken* theToken=(CToken*)aDeque.Pop();
|
||||
PushTokenFront(theToken);
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
|
|||
theRootTag=theTag;
|
||||
}
|
||||
theStack.Push(theToken);
|
||||
theStackDepth++;
|
||||
++theStackDepth;
|
||||
break;
|
||||
|
||||
case eToken_end:
|
||||
|
@ -639,7 +639,7 @@ nsresult nsHTMLTokenizer::ConsumeAttributes(PRUnichar aChar,
|
|||
aToken->SetEmpty(isUsableAttr);
|
||||
}
|
||||
if(isUsableAttr) {
|
||||
theAttrCount++;
|
||||
++theAttrCount;
|
||||
AddToken((CToken*&)theToken,result,&mTokenDeque,theAllocator);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1013,7 +1013,7 @@ static PRBool IsCommentEnd(
|
|||
return PR_TRUE;
|
||||
}
|
||||
if (*current == PRUnichar('-')) {
|
||||
dashes++;
|
||||
++dashes;
|
||||
} else {
|
||||
dashes = 0;
|
||||
}
|
||||
|
@ -2028,9 +2028,9 @@ CEntityToken::ConsumeEntity(PRUnichar aChar,
|
|||
|
||||
aString.Append(aChar);
|
||||
if(aChar==kRightBrace)
|
||||
rightBraceCount++;
|
||||
++rightBraceCount;
|
||||
else if(aChar==kLeftBrace)
|
||||
leftBraceCount++;
|
||||
++leftBraceCount;
|
||||
} while(leftBraceCount!=rightBraceCount);
|
||||
} //if
|
||||
else {
|
||||
|
|
|
@ -133,7 +133,7 @@ nsLoggingSink::SetOutputStream(PRFileDesc *aStream,PRBool autoDeleteOutput) {
|
|||
static
|
||||
void WriteTabs(PRFileDesc * out,int aTabCount) {
|
||||
int tabs;
|
||||
for(tabs=0;tabs<aTabCount;tabs++)
|
||||
for(tabs=0;tabs<aTabCount;++tabs)
|
||||
PR_fprintf(out, " ");
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,7 @@ nsLoggingSink::WriteAttributes(const nsIParserNode& aNode) {
|
|||
WriteTabs(mOutput,1+mLevel);
|
||||
nsAutoString tmp;
|
||||
PRInt32 ac = aNode.GetAttributeCount();
|
||||
for (PRInt32 i = 0; i < ac; i++) {
|
||||
for (PRInt32 i = 0; i < ac; ++i) {
|
||||
char* key=nsnull;
|
||||
char* value=nsnull;
|
||||
const nsAString& k = aNode.GetKeyAt(i);
|
||||
|
|
|
@ -629,7 +629,7 @@ public:
|
|||
case kQuote:
|
||||
target=*cp;
|
||||
if (aSkipQuotes) {
|
||||
cp++;
|
||||
++cp;
|
||||
}
|
||||
done=PR_TRUE;
|
||||
break;
|
||||
|
@ -650,13 +650,13 @@ public:
|
|||
const CharT *firstcp=cp; //hang onto this...
|
||||
PRInt32 theDashCount=2;
|
||||
|
||||
cp++; //just skip first letter to simplify processing...
|
||||
++cp; //just skip first letter to simplify processing...
|
||||
|
||||
//ok, now find end of this word
|
||||
while(cp++<mEndBuffer) {
|
||||
if(kQuote==target) {
|
||||
if(kQuote==*cp) {
|
||||
cp++;
|
||||
++cp;
|
||||
break; //we found our end...
|
||||
}
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ public:
|
|||
//then let's look for SGML comments
|
||||
if(kMinus==*cp) {
|
||||
if(4==++theDashCount) {
|
||||
cp++;
|
||||
++cp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ static PRInt32 ParsePS(const nsString& aBuffer, PRInt32 aIndex)
|
|||
PRUnichar ch = aBuffer.CharAt(aIndex);
|
||||
if ((ch == PRUnichar(' ')) || (ch == PRUnichar('\t')) ||
|
||||
(ch == PRUnichar('\n')) || (ch == PRUnichar('\r'))) {
|
||||
aIndex++;
|
||||
++aIndex;
|
||||
} else if (ch == PRUnichar('-')) {
|
||||
PRInt32 tmpIndex;
|
||||
if (aBuffer.CharAt(aIndex+1) == PRUnichar('-') &&
|
||||
|
@ -2022,7 +2022,7 @@ static PRBool DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
|||
// <?xml
|
||||
PRInt32 i;
|
||||
PRBool versionFound = PR_FALSE, encodingFound = PR_FALSE;
|
||||
for (i=6; i < aLen && !encodingFound; i++) {
|
||||
for (i=6; i < aLen && !encodingFound; ++i) {
|
||||
// end of XML declaration?
|
||||
if ((((char*)aBytes)[i] == '?') &&
|
||||
((i+1) < aLen) &&
|
||||
|
@ -2041,7 +2041,7 @@ static PRBool DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
|||
(0 == PL_strncmp("versio", (char*)(aBytes+i-6), 6 ))) {
|
||||
// Fast forward through version
|
||||
char q = 0;
|
||||
for (++i; i < aLen; i++) {
|
||||
for (++i; i < aLen; ++i) {
|
||||
char qi = ((char*)aBytes)[i];
|
||||
if (qi == '\'' || qi == '"') {
|
||||
if (q && q == qi) {
|
||||
|
@ -2067,7 +2067,7 @@ static PRBool DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
|||
(0 == PL_strncmp("encodin", (char*)(aBytes+i-7), 7 ))) {
|
||||
PRInt32 encStart = 0;
|
||||
char q = 0;
|
||||
for (++i; i < aLen; i++) {
|
||||
for (++i; i < aLen; ++i) {
|
||||
char qi = ((char*)aBytes)[i];
|
||||
if (qi == '\'' || qi == '"') {
|
||||
if (q && q == qi) {
|
||||
|
@ -2580,7 +2580,7 @@ PRBool nsParser::DidTokenize(PRBool aIsFinalChunk){
|
|||
if(mTokenObserver) {
|
||||
PRInt32 theCount=theTokenizer->GetCount();
|
||||
PRInt32 theIndex;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
if((*mTokenObserver)(theTokenizer->GetTokenAt(theIndex))){
|
||||
//add code here to pull unwanted tokens out of the stack...
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,
|
|||
MOZ_COUNT_CTOR(nsCParserNode);
|
||||
|
||||
static int theNodeCount=0;
|
||||
theNodeCount++;
|
||||
++theNodeCount;
|
||||
mAttributes=0;
|
||||
mToken=aToken;
|
||||
IF_HOLD(mToken);
|
||||
|
@ -327,7 +327,7 @@ void nsCParserNode::GetSource(nsString& aString) {
|
|||
}
|
||||
if(mAttributes) {
|
||||
int index=0;
|
||||
for(index=0;index<mAttributes->GetSize();index++) {
|
||||
for(index=0;index<mAttributes->GetSize();++index) {
|
||||
CAttributeToken *theToken=(CAttributeToken*)mAttributes->ObjectAt(index);
|
||||
if(theToken) {
|
||||
theToken->AppendSourceTo(aString);
|
||||
|
|
|
@ -148,7 +148,7 @@ nsParserService::RegisterObserver(nsIElementObserver* aObserver,
|
|||
if(*aTags != eHTMLTag_userdefined && *aTags <= NS_HTML_TAG_MAX) {
|
||||
entry->AddObserver(aObserver,*aTags);
|
||||
}
|
||||
aTags++;
|
||||
++aTags;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -160,7 +160,7 @@ nsParserService::UnregisterObserver(nsIElementObserver* aObserver,
|
|||
{
|
||||
PRInt32 count = mEntries.GetSize();
|
||||
|
||||
for (PRInt32 i=0; i < count; i++) {
|
||||
for (PRInt32 i=0; i < count; ++i) {
|
||||
nsObserverEntry* entry = NS_STATIC_CAST(nsObserverEntry*,mEntries.ObjectAt(i));
|
||||
if (entry && entry->Matches(aTopic)) {
|
||||
entry->RemoveObserver(aObserver);
|
||||
|
|
|
@ -356,7 +356,7 @@ nsresult nsScanner::Append(const char* aBuffer, PRUint32 aLen){
|
|||
srcLength = aLen;
|
||||
}
|
||||
else {
|
||||
srcLength++;
|
||||
++srcLength;
|
||||
}
|
||||
|
||||
aBuffer += srcLength;
|
||||
|
@ -480,7 +480,7 @@ nsresult nsScanner::GetChar(PRUnichar& aChar) {
|
|||
|
||||
if(NS_OK == result){
|
||||
aChar=*mCurrentPosition++;
|
||||
mCountRemaining--;
|
||||
--mCountRemaining;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ nsresult nsScanner::SkipWhitespace(PRInt32& aNewlinesSkipped) {
|
|||
while (!done && current != mEndPosition) {
|
||||
switch(theChar) {
|
||||
case '\n':
|
||||
case '\r': aNewlinesSkipped++;
|
||||
case '\r': ++aNewlinesSkipped;
|
||||
case ' ' :
|
||||
case '\b':
|
||||
case '\t':
|
||||
|
@ -1048,7 +1048,7 @@ nsresult nsScanner::ReadWhitespace(nsString& aString,
|
|||
while(!done && current != end) {
|
||||
switch(theChar) {
|
||||
case '\n':
|
||||
case '\r': aNewlinesSkipped++;
|
||||
case '\r': ++aNewlinesSkipped;
|
||||
case ' ' :
|
||||
case '\b':
|
||||
case '\t':
|
||||
|
@ -1102,7 +1102,7 @@ nsresult nsScanner::ReadWhitespace(nsReadingIterator<PRUnichar>& aStart,
|
|||
while(!done && current != end) {
|
||||
switch(theChar) {
|
||||
case '\n':
|
||||
case '\r': aNewlinesSkipped++;
|
||||
case '\r': ++aNewlinesSkipped;
|
||||
case ' ' :
|
||||
case '\b':
|
||||
case '\t':
|
||||
|
|
|
@ -77,7 +77,7 @@ CToken::CToken(PRInt32 aTag) {
|
|||
mUseCount=1;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
TokenCount++;
|
||||
++TokenCount;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ CToken::~CToken() {
|
|||
#ifdef MATCH_CTOR_DTOR
|
||||
MOZ_COUNT_DTOR(CToken);
|
||||
#endif
|
||||
DelTokenCount++;
|
||||
++DelTokenCount;
|
||||
mUseCount=0;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ void CToken::DebugDumpToken(nsOutputStream& anOutputStream) {
|
|||
anOutputStream << "[" << GetClassName() << "] ";
|
||||
PRUint32 i=0;
|
||||
PRUint32 theLen=GetStringValue().Length();
|
||||
for(i=0;i<theLen;i++){
|
||||
for(i=0;i<theLen;++i){
|
||||
anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get();
|
||||
}
|
||||
anOutputStream << " TypeID: " << mTypeID << " AttrCount: " << mAttrCount << nsEndl;
|
||||
|
|
|
@ -904,7 +904,7 @@ nsresult CViewSourceHTML::WriteAttributes(PRInt32 attrCount) {
|
|||
CSharedVSContext& theContext=CSharedVSContext::GetSharedContext();
|
||||
|
||||
int attr=0;
|
||||
for(attr=0;attr<attrCount;attr++){
|
||||
for(attr=0;attr<attrCount;++attr){
|
||||
CToken* theToken=mTokenizer->PeekToken();
|
||||
if(theToken) {
|
||||
eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType());
|
||||
|
@ -1047,7 +1047,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
|||
|
||||
case eToken_start:
|
||||
{
|
||||
mTagCount++;
|
||||
++mTagCount;
|
||||
|
||||
const nsAString& startValue = aToken->GetStringValue();
|
||||
result=WriteTag(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE);
|
||||
|
@ -1107,9 +1107,9 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
|||
case eToken_newline:
|
||||
{
|
||||
const nsAString& newlineValue = aToken->GetStringValue();
|
||||
mLineNumber++;
|
||||
++mLineNumber;
|
||||
result=WriteTag(mText,newlineValue,0,PR_FALSE);
|
||||
mTokenCount++;
|
||||
++mTokenCount;
|
||||
if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 &&
|
||||
mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK)
|
||||
StartNewPreBlock();
|
||||
|
@ -1120,7 +1120,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
|||
{
|
||||
const nsAString& wsValue = aToken->GetStringValue();
|
||||
result=WriteTag(mText,wsValue,0,PR_FALSE);
|
||||
mTokenCount++;
|
||||
++mTokenCount;
|
||||
if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 &&
|
||||
mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK &&
|
||||
!wsValue.IsEmpty()) {
|
||||
|
@ -1135,7 +1135,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
|||
{
|
||||
const nsAString& str = aToken->GetStringValue();
|
||||
result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE);
|
||||
mTokenCount++;
|
||||
++mTokenCount;
|
||||
if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 &&
|
||||
mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !str.IsEmpty()) {
|
||||
PRUnichar ch = str.Last();
|
||||
|
|
|
@ -209,7 +209,7 @@ PageGrabber::NextFile(const char* aExtension)
|
|||
struct stat sb;
|
||||
int s = stat(cname, &sb);
|
||||
if (s < 0) {
|
||||
mFileNum++;
|
||||
++mFileNum;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,517 +0,0 @@
|
|||
/*========================================================
|
||||
To Do:
|
||||
1. Tag sequences on the command line p..table
|
||||
2. Dumping documents into the right place
|
||||
*========================================================*/
|
||||
|
||||
|
||||
/*========================================================
|
||||
Special keywords:
|
||||
$0..$9: represent command line arguments
|
||||
@file: the name of the file being writtent
|
||||
@nextfile: the name of the next file to be written
|
||||
@import: imports text from another file.
|
||||
*========================================================*/
|
||||
|
||||
|
||||
#include <iostream.h>
|
||||
#include <fstream.h>
|
||||
#include <strstrea.h>
|
||||
#include <string>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <direct.h>
|
||||
|
||||
|
||||
static char* tagTable[] = {
|
||||
"A", "ABBR", "ACRONYM", "ADDRESS", "APPLET", "AREA",
|
||||
"B", "BASE", "BASEFONT", "BDO", "BGSOUND", "BIG", "BLINK", "BLOCKQUOTE", "BODY", "BR", "BUTTON",
|
||||
"CAPTION", "CENTER", "CITE", "CODE", "COL", "COLGROUP",
|
||||
"DD", "DEL", "DFN", "DIR", "DIV", "DL", "DT",
|
||||
"EM", "EMBED",
|
||||
"FIELDSET", "FONT", "FORM", "FRAME", "FRAMESET",
|
||||
"H1", "H2", "H3", "H4", "H5", "H6", "HEAD", "HR", "HTML",
|
||||
"I", "IFRAME", "ILAYER", "IMG", "INPUT", "INS", "ISINDEX",
|
||||
"KBD", "KEYGEN",
|
||||
"LABEL", "LAYER", "LEGEND", "LI", "LINK", "LISTING",
|
||||
"MAP", "MENU", "META", "MULTICOL",
|
||||
"NOBR", "NOEMBED", "NOFRAMES", "NOLAYER", "NOSCRIPT",
|
||||
"OBJECT", "OL", "OPTGROUP", "OPTION",
|
||||
"P", "PARAM", "PLAINTEXT", "PRE",
|
||||
"Q",
|
||||
"S","SAMP","SCRIPT","SELECT","SERVER","SMALL","SOUND","SPACER","SPAN","STRIKE","STRONG","STYLE","SUB","SUP",
|
||||
"TABLE", "TBODY", "TD", "TEXTAREA", "TFOOT", "TH", "THEAD", "TITLE", "TR", "TT",
|
||||
"U", "UL",
|
||||
"VAR",
|
||||
"WBR",
|
||||
"XMP",
|
||||
0
|
||||
};
|
||||
static char gCWD[1025];
|
||||
static char gPrevFile[128];
|
||||
static char gThisFile[128];
|
||||
static char gNextFile[128];
|
||||
static int gFileIndex=0;
|
||||
|
||||
|
||||
int findTag(const char* aTagName) {
|
||||
int low = 0;
|
||||
int high = 107;
|
||||
while (low <= high) {
|
||||
int middle = (low + high) >> 1;
|
||||
int result = stricmp(aTagName, tagTable[middle]);
|
||||
if (result == 0)
|
||||
return middle;
|
||||
if (result < 0)
|
||||
high = middle - 1;
|
||||
else
|
||||
low = middle + 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this to find a tag that closely resembles the given tag.
|
||||
* Note that we match based on the first char.
|
||||
* @update gess12/23/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
int findNearestTag(char* aTag){
|
||||
int result=-1;
|
||||
if(aTag){
|
||||
char theChar=toupper(aTag[0]);
|
||||
int theIndex=-1;
|
||||
while(tagTable[++theIndex]){
|
||||
if(toupper(tagTable[theIndex][0])==theChar) {
|
||||
return theIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(toupper(aTag[0])<'A')
|
||||
result=0;
|
||||
else result=107;
|
||||
return result;
|
||||
}
|
||||
|
||||
char* getNthTagAfter(int aRangeIndex,char* aStartTag){
|
||||
int theIndex=findTag(aStartTag);
|
||||
if(-1==theIndex){
|
||||
theIndex=findNearestTag(aStartTag);
|
||||
}
|
||||
if(-1<theIndex){
|
||||
//now that you have the tag,
|
||||
return tagTable[theIndex+aRangeIndex];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess12/20/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
class CMacros {
|
||||
public:
|
||||
CMacros() {
|
||||
mCount=0;
|
||||
mFilename[0]=0;
|
||||
memset(mKeys,0,sizeof(mKeys));
|
||||
memset(mRanges,0,sizeof(mRanges));
|
||||
memset(mIndex,0,sizeof(mIndex));
|
||||
mBorrowedKeys=false;
|
||||
}
|
||||
|
||||
CMacros(const CMacros& aCopy) {
|
||||
mBorrowedKeys=true;
|
||||
mCount=aCopy.mCount;
|
||||
strcpy(mFilename,aCopy.mFilename);
|
||||
memcpy(mKeys,aCopy.mKeys,sizeof(mKeys));
|
||||
memcpy(mIndex,aCopy.mIndex,sizeof(mIndex));
|
||||
}
|
||||
|
||||
~CMacros(){
|
||||
if(!mBorrowedKeys) {
|
||||
for(int i=0;i<mCount;i++){
|
||||
delete [] mKeys[i];
|
||||
mKeys[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool addMacro(char* aString) {
|
||||
|
||||
//copy a macro name...
|
||||
//start by stripping off the macro key (everything up to the equal sign...
|
||||
if(aString){
|
||||
int sLen=strlen(aString);
|
||||
if(sLen>0){
|
||||
if((strchr(aString,',')) || (strchr(aString,'-'))) {
|
||||
mRanges[mCount]=new char[sLen+1];
|
||||
strcpy(mRanges[mCount++],aString);
|
||||
}
|
||||
else {
|
||||
mKeys[mCount]=new char[sLen+1];
|
||||
strcpy(mKeys[mCount++],aString);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int getCount() {return mCount;}
|
||||
|
||||
char* getMacro(int anIndex) {
|
||||
if(anIndex<mCount)
|
||||
return mKeys[anIndex];
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* getFilename(void) {return mFilename;}
|
||||
|
||||
char* getRangeValueAt(char* aRange,int aRangeIndex) {
|
||||
static char theBuffer[100];
|
||||
char* result=0;
|
||||
char* p1=aRange;
|
||||
char* p2=0;
|
||||
int offset=0;
|
||||
int count=-1;
|
||||
|
||||
theBuffer[0]=0;
|
||||
if(p2=strchr(&aRange[offset],',')) {
|
||||
//in this case, our keys are taken 1 at a time from the range itself.
|
||||
while((++count<aRangeIndex) && (p1) && (p2)) {
|
||||
p1=p2+1;
|
||||
p2=strchr(p1,',');
|
||||
}
|
||||
if(p1 && (count==aRangeIndex)) {
|
||||
strncat(theBuffer,p1,p2-p1);
|
||||
}
|
||||
result=theBuffer;
|
||||
}
|
||||
else if(p2=strchr(&aRange[offset],'-')) {
|
||||
//in this case, our keys are computed based on HTMLTags within the given range (exclusive).
|
||||
strncat(theBuffer,p1,p2-p1);
|
||||
char* tag=getNthTagAfter(aRangeIndex,theBuffer);
|
||||
p2++; //p2 now points at the last item...
|
||||
if(tag){
|
||||
int end=findNearestTag(p2);
|
||||
char* endTag=tagTable[end];
|
||||
if(endTag){
|
||||
int icmp=stricmp(tag,endTag);
|
||||
if(icmp<=0){
|
||||
strcpy(theBuffer,tag);
|
||||
}
|
||||
else theBuffer[0]=0;
|
||||
result=theBuffer;
|
||||
}
|
||||
else result=0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool first(void) {
|
||||
bool result=true;
|
||||
for(int i=0;i<mCount;i++){
|
||||
mIndex[i]=0;
|
||||
if(mRanges[i]){
|
||||
char* key=getRangeValueAt(mRanges[i],mIndex[i]);
|
||||
if(key) {
|
||||
if(!mKeys[i])
|
||||
mKeys[i]=new char[100];
|
||||
strcpy(mKeys[i],key);
|
||||
}
|
||||
}
|
||||
//otherwise key is already set...
|
||||
}
|
||||
sprintf(gThisFile,"out%i.html",gFileIndex++);
|
||||
sprintf(gNextFile,"out%i.html",gFileIndex);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool next(void) {
|
||||
|
||||
//the trick here is to find the rightmost range and increment it.
|
||||
//if it wraps, then reset it to 0, and increment the next range to the left.
|
||||
int rangeIndex=mCount;
|
||||
bool done=false;
|
||||
while((0<=--rangeIndex) && (!done)) {
|
||||
if(mRanges[rangeIndex]) {
|
||||
//ok, now we know the right most range object.
|
||||
//let's see if it can be incremented...
|
||||
char* key=getRangeValueAt(mRanges[rangeIndex],++mIndex[rangeIndex]);
|
||||
if((0==key) || (0==key[0])){
|
||||
mIndex[rangeIndex]=0;
|
||||
char* key=getRangeValueAt(mRanges[rangeIndex],mIndex[rangeIndex]);
|
||||
}//if
|
||||
else done=true;
|
||||
mKeys[rangeIndex][0]=0;
|
||||
if(key)
|
||||
strcpy(mKeys[rangeIndex],key);
|
||||
}//if
|
||||
}//while
|
||||
strcpy(gPrevFile,gThisFile);
|
||||
sprintf(gThisFile,"out%i.html",gFileIndex++);
|
||||
sprintf(gNextFile,"out%i.html",gFileIndex);
|
||||
return done;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess12/23/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
bool consume(istrstream& aStream){
|
||||
char theBuffer[100];
|
||||
bool readDefs=false;
|
||||
|
||||
while(!aStream.eof()){
|
||||
aStream >> theBuffer;
|
||||
if(!stricmp(theBuffer,"-F")){
|
||||
//copy the filename...
|
||||
aStream >> theBuffer;
|
||||
strcpy(mFilename,theBuffer);
|
||||
readDefs=false;
|
||||
}
|
||||
#if 0
|
||||
else if(!stricmp(theBuffer,"-D")){
|
||||
readDefs=true;
|
||||
}
|
||||
#endif
|
||||
else if(!stricmp(theBuffer,"-O")){
|
||||
aStream >> theBuffer;
|
||||
readDefs=false;
|
||||
}
|
||||
else {
|
||||
if(theBuffer[0]){
|
||||
addMacro(theBuffer);
|
||||
theBuffer[0]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void buildArgBuffer(char* aBuffer) {
|
||||
aBuffer[0]=0;
|
||||
if(mFilename[0]) {
|
||||
sprintf(aBuffer,"-o %s -f %s ",gThisFile,mFilename);
|
||||
}
|
||||
for(int i=0;i<mCount;i++){
|
||||
if(mKeys[i]) {
|
||||
strcat(aBuffer,mKeys[i]);
|
||||
strcat(aBuffer," ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dump(void) {
|
||||
for(int i=0;i<mCount;i++){
|
||||
cout << mKeys[i] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
protected:
|
||||
int mCount;
|
||||
char* mKeys[100];
|
||||
char* mRanges[100];
|
||||
int mIndex[100];
|
||||
char mFilename[125];
|
||||
bool mBorrowedKeys;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess12/20/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void expandKeywords(char* aBuffer,CMacros& aMacroSet){
|
||||
char temp[1024];
|
||||
char theWord[100];
|
||||
|
||||
temp[0]=0;
|
||||
if(strchr(aBuffer,'@')){
|
||||
|
||||
int pos=-1;
|
||||
while(aBuffer[++pos]==' ')
|
||||
strcat(temp," ");
|
||||
|
||||
istrstream iStr(aBuffer);
|
||||
while(!iStr.eof()){
|
||||
theWord[0]=0;
|
||||
iStr>>theWord;
|
||||
char* thePos=strchr(theWord,'@');
|
||||
if(thePos){
|
||||
strncat(temp,theWord,thePos-theWord);
|
||||
if(!strnicmp(thePos,"@file",5)){
|
||||
strcat(temp,gThisFile);
|
||||
thePos+=5;
|
||||
}
|
||||
else if(!strnicmp(thePos,"@nextfile",9)){
|
||||
strcat(temp,gNextFile);
|
||||
thePos+=9;
|
||||
}
|
||||
else if(!strnicmp(thePos,"@prevfile",9)){
|
||||
strcat(temp,gPrevFile);
|
||||
thePos+=9;
|
||||
}
|
||||
strcat(temp,thePos);
|
||||
}
|
||||
else strcat(temp,theWord);
|
||||
strcat(temp," ");
|
||||
}
|
||||
strcpy(aBuffer,temp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess12/20/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void expandMacros(char* aBuffer,CMacros& aMacroSet){
|
||||
char temp[1024];
|
||||
int rPos=-1;
|
||||
int wPos=0;
|
||||
|
||||
if(aBuffer){
|
||||
while(aBuffer[++rPos]){
|
||||
if('$'==aBuffer[rPos]){
|
||||
temp[wPos]=0;
|
||||
rPos++; //skip the $...
|
||||
int theIndex=aBuffer[rPos]-'0';
|
||||
char* theMacro=aMacroSet.getMacro(theIndex);
|
||||
if(theMacro){
|
||||
strcat(temp,theMacro);
|
||||
wPos=strlen(temp);
|
||||
}
|
||||
}
|
||||
else temp[wPos++]=aBuffer[rPos];
|
||||
}
|
||||
temp[wPos]=0;
|
||||
strcpy(aBuffer,temp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess12/20/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
int processFile(char* aDir,CMacros& aMacroList,fstream& anOutputStream,fstream& anInputStream){
|
||||
int result=0;
|
||||
|
||||
if(anInputStream.is_open()){
|
||||
bool done=false;
|
||||
char theBuffer[1024];
|
||||
char* p=0;
|
||||
|
||||
while((!done) && (0==result)){
|
||||
|
||||
anInputStream.getline(theBuffer,sizeof(theBuffer)-1);
|
||||
if(anInputStream.gcount()){
|
||||
|
||||
//before doing anything else, expand the macros and keywords...
|
||||
expandMacros(theBuffer,aMacroList);
|
||||
expandKeywords(theBuffer,aMacroList);
|
||||
|
||||
//Now process each line:
|
||||
p=strstr(theBuffer,"@import");
|
||||
if(p) {
|
||||
|
||||
//First, see if the line is an htmlgen statement; if so, recurse to read new file...
|
||||
char theFilename[1024];
|
||||
|
||||
strcpy(theFilename,"htmlgen -F ");
|
||||
p+=8;
|
||||
strcat(theFilename,p);
|
||||
|
||||
//If you're here, we found an htmlgen statement.
|
||||
// To handle this, we have to:
|
||||
// 1. strip off the @htmlgen
|
||||
// 2. grab the filename and collect the args,
|
||||
// 3. and recurse...
|
||||
|
||||
fstream theInStream(p,ios::in);
|
||||
result=processFile(aDir,aMacroList,anOutputStream,theInStream);
|
||||
}
|
||||
else anOutputStream << theBuffer << endl;
|
||||
}
|
||||
else done=true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is where the different combinations of arguments
|
||||
* gets constructed and passed on for processing.
|
||||
* Note that this is even called when the args have only 1 value.
|
||||
* @return error code
|
||||
*/
|
||||
int iterate(istrstream& aInputArgs){
|
||||
int result=0;
|
||||
|
||||
CMacros theArgs;
|
||||
theArgs.consume(aInputArgs);
|
||||
|
||||
char theFilename[1024];
|
||||
|
||||
bool done=!theArgs.first();
|
||||
while((!done) && (0==result)){
|
||||
CMacros theTempArgs(theArgs);
|
||||
|
||||
//theTempArgs.buildArgBuffer(theBuffer);
|
||||
// istrstream theArgStream(theBuffer);
|
||||
|
||||
sprintf(theFilename,"%s\\%s",gCWD,gThisFile);
|
||||
fstream theOutStream(theFilename,ios::trunc);
|
||||
|
||||
char* theInFile=theArgs.getFilename();
|
||||
fstream theInStream(theInFile,ios::in);
|
||||
|
||||
result=processFile(gCWD,theTempArgs,theOutStream,theInStream);
|
||||
theArgs.dump();
|
||||
done=!theArgs.next();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess12/20/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
int main(int argc,char* argv[]){
|
||||
int result=0;
|
||||
|
||||
gPrevFile[0]=gThisFile[0]=gNextFile[0];
|
||||
if(argc>1){
|
||||
char theBuffer[1024];
|
||||
theBuffer[0]=0;
|
||||
|
||||
for(int i=1;i<argc;i++){
|
||||
strcat(theBuffer,argv[i]);
|
||||
strcat(theBuffer," ");
|
||||
}
|
||||
|
||||
_getcwd(gCWD,sizeof(gCWD)-1);
|
||||
istrstream aStrStream(theBuffer);
|
||||
result=iterate(aStrStream);
|
||||
}
|
||||
else cout<<endl <<"HTMLGenerator usage -f filename [yyy | xxx,yyy | xxx-yyy]" << endl;
|
||||
return result;
|
||||
}
|
|
@ -153,7 +153,7 @@ class CToken {
|
|||
* Make a note on number of times you have been referenced
|
||||
* @update harishd 08/02/00
|
||||
*/
|
||||
void AddRef() { mUseCount++; }
|
||||
void AddRef() { ++mUseCount; }
|
||||
|
||||
/**
|
||||
* Free yourself if no one is holding you.
|
||||
|
|
|
@ -112,7 +112,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|||
PRInt32 nCount = g_duplicateList->Count();
|
||||
if (nCount > 0)
|
||||
{
|
||||
for (PRInt32 n = 0; n < nCount; n++)
|
||||
for (PRInt32 n = 0; n < nCount; ++n)
|
||||
{
|
||||
nsString * pstr = (nsString *)g_duplicateList->ElementAt(n);
|
||||
if (pstr->Equals(aURLSpec)) {
|
||||
|
@ -127,7 +127,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|||
str.Truncate();
|
||||
nsString(aURLSpec).Left(str,5);
|
||||
if (str.Equals(NS_LITERAL_STRING("http:"))) {
|
||||
g_iProcessed++;
|
||||
++g_iProcessed;
|
||||
if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0))
|
||||
g_bHitTop = PR_TRUE;
|
||||
g_workList->AppendElement(new nsString(aURLSpec));
|
||||
|
|
|
@ -144,7 +144,7 @@ RobotSink::~RobotSink()
|
|||
{
|
||||
NS_IF_RELEASE(mDocumentURL);
|
||||
PRInt32 i, n = mObservers.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
for (i = 0; i < n; ++i) {
|
||||
nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i);
|
||||
NS_RELEASE(cop);
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
|
|||
if (tmp.Equals(NS_LITERAL_STRING("a"))) {
|
||||
nsAutoString k, v;
|
||||
PRInt32 ac = aNode.GetAttributeCount();
|
||||
for (PRInt32 i = 0; i < ac; i++) {
|
||||
for (PRInt32 i = 0; i < ac; ++i) {
|
||||
// Get upper-cased key
|
||||
const nsAString& key = aNode.GetKeyAt(i);
|
||||
k.Assign(key);
|
||||
|
@ -388,7 +388,7 @@ void RobotSink::ProcessLink(const nsString& aLink)
|
|||
|
||||
// Now give link to robot observers
|
||||
PRInt32 i, n = mObservers.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
for (i = 0; i < n; ++i) {
|
||||
nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i);
|
||||
cop->ProcessLink(absURLSpec);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ int main(int argc, char **argv)
|
|||
nsVoidArray * gWorkList = new nsVoidArray();
|
||||
if(gWorkList) {
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
for (i = 1; i < argc; ++i) {
|
||||
nsString *tempString = new nsString;
|
||||
tempString->AssignWithConversion(argv[i]);
|
||||
gWorkList->AppendElement(tempString);
|
||||
|
|
|
@ -704,7 +704,7 @@ PRBool DoesRequireBody(CToken* aToken,nsITokenizer* aTokenizer) {
|
|||
if(theTag==eHTMLTag_input) {
|
||||
// IE & Nav4x opens up a body for type=text - Bug 66985
|
||||
PRInt32 ac=aToken->GetAttributeCount();
|
||||
for(PRInt32 i=0; i<ac; i++) {
|
||||
for(PRInt32 i=0; i<ac; ++i) {
|
||||
CAttributeToken* attr=NS_STATIC_CAST(CAttributeToken*,aTokenizer->GetTokenAt(i));
|
||||
const nsAString& name=attr->GetKey();
|
||||
const nsAString& value=attr->GetValue();
|
||||
|
@ -1032,7 +1032,7 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
|
|||
|
||||
if(theCount) {
|
||||
PRInt32 theIndex=0;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
const nsAString& theKey = aNode.GetKeyAt(theIndex);
|
||||
if(theKey.Equals(NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
|
||||
const nsAString& theName=aNode.GetValueAt(theIndex);
|
||||
|
@ -1894,7 +1894,7 @@ static void StripWSFollowingTag(eHTMLTags aChildTag,nsITokenizer* aTokenizer,nsT
|
|||
while(theToken) {
|
||||
eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType());
|
||||
switch(theType) {
|
||||
case eToken_newline: aNewlineCount++;
|
||||
case eToken_newline: ++aNewlineCount;
|
||||
case eToken_whitespace:
|
||||
theToken=aTokenizer->PopToken();
|
||||
IF_FREE(theToken, aTokenAllocator);
|
||||
|
@ -2071,7 +2071,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) {
|
|||
// considered as a leaf. However, in the sink FORM can either
|
||||
// be a container or a leaf. Therefore, we have to check
|
||||
// with the sink -- Ref: Bug 20087.
|
||||
anIndex++;
|
||||
++anIndex;
|
||||
}
|
||||
|
||||
STOP_TIMER()
|
||||
|
@ -2085,7 +2085,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) {
|
|||
PRInt32 i=0;
|
||||
nsEntryStack* theChildStyleStack=0;
|
||||
|
||||
for(i=0; i<(theTagCount - theTopIndex); i++) {
|
||||
for(i=0; i<(theTagCount - theTopIndex); ++i) {
|
||||
nsCParserNode* node=mBodyContext->Pop(theChildStyleStack);
|
||||
mTempContext->Push(node);
|
||||
IF_FREE(node, &mNodeAllocator); //release the popped node since push will addref for us.
|
||||
|
@ -2098,7 +2098,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) {
|
|||
theTag = (eHTMLTags)theToken->GetTypeID();
|
||||
attrCount = (gHTMLElements[theTag].mSkipTarget)? 0:theToken->GetAttributeCount();
|
||||
// Put back attributes, which once got popped out, into the tokenizer
|
||||
for(PRInt32 j=0;j<attrCount; j++){
|
||||
for(PRInt32 j=0;j<attrCount; ++j){
|
||||
CToken* theAttrToken = (CToken*)mMisplacedContent.PopFront();
|
||||
if(theAttrToken) {
|
||||
mTokenizer->PushTokenFront(theAttrToken);
|
||||
|
@ -2128,7 +2128,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) {
|
|||
|
||||
// Bad-contents were successfully processed. Now, itz time to get
|
||||
// back to the original body context state.
|
||||
for(PRInt32 k=0; k<(theTagCount - theTopIndex); k++) {
|
||||
for(PRInt32 k=0; k<(theTagCount - theTopIndex); ++k) {
|
||||
nsCParserNode* node=mTempContext->Pop(theChildStyleStack);
|
||||
mBodyContext->Push(node);
|
||||
IF_FREE(node, &mNodeAllocator);
|
||||
|
@ -2380,7 +2380,7 @@ nsresult CNavDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt32
|
|||
if(aCount<=theAvailTokenCount) {
|
||||
CToken* theToken=0;
|
||||
eHTMLTags theSkipTarget=gHTMLElements[aTag].mSkipTarget;
|
||||
for(attr=0;attr<aCount;attr++){
|
||||
for(attr=0;attr<aCount;++attr){
|
||||
if((eHTMLTag_unknown!=theSkipTarget) && mSkippedContent.GetSize())
|
||||
theToken=NS_STATIC_CAST(CToken*,mSkippedContent.PopFront());
|
||||
else
|
||||
|
@ -2448,7 +2448,7 @@ CNavDTD::CollectSkippedContent(PRInt32 aTag, nsAString& aContent, PRInt32 &aLine
|
|||
|
||||
PRInt32 i = 0;
|
||||
PRInt32 tagCount = mSkippedContent.GetSize();
|
||||
for (i = 0; i< tagCount; i++){
|
||||
for (i = 0; i< tagCount; ++i){
|
||||
CHTMLToken* theNextToken = (CHTMLToken*)mSkippedContent.PopFront();
|
||||
|
||||
if (theNextToken) {
|
||||
|
@ -2932,14 +2932,14 @@ nsresult CNavDTD::OpenTransientStyles(eHTMLTags aChildTag){
|
|||
}
|
||||
|
||||
mFlags &= ~NS_DTD_FLAG_ENABLE_RESIDUAL_STYLE;
|
||||
for(;theLevel<theCount;theLevel++){
|
||||
for(;theLevel<theCount;++theLevel){
|
||||
nsEntryStack* theStack=mBodyContext->GetStylesAt(theLevel);
|
||||
if(theStack){
|
||||
|
||||
PRInt32 sindex=0;
|
||||
|
||||
nsTagEntry *theEntry=theStack->mEntries;
|
||||
for(sindex=0;sindex<theStack->mCount;sindex++){
|
||||
for(sindex=0;sindex<theStack->mCount;++sindex){
|
||||
nsCParserNode* theNode=(nsCParserNode*)theEntry->mNode;
|
||||
if(1==theNode->mUseCount) {
|
||||
eHTMLTags theNodeTag=(eHTMLTags)theNode->GetNodeType();
|
||||
|
@ -2965,10 +2965,10 @@ nsresult CNavDTD::OpenTransientStyles(eHTMLTags aChildTag){
|
|||
//if the node tag can't contain the child tag, then remove the child tag from the style stack
|
||||
nsCParserNode* node=theStack->Remove(sindex,theNodeTag);
|
||||
IF_FREE(node, &mNodeAllocator);
|
||||
theEntry--; //back up by one
|
||||
--theEntry; //back up by one
|
||||
}
|
||||
} //if
|
||||
theEntry++;
|
||||
++theEntry;
|
||||
} //for
|
||||
} //if
|
||||
} //for
|
||||
|
@ -3269,7 +3269,7 @@ nsresult CNavDTD::OpenMap(const nsCParserNode *aNode){
|
|||
|
||||
if(NS_OK==result) {
|
||||
mBodyContext->Push(aNode);
|
||||
mOpenMapCount++;
|
||||
++mOpenMapCount;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -581,7 +581,7 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
|
|||
if(theNextToken) {
|
||||
eHTMLTokenTypes theType=eHTMLTokenTypes(theNextToken->GetTokenType());
|
||||
if(eToken_newline==theType){
|
||||
mLineNumber++;
|
||||
++mLineNumber;
|
||||
mTokenizer->PopToken(); //skip 1st newline inside PRE and LISTING
|
||||
}//if
|
||||
}//if
|
||||
|
@ -599,7 +599,7 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
|
|||
|
||||
if(theCount) {
|
||||
PRInt32 theIndex=0;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
const nsAString& theKey = aNode.GetKeyAt(theIndex);
|
||||
if(theKey.Equals(NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
|
||||
const nsAString& theName=aNode.GetValueAt(theIndex);
|
||||
|
@ -662,7 +662,7 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNo
|
|||
|
||||
switch(aTag) {
|
||||
case eHTMLTag_newline:
|
||||
mLineNumber++;
|
||||
++mLineNumber;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -815,7 +815,7 @@ nsresult COtherDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt3
|
|||
if(aCount<=theAvailTokenCount) {
|
||||
//gElementTable->mElements[aTag]->GetSkipTarget();
|
||||
CToken* theToken=0;
|
||||
for(attr=0;attr<aCount;attr++){
|
||||
for(attr=0;attr<aCount;++attr){
|
||||
theToken=mTokenizer->PopToken();
|
||||
if(theToken) {
|
||||
// Sanitize the key for it might contain some non-alpha-non-digit characters
|
||||
|
|
|
@ -104,7 +104,7 @@ inline PRBool ListContainsTag(eHTMLTags* aTagList,eHTMLTags aTag) {
|
|||
if(aTag==*theNextTag) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
theNextTag++;
|
||||
++theNextTag;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -2109,7 +2109,7 @@ void CElementTable::InitializeElements() {
|
|||
|
||||
int max=sizeof(mElements)/sizeof(mElements[0]);
|
||||
int index=0;
|
||||
for(index=0;index<max;index++){
|
||||
for(index=0;index<max;++index){
|
||||
mElements[index]=&mDfltElements[index];
|
||||
}
|
||||
|
||||
|
@ -2465,12 +2465,12 @@ void CElementTable::DebugDumpContainment(CElement* anElement){
|
|||
|
||||
int count=0;
|
||||
int i=0;
|
||||
for(i=0;i<NS_HTML_TAG_MAX;i++){
|
||||
for(i=0;i<NS_HTML_TAG_MAX;++i){
|
||||
CElement* theChild=mElements[i];
|
||||
if(anElement->CanContain(theChild,0)){
|
||||
const PRUnichar *t = nsHTMLTags::GetStringValue(theChild->mTag);
|
||||
printf("%s ", NS_ConvertUCS2toUTF8(t).get());
|
||||
count++;
|
||||
++count;
|
||||
if(18==count) {
|
||||
count=0;
|
||||
printf("\n%s",prefix);
|
||||
|
@ -2528,7 +2528,7 @@ void CElementTable::DebugDumpContainment(const char* aTitle){
|
|||
printf("==================================================\n");
|
||||
int i=0;
|
||||
|
||||
for(i=1;i<NS_HTML_TAG_MAX;i++){
|
||||
for(i=1;i<NS_HTML_TAG_MAX;++i){
|
||||
DebugDumpContainment(mElements[i]);
|
||||
//DebugDumpGroups(mElements[i]);
|
||||
} //for
|
||||
|
|
|
@ -1,232 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
//Testing stream crap...
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <io.h>
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsTokenizer.h"
|
||||
#include "nsHTMLDelegate.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsHTMLContentSink.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsParserCIID.h"
|
||||
|
||||
|
||||
PRBool compareFiles(const char* file1,const char* file2,int& failpos) {
|
||||
PRBool result=PR_TRUE;
|
||||
PRBool done=PR_FALSE;
|
||||
char ch1,ch2;
|
||||
int eof1,eof2;
|
||||
|
||||
#if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX)
|
||||
/* HAVE_IOS_BINARY needs to be set for mac & win */
|
||||
ifstream input1(file1,ios::in && ios::binary,filebuf::openprot);
|
||||
ifstream input2(file2,ios::in && ios::binary,filebuf::openprot);
|
||||
#else
|
||||
ifstream input1(file1,ios::in && ios::bin,filebuf::openprot);
|
||||
ifstream input2(file2,ios::in && ios::bin,filebuf::openprot);
|
||||
#endif
|
||||
input1.setmode(filebuf::binary);
|
||||
input2.setmode(filebuf::binary);
|
||||
failpos=-1;
|
||||
|
||||
while(!done) {
|
||||
|
||||
while(!(eof1=input1.eof())) {
|
||||
input1.read(&ch1,1);
|
||||
if(failpos>4225) {
|
||||
int x=failpos;
|
||||
}
|
||||
failpos++;
|
||||
char* p=strchr(" \t\r\n\b",ch1);
|
||||
if(!p)
|
||||
break;
|
||||
}
|
||||
|
||||
while(!(eof2=input2.eof())) {
|
||||
input2.read(&ch2,1);
|
||||
char* p=strchr(" \t\r\n\b",ch2);
|
||||
if(!p)
|
||||
break;
|
||||
}
|
||||
|
||||
if(eof1==eof2) {
|
||||
if(eof1)
|
||||
done=PR_TRUE;
|
||||
else if(ch1!=ch2) {
|
||||
done=PR_TRUE;
|
||||
result=PR_FALSE;
|
||||
|
||||
}
|
||||
}
|
||||
else done=PR_TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* LAST MODS: gess
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*------------------------------------------------------*/
|
||||
void parseFile (const char* aFilename,int size)
|
||||
{
|
||||
//debug
|
||||
//aFilename="s:\\ns\\raptor\\parser\\tests\\html\\home01.html";
|
||||
//aFilename="c:\\temp\\sun\\test00000.html";
|
||||
//aFilename="c:\\windows\\temp\\test.html";
|
||||
aFilename="s:\\readHTML-VC\\test.html";
|
||||
//aFilename="c:\\temp\\sun\\commentbug.html";
|
||||
|
||||
|
||||
char filename[_MAX_PATH];
|
||||
strcpy(filename,aFilename);
|
||||
strcat(filename,".tokens");
|
||||
{
|
||||
nsIParser* parser;
|
||||
|
||||
static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID);
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCParserCID,
|
||||
nsnull,
|
||||
kCParserIID,
|
||||
(void **)&parser);
|
||||
|
||||
CHTMLContentSink theSink;
|
||||
parser->setContentSink(&theSink);
|
||||
parser->parse(aFilename);
|
||||
NS_RELEASE(parser);
|
||||
}
|
||||
|
||||
int failpos=0;
|
||||
|
||||
if(!compareFiles(aFilename,filename,failpos)) {
|
||||
char buffer[100];
|
||||
printf("FAILED: %s [%i]\n",aFilename,failpos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* LAST MODS: gess
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*------------------------------------------------------*/
|
||||
int walkDirectoryTree(char* aPath) {
|
||||
int result=0;
|
||||
char fullPath[_MAX_PATH];
|
||||
struct _finddata_t c_file;
|
||||
long hFile;
|
||||
|
||||
strcpy(fullPath,aPath);
|
||||
strcat(fullPath,"\\*.*");
|
||||
/* Find first .c file in current directory */
|
||||
if((hFile = _findfirst( fullPath, &c_file )) == -1L )
|
||||
printf( "No matching files in current directory!\n" );
|
||||
else {
|
||||
|
||||
PRBool done=PR_FALSE;
|
||||
while(!done) {
|
||||
if(c_file.attrib & _A_SUBDIR) {
|
||||
if(strlen(c_file.name)>2){
|
||||
char newPath[_MAX_PATH];
|
||||
strcpy(newPath,aPath);
|
||||
strcat(newPath,"\\");
|
||||
strcat(newPath,c_file.name);
|
||||
walkDirectoryTree(newPath);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int len=strlen(c_file.name);
|
||||
if(len>5) {
|
||||
if(0==strnicmp(&c_file.name[len-5],".HTML",5)) {
|
||||
char filepath[_MAX_PATH];
|
||||
strcpy(filepath,aPath);
|
||||
strcat(filepath,"\\");
|
||||
strcat(filepath,c_file.name);
|
||||
parseFile(filepath,c_file.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_findnext( hFile, &c_file )!=0)
|
||||
done=PR_TRUE;
|
||||
}
|
||||
_findclose( hFile );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* LAST MODS: gess
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*------------------------------------------------------*/
|
||||
int main(int argc, char* argv [])
|
||||
{
|
||||
int result=0;
|
||||
char buffer[_MAX_PATH];
|
||||
|
||||
if(argc==2)
|
||||
strcpy(buffer,argv[1]);
|
||||
else _getcwd(buffer,_MAX_PATH);
|
||||
|
||||
nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("NS_InitXPCOM2 failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
walkDirectoryTree(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ void nsEntryStack::EnsureCapacityFor(PRInt32 aNewMax,PRInt32 aShiftOffset) {
|
|||
|
||||
if(temp){
|
||||
PRInt32 index=0;
|
||||
for(index=0;index<mCount;index++) {
|
||||
for(index=0;index<mCount;++index) {
|
||||
temp[aShiftOffset+index]=mEntries[index];
|
||||
}
|
||||
if(mEntries) delete [] mEntries;
|
||||
|
@ -199,7 +199,7 @@ void nsEntryStack::PushFront(const nsCParserNode* aNode,nsEntryStack* aStyleStac
|
|||
|
||||
mEntries[0].mParent=aStyleStack;
|
||||
mEntries[0].mStyles=0;
|
||||
mCount++;
|
||||
++mCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ void nsEntryStack::Append(nsEntryStack *aStack) {
|
|||
EnsureCapacityFor(mCount+aStack->mCount,0);
|
||||
|
||||
PRInt32 theIndex=0;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
mEntries[mCount]=aStack->mEntries[theIndex];
|
||||
mEntries[mCount++].mParent=0;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ nsCParserNode* nsEntryStack::Remove(PRInt32 anIndex,eHTMLTags aTag) {
|
|||
|
||||
PRInt32 theIndex=0;
|
||||
mCount-=1;
|
||||
for(theIndex=anIndex;theIndex<mCount;theIndex++){
|
||||
for(theIndex=anIndex;theIndex<mCount;++theIndex){
|
||||
mEntries[theIndex]=mEntries[theIndex+1];
|
||||
}
|
||||
|
||||
|
@ -261,12 +261,12 @@ nsCParserNode* nsEntryStack::Remove(PRInt32 anIndex,eHTMLTags aTag) {
|
|||
PRUint32 sindex=0;
|
||||
|
||||
nsTagEntry *theStyleEntry=theStyleStack->mEntries;
|
||||
for(sindex=scount-1;sindex>0;sindex--){
|
||||
for(sindex=scount-1;sindex>0;--sindex){
|
||||
if(theStyleEntry->mTag==aTag) {
|
||||
theStyleEntry->mParent=0; //this tells us that the style is not open at any level
|
||||
break;
|
||||
}
|
||||
theStyleEntry++;
|
||||
++theStyleEntry;
|
||||
} //for
|
||||
}
|
||||
}
|
||||
|
@ -299,12 +299,12 @@ nsCParserNode* nsEntryStack::Pop(void) {
|
|||
PRUint32 sindex=0;
|
||||
|
||||
nsTagEntry *theStyleEntry=theStyleStack->mEntries;
|
||||
for(sindex=scount-1;sindex>0;sindex--){
|
||||
for(sindex=scount-1;sindex>0;--sindex){
|
||||
if(theStyleEntry->mTag==mEntries[mCount].mTag) {
|
||||
theStyleEntry->mParent=0; //this tells us that the style is not open at any level
|
||||
break;
|
||||
}
|
||||
theStyleEntry++;
|
||||
++theStyleEntry;
|
||||
} //for
|
||||
}
|
||||
}
|
||||
|
@ -465,12 +465,12 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const {
|
|||
|
||||
// skip past leading and trailing quotes/etc
|
||||
if(kQuote==*start) {
|
||||
start++;
|
||||
++start;
|
||||
}
|
||||
|
||||
if(kSemicolon==theChar ||
|
||||
kQuote == theChar) {
|
||||
end--;
|
||||
--end;
|
||||
}
|
||||
|
||||
|
||||
|
@ -478,7 +478,7 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const {
|
|||
|
||||
PRInt32 theCount=mEntities.GetSize();
|
||||
PRInt32 theIndex=0;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++) {
|
||||
for(theIndex=0;theIndex<theCount;++theIndex) {
|
||||
CNamedEntity *theResult=(CNamedEntity*)mEntities.ObjectAt(theIndex);
|
||||
if(theResult &&
|
||||
theResult->mName.Equals(entityName,
|
||||
|
@ -592,7 +592,7 @@ public:
|
|||
while(next<=aValue) { // scale up in baseN; exceed current value.
|
||||
root=next;
|
||||
next*=base;
|
||||
expn++;
|
||||
++expn;
|
||||
}
|
||||
|
||||
while(expn--) {
|
||||
|
@ -735,7 +735,7 @@ public:
|
|||
int digitPos=0;
|
||||
int n=0;
|
||||
|
||||
for(digitPos=0;digitPos<len;digitPos++) {
|
||||
for(digitPos=0;digitPos<len;++digitPos) {
|
||||
romanPos--;
|
||||
switch(decStr[digitPos]) {
|
||||
case '0': break;
|
||||
|
@ -747,7 +747,7 @@ public:
|
|||
case '5': case '6':
|
||||
case '7': case '8':
|
||||
aString.Append(digitsB[romanPos]);
|
||||
for(n=0;n<(decStr[digitPos]-'5');n++)
|
||||
for(n=0;n<(decStr[digitPos]-'5');++n)
|
||||
aString.Append(digitsA[romanPos]);
|
||||
break;
|
||||
case '9':
|
||||
|
@ -795,7 +795,7 @@ public:
|
|||
repCount=((aValue-1)/seriesLen);
|
||||
modChar=aValue-(repCount*seriesLen);
|
||||
|
||||
for(count=0;count<=repCount;count++) {
|
||||
for(count=0;count<=repCount;++count) {
|
||||
aString.Append(PRUnichar(kFootnoteSet[modChar]));
|
||||
}
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsStr
|
|||
|
||||
CAbacus::eNumFormat theNumFormat=CAbacus::eDecimal;
|
||||
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
const nsAString& theKey=aNode.GetKeyAt(theIndex);
|
||||
const nsAString& theValue=aNode.GetValueAt(theIndex);
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ void nsDTDContext::PushStyle(const nsCParserNode* aNode){
|
|||
}
|
||||
if(theStack) {
|
||||
theStack->Push(aNode);
|
||||
mResidualStyleCount++;
|
||||
++mResidualStyleCount;
|
||||
}
|
||||
} //if
|
||||
}
|
||||
|
@ -1076,10 +1076,10 @@ void nsDTDContext::PushStyles(nsEntryStack *aStyles){
|
|||
PRUint32 sindex=0;
|
||||
|
||||
theEntry=aStyles->mEntries;
|
||||
for(sindex=0;sindex<scount;sindex++){
|
||||
for(sindex=0;sindex<scount;++sindex){
|
||||
theEntry->mParent=0; //this tells us that the style is not open at any level
|
||||
theEntry++;
|
||||
mResidualStyleCount++;
|
||||
++theEntry;
|
||||
++mResidualStyleCount;
|
||||
} //for
|
||||
|
||||
}
|
||||
|
@ -1202,7 +1202,7 @@ nsTokenAllocator::nsTokenAllocator() {
|
|||
|
||||
#ifdef NS_DEBUG
|
||||
int i=0;
|
||||
for(i=0;i<eToken_last-1;i++) {
|
||||
for(i=0;i<eToken_last-1;++i) {
|
||||
mTotals[i]=0;
|
||||
}
|
||||
#endif
|
||||
|
@ -1319,7 +1319,7 @@ static int gAllNodeCount=0;
|
|||
|
||||
int FindNode(nsCParserNode *aNode) {
|
||||
int theIndex=0;
|
||||
for(theIndex=0;theIndex<gAllNodeCount;theIndex++) {
|
||||
for(theIndex=0;theIndex<gAllNodeCount;++theIndex) {
|
||||
if(gAllNodes[theIndex]==aNode) {
|
||||
return theIndex;
|
||||
}
|
||||
|
@ -1402,7 +1402,7 @@ nsCParserNode* nsNodeAllocator::CreateNode(CToken* aToken,
|
|||
else{
|
||||
result=nsCParserNode::Create(aToken, aTokenAllocator,this);
|
||||
#ifdef DEBUG_TRACK_NODES
|
||||
mCount++;
|
||||
++mCount;
|
||||
AddNode(NS_STATIC_CAST(nsCParserNode*,result));
|
||||
#endif
|
||||
IF_HOLD(result);
|
||||
|
@ -1427,13 +1427,13 @@ void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char*
|
|||
out << "==================================================";
|
||||
int i,j=0;
|
||||
int written;
|
||||
for(i=1;i<eHTMLTag_text;i++){
|
||||
for(i=1;i<eHTMLTag_text;++i){
|
||||
const char* tag=nsHTMLTags::GetCStringValue((eHTMLTags)i);
|
||||
out << endl << endl << "Tag: <" << tag << ">" << endl;
|
||||
out << prefix;
|
||||
written=0;
|
||||
if(theDTD.IsContainer(i)) {
|
||||
for(j=1;j<eHTMLTag_text;j++){
|
||||
for(j=1;j<eHTMLTag_text;++j){
|
||||
if(15==written) {
|
||||
out << endl << prefix;
|
||||
written=0;
|
||||
|
@ -1442,7 +1442,7 @@ void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char*
|
|||
tag=nsHTMLTags::GetCStringValue((eHTMLTags)j);
|
||||
if(tag) {
|
||||
out<< tag << ", ";
|
||||
written++;
|
||||
++written;
|
||||
}
|
||||
}
|
||||
}//for
|
||||
|
@ -1509,10 +1509,10 @@ nsObserverEntry::nsObserverEntry(const nsAString& aTopic) : mTopic(aTopic)
|
|||
}
|
||||
|
||||
nsObserverEntry::~nsObserverEntry() {
|
||||
for (PRInt32 i = 0; i <= NS_HTML_TAG_MAX; i++){
|
||||
for (PRInt32 i = 0; i <= NS_HTML_TAG_MAX; ++i){
|
||||
if (mObservers[i]) {
|
||||
PRInt32 count = mObservers[i]->Count();
|
||||
for (PRInt32 j = 0; j < count; j++) {
|
||||
for (PRInt32 j = 0; j < count; ++j) {
|
||||
nsISupports* obs = (nsISupports*)mObservers[i]->ElementAt(j);
|
||||
NS_IF_RELEASE(obs);
|
||||
}
|
||||
|
@ -1550,7 +1550,7 @@ nsObserverEntry::Notify(nsIParserNode* aNode,
|
|||
// least 2 allocations for mImpl, usually more, plus at least 1 per
|
||||
// string (total = 2*(keys+3) + 2(or more) array allocations )).
|
||||
PRInt32 index;
|
||||
for (index = 0; index < theAttrCount; index++) {
|
||||
for (index = 0; index < theAttrCount; ++index) {
|
||||
keys.AppendString(aNode->GetKeyAt(index));
|
||||
values.AppendString(aNode->GetValueAt(index));
|
||||
}
|
||||
|
@ -1570,7 +1570,7 @@ nsObserverEntry::Notify(nsIParserNode* aNode,
|
|||
nsCOMPtr<nsIChannel> channel;
|
||||
aParser->GetChannel(getter_AddRefs(channel));
|
||||
|
||||
for (index=0;index<theObserversCount;index++) {
|
||||
for (index=0;index<theObserversCount;++index) {
|
||||
nsIElementObserver* observer = NS_STATIC_CAST(nsIElementObserver*,theObservers->ElementAt(index));
|
||||
if (observer) {
|
||||
result = observer->Notify(aWebShell, channel,
|
||||
|
@ -1613,7 +1613,7 @@ nsObserverEntry::AddObserver(nsIElementObserver *aObserver,
|
|||
void
|
||||
nsObserverEntry::RemoveObserver(nsIElementObserver *aObserver)
|
||||
{
|
||||
for (PRInt32 i=0; i <= NS_HTML_TAG_MAX; i++){
|
||||
for (PRInt32 i=0; i <= NS_HTML_TAG_MAX; ++i){
|
||||
if (mObservers[i]) {
|
||||
nsISupports* obs = aObserver;
|
||||
PRBool removed = mObservers[i]->RemoveElement(obs);
|
||||
|
|
|
@ -446,7 +446,7 @@ inline PRInt32 IndexOfTagInSet(PRInt32 aTag,const eHTMLTags* aTagSet,PRInt32 aCo
|
|||
if(aTag==*theTag) {
|
||||
return theTag-aTagSet;
|
||||
}
|
||||
theTag++;
|
||||
++theTag;
|
||||
}
|
||||
|
||||
return kNotFound;
|
||||
|
@ -622,7 +622,7 @@ inline PRInt32 LastOf(nsDTDContext& aContext,TagList& aTagList){
|
|||
inline PRInt32 FirstOf(nsDTDContext& aContext,PRInt32 aStartOffset,TagList& aTagList){
|
||||
int max = aContext.GetCount();
|
||||
int index;
|
||||
for(index=aStartOffset;index<max;index++){
|
||||
for(index=aStartOffset;index<max;++index){
|
||||
PRBool result=FindTagInSet(aContext[index],aTagList.mTags,aTagList.mCount);
|
||||
if(result) {
|
||||
return index;
|
||||
|
|
|
@ -2313,7 +2313,7 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
|
|||
int i,j=0;
|
||||
int written;
|
||||
int linenum=5;
|
||||
for(i=1;i<eHTMLTag_text;i++){
|
||||
for(i=1;i<eHTMLTag_text;++i){
|
||||
|
||||
const char* tag=nsHTMLTags::GetStringValue((eHTMLTags)i);
|
||||
out << endl << endl << "Tag: <" << tag << ">" << endl;
|
||||
|
@ -2322,25 +2322,25 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
|
|||
written=0;
|
||||
char startChar=0;
|
||||
if(IsContainer((eHTMLTags)i)) {
|
||||
for(j=1;j<eHTMLTag_text;j++){
|
||||
for(j=1;j<eHTMLTag_text;++j){
|
||||
tag=nsHTMLTags::GetStringValue((eHTMLTags)j);
|
||||
if(tag) {
|
||||
if(!startChar)
|
||||
startChar=tag[0];
|
||||
if(12==written){
|
||||
out << endl << prefix;
|
||||
linenum++;
|
||||
++linenum;
|
||||
written=0;
|
||||
}
|
||||
if(CanContain((eHTMLTags)i,(eHTMLTags)j)){
|
||||
if(tag[0]!=startChar){
|
||||
out << endl << prefix;
|
||||
linenum++;
|
||||
++linenum;
|
||||
written=0;
|
||||
startChar=tag[0];
|
||||
}
|
||||
out<< tag << ", ";
|
||||
written++;
|
||||
++written;
|
||||
}
|
||||
|
||||
}//if
|
||||
|
@ -2348,7 +2348,7 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
|
|||
}
|
||||
else {
|
||||
out<<"(not container)" << endl;
|
||||
linenum++;
|
||||
++linenum;
|
||||
}
|
||||
} //for
|
||||
#endif
|
||||
|
@ -2374,7 +2374,7 @@ void nsHTMLElement::DebugDumpMembership(const char* aFilename){
|
|||
|
||||
char* answer[]={".","Y"};
|
||||
char startChar=0;
|
||||
for(i=1;i<eHTMLTag_text;i++){
|
||||
for(i=1;i<eHTMLTag_text;++i){
|
||||
const char* tag=nsHTMLTags::GetStringValue((eHTMLTags)i);
|
||||
out << tag;
|
||||
int len=strlen(tag);
|
||||
|
@ -2433,7 +2433,7 @@ void nsHTMLElement::DebugDumpContainType(const char* aFilename){
|
|||
|
||||
char* answer[]={".","Y"};
|
||||
char startChar=0;
|
||||
for(i=1;i<eHTMLTag_text;i++){
|
||||
for(i=1;i<eHTMLTag_text;++i){
|
||||
const char* tag=nsHTMLTags::GetStringValue((eHTMLTags)i);
|
||||
out << tag;
|
||||
int len=strlen(tag);
|
||||
|
|
|
@ -409,7 +409,7 @@ nsExpatDriver::HandleXMLDeclaration(const PRUnichar *aValue,
|
|||
// <?xml version='a'?>
|
||||
// 0123456789012345678
|
||||
PRUint32 i = 17; // ?> can start at position 17 at the earliest
|
||||
for (; i < aLength; i++) {
|
||||
for (; i < aLength; ++i) {
|
||||
if (aValue[i] == '?')
|
||||
break;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ CreateSourceText(const PRInt32 aColNumber,
|
|||
|
||||
aSourceString.Append(aSourceLine);
|
||||
aSourceString.Append(PRUnichar('\n'));
|
||||
for (PRInt32 i = 0; i < errorPosition - 1; i++) {
|
||||
for (PRInt32 i = 0; i < errorPosition - 1; ++i) {
|
||||
aSourceString.Append(PRUnichar('-'));
|
||||
}
|
||||
aSourceString.Append(PRUnichar('^'));
|
||||
|
|
|
@ -235,7 +235,7 @@ public:
|
|||
nsHTMLEntities::AddRefTable();
|
||||
|
||||
// Make sure we can find everything we are supposed to
|
||||
for (int i = 0; i < NS_HTML_ENTITY_COUNT; i++) {
|
||||
for (int i = 0; i < NS_HTML_ENTITY_COUNT; ++i) {
|
||||
nsAutoString entity; entity.AssignWithConversion(gEntityArray[i].mStr);
|
||||
|
||||
value = nsHTMLEntities::EntityToUnicode(entity);
|
||||
|
|
|
@ -153,7 +153,7 @@ nsHTMLNullSink::~nsHTMLNullSink() {
|
|||
|
||||
#ifdef VERBOSE_DEBUG
|
||||
static void DebugDump(const char* str1,const nsAString& str2,PRInt32 tabs) {
|
||||
for(PRInt32 i=0;i<tabs;i++) {
|
||||
for(PRInt32 i=0;i<tabs;++i) {
|
||||
PR_fprintf(PR_STDOUT, " "); //add some tabbing to debug output...
|
||||
}
|
||||
|
||||
|
|
|
@ -482,7 +482,7 @@ public:
|
|||
|
||||
nsHTMLTags::AddRefTable();
|
||||
// Make sure we can find everything we are supposed to
|
||||
for (int i = 0; i < NS_HTML_TAG_MAX; i++) {
|
||||
for (int i = 0; i < NS_HTML_TAG_MAX; ++i) {
|
||||
tag = kTagUnicodeTable[i];
|
||||
id = nsHTMLTags::LookupTag(nsDependentString(tag));
|
||||
NS_ASSERTION(id != eHTMLTag_userdefined, "can't find tag id");
|
||||
|
|
|
@ -304,7 +304,7 @@ void nsHTMLTokenizer::PrependTokens(nsDeque& aDeque){
|
|||
//last but not least, let's check the misplaced content list.
|
||||
//if we find it, then we have to push it all into the body before continuing...
|
||||
PRInt32 anIndex=0;
|
||||
for(anIndex=0;anIndex<aCount;anIndex++){
|
||||
for(anIndex=0;anIndex<aCount;++anIndex){
|
||||
CToken* theToken=(CToken*)aDeque.Pop();
|
||||
PushTokenFront(theToken);
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
|
|||
theRootTag=theTag;
|
||||
}
|
||||
theStack.Push(theToken);
|
||||
theStackDepth++;
|
||||
++theStackDepth;
|
||||
break;
|
||||
|
||||
case eToken_end:
|
||||
|
@ -639,7 +639,7 @@ nsresult nsHTMLTokenizer::ConsumeAttributes(PRUnichar aChar,
|
|||
aToken->SetEmpty(isUsableAttr);
|
||||
}
|
||||
if(isUsableAttr) {
|
||||
theAttrCount++;
|
||||
++theAttrCount;
|
||||
AddToken((CToken*&)theToken,result,&mTokenDeque,theAllocator);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1013,7 +1013,7 @@ static PRBool IsCommentEnd(
|
|||
return PR_TRUE;
|
||||
}
|
||||
if (*current == PRUnichar('-')) {
|
||||
dashes++;
|
||||
++dashes;
|
||||
} else {
|
||||
dashes = 0;
|
||||
}
|
||||
|
@ -2028,9 +2028,9 @@ CEntityToken::ConsumeEntity(PRUnichar aChar,
|
|||
|
||||
aString.Append(aChar);
|
||||
if(aChar==kRightBrace)
|
||||
rightBraceCount++;
|
||||
++rightBraceCount;
|
||||
else if(aChar==kLeftBrace)
|
||||
leftBraceCount++;
|
||||
++leftBraceCount;
|
||||
} while(leftBraceCount!=rightBraceCount);
|
||||
} //if
|
||||
else {
|
||||
|
|
|
@ -133,7 +133,7 @@ nsLoggingSink::SetOutputStream(PRFileDesc *aStream,PRBool autoDeleteOutput) {
|
|||
static
|
||||
void WriteTabs(PRFileDesc * out,int aTabCount) {
|
||||
int tabs;
|
||||
for(tabs=0;tabs<aTabCount;tabs++)
|
||||
for(tabs=0;tabs<aTabCount;++tabs)
|
||||
PR_fprintf(out, " ");
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,7 @@ nsLoggingSink::WriteAttributes(const nsIParserNode& aNode) {
|
|||
WriteTabs(mOutput,1+mLevel);
|
||||
nsAutoString tmp;
|
||||
PRInt32 ac = aNode.GetAttributeCount();
|
||||
for (PRInt32 i = 0; i < ac; i++) {
|
||||
for (PRInt32 i = 0; i < ac; ++i) {
|
||||
char* key=nsnull;
|
||||
char* value=nsnull;
|
||||
const nsAString& k = aNode.GetKeyAt(i);
|
||||
|
|
|
@ -629,7 +629,7 @@ public:
|
|||
case kQuote:
|
||||
target=*cp;
|
||||
if (aSkipQuotes) {
|
||||
cp++;
|
||||
++cp;
|
||||
}
|
||||
done=PR_TRUE;
|
||||
break;
|
||||
|
@ -650,13 +650,13 @@ public:
|
|||
const CharT *firstcp=cp; //hang onto this...
|
||||
PRInt32 theDashCount=2;
|
||||
|
||||
cp++; //just skip first letter to simplify processing...
|
||||
++cp; //just skip first letter to simplify processing...
|
||||
|
||||
//ok, now find end of this word
|
||||
while(cp++<mEndBuffer) {
|
||||
if(kQuote==target) {
|
||||
if(kQuote==*cp) {
|
||||
cp++;
|
||||
++cp;
|
||||
break; //we found our end...
|
||||
}
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ public:
|
|||
//then let's look for SGML comments
|
||||
if(kMinus==*cp) {
|
||||
if(4==++theDashCount) {
|
||||
cp++;
|
||||
++cp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ static PRInt32 ParsePS(const nsString& aBuffer, PRInt32 aIndex)
|
|||
PRUnichar ch = aBuffer.CharAt(aIndex);
|
||||
if ((ch == PRUnichar(' ')) || (ch == PRUnichar('\t')) ||
|
||||
(ch == PRUnichar('\n')) || (ch == PRUnichar('\r'))) {
|
||||
aIndex++;
|
||||
++aIndex;
|
||||
} else if (ch == PRUnichar('-')) {
|
||||
PRInt32 tmpIndex;
|
||||
if (aBuffer.CharAt(aIndex+1) == PRUnichar('-') &&
|
||||
|
@ -2022,7 +2022,7 @@ static PRBool DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
|||
// <?xml
|
||||
PRInt32 i;
|
||||
PRBool versionFound = PR_FALSE, encodingFound = PR_FALSE;
|
||||
for (i=6; i < aLen && !encodingFound; i++) {
|
||||
for (i=6; i < aLen && !encodingFound; ++i) {
|
||||
// end of XML declaration?
|
||||
if ((((char*)aBytes)[i] == '?') &&
|
||||
((i+1) < aLen) &&
|
||||
|
@ -2041,7 +2041,7 @@ static PRBool DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
|||
(0 == PL_strncmp("versio", (char*)(aBytes+i-6), 6 ))) {
|
||||
// Fast forward through version
|
||||
char q = 0;
|
||||
for (++i; i < aLen; i++) {
|
||||
for (++i; i < aLen; ++i) {
|
||||
char qi = ((char*)aBytes)[i];
|
||||
if (qi == '\'' || qi == '"') {
|
||||
if (q && q == qi) {
|
||||
|
@ -2067,7 +2067,7 @@ static PRBool DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
|||
(0 == PL_strncmp("encodin", (char*)(aBytes+i-7), 7 ))) {
|
||||
PRInt32 encStart = 0;
|
||||
char q = 0;
|
||||
for (++i; i < aLen; i++) {
|
||||
for (++i; i < aLen; ++i) {
|
||||
char qi = ((char*)aBytes)[i];
|
||||
if (qi == '\'' || qi == '"') {
|
||||
if (q && q == qi) {
|
||||
|
@ -2580,7 +2580,7 @@ PRBool nsParser::DidTokenize(PRBool aIsFinalChunk){
|
|||
if(mTokenObserver) {
|
||||
PRInt32 theCount=theTokenizer->GetCount();
|
||||
PRInt32 theIndex;
|
||||
for(theIndex=0;theIndex<theCount;theIndex++){
|
||||
for(theIndex=0;theIndex<theCount;++theIndex){
|
||||
if((*mTokenObserver)(theTokenizer->GetTokenAt(theIndex))){
|
||||
//add code here to pull unwanted tokens out of the stack...
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,
|
|||
MOZ_COUNT_CTOR(nsCParserNode);
|
||||
|
||||
static int theNodeCount=0;
|
||||
theNodeCount++;
|
||||
++theNodeCount;
|
||||
mAttributes=0;
|
||||
mToken=aToken;
|
||||
IF_HOLD(mToken);
|
||||
|
@ -327,7 +327,7 @@ void nsCParserNode::GetSource(nsString& aString) {
|
|||
}
|
||||
if(mAttributes) {
|
||||
int index=0;
|
||||
for(index=0;index<mAttributes->GetSize();index++) {
|
||||
for(index=0;index<mAttributes->GetSize();++index) {
|
||||
CAttributeToken *theToken=(CAttributeToken*)mAttributes->ObjectAt(index);
|
||||
if(theToken) {
|
||||
theToken->AppendSourceTo(aString);
|
||||
|
|
|
@ -148,7 +148,7 @@ nsParserService::RegisterObserver(nsIElementObserver* aObserver,
|
|||
if(*aTags != eHTMLTag_userdefined && *aTags <= NS_HTML_TAG_MAX) {
|
||||
entry->AddObserver(aObserver,*aTags);
|
||||
}
|
||||
aTags++;
|
||||
++aTags;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -160,7 +160,7 @@ nsParserService::UnregisterObserver(nsIElementObserver* aObserver,
|
|||
{
|
||||
PRInt32 count = mEntries.GetSize();
|
||||
|
||||
for (PRInt32 i=0; i < count; i++) {
|
||||
for (PRInt32 i=0; i < count; ++i) {
|
||||
nsObserverEntry* entry = NS_STATIC_CAST(nsObserverEntry*,mEntries.ObjectAt(i));
|
||||
if (entry && entry->Matches(aTopic)) {
|
||||
entry->RemoveObserver(aObserver);
|
||||
|
|
|
@ -356,7 +356,7 @@ nsresult nsScanner::Append(const char* aBuffer, PRUint32 aLen){
|
|||
srcLength = aLen;
|
||||
}
|
||||
else {
|
||||
srcLength++;
|
||||
++srcLength;
|
||||
}
|
||||
|
||||
aBuffer += srcLength;
|
||||
|
@ -480,7 +480,7 @@ nsresult nsScanner::GetChar(PRUnichar& aChar) {
|
|||
|
||||
if(NS_OK == result){
|
||||
aChar=*mCurrentPosition++;
|
||||
mCountRemaining--;
|
||||
--mCountRemaining;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ nsresult nsScanner::SkipWhitespace(PRInt32& aNewlinesSkipped) {
|
|||
while (!done && current != mEndPosition) {
|
||||
switch(theChar) {
|
||||
case '\n':
|
||||
case '\r': aNewlinesSkipped++;
|
||||
case '\r': ++aNewlinesSkipped;
|
||||
case ' ' :
|
||||
case '\b':
|
||||
case '\t':
|
||||
|
@ -1048,7 +1048,7 @@ nsresult nsScanner::ReadWhitespace(nsString& aString,
|
|||
while(!done && current != end) {
|
||||
switch(theChar) {
|
||||
case '\n':
|
||||
case '\r': aNewlinesSkipped++;
|
||||
case '\r': ++aNewlinesSkipped;
|
||||
case ' ' :
|
||||
case '\b':
|
||||
case '\t':
|
||||
|
@ -1102,7 +1102,7 @@ nsresult nsScanner::ReadWhitespace(nsReadingIterator<PRUnichar>& aStart,
|
|||
while(!done && current != end) {
|
||||
switch(theChar) {
|
||||
case '\n':
|
||||
case '\r': aNewlinesSkipped++;
|
||||
case '\r': ++aNewlinesSkipped;
|
||||
case ' ' :
|
||||
case '\b':
|
||||
case '\t':
|
||||
|
|
|
@ -77,7 +77,7 @@ CToken::CToken(PRInt32 aTag) {
|
|||
mUseCount=1;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
TokenCount++;
|
||||
++TokenCount;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ CToken::~CToken() {
|
|||
#ifdef MATCH_CTOR_DTOR
|
||||
MOZ_COUNT_DTOR(CToken);
|
||||
#endif
|
||||
DelTokenCount++;
|
||||
++DelTokenCount;
|
||||
mUseCount=0;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ void CToken::DebugDumpToken(nsOutputStream& anOutputStream) {
|
|||
anOutputStream << "[" << GetClassName() << "] ";
|
||||
PRUint32 i=0;
|
||||
PRUint32 theLen=GetStringValue().Length();
|
||||
for(i=0;i<theLen;i++){
|
||||
for(i=0;i<theLen;++i){
|
||||
anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get();
|
||||
}
|
||||
anOutputStream << " TypeID: " << mTypeID << " AttrCount: " << mAttrCount << nsEndl;
|
||||
|
|
|
@ -904,7 +904,7 @@ nsresult CViewSourceHTML::WriteAttributes(PRInt32 attrCount) {
|
|||
CSharedVSContext& theContext=CSharedVSContext::GetSharedContext();
|
||||
|
||||
int attr=0;
|
||||
for(attr=0;attr<attrCount;attr++){
|
||||
for(attr=0;attr<attrCount;++attr){
|
||||
CToken* theToken=mTokenizer->PeekToken();
|
||||
if(theToken) {
|
||||
eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType());
|
||||
|
@ -1047,7 +1047,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
|||
|
||||
case eToken_start:
|
||||
{
|
||||
mTagCount++;
|
||||
++mTagCount;
|
||||
|
||||
const nsAString& startValue = aToken->GetStringValue();
|
||||
result=WriteTag(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE);
|
||||
|
@ -1107,9 +1107,9 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
|||
case eToken_newline:
|
||||
{
|
||||
const nsAString& newlineValue = aToken->GetStringValue();
|
||||
mLineNumber++;
|
||||
++mLineNumber;
|
||||
result=WriteTag(mText,newlineValue,0,PR_FALSE);
|
||||
mTokenCount++;
|
||||
++mTokenCount;
|
||||
if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 &&
|
||||
mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK)
|
||||
StartNewPreBlock();
|
||||
|
@ -1120,7 +1120,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
|||
{
|
||||
const nsAString& wsValue = aToken->GetStringValue();
|
||||
result=WriteTag(mText,wsValue,0,PR_FALSE);
|
||||
mTokenCount++;
|
||||
++mTokenCount;
|
||||
if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 &&
|
||||
mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK &&
|
||||
!wsValue.IsEmpty()) {
|
||||
|
@ -1135,7 +1135,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
|||
{
|
||||
const nsAString& str = aToken->GetStringValue();
|
||||
result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE);
|
||||
mTokenCount++;
|
||||
++mTokenCount;
|
||||
if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 &&
|
||||
mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !str.IsEmpty()) {
|
||||
PRUnichar ch = str.Last();
|
||||
|
|
|
@ -209,7 +209,7 @@ PageGrabber::NextFile(const char* aExtension)
|
|||
struct stat sb;
|
||||
int s = stat(cname, &sb);
|
||||
if (s < 0) {
|
||||
mFileNum++;
|
||||
++mFileNum;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -388,7 +388,7 @@ void expandMacros(char* aBuffer,CMacros& aMacroSet){
|
|||
while(aBuffer[++rPos]){
|
||||
if('$'==aBuffer[rPos]){
|
||||
temp[wPos]=0;
|
||||
rPos++; //skip the $...
|
||||
++rPos; //skip the $...
|
||||
int theIndex=aBuffer[rPos]-'0';
|
||||
char* theMacro=aMacroSet.getMacro(theIndex);
|
||||
if(theMacro){
|
||||
|
|
Загрузка…
Ссылка в новой задаче