Compare commits

..

22 Commits

Author SHA1 Message Date
(no author)
e99fb1da7b This commit was manufactured by cvs2svn to create branch 'jsd'.
git-svn-id: svn://10.0.0.236/branches/jsd@10728 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-22 23:39:14 +00:00
fur%netscape.com
a4156ea8c1 Fix windows compilation error
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10727 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-22 23:39:13 +00:00
fur%netscape.com
4e17e7d0b6 Updated dependencies
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10723 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-22 23:27:41 +00:00
fur%netscape.com
0b9f4a6066 Make it build on the Mac
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10669 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-22 02:57:17 +00:00
fur%netscape.com
88e2efb86c Make it build on the Mac
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10668 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-22 02:47:25 +00:00
fur%netscape.com
f70c006cd2 Strange...some initialization of prmjtime.c is actually done in NSPR.
I had to copy the routines out of prtime.c so that prmjtime.c would
not be dependent on NSPR.


git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10666 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-22 02:37:06 +00:00
fur%netscape.com
2d43318eeb Replace PR_snprintf's
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10655 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-22 02:07:32 +00:00
fur%netscape.com
464cfb0128 + Added missing conversion of PR_*printf functions to JS_*printf.
+ Changed jsopcode.def to jsopcode.tbl


git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10653 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-22 01:52:52 +00:00
fur%netscape.com
ccd9fea75c *** empty log message ***
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10633 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 23:28:00 +00:00
fur%netscape.com
adbbf081d4 Changes to build ref/src merged files on Win32 platform.
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10607 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 20:04:13 +00:00
fur%netscape.com
087895e0d4 Standalone makefiles for js ref/src merge
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10606 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 20:03:11 +00:00
fur%netscape.com
f53236bbe5 Replaced with js*.h
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10598 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 18:58:46 +00:00
fur%netscape.com
4525a93346 Replaced with jsdtoa.c
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10597 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 18:57:51 +00:00
fur%netscape.com
92ce8e0953 This check-in is a first attempt at reducing JavaScript's dependency
on NSPR.


git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10589 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 17:54:36 +00:00
fur%netscape.com
4f506cbcbc prarena.c is now jsarena.c
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10586 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 17:47:37 +00:00
fur%netscape.com
53fed9d6ad This check-in is a first attempt at reducing JavaScript's dependency
on NSPR.  In fact, the JS C-engine no longer depends on NSPR at all in
a single-threaded environment and the multi-threaded version relies on
NSPR strictly for its threading primitives.  This change was made for
several reasons:

 + To merge the js/src and js/ref directories, which differ only in that
   the former is designed to link with NSPR2, but the latter makes use of
   an NSPR1 subset.  The automatic generation of src from ref often led
   to confusion and sometimes to merge-related errors.

 + To avoid the requirement to link against multiple versions of NSPR
   when delivering JS binaries. (Different internal customers of JS have
   standardized upon different NSPR releases.)

 + To shield JS from incompatible changes to NSPR.

Most of the changes involved simple renaming of types, macros,
identifiers and file names, i.e. from pr* to js*.  In some cases, this
transformation resulted in name collisions and a different name was
chosen.  One place where renaming was *not* performed was in the
definition of simple scalar types, i.e. int32, uint16, etc.  The
jsotypes.h header file was specially handled so as to avoid typename
collision with NSPR types of the same name.


git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10585 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 17:45:48 +00:00
fur%netscape.com
a7fb2e53b5 Removing dependency on NSPR
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10579 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 17:21:23 +00:00
(no author)
cddacc3fc7 This commit was manufactured by cvs2svn to create branch
'SpiderMonkey140_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10431 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-18 19:56:46 +00:00
fur%netscape.com
6f925ed79a We decided not to do mini-nspr
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10422 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-18 18:21:58 +00:00
fur%netscape.com
91ff9d9174 Checkpoint mini-nspr files, even though we're probably not going to use mini-nspr
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@10292 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-17 18:55:29 +00:00
fur%netscape.com
cb5c11135f Make it build on unix
git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@9520 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-08 19:58:23 +00:00
(no author)
d02f29a398 This commit was manufactured by cvs2svn to create branch
'SpiderMonkey140_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SpiderMonkey140_BRANCH@9511 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-08 19:08:10 +00:00
258 changed files with 75776 additions and 5646 deletions

View File

@@ -1,19 +0,0 @@
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = \
base \
pgsql \
build
ifdef ENABLE_TESTS
DIRS += \
sqltest \
tests
endif
include $(topsrcdir)/config/rules.mk

View File

@@ -1,11 +0,0 @@
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DIRS = \
public \
src \
resources
include $(topsrcdir)/config/rules.mk

View File

@@ -1,19 +0,0 @@
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
MODULE = sql
XPIDLSRCS = \
mozISqlConnection.idl \
mozISqlRequest.idl \
mozISqlDataSource.idl \
mozISqlInputStream.idl \
mozISqlRequestObserver.idl \
mozISqlResult.idl \
mozISqlResultEnumerator.idl \
mozISqlService.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,124 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Varga <varga@utcru.sk>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface mozISqlResult;
interface mozISqlRequest;
interface mozISqlRequestObserver;
/**
* @status UNDER_REVIEW
*/
[scriptable, uuid(f16397a4-1ecb-4e08-84f8-27750c04b779)]
interface mozISqlConnection : nsISupports
{
readonly attribute AString serverVersion;
/**
* The most recent error message.
*/
readonly attribute AString errorMessage;
/**
* The ID of the most recently added record.
*/
readonly attribute long lastID;
/**
* Set up the connection.
*
* @param aHost The host name.
* @param aPort The port at which the host is listening.
* @param aDatabase The real database name to connect to.
* @param aUsername The username to connect as.
* @param aPassword The password to use in authentification phase.
*/
void init(in AString aHost,
in long aPort,
in AString aDatabase,
in AString aUsername,
in AString aPassword);
/**
* Execute the query synchronously and return database result.
*
* @param aQuery The query to execute.
*/
mozISqlResult executeQuery(in AString aQuery);
/**
* Execute the update synchronously and return number of updated rows.
*
* @param aUpdate The update to execute.
*/
long executeUpdate(in AString aUpdate);
mozISqlRequest asyncExecuteQuery(in AString aQuery,
in nsISupports aContext,
in mozISqlRequestObserver aObserver);
mozISqlRequest asyncExecuteUpdate(in AString aQuery,
in nsISUpports aContext,
in mozISqlRequestObserver aObserver);
/**
* Begin transaction.
*/
void beginTransaction();
/**
* Commit transaction.
*/
void commitTransaction();
/**
* Rollback transaction.
*/
void rollbackTransaction();
/**
* Get primary keys.
*
* @param aSchema The schema.
* @param aTable The table name.
*/
mozISqlResult getPrimaryKeys(in AString aSchema, in AString aTable);
};

View File

@@ -1,65 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Varga <varga@utcru.sk>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIRDFResource;
/**
* @status UNDER_REVIEW
*/
[scriptable, uuid(3c0a954f-b595-46a4-932c-3660f55e2e10)]
interface mozISqlDataSource : nsISupports
{
/**
* Retrieve the RDF resource associated with the specified row.
*
* @param aRowIndex The row index.
*/
nsIRDFResource getResourceAtIndex(in long aRowIndex);
/**
* Retrieve the index associated with specified RDF resource.
*
* @param aResource The resource.
*/
long getIndexOfResource(in nsIRDFResource aResource);
};

View File

@@ -1,52 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Varga <varga@utcru.sk>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
/**
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(555f2485-ba82-4c5c-9dd2-d801104dc09e)]
interface mozISqlInputStream : nsISupports
{
AString getColumnHeader(in long aColumnIndex);
void setColumnHeader(in long aColumnIndex, in AString aLabel);
};

View File

@@ -1,77 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Varga <varga@utcru.sk>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface mozISqlConnection;
interface mozISqlRequestObserver;
interface mozISqlResult;
/**
* @status UNDER_REVIEW
*/
[scriptable, uuid(f67cb817-5e07-49ff-aacc-5c80585c5031)]
interface mozISqlRequest : nsISupports
{
readonly attribute AString errorMessage;
readonly attribute mozISqlResult result;
readonly attribute long affectedRows;
readonly attribute long lastID;
readonly attribute AString query;
readonly attribute nsISupports ctxt;
readonly attribute mozISqlRequestObserver observer;
const long STATUS_NONE = 0;
const long STATUS_EXECUTED = 1;
const long STATUS_COMPLETE = 2;
const long STATUS_ERROR = 3;
const long STATUS_CANCELLED = 4;
readonly attribute long status;
void cancel();
};

View File

@@ -1,56 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Varga <varga@utcru.sk>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface mozISqlRequest;
/**
* @status UNDER_REVIEW
*/
[scriptable, uuid(9e950bc0-e252-41ef-ac6f-3e3c4acd9dd8)]
interface mozISqlRequestObserver : nsISupports
{
void onStartRequest(in mozISqlRequest aRequest,
in nsISupports aContext);
void onStopRequest(in mozISqlRequest aRequest,
in nsISupports aContext);
};

View File

@@ -1,87 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Varga <varga@utcru.sk>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface mozISqlConnection;
interface mozISqlResultEnumerator;
interface mozISqlInputStream;
/**
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(08c220b0-7140-456a-89e9-c94609a7392d)]
interface mozISqlResult : nsISupports
{
readonly attribute mozISqlConnection connection;
readonly attribute AString query;
readonly attribute AString tableName;
readonly attribute long rowCount;
readonly attribute long columnCount;
AString getColumnName(in long aColumnIndex);
long getColumnIndex(in AString aColumnName);
const long TYPE_STRING = 1;
const long TYPE_INT = 2;
const long TYPE_FLOAT = 3;
const long TYPE_DECIMAL = 4;
const long TYPE_DATE = 5;
const long TYPE_TIME = 6;
const long TYPE_DATETIME = 7;
const long TYPE_BOOL = 8;
long getColumnType(in long aColumnIndex);
AString getColumnTypeAsString(in long aColumnIndex);
long getColumnDisplaySize(in long aColumnIndex);
mozISqlResultEnumerator enumerate();
mozISqlInputStream open();
void reload();
};

View File

@@ -1,126 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Varga <varga@utcru.sk>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIVariant;
/**
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(dcc0d29e-2b44-460e-b39f-89121ff8b963)]
interface mozISqlResultEnumerator : nsISupports
{
readonly attribute AString errorMessage;
boolean next();
boolean previous();
void beforeFirst();
void first();
void last();
void relative(in long aRows);
void absolute(in long aRowIndex);
boolean isNull(in long aColumnIndex);
nsIVariant getVariant(in long aColumnIndex);
AString getString(in long aColumnIndex);
long getInt(in long aColumnIndex);
float getFloat(in long aColumnIndex);
float getDecimal(in long aColumnIndex);
long long getDate(in long aColumnIndex);
boolean getBool(in long aColumnIndex);
void setNull(in long aColumnIndex);
void setDefault(in long aColumnIndex);
void copy(in long aColumnIndex);
void setVariant(in long aColumnIndex, in nsIVariant aValue);
void setString(in long aColumnIndex, in AString aValue);
void setInt(in long aColumnIndex, in long aValue);
void setFloat(in long aColumnIndex, in float aValue);
void setDecimal(in long aColumnIndex, in float aValue);
void setDate(in long aColumnIndex, in long long aValue);
void setBool(in long aColumnIndex, in boolean aValue);
void setNullValues();
void setDefaultValues();
void copyValues();
boolean canInsert();
boolean canUpdate();
boolean canDelete();
long insertRow();
long updateRow();
long deleteRow();
readonly attribute AString currentCondition;
};

View File

@@ -1,81 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Varga <varga@utcru.sk>
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface mozISqlConnection;
/**
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(1ceb35b7-daa8-4ce4-ac67-125fb17cb019)]
interface mozISqlService : nsISupports
{
readonly attribute AString errorMessage;
void addAlias(in ACString aURI,
in AString aName,
in AString aType,
in AString aHostname,
in long aPort,
in AString aDatabase);
boolean hasAlias(in ACString aURI);
void getAlias(in ACString aURI,
out AString aName,
out AString aType,
out AString aHostname,
out long aPort,
out AString aDatabase);
void updateAlias(in ACString aURI,
in AString aName,
in AString aType,
in AString aHostname,
in long aPort,
in AString aDatabase);
void removeAlias(in ACString aURI);
mozISqlConnection getConnection(in ACString aURI);
mozISqlConnection getNewConnection(in ACString aURI);
};

View File

@@ -1,6 +0,0 @@
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(topsrcdir)/config/rules.mk

View File

@@ -1,39 +0,0 @@
var sqlService = null;
var name;
var type;
var hostname;
var port;
var database;
function init() {
sqlService = Components.classes["@mozilla.org/sql/service;1"]
.getService(Components.interfaces.mozISqlService);
name = document.getElementById("name");
type = document.getElementById("type");
hostname = document.getElementById("hostname");
port = document.getElementById("port");
database = document.getElementById("database");
if (window.arguments) {
// get original values
var uri = window.arguments[0];
sqlService.getAlias(uri, name, type, hostname, port, database);
}
}
function onAccept() {
if (window.arguments) {
// update an existing alias
var uri = window.arguments[0];
sqlService.updateAlias(uri, name.value, type.value, hostname.value,
port.value, database.value);
}
else {
// add a new database
var uri = "urn:aliases:" + name.value;
sqlService.addAlias(uri, name.value, type.value, hostname.value,
port.value, database.value);
}
}

View File

@@ -1,46 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://sql/locale/aliasDialog.dtd">
<dialog id="aliasDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&window.title;"
width="250" height="180"
buttons="accept,cancel" buttonpack="center"
ondialogaccept="return onAccept(event);"
onload="init()">
<script type="application/x-javascript" src="aliasDialog.js"/>
<grid flex="1">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row>
<label value="&name.label;"/>
<textbox id="name"/>
</row>
<row>
<label value="&type.label;"/>
<textbox id="type"/>
</row>
<row>
<label value="&hostname.label;"/>
<textbox id="hostname"/>
</row>
<row>
<label value="&port.label;"/>
<textbox id="port"/>
</row>
<row>
<label value="&database.label;"/>
<textbox id="database"/>
</row>
</rows>
</grid>
</dialog>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:sql"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:sql"
chrome:displayName="SQL support"
chrome:author="mozilla.org"
chrome:authorURL="http://www.mozilla.org/projects/sql/index.html"
chrome:name="sql"
chrome:extension="true"
chrome:settingsURL="chrome://sql/content/sqlSettings.xul"
chrome:description="Allow applications to directly connect to SQL databases.">
</RDF:Description>
</RDF:RDF>

View File

@@ -1,36 +0,0 @@
var sqlService = null;
function getSqlService() {
if (! sqlService)
sqlService = Components.classes["@mozilla.org/sql/service;1"]
.getService(Components.interfaces.mozISqlService);
return sqlService;
}
function getSelectedAlias() {
var tree = document.getElementById("aliasesTree");
return tree.builderView.getResourceAtIndex(tree.currentIndex).Value;
}
function updateButtons() {
var tree = document.getElementById("aliasesTree");
const buttons = ["updateButton", "removeButton"];
for (i = 0; i < buttons.length; i++)
document.getElementById(buttons[i]).disabled = tree.currentIndex < 0;
}
function addAlias() {
window.openDialog("aliasDialog.xul", "addAlias", "chrome,modal=yes,resizable=no,centerscreen");
}
function updateAlias() {
var alias = getSelectedAlias();
window.openDialog("aliasDialog.xul", "updateDatabase", "chrome,modal=yes,resizable=no,centerscreen", alias);
}
function removeAlias() {
var sqlService = getSqlService();
var alias = getSelectedAlias();
sqlService.removeAlias(alias);
updateButtons();
}

View File

@@ -1,55 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://sql/locale/sqlSettings.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&header.label;"
width="450" height="350">
<script type="application/x-javascript" src="sqlSettings.js"/>
<groupbox flex="1">
<caption label="&aliases.label;"/>
<hbox flex="1">
<tree id="aliasesTree" flex="1"
seltype="single"
datasources="rdf:sql" ref="SQL:AliasesRoot" flags="dont-build-content"
onselect="updateButtons()">
<treecols>
<treecol id="nameCol" flex="1" label="&nameCol.label;"
sort="rdf:http://www.mozilla.org/SQL-rdf#name"
sortActive="true" sortDirection="ascending"/>
<treecol id="typeCol" flex="1" label="&typeCol.label;"
sort="rdf:http://www.mozilla.org/SQL-rdf#type"/>
<treecol id="hostnameCol" flex="1" label="&hostnameCol.label;"
sort="rdf:http://www.mozilla.org/SQL-rdf#hostname"/>
<treecol id="portCol" flex="1" label="&portCol.label;"
sort="rdf:http://www.mozilla.org/SQL-rdf#port"/>
<treecol id="databaseCol" flex="1" label="&databaseCol.label;"
sort="rdf:http://www.mozilla.org/SQL-rdf#database"/>
</treecols>
<template>
<treechildren>
<treeitem uri="rdf:*">
<treerow>
<treecell label="rdf:http://www.mozilla.org/SQL-rdf#name"/>
<treecell label="rdf:http://www.mozilla.org/SQL-rdf#type"/>
<treecell label="rdf:http://www.mozilla.org/SQL-rdf#hostname"/>
<treecell label="rdf:http://www.mozilla.org/SQL-rdf#port"/>
<treecell label="rdf:http://www.mozilla.org/SQL-rdf#database"/>
</treerow>
</treeitem>
</treechildren>
</template>
</tree>
<vbox>
<button id="addButton" label="&add.label;" oncommand="addAlias()"/>
<button id="updateButton" label="&update.label;" disabled="true" oncommand="updateAlias()"/>
<button id="removeButton" label="&remove.label;" disabled="true" oncommand="removeAlias()"/>
</vbox>
</hbox>
</groupbox>
</dialog>

View File

@@ -1,9 +0,0 @@
sql.jar:
content/sql/contents.rdf (content/contents.rdf)
content/sql/sqlSettings.xul (content/sqlSettings.xul)
content/sql/sqlSettings.js (content/sqlSettings.js)
content/sql/aliasDialog.xul (content/aliasDialog.xul)
content/sql/aliasDialog.js (content/aliasDialog.js)
locale/en-US/sql/contents.rdf (locale/en-US/contents.rdf)
locale/en-US/sql/sqlSettings.dtd (locale/en-US/sqlSettings.dtd)
locale/en-US/sql/aliasDialog.dtd (locale/en-US/aliasDialog.dtd)

View File

@@ -1,7 +0,0 @@
<!ENTITY window.title "Alias">
<!ENTITY name.label "Name:">
<!ENTITY type.label "Type:">
<!ENTITY hostname.label "Hostname:">
<!ENTITY port.label "Port:">
<!ENTITY database.label "Database:">

View File

@@ -1,23 +0,0 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the locales being supplied by this package -->
<RDF:Seq about="urn:mozilla:locale:root">
<RDF:li resource="urn:mozilla:locale:en-US"/>
</RDF:Seq>
<!-- locale information -->
<RDF:Description about="urn:mozilla:locale:en-US"
chrome:displayName="English(US)"
chrome:author="mozilla.org"
chrome:name="en-US"
chrome:previewURL="http://www.mozilla.org/locales/en-US.gif">
<chrome:packages>
<RDF:Seq about="urn:mozilla:locale:en-US:packages">
<RDF:li resource="urn:mozilla:locale:en-US:sql"/>
</RDF:Seq>
</chrome:packages>
</RDF:Description>
</RDF:RDF>

View File

@@ -1,12 +0,0 @@
<!ENTITY header.label "SQL support">
<!ENTITY aliases.label "Aliases">
<!ENTITY nameCol.label "Name">
<!ENTITY typeCol.label "Type">
<!ENTITY hostnameCol.label "Hostname">
<!ENTITY portCol.label "Port">
<!ENTITY databaseCol.label "Database">
<!ENTITY add.label "Add alias">
<!ENTITY update.label "Update alias">
<!ENTITY remove.label "Remove alias">

View File

@@ -1,33 +0,0 @@
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = sql
LIBRARY_NAME = sqlbase_s
REQUIRES = xpcom \
string \
unicharutil \
locale \
necko \
rdf \
windowwatcher \
$(NULL)
CPPSRCS = \
mozSqlConnection.cpp \
mozSqlRequest.cpp \
mozSqlResult.cpp \
mozSqlService.cpp
EXPORTS = \
mozSqlConnection.h \
mozSqlRequest.h \
mozSqlResult.h \
mozSqlService.h
FORCE_STATIC_LIB=1
include $(topsrcdir)/config/rules.mk

View File

@@ -1,237 +0,0 @@
#include "nsIProxyObjectManager.h"
#include "mozSqlRequest.h"
#include "mozSqlConnection.h"
mozSqlConnection::mozSqlConnection()
: mLock(nsnull),
mCondVar(nsnull),
mThread(nsnull),
mShutdown(PR_FALSE),
mWaiting(PR_FALSE)
{
NS_INIT_ISUPPORTS();
mExecLock = PR_NewLock();
}
mozSqlConnection::~mozSqlConnection()
{
mRequests.Clear();
if (mCondVar)
PR_DestroyCondVar(mCondVar);
PR_DestroyLock(mExecLock);
if (mLock)
PR_DestroyLock(mLock);
}
// We require a special implementation of Release, which knows about
// a circular strong reference
NS_IMPL_THREADSAFE_ADDREF(mozSqlConnection)
NS_IMPL_THREADSAFE_QUERY_INTERFACE3(mozSqlConnection,
mozISqlConnection,
nsIRunnable,
nsISupportsWeakReference)
NS_IMETHODIMP_(nsrefcnt)
mozSqlConnection::Release()
{
PR_AtomicDecrement((PRInt32*)&mRefCnt);
// Delete if the last reference is our strong circular reference.
if (mThread && mRefCnt == 1) {
PR_Lock(mLock);
mRequests.Clear();
mShutdown = PR_TRUE;
if (mWaiting)
PR_NotifyCondVar(mCondVar);
else
CancelExec();
PR_Unlock(mLock);
return 0;
}
else if (mRefCnt == 0) {
delete this;
return 0;
}
return mRefCnt;
}
NS_IMETHODIMP
mozSqlConnection::GetServerVersion(nsAString& aServerVersion)
{
aServerVersion = mServerVersion;
return NS_OK;
}
NS_IMETHODIMP
mozSqlConnection::GetErrorMessage(nsAString& aErrorMessage)
{
aErrorMessage = mErrorMessage;
return NS_OK;
}
NS_IMETHODIMP
mozSqlConnection::GetLastID(PRInt32* aLastID)
{
*aLastID = mLastID;
return NS_OK;
}
NS_IMETHODIMP
mozSqlConnection::Init(const nsAString & aHost, PRInt32 aPort,
const nsAString & aDatabase, const nsAString & aUsername,
const nsAString & aPassword)
{
// descendants have to implement this themselves
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
mozSqlConnection::ExecuteQuery(const nsAString& aQuery, mozISqlResult** _retval)
{
PR_Lock(mExecLock);
nsresult rv = RealExec(aQuery, _retval, nsnull);
PR_Unlock(mExecLock);
return rv;
}
NS_IMETHODIMP
mozSqlConnection::ExecuteUpdate(const nsAString& aUpdate, PRInt32* _retval)
{
PR_Lock(mExecLock);
nsresult rv = RealExec(aUpdate, nsnull, _retval);
PR_Unlock(mExecLock);
return rv;
}
NS_IMETHODIMP
mozSqlConnection::AsyncExecuteQuery(const nsAString& aQuery, nsISupports* aCtxt,
mozISqlRequestObserver* aObserver,
mozISqlRequest **_retval)
{
if (!mThread) {
mLock = PR_NewLock();
mCondVar = PR_NewCondVar(mLock);
NS_NewThread(getter_AddRefs(mThread), this, 0, PR_UNJOINABLE_THREAD);
}
mozSqlRequest* request = new mozSqlRequest(this);
if (! request)
return NS_ERROR_OUT_OF_MEMORY;
request->mIsQuery = PR_TRUE;
request->mQuery = aQuery;
request->mCtxt = aCtxt;
nsresult rv = NS_GetProxyForObject(NS_CURRENT_EVENTQ,
NS_GET_IID(mozISqlRequestObserver),
aObserver,
PROXY_SYNC | PROXY_ALWAYS,
getter_AddRefs(request->mObserver));
if (NS_FAILED(rv))
return rv;
PR_Lock(mLock);
mRequests.AppendObject(request);
if (mWaiting && mRequests.Count() == 1)
PR_NotifyCondVar(mCondVar);
PR_Unlock(mLock);
NS_ADDREF(*_retval = request);
return NS_OK;
}
NS_IMETHODIMP
mozSqlConnection::AsyncExecuteUpdate(const nsAString& aQuery, nsISupports* aCtxt,
mozISqlRequestObserver* aObserver,
mozISqlRequest **_retval)
{
return NS_OK;
}
NS_IMETHODIMP
mozSqlConnection::BeginTransaction()
{
PRInt32 affectedRows;
return ExecuteUpdate(NS_LITERAL_STRING("begin"), &affectedRows);
}
NS_IMETHODIMP
mozSqlConnection::CommitTransaction()
{
PRInt32 affectedRows;
return ExecuteUpdate(NS_LITERAL_STRING("commit"), &affectedRows);
}
NS_IMETHODIMP
mozSqlConnection::RollbackTransaction()
{
PRInt32 affectedRows;
return ExecuteUpdate(NS_LITERAL_STRING("rollback"), &affectedRows);
}
NS_IMETHODIMP
mozSqlConnection::GetPrimaryKeys(const nsAString& aSchema, const nsAString& aTable, mozISqlResult** _retval)
{
// descendants have to implement this themselves
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
mozSqlConnection::Run()
{
while(!mShutdown) {
PR_Lock(mLock);
while (mRequests.Count()) {
mCurrentRequest = mRequests[0];
mRequests.RemoveObjectAt(0);
mozSqlRequest* r = (mozSqlRequest*)mCurrentRequest.get();
r->mObserver->OnStartRequest(mCurrentRequest, r->mCtxt);
r->mStatus = mozISqlRequest::STATUS_EXECUTED;
PR_Unlock(mLock);
nsresult rv = ExecuteQuery(r->mQuery, getter_AddRefs(r->mResult));
PR_Lock(mLock);
if (NS_SUCCEEDED(rv))
r->mStatus = mozISqlRequest::STATUS_COMPLETE;
else {
r->mStatus = mozISqlRequest::STATUS_ERROR;
GetErrorMessage(r->mErrorMessage);
}
r->mObserver->OnStopRequest(mCurrentRequest, r->mCtxt);
mCurrentRequest = nsnull;
}
mWaiting = PR_TRUE;
PR_WaitCondVar(mCondVar, PR_INTERVAL_NO_TIMEOUT);
mWaiting = PR_FALSE;
PR_Unlock(mLock);
}
return NS_OK;
}
nsresult
mozSqlConnection::CancelRequest(mozISqlRequest* aRequest)
{
PR_Lock(mLock);
if (mCurrentRequest == aRequest)
CancelExec();
else {
if (mRequests.RemoveObject(aRequest))
((mozSqlRequest*)aRequest)->mStatus = mozISqlRequest::STATUS_CANCELLED;
}
PR_Unlock(mLock);
return NS_OK;
}

View File

@@ -1,53 +0,0 @@
#ifndef mozSqlConnection_h
#define mozSqlConnection_h
#include "prcvar.h"
#include "nsString.h"
#include "nsCOMArray.h"
#include "nsWeakReference.h"
#include "nsIThread.h"
#include "nsIRunnable.h"
#include "mozISqlConnection.h"
#include "mozISqlRequest.h"
#include "mozISqlResult.h"
class mozSqlConnection : public mozISqlConnection,
public nsIRunnable,
public nsSupportsWeakReference
{
public:
mozSqlConnection();
virtual ~mozSqlConnection();
NS_DECL_ISUPPORTS
NS_DECL_MOZISQLCONNECTION
NS_DECL_NSIRUNNABLE
friend class mozSqlRequest;
friend class mozSqlResult;
protected:
virtual nsresult RealExec(const nsAString& aQuery,
mozISqlResult** aResult, PRInt32* aAffectedRows) = 0;
virtual nsresult CancelExec() = 0;
virtual nsresult GetIDName(nsAString& aIDName) = 0;
nsresult CancelRequest(mozISqlRequest* aRequest);
nsString mServerVersion;
nsString mErrorMessage;
PRInt32 mLastID;
PRLock* mLock;
PRCondVar* mCondVar;
PRLock* mExecLock;
nsCOMPtr<nsIThread> mThread;
nsCOMArray<mozISqlRequest> mRequests;
nsCOMPtr<mozISqlRequest> mCurrentRequest;
PRBool mShutdown;
PRBool mWaiting;
};
#endif // mozSqlConnection_h

View File

@@ -1,86 +0,0 @@
#include "mozSqlConnection.h"
#include "mozSqlRequest.h"
mozSqlRequest::mozSqlRequest(mozISqlConnection* aConnection)
: mAffectedRows(-1),
mIsQuery(PR_TRUE),
mStatus(mozISqlRequest::STATUS_NONE)
{
NS_INIT_ISUPPORTS();
mConnection = do_GetWeakReference(aConnection);
}
mozSqlRequest::~mozSqlRequest()
{
}
NS_IMPL_THREADSAFE_ISUPPORTS1(mozSqlRequest,
mozISqlRequest);
NS_IMETHODIMP
mozSqlRequest::GetErrorMessage(nsAString & aErrorMessage)
{
aErrorMessage = mErrorMessage;
return NS_OK;
}
NS_IMETHODIMP
mozSqlRequest::GetResult(mozISqlResult * *aResult)
{
NS_IF_ADDREF(*aResult = mResult);
return NS_OK;
}
NS_IMETHODIMP
mozSqlRequest::GetAffectedRows(PRInt32 *aAffectedRows)
{
*aAffectedRows = mAffectedRows;
return NS_OK;
}
NS_IMETHODIMP
mozSqlRequest::GetLastID(PRInt32* aLastID)
{
*aLastID = mLastID;
return NS_OK;
}
NS_IMETHODIMP
mozSqlRequest::GetQuery(nsAString & aQuery)
{
aQuery = mQuery;
return NS_OK;
}
NS_IMETHODIMP
mozSqlRequest::GetCtxt(nsISupports * *aCtxt)
{
NS_IF_ADDREF(*aCtxt = mCtxt);
return NS_OK;
}
NS_IMETHODIMP
mozSqlRequest::GetObserver(mozISqlRequestObserver * *aObserver)
{
NS_IF_ADDREF(*aObserver = mObserver);
return NS_OK;
}
NS_IMETHODIMP
mozSqlRequest::GetStatus(PRInt32 *aStatus)
{
*aStatus = mStatus;
return NS_OK;
}
NS_IMETHODIMP
mozSqlRequest::Cancel()
{
nsCOMPtr<mozISqlConnection> connection = do_QueryReferent(mConnection);
if (!connection)
return NS_ERROR_FAILURE;
mozISqlConnection* connectionRaw = connection.get();
return ((mozSqlConnection*)connectionRaw)->CancelRequest(this);
}

View File

@@ -1,41 +0,0 @@
#ifndef mozSqlRequest_h
#define mozSqlRequest_h
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsIWeakReference.h"
#include "mozISqlConnection.h"
#include "mozISqlResult.h"
#include "mozISqlRequest.h"
#include "mozISqlRequestObserver.h"
class mozSqlRequest : public mozISqlRequest
{
public:
mozSqlRequest(mozISqlConnection* aConnection);
virtual ~mozSqlRequest();
NS_DECL_ISUPPORTS
NS_DECL_MOZISQLREQUEST
friend class mozSqlConnection;
protected:
nsCOMPtr<nsIWeakReference> mConnection;
nsString mErrorMessage;
nsCOMPtr<mozISqlResult> mResult;
PRInt32 mAffectedRows;
PRInt32 mLastID;
PRBool mIsQuery;
nsString mQuery;
nsCOMPtr<nsISupports> mCtxt;
nsCOMPtr<mozISqlRequestObserver> mObserver;
PRInt32 mStatus;
};
#endif // mozSqlRequest_h

File diff suppressed because it is too large Load Diff

View File

@@ -1,367 +0,0 @@
#ifndef mozSqlResult_h
#define mozSqlResult_h
#include "nsCRT.h"
#include "nsFixedSizeAllocator.h"
#include "nsVoidArray.h"
#include "nsCOMArray.h"
#include "nsHashtable.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include "nsISimpleEnumerator.h"
#include "nsIRDFService.h"
#include "nsIRDFDataSource.h"
#include "nsIRDFRemoteDataSource.h"
#include "nsIDateTimeFormat.h"
#include "nsIInputStream.h"
#include "mozISqlConnection.h"
#include "mozISqlDataSource.h"
#include "mozISqlResult.h"
#include "mozISqlResultEnumerator.h"
#include "mozISqlInputStream.h"
#define CELL_FLAG_NULL 0x80
#define CELL_FLAG_DEFAULT 0x40
#define CELL_FLAG_MASK ~(CELL_FLAG_NULL | CELL_FLAG_DEFAULT)
class ColumnInfo {
public:
static ColumnInfo*
Create(nsFixedSizeAllocator& aAllocator,
PRUnichar* aName,
PRInt32 aType,
PRInt32 aSize,
PRInt32 aMod,
nsIRDFResource* aProperty) {
void* place = aAllocator.Alloc(sizeof(ColumnInfo));
return place ? ::new(place) ColumnInfo(aName, aType, aSize, aMod, aProperty) : nsnull;
}
static void
Destroy(nsFixedSizeAllocator& aAllocator, ColumnInfo* aColumnInfo) {
aColumnInfo->~ColumnInfo();
aAllocator.Free(aColumnInfo, sizeof(ColumnInfo));
}
ColumnInfo(PRUnichar* aName, PRInt32 aType, PRInt32 aSize, PRInt32 aMod, nsIRDFResource* aProperty)
: mName(aName),
mType(aType),
mSize(aSize),
mMod(aMod),
mProperty(aProperty) {
NS_IF_ADDREF(mProperty);
}
~ColumnInfo() {
if (mName)
nsMemory::Free(mName);
NS_IF_RELEASE(mProperty);
}
PRUnichar* mName;
PRInt32 mType;
PRInt32 mSize;
PRInt32 mMod;
nsIRDFResource* mProperty;
private:
// Hide so that only Create() and Destroy() can be used to
// allocate and deallocate from the heap
static void* operator new(size_t) CPP_THROW_NEW { return 0; }
static void operator delete(void*, size_t) {}
};
class Cell {
public:
static Cell*
Create(nsFixedSizeAllocator& aAllocator,
PRInt32 aType) {
void* place = aAllocator.Alloc(sizeof(Cell));
return place ? ::new(place) Cell(aType) : nsnull;
}
static Cell*
Create(nsFixedSizeAllocator& aAllocator,
PRInt32 aType,
Cell* aSrcCell) {
void* place = aAllocator.Alloc(sizeof(Cell));
if (! place)
return nsnull;
Cell* newCell = ::new(place) Cell(aType);
Copy(aSrcCell, newCell);
return newCell;
}
static void
Copy(Cell* aSrcCell, Cell* aDestCell) {
if (aSrcCell->IsNull())
aDestCell->SetNull(PR_TRUE);
else {
aDestCell->SetNull(PR_FALSE);
PRInt32 type = aSrcCell->GetType();
if (type == mozISqlResult::TYPE_STRING)
aDestCell->SetString(nsCRT::strdup(aSrcCell->mString));
else if (type == mozISqlResult::TYPE_INT)
aDestCell->mInt = aSrcCell->mInt;
else if (type == mozISqlResult::TYPE_FLOAT ||
type == mozISqlResult::TYPE_DECIMAL)
aDestCell->mFloat = aSrcCell->mFloat;
else if (type == mozISqlResult::TYPE_DATE ||
type == mozISqlResult::TYPE_TIME ||
type == mozISqlResult::TYPE_DATETIME)
aDestCell->mDate = aSrcCell->mDate;
else if (type == mozISqlResult::TYPE_BOOL)
aDestCell->mBool = aSrcCell->mBool;
}
}
static void
Destroy(nsFixedSizeAllocator& aAllocator, Cell* aCell) {
aCell->~Cell();
aAllocator.Free(aCell, sizeof(Cell));
}
Cell(PRInt32 aType)
: mString(nsnull),
mType(aType | CELL_FLAG_NULL) {
}
~Cell() {
if ((GetType() == mozISqlResult::TYPE_STRING) && mString) {
nsMemory::Free(mString);
}
}
void SetString(PRUnichar* aString) {
if (mString)
nsMemory::Free(mString);
mString = aString;
}
PRInt32 GetType() {
return mType & CELL_FLAG_MASK;
}
void SetNull(PRBool aNull) {
mType &= CELL_FLAG_MASK;
if (aNull)
mType |= CELL_FLAG_NULL;
}
void SetDefault(PRBool aDefault) {
mType &= CELL_FLAG_MASK;
if (aDefault)
mType |= CELL_FLAG_DEFAULT;
}
PRBool IsNull() {
return mType & CELL_FLAG_NULL;
}
PRBool IsDefault() {
return mType & CELL_FLAG_DEFAULT;
}
union {
PRUnichar* mString;
PRInt32 mInt;
float mFloat;
PRInt64 mDate;
PRBool mBool;
};
private:
static void* operator new(size_t) CPP_THROW_NEW { return 0; }
static void operator delete(void*, size_t) {}
PRInt8 mType;
};
class Row {
public:
static Row*
Create(nsFixedSizeAllocator& aAllocator,
nsIRDFResource* aSource,
nsVoidArray& aColumnInfo) {
void* place = aAllocator.Alloc(sizeof(Row));
if (! place)
return nsnull;
Row* newRow = ::new(place) Row(aSource, aColumnInfo.Count());
for (PRInt32 i = 0; i < aColumnInfo.Count(); i++) {
Cell* newCell = Cell::Create(aAllocator, ((ColumnInfo*)aColumnInfo[i])->mType);
newRow->mCells[i] = newCell;
}
return newRow;
}
static Row*
Create(nsFixedSizeAllocator& aAllocator,
nsIRDFResource* aSource,
nsVoidArray& aColumnInfo,
Row* aSrcRow) {
void* place = aAllocator.Alloc(sizeof(Row));
if (! place)
return nsnull;
Row* newRow = ::new(place) Row(aSource, aColumnInfo.Count());
for (PRInt32 i = 0; i < aColumnInfo.Count(); i++) {
Cell* srcCell = aSrcRow->mCells[i];
Cell* newCell = Cell::Create(aAllocator, ((ColumnInfo*)aColumnInfo[i])->mType, srcCell);
newRow->mCells[i] = newCell;
}
return newRow;
}
static void
Copy(PRInt32 aColumnCount, Row* aSrcRow, Row* aDestRow) {
for (PRInt32 i = 0; i < aColumnCount; i++) {
Cell* srcCell = aSrcRow->mCells[i];
Cell* destCell = aDestRow->mCells[i];
Cell::Copy(srcCell, destCell);
}
}
static void
Destroy(nsFixedSizeAllocator& aAllocator, PRInt32 aColumnCount, Row* aRow) {
for (PRInt32 i = 0; i < aColumnCount; i++)
Cell::Destroy(aAllocator, aRow->mCells[i]);
aRow->~Row();
aAllocator.Free(aRow, sizeof(*aRow));
}
Row(nsIRDFResource* aSource, PRInt32 aColumnCount)
: mSource(aSource)
{
NS_IF_ADDREF(mSource);
mCells = new Cell*[aColumnCount];
}
~Row() {
delete[] mCells;
NS_IF_RELEASE(mSource);
}
nsIRDFResource* mSource;
Cell** mCells;
private:
static void* operator new(size_t) CPP_THROW_NEW { return 0; }
static void operator delete(void*, size_t) {}
};
class mozSqlResult : public mozISqlResult,
public mozISqlDataSource,
public nsIRDFDataSource,
public nsIRDFRemoteDataSource
{
public:
mozSqlResult(mozISqlConnection* aConnection,
const nsAString& aQuery);
nsresult Init();
nsresult Rebuild();
virtual ~mozSqlResult();
NS_DECL_ISUPPORTS
NS_DECL_MOZISQLRESULT
NS_DECL_MOZISQLDATASOURCE
NS_DECL_NSIRDFDATASOURCE
NS_DECL_NSIRDFREMOTEDATASOURCE
friend class mozSqlResultEnumerator;
friend class mozSqlResultStream;
protected:
virtual nsresult BuildColumnInfo() = 0 ;
virtual nsresult BuildRows() = 0;
virtual void ClearNativeResult() = 0;
void ClearColumnInfo();
void ClearRows();
nsresult EnsureTableName();
nsresult EnsurePrimaryKeys();
void AppendValue(Cell* aCell, nsAutoString& aValues);
nsresult AppendKeys(Row* aRow, nsAutoString& aKeys);
nsresult GetValues(Row* aRow, mozISqlResult** aResult, PRBool aUseID);
nsresult CopyValues(mozISqlResult* aResult, Row* aRow);
virtual nsresult CanInsert(PRBool* _retval) = 0;
virtual nsresult CanUpdate(PRBool* _retval) = 0;
virtual nsresult CanDelete(PRBool* _retval) = 0;
nsresult InsertRow(Row* aSrcRow, PRInt32* _retval);
nsresult UpdateRow(PRInt32 aRowIndex, Row* aSrcRow, PRInt32* _retval);
nsresult DeleteRow(PRInt32 aRowIndex, PRInt32* _retval);
nsresult GetCondition(Row* aRow, nsAString& aCurrentCondition);
static PRInt32 gRefCnt;
static nsIRDFService* gRDFService;
static nsIDateTimeFormat* gFormat;
static nsIRDFResource* kSQL_ResultRoot;
static nsIRDFResource* kNC_Child;
static nsIRDFLiteral* kNullLiteral;
static nsIRDFLiteral* kTrueLiteral;
static nsIRDFLiteral* kFalseLiteral;
nsCOMPtr<mozISqlConnection> mConnection;
nsString mErrorMessage;
nsString mQuery;
nsString mTableName;
nsFixedSizeAllocator mAllocator;
nsAutoVoidArray mColumnInfo;
nsVoidArray mRows;
nsObjectHashtable mSources;
nsCOMArray<nsIRDFObserver> mObservers;
nsCOMPtr<mozISqlResultEnumerator> mPrimaryKeys;
PRInt32 mCanInsert;
PRInt32 mCanUpdate;
PRInt32 mCanDelete;
};
class mozSqlResultEnumerator : public mozISqlResultEnumerator,
public nsISimpleEnumerator
{
public:
mozSqlResultEnumerator(mozSqlResult* aResult);
virtual ~mozSqlResultEnumerator();
NS_DECL_ISUPPORTS
NS_DECL_MOZISQLRESULTENUMERATOR
NS_DECL_NSISIMPLEENUMERATOR
private:
mozSqlResult* mResult;
PRInt32 mCurrentIndex;
Row* mCurrentRow;
Row* mBuffer;
};
class mozSqlResultStream : public mozISqlInputStream,
public nsIInputStream
{
public:
mozSqlResultStream(mozSqlResult* aResult);
virtual ~mozSqlResultStream();
NS_DECL_ISUPPORTS
NS_DECL_MOZISQLINPUTSTREAM
NS_DECL_NSIINPUTSTREAM
protected:
nsresult EnsureBuffer();
private:
mozSqlResult* mResult;
char* mBuffer;
PRUint32 mLength;
PRUint32 mPosition;
};
#endif // mozSqlResult_h

View File

@@ -1,624 +0,0 @@
#include "nsReadableUtils.h"
#include "nsXPIDLString.h"
#include "nsCRT.h"
#include "nsIAtom.h"
#include "nsISupportsUtils.h"
#include "nsIServiceManager.h"
#include "rdf.h"
#include "nsRDFCID.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsNetUtil.h"
#include "nsIRDFXMLSink.h"
#include "nsIWindowWatcher.h"
#include "nsIPrompt.h"
#include "mozSqlService.h"
#include "mozSqlConnection.h"
#define SQL_NAMESPACE_URI "http://www.mozilla.org/SQL-rdf#"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
nsIRDFService* mozSqlService::gRDFService;
nsIRDFContainerUtils* mozSqlService::gRDFContainerUtils;
nsIRDFResource* mozSqlService::kSQL_AliasesRoot;
nsIRDFResource* mozSqlService::kSQL_Name;
nsIRDFResource* mozSqlService::kSQL_Type;
nsIRDFResource* mozSqlService::kSQL_Hostname;
nsIRDFResource* mozSqlService::kSQL_Port;
nsIRDFResource* mozSqlService::kSQL_Database;
mozSqlService::mozSqlService()
: mConnectionCache(nsnull)
{
NS_INIT_ISUPPORTS();
}
mozSqlService::~mozSqlService()
{
gRDFService->UnregisterDataSource(this);
delete mConnectionCache;
NS_IF_RELEASE(kSQL_AliasesRoot);
NS_IF_RELEASE(kSQL_Name);
NS_IF_RELEASE(kSQL_Type);
NS_IF_RELEASE(kSQL_Hostname);
NS_IF_RELEASE(kSQL_Port);
NS_IF_RELEASE(kSQL_Database);
nsServiceManager::ReleaseService(kRDFContainerUtilsCID, gRDFContainerUtils);
gRDFContainerUtils = nsnull;
nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);
gRDFService = nsnull;
}
NS_IMPL_ISUPPORTS3(mozSqlService,
mozISqlService,
nsIRDFDataSource,
nsIRDFRemoteDataSource);
NS_IMETHODIMP
mozSqlService::GetErrorMessage(nsAString& aErrorMessage)
{
aErrorMessage = mErrorMessage;
return NS_OK;
}
nsresult
mozSqlService::Init()
{
nsresult rv;
rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService),
(nsISupports**) &gRDFService);
if (NS_FAILED(rv)) return rv;
rv = nsServiceManager::GetService(kRDFContainerUtilsCID, NS_GET_IID(nsIRDFContainerUtils),
(nsISupports**) &gRDFContainerUtils);
if (NS_FAILED(rv)) return rv;
gRDFService->GetResource(NS_LITERAL_CSTRING("SQL:AliasesRoot"),
&kSQL_AliasesRoot);
gRDFService->GetResource(NS_LITERAL_CSTRING(SQL_NAMESPACE_URI "name"),
&kSQL_Name);
gRDFService->GetResource(NS_LITERAL_CSTRING(SQL_NAMESPACE_URI "type"),
&kSQL_Type);
gRDFService->GetResource(NS_LITERAL_CSTRING(SQL_NAMESPACE_URI "hostname"),
&kSQL_Hostname);
gRDFService->GetResource(NS_LITERAL_CSTRING(SQL_NAMESPACE_URI "port"),
&kSQL_Port);
gRDFService->GetResource(NS_LITERAL_CSTRING(SQL_NAMESPACE_URI "database"),
&kSQL_Database);
nsCOMPtr<nsIFile> file;
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(file));
if (NS_FAILED(rv)) return rv;
rv = file->AppendNative(NS_LITERAL_CSTRING("sql.rdf"));
if (NS_FAILED(rv)) return rv;
nsCAutoString sql;
NS_GetURLSpecFromFile(file, sql);
rv = gRDFService->GetDataSourceBlocking(sql.get(), getter_AddRefs(mInner));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIRDFXMLSink> sink = do_QueryInterface(mInner);
if (sink) {
nsCOMPtr<nsIAtom> prefix = getter_AddRefs(NS_NewAtom("SQL"));
sink->AddNameSpace(prefix, NS_ConvertASCIItoUCS2(SQL_NAMESPACE_URI));
}
return gRDFService->RegisterDataSource(this, PR_FALSE);
}
NS_IMETHODIMP
mozSqlService::AddAlias(const nsACString& aURI,
const nsAString& aName,
const nsAString& aType,
const nsAString& aHostname,
PRInt32 aPort,
const nsAString& aDatabase)
{
nsCOMPtr<nsIRDFResource> resource;
gRDFService->GetResource(aURI, getter_AddRefs(resource));
nsCOMPtr<nsIRDFLiteral> rdfLiteral;
nsCOMPtr<nsIRDFInt> rdfInt;
gRDFService->GetLiteral(PromiseFlatString(aName).get(), getter_AddRefs(rdfLiteral));
mInner->Assert(resource, kSQL_Name, rdfLiteral, PR_TRUE);
gRDFService->GetLiteral(PromiseFlatString(aType).get(), getter_AddRefs(rdfLiteral));
mInner->Assert(resource, kSQL_Type, rdfLiteral, PR_TRUE);
gRDFService->GetLiteral(PromiseFlatString(aHostname).get(), getter_AddRefs(rdfLiteral));
mInner->Assert(resource, kSQL_Hostname, rdfLiteral, PR_TRUE);
gRDFService->GetIntLiteral(aPort, getter_AddRefs(rdfInt));
mInner->Assert(resource, kSQL_Port, rdfInt, PR_TRUE);
gRDFService->GetLiteral(PromiseFlatString(aDatabase).get(), getter_AddRefs(rdfLiteral));
mInner->Assert(resource, kSQL_Database, rdfLiteral, PR_TRUE);
nsresult rv = EnsureAliasesContainer();
if (NS_FAILED(rv))
return rv;
mAliasesContainer->AppendElement(resource);
Flush();
return NS_OK;
}
NS_IMETHODIMP
mozSqlService::HasAlias(const nsACString& aURI, PRBool* _retval)
{
nsCOMPtr<nsIRDFResource> resource;
gRDFService->GetResource(aURI, getter_AddRefs(resource));
nsresult rv = EnsureAliasesContainer();
if (NS_FAILED(rv))
return rv;
PRInt32 aliasIndex;
mAliasesContainer->IndexOf(resource, &aliasIndex);
*_retval = aliasIndex != -1;
return NS_OK;
}
NS_IMETHODIMP
mozSqlService::GetAlias(const nsACString& aURI,
nsAString& aName,
nsAString& aType,
nsAString& aHostname,
PRInt32* aPort,
nsAString& aDatabase)
{
nsCOMPtr<nsIRDFResource> resource;
gRDFService->GetResource(aURI, getter_AddRefs(resource));
nsCOMPtr<nsIRDFNode> rdfNode;
nsCOMPtr<nsIRDFLiteral> rdfLiteral;
nsCOMPtr<nsIRDFInt> rdfInt;
const PRUnichar* value;
mInner->GetTarget(resource, kSQL_Name, PR_TRUE, getter_AddRefs(rdfNode));
if (rdfNode) {
rdfLiteral = do_QueryInterface(rdfNode);
rdfLiteral->GetValueConst(&value);
aName.Assign(value);
}
mInner->GetTarget(resource, kSQL_Type, PR_TRUE, getter_AddRefs(rdfNode));
if (rdfNode) {
rdfLiteral = do_QueryInterface(rdfNode);
rdfLiteral->GetValueConst(&value);
aType.Assign(value);
}
mInner->GetTarget(resource, kSQL_Hostname, PR_TRUE, getter_AddRefs(rdfNode));
if (rdfNode) {
rdfLiteral = do_QueryInterface(rdfNode);
rdfLiteral->GetValueConst(&value);
aHostname.Assign(value);
}
mInner->GetTarget(resource, kSQL_Port, PR_TRUE, getter_AddRefs(rdfNode));
if (rdfNode) {
rdfInt = do_QueryInterface(rdfNode);
rdfInt->GetValue(aPort);
}
mInner->GetTarget(resource, kSQL_Database, PR_TRUE, getter_AddRefs(rdfNode));
if (rdfNode) {
rdfLiteral = do_QueryInterface(rdfNode);
rdfLiteral->GetValueConst(&value);
aDatabase.Assign(value);
}
return NS_OK;
}
NS_IMETHODIMP
mozSqlService::UpdateAlias(const nsACString& aURI,
const nsAString& aName,
const nsAString& aType,
const nsAString& aHostname,
PRInt32 aPort,
const nsAString& aDatabase)
{
nsCOMPtr<nsIRDFResource> resource;
gRDFService->GetResource(aURI, getter_AddRefs(resource));
nsCOMPtr<nsIRDFNode> rdfNode;
nsCOMPtr<nsIRDFLiteral> rdfLiteral;
nsCOMPtr<nsIRDFInt> rdfInt;
mInner->GetTarget(resource, kSQL_Name, PR_TRUE, getter_AddRefs(rdfNode));
gRDFService->GetLiteral(PromiseFlatString(aName).get(), getter_AddRefs(rdfLiteral));
mInner->Change(resource, kSQL_Name, rdfNode, rdfLiteral);
mInner->GetTarget(resource, kSQL_Type, PR_TRUE, getter_AddRefs(rdfNode));
gRDFService->GetLiteral(PromiseFlatString(aType).get(), getter_AddRefs(rdfLiteral));
mInner->Change(resource, kSQL_Type, rdfNode, rdfLiteral);
mInner->GetTarget(resource, kSQL_Hostname, PR_TRUE, getter_AddRefs(rdfNode));
gRDFService->GetLiteral(PromiseFlatString(aHostname).get(), getter_AddRefs(rdfLiteral));
mInner->Change(resource, kSQL_Hostname, rdfNode, rdfLiteral);
mInner->GetTarget(resource, kSQL_Port, PR_TRUE, getter_AddRefs(rdfNode));
gRDFService->GetIntLiteral(aPort, getter_AddRefs(rdfInt));
mInner->Change(resource, kSQL_Port, rdfNode, rdfInt);
mInner->GetTarget(resource, kSQL_Database, PR_TRUE, getter_AddRefs(rdfNode));
gRDFService->GetLiteral(PromiseFlatString(aDatabase).get(), getter_AddRefs(rdfLiteral));
mInner->Change(resource, kSQL_Database, rdfNode, rdfLiteral);
Flush();
return NS_OK;
}
NS_IMETHODIMP
mozSqlService::RemoveAlias(const nsACString &aURI)
{
nsCOMPtr<nsIRDFResource> resource;
gRDFService->GetResource(aURI, getter_AddRefs(resource));
nsCOMPtr<nsIRDFNode> rdfNode;
mInner->GetTarget(resource, kSQL_Name, PR_TRUE, getter_AddRefs(rdfNode));
mInner->Unassert(resource, kSQL_Name, rdfNode);
mInner->GetTarget(resource, kSQL_Type, PR_TRUE, getter_AddRefs(rdfNode));
mInner->Unassert(resource, kSQL_Type, rdfNode);
mInner->GetTarget(resource, kSQL_Hostname, PR_TRUE, getter_AddRefs(rdfNode));
mInner->Unassert(resource, kSQL_Hostname, rdfNode);
mInner->GetTarget(resource, kSQL_Port, PR_TRUE, getter_AddRefs(rdfNode));
mInner->Unassert(resource, kSQL_Port, rdfNode);
mInner->GetTarget(resource, kSQL_Database, PR_TRUE, getter_AddRefs(rdfNode));
mInner->Unassert(resource, kSQL_Database, rdfNode);
nsresult rv = EnsureAliasesContainer();
if (NS_FAILED(rv))
return rv;
mAliasesContainer->RemoveElement(resource, PR_TRUE);
Flush();
return NS_OK;
}
NS_IMETHODIMP
mozSqlService::GetConnection(const nsACString &aURI, mozISqlConnection **_retval)
{
nsCStringKey key(aURI);
nsCOMPtr<nsIWeakReference> weakRef;
nsCOMPtr<mozISqlConnection> conn;
if (mConnectionCache) {
weakRef = getter_AddRefs(NS_STATIC_CAST(nsIWeakReference*, mConnectionCache->Get(&key)));
if (weakRef) {
conn = do_QueryReferent(weakRef);
if (conn)
NS_ADDREF(*_retval = conn);
}
}
if (! *_retval) {
nsresult rv = GetNewConnection(aURI, getter_AddRefs(conn));
if (NS_FAILED(rv))
return rv;
weakRef = do_GetWeakReference(conn);
if (! mConnectionCache)
mConnectionCache = new nsSupportsHashtable(16);
mConnectionCache->Put(&key, weakRef);
NS_ADDREF(*_retval = conn);
}
return NS_OK;
}
NS_IMETHODIMP
mozSqlService::GetNewConnection(const nsACString &aURI, mozISqlConnection **_retval)
{
PRBool hasAlias;
HasAlias(aURI, &hasAlias);
if (!hasAlias)
return NS_ERROR_FAILURE;
nsresult rv;
nsAutoString name;
nsAutoString type;
nsAutoString hostname;
PRInt32 port;
nsAutoString database;
GetAlias(aURI, name, type, hostname, &port, database);
nsCAutoString contractID(
NS_LITERAL_CSTRING("@mozilla.org/sql/connection;1?type=") +
NS_ConvertUCS2toUTF8(type));
nsCOMPtr<mozISqlConnection> conn = do_CreateInstance(contractID.get());
if (! conn)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIWindowWatcher> watcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIPrompt> prompter;
watcher->GetNewPrompter(0, getter_AddRefs(prompter));
PRBool retval;
do {
nsXPIDLString username;
nsXPIDLString password;
prompter->PromptUsernameAndPassword(
nsnull, // in wstring dialogTitle
nsnull, // in wstring text
getter_Copies(username),
getter_Copies(password),
nsnull, // in wstring checkMsg
nsnull, // inout boolean checkValue
&retval
);
if (retval) {
rv = conn->Init(hostname, port, database, username, password);
if (NS_FAILED(rv)) {
conn->GetErrorMessage(mErrorMessage);
prompter->Alert(nsnull, mErrorMessage.get());
}
}
} while(retval && NS_FAILED(rv));
NS_IF_ADDREF(*_retval = conn);
return rv;
}
NS_IMETHODIMP
mozSqlService::GetURI(char** aURI)
{
if (!aURI)
return NS_ERROR_NULL_POINTER;
*aURI = nsCRT::strdup("rdf:sql");
if (!(*aURI))
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
mozSqlService::GetSource(nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
PRBool aTruthValue,
nsIRDFResource** aSource)
{
return mInner->GetSource(aProperty, aTarget, aTruthValue, aSource);
}
NS_IMETHODIMP
mozSqlService::GetSources(nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
PRBool aTruthValue,
nsISimpleEnumerator** aSources) {
return mInner->GetSources(aProperty, aTarget, aTruthValue, aSources);
}
NS_IMETHODIMP
mozSqlService::GetTarget(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
PRBool aTruthValue,
nsIRDFNode** aTarget) {
return mInner->GetTarget(aSource, aProperty, aTruthValue, aTarget);
}
NS_IMETHODIMP
mozSqlService::GetTargets(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
PRBool aTruthValue,
nsISimpleEnumerator** aTargets) {
return mInner->GetTargets(aSource, aProperty, aTruthValue, aTargets);
}
NS_IMETHODIMP
mozSqlService::Assert(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
PRBool aTruthValue)
{
return mInner->Assert(aSource, aProperty, aTarget, aTruthValue);
}
NS_IMETHODIMP
mozSqlService::Unassert(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget)
{
return mInner->Unassert(aSource, aProperty, aTarget);
}
NS_IMETHODIMP
mozSqlService::Change(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aOldTarget,
nsIRDFNode* aNewTarget)
{
return mInner->Change(aSource, aProperty, aOldTarget, aNewTarget);
}
NS_IMETHODIMP
mozSqlService::Move(nsIRDFResource* aOldSource,
nsIRDFResource* aNewSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget)
{
return mInner->Move(aOldSource, aNewSource, aProperty, aTarget);
}
NS_IMETHODIMP
mozSqlService::HasAssertion(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
PRBool aTruthValue,
PRBool* hasAssertion)
{
return mInner->HasAssertion(aSource, aProperty, aTarget, aTruthValue, hasAssertion);
}
NS_IMETHODIMP
mozSqlService::AddObserver(nsIRDFObserver* aObserver)
{
return mInner->AddObserver(aObserver);
}
NS_IMETHODIMP
mozSqlService::RemoveObserver(nsIRDFObserver* aObserver)
{
return mInner->RemoveObserver(aObserver);
}
NS_IMETHODIMP
mozSqlService::HasArcIn(nsIRDFNode* aNode,
nsIRDFResource* aArc,
PRBool* _retval)
{
return mInner->HasArcIn(aNode, aArc, _retval);
}
NS_IMETHODIMP
mozSqlService::HasArcOut(nsIRDFResource* aSource,
nsIRDFResource* aArc,
PRBool* _retval)
{
return mInner->HasArcOut(aSource, aArc, _retval);
}
NS_IMETHODIMP
mozSqlService::ArcLabelsIn(nsIRDFNode* aNode,
nsISimpleEnumerator** aLabels)
{
return mInner->ArcLabelsIn(aNode, aLabels);
}
NS_IMETHODIMP
mozSqlService::ArcLabelsOut(nsIRDFResource* aSource,
nsISimpleEnumerator** aLabels)
{
return mInner->ArcLabelsIn(aSource, aLabels);
}
NS_IMETHODIMP
mozSqlService::GetAllResources(nsISimpleEnumerator** aResult)
{
return mInner->GetAllResources(aResult);
}
NS_IMETHODIMP
mozSqlService::GetAllCmds(nsIRDFResource* aSource,
nsISimpleEnumerator** aCommands)
{
return mInner->GetAllCmds(aSource, aCommands);
}
NS_IMETHODIMP
mozSqlService::IsCommandEnabled(nsISupportsArray* aSources,
nsIRDFResource* aCommand,
nsISupportsArray* aArguments,
PRBool* aResult)
{
return mInner->IsCommandEnabled(aSources, aCommand, aArguments, aResult);
}
NS_IMETHODIMP
mozSqlService::DoCommand(nsISupportsArray* aSources,
nsIRDFResource* aCommand,
nsISupportsArray* aArguments)
{
return mInner->DoCommand(aSources, aCommand, aArguments);
}
NS_IMETHODIMP
mozSqlService::BeginUpdateBatch()
{
return mInner->BeginUpdateBatch();
}
NS_IMETHODIMP
mozSqlService::EndUpdateBatch()
{
return mInner->EndUpdateBatch();
}
// nsIRDFRemoteDataSource
NS_IMETHODIMP
mozSqlService::GetLoaded(PRBool* aResult)
{
nsCOMPtr<nsIRDFRemoteDataSource> remote(do_QueryInterface(mInner));
return remote->GetLoaded(aResult);
}
NS_IMETHODIMP
mozSqlService::Init(const char* aURI)
{
return NS_OK;
}
NS_IMETHODIMP
mozSqlService::Refresh(PRBool aBlocking)
{
nsCOMPtr<nsIRDFRemoteDataSource> remote(do_QueryInterface(mInner));
return remote->Refresh(aBlocking);
}
NS_IMETHODIMP
mozSqlService::Flush()
{
nsCOMPtr<nsIRDFRemoteDataSource> remote(do_QueryInterface(mInner));
return remote->Flush();
}
NS_IMETHODIMP
mozSqlService::FlushTo(const char *aURI)
{
nsCOMPtr<nsIRDFRemoteDataSource> remote(do_QueryInterface(mInner));
return remote->FlushTo(aURI);
}
nsresult
mozSqlService::EnsureAliasesContainer()
{
if (! mAliasesContainer) {
PRBool isContainer;
nsresult rv = gRDFContainerUtils->IsContainer(mInner, kSQL_AliasesRoot, &isContainer);
if (NS_FAILED(rv)) return rv;
if (!isContainer) {
rv = gRDFContainerUtils->MakeSeq(mInner, kSQL_AliasesRoot, getter_AddRefs(mAliasesContainer));
if (NS_FAILED(rv)) return rv;
}
else {
mAliasesContainer = do_CreateInstance(NS_RDF_CONTRACTID "/container;1", &rv);
if (NS_FAILED(rv)) return rv;
rv = mAliasesContainer->Init(mInner, kSQL_AliasesRoot);
if (NS_FAILED(rv)) return rv;
}
}
return NS_OK;
}

View File

@@ -1,52 +0,0 @@
#ifndef mozSqlService_h
#define mozSqlService_h
#include "nsHashtable.h"
#include "nsIRDFDataSource.h"
#include "nsIRDFRemoteDataSource.h"
#include "nsIRDFService.h"
#include "nsIRDFContainerUtils.h"
#include "mozISqlService.h"
#define MOZ_SQLSERVICE_CLASSNAME "SQL service"
#define MOZ_SQLSERVICE_CID \
{0x1ceb35b7, 0xdaa8, 0x4ce4, {0xac, 0x67, 0x12, 0x5f, 0xb1, 0x7c, 0xb0, 0x19}}
#define MOZ_SQLSERVICE_CONTRACTID "@mozilla.org/sql/service;1"
#define MOZ_SQLDATASOURCE_CONTRACTID "@mozilla.org/rdf/datasource;1?name=sql"
class mozSqlService : public mozISqlService,
public nsIRDFDataSource,
public nsIRDFRemoteDataSource
{
public:
mozSqlService();
virtual ~mozSqlService();
nsresult Init();
NS_DECL_ISUPPORTS
NS_DECL_MOZISQLSERVICE
NS_DECL_NSIRDFDATASOURCE
NS_DECL_NSIRDFREMOTEDATASOURCE
protected:
nsresult EnsureAliasesContainer();
private:
static nsIRDFService* gRDFService;
static nsIRDFContainerUtils* gRDFContainerUtils;
static nsIRDFResource* kSQL_AliasesRoot;
static nsIRDFResource* kSQL_Name;
static nsIRDFResource* kSQL_Type;
static nsIRDFResource* kSQL_Hostname;
static nsIRDFResource* kSQL_Port;
static nsIRDFResource* kSQL_Database;
nsString mErrorMessage;
nsCOMPtr<nsIRDFDataSource> mInner;
nsCOMPtr<nsIRDFContainer> mAliasesContainer;
nsSupportsHashtable* mConnectionCache;
};
#endif /* mozSqlService_h */

View File

@@ -1,21 +0,0 @@
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = \
src
include $(topsrcdir)/config/rules.mk
XPI_FILE = sql-$(shell date +%Y%m%d)-$(OS_ARCH).xpi
xpi:
zip -j $(DIST)/$(XPI_FILE) $(srcdir)/install.js
cd $(DIST); zip -r $(XPI_FILE) \
bin/components/sql.xpt \
bin/components/sqlpgsql.xpt \
bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \
bin/chrome/sql.jar

View File

@@ -1,58 +0,0 @@
// this function verifies disk space in kilobytes
function verifyDiskSpace(dirPath, spaceRequired)
{
var spaceAvailable;
// Get the available disk space on the given path
spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
// Convert the available disk space into kilobytes
spaceAvailable = parseInt(spaceAvailable / 1024);
// do the verification
if(spaceAvailable < spaceRequired)
{
logComment("Insufficient disk space: " + dirPath);
logComment(" required : " + spaceRequired + " K");
logComment(" available: " + spaceAvailable + " K");
return(false);
}
return(true);
}
var srDest = 200;
var err = initInstall("SQL Support", "SQL", "0.1");
logComment("initInstall: " + err);
var fProgram = getFolder("Program");
logComment("fProgram: " + fProgram);
if (verifyDiskSpace(fProgram, srDest))
{
err = addDirectory("Program", "0.1", "bin", fProgram, "", true);
logComment("addDirectory() returned: " + err);
var chromeFolder = getFolder("Chrome", "sql.jar");
registerChrome(CONTENT | DELAYED_CHROME, chromeFolder, "content/sql/");
registerChrome(LOCALE | DELAYED_CHROME, chromeFolder, "locale/en-US/sql/");
err = getLastError();
if (err == ACCESS_DENIED) {
alert("Unable to write to program directory " + fProgram + ".\n You will need to restart the browser with administrator/root privileges to install this software. After installing as root (or administrator), you will need to restart the browser one more time to register the installed software.\n After the second restart, you can go back to running the browser without privileges!");
cancelInstall(err);
logComment("cancelInstall() due to error: " + err);
}
else if (err != SUCCESS) {
cancelInstall(err);
logComment("cancelInstall() due to error: " + err);
}
else {
performInstall();
logComment("performInstall() returned: " + err);
}
}
else
cancelInstall(INSUFFICIENT_DISK_SPACE);

View File

@@ -1,40 +0,0 @@
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = sql
MODULE_NAME = sqlModule
LIBRARY_NAME = sql
SHORT_LIBNAME = sql
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
REQUIRES = xpcom \
string \
rdf \
$(NULL)
CPPSRCS = \
mozSqlModule.cpp
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)sqlbase_s.$(LIB_SUFFIX)
EXTRA_DSO_LDOPTS = \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(NULL)
ifdef MOZ_ENABLE_PGSQL
DEFINES += -DMOZ_ENABLE_PGSQL
SHARED_LIBRARY_LIBS += $(DIST)/lib/$(LIB_PREFIX)sqlpgsql_s.$(LIB_SUFFIX)
EXTRA_DSO_LDOPTS += -L$(MOZ_PGSQL_LIBS) -lpq
endif
include $(topsrcdir)/config/rules.mk
ifdef MOZ_ENABLE_PGSQL
INCLUDES += -I$(MOZ_PGSQL_INCLUDES)
endif

View File

@@ -1,33 +0,0 @@
#include "nsIGenericFactory.h"
#include "mozSqlService.h"
#ifdef MOZ_ENABLE_PGSQL
#include "mozSqlConnectionPgsql.h"
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozSqlService, Init)
#ifdef MOZ_ENABLE_PGSQL
NS_GENERIC_FACTORY_CONSTRUCTOR(mozSqlConnectionPgsql)
#endif
static nsModuleComponentInfo components[] =
{
{ MOZ_SQLSERVICE_CLASSNAME,
MOZ_SQLSERVICE_CID,
MOZ_SQLSERVICE_CONTRACTID,
mozSqlServiceConstructor
},
{ MOZ_SQLSERVICE_CLASSNAME,
MOZ_SQLSERVICE_CID,
MOZ_SQLDATASOURCE_CONTRACTID,
mozSqlServiceConstructor
},
#ifdef MOZ_ENABLE_PGSQL
{ MOZ_SQLCONNECTIONPGSQL_CLASSNAME,
MOZ_SQLCONNECTIONPGSQL_CID,
MOZ_SQLCONNECTIONPGSQL_CONTRACTID,
mozSqlConnectionPgsqlConstructor
}
#endif
};
NS_IMPL_NSGETMODULE("sql", components)

View File

@@ -1,10 +0,0 @@
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DIRS = \
public \
src
include $(topsrcdir)/config/rules.mk

View File

@@ -1,14 +0,0 @@
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
MODULE = sql
XPIDL_MODULE = sqlpgsql
XPIDLSRCS = \
mozISqlConnectionPgsql.idl \
mozISqlResultPgsql.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,8 +0,0 @@
#include "nsISupports.idl"
[scriptable, uuid(0cf1eefe-611d-48fa-ae27-0a6f40d6a33e)]
interface mozISqlConnectionPgsql : nsISupports
{
};

View File

@@ -1,8 +0,0 @@
#include "nsISupports.idl"
[scriptable, uuid(f6573169-286d-4a20-8253-9abb07bdba29)]
interface mozISqlResultPgsql : nsISupports
{
};

View File

@@ -1,28 +0,0 @@
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = sql
LIBRARY_NAME = sqlpgsql_s
REQUIRES = xpcom \
string \
locale \
rdf \
$(NULL)
CPPSRCS = \
mozSqlConnectionPgsql.cpp \
mozSqlResultPgsql.cpp
EXPORTS = \
mozSqlConnectionPgsql.h \
mozSqlResultPgsql.h
FORCE_STATIC_LIB=1
include $(topsrcdir)/config/rules.mk
INCLUDES += -I$(MOZ_PGSQL_INCLUDES)

View File

@@ -1,240 +0,0 @@
#include "prprf.h"
#include "mozSqlConnectionPgsql.h"
#include "mozSqlResultPgsql.h"
mozSqlConnectionPgsql::mozSqlConnectionPgsql()
: mConnection(nsnull)
{
}
mozSqlConnectionPgsql::~mozSqlConnectionPgsql()
{
if (mConnection)
PQfinish(mConnection);
}
NS_IMPL_ADDREF_INHERITED(mozSqlConnectionPgsql, mozSqlConnection)
NS_IMPL_RELEASE_INHERITED(mozSqlConnectionPgsql, mozSqlConnection)
// QueryInterface
NS_INTERFACE_MAP_BEGIN(mozSqlConnectionPgsql)
NS_INTERFACE_MAP_ENTRY(mozISqlConnectionPgsql)
NS_INTERFACE_MAP_END_INHERITING(mozSqlConnection)
NS_IMETHODIMP
mozSqlConnectionPgsql::Init(const nsAString & aHost, PRInt32 aPort,
const nsAString & aDatabase, const nsAString & aUsername,
const nsAString & aPassword)
{
if (mConnection)
return NS_OK;
if (aPort == -1)
aPort = 5432;
char port[11];
char options[] = "";
char tty[] = "";
PR_snprintf(port, 11, "%d", aPort);
mConnection = PQsetdbLogin(NS_ConvertUCS2toUTF8(aHost).get(),
port, options, tty,
NS_ConvertUCS2toUTF8(aDatabase).get(),
NS_ConvertUCS2toUTF8(aUsername).get(),
NS_ConvertUCS2toUTF8(aPassword).get());
return Setup();
}
NS_IMETHODIMP
mozSqlConnectionPgsql::GetPrimaryKeys(const nsAString& aSchema, const nsAString& aTable, mozISqlResult** _retval)
{
nsAutoString select;
nsAutoString from;
nsAutoString where;
if (mVersion >= SERVER_VERSION(7,3,0)) {
select = NS_LITERAL_STRING("SELECT n.nspname AS TABLE_SCHEM, ");
from = NS_LITERAL_STRING(" FROM pg_catalog.pg_namespace n, pg_catalog.pg_class ct, pg_catalog.pg_class ci, pg_catalog.pg_attribute a, pg_catalog.pg_index i");
where = NS_LITERAL_STRING(" AND ct.relnamespace = n.oid ");
if (!aSchema.IsEmpty()) {
where.Append(NS_LITERAL_STRING(" AND n.nspname = '") + aSchema);
where.Append(PRUnichar('\''));
}
}
else {
select = NS_LITERAL_STRING("SELECT NULL AS TABLE_SCHEM, ");
from = NS_LITERAL_STRING(" FROM pg_class ct, pg_class ci, pg_attribute a, pg_index i ");
}
if (!aTable.IsEmpty()) {
where.Append(NS_LITERAL_STRING(" AND ct.relname = '") + aTable);
where.Append(PRUnichar('\''));
}
NS_NAMED_LITERAL_STRING(select2, " ct.relname AS TABLE_NAME, a.attname AS COLUMN_NAME, a.attnum AS KEY_SEQ, ci.relname AS PK_NAME ");
NS_NAMED_LITERAL_STRING(where2, " WHERE ct.oid=i.indrelid AND ci.oid=i.indexrelid AND a.attrelid=ci.oid AND i.indisprimary ");
NS_NAMED_LITERAL_STRING(order2, " ORDER BY table_name, pk_name, key_seq");
return RealExec(select + select2 + from + where2 + where + order2, _retval, nsnull);
}
nsresult
mozSqlConnectionPgsql::Setup()
{
if (PQstatus(mConnection) == CONNECTION_BAD) {
mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQerrorMessage(mConnection)));
mConnection = nsnull;
return NS_ERROR_FAILURE;
}
PQsetClientEncoding(mConnection, "UNICODE");
/*
PGresult* result = PQexec(mConnection, "SET DATESTYLE TO US");
PRInt32 stat = PQresultStatus(result);
if (stat != PGRES_COMMAND_OK) {
mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQresultErrorMessage(result)));
PQfinish(mConnection);
mConnection = nsnull;
return NS_ERROR_FAILURE;
}
*/
PGresult* result = PQexec(mConnection, "select version()");
PRInt32 stat = PQresultStatus(result);
if (stat != PGRES_TUPLES_OK) {
mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQresultErrorMessage(result)));
return NS_ERROR_FAILURE;
}
char* version = PQgetvalue(result, 0, 0);
NS_ConvertUTF8toUCS2 buffer(version);
nsAString::const_iterator start, end, iter;
buffer.BeginReading(iter);
buffer.EndReading(end);
while (iter != end && !nsCRT::IsAsciiSpace(*iter))
++iter;
while (iter != end && nsCRT::IsAsciiSpace(*iter))
++iter;
start = iter;
while (iter != end && !nsCRT::IsAsciiSpace(*iter))
++iter;
mServerVersion = Substring(start,iter);
PRInt32 numbers[3] = {0,0,0};
mServerVersion.BeginReading(iter);
mServerVersion.EndReading(end);
for (PRInt32 i = 0; i < 3; i++) {
start = iter;
while (iter != end && *iter != PRUnichar('.'))
++iter;
nsAutoString v(Substring(start,iter));
PRInt32 err;
numbers[i] = v.ToInteger(&err);
while (iter != end && *iter == PRUnichar('.'))
++iter;
}
mVersion = SERVER_VERSION(numbers[0], numbers[1], numbers[2]);
return NS_OK;
}
nsresult
mozSqlConnectionPgsql::RealExec(const nsAString& aQuery,
mozISqlResult** aResult, PRInt32* aAffectedRows)
{
if (! mConnection)
return NS_ERROR_NOT_INITIALIZED;
PGresult* r;
r = PQexec(mConnection, NS_ConvertUCS2toUTF8(aQuery).get());
PRInt32 stat = PQresultStatus(r);
if (PQstatus(mConnection) == CONNECTION_BAD) {
PQreset(mConnection);
nsresult rv = Setup();
if (NS_FAILED(rv))
return rv;
r = PQexec(mConnection, NS_ConvertUCS2toUTF8(aQuery).get());
stat = PQresultStatus(r);
}
if (stat == PGRES_TUPLES_OK) {
if (!aResult)
return NS_ERROR_NULL_POINTER;
static char select1[] = "select t.oid, case when t.typbasetype = 0 then t.typname else (select t2.typname from pg_type t2 where t2.oid=t.typbasetype) end as typname from pg_type t where t.oid in (";
static char select2[] = "select oid, typname from pg_type where oid in (";
char* select;
if (mVersion >= SERVER_VERSION(7,3,0))
select = select1;
else
select = select2;
PRInt32 columnCount = PQnfields(r);
char* query = (char*)malloc(strlen(select) + columnCount * 11 + 2);
strcpy(query, select);
for (PRInt32 i = 0; i < columnCount; i++) {
PRInt32 oid = PQftype(r, i);
char oidStr[11];
if (i)
sprintf(oidStr, ",%d", oid);
else
sprintf(oidStr, "%d", oid);
strcat(query, oidStr);
}
strcat(query, ")");
PGresult* types = PQexec(mConnection, query);
free(query);
stat = PQresultStatus(types);
if (stat != PGRES_TUPLES_OK) {
mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQresultErrorMessage(types)));
return NS_ERROR_FAILURE;
}
if (*aResult) {
((mozSqlResultPgsql*)*aResult)->SetResult(r, types);
nsresult rv = ((mozSqlResult*)*aResult)->Rebuild();
if (NS_FAILED(rv))
return rv;
NS_ADDREF(*aResult);
}
else {
mozSqlResult* result = new mozSqlResultPgsql(this, aQuery);
if (! result)
return NS_ERROR_OUT_OF_MEMORY;
((mozSqlResultPgsql*)result)->SetResult(r, types);
nsresult rv = result->Init();
if (NS_FAILED(rv))
return rv;
NS_ADDREF(*aResult = result);
}
}
else if (stat == PGRES_COMMAND_OK) {
if (!aAffectedRows)
return NS_ERROR_NULL_POINTER;
PR_sscanf(PQcmdTuples(r), "%d", aAffectedRows);
mLastID = PQoidValue(r);
}
else {
mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQresultErrorMessage(r)));
return NS_ERROR_FAILURE;
}
return NS_OK;
}
nsresult
mozSqlConnectionPgsql::CancelExec()
{
if (!PQrequestCancel(mConnection)) {
mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQerrorMessage(mConnection)));
return NS_ERROR_FAILURE;
}
return NS_OK;
}
nsresult
mozSqlConnectionPgsql::GetIDName(nsAString& aIDName)
{
aIDName = NS_LITERAL_STRING("OID");
return NS_OK;
}

View File

@@ -1,47 +0,0 @@
#ifndef mozSqlConnectionPgsql_h
#define mozSqlConnectionPgsql_h
#include "libpq-fe.h"
#include "mozSqlConnection.h"
#include "mozISqlConnectionPgsql.h"
#define MOZ_SQLCONNECTIONPGSQL_CLASSNAME "PosgreSQL SQL Connection"
#define MOZ_SQLCONNECTIONPGSQL_CID \
{0x0cf1eefe, 0x611d, 0x48fa, {0xae, 0x27, 0x0a, 0x6f, 0x40, 0xd6, 0xa3, 0x3e }}
#define MOZ_SQLCONNECTIONPGSQL_CONTRACTID "@mozilla.org/sql/connection;1?type=pgsql"
#define SERVER_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
class mozSqlConnectionPgsql : public mozSqlConnection,
public mozISqlConnectionPgsql
{
public:
mozSqlConnectionPgsql();
virtual ~mozSqlConnectionPgsql();
NS_DECL_ISUPPORTS
NS_IMETHOD Init(const nsAString& aHost, PRInt32 aPort,
const nsAString& aDatabase, const nsAString& aUsername,
const nsAString& aPassword);
NS_IMETHOD GetPrimaryKeys(const nsAString& aSchema, const nsAString& aTable, mozISqlResult** _retval);
NS_DECL_MOZISQLCONNECTIONPGSQL
protected:
nsresult Setup();
virtual nsresult RealExec(const nsAString& aQuery,
mozISqlResult** aResult, PRInt32* aAffectedRows);
virtual nsresult CancelExec();
virtual nsresult GetIDName(nsAString& aIDName);
private:
PGconn* mConnection;
PRInt32 mVersion;
};
#endif // mozSqlConnectionPgsql_h

View File

@@ -1,235 +0,0 @@
#include "prprf.h"
#include "nsReadableUtils.h"
#include "mozSqlResultPgsql.h"
mozSqlResultPgsql::mozSqlResultPgsql(mozISqlConnection* aConnection,
const nsAString& aQuery)
: mozSqlResult(aConnection, aQuery),
mResult(nsnull),
mTypes(nsnull)
{
}
void
mozSqlResultPgsql::SetResult(PGresult* aResult,
PGresult* aTypes)
{
mResult = aResult;
mTypes = aTypes;
}
mozSqlResultPgsql::~mozSqlResultPgsql()
{
ClearNativeResult();
}
NS_IMPL_ADDREF_INHERITED(mozSqlResultPgsql, mozSqlResult)
NS_IMPL_RELEASE_INHERITED(mozSqlResultPgsql, mozSqlResult)
// QueryInterface
NS_INTERFACE_MAP_BEGIN(mozSqlResultPgsql)
NS_INTERFACE_MAP_ENTRY(mozISqlResultPgsql)
NS_INTERFACE_MAP_END_INHERITING(mozSqlResult)
PRInt32
mozSqlResultPgsql::GetColType(PRInt32 aColumnIndex)
{
PRInt32 oid = PQftype(mResult, aColumnIndex);
for (PRInt32 i = 0; i < PQntuples(mTypes); i++) {
char* value = PQgetvalue(mTypes, i, 0);
PRInt32 o;
PR_sscanf(value, "%d", &o);
if (o == oid) {
char* type = PQgetvalue(mTypes, i, 1);
if (! strcmp(type, "int2"))
return mozISqlResult::TYPE_INT;
else if (! strcmp(type, "int4"))
return mozISqlResult::TYPE_INT;
else if (! strcmp(type, "float4"))
return mozISqlResult::TYPE_STRING;
else if (! strcmp(type, "numeric"))
return mozISqlResult::TYPE_STRING;
else if (! strcmp(type, "date"))
return mozISqlResult::TYPE_STRING;
else if (! strcmp(type, "time"))
return mozISqlResult::TYPE_STRING;
else if (! strcmp(type, "timestamp"))
return mozISqlResult::TYPE_STRING;
else if (! strcmp(type, "bool"))
return mozISqlResult::TYPE_BOOL;
else
return mozISqlResult::TYPE_STRING;
}
}
return mozISqlResult::TYPE_STRING;
}
nsresult
mozSqlResultPgsql::BuildColumnInfo()
{
for (PRInt32 i = 0; i < PQnfields(mResult); i++) {
char* n = PQfname(mResult, i);
PRUnichar* name = ToNewUnicode(NS_ConvertUTF8toUCS2(n));
PRInt32 type = GetColType(i);
PRInt32 size = PQfsize(mResult, i);
PRInt32 mod = PQfmod(mResult, i);
nsCAutoString uri(NS_LITERAL_CSTRING("http://www.mozilla.org/SQL-rdf#"));
uri.Append(n);
nsCOMPtr<nsIRDFResource> property;
gRDFService->GetResource(uri, getter_AddRefs(property));
ColumnInfo* columnInfo = ColumnInfo::Create(mAllocator, name, type, size, mod, property);
mColumnInfo.AppendElement(columnInfo);
}
return NS_OK;
}
nsresult
mozSqlResultPgsql::BuildRows()
{
for(PRInt32 i = 0; i < PQntuples(mResult); i++) {
nsCOMPtr<nsIRDFResource> resource;
nsresult rv = gRDFService->GetAnonymousResource(getter_AddRefs(resource));
if (NS_FAILED(rv)) return rv;
Row* row = Row::Create(mAllocator, resource, mColumnInfo);
for (PRInt32 j = 0; j < mColumnInfo.Count(); j++) {
if (! PQgetisnull(mResult, i, j)) {
char* value = PQgetvalue(mResult, i, j);
Cell* cell = row->mCells[j];
cell->SetNull(PR_FALSE);
PRInt32 type = cell->GetType();
if (type == mozISqlResult::TYPE_STRING)
cell->SetString(ToNewUnicode(NS_ConvertUTF8toUCS2(value)));
else if (type == mozISqlResult::TYPE_INT)
PR_sscanf(value, "%d", &cell->mInt);
else if (type == mozISqlResult::TYPE_FLOAT)
PR_sscanf(value, "%f", &cell->mFloat);
else if (type == mozISqlResult::TYPE_DECIMAL)
PR_sscanf(value, "%f", &cell->mFloat);
else if (type == mozISqlResult::TYPE_DATE ||
type == mozISqlResult::TYPE_TIME ||
type == mozISqlResult::TYPE_DATETIME)
PR_ParseTimeString(value, PR_FALSE, &cell->mDate);
else if (type == mozISqlResult::TYPE_BOOL)
cell->mBool = !strcmp(value, "t");
}
}
mRows.AppendElement(row);
nsVoidKey key(resource);
mSources.Put(&key, row);
}
return NS_OK;
}
void
mozSqlResultPgsql::ClearNativeResult()
{
if (mResult) {
PQclear(mResult);
mResult = nsnull;
}
if (mTypes) {
PQclear(mTypes);
mTypes = nsnull;
}
}
nsresult
mozSqlResultPgsql::EnsureTablePrivileges()
{
nsresult rv = EnsureTableName();
if (NS_FAILED(rv))
return rv;
NS_NAMED_LITERAL_STRING(select, "select ");
NS_NAMED_LITERAL_STRING(func, "has_table_privilege(SESSION_USER, '");
NS_NAMED_LITERAL_STRING(comma, ", ");
NS_NAMED_LITERAL_STRING(ins, "', 'INSERT')");
NS_NAMED_LITERAL_STRING(upd, "', 'UPDATE')");
NS_NAMED_LITERAL_STRING(del, "','DELETE')");
nsCOMPtr<mozISqlResult> result;
rv = mConnection->ExecuteQuery(
select + func + mTableName + ins +
comma + func + mTableName + upd +
comma + func + mTableName + del,
getter_AddRefs(result));
if (NS_FAILED(rv)) {
mConnection->GetErrorMessage(mErrorMessage);
return rv;
}
nsCOMPtr<mozISqlResultEnumerator> enumerator;
rv = result->Enumerate(getter_AddRefs(enumerator));
if (NS_FAILED(rv))
return rv;
rv = enumerator->First();
if (NS_FAILED(rv))
return rv;
rv = enumerator->GetBool(0, &mCanInsert);
if (NS_FAILED(rv))
return rv;
rv = enumerator->GetBool(1, &mCanUpdate);
if (NS_FAILED(rv))
return rv;
return enumerator->GetBool(2, &mCanDelete);
}
nsresult
mozSqlResultPgsql::CanInsert(PRBool* _retval)
{
if (mCanInsert >= 0) {
*_retval = mCanInsert;
return NS_OK;
}
nsresult rv = EnsureTablePrivileges();
if (NS_FAILED(rv))
return rv;
*_retval = mCanInsert;
return NS_OK;
}
nsresult
mozSqlResultPgsql::CanUpdate(PRBool* _retval)
{
if (mCanUpdate >= 0) {
*_retval = mCanUpdate;
return NS_OK;
}
nsresult rv = EnsureTablePrivileges();
if (NS_FAILED(rv))
return rv;
*_retval = mCanUpdate;
return NS_OK;
}
nsresult
mozSqlResultPgsql::CanDelete(PRBool* _retval)
{
if (mCanDelete >= 0) {
*_retval = mCanDelete;
return NS_OK;
}
nsresult rv = EnsureTablePrivileges();
if (NS_FAILED(rv))
return rv;
*_retval = mCanDelete;
return NS_OK;
}

View File

@@ -1,39 +0,0 @@
#ifndef mozSqlResultPgsql_h
#define mozSqlResultPgsql_h
#include "libpq-fe.h"
#include "mozSqlResult.h"
#include "mozISqlResultPgsql.h"
class mozSqlResultPgsql : public mozSqlResult,
public mozISqlResultPgsql
{
public:
mozSqlResultPgsql(mozISqlConnection* aConnection,
const nsAString& aQuery);
void SetResult(PGresult* aResult,
PGresult* aTypes);
virtual ~mozSqlResultPgsql();
NS_DECL_ISUPPORTS
NS_DECL_MOZISQLRESULTPGSQL
protected:
PRInt32 GetColType(PRInt32 aColumnIndex);
virtual nsresult BuildColumnInfo();
virtual nsresult BuildRows();
virtual void ClearNativeResult();
nsresult EnsureTablePrivileges();
virtual nsresult CanInsert(PRBool* _retval);
virtual nsresult CanUpdate(PRBool* _retval);
virtual nsresult CanDelete(PRBool* _retval);
private:
PGresult* mResult;
PGresult* mTypes;
};
#endif // mozSqlResultPgsql_h

View File

@@ -1,15 +0,0 @@
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
XPI_FILE = sqltest-$(shell date +%Y%m%d).xpi
xpi:
zip -j $(DIST)/$(XPI_FILE) $(srcdir)/install.js
cd $(DIST); zip -r $(XPI_FILE) \
bin/chrome/sqltest.jar

View File

@@ -1,17 +0,0 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:sqltest"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:sqltest"
chrome:displayName="SQL test"
chrome:author="mozilla.org"
chrome:name="sqltest">
</RDF:Description>
</RDF:RDF>

View File

@@ -1,57 +0,0 @@
// this function verifies disk space in kilobytes
function verifyDiskSpace(dirPath, spaceRequired)
{
var spaceAvailable;
// Get the available disk space on the given path
spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
// Convert the available disk space into kilobytes
spaceAvailable = parseInt(spaceAvailable / 1024);
// do the verification
if(spaceAvailable < spaceRequired)
{
logComment("Insufficient disk space: " + dirPath);
logComment(" required : " + spaceRequired + " K");
logComment(" available: " + spaceAvailable + " K");
return(false);
}
return(true);
}
var srDest = 100;
var err = initInstall("SQL test", "SQLTEST", "0.1");
logComment("initInstall: " + err);
var fProgram = getFolder("Program");
logComment("fProgram: " + fProgram);
if (verifyDiskSpace(fProgram, srDest))
{
err = addDirectory("Program", "0.1", "bin", fProgram, "", true);
logComment("addDirectory() returned: " + err);
var chromeFolder = getFolder("Chrome", "sqltest.jar");
registerChrome(CONTENT | DELAYED_CHROME, chromeFolder, "content/sqltest/");
err = getLastError();
if (err == ACCESS_DENIED) {
alert("Unable to write to program directory " + fProgram + ".\n You will need to restart the browser with administrator/root privileges to install this software. After installing as root (or administrator), you will need to restart the browser one more time to register the installed software.\n After the second restart, you can go back to running the browser without privileges!");
cancelInstall(err);
logComment("cancelInstall() due to error: " + err);
}
else if (err != SUCCESS) {
cancelInstall(err);
logComment("cancelInstall() due to error: " + err);
}
else {
performInstall();
logComment("performInstall() returned: " + err);
}
}
else
cancelInstall(INSUFFICIENT_DISK_SPACE);

View File

@@ -1,7 +0,0 @@
sqltest.jar:
content/sqltest/contents.rdf (contents.rdf)
content/sqltest/sqltest.xul (sqltest.xul)
content/sqltest/sqltest.js (sqltest.js)
content/sqltest/sqltest.css (sqltest.css)
content/sqltest/sqltestDialog.xul (sqltestDialog.xul)
content/sqltest/sqltestDialog.js (sqltestDialog.js)

View File

@@ -1,8 +0,0 @@
treechildren:-moz-tree-cell {
border-right: 1px solid ThreeDFace;
border-bottom: 1px solid ThreeDFace;
}
.spacer {
height: 10px;
}

View File

@@ -1,126 +0,0 @@
const alias = "urn:aliases:sqltest";
const complete = Components.interfaces.mozISqlRequest.STATUS_COMPLETE;
var connection;
var result;
var startupObserver = {
onStartRequest: function(request, ctxt) {
},
onStopRequest: function(request, ctxt) {
if (request.status == complete) {
result = request.result;
var ds = result.QueryInterface(Components.interfaces.nsIRDFDataSource);
var menulist = document.getElementById("statesMenulist");
menulist.database.AddDataSource(ds);
menulist.builder.rebuild();
menulist.selectedIndex = 0;
var tree = document.getElementById("statesTree");
tree.database.AddDataSource(ds);
tree.builder.rebuild();
}
else {
alert(request.errorMessage);
}
}
};
var observer = {
onStartRequest: function(request, ctxt) {
},
onStopRequest: function(request, ctxt) {
if (request.status == complete) {
var element = document.getElementById("asyncStateName");
if (request.result.rowCount) {
var enumerator = request.result.enumerate();
enumerator.first();
element.value = enumerator.getVariant(0);
}
else {
element.value = "Not found";
}
}
else {
alert(request.errorMessage);
}
}
};
function init() {
var service = Components.classes["@mozilla.org/sql/service;1"]
.getService(Components.interfaces.mozISqlService);
if (!service.hasAlias(alias)) {
alert("The alias for the sqltest was not defined.");
return;
}
try {
connection = service.getConnection(alias);
}
catch (ex) {
alert(service.errorMessage);
return;
}
var query = "select code, name from states";
var request = connection.asyncExecuteQuery(query, null, startupObserver);
}
function syncFindState() {
var code = document.getElementById("syncStateCode").value
var query = "select name from states where code = '" + code + "'";
try {
var result = connection.executeQuery(query);
var element = document.getElementById("syncStateName");
if (result.rowCount) {
var enumerator = result.enumerate();
enumerator.first();
element.value = enumerator.getVariant(0);
}
else {
element.value = "Not found";
}
}
catch (ex) {
alert(connection.errorMessage);
}
}
function asyncFindState() {
var code = document.getElementById("asyncStateCode").value;
var query = "select name from states where code = '" + code + "'";
var request = connection.asyncExecuteQuery(query, null, observer);
}
function getSelectedRowIndex() {
var tree = document.getElementById("statesTree");
var currentIndex = tree.currentIndex;
var resource = tree.builderView.getResourceAtIndex(currentIndex);
var datasource = result.QueryInterface(Components.interfaces.mozISqlDataSource);
return datasource.getIndexOfResource(resource);
}
function doInsert() {
window.openDialog("sqltestDialog.xul", "testDialog", "chrome,modal=yes,resizable=no", result);
}
function doUpdate() {
var rowIndex = this.getSelectedRowIndex();
window.openDialog("sqltestDialog.xul", "testDialog", "chrome,modal=yes,resizable=no", result, rowIndex);
}
function doDelete() {
var rowIndex = this.getSelectedRowIndex();
var enumerator = result.enumerate();
enumerator.absolute(rowIndex);
try {
enumerator.deleteRow();
}
catch(ex) {
alert(enumerator.errorMessage);
}
}

View File

@@ -1,118 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="sqltest.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
width="640" height="480"
title="SQL test"
onload="init()">
<script type="application/x-javascript" src="sqltest.js"/>
<popupset>
<popup id="editContextMenu">
<menuitem label="Insert" oncommand="doInsert()"/>
<menuitem label="Update" oncommand="doUpdate()"/>
<menuitem label="Delete" oncommand="doDelete()"/>
</popup>
</popupset>
<tabbox flex="1">
<tabs>
<tab label="Sync test"/>
<tab label="Async test"/>
<tab label="Widgets"/>
</tabs>
<tabpanels flex="1">
<vbox>
<text class="label" value="Type a state code and then hit ENTER. You should get a state name."/>
<spacer class="spacer"/>
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<text class="label" value="State code:"/>
<hbox>
<textbox id="syncStateCode" size="2" maxlength="2" onkeyup="if (event.keyCode == 13) syncFindState()"/>
</hbox>
</row>
<row>
<text class="label" value="State name:"/>
<textbox id="syncStateName"/>
</row>
</rows>
</grid>
</vbox>
<vbox>
<text class="label" value="Type a state code and then hit ENTER. You should get a state name."/>
<spacer class="spacer"/>
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<text class="label" value="State code:"/>
<hbox>
<textbox id="asyncStateCode" size="2" maxlength="2" onkeyup="if (event.keyCode == 13) asyncFindState()"/>
</hbox>
</row>
<row>
<text class="label" value="State name:"/>
<textbox id="asyncStateName"/>
</row>
</rows>
</grid>
</vbox>
<vbox>
<text class="label" value="You should see a menulist filled with all the states."/>
<spacer class="spacer"/>
<hbox>
<menulist id="statesMenulist"
datasources="rdf:null" ref="SQL:ResultRoot">
<template>
<menupopup>
<menuitem uri="..."
value="rdf:http://www.mozilla.org/SQL-rdf#code"
label="rdf:http://www.mozilla.org/SQL-rdf#name"/>
</menupopup>
</template>
</menulist>
</hbox>
<spacer class="spacer"/>
<text value="You should see codes and names of all states in this tree. You can even edit them using the context menu."/>
<spacer class="spacer"/>
<tree id="statesTree" flex="1"
context="editContextMenu"
seltype="single" enableColumnDrag="true"
datasources="rdf:null" ref="SQL:ResultRoot" flags="dont-build-content">
<treecols>
<treecol id="codeCol"
label="State code"
sort="rdf:http://www.mozilla.org/SQL-rdf#code"
sortActive="true" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol id="nameCol" flex="1"
label="State name"
sort="rdf:http://www.mozilla.org/SQL-rdf#name"/>
</treecols>
<template>
<treechildren>
<treeitem uri="rdf:*">
<treerow>
<treecell label="rdf:http://www.mozilla.org/SQL-rdf#code"/>
<treecell label="rdf:http://www.mozilla.org/SQL-rdf#name"/>
</treerow>
</treeitem>
</treechildren>
</template>
</tree>
</vbox>
</tabpanels>
</tabbox>
</window>

View File

@@ -1,41 +0,0 @@
var result;
var enumerator;
function init() {
result = window.arguments[0];
enumerator = result.enumerate();
if (window.arguments.length == 2) {
enumerator.absolute(window.arguments[1]);
var columnCount = result.columnCount;
for(var i = 0; i < columnCount; i++) {
if (!enumerator.isNull(i)) {
var element = document.getElementById(result.getColumnName(i));
element.value = enumerator.getVariant(i);
}
}
}
}
function onAccept() {
var columnCount = result.columnCount;
for (var i = 0; i < columnCount; i++) {
var element = document.getElementById(result.getColumnName(i));
if (element.value)
enumerator.setVariant(i, element.value);
else
enumerator.setNull(i);
}
try {
if (window.arguments.length == 2)
enumerator.updateRow();
else
enumerator.insertRow();
}
catch(ex) {
alert(enumerator.errorMessage);
return false;
}
return true;
}

View File

@@ -1,33 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<dialog id="testDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Test dialog"
buttons="accept,cancel" buttonpack="center"
ondialogaccept="return onAccept();"
onload="init()">
<script type="application/x-javascript" src="sqltestDialog.js"/>
<grid flex="1">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row>
<label value="Code:"/>
<hbox>
<textbox id="code" size="2" maxlength="2" oninput="this.value = this.value.toUpperCase()"/>
</hbox>
</row>
<row>
<label value="Name:"/>
<textbox id="name" size="30" maxlength="30"/>
</row>
</rows>
</grid>
</dialog>

View File

@@ -1,4 +0,0 @@
create table states (
code varchar(2) primary key,
name varchar(30)
);

View File

@@ -1,51 +0,0 @@
AL Alabama
AK Alaska
AZ Arizona
AR Arkansas
CA California
CO Colorado
CT Connecticut
DE Delaware
FL Florida
GA Georgia
HI Hawaii
ID Idaho
IL Illinois
IN Indiana
IA Iowa
KS Kansas
KY Kentucky
LA Louisiana
ME Maine
MD Maryland
MA Massachusetts
MI Michigan
MN Minnesota
MS Mississippi
MO Missouri
MT Montana
NE Nebraska
NV Nevada
NH New Hampshire
NJ New Jersey
NM New Mexico
NY New York
NC North Carolina
ND North Dakota
OH Ohio
OK Oklahoma
OR Oregon
PA Pennsylvania
RI Rhode Island
SC South Carolina
SD South Dakota
TN Tennessee
TX Texas
UT Utah
VT Vermont
VA Virginia
WA Washington
DC Washington,D.C.
WV West Virginia
WI Wisconsin
WY Wyoming

View File

@@ -1,6 +0,0 @@
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(topsrcdir)/config/rules.mk

31
mozilla/js/src/MANIFEST Normal file
View File

@@ -0,0 +1,31 @@
# This is a list of local files which get copied to the mozilla:dist directory
#
jsapi.h
jspubtd.h
jsarray.h
jsatom.h
jsbool.h
jscntxt.h
jscompat.h
jsconfig.h
jsdate.h
jsdbgapi.h
jsemit.h
jsfun.h
jsgc.h
jsinterp.h
jslock.h
jsmath.h
jsnum.h
jsobj.h
jsopcode.def
jsopcode.h
jsparse.h
jsprvtd.h
jspubtd.h
jsregexp.h
jsscan.h
jsscope.h
jsscript.h
jsstr.h

236
mozilla/js/src/Makefile Normal file
View File

@@ -0,0 +1,236 @@
#! gmake
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../..
include $(DEPTH)/config/config.mk
ifdef MOZ_OJI
DIRS = liveconnect
endif
LIBRARY_NAME = js
ifeq ($(subst /,_,$(shell uname -s)),OS2)
ifndef XCFLAGS
OS2_IMPLIB=1
LIBRARY = js$(MOZ_BITS)$(VERSION_NUMBER).$(LIB_SUFFIX)
DEF_FILE = jsos2$(VERSION_NUMBER).def
EXTRA_LIBS = $(LIBNSPR) $(LIBNSJAVA)
else
EXTRA_LIBS = $(LIBNSPR) $(LIBNSJAVA) $(OBJDIR)/libjs.lib
endif
endif
MODULE = js
CSRCS = jsapi.c \
jsarray.c \
jsatom.c \
jsbool.c \
jscntxt.c \
jsdate.c \
jsdbgapi.c \
jsemit.c \
jsfun.c \
jsgc.c \
jsinterp.c \
jsmath.c \
jsnum.c \
jsobj.c \
jsopcode.c \
jsparse.c \
jsregexp.c \
jsscan.c \
jsscope.c \
jsscript.c \
jsstr.c \
jslock.c \
jsxdrapi.c \
prmjtime.c \
$(NULL)
EXPORTS = jsapi.h \
jsarray.h \
jsatom.h \
jsbool.h \
jscntxt.h \
jscompat.h \
jsconfig.h \
jsdate.h \
jsdbgapi.h \
jsemit.h \
jsfun.h \
jsgc.h \
jsinterp.h \
jslock.h \
jsmath.h \
jsnum.h \
jsobj.h \
jsopcode.def \
jsopcode.h \
jsparse.h \
jsprvtd.h \
jspubtd.h \
jsregexp.h \
jsscan.h \
jsscope.h \
jsscript.h \
jsstr.h \
jsxdrapi.h \
$(NULL)
# when using gcc the assembly is inlined in the C-file (see jslock.c)
ifdef NS_USE_NATIVE
ASFILES = $(wildcard *_$(OS_ARCH).s)
endif
JS_SAFE_ARENA = 1
ifdef JS_SAFE_ARENA
DEFINES += -DJS_USE_SAFE_ARENA
CSRCS += prarena.c
endif
include $(DEPTH)/config/rules.mk
ifndef BUILD_OPT
MOCHAFILE = 1
endif
ifdef JSFILE
DEFINES += -DJSFILE
endif
ifdef JS_THREADSAFE
DEFINES += -DJS_THREADSAFE
endif
ifdef JS_NO_THIN_LOCKS
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
endif
ifdef JS_VERSION
DEFINES += -DJS_VERSION=$(JS_VERSION)
endif
ifeq ($(CPU_ARCH),sparc)
ifndef JS_NO_ULTRA
ULTRA_OPTIONS := -xarch=v8plus,-DULTRA_SPARC
ULTRA_OPTIONSCC := -DULTRA_SPARC
else
ULTRA_OPTIONS := -xarch=v8
ULTRA_OPTIONSCC :=
endif
ifeq ($(shell uname -m),sun4u)
ASFLAGS += -Wa,$(ULTRA_OPTIONS),-P,-L,-D_ASM,-D__STDC__=0 $(ULTRA_OPTIONSCC)
else
ASFLAGS += -Wa,-xarch=v8,-P,-L,-D_ASM,-D__STDC__=0
endif
endif # sparc
INCLUDES += -I.
ifdef NSPR20
INCLUDES += -I$(DIST)/include/nspr20/pr
else
INCLUDES += -I$(XPDIST)/public/nspr
endif
ifndef NSBUILDROOT
JSJAVA_STUBHEADERS = -I$(DEPTH)/sun-java/include/_gen \
-I$(DEPTH)/sun-java/netscape/javascript/_jri \
-I$(DEPTH)/sun-java/netscape/security/_jri
else
JSJAVA_STUBHEADERS = -I$(JRI_GEN_DIR) -I$(JDK_GEN_DIR)
endif
JSJAVA_CFLAGS = -I$(DEPTH)/sun-java/md-include \
-I$(DEPTH)/sun-java/include \
$(JSJAVA_STUBHEADERS)
# LIBNSPR includes unneeded libmsgc21.a, but abstracts nspr version,
# etc. nicely.
LDFLAGS = $(LIBNSPR) -lm
ifeq ($(OS_ARCH), OSF1)
LDFLAGS += -lc_r
endif
ifeq ($(OS_ARCH), SunOS)
LDFLAGS += -lposix4 -ldl -lnsl -lsocket
endif
ifeq ($(OS_ARCH), Linux)
LDFLAGS += -ldl
endif
# this requires clobbering and recompiling with XCFLAGS=-DJSFILE
js:
$(MAKE) clobber
$(MAKE) XCFLAGS=-DJSFILE $(OBJDIR)/js$(BIN_SUFFIX)
.PHONY: js$(BIN_SUFFIX)
ifneq ($(OS_ARCH),OS2)
$(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
@$(MAKE_OBJDIR)
$(CC) -o $@ $(OBJDIR)/js.o $(LIBRARY) $(LDFLAGS)
else
OS_CFLAGS += -tm-
$(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
@$(MAKE_OBJDIR)
$(LINK_EXE) -OUT:$@ $(OBJDIR)/js.o $(LIBRARIES) $(EXTRA_LIBS)
endif
# hardwire dependencies on jsopcode.def
jsopcode.h jsopcode.c: jsopcode.def
# this section was put in the merged by danda into the
# JAVA_*_MERGE section and normally would have
# been removed. However it looks like it shouldn't have
# been put there in the first place, so we're leaving it
# here until danda can confirm (we don't have OS/2 machines
# to build on) - hshaw/sudu
#
ifeq ($(OS_ARCH),OS2)
$(OBJDIR)/js.o: js.c
@$(MAKE_OBJDIR)
$(CC) -Fo$@ -c $(CFLAGS) $(JSJAVA_CFLAGS) js.c
endif
refdiff:
@for f in `cat commfiles`; do \
t=/tmp/refdiff.$$$$; \
trap 'rm -f $$t' 0 1 2 15; \
sed -f prconv.sed ../ref/$$f > $$t; \
cmp -s $$t $$f; \
if test $$? -ne 0; then \
echo "=== $$f"; \
diff $$f $$t; \
fi; \
rm -f $$t; \
done
refconv:
@for f in `cat commfiles`; do \
echo "=== $$f"; \
sed -f prconv.sed ../ref/$$f > $$f; \
done
.PHONY: refdiff refconv

241
mozilla/js/src/Makefile.in Normal file
View File

@@ -0,0 +1,241 @@
#! gmake
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifdef MOZ_OJI
DIRS = liveconnect
endif
LIBRARY_NAME = js
ifeq ($(subst /,_,$(shell uname -s)),OS2)
ifndef XCFLAGS
OS2_IMPLIB=1
LIBRARY = js$(MOZ_BITS)$(VERSION_NUMBER).$(LIB_SUFFIX)
DEF_FILE = jsos2$(VERSION_NUMBER).def
EXTRA_LIBS = $(LIBNSPR) $(LIBNSJAVA)
else
EXTRA_LIBS = $(LIBNSPR) $(LIBNSJAVA) $(OBJDIR)/libjs.lib
endif
endif
MODULE = js
CSRCS = jsapi.c \
jsarray.c \
jsatom.c \
jsbool.c \
jscntxt.c \
jsdate.c \
jsdbgapi.c \
jsemit.c \
jsfun.c \
jsgc.c \
jsinterp.c \
jsmath.c \
jsnum.c \
jsobj.c \
jsopcode.c \
jsparse.c \
jsregexp.c \
jsscan.c \
jsscope.c \
jsscript.c \
jsstr.c \
jslock.c \
jsxdrapi.c \
prmjtime.c \
$(NULL)
EXPORTS = jsapi.h \
jsarray.h \
jsatom.h \
jsbool.h \
jscntxt.h \
jscompat.h \
jsconfig.h \
jsdate.h \
jsdbgapi.h \
jsemit.h \
jsfun.h \
jsgc.h \
jsinterp.h \
jslock.h \
jsmath.h \
jsnum.h \
jsobj.h \
jsopcode.def \
jsopcode.h \
jsparse.h \
jsprvtd.h \
jspubtd.h \
jsregexp.h \
jsscan.h \
jsscope.h \
jsscript.h \
jsstr.h \
jsxdrapi.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
# when using gcc the assembly is inlined in the C-file (see jslock.c)
ifdef NS_USE_NATIVE
ASFILES = $(wildcard $(srcdir)/*_$(OS_ARCH).s)
endif
JS_SAFE_ARENA = 1
ifdef JS_SAFE_ARENA
DEFINES += -DJS_USE_SAFE_ARENA
CSRCS += prarena.c
endif
include $(topsrcdir)/config/rules.mk
ifndef BUILD_OPT
MOCHAFILE = 1
endif
ifdef JSFILE
DEFINES += -DJSFILE
endif
ifdef JS_THREADSAFE
DEFINES += -DJS_THREADSAFE
endif
ifdef JS_NO_THIN_LOCKS
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
endif
ifdef JS_VERSION
DEFINES += -DJS_VERSION=$(JS_VERSION)
endif
ifeq ($(CPU_ARCH),sparc)
ifndef JS_NO_ULTRA
ULTRA_OPTIONS := -xarch=v8plus,-DULTRA_SPARC
ULTRA_OPTIONSCC := -DULTRA_SPARC
else
ULTRA_OPTIONS := -xarch=v8
ULTRA_OPTIONSCC :=
endif
ifeq ($(shell uname -m),sun4u)
ASFLAGS += -Wa,$(ULTRA_OPTIONS),-P,-L,-D_ASM,-D__STDC__=0 $(ULTRA_OPTIONSCC)
else
ASFLAGS += -Wa,-xarch=v8,-P,-L,-D_ASM,-D__STDC__=0
endif
endif # sparc
INCLUDES += -I$(srcdir)
ifdef NSPR20
INCLUDES += -I$(DIST)/include/nspr20/pr
else
INCLUDES += -I$(XPDIST)/public/nspr
endif
ifndef NSBUILDROOT
JSJAVA_STUBHEADERS = -I$(topsrcdir)/sun-java/include/_gen \
-I$(topsrcdir)/sun-java/netscape/javascript/_jri \
-I$(topsrcdir)/sun-java/netscape/security/_jri
else
JSJAVA_STUBHEADERS = -I$(JRI_GEN_DIR) -I$(JDK_GEN_DIR)
endif
JSJAVA_CFLAGS = -I$(topsrcdir)/sun-java/md-include \
-I$(topsrcdir)/sun-java/include \
$(JSJAVA_STUBHEADERS)
# LIBNSPR includes unneeded libmsgc21.a, but abstracts nspr version,
# etc. nicely.
LDFLAGS = $(LIBNSPR) -lm
ifeq ($(OS_ARCH), OSF1)
LDFLAGS += -lc_r
endif
ifeq ($(OS_ARCH), SunOS)
LDFLAGS += -lposix4 -ldl -lnsl -lsocket
endif
ifeq ($(OS_ARCH), Linux)
LDFLAGS += -ldl
endif
# this requires clobbering and recompiling with XCFLAGS=-DJSFILE
js:
$(MAKE) clobber
$(MAKE) XCFLAGS=-DJSFILE $(OBJDIR)/js$(BIN_SUFFIX)
.PHONY: js$(BIN_SUFFIX)
ifneq ($(OS_ARCH),OS2)
$(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
@$(MAKE_OBJDIR)
$(CC) -o $@ $(OBJDIR)/js.o $(LIBRARY) $(LDFLAGS)
else
OS_CFLAGS += -tm-
$(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
@$(MAKE_OBJDIR)
$(LINK_EXE) -OUT:$@ $(OBJDIR)/js.o $(LIBRARIES) $(EXTRA_LIBS)
endif
# hardwire dependencies on jsopcode.def
jsopcode.h jsopcode.c: jsopcode.def
# this section was put in the merged by danda into the
# JAVA_*_MERGE section and normally would have
# been removed. However it looks like it shouldn't have
# been put there in the first place, so we're leaving it
# here until danda can confirm (we don't have OS/2 machines
# to build on) - hshaw/sudu
#
ifeq ($(OS_ARCH),OS2)
$(OBJDIR)/js.o: js.c
@$(MAKE_OBJDIR)
$(CC) -Fo$@ -c $(CFLAGS) $(JSJAVA_CFLAGS) js.c
endif
refdiff:
@for f in `cat commfiles`; do \
t=/tmp/refdiff.$$$$; \
trap 'rm -f $$t' 0 1 2 15; \
sed -f prconv.sed ../ref/$$f > $$t; \
cmp -s $$t $$f; \
if test $$? -ne 0; then \
echo "=== $$f"; \
diff $$f $$t; \
fi; \
rm -f $$t; \
done
refconv:
@for f in `cat commfiles`; do \
echo "=== $$f"; \
sed -f prconv.sed ../ref/$$f > $$f; \
done
.PHONY: refdiff refconv

316
mozilla/js/src/Makefile.ref Normal file
View File

@@ -0,0 +1,316 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# JSRef GNUmake makefile.
#
# Set os+release dependent make variables
OS_ARCH := $(subst /,_,$(shell uname -s))
# Attempt to differentiate between SunOS 5.4 and x86 5.4
OS_CPUARCH := $(shell uname -m)
ifeq ($(OS_CPUARCH),i86pc)
OS_RELEASE := $(shell uname -r)_$(OS_CPUARCH)
else
ifeq ($(OS_ARCH),AIX)
OS_RELEASE := $(shell uname -v).$(shell uname -r)
else
OS_RELEASE := $(shell uname -r)
endif
endif
# Virtually all Linux versions are identical.
# Any distinctions are handled in linux.h
ifeq ($(OS_ARCH),Linux)
OS_CONFIG := Linux_All
else
ifeq ($(OS_ARCH),dgux)
OS_CONFIG := dgux
else
OS_CONFIG := $(OS_ARCH)$(OS_OBJTYPE)$(OS_RELEASE)
endif
endif
ASFLAGS =
DEFINES =
#NS_USE_NATIVE = 1
include config/$(OS_CONFIG).mk
ifdef BUILD_OPT
OPTIMIZER += -O
DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(shell whoami)
OBJDIR_TAG = _OPT
else
ifdef USE_MSVC
OPTIMIZER = -Zi
else
OPTIMIZER = -g
endif
DEFINES += -DDEBUG -DDEBUG_$(shell whoami)
OBJDIR_TAG = _DBG
endif
#DEFINES += -DJS_THREADSAFE
ifdef JS_NO_THIN_LOCKS
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
endif
# Name of the binary code directories
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
VPATH = $(OBJDIR)
# Automatic make dependencies file
DEPENDENCIES = $(OBJDIR)/.md
define MAKE_OBJDIR
if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi
endef
# Look in OBJDIR to find prcpucfg.h
INCLUDES = -I$(OBJDIR)
#
# XCFLAGS may be set in the environment or on the gmake command line
#
CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) \
-DJSFILE $(XCFLAGS)
LDFLAGS = -lm $(XLDFLAGS)
#
# Ask perl what flags it was built with, so we can build js with similar flags
# and link properly. Viva gmake.
#
ifdef PERLCONNECT
DEFINES += -DPERLCONNECT
PERLCFLAGS := $(shell perl -MExtUtils::Embed -e ccopts)
PERLLDFLAGS := $(shell perl -MExtUtils::Embed -e ldopts)
CFLAGS += $(PERLCFLAGS)
LDFLAGS += $(PERLLDFLAGS)
endif
# For purify
PURE_CFLAGS = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \
$(INCLUDES) $(XCFLAGS)
#
# JS file lists
#
JS_HFILES = \
jsarray.h \
jsatom.h \
jsbool.h \
jsconfig.h \
jscntxt.h \
jsdate.h \
jsemit.h \
jsexn.h \
jsfun.h \
jsgc.h \
jsinterp.h \
jslock.h \
jsmath.h \
jsnum.h \
jsobj.h \
jsopcode.h \
jsparse.h \
jsarena.h \
jsclist.h \
jsdtoa.h \
jshash.h \
jslong.h \
jsmacos.h \
jsosdep.h \
jspcos.h \
jsprintf.h \
jstime.h \
jstypes.h \
jsprvtd.h \
jspubtd.h \
jsregexp.h \
jsscan.h \
jsscope.h \
jsscript.h \
jsstr.h \
jsxdrapi.h \
$(NULL)
API_HFILES = \
jsapi.h \
jsdbgapi.h \
$(NULL)
HFILES = $(JS_HFILES) $(API_HFILES)
JS_CFILES = \
jsapi.c \
jsarray.c \
jsatom.c \
jsbool.c \
jscntxt.c \
jsdate.c \
jsdbgapi.c \
jsemit.c \
jsexn.c \
jsfun.c \
jsgc.c \
jsinterp.c \
jslock.c \
jsmath.c \
jsnum.c \
jsobj.c \
jsopcode.c \
jsparse.c \
jsarena.c \
jsdtoa.c \
jshash.c \
jslog2.c \
jslong.c \
jsprf.c \
jsregexp.c \
jsscan.c \
jsscope.c \
jsscript.c \
jsstr.c \
jsutil.c \
jsxdrapi.c \
prmjtime.c \
$(NULL)
ifdef PERLCONNECT
JS_CFILES += jsperl.c
endif
LIB_CFILES = $(JS_CFILES)
LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
PROG_CFILES = js.c
ifdef USE_MSVC
LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.obj))
PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.obj))
else
LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.o))
LIB_OBJS += $(addprefix $(OBJDIR)/, $(LIB_ASFILES:.s=.o))
PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.o))
endif
CFILES = $(LIB_CFILES) $(PROG_CFILES)
OBJS = $(LIB_OBJS) $(PROG_OBJS)
ifdef USE_MSVC
LIBRARY = $(OBJDIR)/js32.dll
PROGRAM = $(OBJDIR)/js
else
LIBRARY = $(OBJDIR)/libjs.a
PROGRAM = $(OBJDIR)/js
endif
ifdef USE_MSVC
TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet
else
TARGETS = $(LIBRARY) $(PROGRAM)
endif
all: $(TARGETS)
clean:
rm -rf $(OBJS)
clobber:
rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES)
depend:
gcc -MM $(CFLAGS) $(JS_CFILES)
$(OBJDIR)/%: %.c
@$(MAKE_OBJDIR)
$(CC) -o $@ $(CFLAGS) $*.c $(LDFLAGS)
$(OBJDIR)/%.o: %.c
@$(MAKE_OBJDIR)
$(CC) -o $@ -c $(CFLAGS) $*.c
$(OBJDIR)/%.o: %.s
@$(MAKE_OBJDIR)
$(AS) -o $@ $(ASFLAGS) $*.s
# windows only
$(OBJDIR)/%.obj: %.c
@$(MAKE_OBJDIR)
$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $*.c
ifeq ($(OS_ARCH),OS2)
$(LIBRARY): $(LIB_OBJS)
$(AR) $@ $? $(AR_OS2_SUFFIX)
$(RANLIB) $@
else
ifdef USE_MSVC
$(LIBRARY): $(LIB_OBJS)
link.exe $(LIB_LINK_FLAGS) /base:0x61000000 \
/out:"$@" /pdb:"$(OBJDIR)/js32.pdb" /implib:"$(OBJDIR)/js32.lib" $?
else
$(LIBRARY): $(LIB_OBJS)
$(AR) rv $@ $?
$(RANLIB) $@
endif
endif
#NSPR_LIBRARY = ../../dist/$(OBJDIR)/lib/libnspr21.so
NSPR_LIBRARY =
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
$(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(NSPR_LIBRARY) $(LDFLAGS)
$(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY)
purify $(PUREFLAGS) \
$(CC) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS)
$(HFILES) $(CFILES): $(OBJDIR)/jscpucfg.h
ifdef PREBUILT_CPUCFG
$(OBJDIR)/jscpucfg.h: jscpucfg.h
cp jscpucfg.h $(OBJDIR)
else
$(OBJDIR)/jscpucfg.h: $(OBJDIR)/jscpucfg
rm -f $@
$(OBJDIR)/jscpucfg > $@
$(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
$(CC) -o $@ $(OBJDIR)/jscpucfg.o
endif
#
# Hardwire dependencies on jsopcode.tbl
#
jsopcode.h jsopcode.c: jsopcode.tbl
-include $(DEPENDENCIES)
TARNAME = jsref.tar
TARFILES = files `cat files`
tar:
tar cvf $(TARNAME) $(TARFILES)
gzip $(TARNAME)
SUFFIXES: .i
%.i: %.c
$(CC) -C -E $(CFLAGS) $< > $*.i

17
mozilla/js/src/README Normal file
View File

@@ -0,0 +1,17 @@
The js/ref directory contains standalone ANSI-C source for the Netscape
JavaScript Reference implementation, JSRef, which was licensed to over 180
companies as part of Netscape ONE, starting in fall 1996. Now, JSRef is
available under NPL from http://www.mozilla.org.
The js/src directory contains source files listed in the file "commfiles",
that are derived via prconv.sed from counterparts in the js/ref directory.
It also contains files such as jscompat.h that are not needed in js/ref.
The Makefile in js/src has refconv and refdiff targets to help keep js/ref
and js/src in synch.
If you think you need to change a file listed in commfiles here, please
make the change in js/ref first and then use prconv.sed or gmake refconv to
get it into js/src. If you have trouble, please let us know by mailing the
JS owner and peers listed in http://www.mozilla.org/owners.html#JavaScript.
Brendan Eich (brendan@mozilla.org), 15-May-98

100
mozilla/js/src/actra.mk Normal file
View File

@@ -0,0 +1,100 @@
#! gmake
#
# Since everyone seems to need to have their own build configuration
# system these days, this is yet another makefile to build JavaScript.
# This makefile conforms to the NSPR20 build rules. If you have built
# NSPR20 this will build JS and stick the lib and bin files over in
# the dist area created by NSPR (which is different from the dist
# expected by the client and also the dist expected by LiveWire, but
# don't get me started).
#
# I don't currently know enough about what sort of JS-engine the Actra
# projects are going to expect so I don't know if we need to add
# to CFLAGS for -DJS_THREADSAFE or -DJSFILE
#
MOD_DEPTH = ../../nspr20
include $(MOD_DEPTH)/config/config.mk
INCLUDES = -I$(DIST)/include
CFLAGS += -DNSPR20
CSRCS = prmjtime.c \
jsapi.c \
jsarray.c \
jsatom.c \
jsbool.c \
jscntxt.c \
jsdate.c \
jsdbgapi.c \
jsemit.c \
jsfun.c \
jsgc.c \
jsinterp.c \
jsmath.c \
jsnum.c \
jsobj.c \
jsopcode.c \
jsparse.c \
jsregexp.c \
jsscan.c \
jsscope.c \
jsscript.c \
jsstr.c \
jslock.c \
$(NULL)
HEADERS = jsapi.h \
jsarray.h \
jsatom.h \
jsbool.h \
jscntxt.h \
jscompat.h \
jsconfig.h \
jsdate.h \
jsdbgapi.h \
jsemit.h \
jsfun.h \
jsgc.h \
jsinterp.h \
jslock.h \
jsmath.h \
jsnum.h \
jsobj.h \
jsopcode.def \
jsopcode.h \
jsparse.h \
jsprvtd.h \
jspubtd.h \
jsregexp.h \
jsscan.h \
jsscope.h \
jsscript.h \
jsstr.h \
$(NULL)
ifeq ($(OS_ARCH), WINNT)
EXTRA_LIBS += $(DIST)/lib/libnspr$(MOD_VERSION).lib
EXTRA_LIBS += $(DIST)/lib/libplds$(MOD_VERSION).lib
else
EXTRA_LIBS += -L$(DIST)/lib -lnspr$(MOD_VERSION) -lnplds$(MOD_VERSION)
endif
LIBRARY_NAME = js
LIBRARY_VERSION = $(MOD_VERSION)
RELEASE_HEADERS = $(HEADERS)
RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
RELEASE_LIBS = $(TARGETS)
include $(MOD_DEPTH)/config/rules.mk
export:: $(TARGETS)
$(INSTALL) -m 444 $(HEADERS) $(MOD_DEPTH)/../dist/public/$(LIBRARY_NAME)
$(INSTALL) -m 444 $(TARGETS) $(DIST)/lib
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin
install:: export

51
mozilla/js/src/commfiles Normal file
View File

@@ -0,0 +1,51 @@
js.c
jsapi.c
jsapi.h
jsarray.c
jsarray.h
jsatom.c
jsatom.h
jsbool.c
jsbool.h
jscntxt.c
jscntxt.h
jsconfig.h
jsdate.c
jsdate.h
jsdbgapi.c
jsdbgapi.h
jsemit.c
jsemit.h
jsfun.c
jsfun.h
jsgc.c
jsgc.h
jsinterp.c
jsinterp.h
jslock.h
jslock.c
jsmath.c
jsmath.h
jsnum.c
jsnum.h
jsobj.c
jsobj.h
jsopcode.c
jsopcode.def
jsopcode.h
jsparse.c
jsparse.h
jsprvtd.h
jspubtd.h
jsregexp.c
jsregexp.h
jsscan.c
jsscan.h
jsscope.c
jsscope.h
jsscript.c
jsscript.h
jsstr.c
jsstr.h
jsxdrapi.h
jsxdrapi.c

View File

@@ -0,0 +1,37 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for AIX
#
CC = xlC_r
CCC = xlC_r
RANLIB = ranlib
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
ARCH := aix
CPU_ARCH = rs6000
GFX_ARCH = x
INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1
OS_CFLAGS = -qarch=com -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV
OS_LIBS = -lbsd -lsvld -lm
#-lpthreads -lc_r

View File

@@ -0,0 +1,37 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for AIX
#
CC = xlC_r
CCC = xlC_r
RANLIB = ranlib
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
ARCH := aix
CPU_ARCH = rs6000
GFX_ARCH = x
INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1
OS_CFLAGS = -qarch=com -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV
OS_LIBS = -lbsd -lsvld -lm
#-lpthreads -lc_r

View File

@@ -0,0 +1,48 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for HPUX
#
CC = gcc -Wall -Wno-format
CCC = g++ -Wall -Wno-format
RANLIB = echo
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
CPU_ARCH = hppa
GFX_ARCH = x
OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -D_SVID_GETTOD
OS_LIBS = -ldld
ifeq ($(OS_RELEASE),B.10)
PLATFORM_FLAGS += -DHPUX10 -Dhpux10
PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H
ifeq ($(OS_VERSION),.10)
PLATFORM_FLAGS += -DHPUX10_10
endif
ifeq ($(OS_VERSION),.20)
PLATFORM_FLAGS += -DHPUX10_20
endif
ifeq ($(OS_VERSION),.30)
PLATFORM_FLAGS += -DHPUX10_30
endif
endif

View File

@@ -0,0 +1,48 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for HPUX
#
CC = gcc -Wall -Wno-format
CCC = g++ -Wall -Wno-format
RANLIB = echo
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
CPU_ARCH = hppa
GFX_ARCH = x
OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -D_SVID_GETTOD
OS_LIBS = -ldld
ifeq ($(OS_RELEASE),B.10)
PLATFORM_FLAGS += -DHPUX10 -Dhpux10
PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H
ifeq ($(OS_VERSION),.10)
PLATFORM_FLAGS += -DHPUX10_10
endif
ifeq ($(OS_VERSION),.20)
PLATFORM_FLAGS += -DHPUX10_20
endif
ifeq ($(OS_VERSION),.30)
PLATFORM_FLAGS += -DHPUX10_30
endif
endif

View File

@@ -0,0 +1,58 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for IRIX
#
CPU_ARCH = mips
GFX_ARCH = x
RANLIB = /bin/true
#NS_USE_GCC = 1
ifdef NS_USE_GCC
CC = gcc
CCC = g++
AS = $(CC) -x assembler-with-cpp
ODD_CFLAGS = -Wall -Wno-format
ifdef BUILD_OPT
OPTIMIZER = -O6
endif
else
ifeq ($(OS_RELEASE),6.2)
CC = cc -32 -DIRIX6_2
endif
ifeq ($(OS_RELEASE),6.3)
CC = cc -32 -DIRIX6_3
endif
CCC = CC
ODD_CFLAGS = -fullwarn -xansi
ifdef BUILD_OPT
OPTIMIZER += -Olimit 4000
endif
endif
# For purify
HAVE_PURIFY = 1
PURE_OS_CFLAGS = $(ODD_CFLAGS) -DXP_UNIX -DSVR4 -DSW_THREADS -DIRIX
OS_CFLAGS = $(PURE_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
BSDECHO = echo
MKSHLIB = $(LD) -shared

View File

@@ -0,0 +1,22 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for IRIX5.3
#
include config/IRIX.mk

View File

@@ -0,0 +1,22 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for IRIX6.3
#
include config/IRIX.mk

View File

@@ -0,0 +1,22 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for IRIX6.2
#
include config/IRIX.mk

View File

@@ -0,0 +1,22 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for IRIX6.3
#
include config/IRIX.mk

View File

@@ -0,0 +1,47 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config for all versions of Linux
#
CC = gcc -Wall -Wno-format
CCC = g++ -Wall -Wno-format
RANLIB = echo
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
CPU_ARCH = $(shell uname -m)
ifeq (86,$(findstring 86,$(CPU_ARCH)))
CPU_ARCH = x86
endif
GFX_ARCH = x
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DLINUX
OS_LIBS = -lm -lc
ASFLAGS += -x assembler-with-cpp
ifeq ($(CPU_ARCH),alpha)
# Ask the C compiler on alpha linux to let us work with denormalized
# double values, which are required by the ECMA spec.
OS_CFLAGS += -mieee
endif

View File

@@ -0,0 +1,79 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for SunOS4.1
#
CC = gcc
CCC = g++
RANLIB = ranlib
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
CPU_ARCH = sparc
GFX_ARCH = x
# A pile of -D's to build xfe on sunos
MOZ_CFLAGS = -DSTRINGS_ALIGNED -DNO_REGEX -DNO_ISDIR -DUSE_RE_COMP \
-DNO_REGCOMP -DUSE_GETWD -DNO_MEMMOVE -DNO_ALLOCA \
-DBOGUS_MB_MAX -DNO_CONST
# Purify doesn't like -MDupdate
NOMD_OS_CFLAGS = -DXP_UNIX -Wall -Wno-format -DSW_THREADS -DSUNOS4 -DNEED_SYSCALL \
$(MOZ_CFLAGS)
OS_CFLAGS = $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
OS_LIBS = -ldl -lm
MKSHLIB = $(LD) -L$(MOTIF)/lib
HAVE_PURIFY = 1
MOTIF = /home/motif/usr
MOTIFLIB = -L$(MOTIF)/lib -lXm
INCLUDES += -I/usr/X11R5/include -I$(MOTIF)/include
NOSUCHFILE = /solaris-rm-f-sucks
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/sunos.lm
EN_LOCALE = en_US
DE_LOCALE = de
FR_LOCALE = fr
JP_LOCALE = ja
SJIS_LOCALE = ja_JP.SJIS
KR_LOCALE = ko
CN_LOCALE = zh
TW_LOCALE = zh_TW
I2_LOCALE = i2
IT_LOCALE = it
SV_LOCALE = sv
ES_LOCALE = es
NL_LOCALE = nl
PT_LOCALE = pt
LOC_LIB_DIR = /usr/openwin/lib/locale
BSDECHO = echo
#
# These defines are for building unix plugins
#
BUILD_UNIX_PLUGINS = 1
DSO_LDOPTS =
DSO_LDFLAGS =

View File

@@ -0,0 +1,66 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for SunOS5.3
#
CC = gcc -Wall -Wno-format
CCC = g++ -Wall -Wno-format
#CC = /opt/SUNWspro/SC3.0.1/bin/cc
RANLIB = echo
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
CPU_ARCH = sparc
GFX_ARCH = x
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS
OS_LIBS = -lsocket -lnsl -ldl
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
HAVE_PURIFY = 1
NOSUCHFILE = /solaris-rm-f-sucks
ifndef JS_NO_ULTRA
ULTRA_OPTIONS := -xarch=v8plus
ULTRA_OPTIONSD := -DULTRA_SPARC
else
ULTRA_OPTIONS := -xarch=v8
ULTRA_OPTIONSD :=
endif
ifeq ($(OS_CPUARCH),sun4u)
DEFINES += $(ULTRA_OPTIONSD)
ifeq ($(findstring gcc,$(CC)),gcc)
DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD)
else
ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD)
endif
endif
ifeq ($(OS_CPUARCH),sun4m)
ifeq ($(findstring gcc,$(CC)),gcc)
DEFINES += -Wa,-xarch=v8
else
ASFLAGS += -xarch=v8
endif
endif

View File

@@ -0,0 +1,67 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for SunOS5.4
#
ifdef NS_USE_NATIVE
CC = cc
CCC = CC
else
CC = gcc -Wall -Wno-format
CCC = g++ -Wall -Wno-format
endif
RANLIB = echo
CPU_ARCH = sparc
GFX_ARCH = x
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D__svr4 -DSOLARIS
OS_LIBS = -lsocket -lnsl -ldl
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
HAVE_PURIFY = 1
NOSUCHFILE = /solaris-rm-f-sucks
ifndef JS_NO_ULTRA
ULTRA_OPTIONS := -xarch=v8plus
ULTRA_OPTIONSD := -DULTRA_SPARC
else
ULTRA_OPTIONS := -xarch=v8
ULTRA_OPTIONSD :=
endif
ifeq ($(OS_CPUARCH),sun4u)
DEFINES += $(ULTRA_OPTIONSD)
ifeq ($(findstring gcc,$(CC)),gcc)
DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD)
else
ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD)
endif
endif
ifeq ($(OS_CPUARCH),sun4m)
ifeq ($(findstring gcc,$(CC)),gcc)
DEFINES += -Wa,-xarch=v8
else
ASFLAGS += -xarch=v8
endif
endif

View File

@@ -0,0 +1,71 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for SunOS5.5
#
AS = as
ifndef NS_USE_NATIVE
CC = gcc -Wall -Wno-format
CCC = g++ -Wall
else
CC = cc
CCC = CC
endif
RANLIB = echo
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
CPU_ARCH = sparc
GFX_ARCH = x
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -D_SVID_GETTOD
OS_LIBS = -lsocket -lnsl -ldl
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
HAVE_PURIFY = 1
NOSUCHFILE = /solaris-rm-f-sucks
ifndef JS_NO_ULTRA
ULTRA_OPTIONS := -xarch=v8plus
ULTRA_OPTIONSD := -DULTRA_SPARC
else
ULTRA_OPTIONS := -xarch=v8
ULTRA_OPTIONSD :=
endif
ifeq ($(OS_CPUARCH),sun4u)
DEFINES += $(ULTRA_OPTIONSD)
ifeq ($(findstring gcc,$(CC)),gcc)
DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD)
else
ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD)
endif
endif
ifeq ($(OS_CPUARCH),sun4m)
ifeq ($(findstring gcc,$(CC)),gcc)
DEFINES += -Wa,-xarch=v8
else
ASFLAGS += -xarch=v8
endif
endif

View File

@@ -0,0 +1,62 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for SunOS5.5
#
AS = as
CC = gcc -Wall -Wno-format
CCC = g++ -Wall -Wno-format
#CC = /opt/SUNWspro/SC3.0.1/bin/cc
RANLIB = echo
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
CPU_ARCH = sparc
GFX_ARCH = x
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -D_SVID_GETTOD
OS_LIBS = -lsocket -lnsl -ldl
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
HAVE_PURIFY = 1
NOSUCHFILE = /solaris-rm-f-sucks
ifndef JS_NO_ULTRA
ULTRA_OPTIONS := -xarch=v8plus -DULTRA_SPARC
else
ULTRA_OPTIONS := -xarch=v8
endif
ifeq ($(OS_CPUARCH),sun4u)
ASFLAGS += $(ULTRA_OPTIONS)
ifeq ($(findstring gcc,$(CC)),gcc)
DEFINES += -Wa,$(ULTRA_OPTIONS)
endif
else
ifeq ($(OS_CPUARCH),sun4m)
ASFLAGS += -xarch=v8
ifeq ($(findstring gcc,$(CC)),gcc)
DEFINES += -Wa,-xarch=v8
endif
endif
endif

View File

@@ -0,0 +1,46 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# Config for Windows NT using MS Visual C++ (version?)
#
CC = cl
RANLIB = echo
#.c.o:
# $(CC) -c -MD $*.d $(CFLAGS) $<
CPU_ARCH = x86 # XXX fixme
GFX_ARCH = win32
OS_CFLAGS = -DXP_PC -DWIN32 -D_WINDOWS -D_WIN32
OS_LIBS = -lm -lc
PREBUILT_CPUCFG = 1
USE_MSVC = 1
LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib /nologo\
/subsystem:windows /dll /incremental:yes /debug\
/machine:I386
CAFEDIR = t:/cafe
JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip
JAVAC = $(CAFEDIR)/Bin/sj.exe
JAVAH = $(CAFEDIR)/Java/Bin/javah.exe
JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32

View File

@@ -0,0 +1,42 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# Config stuff for Data General DG/UX
#
#
# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com)
#
AS = as
CC = gcc
CCC = g++
RANLIB = echo
#
# _DGUX_SOURCE is needed to turn on a lot of stuff in the headers if
# you're not using DG's compiler. It shouldn't hurt if you are.
#
# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in
# prtime.c
#
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DDGUX -D_DGUX_SOURCE -D_POSIX4A_DRAFT10_SOURCE
OS_LIBS = -lsocket -lnsl
NOSUCHFILE = /no-such-file

30
mozilla/js/src/export.mac Normal file
View File

@@ -0,0 +1,30 @@
# This is a list of local files which get copied to the mozilla:dist directory
#
jsapi.h
jsarray.h
jsatom.h
jsbool.h
jscntxt.h
jscompat.h
jsconfig.h
jsdate.h
jsdbgapi.h
jsemit.h
jsfun.h
jsgc.h
jsinterp.h
jslock.h
jsmath.h
jsnum.h
jsobj.h
jsopcode.def
jsopcode.h
jsparse.h
jsprvtd.h
jspubtd.h
jsregexp.h
jsscan.h
jsscope.h
jsscript.h
jsstr.h

1545
mozilla/js/src/js.c Normal file

File diff suppressed because it is too large Load Diff

184
mozilla/js/src/js.dsp Normal file
View File

@@ -0,0 +1,184 @@
# Microsoft Developer Studio Project File - Name="jsshell" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=jsshell - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "js.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "js.mak" CFG="jsshell - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "jsshell - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "jsshell - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "jsshell - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\jsshell_"
# PROP BASE Intermediate_Dir ".\jsshell_"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "mininspr" /D "NDEBUG" /D "_CONSOLE" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "_WINDOWS" /D "JSFILE" /D "MINI_NSPR" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:".\Release\jsshell.exe"
!ELSEIF "$(CFG)" == "jsshell - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\jsshell0"
# PROP BASE Intermediate_Dir ".\jsshell0"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "mininspr" /D "_DEBUG" /D "DEBUG" /D "_CONSOLE" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "_WINDOWS" /D "JSFILE" /D "MINI_NSPR" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:".\Debug\jsshell.exe"
!ENDIF
# Begin Target
# Name "jsshell - Win32 Release"
# Name "jsshell - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\js.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\jsapi.h
# End Source File
# Begin Source File
SOURCE=.\jsatom.h
# End Source File
# Begin Source File
SOURCE=.\jscntxt.h
# End Source File
# Begin Source File
SOURCE=.\jsdbgapi.h
# End Source File
# Begin Source File
SOURCE=.\jsemit.h
# End Source File
# Begin Source File
SOURCE=.\jsfun.h
# End Source File
# Begin Source File
SOURCE=.\jsgc.h
# End Source File
# Begin Source File
SOURCE=.\jsinterp.h
# End Source File
# Begin Source File
SOURCE=.\jslock.h
# End Source File
# Begin Source File
SOURCE=.\jsobj.h
# End Source File
# Begin Source File
SOURCE=.\jsopcode.h
# End Source File
# Begin Source File
SOURCE=.\jsparse.h
# End Source File
# Begin Source File
SOURCE=.\jsprvtd.h
# End Source File
# Begin Source File
SOURCE=.\jspubtd.h
# End Source File
# Begin Source File
SOURCE=.\jsregexp.h
# End Source File
# Begin Source File
SOURCE=.\jsscan.h
# End Source File
# Begin Source File
SOURCE=.\jsscope.h
# End Source File
# Begin Source File
SOURCE=.\jsscript.h
# End Source File
# Begin Source File
SOURCE=.\jsstddef.h
# End Source File
# Begin Source File
SOURCE=.\jsstr.h
# End Source File
# Begin Source File
SOURCE=.\prarena.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

56
mozilla/js/src/js.dsw Normal file
View File

@@ -0,0 +1,56 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "js32"=.\js32.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "jsshell"=.\js.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name js32
End Project Dependency
}}}
###############################################################################
Project: "miniNSPR"=.\miniNSPR.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

3756
mozilla/js/src/js.mak Normal file

File diff suppressed because it is too large Load Diff

BIN
mozilla/js/src/js.mdp Normal file

Binary file not shown.

194
mozilla/js/src/js.msg Normal file
View File

@@ -0,0 +1,194 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
This is the JavaScript error message file.
The format for each JS error message is:
MSG_DEF(<SYMBOLIC_NAME>, <ERROR_NUMBER>, <ARGUMENT_COUNT>, <EXCEPTION_NAME>,
<FORMAT_STRING>)
where ;
<SYMBOLIC_NAME> is a legal C identifer that will be used in the
JS engine source.
<ERROR_NUMBER> is an unique integral value identifying this error.
<ARGUMENT_COUNT> is an integer literal specifying the total number of
replaceable arguments in the following format string.
<EXCEPTION_NAME> is an exception index from the enum in jsexn.c;
JSEXN_NONE for none. The given exception index will be raised by the
engine when the corresponding error occurs.
<FORMAT_STRING> is a string literal, optionally containing sequences
{X} where X is an integer representing the argument number that will
be replaced with a string value when the error is reported.
e.g.
MSG_DEF(JSMSG_NOT_A_SUBSPECIES, 73, JSEXN_NONE, 2,
"{0} is not a member of the {1} family")
can be used :
JS_ReportErrorNumber(JSMSG_NOT_A_SUBSPECIES, "Rhino", "Monkey");
to report :
"Rhino is not a member of the Monkey family"
*/
MSG_DEF(JSMSG_NOT_AN_ERROR, 0, 0, JSEXN_NONE, "<Error #0 is reserved>")
MSG_DEF(JSMSG_NOT_DEFINED, 1, 1, JSEXN_REFERENCEERR, "{0} is not defined")
MSG_DEF(JSMSG_NO_REG_EXPS, 2, 1, JSEXN_INTERNALERR, "sorry, regular expression are not supported")
MSG_DEF(JSMSG_MORE_ARGS_NEEDED, 3, 3, JSEXN_NONE, "{0} requires more than {1} argument{2}")
MSG_DEF(JSMSG_BAD_CHAR, 4, 1, JSEXN_NONE, "invalid format character {0}")
MSG_DEF(JSMSG_BAD_TYPE, 5, 1, JSEXN_NONE, "unknown type {0}")
MSG_DEF(JSMSG_CANT_LOCK, 6, 0, JSEXN_NONE, "can't lock memory")
MSG_DEF(JSMSG_CANT_UNLOCK, 7, 0, JSEXN_NONE, "can't unlock memory")
MSG_DEF(JSMSG_INCOMPATIBLE_PROTO, 8, 3, JSEXN_TARGETERR, "{0}.prototype.{1} called on incompatible {2}")
MSG_DEF(JSMSG_NO_CONSTRUCTOR, 9, 1, JSEXN_NONE, "{0} has no constructor")
MSG_DEF(JSMSG_CANT_ALIAS, 10, 3, JSEXN_NONE, "can't alias {0} to {1} in class {2}")
MSG_DEF(JSMSG_NO_PROTO, 11, 1, JSEXN_INTERNALERR, "sorry, Array.prototype.{0} is not yet implemented")
MSG_DEF(JSMSG_BAD_SORT_ARG, 12, 0, JSEXN_ARRAYERR, "invalid Array.prototype.sort argument")
MSG_DEF(JSMSG_BAD_ATOMIC_NUMBER, 13, 1, JSEXN_INTERNALERR, "internal error: no index for atom {0}")
MSG_DEF(JSMSG_TOO_MANY_LITERALS, 14, 0, JSEXN_INTERNALERR, "too many literals")
MSG_DEF(JSMSG_CANT_WATCH, 15, 1, JSEXN_NONE, "can't watch non-native objects of class {0}")
MSG_DEF(JSMSG_STACK_UNDERFLOW, 16, 2, JSEXN_INTERNALERR, "internal error compiling {0}: stack underflow at pc {1}")
MSG_DEF(JSMSG_NEED_DIET, 17, 1, JSEXN_SYNTAXERR, "{0} too large")
MSG_DEF(JSMSG_BAD_CASE, 18, 2, JSEXN_SYNTAXERR, "{0}, line {1}: invalid case expression")
MSG_DEF(JSMSG_READ_ONLY, 19, 1, JSEXN_ERR, "{0} is read-only")
MSG_DEF(JSMSG_BAD_FORMAL, 20, 0, JSEXN_SYNTAXERR, "malformed formal parameter")
MSG_DEF(JSMSG_SAME_FORMAL, 21, 1, JSEXN_NONE, "duplicate formal argument {0}")
MSG_DEF(JSMSG_NOT_FUNCTION, 22, 1, JSEXN_CALLERR, "{0} is not a function")
MSG_DEF(JSMSG_NOT_CONSTRUCTOR, 23, 1, JSEXN_CONSTRUCTORERR, "{0} is not a constructor")
MSG_DEF(JSMSG_STACK_OVERFLOW, 24, 1, JSEXN_NONE, "stack overflow in {0}")
MSG_DEF(JSMSG_NOT_EXPORTED, 25, 1, JSEXN_NONE, "{0} is not exported")
MSG_DEF(JSMSG_OVER_RECURSED, 26, 0, JSEXN_NONE, "too much recursion")
MSG_DEF(JSMSG_IN_NOT_OBJECT, 27, 0, JSEXN_ERR, "target of 'in' operator must be an object")
MSG_DEF(JSMSG_BAD_NEW_RESULT, 28, 1, JSEXN_NONE, "invalid new expression result {0}")
MSG_DEF(JSMSG_BAD_SHARP_DEF, 29, 1, JSEXN_ERR, "invalid sharp variable definition #{0}=")
MSG_DEF(JSMSG_BAD_SHARP_USE, 30, 1, JSEXN_ERR, "invalid sharp variable use #{0}#")
MSG_DEF(JSMSG_BAD_INSTANCEOF_RHS, 31, 1, JSEXN_ERR, "invalid instanceof operand {0}")
MSG_DEF(JSMSG_BAD_BYTECODE, 32, 1, JSEXN_INTERNALERR, "unimplemented JavaScript bytecode {0}")
MSG_DEF(JSMSG_BAD_RADIX, 33, 1, JSEXN_ERR, "illegal radix {0}")
MSG_DEF(JSMSG_NAN, 34, 1, JSEXN_ERR, "{0} is not a number")
MSG_DEF(JSMSG_CANT_CONVERT, 35, 1, JSEXN_TOPRIMITIVEERR, "can't convert {0} to an integer")
MSG_DEF(JSMSG_CYCLIC_VALUE, 36, 1, JSEXN_ERR, "cyclic {0} value")
MSG_DEF(JSMSG_PERMANENT, 37, 1, JSEXN_ERR, "{0} is permanent")
MSG_DEF(JSMSG_CANT_CONVERT_TO, 38, 2, JSEXN_DEFAULTVALUEERR, "can't convert {0} to {1}")
MSG_DEF(JSMSG_NO_PROPERTIES, 39, 1, JSEXN_TOOBJECTERR, "{0} has no properties")
MSG_DEF(JSMSG_CANT_FIND_CLASS, 40, 1, JSEXN_NONE, "can't find class id {0}")
MSG_DEF(JSMSG_CANT_XDR_CLASS, 41, 1, JSEXN_NONE, "can't XDR class {0}")
MSG_DEF(JSMSG_BYTECODE_TOO_BIG, 42, 2, JSEXN_INTERNALERR, "bytecode {0} too large (limit {1})")
MSG_DEF(JSMSG_UNKNOWN_FORMAT, 43, 1, JSEXN_INTERNALERR, "unknown bytecode format {0}")
MSG_DEF(JSMSG_TOO_MANY_CON_ARGS, 44, 0, JSEXN_SYNTAXERR, "too many constructor arguments")
MSG_DEF(JSMSG_TOO_MANY_FUN_ARGS, 45, 0, JSEXN_SYNTAXERR, "too many function arguments")
MSG_DEF(JSMSG_BAD_QUANTIFIER, 46, 1, JSEXN_SYNTAXERR, "invalid quantifier {0}")
MSG_DEF(JSMSG_MIN_TOO_BIG, 47, 1, JSEXN_SYNTAXERR, "overlarge minimum {0}")
MSG_DEF(JSMSG_MAX_TOO_BIG, 48, 1, JSEXN_SYNTAXERR, "overlarge maximum {0}")
MSG_DEF(JSMSG_OUT_OF_ORDER, 49, 1, JSEXN_SYNTAXERR, "maximum {0} less than minimum")
MSG_DEF(JSMSG_ZERO_QUANTIFIER, 50, 1, JSEXN_SYNTAXERR, "zero quantifier {0}")
MSG_DEF(JSMSG_UNTERM_QUANTIFIER, 51, 1, JSEXN_SYNTAXERR, "unterminated quantifier {0}")
MSG_DEF(JSMSG_EMPTY_BEFORE_STAR, 52, 0, JSEXN_SYNTAXERR, "regular expression before * could be empty")
MSG_DEF(JSMSG_EMPTY_BEFORE_PLUS, 53, 0, JSEXN_SYNTAXERR, "regular expression before + could be empty")
MSG_DEF(JSMSG_MISSING_PAREN, 54, 1, JSEXN_SYNTAXERR, "unterminated parenthetical {0}")
MSG_DEF(JSMSG_UNTERM_CLASS, 55, 1, JSEXN_SYNTAXERR, "unterminated character class {0}")
MSG_DEF(JSMSG_TRAILING_SLASH, 56, 0, JSEXN_SYNTAXERR, "trailing \\ in regular expression")
MSG_DEF(JSMSG_BAD_CLASS_RANGE, 57, 0, JSEXN_SYNTAXERR, "invalid range in character class")
MSG_DEF(JSMSG_BAD_FLAG, 58, 1, JSEXN_SYNTAXERR, "invalid regular expression flag {0}")
MSG_DEF(JSMSG_NO_INPUT, 59, 3, JSEXN_SYNTAXERR, "no input for /{0}/{1}{2}")
MSG_DEF(JSMSG_CANT_OPEN, 60, 2, JSEXN_NONE, "can't open {0}: {1}")
MSG_DEF(JSMSG_BAD_STRING_MASK, 61, 1, JSEXN_ERR, "invalid string escape mask {0}")
MSG_DEF(JSMSG_NO_STRING_PROTO, 62, 1, JSEXN_INTERNALERR, "sorry, String.prototype.{0} is not yet implemented")
MSG_DEF(JSMSG_END_OF_DATA, 63, 0, JSEXN_NONE, "unexpected end of data")
MSG_DEF(JSMSG_SEEK_BEYOND_START, 64, 0, JSEXN_NONE, "illegal seek beyond start")
MSG_DEF(JSMSG_SEEK_BEYOND_END, 65, 0, JSEXN_NONE, "illegal seek beyond end")
MSG_DEF(JSMSG_END_SEEK, 66, 0, JSEXN_NONE, "illegal end-based seek")
MSG_DEF(JSMSG_WHITHER_WHENCE, 67, 1, JSEXN_NONE, "unknown seek whence: {0}")
MSG_DEF(JSMSG_BAD_JVAL_TYPE, 68, 1, JSEXN_NONE, "unknown jsval type {0} for XDR")
MSG_DEF(JSMSG_PAREN_BEFORE_FORMAL, 69, 0, JSEXN_SYNTAXERR, "missing ( before formal parameters")
MSG_DEF(JSMSG_MISSING_FORMAL, 70, 0, JSEXN_SYNTAXERR, "missing formal parameter")
MSG_DEF(JSMSG_PAREN_AFTER_FORMAL, 71, 0, JSEXN_SYNTAXERR, "missing ) after formal parameters")
MSG_DEF(JSMSG_CURLY_BEFORE_BODY, 72, 0, JSEXN_SYNTAXERR, "missing { before function body")
MSG_DEF(JSMSG_CURLY_AFTER_BODY, 73, 0, JSEXN_SYNTAXERR, "missing } after function body")
MSG_DEF(JSMSG_PAREN_BEFORE_COND, 74, 0, JSEXN_SYNTAXERR, "missing ( before condition")
MSG_DEF(JSMSG_PAREN_AFTER_COND, 75, 0, JSEXN_SYNTAXERR, "missing ) after condition")
MSG_DEF(JSMSG_NO_IMPORT_NAME, 76, 0, JSEXN_SYNTAXERR, "missing name in import statement")
MSG_DEF(JSMSG_NAME_AFTER_DOT, 77, 0, JSEXN_SYNTAXERR, "missing name after . operator")
MSG_DEF(JSMSG_BRACKET_IN_INDEX, 78, 0, JSEXN_SYNTAXERR, "missing ] in index expression")
MSG_DEF(JSMSG_NO_EXPORT_NAME, 79, 0, JSEXN_SYNTAXERR, "missing name in export statement")
MSG_DEF(JSMSG_PAREN_BEFORE_SWITCH, 80, 0, JSEXN_SYNTAXERR, "missing ( before switch expression")
MSG_DEF(JSMSG_PAREN_AFTER_SWITCH, 81, 0, JSEXN_SYNTAXERR, "missing ) after switch expression")
MSG_DEF(JSMSG_CURLY_BEFORE_SWITCH, 82, 0, JSEXN_SYNTAXERR, "missing { before switch body")
MSG_DEF(JSMSG_COLON_AFTER_CASE, 83, 0, JSEXN_SYNTAXERR, "missing : after case label")
MSG_DEF(JSMSG_WHILE_AFTER_DO, 84, 0, JSEXN_SYNTAXERR, "missing while after do-loop body")
MSG_DEF(JSMSG_PAREN_AFTER_FOR, 85, 0, JSEXN_SYNTAXERR, "missing ( after for")
MSG_DEF(JSMSG_SEMI_AFTER_FOR_INIT, 86, 0, JSEXN_SYNTAXERR, "missing ; after for-loop initializer")
MSG_DEF(JSMSG_SEMI_AFTER_FOR_COND, 87, 0, JSEXN_SYNTAXERR, "missing ; after for-loop condition")
MSG_DEF(JSMSG_PAREN_AFTER_FOR_CTRL, 88, 0, JSEXN_SYNTAXERR, "missing ) after for-loop control")
MSG_DEF(JSMSG_CURLY_BEFORE_TRY, 89, 0, JSEXN_SYNTAXERR, "missing { before try block")
MSG_DEF(JSMSG_CURLY_AFTER_TRY, 90, 0, JSEXN_SYNTAXERR, "missing } after try block")
MSG_DEF(JSMSG_PAREN_BEFORE_CATCH, 91, 0, JSEXN_SYNTAXERR, "missing ( before catch")
MSG_DEF(JSMSG_CATCH_IDENTIFIER, 92, 0, JSEXN_SYNTAXERR, "missing identifier in catch")
MSG_DEF(JSMSG_PAREN_AFTER_CATCH, 93, 0, JSEXN_SYNTAXERR, "missing ) after catch")
MSG_DEF(JSMSG_CURLY_BEFORE_CATCH, 94, 0, JSEXN_SYNTAXERR, "missing { before catch block")
MSG_DEF(JSMSG_CURLY_AFTER_CATCH, 95, 0, JSEXN_SYNTAXERR, "missing } after catch block")
MSG_DEF(JSMSG_CURLY_BEFORE_FINALLY, 96, 0, JSEXN_SYNTAXERR, "missing { before finally block")
MSG_DEF(JSMSG_CURLY_AFTER_FINALLY, 97, 0, JSEXN_SYNTAXERR, "missing } after finally block")
MSG_DEF(JSMSG_CATCH_OR_FINALLY, 98, 0, JSEXN_SYNTAXERR, "missing catch or finally after try")
MSG_DEF(JSMSG_PAREN_BEFORE_WITH, 99, 0, JSEXN_SYNTAXERR, "missing ( before with-statement object")
MSG_DEF(JSMSG_PAREN_AFTER_WITH, 100, 0, JSEXN_SYNTAXERR, "missing ) after with-statement object")
MSG_DEF(JSMSG_CURLY_IN_COMPOUND, 101, 0, JSEXN_SYNTAXERR, "missing } in compound statement")
MSG_DEF(JSMSG_NO_VARIABLE_NAME, 102, 0, JSEXN_SYNTAXERR, "missing variable name")
MSG_DEF(JSMSG_COLON_IN_COND, 103, 0, JSEXN_SYNTAXERR, "missing : in conditional expression")
MSG_DEF(JSMSG_PAREN_AFTER_ARGS, 104, 0, JSEXN_SYNTAXERR, "missing ) after argument list")
MSG_DEF(JSMSG_BRACKET_AFTER_LIST, 105, 0, JSEXN_SYNTAXERR, "missing ] after element list")
MSG_DEF(JSMSG_COLON_AFTER_ID, 106, 0, JSEXN_SYNTAXERR, "missing : after property id")
MSG_DEF(JSMSG_CURLY_AFTER_LIST, 107, 0, JSEXN_SYNTAXERR, "missing } after property list")
MSG_DEF(JSMSG_PAREN_IN_PAREN, 108, 0, JSEXN_SYNTAXERR, "missing ) in parenthetical")
MSG_DEF(JSMSG_SEMI_BEFORE_STMNT, 109, 0, JSEXN_SYNTAXERR, "missing ; before statement")
MSG_DEF(JSMSG_NO_RETURN_VALUE, 110, 0, JSEXN_NONE, "function does not always return a value")
MSG_DEF(JSMSG_DUPLICATE_FORMAL, 111, 1, JSEXN_NONE, "duplicate formal argument {0}")
MSG_DEF(JSMSG_EQUAL_AS_ASSIGN, 112, 1, JSEXN_NONE, "test for equality (==) mistyped as assignment (=)?{0}")
MSG_DEF(JSMSG_BAD_IMPORT, 113, 0, JSEXN_SYNTAXERR, "invalid import expression")
MSG_DEF(JSMSG_TOO_MANY_DEFAULTS, 114, 0, JSEXN_SYNTAXERR, "more than one switch default")
MSG_DEF(JSMSG_TOO_MANY_CASES, 115, 0, JSEXN_INTERNALERR, "too many switch cases")
MSG_DEF(JSMSG_BAD_SWITCH, 116, 0, JSEXN_SYNTAXERR, "invalid switch statement")
MSG_DEF(JSMSG_BAD_FOR_LEFTSIDE, 117, 0, JSEXN_SYNTAXERR, "invalid for/in left-hand side")
MSG_DEF(JSMSG_CATCH_AFTER_GENERAL, 118, 0, JSEXN_NONE, "catch clause after general catch")
MSG_DEF(JSMSG_CATCH_WITHOUT_TRY, 119, 0, JSEXN_SYNTAXERR, "catch without try")
MSG_DEF(JSMSG_FINALLY_WITHOUT_TRY, 120, 0, JSEXN_SYNTAXERR, "finally without try")
MSG_DEF(JSMSG_LABEL_NOT_FOUND, 121, 0, JSEXN_SYNTAXERR, "label not found")
MSG_DEF(JSMSG_TOUGH_BREAK, 122, 0, JSEXN_SYNTAXERR, "invalid break")
MSG_DEF(JSMSG_BAD_CONTINUE, 123, 0, JSEXN_SYNTAXERR, "invalid continue")
MSG_DEF(JSMSG_BAD_RETURN, 124, 0, JSEXN_SYNTAXERR, "invalid return")
MSG_DEF(JSMSG_BAD_LABEL, 125, 0, JSEXN_SYNTAXERR, "invalid label")
MSG_DEF(JSMSG_DUPLICATE_LABEL, 126, 0, JSEXN_SYNTAXERR, "duplicate label")
MSG_DEF(JSMSG_VAR_HIDES_ARG, 127, 1, JSEXN_NONE, "variable {0} hides argument")
MSG_DEF(JSMSG_BAD_VAR_INIT, 128, 0, JSEXN_SYNTAXERR, "invalid variable initialization")
MSG_DEF(JSMSG_BAD_LEFTSIDE_OF_ASS, 129, 0, JSEXN_SYNTAXERR, "invalid assignment left-hand side")
MSG_DEF(JSMSG_BAD_OPERAND, 130, 1, JSEXN_SYNTAXERR, "invalid {0} operand")
MSG_DEF(JSMSG_BAD_PROP_ID, 131, 0, JSEXN_SYNTAXERR, "invalid property id")
MSG_DEF(JSMSG_RESERVED_ID, 132, 1, JSEXN_SYNTAXERR, "{0} is a reserved identifier")
MSG_DEF(JSMSG_SYNTAX_ERROR, 133, 0, JSEXN_SYNTAXERR, "syntax error")
MSG_DEF(JSMSG_BAD_SHARP_VAR_DEF, 134, 0, JSEXN_SYNTAXERR, "invalid sharp variable definition")
MSG_DEF(JSMSG_BAD_PROTOTYPE, 135, 1, JSEXN_ERR, "'prototype' property of {0} is not an object")

130
mozilla/js/src/js11640.def Normal file
View File

@@ -0,0 +1,130 @@
; The contents of this file are subject to the Netscape Public License
; Version 1.0 (the "NPL"); you may not use this file except in
; compliance with the NPL. You may obtain a copy of the NPL at
; http://www.mozilla.org/NPL/
;
; Software distributed under the NPL is distributed on an "AS IS" basis,
; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
; for the specific language governing rights and limitations under the
; NPL.
;
; The Initial Developer of this code under the NPL is Netscape
; Communications Corporation. Portions created by Netscape are
; Copyright (C) 1998 Netscape Communications Corporation. All Rights
; Reserved.
LIBRARY JS1640.DLL
EXETYPE WINDOWS
PROTMODE
DESCRIPTION 'Netscape 16-bit JavaScript Library'
CODE LOADONCALL MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 8192
EXPORTS
WEP @1 RESIDENTNAME NONAME
_JS_Init = _JS_Init @2
_JS_Finish = _JS_Finish @3
_JS_GetNaNValue
_JS_GetNegativeInfinityValue
_JS_GetPositiveInfinityValue
_JS_GetEmptyStringValue
_JS_ConvertValue
_JS_ValueToObject
_JS_ValueToFunction
_JS_ValueToString
_JS_ValueToNumber
_JS_ValueToBoolean
_JS_TypeOfValue
_JS_GetTypeName
_JS_Lock
_JS_Unlock
_JS_NewContext
_JS_DestroyContext
_JS_ContextIterator
_JS_GetGlobalObject
_JS_SetGlobalObject
_JS_InitStandardClasses
; _JS_GetStaticLink
_JS_malloc
_JS_realloc
_JS_free
_JS_strdup
_JS_NewDouble
_JS_NewDoubleValue
_JS_AddRoot
_JS_RemoveRoot
_JS_LockGCThing
_JS_UnlockGCThing
_JS_GC
_JS_PropertyStub
_JS_EnumerateStub
_JS_ResolveStub
_JS_ConvertStub
_JS_FinalizeStub
_JS_InitClass
_JS_GetClass
_JS_InstanceOf
_JS_GetPrivate
_JS_SetPrivate
_JS_GetInstancePrivate
_JS_GetPrototype
_JS_GetParent
_JS_SetParent
_JS_GetConstructor
_JS_NewObject
_JS_DefineObject
_JS_DefineConstDoubles
_JS_DefineProperties
_JS_DefineProperty
_JS_DefinePropertyWithTinyId
_JS_AliasProperty
_JS_LookupProperty
_JS_GetProperty
_JS_SetProperty
_JS_DeleteProperty
_JS_NewArrayObject
_JS_DefineElement
_JS_AliasElement
_JS_LookupElement
_JS_GetElement
_JS_SetElement
_JS_DeleteElement
_JS_ClearScope
_JS_NewFunction
_JS_GetFunctionObject
_JS_GetFunctionName
_JS_DefineFunctions
_JS_DefineFunction
_JS_CompileScript
_JS_DestroyScript
_JS_CompileFunction
_JS_DecompileScript
_JS_DecompileFunction
_JS_DecompileFunctionBody
_JS_ExecuteScript
_JS_EvaluateScript
_JS_CallFunction
_JS_CallFunctionName
_JS_CallFunctionValue
_JS_SetBranchCallback
_JS_IsRunning
_JS_NewString
_JS_NewStringCopyN
_JS_NewStringCopyZ
_JS_InternString
_JS_GetStringBytes
_JS_GetStringLength
_JS_CompareStrings
_JS_ReportError
_JS_ReportOutOfMemory
_JS_SetErrorReporter
_JS_NewRegExpObject
_JS_SetRegExpInput
_JS_ClearRegExpStatics
IMPORTS
_printf = nspr21.11
_strftime = nspr21.13

137
mozilla/js/src/js1640.def Normal file
View File

@@ -0,0 +1,137 @@
LIBRARY JS1640.DLL
EXETYPE WINDOWS
PROTMODE
DESCRIPTION 'Netscape 16-bit JavaScript Library'
CODE LOADONCALL MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 8192
EXPORTS
WEP @1 RESIDENTNAME NONAME
_JS_Init = _JS_Init @2
_JS_Finish = _JS_Finish @3
_JS_GetNaNValue
_JS_GetNegativeInfinityValue
_JS_GetPositiveInfinityValue
_JS_GetEmptyStringValue
_JS_ConvertValue
_JS_ValueToObject
_JS_ValueToFunction
_JS_ValueToString
_JS_ValueToNumber
_JS_ValueToBoolean
_JS_TypeOfValue
_JS_GetTypeName
_JS_Lock
_JS_Unlock
_JS_NewContext
_JS_DestroyContext
_JS_ContextIterator
_JS_GetGlobalObject
_JS_SetGlobalObject
_JS_InitStandardClasses
; _JS_GetStaticLink
_JS_malloc
_JS_realloc
_JS_free
_JS_strdup
_JS_NewDouble
_JS_NewDoubleValue
_JS_AddRoot
_JS_RemoveRoot
_JS_LockGCThing
_JS_UnlockGCThing
_JS_GC
_JS_PropertyStub
_JS_EnumerateStub
_JS_ResolveStub
_JS_ConvertStub
_JS_FinalizeStub
_JS_InitClass
_JS_GetClass
_JS_InstanceOf
_JS_GetPrivate
_JS_SetPrivate
_JS_GetInstancePrivate
_JS_GetPrototype
_JS_GetParent
_JS_SetParent
_JS_GetConstructor
_JS_NewObject
_JS_DefineObject
_JS_DefineConstDoubles
_JS_DefineProperties
_JS_DefineProperty
_JS_DefinePropertyWithTinyId
_JS_AliasProperty
_JS_LookupProperty
_JS_GetProperty
_JS_SetProperty
_JS_DeleteProperty
_JS_NewArrayObject
_JS_DefineElement
_JS_AliasElement
_JS_LookupElement
_JS_GetElement
_JS_SetElement
_JS_DeleteElement
_JS_ClearScope
_JS_NewFunction
_JS_GetFunctionObject
_JS_GetFunctionName
_JS_DefineFunctions
_JS_DefineFunction
_JS_CompileScript
_JS_DestroyScript
_JS_CompileFunction
_JS_DecompileScript
_JS_DecompileFunction
_JS_DecompileFunctionBody
_JS_ExecuteScript
_JS_EvaluateScript
_JS_CallFunction
_JS_CallFunctionName
_JS_CallFunctionValue
_JS_SetBranchCallback
_JS_IsRunning
_JS_NewString
_JS_NewStringCopyN
_JS_NewStringCopyZ
_JS_InternString
_JS_GetStringBytes
_JS_GetStringLength
_JS_CompareStrings
_JS_ReportError
_JS_ReportOutOfMemory
_JS_SetErrorReporter
_JS_NewRegExpObject
_JS_SetRegExpInput
_JS_ClearRegExpStatics

60
mozilla/js/src/js1640.rc Normal file
View File

@@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////
// Version stamp for this .DLL
#include <windows.h>
#include <ver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4 // major, minor, release (alpha 1), build #
PRODUCTVERSION 4
FILEFLAGSMASK 0
FILEFLAGS 0 // final version
FILEOS VOS_DOS_WINDOWS16
FILETYPE VFT_DLL
FILESUBTYPE 0 // not used
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
BEGIN
VALUE "CompanyName", "Netscape Communications Corporation\0"
VALUE "FileDescription", "Netscape 16-bit JavaScript Module\0"
VALUE "FileVersion", "4.0\0"
VALUE "InternalName", "JS1640\0"
VALUE "LegalCopyright", "Copyright Netscape Communications. 1994-96\0"
VALUE "LegalTrademarks", "Netscape, Mozilla\0"
VALUE "OriginalFilename","JS1640.DLL\0"
VALUE "ProductName", "NETSCAPE\0"
VALUE "ProductVersion", "4.0\0"
END
END
END

318
mozilla/js/src/js32.dsp Normal file
View File

@@ -0,0 +1,318 @@
# Microsoft Developer Studio Project File - Name="js32" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=js32 - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "js32.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "js32.mak" CFG="js32 - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "js32 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "js32 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "js32 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\js32\Release"
# PROP BASE Intermediate_Dir ".\js32\Release"
# PROP BASE Target_Dir ".\js32"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ".\js32"
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "mininspr" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "JSFILE" /D "EXPORT_JS_API" /D "MINI_NSPR" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 H:\ns\dist\WINNT4.0_OPT.OBJ\lib\libnspr21_s.lib H:\ns\dist\WINNT4.0_OPT.OBJ\lib\libplds21_s.lib winmm.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
!ELSEIF "$(CFG)" == "js32 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\js32\Debug"
# PROP BASE Intermediate_Dir ".\js32\Debug"
# PROP BASE Target_Dir ".\js32"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ".\js32"
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "mininspr" /D "_DEBUG" /D "DEBUG" /D "_WINDOWS" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "JSFILE" /D "EXPORT_JS_API" /D "MINI_NSPR" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 H:\ns\dist\WINNT4.0_DBG.OBJ\lib\libnspr21_s.lib H:\ns\dist\WINNT4.0_DBG.OBJ\lib\libplds21_s.lib winmm.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
!ENDIF
# Begin Target
# Name "js32 - Win32 Release"
# Name "js32 - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\jsapi.c
# End Source File
# Begin Source File
SOURCE=.\jsarray.c
# End Source File
# Begin Source File
SOURCE=.\jsatom.c
# End Source File
# Begin Source File
SOURCE=.\jsbool.c
# End Source File
# Begin Source File
SOURCE=.\jscntxt.c
# End Source File
# Begin Source File
SOURCE=.\jsdate.c
# End Source File
# Begin Source File
SOURCE=.\jsdbgapi.c
# End Source File
# Begin Source File
SOURCE=.\jsemit.c
# End Source File
# Begin Source File
SOURCE=.\jsfun.c
# End Source File
# Begin Source File
SOURCE=.\jsgc.c
# End Source File
# Begin Source File
SOURCE=.\jsinterp.c
# End Source File
# Begin Source File
SOURCE=.\jslock.c
# End Source File
# Begin Source File
SOURCE=.\jsmath.c
# End Source File
# Begin Source File
SOURCE=.\jsnum.c
# End Source File
# Begin Source File
SOURCE=.\jsobj.c
# End Source File
# Begin Source File
SOURCE=.\jsopcode.c
# End Source File
# Begin Source File
SOURCE=.\jsparse.c
# End Source File
# Begin Source File
SOURCE=.\jsregexp.c
# End Source File
# Begin Source File
SOURCE=.\jsscan.c
# End Source File
# Begin Source File
SOURCE=.\jsscope.c
# End Source File
# Begin Source File
SOURCE=.\jsscript.c
# End Source File
# Begin Source File
SOURCE=.\jsstr.c
# End Source File
# Begin Source File
SOURCE=.\jsxdrapi.c
# End Source File
# Begin Source File
SOURCE=.\prarena.c
# End Source File
# Begin Source File
SOURCE=.\prmjtime.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\jsapi.h
# End Source File
# Begin Source File
SOURCE=.\jsarray.h
# End Source File
# Begin Source File
SOURCE=.\jsatom.h
# End Source File
# Begin Source File
SOURCE=.\jsbool.h
# End Source File
# Begin Source File
SOURCE=.\jscntxt.h
# End Source File
# Begin Source File
SOURCE=.\jsconfig.h
# End Source File
# Begin Source File
SOURCE=.\jsdate.h
# End Source File
# Begin Source File
SOURCE=.\jsdbgapi.h
# End Source File
# Begin Source File
SOURCE=.\jsemit.h
# End Source File
# Begin Source File
SOURCE=.\jsfun.h
# End Source File
# Begin Source File
SOURCE=.\jsgc.h
# End Source File
# Begin Source File
SOURCE=.\jsinterp.h
# End Source File
# Begin Source File
SOURCE=.\jslock.h
# End Source File
# Begin Source File
SOURCE=.\jsmath.h
# End Source File
# Begin Source File
SOURCE=.\jsnum.h
# End Source File
# Begin Source File
SOURCE=.\jsobj.h
# End Source File
# Begin Source File
SOURCE=.\jsopcode.h
# End Source File
# Begin Source File
SOURCE=.\jsparse.h
# End Source File
# Begin Source File
SOURCE=.\jsprvtd.h
# End Source File
# Begin Source File
SOURCE=.\jspubtd.h
# End Source File
# Begin Source File
SOURCE=.\jsregexp.h
# End Source File
# Begin Source File
SOURCE=.\jsscan.h
# End Source File
# Begin Source File
SOURCE=.\jsscope.h
# End Source File
# Begin Source File
SOURCE=.\jsscript.h
# End Source File
# Begin Source File
SOURCE=.\jsstddef.h
# End Source File
# Begin Source File
SOURCE=.\jsstr.h
# End Source File
# Begin Source File
SOURCE=.\jsxdrapi.h
# End Source File
# Begin Source File
SOURCE=.\prarena.h
# End Source File
# Begin Source File
SOURCE=.\prdtoa.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

79
mozilla/js/src/js3240.rc Normal file
View File

@@ -0,0 +1,79 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winver.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,0,0
PRODUCTVERSION 4,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x10004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "Netscape Communications Corporation\0"
VALUE "FileDescription", "Netscape 32-bit JavaScript Module\0"
VALUE "FileVersion", "4.0\0"
VALUE "InternalName", "JS3240\0"
VALUE "LegalCopyright", "Copyright Netscape Communications. 1994-96\0"
VALUE "LegalTrademarks", "Netscape, Mozilla\0"
VALUE "OriginalFilename", "js3240.dll\0"
VALUE "ProductName", "NETSCAPE\0"
VALUE "ProductVersion", "4.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""winver.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////

623
mozilla/js/src/jsOS240.def Normal file
View File

@@ -0,0 +1,623 @@
; The contents of this file are subject to the Netscape Public License
; Version 1.0 (the "NPL"); you may not use this file except in
; compliance with the NPL. You may obtain a copy of the NPL at
; http://www.mozilla.org/NPL/
;
; Software distributed under the NPL is distributed on an "AS IS" basis,
; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
; for the specific language governing rights and limitations under the
; NPL.
;
; The Initial Developer of this code under the NPL is Netscape
; Communications Corporation. Portions created by Netscape are
; Copyright (C) 1998 Netscape Communications Corporation. All Rights
; Reserved.
LIBRARY JS3240 INITINSTANCE TERMINSTANCE
PROTMODE
DESCRIPTION 'Netscape OS/2 JavaScript Library'
CODE LOADONCALL MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE NONSHARED
EXPORTS
;====================== win16 exports these at least... ===========
; JS_Init = JS_Init @2
; JS_Finish = JS_Finish @3
; JS_GetNaNValue
; JS_GetNegativeInfinityValue
; JS_GetPositiveInfinityValue
; JS_GetEmptyStringValue
; JS_ConvertValue
; JS_ValueToObject
; JS_ValueToFunction
; JS_ValueToString
; JS_ValueToNumber
; JS_ValueToBoolean
; JS_TypeOfValue
; JS_GetTypeName
; JS_Lock
; JS_Unlock
; JS_NewContext
; JS_DestroyContext
; JS_ContextIterator
; JS_GetGlobalObject
; JS_SetGlobalObject
; JS_InitStandardClasses
;; JS_GetStaticLink
; JS_malloc
; JS_realloc
; JS_free
; JS_strdup
; JS_NewDouble
; JS_NewDoubleValue
; JS_AddRoot
; JS_RemoveRoot
; JS_LockGCThing
; JS_UnlockGCThing
; JS_GC
; JS_PropertyStub
; JS_EnumerateStub
; JS_ResolveStub
; JS_ConvertStub
; JS_FinalizeStub
; JS_InitClass
; JS_GetClass
; JS_InstanceOf
; JS_GetPrivate
; JS_SetPrivate
; JS_GetInstancePrivate
; JS_GetPrototype
; JS_GetParent
; JS_SetParent
; JS_GetConstructor
; JS_NewObject
; JS_DefineObject
; JS_DefineConstDoubles
; JS_DefineProperties
; JS_DefineProperty
; JS_DefinePropertyWithTinyId
; JS_AliasProperty
; JS_LookupProperty
; JS_GetProperty
; JS_SetProperty
; JS_DeleteProperty
; JS_NewArrayObject
; JS_DefineElement
; JS_AliasElement
; JS_LookupElement
; JS_GetElement
; JS_SetElement
; JS_DeleteElement
; JS_ClearScope
; JS_NewFunction
; JS_GetFunctionObject
; JS_GetFunctionName
; JS_DefineFunctions
; JS_DefineFunction
; JS_CompileScript
; JS_DestroyScript
; JS_CompileFunction
; JS_DecompileScript
; JS_DecompileFunction
; JS_DecompileFunctionBody
; JS_ExecuteScript
; JS_EvaluateScript
; JS_CallFunction
; JS_CallFunctionName
; JS_CallFunctionValue
; JS_SetBranchCallback
; JS_IsRunning
; JS_NewString
; JS_NewStringCopyN
; JS_NewStringCopyZ
; JS_InternString
; JS_GetStringBytes
; JS_GetStringLength
; JS_CompareStrings
; JS_ReportError
; JS_ReportOutOfMemory
; JS_SetErrorReporter
; JS_NewRegExpObject
; JS_SetRegExpInput
; JS_ClearRegExpStatics
;=================================================
;00001:jsstr (OFFSET:0x00002e17, SIZE:0x0000ae17):
; - Public Definitions:
; js_EmptySubString
; js_CompareStrings
; js_HashString
; js_ValueToString
; js_StringToObject
; js_FinalizeString
; js_NewStringCopyZ
; js_NewString
; js_InitStringClass
; js_NewStringCopyN
; js_BoyerMooreHorspool
;
;
;00002:jsscript (OFFSET:0x0000dc2e, SIZE:0x00003abb):
; - Public Definitions:
; js_LineNumberToPC
; js_PCToLineNumber
; js_GetSrcNote
; js_DestroyScript
; js_NewScript
;
;
;00003:jsscope (OFFSET:0x000116e9, SIZE:0x00004f82):
; - Public Definitions:
; js_hash_scope_ops
; js_list_scope_ops
; js_DestroyProperty
; js_NewProperty
; js_IdToValue
; js_HashValue
; js_DestroyScope
; js_MutateScope
; js_DropScope
; js_HoldScope
; js_NewScope
; js_GetMutableScope
; js_HoldProperty
; js_DropProperty
;
;
;00004:jsscan (OFFSET:0x0001666b, SIZE:0x00008890):
; - Public Definitions:
; js_MatchToken
; js_FlushNewlines
; js_PeekTokenSameLine
; js_UngetToken
; js_GetToken
; js_PeekToken
; js_ReportCompileError
js_CloseTokenStream
js_NewBufferTokenStream
; js_NewTokenStream
; js_InitScanner
;
;
;00005:jsregexp (OFFSET:0x0001eefb, SIZE:0x0000eee4):
; - Public Definitions:
; js_RegExpClass
; reopsize
; js_NewRegExpObject
; js_InitRegExpClass
; js_FreeRegExpStatics
; js_InitRegExpStatics
; js_ExecuteRegExp
; js_NewRegExpOpt
; js_DestroyRegExp
; js_NewRegExp
;
;
;00006:jsparse (OFFSET:0x0002dddf, SIZE:0x00010b71):
; - Public Definitions:
; js_ParseFunctionBody
js_Parse
;
;
;00007:jsopcode (OFFSET:0x0003e950, SIZE:0x0000d362):
; - Public Definitions:
; js_EscapeMap
; js_NumCodeSpecs
; js_CodeSpec
; js_incop_str
; js_true_str
; js_false_str
; js_this_str
; js_null_str
; js_void_str
; js_typeof_str
; js_delete_str
; js_new_str
; js_ValueToSource
; js_DecompileScript
; js_DecompileCode
; js_DecompileFunction
; js_puts
; js_printf
; js_GetPrinterOutput
; js_DestroyPrinter
; js_NewPrinter
; js_EscapeString
; js_Disassemble1
; js_Disassemble
;
;00008:jsobj (OFFSET:0x0004bcb2, SIZE:0x000090a4):
; - Public Definitions:
; js_WithClass
; js_ObjectClass
; js_TryValueOf
; js_ValueToNonNullObject
; js_TryMethod
; js_ObjectToString
; js_SetClassPrototype
; js_DeleteProperty2
; js_DeleteProperty
; js_SetProperty
; js_GetProperty
; js_FindVariableScope
; js_FindVariable
; js_FindProperty
; js_LookupProperty
; js_DefineProperty
; js_FreeSlot
; js_AllocSlot
; js_FinalizeObject
; js_GetClassPrototype
; js_NewObject
; js_InitObjectClass
; js_ValueToObject
; js_obj_toString
; js_SetSlot
; js_GetSlot
;
;
;00009:jsnum (OFFSET:0x00054d56, SIZE:0x00004f29):
; - Public Definitions:
; js_ValueToInt32
; js_NumberToObject
; js_FinalizeDouble
; js_InitNumberClass
; js_NumberToString
; js_NewDoubleValue
; js_NewDouble
; js_ValueToNumber
;
;
;00010:jsmath (OFFSET:0x00059c7f, SIZE:0x000054b6):
; - Public Definitions:
; js_InitMathClass
;
;
;00011:jsjava (OFFSET:0x0005f135, SIZE:0x00022aad):
; - Public Definitions:
; js_Hooks
; MojaSrcLog
; finalizeTask
JSJ_FindCurrentJSContext
; JSJ_GetPrincipals
JSJ_IsSafeMethod
JSJ_InitContext
JSJ_Init
js_JSErrorToJException
js_JavaErrorReporter
js_RemoveReflection
js_ReflectJObjectToJSObject
js_convertJObjectToJSValue
js_convertJSValueToJObject
js_ReflectJSObjectToJObject
; js_ReflectJClassToJSObject
JSJ_ExitJS
JSJ_EnterJS
JSJ_CurrentContext
JSJ_IsEnabled
;added in GA code - DSR70297
JSJ_Finish
JSJ_IsCalledFromJava
js_GetJSPrincipalsFromJavaCaller
;
;
;00012:jsinterp (OFFSET:0x00081be2, SIZE:0x00012274):
; - Public Definitions:
; js_Call
; js_Interpret
; js_SetLocalVariable
; js_GetLocalVariable
; js_SetArgument
; js_GetArgument
; js_FlushPropertyCacheByProp
; js_FlushPropertyCache
;
;
;00013:jsgc (OFFSET:0x00093e56, SIZE:0x00004f8d):
; - Public Definitions:
; js_ForceGC
; js_UnlockGCThing
; js_LockGCThing
; js_GC
; js_AllocGCThing
; js_RemoveRoot
; js_AddRoot
; js_FinishGC
; js_InitGC
;
;
;00014:jsfun (OFFSET:0x00098de3, SIZE:0x0000977c):
; - Public Definitions:
; js_FunctionClass
; js_ClosureClass
; js_CallClass
; js_DefineFunction
; js_NewFunction
; js_InitCallAndClosureClasses
; js_InitFunctionClass
; js_ValueToFunction
; js_SetCallVariable
; js_GetCallVariable
; js_PutCallObject
; js_GetCallObject
;
;
;00015:jsemit (OFFSET:0x000a255f, SIZE:0x000077be):
; - Public Definitions:
; js_SrcNoteName
; js_SrcNoteArity
js_FinishTakingSrcNotes
; js_MoveSrcNotes
; js_GetSrcNoteOffset
; js_BumpSrcNoteDelta
; js_NewSrcNote3
; js_NewSrcNote2
; js_PopStatement
; js_EmitContinue
; js_EmitBreak
; js_SetSrcNoteOffset
; js_NewSrcNote
; js_PushStatement
; js_MoveCode
; js_SetJumpOffset
; js_Emit3
; js_Emit2
; js_Emit1
; js_UpdateDepth
; js_SrcNoteLength
; js_CancelLastOpcode
js_InitCodeGenerator
;
;
;00016:jsdbgapi (OFFSET:0x000a9d1d, SIZE:0x000057db):
; - Public Definitions:
; js_watchpoint_list
; js_trap_list
; JS_SetAnnotationInFrame
; JS_GetAnnotationFromFrame
; JS_GetJSPrincipalArrayFromFrame
; JS_NextJSFrame
; JS_InitJSFrameIterator
JS_LineNumberToPC
JS_PCToLineNumber
JS_ClearAllWatchPoints
JS_ClearWatchPoint
JS_SetWatchPoint
JS_HandleTrap
JS_ClearAllTraps
JS_ClearScriptTraps
JS_ClearTrap
JS_GetTrapOpcode
JS_SetTrap
;DSR070297 - added in GA code
JS_FrameIterator
JS_GetFrameAnnotation
JS_GetFramePrincipalArray
JS_GetFrameScript
JS_GetScriptFilename
JS_SetFrameAnnotation
JS_GetFramePC
JS_GetFunctionScript
;
;
;00017:jsdate (OFFSET:0x000af4f8, SIZE:0x00009a8e):
; - Public Definitions:
js_DateGetSeconds
js_DateGetMinutes
js_DateGetHours
js_DateGetDate
js_DateGetMonth
js_DateGetYear
js_NewDateObject
; js_InitDateClass
;
;
;00018:jscntxt (OFFSET:0x000b8f86, SIZE:0x00003732):
; - Public Definitions:
; js_InterpreterHooks
; js_ReportIsNotDefined
; js_ReportErrorAgain
; js_ReportErrorVA
; js_ContextIterator
; js_DestroyContext
; js_NewContext
; js_SetInterpreterHooks
;
;
;00019:jsbool (OFFSET:0x000bc6b8, SIZE:0x00003375):
; - Public Definitions:
; js_BooleanToString
; js_BooleanToObject
; js_InitBooleanClass
; js_ValueToBoolean
;
;
;00020:jsatom (OFFSET:0x000bfa2d, SIZE:0x000058d0):
; - Public Definitions:
; js_valueOf_str
; js_toString_str
; js_length_str
; js_eval_str
; js_constructor_str
; js_class_prototype_str
; js_assign_str
; js_anonymous_str
; js_Object_str
; js_Array_str
; js_type_str
; js_DropUnmappedAtoms
js_FreeAtomMap
js_InitAtomMap
; js_GetAtom
; js_DropAtom
; js_IndexAtom
; js_ValueToStringAtom
; js_AtomizeString
; js_AtomizeDouble
; js_AtomizeInt
; js_AtomizeBoolean
; js_AtomizeObject
; js_HoldAtom
; js_MarkAtomState
; js_FreeAtomState
; js_Atomize
; js_InitAtomState
;
;
;00021:jsarray (OFFSET:0x000c52fd, SIZE:0x00007c86):
; - Public Definitions:
; js_ArrayClass
; js_SetArrayLength
; js_GetArrayLength
; js_InitArrayClass
; js_NewArrayObject
; PR_qsort
;
;
;00022:jsapi (OFFSET:0x000ccf83, SIZE:0x0000de8c):
; - Public Definitions:
JS_ClearRegExpStatics
JS_SetRegExpInput
JS_NewRegExpObject
JS_SetErrorReporter
JS_CompareStrings
JS_GetStringLength
JS_GetStringBytes
JS_InternString
JS_NewStringCopyZ
JS_NewStringCopyN
JS_NewString
JS_IsRunning
JS_SetBranchCallback
JS_CallFunctionValue
JS_CallFunctionName
JS_CallFunction
JS_EvaluateScriptForPrincipals
JS_EvaluateScript
JS_ExecuteScript
JS_DecompileFunctionBody
JS_DecompileFunction
JS_DecompileScript
JS_CompileFunctionForPrincipals
JS_CompileFunction
JS_DestroyScript
JS_CompileScriptForPrincipals
JS_CompileScript
JS_DefineFunction
JS_GetFunctionName
JS_GetFunctionObject
JS_NewFunction
JS_ClearScope
JS_DeleteElement
JS_SetElement
JS_GetElement
JS_LookupElement
JS_AliasElement
JS_DefineElement
JS_SetArrayLength
JS_GetArrayLength
JS_NewArrayObject
JS_DeleteProperty
JS_SetProperty
JS_GetProperty
JS_LookupProperty
JS_AliasProperty
JS_DefinePropertyWithTinyId
JS_DefineProperty
JS_DefineConstDoubles
JS_DefineObject
JS_NewObject
JS_GetConstructor
JS_SetParent
JS_GetParent
JS_SetPrototype
JS_GetPrototype
JS_GetInstancePrivate
JS_SetPrivate
JS_GetPrivate
JS_InstanceOf
JS_GetClass
JS_DefineFunctions
JS_DefineProperties
JS_InitClass
JS_FinalizeStub
JS_ConvertStub
JS_ResolveStub
JS_EnumerateStub
JS_PropertyStub
JS_GC
JS_UnlockGCThing
JS_LockGCThing
JS_RemoveRoot
JS_AddRoot
JS_NewDoubleValue
JS_NewDouble
JS_strdup
JS_free
JS_realloc
JS_ReportOutOfMemory
JS_malloc
JS_GetScopeChain
JS_InitStandardClasses
JS_SetGlobalObject
JS_GetGlobalObject
JS_SetVersion
JS_GetVersion
JS_ContextIterator
JS_GetTaskState
JS_DestroyContext
JS_NewContext
JS_Unlock
JS_Lock
JS_Finish
JS_Init
JS_GetTypeName
JS_TypeOfValue
JS_ValueToBoolean
JS_ValueToInt32
JS_ValueToNumber
JS_ValueToString
JS_ValueToFunction
JS_ValueToObject
JS_ReportError
JS_ConvertValue
JS_GetEmptyStringValue
JS_GetPositiveInfinityValue
JS_GetNegativeInfinityValue
JS_GetNaNValue
;DSR062897 - added for GA code
JS_MaybeGC
JS_GetScriptPrincipals
JS_IsAssigning
JS_SetCharSetInfo
;
;
;00023:prmjtime (OFFSET:0x000dae0f, SIZE:0x00008986):
; - Public Definitions:
PRMJ_FormatTimeUSEnglish
PRMJ_gmtime
PRMJ_FormatTime
PRMJ_mktime
PRMJ_ComputeTime
PRMJ_localtime
PRMJ_ExplodeTime
PRMJ_ToLocal
PRMJ_ToGMT
PRMJ_NowLocal
PRMJ_DSTOffset
PRMJ_NowS
PRMJ_NowMS
PRMJ_Now
PRMJ_ToExtendedTime
PRMJ_ToBaseTime
PRMJ_setDST
PRMJ_LocalGMTDifference

42
mozilla/js/src/jsaddr.c Normal file
View File

@@ -0,0 +1,42 @@
/* -*- Mode: C; tab-width: 8 -*-
* Copyright © 1996 Netscape Communications Corporation, All Rights Reserved.
*/
#include <stdio.h>
#include <stdlib.h>
#include "jsapi.h"
#include "jsinterp.h"
/* These functions are needed to get the addresses of certain functions
* in the JS module. On WIN32 especially, these symbols have a different
* address from the actual address of these functions in the JS module.
* This is because on WIN32, import function address fixups are done only
* at load time and function calls are made by indirection - that is by
* using a couple extra instructions to lookup the actual function address
* in the importing module's import address table.
*/
IMPLEMENT(JSPropertyOp)
js_GetArgumentAddress()
{
return ((void *)js_GetArgument);
}
IMPLEMENT(JSPropertyOp)
js_SetArgumentAddress()
{
return ((void *)js_SetArgument);
}
IMPLEMENT(JSPropertyOp)
js_GetLocalVariableAddress()
{
return ((void *)js_GetLocalVariable);
}
IMPLEMENT(JSPropertyOp)
js_SetLocalVariableAddress()
{
return ((void *)js_SetLocalVariable);
}

20
mozilla/js/src/jsaddr.h Normal file
View File

@@ -0,0 +1,20 @@
/* -*- Mode: C; tab-width: 8 -*-
* Copyright © 1996 Netscape Communications Corporation, All Rights Reserved.
*/
#ifndef jsaddr_h___
#define jsaddr_h___
EXTERN(JSPropertyOp)
js_GetArgumentAddress();
EXTERN(JSPropertyOp)
js_SetArgumentAddress();
EXTERN(JSPropertyOp)
js_GetLocalVariableAddress();
EXTERN(JSPropertyOp)
js_SetLocalVariableAddress();
#endif /* jsaddr_h___ */

2756
mozilla/js/src/jsapi.c Normal file

File diff suppressed because it is too large Load Diff

1058
mozilla/js/src/jsapi.h Normal file

File diff suppressed because it is too large Load Diff

343
mozilla/js/src/jsarena.c Normal file
View File

@@ -0,0 +1,343 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* Lifetime-based fast allocation, inspired by much prior art, including
* "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"
* David R. Hanson, Software -- Practice and Experience, Vol. 20(1).
*/
#include "jsstddef.h"
#include <stdlib.h>
#include <string.h>
#include "jstypes.h"
#include "jsbit.h"
#ifndef NSPR20
#include "jsarena.h"
#else
/* Removed by JSIFY: #include "plarena.h"
*/
#include "jsarena.h" /* Added by JSIFY */
#endif
/* Removed by JSIFY: #include "prlog.h" */
#include "jsutil.h" /* Added by JSIFY */
#ifdef JS_THREADSAFE
extern js_CompareAndSwap(jsword *, jsword, jsword);
#endif
static JSArena *arena_freelist;
#ifdef JS_ARENAMETER
static JSArenaStats *arena_stats_list;
#define COUNT(pool,what) (pool)->stats.what++
#else
#define COUNT(pool,what) /* nothing */
#endif
#define JS_ARENA_DEFAULT_ALIGN sizeof(double)
IMPLEMENT(void)
JS_InitArenaPool(JSArenaPool *pool, const char *name, JSUint32 size, JSUint32 align)
{
if (align == 0)
align = JS_ARENA_DEFAULT_ALIGN;
pool->mask = JS_BITMASK(JS_CeilingLog2(align));
pool->first.next = NULL;
pool->first.base = pool->first.avail = pool->first.limit =
(jsuword)JS_ARENA_ALIGN(pool, &pool->first + 1);
pool->current = &pool->first;
pool->arenasize = size;
#ifdef JS_ARENAMETER
memset(&pool->stats, 0, sizeof pool->stats);
pool->stats.name = strdup(name);
pool->stats.next = arena_stats_list;
arena_stats_list = &pool->stats;
#endif
}
IMPLEMENT(void *)
JS_ArenaAllocate(JSArenaPool *pool, JSUint32 nb)
{
JSArena **ap, *a, *b;
#ifdef JS_THREADSAFE
JSArena *c;
#endif
JSUint32 sz;
void *p;
JS_ASSERT((nb & pool->mask) == 0);
#if defined(XP_PC) && !defined(_WIN32)
if (nb >= 60000U)
return 0;
#endif /* WIN16 */
ap = &arena_freelist;
for (a = pool->current; a->avail + nb > a->limit; pool->current = a) {
if (a->next) { /* move to next arena */
a = a->next;
continue;
}
while ((b = *ap) != NULL) { /* reclaim a free arena */
if (b->limit - b->base == pool->arenasize) {
#ifdef JS_THREADSAFE
do {
b = *ap;
c = b->next;
} while (!js_CompareAndSwap((jsword *)ap,(jsword)b,(jsword)c));
#else
*ap = b->next;
#endif
b->next = NULL;
a = a->next = b;
COUNT(pool, nreclaims);
goto claim;
}
ap = &b->next;
}
sz = JS_MAX(pool->arenasize, nb); /* allocate a new arena */
sz += sizeof *a + pool->mask; /* header and alignment slop */
b = malloc(sz);
if (!b)
return 0;
a = a->next = b;
a->next = NULL;
a->limit = (jsuword)a + sz;
JS_COUNT_ARENA(pool,++);
COUNT(pool, nmallocs);
claim:
a->base = a->avail = (jsuword)JS_ARENA_ALIGN(pool, a + 1);
}
p = (void *)a->avail;
a->avail += nb;
return p;
}
IMPLEMENT(void *)
JS_ArenaGrow(JSArenaPool *pool, void *p, JSUint32 size, JSUint32 incr)
{
void *newp;
JS_ARENA_ALLOCATE(newp, pool, size + incr);
memcpy(newp, p, size);
return newp;
}
/*
* Free tail arenas linked after head, which may not be the true list head.
* Reset pool->current to point to head in case it pointed at a tail arena.
*/
static void
FreeArenaList(JSArenaPool *pool, JSArena *head, JSBool reallyFree)
{
JSArena **ap, *a;
#ifdef JS_THREADSAFE
JSArena *b;
#endif
ap = &head->next;
a = *ap;
if (!a)
return;
#ifdef DEBUG
do {
JS_ASSERT(a->base <= a->avail && a->avail <= a->limit);
a->avail = a->base;
JS_CLEAR_UNUSED(a);
} while ((a = a->next) != NULL);
a = *ap;
#endif
if (reallyFree) {
do {
*ap = a->next;
JS_CLEAR_ARENA(a);
JS_COUNT_ARENA(pool,--);
free(a);
} while ((a = *ap) != NULL);
} else {
/* Insert the whole arena chain at the front of the freelist. */
do {
ap = &(*ap)->next;
} while (*ap);
#ifdef JS_THREADSAFE
do {
*ap = b = arena_freelist;
} while (!js_CompareAndSwap((jsword*)&arena_freelist,(jsword)b,(jsword)a));
#else
*ap = arena_freelist;
arena_freelist = a;
#endif
head->next = NULL;
}
pool->current = head;
}
IMPLEMENT(void)
JS_ArenaRelease(JSArenaPool *pool, char *mark)
{
JSArena *a;
for (a = pool->first.next; a; a = a->next) {
if (JS_UPTRDIFF(mark, a) < JS_UPTRDIFF(a->avail, a)) {
a->avail = (jsuword)JS_ARENA_ALIGN(pool, mark);
FreeArenaList(pool, a, JS_TRUE);
return;
}
}
}
IMPLEMENT(void)
JS_FreeArenaPool(JSArenaPool *pool)
{
FreeArenaList(pool, &pool->first, JS_FALSE);
COUNT(pool, ndeallocs);
}
IMPLEMENT(void)
JS_FinishArenaPool(JSArenaPool *pool)
{
FreeArenaList(pool, &pool->first, JS_TRUE);
#ifdef JS_ARENAMETER
{
JSArenaStats *stats, **statsp;
if (pool->stats.name)
free(pool->stats.name);
for (statsp = &arena_stats_list; (stats = *statsp) != 0;
statsp = &stats->next) {
if (stats == &pool->stats) {
*statsp = stats->next;
return;
}
}
}
#endif
}
IMPLEMENT(void)
JS_CompactArenaPool(JSArenaPool *pool)
{
#if 0 /* XP_MAC */
JSArena *a = pool->first.next;
while (a) {
reallocSmaller(a, a->avail - (jsuword)a);
a->limit = a->avail;
a = a->next;
}
#endif
}
IMPLEMENT(void)
JS_ArenaFinish()
{
JSArena *a, *next;
#ifdef JS_THREADSAFE
while (arena_freelist) {
a = arena_freelist;
next = a->next;
if (js_CompareAndSwap((jsword*)&arena_freelist,(jsword)a,(jsword)next))
free(a);
}
#else
for (a = arena_freelist; a; a = next) {
next = a->next;
free(a);
}
arena_freelist = NULL;
#endif
}
#ifdef JS_ARENAMETER
IMPLEMENT(void)
JS_ArenaCountAllocation(JSArenaPool *pool, JSUint32 nb)
{
pool->stats.nallocs++;
pool->stats.nbytes += nb;
if (nb > pool->stats.maxalloc)
pool->stats.maxalloc = nb;
pool->stats.variance += nb * nb;
}
IMPLEMENT(void)
JS_ArenaCountInplaceGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr)
{
pool->stats.ninplace++;
}
IMPLEMENT(void)
JS_ArenaCountGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr)
{
pool->stats.ngrows++;
pool->stats.nbytes += incr;
pool->stats.variance -= size * size;
size += incr;
if (size > pool->stats.maxalloc)
pool->stats.maxalloc = size;
pool->stats.variance += size * size;
}
IMPLEMENT(void)
JS_ArenaCountRelease(JSArenaPool *pool, char *mark)
{
pool->stats.nreleases++;
}
IMPLEMENT(void)
JS_ArenaCountRetract(JSArenaPool *pool, char *mark)
{
pool->stats.nfastrels++;
}
#include <math.h>
#include <stdio.h>
IMPLEMENT(void)
JS_DumpArenaStats(FILE *fp)
{
JSArenaStats *stats;
double mean, variance;
for (stats = arena_stats_list; stats; stats = stats->next) {
if (stats->nallocs != 0) {
mean = (double)stats->nbytes / stats->nallocs;
variance = fabs(stats->variance / stats->nallocs - mean * mean);
} else {
mean = variance = 0;
}
fprintf(fp, "\n%s allocation statistics:\n", stats->name);
fprintf(fp, " number of arenas: %u\n", stats->narenas);
fprintf(fp, " number of allocations: %u\n", stats->nallocs);
fprintf(fp, " number of free arena reclaims: %u\n", stats->nreclaims);
fprintf(fp, " number of malloc calls: %u\n", stats->nmallocs);
fprintf(fp, " number of deallocations: %u\n", stats->ndeallocs);
fprintf(fp, " number of allocation growths: %u\n", stats->ngrows);
fprintf(fp, " number of in-place growths: %u\n", stats->ninplace);
fprintf(fp, "number of released allocations: %u\n", stats->nreleases);
fprintf(fp, " number of fast releases: %u\n", stats->nfastrels);
fprintf(fp, " total bytes allocated: %u\n", stats->nbytes);
fprintf(fp, " mean allocation size: %g\n", mean);
fprintf(fp, " standard deviation: %g\n", sqrt(variance));
fprintf(fp, " maximum allocation size: %u\n", stats->maxalloc);
}
}
#endif /* JS_ARENAMETER */

246
mozilla/js/src/jsarena.h Normal file
View File

@@ -0,0 +1,246 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef jsarena_h___
#define jsarena_h___
/*
* Lifetime-based fast allocation, inspired by much prior art, including
* "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"
* David R. Hanson, Software -- Practice and Experience, Vol. 20(1).
*
* Also supports LIFO allocation (JS_ARENA_MARK/JS_ARENA_RELEASE).
*/
#include <stdlib.h>
#include <string.h>
#include "jstypes.h"
#include "jscompat.h"
JS_BEGIN_EXTERN_C
typedef struct JSArena JSArena;
typedef struct JSArenaPool JSArenaPool;
struct JSArena {
JSArena *next; /* next arena for this lifetime */
jsuword base; /* aligned base address, follows this header */
jsuword limit; /* one beyond last byte in arena */
jsuword avail; /* points to next available byte */
};
#ifdef JS_ARENAMETER
typedef struct JSArenaStats JSArenaStats;
struct JSArenaStats {
JSArenaStats *next; /* next in arenaStats list */
char *name; /* name for debugging */
uint32 narenas; /* number of arenas in pool */
uint32 nallocs; /* number of JS_ARENA_ALLOCATE() calls */
uint32 nreclaims; /* number of reclaims from freeArenas */
uint32 nmallocs; /* number of malloc() calls */
uint32 ndeallocs; /* number of lifetime deallocations */
uint32 ngrows; /* number of JS_ARENA_GROW() calls */
uint32 ninplace; /* number of in-place growths */
uint32 nreleases; /* number of JS_ARENA_RELEASE() calls */
uint32 nfastrels; /* number of "fast path" releases */
size_t nbytes; /* total bytes allocated */
size_t maxalloc; /* maximum allocation size in bytes */
double variance; /* size variance accumulator */
};
#endif
struct JSArenaPool {
JSArena first; /* first arena in pool list */
JSArena *current; /* arena from which to allocate space */
size_t arenasize; /* net exact size of a new arena */
jsuword mask; /* alignment mask (power-of-2 - 1) */
#ifdef JS_ARENAMETER
JSArenaStats stats;
#endif
};
/*
* If the including .c file uses only one power-of-2 alignment, it may define
* JS_ARENA_CONST_ALIGN_MASK to the alignment mask and save a few instructions
* per ALLOCATE and GROW.
*/
#ifdef JS_ARENA_CONST_ALIGN_MASK
#define JS_ARENA_ALIGN(pool, n) (((jsuword)(n) + JS_ARENA_CONST_ALIGN_MASK) \
& ~JS_ARENA_CONST_ALIGN_MASK)
#define JS_INIT_ARENA_POOL(pool, name, size) \
JS_InitArenaPool(pool, name, size, JS_ARENA_CONST_ALIGN_MASK + 1)
#else
#define JS_ARENA_ALIGN(pool, n) (((jsuword)(n) + (pool)->mask) & ~(pool)->mask)
#endif
#define JS_ARENA_ALLOCATE(p, pool, nb) \
JS_BEGIN_MACRO \
JSArena *_a = (pool)->current; \
size_t _nb = JS_ARENA_ALIGN(pool, nb); \
jsuword _p = _a->avail; \
jsuword _q = _p + _nb; \
if (_q > _a->limit) \
_p = (jsuword)JS_ArenaAllocate(pool, _nb); \
else \
_a->avail = _q; \
p = (void *)_p; \
JS_ArenaCountAllocation(pool, nb); \
JS_END_MACRO
#define JS_ARENA_GROW(p, pool, size, incr) \
JS_BEGIN_MACRO \
JSArena *_a = (pool)->current; \
size_t _incr = JS_ARENA_ALIGN(pool, incr); \
jsuword _p = _a->avail; \
jsuword _q = _p + _incr; \
if (_p == (jsuword)(p) + JS_ARENA_ALIGN(pool, size) && \
_q <= _a->limit) { \
_a->avail = _q; \
JS_ArenaCountInplaceGrowth(pool, size, incr); \
} else { \
p = JS_ArenaGrow(pool, p, size, incr); \
} \
JS_ArenaCountGrowth(pool, size, incr); \
JS_END_MACRO
#define JS_ARENA_MARK(pool) ((void *) (pool)->current->avail)
#define JS_UPTRDIFF(p,q) ((jsuword)(p) - (jsuword)(q))
#ifdef DEBUG
#define free_PATTERN 0xDA
#define JS_CLEAR_UNUSED(a) (JS_ASSERT((a)->avail <= (a)->limit), \
memset((void*)(a)->avail, free_PATTERN, \
(a)->limit - (a)->avail))
#define JS_CLEAR_ARENA(a) memset((void*)(a), free_PATTERN, \
(a)->limit - (jsuword)(a))
#else
#define JS_CLEAR_UNUSED(a) /* nothing */
#define JS_CLEAR_ARENA(a) /* nothing */
#endif
#define JS_ARENA_RELEASE(pool, mark) \
JS_BEGIN_MACRO \
char *_m = (char *)(mark); \
JSArena *_a = (pool)->current; \
if (JS_UPTRDIFF(_m, _a) <= JS_UPTRDIFF(_a->avail, _a)) { \
_a->avail = (jsuword)JS_ARENA_ALIGN(pool, _m); \
JS_CLEAR_UNUSED(_a); \
JS_ArenaCountRetract(pool, _m); \
} else { \
JS_ArenaRelease(pool, _m); \
} \
JS_ArenaCountRelease(pool, _m); \
JS_END_MACRO
#ifdef JS_ARENAMETER
#define JS_COUNT_ARENA(pool,op) ((pool)->stats.narenas op)
#else
#define JS_COUNT_ARENA(pool,op)
#endif
#define JS_ARENA_DESTROY(pool, a, pnext) \
JS_BEGIN_MACRO \
JS_COUNT_ARENA(pool,--); \
if ((pool)->current == (a)) (pool)->current = &(pool)->first; \
*(pnext) = (a)->next; \
JS_CLEAR_ARENA(a); \
free(a); \
(a) = NULL; \
JS_END_MACRO
/*
* Initialize an arena pool with the given name for debugging and metering,
* with a minimum size per arena of size bytes.
*/
EXTERN(void)
JS_InitArenaPool(JSArenaPool *pool, const char *name, JSUint32 size,
JSUint32 align);
/*
* Free the arenas in pool. The user may continue to allocate from pool
* after calling this function. There is no need to call JS_InitArenaPool()
* again unless JS_FinishArenaPool(pool) has been called.
*/
EXTERN(void)
JS_FreeArenaPool(JSArenaPool *pool);
/*
* Free the arenas in pool and finish using it altogether.
*/
EXTERN(void)
JS_FinishArenaPool(JSArenaPool *pool);
/*
* Compact all of the arenas in a pool so that no space is wasted.
*/
EXTERN(void)
JS_CompactArenaPool(JSArenaPool *pool);
/*
* Finish using arenas, freeing all memory associated with them.
*/
EXTERN(void)
JS_ArenaFinish(void);
/*
* Friend functions used by the JS_ARENA_*() macros.
*/
EXTERN(void *)
JS_ArenaAllocate(JSArenaPool *pool, JSUint32 nb);
EXTERN(void *)
JS_ArenaGrow(JSArenaPool *pool, void *p, JSUint32 size, JSUint32 incr);
EXTERN(void)
JS_ArenaRelease(JSArenaPool *pool, char *mark);
#ifdef JS_ARENAMETER
#include <stdio.h>
EXTERN(void)
JS_ArenaCountAllocation(JSArenaPool *pool, JSUint32 nb);
EXTERN(void)
JS_ArenaCountInplaceGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr);
EXTERN(void)
JS_ArenaCountGrowth(JSArenaPool *pool, JSUint32 size, JSUint32incr);
EXTERN(void)
JS_ArenaCountRelease(JSArenaPool *pool, char *mark);
EXTERN(void)
JS_ArenaCountRetract(JSArenaPool *pool, char *mark);
EXTERN(void)
JS_DumpArenaStats(FILE *fp);
#else /* !JS_ARENAMETER */
#define JS_ArenaCountAllocation(ap, nb) /* nothing */
#define JS_ArenaCountInplaceGrowth(ap, size, incr) /* nothing */
#define JS_ArenaCountGrowth(ap, size, incr) /* nothing */
#define JS_ArenaCountRelease(ap, mark) /* nothing */
#define JS_ArenaCountRetract(ap, mark) /* nothing */
#endif /* !JS_ARENAMETER */
JS_END_EXTERN_C
#endif /* jsarena_h___ */

1300
mozilla/js/src/jsarray.c Normal file

File diff suppressed because it is too large Load Diff

56
mozilla/js/src/jsarray.h Normal file
View File

@@ -0,0 +1,56 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef jsarray_h___
#define jsarray_h___
/*
* JS Array interface.
*/
#include "jsprvtd.h"
#include "jspubtd.h"
JS_BEGIN_EXTERN_C
extern JSClass js_ArrayClass;
extern JSObject *
js_InitArrayClass(JSContext *cx, JSObject *obj);
extern JSObject *
js_NewArrayObject(JSContext *cx, jsuint length, jsval *vector);
extern JSBool
js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);
extern JSBool
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsuint length);
extern JSBool
js_HasLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);
/*
* JS-specific qsort function.
*/
typedef int (*JSComparator)(const void *a, const void *b, void *arg);
extern JSBool
js_qsort(void *vec, size_t nel, size_t elsize, JSComparator cmp, void *arg);
JS_END_EXTERN_C
#endif /* jsarray_h___ */

Some files were not shown because too many files have changed in this diff Show More