Compare commits

..

682 Commits
mozilla ... jsd

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
fur%netscape.com
5b2c2e76fb Added Mac-specific defines.
git-svn-id: svn://10.0.0.236/trunk@9203 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 03:52:13 +00:00
fur%netscape.com
2d3f594b08 *** empty log message ***
git-svn-id: svn://10.0.0.236/trunk@9202 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 03:51:38 +00:00
fur%netscape.com
eed8c3afc6 Ignore generated files
git-svn-id: svn://10.0.0.236/trunk@9201 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 03:47:13 +00:00
fur%netscape.com
512995a690 Checked in wrong version of project by mistake. This is the right one.
git-svn-id: svn://10.0.0.236/trunk@9200 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 03:46:25 +00:00
fur%netscape.com
b983a196aa Added comments and declaration of PR_Abort().
git-svn-id: svn://10.0.0.236/trunk@9198 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 03:40:50 +00:00
thom%netscape.com
3717641c6c File names change HTMLFoo changed to HTMLFooElement
git-svn-id: svn://10.0.0.236/trunk@9197 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 02:54:46 +00:00
thom%netscape.com
39b855dfd3 Copy and paste error (SomethingClassWin needed to change to somethingClassMac)
git-svn-id: svn://10.0.0.236/trunk@9196 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 02:54:11 +00:00
thom%netscape.com
77361183d1 Fixed an XP change that wasn't XP (_MAX_PATH is already defined on the mac)
git-svn-id: svn://10.0.0.236/trunk@9195 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 02:53:25 +00:00
joki%netscape.com
d2023dac41 Fix typo
git-svn-id: svn://10.0.0.236/trunk@9194 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:58:54 +00:00
cmanske%netscape.com
24789aba9f Removed unused string
git-svn-id: svn://10.0.0.236/trunk@9193 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:32:09 +00:00
joki%netscape.com
9628820de0 This useragent code is wrong anyway but change it to at least send a backwards compat string.
git-svn-id: svn://10.0.0.236/trunk@9192 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:24:59 +00:00
joki%netscape.com
728fea362d Moving script event listener registration back to SetAttributes out of SetDocument
git-svn-id: svn://10.0.0.236/trunk@9191 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:23:59 +00:00
joki%netscape.com
f0699eac56 Standardize order during content creation to be setDoc, addAttr, appendChild
git-svn-id: svn://10.0.0.236/trunk@9190 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:23:12 +00:00
joki%netscape.com
6fe10b9054 Cleaning up unused code
git-svn-id: svn://10.0.0.236/trunk@9189 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:21:48 +00:00
joki%netscape.com
899ed70268 Adding event.cancelBubble
git-svn-id: svn://10.0.0.236/trunk@9188 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:20:29 +00:00
joki%netscape.com
968d59a50f Adding window.opener, window.focus, window.blur, event.cancelBubble, and modifying window.open
git-svn-id: svn://10.0.0.236/trunk@9187 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:19:58 +00:00
cmanske%netscape.com
4853d699d7 Added new strings for Composer I18N work
git-svn-id: svn://10.0.0.236/trunk@9186 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:18:48 +00:00
karnaze%netscape.com
b413a9ba42 frameset/frame border resizing via mouse; NORESIZE, BORDERCOLOR
git-svn-id: svn://10.0.0.236/trunk@9185 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:16:27 +00:00
cmanske%netscape.com
de39922342 Fixed problems with PA_Block and busted file loading into Composer
git-svn-id: svn://10.0.0.236/trunk@9184 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:10:13 +00:00
cyeh%netscape.com
443c21dc15 change version number to reflect ALPHA stage
git-svn-id: svn://10.0.0.236/trunk@9183 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:08:47 +00:00
kipp%netscape.com
e29bad58eb Added new files to the build
git-svn-id: svn://10.0.0.236/trunk@9182 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:04:04 +00:00
kipp%netscape.com
c39cd1d7a2 new
git-svn-id: svn://10.0.0.236/trunk@9181 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:03:33 +00:00
danm%netscape.com
3c22121f48 about: wasn't working. is now.
git-svn-id: svn://10.0.0.236/trunk@9180 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:02:27 +00:00
cyeh%netscape.com
7f08256f2f added changed warning text for absolute timebombs. WARNING: ugly short lived hack.
git-svn-id: svn://10.0.0.236/trunk@9179 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 01:01:19 +00:00
terry%netscape.com
c8fc80fb77 Send mail to Christopher Seawood's machine, so that he can run his own Bonsai.
git-svn-id: svn://10.0.0.236/trunk@9178 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 00:57:23 +00:00
cyeh%netscape.com
1c891d2dd6 set timebombs to always warn. not a part of the build, so okay to check-in
git-svn-id: svn://10.0.0.236/trunk@9177 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 00:31:39 +00:00
kipp%netscape.com
8151679e48 Updated to build new source
git-svn-id: svn://10.0.0.236/trunk@9176 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 00:05:52 +00:00
kipp%netscape.com
a0783a4a5a Fixed SetAttribute where the leaf classes StringToAttribute wasn't being called
git-svn-id: svn://10.0.0.236/trunk@9175 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 00:03:58 +00:00
kipp%netscape.com
a75c02b0f1 Use new element ctors
git-svn-id: svn://10.0.0.236/trunk@9174 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 23:53:49 +00:00
kipp%netscape.com
af61e4b99f Spanked
git-svn-id: svn://10.0.0.236/trunk@9173 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 23:53:16 +00:00
kipp%netscape.com
9a826752e8 Renamed element creation routines
git-svn-id: svn://10.0.0.236/trunk@9172 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 23:52:38 +00:00
kipp%netscape.com
5a6d57899a Added new atoms
git-svn-id: svn://10.0.0.236/trunk@9171 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 23:52:24 +00:00
cyeh%netscape.com
6aa7d36e69 do the right thing and parameterize calls to SetTimeBomb
git-svn-id: svn://10.0.0.236/trunk@9170 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 23:31:57 +00:00
cyeh%netscape.com
1e31df0004 removing debugging statements, support timebombs of 0
git-svn-id: svn://10.0.0.236/trunk@9169 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 23:22:59 +00:00
cyeh%netscape.com
de4253f385 set timebombs to have 0 warning days by default, so that the user
is presented with the warning dialog on every launch


git-svn-id: svn://10.0.0.236/trunk@9168 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 23:20:17 +00:00
buster%netscape.com
68a912b36d put "quickdraw" in an #ifdef NS_MAC
git-svn-id: svn://10.0.0.236/trunk@9167 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 23:01:35 +00:00
despotdaemon%netscape.com
651e6b46d0 Pseudo-automatic update of changes made by mang@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@9166 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:58:43 +00:00
buster%netscape.com
f5e2a5ce2f fixed a space leak for tables with rowspans
git-svn-id: svn://10.0.0.236/trunk@9165 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:55:37 +00:00
cyeh%netscape.com
179b369fde after speaking to scc, moving utility functions to Moz.pm where they belong.
git-svn-id: svn://10.0.0.236/trunk@9164 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:52:49 +00:00
fur%netscape.com
815859a7bb Project files to build standalone JS using mini-NSPR
git-svn-id: svn://10.0.0.236/trunk@9163 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:38:20 +00:00
fur%netscape.com
d9185a5a7e Minimal NSPR subset required to build JS engine
git-svn-id: svn://10.0.0.236/trunk@9161 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:37:14 +00:00
fur%netscape.com
d1c09d04ff ignore generated files
git-svn-id: svn://10.0.0.236/trunk@9160 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:36:05 +00:00
terry%netscape.com
87de70d7ac Oops; mention nomail and maillock. (Thanks to
Sam Ziegler <ziegler@mediaguaranty.com> for pointing out their lack.)


git-svn-id: svn://10.0.0.236/trunk@9159 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:31:50 +00:00
buster%netscape.com
08dcf151a6 nsBrowserWindow.cpp,h
added filter name param to DumpFrames
nsViewerApp.cpp
  added -o <outputDirPath> for specifying where output files should go
  added -filter <filterName> for specifying that <filterName> should be used in an automated fashion for
dumping frames for every URL visited.
nsWebCrawler.cpp,h
  added  support methods to handle output dirs, output file name building from URL, and filter names
  added DumpFrames to ::OnStopBinding when the right state is set (from -filter option)
  added dependancies on:  nsIPresShell.h, nsIPresContext.h, and nsIFrame.h


git-svn-id: svn://10.0.0.236/trunk@9158 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:07:42 +00:00
dcone%netscape.com
96ef1297af mac fixes
git-svn-id: svn://10.0.0.236/trunk@9157 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 22:01:18 +00:00
buster%netscape.com
9a7b48eb26 expanded nsIFrame::List to include nsIListFilter *aFilter param, by default nsnull.
aFilter is useful for determining if a frame should output itself during
a List().  In any event, the children of the frame are always processed.
added nsIListFilter, an interface for any object that wants to act like a filter for frame dumps
added   static NS_LAYOUT nsIListFilter * GetFilter(nsString *aFilterName);
currently, only TableListFilter implements nsIListFilter.
in response to List(...TableListFilter), the frame model is dumped in a way that is useful
for table layout regression testing.  Currently this is controlled by command line switches on the viewer app.


git-svn-id: svn://10.0.0.236/trunk@9156 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:59:54 +00:00
dcone%netscape.com
e8732ba214 add the macradiobutton
git-svn-id: svn://10.0.0.236/trunk@9155 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:54:14 +00:00
dcone%netscape.com
c985cb4b0e made it a mac version
git-svn-id: svn://10.0.0.236/trunk@9154 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:53:49 +00:00
buster%netscape.com
51b30845c1 fixed a space leak caused by incorrect ~nsCellMap iteration through
the new data structures.


git-svn-id: svn://10.0.0.236/trunk@9153 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:51:01 +00:00
dcone%netscape.com
c1f3f02117 enabled the nsRadiobutton factory
git-svn-id: svn://10.0.0.236/trunk@9152 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:48:05 +00:00
dcone%netscape.com
364b725c28 Mac implementation, first pass
git-svn-id: svn://10.0.0.236/trunk@9151 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:47:47 +00:00
dcone%netscape.com
3799ccc7b8 used my own mousemoved tracking for better speed
git-svn-id: svn://10.0.0.236/trunk@9150 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:47:25 +00:00
dcone%netscape.com
b1a6f655d7 added better tracking
git-svn-id: svn://10.0.0.236/trunk@9149 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:46:53 +00:00
spider%netscape.com
18df3a3df2 Fix for modifier key state on keyboard messages
git-svn-id: svn://10.0.0.236/trunk@9148 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 21:14:45 +00:00
despotdaemon%netscape.com
7df5e2ec9a Pseudo-automatic update of changes made by leaf@mozilla.org.
git-svn-id: svn://10.0.0.236/trunk@9147 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 20:03:42 +00:00
rods%netscape.com
8aafdcac95 Removed nsDeviceCOntextUnix header file and replaced it with nsIDeviceContext
git-svn-id: svn://10.0.0.236/trunk@9146 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 20:01:41 +00:00
mccabe%netscape.com
c918d7df77 Further exception work - added 'message' to the js_ErrorToException
call, and experimented with copying the original JSErrorReport into
private data.  Much of this to support a toString method for exception
objects.

It's not polished, but I wanted to get toString available quickly.


git-svn-id: svn://10.0.0.236/trunk@9145 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 20:01:34 +00:00
rods%netscape.com
53df78b377 Fixed a bug in ConvertPixel
git-svn-id: svn://10.0.0.236/trunk@9144 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:51:32 +00:00
rods%netscape.com
65e3dacb58 Implemented ConvertPixel
git-svn-id: svn://10.0.0.236/trunk@9143 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:33:01 +00:00
rods%netscape.com
9db59e2782 Implemented ConvertPixel
git-svn-id: svn://10.0.0.236/trunk@9142 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:26:43 +00:00
rods%netscape.com
3f2149f1d8 Added ConvertPixel to nsIDeviceContext
git-svn-id: svn://10.0.0.236/trunk@9141 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:24:05 +00:00
sar%netscape.com
fc0025b59b Smartupdate landing. Added autoinstl to project.
git-svn-id: svn://10.0.0.236/trunk@9140 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:19:51 +00:00
raman%netscape.com
ad49532330 Build Smartupdate when MOZ_SMARTUPDATE is defined
git-svn-id: svn://10.0.0.236/trunk@9139 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:16:07 +00:00
cyeh%netscape.com
b562308535 change version number to reflect reality
git-svn-id: svn://10.0.0.236/trunk@9138 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:12:26 +00:00
raman%netscape.com
baba7c683c Added CPPSRCS
git-svn-id: svn://10.0.0.236/trunk@9137 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:11:06 +00:00
raman%netscape.com
8a29b1f0b1 Added getSigners API for SmartUpate
git-svn-id: svn://10.0.0.236/trunk@9136 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:10:57 +00:00
cyeh%netscape.com
c9567944e7 change version number to reflect alpha reality
git-svn-id: svn://10.0.0.236/trunk@9135 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:10:53 +00:00
raman%netscape.com
4215e79a8b Merging 4.5 softupdate changes and converting Java code into C++ code and making smartupdate build when MOZ_SMARTUPDATE is defined
git-svn-id: svn://10.0.0.236/trunk@9134 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:09:53 +00:00
raman%netscape.com
6342a98244 Merging 4.5 Libreg changes
git-svn-id: svn://10.0.0.236/trunk@9133 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:09:30 +00:00
raman%netscape.com
03a634f27d removing smartupdate related code, because it is not dependent on Java
git-svn-id: svn://10.0.0.236/trunk@9132 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:09:03 +00:00
raman%netscape.com
fa2721bd60 Added a background/autoupdate pulling of URLs
git-svn-id: svn://10.0.0.236/trunk@9131 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:08:32 +00:00
raman%netscape.com
803782c140 Added a background, autoupdate pulling of URLs
git-svn-id: svn://10.0.0.236/trunk@9130 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:08:00 +00:00
raman%netscape.com
37d6196690 Added SmartUpdate related strings
git-svn-id: svn://10.0.0.236/trunk@9129 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:05:49 +00:00
raman%netscape.com
5db8e09c17 Added SmartUpdate related strings
git-svn-id: svn://10.0.0.236/trunk@9128 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:05:48 +00:00
raman%netscape.com
6b27df86ca Merging 4.5 SmartUpdate changes
git-svn-id: svn://10.0.0.236/trunk@9127 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:05:33 +00:00
raman%netscape.com
bfa28a9e3a Build SmartUpdate when MOZ_SMARTUPDATE is defined
git-svn-id: svn://10.0.0.236/trunk@9126 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:05:13 +00:00
cyeh%netscape.com
20de3f4004 disable setting the agent for right now
git-svn-id: svn://10.0.0.236/trunk@9125 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:04:13 +00:00
terry%netscape.com
8695c64724 Patch by Sam Ziegler <ziegler@mediaguaranty.com> -- allow querying for
empty resolution.


git-svn-id: svn://10.0.0.236/trunk@9124 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 19:02:30 +00:00
terry%netscape.com
67e772ba10 Changelog of important Bugzilla changes.
git-svn-id: svn://10.0.0.236/trunk@9123 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 18:56:48 +00:00
cls%seawood.org
f1b39ff147 Sync'd with Makefile.
git-svn-id: svn://10.0.0.236/trunk@9122 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 18:56:17 +00:00
terry%netscape.com
978e4f71bb Changed the way password validation works. We now keep a
crypt'd version of the password in the database, and check against
that.  (This is silly, because we're also keeping the plaintext
version there, but I have plans...)  Stop passing the plaintext
password around as a cookie; instead, we have a cookie that references
a record in a new database table, logincookies.

IMPORTANT: if updating from an older version of Bugzilla, you must run
the following commands to keep things working:

 ./makelogincookiestable.sh
 echo "alter table profiles add column cryptpassword varchar(64);" | mysql bugs
 echo "update profiles set cryptpassword = encrypt(password,substring(rand(),3, 4));" | mysql bugs


git-svn-id: svn://10.0.0.236/trunk@9121 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 18:54:54 +00:00
cls%seawood.org
c36a681815 Removed OJI ifdef from LO_GetBuiltInAttribute() as the LO_BuiltinStruct is the same for both cases.
git-svn-id: svn://10.0.0.236/trunk@9120 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 18:54:53 +00:00
cls%seawood.org
bdceeef8ff Added check for HAVE_SYSERRLIST to get rid of redefinition warning when using autoconf.
git-svn-id: svn://10.0.0.236/trunk@9119 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 18:52:56 +00:00
kipp%netscape.com
ffd0bfbf4a Added new atoms
git-svn-id: svn://10.0.0.236/trunk@9118 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 18:40:08 +00:00
terry%netscape.com
c59042bc00 Mention the "comments" file.
git-svn-id: svn://10.0.0.236/trunk@9117 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 18:34:04 +00:00
kostello%netscape.com
137860a951 Add nsILookAndFeel.h MANIFEST
git-svn-id: svn://10.0.0.236/trunk@9116 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 17:58:37 +00:00
pinkerton%netscape.com
db81b82093 fix build bustage on mac (rev mjudge).
git-svn-id: svn://10.0.0.236/trunk@9115 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 16:15:43 +00:00
cmanske%netscape.com
291759bd6f Fixed build bustage for Mac
git-svn-id: svn://10.0.0.236/trunk@9114 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 16:08:46 +00:00
ramiro%netscape.com
b1712051f1 Add support for -config-dir command line flag. That means mozilla can now
use a configdir other that ~/.netscape without having to do HOME environment
hacks.
Thanks to Aleksey Nogin (ayn2@cornell.edu) for doing all the work and being
patient for me to actually check the stuff in.


git-svn-id: svn://10.0.0.236/trunk@9113 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 14:29:42 +00:00
cmanske%netscape.com
a1fc084b4f Composer work: Check for valid charset in metatag, paste character style, split table cell, optimization for table cell layout (not turned on), remove P_MENU, P_DIRECTORY support for UIs
git-svn-id: svn://10.0.0.236/trunk@9112 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 14:21:41 +00:00
cmanske%netscape.com
4146681d02 Fixed comflicts with mjudge changes for Ender toolbar
git-svn-id: svn://10.0.0.236/trunk@9111 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 13:22:13 +00:00
cmanske%netscape.com
ded4aa73f8 Composer work: Menus, paste style, paragraph properties dialog improvements, remove P_MENU, P_DIRECTORY
git-svn-id: svn://10.0.0.236/trunk@9110 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 13:12:58 +00:00
cmanske%netscape.com
4f6a05c971 Added strings for new I18N features in Composer: correct bad charset param in tag
git-svn-id: svn://10.0.0.236/trunk@9109 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 13:12:40 +00:00
cmanske%netscape.com
ad98d60489 Added strings for new I18N features in Composer: correct bad charset param in tag
git-svn-id: svn://10.0.0.236/trunk@9108 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 13:12:39 +00:00
ramiro%netscape.com
99d378c03f Add support for OpenBSD. Thanks to Marco S Hyman <marc@snafu.org>.
git-svn-id: svn://10.0.0.236/trunk@9107 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 12:36:18 +00:00
mcafee%netscape.com
b04526e650 Moving getBuiltInAttribute() from winfe to layout, it's now LO_GetBuiltInAttribute(). a+r=nisheeth
git-svn-id: svn://10.0.0.236/trunk@9106 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 09:13:50 +00:00
mccabe%netscape.com
09183e892f Another platform!
Thanks go to Marc Fraioli <fraioli@dg-rtp.dg.com> for
the initial port of the js/ref standalone javascript
engine to DG/UX.


git-svn-id: svn://10.0.0.236/trunk@9105 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 08:19:31 +00:00
mccabe%netscape.com
5274fdddfe Fixes for NetBSD and OpenBSD.
Thanks Marco S Hyman <marc@snafu.org>.


git-svn-id: svn://10.0.0.236/trunk@9104 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 07:56:50 +00:00
rickg%netscape.com
061a6cb718 added new EnableParser() routine for kipp; WIP
git-svn-id: svn://10.0.0.236/trunk@9103 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 07:12:49 +00:00
cls%seawood.org
c46c240ec5 Tweaks to remove XFE dependencies from other parts of the tree. Approved by {gagan,malmer,ramiro}%netscape.com.
git-svn-id: svn://10.0.0.236/trunk@9102 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 07:02:04 +00:00
morse%netscape.com
e7f07b3856 enable trust labels for unix
git-svn-id: svn://10.0.0.236/trunk@9101 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 05:06:15 +00:00
tomw%netscape.com
324119b646 Whoops. Use NETSCAPE_OFFICIAL, not BUILD_OFFICIAL
git-svn-id: svn://10.0.0.236/trunk@9100 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 03:20:44 +00:00
valeski%netscape.com
e753d19e38 added net_xp_file.h to #include
git-svn-id: svn://10.0.0.236/trunk@9099 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 03:01:14 +00:00
tomw%netscape.com
5da415cc22 Generate exports table for Cartman. This stuff needs to get moved out of
mozilla at some point.


git-svn-id: svn://10.0.0.236/trunk@9098 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:25:40 +00:00
peterl%netscape.com
ceda89bcfc reversed doc style sheet ordering in the style set
git-svn-id: svn://10.0.0.236/trunk@9097 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:13:37 +00:00
peterl%netscape.com
4ed0ab4604 fixed unit assumptions in map attributes into
git-svn-id: svn://10.0.0.236/trunk@9096 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:12:41 +00:00
peterl%netscape.com
9b0743f19a COMified interface
made first attribute local
added support for attr uniquing


git-svn-id: svn://10.0.0.236/trunk@9095 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:10:44 +00:00
peterl%netscape.com
c285c5e211 COMified style rule interface
git-svn-id: svn://10.0.0.236/trunk@9094 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:09:43 +00:00
peterl%netscape.com
5c26a357cc sync to attribute container api change
git-svn-id: svn://10.0.0.236/trunk@9093 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:08:14 +00:00
peterl%netscape.com
c1e4733c3b added DTD mode
git-svn-id: svn://10.0.0.236/trunk@9092 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:07:42 +00:00
peterl%netscape.com
60f33a4ff1 reversed style sheet order in the set
added DTD mode


git-svn-id: svn://10.0.0.236/trunk@9091 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:06:39 +00:00
peterl%netscape.com
4c10477c7c added support for uniquing attr containers
git-svn-id: svn://10.0.0.236/trunk@9090 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:05:53 +00:00
peterl%netscape.com
61a871690c added support for uniquing attribute containers
git-svn-id: svn://10.0.0.236/trunk@9089 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:05:13 +00:00
peterl%netscape.com
f4f7396cb9 COMified some interfaces
git-svn-id: svn://10.0.0.236/trunk@9088 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:03:24 +00:00
peterl%netscape.com
48058fdd77 turned around doc style sheet order
git-svn-id: svn://10.0.0.236/trunk@9087 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:02:53 +00:00
peterl%netscape.com
704c2ac772 comment about style sheet ordering
git-svn-id: svn://10.0.0.236/trunk@9086 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:02:30 +00:00
peterl%netscape.com
9ff39fd8a4 reversed style sheet ordering in the set
git-svn-id: svn://10.0.0.236/trunk@9085 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:02:14 +00:00
peterl%netscape.com
6a5da9f5b6 comments on sheet/rule ordering
git-svn-id: svn://10.0.0.236/trunk@9084 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:00:24 +00:00
peterl%netscape.com
cdc1c65a3d COMified
git-svn-id: svn://10.0.0.236/trunk@9083 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 02:00:05 +00:00
peterl%netscape.com
65f20a2d5a changed HashCode to HashValue and fixed return type
git-svn-id: svn://10.0.0.236/trunk@9082 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 01:59:30 +00:00
akkana%netscape.com
7c2b2d86a6 new FE_EncodingDialog to match new API in edtutil.cpp
git-svn-id: svn://10.0.0.236/trunk@9081 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 01:39:39 +00:00
mcafee%netscape.com
ed5c09e2ca Solaris wants EOF character, added comment for #endif.
git-svn-id: svn://10.0.0.236/trunk@9080 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 01:35:54 +00:00
kipp%netscape.com
a19b11738f Added new atoms
git-svn-id: svn://10.0.0.236/trunk@9079 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 01:08:32 +00:00
kipp%netscape.com
ea7ccf3372 New content spanking to use new impl macros for attributes
git-svn-id: svn://10.0.0.236/trunk@9078 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 01:08:23 +00:00
kipp%netscape.com
03e3476df4 Added new source to the build
git-svn-id: svn://10.0.0.236/trunk@9077 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 01:08:15 +00:00
valeski%netscape.com
80669eb600 Adding layer of abstraction (via #defines) between netlib and file code (XP_File*). This will allow raptor to build with a different file implementation (nsINetFile) and no longer rely on XP_File*(). All XP_File*() routines were renamed to NET_XP_File*(). The #define to do the masking is mozilla/network/main/net_xp_file.h .
Aleks told me all I had to do in order to export net_xp_file.h on the mac was to include it in mozilla/network/main/manifest. I did that, so, if mac builds break in netlib, it's likely the exporting of the file isn't happening (I'm not sure of the state of manifest files anymore) and I don't have a mac. So if MAC BREAKS, please add the file to the mac project and check it in (thank you).

I'll be at 408.867.2701 or cell - 415.307.7101 tonight.


git-svn-id: svn://10.0.0.236/trunk@9076 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 01:00:42 +00:00
kipp%netscape.com
17c6dc528b new
git-svn-id: svn://10.0.0.236/trunk@9075 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:56:01 +00:00
cls%seawood.org
4fadfde870 Sync'd Makefile.ins
git-svn-id: svn://10.0.0.236/trunk@9074 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:54:34 +00:00
cls%seawood.org
6ba7c9234f Added blizzard@appliedtheory.com's patches for gnomefe and enable-pthreads.
git-svn-id: svn://10.0.0.236/trunk@9073 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:52:55 +00:00
cls%seawood.org
dafe049ebd Sync'd and moved GARBAGE before rules.mk.
git-svn-id: svn://10.0.0.236/trunk@9072 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:34:07 +00:00
rpotts%netscape.com
ca9ef3c2e8 Fixed return value from PerformNastyWindowsAsyncDNSHack(...)
git-svn-id: svn://10.0.0.236/trunk@9071 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:27:54 +00:00
slamm%netscape.com
034db9db1f Dynamically add items (previously we rebuilt the whole thing).
git-svn-id: svn://10.0.0.236/trunk@9070 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:26:27 +00:00
slamm%netscape.com
9bee1c7ae6 Add support for FE commands from RDF.
git-svn-id: svn://10.0.0.236/trunk@9069 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:26:24 +00:00
slamm%netscape.com
bb5aa010d4 Get rid of unused notification.
git-svn-id: svn://10.0.0.236/trunk@9068 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:26:21 +00:00
slamm%netscape.com
be1460ac84 Add const'ness to function.
git-svn-id: svn://10.0.0.236/trunk@9067 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:26:18 +00:00
slamm%netscape.com
f0d2463f35 Translate 'stop' to xfeCmdStopLoading (in addition to 'abort'). This is used by the RDF command translation.
git-svn-id: svn://10.0.0.236/trunk@9066 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-02 00:26:15 +00:00
beard%netscape.com
dd8e829ab2 Added call to np_UnloadPluginClass in NPL_Shutdown.
git-svn-id: svn://10.0.0.236/trunk@9065 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:57:50 +00:00
kostello%netscape.com
2a60b87633 Removed nsHTMLParts.cpp
git-svn-id: svn://10.0.0.236/trunk@9064 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:56:40 +00:00
beard%netscape.com
45912ca0ac Added call to NPL_Shutdown.
git-svn-id: svn://10.0.0.236/trunk@9063 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:55:59 +00:00
terry%netscape.com
2be4d8d00a Tell people that they have to "create database bugs;".
git-svn-id: svn://10.0.0.236/trunk@9062 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:55:45 +00:00
ltabb%netscape.com
0ec2537a01 added CalendarClient
git-svn-id: svn://10.0.0.236/trunk@9061 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:48:27 +00:00
sdagley%netscape.com
f6180ffc6f Fix #316690. Reviewed/approved aoki (in veditz's absence). Fix hard coded reference to "Netscape Registry" so that Mozilla uses its own "Navigator Regsitry".
git-svn-id: svn://10.0.0.236/trunk@9060 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:44:31 +00:00
despotdaemon%netscape.com
c90e52b4c2 Pseudo-automatic update of changes made by ltabb@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@9059 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:42:53 +00:00
kmcclusk%netscape.com
94082b87b8 More 8BIT visual support.
git-svn-id: svn://10.0.0.236/trunk@9058 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:22:49 +00:00
rods%netscape.com
04398eaf11 Cast mWidget to Widget
git-svn-id: svn://10.0.0.236/trunk@9057 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:21:38 +00:00
rods%netscape.com
5e494d6339 Fixed SetLabel and Get Label in nsDialog
git-svn-id: svn://10.0.0.236/trunk@9056 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 23:13:43 +00:00
rods%netscape.com
d2416e1378 Added Top 100
git-svn-id: svn://10.0.0.236/trunk@9055 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:49:58 +00:00
rods%netscape.com
119a854357 The statusbar is now sized via the LookAndFeel defaults
git-svn-id: svn://10.0.0.236/trunk@9054 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:49:16 +00:00
danm%netscape.com
d5e7ca614a save/restore toolbar collapsed state from RDF
git-svn-id: svn://10.0.0.236/trunk@9053 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:48:17 +00:00
rods%netscape.com
badc0769db Fixed an include and a few nsString defs
git-svn-id: svn://10.0.0.236/trunk@9052 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:48:08 +00:00
rods%netscape.com
566557a3f0 Added InstallColormap call to ConvertPixel
git-svn-id: svn://10.0.0.236/trunk@9051 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:44:17 +00:00
rods%netscape.com
05aeccd5ca Exported nsDeviceContentUnix.h its needed by nsWindow for SetForegroundColor
and SetBackgroundColor


git-svn-id: svn://10.0.0.236/trunk@9050 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:43:38 +00:00
guha%netscape.com
6332596a4d Fix extra comma problem --- (jgellman)
git-svn-id: svn://10.0.0.236/trunk@9049 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:43:32 +00:00
rods%netscape.com
76b95ee227 SetForegroundColor and SetBackground work properly
Enabled implemented


git-svn-id: svn://10.0.0.236/trunk@9048 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:42:13 +00:00
rods%netscape.com
9478439139 SetForegroundColor and SetBackground work properly
git-svn-id: svn://10.0.0.236/trunk@9047 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:41:39 +00:00
rpotts%netscape.com
d49946e886 Fixed build bustage due to NSRepository renaming...
git-svn-id: svn://10.0.0.236/trunk@9046 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:37:27 +00:00
pinkerton%netscape.com
d11dbb57ab Removing const on pass-by-value params.
git-svn-id: svn://10.0.0.236/trunk@9045 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:30:24 +00:00
akkana%netscape.com
08357fe683 Call new FE_EncodingDialog
git-svn-id: svn://10.0.0.236/trunk@9044 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:19:12 +00:00
guha%netscape.com
1f401e1f45 Bunch of bug fixes, etc. Reviewd by jgellman
git-svn-id: svn://10.0.0.236/trunk@9043 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:18:34 +00:00
clu%netscape.com
f5ddf2b63e I18N work for encoding menu (reviewed brade)
git-svn-id: svn://10.0.0.236/trunk@9042 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 22:15:46 +00:00
kmcclusk%netscape.com
c3aa4dba38 Add some 8-bit color support + removed bit conversion in nsImageUnix.cpp Draw.
git-svn-id: svn://10.0.0.236/trunk@9041 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 21:24:32 +00:00
cmanske%netscape.com
1b05ddb812 Added FE_EncodingDialog stub necessary for futher encoding work (and build won't crash!)
git-svn-id: svn://10.0.0.236/trunk@9040 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 21:09:30 +00:00
rods%netscape.com
05b008edf1 Added LookAndFeel
git-svn-id: svn://10.0.0.236/trunk@9039 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 21:08:32 +00:00
terry%netscape.com
110fe5a836 Patch inspired by Sam Ziegler <ziegler@mediaguaranty.com> -- deal
better with product names that have spaces or other weird stuff in them.


git-svn-id: svn://10.0.0.236/trunk@9038 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 21:01:44 +00:00
terry%netscape.com
8b1f3d52f9 Patch by Sam Ziegler <ziegler@mediaguaranty.com> -- add a handy link
to enter a new bug.


git-svn-id: svn://10.0.0.236/trunk@9037 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 21:01:10 +00:00
rods%netscape.com
acef905cbe Fixed small compiler error
git-svn-id: svn://10.0.0.236/trunk@9036 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:57:16 +00:00
rods%netscape.com
d4db10c832 Renamed the enums to be more compiliant with naming conventions,
Changed API to be XP_COM correct
Added eMetric_TextHeight enum


git-svn-id: svn://10.0.0.236/trunk@9035 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:54:39 +00:00
terry%netscape.com
eba879a8ca Use POST, not GET. Allow for boolean params.
git-svn-id: svn://10.0.0.236/trunk@9034 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:54:24 +00:00
danm%netscape.com
14d930dc6d add new toolbar properties, fix early freemem in HT_SetNodeData, bmkNotifFunc notifies for all unassertions regardless of property type. r:rjc
git-svn-id: svn://10.0.0.236/trunk@9033 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:51:45 +00:00
cyeh%netscape.com
f86d88868b Dates are implemented in the non-standard way of starting from 1904 instead of 1970. As a result, we must add back those lost years in order to get cross platform compatibility with other perl time implementations. Special thanks to Chris Nandor (pudge@pobox.com) for unsticking my brain and providing a rough conversion routine.
git-svn-id: svn://10.0.0.236/trunk@9032 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:41:45 +00:00
kmcclusk%netscape.com
e1725a42b9 Removed mouse debug printf.
git-svn-id: svn://10.0.0.236/trunk@9031 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:32:56 +00:00
pinkerton%netscape.com
593aba4abe back to the AM version.
git-svn-id: svn://10.0.0.236/trunk@9030 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:30:55 +00:00
kmcclusk%netscape.com
9a65fa5b1b Added support for 16-bit visuals.
git-svn-id: svn://10.0.0.236/trunk@9029 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:30:42 +00:00
dcone%netscape.com
11f76bfa6b Fixed mouseup messaging
git-svn-id: svn://10.0.0.236/trunk@9028 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:24:54 +00:00
cls%seawood.org
76268b0341 Sync'd.
git-svn-id: svn://10.0.0.236/trunk@9027 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:24:24 +00:00
pinkerton%netscape.com
96501b1fca turn on trust labels for mac.
git-svn-id: svn://10.0.0.236/trunk@9026 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:23:44 +00:00
cls%seawood.org
c20beab072 Added DOM changes.
git-svn-id: svn://10.0.0.236/trunk@9025 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:23:24 +00:00
pinkerton%netscape.com
71712134bd add mkaccess.h to dist
git-svn-id: svn://10.0.0.236/trunk@9024 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:22:23 +00:00
pinkerton%netscape.com
2214a2a3e7 turn on trust labels for mac and fix mac problem.
git-svn-id: svn://10.0.0.236/trunk@9023 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:22:11 +00:00
pinkerton%netscape.com
d9a4819ca7 turn on trust labels on mac.
git-svn-id: svn://10.0.0.236/trunk@9022 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:21:19 +00:00
bjorn%netscape.com
7b045fdab6 Added compare-and-swap patches for AIX (_check_lock) and Solaris (stbar).
git-svn-id: svn://10.0.0.236/trunk@9021 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:21:11 +00:00
pinkerton%netscape.com
3263b3a8ac use function to get at global image cache.
git-svn-id: svn://10.0.0.236/trunk@9020 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:20:29 +00:00
kostello%netscape.com
85648460a7 Added nsHTMLBody.cpp, nsHTMLDList.cpp, nsHTMLDel.cpp, nsHTMLDirectory.cpp, nsHTMLDiv.cpp
git-svn-id: svn://10.0.0.236/trunk@9019 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:20:06 +00:00
pinkerton%netscape.com
767b0ee7b1 pull out unused lines.
git-svn-id: svn://10.0.0.236/trunk@9018 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:19:53 +00:00
pinkerton%netscape.com
fb40581e50 making RefreshRowRange const.
git-svn-id: svn://10.0.0.236/trunk@9017 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:19:34 +00:00
pinkerton%netscape.com
61cec2f531 making stuff const, making other stuff non-virtual.
git-svn-id: svn://10.0.0.236/trunk@9016 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:19:14 +00:00
pinkerton%netscape.com
b34a4917dc use new function to get global.
git-svn-id: svn://10.0.0.236/trunk@9015 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:18:23 +00:00
pinkerton%netscape.com
828552e105 Renaming class to CImageCache because that's what it is.
git-svn-id: svn://10.0.0.236/trunk@9014 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:18:10 +00:00
pinkerton%netscape.com
887b5a178a Making some more stuff const.
git-svn-id: svn://10.0.0.236/trunk@9013 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:17:46 +00:00
pinkerton%netscape.com
8c86df56bf Added CProgressCaption
git-svn-id: svn://10.0.0.236/trunk@9012 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:17:11 +00:00
pinkerton%netscape.com
b257b57e1b updated for new CProgressCaption.
git-svn-id: svn://10.0.0.236/trunk@9011 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:16:59 +00:00
pinkerton%netscape.com
4e5e360aa2 updated for new CProgressCaption
git-svn-id: svn://10.0.0.236/trunk@9010 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:16:43 +00:00
pinkerton%netscape.com
4c0e52f3e9 fix some code for offline to use the new progress bar class.
git-svn-id: svn://10.0.0.236/trunk@9009 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:14:08 +00:00
pinkerton%netscape.com
b43dcc8fd2 New progress bar based on AM.
git-svn-id: svn://10.0.0.236/trunk@9008 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:13:48 +00:00
pinkerton%netscape.com
abcc2d45a0 Registering some AM classes for the progress bar and removing obsolete ones we wrong ourselves.
git-svn-id: svn://10.0.0.236/trunk@9007 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:13:10 +00:00
pinkerton%netscape.com
186be1466f Removed CProgressBar and CPatternProgressBar because CProgressCaption replaces it.
git-svn-id: svn://10.0.0.236/trunk@9006 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:12:34 +00:00
pinkerton%netscape.com
3c3fb4e000 splash screen to match windows.
git-svn-id: svn://10.0.0.236/trunk@9005 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:11:09 +00:00
pinkerton%netscape.com
a1a2c8e6de Redundant implementation (lib/mac/UserInterface is the good one).
git-svn-id: svn://10.0.0.236/trunk@9004 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:10:25 +00:00
gagan%netscape.com
4835fef626 Changes from NuCache. Should'nt affect the build.
git-svn-id: svn://10.0.0.236/trunk@9003 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 20:00:07 +00:00
cls%seawood.org
fd1035a222 Fixed problems with parallel make.
git-svn-id: svn://10.0.0.236/trunk@9002 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:50:28 +00:00
cls%seawood.org
f4db6709de Added ifdef OJI around JVMPlugin define
git-svn-id: svn://10.0.0.236/trunk@9001 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:45:35 +00:00
valeski%netscape.com
ed5f2fad9f xp_dir to pr_dir
git-svn-id: svn://10.0.0.236/trunk@8999 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:18:00 +00:00
vidur%netscape.com
9eb23637ff Proper shutdown of JS engine
git-svn-id: svn://10.0.0.236/trunk@8998 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:13:36 +00:00
kipp%netscape.com
ad009e1438 Added new source to build
git-svn-id: svn://10.0.0.236/trunk@8997 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:13:02 +00:00
kipp%netscape.com
dcc313a3b7 Added new methods
git-svn-id: svn://10.0.0.236/trunk@8996 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:10:14 +00:00
akkana%netscape.com
d1fff060c6 New FE encoding dialog
git-svn-id: svn://10.0.0.236/trunk@8995 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:09:28 +00:00
kipp%netscape.com
5db3c8ded9 Added new files to build
git-svn-id: svn://10.0.0.236/trunk@8994 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:08:44 +00:00
kipp%netscape.com
3f4b2f7d99 Fixed boolean handling in hr
git-svn-id: svn://10.0.0.236/trunk@8993 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:08:36 +00:00
kipp%netscape.com
c4f158b374 new
git-svn-id: svn://10.0.0.236/trunk@8992 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:07:50 +00:00
akkana%netscape.com
61e70e439f Type and prototype for new FE encoding dialog
git-svn-id: svn://10.0.0.236/trunk@8991 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 19:07:27 +00:00
valeski%netscape.com
c66827cc8b adding net_xp_file.h to the list of exports
git-svn-id: svn://10.0.0.236/trunk@8990 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:59:17 +00:00
valeski%netscape.com
f217d60eb4 this file adds a level of abstraction between netlib and xp_file routines.
git-svn-id: svn://10.0.0.236/trunk@8989 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:55:22 +00:00
mjudge%netscape.com
edb5d85d3c Ender reload and new toolbar code
git-svn-id: svn://10.0.0.236/trunk@8988 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:53:36 +00:00
mjudge%netscape.com
bcc969ba8d more Ender things... Reload ect.
git-svn-id: svn://10.0.0.236/trunk@8987 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:52:52 +00:00
mjudge%netscape.com
f774effd17 Reload for Ender
git-svn-id: svn://10.0.0.236/trunk@8986 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:52:11 +00:00
mjudge%netscape.com
b55d68ba95 Fixes for ender to beat 9-1 reviewed winfe specific changes from Bill Law
git-svn-id: svn://10.0.0.236/trunk@8985 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:51:22 +00:00
ftang%netscape.com
d40148503c check in RDF UTF8 drawing, reviewed by hyatt severl days ago
git-svn-id: svn://10.0.0.236/trunk@8984 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:50:05 +00:00
scc%netscape.com
7ec8f8f604 Added a constructor from SPaneInfo and SViewInfo instead of an LStream; factored behavior from constructors into |common_initialization()|
git-svn-id: svn://10.0.0.236/trunk@8983 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:42:52 +00:00
scc%netscape.com
4444e89bbc new method |AddBar| as with RDF, not all bars come from the construction stream; also fixed routines that expected all bars to exist instantly to be a little more forgiving
git-svn-id: svn://10.0.0.236/trunk@8982 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:41:28 +00:00
scc%netscape.com
d7f0325595 First Checked In.
git-svn-id: svn://10.0.0.236/trunk@8981 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 18:39:08 +00:00
buster%netscape.com
f79492b78c empty rows now handled properly
git-svn-id: svn://10.0.0.236/trunk@8980 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 17:49:05 +00:00
despotdaemon%netscape.com
925fbc076c Pseudo-automatic update of changes made by rogerl@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8979 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 17:34:16 +00:00
rods%netscape.com
6d66f71fcf Removed some windows specific code and changed to xp code.
git-svn-id: svn://10.0.0.236/trunk@8978 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 16:29:05 +00:00
rods%netscape.com
4543df6c4b Changed the Windows platform specific dialogs to cross platform dialogs
git-svn-id: svn://10.0.0.236/trunk@8977 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 16:15:16 +00:00
despotdaemon%netscape.com
4e885a8ae1 Pseudo-automatic update of changes made by shaver@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8976 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 16:05:55 +00:00
kostello%netscape.com
de53dbf358 Added new content objects to project file:
nsHTMLArea
nsHTMLBaseFont
nsHTMLInput
nsHTMLLink
nsHTMLParam
nsHTMLScript
nsHTMLStyle


git-svn-id: svn://10.0.0.236/trunk@8975 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 15:30:45 +00:00
rods%netscape.com
1e8647294a Added nsDialog
git-svn-id: svn://10.0.0.236/trunk@8974 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 15:29:47 +00:00
rods%netscape.com
25d3af84a1 Added the managed widget to make it work.
git-svn-id: svn://10.0.0.236/trunk@8973 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 15:28:40 +00:00
terry%netscape.com
72367ff251 Use the "urlbase" param. Make regeneration easier.
git-svn-id: svn://10.0.0.236/trunk@8972 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 14:02:13 +00:00
shaver%netscape.com
8b8a2d4790 don't call layout from the mocha thread, and other progress
git-svn-id: svn://10.0.0.236/trunk@8971 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 12:54:17 +00:00
shaver%netscape.com
eb8ec7d6d1 fix dumb typo (how embarrassing)
git-svn-id: svn://10.0.0.236/trunk@8970 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 12:52:30 +00:00
shaver%netscape.com
00bff720d0 if throwing, cx->exception is a valid root
git-svn-id: svn://10.0.0.236/trunk@8969 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 12:38:59 +00:00
ramiro%netscape.com
39c80534b0 Add XfeTopShadowColor() and XfeBottomShadowColor().
git-svn-id: svn://10.0.0.236/trunk@8968 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 08:26:03 +00:00
ramiro%netscape.com
5cf0cf98f7 Add virtual functions getFGPixel() getBGPixel() getTopShadowPixel()
getBottomShadowPixel().


git-svn-id: svn://10.0.0.236/trunk@8967 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 08:24:40 +00:00
ramiro%netscape.com
1a13e6103c Protect the usage of m_toplevel with XP_ASSERT().
git-svn-id: svn://10.0.0.236/trunk@8966 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 08:23:37 +00:00
rpotts%netscape.com
b1f6a2ce4b Added a new windows-only subdirectory called embed/AcviveX which contains an ActiveX wrapper control for NGLayout
git-svn-id: svn://10.0.0.236/trunk@8965 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 08:07:56 +00:00
nisheeth%netscape.com
8252421f26 Fix for bug# 313278. Random links on the page were unclickable.
The problem was that the width and height of the dummy floating element that gets appended to the line list were not being initialized to 0 in lo_AppendFloatToLineList() and was
fooling the selection code into thinking that the floating element is insanely large.
So, the link wasn't being returned to the FE when you moused over it.


git-svn-id: svn://10.0.0.236/trunk@8964 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 05:40:50 +00:00
terry%netscape.com
51c3eedb87 Oh, gee, djw doesn't work here anymore, and doesn't own the Layout
module anymore.  Whoops.

I gotta make all our "lists of owners" sync'd together...


git-svn-id: svn://10.0.0.236/trunk@8963 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 04:58:10 +00:00
terry%netscape.com
ad73b379e6 Fixed bug #541 -- sorting by "assignee" now works.
git-svn-id: svn://10.0.0.236/trunk@8962 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 04:41:58 +00:00
warren%netscape.com
0440512d07 Removed secstubn.h for mac build.
git-svn-id: svn://10.0.0.236/trunk@8961 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 04:35:11 +00:00
terry%netscape.com
865baefe82 Added parameters to specify the HTML that goes at the top of every
page.  The banner.html and blurb.html files are now obsolete!


git-svn-id: svn://10.0.0.236/trunk@8960 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 04:33:37 +00:00
terry%netscape.com
1732adfa07 Whine at people who haven't been checking their NEW bugs.
git-svn-id: svn://10.0.0.236/trunk@8959 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 04:22:32 +00:00
terry%netscape.com
fcf05717c4 Allow editing of parameters via a web page.
git-svn-id: svn://10.0.0.236/trunk@8958 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 04:21:45 +00:00
warren%netscape.com
6a09708500 Changed c++ comments for inclusion in c files.
git-svn-id: svn://10.0.0.236/trunk@8957 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 04:15:07 +00:00
warren%netscape.com
d3527a8a0b Added xpcom dependency.
git-svn-id: svn://10.0.0.236/trunk@8956 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 03:30:59 +00:00
jgellman%netscape.com
2f90c9532f remove bogus assertions
git-svn-id: svn://10.0.0.236/trunk@8955 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 03:26:16 +00:00
warren%netscape.com
937ce00468 Added requires for xpcom.
git-svn-id: svn://10.0.0.236/trunk@8954 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 02:45:39 +00:00
warren%netscape.com
8f61f8eb54 Added requires for oji and ojiimpl
git-svn-id: svn://10.0.0.236/trunk@8953 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:59:14 +00:00
terry%netscape.com
29bafb193c Fix up NPL and comments that cls%seawood.org horked.
git-svn-id: svn://10.0.0.236/trunk@8952 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:41:07 +00:00
terry%netscape.com
f2de337030 Fix up indentation that cls%seawood.org horked.
git-svn-id: svn://10.0.0.236/trunk@8951 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:40:24 +00:00
kipp%netscape.com
bcae082904 Added some style rules for new content objects
git-svn-id: svn://10.0.0.236/trunk@8950 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:37:43 +00:00
kipp%netscape.com
887320a8d2 Implement NS_CreateHTMLElement using same code that content sink uses; create various and sundry new content objects
git-svn-id: svn://10.0.0.236/trunk@8949 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:37:17 +00:00
kipp%netscape.com
bfcb0c92bc Stop building nsHTMLParts.cpp (obsolete)
git-svn-id: svn://10.0.0.236/trunk@8948 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:36:39 +00:00
kipp%netscape.com
9a73352750 Moved over more attribute parsing routines
git-svn-id: svn://10.0.0.236/trunk@8947 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:36:11 +00:00
kipp%netscape.com
8fe9b5e86a Added new source files
git-svn-id: svn://10.0.0.236/trunk@8946 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:35:34 +00:00
kipp%netscape.com
a716f18685 Revised factory method argument order (normalized)
git-svn-id: svn://10.0.0.236/trunk@8945 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:35:19 +00:00
kipp%netscape.com
2e717f67f3 Added missing atoms
git-svn-id: svn://10.0.0.236/trunk@8944 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:34:32 +00:00
kipp%netscape.com
ade8b21e54 Added factory method names for all the new content objects
git-svn-id: svn://10.0.0.236/trunk@8943 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:33:19 +00:00
kipp%netscape.com
a1599a84e2 added new atoms
git-svn-id: svn://10.0.0.236/trunk@8942 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:32:58 +00:00
kipp%netscape.com
0435e1c021 Unset boolean attributes (noshade)
git-svn-id: svn://10.0.0.236/trunk@8941 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:32:05 +00:00
kipp%netscape.com
7528331669 Twiddled object frame argument order
git-svn-id: svn://10.0.0.236/trunk@8940 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:31:50 +00:00
cyeh%netscape.com
42e5816d97 FTSO MacPerl. Dates are implemented in the non-standard way of starting from 1904 instead of 1970. As a result, we must add back those lost years in order to get cross platform compatibility with other perl time implementations. Please shoot me.
git-svn-id: svn://10.0.0.236/trunk@8939 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:31:32 +00:00
kipp%netscape.com
77788c00a0 new content version
git-svn-id: svn://10.0.0.236/trunk@8938 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:31:20 +00:00
kipp%netscape.com
663af9cca3 new
git-svn-id: svn://10.0.0.236/trunk@8937 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:27:08 +00:00
beard%netscape.com
2e03ecb2b3 Fixed nsRepository exports, and return type signature change for nsHashtable::Enumerate() which used to return int, and now returns void.
git-svn-id: svn://10.0.0.236/trunk@8936 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:23:54 +00:00
beard%netscape.com
752f4aefc8 Moved Checking nsServiceManager.cpp into the xpcom - src folder.
git-svn-id: svn://10.0.0.236/trunk@8935 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:22:23 +00:00
terry%netscape.com
0dbb7eb2fd Do some simple sanity checks.
git-svn-id: svn://10.0.0.236/trunk@8934 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:20:36 +00:00
warren%netscape.com
b6420f1ff6 Added ojiimpl requirement for jvmmgr.h
git-svn-id: svn://10.0.0.236/trunk@8933 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:19:59 +00:00
mccabe%netscape.com
cead6ec411 restore npl.
git-svn-id: svn://10.0.0.236/trunk@8932 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:16:45 +00:00
mccabe%netscape.com
f3c665324e More runtime errors now bound to exceptions.
Most of these will require a second look, but I wanted to get all of
them (that need exceptions) throwing something interesting.


git-svn-id: svn://10.0.0.236/trunk@8931 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:15:16 +00:00
cls%seawood.org
15cbb4eeb5 A few fixes to allow things to work relatively out of the box.
git-svn-id: svn://10.0.0.236/trunk@8930 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:14:20 +00:00
pierre%netscape.com
1892f9e030 enable debugger
git-svn-id: svn://10.0.0.236/trunk@8929 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:12:58 +00:00
pierre%netscape.com
716b9901a9 Make aliases of sample files.
(closed tree override: raptor checkin only)


git-svn-id: svn://10.0.0.236/trunk@8928 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:12:34 +00:00
cls%seawood.org
50516e8f79 Make a couple of tweaks to allow complete admin (expect setting passwd) via webpages.
git-svn-id: svn://10.0.0.236/trunk@8927 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:11:34 +00:00
cls%seawood.org
31a4d80bf5 Initial version
git-svn-id: svn://10.0.0.236/trunk@8926 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 01:09:43 +00:00
despotdaemon%netscape.com
6e43d75756 Pseudo-automatic update of changes made by terry@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8925 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:59:46 +00:00
cyeh%netscape.com
7998ef60b2 we need a mac specific version of set-timebomb.pl. how annoying.
git-svn-id: svn://10.0.0.236/trunk@8923 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:30:17 +00:00
warren%netscape.com
d623edaca1 Renamed NSRepository to nsRepository.
git-svn-id: svn://10.0.0.236/trunk@8922 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:26:28 +00:00
warren%netscape.com
59dcb2a7df Added closure argument to nsHashtable::Enumerate. Renamed NSRepository to nsRepository.
git-svn-id: svn://10.0.0.236/trunk@8921 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:23:47 +00:00
warren%netscape.com
7730de5796 Changes for lazy java initialization.
git-svn-id: svn://10.0.0.236/trunk@8920 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:23:43 +00:00
warren%netscape.com
8fc72c0a4b Fixed Create to work with new nsAgg.h
git-svn-id: svn://10.0.0.236/trunk@8919 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:17:49 +00:00
warren%netscape.com
226ae1a7bb Changed NSServiceManager to nsServiceManager.
git-svn-id: svn://10.0.0.236/trunk@8918 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:17:47 +00:00
warren%netscape.com
324484e756 Made QI try the current object delegating to outer. Removed QI for kISupportsIID (which returned Internal). Added nsIOuter interfacewhich allows for notification of child release.
git-svn-id: svn://10.0.0.236/trunk@8917 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:17:28 +00:00
warren%netscape.com
78dddd29b1 Added FindProxyForURL.
git-svn-id: svn://10.0.0.236/trunk@8916 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:17:25 +00:00
warren%netscape.com
c2d6c41bed Added PR_DestroyLogModule.
git-svn-id: svn://10.0.0.236/trunk@8915 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:17:18 +00:00
warren%netscape.com
da4ceaa4fd Made counts be unsigned.
git-svn-id: svn://10.0.0.236/trunk@8914 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:17:09 +00:00
warren%netscape.com
99cc319bb3 Fixed signature of Write method.
git-svn-id: svn://10.0.0.236/trunk@8913 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:17:01 +00:00
warren%netscape.com
ef858a1b5a Replaced some Java error strings with OJI error strings.
git-svn-id: svn://10.0.0.236/trunk@8912 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:16:57 +00:00
warren%netscape.com
62c0a73a69 Added AWT_11 to NSJVM builds.
git-svn-id: svn://10.0.0.236/trunk@8911 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:16:53 +00:00
warren%netscape.com
24b7d5e489 Added closure argument to nsHashtable::Enumerate.
git-svn-id: svn://10.0.0.236/trunk@8910 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:16:47 +00:00
warren%netscape.com
6f46cc2695 Changes for lazy java initialization.
git-svn-id: svn://10.0.0.236/trunk@8909 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:16:08 +00:00
cyeh%netscape.com
1a58709bfd updated examples that are cleaner and multiple platform friendly.
git-svn-id: svn://10.0.0.236/trunk@8908 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:08:02 +00:00
leaf%mozilla.org
711e1f40e4 Added timebomb setting for MOZILLA_OFFICIAL builds
git-svn-id: svn://10.0.0.236/trunk@8907 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:02:58 +00:00
leaf%mozilla.org
e25b1dc5b6 Included the config directory if MOZILLA_OFFICIAL is set
git-svn-id: svn://10.0.0.236/trunk@8906 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-01 00:02:11 +00:00
beard%netscape.com
ce8cf140f2 The equals method isn't native in the Mozilla tree.
git-svn-id: svn://10.0.0.236/trunk@8905 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 23:39:51 +00:00
beard%netscape.com
005646cae3 Changed JavaPackage_resolve so that it doesn't return immediately if quiet_resolve_failure is true. Otherwise, pre_define_java_packages fails.
git-svn-id: svn://10.0.0.236/trunk@8904 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 23:39:04 +00:00
cyeh%netscape.com
1dd4359338 i hate it when i fuck up
git-svn-id: svn://10.0.0.236/trunk@8903 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 23:27:51 +00:00
cyeh%netscape.com
c3c997183a added support for automagically setting timebombs in the build. only used for mozilla official builds, shouldn't affect anything. (famous last words i know)
git-svn-id: svn://10.0.0.236/trunk@8902 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 22:54:56 +00:00
cyeh%netscape.com
1e3714bd28 First Checked In.
git-svn-id: svn://10.0.0.236/trunk@8901 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 22:51:26 +00:00
shaver%netscape.com
e413d25e7d JS_InternString is volatile, so I'll avoid its use
git-svn-id: svn://10.0.0.236/trunk@8900 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 22:46:06 +00:00
dcone%netscape.com
5e8902c242 fixed the mouse enter and exit routines
git-svn-id: svn://10.0.0.236/trunk@8899 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 22:42:44 +00:00
dcone%netscape.com
35560b569a fixed update action
git-svn-id: svn://10.0.0.236/trunk@8898 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 22:42:06 +00:00
shaver%netscape.com
34f95bbbdd update NodeOps APIs
git-svn-id: svn://10.0.0.236/trunk@8897 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 22:32:57 +00:00
shaver%netscape.com
3c890f1602 avoid dangerous JS_InternString call, and update NodeOps APIs
git-svn-id: svn://10.0.0.236/trunk@8896 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 22:31:44 +00:00
kipp%netscape.com
cf548d3884 Make sure we don't run off the end of the string when translating entities in attribute values
git-svn-id: svn://10.0.0.236/trunk@8895 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 22:00:04 +00:00
rods%netscape.com
8c7e275201 Fixed several crash bugs in Find
git-svn-id: svn://10.0.0.236/trunk@8894 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 21:56:57 +00:00
rickg%netscape.com
31ccae0cec fixed a few infinite loops in new DTD code
git-svn-id: svn://10.0.0.236/trunk@8893 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 21:52:47 +00:00
dcone%netscape.com
f8fe2acdde tracking updates
git-svn-id: svn://10.0.0.236/trunk@8892 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 21:50:59 +00:00
dcone%netscape.com
f0e842dc4a fixed some update and drawing routines
git-svn-id: svn://10.0.0.236/trunk@8891 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 21:50:36 +00:00
dcone%netscape.com
726f629ae1 Re-wrote the drawing routines for this widget
git-svn-id: svn://10.0.0.236/trunk@8890 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 21:49:49 +00:00
cyeh%netscape.com
19a361f674 add timebomb perl script to mac pull
git-svn-id: svn://10.0.0.236/trunk@8889 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 21:28:39 +00:00
buster%netscape.com
cb664f26da reimplemented cell map in terms of nsVoidArrays for incremental building.
the cellmap is now built incrementally, driven by nsTableRowFrame::InitialReflow


git-svn-id: svn://10.0.0.236/trunk@8888 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 21:23:28 +00:00
cyeh%netscape.com
afe1ba95d3 change tool call from perl5 to perl, so that i can actually build
on my primary linux machine. this is purely a selfish change, and only
enabled for official type builds.

reviewed: cyeh. approved: cyeh


git-svn-id: svn://10.0.0.236/trunk@8887 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 21:19:04 +00:00
terry%netscape.com
145536c5fa Patch by Sam Ziegler <ziegler@mediaguaranty.com> -- was crashing if
you have exactly one product defined.  Oops!


git-svn-id: svn://10.0.0.236/trunk@8886 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 20:41:13 +00:00
terry%netscape.com
da880edc7c Patch by Sam Ziegler <ziegler@mediaguaranty.com> -- do some sanity
checking on the list of column names we're given.


git-svn-id: svn://10.0.0.236/trunk@8885 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 20:38:47 +00:00
warren%netscape.com
1ce76af0e9 Added jsj_JavaMember.c (Changes from SpiderMonkey131_BRANCH of js/ref/liveconnect.)
git-svn-id: svn://10.0.0.236/trunk@8884 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 20:17:31 +00:00
beard%netscape.com
72cd4eeaee Changes from SpiderMonkey131_BRANCH of ns/ref/liveconnect.
git-svn-id: svn://10.0.0.236/trunk@8883 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 20:15:32 +00:00
beard%netscape.com
721a9a478f Added jsj_JavaMember.c (Changes from SpiderMonkey131_BRANCH of ns/ref/liveconnect.)
git-svn-id: svn://10.0.0.236/trunk@8882 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 20:12:42 +00:00
spider%netscape.com
d5529afe80 Updates for new XPCOM interface changes to the font metrics
git-svn-id: svn://10.0.0.236/trunk@8881 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 20:11:08 +00:00
spider%netscape.com
44eb3af0f3 Adding netlib to the deps for nsIURL.h
git-svn-id: svn://10.0.0.236/trunk@8880 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 20:10:40 +00:00
kostello%netscape.com
08848b2e92 Added nsHTMLBR.cpp to project file
git-svn-id: svn://10.0.0.236/trunk@8879 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 19:53:21 +00:00
kostello%netscape.com
142620bced These changes match the Windows/Unix changes to methods to take a parameter instead of returning a value.
git-svn-id: svn://10.0.0.236/trunk@8876 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 19:09:55 +00:00
kostello%netscape.com
d599cef011 Add nsIDialog.h and nsILabel.h to MANIFEST
git-svn-id: svn://10.0.0.236/trunk@8875 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 19:00:38 +00:00
kipp%netscape.com
5bba47b39c Use new SetAttr API
git-svn-id: svn://10.0.0.236/trunk@8874 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:44:11 +00:00
kipp%netscape.com
bc26d54909 Use NS_NewHTMLBR to create BR content objects
git-svn-id: svn://10.0.0.236/trunk@8873 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:40:39 +00:00
kipp%netscape.com
6efc1700b6 Added NS_NewHTMLBR
git-svn-id: svn://10.0.0.236/trunk@8872 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:40:16 +00:00
kipp%netscape.com
fe9e562295 Removed old content code
git-svn-id: svn://10.0.0.236/trunk@8871 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:40:03 +00:00
kipp%netscape.com
fe08b8a496 Use new SetAttr API; implement (cheesy) version of new SetAttr entry points
git-svn-id: svn://10.0.0.236/trunk@8870 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:39:46 +00:00
kipp%netscape.com
a71e2703a2 Define new SetAttr api
git-svn-id: svn://10.0.0.236/trunk@8869 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:39:13 +00:00
kipp%netscape.com
255014182e Use new SetAttr API
git-svn-id: svn://10.0.0.236/trunk@8868 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:38:53 +00:00
kipp%netscape.com
e209c98eab Added new source file
git-svn-id: svn://10.0.0.236/trunk@8867 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:38:37 +00:00
kipp%netscape.com
6a4a0f9c36 new
git-svn-id: svn://10.0.0.236/trunk@8866 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 18:38:27 +00:00
kipp%netscape.com
5c7786f39f Added entity reduction for attributes; fixed a bug with incremental loading that would cause some content to seemingly disappear
git-svn-id: svn://10.0.0.236/trunk@8865 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 17:51:32 +00:00
ebina%netscape.com
2fd7cc20b7 Transfer encoded gzip streams were sent to this converter, but the
transfer-encoding was never removed from the URL structure, causing
infinite recursion.  This fixes that bug.


git-svn-id: svn://10.0.0.236/trunk@8864 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 16:31:12 +00:00
kipp%netscape.com
a7b4e24cf4 Fixed porting bug when porting to xpcom'd nsIContent API
git-svn-id: svn://10.0.0.236/trunk@8863 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 16:09:06 +00:00
dcone%netscape.com
4470edff4a fixed some updating problems
git-svn-id: svn://10.0.0.236/trunk@8862 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 15:14:48 +00:00
dcone%netscape.com
b33d20d927 update fix
git-svn-id: svn://10.0.0.236/trunk@8861 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 15:10:01 +00:00
dcone%netscape.com
85b4a44fb1 fixed updating
git-svn-id: svn://10.0.0.236/trunk@8860 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 15:08:46 +00:00
ramiro%netscape.com
8843e8b87e Replace duplicate functions fe_GravityCorrectForms() and fe_ScrollForms() with
XfeMoveChildrenByOffset().


git-svn-id: svn://10.0.0.236/trunk@8859 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 14:30:56 +00:00
ramiro%netscape.com
fcf525416f Make sure the debug event comments are printed only for slamm.
git-svn-id: svn://10.0.0.236/trunk@8858 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 14:14:59 +00:00
ramiro%netscape.com
768c0e1048 Workaround for broken automated browser tests.
git-svn-id: svn://10.0.0.236/trunk@8857 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 14:10:50 +00:00
mccabe%netscape.com
a7b8207a95 Further runtime error work... expose many new errors as catchable
exceptions.  Mostly syntax errors, so far.  Fixed missing #if
JS_HAS_ERROR_EXCEPTIONS


git-svn-id: svn://10.0.0.236/trunk@8856 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 09:49:43 +00:00
mccabe%netscape.com
1cf03b53f5 Added a call to js_ErrorToException to
the compile-error reporting mechanism,
providing a way to associate exceptions
(very likely SyntaxError exceptions)
with compile-time errors.

(Hopefully this is temporary, as I'd
prefer one central place in the
error-reporting process to put the
js_ErrorToException call.)

Also changed the error reporter in js.c
to only ignore error reports marked with
the JSREPORT_EXCEPTION advisory flag when
the error occurs during javascript execution.

If it's at the toplevel compilation
level, then the error is still reported
(and the exception discarded.)

The api is feeling slightly dirtier, but
it still seems like the best
compromise...


git-svn-id: svn://10.0.0.236/trunk@8855 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 08:17:40 +00:00
mccabe%netscape.com
d4a8ee886c Added jsmsg.def to the list of files used by the
'make tar' target.


git-svn-id: svn://10.0.0.236/trunk@8854 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 07:33:13 +00:00
mccabe%netscape.com
e02c67ff07 Made the enum JSErrNum into a typedef
enum JSErrNum, and changed a uintN
errorNumber declaration to JSErrNum.

It'd be nice to change the uintN
errorNumber field in JSErrorReport to
JSErrNum, but it's not clear that
JSErrNum is or should be exposed in the
API.  Any C esthetes want to offer their
opinions?

It made my debugger slightly happier.


git-svn-id: svn://10.0.0.236/trunk@8853 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 07:07:26 +00:00
cls%seawood.org
a10067bd62 More fixes.
git-svn-id: svn://10.0.0.236/trunk@8852 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 03:57:13 +00:00
cls%seawood.org
0aee1faed1 Fixed problem with file permissions not being set.
git-svn-id: svn://10.0.0.236/trunk@8851 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 03:33:55 +00:00
ddrinan%netscape.com
e365a381c6 Set NETSCAPE_OFFICIAL in order to trigger the perl script that generates the Cartman hooks
git-svn-id: svn://10.0.0.236/trunk@8850 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 02:49:51 +00:00
cls%seawood.org
2c89e09d03 Made the people:who field large enough for username%domain
git-svn-id: svn://10.0.0.236/trunk@8849 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 01:08:41 +00:00
troy%netscape.com
fd0d7ccb59 Changes nsIView and nsIScrollableView interfaces to conform to
XPCOM conventions


git-svn-id: svn://10.0.0.236/trunk@8848 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 19:16:11 +00:00
morse%netscape.com
e72a6e6400 fix bustage on all platforms
git-svn-id: svn://10.0.0.236/trunk@8847 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 16:42:20 +00:00
morse%netscape.com
7c4dc96e03 still trying to fix up mac
git-svn-id: svn://10.0.0.236/trunk@8846 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 15:59:53 +00:00
morse%netscape.com
0c4eb3452c one more attempt to clean up mac build
git-svn-id: svn://10.0.0.236/trunk@8845 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 15:43:56 +00:00
morse%netscape.com
9787972139 disable trust labels for mac
git-svn-id: svn://10.0.0.236/trunk@8844 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 13:55:38 +00:00
morse%netscape.com
2b8a3458a8 I give up, backing out trust labels
git-svn-id: svn://10.0.0.236/trunk@8843 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 08:49:56 +00:00
morse%netscape.com
ea58f0d336 giving up on mac for now, backing out some but not all of the changes
git-svn-id: svn://10.0.0.236/trunk@8842 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 07:09:27 +00:00
morse%netscape.com
e03f574b38 another attempt to fix linux bustage
git-svn-id: svn://10.0.0.236/trunk@8841 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 06:46:25 +00:00
morse%netscape.com
115715a1d8 attempt to fix build bustage on Sun in gromit tinderbox
git-svn-id: svn://10.0.0.236/trunk@8840 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 06:10:12 +00:00
morse%netscape.com
fbfaab83ad fix compile error
git-svn-id: svn://10.0.0.236/trunk@8839 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 06:01:22 +00:00
morse%netscape.com
ba2b3e9469 *** empty log message ***
git-svn-id: svn://10.0.0.236/trunk@8838 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 05:54:08 +00:00
morse%netscape.com
4768c7b5e1 second attempt to fix linux bustage on gromit
git-svn-id: svn://10.0.0.236/trunk@8837 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 05:47:25 +00:00
morse%netscape.com
66e6aa031c attempt to fix bustage on the mac
git-svn-id: svn://10.0.0.236/trunk@8836 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 05:09:35 +00:00
morse%netscape.com
5dcb038fa0 attempt to fix linux bustage on gromit
git-svn-id: svn://10.0.0.236/trunk@8835 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 04:49:13 +00:00
morse%netscape.com
6d2505f53f added trust labels
git-svn-id: svn://10.0.0.236/trunk@8834 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 03:40:51 +00:00
morse%netscape.com
4f44efb156 mkaccess.h
git-svn-id: svn://10.0.0.236/trunk@8833 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 03:23:42 +00:00
morse%netscape.com
1ad2e68e4b fixed background color on signon viewer
git-svn-id: svn://10.0.0.236/trunk@8832 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 03:22:40 +00:00
morse%netscape.com
e2077b95a4 added string for cookie management
git-svn-id: svn://10.0.0.236/trunk@8831 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 03:21:00 +00:00
leaf%mozilla.org
c18bed5a9b removed the offending _jri entry
git-svn-id: svn://10.0.0.236/trunk@8830 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-30 00:12:52 +00:00
shaver%netscape.com
bdaf9a8ddf don't use JS_InternString for now -- weird crash in JS_AtomizeString
git-svn-id: svn://10.0.0.236/trunk@8829 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 23:46:47 +00:00
cls%seawood.org
4a37c272a1 Tweaked clobber_all dependency for autoconf tinderbox build.
git-svn-id: svn://10.0.0.236/trunk@8828 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 22:37:34 +00:00
cls%seawood.org
6f9015b67e Needed for --enable-dom.
git-svn-id: svn://10.0.0.236/trunk@8827 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 22:28:46 +00:00
cls%seawood.org
664ce07f1a Fixed problem of autoconf not using ACCFLAGS when using --enable-debug.
git-svn-id: svn://10.0.0.236/trunk@8826 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 22:12:53 +00:00
kipp%netscape.com
54c474764c Fixed bug introduced during nsIContent porting
git-svn-id: svn://10.0.0.236/trunk@8825 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 20:44:42 +00:00
kipp%netscape.com
29e64a354f XPCOM'ized nsIContent and nsIHTMLContent
git-svn-id: svn://10.0.0.236/trunk@8824 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 20:20:38 +00:00
kipp%netscape.com
96b63db44c Added error module for the layout system
git-svn-id: svn://10.0.0.236/trunk@8823 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 20:20:00 +00:00
kipp%netscape.com
8a06d2f5c0 Port to updated nsIContent API
git-svn-id: svn://10.0.0.236/trunk@8822 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 20:19:32 +00:00
rickg%netscape.com
07289be70e improved script handling--required by changes to DTD
git-svn-id: svn://10.0.0.236/trunk@8821 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 19:32:30 +00:00
rickg%netscape.com
04d51e2437 improved script handling--required by changes to DTD
git-svn-id: svn://10.0.0.236/trunk@8820 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 19:31:00 +00:00
despotdaemon%netscape.com
a236f89786 Pseudo-automatic update of changes made by terry@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8819 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 15:11:19 +00:00
despotdaemon%netscape.com
91269b50d0 Pseudo-automatic update of changes made by terry@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8818 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 15:10:49 +00:00
rickg%netscape.com
bc1fcf5d5a added noembed support
git-svn-id: svn://10.0.0.236/trunk@8817 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:52:17 +00:00
briano%netscape.com
6e313c1a0a Not needed.
git-svn-id: svn://10.0.0.236/trunk@8816 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:31:58 +00:00
briano%netscape.com
311bf3dfb6 Added an optimization fix.
git-svn-id: svn://10.0.0.236/trunk@8815 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:31:18 +00:00
rpotts%netscape.com
f48912ead3 Changes to allow building when STRICT is defined.
git-svn-id: svn://10.0.0.236/trunk@8814 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:30:49 +00:00
rpotts%netscape.com
791769f2e4 Changes to allow building when STRICT is defined.
git-svn-id: svn://10.0.0.236/trunk@8813 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:21:50 +00:00
rpotts%netscape.com
e61cbfd632 Added casts to allow building with STRICT defined...
git-svn-id: svn://10.0.0.236/trunk@8812 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:19:23 +00:00
rpotts%netscape.com
f267a054e1 Added specific GDI casts to allow building when STRICT is defined
git-svn-id: svn://10.0.0.236/trunk@8811 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:18:17 +00:00
cls%seawood.org
58743f3d5d Only link against -ljsj if JAVA_OR_OJI.
git-svn-id: svn://10.0.0.236/trunk@8810 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:17:01 +00:00
cls%seawood.org
cf4fa97a21 Commented out outdated non-OJI section.
git-svn-id: svn://10.0.0.236/trunk@8809 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 06:12:03 +00:00
cls%seawood.org
09107f3813 Added ifdef JAVA_OR_OJI around jsjava.h include.
git-svn-id: svn://10.0.0.236/trunk@8808 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 05:50:45 +00:00
rickg%netscape.com
6b0996df7c lots of performance work, bug fixes, and tag handling upgrades
git-svn-id: svn://10.0.0.236/trunk@8807 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 05:08:20 +00:00
rickg%netscape.com
9923f54f7f added BinarySearch method for faster string searches
git-svn-id: svn://10.0.0.236/trunk@8806 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 05:06:50 +00:00
sdagley%netscape.com
d9a9d0c30c When you add a call to an external function, include the F**KING header!!
git-svn-id: svn://10.0.0.236/trunk@8805 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:45:23 +00:00
warren%netscape.com
d20f81781c Premature checkin of renamed nsRepository.
git-svn-id: svn://10.0.0.236/trunk@8804 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:42:29 +00:00
mcafee%netscape.com
9c9dabf8b6 Fixing build bustage on Linux
git-svn-id: svn://10.0.0.236/trunk@8803 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:33:31 +00:00
mcafee%netscape.com
b23a134de1 Fixing build bustage on Linux
git-svn-id: svn://10.0.0.236/trunk@8802 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:27:09 +00:00
troy%netscape.com
d68daf37b3 Added some comments
git-svn-id: svn://10.0.0.236/trunk@8801 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:26:33 +00:00
kipp%netscape.com
d44a503526 Create anchors using NS_NewHTMLAnchor
git-svn-id: svn://10.0.0.236/trunk@8800 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:17:02 +00:00
kipp%netscape.com
64ec20b0cd Use AddRef instead of mRefCnt++; make implementation classes implement HandleDOMEvent; provide HandleDOMEvent generic routine for base behavior; provide TriggerLink for link clicking behavior
git-svn-id: svn://10.0.0.236/trunk@8799 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:16:46 +00:00
kipp%netscape.com
a025e7517b Implement nsHTMLGenericContainerContent; removed anchor code from HandleDOMEvent; implement TriggerLink
git-svn-id: svn://10.0.0.236/trunk@8798 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:15:55 +00:00
kipp%netscape.com
fa7b263033 Stubbed out HandleDOMEvent; and initialized refcnt (doh!)
git-svn-id: svn://10.0.0.236/trunk@8797 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:14:46 +00:00
kipp%netscape.com
0e6478e9bb Added new source
git-svn-id: svn://10.0.0.236/trunk@8796 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:13:56 +00:00
kipp%netscape.com
4c85e1db08 new
git-svn-id: svn://10.0.0.236/trunk@8795 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:13:29 +00:00
kipp%netscape.com
4fdac61f25 Added NewHTMLAnchor
git-svn-id: svn://10.0.0.236/trunk@8794 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:13:15 +00:00
kipp%netscape.com
e247d39ff4 Added new atoms
git-svn-id: svn://10.0.0.236/trunk@8793 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:13:03 +00:00
fur%netscape.com
1ab259806c Shane's makefiles
git-svn-id: svn://10.0.0.236/trunk@8792 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:04:11 +00:00
fur%netscape.com
65bdc27683 New file to deal with case of Java field and method with same name.
git-svn-id: svn://10.0.0.236/trunk@8791 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:03:51 +00:00
fur%netscape.com
8a8bb3d77e Error messages, in separate file for internationalization purposes.
git-svn-id: svn://10.0.0.236/trunk@8790 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:03:05 +00:00
fur%netscape.com
4eb3df0d29 Transferred work from private ns tree back into mozilla.
git-svn-id: svn://10.0.0.236/trunk@8789 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 03:00:50 +00:00
shaver%netscape.com
5f49f22fb7 Move current_node and top_node to top_state, to protect them from tables.
Handle table and row and cell data.
(We do nested-table text now.)


git-svn-id: svn://10.0.0.236/trunk@8788 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:52:27 +00:00
shaver%netscape.com
8e2e51702b move top_node and current_node into top_state, where they're invulnerable to the evil tactics of table layout
git-svn-id: svn://10.0.0.236/trunk@8787 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:49:13 +00:00
fur%netscape.com
c3bc213bef Somehow, montulli resurrected this dead file. Killing it again.
git-svn-id: svn://10.0.0.236/trunk@8786 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:47:25 +00:00
troy%netscape.com
1568e2814d Changed interface nsIFontMetrics to use the XPCOM conventions for returning
a nsresult


git-svn-id: svn://10.0.0.236/trunk@8785 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:34:34 +00:00
warren%netscape.com
6edcfe6a82 Fixed typo
git-svn-id: svn://10.0.0.236/trunk@8784 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:24:41 +00:00
mcafee%netscape.com
1a33421fe1 Fixing bustage on Solaris, Linux.
git-svn-id: svn://10.0.0.236/trunk@8783 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:23:08 +00:00
warren%netscape.com
9f2fefb606 Moved nsresult from nsISupports.h to nsError.h (so that it's defined for C files).
git-svn-id: svn://10.0.0.236/trunk@8782 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:21:49 +00:00
fur%netscape.com
8d0f6d433f Updated Mac build instructions.
git-svn-id: svn://10.0.0.236/trunk@8781 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:20:24 +00:00
fur%netscape.com
5ac9b15456 Replaced with new CodeWarrior project file macbuild/JSRef.mcp
git-svn-id: svn://10.0.0.236/trunk@8780 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 02:20:00 +00:00
mccabe%netscape.com
2ae960ccbd More loose ends towards merging the development branch.
git-svn-id: svn://10.0.0.236/trunk@8779 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 01:53:39 +00:00
warren%netscape.com
2ab76ffdb1 Added test for service manager.
git-svn-id: svn://10.0.0.236/trunk@8778 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 01:51:44 +00:00
pierre%netscape.com
f3a8b74f77 fixed freeze in XP_FileOpen()
git-svn-id: svn://10.0.0.236/trunk@8777 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 01:38:21 +00:00
pierre%netscape.com
25ac0a5f73 added nsHTMLGenericContent.cpp + nsHTMLHR.cpp
git-svn-id: svn://10.0.0.236/trunk@8776 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 01:27:11 +00:00
sdagley%netscape.com
e106f26073 Checking in for warren. Added nsIServiceManager.h to MANIFEST and nsServiceManager.cpp to xpcomPPC.mcp.
git-svn-id: svn://10.0.0.236/trunk@8775 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 01:17:19 +00:00
terry%netscape.com
77e993115e OK, turn it on -- changes will now actually have effect.
git-svn-id: svn://10.0.0.236/trunk@8774 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:51:15 +00:00
ftang%netscape.com
9dd07e6ba0 add XP_ASSERT IsUTF8String for more data source. reviewed by rjc
git-svn-id: svn://10.0.0.236/trunk@8773 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:42:07 +00:00
terry%netscape.com
22e2a9d2bf Need full pathname for CVS_PASSFILE, since change directories before using cvs.
git-svn-id: svn://10.0.0.236/trunk@8772 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:41:24 +00:00
mccabe%netscape.com
eb64550ea4 New platforms! More work from development branch.
git-svn-id: svn://10.0.0.236/trunk@8771 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:40:07 +00:00
mccabe%netscape.com
ac4f37b0a5 Propagate lots 'o work from the development branch.
Including:

Preliminary work on internationalizing error messages

Preliminary work on exposing runtime errors as catchable exceptions

ECMA-proposed throw and try/catch/finally, with multiple catch clauses
and catchguards

ECMA-proposed in/instanceof operators

IEEE-conformant number to string conversion

Fixes and other good stuff.


git-svn-id: svn://10.0.0.236/trunk@8770 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:38:43 +00:00
ftang%netscape.com
354837520c add XP_ASSERT for IsUTF8String, reviewed by rjc
git-svn-id: svn://10.0.0.236/trunk@8769 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:37:15 +00:00
terry%netscape.com
a7a3a142df Oops; wrong environment variable name.
git-svn-id: svn://10.0.0.236/trunk@8768 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:36:03 +00:00
ftang%netscape.com
63b976aae5 make HT Find/property dialogbox work with UTF8. reviewed by rjc
git-svn-id: svn://10.0.0.236/trunk@8767 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:35:53 +00:00
terry%netscape.com
7879e50a84 Keep a .cvspass in our own directory.
git-svn-id: svn://10.0.0.236/trunk@8766 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:35:19 +00:00
terry%netscape.com
16c17cd55c We have a variable containing the full path to the cvs executable; use it!
git-svn-id: svn://10.0.0.236/trunk@8765 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:20:10 +00:00
terry%netscape.com
e9a056744d Got to quote those stupid at-signs.
git-svn-id: svn://10.0.0.236/trunk@8764 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:57:42 +00:00
terry%netscape.com
9aa5b62699 Initial public checkin of despot.
git-svn-id: svn://10.0.0.236/trunk@8763 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:50:39 +00:00
ddrinan%netscape.com
72c4d2a866 Perl script to generate all export symbols
git-svn-id: svn://10.0.0.236/trunk@8762 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:48:13 +00:00
ddrinan%netscape.com
b540c7a2e7 Perl script to generate the dispatcher module.
git-svn-id: svn://10.0.0.236/trunk@8761 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:47:10 +00:00
ddrinan%netscape.com
9f84fe1bf0 Added dispatcher generation and populatio step. Need for Cartman
git-svn-id: svn://10.0.0.236/trunk@8760 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:45:59 +00:00
ddrinan%netscape.com
a0270fc060 Added Cartman hook and dispather tables export
git-svn-id: svn://10.0.0.236/trunk@8759 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:44:13 +00:00
kipp%netscape.com
9c9e082f74 Use -Zi and PDB's for dll creation too
git-svn-id: svn://10.0.0.236/trunk@8758 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:32:47 +00:00
kipp%netscape.com
83d75c3fa0 Stub out new nsIHTMLContent methods
git-svn-id: svn://10.0.0.236/trunk@8757 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:32:27 +00:00
kipp%netscape.com
dce19ba23f Added AttributeToString and StringToAttribute methods
git-svn-id: svn://10.0.0.236/trunk@8756 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:31:44 +00:00
kipp%netscape.com
44d2a050e0 Export new HTML-HR factory method
git-svn-id: svn://10.0.0.236/trunk@8755 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:31:28 +00:00
kipp%netscape.com
e0da233ad3 Stub out StringToAttribute
git-svn-id: svn://10.0.0.236/trunk@8754 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:31:12 +00:00
kipp%netscape.com
457a57d4bc Implement StringToAttribute; AttributeToString is now public
git-svn-id: svn://10.0.0.236/trunk@8753 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:30:50 +00:00
kipp%netscape.com
27a5a65695 Make AttributeToString abstract
git-svn-id: svn://10.0.0.236/trunk@8752 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:30:22 +00:00
kipp%netscape.com
dfe6b9472a Removed content code and exposed a factory method for creating HR frames; made the HR frame code content neutral
git-svn-id: svn://10.0.0.236/trunk@8751 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:29:36 +00:00
kipp%netscape.com
a2b0c41087 Added new atoms
git-svn-id: svn://10.0.0.236/trunk@8750 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:29:05 +00:00
kipp%netscape.com
948d0b54b0 Use new factory method for HR's
git-svn-id: svn://10.0.0.236/trunk@8749 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:27:55 +00:00
kipp%netscape.com
575b985fb8 new
git-svn-id: svn://10.0.0.236/trunk@8748 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:27:19 +00:00
kipp%netscape.com
3f8cc11cae Added new source files to the build
git-svn-id: svn://10.0.0.236/trunk@8747 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:25:56 +00:00
rods%netscape.com
9da3e5c9c9 Fixed nsLabel and nsDialog to compile and link correctly
git-svn-id: svn://10.0.0.236/trunk@8746 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 23:00:03 +00:00
rods%netscape.com
78dd60c020 initial checkin for nsLabel and nsDialog
git-svn-id: svn://10.0.0.236/trunk@8745 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 22:49:12 +00:00
rods%netscape.com
5bcda3f0f2 Added nsLabel and nsDialog
git-svn-id: svn://10.0.0.236/trunk@8744 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 22:48:50 +00:00
cls%seawood.org
d6fc11d98a Fixed problem with makedepend under autoconf.
git-svn-id: svn://10.0.0.236/trunk@8743 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 22:40:14 +00:00
rods%netscape.com
e23a0b6401 Fixed Focus issues with text field in Find Dialog
git-svn-id: svn://10.0.0.236/trunk@8742 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 22:36:10 +00:00
rods%netscape.com
57b7fafb37 Fixed OnPaint to draw Dialog and children correctly.
git-svn-id: svn://10.0.0.236/trunk@8741 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 22:11:04 +00:00
warren%netscape.com
9f4a9bc9a2 Added class ID to OnShutdown.
git-svn-id: svn://10.0.0.236/trunk@8740 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 21:47:44 +00:00
kipp%netscape.com
a877826048 Use kIHTMLContentSinkIID so that inferior compilers will work
git-svn-id: svn://10.0.0.236/trunk@8739 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 21:29:50 +00:00
warren%netscape.com
7876a9e765 Added service manager mechanism.
git-svn-id: svn://10.0.0.236/trunk@8738 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 21:28:35 +00:00
warren%netscape.com
31ab835636 Added service manager mechanism.
git-svn-id: svn://10.0.0.236/trunk@8737 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 21:25:34 +00:00
cyeh%netscape.com
7a3853ed06 First Checked In.
git-svn-id: svn://10.0.0.236/trunk@8736 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 21:03:57 +00:00
ftang%netscape.com
7f80acda40 change rdf winfe to make it render UTF8. reviewed by hyatt
git-svn-id: svn://10.0.0.236/trunk@8735 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:58:01 +00:00
ftang%netscape.com
eb3d75865f fix UTF8 input problem when switch input method back to roman . reviewed by brade.
git-svn-id: svn://10.0.0.236/trunk@8734 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:52:12 +00:00
slamm%netscape.com
43c5f4b46f Bring back the commercial animation.
git-svn-id: svn://10.0.0.236/trunk@8733 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:41:53 +00:00
pinkerton%netscape.com
6890fabd3c Added RowIsContainer() with additional param to say if container is open or closed.
git-svn-id: svn://10.0.0.236/trunk@8732 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:34:43 +00:00
pinkerton%netscape.com
e44c8223ff Use new CNavCenterScroller and tell it to adjust the scroll bar when the column headers appear or disappear.
git-svn-id: svn://10.0.0.236/trunk@8731 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:33:42 +00:00
pinkerton%netscape.com
dd7e62a93c Fix mozilla problem with not showing "about:" page when security is not present.
git-svn-id: svn://10.0.0.236/trunk@8730 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:33:08 +00:00
pinkerton%netscape.com
20a62cdd6c Changed type of scroller in NavCenter panes to be a CNavCenterScroller to better handle scroll bar adjustments on mode switches.
git-svn-id: svn://10.0.0.236/trunk@8729 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:32:36 +00:00
pinkerton%netscape.com
3958cd059f New RowIsContainer method which can replace CellHasDropFlag to determine if the row is a container and if it is currently expanded or collapsed. Fixed auto-expand d&d to use this instead of CellHasDropFlag so it will still autoexpand when drop flags are not used.
git-svn-id: svn://10.0.0.236/trunk@8728 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:32:00 +00:00
pinkerton%netscape.com
53c9fd8dcb Add CNavCenterScroller.cp
git-svn-id: svn://10.0.0.236/trunk@8727 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:30:24 +00:00
pinkerton%netscape.com
be05c26268 Register CNavCenterScroller
git-svn-id: svn://10.0.0.236/trunk@8726 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:29:57 +00:00
spider%netscape.com
8e70f7c6b3 Initialize the device context to null. This was causing a crash if the
device context for a widget were queried prior the window getting
created.


git-svn-id: svn://10.0.0.236/trunk@8725 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:29:04 +00:00
pinkerton%netscape.com
f7238017b5 First Checked In.
git-svn-id: svn://10.0.0.236/trunk@8723 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:24:25 +00:00
briano%netscape.com
064ec3f07b New file to support DG/UX. Thanks to Marc Fraioli (fraioli@dg-rtp.dg.com) for doing all the work.
git-svn-id: svn://10.0.0.236/trunk@8722 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:20:15 +00:00
terry%netscape.com
53b92f890a Get rid of "verified_ts" and "resolved_ts" stuff; we aren't keeping
that stuff in this database.


git-svn-id: svn://10.0.0.236/trunk@8721 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:19:31 +00:00
briano%netscape.com
9b4a75a2f8 Added support for DG/UX, and a fix for bug#254.
git-svn-id: svn://10.0.0.236/trunk@8720 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:17:38 +00:00
morse%netscape.com
25fa2a9395 strings for cookie trust labels
git-svn-id: svn://10.0.0.236/trunk@8719 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 20:10:32 +00:00
rods%netscape.com
516bef3e06 Fixed ref count problem in FindNext (should be able to switch docs now)
git-svn-id: svn://10.0.0.236/trunk@8718 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 19:55:03 +00:00
despotdaemon%netscape.com
74735ce7ed Pseudo-automatic update of changes made by terry@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8717 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 19:45:55 +00:00
terry%netscape.com
a7f2ec4561 Back out last change. No diffs are showing up at all!
git-svn-id: svn://10.0.0.236/trunk@8716 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 19:23:41 +00:00
terry%netscape.com
5faec3d6ed Fixed bug 544 -- now use unified diffs instead of context diffs in mail.
git-svn-id: svn://10.0.0.236/trunk@8715 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 19:17:59 +00:00
despotdaemon%netscape.com
9db2998134 Pseudo-automatic update of changes made by ddrinan@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8714 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 18:52:19 +00:00
terry%netscape.com
326cdd5d93 Fixed bug 513 -- adding CC field caused crash.
git-svn-id: svn://10.0.0.236/trunk@8713 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 18:32:15 +00:00
terry%netscape.com
d777ef9189 Debugging support -- if we get an SQL error, show the SQL command that failed.
git-svn-id: svn://10.0.0.236/trunk@8712 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 18:31:05 +00:00
rods%netscape.com
90439d8478 Added a couple of data members to the header and cleanup some of the
ref count problems


git-svn-id: svn://10.0.0.236/trunk@8711 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 18:15:14 +00:00
cyeh%netscape.com
86bed95f8a add set-timebomb.pl to MozillaSourceUnix module. grrrr...
git-svn-id: svn://10.0.0.236/trunk@8710 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 17:31:08 +00:00
kipp%netscape.com
29d4a0272c Spanked hard to support multiple sink contexts; incremental reflow now happens only on WillInterrupt
git-svn-id: svn://10.0.0.236/trunk@8709 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:20:16 +00:00
kipp%netscape.com
52524023bc Avoid a crash bug
git-svn-id: svn://10.0.0.236/trunk@8708 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:19:38 +00:00
kipp%netscape.com
69abb91cd8 Added a new atom
git-svn-id: svn://10.0.0.236/trunk@8707 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:19:27 +00:00
kipp%netscape.com
22faac0a08 Removed the PushMark method
git-svn-id: svn://10.0.0.236/trunk@8706 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:18:14 +00:00
rods%netscape.com
3817dceba6 Added XP Find dialog
git-svn-id: svn://10.0.0.236/trunk@8705 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:14:37 +00:00
rods%netscape.com
9423ca5271 Added registration of nsIDialog and nsILabel
git-svn-id: svn://10.0.0.236/trunk@8704 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:13:56 +00:00
rods%netscape.com
1dab6ce3ed Enabled the "Find" menu item
git-svn-id: svn://10.0.0.236/trunk@8703 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:12:51 +00:00
rods%netscape.com
143a4edd02 Added selection code that is currently ifdef out (but it is needed)
git-svn-id: svn://10.0.0.236/trunk@8702 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:06:22 +00:00
rods%netscape.com
adec4ac54a Fixed up some of the selection methods
git-svn-id: svn://10.0.0.236/trunk@8701 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 16:02:33 +00:00
rods%netscape.com
db20bc1720 Added FindNext method
git-svn-id: svn://10.0.0.236/trunk@8700 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 15:59:24 +00:00
rods%netscape.com
8d96945b15 Adjusted the method signatures on most of the Selection methods
git-svn-id: svn://10.0.0.236/trunk@8699 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 15:58:37 +00:00
rods%netscape.com
a012be6a6d Added FindNext Method for Find/Search
git-svn-id: svn://10.0.0.236/trunk@8698 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 15:57:59 +00:00
rods%netscape.com
0c8b07b665 Fixed bugs and adjusted TextFrame to match revised method signatures
git-svn-id: svn://10.0.0.236/trunk@8697 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 15:56:40 +00:00
rods%netscape.com
3434b35d86 Added Find/Search capability and supporting methods
git-svn-id: svn://10.0.0.236/trunk@8696 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 15:55:31 +00:00
troy%netscape.com
ffd571769e Interface change
git-svn-id: svn://10.0.0.236/trunk@8695 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 15:19:44 +00:00
despotdaemon%netscape.com
c54323a1f8 Pseudo-automatic update of changes made by shaver@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8694 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 14:29:58 +00:00
terry%netscape.com
b248dd0fc8 Get rid of the "read and eat" line; it doesn't make sense here.
git-svn-id: svn://10.0.0.236/trunk@8693 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 13:50:41 +00:00
shaver%netscape.com
207c272479 actually reflow altered text
git-svn-id: svn://10.0.0.236/trunk@8692 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 13:42:25 +00:00
shaver%netscape.com
f7c264af72 wire up DOM_Nodes and LO_Elements; maybe fix <LI> CSS bug? (all #if DOM)
git-svn-id: svn://10.0.0.236/trunk@8691 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 10:29:42 +00:00
shaver%netscape.com
c55c619ff7 current_node is always the current_node now. also: set up for text mutation
git-svn-id: svn://10.0.0.236/trunk@8690 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 10:23:35 +00:00
shaver%netscape.com
85c33a05a7 break universal dep on lm_dom.h; start wiring DOM_Node<->LO_Element
git-svn-id: svn://10.0.0.236/trunk@8689 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 07:53:18 +00:00
shaver%netscape.com
4d1d70ca76 switch to void * in lo_DocState, not DOM_Node * because too many places #include "layout.h"
git-svn-id: svn://10.0.0.236/trunk@8688 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 07:52:07 +00:00
cls%seawood.org
04dcdb28d2 More tweaks for make depend under autoconf.
git-svn-id: svn://10.0.0.236/trunk@8687 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 07:07:47 +00:00
cyeh%netscape.com
0a30b35651 change default homepage
git-svn-id: svn://10.0.0.236/trunk@8686 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 07:03:39 +00:00
cls%seawood.org
59a413497e ifdef'd out MOZ_OJI as only the bare minimum should be on by default for the autoconf buld.
git-svn-id: svn://10.0.0.236/trunk@8685 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 07:00:13 +00:00
cls%seawood.org
e24cdf321b Removed SHACK and added DOM.
git-svn-id: svn://10.0.0.236/trunk@8684 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 06:55:52 +00:00
cls%seawood.org
ccf2f2da9b Removed check for thread libs as they conflicted with nsprpub threads. Added option for dom and removed option for shack.
git-svn-id: svn://10.0.0.236/trunk@8683 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 06:54:06 +00:00
troy%netscape.com
d4260119a8 Changed nsIFontCache to conform to XPCOM standards
git-svn-id: svn://10.0.0.236/trunk@8682 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 05:16:41 +00:00
troy%netscape.com
e9e900374e Changed nsIViewManager interface to conform to XPCOM conventions
git-svn-id: svn://10.0.0.236/trunk@8681 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 04:56:56 +00:00
toshok%netscape.com
7b65e1900d use $(MAKE) instead of make, so it does not break on bsd machines, where make and gmake are *completely* different
git-svn-id: svn://10.0.0.236/trunk@8680 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 04:37:44 +00:00
morse%netscape.com
92b0d35986 fix bug found by mjudge
git-svn-id: svn://10.0.0.236/trunk@8679 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 04:10:08 +00:00
danm%netscape.com
43ea3d3f41 plug leak in LayoutButtons
git-svn-id: svn://10.0.0.236/trunk@8678 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 03:10:14 +00:00
michaelp%netscape.com
65433b951d changes for new viewobserver stuff.
git-svn-id: svn://10.0.0.236/trunk@8677 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 03:09:22 +00:00
michaelp%netscape.com
6702cf7961 changes to support viewobserver and troy's spankage of the device context.
git-svn-id: svn://10.0.0.236/trunk@8676 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 03:05:23 +00:00
michaelp%netscape.com
7b063335be DeleteFrame() now takes a pres context.
git-svn-id: svn://10.0.0.236/trunk@8675 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 03:02:39 +00:00
troy%netscape.com
b69cf1e950 Fixed call to GetFontCache
git-svn-id: svn://10.0.0.236/trunk@8674 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 02:56:22 +00:00
michaelp%netscape.com
1b64af0c9b added support for view observer.
git-svn-id: svn://10.0.0.236/trunk@8673 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 02:54:06 +00:00
michaelp%netscape.com
cdc8077956 DeleteFrame() now takes a pres context. now uses view's setclientdata().
git-svn-id: svn://10.0.0.236/trunk@8672 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 02:52:54 +00:00
troy%netscape.com
c9c414f1c0 Turned off gamma correction
git-svn-id: svn://10.0.0.236/trunk@8671 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 02:50:19 +00:00
michaelp%netscape.com
d1419737b5 deleteframe() now takes a pres context.
git-svn-id: svn://10.0.0.236/trunk@8670 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 02:50:17 +00:00
michaelp%netscape.com
a230da72a6 made resizereflow() an ns_imethod.
git-svn-id: svn://10.0.0.236/trunk@8669 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 02:49:49 +00:00
michaelp%netscape.com
a2271263d0 changed to pass in prescontext to deleteframe().
git-svn-id: svn://10.0.0.236/trunk@8668 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 02:49:15 +00:00
jgellman%netscape.com
dc657f64cd little patch trouble. whups.
git-svn-id: svn://10.0.0.236/trunk@8667 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 02:10:16 +00:00
troy%netscape.com
c9a229357c nsIDeviceContext API change
git-svn-id: svn://10.0.0.236/trunk@8666 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 01:58:02 +00:00
jgellman%netscape.com
fbb1f40d77 Remove data source entries from cache table when the data source is destroyed
git-svn-id: svn://10.0.0.236/trunk@8665 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 01:33:36 +00:00
thom%netscape.com
cded20b7b6 fixed heap corruption in mac version of the function mangleResourceIntoFileURL. This change ONLY effects macs
git-svn-id: svn://10.0.0.236/trunk@8664 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 01:33:14 +00:00
danm%netscape.com
0e8ef25cee teach RDF toolbars to work with toolbar display mode property. r:hyatt
git-svn-id: svn://10.0.0.236/trunk@8663 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 01:22:30 +00:00
danm%netscape.com
0be3f7f951 new toolbar property, new function which fetches templates, fix hashtable bug, bmkNotifFunc notifies regardless of property type. r:rjc
git-svn-id: svn://10.0.0.236/trunk@8662 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 01:19:41 +00:00
thom%netscape.com
4fb9e17b43 got the file in sync with troy's fontCache changes
git-svn-id: svn://10.0.0.236/trunk@8661 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 00:28:10 +00:00
slamm%netscape.com
d96f914fc1 Standardize the format of the translation resources. Make it easier to see errors.
git-svn-id: svn://10.0.0.236/trunk@8660 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-28 00:20:44 +00:00
kostello%netscape.com
1d4ec605a7 Added support for hit testing and mac support methods for translating between mac coordinate system and nsRects
git-svn-id: svn://10.0.0.236/trunk@8659 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 23:04:30 +00:00
troy%netscape.com
eb362e45da fixed my bustage.
git-svn-id: svn://10.0.0.236/trunk@8658 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 23:02:03 +00:00
kostello%netscape.com
993b43f31c Added methods to update window bounds rect during resize and drag
git-svn-id: svn://10.0.0.236/trunk@8657 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 23:01:56 +00:00
kostello%netscape.com
8711902173 Added Mac to nsRect support. Added HitTest logic
git-svn-id: svn://10.0.0.236/trunk@8656 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 23:01:17 +00:00
despotdaemon%netscape.com
2f43037e94 Pseudo-automatic update of changes made by mwelch@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8655 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 22:55:53 +00:00
troy%netscape.com
15c93f90c2 More changes to nsIDeviceContext interface
git-svn-id: svn://10.0.0.236/trunk@8654 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 22:45:35 +00:00
pierre%netscape.com
6d97cac430 In the previous checkin, the path "powerplant/utility" was added to the 'domDebug.o' target only. Adding it to 'dom.o' now and verified that it was already in the 'shlb' target.
git-svn-id: svn://10.0.0.236/trunk@8653 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 22:16:56 +00:00
troy%netscape.com
ce4befff05 Fixed build bustage
git-svn-id: svn://10.0.0.236/trunk@8652 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 22:12:26 +00:00
pierre%netscape.com
555a919ddd added path "powerplant/utility"
added files jsurl.cpp + nsFrameList.cpp + nsJSWindowCollection.cpp


git-svn-id: svn://10.0.0.236/trunk@8651 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 22:11:05 +00:00
pierre%netscape.com
5847c66bb7 added nsHTMLLayer.cpp
git-svn-id: svn://10.0.0.236/trunk@8650 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 22:09:02 +00:00
pierre%netscape.com
349def3a94 re-enabled the View, Web and Pref factories
git-svn-id: svn://10.0.0.236/trunk@8649 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 22:08:39 +00:00
cyeh%netscape.com
f4f16f6856 added subroutine to adjust agent number everytime you build. for official releases only.
git-svn-id: svn://10.0.0.236/trunk@8648 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 22:04:19 +00:00
morse%netscape.com
bdcafcea64 added apple keychain
git-svn-id: svn://10.0.0.236/trunk@8647 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 21:14:41 +00:00
pinkerton%netscape.com
8ee4b70edd Fix bug where if rdf file specified that all columns should be hidden the heap would get corrupted. Now forces at least one column to be visible.
git-svn-id: svn://10.0.0.236/trunk@8646 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 21:10:07 +00:00
troy%netscape.com
917cd408ec Change to GetRenderingContext
git-svn-id: svn://10.0.0.236/trunk@8645 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 21:09:25 +00:00
morse%netscape.com
ef190fe835 single-signon fix
git-svn-id: svn://10.0.0.236/trunk@8644 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 21:05:58 +00:00
troy%netscape.com
26782f0ba7 API change to nsIDeviceContext
git-svn-id: svn://10.0.0.236/trunk@8643 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:45:56 +00:00
troy%netscape.com
9c277134e0 More API changes to nsIDeviceContext
git-svn-id: svn://10.0.0.236/trunk@8642 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:43:04 +00:00
troy%netscape.com
ad7971ffd1 Another attempt
git-svn-id: svn://10.0.0.236/trunk@8641 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:31:39 +00:00
rods%netscape.com
049f316091 Added InitData struct
git-svn-id: svn://10.0.0.236/trunk@8640 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:29:59 +00:00
pinkerton%netscape.com
8ef5bef118 Respond better to column add/delete events.
git-svn-id: svn://10.0.0.236/trunk@8639 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:27:10 +00:00
pinkerton%netscape.com
d85b33f31d More 4.5 merges. Fix problem with not showing form data in viewSource, print, saveAs.
git-svn-id: svn://10.0.0.236/trunk@8638 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:26:40 +00:00
rods%netscape.com
6a3942478b Added nsLabel and nsDialog to build
git-svn-id: svn://10.0.0.236/trunk@8637 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:26:30 +00:00
pinkerton%netscape.com
6ec83383e2 Fix bug that caused crash when you clicked onany blank area of the toolbar.
git-svn-id: svn://10.0.0.236/trunk@8636 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:25:21 +00:00
cyeh%netscape.com
b10aaddcd7 disable updating the build number in about-all.html everytime you build. needs to be turned on for official releases only until ckid/mcvs resource problem is solved. editing about-all.html causes file to be blown away.
git-svn-id: svn://10.0.0.236/trunk@8635 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:20:06 +00:00
shaver%netscape.com
abea434d80 tell people how to change their new password
git-svn-id: svn://10.0.0.236/trunk@8634 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:18:13 +00:00
rods%netscape.com
ee0e8ac41f Initial working checkin
git-svn-id: svn://10.0.0.236/trunk@8633 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:16:20 +00:00
cyeh%netscape.com
64c2293952 udpate the build number in about-all.html everytime you build.
git-svn-id: svn://10.0.0.236/trunk@8632 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:15:30 +00:00
rods%netscape.com
c900d89367 Added nsILabel.h and nsIDialog.h
git-svn-id: svn://10.0.0.236/trunk@8631 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 20:09:16 +00:00
cls%seawood.org
656bd9c3e8 Added timebomb target.
git-svn-id: svn://10.0.0.236/trunk@8630 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 19:53:30 +00:00
cls%seawood.org
16915211df Enabled dependencies for autoconf.
git-svn-id: svn://10.0.0.236/trunk@8629 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 19:52:22 +00:00
cls%seawood.org
0343f30ff3 Removed HistoryFrame.cpp
git-svn-id: svn://10.0.0.236/trunk@8628 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 19:48:25 +00:00
cls%seawood.org
519fb35777 Put DEBUG ifdefs around debugEvent() call. Approved by shaver%netscape.com
git-svn-id: svn://10.0.0.236/trunk@8627 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 19:47:48 +00:00
troy%netscape.com
29ae90ea2b More changes to nsIDeviceContext API
git-svn-id: svn://10.0.0.236/trunk@8626 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 18:47:22 +00:00
troy%netscape.com
6d5ab64685 Fixed build bustage
git-svn-id: svn://10.0.0.236/trunk@8625 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 18:46:51 +00:00
troy%netscape.com
c37f617b06 Combined GetScrollBarWidth/GetScrollBarHeight into one function
GetScrollBarDimensions


git-svn-id: svn://10.0.0.236/trunk@8624 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 18:30:55 +00:00
terry%netscape.com
08b3a23aa0 Hacky preventative for bug 540 -- disable the "edit long description"
feature entirely.


git-svn-id: svn://10.0.0.236/trunk@8623 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 18:14:14 +00:00
dcone%netscape.com
b816bd348e Fixed some small bugs.
git-svn-id: svn://10.0.0.236/trunk@8622 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 18:03:15 +00:00
dcone%netscape.com
754bbcabc4 updated some routines
git-svn-id: svn://10.0.0.236/trunk@8621 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 17:46:58 +00:00
dcone%netscape.com
9583aa7936 Updated to use regions
git-svn-id: svn://10.0.0.236/trunk@8620 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 17:36:13 +00:00
dcone%netscape.com
6ffe0079d6 updated some routines
git-svn-id: svn://10.0.0.236/trunk@8619 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 17:35:49 +00:00
dcone%netscape.com
36dc0329f9 Updated the clipping region, and some coordinate fixes
git-svn-id: svn://10.0.0.236/trunk@8618 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 17:33:51 +00:00
dcone%netscape.com
ce98b2dc7d Fixed the messaging and local/global point location
git-svn-id: svn://10.0.0.236/trunk@8617 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 17:32:57 +00:00
dcone%netscape.com
d3fa62c6e9 added a region native data type
git-svn-id: svn://10.0.0.236/trunk@8616 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 17:31:59 +00:00
troy%netscape.com
d90e450524 Fixed some bustage I intriduced
git-svn-id: svn://10.0.0.236/trunk@8615 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 17:26:48 +00:00
terry%netscape.com
0a02093753 Fixed bug 538 -- can now search through summary and description fields.
git-svn-id: svn://10.0.0.236/trunk@8614 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 17:22:23 +00:00
despotdaemon%netscape.com
c0a315bbec Pseudo-automatic update of changes made by leaf@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8613 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 16:10:26 +00:00
terry%netscape.com
ce187b5865 The default product is now called "Mozilla".
git-svn-id: svn://10.0.0.236/trunk@8612 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 15:30:25 +00:00
terry%netscape.com
9e813ee681 Sort the list of products.
git-svn-id: svn://10.0.0.236/trunk@8611 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 15:30:01 +00:00
terry%netscape.com
e0dadcef2d Fixed bug 539 -- cope with multiple products in the system.
git-svn-id: svn://10.0.0.236/trunk@8610 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 14:56:19 +00:00
terry%netscape.com
9b69df4fe2 I'd prefer to be known as terry@mozilla.org.
git-svn-id: svn://10.0.0.236/trunk@8609 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 14:55:27 +00:00
shaver%netscape.com
f6d9f7194c start to flesh out lm_CDataOp (you can set the title!) and remove attrs from HTMLElementPrivate
git-svn-id: svn://10.0.0.236/trunk@8608 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 09:13:00 +00:00
shaver%netscape.com
a59d815420 implemented cdata_setter
git-svn-id: svn://10.0.0.236/trunk@8607 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 09:11:45 +00:00
valeski%netscape.com
3574dedce6 nsString.h - the mBuf member data type was the raw PRUnichar type, changed it to chartype.
nsString.cpp - we were dropping the ending null-byte/unichar when expanding/growing strings


git-svn-id: svn://10.0.0.236/trunk@8606 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 08:15:40 +00:00
mcafee%netscape.com
164839f6fb Fixing compile warnings on Linux
git-svn-id: svn://10.0.0.236/trunk@8605 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 07:13:15 +00:00
mcafee%netscape.com
89e50ae71e Fixing Solaris warning, native compiler
git-svn-id: svn://10.0.0.236/trunk@8604 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 07:02:04 +00:00
shaver%netscape.com
917fc12442 protect against multiple inclusion (possibe now with DOM/layout/libmocha)
git-svn-id: svn://10.0.0.236/trunk@8603 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 05:54:56 +00:00
shaver%netscape.com
0f715858f6 DOM stub tweakage and fixed Text/CData init
git-svn-id: svn://10.0.0.236/trunk@8602 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 05:54:01 +00:00
shaver%netscape.com
903f2bc165 small DOM changes (new and old)
git-svn-id: svn://10.0.0.236/trunk@8601 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 05:51:47 +00:00
troy%netscape.com
50594d5ee2 Made sure that _I32_MIN is defined (it appears to be a Windows only thing)
git-svn-id: svn://10.0.0.236/trunk@8600 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 05:28:32 +00:00
shaver%netscape.com
0e484541ef Added CData operations (append, insert, delete, replace, substring).
Added Element {[sg]et,remove}Attribute
Check for illegal child in Node ops appendChild, insertBefore and replaceChild.


git-svn-id: svn://10.0.0.236/trunk@8599 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 05:25:40 +00:00
troy%netscape.com
3a6cdd1b67 Changes to nsIDeviceContext API
git-svn-id: svn://10.0.0.236/trunk@8598 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 05:14:35 +00:00
troy%netscape.com
9b42ea4cb1 Changed nsIDeviceContext interface to conform [more] with COM conventions
git-svn-id: svn://10.0.0.236/trunk@8597 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 05:05:03 +00:00
beard%netscape.com
7ddcb2ecb1 Removed hotlist.c from non-debug target as well.
git-svn-id: svn://10.0.0.236/trunk@8596 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 03:48:28 +00:00
saari%netscape.com
2d833c1592 Fix for bug # 311002
Fixed Pinkerton's Mac scrolling optimization so that it doesn't grab the bits of floating windows above Navigator.

This is Mac only.


git-svn-id: svn://10.0.0.236/trunk@8595 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 02:43:43 +00:00
kipp%netscape.com
59188b9ffd Fixed compiler problem with other compilers by removing useless const in front of void
git-svn-id: svn://10.0.0.236/trunk@8594 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 02:39:36 +00:00
akkana%netscape.com
044185b9c7 Add a PR_ASSERT (yes, a crash) for unreproducible crash 113534;
add code for "Send now" under Publish menu, but only if MOZ_MAIL_NEWS.


git-svn-id: svn://10.0.0.236/trunk@8593 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 01:55:52 +00:00
brendan%netscape.com
541a9954be Fix funky whitespace.
git-svn-id: svn://10.0.0.236/trunk@8591 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 01:48:25 +00:00
cyeh%netscape.com
863cdb6dda added lib/libdom for shaver to MozillaSourceCommon
git-svn-id: svn://10.0.0.236/trunk@8590 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 01:13:27 +00:00
peterl%netscape.com
2512a98a4d hacked colgroup & col handling
git-svn-id: svn://10.0.0.236/trunk@8589 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 01:04:22 +00:00
peterl%netscape.com
b27c2c0f07 added default attribute handling
git-svn-id: svn://10.0.0.236/trunk@8588 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:57:24 +00:00
peterl%netscape.com
b3ace934f1 no longer force unique style contexts
git-svn-id: svn://10.0.0.236/trunk@8587 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:57:05 +00:00
peterl%netscape.com
6655d27071 remove text attribute processing
git-svn-id: svn://10.0.0.236/trunk@8586 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:56:17 +00:00
peterl%netscape.com
6a79a8665f removed hack attibute
removed attribute propogation form rows & row groups


git-svn-id: svn://10.0.0.236/trunk@8585 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:55:30 +00:00
peterl%netscape.com
25d65b9397 added table dir to includes
git-svn-id: svn://10.0.0.236/trunk@8584 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:51:11 +00:00
peterl%netscape.com
2a62f344d7 added table cell style rule inheritance
git-svn-id: svn://10.0.0.236/trunk@8583 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:50:52 +00:00
peterl%netscape.com
6a2a44c8c2 reversed rule ordering
git-svn-id: svn://10.0.0.236/trunk@8582 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:49:55 +00:00
peterl%netscape.com
fbcc465682 made col tag be handled as a leaf
git-svn-id: svn://10.0.0.236/trunk@8581 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:48:53 +00:00
peterl%netscape.com
bc4211d1ed added td & th
git-svn-id: svn://10.0.0.236/trunk@8580 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:48:06 +00:00
peterl%netscape.com
bf5ece7e7a reversed sheet/rule ordering
added backstop rule count


git-svn-id: svn://10.0.0.236/trunk@8579 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:47:15 +00:00
leaf%mozilla.org
16725b12a1 Added a timebomb target for "MOZILLA_OFFICIAL" builds, w/unix and perl5.
git-svn-id: svn://10.0.0.236/trunk@8578 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:47:14 +00:00
peterl%netscape.com
edecfc5a4c commented on sheet/rule ordering
git-svn-id: svn://10.0.0.236/trunk@8577 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:46:34 +00:00
peterl%netscape.com
c85bf386f6 added backstop rule count
git-svn-id: svn://10.0.0.236/trunk@8576 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:46:13 +00:00
mlm%netscape.com
173d73ff3c Fix from Jeff Garzik (jgarzik@pobox.com): remove SIZE_MIN and SIZE_MAX
from the include file, as they're not referenced anywhere.


git-svn-id: svn://10.0.0.236/trunk@8575 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:29:24 +00:00
rjc%netscape.com
f329c08189 Expose HT_LayoutComplete() API for layout notification.
git-svn-id: svn://10.0.0.236/trunk@8574 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:27:59 +00:00
rjc%netscape.com
a2915eebfa Disable personal toolbar relations (important for Mac). Also, when removing columns
during pane deletion, adjust internal list.


git-svn-id: svn://10.0.0.236/trunk@8573 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:27:18 +00:00
shaver%netscape.com
f5d79b0ece fix typo and kill warning
git-svn-id: svn://10.0.0.236/trunk@8572 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:17:40 +00:00
shaver%netscape.com
16523d1fdc build libdom (if DOM)
git-svn-id: svn://10.0.0.236/trunk@8571 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:14:53 +00:00
shaver%netscape.com
d5d47cefc1 add libdom to link, if DOM set
git-svn-id: svn://10.0.0.236/trunk@8570 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:14:34 +00:00
shaver%netscape.com
816b75fd0b added code to drive the lib/libdom stuff
git-svn-id: svn://10.0.0.236/trunk@8569 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:09:43 +00:00
shaver%netscape.com
fce77d4a7b added hooks to lib/libdom stuff, and exposed lo_IsEmptyTag for use by libmocha DOM hooks
git-svn-id: svn://10.0.0.236/trunk@8568 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:05:26 +00:00
terry%netscape.com
70ff2bd9be Don't choke if the user hits a space or something in the 'changed in
last ___ days' field.


git-svn-id: svn://10.0.0.236/trunk@8567 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:03:27 +00:00
shaver%netscape.com
f1886e2f6b added first cut of Level-1 DOM (not layout or XML dependent)
git-svn-id: svn://10.0.0.236/trunk@8566 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-27 00:02:31 +00:00
despotdaemon%netscape.com
c2826b34ce Pseudo-automatic update of changes made by terry@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8564 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 23:06:50 +00:00
despotdaemon%netscape.com
5704816c0b Pseudo-automatic update of changes made by terry@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8563 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 23:05:15 +00:00
kostello%netscape.com
a6e15c2d3c Remove Widget from the build list (it shouldn't have been their in the first place) -- my error.
git-svn-id: svn://10.0.0.236/trunk@8562 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 22:58:54 +00:00
terry%netscape.com
7d0b388dfa Oops; mail the right URL.
git-svn-id: svn://10.0.0.236/trunk@8561 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 22:51:52 +00:00
despotdaemon%netscape.com
95ddf7bfd9 Pseudo-automatic update of changes made by briano@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@8560 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 22:48:51 +00:00
jwz%mozilla.org
d3b1cdd2e4 give the image a border
git-svn-id: svn://10.0.0.236/trunk@8559 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 22:36:44 +00:00
jwz%mozilla.org
04599c8a68 smaller version of the ant image (8k instead of 17k.)
git-svn-id: svn://10.0.0.236/trunk@8558 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 22:36:05 +00:00
terry%netscape.com
91fea0ae34 Turn on mail notifications.
git-svn-id: svn://10.0.0.236/trunk@8557 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 22:23:00 +00:00
ramiro%netscape.com
280d940b0a Remove unused include.
git-svn-id: svn://10.0.0.236/trunk@8556 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 21:38:46 +00:00
despotdaemon%netscape.com
094a26a86b Pseudo-automatic update of changes made by leaf@mozilla.org.
git-svn-id: svn://10.0.0.236/trunk@8555 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 21:35:49 +00:00
slamm%netscape.com
f2557c4d40 Have cvs ingnore the generated '.c' files.
git-svn-id: svn://10.0.0.236/trunk@8554 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 21:29:46 +00:00
michaelp%netscape.com
c6b1a0acee killed Set/GetRootWindow() methods in viewmanager. this is now inferred from
the root view. added ability to select painting in view resizing.


git-svn-id: svn://10.0.0.236/trunk@8553 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 21:24:58 +00:00
michaelp%netscape.com
56715faccc killed viewmanager SetRootWindow() call.
git-svn-id: svn://10.0.0.236/trunk@8552 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 21:24:19 +00:00
rickg%netscape.com
dac30eb9e4 various bug fixes, performance wip
git-svn-id: svn://10.0.0.236/trunk@8551 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 21:20:41 +00:00
leaf%mozilla.org
b8dc6ccf8e kill warnings and '?' lines when people update with obj files, etc.
git-svn-id: svn://10.0.0.236/trunk@8550 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 21:17:04 +00:00
hyatt%netscape.com
aba751fdab Improvements to the control strip in the RDF tree widget. Fixes for two P0 bugs:
#311916 and #314414.


git-svn-id: svn://10.0.0.236/trunk@8549 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 20:51:01 +00:00
robinf%netscape.com
215bbb6978 removing outdated Mac dialer help file
git-svn-id: svn://10.0.0.236/trunk@8548 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 20:37:22 +00:00
robinf%netscape.com
66ab409858 removing outdated files
git-svn-id: svn://10.0.0.236/trunk@8547 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 20:36:09 +00:00
beard%netscape.com
09c7594e49 Removed hotlist.c, which was obsoleted (bad, bad!) before verifying on the Mac.
git-svn-id: svn://10.0.0.236/trunk@8546 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 20:33:53 +00:00
donm%netscape.com
0ba7886e77 reverting to ifdef BUILD_OFFICIAL around the build_numbering system.
git-svn-id: svn://10.0.0.236/trunk@8545 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 20:27:11 +00:00
terry%netscape.com
e12ca36c15 About the Bugzilla source.
git-svn-id: svn://10.0.0.236/trunk@8544 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 20:15:06 +00:00
beard%netscape.com
02ad7fd44b Removed obsolete files: bkmks.h, hotlist.h so build will work.
git-svn-id: svn://10.0.0.236/trunk@8543 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 19:41:55 +00:00
av%netscape.com
764e512976 Anthrax changes
git-svn-id: svn://10.0.0.236/trunk@8542 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 19:30:58 +00:00
terry%netscape.com
8cc794caff Stop looking for "target_fix_version".
git-svn-id: svn://10.0.0.236/trunk@8541 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 19:26:59 +00:00
pinkerton%netscape.com
b6e496388d No more netcaster. Minor 4.5 merges (added referrer to DoGetURL).
git-svn-id: svn://10.0.0.236/trunk@8540 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 19:07:03 +00:00
pinkerton%netscape.com
608220c2a7 Column support in tree view.
git-svn-id: svn://10.0.0.236/trunk@8539 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 19:04:54 +00:00
pinkerton%netscape.com
3805b9c59e no more netcaster.
git-svn-id: svn://10.0.0.236/trunk@8538 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 19:02:43 +00:00
pinkerton%netscape.com
c15c254fa0 No more netcaster.
git-svn-id: svn://10.0.0.236/trunk@8537 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 19:02:26 +00:00
pinkerton%netscape.com
0a32d2eefa More printing fixes and 4.5 landings. Mostly minor except for print fix.
git-svn-id: svn://10.0.0.236/trunk@8536 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 19:02:13 +00:00
slamm%netscape.com
30412e1a6d Have cvs ignore the generated files.
git-svn-id: svn://10.0.0.236/trunk@8535 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-26 18:36:12 +00:00
207 changed files with 75776 additions and 102 deletions

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___ */

672
mozilla/js/src/jsatom.c Normal file
View File

@@ -0,0 +1,672 @@
/* -*- 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.
*/
/*
* JS atom table.
*/
#include "jsstddef.h"
#include <stdlib.h>
#include <string.h>
#include "jstypes.h"
/* Removed by JSIFY: #include "prlog.h" */
#include "jsutil.h" /* Added by JSIFY */
#ifndef NSPR20
#include "jshash.h"
#else
/* Removed by JSIFY: #include "JShash.h"
*/
#include "jshash.h" /* Added by JSIFY */
#endif
#include "jsprf.h"
#include "jsapi.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsgc.h"
#include "jslock.h"
#include "jsnum.h"
#include "jsopcode.h"
#include "jsstr.h"
/*
* Keep this in sync with jspubtd.h -- an assertion below will insist that
* its length match the JSType enum's JSTYPE_LIMIT limit value.
*/
char *js_type_str[] = {
"undefined",
"object",
"function",
"string",
"number",
"boolean",
};
char *js_boolean_str[] = {
js_false_str,
js_true_str
};
char js_Array_str[] = "Array";
char js_Math_str[] = "Math";
char js_Object_str[] = "Object";
char js_anonymous_str[] = "anonymous";
char js_arguments_str[] = "arguments";
char js_arity_str[] = "arity";
char js_assign_str[] = "assign";
char js_callee_str[] = "callee";
char js_caller_str[] = "caller";
char js_class_prototype_str[] = "prototype";
char js_constructor_str[] = "constructor";
char js_count_str[] = "__count__";
char js_eval_str[] = "eval";
char js_index_str[] = "index";
char js_input_str[] = "input";
char js_length_str[] = "length";
char js_name_str[] = "name";
char js_parent_str[] = "__parent__";
char js_proto_str[] = "__proto__";
char js_toSource_str[] = "toSource";
char js_toString_str[] = "toString";
char js_valueOf_str[] = "valueOf";
#define HASH_OBJECT(o) ((JSHashNumber)(o) >> JSVAL_TAGBITS)
#define HASH_INT(i) ((JSHashNumber)(i))
#define HASH_DOUBLE(dp) ((JSHashNumber)(((uint32*)(dp))[0] ^ ((uint32*)(dp))[1]))
#define HASH_BOOLEAN(b) ((JSHashNumber)(b))
STATIC_DLL_CALLBACK(JSHashNumber)
js_hash_atom_key(const void *key)
{
jsval v;
jsdouble *dp;
/* Order JSVAL_IS_* tests by likelihood of success. */
v = (jsval)key;
if (JSVAL_IS_STRING(v))
return js_HashString(JSVAL_TO_STRING(v));
if (JSVAL_IS_INT(v))
return HASH_INT(JSVAL_TO_INT(v));
if (JSVAL_IS_DOUBLE(v)) {
dp = JSVAL_TO_DOUBLE(v);
return HASH_DOUBLE(dp);
}
if (JSVAL_IS_OBJECT(v))
return HASH_OBJECT(JSVAL_TO_OBJECT(v));
if (JSVAL_IS_BOOLEAN(v))
return HASH_BOOLEAN(JSVAL_TO_BOOLEAN(v));
return (JSHashNumber)v;
}
STATIC_DLL_CALLBACK(intN)
js_compare_atom_keys(const void *k1, const void *k2)
{
jsval v1, v2;
v1 = (jsval)k1, v2 = (jsval)k2;
if (JSVAL_IS_STRING(v1) && JSVAL_IS_STRING(v2))
return !js_CompareStrings(JSVAL_TO_STRING(v1), JSVAL_TO_STRING(v2));
if (JSVAL_IS_DOUBLE(v1) && JSVAL_IS_DOUBLE(v2)) {
double d1 = *JSVAL_TO_DOUBLE(v1);
double d2 = *JSVAL_TO_DOUBLE(v2);
if (JSDOUBLE_IS_NaN(d1))
return JSDOUBLE_IS_NaN(d2);
#ifdef XP_PC
/* XXX MSVC miscompiles such that (NaN == 0) */
if (JSDOUBLE_IS_NaN(d2))
return JS_FALSE;
#endif
return d1 == d2;
}
return v1 == v2;
}
STATIC_DLL_CALLBACK(int)
js_compare_stub(const void *v1, const void *v2)
{
return 1;
}
STATIC_DLL_CALLBACK(void *)
js_alloc_atom_space(void *priv, size_t size)
{
return malloc(size);
}
STATIC_DLL_CALLBACK(void)
js_free_atom_space(void *priv, void *item)
{
free(item);
}
STATIC_DLL_CALLBACK(JSHashEntry *)
js_alloc_atom(void *priv, const void *key)
{
JSAtomState *state = priv;
JSAtom *atom;
atom = malloc(sizeof(JSAtom));
if (!atom)
return NULL;
#ifdef JS_THREADSAFE
state->tablegen++;
#endif
atom->entry.key = key;
atom->entry.value = NULL;
atom->flags = 0;
atom->kwindex = -1;
atom->number = state->number++;
return &atom->entry;
}
STATIC_DLL_CALLBACK(void)
js_free_atom(void *priv, JSHashEntry *he, uintN flag)
{
if (flag != HT_FREE_ENTRY)
return;
#ifdef JS_THREADSAFE
((JSAtomState *)priv)->tablegen++;
#endif
free(he);
}
static JSHashAllocOps atom_alloc_ops = {
js_alloc_atom_space, js_free_atom_space,
js_alloc_atom, js_free_atom
};
#define JS_ATOM_HASH_SIZE 1024
JSBool
js_InitAtomState(JSContext *cx, JSAtomState *state)
{
uintN i;
state->runtime = cx->runtime;
state->number = 0;
state->table = JS_NewHashTable(JS_ATOM_HASH_SIZE, js_hash_atom_key,
js_compare_atom_keys, js_compare_stub,
&atom_alloc_ops, state);
if (!state->table) {
JS_ReportOutOfMemory(cx);
return JS_FALSE;
}
#ifdef JS_THREADSAFE
js_NewLock(&state->lock);
state->tablegen = 0;
#endif
#define FROB(lval,str) { \
if (!(state->lval = js_Atomize(cx, str, strlen(str), ATOM_PINNED))) { \
js_FreeAtomState(cx, state); \
return JS_FALSE; \
} \
}
JS_ASSERT(sizeof js_type_str / sizeof js_type_str[0] == JSTYPE_LIMIT);
for (i = 0; i < JSTYPE_LIMIT; i++)
FROB(typeAtoms[i], js_type_str[i]);
FROB(booleanAtoms[0], js_false_str);
FROB(booleanAtoms[1], js_true_str);
FROB(nullAtom, js_null_str);
FROB(ArrayAtom, js_Array_str);
FROB(MathAtom, js_Math_str);
FROB(ObjectAtom, js_Object_str);
FROB(anonymousAtom, js_anonymous_str);
FROB(argumentsAtom, js_arguments_str);
FROB(arityAtom, js_arity_str);
FROB(assignAtom, js_assign_str);
FROB(calleeAtom, js_callee_str);
FROB(callerAtom, js_caller_str);
FROB(classPrototypeAtom, js_class_prototype_str);
FROB(constructorAtom, js_constructor_str);
FROB(countAtom, js_count_str);
FROB(indexAtom, js_index_str);
FROB(inputAtom, js_input_str);
FROB(lengthAtom, js_length_str);
FROB(nameAtom, js_name_str);
FROB(parentAtom, js_parent_str);
FROB(protoAtom, js_proto_str);
FROB(toSourceAtom, js_toSource_str);
FROB(toStringAtom, js_toString_str);
FROB(valueOfAtom, js_valueOf_str);
#undef FROB
return JS_TRUE;
}
void
js_FreeAtomState(JSContext *cx, JSAtomState *state)
{
state->runtime = NULL;
JS_HashTableDestroy(state->table);
state->table = NULL;
state->number = 0;
#ifdef JS_THREADSAFE
js_DestroyLock(&state->lock);
#endif
}
typedef struct MarkArgs {
JSRuntime *runtime;
JSGCThingMarker mark;
} MarkArgs;
STATIC_DLL_CALLBACK(intN)
js_atom_marker(JSHashEntry *he, intN i, void *arg)
{
JSAtom *atom;
jsval key;
MarkArgs *args;
atom = (JSAtom *)he;
if (atom->flags & ATOM_PINNED) {
atom->flags |= ATOM_MARK;
key = ATOM_KEY(atom);
if (JSVAL_IS_GCTHING(key)) {
args = arg;
args->mark(args->runtime, JSVAL_TO_GCTHING(key));
}
}
return HT_ENUMERATE_NEXT;
}
void
js_MarkAtomState(JSAtomState *state, JSGCThingMarker mark)
{
MarkArgs args;
args.runtime = state->runtime;
args.mark = mark;
JS_HashTableEnumerateEntries(state->table, js_atom_marker, &args);
}
STATIC_DLL_CALLBACK(intN)
js_atom_sweeper(JSHashEntry *he, intN i, void *arg)
{
JSAtom *atom;
atom = (JSAtom *)he;
if (atom->flags & ATOM_MARK) {
atom->flags &= ~ATOM_MARK;
return HT_ENUMERATE_NEXT;
}
JS_ASSERT((atom->flags & ATOM_PINNED) == 0);
atom->entry.key = NULL;
atom->flags = 0;
return HT_ENUMERATE_REMOVE;
}
void
js_SweepAtomState(JSAtomState *state)
{
JS_HashTableEnumerateEntries(state->table, js_atom_sweeper, NULL);
}
STATIC_DLL_CALLBACK(intN)
js_atom_unpinner(JSHashEntry *he, intN i, void *arg)
{
JSAtom *atom;
atom = (JSAtom *)he;
atom->flags &= ~ATOM_PINNED;
return HT_ENUMERATE_NEXT;
}
void
js_UnpinPinnedAtoms(JSAtomState *state)
{
JS_HashTableEnumerateEntries(state->table, js_atom_unpinner, NULL);
}
static JSAtom *
js_AtomizeHashedKey(JSContext *cx, jsval key, JSHashNumber keyHash, uintN flags)
{
JSAtomState *state;
JSHashTable *table;
JSHashEntry *he, **hep;
JSAtom *atom;
state = &cx->runtime->atomState;
JS_LOCK(&state->lock,cx);
table = state->table;
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
if ((he = *hep) == NULL) {
he = JS_HashTableRawAdd(table, hep, keyHash, (void *)key, NULL);
if (!he) {
JS_ReportOutOfMemory(cx);
atom = NULL;
goto out;
}
}
atom = (JSAtom *)he;
atom->flags |= flags;
out:
JS_UNLOCK(&state->lock,cx);
return atom;
}
JSAtom *
js_AtomizeObject(JSContext *cx, JSObject *obj, uintN flags)
{
jsval key;
JSHashNumber keyHash;
/* XXX must be set in the following order or MSVC1.52 will crash */
keyHash = HASH_OBJECT(obj);
key = OBJECT_TO_JSVAL(obj);
return js_AtomizeHashedKey(cx, key, keyHash, flags);
}
JSAtom *
js_AtomizeBoolean(JSContext *cx, JSBool b, uintN flags)
{
jsval key;
JSHashNumber keyHash;
key = BOOLEAN_TO_JSVAL(b);
keyHash = HASH_BOOLEAN(b);
return js_AtomizeHashedKey(cx, key, keyHash, flags);
}
JSAtom *
js_AtomizeInt(JSContext *cx, jsint i, uintN flags)
{
jsval key;
JSHashNumber keyHash;
key = INT_TO_JSVAL(i);
keyHash = HASH_INT(i);
return js_AtomizeHashedKey(cx, key, keyHash, flags);
}
JSAtom *
js_AtomizeDouble(JSContext *cx, jsdouble d, uintN flags)
{
jsdouble *dp;
JSHashNumber keyHash;
jsval key;
JSAtomState *state;
JSHashTable *table;
JSHashEntry *he, **hep;
JSAtom *atom;
#if JS_ALIGN_OF_DOUBLE == 8
dp = &d;
#else
char alignbuf[16];
dp = (jsdouble *)&alignbuf[8 - ((jsuword)&alignbuf & 7)];
*dp = d;
#endif
keyHash = HASH_DOUBLE(dp);
key = DOUBLE_TO_JSVAL(dp);
state = &cx->runtime->atomState;
JS_LOCK(&state->lock,cx);
table = state->table;
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
if ((he = *hep) == NULL) {
#ifdef JS_THREADSAFE
uint32 gen = state->tablegen;
#endif
JS_UNLOCK(&state->lock,cx);
if (!js_NewDoubleValue(cx, d, &key))
return NULL;
JS_LOCK(&state->lock,cx);
#ifdef JS_THREADSAFE
if (state->tablegen != gen) {
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
if ((he = *hep) != NULL) {
atom = (JSAtom *)he;
goto out;
}
}
#endif
he = JS_HashTableRawAdd(table, hep, keyHash, (void *)key, NULL);
if (!he) {
JS_ReportOutOfMemory(cx);
atom = NULL;
goto out;
}
}
atom = (JSAtom *)he;
atom->flags |= flags;
out:
JS_UNLOCK(&state->lock,cx);
return atom;
}
JSAtom *
js_AtomizeString(JSContext *cx, JSString *str, uintN flags)
{
JSHashNumber keyHash;
jsval key;
JSAtomState *state;
JSHashTable *table;
JSHashEntry *he, **hep;
JSAtom *atom;
keyHash = js_HashString(str);
key = STRING_TO_JSVAL(str);
state = &cx->runtime->atomState;
JS_LOCK(&state->lock,cx);
table = state->table;
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
if ((he = *hep) == NULL) {
if (flags & ATOM_TMPSTR) {
#ifdef JS_THREADSAFE
uint32 gen = state->tablegen;
#endif
JS_UNLOCK(&state->lock,cx);
flags &= ~ATOM_TMPSTR;
if (flags & ATOM_NOCOPY) {
flags &= ~ATOM_NOCOPY;
str = js_NewString(cx, str->chars, str->length, 0);
} else {
str = js_NewStringCopyN(cx, str->chars, str->length, 0);
}
if (!str)
return NULL;
key = STRING_TO_JSVAL(str);
JS_LOCK(&state->lock,cx);
#ifdef JS_THREADSAFE
if (state->tablegen != gen) {
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
if ((he = *hep) != NULL) {
atom = (JSAtom *)he;
goto out;
}
}
#endif
}
he = JS_HashTableRawAdd(table, hep, keyHash, (void *)key, NULL);
if (!he) {
JS_ReportOutOfMemory(cx);
atom = NULL;
goto out;
}
}
atom = (JSAtom *)he;
atom->flags |= flags;
out:
JS_UNLOCK(&state->lock,cx);
return atom;
}
JS_FRIEND_API(JSAtom *)
js_Atomize(JSContext *cx, const char *bytes, size_t length, uintN flags)
{
jschar *chars;
JSString *str;
JSAtom *atom;
#if JS_ALIGN_OF_DOUBLE == 8
union { jsdouble d; JSString s; } u;
str = &u.s;
#else
char alignbuf[16];
str = (JSString *)&alignbuf[8 - ((jsuword)&alignbuf & 7)];
#endif
chars = js_InflateString(cx, bytes, length);
if (!chars)
return NULL;
str->chars = chars;
str->length = length;
atom = js_AtomizeString(cx, str, ATOM_TMPSTR | ATOM_NOCOPY | flags);
if (!atom || ATOM_TO_STRING(atom)->chars != chars)
JS_free(cx, chars);
return atom;
}
JS_FRIEND_API(JSAtom *)
js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, uintN flags)
{
JSString *str;
#if JS_ALIGN_OF_DOUBLE == 8
union { jsdouble d; JSString s; } u;
str = &u.s;
#else
char alignbuf[16];
str = (JSString *)&alignbuf[8 - ((jsuword)&alignbuf & 7)];
#endif
str->chars = (jschar *)chars;
str->length = length;
return js_AtomizeString(cx, str, ATOM_TMPSTR | flags);
}
JSAtom *
js_AtomizeValue(JSContext *cx, jsval value, uintN flags)
{
if (JSVAL_IS_STRING(value))
return js_AtomizeString(cx, JSVAL_TO_STRING(value), flags);
if (JSVAL_IS_INT(value))
return js_AtomizeInt(cx, JSVAL_TO_INT(value), flags);
if (JSVAL_IS_DOUBLE(value))
return js_AtomizeDouble(cx, *JSVAL_TO_DOUBLE(value), flags);
if (JSVAL_IS_OBJECT(value))
return js_AtomizeObject(cx, JSVAL_TO_OBJECT(value), flags);
if (JSVAL_IS_BOOLEAN(value))
return js_AtomizeBoolean(cx, JSVAL_TO_BOOLEAN(value), flags);
return js_AtomizeHashedKey(cx, value, (JSHashNumber)value, flags);
}
JSAtom *
js_ValueToStringAtom(JSContext *cx, jsval v)
{
JSString *str;
str = js_ValueToString(cx, v);
if (!str)
return NULL;
return js_AtomizeString(cx, str, 0);
}
JSAtomListElement *
js_IndexAtom(JSContext *cx, JSAtom *atom, JSAtomList *al)
{
JSAtomListElement *ale;
ATOM_LIST_SEARCH(ale, al, atom);
if (!ale) {
JS_ARENA_ALLOCATE(ale, &cx->tempPool, sizeof(JSAtomListElement));
if (!ale) {
JS_ReportOutOfMemory(cx);
return NULL;
}
ale->atom = atom;
ale->index = (jsatomid) al->count++;
ale->next = al->list;
al->list = ale;
}
return ale;
}
JS_FRIEND_API(JSAtom *)
js_GetAtom(JSContext *cx, JSAtomMap *map, jsatomid i)
{
JSAtom *atom;
JS_ASSERT(map->vector && i < map->length);
if (!map->vector || i >= map->length) {
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%lu", (unsigned long)i);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_BAD_ATOMIC_NUMBER, numBuf);
return NULL;
}
atom = map->vector[i];
JS_ASSERT(atom);
return atom;
}
JS_FRIEND_API(JSBool)
js_InitAtomMap(JSContext *cx, JSAtomMap *map, JSAtomList *al)
{
JSAtom **vector;
JSAtomListElement *ale, *next;
uint32 count;
ale = al->list;
if (!ale) {
map->vector = NULL;
map->length = 0;
return JS_TRUE;
}
count = al->count;
if (count >= ATOM_INDEX_LIMIT) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_TOO_MANY_LITERALS);
return JS_FALSE;
}
vector = JS_malloc(cx, (size_t) count * sizeof *vector);
if (!vector)
return JS_FALSE;
do {
vector[ale->index] = ale->atom;
next = ale->next;
ale->next = NULL;
} while ((ale = next) != NULL);
al->list = NULL;
al->count = 0;
map->vector = vector;
map->length = (jsatomid)count;
return JS_TRUE;
}
JS_FRIEND_API(void)
js_FreeAtomMap(JSContext *cx, JSAtomMap *map)
{
if (map->vector) {
free(map->vector);
map->vector = NULL;
}
map->length = 0;
}

278
mozilla/js/src/jsatom.h Normal file
View File

@@ -0,0 +1,278 @@
/* -*- 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 jsatom_h___
#define jsatom_h___
/*
* JS atom table.
*/
#include <stddef.h>
#include "jstypes.h"
#ifndef NSPR20
#include "jshash.h"
#else
/* Removed by JSIFY: #include "JShash.h"
*/
#include "jshash.h" /* Added by JSIFY */
#endif
#include "jsapi.h"
#include "jsprvtd.h"
#include "jspubtd.h"
#ifdef JS_THREADSAFE
#include "jslock.h"
#endif
JS_BEGIN_EXTERN_C
#define ATOM_NOCOPY 0x01 /* don't copy atom string bytes */
#define ATOM_TMPSTR 0x02 /* internal, to avoid extra string */
#define ATOM_MARK 0x04 /* atom is reachable via GC */
#define ATOM_PINNED 0x08 /* atom is pinned against GC */
struct JSAtom {
JSHashEntry entry; /* key is jsval, value keyword info */
uint8 flags; /* flags, PINNED and/or MARK for now */
int8 kwindex; /* keyword index, -1 if not keyword */
jsatomid number; /* atom serial number and hash code */
};
#define ATOM_KEY(atom) ((jsval)(atom)->entry.key)
#define ATOM_IS_OBJECT(atom) JSVAL_IS_OBJECT(ATOM_KEY(atom))
#define ATOM_TO_OBJECT(atom) JSVAL_TO_OBJECT(ATOM_KEY(atom))
#define ATOM_IS_INT(atom) JSVAL_IS_INT(ATOM_KEY(atom))
#define ATOM_TO_INT(atom) JSVAL_TO_INT(ATOM_KEY(atom))
#define ATOM_IS_DOUBLE(atom) JSVAL_IS_DOUBLE(ATOM_KEY(atom))
#define ATOM_TO_DOUBLE(atom) JSVAL_TO_DOUBLE(ATOM_KEY(atom))
#define ATOM_IS_STRING(atom) JSVAL_IS_STRING(ATOM_KEY(atom))
#define ATOM_TO_STRING(atom) JSVAL_TO_STRING(ATOM_KEY(atom))
#define ATOM_IS_BOOLEAN(atom) JSVAL_IS_BOOLEAN(ATOM_KEY(atom))
#define ATOM_TO_BOOLEAN(atom) JSVAL_TO_BOOLEAN(ATOM_KEY(atom))
#define ATOM_BYTES(atom) JS_GetStringBytes(ATOM_TO_STRING(atom))
struct JSAtomListElement {
JSAtomListElement *next;
jsatomid index; /* index in script-specific atom map */
JSAtom *atom;
};
struct JSAtomList {
JSAtomListElement *list; /* literals indexed for mapping */
jsuint count; /* count of indexed literals */
};
#define ATOM_LIST_INIT(al) ((al)->list = NULL, (al)->count = 0)
#define ATOM_LIST_SEARCH(_ale,_al,_atom) \
JS_BEGIN_MACRO \
JSAtomListElement **_alep = &(_al)->list; \
while ((_ale = *_alep) != NULL) { \
if (_ale->atom == (_atom)) { \
/* Hit, move atom's element to the front of the list. */ \
*_alep = _ale->next; \
_ale->next = (_al)->list; \
(_al)->list = _ale; \
break; \
} \
_alep = &_ale->next; \
} \
JS_END_MACRO
struct JSAtomMap {
JSAtom **vector; /* array of ptrs to indexed atoms */
jsatomid length; /* count of (to-be-)indexed atoms */
};
struct JSAtomState {
JSRuntime *runtime; /* runtime that owns us */
JSHashTable *table; /* hash table containing all atoms */
jsatomid number; /* one beyond greatest atom number */
/* Type names and value literals. */
JSAtom *typeAtoms[JSTYPE_LIMIT];
JSAtom *booleanAtoms[2];
JSAtom *nullAtom;
/* Various built-in or commonly-used atoms. */
JSAtom *ArrayAtom;
JSAtom *MathAtom;
JSAtom *ObjectAtom;
JSAtom *anonymousAtom;
JSAtom *argumentsAtom;
JSAtom *arityAtom;
JSAtom *assignAtom;
JSAtom *calleeAtom;
JSAtom *callerAtom;
JSAtom *classPrototypeAtom;
JSAtom *constructorAtom;
JSAtom *countAtom;
JSAtom *indexAtom;
JSAtom *inputAtom;
JSAtom *lengthAtom;
JSAtom *nameAtom;
JSAtom *parentAtom;
JSAtom *protoAtom;
JSAtom *toSourceAtom;
JSAtom *toStringAtom;
JSAtom *valueOfAtom;
#ifdef JS_THREADSAFE
JSThinLock lock;
volatile uint32 tablegen;
#endif
};
/* Well-known predefined strings and their atoms. */
extern char *js_type_str[];
extern char *js_boolean_str[];
extern char js_Array_str[];
extern char js_Math_str[];
extern char js_Object_str[];
extern char js_anonymous_str[];
extern char js_arguments_str[];
extern char js_arity_str[];
extern char js_assign_str[];
extern char js_callee_str[];
extern char js_caller_str[];
extern char js_class_prototype_str[];
extern char js_constructor_str[];
extern char js_count_str[];
extern char js_eval_str[];
extern char js_index_str[];
extern char js_input_str[];
extern char js_length_str[];
extern char js_name_str[];
extern char js_parent_str[];
extern char js_proto_str[];
extern char js_toSource_str[];
extern char js_toString_str[];
extern char js_valueOf_str[];
/*
* Initialize atom state. Return true on success, false with an out of
* memory error report on failure.
*/
extern JSBool
js_InitAtomState(JSContext *cx, JSAtomState *state);
/*
* Free and clear atom state.
*/
extern void
js_FreeAtomState(JSContext *cx, JSAtomState *state);
/*
* Atom garbage collection hooks.
*/
typedef void
(*JSGCThingMarker)(JSRuntime *rt, void *thing);
extern void
js_MarkAtomState(JSAtomState *state, JSGCThingMarker mark);
extern void
js_SweepAtomState(JSAtomState *state);
extern void
js_UnpinPinnedAtoms(JSAtomState *state);
/*
* Find or create the atom for an object. If we create a new atom, give it the
* type indicated in flags. Return 0 on failure to allocate memory.
*/
extern JSAtom *
js_AtomizeObject(JSContext *cx, JSObject *obj, uintN flags);
/*
* Find or create the atom for a Boolean value. If we create a new atom, give
* it the type indicated in flags. Return 0 on failure to allocate memory.
*/
extern JSAtom *
js_AtomizeBoolean(JSContext *cx, JSBool b, uintN flags);
/*
* Find or create the atom for an integer value. If we create a new atom, give
* it the type indicated in flags. Return 0 on failure to allocate memory.
*/
extern JSAtom *
js_AtomizeInt(JSContext *cx, jsint i, uintN flags);
/*
* Find or create the atom for a double value. If we create a new atom, give
* it the type indicated in flags. Return 0 on failure to allocate memory.
*/
extern JSAtom *
js_AtomizeDouble(JSContext *cx, jsdouble d, uintN flags);
/*
* Find or create the atom for a string. If we create a new atom, give it the
* type indicated in flags. Return 0 on failure to allocate memory.
*/
extern JSAtom *
js_AtomizeString(JSContext *cx, JSString *str, uintN flags);
extern JS_FRIEND_API(JSAtom *)
js_Atomize(JSContext *cx, const char *bytes, size_t length, uintN flags);
extern JS_FRIEND_API(JSAtom *)
js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, uintN flags);
/*
* This variant handles all value tag types.
*/
extern JSAtom *
js_AtomizeValue(JSContext *cx, jsval value, uintN flags);
/*
* Convert v to an atomized string.
*/
extern JSAtom *
js_ValueToStringAtom(JSContext *cx, jsval v);
/*
* Assign atom an index and insert it on al.
*/
extern JSAtomListElement *
js_IndexAtom(JSContext *cx, JSAtom *atom, JSAtomList *al);
/*
* Get the atom with index i from map.
*/
extern JS_FRIEND_API(JSAtom *)
js_GetAtom(JSContext *cx, JSAtomMap *map, jsatomid i);
/*
* For all unmapped atoms recorded in al, add a mapping from the atom's index
* to its address. The GC must not run until all indexed atoms in atomLists
* have been mapped by scripts connected to live objects (Function and Script
* class objects have scripts as/in their private data -- the GC knows about
* these two classes).
*/
extern JS_FRIEND_API(JSBool)
js_InitAtomMap(JSContext *cx, JSAtomMap *map, JSAtomList *al);
/*
* Free map->vector and clear map.
*/
extern JS_FRIEND_API(void)
js_FreeAtomMap(JSContext *cx, JSAtomMap *map);
JS_END_EXTERN_C
#endif /* jsatom_h___ */

92
mozilla/js/src/jsbit.h Normal file
View File

@@ -0,0 +1,92 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 jsbit_h___
#define jsbit_h___
#include "jstypes.h"
JS_BEGIN_EXTERN_C
/*
** A jsbitmap_t is a long integer that can be used for bitmaps
*/
typedef unsigned long jsbitmap_t;
#define JS_TEST_BIT(_map,_bit) \
((_map)[(_bit)>>JS_BITS_PER_LONG_LOG2] & (1L << ((_bit) & (JS_BITS_PER_LONG-1))))
#define JS_SET_BIT(_map,_bit) \
((_map)[(_bit)>>JS_BITS_PER_LONG_LOG2] |= (1L << ((_bit) & (JS_BITS_PER_LONG-1))))
#define JS_CLEAR_BIT(_map,_bit) \
((_map)[(_bit)>>JS_BITS_PER_LONG_LOG2] &= ~(1L << ((_bit) & (JS_BITS_PER_LONG-1))))
/*
** Compute the log of the least power of 2 greater than or equal to n
*/
EXTERN(JSIntn) JS_CeilingLog2(JSUint32 i);
/*
** Compute the log of the greatest power of 2 less than or equal to n
*/
EXTERN(JSIntn) JS_FloorLog2(JSUint32 i);
/*
** Macro version of JS_CeilingLog2: Compute the log of the least power of
** 2 greater than or equal to _n. The result is returned in _log2.
*/
#define JS_CEILING_LOG2(_log2,_n) \
JS_BEGIN_MACRO \
JSUint32 j_ = (JSUint32)(_n); \
(_log2) = 0; \
if ((j_) & ((j_)-1)) \
(_log2) += 1; \
if ((j_) >> 16) \
(_log2) += 16, (j_) >>= 16; \
if ((j_) >> 8) \
(_log2) += 8, (j_) >>= 8; \
if ((j_) >> 4) \
(_log2) += 4, (j_) >>= 4; \
if ((j_) >> 2) \
(_log2) += 2, (j_) >>= 2; \
if ((j_) >> 1) \
(_log2) += 1; \
JS_END_MACRO
/*
** Macro version of JS_FloorLog2: Compute the log of the greatest power of
** 2 less than or equal to _n. The result is returned in _log2.
**
** This is equivalent to finding the highest set bit in the word.
*/
#define JS_FLOOR_LOG2(_log2,_n) \
JS_BEGIN_MACRO \
JSUint32 j_ = (JSUint32)(_n); \
(_log2) = 0; \
if ((j_) >> 16) \
(_log2) += 16, (j_) >>= 16; \
if ((j_) >> 8) \
(_log2) += 8, (j_) >>= 8; \
if ((j_) >> 4) \
(_log2) += 4, (j_) >>= 4; \
if ((j_) >> 2) \
(_log2) += 2, (j_) >>= 2; \
if ((j_) >> 1) \
(_log2) += 1; \
JS_END_MACRO
JS_END_EXTERN_C
#endif /* jsbit_h___ */

211
mozilla/js/src/jsbool.c Normal file
View File

@@ -0,0 +1,211 @@
/* -*- 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.
*/
/*
* JS boolean implementation.
*/
#include "jsstddef.h"
#include "jstypes.h"
/* Removed by JSIFY: #include "prlog.h" */
#include "jsutil.h" /* Added by JSIFY */
#include "jsapi.h"
#include "jsatom.h"
#include "jsbool.h"
#include "jscntxt.h"
#include "jsconfig.h"
#include "jsinterp.h"
#include "jslock.h"
#include "jsnum.h"
#include "jsobj.h"
#include "jsstr.h"
static JSClass boolean_class = {
"Boolean",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
};
#if JS_HAS_TOSOURCE
#include "jsprf.h"
static JSBool
bool_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
{
jsval v;
char buf[32];
JSString *str;
if (!JS_InstanceOf(cx, obj, &boolean_class, argv))
return JS_FALSE;
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
if (!JSVAL_IS_BOOLEAN(v))
return js_obj_toSource(cx, obj, argc, argv, rval);
JS_snprintf(buf, sizeof buf, "(new %s(%s))",
boolean_class.name,
js_boolean_str[JSVAL_TO_BOOLEAN(v) ? 1 : 0]);
str = JS_NewStringCopyZ(cx, buf);
if (!str)
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
}
#endif
static JSBool
bool_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
{
jsval v;
JSAtom *atom;
JSString *str;
if (!JS_InstanceOf(cx, obj, &boolean_class, argv))
return JS_FALSE;
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
if (!JSVAL_IS_BOOLEAN(v))
return js_obj_toString(cx, obj, argc, argv, rval);
atom = cx->runtime->atomState.booleanAtoms[JSVAL_TO_BOOLEAN(v) ? 1 : 0];
str = ATOM_TO_STRING(atom);
if (!str)
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
}
static JSBool
bool_valueOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
if (!JS_InstanceOf(cx, obj, &boolean_class, argv))
return JS_FALSE;
*rval = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
return JS_TRUE;
}
static JSFunctionSpec boolean_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, bool_toSource, 0},
#endif
{js_toString_str, bool_toString, 0},
{js_valueOf_str, bool_valueOf, 0},
{0}
};
#ifdef XP_MAC
#undef Boolean
#define Boolean js_Boolean
#endif
static JSBool
Boolean(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSBool b;
jsval bval;
if (argc != 0) {
if (!js_ValueToBoolean(cx, argv[0], &b))
return JS_FALSE;
bval = BOOLEAN_TO_JSVAL(b);
} else {
bval = JSVAL_FALSE;
}
if (!cx->fp->constructing) {
*rval = bval;
return JS_TRUE;
}
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, bval);
return JS_TRUE;
}
JSObject *
js_InitBooleanClass(JSContext *cx, JSObject *obj)
{
JSObject *proto;
proto = JS_InitClass(cx, obj, NULL, &boolean_class, Boolean, 1,
NULL, boolean_methods, NULL, NULL);
if (!proto)
return NULL;
OBJ_SET_SLOT(cx, proto, JSSLOT_PRIVATE, JSVAL_FALSE);
return proto;
}
JSObject *
js_BooleanToObject(JSContext *cx, JSBool b)
{
JSObject *obj;
obj = js_NewObject(cx, &boolean_class, NULL, NULL);
if (!obj)
return NULL;
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, BOOLEAN_TO_JSVAL(b));
return obj;
}
JSString *
js_BooleanToString(JSContext *cx, JSBool b)
{
return ATOM_TO_STRING(cx->runtime->atomState.booleanAtoms[b ? 1 : 0]);
}
JSBool
js_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp)
{
JSBool b;
jsdouble d;
#if defined XP_PC && defined _MSC_VER &&_MSC_VER <= 800
/* MSVC1.5 coredumps */
if (!bp)
return JS_TRUE;
#endif
/* XXX this should be an if-else chain, but MSVC1.5 crashes if it is. */
if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v)) {
/* Must return early to avoid falling thru to JSVAL_IS_OBJECT case. */
*bp = JS_FALSE;
return JS_TRUE;
}
if (JSVAL_IS_OBJECT(v)) {
if (!JSVERSION_IS_ECMA(cx->version)) {
if (!OBJ_DEFAULT_VALUE(cx, JSVAL_TO_OBJECT(v), JSTYPE_BOOLEAN, &v))
return JS_FALSE;
if (!JSVAL_IS_BOOLEAN(v))
v = JSVAL_TRUE; /* non-null object is true */
b = JSVAL_TO_BOOLEAN(v);
} else {
b = JS_TRUE;
}
}
if (JSVAL_IS_STRING(v)) {
b = JSVAL_TO_STRING(v)->length ? JS_TRUE : JS_FALSE;
}
if (JSVAL_IS_INT(v)) {
b = JSVAL_TO_INT(v) ? JS_TRUE : JS_FALSE;
}
if (JSVAL_IS_DOUBLE(v)) {
d = *JSVAL_TO_DOUBLE(v);
b = (!JSDOUBLE_IS_NaN(d) && d != 0) ? JS_TRUE : JS_FALSE;
}
if (JSVAL_IS_BOOLEAN(v)) {
b = JSVAL_TO_BOOLEAN(v);
}
*bp = b;
return JS_TRUE;
}

41
mozilla/js/src/jsbool.h Normal file
View File

@@ -0,0 +1,41 @@
/* -*- 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 jsbool_h___
#define jsbool_h___
/*
* JS boolean interface.
*/
JS_BEGIN_EXTERN_C
extern JSObject *
js_InitBooleanClass(JSContext *cx, JSObject *obj);
extern JSObject *
js_BooleanToObject(JSContext *cx, JSBool b);
extern JSString *
js_BooleanToString(JSContext *cx, JSBool b);
extern JSBool
js_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp);
JS_END_EXTERN_C
#endif /* jsbool_h___ */

121
mozilla/js/src/jsclist.h Normal file
View File

@@ -0,0 +1,121 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 jsclist_h___
#define jsclist_h___
#include "jstypes.h"
typedef struct JSCListStr JSCList;
/*
** Circular linked list
*/
struct JSCListStr {
JSCList *next;
JSCList *prev;
};
/*
** Insert element "_e" into the list, before "_l".
*/
#define JS_INSERT_BEFORE(_e,_l) \
JS_BEGIN_MACRO \
(_e)->next = (_l); \
(_e)->prev = (_l)->prev; \
(_l)->prev->next = (_e); \
(_l)->prev = (_e); \
JS_END_MACRO
/*
** Insert element "_e" into the list, after "_l".
*/
#define JS_INSERT_AFTER(_e,_l) \
JS_BEGIN_MACRO \
(_e)->next = (_l)->next; \
(_e)->prev = (_l); \
(_l)->next->prev = (_e); \
(_l)->next = (_e); \
JS_END_MACRO
/*
** Return the element following element "_e"
*/
#define JS_NEXT_LINK(_e) \
((_e)->next)
/*
** Return the element preceding element "_e"
*/
#define JS_PREV_LINK(_e) \
((_e)->prev)
/*
** Append an element "_e" to the end of the list "_l"
*/
#define JS_APPEND_LINK(_e,_l) JS_INSERT_BEFORE(_e,_l)
/*
** Insert an element "_e" at the head of the list "_l"
*/
#define JS_INSERT_LINK(_e,_l) JS_INSERT_AFTER(_e,_l)
/* Return the head/tail of the list */
#define JS_LIST_HEAD(_l) (_l)->next
#define JS_LIST_TAIL(_l) (_l)->prev
/*
** Remove the element "_e" from it's circular list.
*/
#define JS_REMOVE_LINK(_e) \
JS_BEGIN_MACRO \
(_e)->prev->next = (_e)->next; \
(_e)->next->prev = (_e)->prev; \
JS_END_MACRO
/*
** Remove the element "_e" from it's circular list. Also initializes the
** linkage.
*/
#define JS_REMOVE_AND_INIT_LINK(_e) \
JS_BEGIN_MACRO \
(_e)->prev->next = (_e)->next; \
(_e)->next->prev = (_e)->prev; \
(_e)->next = (_e); \
(_e)->prev = (_e); \
JS_END_MACRO
/*
** Return non-zero if the given circular list "_l" is empty, zero if the
** circular list is not empty
*/
#define JS_CLIST_IS_EMPTY(_l) \
((_l)->next == (_l))
/*
** Initialize a circular list
*/
#define JS_INIT_CLIST(_l) \
JS_BEGIN_MACRO \
(_l)->next = (_l); \
(_l)->prev = (_l); \
JS_END_MACRO
#define JS_INIT_STATIC_CLIST(_l) \
{(_l), (_l)}
#endif /* jsclist_h___ */

400
mozilla/js/src/jscntxt.c Normal file
View File

@@ -0,0 +1,400 @@
/* -*- 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.
*/
/*
* JS execution context.
*/
#include "jsstddef.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "jstypes.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 */
#include "jsclist.h"
#include "jsprf.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsconfig.h"
#include "jsdbgapi.h"
#include "jsexn.h"
#include "jsgc.h"
#include "jslock.h"
#include "jsobj.h"
#include "jsopcode.h"
#include "jsscan.h"
#include "jsscript.h"
JSContext *
js_NewContext(JSRuntime *rt, size_t stacksize)
{
JSContext *cx;
cx = malloc(sizeof *cx);
if (!cx)
return NULL;
memset(cx, 0, sizeof *cx);
cx->runtime = rt;
#ifdef JS_THREADSAFE
js_InitContextForLocking(cx);
#endif
if (rt->contextList.next == (JSCList *)&rt->contextList) {
/* First context on this runtime: initialize atoms and keywords. */
if (!js_InitAtomState(cx, &rt->atomState) ||
!js_InitScanner(cx)) {
free(cx);
return NULL;
}
}
/* Atomicly append cx to rt's context list. */
JS_LOCK_RUNTIME_VOID(rt, JS_APPEND_LINK(&cx->links, &rt->contextList));
cx->version = JSVERSION_DEFAULT;
cx->jsop_eq = JSOP_EQ;
cx->jsop_ne = JSOP_NE;
JS_InitArenaPool(&cx->stackPool, "stack", stacksize, sizeof(jsval));
JS_InitArenaPool(&cx->codePool, "code", 1024, sizeof(jsbytecode));
JS_InitArenaPool(&cx->tempPool, "temp", 1024, sizeof(jsdouble));
#if JS_HAS_REGEXPS
if (!js_InitRegExpStatics(cx, &cx->regExpStatics)) {
js_DestroyContext(cx);
return NULL;
}
#endif
return cx;
}
void
js_DestroyContext(JSContext *cx)
{
JSRuntime *rt;
JSBool rtempty;
rt = cx->runtime;
/* Remove cx from context list first. */
JS_LOCK_RUNTIME(rt);
JS_REMOVE_LINK(&cx->links);
rtempty = (rt->contextList.next == (JSCList *)&rt->contextList);
JS_UNLOCK_RUNTIME(rt);
if (rtempty) {
/* Unpin all pinned atoms before final GC. */
js_UnpinPinnedAtoms(&rt->atomState);
/* Unlock GC things held by runtime pointers. */
js_UnlockGCThing(cx, rt->jsNaN);
js_UnlockGCThing(cx, rt->jsNegativeInfinity);
js_UnlockGCThing(cx, rt->jsPositiveInfinity);
js_UnlockGCThing(cx, rt->emptyString);
/*
* Clear these so they get recreated if the standard classes are
* initialized again.
*/
rt->jsNaN = NULL;
rt->jsNegativeInfinity = NULL;
rt->jsPositiveInfinity = NULL;
rt->emptyString = NULL;
/* Clear debugging state to remove GC roots. */
JS_ClearAllTraps(cx);
JS_ClearAllWatchPoints(cx);
}
/* Remove more GC roots in regExpStatics, then collect garbage. */
#if JS_HAS_REGEXPS
js_FreeRegExpStatics(cx, &cx->regExpStatics);
#endif
js_ForceGC(cx);
if (rtempty) {
/* Free atom state now that we've run the GC. */
js_FreeAtomState(cx, &rt->atomState);
}
/* Free the stuff hanging off of cx. */
JS_FinishArenaPool(&cx->stackPool);
JS_FinishArenaPool(&cx->codePool);
JS_FinishArenaPool(&cx->tempPool);
if (cx->lastMessage)
free(cx->lastMessage);
free(cx);
}
JSContext *
js_ContextIterator(JSRuntime *rt, JSContext **iterp)
{
JSContext *cx = *iterp;
JS_LOCK_RUNTIME(rt);
if (!cx)
cx = (JSContext *)rt->contextList.next;
if ((void *)cx == &rt->contextList)
cx = NULL;
else
*iterp = (JSContext *)cx->links.next;
JS_UNLOCK_RUNTIME(rt);
return cx;
}
void
js_ReportErrorVA(JSContext *cx, uintN flags, const char *format, va_list ap)
{
JSStackFrame *fp;
JSErrorReport report, *reportp;
char *last;
fp = cx->fp;
if (fp && fp->script && fp->pc) {
report.filename = fp->script->filename;
report.lineno = js_PCToLineNumber(fp->script, fp->pc);
/* XXX should fetch line somehow */
report.linebuf = NULL;
report.tokenptr = NULL;
report.flags = flags;
reportp = &report;
} else {
/* XXXshaver still fill out report here for flags? */
reportp = NULL;
}
last = JS_vsmprintf(format, ap);
if (!last)
return;
js_ReportErrorAgain(cx, last, reportp);
free(last);
}
/*
* The arguments from ap need to be packaged up into an array and stored
* into the report struct.
*
* The format string addressed by the error number may contain operands
* identified by the format {N}, where N is a decimal digit. Each of these
* is to be replaced by the Nth argument from the va_list. The complete
* message is placed into reportp->ucmessage converted to a JSString.
*
* returns true/false if the expansion succeeds (can fail for memory errors)
*/
JSBool
js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
void *userRef, const uintN errorNumber,
char **messagep, JSErrorReport *reportp, va_list ap)
{
const JSErrorFormatString *fmtData;
int i;
int argCount;
*messagep = NULL;
if (callback) {
fmtData = (*callback)(userRef, "Mountain View", errorNumber);
if (fmtData != NULL) {
argCount = fmtData->argCount;
if (argCount > 0) {
/*
* Gather the arguments into a char * array, the
* messageArgs field is supposed to be an array of
* JSString's and we'll convert them later.
*/
reportp->messageArgs = malloc(sizeof(char *) * argCount);
if (!reportp->messageArgs)
return JS_FALSE;
for (i = 0; i < argCount; i++)
reportp->messageArgs[i] = (JSString *) va_arg(ap, char *);
}
/*
* Parse the error format, substituting the argument X
* for {X} in the format.
*/
if (argCount > 0) {
if (fmtData->format) {
const char *fmt, *arg;
char *out;
int expandedArgs = 0;
int expandedLength
= strlen(fmtData->format)
- (3 * argCount); /* exclude the {n} */
for (i = 0; i < argCount; i++) {
expandedLength
+= strlen((char *)reportp->messageArgs[i]);
}
*messagep = out = malloc(expandedLength + 1);
if (!out) {
if (reportp->messageArgs) {
free(reportp->messageArgs);
reportp->messageArgs = NULL;
}
return JS_FALSE;
}
fmt = fmtData->format;
while (*fmt) {
if (*fmt == '{') { /* balance} */
if (isdigit(fmt[1])) {
int d = JS7_UNDEC(fmt[1]);
JS_ASSERT(expandedArgs < argCount);
arg = (char *)reportp->messageArgs[d];
strcpy(out, arg);
out += strlen(arg);
fmt += 3;
expandedArgs++;
continue;
}
}
*out++ = *fmt++;
}
JS_ASSERT(expandedArgs == argCount);
*out = '\0';
}
/*
* Now convert all the arguments to JSStrings.
*/
for (i = 0; i < argCount; i++) {
reportp->messageArgs[i] =
JS_NewStringCopyZ(cx, (char *)reportp->messageArgs[i]);
}
} else {
*messagep = JS_strdup(cx, fmtData->format);
}
/*
* And finally convert the message.
*/
reportp->ucmessage = JS_NewStringCopyZ(cx, *messagep);
}
}
if (*messagep == NULL) {
/* where's the right place for this ??? */
const char *defaultErrorMessage
= "No error message available for error number %d";
size_t nbytes = strlen(defaultErrorMessage) + 16;
*messagep = (char *)malloc(nbytes);
JS_snprintf(*messagep, nbytes, defaultErrorMessage, errorNumber);
}
return JS_TRUE;
}
void
js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
void *userRef, const uintN errorNumber, va_list ap)
{
JSStackFrame *fp;
JSErrorReport report;
char *message;
report.messageArgs = NULL;
report.ucmessage = NULL;
message = NULL;
fp = cx->fp;
if (fp && fp->script && fp->pc) {
report.filename = fp->script->filename;
report.lineno = js_PCToLineNumber(fp->script, fp->pc);
} else {
report.filename = NULL;
report.lineno = 0;
}
/* XXX should fetch line somehow */
report.linebuf = NULL;
report.tokenptr = NULL;
report.flags = flags;
report.errorNumber = errorNumber;
if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber,
&message, &report, ap))
return;
#if JS_HAS_ERROR_EXCEPTIONS
/*
* Check the error report, and set a JavaScript-catchable exception
* if the error is defined to have an associated exception. If an
* exception is thrown, then the JSREPORT_EXCEPTION flag will be set
* on the error report, and exception-aware hosts should ignore it.
*/
js_ErrorToException(cx, &report, message);
#endif
js_ReportErrorAgain(cx, message, &report);
if (message)
free(message);
if (report.messageArgs)
free(report.messageArgs);
}
JS_FRIEND_API(void)
js_ReportErrorAgain(JSContext *cx, const char *message, JSErrorReport *reportp)
{
JSErrorReporter onError;
if (!message)
return;
if (cx->lastMessage)
free(cx->lastMessage);
cx->lastMessage = JS_strdup(cx, message);
if (!cx->lastMessage)
return;
onError = cx->errorReporter;
if (onError)
(*onError)(cx, cx->lastMessage, reportp);
}
void
js_ReportIsNotDefined(JSContext *cx, const char *name)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_DEFINED, name);
}
#if defined DEBUG && defined XP_UNIX
/* For gdb usage. */
void js_traceon(JSContext *cx) { cx->tracefp = stderr; }
void js_traceoff(JSContext *cx) { cx->tracefp = NULL; }
#endif
JSErrorFormatString js_ErrorFormatString[JSErr_Limit] = {
#if JS_HAS_DFLT_MSG_STRINGS
#define MSG_DEF(name, number, count, exception, format) \
{ format, count } ,
#else
#define MSG_DEF(name, number, count, exception, format) \
{ NULL, count } ,
#endif
#include "js.msg"
#undef MSG_DEF
};
const JSErrorFormatString *
js_GetErrorMessage(void *userRef, const char *locale, const uintN errorNumber)
{
if ((errorNumber > 0) && (errorNumber < JSErr_Limit))
return &js_ErrorFormatString[errorNumber];
else
return NULL;
}

230
mozilla/js/src/jscntxt.h Normal file
View File

@@ -0,0 +1,230 @@
/* -*- 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 jscntxt_h___
#define jscntxt_h___
/*
* JS execution context.
*/
#ifndef NSPR20
#include "jsarena.h"
#else
/* Removed by JSIFY: #include "plarena.h"
*/
#include "jsarena.h" /* Added by JSIFY */
#endif
#include "jsclist.h"
#include "jslong.h"
#include "jsatom.h"
#include "jsgc.h"
#include "jsinterp.h"
#include "jsobj.h"
#include "jsprvtd.h"
#include "jspubtd.h"
#include "jsregexp.h"
JS_BEGIN_EXTERN_C
struct JSRuntime {
/* Garbage collector state, used by jsgc.c. */
JSArenaPool gcArenaPool;
JSArenaPool gcFlagsPool;
JSHashTable *gcRootsHash;
JSGCThing *gcFreeList;
uint32 gcBytes;
uint32 gcLastBytes;
uint32 gcMaxBytes;
uint32 gcLevel;
uint32 gcNumber;
JSBool gcPoke;
JSGCCallback gcCallback;
#ifdef JS_GCMETER
JSGCStats gcStats;
#endif
/* Literal table maintained by jsatom.c functions. */
JSAtomState atomState;
/* Random number generator state, used by jsmath.c. */
JSBool rngInitialized;
int64 rngMultiplier;
int64 rngAddend;
int64 rngMask;
int64 rngSeed;
jsdouble rngDscale;
/* Well-known numbers held for use by this runtime's contexts. */
jsdouble *jsNaN;
jsdouble *jsNegativeInfinity;
jsdouble *jsPositiveInfinity;
/* Empty string held for use by this runtime's contexts. */
JSString *emptyString;
/* List of active contexts sharing this runtime. */
JSCList contextList;
/* These are used for debugging -- see jsprvtd.h and jsdbgapi.h. */
JSTrapHandler interruptHandler;
void *interruptHandlerData;
JSNewScriptHook newScriptHook;
void *newScriptHookData;
JSDestroyScriptHook destroyScriptHook;
void *destroyScriptHookData;
JSTrapHandler debuggerHandler;
void *debuggerHandlerData;
JSSourceHandler sourceHandler;
void *sourceHandlerData;
JSInterpreterHook executeHook;
void *executeHookData;
JSInterpreterHook callHook;
void *callHookData;
/* More debugging state, see jsdbgapi.c. */
JSCList trapList;
JSCList watchPointList;
/* Weak links to properties, indexed by quickened get/set opcodes. */
/* XXX must come after JSCLists or MSVC alignment bug bites empty lists */
JSPropertyCache propertyCache;
#ifdef JS_THREADSAFE
/* These combine to interlock the GC and new requests. */
PRLock *gcLock;
PRCondVar *gcDone;
PRCondVar *requestDone;
uint32 requestCount;
/* Lock and owning thread pointer for JS_LOCK_RUNTIME. */
JSThinLock rtLock;
#endif
};
struct JSContext {
JSCList links;
/* Interpreter activation count. */
uintN interpLevel;
/* Runtime version control identifier and equality operators. */
JSVersion version;
jsbytecode jsop_eq;
jsbytecode jsop_ne;
/* Data shared by threads in an address space. */
JSRuntime *runtime;
/* Stack arena pool and frame pointer register. */
JSArenaPool stackPool;
JSStackFrame *fp;
/* Temporary arena pools used while compiling and decompiling. */
JSArenaPool codePool;
JSArenaPool tempPool;
/* Top-level object and pointer to top stack frame's scope chain. */
JSObject *globalObject;
/* Most recently created things by type, members of the GC's root set. */
JSGCThing *newborn[GCX_NTYPES];
/* Regular expression class statics (XXX not shared globally). */
JSRegExpStatics regExpStatics;
/* State for object and array toSource conversion. */
JSSharpObjectMap sharpObjectMap;
/* Last message string and trace file for debugging. */
char *lastMessage;
#ifdef DEBUG
void *tracefp;
#endif
/* Per-context optional user callbacks. */
JSBranchCallback branchCallback;
JSErrorReporter errorReporter;
/* Client opaque pointer */
void *data;
/* GC and thread-safe state. */
JSStackFrame *dormantFrameChain; /* dormant stack frame to scan */
uint32 gcDisabled; /* XXX for pre-ECMAv2 switch */
#ifdef JS_THREADSAFE
jsword thread;
jsrefcount requestDepth;
JSPackedBool gcActive;
#endif
/* Exception state (NB: throwing is packed with gcActive above). */
JSPackedBool throwing; /* is there a pending exception? */
jsval exception; /* most-recently-thrown exceptin */
};
extern JSContext *
js_NewContext(JSRuntime *rt, size_t stacksize);
extern void
js_DestroyContext(JSContext *cx);
extern JSContext *
js_ContextIterator(JSRuntime *rt, JSContext **iterp);
/*
* Report an exception, which is currently realized as a printf-style format
* string and its arguments.
*/
typedef enum JSErrNum {
#define MSG_DEF(name, number, count, exception, format) \
name = number,
#include "js.msg"
#undef MSG_DEF
JSErr_Limit
} JSErrNum;
extern const JSErrorFormatString *
js_GetErrorMessage(void *userRef, const char *locale, const uintN errorNumber);
#ifdef va_start
extern void
js_ReportErrorVA(JSContext *cx, uintN flags, const char *format, va_list ap);
extern void
js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
void *userRef, const uintN errorNumber, va_list ap);
extern JSBool
js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
void *userRef, const uintN errorNumber,
char **message, JSErrorReport *reportp,
va_list ap);
#endif
/*
* Report an exception using a previously composed JSErrorReport.
*/
extern JS_FRIEND_API(void)
js_ReportErrorAgain(JSContext *cx, const char *message, JSErrorReport *report);
extern void
js_ReportIsNotDefined(JSContext *cx, const char *name);
extern JSErrorFormatString js_ErrorFormatString[JSErr_Limit];
JS_END_EXTERN_C
#endif /* jscntxt_h___ */

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

@@ -0,0 +1,20 @@
/* -*- Mode: C; tab-width: 8 -*-
* Copyright © 1996 Netscape Communications Corporation, All Rights Reserved.
*/
#ifndef jscompat_h___
#define jscompat_h___
/*
* Compatibility glue for various NSPR versions. We must always define int8,
* int16, jsword, and so on to minimize differences with js/ref, no matter what
* the NSPR typedef names may be.
*/
#include "jstypes.h"
#include "jslong.h"
typedef JSIntn intN;
typedef JSUintn uintN;
typedef JSUword jsuword;
typedef JSWord jsword;
typedef float float32;
#define allocPriv allocPool
#endif /* jscompat_h___ */

267
mozilla/js/src/jsconfig.h Normal file
View File

@@ -0,0 +1,267 @@
/* -*- 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.
*/
/*
* JS configuration macros.
*/
#ifndef JS_VERSION
#define JS_VERSION 140
#endif
#if JS_VERSION == 100
#define JS_BUG_AUTO_INDEX_PROPS 1 /* new object o: o.p = v sets o[0] */
#define JS_BUG_NULL_INDEX_PROPS 1 /* o[0] defaults to null, not void */
#define JS_BUG_EMPTY_INDEX_ZERO 1 /* o[""] is equivalent to o[0] */
#define JS_BUG_SHORT_CIRCUIT 1 /* 1 && 1 => true, 1 && 0 => 0 bug */
#define JS_BUG_EAGER_TOSTRING 1 /* o.toString() trumps o.valueOf() */
#define JS_BUG_VOID_TOSTRING 0 /* void 0 + 0 == "undefined0" */
#define JS_BUG_EVAL_THIS_FUN 0 /* eval('this') in function f is f */
#define JS_BUG_EVAL_THIS_SCOPE 0 /* Math.eval('sin(x)') vs. local x */
#define JS_BUG_FALLIBLE_EQOPS 1 /* fallible/intransitive equality ops */
#define JS_BUG_FALLIBLE_TONUM 1 /* fallible ValueToNumber primitive */
#define JS_BUG_WITH_CLOSURE 0 /* with(o)function f(){} sets o.f */
#define JS_BUG_SET_ENUMERATE 1 /* o.p=q flags o.p JSPROP_ENUMERATE */
#define JS_HAS_PROP_DELETE 0 /* delete o.p removes p from o */
#define JS_HAS_CALL_OBJECT 0 /* fun.caller is stack frame obj */
#define JS_HAS_LABEL_STATEMENT 0 /* has break/continue to label: */
#define JS_HAS_DO_WHILE_LOOP 0 /* has do {...} while (b) */
#define JS_HAS_SWITCH_STATEMENT 0 /* has switch (v) {case c: ...} */
#define JS_HAS_SOME_PERL_FUN 0 /* has array.join/reverse/sort */
#define JS_HAS_MORE_PERL_FUN 0 /* has array.push, str.substr, etc */
#define JS_HAS_VALUEOF_HINT 0 /* valueOf(hint) where hint is typeof */
#define JS_HAS_LEXICAL_CLOSURE 0 /* nested functions, lexically closed */
#define JS_HAS_APPLY_FUNCTION 0 /* has fun.apply(obj, argArray) */
#define JS_HAS_CALL_FUNCTION 0 /* has fun.call(obj, arg1, ... argN) */
#define JS_HAS_OBJ_PROTO_PROP 0 /* has o.__proto__ etc. */
#define JS_HAS_REGEXPS 0 /* has perl r.e.s via RegExp, /pat/ */
#define JS_HAS_SEQUENCE_OPS 0 /* has array.slice, string.concat */
#define JS_HAS_INITIALIZERS 0 /* has var o = {'foo': 42, 'bar':3} */
#define JS_HAS_OBJ_WATCHPOINT 0 /* has o.watch and o.unwatch */
#define JS_HAS_EXPORT_IMPORT 0 /* has export fun; import obj.fun */
#define JS_HAS_EVAL_THIS_SCOPE 0 /* Math.eval is same as with (Math) */
#define JS_HAS_TRIPLE_EQOPS 0 /* has === and !== identity eqops */
#define JS_HAS_SHARP_VARS 0 /* has #n=, #n# for object literals */
#define JS_HAS_REPLACE_LAMBDA 0 /* has string.replace(re, lambda) */
#define JS_HAS_SCRIPT_OBJECT 0 /* has (new Script("x++")).exec() */
#define JS_HAS_XDR 0 /* has XDR API and object methods */
#define JS_HAS_EXCEPTIONS 0 /* has exception handling */
#define JS_HAS_UNDEFINED 0 /* has global "undefined" property */
#define JS_HAS_TOSOURCE 0 /* has Object/Array toSource method */
#define JS_HAS_IN_OPERATOR 0 /* has in operator ('p' in {p:1}) */
#define JS_HAS_INSTANCEOF 0 /* has {p:1} instanceof Object */
#define JS_HAS_ARGS_OBJECT 0 /* has minimal ECMA arguments object */
#define JS_HAS_DEBUGGER_KEYWORD 0 /* has hook for debugger keyword */
#define JS_HAS_ERROR_EXCEPTIONS 0 /* has error object hierarchy */
#elif JS_VERSION == 110
#define JS_BUG_AUTO_INDEX_PROPS 0 /* new object o: o.p = v sets o[0] */
#define JS_BUG_NULL_INDEX_PROPS 1 /* o[0] defaults to null, not void */
#define JS_BUG_EMPTY_INDEX_ZERO 1 /* o[""] is equivalent to o[0] */
#define JS_BUG_SHORT_CIRCUIT 1 /* 1 && 1 => true, 1 && 0 => 0 bug */
#define JS_BUG_EAGER_TOSTRING 1 /* o.toString() trumps o.valueOf() */
#define JS_BUG_VOID_TOSTRING 0 /* void 0 + 0 == "undefined0" */
#define JS_BUG_EVAL_THIS_FUN 1 /* eval('this') in function f is f */
#define JS_BUG_EVAL_THIS_SCOPE 1 /* Math.eval('sin(x)') vs. local x */
#define JS_BUG_FALLIBLE_EQOPS 1 /* fallible/intransitive equality ops */
#define JS_BUG_FALLIBLE_TONUM 1 /* fallible ValueToNumber primitive */
#define JS_BUG_WITH_CLOSURE 0 /* with(o)function f(){} sets o.f */
#define JS_BUG_SET_ENUMERATE 1 /* o.p=q flags o.p JSPROP_ENUMERATE */
#define JS_HAS_PROP_DELETE 0 /* delete o.p removes p from o */
#define JS_HAS_CALL_OBJECT 0 /* fun.caller is stack frame obj */
#define JS_HAS_LABEL_STATEMENT 0 /* has break/continue to label: */
#define JS_HAS_DO_WHILE_LOOP 0 /* has do {...} while (b) */
#define JS_HAS_SWITCH_STATEMENT 0 /* has switch (v) {case c: ...} */
#define JS_HAS_SOME_PERL_FUN 1 /* has array.join/reverse/sort */
#define JS_HAS_MORE_PERL_FUN 0 /* has array.push, str.substr, etc */
#define JS_HAS_VALUEOF_HINT 0 /* valueOf(hint) where hint is typeof */
#define JS_HAS_LEXICAL_CLOSURE 0 /* nested functions, lexically closed */
#define JS_HAS_APPLY_FUNCTION 0 /* has apply(fun, arg1, ... argN) */
#define JS_HAS_CALL_FUNCTION 0 /* has fun.call(obj, arg1, ... argN) */
#define JS_HAS_OBJ_PROTO_PROP 0 /* has o.__proto__ etc. */
#define JS_HAS_REGEXPS 0 /* has perl r.e.s via RegExp, /pat/ */
#define JS_HAS_SEQUENCE_OPS 0 /* has array.slice, string.concat */
#define JS_HAS_INITIALIZERS 0 /* has var o = {'foo': 42, 'bar':3} */
#define JS_HAS_OBJ_WATCHPOINT 0 /* has o.watch and o.unwatch */
#define JS_HAS_EXPORT_IMPORT 0 /* has export fun; import obj.fun */
#define JS_HAS_EVAL_THIS_SCOPE 0 /* Math.eval is same as with (Math) */
#define JS_HAS_TRIPLE_EQOPS 0 /* has === and !== identity eqops */
#define JS_HAS_SHARP_VARS 0 /* has #n=, #n# for object literals */
#define JS_HAS_REPLACE_LAMBDA 0 /* has string.replace(re, lambda) */
#define JS_HAS_SCRIPT_OBJECT 0 /* has (new Script("x++")).exec() */
#define JS_HAS_XDR 0 /* has XDR API and object methods */
#define JS_HAS_EXCEPTIONS 0 /* has exception handling */
#define JS_HAS_UNDEFINED 0 /* has global "undefined" property */
#define JS_HAS_TOSOURCE 0 /* has Object/Array toSource method */
#define JS_HAS_IN_OPERATOR 0 /* has in operator ('p' in {p:1}) */
#define JS_HAS_INSTANCEOF 0 /* has {p:1} instanceof Object */
#define JS_HAS_ARGS_OBJECT 0 /* has minimal ECMA arguments object */
#define JS_HAS_DEBUGGER_KEYWORD 0 /* has hook for debugger keyword */
#define JS_HAS_ERROR_EXCEPTIONS 0 /* has error object hierarchy */
#elif JS_VERSION == 120
#define JS_BUG_AUTO_INDEX_PROPS 0 /* new object o: o.p = v sets o[0] */
#define JS_BUG_NULL_INDEX_PROPS 0 /* o[0] defaults to null, not void */
#define JS_BUG_EMPTY_INDEX_ZERO 0 /* o[""] is equivalent to o[0] */
#define JS_BUG_SHORT_CIRCUIT 0 /* 1 && 1 => true, 1 && 0 => 0 bug */
#define JS_BUG_EAGER_TOSTRING 0 /* o.toString() trumps o.valueOf() */
#define JS_BUG_VOID_TOSTRING 1 /* void 0 + 0 == "undefined0" */
#define JS_BUG_EVAL_THIS_FUN 0 /* eval('this') in function f is f */
#define JS_BUG_EVAL_THIS_SCOPE 0 /* Math.eval('sin(x)') vs. local x */
#define JS_BUG_FALLIBLE_EQOPS 0 /* fallible/intransitive equality ops */
#define JS_BUG_FALLIBLE_TONUM 0 /* fallible ValueToNumber primitive */
#define JS_BUG_WITH_CLOSURE 1 /* with(o)function f(){} sets o.f */
#define JS_BUG_SET_ENUMERATE 1 /* o.p=q flags o.p JSPROP_ENUMERATE */
#define JS_HAS_PROP_DELETE 1 /* delete o.p removes p from o */
#define JS_HAS_CALL_OBJECT 1 /* fun.caller is stack frame obj */
#define JS_HAS_LABEL_STATEMENT 1 /* has break/continue to label: */
#define JS_HAS_DO_WHILE_LOOP 1 /* has do {...} while (b) */
#define JS_HAS_SWITCH_STATEMENT 1 /* has switch (v) {case c: ...} */
#define JS_HAS_SOME_PERL_FUN 1 /* has array.join/reverse/sort */
#define JS_HAS_MORE_PERL_FUN 1 /* has array.push, str.substr, etc */
#define JS_HAS_VALUEOF_HINT 1 /* valueOf(hint) where hint is typeof */
#define JS_HAS_LEXICAL_CLOSURE 1 /* nested functions, lexically closed */
#define JS_HAS_APPLY_FUNCTION 1 /* has apply(fun, arg1, ... argN) */
#define JS_HAS_CALL_FUNCTION 0 /* has fun.call(obj, arg1, ... argN) */
#define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
#define JS_HAS_REGEXPS 1 /* has perl r.e.s via RegExp, /pat/ */
#define JS_HAS_SEQUENCE_OPS 1 /* has array.slice, string.concat */
#define JS_HAS_INITIALIZERS 1 /* has var o = {'foo': 42, 'bar':3} */
#define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
#define JS_HAS_EXPORT_IMPORT 1 /* has export fun; import obj.fun */
#define JS_HAS_EVAL_THIS_SCOPE 1 /* Math.eval is same as with (Math) */
#define JS_HAS_TRIPLE_EQOPS 0 /* has === and !== identity eqops */
#define JS_HAS_SHARP_VARS 0 /* has #n=, #n# for object literals */
#define JS_HAS_REPLACE_LAMBDA 0 /* has string.replace(re, lambda) */
#define JS_HAS_SCRIPT_OBJECT 0 /* has (new Script("x++")).exec() */
#define JS_HAS_XDR 0 /* has XDR API and object methods */
#define JS_HAS_EXCEPTIONS 0 /* has exception handling */
#define JS_HAS_UNDEFINED 0 /* has global "undefined" property */
#define JS_HAS_TOSOURCE 0 /* has Object/Array toSource method */
#define JS_HAS_IN_OPERATOR 0 /* has in operator ('p' in {p:1}) */
#define JS_HAS_INSTANCEOF 0 /* has {p:1} instanceof Object */
#define JS_HAS_ARGS_OBJECT 0 /* has minimal ECMA arguments object */
#define JS_HAS_DEBUGGER_KEYWORD 0 /* has hook for debugger keyword */
#define JS_HAS_ERROR_EXCEPTIONS 0 /* has error object hierarchy */
#elif JS_VERSION == 130
#define JS_BUG_AUTO_INDEX_PROPS 0 /* new object o: o.p = v sets o[0] */
#define JS_BUG_NULL_INDEX_PROPS 0 /* o[0] defaults to null, not void */
#define JS_BUG_EMPTY_INDEX_ZERO 0 /* o[""] is equivalent to o[0] */
#define JS_BUG_SHORT_CIRCUIT 0 /* 1 && 1 => true, 1 && 0 => 0 bug */
#define JS_BUG_EAGER_TOSTRING 0 /* o.toString() trumps o.valueOf() */
#define JS_BUG_VOID_TOSTRING 0 /* void 0 + 0 == "undefined0" */
#define JS_BUG_EVAL_THIS_FUN 0 /* eval('this') in function f is f */
#define JS_BUG_EVAL_THIS_SCOPE 0 /* Math.eval('sin(x)') vs. local x */
#define JS_BUG_FALLIBLE_EQOPS 0 /* fallible/intransitive equality ops */
#define JS_BUG_FALLIBLE_TONUM 0 /* fallible ValueToNumber primitive */
#define JS_BUG_WITH_CLOSURE 1 /* with(o)function f(){} sets o.f */
#define JS_BUG_SET_ENUMERATE 0 /* o.p=q flags o.p JSPROP_ENUMERATE */
#define JS_HAS_PROP_DELETE 1 /* delete o.p removes p from o */
#define JS_HAS_CALL_OBJECT 1 /* fun.caller is stack frame obj */
#define JS_HAS_LABEL_STATEMENT 1 /* has break/continue to label: */
#define JS_HAS_DO_WHILE_LOOP 1 /* has do {...} while (b) */
#define JS_HAS_SWITCH_STATEMENT 1 /* has switch (v) {case c: ...} */
#define JS_HAS_SOME_PERL_FUN 1 /* has array.join/reverse/sort */
#define JS_HAS_MORE_PERL_FUN 1 /* has array.push, str.substr, etc */
#define JS_HAS_VALUEOF_HINT 1 /* valueOf(hint) where hint is typeof */
#define JS_HAS_LEXICAL_CLOSURE 1 /* nested functions, lexically closed */
#define JS_HAS_APPLY_FUNCTION 1 /* has apply(fun, arg1, ... argN) */
#define JS_HAS_CALL_FUNCTION 1 /* has fun.call(obj, arg1, ... argN) */
#define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
#define JS_HAS_REGEXPS 1 /* has perl r.e.s via RegExp, /pat/ */
#define JS_HAS_SEQUENCE_OPS 1 /* has array.slice, string.concat */
#define JS_HAS_INITIALIZERS 1 /* has var o = {'foo': 42, 'bar':3} */
#define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
#define JS_HAS_EXPORT_IMPORT 1 /* has export fun; import obj.fun */
#define JS_HAS_EVAL_THIS_SCOPE 1 /* Math.eval is same as with (Math) */
#define JS_HAS_TRIPLE_EQOPS 1 /* has === and !== identity eqops */
#define JS_HAS_SHARP_VARS 1 /* has #n=, #n# for object literals */
#define JS_HAS_REPLACE_LAMBDA 1 /* has string.replace(re, lambda) */
#define JS_HAS_SCRIPT_OBJECT 1 /* has (new Script("x++")).exec() */
#define JS_HAS_XDR 1 /* has XDR API and object methods */
#define JS_HAS_EXCEPTIONS 0 /* has exception handling */
#define JS_HAS_UNDEFINED 1 /* has global "undefined" property */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_IN_OPERATOR 0 /* has in operator ('p' in {p:1}) */
#define JS_HAS_INSTANCEOF 0 /* has {p:1} instanceof Object */
#define JS_HAS_ARGS_OBJECT 1 /* has minimal ECMA arguments object */
#define JS_HAS_DEBUGGER_KEYWORD 1 /* has hook for debugger keyword */
#define JS_HAS_ERROR_EXCEPTIONS 0 /* has error object hierarchy */
#elif JS_VERSION == 140
#define JS_BUG_AUTO_INDEX_PROPS 0 /* new object o: o.p = v sets o[0] */
#define JS_BUG_NULL_INDEX_PROPS 0 /* o[0] defaults to null, not void */
#define JS_BUG_EMPTY_INDEX_ZERO 0 /* o[""] is equivalent to o[0] */
#define JS_BUG_SHORT_CIRCUIT 0 /* 1 && 1 => true, 1 && 0 => 0 bug */
#define JS_BUG_EAGER_TOSTRING 0 /* o.toString() trumps o.valueOf() */
#define JS_BUG_VOID_TOSTRING 0 /* void 0 + 0 == "undefined0" */
#define JS_BUG_EVAL_THIS_FUN 0 /* eval('this') in function f is f */
#define JS_BUG_EVAL_THIS_SCOPE 0 /* Math.eval('sin(x)') vs. local x */
#define JS_BUG_FALLIBLE_EQOPS 0 /* fallible/intransitive equality ops */
#define JS_BUG_FALLIBLE_TONUM 0 /* fallible ValueToNumber primitive */
#define JS_BUG_WITH_CLOSURE 1 /* with(o)function f(){} sets o.f */
#define JS_BUG_SET_ENUMERATE 0 /* o.p=q flags o.p JSPROP_ENUMERATE */
#define JS_HAS_PROP_DELETE 1 /* delete o.p removes p from o */
#define JS_HAS_CALL_OBJECT 1 /* fun.caller is stack frame obj */
#define JS_HAS_LABEL_STATEMENT 1 /* has break/continue to label: */
#define JS_HAS_DO_WHILE_LOOP 1 /* has do {...} while (b) */
#define JS_HAS_SWITCH_STATEMENT 1 /* has switch (v) {case c: ...} */
#define JS_HAS_SOME_PERL_FUN 1 /* has array.join/reverse/sort */
#define JS_HAS_MORE_PERL_FUN 1 /* has array.push, str.substr, etc */
#define JS_HAS_VALUEOF_HINT 1 /* valueOf(hint) where hint is typeof */
#define JS_HAS_LEXICAL_CLOSURE 1 /* nested functions, lexically closed */
#define JS_HAS_APPLY_FUNCTION 1 /* has apply(fun, arg1, ... argN) */
#define JS_HAS_CALL_FUNCTION 1 /* has fun.call(obj, arg1, ... argN) */
#define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
#define JS_HAS_REGEXPS 1 /* has perl r.e.s via RegExp, /pat/ */
#define JS_HAS_SEQUENCE_OPS 1 /* has array.slice, string.concat */
#define JS_HAS_INITIALIZERS 1 /* has var o = {'foo': 42, 'bar':3} */
#define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
#define JS_HAS_EXPORT_IMPORT 1 /* has export fun; import obj.fun */
#define JS_HAS_EVAL_THIS_SCOPE 1 /* Math.eval is same as with (Math) */
#define JS_HAS_TRIPLE_EQOPS 1 /* has === and !== identity eqops */
#define JS_HAS_SHARP_VARS 1 /* has #n=, #n# for object literals */
#define JS_HAS_REPLACE_LAMBDA 1 /* has string.replace(re, lambda) */
#define JS_HAS_SCRIPT_OBJECT 1 /* has (new Script("x++")).exec() */
#define JS_HAS_XDR 1 /* has XDR API and object methods */
#define JS_HAS_EXCEPTIONS 1 /* has exception handling */
#define JS_HAS_UNDEFINED 1 /* has global "undefined" property */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_IN_OPERATOR 1 /* has in operator ('p' in {p:1}) */
#define JS_HAS_INSTANCEOF 1 /* has {p:1} instanceof Object */
#define JS_HAS_ARGS_OBJECT 1 /* has minimal ECMA arguments object */
#define JS_HAS_DEBUGGER_KEYWORD 1 /* has hook for debugger keyword */
#define JS_HAS_ERROR_EXCEPTIONS 1 /* rt errors reflected as exceptions */
#define JS_HAS_DFLT_MSG_STRINGS 1 /* provides English error messages */
#else
#error "unknown JS_VERSION"
#endif

288
mozilla/js/src/jscpucfg.c Normal file
View File

@@ -0,0 +1,288 @@
/* -*- 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.
*/
/*
* Generate CPU-specific bit-size and similar #defines.
*/
#include <stdio.h>
#if defined(sgi)
#ifndef IRIX
# error "IRIX is not defined"
#endif
#endif
#if defined(__sun)
#if defined(__svr4) || defined(__svr4__)
#ifndef SOLARIS
# error "SOLARIS is not defined"
#endif
#else
#ifndef SUNOS4
# error "SUNOS4 is not defined"
#endif
#endif
#endif
#if defined(__hpux)
#ifndef HPUX
# error "HPUX is not defined"
#endif
#endif
#if defined(__osf__)
#ifndef OSF1
# error "OSF1 is not defined"
#endif
#endif
#if defined(_IBMR2)
#ifndef AIX
# error "AIX is not defined"
#endif
#endif
#if defined(linux)
#ifndef LINUX
# error "LINUX is not defined"
#endif
#endif
#if defined(bsdi)
#ifndef BSDI
# error "BSDI is not defined"
#endif
#endif
#if defined(M_UNIX)
#ifndef SCO
# error "SCO is not defined"
#endif
#endif
#if !defined(M_UNIX) && defined(_USLC_)
#ifndef UNIXWARE
# error "UNIXWARE is not defined"
#endif
#endif
#ifdef __MWERKS__
#define XP_MAC 1
#endif
/************************************************************************/
/* Generate cpucfg.h */
#ifdef XP_MAC
#include <Types.h>
#define INT64 UnsignedWide
#else
#ifdef XP_PC
#ifdef WIN32
#define INT64 _int64
#else
#define INT64 long
#endif
#else
#if defined(HPUX) || defined(SCO) || defined(UNIXWARE)
#define INT64 long
#else
#define INT64 long long
#endif
#endif
#endif
typedef void *prword;
struct align_short {
char c;
short a;
};
struct align_int {
char c;
int a;
};
struct align_long {
char c;
long a;
};
struct align_int64 {
char c;
INT64 a;
};
struct align_fakelonglong {
char c;
struct {
long hi, lo;
} a;
};
struct align_float {
char c;
float a;
};
struct align_double {
char c;
double a;
};
struct align_pointer {
char c;
void *a;
};
struct align_prword {
char c;
prword a;
};
#define ALIGN_OF(type) \
(((char*)&(((struct align_##type *)0)->a)) - ((char*)0))
int bpb;
static int Log2(int n)
{
int log2 = 0;
if (n & (n-1))
log2++;
if (n >> 16)
log2 += 16, n >>= 16;
if (n >> 8)
log2 += 8, n >>= 8;
if (n >> 4)
log2 += 4, n >>= 4;
if (n >> 2)
log2 += 2, n >>= 2;
if (n >> 1)
log2++;
return log2;
}
/* We assume that int's are 32 bits */
static void do64(void)
{
union {
long i;
char c[4];
} u;
u.i = 0x01020304;
if (u.c[0] == 0x01) {
printf("#undef IS_LITTLE_ENDIAN\n");
printf("#define IS_BIG_ENDIAN 1\n\n");
} else {
printf("#define IS_LITTLE_ENDIAN 1\n");
printf("#undef IS_BIG_ENDIAN\n\n");
}
}
static void do32(void)
{
union {
long i;
char c[4];
} u;
u.i = 0x01020304;
if (u.c[0] == 0x01) {
printf("#undef IS_LITTLE_ENDIAN\n");
printf("#define IS_BIG_ENDIAN 1\n\n");
} else {
printf("#define IS_LITTLE_ENDIAN 1\n");
printf("#undef IS_BIG_ENDIAN\n\n");
}
}
/*
* Conceivably this could actually be used, but there is lots of code out
* there with ands and shifts in it that assumes a byte is exactly 8 bits,
* so forget about porting THIS code to all those non 8 bit byte machines.
*/
static void BitsPerByte(void)
{
bpb = 8;
}
int main(int argc, char **argv)
{
BitsPerByte();
printf("#ifndef js_cpucfg___\n");
printf("#define js_cpucfg___\n\n");
printf("/* AUTOMATICALLY GENERATED - DO NOT EDIT */\n\n");
if (sizeof(long) == 8) {
do64();
} else {
do32();
}
printf("#define JS_BYTES_PER_BYTE %dL\n", sizeof(char));
printf("#define JS_BYTES_PER_SHORT %dL\n", sizeof(short));
printf("#define JS_BYTES_PER_INT %dL\n", sizeof(int));
printf("#define JS_BYTES_PER_INT64 %dL\n", 8);
printf("#define JS_BYTES_PER_LONG %dL\n", sizeof(long));
printf("#define JS_BYTES_PER_FLOAT %dL\n", sizeof(float));
printf("#define JS_BYTES_PER_DOUBLE %dL\n", sizeof(double));
printf("#define JS_BYTES_PER_WORD %dL\n", sizeof(prword));
printf("#define JS_BYTES_PER_DWORD %dL\n", 8);
printf("\n");
printf("#define JS_BITS_PER_BYTE %dL\n", bpb);
printf("#define JS_BITS_PER_SHORT %dL\n", bpb * sizeof(short));
printf("#define JS_BITS_PER_INT %dL\n", bpb * sizeof(int));
printf("#define JS_BITS_PER_INT64 %dL\n", bpb * 8);
printf("#define JS_BITS_PER_LONG %dL\n", bpb * sizeof(long));
printf("#define JS_BITS_PER_FLOAT %dL\n", bpb * sizeof(float));
printf("#define JS_BITS_PER_DOUBLE %dL\n", bpb * sizeof(double));
printf("#define JS_BITS_PER_WORD %dL\n", bpb * sizeof(prword));
printf("\n");
printf("#define JS_BITS_PER_BYTE_LOG2 %dL\n", Log2(bpb));
printf("#define JS_BITS_PER_SHORT_LOG2 %dL\n", Log2(bpb * sizeof(short)));
printf("#define JS_BITS_PER_INT_LOG2 %dL\n", Log2(bpb * sizeof(int)));
printf("#define JS_BITS_PER_INT64_LOG2 %dL\n", 6);
printf("#define JS_BITS_PER_LONG_LOG2 %dL\n", Log2(bpb * sizeof(long)));
printf("#define JS_BITS_PER_FLOAT_LOG2 %dL\n", Log2(bpb * sizeof(float)));
printf("#define JS_BITS_PER_DOUBLE_LOG2 %dL\n", Log2(bpb * sizeof(double)));
printf("#define JS_BITS_PER_WORD_LOG2 %dL\n", Log2(bpb * sizeof(prword)));
printf("\n");
printf("#define JS_ALIGN_OF_SHORT %dL\n", ALIGN_OF(short));
printf("#define JS_ALIGN_OF_INT %dL\n", ALIGN_OF(int));
printf("#define JS_ALIGN_OF_LONG %dL\n", ALIGN_OF(long));
if (sizeof(INT64) < 8) {
/* this machine doesn't actually support int64's */
printf("#define JS_ALIGN_OF_INT64 %dL\n", ALIGN_OF(fakelonglong));
} else {
printf("#define JS_ALIGN_OF_INT64 %dL\n", ALIGN_OF(int64));
}
printf("#define JS_ALIGN_OF_FLOAT %dL\n", ALIGN_OF(float));
printf("#define JS_ALIGN_OF_DOUBLE %dL\n", ALIGN_OF(double));
printf("#define JS_ALIGN_OF_POINTER %dL\n", ALIGN_OF(pointer));
printf("#define JS_ALIGN_OF_WORD %dL\n", ALIGN_OF(prword));
printf("\n");
printf("#define JS_BYTES_PER_WORD_LOG2 %dL\n", Log2(sizeof(prword)));
printf("#define JS_BYTES_PER_DWORD_LOG2 %dL\n", Log2(8));
printf("#define JS_WORDS_PER_DWORD_LOG2 %dL\n", Log2(8/sizeof(prword)));
printf("\n");
printf("#endif /* js_cpucfg___ */\n");
return 0;
}

702
mozilla/js/src/jscpucfg.h Normal file
View File

@@ -0,0 +1,702 @@
/* -*- 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 js_cpucfg___
#define js_cpucfg___
#include "jsosdep.h"
#ifdef XP_MAC
#include "jsmacos.h"
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 2L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 4L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#endif /* XP_MAC */
#ifdef _WIN32
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 8L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 4L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#endif /* _WIN32 */
#if defined(_WINDOWS) && !defined(_WIN32) /* WIN16 */
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 2L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 16L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 4L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 2L
#define JS_ALIGN_OF_LONG 2L
#define JS_ALIGN_OF_INT64 2L
#define JS_ALIGN_OF_FLOAT 2L
#define JS_ALIGN_OF_DOUBLE 2L
#define JS_ALIGN_OF_POINTER 2L
#define JS_ALIGN_OF_WORD 2L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#endif /* defined(_WINDOWS) && !defined(_WIN32) */
#ifdef XP_UNIX
#ifdef AIXV3
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 8L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 4L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(BSDI)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 4L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 4L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(HPUX)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 4L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 8L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(IRIX)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 8L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 8L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(LINUX)
#ifdef __powerpc__
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#elif __i386__
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#else
#error "linux cpu architecture not supported by jscpucfg.h"
#endif
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 4L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 4L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(OSF1)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 8L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 8L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 64L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 64L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 6L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 6L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 8L
#define JS_ALIGN_OF_INT64 8L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 8L
#define JS_ALIGN_OF_POINTER 8L
#define JS_ALIGN_OF_WORD 8L
#define JS_BYTES_PER_WORD_LOG2 3L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 0L
#elif defined(SOLARIS)
#ifdef i386
/* PC-based */
#undef IS_BIG_ENDIAN
#define IS_LITTLE_ENDIAN 1
#else
/* Sparc-based */
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#endif
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 8L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 8L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#ifdef i386
#undef JS_ALIGN_OF_INT64
#undef JS_ALIGN_OF_DOUBLE
#define JS_ALIGN_OF_INT64 4L
#define JS_ALIGN_OF_DOUBLE 4L
#endif
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(SUNOS4)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 8L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 8L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(SNI)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 8L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 8L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(SONY)
/* Don't have it */
#elif defined(NECSVR4)
/* Don't have it */
#elif defined(SCO)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 4L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 4L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#elif defined(UNIXWARE)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define JS_BYTES_PER_BYTE 1L
#define JS_BYTES_PER_SHORT 2L
#define JS_BYTES_PER_INT 4L
#define JS_BYTES_PER_INT64 8L
#define JS_BYTES_PER_LONG 4L
#define JS_BYTES_PER_FLOAT 4L
#define JS_BYTES_PER_DOUBLE 8L
#define JS_BYTES_PER_WORD 4L
#define JS_BYTES_PER_DWORD 8L
#define JS_BITS_PER_BYTE 8L
#define JS_BITS_PER_SHORT 16L
#define JS_BITS_PER_INT 32L
#define JS_BITS_PER_INT64 64L
#define JS_BITS_PER_LONG 32L
#define JS_BITS_PER_FLOAT 32L
#define JS_BITS_PER_DOUBLE 64L
#define JS_BITS_PER_WORD 32L
#define JS_BITS_PER_BYTE_LOG2 3L
#define JS_BITS_PER_SHORT_LOG2 4L
#define JS_BITS_PER_INT_LOG2 5L
#define JS_BITS_PER_INT64_LOG2 6L
#define JS_BITS_PER_LONG_LOG2 5L
#define JS_BITS_PER_FLOAT_LOG2 5L
#define JS_BITS_PER_DOUBLE_LOG2 6L
#define JS_BITS_PER_WORD_LOG2 5L
#define JS_ALIGN_OF_SHORT 2L
#define JS_ALIGN_OF_INT 4L
#define JS_ALIGN_OF_LONG 4L
#define JS_ALIGN_OF_INT64 4L
#define JS_ALIGN_OF_FLOAT 4L
#define JS_ALIGN_OF_DOUBLE 4L
#define JS_ALIGN_OF_POINTER 4L
#define JS_ALIGN_OF_WORD 4L
#define JS_BYTES_PER_WORD_LOG2 2L
#define JS_BYTES_PER_DWORD_LOG2 3L
#define PR_WORDS_PER_DWORD_LOG2 1L
#endif
#endif /* XP_UNIX */
#endif /* js_cpucfg___ */

2023
mozilla/js/src/jsdate.c Normal file

File diff suppressed because it is too large Load Diff

76
mozilla/js/src/jsdate.h Normal file
View File

@@ -0,0 +1,76 @@
/* -*- 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 jsdate_h___
#define jsdate_h___
/*
* JS Date class interface.
*/
JS_BEGIN_EXTERN_C
extern JSObject *
js_InitDateClass(JSContext *cx, JSObject *obj);
/*
* These functions provide a C interface to the date/time object
*/
extern JS_FRIEND_API(JSObject*)
js_NewDateObject(JSContext* cx, int year, int mon, int mday,
int hour, int min, int sec);
extern JS_FRIEND_API(int)
js_DateGetYear(JSContext *cx, JSObject* obj);
extern JS_FRIEND_API(int)
js_DateGetMonth(JSContext *cx, JSObject* obj);
extern JS_FRIEND_API(int)
js_DateGetDate(JSContext *cx, JSObject* obj);
extern JS_FRIEND_API(int)
js_DateGetHours(JSContext *cx, JSObject* obj);
extern JS_FRIEND_API(int)
js_DateGetMinutes(JSContext *cx, JSObject* obj);
extern JS_FRIEND_API(int)
js_DateGetSeconds(JSContext *cx, JSObject* obj);
extern JS_FRIEND_API(void)
js_DateSetYear(JSContext *cx, JSObject *obj, int year);
extern JS_FRIEND_API(void)
js_DateSetMonth(JSContext *cx, JSObject *obj, int year);
extern JS_FRIEND_API(void)
js_DateSetDate(JSContext *cx, JSObject *obj, int date);
extern JS_FRIEND_API(void)
js_DateSetHours(JSContext *cx, JSObject *obj, int hours);
extern JS_FRIEND_API(void)
js_DateSetMinutes(JSContext *cx, JSObject *obj, int minutes);
extern JS_FRIEND_API(void)
js_DateSetSeconds(JSContext *cx, JSObject *obj, int seconds);
JS_END_EXTERN_C
#endif /* jsdate_h___ */

859
mozilla/js/src/jsdbgapi.c Normal file
View File

@@ -0,0 +1,859 @@
/* -*- 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.
*/
/*
* JS debugging API.
*/
#include "jsstddef.h"
#include <string.h>
#include "jstypes.h"
/* Removed by JSIFY: #include "prlog.h" */
#include "jsutil.h" /* Added by JSIFY */
#include "jsclist.h"
#include "jsapi.h"
#include "jscntxt.h"
#include "jsconfig.h"
#include "jsdbgapi.h"
#include "jsfun.h"
#include "jsgc.h"
#include "jsinterp.h"
#include "jslock.h"
#include "jsobj.h"
#include "jsopcode.h"
#include "jsscope.h"
#include "jsscript.h"
#include "jsstr.h"
typedef struct JSTrap {
JSCList links;
JSScript *script;
jsbytecode *pc;
JSOp op;
JSTrapHandler handler;
void *closure;
} JSTrap;
static JSTrap *
FindTrap(JSRuntime *rt, JSScript *script, jsbytecode *pc)
{
JSTrap *trap;
for (trap = (JSTrap *)rt->trapList.next;
trap != (JSTrap *)&rt->trapList;
trap = (JSTrap *)trap->links.next) {
if (trap->script == script && trap->pc == pc)
return trap;
}
return NULL;
}
void
js_PatchOpcode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op)
{
JSTrap *trap;
trap = FindTrap(cx->runtime, script, pc);
if (trap)
trap->op = op;
else
*pc = (jsbytecode)op;
}
JS_PUBLIC_API(JSBool)
JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
JSTrapHandler handler, void *closure)
{
JSRuntime *rt;
JSTrap *trap;
rt = cx->runtime;
trap = FindTrap(rt, script, pc);
if (trap) {
/* Restore opcode at pc so it can be saved again. */
*pc = (jsbytecode)trap->op;
} else {
trap = JS_malloc(cx, sizeof *trap);
if (!trap || !js_AddRoot(cx, &trap->closure, "trap->closure")) {
if (trap)
JS_free(cx, trap);
return JS_FALSE;
}
}
JS_APPEND_LINK(&trap->links, &rt->trapList);
trap->script = script;
trap->pc = pc;
trap->op = (JSOp)*pc;
trap->handler = handler;
trap->closure = closure;
*pc = JSOP_TRAP;
return JS_TRUE;
}
JS_PUBLIC_API(JSOp)
JS_GetTrapOpcode(JSContext *cx, JSScript *script, jsbytecode *pc)
{
JSTrap *trap;
trap = FindTrap(cx->runtime, script, pc);
if (!trap) {
JS_ASSERT(0); /* XXX can't happen */
return JSOP_LIMIT;
}
return trap->op;
}
static void
DestroyTrap(JSContext *cx, JSTrap *trap)
{
JS_REMOVE_LINK(&trap->links);
*trap->pc = (jsbytecode)trap->op;
js_RemoveRoot(cx, &trap->closure);
JS_free(cx, trap);
}
JS_PUBLIC_API(void)
JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
JSTrapHandler *handlerp, void **closurep)
{
JSTrap *trap;
trap = FindTrap(cx->runtime, script, pc);
if (handlerp)
*handlerp = trap ? trap->handler : NULL;
if (closurep)
*closurep = trap ? trap->closure : NULL;
if (trap)
DestroyTrap(cx, trap);
}
JS_PUBLIC_API(void)
JS_ClearScriptTraps(JSContext *cx, JSScript *script)
{
JSRuntime *rt;
JSTrap *trap, *next;
rt = cx->runtime;
for (trap = (JSTrap *)rt->trapList.next;
trap != (JSTrap *)&rt->trapList;
trap = next) {
next = (JSTrap *)trap->links.next;
if (trap->script == script)
DestroyTrap(cx, trap);
}
}
JS_PUBLIC_API(void)
JS_ClearAllTraps(JSContext *cx)
{
JSRuntime *rt;
JSTrap *trap, *next;
rt = cx->runtime;
for (trap = (JSTrap *)rt->trapList.next;
trap != (JSTrap *)&rt->trapList;
trap = next) {
next = (JSTrap *)trap->links.next;
DestroyTrap(cx, trap);
}
}
JS_PUBLIC_API(JSTrapStatus)
JS_HandleTrap(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval)
{
JSTrap *trap;
JSTrapStatus status;
jsint op;
trap = FindTrap(cx->runtime, script, pc);
if (!trap) {
JS_ASSERT(0); /* XXX can't happen */
return JSTRAP_ERROR;
}
/*
* It's important that we not use 'trap->' after calling the callback --
* the callback might remove the trap!
*/
op = (jsint)trap->op;
status = trap->handler(cx, script, pc, rval, trap->closure);
if (status == JSTRAP_CONTINUE) {
/* By convention, return the true op to the interpreter in rval. */
*rval = INT_TO_JSVAL(op);
}
return status;
}
JS_PUBLIC_API(JSBool)
JS_SetInterrupt(JSRuntime *rt, JSTrapHandler handler, void *closure)
{
rt->interruptHandler = handler;
rt->interruptHandlerData = closure;
return JS_TRUE;
}
JS_PUBLIC_API(JSBool)
JS_ClearInterrupt(JSRuntime *rt, JSTrapHandler *handlerp, void **closurep)
{
if (handlerp)
*handlerp = (JSTrapHandler)rt->interruptHandler;
if (closurep)
*closurep = rt->interruptHandlerData;
rt->interruptHandler = 0;
rt->interruptHandlerData = 0;
return JS_TRUE;
}
typedef struct JSWatchPoint {
JSCList links;
JSObject *object; /* weak link, see js_FinalizeObject */
jsval userid;
JSScopeProperty *sprop;
JSPropertyOp setter;
JSWatchPointHandler handler;
void *closure;
jsrefcount nrefs;
} JSWatchPoint;
#define HoldWatchPoint(wp) ((wp)->nrefs++)
static void
DropWatchPoint(JSContext *cx, JSWatchPoint *wp)
{
if (--wp->nrefs != 0)
return;
wp->sprop->setter = wp->setter;
JS_LOCK_OBJ_VOID(cx, wp->object,
js_DropScopeProperty(cx, (JSScope *)wp->object->map,
wp->sprop));
JS_REMOVE_LINK(&wp->links);
js_RemoveRoot(cx, &wp->closure);
JS_free(cx, wp);
}
static JSWatchPoint *
FindWatchPoint(JSRuntime *rt, JSObject *obj, jsval userid)
{
JSWatchPoint *wp;
for (wp = (JSWatchPoint *)rt->watchPointList.next;
wp != (JSWatchPoint *)&rt->watchPointList;
wp = (JSWatchPoint *)wp->links.next) {
if (wp->object == obj && wp->userid == userid)
return wp;
}
return NULL;
}
JSScopeProperty *
js_FindWatchPoint(JSRuntime *rt, JSObject *obj, jsval userid)
{
JSWatchPoint *wp;
wp = FindWatchPoint(rt, obj, userid);
if (!wp)
return NULL;
return wp->sprop;
}
JSBool DLL_CALLBACK
js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
JSRuntime *rt;
JSWatchPoint *wp;
JSScopeProperty *sprop;
JSSymbol *sym;
jsval userid, value;
jsid symid;
JSScope *scope;
JSAtom *atom;
JSBool ok;
rt = cx->runtime;
for (wp = (JSWatchPoint *)rt->watchPointList.next;
wp != (JSWatchPoint *)&rt->watchPointList;
wp = (JSWatchPoint *)wp->links.next) {
sprop = wp->sprop;
if (wp->object == obj && sprop->id == id) {
JS_LOCK_OBJ(cx, obj);
sym = sprop->symbols;
if (!sym) {
userid = wp->userid;
atom = NULL;
if (JSVAL_IS_INT(userid)) {
symid = (jsid)userid;
} else {
atom = js_ValueToStringAtom(cx, userid);
if (!atom) {
JS_UNLOCK_OBJ(cx, obj);
return JS_FALSE;
}
symid = (jsid)atom;
}
scope = (JSScope *) obj->map;
JS_ASSERT(scope->props);
ok = LOCKED_OBJ_GET_CLASS(obj)->addProperty(cx, obj, sprop->id,
&value);
if (!ok) {
JS_UNLOCK_OBJ(cx, obj);
return JS_FALSE;
}
ok = (scope->ops->add(cx, scope, symid, sprop) != NULL);
if (!ok) {
JS_UNLOCK_OBJ(cx, obj);
return JS_FALSE;
}
sym = sprop->symbols;
}
JS_UNLOCK_OBJ(cx, obj);
HoldWatchPoint(wp);
ok = wp->handler(cx, obj, js_IdToValue(sym_id(sym)),
OBJ_GET_SLOT(cx, obj, wp->sprop->slot), vp,
wp->closure);
if (ok)
ok = wp->setter(cx, obj, id, vp);
DropWatchPoint(cx, wp);
return ok;
}
}
JS_ASSERT(0); /* XXX can't happen */
return JS_FALSE;
}
JS_PUBLIC_API(JSBool)
JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsval id,
JSWatchPointHandler handler, void *closure)
{
JSAtom *atom;
jsid symid;
JSObject *pobj;
JSScopeProperty *sprop;
JSRuntime *rt;
JSWatchPoint *wp;
if (!OBJ_IS_NATIVE(obj)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_WATCH,
OBJ_GET_CLASS(cx, obj)->name);
return JS_FALSE;
}
if (JSVAL_IS_INT(id)) {
symid = (jsid)id;
atom = NULL;
} else {
atom = js_ValueToStringAtom(cx, id);
if (!atom)
return JS_FALSE;
symid = (jsid)atom;
}
if (!js_LookupProperty(cx, obj, symid, &pobj, (JSProperty **)&sprop))
return JS_FALSE;
rt = cx->runtime;
if (!sprop) {
/* Check for a deleted symbol watchpoint, which holds its property. */
sprop = js_FindWatchPoint(rt, obj, id);
if (sprop) {
#ifdef JS_THREADSAFE
/* Emulate js_LookupProperty if thread-safe. */
JS_LOCK_OBJ(cx, obj);
sprop->nrefs++;
#endif
} else {
/* Make a new property in obj so we can watch for the first set. */
if (!js_DefineProperty(cx, obj, symid, JSVAL_VOID, NULL, NULL, 0,
(JSProperty **)&sprop)) {
sprop = NULL;
}
}
} else if (pobj != obj) {
/* Clone the prototype property so we can watch the right object. */
jsval value;
JSPropertyOp getter, setter;
uintN attrs;
if (OBJ_IS_NATIVE(pobj)) {
value = LOCKED_OBJ_GET_SLOT(pobj, sprop->slot);
} else {
if (!OBJ_GET_PROPERTY(cx, pobj, id, &value)) {
OBJ_DROP_PROPERTY(cx, pobj, (JSProperty *)sprop);
return JS_FALSE;
}
}
getter = sprop->getter;
setter = sprop->setter;
attrs = sprop->attrs;
OBJ_DROP_PROPERTY(cx, pobj, (JSProperty *)sprop);
if (!js_DefineProperty(cx, obj, symid, value, getter, setter, attrs,
(JSProperty **)&sprop)) {
sprop = NULL;
}
}
if (!sprop)
return JS_FALSE;
wp = FindWatchPoint(rt, obj, id);
if (!wp) {
wp = JS_malloc(cx, sizeof *wp);
if (!wp)
return JS_FALSE;
if (!js_AddRoot(cx, &wp->closure, "wp->closure")) {
JS_free(cx, wp);
return JS_FALSE;
}
JS_APPEND_LINK(&wp->links, &rt->watchPointList);
wp->object = obj;
wp->userid = id;
wp->sprop = js_HoldScopeProperty(cx, (JSScope *)obj->map, sprop);
wp->setter = sprop->setter;
sprop->setter = js_watch_set;
wp->nrefs = 1;
}
wp->handler = handler;
wp->closure = closure;
OBJ_DROP_PROPERTY(cx, obj, (JSProperty *)sprop);
return JS_TRUE;
}
JS_PUBLIC_API(void)
JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsval id,
JSWatchPointHandler *handlerp, void **closurep)
{
JSRuntime *rt;
JSWatchPoint *wp;
rt = cx->runtime;
for (wp = (JSWatchPoint *)rt->watchPointList.next;
wp != (JSWatchPoint *)&rt->watchPointList;
wp = (JSWatchPoint *)wp->links.next) {
if (wp->object == obj && wp->userid == id) {
if (handlerp)
*handlerp = wp->handler;
if (closurep)
*closurep = wp->closure;
DropWatchPoint(cx, wp);
return;
}
}
if (handlerp)
*handlerp = NULL;
if (closurep)
*closurep = NULL;
}
JS_PUBLIC_API(void)
JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj)
{
JSRuntime *rt;
JSWatchPoint *wp, *next;
rt = cx->runtime;
for (wp = (JSWatchPoint *)rt->watchPointList.next;
wp != (JSWatchPoint *)&rt->watchPointList;
wp = next) {
next = (JSWatchPoint *)wp->links.next;
if (wp->object == obj)
DropWatchPoint(cx, wp);
}
}
JS_PUBLIC_API(void)
JS_ClearAllWatchPoints(JSContext *cx)
{
JSRuntime *rt;
JSWatchPoint *wp, *next;
rt = cx->runtime;
for (wp = (JSWatchPoint *)rt->watchPointList.next;
wp != (JSWatchPoint *)&rt->watchPointList;
wp = next) {
next = (JSWatchPoint *)wp->links.next;
DropWatchPoint(cx, wp);
}
}
JS_PUBLIC_API(uintN)
JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc)
{
return js_PCToLineNumber(script, pc);
}
JS_PUBLIC_API(jsbytecode *)
JS_LineNumberToPC(JSContext *cx, JSScript *script, uintN lineno)
{
return js_LineNumberToPC(script, lineno);
}
JS_PUBLIC_API(JSScript *)
JS_GetFunctionScript(JSContext *cx, JSFunction *fun)
{
return fun->script;
}
JS_PUBLIC_API(JSPrincipals *)
JS_GetScriptPrincipals(JSContext *cx, JSScript *script)
{
return script->principals;
}
/*
* Stack Frame Iterator
*/
JS_PUBLIC_API(JSStackFrame *)
JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp)
{
*iteratorp = (*iteratorp == NULL) ? cx->fp : (*iteratorp)->down;
return *iteratorp;
}
JS_PUBLIC_API(JSScript *)
JS_GetFrameScript(JSContext *cx, JSStackFrame *fp)
{
return fp->script;
}
JS_PUBLIC_API(jsbytecode *)
JS_GetFramePC(JSContext *cx, JSStackFrame *fp)
{
return fp->pc;
}
JS_PUBLIC_API(void *)
JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp)
{
if (fp->annotation) {
JSPrincipals *principals = fp->script
? fp->script->principals
: NULL;
if (principals == NULL)
return NULL;
if (principals->globalPrivilegesEnabled(cx, principals)) {
/*
* Only give out an annotation if privileges have not
* been revoked globally.
*/
return fp->annotation;
}
}
return NULL;
}
JS_PUBLIC_API(void)
JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation)
{
fp->annotation = annotation;
}
JS_PUBLIC_API(void *)
JS_GetFramePrincipalArray(JSContext *cx, JSStackFrame *fp)
{
JSPrincipals *principals = fp->script
? fp->script->principals
: NULL;
return principals
? principals->getPrincipalArray(cx, principals)
: NULL;
}
JS_PUBLIC_API(JSBool)
JS_IsNativeFrame(JSContext *cx, JSStackFrame *fp)
{
return fp->fun && fp->fun->call;
}
/* this is deprecated, use JS_GetFrameScopeChain instead */
JS_PUBLIC_API(JSObject *)
JS_GetFrameObject(JSContext *cx, JSStackFrame *fp)
{
return fp->scopeChain;
}
JS_PUBLIC_API(JSObject *)
JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp)
{
/* Force creation of argument and call objects if not yet created */
JS_GetFrameCallObject(cx, fp);
return fp->scopeChain;
}
JS_PUBLIC_API(JSObject *)
JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp)
{
if (! fp->fun)
return NULL;
/* Force creation of argument object if not yet created */
js_GetArgsObject(cx, fp);
#if JS_HAS_CALL_OBJECT
return js_GetCallObject(cx, fp, NULL, NULL);
#else
return NULL;
#endif /* JS_HAS_CALL_OBJECT */
}
JS_PUBLIC_API(JSObject *)
JS_GetFrameThis(JSContext *cx, JSStackFrame *fp)
{
return fp->thisp;
}
JS_PUBLIC_API(JSFunction *)
JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp)
{
return fp->fun;
}
JS_PUBLIC_API(JSBool)
JS_IsContructorFrame(JSContext *cx, JSStackFrame *fp)
{
return fp->constructing;
}
JS_PUBLIC_API(JSBool)
JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp)
{
return fp->debugging;
}
JS_PUBLIC_API(jsval)
JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp)
{
return fp->rval;
}
JS_PUBLIC_API(void)
JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval)
{
fp->rval = rval;
}
/************************************************************************/
JS_PUBLIC_API(const char *)
JS_GetScriptFilename(JSContext *cx, JSScript *script)
{
return script->filename;
}
JS_PUBLIC_API(uintN)
JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script)
{
return script->lineno;
}
JS_PUBLIC_API(uintN)
JS_GetScriptLineExtent(JSContext *cx, JSScript *script)
{
return js_GetScriptLineExtent(script);
}
/***************************************************************************/
JS_PUBLIC_API(void)
JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata)
{
rt->newScriptHook = hook;
rt->newScriptHookData = callerdata;
}
JS_PUBLIC_API(void)
JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
void *callerdata)
{
rt->destroyScriptHook = hook;
rt->destroyScriptHookData = callerdata;
}
/***************************************************************************/
JS_PUBLIC_API(JSBool)
JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp,
const char *bytes, uintN length,
const char *filename, uintN lineno,
jsval *rval)
{
JSScript *script;
JSBool ok;
script = JS_CompileScriptForPrincipals(cx, fp->scopeChain,
fp->script ? fp->script->principals
: NULL,
bytes, length, filename, lineno);
if (!script)
return JS_FALSE;
ok = js_Execute(cx, fp->scopeChain, script, fp->fun, fp, JS_TRUE, rval);
js_DestroyScript(cx, script);
return ok;
}
/************************************************************************/
JS_PUBLIC_API(JSScopeProperty *)
JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp)
{
JSScopeProperty *sprop;
JSScope *scope;
sprop = *iteratorp;
scope = (JSScope *) obj->map;
sprop = (sprop == NULL) ? scope->props : sprop->next;
*iteratorp = sprop;
return sprop;
}
JS_PUBLIC_API(JSBool)
JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
JSPropertyDesc *pd)
{
JSSymbol *sym;
sym = sprop->symbols;
pd->id = sym ? js_IdToValue(sym_id(sym)) : JSVAL_VOID;
if (!sym || !js_GetProperty(cx, obj, sym_id(sym), &pd->value))
pd->value = OBJ_GET_SLOT(cx, obj, sprop->slot);
pd->flags = ((sprop->attrs & JSPROP_ENUMERATE) ? JSPD_ENUMERATE : 0)
| ((sprop->attrs & JSPROP_READONLY) ? JSPD_READONLY : 0)
| ((sprop->attrs & JSPROP_PERMANENT) ? JSPD_PERMANENT : 0)
#if JS_HAS_CALL_OBJECT
| ((sprop->getter == js_GetCallVariable) ? JSPD_VARIABLE : 0)
#endif /* JS_HAS_CALL_OBJECT */
| ((sprop->getter == js_GetArgument) ? JSPD_ARGUMENT : 0)
| ((sprop->getter == js_GetLocalVariable) ? JSPD_VARIABLE : 0);
#if JS_HAS_CALL_OBJECT
/* for Call Object 'real' getter isn't passed in to us */
if (OBJ_GET_CLASS(cx, obj) == &js_CallClass &&
OBJ_GET_CLASS(cx, obj)->getProperty == sprop->getter)
pd->flags |= JSPD_ARGUMENT;
#endif /* JS_HAS_CALL_OBJECT */
pd->spare = 0;
pd->slot = (pd->flags & (JSPD_ARGUMENT | JSPD_VARIABLE))
? JSVAL_TO_INT(sprop->id)
: 0;
if (!sym || !sym->next || (pd->flags & (JSPD_ARGUMENT | JSPD_VARIABLE))) {
pd->alias = JSVAL_VOID;
} else {
pd->alias = js_IdToValue(sym_id(sym->next));
pd->flags |= JSPD_ALIAS;
}
return JS_TRUE;
}
JS_PUBLIC_API(JSBool)
JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda)
{
JSScope *scope;
uint32 i, n;
JSPropertyDesc *pd;
JSScopeProperty *sprop;
jsval state;
jsid num_prop;
if (!OBJ_ENUMERATE(cx, obj, JSENUMERATE_INIT, &state, &num_prop))
return JS_FALSE;
scope = (JSScope *)obj->map;
/* have no props, or object's scope has not mutated from that of proto */
if (!scope->props ||
(OBJ_GET_PROTO(cx,obj) &&
scope == (JSScope *)(OBJ_GET_PROTO(cx,obj)->map))) {
pda->length = 0;
pda->array = NULL;
return JS_TRUE;
}
n = scope->map.freeslot;
pd = JS_malloc(cx, (size_t)n * sizeof(JSPropertyDesc));
if (!pd)
return JS_FALSE;
i = 0;
for (sprop = scope->props; sprop; sprop = sprop->next) {
if (!js_AddRoot(cx, &pd[i].id, NULL))
goto bad;
if (!js_AddRoot(cx, &pd[i].value, NULL))
goto bad;
JS_GetPropertyDesc(cx, obj, sprop, &pd[i]);
if ((pd[i].flags & JSPD_ALIAS) && !js_AddRoot(cx, &pd[i].alias, NULL))
goto bad;
if (++i == n)
break;
}
pda->length = i;
pda->array = pd;
return JS_TRUE;
bad:
pda->length = i + 1;
pda->array = pd;
JS_PutPropertyDescArray(cx, pda);
return JS_FALSE;
}
JS_PUBLIC_API(void)
JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda)
{
JSPropertyDesc *pd;
uint32 i;
pd = pda->array;
for (i = 0; i < pda->length; i++) {
js_RemoveRoot(cx, &pd[i].id);
js_RemoveRoot(cx, &pd[i].value);
if (pd[i].flags & JSPD_ALIAS)
js_RemoveRoot(cx, &pd[i].alias);
}
JS_free(cx, pd);
}
/************************************************************************/
JS_PUBLIC_API(JSBool)
JS_SetDebuggerHandler(JSRuntime *rt, JSTrapHandler handler, void *closure)
{
rt->debuggerHandler = handler;
rt->debuggerHandlerData = closure;
return JS_TRUE;
}
JS_PUBLIC_API(JSBool)
JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure)
{
rt->sourceHandler = handler;
rt->sourceHandlerData = closure;
return JS_TRUE;
}
JS_PUBLIC_API(JSBool)
JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure)
{
rt->executeHook = hook;
rt->executeHookData = closure;
return JS_TRUE;
}
extern JS_PUBLIC_API(JSBool)
JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure)
{
rt->callHook = hook;
rt->callHookData = closure;
return JS_TRUE;
}

245
mozilla/js/src/jsdbgapi.h Normal file
View File

@@ -0,0 +1,245 @@
/* -*- 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 jsdbgapi_h___
#define jsdbgapi_h___
/*
* JS debugger API.
*/
#include "jsapi.h"
#include "jsopcode.h"
#include "jsprvtd.h"
JS_BEGIN_EXTERN_C
extern void
js_PatchOpcode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op);
extern JS_PUBLIC_API(JSBool)
JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
JSTrapHandler handler, void *closure);
extern JS_PUBLIC_API(JSOp)
JS_GetTrapOpcode(JSContext *cx, JSScript *script, jsbytecode *pc);
extern JS_PUBLIC_API(void)
JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
JSTrapHandler *handlerp, void **closurep);
extern JS_PUBLIC_API(void)
JS_ClearScriptTraps(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(void)
JS_ClearAllTraps(JSContext *cx);
extern JS_PUBLIC_API(JSTrapStatus)
JS_HandleTrap(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval);
extern JS_PUBLIC_API(JSBool)
JS_SetInterrupt(JSRuntime *rt, JSTrapHandler handler, void *closure);
extern JS_PUBLIC_API(JSBool)
JS_ClearInterrupt(JSRuntime *rt, JSTrapHandler *handlerp, void **closurep);
/************************************************************************/
extern JS_PUBLIC_API(JSBool)
JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsval id,
JSWatchPointHandler handler, void *closure);
extern JS_PUBLIC_API(void)
JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsval id,
JSWatchPointHandler *handlerp, void **closurep);
extern JS_PUBLIC_API(void)
JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj);
extern JS_PUBLIC_API(void)
JS_ClearAllWatchPoints(JSContext *cx);
#ifdef JS_HAS_OBJ_WATCHPOINT
/*
* Hide these non-API function prototypes by testing whether the internal
* header file "jsconfig.h" has been included.
*/
extern JSScopeProperty *
js_FindWatchPoint(JSRuntime *rt, JSObject *obj, jsval userid);
extern JSBool DLL_CALLBACK
js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
#endif
/************************************************************************/
extern JS_PUBLIC_API(uintN)
JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
extern JS_PUBLIC_API(jsbytecode *)
JS_LineNumberToPC(JSContext *cx, JSScript *script, uintN lineno);
extern JS_PUBLIC_API(JSScript *)
JS_GetFunctionScript(JSContext *cx, JSFunction *fun);
extern JS_PUBLIC_API(JSPrincipals *)
JS_GetScriptPrincipals(JSContext *cx, JSScript *script);
/*
* Stack Frame Iterator
*
* Used to iterate through the JS stack frames to extract
* information from the frames.
*/
extern JS_PUBLIC_API(JSStackFrame *)
JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp);
extern JS_PUBLIC_API(JSScript *)
JS_GetFrameScript(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(jsbytecode *)
JS_GetFramePC(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSBool)
JS_IsNativeFrame(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(void *)
JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(void)
JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation);
extern JS_PUBLIC_API(void *)
JS_GetFramePrincipalArray(JSContext *cx, JSStackFrame *fp);
/* this is deprecated, use JS_GetFrameScopeChain instead */
extern JS_PUBLIC_API(JSObject *)
JS_GetFrameObject(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSObject *)
JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSObject *)
JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSObject *)
JS_GetFrameThis(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSFunction *)
JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSBool)
JS_IsContructorFrame(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSBool)
JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(jsval)
JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(void)
JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval);
/************************************************************************/
extern JS_PUBLIC_API(const char *)
JS_GetScriptFilename(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(uintN)
JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(uintN)
JS_GetScriptLineExtent(JSContext *cx, JSScript *script);
/************************************************************************/
/*
* Hook setters for script creation and destruction, see jsprvtd.h for the
* typedefs. These macros provide binary compatibility and newer, shorter
* synonyms.
*/
#define JS_SetNewScriptHook JS_SetNewScriptHookProc
#define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc
extern JS_PUBLIC_API(void)
JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata);
extern JS_PUBLIC_API(void)
JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
void *callerdata);
/************************************************************************/
extern JS_PUBLIC_API(JSBool)
JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp,
const char *bytes, uintN length,
const char *filename, uintN lineno,
jsval *rval);
/************************************************************************/
typedef struct JSPropertyDesc {
jsval id; /* primary id, a string or int */
jsval value; /* property value */
uint8 flags; /* flags, see below */
uint8 spare; /* unused */
uint16 slot; /* argument/variable slot */
jsval alias; /* alias id if JSPD_ALIAS flag */
} JSPropertyDesc;
#define JSPD_ENUMERATE 0x01 /* visible to for/in loop */
#define JSPD_READONLY 0x02 /* assignment is error */
#define JSPD_PERMANENT 0x04 /* property cannot be deleted */
#define JSPD_ALIAS 0x08 /* property has an alias id */
#define JSPD_ARGUMENT 0x10 /* argument to function */
#define JSPD_VARIABLE 0x20 /* local variable in function */
typedef struct JSPropertyDescArray {
uint32 length; /* number of elements in array */
JSPropertyDesc *array; /* alloc'd by Get, freed by Put */
} JSPropertyDescArray;
extern JS_PUBLIC_API(JSScopeProperty *)
JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp);
extern JS_PUBLIC_API(JSBool)
JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
JSPropertyDesc *pd);
extern JS_PUBLIC_API(JSBool)
JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda);
extern JS_PUBLIC_API(void)
JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda);
/************************************************************************/
extern JS_PUBLIC_API(JSBool)
JS_SetDebuggerHandler(JSRuntime *rt, JSTrapHandler handler, void *closure);
extern JS_PUBLIC_API(JSBool)
JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure);
extern JS_PUBLIC_API(JSBool)
JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
extern JS_PUBLIC_API(JSBool)
JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
JS_END_EXTERN_C
#endif /* jsdbgapi_h___ */

2607
mozilla/js/src/jsdtoa.c Normal file

File diff suppressed because it is too large Load Diff

54
mozilla/js/src/jsdtoa.h Normal file
View File

@@ -0,0 +1,54 @@
/* -*- 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 jsdtoa_h___
#define jsdtoa_h___
/*
* Public interface to portable double-precision floating point to string
* and back conversion package.
*/
#include "jscompat.h"
JS_BEGIN_EXTERN_C
/*
* PR_strtod() returns as a double-precision floating-point number
* the value represented by the character string pointed to by
* s00. The string is scanned up to the first unrecognized
* character.
* If the value of se is not (char **)NULL, a pointer to
* the character terminating the scan is returned in the location pointed
* to by se. If no number can be formed, se is set to s00r, and
* zero is returned.
*/
extern PUBLIC_API(double)
PR_strtod(const char *s00, char **se);
/*
* PR_cnvtf()
* conversion routines for floating point
* prcsn - number of digits of precision to generate floating
* point value.
*/
extern PUBLIC_API(void)
PR_cnvtf(char *buf, intN bufsz, intN prcsn, double dval);
JS_END_EXTERN_C
#endif /* jsdtoa_h___ */

2508
mozilla/js/src/jsemit.c Normal file

File diff suppressed because it is too large Load Diff

366
mozilla/js/src/jsemit.h Normal file
View File

@@ -0,0 +1,366 @@
/* -*- 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 jsemit_h___
#define jsemit_h___
/*
* JS bytecode generation.
*/
#include "jsstddef.h"
#include "jstypes.h"
#include "jsatom.h"
#include "jsopcode.h"
#include "jsprvtd.h"
#include "jspubtd.h"
JS_BEGIN_EXTERN_C
typedef enum JSStmtType {
STMT_BLOCK = 0, /* compound statement: { s1[;... sN] } */
STMT_LABEL = 1, /* labeled statement: l: s */
STMT_IF = 2, /* if (then) statement */
STMT_ELSE = 3, /* else statement */
STMT_SWITCH = 4, /* switch statement */
STMT_WITH = 5, /* with statement */
STMT_TRY = 6, /* try statement */
STMT_CATCH = 7, /* catch block */
STMT_FINALLY = 8, /* finally statement */
STMT_DO_LOOP = 9, /* do/while loop statement */
STMT_FOR_LOOP = 10, /* for loop statement */
STMT_FOR_IN_LOOP = 11, /* for/in loop statement */
STMT_WHILE_LOOP = 12 /* while loop statement */
} JSStmtType;
#define STMT_IS_LOOP(stmt) ((stmt)->type >= STMT_DO_LOOP)
typedef struct JSStmtInfo JSStmtInfo;
struct JSStmtInfo {
JSStmtType type; /* statement type */
ptrdiff_t top; /* offset of loop top from cg base */
ptrdiff_t update; /* loop update offset (top if none) */
ptrdiff_t breaks; /* offset of last break in loop */
ptrdiff_t continues; /* offset of last continue in loop */
JSAtom *label; /* label name if type is STMT_LABEL */
JSStmtInfo *down; /* info for enclosing statement */
};
#define SET_STATEMENT_TOP(stmt, top) \
((stmt)->top = (stmt)->update = (top), (stmt)->breaks = (stmt)->continues = (-1))
struct JSTreeContext { /* tree context for semantic checks */
uint32 flags; /* statement state flags, see below */
uint32 tryCount; /* total count of try statements parsed */
JSStmtInfo *topStmt; /* top of statement info stack */
};
#define TCF_IN_FUNCTION 0x01 /* parsing inside function body */
#define TCF_RETURN_EXPR 0x02 /* function has 'return expr;' */
#define TCF_RETURN_VOID 0x04 /* function has 'return;' */
#define TCF_IN_FOR_INIT 0x08 /* parsing init expr of for; exclude 'in' */
#define TREE_CONTEXT_INIT(tc) \
((tc)->flags = 0, (tc)->tryCount = 0, (tc)->topStmt = NULL)
struct JSCodeGenerator {
void *codeMark; /* low watermark in cx->codePool */
void *tempMark; /* low watermark in cx->tempPool */
jsbytecode *base; /* base of JS bytecode vector */
jsbytecode *limit; /* one byte beyond end of bytecode */
jsbytecode *next; /* pointer to next free bytecode */
const char *filename; /* null or weak link to source filename */
uintN firstLine; /* first line, for js_NewScriptFromCG */
uintN currentLine; /* line number for tree-based srcnote gen */
JSPrincipals *principals; /* principals for constant folding eval */
JSTreeContext treeContext; /* for break/continue code generation */
JSAtomList atomList; /* literals indexed for mapping */
intN stackDepth; /* current stack depth in basic block */
uintN maxStackDepth; /* maximum stack depth so far */
jssrcnote *notes; /* source notes, see below */
uintN noteCount; /* number of source notes so far */
ptrdiff_t lastNoteOffset; /* code offset for last source note */
JSTryNote *tryBase; /* first exception handling note */
JSTryNote *tryNext; /* next available note */
size_t tryNoteSpace; /* # of bytes allocated at tryBase */
};
#define CG_CODE(cg,offset) ((cg)->base + (offset))
#define CG_OFFSET(cg) PTRDIFF((cg)->next, (cg)->base, jsbytecode)
/*
* Initialize cg to allocate bytecode space from cx->codePool, and srcnote
* space from cx->tempPool. Return true on success. Report an error and
* return false if the initial code segment can't be allocated.
*/
extern JS_FRIEND_API(JSBool)
js_InitCodeGenerator(JSContext *cx, JSCodeGenerator *cg,
const char *filename, uintN lineno,
JSPrincipals *principals);
/*
* Release cx->codePool and cx->tempPool to marks set by js_InitCodeGenerator.
*/
extern JS_FRIEND_API(void)
js_ResetCodeGenerator(JSContext *cx, JSCodeGenerator *cg);
/*
* Emit one bytecode.
*/
extern ptrdiff_t
js_Emit1(JSContext *cx, JSCodeGenerator *cg, JSOp op);
/*
* Emit two bytecodes, an opcode (op) with a byte of immediate operand (op1).
*/
extern ptrdiff_t
js_Emit2(JSContext *cx, JSCodeGenerator *cg, JSOp op, jsbytecode op1);
/*
* Emit three bytecodes, an opcode with two bytes of immediate operands.
*/
extern ptrdiff_t
js_Emit3(JSContext *cx, JSCodeGenerator *cg, JSOp op, jsbytecode op1,
jsbytecode op2);
/*
* Emit (1 + extra) bytecodes, for N bytes of op and its immediate operand.
*/
extern ptrdiff_t
js_EmitN(JSContext *cx, JSCodeGenerator *cg, JSOp op, size_t extra);
/*
* Unsafe macro to call js_SetJumpOffset and return false if it does.
*/
#define CHECK_AND_SET_JUMP_OFFSET(cx,cg,pc,off) \
JS_BEGIN_MACRO \
if (!js_SetJumpOffset(cx, cg, pc, off)) \
return JS_FALSE; \
JS_END_MACRO
#define CHECK_AND_SET_JUMP_OFFSET_AT(cx,cg,off) \
CHECK_AND_SET_JUMP_OFFSET(cx, cg, CG_CODE(cg,off), CG_OFFSET(cg) - (off))
extern JSBool
js_SetJumpOffset(JSContext *cx, JSCodeGenerator *cg, jsbytecode *pc,
ptrdiff_t off);
/*
* Push the C-stack-allocated struct at stmt onto the stmtInfo stack.
*/
extern void
js_PushStatement(JSTreeContext *tc, JSStmtInfo *stmt, JSStmtType type,
ptrdiff_t top);
/*
* Emit a break instruction, recording it for backpatching.
*/
extern ptrdiff_t
js_EmitBreak(JSContext *cx, JSCodeGenerator *cg, JSStmtInfo *stmt,
JSAtomListElement *label);
/*
* Emit a continue instruction, recording it for backpatching.
*/
extern ptrdiff_t
js_EmitContinue(JSContext *cx, JSCodeGenerator *cg, JSStmtInfo *stmt,
JSAtomListElement *label);
/*
* Pop tc->topStmt. If the top JSStmtInfo struct is not stack-allocated, it
* is up to the caller to free it.
*/
extern void
js_PopStatement(JSTreeContext *tc);
/*
* Like js_PopStatement(&cg->treeContext), also patch breaks and continues.
* May fail if a jump offset overflows.
*/
extern JSBool
js_PopStatementCG(JSContext *cx, JSCodeGenerator *cg);
/*
* Emit code into cg for the tree rooted at pn.
*/
extern JSBool
js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn);
/*
* Emit code into cg for the tree rooted at body, then create a persistent
* script for fun from cg.
*/
extern JSBool
js_EmitFunctionBody(JSContext *cx, JSCodeGenerator *cg, JSParseNode *body,
JSFunction *fun);
/*
* Source notes generated along with bytecode for decompiling and debugging.
* A source note is a uint8 with 5 bits of type and 3 of offset from the pc of
* the previous note. If 3 bits of offset aren't enough, extended delta notes
* (SRC_XDELTA) consisting of 2 set high order bits followed by 6 offset bits
* are emitted before the next note. Some notes have operand offsets encoded
* immediately after them, in note bytes or byte-triples.
*
* At most one "gettable" note (i.e., a note of type other than SRC_NEWLINE,
* SRC_SETLINE, and SRC_XDELTA) applies to a given bytecode.
*
* NB: the js_SrcNoteName and js_SrcNoteArity arrays in jsemit.c are indexed
* by this enum, so their initializers need to match the order here.
*/
typedef enum JSSrcNoteType {
SRC_NULL = 0, /* terminates a note vector */
SRC_IF = 1, /* JSOP_IFEQ bytecode is from an if-then */
SRC_IF_ELSE = 2, /* JSOP_IFEQ bytecode is from an if-then-else */
SRC_WHILE = 3, /* JSOP_IFEQ is from a while loop */
SRC_FOR = 4, /* JSOP_NOP or JSOP_POP in for loop head */
SRC_CONTINUE = 5, /* JSOP_GOTO is a continue, not a break;
also used on JSOP_ENDINIT if extra comma
at end of array literal: [1,2,,] */
SRC_VAR = 6, /* JSOP_NAME/FORNAME with a var declaration */
SRC_PCDELTA = 7, /* offset from comma-operator to next POP,
or from CONDSWITCH to first CASE opcode */
SRC_ASSIGNOP = 8, /* += or another assign-op follows */
SRC_COND = 9, /* JSOP_IFEQ is from conditional ?: operator */
SRC_PAREN = 10, /* JSOP_NOP generated to mark user parens */
SRC_HIDDEN = 11, /* opcode shouldn't be decompiled */
SRC_PCBASE = 12, /* offset of first obj.prop.subprop bytecode */
SRC_LABEL = 13, /* JSOP_NOP for label: with atomid immediate */
SRC_LABELBRACE = 14, /* JSOP_NOP for label: {...} begin brace */
SRC_ENDBRACE = 15, /* JSOP_NOP for label: {...} end brace */
SRC_BREAK2LABEL = 16, /* JSOP_GOTO for 'break label' with atomid */
SRC_CONT2LABEL = 17, /* JSOP_GOTO for 'continue label' with atomid */
SRC_SWITCH = 18, /* JSOP_*SWITCH with offset to end of switch,
2nd off to first JSOP_CASE if condswitch */
SRC_FUNCDEF = 19, /* JSOP_NOP for function f() with atomid */
SRC_TRYFIN = 20, /* JSOP_NOP for try or finally section */
SRC_CATCH = 21, /* catch block has guard */
SRC_NEWLINE = 22, /* bytecode follows a source newline */
SRC_SETLINE = 23, /* a file-absolute source line number note */
SRC_XDELTA = 24 /* 24-31 are for extended delta notes */
} JSSrcNoteType;
#define SN_TYPE_BITS 5
#define SN_DELTA_BITS 3
#define SN_XDELTA_BITS 6
#define SN_TYPE_MASK (JS_BITMASK(SN_TYPE_BITS) << SN_DELTA_BITS)
#define SN_DELTA_MASK ((ptrdiff_t)JS_BITMASK(SN_DELTA_BITS))
#define SN_XDELTA_MASK ((ptrdiff_t)JS_BITMASK(SN_XDELTA_BITS))
#define SN_MAKE_NOTE(sn,t,d) (*(sn) = (jssrcnote) \
(((t) << SN_DELTA_BITS) \
| ((d) & SN_DELTA_MASK)))
#define SN_MAKE_XDELTA(sn,d) (*(sn) = (jssrcnote) \
((SRC_XDELTA << SN_DELTA_BITS) \
| ((d) & SN_XDELTA_MASK)))
#define SN_IS_XDELTA(sn) ((*(sn) >> SN_DELTA_BITS) >= SRC_XDELTA)
#define SN_TYPE(sn) (SN_IS_XDELTA(sn) ? SRC_XDELTA \
: *(sn) >> SN_DELTA_BITS)
#define SN_SET_TYPE(sn,type) SN_MAKE_NOTE(sn, type, SN_DELTA(sn))
#define SN_IS_GETTABLE(sn) (SN_TYPE(sn) < SRC_NEWLINE)
#define SN_DELTA(sn) ((ptrdiff_t)(SN_IS_XDELTA(sn) \
? *(sn) & SN_XDELTA_MASK \
: *(sn) & SN_DELTA_MASK))
#define SN_SET_DELTA(sn,delta) (SN_IS_XDELTA(sn) \
? SN_MAKE_XDELTA(sn, delta) \
: SN_MAKE_NOTE(sn, SN_TYPE(sn), delta))
#define SN_DELTA_LIMIT ((ptrdiff_t)JS_BIT(SN_DELTA_BITS))
#define SN_XDELTA_LIMIT ((ptrdiff_t)JS_BIT(SN_XDELTA_BITS))
/*
* Offset fields follow certain notes and are frequency-encoded: an offset in
* [0,0x7f] consumes one byte, an offset in [0x80,0x7fffff] takes three, and
* the high bit of the first byte is set.
*/
#define SN_3BYTE_OFFSET_FLAG 0x80
#define SN_3BYTE_OFFSET_MASK 0x7f
extern JS_FRIEND_DATA(const char *) js_SrcNoteName[];
extern JS_FRIEND_DATA(uint8) js_SrcNoteArity[];
extern JS_FRIEND_DATA(uintN) js_SrcNoteLength(jssrcnote *sn);
#define SN_LENGTH(sn) ((js_SrcNoteArity[SN_TYPE(sn)] == 0) ? 1 \
: js_SrcNoteLength(sn))
#define SN_NEXT(sn) ((sn) + SN_LENGTH(sn))
/* A source note array is terminated by an all-zero element. */
#define SN_MAKE_TERMINATOR(sn) (*(sn) = SRC_NULL)
#define SN_IS_TERMINATOR(sn) (*(sn) == SRC_NULL)
/*
* Append a new source note of the given type (and therefore size) to cg's
* notes dynamic array, updating cg->noteCount. Return the new note's index
* within the array pointed at by cg->notes. Return -1 if out of memory.
*/
extern intN
js_NewSrcNote(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type);
extern intN
js_NewSrcNote2(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type,
ptrdiff_t offset);
extern intN
js_NewSrcNote3(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type,
ptrdiff_t offset1, ptrdiff_t offset2);
/*
* Get and set the offset operand identified by which (0 for the first, etc.).
*/
extern JS_FRIEND_API(ptrdiff_t)
js_GetSrcNoteOffset(jssrcnote *sn, uintN which);
extern JSBool
js_SetSrcNoteOffset(JSContext *cx, JSCodeGenerator *cg, uintN index,
uintN which, ptrdiff_t offset);
/*
* Finish taking source notes in cx's tempPool by copying them to new
* stable store allocated via JS_malloc. Return null on malloc failure,
* which means this function reported an error.
*/
extern jssrcnote *
js_FinishTakingSrcNotes(JSContext *cx, JSCodeGenerator *cg);
/*
* Allocate cg->treeContext.tryCount notes (plus one for the end sentinel)
* from cx->tempPool and set up cg->tryBase/tryNext for exactly tryCount
* js_NewTryNote calls. The storage is freed by js_ResetCodeGenerator.
*/
extern JSBool
js_AllocTryNotes(JSContext *cx, JSCodeGenerator *cg);
/*
* Grab the next trynote slot in cg, filling it in appropriately.
*/
extern JSTryNote *
js_NewTryNote(JSContext *cx, JSCodeGenerator *cg, ptrdiff_t start,
ptrdiff_t end, ptrdiff_t catchStart);
/*
* Finish generating exception information, and copy it to JS_malloc
* storage.
*/
extern JSBool
js_FinishTakingTryNotes(JSContext *cx, JSCodeGenerator *cg, JSTryNote **tryp);
JS_END_EXTERN_C
#endif /* jsemit_h___ */

477
mozilla/js/src/jsexn.c Normal file
View File

@@ -0,0 +1,477 @@
/* -*- 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.
*/
/*
* JS standard exception implementation.
*/
/*
* This is currently very messy, and in flux. Don't anybody think
* I'm going to leave it like this. No no.
*/
#include "jsstddef.h"
#include "jstypes.h"
/* Removed by JSIFY: #include "prlog.h" */
#include "jsutil.h" /* Added by JSIFY */
#include "jsprf.h"
#include "jsapi.h"
#include "jscntxt.h"
#include "jsconfig.h"
#include "jsexn.h"
#if JS_HAS_ERROR_EXCEPTIONS
#if !JS_HAS_EXCEPTIONS
# error "JS_HAS_EXCEPTIONS must be defined to use JS_HAS_ERROR_EXCEPTIONS"
#endif
JSObject *tlobj;
/*
* This could end up just being the error report, but I
* want to learn how to support random garbage here.
*
* If I go with it, a rambling comment mentioning GC, memory management etc. is
* needed.
*
* I'd rather have the errorReport inline, to avoid the extra malloc'd object
* dangle. But I'll figure that out later, if I still need it.
*/
typedef struct JSExnPrivate {
JSErrorReport *errorReport;
const char *message;
} JSExnPrivate;
/*
* Copy everything interesting about an error into allocated memory.
*/
static JSExnPrivate *
exn_initPrivate(JSContext *cx, JSErrorReport *report, const char *message)
{
JSExnPrivate *newPrivate;
JSErrorReport * newReport;
char *newMessage;
newPrivate = (JSExnPrivate *)JS_malloc(cx, sizeof (JSExnPrivate));
JS_ASSERT(message);
newMessage = (char *)JS_malloc(cx, strlen(message)+1);
strcpy(newMessage, message);
newPrivate->message = newMessage;
/* Copy the error report */
newReport = (JSErrorReport *)JS_malloc(cx, sizeof (JSErrorReport));
if (report->filename) {
newReport->filename =
(const char *)JS_malloc(cx, strlen(report->filename)+1);
/* Ack. Const! */
strcpy((char *)newReport->filename, report->filename);
} else {
newReport->filename = NULL;
}
newReport->lineno = report->lineno;
/*
* We don't need to copy linebuf and tokenptr, because they
* point into the deflated string cache. (currently?)
*/
newReport->linebuf = report->linebuf;
newReport->tokenptr = report->tokenptr;
/*
* But we do need to copy uclinebuf, uctokenptr, because they're
* pointers into internal tokenstream structs, and may go away.
* But only if they're non-null...
*
* NOTE nothing uses this and I'm not really maintaining it until
* I know it's the desired API.
*
* Temporarily disabled, because uclinebuf is 0x10 when I evaluate 'Math()'!
*/
#if 0
if (report->uclinebuf) {
size_t len = js_strlen(report->uclinebuf)+1;
newReport->uclinebuf =
(const jschar *)JS_malloc(cx, len);
js_strncpy(newReport->uclinebuf, report->uclinebuf, len);
newReport->uctokenptr = newReport->uclinebuf + (report->uctokenptr -
report->uclinebuf);
} else
#endif
newReport->uclinebuf = newReport->uctokenptr = NULL;
/* Note that this is before it gets flagged with JSREPORT_EXCEPTION */
newReport->flags = report->flags;
/* Skipping *ucmessage, **messageArgs for now. My guess is that it'll just
* mean copying the pointers, and adding another GC root. Then de-rooting
* them in the finalizer. Dunno if they're rooted in the first place -
* maybe it's only relevant for an exception that goes where it pleases,
* and not for the formerly stack-bound use of the error report.
*/
newPrivate->errorReport = newReport;
return newPrivate;
}
/*
* Undo all the damage done by exn_initPrivate.
*/
static void
exn_destroyPrivate(JSContext *cx, JSExnPrivate *privateData)
{
JS_ASSERT(privateData->message);
/* ! what does const do? */
JS_free(cx, (void *)privateData->message);
JS_ASSERT(privateData->errorReport);
if (privateData->errorReport->uclinebuf)
JS_free(cx, (void *)privateData->errorReport->uclinebuf);
if (privateData->errorReport->filename)
JS_free(cx, (void *)privateData->errorReport->filename);
JS_free(cx, privateData->errorReport);
JS_free(cx, privateData);
}
/* Destroy associated data... */
static void
exn_finalize(JSContext *cx, JSObject *obj)
{
JSExnPrivate *privateData;
privateData = (JSExnPrivate *)
JSVAL_TO_PRIVATE(OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE));
if (privateData) {
exn_destroyPrivate(cx, privateData);
}
}
/* This must be kept in synch with the exceptions array below. */
typedef enum JSExnType {
JSEXN_NONE = -1,
JSEXN_EXCEPTION,
JSEXN_ERR,
JSEXN_INTERNALERR,
JSEXN_SYNTAXERR,
JSEXN_REFERENCEERR,
JSEXN_CALLERR,
JSEXN_TARGETERR,
JSEXN_CONSTRUCTORERR,
JSEXN_CONVERSIONERR,
JSEXN_TOOBJECTERR,
JSEXN_TOPRIMITIVEERR,
JSEXN_DEFAULTVALUEERR,
JSEXN_ARRAYERR,
JSEXN_LIMIT
} JSExnType;
#define FLAGS JSCLASS_HAS_PRIVATE
/* Maybe #define RANDOM_CLASS(name, prototype) 4 here? */
struct JSExnSpec {
int protoIndex;
JSClass theclass;
};
/*
* I want to replace all of these with just one class. All we really care
* about is the prototypes, and the constructor names.
*/
static struct JSExnSpec exceptions[] = {
{ JSEXN_NONE, /* No proto? */ {
"Exception", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_EXCEPTION, {
"Error", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_ERR, {
"InternalError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_ERR, {
"SyntaxError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_ERR, {
"ReferenceError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_ERR, {
"CallError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_CALLERR, {
"TargetError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_ERR, {
"ConstructorError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_ERR, {
"ConversionError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_CONVERSIONERR, {
"ToObjectError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_CONVERSIONERR, {
"ToPrimitiveError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_CONVERSIONERR, {
"DefaultValueError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{ JSEXN_ERR, {
"ArrayError", FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize
} },
{0}
};
static JSBool
Exception(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
if (!cx->fp->constructing) {
return JS_TRUE;
}
/* gotta null out that private data */
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, JSVAL_NULL);
return JS_TRUE;
}
/*
* Convert to string. Much of this is taken from js.c.
*
* I should rewrite this to use message, line, file etc. from
* javascript-modifiable properties (which might be lazily created
* from the encapsulated error report.)
*/
static JSBool
exn_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSString *str;
JSExnPrivate *privateData;
JSErrorReport *report;
jsval v;
char *name;
JSClass *theclass;
/* Check needed against incompatible target... */
/* Try to include the exception name in the error message. */
theclass = OBJ_GET_CLASS(cx, obj);
name = theclass->name;
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
if (!JSVAL_IS_NULL(v)) {
char *msgbuf, *tmp;
privateData = JSVAL_TO_PRIVATE(v);
report = privateData->errorReport;
msgbuf = JS_smprintf("%s:", name);
if (report->filename) {
tmp = msgbuf;
msgbuf = JS_smprintf("%s%s:", tmp, report->filename);
JS_free(cx, tmp);
}
if (report->lineno) {
tmp = msgbuf;
msgbuf = JS_smprintf("%s%u: ", tmp ? tmp : "", report->lineno);
if (tmp)
JS_free(cx, tmp);
}
JS_ASSERT(privateData->message);
tmp = msgbuf;
msgbuf = JS_smprintf("%s%s", tmp ? tmp : "", privateData->message);
if(tmp)
JS_free(cx, tmp);
str = JS_NewStringCopyZ(cx, msgbuf);
} else {
str = JS_NewStringCopyZ(cx, "some non-engine-thrown exception");
}
if (!str)
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
}
static JSFunctionSpec exception_methods[] = {
{js_toString_str, exn_toString, 0},
{0}
};
JSObject *
js_InitExceptionClasses(JSContext *cx, JSObject *obj)
{
JSObject *protos[JSEXN_LIMIT];
int i;
for (i = 0; exceptions[i].theclass.name != 0; i++) {
int protoidx = exceptions[i].protoIndex;
protos[i] = JS_InitClass(cx, obj,
((protoidx >= 0) ? protos[protoidx] : NULL),
&(exceptions[i].theclass),
Exception, 1,
NULL,
exception_methods,
NULL,
NULL);
/* So finalize knows whether to. */
OBJ_SET_SLOT(cx, protos[i], JSSLOT_PRIVATE, JSVAL_NULL);
}
/*
* JS_InitClass magically replaces a null prototype with Object.prototype,
* so we need to explicitly assign to the proto slot to get null.
*
* Temporarily disabled until I do toString for Exception.
*/
/* protos[0]->slots[JSSLOT_PROTO] = JSVAL_NULL; */
return protos[0];
}
static JSErrorReport *
js_GetErrorFromException(JSContext *cx, JSObject *errobj)
{
JSExnPrivate *privateData;
#if 0
{
JSClass *errobjclass;
/* Assert that we have an Exception object */
/* This assert does the right thing, but we can't use it yet, because
* we're throwing lots of different exception classes. */
errobjclass = OBJ_GET_CLASS(cx, errobj);
JS_ASSERT(errobjclass == &(exceptions[JSEXN_CALLERR].theclass));
}
#endif
privateData = JSVAL_TO_PRIVATE(OBJ_GET_SLOT(cx, errobj, JSSLOT_PRIVATE));
/* Still OK to return NULL, tho. */
return privateData->errorReport;
}
static JSExnType errorToException[] = {
#define MSG_DEF(name, number, count, exception, format) \
exception,
#include "js.msg"
#undef MSG_DEF
};
#if defined ( DEBUG_mccabe ) && defined ( PRINTNAMES )
/* For use below... get character strings for error name and exception name */
static struct exnname { char *name; char *exception; } errortoexnname[] = {
#define MSG_DEF(name, number, count, exception, format) \
{#name, #exception},
#include "js.msg"
#undef MSG_DEF
};
#endif /* DEBUG */
JSBool
js_ErrorToException(JSContext *cx, JSErrorReport *reportp, const char *message)
{
JSErrNum errorNumber;
JSObject *errobj;
JSExnType exn;
JSExnPrivate *privateData;
JS_ASSERT(reportp);
errorNumber = reportp->errorNumber;
exn = errorToException[errorNumber];
JS_ASSERT(exn < JSEXN_LIMIT);
#if defined( DEBUG_mccabe ) && defined ( PRINTNAMES )
/* Print the error name and the associated exception name to stderr */
fprintf(stderr, "%s\t%s\n",
errortoexnname[errorNumber].name,
errortoexnname[errorNumber].exception);
#endif
/*
* Return false (no exception raised) if no exception is associated
* with the given error number.
*/
if (exn == JSEXN_NONE)
return JS_FALSE;
/*
* Should (?) be js_ConstructObject... switching to NewObject
* in the speculation that it won't require a frame. DefaultValue trouble.
* And it seems to work???? For the record, the trouble was that
* cx->fp was null when trying to construct the object...
*/
errobj = js_NewObject(cx,
&(exceptions[exn].theclass),
NULL, NULL);
/*
* Construct a new copy of the error report, and store it in the
* exception objects' private data. We can't use the error report
* handed in, because it's stack-allocated, and may point to transient
* data in the JSTokenStream.
*/
/* XXX report failure? */
privateData = exn_initPrivate(cx, reportp, message);
OBJ_SET_SLOT(cx, errobj, JSSLOT_PRIVATE, PRIVATE_TO_JSVAL(privateData));
JS_SetPendingException(cx, OBJECT_TO_JSVAL(errobj));
reportp->flags |= JSREPORT_EXCEPTION;
return JS_TRUE;
}
#endif /* JS_HAS_ERROR_EXCEPTIONS */

47
mozilla/js/src/jsexn.h Normal file
View File

@@ -0,0 +1,47 @@
/* -*- 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.
*/
/*
* JS runtime exception classes.
*/
#ifndef jsexn_h___
#define jsexn_h___
JS_BEGIN_EXTERN_C
/*
* Initialize exception object hierarchy.
*/
extern JSObject *
js_InitExceptionClasses(JSContext *cx, JSObject *obj);
/*
* Given a JSErrorReport, check to see if there is an exception associated
* with the error number. If there is, then create an appropriate exception
* object, set it as the pending exception, and set the JSREPORT_EXCEPTION
* flag on the error report. Exception-aware host error reporters will
* know to ignore error reports so flagged. Returns JS_TRUE if an associated
* exception is found, JS_FALSE if none.
*/
extern JSBool
js_ErrorToException(JSContext *cx, JSErrorReport *reportp, const char *message);
JS_END_EXTERN_C
#endif /* jsexn_h___ */

1771
mozilla/js/src/jsfun.c Normal file

File diff suppressed because it is too large Load Diff

106
mozilla/js/src/jsfun.h Normal file
View File

@@ -0,0 +1,106 @@
/* -*- 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 jsfun_h___
#define jsfun_h___
/*
* JS function definitions.
*/
#include "jsprvtd.h"
#include "jspubtd.h"
JS_BEGIN_EXTERN_C
struct JSFunction {
jsrefcount nrefs; /* number of referencing objects */
JSObject *object; /* back-pointer to GC'ed object header */
JSNative call; /* native method pointer or null */
uint16 nargs; /* minimum number of actual arguments */
uint16 extra; /* number of arg slots for local GC roots */
uint16 nvars; /* number of local variables */
uint8 flags; /* bound method and other flags, see jsapi.h */
uint8 spare; /* reserved for future use */
JSAtom *atom; /* name for diagnostics and decompiling */
JSScript *script; /* interpreted bytecode descriptor or null */
};
extern JSClass js_ArgumentsClass;
extern JSClass js_CallClass;
extern JSClass js_ClosureClass;
/* JS_FRIEND_DATA so that JSVAL_IS_FUNCTION is callable from outside */
extern JS_FRIEND_DATA(JSClass) js_FunctionClass;
/*
* NB: jsapi.h and jsobj.h must be included before any call to this macro.
*/
#define JSVAL_IS_FUNCTION(cx, v) \
(JSVAL_IS_OBJECT(v) && JSVAL_TO_OBJECT(v) && \
OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == &js_FunctionClass)
extern JSBool
js_IsIdentifier(JSString *str);
extern JSObject *
js_InitFunctionClass(JSContext *cx, JSObject *obj);
extern JSBool
js_InitArgsCallClosureClasses(JSContext *cx, JSObject *obj,
JSObject *arrayProto);
extern JSFunction *
js_NewFunction(JSContext *cx, JSObject *funobj, JSNative call, uintN nargs,
uintN flags, JSObject *parent, JSAtom *atom);
extern JSBool
js_LinkFunctionObject(JSContext *cx, JSFunction *fun, JSObject *object);
extern JSFunction *
js_DefineFunction(JSContext *cx, JSObject *obj, JSAtom *atom, JSNative call,
uintN nargs, uintN flags);
extern JSFunction *
js_ValueToFunction(JSContext *cx, jsval *vp, JSBool constructing);
extern void
js_ReportIsNotFunction(JSContext *cx, jsval *vp, JSBool constructing);
extern JSObject *
js_GetCallObject(JSContext *cx, JSStackFrame *fp, JSObject *parent,
JSObject *withobj);
extern JSBool
js_PutCallObject(JSContext *cx, JSStackFrame *fp);
extern JSBool
js_GetCallVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
extern JSBool
js_SetCallVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
extern JSObject *
js_GetArgsObject(JSContext *cx, JSStackFrame *fp);
extern JSBool
js_PutArgsObject(JSContext *cx, JSStackFrame *fp);
extern JSBool
js_XDRFunction(JSXDRState *xdr, JSObject **objp);
JS_END_EXTERN_C
#endif /* jsfun_h___ */

925
mozilla/js/src/jsgc.c Normal file
View File

@@ -0,0 +1,925 @@
/* -*- 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.
*/
/*
* JS Mark-and-Sweep Garbage Collector.
*
* This GC allocates only fixed-sized things big enough to contain two words
* (pointers) on any host architecture. It allocates from an arena pool (see
* jsarena.h). It uses a parallel arena-pool array of flag bytes to hold the
* mark bit, finalizer type index, etc.
*
* XXX swizzle page to freelist for better locality of reference
*/
#include "jsstddef.h"
#include <stdlib.h> /* for free, called by JS_ARENA_DESTROY */
#include <string.h> /* for memset, called by jsarena.h macros if DEBUG */
#include "jstypes.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 */
#ifndef NSPR20
#include "jshash.h"
#else
/* Removed by JSIFY: #include "JShash.h"
*/
#include "jshash.h" /* Added by JSIFY */
#endif
#include "jsapi.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsfun.h"
#include "jsgc.h"
#include "jsinterp.h"
#include "jslock.h"
#include "jsnum.h"
#include "jsobj.h"
#include "jsscope.h"
#include "jsscript.h"
#include "jsstr.h"
/*
* Arena sizes, the first must be a multiple of the second so the two arena
* pools can be maintained (in particular, arenas may be destroyed from the
* middle of each pool) in parallel.
*/
#define GC_ARENA_SIZE 8192 /* 1024 (512 on Alpha) objects */
#define GC_FLAGS_SIZE (GC_ARENA_SIZE / sizeof(JSGCThing))
#define GC_ROOTS_SIZE 256 /* SWAG, small enough to amortize */
static JSHashNumber gc_hash_root(const void *key);
struct JSGCThing {
JSGCThing *next;
uint8 *flagp;
};
typedef void (*GCFinalizeOp)(JSContext *cx, JSGCThing *thing);
static GCFinalizeOp gc_finalizers[GCX_NTYPES];
#ifdef JS_GCMETER
#define METER(x) x
#else
#define METER(x) /* nothing */
#endif
JSBool
js_InitGC(JSRuntime *rt, uint32 maxbytes)
{
if (!gc_finalizers[GCX_OBJECT]) {
gc_finalizers[GCX_OBJECT] = (GCFinalizeOp)js_FinalizeObject;
gc_finalizers[GCX_STRING] = (GCFinalizeOp)js_FinalizeString;
gc_finalizers[GCX_DOUBLE] = (GCFinalizeOp)js_FinalizeDouble;
}
JS_InitArenaPool(&rt->gcArenaPool, "gc-arena", GC_ARENA_SIZE,
sizeof(JSGCThing));
JS_InitArenaPool(&rt->gcFlagsPool, "gc-flags", GC_FLAGS_SIZE,
sizeof(uint8));
rt->gcRootsHash = JS_NewHashTable(GC_ROOTS_SIZE, gc_hash_root,
JS_CompareValues, JS_CompareValues,
NULL, NULL);
if (!rt->gcRootsHash)
return JS_FALSE;
rt->gcMaxBytes = maxbytes;
return JS_TRUE;
}
#ifdef JS_GCMETER
void
js_DumpGCStats(JSRuntime *rt, FILE *fp)
{
fprintf(fp, "\nGC allocation statistics:\n");
fprintf(fp, " bytes currently allocated: %lu\n", rt->gcBytes);
fprintf(fp, " alloc attempts: %lu\n", rt->gcStats.alloc);
fprintf(fp, " GC freelist length: %lu\n", rt->gcStats.freelen);
fprintf(fp, " recycles through GC freelist: %lu\n", rt->gcStats.recycle);
fprintf(fp, "alloc retries after running GC: %lu\n", rt->gcStats.retry);
fprintf(fp, " allocation failures: %lu\n", rt->gcStats.fail);
fprintf(fp, " valid lock calls: %lu\n", rt->gcStats.lock);
fprintf(fp, " valid unlock calls: %lu\n", rt->gcStats.unlock);
fprintf(fp, " locks that hit stuck counts: %lu\n", rt->gcStats.stuck);
fprintf(fp, " unlocks that saw stuck counts: %lu\n", rt->gcStats.unstuck);
fprintf(fp, " mark recursion depth: %lu\n", rt->gcStats.depth);
fprintf(fp, " maximum mark recursion depth: %lu\n", rt->gcStats.maxdepth);
fprintf(fp, " maximum GC nesting level: %lu\n", rt->gcStats.maxlevel);
fprintf(fp, " potentially useful GC calls: %lu\n", rt->gcStats.poke);
fprintf(fp, " useless GC calls: %lu\n", rt->gcStats.nopoke);
fprintf(fp, " thing arena corruption: %lu\n", rt->gcStats.badarena);
fprintf(fp, " flags arena corruption: %lu\n", rt->gcStats.badflag);
fprintf(fp, " thing arenas freed so far: %lu\n", rt->gcStats.afree);
fprintf(fp, " flags arenas freed so far: %lu\n", rt->gcStats.fafree);
#ifdef JS_ARENAMETER
JS_DumpArenaStats(fp);
#endif
}
#endif
void
js_FinishGC(JSRuntime *rt)
{
#ifdef JS_ARENAMETER
JS_DumpArenaStats(stdout);
#endif
#ifdef JS_GCMETER
js_DumpGCStats(rt, stdout);
#endif
JS_FinishArenaPool(&rt->gcArenaPool);
JS_FinishArenaPool(&rt->gcFlagsPool);
JS_ArenaFinish();
JS_HashTableDestroy(rt->gcRootsHash);
rt->gcRootsHash = NULL;
rt->gcFreeList = NULL;
}
JSBool
js_AddRoot(JSContext *cx, void *rp, const char *name)
{
JSRuntime *rt;
JSBool ok;
rt = cx->runtime;
JS_LOCK_GC_VOID(rt,
ok = (JS_HashTableAdd(rt->gcRootsHash, rp, (void *)name) != NULL));
if (!ok)
JS_ReportOutOfMemory(cx);
return ok;
}
JSBool
js_RemoveRoot(JSContext *cx, void *rp)
{
JSRuntime *rt;
rt = cx->runtime;
JS_LOCK_GC_VOID(rt, JS_HashTableRemove(rt->gcRootsHash, rp));
return JS_TRUE;
}
void *
js_AllocGCThing(JSContext *cx, uintN flags)
{
JSRuntime *rt;
JSGCThing *thing;
uint8 *flagp;
#ifdef TOO_MUCH_GC
JSBool tried_gc = JS_TRUE;
js_GC(cx);
#else
JSBool tried_gc = JS_FALSE;
#endif
rt = cx->runtime;
JS_LOCK_GC(rt);
METER(rt->gcStats.alloc++);
retry:
thing = rt->gcFreeList;
if (thing) {
rt->gcFreeList = thing->next;
flagp = thing->flagp;
METER(rt->gcStats.freelen--);
METER(rt->gcStats.recycle++);
} else {
if (rt->gcBytes < rt->gcMaxBytes) {
JS_ARENA_ALLOCATE(thing, &rt->gcArenaPool, sizeof(JSGCThing));
JS_ARENA_ALLOCATE(flagp, &rt->gcFlagsPool, sizeof(uint8));
}
if (!thing || !flagp) {
if (thing)
JS_ARENA_RELEASE(&rt->gcArenaPool, thing);
if (!tried_gc) {
JS_UNLOCK_GC(rt);
js_GC(cx);
tried_gc = JS_TRUE;
JS_LOCK_GC(rt);
METER(rt->gcStats.retry++);
goto retry;
}
METER(rt->gcStats.fail++);
JS_UNLOCK_GC(rt);
JS_ReportOutOfMemory(cx);
return NULL;
}
}
*flagp = (uint8)flags;
rt->gcBytes += sizeof(JSGCThing) + sizeof(uint8);
cx->newborn[flags & GCF_TYPEMASK] = thing;
/*
* Clear thing before unlocking in case a GC run is about to scan it,
* finding it via cx->newborn[].
*/
thing->next = NULL;
thing->flagp = NULL;
JS_UNLOCK_GC(rt);
return thing;
}
static uint8 *
gc_find_flags(JSRuntime *rt, void *thing)
{
jsuword index, offset, length;
JSArena *a, *fa;
index = 0;
for (a = rt->gcArenaPool.first.next; a; a = a->next) {
offset = JS_UPTRDIFF(thing, a->base);
length = a->avail - a->base;
if (offset < length) {
index += offset / sizeof(JSGCThing);
for (fa = rt->gcFlagsPool.first.next; fa; fa = fa->next) {
offset = fa->avail - fa->base;
if (index < offset)
return (uint8 *)fa->base + index;
index -= offset;
}
return NULL;
}
index += length / sizeof(JSGCThing);
}
return NULL;
}
JSBool
js_LockGCThing(JSContext *cx, void *thing)
{
uint8 *flagp, flags;
if (!thing)
return JS_TRUE;
flagp = gc_find_flags(cx->runtime, thing);
if (!flagp)
return JS_FALSE;
flags = *flagp;
if ((flags & GCF_LOCKMASK) != GCF_LOCKMASK) {
*flagp = (uint8)(flags + GCF_LOCK);
} else {
METER(cx->runtime->gcStats.stuck++);
}
METER(cx->runtime->gcStats.lock++);
return JS_TRUE;
}
JSBool
js_UnlockGCThing(JSContext *cx, void *thing)
{
uint8 *flagp, flags;
if (!thing)
return JS_TRUE;
flagp = gc_find_flags(cx->runtime, thing);
if (!flagp)
return JS_FALSE;
flags = *flagp;
if ((flags & GCF_LOCKMASK) != GCF_LOCKMASK) {
*flagp = (uint8)(flags - GCF_LOCK);
} else {
METER(cx->runtime->gcStats.unstuck++);
}
METER(cx->runtime->gcStats.unlock++);
return JS_TRUE;
}
#ifdef GC_MARK_DEBUG
#include <stdio.h>
#include <stdlib.h>
#include "jsprf.h"
JS_FRIEND_DATA(FILE *) js_DumpGCHeap;
JS_FRIEND_DATA(void *) js_LiveThingToFind;
typedef struct GCMarkNode GCMarkNode;
struct GCMarkNode {
void *thing;
char *name;
GCMarkNode *next;
GCMarkNode *prev;
};
static void
gc_dump_thing(JSGCThing *thing, uint8 flags, GCMarkNode *prev, FILE *fp)
{
GCMarkNode *next = NULL;
char *path = NULL;
JSObject *obj;
JSClass *clasp;
while (prev) {
next = prev;
prev = prev->prev;
}
while (next) {
path = JS_sprintf_append(path, "%s.", next->name);
next = next->next;
}
if (!path)
return;
fprintf(fp, "%08lx ", (long)thing);
switch (flags & GCF_TYPEMASK) {
case GCX_OBJECT:
obj = (JSObject *)thing;
clasp = JSVAL_TO_PRIVATE(obj->slots[JSSLOT_CLASS]);
fprintf(fp, "object %s", clasp->name);
break;
case GCX_STRING:
fprintf(fp, "string %s", JS_GetStringBytes((JSString *)thing));
break;
case GCX_DOUBLE:
fprintf(fp, "double %g", *(jsdouble *)thing);
break;
case GCX_DECIMAL:
break;
}
fprintf(fp, " via %s\n", path);
free(path);
}
static void
gc_mark_node(JSRuntime *rt, void *thing, GCMarkNode *prev);
#define GC_MARK(_rt, _thing, _name, _prev) \
JS_BEGIN_MACRO \
GCMarkNode _node; \
_node.thing = _thing; \
_node.name = _name; \
_node.next = NULL; \
_node.prev = _prev; \
if (_prev) ((GCMarkNode *)(_prev))->next = &_node; \
gc_mark_node(_rt, _thing, &_node); \
JS_END_MACRO
static void
gc_mark(JSRuntime *rt, void *thing)
{
GC_MARK(rt, thing, "atom", NULL);
}
#define GC_MARK_ATOM(rt, atom, prev) gc_mark_atom(rt, atom, prev)
#define GC_MARK_SCRIPT(rt, script, prev) gc_mark_script(rt, script, prev)
#else /* !GC_MARK_DEBUG */
#define GC_MARK(rt, thing, name, prev) gc_mark(rt, thing)
#define GC_MARK_ATOM(rt, atom, prev) gc_mark_atom(rt, atom)
#define GC_MARK_SCRIPT(rt, script, prev) gc_mark_script(rt, script)
static void
gc_mark(JSRuntime *rt, void *thing);
#endif /* !GC_MARK_DEBUG */
static void
gc_mark_atom(JSRuntime *rt, JSAtom *atom
#ifdef GC_MARK_DEBUG
, GCMarkNode *prev
#endif
)
{
jsval key;
if (!atom || atom->flags & ATOM_MARK)
return;
atom->flags |= ATOM_MARK;
key = ATOM_KEY(atom);
if (JSVAL_IS_GCTHING(key)) {
#ifdef GC_MARK_DEBUG
char name[32];
if (JSVAL_IS_STRING(key)) {
JS_snprintf(name, sizeof name, "'%s'",
JS_GetStringBytes(JSVAL_TO_STRING(key)));
} else {
JS_snprintf(name, sizeof name, "<%x>", key);
}
#endif
GC_MARK(rt, JSVAL_TO_GCTHING(key), name, prev);
}
}
static void
gc_mark_script(JSRuntime *rt, JSScript *script
#ifdef GC_MARK_DEBUG
, GCMarkNode *prev
#endif
)
{
JSAtomMap *map;
uintN i, length;
JSAtom **vector;
map = &script->atomMap;
length = map->length;
vector = map->vector;
for (i = 0; i < length; i++)
GC_MARK_ATOM(rt, vector[i], prev);
}
static void
#ifdef GC_MARK_DEBUG
gc_mark_node(JSRuntime *rt, void *thing, GCMarkNode *prev)
#else
gc_mark(JSRuntime *rt, void *thing)
#endif
{
uint8 flags, *flagp;
JSObject *obj;
jsval v, *vp, *end;
JSScope *scope;
JSClass *clasp;
JSScript *script;
JSFunction *fun;
JSScopeProperty *sprop;
JSSymbol *sym;
if (!thing)
return;
flagp = gc_find_flags(rt, thing);
if (!flagp)
return;
/* Check for something on the GC freelist to handle recycled stack. */
flags = *flagp;
if (flags == GCF_FINAL)
return;
#ifdef GC_MARK_DEBUG
if (js_LiveThingToFind == thing)
gc_dump_thing(thing, flags, prev, stderr);
#endif
if (flags & GCF_MARK)
return;
*flagp |= GCF_MARK;
METER(if (++rt->gcStats.depth > rt->gcStats.maxdepth)
rt->gcStats.maxdepth = rt->gcStats.depth);
#ifdef GC_MARK_DEBUG
if (js_DumpGCHeap)
gc_dump_thing(thing, flags, prev, js_DumpGCHeap);
#endif
if ((flags & GCF_TYPEMASK) == GCX_OBJECT) {
obj = thing;
vp = obj->slots;
if (vp) {
scope = OBJ_IS_NATIVE(obj) ? (JSScope *) obj->map : NULL;
if (scope) {
clasp = JSVAL_TO_PRIVATE(obj->slots[JSSLOT_CLASS]);
if (clasp == &js_ScriptClass) {
v = vp[JSSLOT_PRIVATE];
if (!JSVAL_IS_VOID(v)) {
script = JSVAL_TO_PRIVATE(v);
if (script)
GC_MARK_SCRIPT(rt, script, prev);
}
}
if (clasp == &js_FunctionClass) {
v = vp[JSSLOT_PRIVATE];
if (!JSVAL_IS_VOID(v)) {
fun = JSVAL_TO_PRIVATE(v);
if (fun) {
if (fun->atom)
GC_MARK_ATOM(rt, fun->atom, prev);
if (fun->script)
GC_MARK_SCRIPT(rt, fun->script, prev);
}
}
}
for (sprop = scope->props; sprop; sprop = sprop->next) {
for (sym = sprop->symbols; sym; sym = sym->next) {
if (JSVAL_IS_INT(sym_id(sym)))
continue;
GC_MARK_ATOM(rt, sym_atom(sym), prev);
}
}
}
if (!scope || scope->object == obj)
end = vp + obj->map->freeslot;
else
end = vp + JS_INITIAL_NSLOTS;
for (; vp < end; vp++) {
v = *vp;
if (JSVAL_IS_GCTHING(v)) {
#ifdef GC_MARK_DEBUG
char name[32];
if (scope) {
uint32 slot;
jsval nval;
slot = vp - obj->slots;
for (sprop = scope->props; ; sprop = sprop->next) {
if (!sprop) {
switch (slot) {
case JSSLOT_PROTO:
strcpy(name, "__proto__");
break;
case JSSLOT_PARENT:
strcpy(name, "__parent__");
break;
case JSSLOT_PRIVATE:
strcpy(name, "__private__");
break;
default:
JS_snprintf(name, sizeof name,
"**UNKNOWN SLOT %ld**",
(long)slot);
break;
}
break;
}
if (sprop->slot == slot) {
nval = sprop->symbols
? js_IdToValue(sym_id(sprop->symbols))
: sprop->id;
if (JSVAL_IS_INT(nval)) {
JS_snprintf(name, sizeof name, "%ld",
(long)JSVAL_TO_INT(nval));
} else if (JSVAL_IS_STRING(nval)) {
JS_snprintf(name, sizeof name, "%s",
JS_GetStringBytes(JSVAL_TO_STRING(nval)));
} else {
strcpy(name, "**FINALIZED ATOM KEY**");
}
break;
}
}
}
#endif
GC_MARK(rt, JSVAL_TO_GCTHING(v), name, prev);
}
}
}
}
METER(rt->gcStats.depth--);
}
static JSHashNumber
gc_hash_root(const void *key)
{
JSHashNumber num = (JSHashNumber) key; /* help lame MSVC1.5 on Win16 */
return num >> 2;
}
STATIC_DLL_CALLBACK(intN)
gc_root_marker(JSHashEntry *he, intN i, void *arg)
{
void **rp = (void **)he->key;
if (*rp) {
#ifdef DEBUG
JSArena *a;
JSRuntime *rt = (JSRuntime *)arg;
for (a = rt->gcArenaPool.first.next; a; a = a->next) {
JS_ASSERT(!rp ||
(*rp >= (void *)a->base && *rp <= (void *)a->avail));
}
#endif
GC_MARK(arg, *rp, he->value ? he->value : "root", NULL);
}
return HT_ENUMERATE_NEXT;
}
JS_FRIEND_API(void)
js_ForceGC(JSContext *cx)
{
cx->newborn[GCX_OBJECT] = NULL;
cx->newborn[GCX_STRING] = NULL;
cx->newborn[GCX_DOUBLE] = NULL;
cx->runtime->gcPoke = JS_TRUE;
js_GC(cx);
JS_ArenaFinish();
}
void
js_GC(JSContext *cx)
{
JSRuntime *rt;
JSContext *iter, *acx;
JSArena *a, *ma, *fa, **ap, **fap;
jsval v, *vp, *sp;
jsuword begin, end;
JSStackFrame *fp, *chain;
void *mark;
uint8 flags, *flagp;
JSGCThing *thing, *final, **flp, **oflp;
GCFinalizeOp finalizer;
JSBool a_all_clear, f_all_clear;
/*
* XXX kludge for pre-ECMAv2 compile-time switch case expr eval, see
* jsemit.c:js_EmitTree, under case TOK_SWITCH: (look for XXX).
*/
if (cx->gcDisabled)
return;
rt = cx->runtime;
#ifdef JS_THREADSAFE
/* Avoid deadlock. */
JS_ASSERT(!JS_IS_RUNTIME_LOCKED(rt));
#endif
/* Let the API user decide to defer a GC if it wants to. */
if (rt->gcCallback && !rt->gcCallback(cx, JSGC_BEGIN))
return;
/* Lock out other GC allocator and collector invocations. */
JS_LOCK_GC(rt);
/* Do nothing if no assignment has executed since the last GC. */
if (!rt->gcPoke) {
METER(rt->gcStats.nopoke++);
JS_UNLOCK_GC(rt);
return;
}
rt->gcPoke = JS_FALSE;
METER(rt->gcStats.poke++);
#ifdef JS_THREADSAFE
/* Bump gcLevel and return rather than nest on this context. */
if (cx->gcActive) {
rt->gcLevel++;
METER(if (rt->gcLevel > rt->gcStats.maxlevel)
rt->gcStats.maxlevel = rt->gcLevel);
if (rt->gcLevel > 1) {
JS_UNLOCK_GC(rt);
return;
}
}
/* If we're in a request, indicate, temporarily, that we're inactive. */
if (cx->requestDepth) {
rt->requestCount--;
JS_NOTIFY_REQUEST_DONE(rt);
}
/* If another thread is already in GC, don't attempt GC; wait instead. */
if (rt->gcLevel > 0) {
while (rt->gcLevel > 0)
JS_AWAIT_GC_DONE(rt);
if (cx->requestDepth)
rt->requestCount++;
JS_UNLOCK_GC(rt);
return;
}
/* No other thread is in GC, so indicate that we're now in GC. */
rt->gcLevel = 1;
/* Also indicate that GC is active on this context. */
cx->gcActive = JS_TRUE;
/* Wait for all other requests to finish. */
while (rt->requestCount > 0)
JS_AWAIT_REQUEST_DONE(rt);
#else /* !JS_THREADSAFE */
/* Bump gcLevel and return rather than nest; the outer gc will restart. */
rt->gcLevel++;
METER(if (rt->gcLevel > rt->gcStats.maxlevel)
rt->gcStats.maxlevel = rt->gcLevel);
if (rt->gcLevel > 1)
return;
#endif /* !JS_THREADSAFE */
/* Drop atoms held by the property cache, and clear property weak links. */
js_FlushPropertyCache(cx);
restart:
rt->gcNumber++;
/* Mark phase. */
JS_HashTableEnumerateEntries(rt->gcRootsHash, gc_root_marker, rt);
js_MarkAtomState(&rt->atomState, gc_mark);
iter = NULL;
while ((acx = js_ContextIterator(rt, &iter)) != NULL) {
/*
* Iterate frame chain and dormant chains. Temporarily tack current
* frame onto the head of the dormant list to ease iteration.
*
* (NOTE: see comment on this whole 'dormant' thing in js_Execute)
*/
chain = acx->fp;
if (chain) {
JS_ASSERT(!chain->dormantNext);
chain->dormantNext = acx->dormantFrameChain;
} else {
chain = acx->dormantFrameChain;
}
for (fp=chain; fp; fp = chain = chain->dormantNext) {
sp = fp->sp;
if (sp) {
for (a = acx->stackPool.first.next; a; a = a->next) {
begin = a->base;
end = a->avail;
if (JS_UPTRDIFF(sp, begin) < JS_UPTRDIFF(end, begin))
end = (jsuword)sp;
for (vp = (jsval *)begin; vp < (jsval *)end; vp++) {
v = *vp;
if (JSVAL_IS_GCTHING(v))
GC_MARK(rt, JSVAL_TO_GCTHING(v), "stack", NULL);
}
if (end == (jsuword)sp)
break;
}
}
do {
GC_MARK(rt, fp->scopeChain, "scope chain", NULL);
GC_MARK(rt, fp->thisp, "this", NULL);
if (JSVAL_IS_GCTHING(fp->rval))
GC_MARK(rt, JSVAL_TO_GCTHING(fp->rval), "rval", NULL);
if (fp->callobj)
GC_MARK(rt, fp->callobj, "call object", NULL);
if (fp->argsobj)
GC_MARK(rt, fp->argsobj, "arguments object", NULL);
if (fp->script)
GC_MARK_SCRIPT(rt, fp->script, NULL);
if (fp->sharpArray)
GC_MARK(rt, fp->sharpArray, "sharp array", NULL);
} while ((fp = fp->down) != NULL);
}
/* cleanup temporary link */
if (acx->fp)
acx->fp->dormantNext = NULL;
GC_MARK(rt, acx->globalObject, "global object", NULL);
GC_MARK(rt, acx->newborn[GCX_OBJECT], "newborn object", NULL);
GC_MARK(rt, acx->newborn[GCX_STRING], "newborn string", NULL);
GC_MARK(rt, acx->newborn[GCX_DOUBLE], "newborn double", NULL);
#if JS_HAS_EXCEPTIONS
if (acx->throwing)
GC_MARK(rt, acx->exception, "exception", NULL);
#endif
}
/* Sweep phase. Mark in tempPool for release at label out:. */
ma = cx->tempPool.current;
mark = JS_ARENA_MARK(&cx->tempPool);
js_SweepAtomState(&rt->atomState);
fa = rt->gcFlagsPool.first.next;
flagp = (uint8 *)fa->base;
for (a = rt->gcArenaPool.first.next; a; a = a->next) {
for (thing = (JSGCThing *)a->base; thing < (JSGCThing *)a->avail;
thing++) {
if (flagp >= (uint8 *)fa->avail) {
fa = fa->next;
JS_ASSERT(fa);
if (!fa) {
METER(rt->gcStats.badflag++);
goto out;
}
flagp = (uint8 *)fa->base;
}
flags = *flagp;
if (flags & GCF_MARK) {
*flagp &= ~GCF_MARK;
} else if (!(flags & (GCF_LOCKMASK | GCF_FINAL))) {
JS_ARENA_ALLOCATE(final, &cx->tempPool, sizeof(JSGCThing));
if (!final)
goto out;
final->next = thing;
final->flagp = flagp;
JS_ASSERT(rt->gcBytes >= sizeof(JSGCThing) + sizeof(uint8));
rt->gcBytes -= sizeof(JSGCThing) + sizeof(uint8);
}
flagp++;
}
}
/* Finalize phase. Don't hold the GC lock while running finalizers! */
JS_UNLOCK_GC(rt);
for (final = mark; ; final++) {
if ((jsuword)final >= ma->avail) {
ma = ma->next;
if (!ma)
break;
final = (JSGCThing *)ma->base;
}
thing = final->next;
flagp = final->flagp;
flags = *flagp;
finalizer = gc_finalizers[flags & GCF_TYPEMASK];
if (finalizer) {
*flagp |= GCF_FINAL;
finalizer(cx, thing);
}
/*
* Set flags to GCF_FINAL, signifying that thing is free, but don't
* thread thing onto rt->gcFreeList. We need the GC lock to rebuild
* the freelist below while also looking for free-able arenas.
*/
*flagp = GCF_FINAL;
}
JS_LOCK_GC(rt);
/* Free unused arenas and rebuild the freelist. */
ap = &rt->gcArenaPool.first.next;
a = *ap;
if (!a)
goto out;
thing = (JSGCThing *)a->base;
a_all_clear = f_all_clear = JS_TRUE;
flp = oflp = &rt->gcFreeList;
*flp = NULL;
METER(rt->gcStats.freelen = 0);
fap = &rt->gcFlagsPool.first.next;
while ((fa = *fap) != NULL) {
/* XXX optimize by unrolling to use word loads */
for (flagp = (uint8 *)fa->base; ; flagp++) {
JS_ASSERT(a);
if (!a) {
METER(rt->gcStats.badarena++);
goto out;
}
if (thing >= (JSGCThing *)a->avail) {
if (a_all_clear) {
JS_ARENA_DESTROY(&rt->gcArenaPool, a, ap);
flp = oflp;
METER(rt->gcStats.afree++);
} else {
ap = &a->next;
a_all_clear = JS_TRUE;
oflp = flp;
}
a = *ap;
if (!a)
break;
thing = (JSGCThing *)a->base;
}
if (flagp >= (uint8 *)fa->avail)
break;
if (*flagp != GCF_FINAL) {
a_all_clear = f_all_clear = JS_FALSE;
} else {
thing->flagp = flagp;
*flp = thing;
flp = &thing->next;
METER(rt->gcStats.freelen++);
}
thing++;
}
if (f_all_clear) {
JS_ARENA_DESTROY(&rt->gcFlagsPool, fa, fap);
METER(rt->gcStats.fafree++);
} else {
fap = &fa->next;
f_all_clear = JS_TRUE;
}
}
/* Terminate the new freelist. */
*flp = NULL;
out:
JS_ARENA_RELEASE(&cx->tempPool, mark);
if (rt->gcLevel > 1) {
rt->gcLevel = 1;
goto restart;
}
rt->gcLevel = 0;
rt->gcLastBytes = rt->gcBytes;
#ifdef JS_THREADSAFE
/* If we were invoked during a request, undo the temporary decrement. */
if (cx->requestDepth)
rt->requestCount++;
cx->gcActive = JS_FALSE;
JS_NOTIFY_GC_DONE(rt);
JS_UNLOCK_GC(rt);
#endif
if (rt->gcCallback)
(void) rt->gcCallback(cx, JSGC_END);
}

110
mozilla/js/src/jsgc.h Normal file
View File

@@ -0,0 +1,110 @@
/* -*- 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 jsgc_h___
#define jsgc_h___
/*
* JS Garbage Collector.
*/
#include "jspubtd.h"
JS_BEGIN_EXTERN_C
/* GC thing type indexes. */
#define GCX_OBJECT 0 /* JSObject */
#define GCX_STRING 1 /* JSString */
#define GCX_DOUBLE 2 /* jsdouble */
#define GCX_DECIMAL 3 /* JSDecimal */
#define GCX_NTYPES 4
/* GC flag definitions (type index goes in low bits). */
#define GCF_TYPEMASK JS_BITMASK(2) /* use low bits for type */
#define GCF_MARK JS_BIT(2) /* mark bit */
#define GCF_FINAL JS_BIT(3) /* in finalization bit */
#define GCF_LOCKBIT 4 /* lock bit shift and mask */
#define GCF_LOCKMASK (JS_BITMASK(4) << GCF_LOCKBIT)
#define GCF_LOCK JS_BIT(GCF_LOCKBIT) /* lock request bit in API */
#if 1
/*
* Since we're forcing a GC from JS_GC anyway, don't bother wasting cycles
* loading oldval. XXX remove implied force, poke in addroot/removeroot, &c
*/
#define GC_POKE(cx, oldval) ((cx)->runtime->gcPoke = JS_TRUE)
#else
#define GC_POKE(cx, oldval) ((cx)->runtime->gcPoke = JSVAL_IS_GCTHING(oldval))
#endif
extern JSBool
js_InitGC(JSRuntime *rt, uint32 maxbytes);
extern void
js_FinishGC(JSRuntime *rt);
extern JSBool
js_AddRoot(JSContext *cx, void *rp, const char *name);
extern JSBool
js_RemoveRoot(JSContext *cx, void *rp);
extern void *
js_AllocGCThing(JSContext *cx, uintN flags);
extern JSBool
js_LockGCThing(JSContext *cx, void *thing);
extern JSBool
js_UnlockGCThing(JSContext *cx, void *thing);
extern JS_FRIEND_API(void)
js_ForceGC(JSContext *cx);
extern void
js_GC(JSContext *cx);
#ifdef JS_GCMETER
typedef struct JSGCStats {
uint32 alloc; /* number of allocation attempts */
uint32 freelen; /* gcFreeList length */
uint32 recycle; /* number of things recycled through gcFreeList */
uint32 retry; /* allocation attempt retries after running the GC */
uint32 fail; /* allocation failures */
uint32 lock; /* valid lock calls */
uint32 unlock; /* valid unlock calls */
uint32 stuck; /* stuck reference counts seen by lock calls */
uint32 unstuck; /* unlock calls that saw a stuck lock count */
uint32 depth; /* mark recursion depth */
uint32 maxdepth; /* maximum mark recursion depth */
uint32 maxlevel; /* maximum GC nesting (indirect recursion) level */
uint32 poke; /* number of potentially useful GC calls */
uint32 nopoke; /* useless GC calls where js_PokeGC was not set */
uint32 badarena; /* thing arena corruption */
uint32 badflag; /* flags arena corruption */
uint32 afree; /* thing arenas freed so far */
uint32 fafree; /* flags arenas freed so far */
} JSGCStats;
extern void
js_DumpGCStats(JSRuntime *rt, FILE *fp);
#endif /* JS_GCMETER */
JS_END_EXTERN_C
#endif /* jsgc_h___ */

457
mozilla/js/src/jshash.c Normal file
View File

@@ -0,0 +1,457 @@
/* -*- 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.
*/
/*
* PR hash table package.
*/
#include <stdlib.h>
#include <string.h>
#include "jstypes.h"
#include "jsbit.h"
/* Removed by JSIFY: #include "prlog.h" */
#include "jsutil.h" /* Added by JSIFY */
#ifndef NSPR20
#include "jshash.h"
#else
/* Removed by JSIFY: #include "JShash.h"
*/
#include "jshash.h" /* Added by JSIFY */
#endif
/* Compute the number of buckets in ht */
#define NBUCKETS(ht) JS_BIT(PR_HASH_BITS - (ht)->shift)
/* The smallest table has 16 buckets */
#define MINBUCKETSLOG2 4
#define MINBUCKETS JS_BIT(MINBUCKETSLOG2)
/* Compute the maximum entries given n buckets that we will tolerate, ~90% */
#define OVERLOADED(n) ((n) - ((n) >> 3))
/* Compute the number of entries below which we shrink the table by half */
#define UNDERLOADED(n) (((n) > MINBUCKETS) ? ((n) >> 2) : 0)
/*
** Stubs for default hash allocator ops.
*/
static void *
DefaultAllocTable(void *pool, size_t size)
{
return malloc(size);
}
static void
DefaultFreeTable(void *pool, void *item)
{
free(item);
}
static JSHashEntry *
DefaultAllocEntry(void *pool, const void *key)
{
return malloc(sizeof(JSHashEntry));
}
static void
DefaultFreeEntry(void *pool, JSHashEntry *he, uintN flag)
{
if (flag == HT_FREE_ENTRY)
free(he);
}
static JSHashAllocOps defaultHashAllocOps = {
DefaultAllocTable, DefaultFreeTable,
DefaultAllocEntry, DefaultFreeEntry
};
IMPLEMENT(JSHashTable *)
JS_NewHashTable(uint32 n, JSHashFunction keyHash,
JSHashComparator keyCompare, JSHashComparator valueCompare,
JSHashAllocOps *allocOps, void *allocPriv)
{
JSHashTable *ht;
size_t nb;
if (n <= MINBUCKETS) {
n = MINBUCKETSLOG2;
} else {
n = JS_CeilingLog2(n);
if ((int32)n < 0)
return NULL;
}
if (!allocOps) allocOps = &defaultHashAllocOps;
ht = (*allocOps->allocTable)(allocPriv, sizeof *ht);
if (!ht)
return NULL;
memset(ht, 0, sizeof *ht);
ht->shift = PR_HASH_BITS - n;
n = JS_BIT(n);
#if defined(XP_PC) && defined _MSC_VER && _MSC_VER <= 800
if (n > 16000) {
(*allocOps->freeTable)(allocPriv, ht);
return NULL;
}
#endif /* WIN16 */
nb = n * sizeof(JSHashEntry *);
ht->buckets = (*allocOps->allocTable)(allocPriv, nb);
if (!ht->buckets) {
(*allocOps->freeTable)(allocPriv, ht);
return NULL;
}
memset(ht->buckets, 0, nb);
ht->keyHash = keyHash;
ht->keyCompare = keyCompare;
ht->valueCompare = valueCompare;
ht->allocOps = allocOps;
ht->allocPriv = allocPriv;
return ht;
}
IMPLEMENT(void)
JS_HashTableDestroy(JSHashTable *ht)
{
uint32 i, n;
JSHashEntry *he, *next;
JSHashAllocOps *allocOps = ht->allocOps;
void *allocPriv = ht->allocPriv;
n = NBUCKETS(ht);
for (i = 0; i < n; i++) {
for (he = ht->buckets[i]; he; he = next) {
next = he->next;
(*allocOps->freeEntry)(allocPriv, he, HT_FREE_ENTRY);
}
}
#ifdef DEBUG
memset(ht->buckets, 0xDB, n * sizeof ht->buckets[0]);
#endif
(*allocOps->freeTable)(allocPriv, ht->buckets);
#ifdef DEBUG
memset(ht, 0xDB, sizeof *ht);
#endif
(*allocOps->freeTable)(allocPriv, ht);
}
/*
** Multiplicative hash, from Knuth 6.4.
*/
IMPLEMENT(JSHashEntry **)
JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key)
{
JSHashEntry *he, **hep, **hep0;
JSHashNumber h;
#ifdef HASHMETER
ht->nlookups++;
#endif
h = keyHash * PR_GOLDEN_RATIO;
h >>= ht->shift;
hep = hep0 = &ht->buckets[h];
while ((he = *hep) != NULL) {
if (he->keyHash == keyHash && (*ht->keyCompare)(key, he->key)) {
/* Move to front of chain if not already there */
if (hep != hep0) {
*hep = he->next;
he->next = *hep0;
*hep0 = he;
}
return hep0;
}
hep = &he->next;
#ifdef HASHMETER
ht->nsteps++;
#endif
}
return hep;
}
IMPLEMENT(JSHashEntry *)
JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **hep,
JSHashNumber keyHash, const void *key, void *value)
{
uint32 i, n;
JSHashEntry *he, *next, **oldbuckets;
size_t nb;
/* Grow the table if it is overloaded */
n = NBUCKETS(ht);
if (ht->nentries >= OVERLOADED(n)) {
#ifdef HASHMETER
ht->ngrows++;
#endif
ht->shift--;
oldbuckets = ht->buckets;
#if defined(XP_PC) && defined _MSC_VER && _MSC_VER <= 800
if (2 * n > 16000)
return NULL;
#endif /* WIN16 */
nb = 2 * n * sizeof(JSHashEntry *);
ht->buckets = (*ht->allocOps->allocTable)(ht->allocPriv, nb);
if (!ht->buckets) {
ht->buckets = oldbuckets;
return NULL;
}
memset(ht->buckets, 0, nb);
for (i = 0; i < n; i++) {
for (he = oldbuckets[i]; he; he = next) {
next = he->next;
hep = JS_HashTableRawLookup(ht, he->keyHash, he->key);
JS_ASSERT(*hep == NULL);
he->next = NULL;
*hep = he;
}
}
#ifdef DEBUG
memset(oldbuckets, 0xDB, n * sizeof oldbuckets[0]);
#endif
(*ht->allocOps->freeTable)(ht->allocPriv, oldbuckets);
hep = JS_HashTableRawLookup(ht, keyHash, key);
}
/* Make a new key value entry */
he = (*ht->allocOps->allocEntry)(ht->allocPriv, key);
if (!he)
return NULL;
he->keyHash = keyHash;
he->key = key;
he->value = value;
he->next = *hep;
*hep = he;
ht->nentries++;
return he;
}
IMPLEMENT(JSHashEntry *)
JS_HashTableAdd(JSHashTable *ht, const void *key, void *value)
{
JSHashNumber keyHash;
JSHashEntry *he, **hep;
keyHash = (*ht->keyHash)(key);
hep = JS_HashTableRawLookup(ht, keyHash, key);
if ((he = *hep) != NULL) {
/* Hit; see if values match */
if ((*ht->valueCompare)(he->value, value)) {
/* key,value pair is already present in table */
return he;
}
if (he->value)
(*ht->allocOps->freeEntry)(ht->allocPriv, he, HT_FREE_VALUE);
he->value = value;
return he;
}
return JS_HashTableRawAdd(ht, hep, keyHash, key, value);
}
IMPLEMENT(void)
JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he)
{
uint32 i, n;
JSHashEntry *next, **oldbuckets;
size_t nb;
*hep = he->next;
(*ht->allocOps->freeEntry)(ht->allocPriv, he, HT_FREE_ENTRY);
/* Shrink table if it's underloaded */
n = NBUCKETS(ht);
if (--ht->nentries < UNDERLOADED(n)) {
#ifdef HASHMETER
ht->nshrinks++;
#endif
ht->shift++;
oldbuckets = ht->buckets;
nb = n * sizeof(JSHashEntry*) / 2;
ht->buckets = (*ht->allocOps->allocTable)(ht->allocPriv, nb);
if (!ht->buckets) {
ht->buckets = oldbuckets;
return;
}
memset(ht->buckets, 0, nb);
for (i = 0; i < n; i++) {
for (he = oldbuckets[i]; he; he = next) {
next = he->next;
hep = JS_HashTableRawLookup(ht, he->keyHash, he->key);
JS_ASSERT(*hep == NULL);
he->next = NULL;
*hep = he;
}
}
#ifdef DEBUG
memset(oldbuckets, 0xDB, n * sizeof oldbuckets[0]);
#endif
(*ht->allocOps->freeTable)(ht->allocPriv, oldbuckets);
}
}
IMPLEMENT(JSBool)
JS_HashTableRemove(JSHashTable *ht, const void *key)
{
JSHashNumber keyHash;
JSHashEntry *he, **hep;
keyHash = (*ht->keyHash)(key);
hep = JS_HashTableRawLookup(ht, keyHash, key);
if ((he = *hep) == NULL)
return JS_FALSE;
/* Hit; remove element */
JS_HashTableRawRemove(ht, hep, he);
return JS_TRUE;
}
IMPLEMENT(void *)
JS_HashTableLookup(JSHashTable *ht, const void *key)
{
JSHashNumber keyHash;
JSHashEntry *he, **hep;
keyHash = (*ht->keyHash)(key);
hep = JS_HashTableRawLookup(ht, keyHash, key);
if ((he = *hep) != NULL) {
return he->value;
}
return NULL;
}
/*
** Iterate over the entries in the hash table calling func for each
** entry found. Stop if "f" says to (return value & JS_ENUMERATE_STOP).
** Return a count of the number of elements scanned.
*/
IMPLEMENT(int)
JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg)
{
JSHashEntry *he, **hep;
uint32 i, nbuckets;
int rv, n = 0;
JSHashEntry *todo = NULL;
nbuckets = NBUCKETS(ht);
for (i = 0; i < nbuckets; i++) {
hep = &ht->buckets[i];
while ((he = *hep) != NULL) {
rv = (*f)(he, n, arg);
n++;
if (rv & (HT_ENUMERATE_REMOVE | HT_ENUMERATE_UNHASH)) {
*hep = he->next;
if (rv & HT_ENUMERATE_REMOVE) {
he->next = todo;
todo = he;
}
} else {
hep = &he->next;
}
if (rv & HT_ENUMERATE_STOP) {
goto out;
}
}
}
out:
hep = &todo;
while ((he = *hep) != NULL) {
JS_HashTableRawRemove(ht, hep, he);
}
return n;
}
#ifdef HASHMETER
#include <math.h>
#include <stdio.h>
IMPLEMENT(void)
JS_HashTableDumpMeter(JSHashTable *ht, JSHashEnumerator dump, FILE *fp)
{
double mean, variance;
uint32 nchains, nbuckets;
uint32 i, n, maxChain, maxChainLen;
JSHashEntry *he;
variance = 0;
nchains = 0;
maxChainLen = 0;
nbuckets = NBUCKETS(ht);
for (i = 0; i < nbuckets; i++) {
he = ht->buckets[i];
if (!he)
continue;
nchains++;
for (n = 0; he; he = he->next)
n++;
variance += n * n;
if (n > maxChainLen) {
maxChainLen = n;
maxChain = i;
}
}
mean = (double)ht->nentries / nchains;
variance = fabs(variance / nchains - mean * mean);
fprintf(fp, "\nHash table statistics:\n");
fprintf(fp, " number of lookups: %u\n", ht->nlookups);
fprintf(fp, " number of entries: %u\n", ht->nentries);
fprintf(fp, " number of grows: %u\n", ht->ngrows);
fprintf(fp, " number of shrinks: %u\n", ht->nshrinks);
fprintf(fp, " mean steps per hash: %g\n", (double)ht->nsteps
/ ht->nlookups);
fprintf(fp, "mean hash chain length: %g\n", mean);
fprintf(fp, " standard deviation: %g\n", sqrt(variance));
fprintf(fp, " max hash chain length: %u\n", maxChainLen);
fprintf(fp, " max hash chain: [%u]\n", maxChain);
for (he = ht->buckets[maxChain], i = 0; he; he = he->next, i++)
if ((*dump)(he, i, fp) != HT_ENUMERATE_NEXT)
break;
}
#endif /* HASHMETER */
IMPLEMENT(int)
JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp)
{
int count;
count = JS_HashTableEnumerateEntries(ht, dump, fp);
#ifdef HASHMETER
JS_HashTableDumpMeter(ht, dump, fp);
#endif
return count;
}
IMPLEMENT(JSHashNumber)
JS_HashString(const void *key)
{
JSHashNumber h;
const unsigned char *s;
h = 0;
for (s = key; *s; s++)
h = (h >> 28) ^ (h << 4) ^ *s;
return h;
}
IMPLEMENT(int)
JS_CompareValues(const void *v1, const void *v2)
{
return v1 == v2;
}

131
mozilla/js/src/jshash.h Normal file
View File

@@ -0,0 +1,131 @@
/* -*- 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 jshash_h___
#define jshash_h___
/*
* API to portable hash table code.
*/
#include <stddef.h>
#include <stdio.h>
#include "jstypes.h"
#include "jscompat.h"
JS_BEGIN_EXTERN_C
typedef uint32 JSHashNumber;
typedef struct JSHashEntry JSHashEntry;
typedef struct JSHashTable JSHashTable;
#define PR_HASH_BITS 32
#define PR_GOLDEN_RATIO 0x9E3779B9U
typedef JSHashNumber (*JSHashFunction)(const void *key);
typedef intN (*JSHashComparator)(const void *v1, const void *v2);
typedef intN (*JSHashEnumerator)(JSHashEntry *he, intN i, void *arg);
/* Flag bits in JSHashEnumerator's return value */
#define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */
#define HT_ENUMERATE_STOP 1 /* stop enumerating entries */
#define HT_ENUMERATE_REMOVE 2 /* remove and free the current entry */
#define HT_ENUMERATE_UNHASH 4 /* just unhash the current entry */
typedef struct JSHashAllocOps {
void * (*allocTable)(void *pool, size_t size);
void (*freeTable)(void *pool, void *item);
JSHashEntry * (*allocEntry)(void *pool, const void *key);
void (*freeEntry)(void *pool, JSHashEntry *he, uintN flag);
} JSHashAllocOps;
#define HT_FREE_VALUE 0 /* just free the entry's value */
#define HT_FREE_ENTRY 1 /* free value and entire entry */
struct JSHashEntry {
JSHashEntry *next; /* hash chain linkage */
JSHashNumber keyHash; /* key hash function result */
const void *key; /* ptr to opaque key */
void *value; /* ptr to opaque value */
};
struct JSHashTable {
JSHashEntry **buckets; /* vector of hash buckets */
uint32 nentries; /* number of entries in table */
uint32 shift; /* multiplicative hash shift */
JSHashFunction keyHash; /* key hash function */
JSHashComparator keyCompare; /* key comparison function */
JSHashComparator valueCompare; /* value comparison function */
JSHashAllocOps *allocOps; /* allocation operations */
void *allocPriv; /* allocation private data */
#ifdef HASHMETER
uint32 nlookups; /* total number of lookups */
uint32 nsteps; /* number of hash chains traversed */
uint32 ngrows; /* number of table expansions */
uint32 nshrinks; /* number of table contractions */
#endif
};
/*
* Create a new hash table.
* If allocOps is null, use default allocator ops built on top of malloc().
*/
EXTERN(JSHashTable *)
JS_NewHashTable(uint32 n, JSHashFunction keyHash,
JSHashComparator keyCompare, JSHashComparator valueCompare,
JSHashAllocOps *allocOps, void *allocPriv);
EXTERN(void)
JS_HashTableDestroy(JSHashTable *ht);
/* Low level access methods */
EXTERN(JSHashEntry **)
JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key);
EXTERN(JSHashEntry *)
JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **hep, JSHashNumber keyHash,
const void *key, void *value);
EXTERN(void)
JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he);
/* Higher level access methods */
EXTERN(JSHashEntry *)
JS_HashTableAdd(JSHashTable *ht, const void *key, void *value);
EXTERN(JSBool)
JS_HashTableRemove(JSHashTable *ht, const void *key);
EXTERN(intN)
JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg);
EXTERN(void *)
JS_HashTableLookup(JSHashTable *ht, const void *key);
EXTERN(intN)
JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp);
/* General-purpose C string hash function. */
EXTERN(JSHashNumber)
JS_HashString(const void *key);
/* Stub function just returns v1 == v2 */
IMPLEMENT(intN)
JS_CompareValues(const void *v1, const void *v2);
JS_END_EXTERN_C
#endif /* jshash_h___ */

482
mozilla/js/src/jsify.pl Normal file
View File

@@ -0,0 +1,482 @@
#!/usr/local/bin/perl
# This script modifies C code to use the hijacked NSPR routines that are
# now baked into the JavaScript engine rather than using the NSPR
# routines that they were based on, i.e. types like PRArenaPool are changed
# to JSArenaPool.
#
# This script was used in 9/98 to facilitate the incorporation of some NSPR
# code into the JS engine so as to minimize dependency on NSPR.
#
# Command-line: jsify.pl [options] [filename]*
#
# Options:
# -r Reverse direction of transformation, i.e. JS ==> NSPR2
# -outdir Directory in which to place output files
# NSPR2 symbols that will be modified to JS symbols, e.g.
# PRArena <==> JSArena
@NSPR_symbols = (
"PRArena",
"PRArenaPool",
"PRArenaStats",
"PR_ARENAMETER",
"PR_ARENA_",
"PR_ARENA_ALIGN",
"PR_ARENA_ALLOCATE",
"PR_ARENA_CONST_ALIGN_MASK",
"PR_ARENA_DEFAULT_ALIGN",
"PR_ARENA_DESTROY",
"PR_ARENA_GROW",
"PR_ARENA_MARK",
"PR_ARENA_RELEASE",
"PR_smprintf",
"PR_smprintf_free",
"PR_snprintf",
"PR_sprintf_append",
"PR_sscanf",
"PR_sxprintf",
"PR_vsmprintf",
"PR_vsnprintf",
"PR_vsprintf_append",
"PR_vsxprintf",
"PRCList",
"PRCListStr",
"PRCLists",
"PRDestroyEventProc",
"PREvent",
"PREventFunProc",
"PREventQueue",
"PRHandleEventProc",
"PR_PostEvent",
"PR_PostSynchronousEvent",
"PR_ProcessPendingEvents",
"PR_CreateEventQueue",
"PR_DequeueEvent",
"PR_DestroyEvent",
"PR_DestroyEventQueue",
"PR_EventAvailable",
"PR_EventLoop",
"PR_GetEvent",
"PR_GetEventOwner",
"PR_GetEventQueueMonitor",
"PR_GetEventQueueSelectFD",
"PR_GetMainEventQueue",
"PR_HandleEvent",
"PR_InitEvent",
"PR_ENTER_EVENT_QUEUE_MONITOR",
"PR_EXIT_EVENT_QUEUE_MONITOR",
"PR_MapEvents",
"PR_RevokeEvents",
"PRFileDesc",
"PRHashAllocOps",
"PRHashComparator",
"PRHashEntry",
"PRHashEnumerator",
"PRHashFunction",
"PRHashNumber",
"PRHashTable",
"PR_HashString",
"PR_HashTableAdd",
"PR_HashTableDestroy",
"PR_HashTableDump",
"PR_HashTableEnumerateEntries",
"PR_HashTableLookup",
"PR_HashTableRawAdd",
"PR_HashTableRawLookup",
"PR_HashTableRawRemove",
"PR_HashTableRemove",
"PRBool",
"PRFloat64",
"PRInt16",
"PRInt32",
"PRInt64",
"PRInt8",
"PRIntn",
"PRUint16",
"PRUint32",
"PRUint64",
"PRUint8",
"PRUintn",
"PRPtrDiff",
"PRPtrdiff",
"PRUptrdiff",
"PRUword",
"PRWord",
"PRPackedBool",
"PRSize",
"PRStatus",
"pruword",
"prword",
"prword_t",
"PR_ALIGN_OF_DOUBLE",
"PR_ALIGN_OF_FLOAT",
"PR_ALIGN_OF_INT",
"PR_ALIGN_OF_INT64",
"PR_ALIGN_OF_LONG",
"PR_ALIGN_OF_POINTER",
"PR_ALIGN_OF_SHORT",
"PR_ALIGN_OF_WORD",
"PR_BITS_PER_BYTE",
"PR_BITS_PER_BYTE_LOG2",
"PR_BITS_PER_DOUBLE",
"PR_BITS_PER_DOUBLE_LOG2",
"PR_BITS_PER_FLOAT",
"PR_BITS_PER_FLOAT_LOG2",
"PR_BITS_PER_INT",
"PR_BITS_PER_INT64",
"PR_BITS_PER_INT64_LOG2",
"PR_BITS_PER_INT_LOG2",
"PR_BITS_PER_LONG",
"PR_BITS_PER_LONG_LOG2",
"PR_BITS_PER_SHORT",
"PR_BITS_PER_SHORT_LOG2",
"PR_BITS_PER_WORD",
"PR_BITS_PER_WORD_LOG2",
"PR_BYTES_PER_BYTE",
"PR_BYTES_PER_DOUBLE",
"PR_BYTES_PER_DWORD",
"PR_BYTES_PER_DWORD_LOG2",
"PR_BYTES_PER_FLOAT",
"PR_BYTES_PER_INT",
"PR_BYTES_PER_INT64",
"PR_BYTES_PER_LONG",
"PR_BYTES_PER_SHORT",
"PR_BYTES_PER_WORD",
"PR_BYTES_PER_WORD_LOG2",
"PRSegment",
"PRSegmentAccess",
"PRStuffFunc",
"PRThread",
"PR_APPEND_LINK",
"PR_ASSERT",
"PR_ATOMIC_DWORD_LOAD",
"PR_ATOMIC_DWORD_STORE",
"PR_Abort",
"PR_ArenaAllocate",
"PR_ArenaCountAllocation",
"PR_ArenaCountGrowth",
"PR_ArenaCountInplaceGrowth",
"PR_ArenaCountRelease",
"PR_ArenaCountRetract",
"PR_ArenaFinish",
"PR_ArenaGrow",
"PR_ArenaRelease",
"PR_CompactArenaPool",
"PR_DumpArenaStats",
"PR_FinishArenaPool",
"PR_FreeArenaPool",
"PR_InitArenaPool",
"PR_Assert",
"PR_AttachThread",
"PR_BEGIN_EXTERN_C",
"PR_BEGIN_MACRO",
"PR_BIT",
"PR_BITMASK",
"PR_BUFFER_OVERFLOW_ERROR",
"PR_CALLBACK",
"PR_CALLBACK_DECL",
"PR_CALLOC",
"PR_CEILING_LOG2",
"PR_CLEAR_ARENA",
"PR_CLEAR_BIT",
"PR_CLEAR_UNUSED",
"PR_CLIST_IS_EMPTY",
"PR_COUNT_ARENA",
"PR_CURRENT_THREAD",
"PR_GetSegmentAccess",
"PR_GetSegmentSize",
"PR_GetSegmentVaddr",
"PR_GrowSegment",
"PR_DestroySegment",
"PR_MapSegment",
"PR_NewSegment",
"PR_Segment",
"PR_Seg",
"PR_SEGMENT_NONE",
"PR_SEGMENT_RDONLY",
"PR_SEGMENT_RDWR",
"PR_Calloc",
"PR_CeilingLog2",
"PR_CompareStrings",
"PR_CompareValues",
"PR_DELETE",
"PR_END_EXTERN_C",
"PR_END_MACRO",
"PR_ENUMERATE_STOP",
"PR_FAILURE",
"PR_FALSE",
"PR_FLOOR_LOG2",
"PR_FREEIF",
"PR_FREE_PATTERN",
"PR_FloorLog2",
"PR_FormatTime",
"PR_Free",
"PR_GetEnv",
"PR_GetError",
"PR_INIT_ARENA_POOL",
"PR_INIT_CLIST",
"PR_INIT_STATIC_CLIST",
"PR_INLINE",
"PR_INSERT_AFTER",
"PR_INSERT_BEFORE",
"PR_INSERT_LINK",
"PR_INT32",
"PR_INTERVAL_NO_TIMEOUT",
"PR_INTERVAL_NO_WAIT",
"PR_Init",
"PR_LIST_HEAD",
"PR_LIST_TAIL",
"PR_LOG",
"PR_LOGGING",
"PR_LOG_ALWAYS",
"PR_LOG_BEGIN",
"PR_LOG_DEBUG",
"PR_LOG_DEFINE",
"PR_LOG_END",
"PR_LOG_ERROR",
"PR_LOG_MAX",
"PR_LOG_MIN",
"PR_LOG_NONE",
"PR_LOG_NOTICE",
"PR_LOG_TEST",
"PR_LOG_WARN",
"PR_LOG_WARNING",
"PR_LogFlush",
"PR_LogPrint",
"PR_MALLOC",
"PR_MAX",
"PR_MD_calloc",
"PR_MD_free",
"PR_MD_malloc",
"PR_MD_realloc",
"PR_MIN",
"PR_Malloc",
"PR_NEW",
"PR_NEWZAP",
"PR_NEXT_LINK",
"PR_NOT_REACHED",
"PR_NewCondVar",
"PR_NewHashTable",
"PR_NewLogModule",
"PR_PREV_LINK",
"PR_PUBLIC_API",
"PR_PUBLIC_DATA",
"PR_RANGE_ERROR",
"PR_REALLOC",
"PR_REMOVE_AND_INIT_LINK",
"PR_REMOVE_LINK",
"PR_ROUNDUP",
"PR_Realloc",
"PR_SET_BIT",
"PR_STATIC_CALLBACK",
"PR_SUCCESS",
"PR_SetError",
"PR_SetLogBuffering",
"PR_SetLogFile",
"PR_TEST_BIT",
"PR_TRUE",
"PR_UINT32",
"PR_UPTRDIFF",
"prarena_h___",
"prbit_h___",
"prclist_h___",
"prdtoa_h___",
"prlog_h___",
"prlong_h___",
"prmacos_h___",
"prmem_h___",
"prprf_h___",
"prtypes_h___",
"prarena",
"prbit",
"prbitmap_t",
"prclist",
"prcpucfg",
"prdtoa",
"prhash",
"plhash",
"prlong",
"prmacos",
"prmem",
"prosdep",
"protypes",
"prprf",
"prtypes"
);
while ($ARGV[0] =~ /^-/) {
if ($ARGV[0] eq "-r") {
shift;
$reverse_conversion = 1;
} elsif ($ARGV[0] eq "-outdir") {
shift;
$outdir = shift;
}
}
# Given an NSPR symbol compute the JS equivalent or
# vice-versa
sub subst {
local ($replacement);
local ($sym) = @_;
$replacement = substr($sym,0,2) eq "pr" ? "js" : "JS";
$replacement .= substr($sym, 2);
return $replacement;
}
# Build the regular expression that will convert between the NSPR
# types and the JS types
if ($reverse_conversion) {
die "Not implemented yet";
} else {
foreach $sym (@NSPR_symbols) {
$regexp .= $sym . "|"
}
# Get rid of the last "!"
chop $regexp;
# Replace PR* with JS* and replace pr* with js*
$regexp = 's/(^|\\W)(' . $regexp . ')/$1 . &subst($2)/eg';
# print $regexp;
}
# Pre-compile a little subroutine to perform the regexp substitution
# between NSPR types and JS types
eval('sub convert_from_NSPR {($line) = @_; $line =~ ' . $regexp . ';}');
sub convert_mallocs {
($line) = @_;
$line =~ s/PR_MALLOC/malloc/g;
$line =~ s/PR_REALLOC/realloc/g;
$line =~ s/PR_FREE/free/g;
return $line;
}
sub convert_includes {
($line) = @_;
if ($line !~ /include/) {
return $line;
}
if ($line =~ /prlog\.h/) {
chop $line;
$line = "/* Removed by JSIFY: $line */\n";
$line .= '#include "jsutil.h"'. " /* Added by JSIFY */\n";
} elsif ($line =~ /plhash\.h/) {
$line = "/* Removed by JSIFY: $line */\n";
$line .= '#include "jshash.h"'. " /* Added by JSIFY */\n";
} elsif ($line =~ /plarena\.h/) {
$line = "/* Removed by JSIFY: $line */\n";
$line .= '#include "jsarena.h"'. " /* Added by JSIFY */\n";
} elsif ($line =~ /prmem\.h/) {
$line = "/* Removed by JSIFY: $line */\n";
} elsif ($line =~ /jsmsg\.def/) {
$line = '#include "js.msg"' . "\n";
} elsif ($line =~ /shellmsg\.def/) {
$line = '#include "jsshell.msg"' . "\n";
} elsif ($line =~ /jsopcode\.def/) {
$line = '#include "jsopcode.tbl"' . "\n";
}
return $line;
}
sub convert_declarations {
($line) = @_;
$line =~ s/PR_EXTERN/EXTERN/g;
$line =~ s/PR_IMPLEMENT/IMPLEMENT/g;
$line =~ s/PR_CALLBACK/DLL_CALLBACK/g;
$line =~ s/PR_STATIC_CALLBACK/STATIC_DLL_CALLBACK/g;
$line =~ s/PR_IMPORT/IMPORT/g;
$line =~ s/PR_PUBLIC_API/PUBLIC_API/g;
$line =~ s/PR_PUBLIC_DATA/PUBLIC_DATA/g;
return $line;
}
sub convert_long_long_macros {
($line) = @_;
$line =~ s/\b(LL_)/JSLL_/g;
return $line;
}
sub convert_asserts {
($line) = @_;
$line =~ s/\bPR_ASSERT/JS_ASSERT/g;
return $line;
}
while ($#ARGV >= 0) {
$infile = shift;
# Change filename, e.g. prtime.h to jsprtime.h, except for legacy
# files that start with 'prmj', like prmjtime.h.
$outfile = $infile;
if ($infile !~ /^prmj/) {
$outfile =~ s/^pr/js/;
$outfile =~ s/^pl/js/;
}
if ($outdir) {
$outfile = $outdir . '/' . $outfile;
}
if ($infile eq $outfile) {
die "Error: refuse to overwrite $outfile, use -outdir option."
}
die "Can't open $infile" if !open(INFILE, "<$infile");
die "Can't open $outfile for writing" if !open(OUTFILE, ">$outfile");
while (<INFILE>) {
$line = $_;
#Get rid of #include "prlog.h"
&convert_includes($line);
# Rename PR_EXTERN, PR_IMPORT, etc.
&convert_declarations($line);
# Convert from PR_MALLOC to malloc, etc.
&convert_mallocs($line);
# Convert from PR_ASSERT to JS_ASSERT
# &convert_asserts($line);
# Convert from, e.g. PRArena to JSPRArena
&convert_from_NSPR($line);
# Change LL_* macros to JSLL_*
&convert_long_long_macros($line);
print OUTFILE $line;
}
}

2789
mozilla/js/src/jsinterp.c Normal file

File diff suppressed because it is too large Load Diff

209
mozilla/js/src/jsinterp.h Normal file
View File

@@ -0,0 +1,209 @@
/* -*- 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 jsinterp_h___
#define jsinterp_h___
/*
* JS interpreter interface.
*/
#include "jsprvtd.h"
#include "jspubtd.h"
/*
* JS stack frame, allocated on the C stack.
*/
struct JSStackFrame {
JSObject *callobj; /* lazily created Call object */
JSObject *argsobj; /* lazily created arguments object */
JSScript *script; /* script being interpreted */
JSFunction *fun; /* function being called or null */
JSObject *thisp; /* "this" pointer if in method */
uintN argc; /* actual argument count */
jsval *argv; /* base of argument stack slots */
jsval rval; /* function return value */
uintN nvars; /* local variable count */
jsval *vars; /* base of variable stack slots */
JSStackFrame *down; /* previous frame */
void *annotation; /* used by Java security */
JSObject *scopeChain; /* scope chain */
jsbytecode *pc; /* program counter */
jsval *sp; /* stack pointer */
uintN sharpDepth; /* array/object initializer depth */
JSObject *sharpArray; /* scope for #n= initializer vars */
JSPackedBool constructing; /* true if called via new operator */
uint8 overrides; /* bit-set of overridden Call properties */
JSPackedBool debugging; /* true if for JS_EvaluateInStackFrame */
JSStackFrame *dormantNext; /* next dormant frame chain */
};
/*
* Property cache for quickened get/set property opcodes.
*/
#define PROPERTY_CACHE_LOG2 10
#define PROPERTY_CACHE_SIZE JS_BIT(PROPERTY_CACHE_LOG2)
#define PROPERTY_CACHE_MASK JS_BITMASK(PROPERTY_CACHE_LOG2)
#define PROPERTY_CACHE_HASH(obj, id) \
((((jsuword)(obj) >> JSVAL_TAGBITS) ^ (jsuword)(id)) & PROPERTY_CACHE_MASK)
#ifdef JS_THREADSAFE
#if HAVE_ATOMIC_DWORD_ACCESS
#define PCE_LOAD(cache, pce, entry) JS_ATOMIC_DWORD_LOAD(pce, entry)
#define PCE_STORE(cache, pce, entry) JS_ATOMIC_DWORD_STORE(pce, entry)
#else /* !HAVE_ATOMIC_DWORD_ACCESS */
#define PCE_LOAD(cache, pce, entry) \
JS_BEGIN_MACRO \
uint32 _prefills; \
uint32 _fills = (cache)->fills; \
do { \
/* Load until cache->fills is stable (see FILL macro below). */ \
_prefills = _fills; \
(entry) = *(pce); \
} while ((_fills = (cache)->fills) != _prefills); \
JS_END_MACRO
#define PCE_STORE(cache, pce, entry) \
JS_BEGIN_MACRO \
do { \
/* Store until no racing collider stores half or all of pce. */ \
*(pce) = (entry); \
} while (PCE_OBJECT(*pce) != PCE_OBJECT(entry) || \
PCE_PROPERTY(*pce) != PCE_PROPERTY(entry)); \
JS_END_MACRO
#endif /* !HAVE_ATOMIC_DWORD_ACCESS */
#else /* !JS_THREADSAFE */
#define PCE_LOAD(cache, pce, entry) ((entry) = *(pce))
#define PCE_STORE(cache, pce, entry) (*(pce) = (entry))
#endif /* !JS_THREADSAFE */
typedef union JSPropertyCacheEntry {
struct {
JSObject *object; /* weak link to object */
JSProperty *property; /* weak link to property, or not-found id */
} s;
#ifdef HAVE_ATOMIC_DWORD_ACCESS
prdword align;
#endif
} JSPropertyCacheEntry;
/* These may be called in lvalue or rvalue position. */
#define PCE_OBJECT(entry) ((entry).s.object)
#define PCE_PROPERTY(entry) ((entry).s.property)
typedef struct JSPropertyCache {
JSPropertyCacheEntry table[PROPERTY_CACHE_SIZE];
JSBool empty;
uint32 fills;
uint32 recycles;
uint32 tests;
uint32 misses;
uint32 flushes;
} JSPropertyCache;
/* Property-not-found lookup results are cached using this invalid pointer. */
#define PROP_NOT_FOUND(obj,id) ((JSProperty *) ((jsword)(id) | 1))
#define PROP_NOT_FOUND_ID(prop) ((jsid) ((jsword)(prop) & ~1))
#define PROP_FOUND(prop) ((prop) && ((jsword)(prop) & 1) == 0)
#define PROPERTY_CACHE_FILL(cx, cache, obj, id, prop) \
JS_BEGIN_MACRO \
uintN _hashIndex = (uintN)PROPERTY_CACHE_HASH(obj, id); \
JSPropertyCache *_cache = (cache); \
JSPropertyCacheEntry *_pce = &_cache->table[_hashIndex]; \
JSPropertyCacheEntry _entry; \
JSProperty *_pce_prop; \
PCE_LOAD(_cache, _pce, _entry); \
_pce_prop = PCE_PROPERTY(_entry); \
if (_pce_prop && _pce_prop != prop) \
_cache->recycles++; \
PCE_OBJECT(_entry) = obj; \
PCE_PROPERTY(_entry) = prop; \
_cache->empty = JS_FALSE; \
_cache->fills++; \
PCE_STORE(_cache, _pce, _entry); \
JS_END_MACRO
#define PROPERTY_CACHE_TEST(cache, obj, id, prop) \
JS_BEGIN_MACRO \
uintN _hashIndex = (uintN)PROPERTY_CACHE_HASH(obj, id); \
JSPropertyCache *_cache = (cache); \
JSPropertyCacheEntry *_pce = &_cache->table[_hashIndex]; \
JSPropertyCacheEntry _entry; \
JSProperty *_pce_prop; \
PCE_LOAD(_cache, _pce, _entry); \
_pce_prop = PCE_PROPERTY(_entry); \
_cache->tests++; \
if (_pce_prop && \
(((jsword)_pce_prop & 1) \
? PROP_NOT_FOUND_ID(_pce_prop) \
: sym_id(((JSScopeProperty *)_pce_prop)->symbols)) == id && \
PCE_OBJECT(_entry) == obj) { \
prop = _pce_prop; \
} else { \
_cache->misses++; \
prop = NULL; \
} \
JS_END_MACRO
extern void
js_FlushPropertyCache(JSContext *cx);
extern void
js_FlushPropertyCacheByProp(JSContext *cx, JSProperty *prop);
extern jsval *
js_AllocStack(JSContext *cx, uintN nslots, void **markp);
extern void
js_FreeStack(JSContext *cx, void *mark);
extern JSBool
js_GetArgument(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
extern JSBool
js_SetArgument(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
extern JSBool
js_GetLocalVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
extern JSBool
js_SetLocalVariable(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
extern JSBool
js_Invoke(JSContext *cx, uintN argc, JSBool constructing);
extern JSBool
js_CallFunctionValue(JSContext *cx, JSObject *obj, jsval fval,
uintN argc, jsval *argv, jsval *rval);
extern JSBool
js_Execute(JSContext *cx, JSObject *chain, JSScript *script, JSFunction *fun,
JSStackFrame *down, JSBool debugging, jsval *result);
extern JSBool
js_Interpret(JSContext *cx, jsval *result);
#endif /* jsinterp_h___ */

782
mozilla/js/src/jslock.c Normal file
View File

@@ -0,0 +1,782 @@
/* -*- 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.
*/
#ifdef JS_THREADSAFE
/*
* JS locking stubs.
*/
#include "jsstddef.h"
#include <stdlib.h>
#include "jspubtd.h"
#include "prthread.h"
#include "pratom.h"
/* Removed by JSIFY: #include "prlog.h" */
#include "jsutil.h" /* Added by JSIFY */
#include "jscntxt.h"
#include "jsscope.h"
#include "jspubtd.h"
#include "jslock.h"
static PRLock *_global_lock;
static void
js_LockGlobal()
{
PR_Lock(_global_lock);
}
static void
js_UnlockGlobal()
{
PR_Unlock(_global_lock);
}
#define ReadWord(W) (W)
#define AtomicAddBody(P,I)\
jsword n;\
do {\
n = ReadWord(*(P));\
} while (!js_CompareAndSwap(P, n, n + I));
#if defined(_WIN32) && !defined(NSPR_LOCK)
#pragma warning( disable : 4035 )
JS_INLINE int
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
{
__asm {
mov eax,ov
mov ecx, nv
mov ebx, w
lock cmpxchg [ebx], ecx
sete al
and eax,1h
}
}
#elif defined(SOLARIS) && !defined(NSPR_LOCK)
#ifndef ULTRA_SPARC
JS_INLINE jsword
js_ReadWord(jsword *p)
{
jsword n;
while ((n = *p) == -1)
;
return n;
}
#undef ReadWord
#define ReadWord(W) js_ReadWord(&(W))
static PRLock *_counter_lock;
#define UsingCounterLock 1
#undef AtomicAddBody
#define AtomicAddBody(P,I) \
PR_Lock(_counter_lock);\
*(P) += I;\
PR_Unlock(_counter_lock);
#endif /* !ULTRA_SPARC */
JS_INLINE int
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
{
#if defined(__GNUC__)
unsigned int res;
#ifndef ULTRA_SPARC
JS_ASSERT(nv >= 0);
asm volatile ("
stbar
swap [%1],%4
1: tst %4
bneg,a 1b
swap [%1],%4
cmp %2,%4
be,a 2f
swap [%1],%3
swap [%1],%4
ba 3f
mov 0,%0
2: mov 1,%0
3:"
: "=r" (res)
: "r" (w), "r" (ov), "r" (nv), "r" (-1));
#else /* ULTRA_SPARC */
JS_ASSERT(ov != nv);
asm volatile ("
stbar
cas [%1],%2,%3
cmp %2,%3
be,a 1f
mov 1,%0
mov 0,%0
1:"
: "=r" (res)
: "r" (w), "r" (ov), "r" (nv));
#endif /* ULTRA_SPARC */
return (int)res;
#else /* !__GNUC__ */
extern int compare_and_swap(jsword*,jsword,jsword);
#ifndef ULTRA_SPARC
JS_ASSERT(nv >= 0);
#else
JS_ASSERT(ov != nv);
#endif
return compare_and_swap(w,ov,nv);
#endif
}
#elif defined(AIX) && !defined(NSPR_LOCK)
#include <sys/atomic_op.h>
JS_INLINE int
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
{
return !_check_lock(w,ov,nv);
}
#else
static PRLock *_counter_lock;
#define UsingCounterLock 1
#undef AtomicAddBody
#define AtomicAddBody(P,I) \
PR_Lock(_counter_lock);\
*(P) += I;\
PR_Unlock(_counter_lock);
static PRLock *_compare_and_swap_lock;
#define UsingCompareAndSwapLock 1
JS_INLINE int
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
{
int res = 0;
PR_Lock(_compare_and_swap_lock);
if (*w == ov) {
*w = nv;
res = 1;
}
PR_Unlock(_compare_and_swap_lock);
return res;
}
#endif /* arch-tests */
JS_INLINE void
js_AtomicAdd(jsword *p, jsword i)
{
AtomicAddBody(p,i);
}
JS_INLINE jsword
js_AtomicSet(jsword *p, jsword n)
{
jsword o;
do {
o = ReadWord(*p);
} while (!js_CompareAndSwap(p,o,n));
return o;
}
jsword
js_CurrentThreadId()
{
return CurrentThreadId();
}
void
js_NewLock(JSThinLock *p)
{
#ifdef NSPR_LOCK
p->owner = 0;
p->fat = (JSFatLock*)JS_NEW_LOCK();
#else
memset(p, 0, sizeof(JSThinLock));
#endif
}
void
js_DestroyLock(JSThinLock *p)
{
#ifdef NSPR_LOCK
p->owner = 0xdeadbeef;
JS_DESTROY_LOCK(((JSLock*)p->fat));
#else
JS_ASSERT(p->owner == 0);
JS_ASSERT(p->fat == NULL);
#endif
}
static void js_Dequeue(JSThinLock *);
JS_INLINE jsval
js_GetSlotWhileLocked(JSContext *cx, JSObject *obj, uint32 slot)
{
jsval v;
#ifndef NSPR_LOCK
JSScope *scp = (JSScope *)obj->map;
JSThinLock *p = &scp->lock;
jsword me = cx->thread;
#endif
JS_ASSERT(obj->slots && slot < obj->map->freeslot);
#ifndef NSPR_LOCK
JS_ASSERT(me == CurrentThreadId());
if (js_CompareAndSwap(&p->owner, 0, me)) {
if (scp == (JSScope *)obj->map) {
v = obj->slots[slot];
if (!js_CompareAndSwap(&p->owner, me, 0)) {
scp->count = 1;
js_UnlockObj(cx,obj);
}
return v;
}
if (!js_CompareAndSwap(&p->owner, me, 0))
js_Dequeue(p);
}
else if (Thin_RemoveWait(ReadWord(p->owner)) == me) {
return obj->slots[slot];
}
#endif
js_LockObj(cx,obj);
v = obj->slots[slot];
js_UnlockObj(cx,obj);
return v;
}
JS_INLINE void
js_SetSlotWhileLocked(JSContext *cx, JSObject *obj, uint32 slot, jsval v)
{
#ifndef NSPR_LOCK
JSScope *scp = (JSScope *)obj->map;
JSThinLock *p = &scp->lock;
jsword me = cx->thread;
#endif
JS_ASSERT(obj->slots && slot < obj->map->freeslot);
#ifndef NSPR_LOCK
JS_ASSERT(me == CurrentThreadId());
if (js_CompareAndSwap(&p->owner, 0, me)) {
if (scp == (JSScope *)obj->map) {
obj->slots[slot] = v;
if (!js_CompareAndSwap(&p->owner, me, 0)) {
scp->count = 1;
js_UnlockObj(cx,obj);
}
return;
}
if (!js_CompareAndSwap(&p->owner, me, 0))
js_Dequeue(p);
}
else if (Thin_RemoveWait(ReadWord(p->owner)) == me) {
obj->slots[slot] = v;
return;
}
#endif
js_LockObj(cx,obj);
obj->slots[slot] = v;
js_UnlockObj(cx,obj);
}
static JSFatLock *
mallocFatlock()
{
JSFatLock *fl = (JSFatLock *)malloc(sizeof(JSFatLock)); /* for now */
JS_ASSERT(fl);
fl->susp = 0;
fl->next = NULL;
fl->prev = NULL;
fl->slock = PR_NewLock();
fl->svar = JS_NewCondVar(fl->slock);
return fl;
}
static void
freeFatlock(JSFatLock *fl)
{
PR_DestroyLock(fl->slock);
PR_DestroyCondVar(fl->svar);
free(fl);
}
static int
js_SuspendThread(JSThinLock *p)
{
JSFatLock *fl;
JSStatus stat;
while ((fl = (JSFatLock*)js_AtomicSet((jsword*)&p->fat,1)) == (JSFatLock*)1) /* busy wait */
PR_Sleep(JS_INTERVAL_NO_WAIT);
if (fl == NULL)
return 1;
PR_Lock(fl->slock);
js_AtomicSet((jsword*)&p->fat,(jsword)fl);
fl->susp++;
if (fl->susp < 1) {
PR_Unlock(fl->slock);
return 1;
}
stat = PR_WaitCondVar(fl->svar,JS_INTERVAL_NO_TIMEOUT);
if (stat == JS_FAILURE) {
fl->susp--;
return 0;
}
PR_Unlock(fl->slock);
return 1;
}
static void
js_ResumeThread(JSThinLock *p)
{
JSFatLock *fl;
JSStatus stat;
while ((fl = (JSFatLock*)js_AtomicSet((jsword*)&p->fat,1)) == (JSFatLock*)1)
PR_Sleep(JS_INTERVAL_NO_WAIT);
if (fl == NULL)
return;
PR_Lock(fl->slock);
js_AtomicSet((jsword*)&p->fat,(jsword)fl);
fl->susp--;
if (fl->susp < 0) {
PR_Unlock(fl->slock);
return;
}
stat = PR_NotifyCondVar(fl->svar);
JS_ASSERT(stat != JS_FAILURE);
PR_Unlock(fl->slock);
}
static JSFatLock *
listOfFatlocks(int l)
{
JSFatLock *m;
JSFatLock *m0;
int i;
JS_ASSERT(l>0);
m0 = m = mallocFatlock();
for (i=1; i<l; i++) {
m->next = mallocFatlock();
m = m->next;
}
return m0;
}
static void
deleteListOfFatlocks(JSFatLock *m)
{
JSFatLock *m0;
for (; m; m=m0) {
m0 = m->next;
freeFatlock(m);
}
}
static JSFatLockTable _fl_table;
JSFatLock *
allocateFatlock()
{
JSFatLock *m;
js_LockGlobal();
if (_fl_table.free == NULL) {
#ifdef DEBUG
printf("Ran out of fat locks!\n");
#endif
_fl_table.free = listOfFatlocks(10);
}
m = _fl_table.free;
_fl_table.free = m->next;
_fl_table.free->prev = NULL;
m->susp = 0;
m->next = _fl_table.taken;
m->prev = NULL;
if (_fl_table.taken != NULL)
_fl_table.taken->prev = m;
_fl_table.taken = m;
js_UnlockGlobal();
return m;
}
void
deallocateFatlock(JSFatLock *m)
{
if (m == NULL)
return;
js_LockGlobal();
if (m->prev != NULL)
m->prev->next = m->next;
if (m->next != NULL)
m->next->prev = m->prev;
if (m == _fl_table.taken)
_fl_table.taken = m->next;
m->next = _fl_table.free;
_fl_table.free = m;
js_UnlockGlobal();
}
JS_PUBLIC_API(int)
js_SetupLocks(int l)
{
if (l > 10000) /* l equals number of initially allocated fat locks */
#ifdef DEBUG
printf("Number %d very large in js_SetupLocks()!\n",l);
#endif
if (_global_lock)
return 1;
_global_lock = PR_NewLock();
JS_ASSERT(_global_lock);
#ifdef UsingCounterLock
_counter_lock = PR_NewLock();
JS_ASSERT(_counter_lock);
#endif
#ifdef UsingCompareAndSwapLock
_compare_and_swap_lock = PR_NewLock();
JS_ASSERT(_compare_and_swap_lock);
#endif
_fl_table.free = listOfFatlocks(l);
_fl_table.taken = NULL;
return 1;
}
JS_PUBLIC_API(void)
js_CleanupLocks()
{
if (_global_lock != NULL) {
deleteListOfFatlocks(_fl_table.free);
_fl_table.free = NULL;
deleteListOfFatlocks(_fl_table.taken);
_fl_table.taken = NULL;
PR_DestroyLock(_global_lock);
_global_lock = NULL;
#ifdef UsingCounterLock
PR_DestroyLock(_counter_lock);
_counter_lock = NULL;
#endif
#ifdef UsingCompareAndSwapLock
PR_DestroyLock(_compare_and_swap_lock);
_compare_and_swap_lock = NULL;
#endif
}
}
JS_PUBLIC_API(void)
js_InitContextForLocking(JSContext *cx)
{
cx->thread = CurrentThreadId();
JS_ASSERT(Thin_GetWait(cx->thread) == 0);
}
/*
It is important that emptyFatlock() clears p->fat in the empty case
while holding p->slock. This serializes the access of p->fat wrt
js_SuspendThread(), which also requires p->slock. There would
otherwise be a race condition as follows. Thread A is about to
clear p->fat, having woken up after being suspended in a situation
where no other thread has yet suspended on p. However, suppose
thread B is about to suspend on p, having just released the global
lock, and is currently calling js_SuspendThread(). In the unfortunate
case where A precedes B ever so slightly, A will think that it
should clear p->fat (being currently empty but not for long), at the
same time as B is about to suspend on p->fat. Now, A deallocates
p->fat while B is about to suspend on it. Thus, the suspension of B
is lost and B will not be properly activated.
Using p->slock as below (and correspondingly in js_SuspendThread()),
js_SuspendThread() will notice that p->fat is empty, and hence return
immediately.
*/
int
emptyFatlock(JSThinLock *p)
{
JSFatLock *fl;
int i;
PRLock* lck;
while ((fl = (JSFatLock*)js_AtomicSet((jsword*)&p->fat,1)) == (JSFatLock*)1)
PR_Sleep(JS_INTERVAL_NO_WAIT);
if (fl == NULL) {
js_AtomicSet((jsword*)&p->fat,(jsword)fl);
return 1;
}
lck = fl->slock;
PR_Lock(lck);
i = fl->susp;
if (i < 1) {
fl->susp = -1;
deallocateFatlock(fl);
fl = NULL;
}
js_AtomicSet((jsword*)&p->fat,(jsword)fl);
PR_Unlock(lck);
return i < 1;
}
/*
Fast locking and unlocking is implemented by delaying the
allocation of a system lock (fat lock) until contention. As long as
a locking thread A runs uncontended, the lock is represented solely
by storing A's identity in the object being locked.
If another thread B tries to lock the object currently locked by A,
B is enqueued into a fat lock structure (which might have to be
allocated and pointed to by the object), and suspended using NSPR
conditional variables (wait). A wait bit (Bacon bit) is set in the
lock word of the object, signalling to A that when releasing the
lock, B must be dequeued and notified.
The basic operation of the locking primitives (js_Lock(),
js_Unlock(), js_Enqueue(), and js_Dequeue()) is
compare-and-swap. Hence, when locking into p, if
compare-and-swap(p,NULL,me) succeeds this implies that p is
unlocked. Similarly, when unlocking p, if
compare-and-swap(p,me,NULL) succeeds this implies that p is
uncontended (no one is waiting because the wait bit is not set).
Furthermore, when enqueueing (after the compare-and-swap has failed
to lock the object), p->fat is used to serialize the different
accesses to the fat lock. The four function thus synchronized are
js_Enqueue, emptyFatLock, js_SuspendThread, and js_ResumeThread.
When dequeueing, the lock is released, and one of the threads
suspended on the lock is notified. If other threads still are
waiting, the wait bit is kept (in js_Enqueue), and if not, the fat
lock is deallocated (in emptyFatlock()).
p->fat is set to 1 by enqueue and emptyFatlock to signal that the pointer
is being accessed.
*/
static void
js_Enqueue(JSThinLock *p, jsword me)
{
jsword o, n;
while (1) {
o = ReadWord(p->owner);
n = Thin_SetWait(o);
if (o != 0 && js_CompareAndSwap(&p->owner,o,n)) {
JSFatLock* fl;
while ((fl = (JSFatLock*)js_AtomicSet((jsword*)&p->fat,1)) == (JSFatLock*)1)
PR_Sleep(JS_INTERVAL_NO_WAIT);
if (fl == NULL)
fl = allocateFatlock();
js_AtomicSet((jsword*)&p->fat,(jsword)fl);
js_SuspendThread(p);
if (emptyFatlock(p))
me = Thin_RemoveWait(me);
else
me = Thin_SetWait(me);
}
else if (js_CompareAndSwap(&p->owner,0,me)) {
return;
}
}
}
static void
js_Dequeue(JSThinLock *p)
{
int o = ReadWord(p->owner);
JS_ASSERT(Thin_GetWait(o));
if (!js_CompareAndSwap(&p->owner,o,0)) /* release it */
JS_ASSERT(0);
js_ResumeThread(p);
}
JS_INLINE void
js_Lock(JSThinLock *p, jsword me)
{
JS_ASSERT(me == CurrentThreadId());
if (js_CompareAndSwap(&p->owner, 0, me))
return;
if (Thin_RemoveWait(ReadWord(p->owner)) != me)
js_Enqueue(p, me);
#ifdef DEBUG
else
JS_ASSERT(0);
#endif
}
JS_INLINE void
js_Unlock(JSThinLock *p, jsword me)
{
JS_ASSERT(me == CurrentThreadId());
if (js_CompareAndSwap(&p->owner, me, 0))
return;
if (Thin_RemoveWait(ReadWord(p->owner)) == me)
js_Dequeue(p);
#ifdef DEBUG
else
JS_ASSERT(0);
#endif
}
void
js_LockRuntime(JSRuntime *rt)
{
jsword me = CurrentThreadId();
JSThinLock *p;
JS_ASSERT(Thin_RemoveWait(ReadWord(rt->rtLock.owner)) != me);
p = &rt->rtLock;
JS_LOCK0(p,me);
}
void
js_UnlockRuntime(JSRuntime *rt)
{
jsword me = CurrentThreadId();
JSThinLock *p;
JS_ASSERT(Thin_RemoveWait(ReadWord(rt->rtLock.owner)) == me);
p = &rt->rtLock;
JS_UNLOCK0(p,me);
}
JS_INLINE void
js_LockScope1(JSContext *cx, JSScope *scope, jsword me)
{
JSThinLock *p;
if (Thin_RemoveWait(ReadWord(scope->lock.owner)) == me) {
JS_ASSERT(scope->count > 0);
scope->count++;
} else {
p = &scope->lock;
JS_LOCK0(p,me);
JS_ASSERT(scope->count == 0);
scope->count = 1;
}
}
void
js_LockScope(JSContext *cx, JSScope *scope)
{
JS_ASSERT(cx->thread == CurrentThreadId());
js_LockScope1(cx,scope,cx->thread);
}
void
js_UnlockScope(JSContext *cx, JSScope *scope)
{
jsword me = cx->thread;
JSThinLock *p;
JS_ASSERT(scope->count > 0);
if (Thin_RemoveWait(ReadWord(scope->lock.owner)) != me) {
JS_ASSERT(0);
return;
}
if (--scope->count == 0) {
p = &scope->lock;
JS_UNLOCK0(p,me);
}
}
void
js_TransferScopeLock(JSContext *cx, JSScope *oldscope, JSScope *newscope)
{
jsword me;
JSThinLock *p;
JS_ASSERT(JS_IS_SCOPE_LOCKED(newscope));
/*
* If the last reference to oldscope went away, newscope needs no lock
* state update.
*/
if (!oldscope) {
return;
}
JS_ASSERT(JS_IS_SCOPE_LOCKED(oldscope));
/*
* Transfer oldscope's entry count to newscope, as it will be unlocked
* now via JS_UNLOCK_OBJ(cx,obj) calls made while we unwind the C stack
* from the current point (under js_GetMutableScope).
*/
newscope->count = oldscope->count;
/*
* Reset oldscope's lock state so that it is completely unlocked.
*/
oldscope->count = 0;
p = &oldscope->lock;
me = cx->thread;
JS_UNLOCK0(p,me);
}
void
js_LockObj(JSContext *cx, JSObject *obj)
{
JSScope *scope;
jsword me = cx->thread;
JS_ASSERT(me == CurrentThreadId());
for (;;) {
scope = (JSScope *) obj->map;
js_LockScope1(cx, scope, me);
/* If obj still has this scope, we're done. */
if (scope == (JSScope *) obj->map)
return;
/* Lost a race with a mutator; retry with obj's new scope. */
js_UnlockScope(cx, scope);
}
}
void
js_UnlockObj(JSContext *cx, JSObject *obj)
{
js_UnlockScope(cx, (JSScope *) obj->map);
}
#ifdef DEBUG
JSBool
js_IsRuntimeLocked(JSRuntime *rt)
{
return CurrentThreadId() == Thin_RemoveWait(ReadWord(rt->rtLock.owner));
}
JSBool
js_IsObjLocked(JSObject *obj)
{
JSObjectMap *map = obj->map;
return MAP_IS_NATIVE(map) && CurrentThreadId() == Thin_RemoveWait(ReadWord(((JSScope *)map)->lock.owner));
}
JSBool
js_IsScopeLocked(JSScope *scope)
{
return CurrentThreadId() == Thin_RemoveWait(ReadWord(scope->lock.owner));
}
#endif
#undef ReadWord
#endif /* JS_THREADSAFE */

219
mozilla/js/src/jslock.h Normal file
View File

@@ -0,0 +1,219 @@
/* -*- 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 jslock_h__
#define jslock_h__
#ifdef JS_THREADSAFE
#include "jstypes.h"
#include "prlock.h"
#include "prcvar.h"
#ifndef NSPR20
#include "jshash.h"
#else
/* Removed by JSIFY: #include "JShash.h"
*/
#include "jshash.h" /* Added by JSIFY */
#endif
#define Thin_GetWait(W) ((jsword)(W) & 0x1)
#define Thin_SetWait(W) ((jsword)(W) | 0x1)
#define Thin_RemoveWait(W) ((jsword)(W) & ~0x1)
typedef struct JSFatLock {
int susp;
PRLock* slock;
PRCondVar* svar;
struct JSFatLock *next;
struct JSFatLock *prev;
} JSFatLock;
typedef struct JSThinLock {
jsword owner;
JSFatLock *fat;
} JSThinLock;
typedef PRLock JSLock;
typedef struct JSFatLockTable {
JSFatLock *free;
JSFatLock *taken;
} JSFatLockTable;
#define JS_ATOMIC_ADDREF(p, i) js_AtomicAdd(p,i)
#define CurrentThreadId() (jsword)PR_GetCurrentThread()
#define JS_CurrentThreadId() js_CurrentThreadId()
#define JS_NEW_LOCK() PR_NewLock()
#define JS_DESTROY_LOCK(l) PR_DestroyLock(l)
#define JS_ACQUIRE_LOCK(l) PR_Lock(l)
#define JS_RELEASE_LOCK(l) PR_Unlock(l)
#define JS_LOCK0(P,M) js_Lock(P,M)
#define JS_UNLOCK0(P,M) js_Unlock(P,M)
#define JS_NEW_CONDVAR(l) JS_NewCondVar(l)
#define JS_DESTROY_CONDVAR(cv) PR_DestroyCondVar(cv)
#define JS_WAIT_CONDVAR(cv,to) PR_WaitCondVar(cv,to)
#define JS_NO_TIMEOUT JS_INTERVAL_NO_TIMEOUT
#define JS_NOTIFY_CONDVAR(cv) PR_NotifyCondVar(cv)
#define JS_NOTIFY_ALL_CONDVAR(cv) PR_NotifyAllCondVar(cv)
#ifdef DEBUG
#include "jsscope.h"
#define _SET_OBJ_INFO(obj,f,l) \
_SET_SCOPE_INFO(((JSScope*)obj->map),f,l)
#define _SET_SCOPE_INFO(scope,f,l) \
(JS_ASSERT(scope->count > 0 && scope->count <= 4), \
scope->file[scope->count-1] = f, \
scope->line[scope->count-1] = l)
#endif /* DEBUG */
#define JS_LOCK_RUNTIME(rt) js_LockRuntime(rt)
#define JS_UNLOCK_RUNTIME(rt) js_UnlockRuntime(rt)
#define JS_LOCK_OBJ(cx,obj) (js_LockObj(cx, obj), \
_SET_OBJ_INFO(obj,__FILE__,__LINE__))
#define JS_UNLOCK_OBJ(cx,obj) js_UnlockObj(cx, obj)
#define JS_LOCK_SCOPE(cx,scope) (js_LockScope(cx, scope), \
_SET_SCOPE_INFO(scope,__FILE__,__LINE__))
#define JS_UNLOCK_SCOPE(cx,scope) js_UnlockScope(cx, scope)
#define JS_TRANSFER_SCOPE_LOCK(cx, scope, newscope) js_TransferScopeLock(cx, scope, newscope)
extern jsword js_CurrentThreadId();
extern JS_INLINE void js_Lock(JSThinLock *, jsword);
extern JS_INLINE void js_Unlock(JSThinLock *, jsword);
extern int js_CompareAndSwap(jsword *, jsword, jsword);
extern void js_AtomicAdd(jsword*, jsword);
extern void js_LockRuntime(JSRuntime *rt);
extern void js_UnlockRuntime(JSRuntime *rt);
extern void js_LockObj(JSContext *cx, JSObject *obj);
extern void js_UnlockObj(JSContext *cx, JSObject *obj);
extern void js_LockScope(JSContext *cx, JSScope *scope);
extern void js_UnlockScope(JSContext *cx, JSScope *scope);
extern JS_PUBLIC_API(int) js_SetupLocks(int);
extern JS_PUBLIC_API(void) js_CleanupLocks();
extern JS_PUBLIC_API(void) js_InitContextForLocking(JSContext *);
extern void js_TransferScopeLock(JSContext *, JSScope *, JSScope *);
extern JS_PUBLIC_API(jsval) js_GetSlotWhileLocked(JSContext *, JSObject *, uint32);
extern JS_PUBLIC_API(void) js_SetSlotWhileLocked(JSContext *, JSObject *, uint32, jsval);
extern void js_NewLock(JSThinLock *);
extern void js_DestroyLock(JSThinLock *);
#ifdef DEBUG
#define JS_IS_RUNTIME_LOCKED(rt) js_IsRuntimeLocked(rt)
#define JS_IS_OBJ_LOCKED(obj) js_IsObjLocked(obj)
#define JS_IS_SCOPE_LOCKED(scope) js_IsScopeLocked(scope)
extern JSBool js_IsRuntimeLocked(JSRuntime *rt);
extern JSBool js_IsObjLocked(JSObject *obj);
extern JSBool js_IsScopeLocked(JSScope *scope);
#else
#define JS_IS_RUNTIME_LOCKED(rt) 0
#define JS_IS_OBJ_LOCKED(obj) 1
#define JS_IS_SCOPE_LOCKED(scope) 1
#endif /* DEBUG */
#define JS_LOCK_OBJ_VOID(cx, obj, e) \
JS_BEGIN_MACRO \
js_LockObj(cx, obj); \
e; \
js_UnlockObj(cx, obj); \
JS_END_MACRO
#define JS_LOCK_VOID(cx, e) \
JS_BEGIN_MACRO \
JSRuntime *_rt = (cx)->runtime; \
JS_LOCK_RUNTIME_VOID(_rt, e); \
JS_END_MACRO
#if defined(JS_ONLY_NSPR_LOCKS) || !(defined(_WIN32) || defined(SOLARIS) || defined(AIX))
#undef JS_LOCK0
#undef JS_UNLOCK0
#define JS_LOCK0(P,M) JS_ACQUIRE_LOCK(((JSLock*)(P)->fat)); (P)->owner = (M)
#define JS_UNLOCK0(P,M) (P)->owner = 0; JS_RELEASE_LOCK(((JSLock*)(P)->fat))
#define NSPR_LOCK 1
#endif /* arch-tests */
#else /* !JS_THREADSAFE */
#define JS_ATOMIC_ADDREF(p,i) (*(p) += i)
#define JS_CurrentThreadId() 0
#define JS_NEW_LOCK() NULL
#define JS_DESTROY_LOCK(l) ((void)0)
#define JS_ACQUIRE_LOCK(l) ((void)0)
#define JS_RELEASE_LOCK(l) ((void)0)
#define JS_LOCK0(P,M) ((void)0)
#define JS_UNLOCK0(P,M) ((void)0)
#define JS_NEW_CONDVAR(l) NULL
#define JS_DESTROY_CONDVAR(cv) ((void)0)
#define JS_WAIT_CONDVAR(cv,to) ((void)0)
#define JS_NOTIFY_CONDVAR(cv) ((void)0)
#define JS_NOTIFY_ALL_CONDVAR(cv) ((void)0)
#define JS_LOCK_RUNTIME(rt) ((void)0)
#define JS_UNLOCK_RUNTIME(rt) ((void)0)
#define JS_LOCK_OBJ(cx,obj) ((void)0)
#define JS_UNLOCK_OBJ(cx,obj) ((void)0)
#define JS_LOCK_OBJ_VOID(cx,obj,e) (e)
#define JS_LOCK_SCOPE(cx,scope) ((void)0)
#define JS_UNLOCK_SCOPE(cx,scope) ((void)0)
#define JS_TRANSFER_SCOPE_LOCK(c,o,n) ((void)0)
#define JS_IS_RUNTIME_LOCKED(rt) 1
#define JS_IS_OBJ_LOCKED(obj) 1
#define JS_IS_SCOPE_LOCKED(scope) 1
#define JS_LOCK_VOID(cx, e) JS_LOCK_RUNTIME_VOID((cx)->runtime, e)
#endif /* !JS_THREADSAFE */
#define JS_LOCK_RUNTIME_VOID(rt,e) \
JS_BEGIN_MACRO \
JS_LOCK_RUNTIME(rt); \
e; \
JS_UNLOCK_RUNTIME(rt); \
JS_END_MACRO
#define JS_LOCK_GC(rt) JS_ACQUIRE_LOCK((rt)->gcLock)
#define JS_UNLOCK_GC(rt) JS_RELEASE_LOCK((rt)->gcLock)
#define JS_LOCK_GC_VOID(rt,e) (JS_LOCK_GC(rt), (e), JS_UNLOCK_GC(rt))
#define JS_AWAIT_GC_DONE(rt) JS_WAIT_CONDVAR((rt)->gcDone, JS_NO_TIMEOUT)
#define JS_NOTIFY_GC_DONE(rt) JS_NOTIFY_ALL_CONDVAR((rt)->gcDone)
#define JS_AWAIT_REQUEST_DONE(rt) JS_WAIT_CONDVAR((rt)->requestDone, \
JS_NO_TIMEOUT)
#define JS_NOTIFY_REQUEST_DONE(rt) JS_NOTIFY_CONDVAR((rt)->requestDone)
#define JS_LOCK(P,CX) JS_LOCK0(P,(CX)->thread)
#define JS_UNLOCK(P,CX) JS_UNLOCK0(P,(CX)->thread)
#ifndef _SET_OBJ_INFO
#define _SET_OBJ_INFO(obj,f,l) ((void)0)
#endif
#ifndef _SET_SCOPE_INFO
#define _SET_SCOPE_INFO(scope,f,l) ((void)0)
#endif
#endif /* jslock_h___ */

233
mozilla/js/src/jslog.h Normal file
View File

@@ -0,0 +1,233 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 jslog_h___
#define jslog_h___
#include "jstypes.h"
JS_BEGIN_EXTERN_C
/*
/* Removed by JSIFY: ** prlog.h -- Declare interfaces to NSPR's Logging service */
#include "jsutil.h" /* Added by JSIFY */
**
** NSPR provides a logging service that is used by NSPR itself and is
** available to client programs.
**
** To use the service from a client program, you should create a
** PRLogModuleInfo structure by calling JS_NewLogModule(). After
** creating the LogModule, you can write to the log using the JS_LOG()
** macro.
**
** Initialization of the log service is handled by NSPR initialization.
**
** At execution time, you must enable the log service. To enable the
** log service, set the environment variable: NSPR_LOG_MODULES
** variable.
**
** NSPR_LOG_MODULES variable has the form:
**
** <moduleName>:<value>[, <moduleName>:<value>]*
**
** Where:
** <moduleName> is the name passed to JS_NewLogModule().
** <value> is a numeric constant, e.g. 5. This value is the maximum
** value of a log event, enumerated by PRLogModuleLevel, that you want
** written to the log.
**
** For example: to record all events of greater value than or equal to
** JS_LOG_ERROR for a LogModule names "gizmo", say:
**
** set NSPR_LOG_MODULES=gizmo:2
**
** Note that you must specify the numeric value of JS_LOG_ERROR.
**
** Special LogModule names are provided for controlling NSPR's log
** service at execution time. These controls should be set in the
** NSPR_LOG_MODULES environment variable at execution time to affect
** NSPR's log service for your application.
**
** The special LogModule "all" enables all LogModules. To enable all
** LogModule calls to JS_LOG(), say:
**
** set NSPR_LOG_MODULES=all:5
**
** The special LogModule name "sync" tells the NSPR log service to do
** unbuffered logging.
**
** The special LogModule name "buffsize:<size>" tells NSPR to set the
** log buffer to <size>.
**
** The environment variable NSPR_LOG_FILE specifies the log file to use
** unless the default of "stderr" is acceptable.
**
** To put log messages in your programs, use the JS_LOG macro:
**
** JS_LOG(<module>, <level>, (<printfString>, <args>*));
**
** Where <module> is the address of a PRLogModuleInfo structure, and
** <level> is one of the levels defined by the enumeration:
** PRLogModuleLevel. <args> is a printf() style of argument list. That
** is: (fmtstring, ...).
**
** Example:
**
** main() {
** JSIntn one = 1;
** PRLogModuleInfo * myLm = JS_NewLogModule("gizmo");
** JS_LOG( myLm, JS_LOG_ALWAYS, ("Log this! %d\n", one));
** return;
** }
**
** Note the use of printf() style arguments as the third agrument(s) to
** JS_LOG().
**
** After compiling and linking you application, set the environment:
**
** SET NSPR_LOGMODULES=gizmo:5
** SET NSPR_LOG_FILE=logfile.txt
**
** When you execute your application, the string "Log this! 1" will be
** written to the file "logfile.txt".
**
** Note to NSPR engineers: a number of PRLogModuleInfo structures are
** defined and initialized in prinit.c. See this module for ideas on
** what to log where.
**
*/
typedef enum PRLogModuleLevel {
JS_LOG_NONE = 0, /* nothing */
JS_LOG_ALWAYS = 1, /* always printed */
JS_LOG_ERROR = 2, /* error messages */
JS_LOG_WARNING = 3, /* warning messages */
JS_LOG_DEBUG = 4, /* debug messages */
JS_LOG_NOTICE = JS_LOG_DEBUG, /* notice messages */
JS_LOG_WARN = JS_LOG_WARNING, /* warning messages */
JS_LOG_MIN = JS_LOG_DEBUG, /* minimal debugging messages */
JS_LOG_MAX = JS_LOG_DEBUG /* maximal debugging messages */
} PRLogModuleLevel;
/*
** One of these structures is created for each module that uses logging.
** "name" is the name of the module
** "level" is the debugging level selected for that module
*/
typedef struct PRLogModuleInfo {
const char *name;
PRLogModuleLevel level;
struct PRLogModuleInfo *next;
} PRLogModuleInfo;
/*
** Create a new log module.
*/
EXTERN(PRLogModuleInfo*) JS_NewLogModule(const char *name);
/*
** Set the file to use for logging. Returns JS_FALSE if the file cannot
** be created
*/
EXTERN(JSBool) JS_SetLogFile(const char *name);
/*
** Set the size of the logging buffer. If "buffer_size" is zero then the
** logging becomes "synchronous" (or unbuffered).
*/
EXTERN(void) JS_SetLogBuffering(JSIntn buffer_size);
/*
** Print a string to the log. "fmt" is a PR_snprintf format type. All
** messages printed to the log are preceeded by the name of the thread
** and a time stamp. Also, the routine provides a missing newline if one
** is not provided.
*/
EXTERN(void) JS_LogPrint(const char *fmt, ...);
/*
** Flush the log to its file.
*/
EXTERN(void) JS_LogFlush(void);
/*
** Windoze 16 can't support a large static string space for all of the
** various debugging strings so logging is not enabled for it.
*/
#if (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16)
#define JS_LOGGING 1
#define JS_LOG_TEST(_module,_level) \
((_module)->level >= (_level))
/*
** Log something.
** "module" is the address of a PRLogModuleInfo structure
** "level" is the desired logging level
** "args" is a variable length list of arguments to print, in the following
** format: ("printf style format string", ...)
*/
#define JS_LOG(_module,_level,_args) \
JS_BEGIN_MACRO \
if (JS_LOG_TEST(_module,_level)) { \
JS_LogPrint _args; \
} \
JS_END_MACRO
#else /* (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16) */
#undef JS_LOGGING
#define JS_LOG_TEST(module,level) 0
#define JS_LOG(module,level,args)
#endif /* (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16) */
#ifndef NO_NSPR_10_SUPPORT
#ifdef JS_LOGGING
#define JS_LOG_BEGIN JS_LOG
#define JS_LOG_END JS_LOG
#define JS_LOG_DEFINE JS_NewLogModule
#else
#define JS_LOG_BEGIN(module,level,args)
#define JS_LOG_END(module,level,args)
#define JS_LOG_DEFINE(_name) NULL
#endif /* JS_LOGGING */
#endif /* NO_NSPR_10_SUPPORT */
#ifdef DEBUG
EXTERN(void) JS_Assert(const char *s, const char *file, JSIntn ln);
#define JS_ASSERT(_expr) \
((_expr)?((void)0):JS_Assert(# _expr,__FILE__,__LINE__))
#define JS_NOT_REACHED(_reasonStr) \
JS_Assert(_reasonStr,__FILE__,__LINE__)
#else
#define JS_ASSERT(expr) ((void) 0)
#define JS_NOT_REACHED(reasonStr)
#endif /* defined(DEBUG) */
JS_END_EXTERN_C
#endif /* jslog_h___ */

62
mozilla/js/src/jslog2.c Normal file
View File

@@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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.
*/
#include "jsbit.h"
/*
** Compute the log of the least power of 2 greater than or equal to n
*/
IMPLEMENT(JSIntn) JS_CeilingLog2(JSUint32 n)
{
JSIntn log2 = 0;
if (n & (n-1))
log2++;
if (n >> 16)
log2 += 16, n >>= 16;
if (n >> 8)
log2 += 8, n >>= 8;
if (n >> 4)
log2 += 4, n >>= 4;
if (n >> 2)
log2 += 2, n >>= 2;
if (n >> 1)
log2++;
return log2;
}
/*
** Compute the log of the greatest power of 2 less than or equal to n.
** This really just finds the highest set bit in the word.
*/
IMPLEMENT(JSIntn) JS_FloorLog2(JSUint32 n)
{
JSIntn log2 = 0;
if (n >> 16)
log2 += 16, n >>= 16;
if (n >> 8)
log2 += 8, n >>= 8;
if (n >> 4)
log2 += 4, n >>= 4;
if (n >> 2)
log2 += 2, n >>= 2;
if (n >> 1)
log2++;
return log2;
}

260
mozilla/js/src/jslong.c Normal file
View File

@@ -0,0 +1,260 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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.
*/
#include "jstypes.h"
#include "jslong.h"
static JSInt64 ll_zero = JSLL_INIT( 0x00000000,0x00000000 );
static JSInt64 ll_maxint = JSLL_INIT( 0x7fffffff, 0xffffffff );
static JSInt64 ll_minint = JSLL_INIT( 0x80000000, 0x00000000 );
#ifdef HAVE_WATCOM_BUG_2
JSInt64 __pascal __loadds __export
JSLL_Zero(void) { return ll_zero; }
JSInt64 __pascal __loadds __export
JSLL_MaxInt(void) { return ll_maxint; }
JSInt64 __pascal __loadds __export
JSLL_MinInt(void) { return ll_minint; }
#else
IMPLEMENT(JSInt64) JSLL_Zero(void) { return ll_zero; }
IMPLEMENT(JSInt64) JSLL_MaxInt(void) { return ll_maxint; }
IMPLEMENT(JSInt64) JSLL_MinInt(void) { return ll_minint; }
#endif
#ifndef HAVE_LONG_LONG
/*
** Divide 64-bit a by 32-bit b, which must be normalized so its high bit is 1.
*/
static void norm_udivmod32(JSUint32 *qp, JSUint32 *rp, JSUint64 a, JSUint32 b)
{
JSUint32 d1, d0, q1, q0;
JSUint32 r1, r0, m;
d1 = _hi16(b);
d0 = _lo16(b);
r1 = a.hi % d1;
q1 = a.hi / d1;
m = q1 * d0;
r1 = (r1 << 16) | _hi16(a.lo);
if (r1 < m) {
q1--, r1 += b;
if (r1 >= b /* i.e., we didn't get a carry when adding to r1 */
&& r1 < m) {
q1--, r1 += b;
}
}
r1 -= m;
r0 = r1 % d1;
q0 = r1 / d1;
m = q0 * d0;
r0 = (r0 << 16) | _lo16(a.lo);
if (r0 < m) {
q0--, r0 += b;
if (r0 >= b
&& r0 < m) {
q0--, r0 += b;
}
}
*qp = (q1 << 16) | q0;
*rp = r0 - m;
}
static JSUint32 CountLeadingZeros(JSUint32 a)
{
JSUint32 t;
JSUint32 r = 32;
if ((t = a >> 16) != 0)
r -= 16, a = t;
if ((t = a >> 8) != 0)
r -= 8, a = t;
if ((t = a >> 4) != 0)
r -= 4, a = t;
if ((t = a >> 2) != 0)
r -= 2, a = t;
if ((t = a >> 1) != 0)
r -= 1, a = t;
if (a & 1)
r--;
return r;
}
IMPLEMENT(void) ll_udivmod(JSUint64 *qp, JSUint64 *rp, JSUint64 a, JSUint64 b)
{
JSUint32 n0, n1, n2;
JSUint32 q0, q1;
JSUint32 rsh, lsh;
n0 = a.lo;
n1 = a.hi;
if (b.hi == 0) {
if (b.lo > n1) {
/* (0 q0) = (n1 n0) / (0 D0) */
lsh = CountLeadingZeros(b.lo);
if (lsh) {
/*
* Normalize, i.e. make the most significant bit of the
* denominator be set.
*/
b.lo = b.lo << lsh;
n1 = (n1 << lsh) | (n0 >> (32 - lsh));
n0 = n0 << lsh;
}
a.lo = n0, a.hi = n1;
norm_udivmod32(&q0, &n0, a, b.lo);
q1 = 0;
/* remainder is in n0 >> lsh */
} else {
/* (q1 q0) = (n1 n0) / (0 d0) */
if (b.lo == 0) /* user wants to divide by zero! */
b.lo = 1 / b.lo; /* so go ahead and crash */
lsh = CountLeadingZeros(b.lo);
if (lsh == 0) {
/*
* From (n1 >= b.lo)
* && (the most significant bit of b.lo is set),
* conclude that
* (the most significant bit of n1 is set)
* && (the leading quotient digit q1 = 1).
*
* This special case is necessary, not an optimization
* (Shifts counts of 32 are undefined).
*/
n1 -= b.lo;
q1 = 1;
} else {
/*
* Normalize.
*/
rsh = 32 - lsh;
b.lo = b.lo << lsh;
n2 = n1 >> rsh;
n1 = (n1 << lsh) | (n0 >> rsh);
n0 = n0 << lsh;
a.lo = n1, a.hi = n2;
norm_udivmod32(&q1, &n1, a, b.lo);
}
/* n1 != b.lo... */
a.lo = n0, a.hi = n1;
norm_udivmod32(&q0, &n0, a, b.lo);
/* remainder in n0 >> lsh */
}
if (rp) {
rp->lo = n0 >> lsh;
rp->hi = 0;
}
} else {
if (b.hi > n1) {
/* (0 0) = (n1 n0) / (D1 d0) */
q0 = 0;
q1 = 0;
/* remainder in (n1 n0) */
if (rp) {
rp->lo = n0;
rp->hi = n1;
}
} else {
/* (0 q0) = (n1 n0) / (d1 d0) */
lsh = CountLeadingZeros(b.hi);
if (lsh == 0) {
/*
* From (n1 >= b.hi)
* && (the most significant bit of b.hi is set),
* conclude that
* (the most significant bit of n1 is set)
* && (the quotient digit q0 = 0 or 1).
*
* This special case is necessary, not an optimization.
*/
/*
* The condition on the next line takes advantage of that
* n1 >= b.hi (true due to control flow).
*/
if (n1 > b.hi || n0 >= b.lo) {
q0 = 1;
a.lo = n0, a.hi = n1;
JSLL_SUB(a, a, b);
} else {
q0 = 0;
}
q1 = 0;
if (rp) {
rp->lo = n0;
rp->hi = n1;
}
} else {
JSInt64 m;
/*
* Normalize.
*/
rsh = 32 - lsh;
b.hi = (b.hi << lsh) | (b.lo >> rsh);
b.lo = b.lo << lsh;
n2 = n1 >> rsh;
n1 = (n1 << lsh) | (n0 >> rsh);
n0 = n0 << lsh;
a.lo = n1, a.hi = n2;
norm_udivmod32(&q0, &n1, a, b.hi);
JSLL_MUL32(m, q0, b.lo);
if ((m.hi > n1) || ((m.hi == n1) && (m.lo > n0))) {
q0--;
JSLL_SUB(m, m, b);
}
q1 = 0;
/* Remainder is ((n1 n0) - (m1 m0)) >> lsh */
if (rp) {
a.lo = n0, a.hi = n1;
JSLL_SUB(a, a, m);
rp->lo = (a.hi << rsh) | (a.lo >> lsh);
rp->hi = a.hi >> lsh;
}
}
}
}
if (qp) {
qp->lo = q0;
qp->hi = q1;
}
}
#endif /* !HAVE_LONG_LONG */

409
mozilla/js/src/jslong.h Normal file
View File

@@ -0,0 +1,409 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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.
*/
/*
** File: jslong.h
** Description: Portable access to 64 bit numerics
**
** Long-long (64-bit signed integer type) support. Some C compilers
** don't support 64 bit integers yet, so we use these macros to
** support both machines that do and don't.
**/
#ifndef jslong_h___
#define jslong_h___
#include "jstypes.h"
JS_BEGIN_EXTERN_C
/***********************************************************************
** DEFINES: JSLL_MaxInt
** JSLL_MinInt
** JSLL_Zero
** DESCRIPTION:
** Various interesting constants and static variable
** initializer
***********************************************************************/
#ifdef HAVE_WATCOM_BUG_2
JSInt64 __pascal __loadds __export
JSLL_MaxInt(void);
JSInt64 __pascal __loadds __export
JSLL_MinInt(void);
JSInt64 __pascal __loadds __export
JSLL_Zero(void);
#else
EXTERN(JSInt64) JSLL_MaxInt(void);
EXTERN(JSInt64) JSLL_MinInt(void);
EXTERN(JSInt64) JSLL_Zero(void);
#endif
#define JSLL_MAXINT JSLL_MaxInt()
#define JSLL_MININT JSLL_MinInt()
#define JSLL_ZERO JSLL_Zero()
#ifdef HAVE_LONG_LONG
#if JS_BYTES_PER_LONG == 8
#define JSLL_INIT(hi, lo) ((hi ## L << 32) + lo ## L)
#elif defined(WIN32) || defined(WIN16)
#define JSLL_INIT(hi, lo) ((hi ## i64 << 32) + lo ## i64)
#else
#define JSLL_INIT(hi, lo) ((hi ## LL << 32) + lo ## LL)
#endif
/***********************************************************************
** MACROS: JSLL_*
** DESCRIPTION:
** The following macros define portable access to the 64 bit
** math facilities.
**
***********************************************************************/
/***********************************************************************
** MACROS: JSLL_<relational operators>
**
** JSLL_IS_ZERO Test for zero
** JSLL_EQ Test for equality
** JSLL_NE Test for inequality
** JSLL_GE_ZERO Test for zero or positive
** JSLL_CMP Compare two values
***********************************************************************/
#define JSLL_IS_ZERO(a) ((a) == 0)
#define JSLL_EQ(a, b) ((a) == (b))
#define JSLL_NE(a, b) ((a) != (b))
#define JSLL_GE_ZERO(a) ((a) >= 0)
#define JSLL_CMP(a, op, b) ((JSInt64)(a) op (JSInt64)(b))
#define JSLL_UCMP(a, op, b) ((JSUint64)(a) op (JSUint64)(b))
/***********************************************************************
** MACROS: JSLL_<logical operators>
**
** JSLL_AND Logical and
** JSLL_OR Logical or
** JSLL_XOR Logical exclusion
** JSLL_OR2 A disgusting deviation
** JSLL_NOT Negation (one's compliment)
***********************************************************************/
#define JSLL_AND(r, a, b) ((r) = (a) & (b))
#define JSLL_OR(r, a, b) ((r) = (a) | (b))
#define JSLL_XOR(r, a, b) ((r) = (a) ^ (b))
#define JSLL_OR2(r, a) ((r) = (r) | (a))
#define JSLL_NOT(r, a) ((r) = ~(a))
/***********************************************************************
** MACROS: JSLL_<mathematical operators>
**
** JSLL_NEG Negation (two's compliment)
** JSLL_ADD Summation (two's compliment)
** JSLL_SUB Difference (two's compliment)
***********************************************************************/
#define JSLL_NEG(r, a) ((r) = -(a))
#define JSLL_ADD(r, a, b) ((r) = (a) + (b))
#define JSLL_SUB(r, a, b) ((r) = (a) - (b))
/***********************************************************************
** MACROS: JSLL_<mathematical operators>
**
** JSLL_MUL Product (two's compliment)
** JSLL_DIV Quotient (two's compliment)
** JSLL_MOD Modulus (two's compliment)
***********************************************************************/
#define JSLL_MUL(r, a, b) ((r) = (a) * (b))
#define JSLL_DIV(r, a, b) ((r) = (a) / (b))
#define JSLL_MOD(r, a, b) ((r) = (a) % (b))
/***********************************************************************
** MACROS: JSLL_<shifting operators>
**
** JSLL_SHL Shift left [0..64] bits
** JSLL_SHR Shift right [0..64] bits with sign extension
** JSLL_USHR Unsigned shift right [0..64] bits
** JSLL_ISHL Signed shift left [0..64] bits
***********************************************************************/
#define JSLL_SHL(r, a, b) ((r) = (JSInt64)(a) << (b))
#define JSLL_SHR(r, a, b) ((r) = (JSInt64)(a) >> (b))
#define JSLL_USHR(r, a, b) ((r) = (JSUint64)(a) >> (b))
#define JSLL_ISHL(r, a, b) ((r) = (JSInt64)(a) << (b))
/***********************************************************************
** MACROS: JSLL_<conversion operators>
**
** JSLL_L2I Convert to signed 32 bit
** JSLL_L2UI Convert to unsigned 32 bit
** JSLL_L2F Convert to floating point
** JSLL_L2D Convert to floating point
** JSLL_I2L Convert signed to 64 bit
** JSLL_UI2L Convert unsigned to 64 bit
** JSLL_F2L Convert float to 64 bit
** JSLL_D2L Convert float to 64 bit
***********************************************************************/
#define JSLL_L2I(i, l) ((i) = (JSInt32)(l))
#define JSLL_L2UI(ui, l) ((ui) = (JSUint32)(l))
#define JSLL_L2F(f, l) ((f) = (JSFloat64)(l))
#define JSLL_L2D(d, l) ((d) = (JSFloat64)(l))
#define JSLL_I2L(l, i) ((l) = (JSInt64)(i))
#define JSLL_UI2L(l, ui) ((l) = (JSInt64)(ui))
#define JSLL_F2L(l, f) ((l) = (JSInt64)(f))
#define JSLL_D2L(l, d) ((l) = (JSInt64)(d))
/***********************************************************************
** MACROS: JSLL_UDIVMOD
** DESCRIPTION:
** Produce both a quotient and a remainder given an unsigned
** INPUTS: JSUint64 a: The dividend of the operation
** JSUint64 b: The quotient of the operation
** OUTPUTS: JSUint64 *qp: pointer to quotient
** JSUint64 *rp: pointer to remainder
***********************************************************************/
#define JSLL_UDIVMOD(qp, rp, a, b) \
(*(qp) = ((JSUint64)(a) / (b)), \
*(rp) = ((JSUint64)(a) % (b)))
#else /* !HAVE_LONG_LONG */
#ifdef IS_LITTLE_ENDIAN
#define JSLL_INIT(hi, lo) {JS_INT32(lo), JS_INT32(hi)}
#else
#define JSLL_INIT(hi, lo) {JS_INT32(hi), JS_INT32(lo)}
#endif
#define JSLL_IS_ZERO(a) (((a).hi == 0) && ((a).lo == 0))
#define JSLL_EQ(a, b) (((a).hi == (b).hi) && ((a).lo == (b).lo))
#define JSLL_NE(a, b) (((a).hi != (b).hi) || ((a).lo != (b).lo))
#define JSLL_GE_ZERO(a) (((a).hi >> 31) == 0)
#define JSLL_CMP(a, op, b) (((JSInt32)(a).hi op (JSInt32)(b).hi) || \
(((a).hi == (b).hi) && ((a).lo op (b).lo)))
#define JSLL_UCMP(a, op, b) (((a).hi op (b).hi) || \
(((a).hi == (b).hi) && ((a).lo op (b).lo)))
#define JSLL_AND(r, a, b) ((r).lo = (a).lo & (b).lo, \
(r).hi = (a).hi & (b).hi)
#define JSLL_OR(r, a, b) ((r).lo = (a).lo | (b).lo, \
(r).hi = (a).hi | (b).hi)
#define JSLL_XOR(r, a, b) ((r).lo = (a).lo ^ (b).lo, \
(r).hi = (a).hi ^ (b).hi)
#define JSLL_OR2(r, a) ((r).lo = (r).lo | (a).lo, \
(r).hi = (r).hi | (a).hi)
#define JSLL_NOT(r, a) ((r).lo = ~(a).lo, \
(r).hi = ~(a).hi)
#define JSLL_NEG(r, a) ((r).lo = -(JSInt32)(a).lo, \
(r).hi = -(JSInt32)(a).hi - ((r).lo != 0))
#define JSLL_ADD(r, a, b) { \
JSInt64 _a, _b; \
_a = a; _b = b; \
(r).lo = _a.lo + _b.lo; \
(r).hi = _a.hi + _b.hi + ((r).lo < _b.lo); \
}
#define JSLL_SUB(r, a, b) { \
JSInt64 _a, _b; \
_a = a; _b = b; \
(r).lo = _a.lo - _b.lo; \
(r).hi = _a.hi - _b.hi - (_a.lo < _b.lo); \
}
#define JSLL_MUL(r, a, b) { \
JSInt64 _a, _b; \
_a = a; _b = b; \
JSLL_MUL32(r, _a.lo, _b.lo); \
(r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \
}
#define _lo16(a) ((a) & JS_BITMASK(16))
#define _hi16(a) ((a) >> 16)
#define JSLL_MUL32(r, a, b) { \
JSUint32 _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \
_a1 = _hi16(a), _a0 = _lo16(a); \
_b1 = _hi16(b), _b0 = _lo16(b); \
_y0 = _a0 * _b0; \
_y1 = _a0 * _b1; \
_y2 = _a1 * _b0; \
_y3 = _a1 * _b1; \
_y1 += _hi16(_y0); /* can't carry */ \
_y1 += _y2; /* might carry */ \
if (_y1 < _y2) \
_y3 += (JSUint32)(JS_BIT(16)); /* propagate */ \
(r).lo = (_lo16(_y1) << 16) + _lo16(_y0); \
(r).hi = _y3 + _hi16(_y1); \
}
#define JSLL_UDIVMOD(qp, rp, a, b) ll_udivmod(qp, rp, a, b)
EXTERN(void) ll_udivmod(JSUint64 *qp, JSUint64 *rp, JSUint64 a, JSUint64 b);
#define JSLL_DIV(r, a, b) { \
JSInt64 _a, _b; \
JSUint32 _negative = (JSInt32)(a).hi < 0; \
if (_negative) { \
JSLL_NEG(_a, a); \
} else { \
_a = a; \
} \
if ((JSInt32)(b).hi < 0) { \
_negative ^= 1; \
JSLL_NEG(_b, b); \
} else { \
_b = b; \
} \
JSLL_UDIVMOD(&(r), 0, _a, _b); \
if (_negative) \
JSLL_NEG(r, r); \
}
#define JSLL_MOD(r, a, b) { \
JSInt64 _a, _b; \
JSUint32 _negative = (JSInt32)(a).hi < 0; \
if (_negative) { \
JSLL_NEG(_a, a); \
} else { \
_a = a; \
} \
if ((JSInt32)(b).hi < 0) { \
JSLL_NEG(_b, b); \
} else { \
_b = b; \
} \
JSLL_UDIVMOD(0, &(r), _a, _b); \
if (_negative) \
JSLL_NEG(r, r); \
}
#define JSLL_SHL(r, a, b) { \
if (b) { \
JSInt64 _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = _a.lo << ((b) & 31); \
(r).hi = (_a.hi << ((b) & 31)) | (_a.lo >> (32 - (b))); \
} else { \
(r).lo = 0; \
(r).hi = _a.lo << ((b) & 31); \
} \
} else { \
(r) = (a); \
} \
}
/* a is an JSInt32, b is JSInt32, r is JSInt64 */
#define JSLL_ISHL(r, a, b) { \
if (b) { \
JSInt64 _a; \
_a.lo = (a); \
_a.hi = 0; \
if ((b) < 32) { \
(r).lo = (a) << ((b) & 31); \
(r).hi = ((a) >> (32 - (b))); \
} else { \
(r).lo = 0; \
(r).hi = (a) << ((b) & 31); \
} \
} else { \
(r).lo = (a); \
(r).hi = 0; \
} \
}
#define JSLL_SHR(r, a, b) { \
if (b) { \
JSInt64 _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = (_a.hi << (32 - (b))) | (_a.lo >> ((b) & 31)); \
(r).hi = (JSInt32)_a.hi >> ((b) & 31); \
} else { \
(r).lo = (JSInt32)_a.hi >> ((b) & 31); \
(r).hi = (JSInt32)_a.hi >> 31; \
} \
} else { \
(r) = (a); \
} \
}
#define JSLL_USHR(r, a, b) { \
if (b) { \
JSInt64 _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = (_a.hi << (32 - (b))) | (_a.lo >> ((b) & 31)); \
(r).hi = _a.hi >> ((b) & 31); \
} else { \
(r).lo = _a.hi >> ((b) & 31); \
(r).hi = 0; \
} \
} else { \
(r) = (a); \
} \
}
#define JSLL_L2I(i, l) ((i) = (l).lo)
#define JSLL_L2UI(ui, l) ((ui) = (l).lo)
#define JSLL_L2F(f, l) { double _d; JSLL_L2D(_d, l); (f) = (JSFloat64)_d; }
#define JSLL_L2D(d, l) { \
int _negative; \
JSInt64 _absval; \
\
_negative = (l).hi >> 31; \
if (_negative) { \
JSLL_NEG(_absval, l); \
} else { \
_absval = l; \
} \
(d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \
if (_negative) \
(d) = -(d); \
}
#define JSLL_I2L(l, i) { JSInt32 _i = (i) >> 31; (l).lo = (i); (l).hi = _i; }
#define JSLL_UI2L(l, ui) ((l).lo = (ui), (l).hi = 0)
#define JSLL_F2L(l, f) { double _d = (double)f; JSLL_D2L(l, _d); }
#define JSLL_D2L(l, d) { \
int _negative; \
double _absval, _d_hi; \
JSInt64 _lo_d; \
\
_negative = ((d) < 0); \
_absval = _negative ? -(d) : (d); \
\
(l).hi = _absval / 4.294967296e9; \
(l).lo = 0; \
JSLL_L2D(_d_hi, l); \
_absval -= _d_hi; \
_lo_d.hi = 0; \
if (_absval < 0) { \
_lo_d.lo = -_absval; \
JSLL_SUB(l, l, _lo_d); \
} else { \
_lo_d.lo = _absval; \
JSLL_ADD(l, l, _lo_d); \
} \
\
if (_negative) \
JSLL_NEG(l, l); \
}
#endif /* !HAVE_LONG_LONG */
JS_END_EXTERN_C
#endif /* jslong_h___ */

37
mozilla/js/src/jsmacos.h Normal file
View File

@@ -0,0 +1,37 @@
/* -*- 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 jsmacos_h___
#define jsmacos_h___
//
// This file contains all changes and additions that need to be made to the
// runtime for the Macintosh platform hosting the Metrowerks environment.
// This file should only be included in Macintosh builds.
//
JS_BEGIN_EXTERN_C
#include <stddef.h>
extern void* reallocSmaller(void* block, size_t newSize);
extern char* strdup(const char* str);
JS_END_EXTERN_C
#endif /* jsmacos_h___ */

414
mozilla/js/src/jsmath.c Normal file
View File

@@ -0,0 +1,414 @@
/* -*- 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.
*/
/*
* JS math package.
*/
#include "jsstddef.h"
#include <math.h>
#include <stdlib.h>
#include "jstypes.h"
#include "jslong.h"
#include "prmjtime.h"
#include "jsapi.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsconfig.h"
#include "jslock.h"
#include "jsmath.h"
#include "jsnum.h"
#include "jsobj.h"
#ifndef M_E
#define M_E 2.7182818284590452354
#endif
#ifndef M_LOG2E
#define M_LOG2E 1.4426950408889634074
#endif
#ifndef M_LOG10E
#define M_LOG10E 0.43429448190325182765
#endif
#ifndef M_LN2
#define M_LN2 0.69314718055994530942
#endif
#ifndef M_LN10
#define M_LN10 2.30258509299404568402
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880
#endif
#ifndef M_SQRT1_2
#define M_SQRT1_2 0.70710678118654752440
#endif
static JSConstDoubleSpec math_constants[] = {
{M_E, "E"},
{M_LOG2E, "LOG2E"},
{M_LOG10E, "LOG10E"},
{M_LN2, "LN2"},
{M_LN10, "LN10"},
{M_PI, "PI"},
{M_SQRT2, "SQRT2"},
{M_SQRT1_2, "SQRT1_2"},
{0}
};
static JSClass math_class = {
"Math",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
};
static JSBool
math_abs(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = (x < 0) ? -x : x;
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_acos(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = acos(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_asin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = asin(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_atan(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = atan(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_atan2(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, y, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
if (!js_ValueToNumber(cx, argv[1], &y))
return JS_FALSE;
z = atan2(x, y);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_ceil(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = ceil(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_cos(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = cos(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_exp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = exp(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_floor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = floor(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_log(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = log(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_max(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, y, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
if (!js_ValueToNumber(cx, argv[1], &y))
return JS_FALSE;
z = (x > y) ? x : y;
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_min(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, y, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
if (!js_ValueToNumber(cx, argv[1], &y))
return JS_FALSE;
z = (x < y) ? x : y;
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_pow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, y, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
if (!js_ValueToNumber(cx, argv[1], &y))
return JS_FALSE;
z = pow(x, y);
return js_NewNumberValue(cx, z, rval);
}
/*
* Math.random() support, lifted from java.util.Random.java.
*/
static void
random_setSeed(JSRuntime *rt, int64 seed)
{
int64 tmp;
JSLL_I2L(tmp, 1000);
JSLL_DIV(seed, seed, tmp);
JSLL_XOR(tmp, seed, rt->rngMultiplier);
JSLL_AND(rt->rngSeed, tmp, rt->rngMask);
}
static void
random_init(JSRuntime *rt)
{
int64 tmp, tmp2;
/* Do at most once. */
if (rt->rngInitialized)
return;
rt->rngInitialized = JS_TRUE;
/* rt->rngMultiplier = 0x5DEECE66DL */
JSLL_ISHL(tmp, 0x5D, 32);
JSLL_UI2L(tmp2, 0xEECE66DL);
JSLL_OR(rt->rngMultiplier, tmp, tmp2);
/* rt->rngAddend = 0xBL */
JSLL_I2L(rt->rngAddend, 0xBL);
/* rt->rngMask = (1L << 48) - 1 */
JSLL_I2L(tmp, 1);
JSLL_SHL(tmp2, tmp, 48);
JSLL_SUB(rt->rngMask, tmp2, tmp);
/* rt->rngDscale = (jsdouble)(1L << 54) */
JSLL_SHL(tmp2, tmp, 54);
JSLL_L2D(rt->rngDscale, tmp2);
/* Finally, set the seed from current time. */
random_setSeed(rt, PRMJ_Now());
}
static uint32
random_next(JSRuntime *rt, int bits)
{
int64 nextseed, tmp;
uint32 retval;
JSLL_MUL(nextseed, rt->rngSeed, rt->rngMultiplier);
JSLL_ADD(nextseed, nextseed, rt->rngAddend);
JSLL_AND(nextseed, nextseed, rt->rngMask);
rt->rngSeed = nextseed;
JSLL_USHR(tmp, nextseed, 48 - bits);
JSLL_L2I(retval, tmp);
return retval;
}
static jsdouble
random_nextDouble(JSRuntime *rt)
{
int64 tmp, tmp2;
jsdouble d;
JSLL_ISHL(tmp, random_next(rt, 27), 27);
JSLL_UI2L(tmp2, random_next(rt, 27));
JSLL_ADD(tmp, tmp, tmp2);
JSLL_L2D(d, tmp);
return d / rt->rngDscale;
}
static JSBool
math_random(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSRuntime *rt;
jsdouble z;
rt = cx->runtime;
JS_LOCK_RUNTIME(rt);
random_init(rt);
z = random_nextDouble(rt);
JS_UNLOCK_RUNTIME(rt);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_round(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = floor(x + 0.5);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_sin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = sin(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_sqrt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = sqrt(x);
return js_NewNumberValue(cx, z, rval);
}
static JSBool
math_tan(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
z = tan(x);
return js_NewNumberValue(cx, z, rval);
}
static JSFunctionSpec math_static_methods[] = {
{"abs", math_abs, 1},
{"acos", math_acos, 1},
{"asin", math_asin, 1},
{"atan", math_atan, 1},
{"atan2", math_atan2, 2},
{"ceil", math_ceil, 1},
{"cos", math_cos, 1},
{"exp", math_exp, 1},
{"floor", math_floor, 1},
{"log", math_log, 1},
{"max", math_max, 2},
{"min", math_min, 2},
{"pow", math_pow, 2},
{"random", math_random, 0},
{"round", math_round, 1},
{"sin", math_sin, 1},
{"sqrt", math_sqrt, 1},
{"tan", math_tan, 1},
{0}
};
#if JS_HAS_TOSOURCE
static JSBool
math_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
{
*rval = ATOM_KEY(cx->runtime->atomState.MathAtom);
return JS_TRUE;
}
static JSFunctionSpec math_methods[] = {
{js_toSource_str, math_toSource, 0},
{0}
};
#else
#define math_methods NULL
#endif
JSObject *
js_InitMathClass(JSContext *cx, JSObject *obj)
{
JSObject *proto;
proto = JS_InitClass(cx, obj, NULL, &math_class, NULL, 0,
NULL, math_methods, NULL, math_static_methods);
if (!proto)
return NULL;
if (!JS_DefineConstDoubles(cx, proto, math_constants))
return NULL;
return proto;
}

32
mozilla/js/src/jsmath.h Normal file
View File

@@ -0,0 +1,32 @@
/* -*- 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 jsmath_h___
#define jsmath_h___
/*
* JS math functions.
*/
JS_BEGIN_EXTERN_C
extern JSObject *
js_InitMathClass(JSContext *cx, JSObject *obj);
JS_END_EXTERN_C
#endif /* jsmath_h___ */

841
mozilla/js/src/jsnum.c Normal file
View File

@@ -0,0 +1,841 @@
/* -*- 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.
*/
/*
* JS number type and wrapper class.
*/
#include "jsstddef.h"
#include <errno.h>
#ifdef XP_PC
#include <float.h>
#endif
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "jstypes.h"
/* Removed by JSIFY: #include "prlog.h" */
#include "jsutil.h" /* Added by JSIFY */
#include "jsdtoa.h"
#include "jsprf.h"
#include "jsapi.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsconfig.h"
#include "jsgc.h"
#include "jsinterp.h"
#include "jsnum.h"
#include "jsobj.h"
#include "jsopcode.h"
#include "jsstr.h"
union dpun {
struct {
#ifdef IS_LITTLE_ENDIAN
uint32 lo, hi;
#else
uint32 hi, lo;
#endif
} s;
jsdouble d;
};
static JSBool
num_isNaN(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
*rval = BOOLEAN_TO_JSVAL(JSDOUBLE_IS_NaN(x));
return JS_TRUE;
}
static JSBool
num_isFinite(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble x;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
*rval = BOOLEAN_TO_JSVAL(JSDOUBLE_IS_FINITE(x));
return JS_TRUE;
}
static JSBool
num_parseFloat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSString *str;
jsdouble d;
const jschar *ep;
str = js_ValueToString(cx, argv[0]);
if (!str)
return JS_FALSE;
if (!js_strtod(cx, str->chars, &ep, &d))
return JS_FALSE;
if (ep == str->chars) {
*rval = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
return JS_TRUE;
}
return js_NewNumberValue(cx, d, rval);
}
/* See ECMA 15.1.2.2. */
static JSBool
num_parseInt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSString *str;
jsint radix;
jsdouble d;
const jschar *ep;
str = js_ValueToString(cx, argv[0]);
if (!str)
return JS_FALSE;
if (argc > 1) {
if (!js_ValueToECMAInt32(cx, argv[1], &radix))
return JS_FALSE;
} else
radix = 0;
if (radix != 0 && (radix < 2 || radix > 36)) {
*rval = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
return JS_TRUE;
}
if (!js_strtointeger(cx, str->chars, &ep, radix, &d))
return JS_FALSE;
if (ep == str->chars) {
*rval = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
return JS_TRUE;
}
return js_NewNumberValue(cx, d, rval);
}
static JSFunctionSpec number_functions[] = {
{"isNaN", num_isNaN, 1},
{"isFinite", num_isFinite, 1},
{"parseFloat", num_parseFloat, 1},
{"parseInt", num_parseInt, 2},
{0}
};
static JSClass number_class = {
"Number",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
};
static JSBool
Number(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsdouble d;
jsval v;
if (argc != 0) {
if (!js_ValueToNumber(cx, argv[0], &d))
return JS_FALSE;
} else {
d = 0.0;
}
if (!js_NewNumberValue(cx, d, &v))
return JS_FALSE;
if (!cx->fp->constructing) {
*rval = v;
return JS_TRUE;
}
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, v);
return JS_TRUE;
}
#if JS_HAS_TOSOURCE
static JSBool
num_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsval v;
jsdouble d;
size_t i;
char buf[64];
JSString *str;
if (!JS_InstanceOf(cx, obj, &number_class, argv))
return JS_FALSE;
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
if (!JSVAL_IS_NUMBER(v))
return js_obj_toSource(cx, obj, argc, argv, rval);
d = JSVAL_IS_INT(v) ? (jsdouble)JSVAL_TO_INT(v) : *JSVAL_TO_DOUBLE(v);
i = JS_snprintf(buf, sizeof buf, "(new %s(", number_class.name);
PR_cnvtf(buf + i, sizeof buf - i, 20, d);
i = strlen(buf);
JS_snprintf(buf + i, sizeof buf - i, "))");
str = JS_NewStringCopyZ(cx, buf);
if (!str)
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
}
#endif
static JSBool
num_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsval v;
jsdouble d;
jsint base, ival, dval;
char *bp, buf[32];
JSString *str;
if (!JS_InstanceOf(cx, obj, &number_class, argv))
return JS_FALSE;
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
if (!JSVAL_IS_NUMBER(v))
return js_obj_toString(cx, obj, argc, argv, rval);
d = JSVAL_IS_INT(v) ? (jsdouble)JSVAL_TO_INT(v) : *JSVAL_TO_DOUBLE(v);
if (argc != 0) {
if (!js_ValueToECMAInt32(cx, argv[0], &base))
return JS_FALSE;
if (base < 2 || base > 36) {
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%ld", (long) base);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_RADIX,
numBuf);
return JS_FALSE;
}
if (base != 10 && JSDOUBLE_IS_FINITE(d)) {
ival = (jsint) js_DoubleToInteger(d);
bp = buf + sizeof buf;
for (*--bp = '\0'; ival != 0 && --bp >= buf; ival /= base) {
dval = ival % base;
*bp = (char)((dval >= 10) ? 'a' - 10 + dval : '0' + dval);
}
if (*bp == '\0')
*--bp = '0';
str = JS_NewStringCopyZ(cx, bp);
} else {
str = js_NumberToString(cx, d);
}
} else {
str = js_NumberToString(cx, d);
}
if (!str)
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
}
static JSBool
num_valueOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
if (!JS_InstanceOf(cx, obj, &number_class, argv))
return JS_FALSE;
*rval = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
return JS_TRUE;
}
static JSFunctionSpec number_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, num_toSource, 0},
#endif
{js_toString_str, num_toString, 0},
{js_valueOf_str, num_valueOf, 0},
{0}
};
/* NB: Keep this in synch with number_constants[]. */
enum nc_slot {
NC_NaN,
NC_POSITIVE_INFINITY,
NC_NEGATIVE_INFINITY,
NC_MAX_VALUE,
NC_MIN_VALUE,
NC_LIMIT
};
/*
* Some to most C compilers forbid spelling these at compile time, or barf
* if you try, so all but MAX_VALUE are set at runtime by js_InitNumberClass
* using union dpun.
*/
static JSConstDoubleSpec number_constants[] = {
{0, "NaN"},
{0, "POSITIVE_INFINITY"},
{0, "NEGATIVE_INFINITY"},
{1.7976931348623157E+308, "MAX_VALUE"},
{0, "MIN_VALUE"},
{0}
};
static jsdouble NaN;
JSObject *
js_InitNumberClass(JSContext *cx, JSObject *obj)
{
JSRuntime *rt;
union dpun u;
JSObject *proto, *ctor;
rt = cx->runtime;
if (!rt->jsNaN) {
#ifdef XP_PC
#ifdef XP_OS2
/*DSR071597 - I have no idea what this really does other than mucking with the floating */
/*point unit, but it does fix a "floating point underflow" exception I am getting, and there*/
/*is similar code in the Hursley java. Making sure we have the same code in Javascript */
/*where Netscape was calling control87 on Windows... */
_control87(MCW_EM+PC_53+RC_NEAR,MCW_EM+MCW_PC+MCW_RC);
#else
_control87(MCW_EM, MCW_EM);
#endif
#endif
u.s.hi = JSDOUBLE_HI32_EXPMASK | JSDOUBLE_HI32_MANTMASK;
u.s.lo = 0xffffffff;
number_constants[NC_NaN].dval = NaN = u.d;
rt->jsNaN = js_NewDouble(cx, NaN);
if (!rt->jsNaN || !js_LockGCThing(cx, rt->jsNaN))
return NULL;
u.s.hi = JSDOUBLE_HI32_EXPMASK;
u.s.lo = 0x00000000;
number_constants[NC_POSITIVE_INFINITY].dval = u.d;
rt->jsPositiveInfinity = js_NewDouble(cx, u.d);
if (!rt->jsPositiveInfinity ||
!js_LockGCThing(cx, rt->jsPositiveInfinity)) {
return NULL;
}
u.s.hi = JSDOUBLE_HI32_SIGNBIT | JSDOUBLE_HI32_EXPMASK;
u.s.lo = 0x00000000;
number_constants[NC_NEGATIVE_INFINITY].dval = u.d;
rt->jsNegativeInfinity = js_NewDouble(cx, u.d);
if (!rt->jsNegativeInfinity ||
!js_LockGCThing(cx, rt->jsNegativeInfinity)) {
return NULL;
}
u.s.hi = 0;
u.s.lo = 1;
number_constants[NC_MIN_VALUE].dval = u.d;
}
if (!JS_DefineFunctions(cx, obj, number_functions))
return NULL;
proto = JS_InitClass(cx, obj, NULL, &number_class, Number, 1,
NULL, number_methods, NULL, NULL);
if (!proto || !(ctor = JS_GetConstructor(cx, proto)))
return NULL;
OBJ_SET_SLOT(cx, proto, JSSLOT_PRIVATE, JSVAL_ZERO);
if (!JS_DefineConstDoubles(cx, ctor, number_constants))
return NULL;
/* ECMA 15.1.1.1 */
if (!JS_DefineProperty(cx, obj, "NaN", DOUBLE_TO_JSVAL(rt->jsNaN),
NULL, NULL, 0)) {
return NULL;
}
/* ECMA 15.1.1.2 */
if (!JS_DefineProperty(cx, obj, "Infinity",
DOUBLE_TO_JSVAL(rt->jsPositiveInfinity),
NULL, NULL, 0)) {
return NULL;
}
return proto;
}
jsdouble *
js_NewDouble(JSContext *cx, jsdouble d)
{
jsdouble *dp;
dp = js_AllocGCThing(cx, GCX_DOUBLE);
if (!dp)
return NULL;
*dp = d;
return dp;
}
void
js_FinalizeDouble(JSContext *cx, jsdouble *dp)
{
*dp = NaN;
}
JSBool
js_NewDoubleValue(JSContext *cx, jsdouble d, jsval *rval)
{
jsdouble *dp;
dp = js_NewDouble(cx, d);
if (!dp)
return JS_FALSE;
*rval = DOUBLE_TO_JSVAL(dp);
return JS_TRUE;
}
JSBool
js_NewNumberValue(JSContext *cx, jsdouble d, jsval *rval)
{
jsint i;
if (JSDOUBLE_IS_INT(d, i) && INT_FITS_IN_JSVAL(i)) {
*rval = INT_TO_JSVAL(i);
} else {
if (!js_NewDoubleValue(cx, d, rval))
return JS_FALSE;
}
return JS_TRUE;
}
JSObject *
js_NumberToObject(JSContext *cx, jsdouble d)
{
JSObject *obj;
jsval v;
obj = js_NewObject(cx, &number_class, NULL, NULL);
if (!obj)
return NULL;
if (!js_NewNumberValue(cx, d, &v)) {
cx->newborn[GCX_OBJECT] = NULL;
return NULL;
}
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, v);
return obj;
}
/* XXXbe rewrite me to be ECMA-based! */
JSString *
js_NumberToString(JSContext *cx, jsdouble d)
{
jsint i;
char buf[32];
if (JSDOUBLE_IS_INT(d, i)) {
JS_snprintf(buf, sizeof buf, "%ld", (long)i);
} else {
PR_cnvtf(buf, sizeof buf, 20, d);
}
return JS_NewStringCopyZ(cx, buf);
}
JSBool
js_ValueToNumber(JSContext *cx, jsval v, jsdouble *dp)
{
JSObject *obj;
JSString *str;
const jschar *ep;
jsdouble d;
if (JSVAL_IS_OBJECT(v)) {
obj = JSVAL_TO_OBJECT(v);
if (!obj) {
*dp = 0;
return JS_TRUE;
}
if (!OBJ_DEFAULT_VALUE(cx, obj, JSTYPE_NUMBER, &v))
return JS_FALSE;
}
if (JSVAL_IS_INT(v)) {
*dp = (jsdouble)JSVAL_TO_INT(v);
} else if (JSVAL_IS_DOUBLE(v)) {
*dp = *JSVAL_TO_DOUBLE(v);
} else if (JSVAL_IS_STRING(v)) {
str = JSVAL_TO_STRING(v);
errno = 0;
/* Note that ECMAScript doesn't treat numbers beginning with a zero as octal numbers here.
* This works because all such numbers will be interpreted as decimal by js_strtod and
* will never get passed to js_strtointeger, which would interpret them as octal. */
if ((!js_strtod(cx, str->chars, &ep, &d) || js_SkipWhiteSpace(ep) != str->chars + str->length) &&
(!js_strtointeger(cx, str->chars, &ep, 0, &d) || js_SkipWhiteSpace(ep) != str->chars + str->length)) {
goto badstr;
}
*dp = d;
} else if (JSVAL_IS_BOOLEAN(v)) {
*dp = JSVAL_TO_BOOLEAN(v) ? 1 : 0;
} else {
#if JS_BUG_FALLIBLE_TONUM
str = js_DecompileValueGenerator(cx, v, NULL);
badstr:
if (str) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NAN,
JS_GetStringBytes(str));
}
return JS_FALSE;
#else
badstr:
*dp = *cx->runtime->jsNaN;
#endif
}
return JS_TRUE;
}
JSBool
js_ValueToECMAInt32(JSContext *cx, jsval v, int32 *ip)
{
jsdouble d;
if (!js_ValueToNumber(cx, v, &d))
return JS_FALSE;
return js_DoubleToECMAInt32(cx, d, ip);
}
JSBool
js_DoubleToECMAInt32(JSContext *cx, jsdouble d, int32 *ip)
{
jsdouble two32 = 4294967296.0;
jsdouble two31 = 2147483648.0;
if (!JSDOUBLE_IS_FINITE(d) || d == 0) {
*ip = 0;
return JS_TRUE;
}
d = fmod(d, two32);
d = d >= 0 ? d : d + two32;
if (d >= two31)
*ip = (int32)(d - two32);
else
*ip = (int32)d;
return JS_TRUE;
}
JSBool
js_ValueToECMAUint32(JSContext *cx, jsval v, uint32 *ip)
{
jsdouble d;
if (!js_ValueToNumber(cx, v, &d))
return JS_FALSE;
return js_DoubleToECMAUint32(cx, d, ip);
}
JSBool
js_DoubleToECMAUint32(JSContext *cx, jsdouble d, uint32 *ip)
{
JSBool neg;
jsdouble two32 = 4294967296.0;
if (!JSDOUBLE_IS_FINITE(d) || d == 0) {
*ip = 0;
return JS_TRUE;
}
neg = (d < 0);
d = floor(neg ? -d : d);
d = neg ? -d : d;
d = fmod(d, two32);
d = d >= 0 ? d : d + two32;
*ip = (uint32)d;
return JS_TRUE;
}
JSBool
js_ValueToInt32(JSContext *cx, jsval v, int32 *ip)
{
jsdouble d;
JSString *str;
if (!js_ValueToNumber(cx, v, &d))
return JS_FALSE;
if (JSDOUBLE_IS_NaN(d) || d <= -2147483649.0 || 2147483648.0 <= d) {
str = js_DecompileValueGenerator(cx, v, NULL);
if (str) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_CANT_CONVERT, JS_GetStringBytes(str));
}
return JS_FALSE;
}
*ip = (int32)floor(d + 0.5); /* Round to nearest */
return JS_TRUE;
}
JSBool
js_ValueToUint16(JSContext *cx, jsval v, uint16 *ip)
{
jsdouble d;
jsuint i, m;
JSBool neg;
if (!js_ValueToNumber(cx, v, &d))
return JS_FALSE;
if (d == 0 || !JSDOUBLE_IS_FINITE(d)) {
*ip = 0;
return JS_TRUE;
}
i = (jsuint)d;
if ((jsdouble)i == d) {
*ip = (uint16)i;
return JS_TRUE;
}
neg = (d < 0);
d = floor(neg ? -d : d);
d = neg ? -d : d;
m = JS_BIT(16);
d = fmod(d, m);
if (d < 0)
d += m;
*ip = (uint16) d;
return JS_TRUE;
}
jsdouble
js_DoubleToInteger(jsdouble d)
{
JSBool neg;
if (d == 0)
return d;
if (!JSDOUBLE_IS_FINITE(d)) {
if (JSDOUBLE_IS_NaN(d))
return 0;
return d;
}
neg = (d < 0);
d = floor(neg ? -d : d);
return neg ? -d : d;
}
JSBool
js_strtod(JSContext *cx, const jschar *s, const jschar **ep, jsdouble *dp)
{
size_t i;
char *cstr, *istr, *estr;
JSBool negative;
jsdouble d;
const jschar *s1 = js_SkipWhiteSpace(s);
size_t length = js_strlen(s1);
cstr = malloc(length + 1);
if (!cstr)
return JS_FALSE;
for (i = 0; i <= length; i++) {
if (s1[i] >> 8) {
cstr[i] = 0;
break;
}
cstr[i] = (char)s1[i];
}
istr = cstr;
if ((negative = (*istr == '-')) != 0 || *istr == '+')
istr++;
if (!strncmp(istr, "Infinity", 8)) {
d = *(negative ? cx->runtime->jsNegativeInfinity : cx->runtime->jsPositiveInfinity);
estr = istr + 8;
} else {
errno = 0;
d = PR_strtod(cstr, &estr);
if (errno == ERANGE)
if (d == HUGE_VAL)
d = *cx->runtime->jsPositiveInfinity;
else if (d == -HUGE_VAL)
d = *cx->runtime->jsNegativeInfinity;
#ifdef HPUX
if (d == 0.0 && negative) {
/*
* "-0", "-1e-2000" come out as positive zero
* here on HPUX. Force a negative zero instead.
*/
JSDOUBLE_HI32(d) = JSDOUBLE_HI32_SIGNBIT;
JSDOUBLE_LO32(d) = 0;
}
#endif
}
free(cstr);
i = estr - cstr;
*ep = i ? s1 + i : s;
*dp = d;
return JS_TRUE;
}
struct BinaryDigitReader
{
uintN base; /* Base of number; must be a power of 2 */
uintN digit; /* Current digit value in radix given by base */
uintN digitMask; /* Mask to extract the next bit from digit */
const jschar *digits; /* Pointer to the remaining digits */
const jschar *end; /* Pointer to first non-digit */
};
/* Return the next binary digit from the number or -1 if done */
static intN GetNextBinaryDigit(struct BinaryDigitReader *bdr)
{
intN bit;
if (bdr->digitMask == 0) {
uintN c;
if (bdr->digits == bdr->end)
return -1;
c = *bdr->digits++;
if ('0' <= c && c <= '9')
bdr->digit = c - '0';
else if ('a' <= c && c <= 'z')
bdr->digit = c - 'a' + 10;
else bdr->digit = c - 'A' + 10;
bdr->digitMask = bdr->base >> 1;
}
bit = (bdr->digit & bdr->digitMask) != 0;
bdr->digitMask >>= 1;
return bit;
}
JSBool
js_strtointeger(JSContext *cx, const jschar *s, const jschar **ep, jsint base, jsdouble *dp)
{
JSBool negative;
jsdouble value;
const jschar *start;
const jschar *s1 = js_SkipWhiteSpace(s);
if ((negative = (*s1 == '-')) != 0 || *s1 == '+')
s1++;
if (base == 0)
/* No base supplied, or some base that evaluated to 0. */
if (*s1 == '0')
/* It's either hex or octal; only increment char if str isn't '0' */
if (s1[1] == 'X' || s1[1] == 'x') { /* Hex */
s1 += 2;
base = 16;
} else /* Octal */
base = 8;
else
base = 10; /* Default to decimal. */
else if (base == 16 && *s1 == '0' && (s1[1] == 'X' || s1[1] == 'x'))
/* If base is 16, ignore hex prefix. */
s1 += 2;
/* Done with the preliminaries; find some prefix of the string that's
* a number in the given base.
*/
start = s1; /* Mark - if string is empty, we return NaN. */
value = 0.0;
while (1) {
uintN digit;
jschar c = *s1;
if ('0' <= c && c <= '9')
digit = c - '0';
else if ('a' <= c && c <= 'z')
digit = c - 'a' + 10;
else if ('A' <= c && c <= 'Z')
digit = c - 'A' + 10;
else
break;
if (digit >= (uintN)base)
break;
value = value*base + digit;
s1++;
}
if (value >= 9007199254740992.0)
if (base == 10) {
/* If we're accumulating a decimal number and the number is >= 2^53, then
* the result from the repeated multiply-add above may be inaccurate. Call
* PR_strtod to get the correct answer.
*/
size_t i;
size_t length = s1 - start;
char *cstr = malloc(length + 1);
char *estr;
if (!cstr)
return JS_FALSE;
for (i = 0; i != length; i++)
cstr[i] = (char)start[i];
cstr[length] = 0;
errno = 0;
value = PR_strtod(cstr, &estr);
if (errno == ERANGE && value == HUGE_VAL)
value = *cx->runtime->jsPositiveInfinity;
free(cstr);
} else if (base == 2 || base == 4 || base == 8 || base == 16 || base == 32) {
/* The number may also be inaccurate for one of these bases. This
* happens if the addition in value*base + digit causes a round-down
* to an even least significant mantissa bit when the first dropped bit
* is a one. If any of the following digits in the number (which haven't
* been added in yet) are nonzero then the correct action would have
* been to round up instead of down. An example of this occurs when
* reading the number 0x1000000000000081, which rounds to 0x1000000000000000
* instead of 0x1000000000000100.
*/
struct BinaryDigitReader bdr;
intN bit, bit2;
intN j;
bdr.base = base;
bdr.digitMask = 0;
bdr.digits = start;
bdr.end = s1;
value = 0.0;
/* Skip leading zeros. */
do {
bit = GetNextBinaryDigit(&bdr);
} while (bit == 0);
if (bit == 1) {
/* Gather the 53 significant bits (including the leading 1) */
value = 1.0;
for (j = 52; j; j--) {
bit = GetNextBinaryDigit(&bdr);
if (bit < 0)
goto done;
value = value*2 + bit;
}
/* bit2 is the 54th bit (the first dropped from the mantissa) */
bit2 = GetNextBinaryDigit(&bdr);
if (bit2 >= 0) {
jsdouble factor = 2.0;
intN sticky = 0; /* sticky is 1 if any bit beyond the 54th is 1 */
intN bit3;
while ((bit3 = GetNextBinaryDigit(&bdr)) >= 0) {
sticky |= bit3;
factor *= 2;
}
value += bit2 & (bit | sticky);
value *= factor;
}
done:;
}
}
/* We don't worry about inaccurate numbers for any other base. */
if (s1 == start) {
*dp = 0.0;
*ep = s;
} else {
*dp = negative ? -value : value;
*ep = s1;
}
return JS_TRUE;
}

167
mozilla/js/src/jsnum.h Normal file
View File

@@ -0,0 +1,167 @@
/* -*- 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 jsnum_h___
#define jsnum_h___
/*
* JS number (IEEE double) interface.
*
* JS numbers are optimistically stored in the top 31 bits of 32-bit integers,
* but floating point literals, results that overflow 31 bits, and division and
* modulus operands and results require a 64-bit IEEE double. These are GC'ed
* and pointed to by 32-bit jsvals on the stack and in object properties.
*
* When a JS number is treated as an object (followed by . or []), the runtime
* wraps it with a JSObject whose valueOf method returns the unwrapped number.
*/
JS_BEGIN_EXTERN_C
#ifdef IS_LITTLE_ENDIAN
#define JSDOUBLE_HI32(x) (((uint32 *)&(x))[1])
#define JSDOUBLE_LO32(x) (((uint32 *)&(x))[0])
#else
#define JSDOUBLE_HI32(x) (((uint32 *)&(x))[0])
#define JSDOUBLE_LO32(x) (((uint32 *)&(x))[1])
#endif
#define JSDOUBLE_HI32_SIGNBIT 0x80000000
#define JSDOUBLE_HI32_EXPMASK 0x7ff00000
#define JSDOUBLE_HI32_MANTMASK 0x000fffff
#define JSDOUBLE_IS_NaN(x) \
((JSDOUBLE_HI32(x) & JSDOUBLE_HI32_EXPMASK) == JSDOUBLE_HI32_EXPMASK && \
(JSDOUBLE_LO32(x) || (JSDOUBLE_HI32(x) & JSDOUBLE_HI32_MANTMASK)))
#define JSDOUBLE_IS_INFINITE(x) \
((JSDOUBLE_HI32(x) & ~JSDOUBLE_HI32_SIGNBIT) == JSDOUBLE_HI32_EXPMASK && \
!JSDOUBLE_LO32(x))
#define JSDOUBLE_IS_FINITE(x) \
((JSDOUBLE_HI32(x) & JSDOUBLE_HI32_EXPMASK) != JSDOUBLE_HI32_EXPMASK)
#define JSDOUBLE_IS_NEGZERO(d) (JSDOUBLE_HI32(d) == JSDOUBLE_HI32_SIGNBIT && \
JSDOUBLE_LO32(d) == 0)
/*
* JSDOUBLE_IS_INT first checks that d is neither NaN nor infinite, to avoid
* raising SIGFPE on platforms such as Alpha Linux, then (only if the cast is
* safe) leaves i as (jsint)d. This also avoid anomalous NaN floating point
* comparisons under MSVC.
*/
#define JSDOUBLE_IS_INT(d, i) (JSDOUBLE_IS_FINITE(d) && !JSDOUBLE_IS_NEGZERO(d) \
&& ((d) == (i = (jsint)(d))))
/* Initialize the Number class, returning its prototype object. */
extern JSObject *
js_InitNumberClass(JSContext *cx, JSObject *obj);
/* GC-allocate a new JS number. */
extern jsdouble *
js_NewDouble(JSContext *cx, jsdouble d);
extern void
js_FinalizeDouble(JSContext *cx, jsdouble *dp);
extern JSBool
js_NewDoubleValue(JSContext *cx, jsdouble d, jsval *rval);
extern JSBool
js_NewNumberValue(JSContext *cx, jsdouble d, jsval *rval);
/* Construct a Number instance that wraps around d. */
extern JSObject *
js_NumberToObject(JSContext *cx, jsdouble d);
/* Convert a number to a GC'ed string. */
extern JSString *
js_NumberToString(JSContext *cx, jsdouble d);
/*
* Convert a value to a number, returning false after reporting any error,
* otherwise returning true with *dp set.
*/
extern JSBool
js_ValueToNumber(JSContext *cx, jsval v, jsdouble *dp);
/*
* Convert a value or a double to an int32, according to the ECMA rules
* for ToInt32.
*/
extern JSBool
js_ValueToECMAInt32(JSContext *cx, jsval v, int32 *ip);
extern JSBool
js_DoubleToECMAInt32(JSContext *cx, jsdouble d, int32 *ip);
/*
* Convert a value or a double to a uint32, according to the ECMA rules
* for ToUint32.
*/
extern JSBool
js_ValueToECMAUint32(JSContext *cx, jsval v, uint32 *ip);
extern JSBool
js_DoubleToECMAUint32(JSContext *cx, jsdouble d, uint32 *ip);
/*
* Convert a value to a number, then to an int32 if it fits by rounding to
* nearest; but failing with an error report if the double is out of range
* or unordered.
*/
extern JSBool
js_ValueToInt32(JSContext *cx, jsval v, int32 *ip);
/*
* Convert a value to a number, then to a uint16 according to the ECMA rules
* for ToUint16.
*/
extern JSBool
js_ValueToUint16(JSContext *cx, jsval v, uint16 *ip);
/*
* Convert a jsdouble to an integral number, stored in a jsdouble.
* If d is NaN, return 0. If d is an infinity, return it without conversion.
*/
extern jsdouble
js_DoubleToInteger(jsdouble d);
/*
* Similar to strtod except that replaces overflows with infinities of the correct
* sign and underflows with zeros of the correct sign. Guaranteed to return the
* closest double number to the given input in dp.
* Also allows inputs of the form [+|-]Infinity, which produce an infinity of the
* appropriate sign. The case of the "Infinity" string must match.
* If the string does not have a number in it, set *ep to s and return 0.0 in dp.
* Return false if out of memory.
*/
extern JSBool
js_strtod(JSContext *cx, const jschar *s, const jschar **ep, jsdouble *dp);
/*
* Similar to strtol except that handles integers of arbitrary size. Guaranteed to
* return the closest double number to the given input when radix is 10 or a power of 2.
* May experience roundoff errors for very large numbers of a different radix.
* If the string does not have a number in it, set *ep to s and return 0.0 in dp.
* Return false if out of memory.
*/
extern JSBool
js_strtointeger(JSContext *cx, const jschar *s, const jschar **ep, jsint radix, jsdouble *dp);
JS_END_EXTERN_C
#endif /* jsnum_h___ */

2574
mozilla/js/src/jsobj.c Normal file

File diff suppressed because it is too large Load Diff

335
mozilla/js/src/jsobj.h Normal file
View File

@@ -0,0 +1,335 @@
/* -*- 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 jsobj_h___
#define jsobj_h___
/*
* JS object definitions.
*
* A JS object consists of a possibly-shared object descriptor containing
* ordered property names, called the map; and a dense vector of property
* values, called slots. The map/slot pointer pair is GC'ed, while the map
* is reference counted and the slot vector is malloc'ed.
*/
#ifdef NETSCAPE_INTERNAL
#ifndef NSPR20
#include "jshash.h"
#else
/* Removed by JSIFY: #include "JShash.h"
*/
#include "jshash.h" /* Added by JSIFY */
#endif
#endif
#include "jsprvtd.h"
#include "jspubtd.h"
JS_BEGIN_EXTERN_C
struct JSObjectMap {
jsrefcount nrefs; /* count of all referencing objects */
JSObjectOps *ops; /* high level object operation vtable */
uint32 nslots; /* length of obj->slots vector */
uint32 freeslot; /* index of next free obj->slots element */
};
/* Shorthand macros for frequently-made calls. */
#if defined JS_THREADSAFE && defined DEBUG
#define OBJ_LOOKUP_PROPERTY(cx,obj,id,objp,propp) \
(obj)->map->ops->lookupProperty(cx,obj,id,objp,propp,__FILE__,__LINE__)
#else
#define OBJ_LOOKUP_PROPERTY(cx,obj,id,objp,propp) \
(obj)->map->ops->lookupProperty(cx,obj,id,objp,propp)
#endif
#define OBJ_DEFINE_PROPERTY(cx,obj,id,value,getter,setter,attrs,propp) \
(obj)->map->ops->defineProperty(cx,obj,id,value,getter,setter,attrs,propp)
#define OBJ_GET_PROPERTY(cx,obj,id,vp) \
(obj)->map->ops->getProperty(cx,obj,id,vp)
#define OBJ_SET_PROPERTY(cx,obj,id,vp) \
(obj)->map->ops->setProperty(cx,obj,id,vp)
#define OBJ_GET_ATTRIBUTES(cx,obj,id,prop,attrsp) \
(obj)->map->ops->getAttributes(cx,obj,id,prop,attrsp)
#define OBJ_SET_ATTRIBUTES(cx,obj,id,prop,attrsp) \
(obj)->map->ops->setAttributes(cx,obj,id,prop,attrsp)
#define OBJ_DELETE_PROPERTY(cx,obj,id,rval) \
(obj)->map->ops->deleteProperty(cx,obj,id,rval)
#define OBJ_DEFAULT_VALUE(cx,obj,hint,vp) \
(obj)->map->ops->defaultValue(cx,obj,hint,vp)
#define OBJ_ENUMERATE(cx,obj,enum_op,statep,idp) \
(obj)->map->ops->enumerate(cx,obj,enum_op,statep,idp)
#define OBJ_CHECK_ACCESS(cx,obj,id,mode,vp,attrsp) \
(obj)->map->ops->checkAccess(cx,obj,id,mode,vp,attrsp)
/* These two are time-optimized to avoid stub calls. */
#define OBJ_THIS_OBJECT(cx,obj) \
((obj)->map->ops->thisObject \
? (obj)->map->ops->thisObject(cx,obj) \
: (obj))
#define OBJ_DROP_PROPERTY(cx,obj,prop) \
((obj)->map->ops->dropProperty \
? (obj)->map->ops->dropProperty(cx,obj,prop) \
: (void)0)
struct JSObject {
JSObjectMap *map;
jsval *slots;
};
#define JSSLOT_PROTO 0
#define JSSLOT_PARENT 1
#define JSSLOT_CLASS 2
#define JSSLOT_PRIVATE 3
#define JSSLOT_START 3
#define JSSLOT_FREE(clasp) (((clasp)->flags & JSCLASS_HAS_PRIVATE) \
? JSSLOT_PRIVATE + 1 \
: JSSLOT_START)
#define JS_INITIAL_NSLOTS 5
#ifdef DEBUG
#define MAP_CHECK_SLOT(map,slot) \
JS_ASSERT((uint32)slot < JS_MAX((map)->nslots, (map)->freeslot))
#define OBJ_CHECK_SLOT(obj,slot) \
MAP_CHECK_SLOT((obj)->map, slot)
#else
#define OBJ_CHECK_SLOT(obj,slot) ((void)0)
#endif
/* Fast macros for accessing obj->slots while obj is locked (if thread-safe). */
#define LOCKED_OBJ_GET_SLOT(obj,slot) \
(OBJ_CHECK_SLOT(obj, slot), (obj)->slots[slot])
#define LOCKED_OBJ_SET_SLOT(obj,slot,value) \
(OBJ_CHECK_SLOT(obj, slot), (obj)->slots[slot] = (value))
#define LOCKED_OBJ_GET_PROTO(obj) \
JSVAL_TO_OBJECT(LOCKED_OBJ_GET_SLOT(obj, JSSLOT_PROTO))
#define LOCKED_OBJ_GET_CLASS(obj) \
((JSClass *)JSVAL_TO_PRIVATE(LOCKED_OBJ_GET_SLOT(obj, JSSLOT_CLASS)))
#ifdef JS_THREADSAFE
/* Thread-safe functions and wrapper macros for accessing obj->slots. */
#define OBJ_GET_SLOT(cx,obj,slot) \
(OBJ_CHECK_SLOT(obj, slot), js_GetSlotWhileLocked(cx, obj, slot))
#define OBJ_SET_SLOT(cx,obj,slot,value) \
(OBJ_CHECK_SLOT(obj, slot), js_SetSlotWhileLocked(cx, obj, slot, value))
#else /* !JS_THREADSAFE */
#define OBJ_GET_SLOT(cx,obj,slot) LOCKED_OBJ_GET_SLOT(obj,slot)
#define OBJ_SET_SLOT(cx,obj,slot,value) LOCKED_OBJ_SET_SLOT(obj,slot,value)
#endif /* !JS_THREADSAFE */
/* Thread-safe proto, parent, and class access macros. */
#define OBJ_GET_PROTO(cx,obj) \
JSVAL_TO_OBJECT(OBJ_GET_SLOT(cx, obj, JSSLOT_PROTO))
#define OBJ_SET_PROTO(cx,obj,proto) \
OBJ_SET_SLOT(cx, obj, JSSLOT_PROTO, OBJECT_TO_JSVAL(proto))
#define OBJ_GET_PARENT(cx,obj) \
JSVAL_TO_OBJECT(OBJ_GET_SLOT(cx, obj, JSSLOT_PARENT))
#define OBJ_SET_PARENT(cx,obj,parent) \
OBJ_SET_SLOT(cx, obj, JSSLOT_PARENT, OBJECT_TO_JSVAL(parent))
#define OBJ_GET_CLASS(cx,obj) \
((JSClass *)JSVAL_TO_PRIVATE(OBJ_GET_SLOT(cx, obj, JSSLOT_CLASS)))
/* Test whether a map or object is native. */
#define MAP_IS_NATIVE(map) ((map)->ops == &js_ObjectOps || \
(map)->ops == &js_WithObjectOps)
#define OBJ_IS_NATIVE(obj) MAP_IS_NATIVE((obj)->map)
extern JS_FRIEND_DATA(JSObjectOps) js_ObjectOps;
extern JS_FRIEND_DATA(JSObjectOps) js_WithObjectOps;
extern JSClass js_ObjectClass;
extern JSClass js_WithClass;
struct JSSharpObjectMap {
jsrefcount depth;
jsatomid sharpgen;
JSHashTable *table;
};
#define SHARP_BIT 1
#define IS_SHARP(he) ((jsatomid)(he)->value & SHARP_BIT)
#define MAKE_SHARP(he) ((he)->value = (void*)((jsatomid)(he)->value|SHARP_BIT))
extern JSHashEntry *
js_EnterSharpObject(JSContext *cx, JSObject *obj, JSIdArray **idap,
jschar **sp);
extern void
js_LeaveSharpObject(JSContext *cx, JSIdArray **idap);
extern JSBool
js_obj_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval);
extern JSBool
js_obj_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval);
extern JSObject *
js_InitObjectClass(JSContext *cx, JSObject *obj);
extern void
js_InitObjectMap(JSObjectMap *map, jsrefcount nrefs, JSObjectOps *ops,
JSClass *clasp);
extern JSObjectMap *
js_NewObjectMap(JSContext *cx, jsrefcount nrefs, JSObjectOps *ops,
JSClass *clasp, JSObject *obj);
extern void
js_DestroyObjectMap(JSContext *cx, JSObjectMap *map);
extern JSObjectMap *
js_HoldObjectMap(JSContext *cx, JSObjectMap *map);
extern JSObjectMap *
js_DropObjectMap(JSContext *cx, JSObjectMap *map, JSObject *obj);
extern JSObject *
js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);
extern JSObject *
js_ConstructObject(JSContext *cx, JSClass *clasp, JSObject *proto,
JSObject *parent);
extern void
js_FinalizeObject(JSContext *cx, JSObject *obj);
extern JSBool
js_AllocSlot(JSContext *cx, JSObject *obj, uint32 *slotp);
extern void
js_FreeSlot(JSContext *cx, JSObject *obj, uint32 slot);
/*
* On error, return false. On success, if propp is non-null, return true with
* obj locked and with a held property in *propp; if propp is null, return true
* but release obj's lock first. Therefore all callers who pass non-null propp
* result parameters must later call OBJ_DROP_PROPERTY(cx, obj, *propp) both to
* drop the held property, and to release the lock on obj.
*/
extern JSBool
js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
JSProperty **propp);
/*
* Unlike js_DefineProperty, propp must be non-null. On success, and if id was
* found, return true with *objp non-null and locked, and with a held property
* stored in *propp. If successful but id was not found, return true with both
* *objp and *propp null. Therefore all callers who receive a non-null *propp
* must later call OBJ_DROP_PROPERTY(cx, *objp, *propp).
*/
#if defined JS_THREADSAFE && defined DEBUG
extern JS_FRIEND_API(JSBool)
_js_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
JSProperty **propp, const char *file, uintN line);
#define js_LookupProperty(cx,obj,id,objp,propp) \
_js_LookupProperty(cx,obj,id,objp,propp,__FILE__,__LINE__)
#else
extern JS_FRIEND_API(JSBool)
js_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
JSProperty **propp);
#endif
extern JS_FRIEND_API(JSBool)
js_FindProperty(JSContext *cx, jsid id, JSObject **objp, JSObject **pobjp,
JSProperty **propp);
extern JSBool
js_FindVariable(JSContext *cx, jsid id, JSObject **objp, JSObject **pobjp,
JSProperty **propp);
extern JSObject *
js_FindVariableScope(JSContext *cx, JSFunction **funp);
extern JSBool
js_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
extern JSBool
js_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
extern JSBool
js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
uintN *attrsp);
extern JSBool
js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
uintN *attrsp);
extern JSBool
js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval);
extern JSBool
js_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp);
extern JSBool
js_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
jsval *statep, jsid *idp);
extern JSBool
js_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
jsval *vp, uintN *attrsp);
extern JSBool
js_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
extern JSBool
js_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval);
extern JSBool
js_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
extern JSBool
js_IsDelegate(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
extern JSBool
js_GetClassPrototype(JSContext *cx, const char *name, JSObject **protop);
extern JSBool
js_SetClassPrototype(JSContext *cx, JSObject *ctor, JSObject *proto,
uintN attrs);
extern JSBool
js_ValueToObject(JSContext *cx, jsval v, JSObject **objp);
extern JSObject *
js_ValueToNonNullObject(JSContext *cx, jsval v);
extern void
js_TryValueOf(JSContext *cx, JSObject *obj, JSType type, jsval *rval);
extern void
js_TryMethod(JSContext *cx, JSObject *obj, JSAtom *atom,
uintN argc, jsval *argv, jsval *rval);
extern JSBool
js_XDRObject(JSXDRState *xdr, JSObject **objp);
extern JSIdArray *
js_NewIdArray(JSContext *cx, jsint length);
JS_END_EXTERN_C
#endif /* jsobj_h___ */

2197
mozilla/js/src/jsopcode.c Normal file

File diff suppressed because it is too large Load Diff

188
mozilla/js/src/jsopcode.h Normal file
View File

@@ -0,0 +1,188 @@
/* -*- 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 jsopcode_h___
#define jsopcode_h___
/*
* JS bytecode definitions.
*/
#include <stddef.h>
#include "jsprvtd.h"
#include "jspubtd.h"
JS_BEGIN_EXTERN_C
/*
* JS operation bytecodes.
*/
typedef enum JSOp {
#define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \
op = val,
#include "jsopcode.tbl"
#undef OPDEF
JSOP_LIMIT
} JSOp;
/*
* JS bytecode formats.
*/
#define JOF_BYTE 0 /* single bytecode, no immediates */
#define JOF_JUMP 1 /* signed 16-bit jump offset immediate */
#define JOF_CONST 2 /* unsigned 16-bit constant pool index */
#define JOF_UINT16 3 /* unsigned 16-bit immediate operand */
#define JOF_TABLESWITCH 4 /* table switch */
#define JOF_LOOKUPSWITCH 5 /* lookup switch */
#define JOF_QARG 6 /* quickened get/set function argument ops */
#define JOF_QVAR 7 /* quickened get/set local variable ops */
#define JOF_TYPEMASK 0x000f /* mask for above immediate types */
#define JOF_NAME 0x0010 /* name operation */
#define JOF_PROP 0x0020 /* obj.prop operation */
#define JOF_ELEM 0x0030 /* obj[index] operation */
#define JOF_MODEMASK 0x0030 /* mask for above addressing modes */
#define JOF_SET 0x0040 /* set (i.e., assignment) operation */
#define JOF_DEL 0x0080 /* delete operation */
#define JOF_DEC 0x0100 /* decrement (--, not ++) opcode */
#define JOF_INC 0x0200 /* increment (++, not --) opcode */
#define JOF_INCDEC 0x0300 /* increment or decrement opcode */
#define JOF_POST 0x0400 /* postorder increment or decrement */
#define JOF_IMPORT 0x0800 /* import property op */
#define JOF_FOR2 0x1000 /* new for/in loop bytecodes */
/*
* Immediate operand getters, setters, and bounds.
*/
#define JUMP_OFFSET_LEN 2
#define JUMP_OFFSET_HI(off) ((jsbytecode)((off) >> 8))
#define JUMP_OFFSET_LO(off) ((jsbytecode)(off))
#define GET_JUMP_OFFSET(pc) ((int16)(((pc)[1] << 8) | (pc)[2]))
#define SET_JUMP_OFFSET(pc,off) ((pc)[1] = JUMP_OFFSET_HI(off), \
(pc)[2] = JUMP_OFFSET_LO(off))
#define JUMP_OFFSET_MIN ((int16)0x8000)
#define JUMP_OFFSET_MAX ((int16)0x7fff)
#define ATOM_INDEX_LEN 2
#define ATOM_INDEX_HI(index) ((jsbytecode)((index) >> 8))
#define ATOM_INDEX_LO(index) ((jsbytecode)(index))
#define GET_ATOM_INDEX(pc) (((pc)[1] << 8) | (pc)[2])
#define SET_ATOM_INDEX(pc,index)((pc)[1] = ATOM_INDEX_HI(index), \
(pc)[2] = ATOM_INDEX_LO(index))
#define GET_ATOM(cx,script,pc) js_GetAtom((cx), &(script)->atomMap, \
GET_ATOM_INDEX(pc))
#define ATOM_INDEX_LIMIT_LOG2 16
#define ATOM_INDEX_LIMIT ((uint32)1 << ATOM_INDEX_LIMIT_LOG2)
#define ARGC_HI(argc) ((jsbytecode)((argc) >> 8))
#define ARGC_LO(argc) ((jsbytecode)(argc))
#define GET_ARGC(pc) (((pc)[1] << 8) | (pc)[2])
#define ARGC_LIMIT ((uint32)1 << 16)
/* Synonyms for quick JOF_QARG and JOF_QVAR bytecodes. */
#define GET_ARGNO(pc) GET_ARGC(pc)
#define SET_ARGNO(pc,argno) SET_JUMP_OFFSET(pc,argno)
#define GET_VARNO(pc) GET_ARGC(pc)
#define SET_VARNO(pc,varno) SET_JUMP_OFFSET(pc,varno)
struct JSCodeSpec {
const char *name; /* JS bytecode name */
const char *token; /* JS source literal or null */
int8 length; /* length including opcode byte */
int8 nuses; /* arity, -1 if variadic */
int8 ndefs; /* number of stack results */
uint8 prec; /* operator precedence */
uint32 format; /* immediate operand format */
};
extern char js_in_str[];
extern char js_instanceof_str[];
extern char js_new_str[];
extern char js_delete_str[];
extern char js_typeof_str[];
extern char js_void_str[];
extern char js_null_str[];
extern char js_this_str[];
extern char js_false_str[];
extern char js_true_str[];
extern JSCodeSpec js_CodeSpec[];
extern uintN js_NumCodeSpecs;
extern jschar js_EscapeMap[];
/*
* Return a GC'ed string containing the chars in str, with any non-printing
* chars or quotes (' or " as specified by the quote argument) escaped, and
* with the quote character at the beginning and end of the result string.
*/
extern JSString *
js_QuoteString(JSContext *cx, JSString *str, jschar quote);
/*
* JSPrinter operations, for printf style message formatting. The return
* value from js_GetPrinterOutput() is the printer's cumulative output, in
* a GC'ed string.
*/
extern JSPrinter *
js_NewPrinter(JSContext *cx, const char *name, uintN indent);
extern void
js_DestroyPrinter(JSPrinter *jp);
extern JSString *
js_GetPrinterOutput(JSPrinter *jp);
extern int
js_printf(JSPrinter *jp, char *format, ...);
extern JSBool
js_puts(JSPrinter *jp, char *s);
#ifdef DEBUG
/*
* Disassemblers, for debugging only.
*/
#include <stdio.h>
extern JS_FRIEND_API(void)
js_Disassemble(JSContext *cx, JSScript *script, JSBool lines, FILE *fp);
extern JS_FRIEND_API(uintN)
js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, uintN loc,
JSBool lines, FILE *fp);
#endif /* DEBUG */
/*
* Decompilers, for script, function, and expression pretty-printing.
*/
extern JSBool
js_DecompileCode(JSPrinter *jp, JSScript *script, jsbytecode *pc, uintN len);
extern JSBool
js_DecompileScript(JSPrinter *jp, JSScript *script);
extern JSBool
js_DecompileFunction(JSPrinter *jp, JSFunction *fun, JSBool newlines);
/*
* Find the source expression that resulted in v, and return a new string
* containing it. Fall back on v's string conversion if we can't find the
* bytecode that generated and pushed v on the operand stack.
*/
extern JSString *
js_DecompileValueGenerator(JSContext *cx, jsval v, JSString *fallback);
JS_END_EXTERN_C
#endif /* jsopcode_h___ */

212
mozilla/js/src/jsopcode.tbl Normal file
View File

@@ -0,0 +1,212 @@
/* -*- 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.
*/
/*
* JavaScript operation bytecodes.
*
* Includers must define an OPDEF macro of the following form:
*
* #define OPDEF(op,val,name,image,length,nuses,ndefs,prec,format) ...
*
* Selected arguments can be expanded in initializers. The op argument is
* expanded followed by comma in the JSOp enum (jsopcode.h), e.g. The value
* field must be dense for now, because jsopcode.c uses an OPDEF() expansion
* inside the js_CodeSpec[] initializer.
*
* Field Description
* op Bytecode name, which is the JSOp enumerator name
* value Bytecode value, which is the JSOp enumerator value
* name C string containing name for disassembler
* image C string containing "image" for pretty-printer, null if ugly
* length Number of bytes including any immediate operands
* nuses Number of stack slots consumed by bytecode, -1 if variadic
* ndefs Number of stack slots produced by bytecode
* prec Operator precedence, zero if not an operator
* format Bytecode plus immediate operand encoding format
*
* This file is best viewed with 116 columns:
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345
*/
/* legend: op val name image len use def prec format */
/* Permanently-assigned bytecodes. */
OPDEF(JSOP_NOP, 0, "nop", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_PUSH, 1, "push", NULL, 1, 0, 1, 0, JOF_BYTE)
OPDEF(JSOP_POPV, 2, "popv", NULL, 1, 1, 0, 0, JOF_BYTE)
OPDEF(JSOP_ENTERWITH, 3, "enterwith", NULL, 1, 1, 1, 0, JOF_BYTE)
OPDEF(JSOP_LEAVEWITH, 4, "leavewith", NULL, 1, 1, 0, 0, JOF_BYTE)
OPDEF(JSOP_RETURN, 5, "return", NULL, 1, 1, 0, 0, JOF_BYTE)
OPDEF(JSOP_GOTO, 6, "goto", NULL, 3, 0, 0, 0, JOF_JUMP)
OPDEF(JSOP_IFEQ, 7, "ifeq", NULL, 3, 1, 0, 0, JOF_JUMP)
OPDEF(JSOP_IFNE, 8, "ifne", NULL, 3, 1, 0, 0, JOF_JUMP)
OPDEF(JSOP_FORNAME, 9, "forname", NULL, 3, 1, 1, 0, JOF_CONST|JOF_NAME|JOF_SET)
OPDEF(JSOP_FORPROP, 10, "forprop", NULL, 3, 2, 1, 0, JOF_CONST|JOF_PROP|JOF_SET)
OPDEF(JSOP_FORELEM, 11, "forelem", NULL, 1, 3, 1, 0, JOF_BYTE |JOF_ELEM|JOF_SET)
OPDEF(JSOP_DUP, 12, "dup", NULL, 1, 1, 2, 0, JOF_BYTE)
OPDEF(JSOP_DUP2, 13, "dup2", NULL, 1, 2, 4, 0, JOF_BYTE)
OPDEF(JSOP_SETNAME, 14, "setname", NULL, 3, 1, 1, 1, JOF_CONST|JOF_NAME|JOF_SET)
OPDEF(JSOP_BITOR, 15, "bitor", "|", 1, 2, 1, 2, JOF_BYTE)
OPDEF(JSOP_BITXOR, 16, "bitxor", "^", 1, 2, 1, 3, JOF_BYTE)
OPDEF(JSOP_BITAND, 17, "bitand", "&", 1, 2, 1, 4, JOF_BYTE)
OPDEF(JSOP_EQ, 18, "eq", "==", 1, 2, 1, 5, JOF_BYTE)
OPDEF(JSOP_NE, 19, "ne", "!=", 1, 2, 1, 5, JOF_BYTE)
OPDEF(JSOP_LT, 20, "lt", "<", 1, 2, 1, 6, JOF_BYTE)
OPDEF(JSOP_LE, 21, "le", "<=", 1, 2, 1, 6, JOF_BYTE)
OPDEF(JSOP_GT, 22, "gt", ">", 1, 2, 1, 6, JOF_BYTE)
OPDEF(JSOP_GE, 23, "ge", ">=", 1, 2, 1, 6, JOF_BYTE)
OPDEF(JSOP_LSH, 24, "lsh", "<<", 1, 2, 1, 7, JOF_BYTE)
OPDEF(JSOP_RSH, 25, "rsh", ">>", 1, 2, 1, 7, JOF_BYTE)
OPDEF(JSOP_URSH, 26, "ursh", ">>>", 1, 2, 1, 7, JOF_BYTE)
OPDEF(JSOP_ADD, 27, "add", "+", 1, 2, 1, 8, JOF_BYTE)
OPDEF(JSOP_SUB, 28, "sub", "-", 1, 2, 1, 8, JOF_BYTE)
OPDEF(JSOP_MUL, 29, "mul", "*", 1, 2, 1, 9, JOF_BYTE)
OPDEF(JSOP_DIV, 30, "div", "/", 1, 2, 1, 9, JOF_BYTE)
OPDEF(JSOP_MOD, 31, "mod", "%", 1, 2, 1, 9, JOF_BYTE)
OPDEF(JSOP_NOT, 32, "not", "!", 1, 1, 1, 10, JOF_BYTE)
OPDEF(JSOP_BITNOT, 33, "bitnot", "~", 1, 1, 1, 10, JOF_BYTE)
OPDEF(JSOP_NEG, 34, "neg", "-", 1, 1, 1, 10, JOF_BYTE)
OPDEF(JSOP_NEW, 35, js_new_str, NULL, 3, -1, 1, 10, JOF_UINT16)
OPDEF(JSOP_DELNAME, 36, "delname", NULL, 3, 0, 1, 10, JOF_CONST|JOF_NAME|JOF_DEL)
OPDEF(JSOP_DELPROP, 37, "delprop", NULL, 3, 1, 1, 10, JOF_CONST|JOF_PROP|JOF_DEL)
OPDEF(JSOP_DELELEM, 38, "delelem", NULL, 1, 2, 1, 10, JOF_BYTE |JOF_ELEM|JOF_DEL)
OPDEF(JSOP_TYPEOF, 39, js_typeof_str,NULL, 1, 1, 1, 10, JOF_BYTE)
OPDEF(JSOP_VOID, 40, js_void_str, NULL, 1, 1, 1, 10, JOF_BYTE)
OPDEF(JSOP_INCNAME, 41, "incname", NULL, 3, 0, 1, 10, JOF_CONST|JOF_NAME|JOF_INC)
OPDEF(JSOP_INCPROP, 42, "incprop", NULL, 3, 1, 1, 10, JOF_CONST|JOF_PROP|JOF_INC)
OPDEF(JSOP_INCELEM, 43, "incelem", NULL, 1, 2, 1, 10, JOF_BYTE |JOF_ELEM|JOF_INC)
OPDEF(JSOP_DECNAME, 44, "decname", NULL, 3, 0, 1, 10, JOF_CONST|JOF_NAME|JOF_DEC)
OPDEF(JSOP_DECPROP, 45, "decprop", NULL, 3, 1, 1, 10, JOF_CONST|JOF_PROP|JOF_DEC)
OPDEF(JSOP_DECELEM, 46, "decelem", NULL, 1, 2, 1, 10, JOF_BYTE |JOF_ELEM|JOF_DEC)
OPDEF(JSOP_NAMEINC, 47, "nameinc", NULL, 3, 0, 1, 10, JOF_CONST|JOF_NAME|JOF_INC|JOF_POST)
OPDEF(JSOP_PROPINC, 48, "propinc", NULL, 3, 1, 1, 10, JOF_CONST|JOF_PROP|JOF_INC|JOF_POST)
OPDEF(JSOP_ELEMINC, 49, "eleminc", NULL, 1, 2, 1, 10, JOF_BYTE |JOF_ELEM|JOF_INC|JOF_POST)
OPDEF(JSOP_NAMEDEC, 50, "namedec", NULL, 3, 0, 1, 10, JOF_CONST|JOF_NAME|JOF_DEC|JOF_POST)
OPDEF(JSOP_PROPDEC, 51, "propdec", NULL, 3, 1, 1, 10, JOF_CONST|JOF_PROP|JOF_DEC|JOF_POST)
OPDEF(JSOP_ELEMDEC, 52, "elemdec", NULL, 1, 2, 1, 10, JOF_BYTE |JOF_ELEM|JOF_DEC|JOF_POST)
OPDEF(JSOP_GETPROP, 53, "getprop", NULL, 3, 1, 1, 11, JOF_CONST|JOF_PROP)
OPDEF(JSOP_SETPROP, 54, "setprop", NULL, 3, 2, 1, 1, JOF_CONST|JOF_PROP|JOF_SET)
OPDEF(JSOP_GETELEM, 55, "getelem", NULL, 1, 2, 1, 11, JOF_BYTE |JOF_ELEM)
OPDEF(JSOP_SETELEM, 56, "setelem", NULL, 1, 3, 1, 1, JOF_BYTE |JOF_ELEM|JOF_SET)
OPDEF(JSOP_PUSHOBJ, 57, "pushobj", NULL, 1, 0, 1, 0, JOF_BYTE)
OPDEF(JSOP_CALL, 58, "call", NULL, 3, -1, 1, 11, JOF_UINT16)
OPDEF(JSOP_NAME, 59, "name", NULL, 3, 0, 1, 12, JOF_CONST|JOF_NAME)
OPDEF(JSOP_NUMBER, 60, "number", NULL, 3, 0, 1, 12, JOF_CONST)
OPDEF(JSOP_STRING, 61, "string", NULL, 3, 0, 1, 12, JOF_CONST)
OPDEF(JSOP_ZERO, 62, "zero", "0", 1, 0, 1, 12, JOF_BYTE)
OPDEF(JSOP_ONE, 63, "one", "1", 1, 0, 1, 12, JOF_BYTE)
OPDEF(JSOP_NULL, 64, js_null_str, js_null_str, 1, 0, 1, 12, JOF_BYTE)
OPDEF(JSOP_THIS, 65, js_this_str, js_this_str, 1, 0, 1, 12, JOF_BYTE)
OPDEF(JSOP_FALSE, 66, js_false_str, js_false_str, 1, 0, 1, 12, JOF_BYTE)
OPDEF(JSOP_TRUE, 67, js_true_str, js_true_str, 1, 0, 1, 12, JOF_BYTE)
OPDEF(JSOP_OR, 68, "or", NULL, 3, 1, 0, 0, JOF_JUMP)
OPDEF(JSOP_AND, 69, "and", NULL, 3, 1, 0, 0, JOF_JUMP)
/* The switch bytecodes have variable length. */
OPDEF(JSOP_TABLESWITCH, 70, "tableswitch", NULL, -1, 1, 0, 0, JOF_TABLESWITCH)
OPDEF(JSOP_LOOKUPSWITCH, 71, "lookupswitch", NULL, -1, 1, 0, 0, JOF_LOOKUPSWITCH)
/* New, infallible/transitive identity ops. */
OPDEF(JSOP_NEW_EQ, 72, "eq", NULL, 1, 2, 1, 5, JOF_BYTE)
OPDEF(JSOP_NEW_NE, 73, "ne", NULL, 1, 2, 1, 5, JOF_BYTE)
/* Lexical closure constructor. */
OPDEF(JSOP_CLOSURE, 74, "closure", NULL, 3, 0, 1, 0, JOF_CONST)
/* Export and import ops. */
OPDEF(JSOP_EXPORTALL, 75, "exportall", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_EXPORTNAME,76, "exportname", NULL, 3, 0, 0, 0, JOF_CONST|JOF_NAME)
OPDEF(JSOP_IMPORTALL, 77, "importall", NULL, 1, 1, 0, 0, JOF_BYTE)
OPDEF(JSOP_IMPORTPROP,78, "importprop", NULL, 3, 1, 0, 0, JOF_CONST|JOF_PROP|JOF_IMPORT)
OPDEF(JSOP_IMPORTELEM,79, "importelem", NULL, 3, 2, 0, 0, JOF_BYTE |JOF_ELEM|JOF_IMPORT)
/* Push object literal. */
OPDEF(JSOP_OBJECT, 80, "object", NULL, 3, 0, 1, 12, JOF_CONST)
/* Pop value and discard it. */
OPDEF(JSOP_POP, 81, "pop", NULL, 1, 1, 0, 0, JOF_BYTE)
/* Convert value to number, for unary +. */
OPDEF(JSOP_POS, 82, "pos", "+", 1, 1, 1, 10, JOF_BYTE)
/* Trap into debugger for breakpoint, etc. */
OPDEF(JSOP_TRAP, 83, "trap", NULL, 1, 0, 0, 0, JOF_BYTE)
/* Fast get/set ops for function arguments and local variables. */
OPDEF(JSOP_GETARG, 84, "getarg", NULL, 3, 0, 1, 12, JOF_QARG |JOF_NAME)
OPDEF(JSOP_SETARG, 85, "setarg", NULL, 3, 1, 1, 1, JOF_QARG |JOF_NAME|JOF_SET)
OPDEF(JSOP_GETVAR, 86, "getvar", NULL, 3, 0, 1, 12, JOF_QVAR |JOF_NAME)
OPDEF(JSOP_SETVAR, 87, "setvar", NULL, 3, 1, 1, 1, JOF_QVAR |JOF_NAME|JOF_SET)
/* Push unsigned 16-bit int constant. */
OPDEF(JSOP_UINT16, 88, "uint16", NULL, 3, 0, 1, 12, JOF_UINT16)
/* Object and array literal support. */
OPDEF(JSOP_NEWINIT, 89, "newinit", NULL, 1, 2, 1, 10, JOF_BYTE)
OPDEF(JSOP_ENDINIT, 90, "endinit", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_INITPROP, 91, "initprop", NULL, 3, 1, 0, 0, JOF_CONST|JOF_PROP)
OPDEF(JSOP_INITELEM, 92, "initelem", NULL, 1, 2, 0, 0, JOF_BYTE |JOF_ELEM)
OPDEF(JSOP_DEFSHARP, 93, "defsharp", NULL, 3, 0, 0, 0, JOF_UINT16)
OPDEF(JSOP_USESHARP, 94, "usesharp", NULL, 3, 0, 1, 0, JOF_UINT16)
/* Fast inc/dec ops for args and local vars. */
OPDEF(JSOP_INCARG, 95, "incarg", NULL, 3, 0, 1, 10, JOF_QARG |JOF_NAME|JOF_INC)
OPDEF(JSOP_INCVAR, 96, "incvar", NULL, 3, 0, 1, 10, JOF_QVAR |JOF_NAME|JOF_INC)
OPDEF(JSOP_DECARG, 97, "decarg", NULL, 3, 0, 1, 10, JOF_QARG |JOF_NAME|JOF_DEC)
OPDEF(JSOP_DECVAR, 98, "decvar", NULL, 3, 0, 1, 10, JOF_QVAR |JOF_NAME|JOF_DEC)
OPDEF(JSOP_ARGINC, 99, "arginc", NULL, 3, 0, 1, 10, JOF_QARG |JOF_NAME|JOF_INC|JOF_POST)
OPDEF(JSOP_VARINC, 100,"varinc", NULL, 3, 0, 1, 10, JOF_QVAR |JOF_NAME|JOF_INC|JOF_POST)
OPDEF(JSOP_ARGDEC, 101,"argdec", NULL, 3, 0, 1, 10, JOF_QARG |JOF_NAME|JOF_DEC|JOF_POST)
OPDEF(JSOP_VARDEC, 102,"vardec", NULL, 3, 0, 1, 10, JOF_QVAR |JOF_NAME|JOF_DEC|JOF_POST)
/* ECMA-compliant for/in ops. */
OPDEF(JSOP_TOOBJECT, 103,"toobject", NULL, 1, 1, 1, 0, JOF_BYTE)
OPDEF(JSOP_FORNAME2, 104,"forname2", NULL, 3, 0, 1, 0, JOF_CONST|JOF_NAME|JOF_SET|JOF_FOR2)
OPDEF(JSOP_FORPROP2, 105,"forprop2", NULL, 3, 1, 1, 0, JOF_CONST|JOF_PROP|JOF_SET|JOF_FOR2)
OPDEF(JSOP_FORELEM2, 106,"forelem2", NULL, 1, 2, 1, 0, JOF_BYTE |JOF_ELEM|JOF_SET|JOF_FOR2)
OPDEF(JSOP_POP2, 107,"pop2", NULL, 1, 2, 0, 0, JOF_BYTE)
/* ECMA-complaint assignment ops. */
OPDEF(JSOP_BINDNAME, 108,"bindname", NULL, 3, 0, 1, 0, JOF_CONST|JOF_NAME)
OPDEF(JSOP_SETNAME2, 109,"setname2", NULL, 3, 2, 1, 1, JOF_CONST|JOF_NAME|JOF_SET)
/* Exception handling ops. */
OPDEF(JSOP_THROW, 110,"throw", NULL, 1, 1, 0, 0, JOF_BYTE)
/* 'in' and 'instanceof' ops. */
OPDEF(JSOP_IN, 111,js_in_str, js_in_str, 1, 2, 1, 6, JOF_BYTE)
OPDEF(JSOP_INSTANCEOF,112,js_instanceof_str,js_instanceof_str,1,2,1,6,JOF_BYTE)
/* debugger op */
OPDEF(JSOP_DEBUGGER, 113,"debugger", NULL, 1, 0, 0, 0, JOF_BYTE)
/* gosub/retsub for finally handling */
OPDEF(JSOP_GOSUB, 114,"gosub", NULL, 3, 0, 1, 0, JOF_JUMP)
OPDEF(JSOP_RETSUB, 115,"retsub", NULL, 1, 1, 0, 0, JOF_BYTE)
/* more exception handling ops */
OPDEF(JSOP_EXCEPTION, 116,"exception", NULL, 1, 0, 1, 0, JOF_BYTE)
OPDEF(JSOP_SETSP, 117,"setsp", NULL, 3, 0, 0, 0, JOF_UINT16)
/*
* ECMA-compliant switch statement ops.
* CONDSWITCH is a decompilable NOP; CASE is ===, POP, jump if true, re-push
* lval if false; and DEFAULT is POP lval and GOTO.
*/
OPDEF(JSOP_CONDSWITCH,118,"condswitch", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_CASE, 119,"case", NULL, 3, 1, 0, 0, JOF_JUMP)
OPDEF(JSOP_DEFAULT, 120,"default", NULL, 3, 1, 0, 0, JOF_JUMP)

76
mozilla/js/src/jsosdep.h Normal file
View File

@@ -0,0 +1,76 @@
/* -*- 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 jsosdep_h___
#define jsosdep_h___
/*
* OS (and machine, and compiler XXX) dependent information.
*/
#ifdef XP_PC
#ifdef _WIN32
#include "os/win32.h"
#else
#include "os/win16.h"
#endif
#endif /* XP_PC */
#ifdef XP_MAC
#include "jsmacos.h"
#endif
#ifdef XP_UNIX
/*
* Get OS specific header information.
*/
#if defined(AIXV3)
#include "os/aix.h"
#elif defined(BSDI)
#include "os/bsdi.h"
#elif defined(HPUX)
#include "os/hpux.h"
#elif defined(IRIX)
#include "os/irix.h"
#elif defined(LINUX)
#include "os/linux.h"
#elif defined(OSF1)
#include "os/osf1.h"
#elif defined(SCO)
#include "os/scoos.h"
#elif defined(SOLARIS)
#include "os/solaris.h"
#elif defined(SUNOS4)
#include "os/sunos.h"
#elif defined(UNIXWARE)
#include "os/unixware.h"
#endif
#endif /* XP_UNIX */
#endif /* jsosdep_h___ */

91
mozilla/js/src/jsotypes.h Normal file
View File

@@ -0,0 +1,91 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 section typedefs the old 'native' types to the new PR<type>s.
* These definitions are scheduled to be eliminated at the earliest
* possible time. The NSPR API is implemented and documented using
* the new definitions.
*/
#ifndef PROTYPES_H
#define PROTYPES_H
/* SVR4 typedef of uint is commonly found on UNIX machines. */
#ifndef XP_UNIX
typedef JSUintn uint;
#endif
typedef JSUintn uintn;
typedef JSUint64 uint64;
#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
typedef JSUint32 uint32;
#else
typedef unsigned long uint32;
#endif
typedef JSUint16 uint16;
typedef JSUint8 uint8;
#ifndef _XP_Core_
typedef JSIntn intn;
#endif
/*
* On AIX 4.3, sys/inttypes.h (which is included by sys/types.h, a very
* common header file) defines the types int8, int16, int32, and int64.
* So we don't define these four types here to avoid conflicts in case
* the code also includes sys/types.h.
*/
#ifdef AIX4_3
#include <sys/inttypes.h>
#else
typedef JSInt64 int64;
/* /usr/include/model.h on HP-UX defines int8, int16, and int32 */
#ifdef HPUX
#include <model.h>
#else
#if !defined(WIN32) || !defined(_WINSOCK2API_) /* defines its own "int32" */
#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
typedef JSInt32 int32;
#else
typedef long int32;
#endif
#endif
typedef JSInt16 int16;
typedef JSInt8 int8;
#endif /* HPUX */
#endif /* AIX4_3 */
typedef JSFloat64 float64;
/* Re: jsbit.h */
#define TEST_BIT JS_TEST_BIT
#define SET_BIT JS_SET_BIT
#define CLEAR_BIT JS_CLEAR_BIT
#ifdef XP_MAC
#ifndef TRUE /* Mac standard is lower case true */
#define TRUE 1
#endif
#ifndef FALSE /* Mac standard is lower case false */
#define FALSE 0
#endif
#endif
#endif /* !defined(PROTYPES_H) */

2750
mozilla/js/src/jsparse.c Normal file

File diff suppressed because it is too large Load Diff

256
mozilla/js/src/jsparse.h Normal file
View File

@@ -0,0 +1,256 @@
/* -*- 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 jsparse_h___
#define jsparse_h___
/*
* JS parser definitions.
*/
#include "jsprvtd.h"
#include "jspubtd.h"
#include "jsscan.h"
JS_BEGIN_EXTERN_C
/*
* Parsing builds a tree of nodes that directs code generation. This tree is
* not a concrete syntax tree in all respects (for example, || and && are left
* associative, but (A && B && C) translates into the right-associated tree
* <A && <B && C>> so that code generation can emit a left-associative branch
* around <B && C> when A is false). Nodes are labeled by token type, with a
* JSOp secondary label when needed:
*
* Label Variant Members
* ----- ------- -------
* <Definitions>
* TOK_FUNCTION func pn_fun: function, contains arg and var properties
* pn_body: TOK_LC node for function body
* NB: We define or create the function object at
* parse (not emit) time, in order to specialize arg
* and var bytecodes early.
* pn_tryCount: of try statements in function
*
* <Statements>
* TOK_LC list pn_head: list of pn_count statements
* TOK_EXPORT list pn_head: list of pn_count TOK_NAMEs or one TOK_STAR
* (which is not a multiply node)
* TOK_IMPORT list pn_head: list of pn_count sub-trees of the form
* a.b.*, a[b].*, a.*, a.b, or a[b] -- but never a.
* Each member is expressed with TOK_DOT or TOK_LB.
* Each sub-tree's root node has a pn_op in the set
* JSOP_IMPORT{ALL,PROP,ELEM}
* TOK_IF ternary pn_kid1: cond, pn_kid2: then, pn_kid3: else or null
* TOK_SWITCH binary pn_left: discriminant
* pn_right: list of TOK_CASE nodes, with at most one
* TOK_DEFAULT node
* TOK_CASE, binary pn_left: case expr or null if TOK_DEFAULT
* TOK_DEFAULT pn_right: TOK_LC node for this case's statements
* TOK_WHILE binary pn_left: cond, pn_right: body
* TOK_DO binary pn_left: body, pn_right: cond
* TOK_FOR binary pn_left: either
* for/in loop: a binary TOK_IN node with
* pn_left: TOK_VAR or TOK_NAME to left of 'in'
* pn_right: object expr to right of 'in'
* for(;;) loop: a ternary TOK_RESERVED node with
* pn_kid1: init expr before first ';'
* pn_kid2: cond expr before second ';'
* pn_kid3: update expr after second ';'
* any kid may be null
* pn_right: body
* TOK_THROW unary pn_op: JSOP_THROW, pn_kid: exception
* TOK_BREAK name pn_atom: label or null
* TOK_CONTINUE name pn_atom: label or null
* TOK_WITH binary pn_left: head expr, pn_right: body
* TOK_VAR list pn_head: list of pn_count TOK_NAME nodes
* each name node has pn_atom: variable name and
* pn_expr: initializer or null
* TOK_RETURN unary pn_kid: return expr or null
* TOK_SEMI unary pn_kid: expr or null statement
* TOK_COLON name pn_atom: label, pn_expr: labeled statement
*
* <Expressions>
* TOK_COMMA list pn_head: list of pn_count comma-separated exprs
* TOK_ASSIGN binary pn_left: lvalue, pn_right: rvalue
* TOK_HOOK ternary pn_kid1: cond, pn_kid2: then, pn_kid3: else
* TOK_OR binary pn_left: first in || chain, pn_right: rest of chain
* TOK_AND binary pn_left: first in && chain, pn_right: rest of chain
* TOK_BITOR binary pn_left: left-assoc | expr, pn_right: ^ expr
* TOK_BITXOR binary pn_left: left-assoc ^ expr, pn_right: & expr
* TOK_BITAND binary pn_left: left-assoc & expr, pn_right: EQ expr
* TOK_EQOP binary pn_left: left-assoc EQ expr, pn_right: REL expr
* pn_op: JSOP_EQ, JSOP_NE, JSOP_NEW_EQ, JSOP_NEW_NE
* TOK_RELOP binary pn_left: left-assoc REL expr, pn_right: SH expr
* pn_op: JSOP_LT, JSOP_LE, JSOP_GT, JSOP_GE
* TOK_SHOP binary pn_left: left-assoc SH expr, pn_right: ADD expr
* pn_op: JSOP_LSH, JSOP_RSH, JSOP_URSH
* TOK_PLUS, binary pn_left: left-assoc ADD expr, pn_right: MUL expr
* TOK_MINUS pn_op: JSOP_ADD, JSOP_SUB
* TOK_STAR, binary pn_left: left-assoc MUL expr, pn_right: UNARY expr
* TOK_DIVOP pn_op: JSOP_MUL, JSOP_DIV, JSOP_MOD
* TOK_UNARYOP unary pn_kid: UNARY expr, pn_op: JSOP_NEG, JSOP_POS,
* JSOP_NOT, JSOP_BITNOT, JSOP_TYPEOF, JSOP_VOID
* TOK_INC, unary pn_kid: MEMBER expr
* TOK_DEC pn_num: arg or local var slot if non-negative
* TOK_NEW list pn_head: list of ctor, arg1, arg2, ... argN
* pn_count: 1 + N (where N is number of args)
* ctor is a MEMBER expr
* TOK_DELETE unary pn_kid: MEMBER expr
* TOK_DOT name pn_expr: MEMBER expr to left of .
* pn_atom: name to right of .
* TOK_LB binary pn_left: MEMBER expr to left of [
* pn_right: expr between [ and ]
* TOK_LP list pn_head: list of call, arg1, arg2, ... argN
* pn_count: 1 + N (where N is number of args)
* call is a MEMBER expr naming a callable object
* TOK_RB list pn_head: list of pn_count array element exprs
* [,,] holes are represented by TOK_COMMA nodes
* #n=[...] produces TOK_DEFSHARP at head of list
* pn_extra: true if extra comma at end
* TOK_RC list pn_head: list of pn_count TOK_COLON nodes where
* each has pn_left: property id, pn_right: value
* #n={...} produces TOK_DEFSHARP at head of list
* TOK_DEFSHARP unary pn_num: jsint value of n in #n=
* pn_kid: null for #n=[...] and #n={...}, primary
* if #n=primary for function, paren, name, object
* literal expressions
* TOK_USESHARP nullary pn_num: jsint value of n in #n#
* TOK_RP unary pn_kid: parenthesized expression
* TOK_NAME, name pn_atom: name, string, or object atom
* TOK_STRING, pn_op: JSOP_NAME, JSOP_STRING, or JSOP_OBJECT
* TOK_OBJECT pn_op may be *ARG or *VAR with pn_slot >= 0
* TOK_NUMBER dval pn_dval: double value of numeric literal
* TOK_PRIMARY nullary pn_op: JSOp bytecode
*/
typedef enum JSParseNodeArity {
PN_FUNC = -3,
PN_LIST = -2,
PN_TERNARY = 3,
PN_BINARY = 2,
PN_UNARY = 1,
PN_NAME = -1,
PN_NULLARY = 0
} JSParseNodeArity;
struct JSParseNode {
JSTokenType pn_type;
JSTokenPos pn_pos;
JSOp pn_op;
ptrdiff_t pn_offset; /* first generated bytecode offset */
JSParseNodeArity pn_arity;
union {
struct { /* TOK_FUNCTION node */
JSFunction *fun; /* function object private data */
JSParseNode *body; /* TOK_LC list of statements */
uint32 tryCount; /* try statement count */
} func;
struct { /* list of next-linked nodes */
JSParseNode *head; /* first node in list */
JSParseNode **tail; /* ptr to ptr to last node in list */
uint32 count; /* number of nodes in list */
JSBool extra; /* extra comma flag for [1,2,,] */
} list;
struct { /* ternary: if, for(;;), ?: */
JSParseNode *kid1; /* condition, discriminant, etc. */
JSParseNode *kid2; /* then-part, case list, etc. */
JSParseNode *kid3; /* else-part, default case, etc. */
} ternary;
struct { /* two kids if binary */
JSParseNode *left;
JSParseNode *right;
jsval val; /* switch case value */
} binary;
struct { /* one kid if unary */
JSParseNode *kid;
jsint num; /* -1 or arg or local/sharp var num */
} unary;
struct { /* name, labeled statement, etc. */
JSAtom *atom; /* name or label atom, null if slot */
JSParseNode *expr; /* object or initializer */
jsint slot; /* -1 or arg or local var slot */
} name;
jsdouble dval; /* aligned numeric literal value */
} pn_u;
JSParseNode *pn_next; /* here to align dval and pn_u on RISCs */
};
#define pn_fun pn_u.func.fun
#define pn_body pn_u.func.body
#define pn_tryCount pn_u.func.tryCount
#define pn_head pn_u.list.head
#define pn_tail pn_u.list.tail
#define pn_count pn_u.list.count
#define pn_extra pn_u.list.extra
#define pn_kid1 pn_u.ternary.kid1
#define pn_kid2 pn_u.ternary.kid2
#define pn_kid3 pn_u.ternary.kid3
#define pn_left pn_u.binary.left
#define pn_right pn_u.binary.right
#define pn_val pn_u.binary.val
#define pn_kid pn_u.unary.kid
#define pn_num pn_u.unary.num
#define pn_atom pn_u.name.atom
#define pn_expr pn_u.name.expr
#define pn_slot pn_u.name.slot
#define pn_dval pn_u.dval
/*
* Compute a pointer to the last JSParseNode element in a singly-linked list.
* NB: list must be non-empty for correct PN_LAST usage!
*/
#define PN_LAST(list) \
((JSParseNode *)((char *)(list)->pn_tail - offsetof(JSParseNode, pn_next)))
#define PN_INIT_LIST(list) \
JS_BEGIN_MACRO \
(list)->pn_head = NULL; \
(list)->pn_tail = &(list)->pn_head; \
(list)->pn_count = 0; \
JS_END_MACRO
#define PN_INIT_LIST_1(list, pn) \
JS_BEGIN_MACRO \
(list)->pn_head = (pn); \
(list)->pn_tail = &(pn)->pn_next; \
(list)->pn_count = 1; \
JS_END_MACRO
#define PN_APPEND(list, pn) \
JS_BEGIN_MACRO \
*(list)->pn_tail = (pn); \
(list)->pn_tail = &(pn)->pn_next; \
(list)->pn_count++; \
JS_END_MACRO
/* New names to connote code generation in addition to parse tree gen. */
#define js_CompileTokenStream js_Parse
#define js_CompileFunctionBody js_ParseFunctionBody
extern JS_FRIEND_API(JSBool)
js_CompileTokenStream(JSContext *cx, JSObject *chain, JSTokenStream *ts,
JSCodeGenerator *cg);
extern JSBool
js_CompileFunctionBody(JSContext *cx, JSTokenStream *ts, JSFunction *fun);
/* XXXbe expose js_Parse{TokenStream,FunctionBody} that return trees? */
extern JSBool
js_FoldConstants(JSContext *cx, JSParseNode *pn);
JS_END_EXTERN_C
#endif /* jsparse_h___ */

1228
mozilla/js/src/jsprf.c Normal file

File diff suppressed because it is too large Load Diff

128
mozilla/js/src/jsprf.h Normal file
View File

@@ -0,0 +1,128 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 jsprf_h___
#define jsprf_h___
/*
** API for PR printf like routines. Supports the following formats
** %d - decimal
** %u - unsigned decimal
** %x - unsigned hex
** %X - unsigned uppercase hex
** %o - unsigned octal
** %hd, %hu, %hx, %hX, %ho - 16-bit versions of above
** %ld, %lu, %lx, %lX, %lo - 32-bit versions of above
** %lld, %llu, %llx, %llX, %llo - 64 bit versions of above
** %s - string
** %c - character
** %p - pointer (deals with machine dependent pointer size)
** %f - float
** %g - float
*/
#include "jstypes.h"
#include <stdio.h>
#include <stdarg.h>
JS_BEGIN_EXTERN_C
/*
** sprintf into a fixed size buffer. Guarantees that a NUL is at the end
** of the buffer. Returns the length of the written output, NOT including
** the NUL, or (JSUint32)-1 if an error occurs.
*/
EXTERN(JSUint32) JS_snprintf(char *out, JSUint32 outlen, const char *fmt, ...);
/*
** sprintf into a malloc'd buffer. Return a pointer to the malloc'd
** buffer on success, NULL on failure. Call "JS_smprintf_free" to release
** the memory returned.
*/
EXTERN(char*) JS_smprintf(const char *fmt, ...);
/*
** Free the memory allocated, for the caller, by JS_smprintf
*/
EXTERN(void) JS_smprintf_free(char *mem);
/*
** "append" sprintf into a malloc'd buffer. "last" is the last value of
** the malloc'd buffer. sprintf will append data to the end of last,
** growing it as necessary using realloc. If last is NULL, JS_sprintf_append
** will allocate the initial string. The return value is the new value of
** last for subsequent calls, or NULL if there is a malloc failure.
*/
EXTERN(char*) JS_sprintf_append(char *last, const char *fmt, ...);
/*
** sprintf into a function. The function "f" is called with a string to
** place into the output. "arg" is an opaque pointer used by the stuff
** function to hold any state needed to do the storage of the output
** data. The return value is a count of the number of characters fed to
** the stuff function, or (JSUint32)-1 if an error occurs.
*/
typedef JSIntn (*JSStuffFunc)(void *arg, const char *s, JSUint32 slen);
EXTERN(JSUint32) JS_sxprintf(JSStuffFunc f, void *arg, const char *fmt, ...);
/*
** va_list forms of the above.
*/
EXTERN(JSUint32) JS_vsnprintf(char *out, JSUint32 outlen, const char *fmt, va_list ap);
EXTERN(char*) JS_vsmprintf(const char *fmt, va_list ap);
EXTERN(char*) JS_vsprintf_append(char *last, const char *fmt, va_list ap);
EXTERN(JSUint32) JS_vsxprintf(JSStuffFunc f, void *arg, const char *fmt, va_list ap);
/*
***************************************************************************
** FUNCTION: JS_sscanf
** DESCRIPTION:
** JS_sscanf() scans the input character string, performs data
** conversions, and stores the converted values in the data objects
** pointed to by its arguments according to the format control
** string.
**
** JS_sscanf() behaves the same way as the sscanf() function in the
** Standard C Library (stdio.h), with the following exceptions:
** - JS_sscanf() handles the NSPR integer and floating point types,
** such as JSInt16, JSInt32, JSInt64, and JSFloat64, whereas
** sscanf() handles the standard C types like short, int, long,
** and double.
** - JS_sscanf() has no multibyte character support, while sscanf()
** does.
** INPUTS:
** const char *buf
** a character string holding the input to scan
** const char *fmt
** the format control string for the conversions
** ...
** variable number of arguments, each of them is a pointer to
** a data object in which the converted value will be stored
** OUTPUTS: none
** RETURNS: JSInt32
** The number of values converted and stored.
** RESTRICTIONS:
** Multibyte characters in 'buf' or 'fmt' are not allowed.
***************************************************************************
*/
EXTERN(JSInt32) JS_sscanf(const char *buf, const char *fmt, ...);
JS_END_EXTERN_C
#endif /* jsprf_h___ */

131
mozilla/js/src/jsprhash.h Normal file
View File

@@ -0,0 +1,131 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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 JSplhash_h___
#define JSplhash_h___
/*
* API to portable hash table code.
*/
#include <stddef.h>
#include <stdio.h>
#include "jsprtypes.h"
JSPR_BEGIN_EXTERN_C
typedef struct JSPRHashEntry JSPRHashEntry;
typedef struct JSPRHashTable JSPRHashTable;
typedef JSPRUint32 JSPRHashNumber;
#define JSPR_HASH_BITS 32
typedef JSPRHashNumber (JSCALLBACK *JSPRHashFunction)(const void *key);
typedef JSPRIntn (JSCALLBACK *JSPRHashComparator)(const void *v1, const void *v2);
typedef JSPRIntn (JSCALLBACK *JSPRHashEnumerator)(JSPRHashEntry *he, JSPRIntn i, void *arg);
/* Flag bits in JSPRHashEnumerator's return value */
#define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */
#define HT_ENUMERATE_STOP 1 /* stop enumerating entries */
#define HT_ENUMERATE_REMOVE 2 /* remove and free the current entry */
#define HT_ENUMERATE_UNHASH 4 /* just unhash the current entry */
typedef struct JSPRHashAllocOps {
void * (JSCALLBACK *allocTable)(void *pool, JSPRSize size);
void (JSCALLBACK *freeTable)(void *pool, void *item);
JSPRHashEntry * (JSCALLBACK *allocEntry)(void *pool, const void *key);
void (JSCALLBACK *freeEntry)(void *pool, JSPRHashEntry *he, JSPRUintn flag);
} JSPRHashAllocOps;
#define HT_FREE_VALUE 0 /* just free the entry's value */
#define HT_FREE_ENTRY 1 /* free value and entire entry */
struct JSPRHashEntry {
JSPRHashEntry *next; /* hash chain linkage */
JSPRHashNumber keyHash; /* key hash function result */
const void *key; /* ptr to opaque key */
void *value; /* ptr to opaque value */
};
struct JSPRHashTable {
JSPRHashEntry **buckets; /* vector of hash buckets */
JSPRUint32 nentries; /* number of entries in table */
JSPRUint32 shift; /* multiplicative hash shift */
JSPRHashFunction keyHash; /* key hash function */
JSPRHashComparator keyCompare; /* key comparison function */
JSPRHashComparator valueCompare; /* value comparison function */
JSPRHashAllocOps *allocOps; /* allocation operations */
void *allocPriv; /* allocation private data */
#ifdef HASHMETER
JSPRUint32 nlookups; /* total number of lookups */
JSPRUint32 nsteps; /* number of hash chains traversed */
JSPRUint32 ngrows; /* number of table expansions */
JSPRUint32 nshrinks; /* number of table contractions */
#endif
};
/*
* Create a new hash table.
* If allocOps is null, use default allocator ops built on top of malloc().
*/
JSEXTERN(JSPRHashTable *)
JSPR_NewHashTable(JSPRUint32 n, JSPRHashFunction keyHash,
JSPRHashComparator keyCompare, JSPRHashComparator valueCompare,
JSPRHashAllocOps *allocOps, void *allocPriv);
JSEXTERN(void)
JSPR_HashTableDestroy(JSPRHashTable *ht);
/* Low level access methods */
JSEXTERN(JSPRHashEntry **)
JSPR_HashTableRawLookup(JSPRHashTable *ht, JSPRHashNumber keyHash, const void *key);
JSEXTERN(JSPRHashEntry *)
JSPR_HashTableRawAdd(JSPRHashTable *ht, JSPRHashEntry **hep, JSPRHashNumber keyHash,
const void *key, void *value);
JSEXTERN(void)
JSPR_HashTableRawRemove(JSPRHashTable *ht, JSPRHashEntry **hep, JSPRHashEntry *he);
/* Higher level access methods */
JSEXTERN(JSPRHashEntry *)
JSPR_HashTableAdd(JSPRHashTable *ht, const void *key, void *value);
JSEXTERN(JSPRBool)
JSPR_HashTableRemove(JSPRHashTable *ht, const void *key);
JSEXTERN(JSPRIntn)
JSPR_HashTableEnumerateEntries(JSPRHashTable *ht, JSPRHashEnumerator f, void *arg);
JSEXTERN(void *)
JSPR_HashTableLookup(JSPRHashTable *ht, const void *key);
JSEXTERN(JSPRIntn)
JSPR_HashTableDump(JSPRHashTable *ht, JSPRHashEnumerator dump, FILE *fp);
/* General-purpose C string hash function. */
JSEXTERN(JSPRHashNumber)
JSPR_HashString(const void *key);
/* Compare strings using strcmp(), return true if equal. */
JSEXTERN(int)
JSPR_CompareStrings(const void *v1, const void *v2);
/* Stub function just returns v1 == v2 */
JSEXTERN(JSPRIntn)
JSPR_CompareValues(const void *v1, const void *v2);
JSPR_END_EXTERN_C
#endif /* JSplhash_h___ */

148
mozilla/js/src/jsprvtd.h Normal file
View File

@@ -0,0 +1,148 @@
/* -*- 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 jsprvtd_h___
#define jsprvtd_h___
/*
* JS private typename definitions.
*
* This header is included only in other .h files, for convenience and for
* simplicity of type naming. The alternative for structures is to use tags,
* which are named the same as their typedef names (legal in C/C++, and less
* noisy than suffixing the typedef name with "Struct" or "Str"). Instead,
* all .h files that include this file may use the same typedef name, whether
* declaring a pointer to struct type, or defining a member of struct type.
*
* A few fundamental scalar types are defined here too. Neither the scalar
* nor the struct typedefs should change much, therefore the nearly-global
* make dependency induced by this file should not prove painful.
*/
#include "jspubtd.h"
/* Scalar typedefs. */
typedef uint8 jsbytecode;
typedef uint8 jssrcnote;
typedef uint32 jsatomid;
/* Struct typedefs. */
typedef struct JSCodeGenerator JSCodeGenerator;
typedef struct JSGCThing JSGCThing;
typedef struct JSParseNode JSParseNode;
typedef struct JSSharpObjectMap JSSharpObjectMap;
typedef struct JSToken JSToken;
typedef struct JSTokenPos JSTokenPos;
typedef struct JSTokenPtr JSTokenPtr;
typedef struct JSTokenStream JSTokenStream;
typedef struct JSTreeContext JSTreeContext;
typedef struct JSTryNote JSTryNote;
/* Friend "Advanced API" typedefs. */
typedef struct JSAtom JSAtom;
typedef struct JSAtomList JSAtomList;
typedef struct JSAtomListElement JSAtomListElement;
typedef struct JSAtomMap JSAtomMap;
typedef struct JSAtomState JSAtomState;
typedef struct JSCodeSpec JSCodeSpec;
typedef struct JSPrinter JSPrinter;
typedef struct JSRegExp JSRegExp;
typedef struct JSRegExpStatics JSRegExpStatics;
typedef struct JSScope JSScope;
typedef struct JSScopeOps JSScopeOps;
typedef struct JSScopeProperty JSScopeProperty;
typedef struct JSStackFrame JSStackFrame;
typedef struct JSSubString JSSubString;
typedef struct JSSymbol JSSymbol;
/* "Friend" types used by jscntxt.h and jsdbgapi.h. */
typedef enum JSTrapStatus {
JSTRAP_ERROR,
JSTRAP_CONTINUE,
JSTRAP_RETURN,
JSTRAP_LIMIT
} JSTrapStatus;
#ifndef CRT_CALL
#ifdef XP_OS2
#define CRT_CALL _Optlink
#else
#define CRT_CALL
#endif
#endif
typedef JSTrapStatus
(* CRT_CALL JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc,
jsval *rval, void *closure);
typedef JSBool
(* CRT_CALL JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsval id,
jsval old, jsval *newp, void *closure);
/* called just after script creation */
typedef void
(* CRT_CALL JSNewScriptHook)(JSContext *cx,
const char *filename, /* URL of script */
uintN lineno, /* line script starts */
JSScript *script,
JSFunction *fun,
void *callerdata);
/* called just before script destruction */
typedef void
(* CRT_CALL JSDestroyScriptHook)(JSContext *cx,
JSScript *script,
void *callerdata);
typedef void
(* CRT_CALL JSSourceHandler)(const char *filename, uintN lineno,
jschar *str, size_t length,
void **listenerTSData, void *closure);
/*
* This hook captures high level script execution and function calls
* (JS or native).
* It is used by JS_SetExecuteHook to hook top level scripts and by
* JS_SetCallHook to hook function calls.
* It will get called twice per script or function call:
* just before execution begins and just after it finishes. In both cases
* the 'current' frame is that of the executing code.
*
* The 'before' param is JS_TRUE for the hook invocation before the execution
* and JS_FALSE for the invocation after the code has run.
*
* The 'ok' param is significant only on the post execution invocation to
* signify whether or not the code completed 'normally'.
*
* The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook
* for the 'before'invocation, but is whatever value is returned from that
* invocation for the 'after' invocation. Thus, the hook implementor *could*
* allocate a stucture in the 'before' invocation and return a pointer
* to that structure. The pointer would then be handed to the hook for
* the 'after' invocation. Alternately, the 'before' could just return the
* same value as in 'closure' to cause the 'after' invocation to be called
* with the same 'closure' value as the 'before'.
*
* Returning NULL in the 'before' hook will cause the 'after' hook to
* NOT be called.
*/
typedef void *
(* CRT_CALL JSInterpreterHook)(JSContext *cx, JSStackFrame *fp, JSBool before,
JSBool *ok, void *closure);
#endif /* jsprvtd_h___ */

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