Commit f028f81b authored by darin's avatar darin

JavaScriptCore:

	Merged in changes from KDE 3.0.1.

	* kjs/collector.cpp:
	* kjs/date_object.cpp:
	* kjs/function.cpp:
	* kjs/internal.cpp:
	* kjs/lookup.h:
	* kjs/object.cpp:
	* kjs/operations.cpp:
	* kjs/regexp.cpp:
	* kjs/regexp_object.cpp:
	* kjs/regexp_object.h:
	* kjs/string_object.cpp:
	* kjs/testkjs.cpp:
	* kjs/ustring.cpp:
	* kjs/value.cpp:
	* kjs/value.h:
	Do the merge, and add APPLE_CHANGES as needed to make things compile.

	* kjs/date_object.lut.h: Re-generated.

WebCore:

	Merged in changes from KDE 3.0.1.

	* kwq/kdecore/kurl.h:
	* kwq/KWQKURL.mm: (operator==): New, needed by some 3.0.1 code.

	* kwq/qt/qpalette.h: Add QPalette::NColorGroups and QColorGroup::NColorRoles.
	* kwq/KWQPalette.mm: Simplify by getting rid of "private" indirection.
	(QPalette::color): New, needed by some 3.0.1 code.
	* kwq/KWQColorGroup.mm: Simplify by getting rid of "private" indirection.

	* kwq/qt/qstring.h:
	* kwq/KWQString.mm: (QConstString::QConstString): Change parameter to const QChar *
	to match Qt so we compile.

	* kwq/qt/qtextedit.h:
	* kwq/KWQTextEdit.mm: (QTextEdit::setTabStopWidth): Add unimplemented placeholder,
	needed by some 3.0.1 code.

	* kwq/qt/qvaluelist.h:
	* kwq/KWQValueListImpl.h:
	* kwq/KWQValueListImpl.mm: Simplify implementation.

	* WebCore-tests.exp: Update for changes in QValueList implementation.

	* kwq/kdecore/klibloader.h: Add include of <kio/global.h> to make something compile.

	* kwq/khtml/java/kjavaappletcontext.h: Add JType and constructor that takes DCOPObject*.

	* kwq/kio/global.h: Add KIO::CacheControl.

	* khtml/css/css_ruleimpl.cpp:
	* khtml/css/css_ruleimpl.h:
	* khtml/css/css_stylesheetimpl.cpp:
	* khtml/css/css_stylesheetimpl.h:
	* khtml/css/css_valueimpl.cpp:
	* khtml/css/css_valueimpl.h:
	* khtml/css/cssparser.cpp:
	* khtml/css/cssparser.h:
	* khtml/css/cssstyleselector.cpp:
	* khtml/css/cssstyleselector.h:
	* khtml/css/html4.css:
	* khtml/dom/css_rule.cpp:
	* khtml/dom/css_rule.h:
	* khtml/dom/css_stylesheet.cpp:
	* khtml/dom/css_stylesheet.h:
	* khtml/dom/css_value.cpp:
	* khtml/dom/dom2_events.cpp:
	* khtml/dom/dom2_range.cpp:
	* khtml/dom/dom2_range.h:
	* khtml/dom/dom2_views.cpp:
	* khtml/dom/dom_doc.cpp:
	* khtml/dom/dom_element.cpp:
	* khtml/dom/dom_exception.h:
	* khtml/dom/dom_node.cpp:
	* khtml/dom/dom_string.cpp:
	* khtml/dom/dom_text.cpp:
	* khtml/dom/dom_xml.cpp:
	* khtml/dom/html_base.cpp:
	* khtml/dom/html_block.cpp:
	* khtml/dom/html_document.cpp:
	* khtml/dom/html_element.cpp:
	* khtml/dom/html_element.h:
	* khtml/dom/html_form.cpp:
	* khtml/dom/html_head.cpp:
	* khtml/dom/html_image.cpp:
	* khtml/dom/html_inline.cpp:
	* khtml/dom/html_list.cpp:
	* khtml/dom/html_misc.cpp:
	* khtml/dom/html_object.cpp:
	* khtml/dom/html_table.cpp:
	* khtml/ecma/kjs_html.cpp:
	* khtml/ecma/kjs_proxy.cpp:
	* khtml/ecma/kjs_traversal.cpp:
	* khtml/ecma/kjs_window.cpp:
	* khtml/html/html_baseimpl.cpp:
	* khtml/html/html_formimpl.cpp:
	* khtml/html/html_miscimpl.h:
	* khtml/html/html_objectimpl.cpp:
	* khtml/html/html_objectimpl.h:
	* khtml/html/htmlparser.cpp:
	* khtml/html/htmlparser.h:
	* khtml/html/htmltokenizer.cpp:
	* khtml/html/htmltokenizer.h:
	* khtml/khtml_part.cpp:
	* khtml/khtmlpart_p.h:
	* khtml/khtmlview.cpp:
	* khtml/misc/helper.cpp:
	* khtml/misc/khtmllayout.h:
	* khtml/misc/loader.cpp:
	* khtml/misc/loader.h:
	* khtml/misc/loader_client.h:
	* khtml/misc/shared.h: Added.
	* khtml/rendering/bidi.cpp:
	* khtml/rendering/break_lines.cpp:
	* khtml/rendering/font.cpp:
	* khtml/rendering/render_applet.cpp:
	* khtml/rendering/render_applet.h:
	* khtml/rendering/render_container.cpp:
	* khtml/rendering/render_form.cpp:
	* khtml/rendering/render_form.h:
	* khtml/rendering/render_frames.cpp:
	* khtml/rendering/render_image.cpp:
	* khtml/rendering/render_object.cpp:
	* khtml/rendering/render_object.h:
	* khtml/rendering/render_replaced.cpp:
	* khtml/rendering/render_replaced.h:
	* khtml/rendering/render_root.cpp:
	* khtml/rendering/render_style.cpp:
	* khtml/rendering/render_style.h:
	* khtml/rendering/render_table.cpp:
	* khtml/rendering/render_table.h:
	* khtml/rendering/render_text.cpp:
	* khtml/rendering/render_text.h:
	* khtml/xml/dom2_eventsimpl.h:
	* khtml/xml/dom2_rangeimpl.h:
	* khtml/xml/dom2_traversalimpl.cpp:
	* khtml/xml/dom2_traversalimpl.h:
	* khtml/xml/dom2_viewsimpl.h:
	* khtml/xml/dom_docimpl.cpp:
	* khtml/xml/dom_docimpl.h:
	* khtml/xml/dom_elementimpl.h:
	* khtml/xml/dom_nodeimpl.cpp:
	* khtml/xml/dom_nodeimpl.h:
	* khtml/xml/dom_stringimpl.cpp:
	* khtml/xml/dom_stringimpl.h:
	* khtml/xml/xml_tokenizer.h:
	Merge in 3.0.1 changes and add APPLE_CHANGES as necessary to get it to compile.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 97f5c590
2002-06-10 Darin Adler <darin@apple.com>
Merged in changes from KDE 3.0.1.
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/function.cpp:
* kjs/internal.cpp:
* kjs/lookup.h:
* kjs/object.cpp:
* kjs/operations.cpp:
* kjs/regexp.cpp:
* kjs/regexp_object.cpp:
* kjs/regexp_object.h:
* kjs/string_object.cpp:
* kjs/testkjs.cpp:
* kjs/ustring.cpp:
* kjs/value.cpp:
* kjs/value.h:
Do the merge, and add APPLE_CHANGES as needed to make things compile.
* kjs/date_object.lut.h: Re-generated.
2002-06-07 Darin Adler <darin@apple.com>
* Makefile.am: Use new shared "embed.am" file so we don't need four copies of
......
2002-06-10 Darin Adler <darin@apple.com>
Merged in changes from KDE 3.0.1.
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/function.cpp:
* kjs/internal.cpp:
* kjs/lookup.h:
* kjs/object.cpp:
* kjs/operations.cpp:
* kjs/regexp.cpp:
* kjs/regexp_object.cpp:
* kjs/regexp_object.h:
* kjs/string_object.cpp:
* kjs/testkjs.cpp:
* kjs/ustring.cpp:
* kjs/value.cpp:
* kjs/value.h:
Do the merge, and add APPLE_CHANGES as needed to make things compile.
* kjs/date_object.lut.h: Re-generated.
2002-06-07 Darin Adler <darin@apple.com>
* Makefile.am: Use new shared "embed.am" file so we don't need four copies of
......
2002-06-10 Darin Adler <darin@apple.com>
Merged in changes from KDE 3.0.1.
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/function.cpp:
* kjs/internal.cpp:
* kjs/lookup.h:
* kjs/object.cpp:
* kjs/operations.cpp:
* kjs/regexp.cpp:
* kjs/regexp_object.cpp:
* kjs/regexp_object.h:
* kjs/string_object.cpp:
* kjs/testkjs.cpp:
* kjs/ustring.cpp:
* kjs/value.cpp:
* kjs/value.h:
Do the merge, and add APPLE_CHANGES as needed to make things compile.
* kjs/date_object.lut.h: Re-generated.
2002-06-07 Darin Adler <darin@apple.com>
* Makefile.am: Use new shared "embed.am" file so we don't need four copies of
......
......@@ -225,10 +225,10 @@ bool Collector::collect()
}
// SWEEP: delete everything with a zero refcount (garbage)
// 1st step: destruct all objects
block = root;
while (block) {
ValueImp **r = (ValueImp**)block->mem;
int del = 0;
for (int i = 0; i < block->size; i++, r++) {
ValueImp *imp = (*r);
// Can delete if refcount==0, created==true, gcAllowed==true, and marked==false
......@@ -238,7 +238,20 @@ bool Collector::collect()
// emulate destructing part of 'operator delete()'
//fprintf( stderr, "Collector::deleting ValueImp %p (%s)\n", (void*)imp, typeid(*imp).name());
imp->~ValueImp();
free(imp);
}
}
block = block->next;
}
// 2nd step: free memory
block = root;
while (block) {
ValueImp **r = (ValueImp**)block->mem;
int del = 0;
for (int i = 0; i < block->size; i++, r++) {
ValueImp *imp = (*r);
if (imp && (imp->_flags & ValueImp::VI_DESTRUCTED) != 0) {
free(imp);
*r = 0L;
del++;
}
......
......@@ -76,7 +76,7 @@ const ClassInfo DatePrototypeImp::info = {"Date", 0, &dateTable, 0};
We use a negative ID to denote the "UTC" variant.
@begin dateTable 61
toString DateProtoFuncImp::ToString DontEnum|Function 0
toUTCString -DateProtoFuncImp::ToString DontEnum|Function 0
toUTCString DateProtoFuncImp::ToUTCString DontEnum|Function 0
toDateString DateProtoFuncImp::ToDateString DontEnum|Function 0
toTimeString DateProtoFuncImp::ToTimeString DontEnum|Function 0
toLocaleString DateProtoFuncImp::ToLocaleString DontEnum|Function 0
......@@ -195,14 +195,15 @@ Value DateProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
case ToDateString:
case ToTimeString:
case ToGMTString:
case ToUTCString:
setlocale(LC_TIME,"C");
if (id == DateProtoFuncImp::ToDateString) {
strftime(timebuffer, bufsize, "%x",t);
} else if (id == DateProtoFuncImp::ToTimeString) {
strftime(timebuffer, bufsize, "%X",t);
} else {
} else { // toGMTString & toUTCString
t = gmtime(&tv);
strftime(timebuffer, bufsize, "%a, %d-%b-%y %H:%M:%S %Z", t);
strftime(timebuffer, bufsize, "%a, %d %b %Y %H:%M:%S %Z", t);
}
setlocale(LC_TIME,oldlocale.c_str());
result = String(timebuffer);
......
......@@ -62,7 +62,7 @@ const struct HashEntry dateTableEntries[] = {
{ 0, 0, 0, 0, 0 },
{ "getUTCSeconds", -DateProtoFuncImp::GetSeconds, DontEnum|Function, 0, 0 },
{ "getHours", DateProtoFuncImp::GetHours, DontEnum|Function, 0, 0 },
{ "toUTCString", -DateProtoFuncImp::ToString, DontEnum|Function, 0, &dateTableEntries[62] },
{ "toUTCString", DateProtoFuncImp::ToUTCString, DontEnum|Function, 0, &dateTableEntries[62] },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "setTime", DateProtoFuncImp::SetTime, DontEnum|Function, 1, &dateTableEntries[67] },
......
......@@ -369,7 +369,8 @@ Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args
"abcdefghijklmnopqrstuvwxyz"
"0123456789@*_+-./";
if (id == Eval) { // eval()
switch (id) {
case Eval: { // eval()
Value x = args[0];
if (x.type() != StringType)
return x;
......@@ -422,10 +423,13 @@ Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args
return c.value();
else
return Undefined();
} else
} else {
return c;
}
}
} else if (id == ParseInt) {
break;
}
case ParseInt: {
String str = args[0].toString(exec);
int radix = args[1].toInt32(exec);
if (radix == 0)
......@@ -441,15 +445,22 @@ Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args
res = Number(NaN);
else
res = Number(static_cast<long>(value)); // remove floating-point part
} else if (id == ParseFloat) {
break;
}
case ParseFloat: {
String str = args[0].toString(exec);
res = Number(str.value().toDouble( true /*tolerant*/ ));
} else if (id == IsNaN) {
break;
}
case IsNaN:
res = Boolean(isNaN(args[0].toNumber(exec)));
} else if (id == IsFinite) {
break;
case IsFinite: {
Number n = args[0].toNumber(exec);
res = Boolean(!n.isNaN() && !n.isInf());
} else if (id == Escape) {
break;
}
case Escape: {
UString r = "", s, str = args[0].toString(exec);
const UChar *c = str.data();
for (int k = 0; k < str.size(); k++, c++) {
......@@ -468,7 +479,9 @@ Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args
r += s;
}
res = String(r);
} else if (id == UnEscape) {
break;
}
case UnEscape: {
UString s, str = args[0].toString(exec);
int k = 0, len = str.size();
while (k < len) {
......@@ -488,6 +501,8 @@ Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args
s += UString(c, 1);
}
res = String(s);
break;
}
}
return res;
......
......@@ -917,9 +917,9 @@ void InterpreterImp::initGlobalObject()
b_uriErrorPrototype.put(globExec, "constructor", b_uriError, DontEnum | DontDelete | ReadOnly);
// built-in values
global.put(globExec,"NaN", Number(NaN), DontEnum);
global.put(globExec,"Infinity", Number(Inf), DontEnum);
global.put(globExec,"undefined", Undefined(), DontEnum);
global.put(globExec, "NaN", Number(NaN), DontEnum|DontDelete);
global.put(globExec, "Infinity", Number(Inf), DontEnum|DontDelete);
global.put(globExec, "undefined", Undefined(), DontEnum|DontDelete);
// built-in functions
global.put(globExec,"eval", Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::Eval, 1)), DontEnum);
......
......@@ -194,7 +194,7 @@ namespace KJS {
fprintf(stderr, "Function bit not set! Shouldn't happen in lookupGetFunction!\n" );
return Undefined();
};
}
/**
* Simplified version of lookupGet in case there are no functions, only "values".
......
......@@ -200,15 +200,12 @@ ObjectImp::ObjectImp()
ObjectImp::~ObjectImp()
{
//fprintf(stderr,"ObjectImp::~ObjectImp %p\n",(void*)this);
#if 0 // Those could be already deleted. The collector ensures no order
// ### Check if this leads to memory leaks....
if (_proto)
_proto->setGcAllowed();
if (_internalValue)
_internalValue->setGcAllowed();
if (_scope)
_scope->setGcAllowed();
#endif
delete _prop;
}
......
......@@ -220,8 +220,10 @@ int KJS::minInt(int d1, int d2)
// ECMA 11.6
Value KJS::add(ExecState *exec, const Value &v1, const Value &v2, char oper)
{
Value p1 = v1.toPrimitive(exec);
Value p2 = v2.toPrimitive(exec);
// exception for the Date exception in defaultValue()
Type preferred = oper == '+' ? UnspecifiedType : NumberType;
Value p1 = v1.toPrimitive(exec, preferred);
Value p2 = v2.toPrimitive(exec, preferred);
if ((p1.type() == StringType || p2.type() == StringType) && oper == '+') {
UString s1 = p1.toString(exec);
......
......@@ -19,18 +19,17 @@
*
*/
#include "regexp.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "regexp.h"
using namespace KJS;
RegExp::RegExp(const UString &p, int f)
: pattern(p), flags(f)
{
#ifdef HAVE_PCREPOSIX
int pcreflags = 0;
const char *perrormsg;
......@@ -44,6 +43,10 @@ RegExp::RegExp(const UString &p, int f)
pcregex = pcre_compile(p.ascii(), pcreflags,
&perrormsg, &errorOffset, NULL);
#ifndef NDEBUG
if (!pcregex)
fprintf(stderr, "KJS: pcre_compile() failed with '%s'\n", perrormsg);
#endif
#ifdef PCRE_INFO_CAPTURECOUNT
// Get number of subpatterns that will be returned
......@@ -54,7 +57,7 @@ RegExp::RegExp(const UString &p, int f)
#else /* HAVE_PCREPOSIX */
nrSubPatterns = 0; // not implemented with POSIX regex.
nrSubPatterns = 0; // determined in match() with POSIX regex.
int regflags = 0;
#ifdef REG_EXTENDED
regflags |= REG_EXTENDED;
......@@ -78,8 +81,8 @@ RegExp::RegExp(const UString &p, int f)
RegExp::~RegExp()
{
#ifdef HAVE_PCREPOSIX
pcre_free(pcregex);
if (pcregex)
pcre_free(pcregex);
#else
/* TODO: is this really okay after an error ? */
regfree(&preg);
......@@ -88,50 +91,76 @@ RegExp::~RegExp()
UString RegExp::match(const UString &s, int i, int *pos, int **ovector)
{
if (i < 0)
i = 0;
if (ovector)
*ovector = 0L;
int dummyPos;
if (!pos)
pos = &dummyPos;
*pos = -1;
if (i > s.size() || s.isNull())
return UString::null;
#ifdef HAVE_PCREPOSIX
CString buffer(s.cstring());
int ovecsize = (nrSubPatterns+1)*3; // see pcre docu
if (ovector) *ovector = new int[ovecsize];
if (i < 0)
i = 0;
if (i > s.size() || s.isNull() ||
pcre_exec(pcregex, NULL, buffer.c_str(), buffer.size(), i,
0, ovector ? *ovector : 0L, ovecsize) == PCRE_ERROR_NOMATCH) {
if (pos)
*pos = -1;
if (!pcregex || pcre_exec(pcregex, NULL, buffer.c_str(), buffer.size(), i,
0, ovector ? *ovector : 0L, ovecsize) == PCRE_ERROR_NOMATCH)
return UString::null;
}
if (!ovector)
return UString::null; // don't rely on the return value if you pass ovector==0
if (pos)
*pos = (*ovector)[0];
return s.substr((*ovector)[0], (*ovector)[1] - (*ovector)[0]);
#else
regmatch_t rmatch[10];
if (i < 0)
i = 0;
#ifdef APPLE_CHANGES
const uint maxMatch = 10;
#else
const int maxMatch = 10;
#endif
regmatch_t rmatch[maxMatch];
char *str = strdup(s.ascii());
if (i > s.size() || s.isNull() ||
regexec(&preg, str + i, 10, rmatch, 0)) {
if (pos)
*pos = -1;
char *str = strdup(s.ascii()); // TODO: why ???
if (regexec(&preg, str + i, maxMatch, rmatch, 0)) {
free(str);
return UString::null;
}
free(str);
if (pos)
*pos = rmatch[0].rm_so + i;
// TODO copy from rmatch to ovector
return s.substr(rmatch[0].rm_so + i, rmatch[0].rm_eo - rmatch[0].rm_so);
if (!ovector) {
*pos = rmatch[0].rm_so + i;
return s.substr(rmatch[0].rm_so + i, rmatch[0].rm_eo - rmatch[0].rm_so);
}
// map rmatch array to ovector used in PCRE case
nrSubPatterns = 0;
#ifdef APPLE_CHANGES
for(uint j = 1; j < maxMatch && rmatch[j].rm_so >= 0 ; j++)
#else
for(int j = 1; j < maxMatch && rmatch[j].rm_so >= 0 ; j++)
#endif
nrSubPatterns++;
int ovecsize = (nrSubPatterns+1)*3; // see above
*ovector = new int[ovecsize];
#ifdef APPLE_CHANGES
for (uint j = 0; j < nrSubPatterns + 1; j++) {
#else
for (int j = 0; j < nrSubPatterns + 1; j++) {
#endif
if (j>maxMatch)
break;
(*ovector)[2*j] = rmatch[j].rm_so + i;
(*ovector)[2*j+1] = rmatch[j].rm_eo + i;
#ifdef APPLE_CHANGES
} // balance extra { so we don't confuse prepare-ChangeLog
#else
}
#endif
#endif
*pos = (*ovector)[0];
return s.substr((*ovector)[0], (*ovector)[1] - (*ovector)[0]);
}
#if 0 // unused
......
......@@ -92,12 +92,16 @@ Value RegExpProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
i = 0;
if (i < 0 || i > length) {
thisObj.put(exec,"lastIndex", Number(0), DontDelete | DontEnum);
return Null();
if (id == Test)
return Boolean(false);
else
Null();
}
RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->interpreter()->builtinRegExp().imp());
int **ovector = regExpObj->registerRegexp( re, s.value() );
str = re->match(s.value(), i, 0L, ovector);
regExpObj->setSubPatterns(re->subPatterns());
if (id == Test)
return Boolean(!str.isNull());
......@@ -159,15 +163,13 @@ RegExpObjectImp::RegExpObjectImp(ExecState *exec,
RegExpObjectImp::~RegExpObjectImp()
{
if (lastOvector)
delete [] lastOvector;
delete [] lastOvector;
}
int **RegExpObjectImp::registerRegexp( const RegExp* re, const UString& s )
{
lastString = s;
if (lastOvector)
delete [] lastOvector;
delete [] lastOvector;
lastOvector = 0;
lastNrSubPatterns = re->subPatterns();
return &lastOvector;
......
......@@ -74,6 +74,7 @@ namespace KJS {
Value get(ExecState *exec, const UString &p) const;
int ** registerRegexp( const RegExp* re, const UString& s );
void setSubPatterns(int num) { lastNrSubPatterns = num; }
Value arrayOfMatches(ExecState *exec, const UString &result) const;
private:
UString lastString;
......
......@@ -213,6 +213,7 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->interpreter()->builtinRegExp().imp());
int **ovector = regExpObj->registerRegexp( reg, u );
UString mstr = reg->match(u, -1, &pos, ovector);
regExpObj->setSubPatterns(reg->subPatterns());
if (a0.isA(StringType))
delete reg;
if (id == Search) {
......@@ -242,7 +243,16 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
do {
int **ovector = regExpObj->registerRegexp( reg, u );
UString mstr = reg->match(u, lastIndex, &pos, ovector);
regExpObj->setSubPatterns(reg->subPatterns());
if (pos == -1)
break;
len = mstr.size();
// special case of empty match
if (len == 0 && lastIndex > 0) {
pos = lastIndex + 1;
if (pos > u.size())
break;
}
UString rstr(u3);
bool ok;
// check if u3 matches $1 or $2 etc
......@@ -262,10 +272,9 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
}
}
lastIndex = pos + rstr.size();
if ( pos != -1 )
u = u.substr(0, pos) + rstr + u.substr(pos + len);
u = u.substr(0, pos) + rstr + u.substr(pos + len);
//fprintf(stderr,"pos=%d,len=%d,lastIndex=%d,u=%s\n",pos,len,lastIndex,u.ascii());
} while ( global && pos != -1 );
} while (global);
result = String(u);
} else { // First arg is a string
......
......@@ -21,9 +21,6 @@
*/
#include <stdio.h>
#if !APPLE_CHANGES
#include <iostream.h>
#endif
#include "value.h"
#include "object.h"
......
......@@ -423,7 +423,7 @@ double UString::toDouble( bool tolerant ) const
// empty string ?
if (*c == '\0')
return 0.0;
return tolerant ? NaN : 0.0;
// hex number ?
if (*c == '0' && (*(c+1) == 'x' || *(c+1) == 'X')) {
......
......@@ -64,6 +64,7 @@ ValueImp::ValueImp() :
ValueImp::~ValueImp()
{
//fprintf(stderr,"ValueImp::~ValueImp %p\n",(void*)this);
_flags |= VI_DESTRUCTED;
}
void ValueImp::mark()
......
......@@ -160,7 +160,8 @@ namespace KJS {
enum {
VI_MARKED = 1,
VI_GCALLOWED = 2,
VI_CREATED = 4
VI_CREATED = 4,
VI_DESTRUCTED = 8
}; // VI means VALUEIMPL
ValueImpPrivate *_vd;
......
2002-06-10 Darin Adler <darin@apple.com>
Merged in changes from KDE 3.0.1.
* kwq/kdecore/kurl.h:
* kwq/KWQKURL.mm: (operator==): New, needed by some 3.0.1 code.
* kwq/qt/qpalette.h: Add QPalette::NColorGroups and QColorGroup::NColorRoles.
* kwq/KWQPalette.mm: Simplify by getting rid of "private" indirection.
(QPalette::color): New, needed by some 3.0.1 code.
* kwq/KWQColorGroup.mm: Simplify by getting rid of "private" indirection.
* kwq/qt/qstring.h:
* kwq/KWQString.mm: (QConstString::QConstString): Change parameter to const QChar *
to match Qt so we compile.
* kwq/qt/qtextedit.h:
* kwq/KWQTextEdit.mm: (QTextEdit::setTabStopWidth): Add unimplemented placeholder,
needed by some 3.0.1 code.