Compare commits

..

49 Commits

Author SHA1 Message Date
morse
73279a25bf changes for cookie management, anonymous mode
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5194 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-09 02:22:40 +00:00
dfm
695593a38d Blowing away morse's changes because of whitespace corruption.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5190 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-09 01:58:30 +00:00
morse
639e959a40 rearrange include files so it compiles
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5181 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 22:55:18 +00:00
morse
9c86375f7e added include for privacy tools
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5180 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 21:17:12 +00:00
morse
aa680ec28b back off last change -- adding of privacy.h
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5179 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 21:16:14 +00:00
morse
7a985c9f91 added privacy tools include files for front end
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5175 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:53:22 +00:00
morse
68234825e7 added defines for cookie management and single signon
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5174 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:50:46 +00:00
morse
011e50b29a fixes for about:cookies and about:signons
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5173 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:48:34 +00:00
morse
63faafb6c5 Added externs for privacy tools
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5172 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:47:13 +00:00
morse
01ea71c87c cookie management change
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5171 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:45:23 +00:00
morse
58b4edaea4 Added anonymous mode
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5170 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:43:02 +00:00
morse
cbec9e7e08 cookie management changes, added anonymous mode
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5169 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:42:14 +00:00
morse
d95ea8de0c added temporary menu items for privacy tools
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5168 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:35:58 +00:00
morse
003868fb24 added items for privacy tools
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5167 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:34:32 +00:00
morse
a6e7a78d45 Added strings for privacy tools
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5166 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:31:47 +00:00
morse
0caa6a1e69 Added variables for privacy tools
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5165 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:30:49 +00:00
morse
6c9583ffa0 Added routines for privacy tools
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5164 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:30:02 +00:00
morse
3b6783015d added preferences for single signon
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5163 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:27:29 +00:00
morse
8254de91b7 added single signon
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5162 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:22:28 +00:00
morse
7eb5c6fd64 Module for single singon (formerly in the tail end of layform.c)
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5161 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:20:11 +00:00
morse
9b6a37db6e put single signon into its own file
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5160 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 19:18:20 +00:00
dfm
391cc9454c Fixed undefined macro errors for people other than me. Oops.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5146 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-08 16:07:21 +00:00
dfm
534bb3a35c Yet more Unix build changes.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5022 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 19:39:02 +00:00
dfm
c7e71a906b Added top-level privacy directory to MozillaSourceCommon module.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5021 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 19:10:57 +00:00
dfm
310785751e More windows build changes..
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@5019 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 19:02:52 +00:00
dfm
55857919c7 Windows makefile changes..
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4993 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 07:12:07 +00:00
dfm
57b9cc0ef7 More makefile changes..
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4992 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 07:06:01 +00:00
dfm
b9c8ddcf96 Windows build changes..
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4991 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 07:03:42 +00:00
dfm
975b9fca0e Makefile changes..
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4979 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 01:05:20 +00:00
dfm
35a878db88 Added top-level build rules for privacy module.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4977 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 00:53:14 +00:00
dfm
03272b4516 Added build files.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4973 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 00:46:34 +00:00
dfm
e5215d2d8e Added privacy sources.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4972 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 00:46:19 +00:00
dfm
2351635ca9 Added privacy include files.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4971 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 00:45:31 +00:00
dfm
fa037f00c8 Windows makefile changes.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4970 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 00:37:50 +00:00
dfm
e65a1e7b28 Changed ifdef switch over to MOZ_PRIVACY, added windows makefile changes.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4969 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 00:35:47 +00:00
dfm
df8290145f Changed tag over to MOZ_PRIVACY.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4966 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 00:31:35 +00:00
dfm
de82ddfa3e Backed out changes to libmisc. Privacy features moved to mozilla/privacy.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4965 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-03 00:30:37 +00:00
dfm
d14c34747e Added support for HTTP Link supplied privacy policies.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4758 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 23:14:21 +00:00
dfm
7af7347ec4 Added support for privacy features, and fixed a memory leak.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4757 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 23:13:11 +00:00
dfm
c617e36f7f Added RDF_Receipts to NavCenter.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4756 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 23:11:52 +00:00
dfm
383daaaf85 Fixed bogus filename so I can build under NT.. grrr..
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4755 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 23:10:35 +00:00
dfm
1427ab0ae5 Added ifdef switch for privacy features.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4753 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 23:07:50 +00:00
dfm
87d247c628 Did preliminary implementation of privacy features on xfe.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4752 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 23:06:07 +00:00
dfm
6d5f9aefe7 Added necessary elements for privacy features.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4751 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 23:00:05 +00:00
dfm
32391d9c0d Added privacy feature hooks to layout.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4750 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 22:58:32 +00:00
dfm
a736f83e84 Added ifdef'd code to depend on libmisc if privacy features are enabled.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4749 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 22:56:58 +00:00
dfm
a701bd9d5a Added privacy feature code to libmisc.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4748 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 22:53:48 +00:00
dfm
d6f0ce8ffe Updated Makefile to build additional source files for privacy features.
git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4747 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 22:52:07 +00:00
(no author)
15687b22ca This commit was manufactured by cvs2svn to create branch
'PRIVACY_BRANCH_063098'.

git-svn-id: svn://10.0.0.236/branches/PRIVACY_BRANCH_063098@4697 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-30 02:24:00 +00:00
9228 changed files with 2707038 additions and 106011 deletions

320
CVSROOT/modules Normal file
View File

@@ -0,0 +1,320 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.
MozillaSource -a \
MozillaSourceWin \
MozillaSourceMac \
MozillaSourceUnix \
MozillaSourceWin -a MozillaSourceCommon MozillaSourceWinOnly
MozillaSourceMac -a MozillaSourceCommon MozillaSourceMacOnly
MozillaSourceUnix -a MozillaSourceCommon MozillaSourceUnixOnly
MozillaSourceCommon -a \
mozilla/LEGAL \
mozilla/LICENSE \
mozilla/CHANGES.html \
mozilla/build \
mozilla/include \
mozilla/jpeg \
mozilla/js \
mozilla/lib/htmldlgs \
mozilla/lib/layout \
mozilla/lib/libcnv \
mozilla/lib/libi18n \
mozilla/lib/liblayer \
mozilla/lib/libmisc \
mozilla/lib/libmime \
mozilla/lib/libmocha \
mozilla/lib/libnet \
mozilla/lib/libparse \
mozilla/lib/libpics \
mozilla/lib/libpwcac \
mozilla/lib/libstyle \
mozilla/lib/plugin \
mozilla/lib/xlate \
mozilla/lib/xp \
mozilla/modules/calendar \
mozilla/modules/edtplug/classes \
mozilla/modules/edtplug/src \
mozilla/modules/edtplug/include \
mozilla/modules/libfont/classes \
mozilla/modules/libfont/public \
mozilla/modules/libfont/src \
mozilla/modules/libhook \
mozilla/modules/libimg \
mozilla/modules/libnls \
mozilla/modules/libpref \
mozilla/modules/libreg \
mozilla/modules/libutil \
mozilla/modules/oji \
mozilla/modules/progress/src \
mozilla/modules/rdf \
mozilla/modules/schedulr \
mozilla/modules/security/freenav \
mozilla/modules/softupdt/classes \
mozilla/modules/softupdt/include \
mozilla/modules/softupdt/src \
mozilla/modules/xml \
mozilla/modules/zlib/src \
mozilla/nav-java/stubs \
mozilla/network \
mozilla/nsprpub \
mozilla/xpcom \
mozilla/l10n \
mozilla/dbm \
mozilla/privacy \
mozilla/README
MozillaSourceWinOnly -a \
mozilla/client.mak \
mozilla/cmd/makefile.win \
mozilla/cmd/dialup \
mozilla/cmd/wincom \
mozilla/cmd/winfe \
mozilla/config \
mozilla/lib/makefile.win \
mozilla/modules/coreincl \
mozilla/modules/edtplug/makefile.win \
mozilla/makefile.win \
mozilla/modules/libfont/jmcgen \
mozilla/modules/libfont/makefile.win \
mozilla/modules/libfont/producers/makefile.win \
mozilla/modules/libfont/producers/win \
mozilla/modules/libfont/producers/win/classes \
mozilla/modules/libfont/producers/win/classes/netscape \
mozilla/modules/libfont/producers/win/classes/netscape/fonts \
mozilla/modules/libfont/producers/win/src \
mozilla/modules/makefile.win \
mozilla/modules/progress/makefile.win \
mozilla/modules/progress/public \
mozilla/modules/security/makefile.win \
mozilla/modules/softupdt/makefile.win \
mozilla/modules/zlib/makefile.win \
mozilla/nav-java/makefile.win \
JavaStubWin
MozillaSourceUnixOnly -a \
mozilla/cmd/Makefile \
mozilla/cmd/stubfe \
mozilla/cmd/xfe \
mozilla/config/.cvsignore \
mozilla/config/AIX.mk \
mozilla/config/BSD_OS.mk \
mozilla/config/bsdecho.c \
mozilla/config/clobber_miss.pl \
mozilla/config/common.mk \
mozilla/config/config.guess \
mozilla/config/config.mk \
mozilla/config/coreconf.mk \
mozilla/config/cvsco.pl \
mozilla/config/fastcwd.pl \
mozilla/config/FreeBSD.mk \
mozilla/config/gtscc.c \
mozilla/config/HP-UX.mk \
mozilla/config/IRIX.mk \
mozilla/config/Linux.mk \
mozilla/config/makecopy.c \
mozilla/config/Makefile \
mozilla/config/mangle.c \
mozilla/config/mantomak.c \
mozilla/config/mkdepend \
mozilla/config/NCR.mk \
mozilla/config/NEC.mk \
mozilla/config/NEWS-OS.mk \
mozilla/config/NEXTSTEP.mk \
mozilla/config/nfspwd.pl \
mozilla/config/nodl.pl \
mozilla/config/nsinstall.c \
mozilla/config/OSF1.mk \
mozilla/config/outofdate.pl \
mozilla/config/pathsub.c \
mozilla/config/pathsub.h \
mozilla/config/pkg2dpth.pl \
mozilla/config/ports \
mozilla/config/revdepth.pl \
mozilla/config/Rhapsody.mk \
mozilla/config/rules.mk \
mozilla/config/SCOOS.mk \
mozilla/config/SINIX.mk \
mozilla/config/sj.pl \
mozilla/config/SunOS.mk \
mozilla/config/SunOS4.mk \
mozilla/config/SunOS5.mk \
mozilla/config/UNIXWARE.mk \
mozilla/config/xmversion.sh \
mozilla/lib/Makefile \
mozilla/Makefile \
mozilla/modules/edtplug/Makefile \
mozilla/modules/libfont/jmcgen \
mozilla/modules/libfont/Makefile \
mozilla/modules/libfont/producers/Makefile \
mozilla/modules/Makefile \
mozilla/modules/progress/Makefile \
mozilla/modules/progress/public \
mozilla/modules/security/Makefile \
mozilla/modules/softupdt/Makefile \
mozilla/modules/zlib/Makefile \
mozilla/nav-java/Makefile \
mozilla/lib/mariner \
JavaStubUnix
MozillaSourceMacOnly -a \
mozilla/config/mac \
mozilla/cmd/dialup \
mozilla/cmd/macfe \
mozilla/lib/mac/AutoAdmin \
mozilla/lib/mac/Includes \
mozilla/lib/mac/MacMemoryAllocator \
mozilla/lib/mac/Misc \
mozilla/lib/mac/MoreFiles \
mozilla/lib/mac/NSRuntime \
mozilla/lib/mac/NSStdLib \
mozilla/lib/mac/patches \
mozilla/lib/mac/PowerPlant \
mozilla/lib/mac/UserInterface \
mozilla/modules/coreincl \
mozilla/modules/edtplug/macbuild \
mozilla/modules/libfont \
mozilla/modules/progress/macbuild \
mozilla/modules/progress/public \
mozilla/modules/softupdt/macbuild \
mozilla/modules/zlib/macbuild \
mozilla/lib/mariner \
JavaStubMac
JavaStubAll -a \
JavaStubWin \
JavaStubMac \
JavaStubUnix
JavaStubCore -a \
mozilla/sun-java/stubs/include \
mozilla/sun-java/stubs/src
JavaStubMac -a \
JavaStubCore \
mozilla/sun-java/stubs/macbuild \
mozilla/sun-java/stubs/macjri
JavaStubUnix -a \
JavaStubCore \
mozilla/sun-java/Makefile \
mozilla/sun-java/stubs/jri \
mozilla/sun-java/stubs/Makefile
JavaStubWin -a \
JavaStubCore \
mozilla/sun-java/makefile.win \
mozilla/sun-java/stubs/jri \
mozilla/sun-java/stubs/makefile.win
######################################################################
#
# Modules for the raptor layout effort. Note that raptor dist is temporary
# until raptor is integrated into the mainline build.
#
RaptorDist -a \
mozilla/nsprpub \
mozilla/include \
mozilla/jpeg \
mozilla/modules/libreg \
mozilla/xpcom \
mozilla/modules/zlib \
mozilla/modules/libutil \
mozilla/sun-java \
mozilla/nav-java \
mozilla/js \
mozilla/modules/security/freenav \
mozilla/modules/libpref \
mozilla/modules/libimg \
mozilla/lib/xp \
mozilla/lib/libnet \
mozilla/base \
mozilla/network
Raptor -a \
mozilla/htmlparser \
mozilla/dom \
mozilla/gfx \
mozilla/view \
mozilla/widget \
mozilla/layout \
mozilla/webshell
RaptorAll -a \
RaptorDist \
Raptor
#####################################################################
# Module for the Normandy landing.
NormandyBeach -a \
MozillaSource \
mozilla/lib/libaddr \
mozilla/lib/libmsg
NormandyBeachWin -a \
MozillaSourceWin \
mozilla/lib/libaddr \
mozilla/lib/libmsg
NormandyBeachUnix -a \
MozillaSourceUnix \
mozilla/lib/libaddr \
mozilla/lib/libmsg
NormandyBeachMac -a \
MozillaSourceMac \
mozilla/lib/libaddr \
mozilla/lib/libmsg
#######################################################################
# Modules for the Directory SDK. There are two users of the libldap
# Mozilla and the DirectorySDK
DirectorySDKSource -a \
DirectorySDKSourceCommon \
DirectorySDKSourceBuild
DirectorySDKSourceCommon -a \
mozilla/directory/ldapsdk.mak \
mozilla/directory/ldapsdk.mk \
mozilla/directory/buildsdk.txt \
mozilla/directory/Makefile \
mozilla/directory/c-sdk
DirectorySDKSourceBuild -a \
mozilla/cmd/winfe/mkfiles32 \
mozilla/config

36279
mozilla/CHANGES.html Normal file

File diff suppressed because it is too large Load Diff

40
mozilla/LEGAL Normal file
View File

@@ -0,0 +1,40 @@
Please be apprised of the following Legal Notices:
A) The U.S. District Court for the Eastern District of Virginia has
ruled that the Netscape Navigator code does not infringe Wang's U.S.
Patent No. 4,751,669 ("the '669 Patent") because: 1) HTML is not
Videotex as defined by the '669 patent; 2) web servers are not central
suppliers; and 3) Navigator does not "connect," as defined by the '669
Patent, to web servers on the Internet. Wang may appeal this decision to
the Federal Circuit. Wang contended that its Patent disclosing a
"Videotext" system, is infringed by the following functionality in the
Netscape Navigator code: 1) the animated logo and status line indicators
--See Claims 1,8 and 9; 2) the "File Save As" function --See Claims
23-27; 3) Bookmarks and Rename Bookmarks in the Properties window --See
Claims 20-22; 4) storing HTML, GIF, and JPEG files and adding filename
extensions --See Claim 38
B) Intermind owns pending U.S. patent applications on communications
systems which employ metadata ("channel objects") to define a control
structure for information transfer. The Netscape code does not infringe
as released; however, modifications which utilize channel objects as
described by Intermind should be considered carefully. The following is
a statement from Intermind: "Intermind's claims fundamentally involve
the use of a control structure to automate communications. ...The
essence of Intermind's top claim is that two devices sender and
receiver have persistent storage, communicate over a network,
and exchange a control structure including metadata which describes: 1)
what information is to be updated, 2) when to update this information,
and 3) how to transfer the updated information. In addition, at least
the receiving device must be able to process the metadata in order to
perform the update determination and transfer. Any digital
communications system which incorporates all of these elements will be
covered by Intermind's patents." See Intermind.com.
C) Stac, Inc., and its licensing agent Hi/fn, own several patents which
disclose data compression methods implementing an LZS compression
algorithm, including U.S. Patent Nos. 4,701,745 and 5,016, 009 ("the
Stac Patents"). The Netscape Communicator code does not perform
compression. If you modify the Netscape source code to perform
compression, please take notice of the Stac Patents.

421
mozilla/LICENSE Normal file
View File

@@ -0,0 +1,421 @@
NETSCAPE PUBLIC LICENSE
Version 1.0
----------------
1. Definitions.
1.1. ``Contributor'' means each entity that creates or contributes to
the creation of Modifications.
1.2. ``Contributor Version'' means the combination of the Original
Code, prior Modifications used by a Contributor, and the Modifications
made by that particular Contributor.
1.3. ``Covered Code'' means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case
including portions thereof.
1.4. ``Electronic Distribution Mechanism'' means a mechanism generally
accepted in the software development community for the electronic
transfer of data.
1.5. ``Executable'' means Covered Code in any form other than Source
Code.
1.6. ``Initial Developer'' means the individual or entity identified as
the Initial Developer in the Source Code notice required by Exhibit A.
1.7. ``Larger Work'' means a work which combines Covered Code or
portions thereof with code not governed by the terms of this License.
1.8. ``License'' means this document.
1.9. ``Modifications'' means any addition to or deletion from the
substance or structure of either the Original Code or any previous
Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or
previous Modifications.
1.10. ``Original Code'' means Source Code of computer software code
which is described in the Source Code notice required by Exhibit A as
Original Code, and which, at the time of its release under this License
is not already Covered Code governed by this License.
1.11. ``Source Code'' means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus any
associated interface definition files, scripts used to control
compilation and installation of an Executable, or a list of source code
differential comparisons against either the Original Code or another
well known, available Covered Code of the Contributor's choice. The
Source Code can be in a compressed or archival form, provided the
appropriate decompression or de-archiving software is widely available
for no charge.
1.12. ``You'' means an individual or a legal entity exercising rights
under, and complying with all of the terms of, this License or a future
version of this License issued under Section 6.1. For legal entities,
``You'' includes any entity which controls, is controlled by, or is
under common control with You. For purposes of this definition,
``control'' means (a) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (b) ownership of fifty percent (50%) or more of the
outstanding shares or beneficial ownership of such entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) to use, reproduce, modify, display, perform, sublicense and
distribute the Original Code (or portions thereof) with or without
Modifications, or as part of a Larger Work; and
(b) under patents now or hereafter owned or controlled by Initial
Developer, to make, have made, use and sell (``Utilize'') the
Original Code (or portions thereof), but solely to the extent that
any such patent is reasonably necessary to enable You to Utilize
the Original Code (or portions thereof) and not to any greater
extent that may be necessary to Utilize further Modifications or
combinations.
2.2. Contributor Grant.
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) to use, reproduce, modify, display, perform, sublicense and
distribute the Modifications created by such Contributor (or
portions thereof) either on an unmodified basis, with other
Modifications, as Covered Code or as part of a Larger Work; and
(b) under patents now or hereafter owned or controlled by
Contributor, to Utilize the Contributor Version (or portions
thereof), but solely to the extent that any such patent is
reasonably necessary to enable You to Utilize the Contributor
Version (or portions thereof), and not to any greater extent that
may be necessary to Utilize further Modifications or combinations.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are
governed by the terms of this License, including without limitation
Section 2.2. The Source Code version of Covered Code may be distributed
only under the terms of this License or a future version of this
License released under Section 6.1, and You must include a copy of this
License with every copy of the Source Code You distribute. You may not
offer or impose any terms on any Source Code version that alters or
restricts the applicable version of this License or the recipients'
rights hereunder. However, You may include an additional document
offering the additional rights described in Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be
made available in Source Code form under the terms of this License
either on the same media as an Executable version or via an accepted
Electronic Distribution Mechanism to anyone to whom you made an
Executable version available; and if made available via Electronic
Distribution Mechanism, must remain available for at least twelve (12)
months after the date it initially became available, or at least six
(6) months after a subsequent version of that particular Modification
has been made available to such recipients. You are responsible for
ensuring that the Source Code version remains available even if the
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which you contribute to contain a
file documenting the changes You made to create that Covered Code and
the date of any change. You must include a prominent statement that the
Modification is derived, directly or indirectly, from Original Code
provided by the Initial Developer and including the name of the Initial
Developer in (a) the Source Code, and (b) in any notice in an
Executable version or related documentation in which You describe the
origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If You have knowledge that a party claims an intellectual property
right in particular functionality or code (or its utilization
under this License), you must include a text file with the source
code distribution titled ``LEGAL'' which describes the claim and
the party making the claim in sufficient detail that a recipient
will know whom to contact. If you obtain such knowledge after You
make Your Modification available as described in Section 3.2, You
shall promptly modify the LEGAL file in all copies You make
available thereafter and shall take other steps (such as notifying
appropriate mailing lists or newsgroups) reasonably calculated to
inform those who received the Covered Code that new knowledge has
been obtained.
(b) Contributor APIs.
If Your Modification is an application programming interface and
You own or control patents which are reasonably necessary to
implement that API, you must also include this information in the
LEGAL file.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code, and this License in any documentation for the Source Code, where
You describe recipients' rights relating to Covered Code. If You
created one or more Modification(s), You may add your name as a
Contributor to the notice described in Exhibit A. If it is not possible
to put such notice in a particular Source Code file due to its
structure, then you must include such notice in a location (such as a
relevant directory file) where a user would be likely to look for such
a notice. You may choose to offer, and to charge a fee for, warranty,
support, indemnity or liability obligations to one or more recipients
of Covered Code. However, You may do so only on Your own behalf, and
not on behalf of the Initial Developer or any Contributor. You must
make it absolutely clear than any such warranty, support, indemnity or
liability obligation is offered by You alone, and You hereby agree to
indemnify the Initial Developer and every Contributor for any liability
incurred by the Initial Developer or such Contributor as a result of
warranty, support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the
requirements of Section 3.1-3.5 have been met for that Covered Code,
and if You include a notice stating that the Source Code version of the
Covered Code is available under the terms of this License, including a
description of how and where You have fulfilled the obligations of
Section 3.2. The notice must be conspicuously included in any notice in
an Executable version, related documentation or collateral in which You
describe recipients' rights relating to the Covered Code. You may
distribute the Executable version of Covered Code under a license of
Your choice, which may contain terms different from this License,
provided that You are in compliance with the terms of this License and
that the license for the Executable version does not attempt to limit
or alter the recipient's rights in the Source Code version from the
rights set forth in this License. If You distribute the Executable
version under a different license You must make it absolutely clear
that any terms which differ from this License are offered by You alone,
not by the Initial Developer or any Contributor. You hereby agree to
indemnify the Initial Developer and every Contributor for any liability
incurred by the Initial Developer or such Contributor as a result of
any such terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code
not governed by the terms of this License and distribute the Larger
Work as a single product. In such a case, You must make sure the
requirements of this License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Code due to statute
or regulation then You must: (a) comply with the terms of this License
to the maximum extent possible; and (b) describe the limitations and
the code they affect. Such description must be included in the LEGAL
file described in Section 3.4 and must be included with all
distributions of the Source Code. Except to the extent prohibited by
statute or regulation, such description must be sufficiently detailed
for a recipient of ordinary skill to be able to understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has
attached the notice in Exhibit A, and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation (``Netscape'') may publish revised
and/or new versions of the License from time to time. Each version will
be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
License, You may always continue to use it under the terms of that
version. You may also choose to use such Covered Code under the terms
of any subsequent version of the License published by Netscape. No one
other than Netscape has the right to modify the terms applicable to
Covered Code created under this License.
6.3. Derivative Works.
If you create or use a modified version of this License (which you may
only do in order to apply it to code which is not already Covered Code
governed by this License), you must (a) rename Your license so that the
phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL'' or
any confusingly similar phrase do not appear anywhere in your license
and (b) otherwise make it clear that your version of the license
contains terms which differ from the Mozilla Public License and
Netscape Public License. (Filling in the name of the Initial Developer,
Original Code or Contributor in the notice described in Exhibit A shall
not of themselves be deemed to be modifications of this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
This License and the rights granted hereunder will terminate
automatically if You fail to comply with terms herein and fail to cure
such breach within 30 days of becoming aware of the breach. All
sublicenses to the Covered Code which are properly granted shall
survive any termination of this License. Provisions which, by their
nature, must remain in effect beyond the termination of this License
shall survive.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER
PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND
ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE
BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT
EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a ``commercial item,'' as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer
software'' and ``commercial computer software documentation,'' as such
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
all U.S. Government End Users acquire Covered Code with only those
rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. This License shall be governed by
California law provisions (except to the extent applicable law, if any,
provides otherwise), excluding its conflict-of-law provisions. With
respect to disputes in which at least one party is a citizen of, or an
entity chartered or registered to do business in, the United States of
America: (a) unless otherwise agreed in writing, all disputes relating
to this License (excepting any dispute relating to intellectual
property rights) shall be subject to final and binding arbitration,
with the losing party paying all costs of arbitration; (b) any
arbitration relating to this Agreement shall be held in Santa Clara
County, California, under the auspices of JAMS/EndDispute; and (c) any
litigation relating to this Agreement shall be subject to the
jurisdiction of the Federal Courts of the Northern District of
California, with venue lying in Santa Clara County, California, with
the losing party responsible for costs, including without limitation,
court costs and reasonable attorneys fees and expenses. The application
of the United Nations Convention on Contracts for the International
Sale of Goods is expressly excluded. Any law or regulation which
provides that the language of a contract shall be construed against the
drafter shall not apply to this License.
12. RESPONSIBILITY FOR CLAIMS.
Except in cases where another Contributor has failed to comply with
Section 3.4, You are responsible for damages arising, directly or
indirectly, out of Your utilization of rights under this License, based
on the number of copies of Covered Code you made available, the
revenues you received from utilizing such rights, and other relevant
factors. You agree to work with affected parties to distribute
responsibility on an equitable basis.
AMENDMENTS
Additional Terms applicable to the Netscape Public License.
I. Effect.
These additional terms described in this Netscape Public License --
Amendments shall apply to the Mozilla Communicator client code and to
all Covered Code under this License.
II. ``Netscape's Branded Code'' means Covered Code that Netscape
distributes and/or permits others to distribute under one or more
trademark(s) which are controlled by Netscape but which are not
licensed for use under this License.
III. Netscape and logo.
This License does not grant any rights to use the trademark
``Netscape'', the ``Netscape N and horizon'' logo or the Netscape
lighthouse logo, even if such marks are included in the Original Code.
IV. Inability to Comply Due to Contractual Obligation.
Prior to licensing the Original Code under this License, Netscape has
licensed third party code for use in Netscape's Branded Code. To the
extent that Netscape is limited contractually from making such third
party code available under this License, Netscape may choose to
reintegrate such code into Covered Code without being required to
distribute such code in Source Code form, even if such code would
otherwise be considered ``Modifications'' under this License.
V. Use of Modifications and Covered Code by Initial Developer.
V.1. In General.
The obligations of Section 3 apply to Netscape, except to the
extent specified in this Amendment, Section V.2 and V.3.
V.2. Other Products.
Netscape may include Covered Code in products other than the
Netscape's Branded Code which are released by Netscape during the
two (2) years following the release date of the Original Code,
without such additional products becoming subject to the terms of
this License, and may license such additional products on
different terms from those contained in this License.
V.3. Alternative Licensing.
Netscape may license the Source Code of Netscape's Branded Code,
including Modifications incorporated therein, without such
additional products becoming subject to the terms of this License,
and may license such additional products on different terms from
those contained in this License.
VI. Arbitration and Litigation.
Notwithstanding the limitations of Section 11 above, the provisions
regarding arbitration and litigation in Section 11(a), (b) and (c) of
the License shall apply to all disputes relating to this License.
EXHIBIT A.
``The contents of this file are subject to the Netscape Public License
Version 1.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is Mozilla Communicator client code, released March
31, 1998.
The Initial Developer of the Original Code is Netscape Communications
Corporation. Portions created by Netscape are Copyright (C) 1998
Netscape Communications Corporation. All Rights Reserved.
Contributor(s): ______________________________________.''
[NOTE: The text of this Exhibit A may differ slightly from the text of
the notices in the Source Code files of the Original Code. This is due
to time constraints encountered in simultaneously finalizing the
License and in preparing the Original Code for release. You should use
the text of this Exhibit A rather than the text found in the Original
Code Source Code for Your Modifications.]

87
mozilla/Makefile Normal file
View File

@@ -0,0 +1,87 @@
#
# 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 = .
NSPRDIR = nsprpub
NSPR20 = 1
MOZILLA_CLIENT = 1
ifndef NO_MOCHA
DIRS_JS = js
endif
DIRS = config coreconf $(NSPRDIR) jpeg dbm xpcom network
ifdef MOZ_NETCAST
DIRS += netcast
endif
ifdef MOZ_JAVA
DIRS += sun-java ldap ifc $(DIRS_JS) nav-java ifc/tools js/jsd
else
DIRS += sun-java nav-java $(DIRS_JS)
endif
ifndef NO_SECURITY
DIRS += security
endif
ifdef MOZ_PRIVACY
DIRS += privacy
endif
DIRS += modules lib l10n cmd
ifeq ($(STAND_ALONE_JAVA),1)
DIRS = config lib/xp $(NSPRDIR) jpeg modules/zlib sun-java ifc js ifc/tools sun-java/java
endif
include $(DEPTH)/config/rules.mk
export:: $(OBJS)
# Running this rule assembles all the SDK source pieces into dist/sdk.
# You'll need to run this rule on every platform to get all the
# binaries (e.g. javah) copied there. You'll also have to do special
# magic on a Mac.
sdk-src::
$(SDKINSTALL) include/npapi.h $(SDK)/include/
$(SDKINSTALL) include/jri_md.h $(SDK)/include/
$(SDKINSTALL) include/jritypes.h $(SDK)/include/
$(SDKINSTALL) include/jri.h $(SDK)/include/
$(SDKINSTALL) lib/plugin/npupp.h $(SDK)/include/
$(SDKINSTALL) sdk/common/*.c* $(SDK)/common/
$(SDKINSTALL) sun-java/classsrc/$(ZIP_NAME).x $(SDK)/classes/$(ZIP_NAME)
$(SDKINSTALL) sdk/examples/simple/Source/*.c $(SDK)/examples/simple/Source/
$(SDKINSTALL) sdk/examples/simple/Source/*.java $(SDK)/examples/simple/Source/
$(SDKINSTALL) sdk/examples/simple/Source/*.class $(SDK)/examples/simple/Source/
$(SDKINSTALL) sdk/examples/simple/Source/_gen/*.h $(SDK)/examples/simple/Source/_gen/
$(SDKINSTALL) sdk/examples/simple/Source/_stubs/*.c $(SDK)/examples/simple/Source/_stubs/
$(SDKINSTALL) sdk/examples/simple/Unix/makefile.* $(SDK)/examples/simple/Unix/
$(SDKINSTALL) sdk/examples/simple/Testing/SimpleExample.html $(SDK)/examples/simple/Testing/
$(SDKINSTALL) sdk/examples/simple/readme.html $(SDK)/examples/simple/
$(SDKINSTALL) sdk/examples/UnixTemplate/Source/*.c $(SDK)/examples/UnixTemplate/Source/
$(SDKINSTALL) sdk/examples/UnixTemplate/Testing/Test.html $(SDK)/examples/UnixTemplate/Testing/
$(SDKINSTALL) sdk/examples/UnixTemplate/Unix/makefile.* $(SDK)/examples/UnixTemplate/Unix/
$(SDKINSTALL) sdk/examples/UnixTemplate/readme.html $(SDK)/examples/UnixTemplate/
sdk-bin::
cd sdk; $(MAKE); cd ..
$(SDKINSTALL) $(DIST)/bin/javah$(BIN_SUFFIX) $(SDK)/bin/$(OS_CONFIG)/
$(SDKINSTALL) sdk/examples/simple/Source/$(OBJDIR)/npsimple.$(DLL_SUFFIX) $(SDK)/bin/$(OS_CONFIG)/
$(SDKINSTALL) sdk/examples/UnixTemplate/Source/$(OBJDIR)/nptemplate.$(DLL_SUFFIX) $(SDK)/bin/$(OS_CONFIG)/

24
mozilla/base/Makefile Normal file
View File

@@ -0,0 +1,24 @@
#!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 = ..
DIRS = public src tests
include $(DEPTH)/config/config.mk
include $(DEPTH)/config/rules.mk

Binary file not shown.

23
mozilla/base/makefile.win Normal file
View File

@@ -0,0 +1,23 @@
#!nmake
#
# 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=..
IGNORE_MANIFEST=1
DIRS=public src tests
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,5 @@
#
# This is a list of local files which get copied to the mozilla:dist:base directory
#
nsISizeOfHandler.h

View File

@@ -0,0 +1,30 @@
#!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=../..
DEFINES = -D_IMPL_NS_BASE
EXPORTS = \
nsISizeOfHandler.h \
$(NULL)
MODULE = raptor
include $(DEPTH)/config/config.mk
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,30 @@
#!nmake
#
# 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=..\..
IGNORE_MANIFEST=1
DEFINES = -D_IMPL_NS_BASE
EXPORTS = \
nsISizeOfHandler.h \
$(NULL)
MODULE = raptor
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,66 @@
/* -*- Mode: C++; tab-width: 2; 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 nsISizeOfHandler_h___
#define nsISizeOfHandler_h___
#include "nscore.h"
#include "nsISupports.h"
/* c028d1f0-fc9e-11d1-89e4-006008911b81 */
#define NS_ISIZEOF_HANDLER_IID \
{ 0xc028d1f0, 0xfc9e, 0x11d1, {0x89, 0xe4, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81}}
/**
* An API to managing a sizeof computation of an arbitrary graph.
* The handler is responsible for remembering which objects have been
* seen before. Note that the handler doesn't hold references to
* nsISupport's objects; the assumption is that the objects being
* sized are stationary and will not be modified during the sizing
* computation and therefore do not need an extra reference count.
*/
class nsISizeOfHandler : public nsISupports {
public:
/**
* Add in a simple size value to the running total.
* Always returns NS_OK.
*/
NS_IMETHOD Add(size_t aSize) = 0;
/**
* Update aResult with PR_TRUE if the object has been traversed
* by the sizeof computation before. Otherwise aResult is set to
* PR_FALSE and the object is added to the internal database
* of objects that have been traversed. It's ok to pass a null
* pointer in; aResult will be set to PR_TRUE so you won't accidently
* try to traverse through null pointer.
*
* Note: This violates the COM API standard on purpose; so there!
*/
virtual PRBool HaveSeen(void* anObject) = 0;
/**
* Return the currently computed size.
* Always returns NS_OK.
*/
NS_IMETHOD GetSize(PRUint32& aResult) = 0;
};
extern NS_BASE nsresult
NS_NewSizeOfHandler(nsISizeOfHandler** aInstancePtrResult);
#endif /* nsISizeofHandler_h___ */

22
mozilla/base/src/MANIFEST Normal file
View File

@@ -0,0 +1,22 @@
#
# This is a list of local files which get copied to the mozilla:dist directory
#
nscore.h
nsIArena.h
nsIAtom.h
nsIByteBuffer.h
nsBTree.h
nsCRT.h
nsDeque.h
nsITimer.h
nsITimerCallback.h
nsIUnicharBuffer.h
nsRBTree.h
nsIUnicharInputStream.h
nsString.h
nsVoidArray.h
nsUnitConversion.h
nsIBaseStream.h
nsIInputStream.h
nsIOutputStream.h

70
mozilla/base/src/Makefile Normal file
View File

@@ -0,0 +1,70 @@
#!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=../..
DEFINES =-D_IMPL_NS_BASE
DIRS = unix
LIBRARY_NAME = raptorbase
CPPSRCS = \
nsArena.cpp \
nsAtomTable.cpp \
nsBTree.cpp \
nsByteBuffer.cpp \
nsCRT.cpp \
nsDeque.cpp \
nsRBTree.cpp \
nsSizeOfHandler.cpp \
nsString.cpp \
nsUnicharBuffer.cpp \
nsUnicharInputStream.cpp \
nsVoidArray.cpp \
$(NULL)
EXPORTS = \
nscore.h \
nsBTree.h \
nsCRT.h \
nsDeque.h \
nsIArena.h \
nsIAtom.h \
nsIByteBuffer.h \
nsIBaseStream.h \
nsIInputStream.h \
nsIOutputStream.h \
nsITimer.h \
nsITimerCallback.h \
nsIUnicharBuffer.h \
nsIUnicharInputStream.h \
nsRBTree.h \
nsString.h \
nsVoidArray.h \
nsUnitConversion.h \
$(NULL)
MODULE = raptor
REQUIRES = xpcom netlib raptor
include $(DEPTH)/config/config.mk
TARGET = $(LIBARY)
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,95 @@
#!nmake
#
# 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=..\..
IGNORE_MANIFEST=1
DIRS = windows
DEFINES=-D_IMPL_NS_BASE -DWIN32_LEAN_AND_MEAN
LIBRARY_NAME=raptorbase
CPPSRCS = \
nsArena.cpp \
nsAtomTable.cpp \
nsBTree.cpp \
nsByteBuffer.cpp \
nsCRT.cpp \
nsDeque.cpp \
nsRBTree.cpp \
nsSizeOfHandler.cpp \
nsString.cpp \
nsUnicharBuffer.cpp \
nsUnicharInputStream.cpp \
nsVoidArray.cpp \
$(NULL)
CPP_OBJS = \
.\$(OBJDIR)\nsArena.obj \
.\$(OBJDIR)\nsAtomTable.obj \
.\$(OBJDIR)\nsBTree.obj \
.\$(OBJDIR)\nsByteBuffer.obj \
.\$(OBJDIR)\nsCRT.obj \
.\$(OBJDIR)\nsDeque.obj \
.\$(OBJDIR)\nsRBTree.obj \
.\$(OBJDIR)\nsSizeOfHandler.obj \
.\$(OBJDIR)\nsString.obj \
.\$(OBJDIR)\nsUnicharBuffer.obj \
.\$(OBJDIR)\nsUnicharInputStream.obj \
.\$(OBJDIR)\nsVoidArray.obj \
$(NULL)
EXPORTS=nscore.h nsIArena.h nsIAtom.h nsIByteBuffer.h \
nsBTree.h nsCRT.h nsDeque.h nsITimer.h \
nsITimerCallback.h nsIUnicharBuffer.h nsRBTree.h \
nsIUnicharInputStream.h nsString.h nsVoidArray.h \
nsUnitConversion.h \
nsIBaseStream.h nsIInputStream.h nsIOutputStream.h
MODULE=raptor
REQUIRES=xpcom netlib raptor
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\netlib \
-I$(PUBLIC)\raptor
MAKE_OBJ_TYPE = DLL
DLLNAME = raptorbase
DLL=.\$(OBJDIR)\$(DLLNAME).dll
OBJS = $(OBJS) .\$(OBJDIR)\nsTimer.obj
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
# These are the libraries we need to link with to create the dll
LLIBS= \
$(DIST)\lib\xpcom32.lib \
$(DIST)\lib\libplc21.lib \
$(LIBNSPR)
include <$(DEPTH)\config\rules.mak>
libs:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\$(DLLNAME).dll
rm -f $(DIST)\lib\$(DLLNAME).lib

View File

@@ -0,0 +1,80 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsIArena.h"
#include "nsCRT.h"
#define PL_ARENA_CONST_ALIGN_MASK 7
#include "plarena.h"
static NS_DEFINE_IID(kArenaIID, NS_IARENA_IID);
// Simple arena implementation layered on plarena
class ArenaImpl : public nsIArena {
public:
ArenaImpl(PRInt32 aBlockSize);
NS_DECL_ISUPPORTS
virtual void* Alloc(PRInt32 aSize);
protected:
~ArenaImpl();
PLArenaPool mPool;
PRInt32 mBlockSize;
};
ArenaImpl::ArenaImpl(PRInt32 aBlockSize)
{
NS_INIT_REFCNT();
if (aBlockSize < NS_MIN_ARENA_BLOCK_SIZE) {
aBlockSize = NS_DEFAULT_ARENA_BLOCK_SIZE;
}
PL_INIT_ARENA_POOL(&mPool, "nsIArena", aBlockSize);
mBlockSize = aBlockSize;
}
NS_IMPL_ISUPPORTS(ArenaImpl,kArenaIID)
ArenaImpl::~ArenaImpl()
{
PL_FinishArenaPool(&mPool);
}
void* ArenaImpl::Alloc(PRInt32 size)
{
// Adjust size so that it's a multiple of sizeof(double)
PRInt32 align = size & (sizeof(double) - 1);
if (0 != align) {
size += sizeof(double) - align;
}
void* p;
PL_ARENA_ALLOCATE(p, &mPool, size);
return p;
}
NS_BASE nsresult NS_NewHeapArena(nsIArena** aInstancePtrResult,
PRInt32 aArenaBlockSize)
{
ArenaImpl* it = new ArenaImpl(aArenaBlockSize);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kArenaIID, (void **) aInstancePtrResult);
}

View File

@@ -0,0 +1,154 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsIAtom.h"
#include "nsString.h"
#include "nsCRT.h"
#include "plhash.h"
#include "nsISizeOfHandler.h"
/**
* The shared hash table for atom lookups.
*/
static nsrefcnt gAtoms;
static struct PLHashTable* gAtomHashTable;
class AtomImpl : public nsIAtom {
public:
AtomImpl();
~AtomImpl();
NS_DECL_ISUPPORTS
void* operator new(size_t size, const PRUnichar* us, PRInt32 uslen);
virtual void ToString(nsString& aBuf) const;
virtual const PRUnichar* GetUnicode() const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
// Actually more; 0 terminated. This slot is reserved for the
// terminating zero.
PRUnichar mString[1];
};
AtomImpl::AtomImpl()
{
NS_INIT_REFCNT();
// Every live atom holds a reference on the atom hashtable
gAtoms++;
}
AtomImpl::~AtomImpl()
{
NS_PRECONDITION(nsnull != gAtomHashTable, "null atom hashtable");
if (nsnull != gAtomHashTable) {
PL_HashTableRemove(gAtomHashTable, mString);
nsrefcnt cnt = --gAtoms;
if (0 == cnt) {
// When the last atom is destroyed, the atom arena is destroyed
NS_ASSERTION(0 == gAtomHashTable->nentries, "bad atom table");
PL_HashTableDestroy(gAtomHashTable);
gAtomHashTable = nsnull;
}
}
}
static NS_DEFINE_IID(kIAtomIID, NS_IATOM_IID);
NS_IMPL_ISUPPORTS(AtomImpl, kIAtomIID);
void* AtomImpl::operator new(size_t size, const PRUnichar* us, PRInt32 uslen)
{
size = size + uslen * sizeof(PRUnichar);
AtomImpl* ii = (AtomImpl*) new char[size];
nsCRT::memcpy(ii->mString, us, uslen * sizeof(PRUnichar));
ii->mString[uslen] = 0;
return ii;
}
void AtomImpl::ToString(nsString& aBuf) const
{
aBuf.SetLength(0);
aBuf.Append(mString, nsCRT::strlen(mString));
}
const PRUnichar* AtomImpl::GetUnicode() const
{
return mString;
}
NS_IMETHODIMP
AtomImpl::SizeOf(nsISizeOfHandler* aHandler) const
{
aHandler->Add(sizeof(*this) + nsCRT::strlen(mString) * sizeof(PRUnichar));
return NS_OK;
}
//----------------------------------------------------------------------
static PLHashNumber HashKey(const PRUnichar* k)
{
return (PLHashNumber) nsCRT::HashCode(k);
}
static PRIntn CompareKeys(const PRUnichar* k1, const PRUnichar* k2)
{
return nsCRT::strcmp(k1, k2) == 0;
}
NS_BASE nsIAtom* NS_NewAtom(const char* isolatin1)
{
nsAutoString tmp(isolatin1);
return NS_NewAtom(tmp.GetUnicode());
}
NS_BASE nsIAtom* NS_NewAtom(const nsString& aString)
{
return NS_NewAtom(aString.GetUnicode());
}
NS_BASE nsIAtom* NS_NewAtom(const PRUnichar* us)
{
if (nsnull == gAtomHashTable) {
gAtomHashTable = PL_NewHashTable(8, (PLHashFunction) HashKey,
(PLHashComparator) CompareKeys,
(PLHashComparator) nsnull,
nsnull, nsnull);
}
PRInt32 uslen;
PRInt32 hashCode = nsCRT::HashCode(us, &uslen);
PLHashEntry** hep = PL_HashTableRawLookup(gAtomHashTable, hashCode, us);
PLHashEntry* he = *hep;
if (nsnull != he) {
nsIAtom* id = (nsIAtom*) he->value;
NS_ADDREF(id);
return id;
}
AtomImpl* id = new(us, uslen) AtomImpl();
PL_HashTableRawAdd(gAtomHashTable, hep, hashCode, id->mString, id);
NS_ADDREF(id);
return id;
}
NS_BASE nsrefcnt NS_GetNumberOfAtoms(void)
{
if (nsnull != gAtomHashTable) {
NS_PRECONDITION(nsrefcnt(gAtomHashTable->nentries) == gAtoms, "bad atom table");
}
return gAtoms;
}

View File

@@ -0,0 +1,403 @@
/**
* This file defines the binary tree class and it
* nsNode child class.
*
* This simple version stores nodes, and the
* nodes store void* ptrs.
*
* @update gess 4/11/98
* @param
* @return
*/
#include "nsBTree.h"
/**
* default constructor
*
* @update gess 4/11/98
*/
nsNode::nsNode(){
mLeft=0;
mRight=0;
mParent=0;
mColor=eBlack;
}
/**
* Copy constructor
*
* @update gess 4/11/98
* @param
* @return
*/
nsNode::nsNode(const nsNode& aNode){
mLeft=aNode.mLeft;
mRight=aNode.mRight;
mParent=aNode.mParent;
mColor=aNode.mColor;
}
/**
* destructor
*
* @update gess 4/11/98
*/
nsNode::~nsNode(){
}
/**
* Retrive ptr to parent node
*
* @update gess 4/11/98
* @return ptr to parent node
*/
nsNode* nsNode::GetParentNode(void) const{
return mParent;
}
/**
* Retrieve ptr to left (less) node
*
* @update gess 4/11/98
* @return ptr to left (may be NULL)
*/
nsNode* nsNode::GetLeftNode(void) const{
return mLeft;
}
/**
* Retrieve ptr to right (more) node
*
* @update gess 4/11/98
* @return ptr to right node (may be NULL)
*/
nsNode* nsNode::GetRightNode(void) const{
return mRight;
}
/**
*
*
* @update gess 4/11/98
* @param
* @return
*/
nsNode& nsNode::operator=(const nsNode& aNode){
if(this!=&aNode){
mLeft=aNode.mLeft;
mRight=aNode.mRight;
mParent=aNode.mParent;
mColor=aNode.mColor;
}
return *this;
}
/********************************************************
* Here comes the BTREE class...
********************************************************/
/**
* nsBTree constructor
*
* @update gess 4/11/98
*/
nsBTree::nsBTree(){
mRoot=0;
}
/**
* destructor
*
* @update gess 4/11/98
*/
nsBTree::~nsBTree(){
if(mRoot){
//walk the tree and destroy the children.
}
}
/**
* Given a node, we're supposed to add it into
* our tree.
*
* @update gess 4/11/98
* @param aNode to be added to tree
* @return ptr to added node or NULL
*/
nsNode* nsBTree::Add(nsNode& aNode){
PRBool result=PR_TRUE;
nsNode* node1=mRoot; //x
nsNode* node2=0; //y
while(node1) {
node2=node1;
if(aNode<*node1)
node1=node1->mLeft;
else node1=node1->mRight;
}
aNode.mParent=node2;
if(!node2){
mRoot=&aNode;
}
else{
if(aNode<*node2)
node2->mLeft=&aNode;
else node2->mRight=&aNode;
}
return &aNode;
}
/**
* Removes given node from tree if present.
*
* @update gess 4/11/98
* @param aNode to be found and removed
* @return ptr to remove node, or NULL
*/
nsNode* nsBTree::Remove(nsNode& aNode){
nsNode* result=0;
nsNode* node3=Find(aNode);
if(node3) {
nsNode* node1;
nsNode* node2;
if((!node3->mLeft) || (!node3->mRight))
node2=node3;
else node2=After(*node3);
if(node2->mLeft)
node1=node2->mLeft;
else node1=node2->mRight;
if(node1)
node1->mParent=node2->mParent;
if(node2->mParent) {
if(node2==node2->mParent->mLeft)
node2->mParent->mLeft=node1;
else node2->mParent->mRight=node1;
}
else mRoot=node1;
if(node2!=node3)
(*node3)==(*node2);
if(node2->mColor == nsNode::eBlack)
ReBalance(*node1);
delete node2;
result=&aNode;
}
return result;
}
/**
* Clears the tree of any data.
* Be careful here if your objects are heap based!
* This method doesn't free the objects, so if you
* don't have your own pointers, they will become
* orphaned.
*
* @update gess 4/11/98
* @param
* @return this
*/
nsBTree& nsBTree::Empty(nsNode* aNode) {
mRoot=0;
return *this;
}
/**
* This method destroys all the objects in the tree.
* WARNING: Never call this method on stored objects
* that are stack-based!
*
* @update gess 4/11/98
* @param
* @return this
*/
nsBTree& nsBTree::Erase(nsNode* aNode){
nsNode* node1 =(aNode) ? aNode : mRoot;
if(aNode) {
Erase(aNode->mLeft); //begin by walking left side
Erase(aNode->mRight); //then search right side
delete aNode; //until a leaf, then delete
}
return *this;
}
/**
* Retrieve ptr to first node in tree
*
* @update gess 4/11/98
* @return
*/
nsNode* nsBTree::First(void) const{
if(mRoot)
return First(*mRoot);
return 0;
}
/**
* Retrive ptr to first node rel to given node
*
* @update gess 4/11/98
* @param node to begin scan from
* @return ptr to first node from given node or NULL
*/
nsNode* nsBTree::First(const nsNode& aNode) const{
nsNode* result=0;
if(mRoot) {
result=mRoot;
while(result->GetLeftNode()) {
result=result->GetLeftNode();
}
}
return result;
}
/**
* Retrive ptr to last node
*
* @update gess 4/11/98
* @return ptr to last node rel to root or NULL
*/
nsNode* nsBTree::Last(void) const{
if(mRoot)
return Last(*mRoot);
return 0;
}
/**
* Retrive ptr to last node rel to given node
*
* @update gess 4/11/98
* @param node to begin scan from
* @return ptr to first node from given node or NULL
*/
nsNode* nsBTree::Last(const nsNode& aNode) const{
nsNode* result=0;
if(mRoot) {
result=mRoot;
while(result->GetRightNode()) {
result=result->GetRightNode();
}
}
return result;
}
/**
* Retrive ptr to prior node rel to given node
*
* @update gess 4/11/98
* @param node to begin scan from
* @return ptr to prior node from given node or NULL
*/
nsNode* nsBTree::Before(const nsNode& aNode) const{
if(aNode.GetLeftNode())
return Last(*aNode.GetLeftNode());
//otherwise...
nsNode* node1=(nsNode*)&aNode;
nsNode* node2=aNode.GetParentNode();
while((node2) && (node1==node2->GetLeftNode())) {
node1=node2;
node2=node2->GetParentNode();
}
return node2;
}
/**
* Retrive ptr to next node rel to given node
*
* @update gess 4/11/98
* @param node to begin scan from
* @return ptr to next node from given node or NULL
*/
nsNode* nsBTree::After(const nsNode& aNode) const{
if(aNode.GetRightNode())
return First(*aNode.GetRightNode());
//otherwise...
nsNode* node1=(nsNode*)&aNode;
nsNode* node2=aNode.GetParentNode();
while((node2) && (node1==node2->GetRightNode())) {
node1=node2;
node2=node2->GetParentNode();
}
return node2;
}
/**
* Scan for given node
*
* @update gess 4/11/98
* @param node to find
* @return ptr to given node, or NULL
*/
nsNode* nsBTree::Find(const nsNode& aNode) const{
nsNode* result=mRoot;
while((result) && (!(aNode==(*result)))) {
if(aNode<*result)
result=result->mLeft;
else result=result->mRight;
}
return (nsNode*)result;
}
/**
* Rebalances tree around the given node. This only
* needs to be called after a node is deleted.
* This method does nothing for btrees, but is
* needed for RBTrees.
*
* @update gess 4/11/98
* @param aNode -- node to balance around
* @return this
*/
nsBTree& nsBTree::ReBalance(nsNode& aNode){
return *this;
}
/**
*
*
* @update gess 4/11/98
* @param
* @return
*/
const nsBTree& nsBTree::ForEach(nsNodeFunctor& aFunctor,nsNode* aNode) const{
nsNode* node1 =(aNode) ? aNode : mRoot;
if(node1) {
if(node1->mLeft)
ForEach(aFunctor,node1->mLeft); //begin by walking left side
aFunctor(*node1);
if(node1->mRight)
ForEach(aFunctor,node1->mRight); //then search right side
}
return *this;
}

283
mozilla/base/src/nsBTree.h Normal file
View File

@@ -0,0 +1,283 @@
/* -*- Mode: C++; tab-width: 2; 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 file defines the binary tree class and it
* nsNode child class. Note that like all nsBTree
* containers, this one does not automatically balance.
* (Find for random data, bad for pre-ordered data).
*
* This simple version stores nodes, and the
* nodes store void* ptrs.
*
* @update gess 4/11/98
*/
/**
* nsNode
*
* @update gess 4/11/98
* @param
* @return
*/
#ifndef _BTREE_H
#define _BTREE_H
#include "nscore.h"
struct NS_BASE nsNode {
/**
*
* @update gess4/20/98
* @param
* @return
*/
nsNode();
/**
* Copy constructor
* @update gess 4/11/98
*/
nsNode(const nsNode& aNode);
/**
* destructor
* @update gess 4/11/98
*/
virtual ~nsNode();
/**
* Retrieve parent node
*
* @update gess 4/11/98
* @return
*/
nsNode* GetParentNode(void) const;
/**
*
* @update gess 4/11/98
* @param
* @return
*/
nsNode* GetLeftNode() const;
/**
*
* @update gess 4/11/98
* @param
* @return
*/
nsNode* GetRightNode() const;
/**
*
* @update gess 4/11/98
* @param
* @return
*/
virtual nsNode& operator=(const nsNode& aNode);
/**
* This method gets called to determine which of
* two nodes is less. When you create your own
* subclass of nsNode, this is the most important
* method for you to overload.
*
* @update gess 4/11/98
* @param
* @return
*/
virtual PRBool operator<(const nsNode& aNode) const=0;
/**
* This method gets called to determine which of
* two nodes is less. When you create your own
* subclass of nsNode, this is the most important
* method for you to overload.
*
* @update gess 4/11/98
* @param
* @return
*/
virtual PRBool operator==(const nsNode& aNode) const=0;
enum eRBColor {eRed,eBlack};
nsNode* mParent;
nsNode* mLeft;
nsNode* mRight;
eRBColor mColor;
};
/**
* The Nodefunctor class is used when you want to create
* callbacks between the nsRBTree and your generic code.
*
* @update gess4/20/98
*/
class NS_BASE nsNodeFunctor {
public:
virtual nsNodeFunctor& operator()(nsNode& aNode)=0;
};
/****************************************************
* Here comes the nsBTree class...
****************************************************/
class NS_BASE nsBTree {
public:
friend class nsBTreeIterator;
nsBTree();
~nsBTree();
/**
* Add given node reference into our tree.
*
* @update gess 4/11/98
* @param aNode is a ref to a node to be added
* @return newly added node
*/
nsNode* Add(nsNode& aNode);
/**
* Remove given node reference into our tree.
*
* @update gess 4/11/98
* @param aNode is a ref to a node to be removed
* @return Ptr to node if found (and removed) or NULL
*/
nsNode* Remove(nsNode& aNode);
/**
* Clears the tree of any data.
* Be careful here if your objects are heap based!
* This method doesn't free the objects, so if you
* don't have your own pointers, they will become
* orphaned.
*
* @update gess 4/11/98
* @param
* @return this
*/
nsBTree& Empty(nsNode* aNode=0);
/**
* This method destroys all the objects in the tree.
* WARNING: Never call this method on stored objects
* that are stack-based!
*
* @update gess 4/11/98
* @param
* @return this
*/
nsBTree& Erase(nsNode* aNode=0);
/**
* Retrieve ptr to 1st node in tree (starting at root)
*
* @update gess 4/11/98
* @return ptr to 1st node, possible to be NULL
*/
nsNode* First(void) const;
/**
* Find first node in tree starting at given node
*
* @update gess 4/11/98
* @param aNode node to begin 1st search from
* @return ptr to 1st node below given node
*/
nsNode* First(const nsNode& aNode) const;
/**
* Retrieve ptr to last node in tree relative to root.
*
* @update gess 4/11/98
* @return ptr to last node or NULL
*/
nsNode* Last(void) const;
/**
* Retrieve ptr to last node in tree relative to given node.
*
* @update gess 4/11/98
* @param node to find last node from
* @return ptr to last node or NULL
*/
nsNode* Last(const nsNode& aNode) const;
/**
* Retrieve a ptr to the node that preceeds given node
*
* @update gess 4/11/98
* @param aNode used as reference to find prev.
* @return ptr to prev node or NULL
*/
nsNode* Before(const nsNode& aNode) const;
/**
* Retrieve a ptr to the node after given node
*
* @update gess 4/11/98
* @param aNode used as reference to find next.
* @return ptr to next node or NULL
*/
nsNode* After(const nsNode& aNode) const;
/**
* Find given node in tree.
* (Why would you want to find a node you already have?)
*
* @update gess 4/11/98
* @param aNode is the node you're searching for
* @return ptr to node if found, or NULL
*/
nsNode* Find(const nsNode& aNode) const;
/**
* Walks the tree, starting with root.
*
* @update gess 4/11/98
*/
virtual const nsBTree& ForEach(nsNodeFunctor& aFunctor,nsNode* aNode=0) const;
protected:
/**
* Rebalances tree around the given node. This only
* needs to be called after a node is deleted.
*
* @update gess 4/11/98
* @param aNode -- node to balance around
* @return this
*/
virtual nsBTree& ReBalance(nsNode& aNode);
nsNode* mRoot;
};
#endif

View File

@@ -0,0 +1,135 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsIByteBuffer.h"
#include "nsIInputStream.h"
#include "nsCRT.h"
#define MIN_BUFFER_SIZE 32
class ByteBufferImpl : public nsIByteBuffer {
public:
ByteBufferImpl(PRInt32 aBufferSize);
~ByteBufferImpl();
NS_DECL_ISUPPORTS
virtual PRInt32 GetLength() const;
virtual PRInt32 GetBufferSize() const;
virtual char* GetBuffer() const;
virtual PRBool Grow(PRInt32 aNewSize);
virtual PRInt32 Fill(PRInt32* aErrorCode, nsIInputStream* aStream,
PRInt32 aKeep);
char* mBuffer;
PRInt32 mSpace;
PRInt32 mLength;
};
ByteBufferImpl::ByteBufferImpl(PRInt32 aBufferSize)
{
if (PRUint32(aBufferSize) < MIN_BUFFER_SIZE) {
aBufferSize = MIN_BUFFER_SIZE;
}
mSpace = aBufferSize;
mBuffer = new char[aBufferSize];
mLength = 0;
NS_INIT_REFCNT();
}
NS_DEFINE_IID(kByteBufferIID,NS_IBYTE_BUFFER_IID);
NS_IMPL_ISUPPORTS(ByteBufferImpl,kByteBufferIID)
ByteBufferImpl::~ByteBufferImpl()
{
if (nsnull != mBuffer) {
delete mBuffer;
mBuffer = nsnull;
}
mLength = 0;
}
PRInt32 ByteBufferImpl::GetLength() const
{
return mLength;
}
PRInt32 ByteBufferImpl::GetBufferSize() const
{
return mSpace;
}
char* ByteBufferImpl::GetBuffer() const
{
return mBuffer;
}
PRBool ByteBufferImpl::Grow(PRInt32 aNewSize)
{
if (PRUint32(aNewSize) < MIN_BUFFER_SIZE) {
aNewSize = MIN_BUFFER_SIZE;
}
char* newbuf = new char[aNewSize];
if (nsnull != newbuf) {
if (0 != mLength) {
nsCRT::memcpy(newbuf, mBuffer, mLength);
}
delete mBuffer;
mBuffer = newbuf;
return PR_TRUE;
}
return PR_FALSE;
}
PRInt32 ByteBufferImpl::Fill(PRInt32* aErrorCode, nsIInputStream* aStream,
PRInt32 aKeep)
{
NS_PRECONDITION(nsnull != aStream, "null stream");
NS_PRECONDITION(PRUint32(aKeep) <= PRUint32(mLength), "illegal keep count");
if ((nsnull == aStream) || (PRUint32(aKeep) > PRUint32(mLength))) {
// whoops
*aErrorCode = NS_INPUTSTREAM_ILLEGAL_ARGS;
return -1;
}
if (0 != aKeep) {
// Slide over kept data
nsCRT::memmove(mBuffer, mBuffer + (mLength - aKeep), aKeep);
}
// Read in some new data
mLength = aKeep;
PRInt32 amount = mSpace - aKeep;
PRInt32 nb = aStream->Read(aErrorCode, mBuffer, aKeep, amount);
if (nb > 0) {
mLength += nb;
}
return nb;
}
NS_BASE nsresult NS_NewByteBuffer(nsIByteBuffer** aInstancePtrResult,
nsISupports* aOuter,
PRInt32 aBufferSize)
{
if (nsnull != aOuter) {
return NS_ERROR_NO_AGGREGATION;
}
ByteBufferImpl* it = new ByteBufferImpl(aBufferSize);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kByteBufferIID, (void **) aInstancePtrResult);
}

290
mozilla/base/src/nsCRT.cpp Normal file
View File

@@ -0,0 +1,290 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsCRT.h"
// XXX Bug: These tables don't lowercase the upper 128 characters properly
// This table maps uppercase characters to lower case characters;
// characters that are neither upper nor lower case are unaffected.
static const unsigned char kUpper2Lower[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64,
// upper band mapped to lower [A-Z] => [a-z]
97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,
91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
static const unsigned char kLower2Upper[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96,
// lower band mapped to upper [a-z] => [A-Z]
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
static const PRUnichar kIsoLatin1ToUCS2[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
//----------------------------------------------------------------------
#define TOLOWER(_ucs2) \
(((_ucs2) < 256) ? PRUnichar(kUpper2Lower[_ucs2]) : _ToLower(_ucs2))
#define TOUPPER(_ucs2) \
(((_ucs2) < 256) ? PRUnichar(kLower2Upper[_ucs2]) : _ToUpper(_ucs2))
static PRUnichar _ToLower(PRUnichar aChar)
{
// XXX need i18n code here
return aChar;
}
static PRUnichar _ToUpper(PRUnichar aChar)
{
// XXX need i18n code here
return aChar;
}
//----------------------------------------------------------------------
PRUnichar nsCRT::ToUpper(PRUnichar aChar)
{
return TOUPPER(aChar);
}
PRUnichar nsCRT::ToLower(PRUnichar aChar)
{
return TOLOWER(aChar);
}
PRInt32 nsCRT::strlen(const PRUnichar* s)
{
PRInt32 len = 0;
while (*s++ != 0) {
len++;
}
return len;
}
PRInt32 nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2)
{
for (;;) {
PRUnichar c1 = *s1++;
PRUnichar c2 = *s2++;
if (c1 != c2) {
if (c1 < c2) return -1;
return 1;
}
if (c1 == 0) break;
}
return 0;
}
// characters following a null character are not compared
PRInt32 nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n)
{
while (--n >= 0) {
PRUnichar c1 = *s1++;
PRUnichar c2 = *s2++;
if (c1 != c2) {
if (c1 < c2) return -1;
return 1;
}
if (c1 == 0) break;
}
return 0;
}
PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const PRUnichar* s2)
{
for (;;) {
PRUnichar c1 = *s1++;
PRUnichar c2 = *s2++;
if (c1 != c2) {
c1 = TOLOWER(c1);
c2 = TOLOWER(c2);
if (c1 != c2) {
if (c1 < c2) return -1;
return 1;
}
}
if (c1 == 0) break;
}
return 0;
}
PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n)
{
while (--n >= 0) {
PRUnichar c1 = *s1++;
PRUnichar c2 = *s2++;
if (c1 != c2) {
c1 = TOLOWER(c1);
c2 = TOLOWER(c2);
if (c1 != c2) {
if (c1 < c2) return -1;
return 1;
}
}
if (c1 == 0) break;
}
return 0;
}
PRInt32 nsCRT::strcmp(const PRUnichar* s1, const char* s2)
{
for (;;) {
PRUnichar c1 = *s1++;
PRUnichar c2 = kIsoLatin1ToUCS2[*(const unsigned char*)s2++];
if (c1 != c2) {
if (c1 < c2) return -1;
return 1;
}
if (c1 == 0) break;
}
return 0;
}
PRInt32 nsCRT::strncmp(const PRUnichar* s1, const char* s2, PRInt32 n)
{
while (--n >= 0) {
PRUnichar c1 = *s1++;
PRUnichar c2 = kIsoLatin1ToUCS2[*(const unsigned char*)s2++];
if (c1 != c2) {
if (c1 < c2) return -1;
return 1;
}
if (c1 == 0) break;
}
return 0;
}
PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const char* s2)
{
for (;;) {
PRUnichar c1 = *s1++;
PRUnichar c2 = kIsoLatin1ToUCS2[*(const unsigned char*)s2++];
if (c1 != c2) {
c1 = TOLOWER(c1);
c2 = TOLOWER(c2);
if (c1 != c2) {
if (c1 < c2) return -1;
return 1;
}
}
if (c1 == 0) break;
}
return 0;
}
PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const char* s2, PRInt32 n)
{
while (--n >= 0) {
PRUnichar c1 = *s1++;
PRUnichar c2 = kIsoLatin1ToUCS2[*(const unsigned char*)s2++];
if (c1 != c2) {
c1 = TOLOWER(c1);
c2 = TOLOWER(c2);
if (c1 != c2) {
if (c1 < c2) return -1;
return 1;
}
}
if (c1 == 0) break;
}
return 0;
}
PRInt32 nsCRT::HashCode(const PRUnichar* us)
{
PRInt32 rv = 0;
PRUnichar ch;
while ((ch = *us++) != 0) {
// FYI: rv = rv*37 + ch
rv = ((rv << 5) + (rv << 2) + rv) + ch;
}
return rv;
}
PRInt32 nsCRT::HashCode(const PRUnichar* us, PRInt32* uslenp)
{
PRInt32 rv = 0;
PRInt32 len = 0;
PRUnichar ch;
while ((ch = *us++) != 0) {
// FYI: rv = rv*37 + ch
rv = ((rv << 5) + (rv << 2) + rv) + ch;
len++;
}
*uslenp = len;
return rv;
}
PRInt32 nsCRT::atoi( const PRUnichar *string )
{
return atoi(string);
}

115
mozilla/base/src/nsCRT.h Normal file
View File

@@ -0,0 +1,115 @@
/* -*- Mode: C++; tab-width: 2; 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 nsCRT_h___
#define nsCRT_h___
#include <stdlib.h>
#include <string.h>
#include "plstr.h"
#include "nscore.h"
/// This is a wrapper class around all the C runtime functions.
class NS_BASE nsCRT {
public:
/** Copy bytes from aSrc to aDest.
@param aDest the destination address
@param aSrc the source address
@param aCount the number of bytes to copy
*/
static void memcpy(void* aDest, const void* aSrc, PRInt32 aCount) {
::memcpy(aDest, aSrc, (size_t)aCount);
}
static void memmove(void* aDest, const void* aSrc, PRInt32 aCount) {
::memmove(aDest, aSrc, (size_t)aCount);
}
static void memset(void* aDest, PRUint8 aByte, PRInt32 aCount) {
::memset(aDest, aByte, aCount);
}
static void zero(void* aDest, PRInt32 aCount) {
::memset(aDest, 0, (size_t)aCount);
}
/** Compute the string length of s
@param s the string in question
@return the length of s
*/
static PRInt32 strlen(const char* s) {
return PRInt32(::strlen(s));
}
/// Compare s1 and s2.
static PRInt32 strcmp(const char* s1, const char* s2) {
return PRInt32(PL_strcmp(s1, s2));
}
/// Case-insensitive string comparison.
static PRInt32 strcasecmp(const char* s1, const char* s2) {
return PRInt32(PL_strcasecmp(s1, s2));
}
/// Case-insensitive string comparison with length
static PRInt32 strncasecmp(const char* s1, const char* s2, PRInt32 aMaxLen) {
return PRInt32(PL_strncasecmp(s1, s2, aMaxLen));
}
/// Like strlen except for ucs2 strings
static PRInt32 strlen(const PRUnichar* s);
/// Like strcmp except for ucs2 strings
static PRInt32 strcmp(const PRUnichar* s1, const PRUnichar* s2);
/// Like strcmp except for ucs2 strings
static PRInt32 strncmp(const PRUnichar* s1, const PRUnichar* s2,
PRInt32 aMaxLen);
/// Like strcasecmp except for ucs2 strings
static PRInt32 strcasecmp(const PRUnichar* s1, const PRUnichar* s2);
/// Like strncasecmp except for ucs2 strings
static PRInt32 strncasecmp(const PRUnichar* s1, const PRUnichar* s2,
PRInt32 aMaxLen);
/// Like strcmp with a char* and a ucs2 string
static PRInt32 strcmp(const PRUnichar* s1, const char* s2);
/// Like strncmp with a char* and a ucs2 string
static PRInt32 strncmp(const PRUnichar* s1, const char* s2,
PRInt32 aMaxLen);
/// Like strcasecmp with a char* and a ucs2 string
static PRInt32 strcasecmp(const PRUnichar* s1, const char* s2);
/// Like strncasecmp with a char* and a ucs2 string
static PRInt32 strncasecmp(const PRUnichar* s1, const char* s2,
PRInt32 aMaxLen);
/// Compute a hashcode for a ucs2 string
static PRInt32 HashCode(const PRUnichar* s1);
/// Same as above except that we return the length in s1len
static PRInt32 HashCode(const PRUnichar* s1, PRInt32* s1len);
/// String to integer.
static PRInt32 atoi( const PRUnichar *string );
static PRUnichar ToUpper(PRUnichar aChar);
static PRUnichar ToLower(PRUnichar aChar);
};
#endif /* nsCRT_h___ */

View File

@@ -0,0 +1,432 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsDeque.h"
#include "nsCRT.h"
/**
* Standard constructor
* @update gess4/18/98
* @return new deque
*/
nsDeque::nsDeque(nsDequeFunctor& aMemDestroyer) : mMemDestroyer(aMemDestroyer) {
mMemDestroyer=aMemDestroyer;
mCapacity=eGrowthDelta;
mOrigin=mSize=0;
mData=new void*[mCapacity];
}
/**
* Destructor
* @update gess4/18/98
*/
nsDeque::~nsDeque() {
Erase();
delete [] mData;
mData=0;
}
/**
* Returns the number of elements currently stored in
* this deque.
*
* @update gess4/18/98
* @param
* @return int contains element count
*/
PRInt32 nsDeque::GetSize(void) const {
return mSize;
}
/**
* Remove all items from container without destroying them.
*
* @update gess4/18/98
* @param
* @return
*/
nsDeque& nsDeque::Empty() {
nsCRT::zero(mData,mCapacity*sizeof(mData));
mSize=0;
mOrigin=0;
return *this;
}
/**
* Remove and delete all items from container
*
* @update gess4/18/98
* @return this
*/
nsDeque& nsDeque::Erase() {
ForEach(mMemDestroyer);
return Empty();
}
/**
* This method adds an item to the end of the queue.
* This operation has the potential to cause the
* underlying buffer to resize.
*
* @update gess4/18/98
* @param anItem: new item to be added to queue
* @return nada
*/
nsDeque& nsDeque::Push(void* anItem) {
if(mSize==mCapacity) {
void** temp=new void*[mCapacity+eGrowthDelta];
//Here's the interesting part: You can't just move the elements
//directy (in situ) from the old buffer to the new one.
//Since capacity has changed, the old origin doesn't make
//sense anymore. It's better to resequence the elements now.
int tempi=0;
int i=0;
int j=0;
for(i=mOrigin;i<mCapacity;i++) temp[tempi++]=mData[i]; //copy the leading elements...
for(j=0;j<mOrigin;j++) temp[tempi++]=mData[j]; //copy the trailing elements...
mCapacity+=eGrowthDelta;
mOrigin=0; //now realign the origin...
delete[]mData;
mData=temp;
}
int offset=mOrigin+mSize;
if(offset<mCapacity)
mData[offset]=anItem;
else mData[offset-mCapacity]=anItem;
mSize++;
return *this;
}
/**
* This method gets called you want to remove and return
* the first member in the container.
*
* @update gess4/18/98
* @param nada
* @return last item in container
*/
void* nsDeque::Pop() {
void* result=0;
if(mSize>0) {
result=mData[mOrigin];
mData[mOrigin++]=0; //zero it out for debugging purposes.
mSize--;
if(0==mSize)
mOrigin=0;
}
return result;
}
/**
* Remove and return the last item in the container.
*
* @update gess4/18/98
* @param none
* @return ptr to last item in container
*/
void* nsDeque::PopBack(void) {
void* result=0;
if(mSize>0) {
int offset=mOrigin+mSize;
if(offset>=mCapacity)
offset-=mCapacity;
result=mData[offset-1];
mData[offset-1]=0;
mSize--;
if(0==mSize)
mOrigin=0;
}
return result;
}
/**
* Call this to retrieve the ith element from this container.
* Keep in mind that accessing the underlying elements is
* done in a relative fashion. Object 0 is not necessarily
* the first element (the first element is at mOrigin).
*
* @update gess4/18/98
* @param anIndex : 0 relative offset of item you want
* @return void* or null
*/
void* nsDeque::ObjectAt(PRInt32 anIndex) const {
void* result=0;
if((anIndex>=0) && (anIndex<mSize))
{
if(anIndex<(mSize-mOrigin)) {
result=mData[mOrigin+anIndex];
}
else {
result=mData[anIndex-(mSize-mOrigin)];
}
}
return result;
}
/**
* Create and return an iterator pointing to
* the beginning of the queue. Note that this
* takes the circular buffer semantics into account.
*
* @update gess4/18/98
* @return new deque iterator, init'ed to 1st item
*/
nsDequeIterator nsDeque::Begin(void) const{
return nsDequeIterator(*this,0);
}
/**
* Create and return an iterator pointing to
* the last of the queue. Note that this
* takes the circular buffer semantics into account.
*
* @update gess4/18/98
* @return new deque iterator, init'ed to last item
*/
nsDequeIterator nsDeque::End(void) const{
return nsDequeIterator(*this,mSize);
}
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const nsDeque& nsDeque::ForEach(nsDequeFunctor& aFunctor) const{
int i=0;
for(i=0;i<mSize;i++){
void* obj=ObjectAt(i);
aFunctor(obj);
}
return *this;
}
/******************************************************
* Here comes the nsDequeIterator class...
******************************************************/
/**
* DequeIterator is an object that knows how to iterate (forward and backward)
* a Deque. Normally, you don't need to do this, but there are some special
* cases where it is pretty handy, so here you go.
*
* This is a standard dequeiterator constructor
*
* @update gess4/18/98
* @param aQueue is the deque object to be iterated
* @param anIndex is the starting position for your iteration
*/
nsDequeIterator::nsDequeIterator(const nsDeque& aQueue,int anIndex): mDeque(aQueue) {
mIndex=anIndex;
}
/**
* Copy construct a new iterator beginning with given
*
* @update gess4/20/98
* @param aCopy is another iterator to copy from
* @return
*/
nsDequeIterator::nsDequeIterator(const nsDequeIterator& aCopy) :
mDeque(aCopy.mDeque),
mIndex(aCopy.mIndex) {
}
/**
* Standard assignment operator for dequeiterator
*
* @update gess4/18/98
* @param aCopy is an iterator to be copied from
* @return *this
*/
nsDequeIterator& nsDequeIterator::operator=(const nsDequeIterator& aCopy) {
//queue's are already equal.
mIndex=aCopy.mIndex;
return *this;
}
/**
* preform ! operation against to iterators to test for equivalence
* (or lack thereof)!
*
* @update gess4/18/98
* @param anIter is the object to be compared to
* @return TRUE if NOT equal.
*/
PRBool nsDequeIterator::operator!=(nsDequeIterator& anIter) {
return PRBool(!this->operator==(anIter));
}
/**
* Compare 2 iterators for equivalence.
*
* @update gess4/18/98
* @param anIter is the other iterator to be compared to
* @return TRUE if EQUAL
*/
PRBool nsDequeIterator::operator<(nsDequeIterator& anIter) {
return PRBool(((mIndex<anIter.mIndex) && (&mDeque==&anIter.mDeque)));
}
/**
* Compare 2 iterators for equivalence.
*
* @update gess4/18/98
* @param anIter is the other iterator to be compared to
* @return TRUE if EQUAL
*/
PRBool nsDequeIterator::operator==(nsDequeIterator& anIter) {
return PRBool(((mIndex==anIter.mIndex) && (&mDeque==&anIter.mDeque)));
}
/**
* Compare 2 iterators for equivalence.
*
* @update gess4/18/98
* @param anIter is the other iterator to be compared to
* @return TRUE if EQUAL
*/
PRBool nsDequeIterator::operator>=(nsDequeIterator& anIter) {
return PRBool(((mIndex>=anIter.mIndex) && (&mDeque==&anIter.mDeque)));
}
/**
* Pre-increment operator
*
* @update gess4/18/98
* @return object at preincremented index
*/
void* nsDequeIterator::operator++() {
return mDeque.ObjectAt(++mIndex);
}
/**
* Post-increment operator
*
* @update gess4/18/98
* @param param is ignored
* @return object at post-incremented index
*/
void* nsDequeIterator::operator++(int) {
return mDeque.ObjectAt(mIndex++);
}
/**
* Pre-decrement operator
*
* @update gess4/18/98
* @return object at pre-decremented index
*/
void* nsDequeIterator::operator--() {
return mDeque.ObjectAt(--mIndex);
}
/**
* Post-decrement operator
*
* @update gess4/18/98
* @param param is ignored
* @return object at post-decremented index
*/
void* nsDequeIterator::operator--(int) {
return mDeque.ObjectAt(mIndex--);
}
/**
* Dereference operator
*
* @update gess4/18/98
* @return object at ith index
*/
void* nsDequeIterator::GetCurrent(void) {
return mDeque.ObjectAt(mIndex);
}
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const nsDequeIterator& nsDequeIterator::ForEach(nsDequeFunctor& aFunctor) const{
mDeque.ForEach(aFunctor);
return *this;
}
/**
* conduct automated self test for this class
*
* @update gess4/18/98
* @param
* @return
*/
void nsDeque::SelfTest(void) {
#undef _SELFTEST_DEQUE
#ifdef _SELFTEST_DEQUE
#include <iostream.h>
{
nsDeque theDeque(PR_FALSE); //construct a simple one...
int ints[10]={100,200,300,400,500,600,700,800,900,1000};
int count=sizeof(ints)/sizeof(int);
int i=0;
for(i=0;i<count;i++){
theDeque.Push(&ints[i]);
}
int* temp1=(int*)theDeque.Pop(); //should have popped 100
int* temp2=(int*)theDeque.Pop(); //should have popped 200
theDeque.Push(temp1); //these should now become
theDeque.Push(temp2); //the last 2 items in deque.
nsDequeIterator iter1=theDeque.Begin();
nsDequeIterator iter2=theDeque.End();
while(iter1!=iter2) {
temp1=(int*)(iter1++);
cout << *temp1 << endl;
}
//now, afll thru and watch the deque dtor run...
cout << "done" << endl;
}
int x;
x=10;
#endif
}

357
mozilla/base/src/nsDeque.h Normal file
View File

@@ -0,0 +1,357 @@
/* -*- Mode: C++; tab-width: 2; 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.
*/
/**
* MODULE NOTES:
* @update gess 4/15/98 (tax day)
*
* The Deque is a very small, very efficient container object
* than can hold elements of type void*, offering the following features:
* It's interface supports pushing and poping of children.
* It can iterate (via an interator class) it's children.
* When full, it can efficently resize dynamically.
*
*
* NOTE: The only bit of trickery here is that this deque is
* built upon a ring-buffer. Like all ring buffers, the first
* element may not be at index[0]. The mOrigin member determines
* where the first child is. This point is quietly hidden from
* customers of this class.
*
*/
#ifndef _NSDEQUE
#define _NSDEQUE
#include "nscore.h"
/**
* The nsDequefunctor class is used when you want to create
* callbacks between the deque and your generic code.
* Use these objects in a call to ForEach();
*
* @update gess4/20/98
*/
class NS_BASE nsDequeFunctor{
public:
virtual void operator()(void* anObject)=0;
};
/******************************************************
* Here comes the nsDeque class itself...
******************************************************/
/**
* The deque (double-ended queue) class is a common container type,
* whose behavior mimics a line in your favorite checkout stand.
* Classic CS describes the common behavior of a queue as FIFO.
* A Deque allows items to be added and removed from either end of
* the queue.
*
* @update gess4/20/98
*/
class NS_BASE nsDeque {
friend class nsDequeIterator;
public:
nsDeque(nsDequeFunctor& aMemDestroyer);
~nsDeque();
/**
* Returns the number of elements currently stored in
* this deque.
*
* @update gess4/18/98
* @param
* @return int contains element count
*/
PRInt32 GetSize() const;
/**
* Pushes new member onto the end of the deque
*
* @update gess4/18/98
* @param ptr to object to store
* @return *this
*/
nsDeque& Push(void* anItem);
/**
* Remove and return the first item in the container.
*
* @update gess4/18/98
* @param none
* @return ptr to first item in container
*/
void* Pop(void);
/**
* Remove and return the last item in the container.
*
* @update gess4/18/98
* @param none
* @return ptr to first item in container
*/
void* PopBack(void);
/**
* Remove all items from container without destroying them
*
* @update gess4/18/98
* @param
* @return
*/
nsDeque& Empty();
/**
* Remove and delete all items from container
*
* @update gess4/18/98
* @param
* @return
*/
nsDeque& Erase();
/**
* Creates a new iterator, init'ed to start of container
*
* @update gess4/18/98
* @return new dequeIterator
*/
nsDequeIterator Begin() const;
/**
* Creates a new iterator, init'ed to end of container
*
* @update gess4/18/98
* @return new dequeIterator
*/
nsDequeIterator End() const;
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const nsDeque& ForEach(nsDequeFunctor& aFunctor) const;
/**
* Perform automated selftest on the deque
*
* @update gess4/18/98
* @param
* @return
*/
static void SelfTest();
protected:
PRInt32 mSize;
PRInt32 mCapacity;
PRInt32 mOrigin;
nsDequeFunctor& mMemDestroyer;
void** mData;
private:
enum {eGrowthDelta=64};
/**
* Simple default constructor (PRIVATE)
*
* @update gess4/18/98
* @param
* @return
*/
nsDeque();
/**
* Copy constructor (PRIVATE)
*
* @update gess4/18/98
* @param
* @return
*/
nsDeque(const nsDeque& other);
/**
* Deque assignment operator (PRIVATE)
*
* @update gess4/18/98
* @param another deque
* @return *this
*/
nsDeque& operator=(const nsDeque& anOther);
/**
* PRIVATE method used to retrieve ptr to
* ith member in container. DOesn't remove
* that item.
*
* @update gess4/18/98
* @param index of desired item
* @return ptr to ith element in list
*/
void* ObjectAt(int anIndex) const;
};
/******************************************************
* Here comes the nsDequeIterator class...
******************************************************/
class NS_BASE nsDequeIterator {
public:
/**
* DequeIterator is an object that knows how to iterate (forward and backward)
* a Deque. Normally, you don't need to do this, but there are some special
* cases where it is pretty handy, so here you go.
*
* @update gess4/18/98
* @param aQueue is the deque object to be iterated
* @param anIndex is the starting position for your iteration
*/
nsDequeIterator(const nsDeque& aQueue,int anIndex=0);
/**
* DequeIterator is an object that knows how to iterate (forward and backward)
* a Deque. Normally, you don't need to do this, but there are some special
* cases where it is pretty handy, so here you go.
*
* @update gess4/18/98
* @param aQueue is the deque object to be iterated
* @param anIndex is the starting position for your iteration
*/
nsDequeIterator(const nsDequeIterator& aCopy);
/**
* Standard assignment operator for deque
* @update gess4/18/98
* @param
* @return
*/
nsDequeIterator& operator=(const nsDequeIterator& aCopy);
/**
* preform ! operation against to iterators to test for equivalence
* (or lack thereof)!
*
* @update gess4/18/98
* @param anIter is the object to be compared to
* @return TRUE if NOT equal.
*/
PRBool operator!=(nsDequeIterator& anIter);
/**
* Compare 2 iterators for equivalence.
*
* @update gess4/18/98
* @param anIter is the other iterator to be compared to
* @return TRUE if EQUAL
*/
PRBool operator<(nsDequeIterator& anIter);
/**
* Compare 2 iterators for equivalence.
*
* @update gess4/18/98
* @param anIter is the other iterator to be compared to
* @return TRUE if EQUAL
*/
PRBool operator==(nsDequeIterator& anIter);
/**
* Compare 2 iterators for equivalence.
*
* @update gess4/18/98
* @param anIter is the other iterator to be compared to
* @return TRUE if EQUAL
*/
PRBool operator>=(nsDequeIterator& anIter);
/**
* Pre-increment operator
*
* @update gess4/18/98
* @return object at preincremented index
*/
void* operator++();
/**
* Post-increment operator
*
* @update gess4/18/98
* @param param is ignored
* @return object at post-incremented index
*/
void* operator++(int);
/**
* Pre-decrement operator
*
* @update gess4/18/98
* @return object at pre-decremented index
*/
void* operator--();
/**
* Post-decrement operator
*
* @update gess4/18/98
* @param param is ignored
* @return object at post-decremented index
*/
void* operator--(int);
/**
* Retrieve the ptr to the iterators notion of current node
*
* @update gess4/18/98
* @return object at ith index
*/
void* GetCurrent(void);
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const nsDequeIterator& ForEach(nsDequeFunctor& aFunctor) const;
protected:
PRInt32 mIndex;
const nsDeque& mDeque;
};
#endif

View File

@@ -0,0 +1,51 @@
/* -*- Mode: C++; tab-width: 2; 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 nsIArena_h___
#define nsIArena_h___
#include "nscore.h"
#include "nsISupports.h"
#define NS_MIN_ARENA_BLOCK_SIZE 64
#define NS_DEFAULT_ARENA_BLOCK_SIZE 4096
/// Interface IID for nsIArena
#define NS_IARENA_IID \
{ 0xa24fdad0, 0x93b4, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
/** Interface to a memory arena abstraction. Arena's use large blocks
* of memory to allocate smaller objects. Arena's provide no free
* operator; instead, all of the objects in the arena are deallocated
* by deallocating the arena (e.g. when it's reference count goes to
* zero)
*/
class nsIArena : public nsISupports {
public:
virtual void* Alloc(PRInt32 size) = 0;
};
/**
* Create a new arena using the desired block size for allocating the
* underlying memory blocks. The underlying memory blocks are allocated
* using the PR heap.
*/
extern NS_BASE nsresult NS_NewHeapArena(nsIArena** aInstancePtrResult,
PRInt32 aArenaBlockSize = 0);
#endif /* nsIArena_h___ */

View File

@@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; 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 nsIAtom_h___
#define nsIAtom_h___
#include "nscore.h"
#include "nsISupports.h"
class nsString;
class nsISizeOfHandler;
#define NS_IATOM_IID \
{ 0x3d1b15b0, 0x93b4, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
/**
* A globally unique identfier. nsIAtom's can be compared for
* equality by using operator '=='. These objects are reference
* counted like other nsISupports objects. When you are done with
* the atom, NS_RELEASE it.
*/
class nsIAtom : public nsISupports {
public:
/**
* Translate the unicode string into the stringbuf.
*/
virtual void ToString(nsString& aString) const = 0;
/**
* Return a pointer to a zero terminated unicode string.
*/
virtual const PRUnichar* GetUnicode() const = 0;
/**
* Add the size, in bytes, of the atom to the handler.
*/
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const = 0;
};
/**
* Find an atom that matches the given iso-latin1 C string. The
* C string is translated into it's unicode equivalent.
*/
extern NS_BASE nsIAtom* NS_NewAtom(const char* isolatin1);
/**
* Find an atom that matches the given unicode string. The string is assumed
* to be zero terminated.
*/
extern NS_BASE nsIAtom* NS_NewAtom(const PRUnichar* unicode);
/**
* Find an atom that matches the given string.
*/
extern NS_BASE nsIAtom* NS_NewAtom(const nsString& aString);
/**
* Return a count of the total number of atoms currently
* alive in the system.
*/
extern NS_BASE nsrefcnt NS_GetNumberOfAtoms(void);
#endif /* nsIAtom_h___ */

View File

@@ -0,0 +1,42 @@
/* -*- Mode: C++; tab-width: 2; 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 nsIBaseStream_h___
#define nsIBaseStream_h___
#include "nscore.h"
#include "nsISupports.h"
/* 6ccb17a0-e95e-11d1-beae-00805f8a66dc */
#define NS_IBASESTREAM_IID \
{ 0x6ccb17a0, 0xe95e, 0x11d1, \
{0xbe, 0xae, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} }
/** Abstract stream */
class nsIBaseStream : public nsISupports {
public:
/** Return the number of bytes in the stream */
virtual PRInt32 GetLength() = 0;
/** Close the stream. */
virtual void Close() = 0;
};
#endif /* nsInputStream_h___ */

View File

@@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 2; 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 nsIByteBuffer_h___
#define nsIByteBuffer_h___
#include "nscore.h"
#include "nsISupports.h"
class nsIInputStream;
#define NS_IBYTE_BUFFER_IID \
{ 0xe4a6e4b0, 0x93b4, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
/** Interface to a buffer that holds bytes */
class nsIByteBuffer : public nsISupports {
public:
/** @return length of buffer, i.e. how many bytes are currently in it. */
virtual PRInt32 GetLength() const = 0;
/** @return number of bytes allocated in the buffer */
virtual PRInt32 GetBufferSize() const = 0;
/** @return the buffer */
virtual char* GetBuffer() const = 0;
/** Grow buffer to aNewSize bytes. */
virtual PRBool Grow(PRInt32 aNewSize) = 0;
/** Fill the buffer with data from aStream. Don't grow the buffer, only
* read until length of buffer equals buffer size. */
virtual PRInt32 Fill(PRInt32* aErrorCode, nsIInputStream* aStream,
PRInt32 aKeep) = 0;
};
/** Create a new byte buffer using the given buffer size. */
extern NS_BASE nsresult NS_NewByteBuffer(nsIByteBuffer** aInstancePtrResult,
nsISupports* aOuter,
PRInt32 aBufferSize = 0);
#endif /* nsIByteBuffer_h___ */

View File

@@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 2; 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 nsIInputStream_h___
#define nsIInputStream_h___
#include "nsIBaseStream.h"
#define NS_IINPUTSTREAM_IID \
{ 0x022396f0, 0x93b5, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
/** Abstract byte input stream */
class nsIInputStream : public nsIBaseStream {
public:
/** Read data from the stream.
* @param aErrorCode the error code if an error occurs
* @param aBuf the buffer into which the data is read
* @param aOffset the start offset of the data
* @param aCount the maximum number of bytes to read
* @return number of bytes read or -1 if error
*/
virtual PRInt32 Read(PRInt32* aErrorCode,
char* aBuf,
PRInt32 aOffset,
PRInt32 aCount) = 0;
};
/** Error codes */
//@{
// XXX fix up the values to work with nsqresult
/// End of file
#define NS_INPUTSTREAM_EOF 1
/// Stream closed
#define NS_INPUTSTREAM_CLOSED 2
/// Error from the operating system
#define NS_INPUTSTREAM_OSERROR 3
/// Illegal arguments
#define NS_INPUTSTREAM_ILLEGAL_ARGS 4
/// For unichar streams
#define NS_INPUTSTREAM_NO_CONVERTER 5
/// For unichar streams
#define NS_INPUTSTREAM_BAD_CONVERSION 6
//@}
#endif /* nsInputStream_h___ */

View File

@@ -0,0 +1,45 @@
/* -*- Mode: C++; tab-width: 2; 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 nsIOutputStream_h___
#define nsIOutputStream_h___
#include "nsIBaseStream.h"
/* 7f13b870-e95f-11d1-beae-00805f8a66dc */
#define NS_IOUTPUTSTREAM_IID \
{ 0x7f13b870, 0xe95f, 0x11d1, \
{0xbe, 0xae, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} }
/** Abstract byte input stream */
class nsIOutputStream : public nsIBaseStream {
public:
/** Write data into the stream.
* @param aErrorCode the error code if an error occurs
* @param aBuf the buffer into which the data is read
* @param aOffset the start offset of the data
* @param aCount the maximum number of bytes to read
* @return number of bytes read or -1 if error
*/
virtual PRInt32 Write(PRInt32* aErrorCode,
const char* aBuf,
PRInt32 aOffset,
PRInt32 aCount) = 0;
};
#endif /* nsOutputStream_h___ */

View File

@@ -0,0 +1,86 @@
/* -*- Mode: C++; tab-width: 2; 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 nsITimer_h___
#define nsITimer_h___
#include "nscore.h"
#include "nsISupports.h"
class nsITimer;
class nsITimerCallback;
/// Signature of timer callback function
typedef void
(*nsTimerCallbackFunc) (nsITimer *aTimer, void *aClosure);
/// Interface IID for nsITimer
#define NS_ITIMER_IID \
{ 0x497eed20, 0xb740, 0x11d1, \
{ 0x9b, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }
/**
* Timer class, used to invoke a function or method after a fixed
* millisecond interval. <B>Note that this interface is subject to
* change!</B>
*/
class nsITimer : public nsISupports {
public:
/**
* Initialize a timer to fire after the given millisecond interval.
* This version takes a function to call and a closure to pass to
* that function.
*
* @param aFunc - The function to invoke
* @param aClosure - an opaque pointer to pass to that function
* @param aRepeat - (Not yet implemented) One-shot or repeating
* @param aDelay - The millisecond interval
* @result - NS_OK if this operation was successful
*/
virtual nsresult Init(nsTimerCallbackFunc aFunc,
void *aClosure,
// PRBool aRepeat,
PRUint32 aDelay)=0;
/**
* Initialize a timer to fire after the given millisecond interval.
* This version takes an interface of type <code>nsITimerCallback</code>.
* The <code>Notify</code> method of this method is invoked.
*
* @param aCallback - The interface to notify
* @param aRepeat - (Not yet implemented) One-shot or repeating
* @param aDelay - The millisecond interval
* @result - NS_OK if this operation was successful
*/
virtual nsresult Init(nsITimerCallback *aCallback,
// PRBool aRepeat,
PRUint32 aDelay)=0;
/// Cancels the timeout
virtual void Cancel()=0;
/// @return the millisecond delay of the timeout
virtual PRUint32 GetDelay()=0;
/// Change the millisecond interval for the timeout
virtual void SetDelay(PRUint32 aDelay)=0;
};
/** Factory method for creating an nsITimer */
extern NS_BASE nsresult NS_NewTimer(nsITimer** aInstancePtrResult);
#endif

View File

@@ -0,0 +1,41 @@
/* -*- Mode: C++; tab-width: 2; 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 nsITimerCallback_h___
#define nsITimerCallback_h___
#include "nscore.h"
#include "nsISupports.h"
class nsITimer;
/// Interface IID for nsITimerCallback
#define NS_ITIMERCALLBACK_IID \
{ 0x5079b3a0, 0xb743, 0x11d1, \
{ 0x9b, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }
/**
* Interface implemented by users of the nsITimer class. An instance
* of this interface is passed in when creating a timer. The Notify()
* method of that instance is invoked after the specified delay.
*/
class nsITimerCallback : public nsISupports {
public:
virtual void Notify(nsITimer *timer)=0;
};
#endif

View File

@@ -0,0 +1,46 @@
/* -*- Mode: C++; tab-width: 2; 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 nsIUnicharBuffer_h___
#define nsIUnicharBuffer_h___
#include "nscore.h"
#include "nsISupports.h"
class nsIUnicharInputStream;
#define NS_IUNICHAR_BUFFER_IID \
{ 0x14cf6970, 0x93b5, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
/// Interface to a buffer that holds unicode characters
class nsIUnicharBuffer : public nsISupports {
public:
virtual PRInt32 GetLength() const = 0;
virtual PRInt32 GetBufferSize() const = 0;
virtual PRUnichar* GetBuffer() const = 0;
virtual PRBool Grow(PRInt32 aNewSize) = 0;
virtual PRInt32 Fill(PRInt32* aErrorCode, nsIUnicharInputStream* aStream,
PRInt32 aKeep) = 0;
};
/// Factory method for nsIUnicharBuffer.
extern NS_BASE nsresult
NS_NewUnicharBuffer(nsIUnicharBuffer** aInstancePtrResult,
nsISupports* aOuter,
PRInt32 aBufferSize = 0);
#endif /* nsIUnicharBuffer_h___ */

View File

@@ -0,0 +1,98 @@
/* -*- Mode: C++; tab-width: 2; 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 nsIUnicharInputStream_h___
#define nsIUnicharInputStream_h___
#include "nsIInputStream.h"
class nsString;
#define NS_IUNICHAR_INPUT_STREAM_IID \
{ 0x2d97fbf0, 0x93b5, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
#define NS_IB2UCONVERTER_IID \
{ 0x35e40290, 0x93b5, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
/// Enumeration of character set ids.
enum nsCharSetID {
eCharSetID_IsoLatin1 = 0,
eCharSetID_UTF8,
eCharSetID_ShiftJis
// XXX more i'm sure...
};
/** Abstract unicode character input stream
* @see nsIInputStream
*/
class nsIUnicharInputStream : public nsISupports {
public:
virtual PRInt32 Read(PRInt32* aErrorCode,
PRUnichar* aBuf,
PRInt32 aOffset,
PRInt32 aCount) = 0;
virtual void Close() = 0;
};
/**
* Create a nsIUnicharInputStream that wraps up a string. Data is fed
* from the string out until the done. When this object is destroyed
* it destroyes the string (so make a copy if you don't want it doing
* that)
*/
extern NS_BASE nsresult
NS_NewStringUnicharInputStream(nsIUnicharInputStream** aInstancePtrResult,
nsString* aString);
/// Abstract interface for converting from bytes to unicode characters
class nsIB2UConverter : public nsISupports {
public:
/** aDstLen is updated to indicate how much data was translated into
* aDst; aSrcLen is updated to indicate how much data was used in
* the source buffer.
*/
virtual PRInt32 Convert(PRUnichar* aDst,
PRInt32 aDstOffset,
PRInt32& aDstLen,
const char* aSrc,
PRInt32 aSrcOffset,
PRInt32& aSrcLen) = 0;
};
/** Create a new nsUnicharInputStream that provides a converter for the
* byte input stream aStreamToWrap. If no converter can be found then
* nsnull is returned and the error code is set to
* NS_INPUTSTREAM_NO_CONVERTER.
*/
extern NS_BASE nsresult
NS_NewConverterStream(nsIUnicharInputStream** aInstancePtrResult,
nsISupports* aOuter,
nsIInputStream* aStreamToWrap,
PRInt32 aBufferSize = 0,
nsCharSetID aCharSet = eCharSetID_IsoLatin1);
/** Create a new nsB2UConverter for the given character set. When given
* nsnull, the converter for iso-latin1 to unicode is provided. If no
* converter can be found, nsnull is returned.
*/
extern NS_BASE nsresult
NS_NewB2UConverter(nsIB2UConverter** aInstancePtrResult,
nsISupports* aOuter,
nsCharSetID aCharSet = eCharSetID_IsoLatin1);
#endif /* nsUnicharInputStream_h___ */

View File

@@ -0,0 +1,423 @@
/**
* This file defines the binary tree class and it
* nsNode child class.
*
* This simple version stores nodes, and the
* nodes store void* ptrs.
*
* @update gess 4/11/98
* @param
* @return
*/
#include "nsRBTree.h"
/**************************************************
Here comes the nsRBTree class...
*************************************************/
/**
* nsRBTree constructor
*
* @update gess 4/11/98
*/
nsRBTree::nsRBTree() : nsBTree() {
mRoot=0;
}
/**
* nsRBTree constructor
*
* @update gess 4/11/98
*/
nsRBTree::nsRBTree(const nsRBTree& aCopy) : nsBTree(aCopy) {
mRoot=aCopy.mRoot;
}
/**
* nsRBTree destructor
*
* @update gess 4/11/98
* @param
* @return
*/
nsRBTree::~nsRBTree(){
if(mRoot){
//walk the tree and destroy the children.
}
}
/**
* Given a node, we're supposed to add it into
* our tree.
*
* @update gess 4/11/98
* @param
* @return
*/
nsNode* nsRBTree::Add(nsNode& aNode){
nsBTree::Add(aNode);
nsNode* node1=&aNode;
nsNode* node2=0;
node1->mColor=nsNode::eRed;
while((node1!=mRoot) && (node1->mParent->mColor==nsNode::eRed)) {
if(node1->mParent==node1->mParent->mParent->mLeft) {
node2=node1->mParent->mParent->mLeft;
if(node2->mColor==nsNode::eRed) {
node1->mParent->mColor=nsNode::eBlack;
node2->mColor=nsNode::eBlack;
node1->mParent->mParent->mColor=nsNode::eRed;
node1=node1->mParent->mParent;
}
else {
if(node1==node1->mParent->mRight) {
node1=node1->mParent;
ShiftLeft(*node1);
}
node1->mParent->mColor=nsNode::eBlack;
node1->mParent->mParent->mColor=nsNode::eRed;
ShiftRight(*node1->mParent->mParent);
}
}
else {
node2=node1->mParent->mParent->mRight;
if (node2->mColor==nsNode::eRed){
node1->mParent->mColor=nsNode::eBlack;
node2->mColor=nsNode::eBlack;
node1->mParent->mParent->mColor=nsNode::eRed;
node1=node1->mParent->mParent;
}
else {
if (node1==node1->mParent->mLeft) {
node1=node1->mParent;
ShiftRight(*node1);
}
node1->mParent->mColor=nsNode::eBlack;
node1->mParent->mParent->mColor=nsNode::eRed;
ShiftLeft(*node1->mParent->mParent);
}
}
}
mRoot->mColor=nsNode::eBlack;
return &aNode;
}
/**
* Retrive the first node in the tree
*
* @update gess 4/11/98
* @param
* @return
*/
nsNode* nsRBTree::First(){
nsNode* result=First(*mRoot);
return result;
}
/**
* Retrieve the first node given a starting node
*
* @update gess 4/11/98
* @param aNode --
* @return node ptr or null
*/
nsNode* nsRBTree::First(nsNode& aNode){
nsNode* result=0;
if(mRoot) {
result=mRoot;
while(result->GetLeftNode()) {
result=result->GetLeftNode();
}
}
return result;
}
/**
* Find the last node in the tree
*
* @update gess 4/11/98
* @param
* @return node ptr or null
*/
nsNode* nsRBTree::Last(){
nsNode* result=Last(*mRoot);
return result;
}
/**
* Find the last node from a given node
*
* @update gess 4/11/98
* @param aNode -- node ptr to start from
* @return node ptr or null
*/
nsNode* nsRBTree::Last(nsNode& aNode){
nsNode* result=0;
if(mRoot) {
result=mRoot;
while(result->GetRightNode()) {
result=result->GetRightNode();
}
}
return result;
}
/**
* Retrieve the node that preceeds the given node
*
* @update gess 4/11/98
* @param aNode -- node to find precedent of
* @return preceeding node ptr, or null
*/
nsNode* nsRBTree::Before(nsNode& aNode){
if(aNode.GetLeftNode())
return Last(*aNode.GetLeftNode());
//otherwise...
nsNode* node1=&aNode;
nsNode* node2=aNode.GetParentNode();
while((node2) && (node1==node2->GetLeftNode())) {
node1=node2;
node2=node2->GetParentNode();
}
return node2;
}
/**
* Retrieve a ptr to the node following the given node
*
* @update gess 4/11/98
* @param aNode -- node to find successor node from
* @return node ptr or null
*/
nsNode* nsRBTree::After(nsNode& aNode){
if(aNode.GetRightNode())
return First(*aNode.GetRightNode());
//otherwise...
nsNode* node1=&aNode;
nsNode* node2=aNode.GetParentNode();
while((node2) && (node1==node2->GetRightNode())) {
node1=node2;
node2=node2->GetParentNode();
}
return node2;
}
/**
* Find a (given) node in the tree
*
* @update gess 4/11/98
* @param node to find in the tree
* @return node ptr (if found) or null
*/
nsNode* nsRBTree::Find(nsNode& aNode){
nsNode* result=mRoot;
while((result) && (!((*result)==aNode))) {
if(aNode<*result)
result=result->mLeft;
else result=result->mRight;
}
return result;
}
/**
* Causes a shift to the left, to keep the
* underlying RB data in balance
*
* @update gess 4/11/98
* @param
* @return this
*/
nsRBTree& nsRBTree::ShiftLeft(nsNode& aNode){
nsNode* temp= aNode.mRight;
aNode.mRight=temp->mLeft;
if(temp->mLeft)
temp->mRight->mParent=&aNode;
temp->mParent= aNode.mParent;
if (aNode.mParent) {
if (&aNode==aNode.mParent->mLeft)
aNode.mParent->mLeft=temp;
else aNode.mParent->mRight=temp;
}
else mRoot=temp;
temp->mLeft=&aNode;;
aNode.mParent=temp;
return *this;
}
/**
* Causes a shift right to occur, to keep the
* underlying RB data in balance
*
* @update gess 4/11/98
* @param aNode -- node at which to perform shift
* @return this
*/
nsRBTree& nsRBTree::ShiftRight(nsNode& aNode){
nsNode* temp=aNode.mLeft;
aNode.mLeft=temp->mRight;
if(temp->mRight)
temp->mRight->mParent=&aNode;
temp->mParent=aNode.mParent;
if(aNode.mParent){
if(&aNode==aNode.mParent->mRight)
aNode.mParent->mRight=temp;
else aNode.mParent->mLeft=temp;
}
else mRoot=temp;
temp->mRight=&aNode;
aNode.mParent=temp;
return *this;
}
/**
* Rebalances tree around the given node. This only
* needs to be called after a node is deleted.
*
* @update gess 4/11/98
* @param aNode -- node to balance around
* @return this
*/
nsBTree& nsRBTree::ReBalance(nsNode& aNode){
nsNode* node1=&aNode;
nsNode* node2=0;
while ((node1!=mRoot) && (node1->mColor==nsNode::eBlack)) {
if(node1==node1->mParent->mLeft) {
node2=node1->mParent->mRight;
if(node2->mColor==nsNode::eRed) {
node2->mColor=nsNode::eBlack;
node1->mParent->mColor=nsNode::eRed;
ShiftLeft(*node1->mParent);
node2=node1->mParent->mRight;
}
if((node2->mLeft->mColor == nsNode::eBlack) &&
(node2->mRight->mColor == nsNode::eBlack)) {
node2->mColor=nsNode::eRed;
node1=node1->mParent;
}
else {
if(node2->mRight->mColor == nsNode::eBlack) {
node2->mLeft->mColor=nsNode::eBlack;
node2->mColor=nsNode::eRed;
ShiftRight(*node2);
node2=node1->mParent->mRight;
}
node2->mColor=node1->mParent->mColor;
node1->mParent->mColor=nsNode::eBlack;
node2->mRight->mColor=nsNode::eBlack;
ShiftLeft(*node1->mParent);
node1=mRoot;
} //else
}
else {
node2=node1->mParent->mLeft;
if(node2->mColor==nsNode::eRed) {
node2->mColor=nsNode::eBlack;
node1->mParent->mColor=nsNode::eRed;
ShiftRight(*node1->mParent);
node2=node1->mParent->mLeft;
}
if((node2->mRight->mColor == nsNode::eBlack) &&
(node2->mLeft->mColor == nsNode::eBlack)) {
node2->mColor=nsNode::eRed;
node1=node1->mParent;
}
else {
if(node2->mLeft->mColor == nsNode::eBlack){
node2->mRight->mColor=nsNode::eBlack;
node2->mColor=nsNode::eRed;
ShiftLeft(*node2);
node2=node1->mParent->mLeft;
}
node2->mColor=node1->mParent->mColor;
node1->mParent->mColor=nsNode::eBlack;
node2->mLeft->mColor=nsNode::eBlack;
ShiftRight(*node1->mParent);
node1=mRoot;
} //else
} //if
} //while
node1->mColor=nsNode::eBlack;
return *this;
}
/**************************************************
Here comes the nsRBTreeIterator class...
*************************************************/
/**
*
*
* @update gess 4/11/98
* @param
* @return
*/
nsRBTreeIterator::nsRBTreeIterator(const nsRBTree& aTree) : mTree(aTree) {
}
/**
* copy constructor
*
* @update gess 4/11/98
* @param aCopy is the object you want to copy from
* @return newly constructed object
*/
nsRBTreeIterator::nsRBTreeIterator(const nsRBTreeIterator& aCopy) : mTree(aCopy.mTree) {
}
/**
* Destructor method
*
* @update gess 4/11/98
*/
nsRBTreeIterator::~nsRBTreeIterator(){
}
/**
* This method iterates over the tree, calling
* aFunctor for each node.
*
* @update gess 4/11/98
* @param aFunctor -- object to call for each node
* @param aNode -- node at which to start iteration
* @return this
*/
const nsRBTreeIterator& nsRBTreeIterator::ForEach(nsNodeFunctor& aFunctor) const{
mTree.ForEach(aFunctor);
return *this;
}

223
mozilla/base/src/nsRBTree.h Normal file
View File

@@ -0,0 +1,223 @@
/**
* This file defines the binary tree class and its
* nsNode child class.
*
* This simple version stores nodes, and the
* nodes store void* ptrs.
*
* @update gess 4/11/98
* @param
* @return
*/
/**
* MODULE NOTES
* @update gess 4/11/98
*
* This file declares the nsRBTree (red/black tree).
* Red/black trees are auto-balancing binary trees.
*
* To use this class, define a subclass of nsNode
* which stores your data type. It's important that
* you overload the following methods:
*
* virtual PRBool operator<()
* virtual PRBool operator==()
*
*/
#ifndef _nsRBTree
#define _nsRBTree
#include "nsBTree.h"
/**
* Here comes the main event: our nsRBTree (red/black tree).
* Red/Black trees are autobalancing binary trees.
*
* @update gess4/20/98
*/
class NS_BASE nsRBTree : public nsBTree {
public:
friend class NS_BASE nsRBTreeIterator;
/**
* nsRBTree constructor
*
* @update gess 4/11/98
*/
nsRBTree();
/**
* nsRBTree constructor
*
* @update gess 4/11/98
*/
nsRBTree(const nsRBTree& aCopy);
/**
* nsRBTree destructor
*
* @update gess 4/11/98
*/
~nsRBTree();
/**
* Given a node, we're supposed to add it into
* our tree.
*
* @update gess 4/11/98
* @param
* @return
*/
nsNode* Add(nsNode& aNode);
/**
* Retrive the first node in the tree
*
* @update gess 4/11/98
* @param
* @return
*/
nsNode* First(void);
/**
* Retrieve the first node given a starting node
*
* @update gess 4/11/98
* @param aNode --
* @return node ptr or null
*/
nsNode* First(nsNode& aNode);
/**
* Find the last node in the tree
*
* @update gess 4/11/98
* @param
* @return node ptr or null
*/
nsNode* Last(void);
/**
* Find the last node from a given node
*
* @update gess 4/11/98
* @param aNode -- node ptr to start from
* @return node ptr or null
*/
nsNode* Last(nsNode& aNode);
/**
* Retrieve the node that preceeds the given node
*
* @update gess 4/11/98
* @param aNode -- node to find precedent of
* @return preceeding node ptr, or null
*/
nsNode* Before(nsNode& aNode);
/**
* Retrieve a ptr to the node following the given node
*
* @update gess 4/11/98
* @param aNode -- node to find successor node from
* @return node ptr or null
*/
nsNode* After(nsNode& aNode);
/**
* Find a (given) node in the tree
*
* @update gess 4/11/98
* @param node to find in the tree
* @return node ptr (if found) or null
*/
nsNode* Find(nsNode& aNode);
private:
/**
* Causes a shift to the left, to keep the
* underlying RB data in balance
*
* @update gess 4/11/98
* @param
* @return this
*/
nsRBTree& ShiftLeft(nsNode& aNode);
/**
* Causes a shift right to occur, to keep the
* underlying RB data in balance
*
* @update gess 4/11/98
* @param aNode -- node at which to perform shift
* @return this
*/
nsRBTree& ShiftRight(nsNode& aNode);
/**
* Rebalances tree around the given node. This only
* needs to be called after a node is deleted.
*
* @update gess 4/11/98
* @param aNode -- node to balance around
* @return this
*/
virtual nsBTree& ReBalance(nsNode& aNode);
};
class NS_BASE nsRBTreeIterator {
public:
/**
* TreeIterator constructor
*
* @update gess 4/11/98
* @param
* @return
*/
nsRBTreeIterator(const nsRBTree& aTree);
/**
* TreeIterator constructor
*
* @update gess 4/11/98
* @param
* @return
*/
nsRBTreeIterator(const nsRBTreeIterator& aCopy);
/**
* tree iterator destructor
*
* @update gess 4/11/98
* @param
* @return
*/
~nsRBTreeIterator();
/**
* This method iterates over the tree, calling
* aFunctor for each node.
*
* @update gess 4/11/98
* @param aFunctor -- object to call for each node
* @param aNode -- node at which to start iteration
* @return this
*/
const nsRBTreeIterator& ForEach(nsNodeFunctor& aFunctor) const;
protected:
const nsRBTree& mTree;
};
#endif

View File

@@ -0,0 +1,121 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsISizeOfHandler.h"
#include "plhash.h"
static NS_DEFINE_IID(kISizeOfHandlerIID, NS_ISIZEOF_HANDLER_IID);
class nsSizeOfHandler : public nsISizeOfHandler {
public:
nsSizeOfHandler();
~nsSizeOfHandler();
// nsISupports
NS_DECL_ISUPPORTS
// nsISizeOfHandler
NS_IMETHOD Add(size_t aSize);
virtual PRBool HaveSeen(void* anObject);
NS_IMETHOD GetSize(PRUint32& aResult);
protected:
PRUint32 mTotalSize;
PLHashTable* mTable;
};
static PLHashNumber
HashKey(void* key)
{
return (PLHashNumber) key;
}
static PRIntn
CompareKeys(void* key1, void* key2)
{
return key1 == key2;
}
nsSizeOfHandler::nsSizeOfHandler()
{
NS_INIT_REFCNT();
mTotalSize = 0;
mTable = PL_NewHashTable(8, (PLHashFunction) HashKey,
(PLHashComparator) CompareKeys,
(PLHashComparator) nsnull,
nsnull, nsnull);
}
nsSizeOfHandler::~nsSizeOfHandler()
{
if (nsnull != mTable) {
PL_HashTableDestroy(mTable);
}
}
NS_IMPL_ISUPPORTS(nsSizeOfHandler, kISizeOfHandlerIID)
NS_IMETHODIMP
nsSizeOfHandler::Add(size_t aSize)
{
mTotalSize += aSize;
return NS_OK;
}
PRBool
nsSizeOfHandler::HaveSeen(void* anObject)
{
if (nsnull == mTable) {
// When we run out of memory, HaveSeen returns PR_TRUE to stop
// wasting time.
return PR_TRUE;
}
if (nsnull != anObject) {
PRInt32 hashCode = (PRInt32) anObject;
PLHashEntry** hep = PL_HashTableRawLookup(mTable, hashCode, anObject);
PLHashEntry* he = *hep;
if (nsnull != he) {
return PR_TRUE;
}
he = PL_HashTableRawAdd(mTable, hep, hashCode, anObject, anObject);
if (nsnull == he) {
// When we run out of memory, HaveSeen returns PR_TRUE to stop
// wasting time.
return PR_TRUE;
}
return PR_FALSE;
}
return PR_TRUE;
}
NS_IMETHODIMP
nsSizeOfHandler::GetSize(PRUint32& aResult)
{
aResult = mTotalSize;
return NS_OK;
}
NS_BASE nsresult
NS_NewSizeOfHandler(nsISizeOfHandler** aInstancePtrResult)
{
nsISizeOfHandler *it = new nsSizeOfHandler();
if (it == nsnull) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kISizeOfHandlerIID, (void **) aInstancePtrResult);
}

File diff suppressed because it is too large Load Diff

238
mozilla/base/src/nsString.h Normal file
View File

@@ -0,0 +1,238 @@
/* -*- Mode: C++; tab-width: 2; 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.
*/
/**
* MODULE NOTES:
* LAST MODS: gess 28Feb98
*
* This very simple string class that knows how to do
* efficient (dynamic) resizing. It offers almost no
* i18n support, and will undoubtedly have to be replaced.
*
*/
#ifndef _NSSTRING
#define _NSSTRING
#include "prtypes.h"
#include "nscore.h"
#include "nsIAtom.h"
#include <iostream.h>
#include <stdio.h>
class nsISizeOfHandler;
class NS_BASE nsString {
public:
nsString();
nsString(const char* anISOLatin1);
nsString(const nsString&);
nsString(const PRUnichar* aUnicode);
protected:
// special subclass constructor
nsString(PRBool aSubclassBuffer);
public:
virtual ~nsString();
PRInt32 Length() const { return mLength; }
void SetLength(PRInt32 aLength);
void Truncate(PRInt32 anIndex=0);
virtual void EnsureCapacityFor(PRInt32 aNewLength);
virtual void SizeOf(nsISizeOfHandler* aHandler) const;
///accessor methods
//@{
PRUnichar* GetUnicode(void) const;
operator PRUnichar*() const;
PRUnichar* operator()() const;
PRUnichar operator()(PRInt32 i) const;
PRUnichar& operator[](PRInt32 i) const;
PRUnichar& CharAt(PRInt32 anIndex) const;
PRUnichar& First() const;
PRUnichar& Last() const;
//string creation methods...
nsString operator+(const nsString& aString);
nsString operator+(const char* anISOLatin1);
nsString operator+(char aChar);
nsString operator+(const PRUnichar* aBuffer);
nsString operator+(PRUnichar aChar);
void ToLowerCase();
void ToLowerCase(nsString& aString) const;
void ToUpperCase();
void ToUpperCase(nsString& aString) const;
nsString* ToNewString() const;
char* ToNewCString() const;
char* ToCString(char* aBuf,PRInt32 aBufLength) const;
void ToString(nsString& aString) const;
PRUnichar* ToNewUnicode() const;
float ToFloat(PRInt32* aErrorCode) const;
PRInt32 ToInteger(PRInt32* aErrorCode) const;
//@}
///string manipulation methods...
//@{
nsString& operator=(const nsString& aString);
nsString& operator=(const char* anISOLatin1);
nsString& operator=(char aChar);
nsString& operator=(const PRUnichar* aBuffer);
nsString& operator=(PRUnichar aChar);
nsString& SetString(const PRUnichar* aStr,PRInt32 aLength=-1);
nsString& SetString(const char* anISOLatin1,PRInt32 aLength=-1);
nsString& operator+=(const nsString& aString);
nsString& operator+=(const char* anISOLatin1);
nsString& operator+=(const PRUnichar* aBuffer);
nsString& operator+=(PRUnichar aChar);
nsString& Append(const nsString& aString,PRInt32 aLength=-1);
nsString& Append(const char* anISOLatin1,PRInt32 aLength=-1);
nsString& Append(char aChar);
nsString& Append(const PRUnichar* aBuffer,PRInt32 aLength=-1);
nsString& Append(PRUnichar aChar);
nsString& Append(PRInt32 aInteger,PRInt32 aRadix); //radix=8,10 or 16
nsString& Append(float aFloat);
PRInt32 Left(nsString& aCopy,PRInt32 aCount);
PRInt32 Mid(nsString& aCopy,PRInt32 anOffset,PRInt32 aCount);
PRInt32 Right(nsString& aCopy,PRInt32 aCount);
PRInt32 Insert(nsString& aCopy,PRInt32 anOffset,PRInt32 aCount=-1);
PRInt32 Insert(PRUnichar aChar,PRInt32 anOffset);
nsString& Cut(PRInt32 anOffset,PRInt32 aCount);
nsString& StripChars(const char* aSet);
nsString& StripWhitespace();
nsString& Trim( const char* aSet,
PRBool aEliminateLeading=PR_TRUE,
PRBool aEliminateTrailing=PR_TRUE);
nsString& CompressWhitespace( PRBool aEliminateLeading=PR_TRUE,
PRBool aEliminateTrailing=PR_TRUE);
static PRBool IsSpace(PRUnichar ch);
static PRBool IsAlpha(PRUnichar ch);
static PRBool IsDigit(PRUnichar ch);
//@}
///searching methods...
//@{
PRInt32 Find(const char* anISOLatin1) const;
PRInt32 Find(const PRUnichar* aString) const;
PRInt32 Find(PRUnichar aChar,PRInt32 offset=0) const;
PRInt32 Find(const nsString& aString) const;
PRInt32 FindFirstCharInSet(const char* anISOLatin1Set,PRInt32 offset=0) const;
PRInt32 FindFirstCharInSet(nsString& aString,PRInt32 offset=0) const;
PRInt32 FindLastCharInSet(const char* anISOLatin1Set,PRInt32 offset=0) const;
PRInt32 FindLastCharInSet(nsString& aString,PRInt32 offset=0) const;
PRInt32 RFind(const char* anISOLatin1,PRBool aIgnoreCase=PR_FALSE) const;
PRInt32 RFind(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE) const;
PRInt32 RFind(const nsString& aString,PRBool aIgnoreCase=PR_FALSE) const;
PRInt32 RFind(PRUnichar aChar,PRBool aIgnoreCase=PR_FALSE) const;
//@}
///comparision methods...
//@{
virtual PRInt32 Compare(const nsString &S,PRBool aIgnoreCase=PR_FALSE) const;
virtual PRInt32 Compare(const char *anISOLatin1,PRBool aIgnoreCase=PR_FALSE) const;
virtual PRInt32 Compare(const PRUnichar *aString,PRBool aIgnoreCase=PR_FALSE) const;
PRInt32 operator==(const nsString &S) const;
PRInt32 operator==(const char *anISOLatin1) const;
PRInt32 operator==(const PRUnichar* aString) const;
PRInt32 operator!=(const nsString &S) const;
PRInt32 operator!=(const char *anISOLatin1) const;
PRInt32 operator!=(const PRUnichar* aString) const;
PRInt32 operator<(const nsString &S) const;
PRInt32 operator<(const char *anISOLatin1) const;
PRInt32 operator<(const PRUnichar* aString) const;
PRInt32 operator>(const nsString &S) const;
PRInt32 operator>(const char *anISOLatin1) const;
PRInt32 operator>(const PRUnichar* aString) const;
PRInt32 operator<=(const nsString &S) const;
PRInt32 operator<=(const char *anISOLatin1) const;
PRInt32 operator<=(const PRUnichar* aString) const;
PRInt32 operator>=(const nsString &S) const;
PRInt32 operator>=(const char *anISOLatin1) const;
PRInt32 operator>=(const PRUnichar* aString) const;
PRBool Equals(const nsString& aString) const;
PRBool Equals(const char* anISOLatin1) const;
PRBool Equals(const nsIAtom *aAtom) const;
PRBool Equals(const PRUnichar* s1, const PRUnichar* s2) const;
PRBool EqualsIgnoreCase(const nsString& aString) const;
PRBool EqualsIgnoreCase(const char* anISOLatin1) const;
PRBool EqualsIgnoreCase(const nsIAtom *aAtom) const;
PRBool EqualsIgnoreCase(const PRUnichar* s1, const PRUnichar* s2) const;
//@}
static void SelfTest();
virtual void DebugDump(ostream& aStream) const;
protected:
typedef PRUnichar chartype;
chartype* mStr;
PRInt32 mLength;
PRInt32 mCapacity;
};
extern NS_BASE int fputs(const nsString& aString, FILE* out);
//----------------------------------------------------------------------
/**
* A version of nsString which is designed to be used as an automatic
* variable. It attempts to operate out of a fixed size internal
* buffer until too much data is added; then a dynamic buffer is
* allocated and grown as necessary.
*/
// XXX template this with a parameter for the size of the buffer?
class NS_BASE nsAutoString : public nsString {
public:
nsAutoString();
nsAutoString(const nsString& other);
nsAutoString(const nsAutoString& other);
nsAutoString(PRUnichar aChar);
nsAutoString(const char* isolatin1);
nsAutoString(const PRUnichar* us, PRInt32 uslen = -1);
virtual ~nsAutoString();
virtual void SizeOf(nsISizeOfHandler* aHandler) const;
static void SelfTest();
protected:
virtual void EnsureCapacityFor(PRInt32 aNewLength);
PRUnichar mBuf[32];
private:
// XXX these need writing I suppose
nsAutoString& operator=(const nsAutoString& other);
};
#endif

View File

@@ -0,0 +1,137 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsIUnicharBuffer.h"
#include "nsIUnicharInputStream.h"
#include "nsCRT.h"
#define MIN_BUFFER_SIZE 32
class UnicharBufferImpl : public nsIUnicharBuffer {
public:
UnicharBufferImpl(PRInt32 aBufferSize);
~UnicharBufferImpl();
NS_DECL_ISUPPORTS
virtual PRInt32 GetLength() const;
virtual PRInt32 GetBufferSize() const;
virtual PRUnichar* GetBuffer() const;
virtual PRBool Grow(PRInt32 aNewSize);
virtual PRInt32 Fill(PRInt32* aErrorCode, nsIUnicharInputStream* aStream,
PRInt32 aKeep);
PRUnichar* mBuffer;
PRInt32 mSpace;
PRInt32 mLength;
};
UnicharBufferImpl::UnicharBufferImpl(PRInt32 aBufferSize)
{
if (PRUint32(aBufferSize) < MIN_BUFFER_SIZE) {
aBufferSize = MIN_BUFFER_SIZE;
}
mSpace = aBufferSize;
mBuffer = new PRUnichar[aBufferSize];
mLength = 0;
NS_INIT_REFCNT();
}
NS_DEFINE_IID(kUnicharBufferIID, NS_IUNICHAR_BUFFER_IID);
NS_IMPL_ISUPPORTS(UnicharBufferImpl,kUnicharBufferIID)
UnicharBufferImpl::~UnicharBufferImpl()
{
if (nsnull != mBuffer) {
delete mBuffer;
mBuffer = nsnull;
}
mLength = 0;
}
PRInt32 UnicharBufferImpl::GetLength() const
{
return mLength;
}
PRInt32 UnicharBufferImpl::GetBufferSize() const
{
return mSpace;
}
PRUnichar* UnicharBufferImpl::GetBuffer() const
{
return mBuffer;
}
PRBool UnicharBufferImpl::Grow(PRInt32 aNewSize)
{
if (PRUint32(aNewSize) < MIN_BUFFER_SIZE) {
aNewSize = MIN_BUFFER_SIZE;
}
PRUnichar* newbuf = new PRUnichar[aNewSize];
if (nsnull != newbuf) {
if (0 != mLength) {
nsCRT::memcpy(newbuf, mBuffer, mLength * sizeof(PRUnichar));
}
delete mBuffer;
mBuffer = newbuf;
return PR_TRUE;
}
return PR_FALSE;
}
PRInt32 UnicharBufferImpl::Fill(PRInt32* aErrorCode,
nsIUnicharInputStream* aStream,
PRInt32 aKeep)
{
NS_PRECONDITION(nsnull != aStream, "null stream");
NS_PRECONDITION(PRUint32(aKeep) < PRUint32(mLength), "illegal keep count");
if ((nsnull == aStream) || (PRUint32(aKeep) >= PRUint32(mLength))) {
// whoops
*aErrorCode = NS_INPUTSTREAM_ILLEGAL_ARGS;
return -1;
}
if (0 != aKeep) {
// Slide over kept data
nsCRT::memmove(mBuffer, mBuffer + (mLength - aKeep),
aKeep * sizeof(PRUnichar));
}
// Read in some new data
mLength = aKeep;
PRInt32 amount = mSpace - aKeep;
PRInt32 nb = aStream->Read(aErrorCode, mBuffer, aKeep, amount);
if (nb > 0) {
mLength += nb;
}
return nb;
}
NS_BASE nsresult NS_NewUnicharBuffer(nsIUnicharBuffer** aInstancePtrResult,
nsISupports* aOuter,
PRInt32 aBufferSize)
{
if (nsnull != aOuter) {
return NS_ERROR_NO_AGGREGATION;
}
UnicharBufferImpl* it = new UnicharBufferImpl(aBufferSize);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kUnicharBufferIID, (void **) aInstancePtrResult);
}

View File

@@ -0,0 +1,329 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsIUnicharInputStream.h"
#include "nsIByteBuffer.h"
#include "nsIUnicharBuffer.h"
#include "nsString.h"
#include "nsCRT.h"
#include <fcntl.h>
#ifdef NS_WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
static NS_DEFINE_IID(kIUnicharInputStreamIID, NS_IUNICHAR_INPUT_STREAM_IID);
class StringUnicharInputStream : public nsIUnicharInputStream {
public:
StringUnicharInputStream(nsString* aString);
~StringUnicharInputStream();
NS_DECL_ISUPPORTS
virtual PRInt32 Read(PRInt32* aErrorCode,
PRUnichar* aBuf,
PRInt32 aOffset,
PRInt32 aCount);
virtual void Close();
nsString* mString;
PRInt32 mPos;
PRInt32 mLen;
};
StringUnicharInputStream::StringUnicharInputStream(nsString* aString)
{
NS_INIT_REFCNT();
mString = aString;
mPos = 0;
mLen = aString->Length();
}
StringUnicharInputStream::~StringUnicharInputStream()
{
if (nsnull != mString) {
delete mString;
}
}
PRInt32 StringUnicharInputStream::Read(PRInt32* aErrorCode,
PRUnichar* aBuf,
PRInt32 aOffset,
PRInt32 aCount)
{
if (mPos >= mLen) {
return -1;
}
const PRUnichar* us = mString->GetUnicode();
PRInt32 amount = mLen - mPos;
if (amount > aCount) {
amount = aCount;
}
nsCRT::memcpy(aBuf + aOffset, us + mPos, sizeof(PRUnichar) * amount);
mPos += amount;
return amount;
}
void StringUnicharInputStream::Close()
{
mPos = mLen;
if (nsnull != mString) {
delete mString;
}
}
NS_IMPL_ISUPPORTS(StringUnicharInputStream, kIUnicharInputStreamIID);
NS_BASE nsresult
NS_NewStringUnicharInputStream(nsIUnicharInputStream** aInstancePtrResult,
nsString* aString)
{
NS_PRECONDITION(nsnull != aString, "null ptr");
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if ((nsnull == aString) || (nsnull == aInstancePtrResult)) {
return NS_ERROR_NULL_POINTER;
}
StringUnicharInputStream* it = new StringUnicharInputStream(aString);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kIUnicharInputStreamIID,
(void**) aInstancePtrResult);
}
//----------------------------------------------------------------------
class IsoLatin1Converter : public nsIB2UConverter {
public:
IsoLatin1Converter();
NS_DECL_ISUPPORTS
virtual PRInt32 Convert(PRUnichar* aDst,
PRInt32 aDstOffset,
PRInt32& aDstLen,
const char* aSrc,
PRInt32 aSrcOffset,
PRInt32& aSrcLen);
};
IsoLatin1Converter::IsoLatin1Converter()
{
NS_INIT_REFCNT();
}
NS_DEFINE_IID(kIB2UConverterIID, NS_IB2UCONVERTER_IID);
NS_IMPL_ISUPPORTS(IsoLatin1Converter,kIB2UConverterIID);
PRInt32 IsoLatin1Converter::Convert(PRUnichar* aDst,
PRInt32 aDstOffset,
PRInt32& aDstLen,
const char* aSrc,
PRInt32 aSrcOffset,
PRInt32& aSrcLen)
{
PRInt32 amount = aSrcLen;
if (aSrcLen > aDstLen) {
amount = aDstLen;
}
const char* end = aSrc + amount;
while (aSrc < end) {
PRUint8 isoLatin1 = PRUint8(*aSrc++);
/* XXX insert table based lookup converter here */
*aDst++ = isoLatin1;
}
aDstLen = amount;
aSrcLen = amount;
return NS_OK;
}
NS_BASE nsresult
NS_NewB2UConverter(nsIB2UConverter** aInstancePtrResult,
nsISupports* aOuter,
nsCharSetID aCharSet)
{
if (nsnull != aOuter) {
return NS_ERROR_NO_AGGREGATION;
}
if (eCharSetID_IsoLatin1 != aCharSet) {
return NS_INPUTSTREAM_NO_CONVERTER;
}
IsoLatin1Converter* it = new IsoLatin1Converter();
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kIB2UConverterIID, (void**)aInstancePtrResult);
}
//----------------------------------------------------------------------
class ConverterInputStream : public nsIUnicharInputStream {
public:
ConverterInputStream(nsIInputStream* aStream,
nsIB2UConverter* aConverter,
PRInt32 aBufSize);
~ConverterInputStream();
NS_DECL_ISUPPORTS
virtual PRInt32 Read(PRInt32* aErrorCode,
PRUnichar* aBuf,
PRInt32 aOffset,
PRInt32 aCount);
virtual void Close();
protected:
PRInt32 Fill(PRInt32* aErrorCode);
nsIInputStream* mInput;
nsIB2UConverter* mConverter;
nsIByteBuffer* mByteData;
PRInt32 mByteDataOffset;
nsIUnicharBuffer* mUnicharData;
PRInt32 mUnicharDataOffset;
PRInt32 mUnicharDataLength;
};
ConverterInputStream::ConverterInputStream(nsIInputStream* aStream,
nsIB2UConverter* aConverter,
PRInt32 aBufferSize)
{
NS_INIT_REFCNT();
mInput = aStream; aStream->AddRef();
mConverter = aConverter; aConverter->AddRef();
if (aBufferSize == 0) {
aBufferSize = 8192;
}
nsresult rv1 = NS_NewByteBuffer(&mByteData, nsnull, aBufferSize);
nsresult rv2 = NS_NewUnicharBuffer(&mUnicharData, nsnull, aBufferSize);
mByteDataOffset = 0;
mUnicharDataOffset = 0;
mUnicharDataLength = 0;
}
NS_IMPL_ISUPPORTS(ConverterInputStream,kIUnicharInputStreamIID);
ConverterInputStream::~ConverterInputStream()
{
Close();
}
void ConverterInputStream::Close()
{
if (nsnull != mInput) {
mInput->Release();
mInput = nsnull;
}
if (nsnull != mConverter) {
mConverter->Release();
mConverter = nsnull;
}
if (nsnull != mByteData) {
mByteData->Release();
mByteData = nsnull;
}
if (nsnull != mUnicharData) {
mUnicharData->Release();
mUnicharData = nsnull;
}
}
PRInt32 ConverterInputStream::Read(PRInt32* aErrorCode,
PRUnichar* aBuf,
PRInt32 aOffset,
PRInt32 aCount)
{
PRInt32 rv = mUnicharDataLength - mUnicharDataOffset;
if (0 == rv) {
// Fill the unichar buffer
rv = Fill(aErrorCode);
if (rv <= 0) {
return rv;
}
}
if (rv > aCount) {
rv = aCount;
}
nsCRT::memcpy(aBuf + aOffset, mUnicharData->GetBuffer() + mUnicharDataOffset,
rv * sizeof(PRUnichar));
mUnicharDataOffset += rv;
return rv;
}
PRInt32 ConverterInputStream::Fill(PRInt32* aErrorCode)
{
if (nsnull == mInput) {
// We already closed the stream!
*aErrorCode = NS_INPUTSTREAM_CLOSED;
return -1;
}
PRInt32 remainder = mByteData->GetLength() - mByteDataOffset;
mByteDataOffset = remainder;
PRInt32 nb = mByteData->Fill(aErrorCode, mInput, remainder);
if (nb <= 0) {
// Because we assume a many to one conversion, the lingering data
// in the byte buffer must be a partial conversion
// fragment. Because we know that we have recieved no more new
// data to add to it, we can't convert it. Therefore, we discard
// it.
return nb;
}
NS_ASSERTION(remainder + nb == mByteData->GetLength(), "bad nb");
// Now convert as much of the byte buffer to unicode as possible
PRInt32 dstLen = mUnicharData->GetBufferSize();
PRInt32 srcLen = remainder + nb;
*aErrorCode = mConverter->Convert(mUnicharData->GetBuffer(), 0, dstLen,
mByteData->GetBuffer(), 0, srcLen);
mUnicharDataOffset = 0;
mUnicharDataLength = dstLen;
mByteDataOffset += srcLen;
return dstLen;
}
// XXX hook up auto-detect here (do we need more info, like the url?)
NS_BASE nsresult
NS_NewConverterStream(nsIUnicharInputStream** aInstancePtrResult,
nsISupports* aOuter,
nsIInputStream* aStreamToWrap,
PRInt32 aBufferSize,
nsCharSetID aCharSet)
{
if (nsnull != aOuter) {
return NS_ERROR_NO_AGGREGATION;
}
// Create converter
nsIB2UConverter* converter;
nsresult rv = NS_NewB2UConverter(&converter, nsnull, aCharSet);
if (NS_OK != rv) {
return rv;
}
// Create converter input stream
ConverterInputStream* it =
new ConverterInputStream(aStreamToWrap, converter, aBufferSize);
converter->Release();
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kIUnicharInputStreamIID,
(void **) aInstancePtrResult);
}

View File

@@ -0,0 +1,76 @@
/* -*- Mode: C++; tab-width: 2; 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 nsUnitConversion_h__
#define nsUnitConversion_h__
#include "nscore.h"
#include <math.h>
/// Unit conversion macros
//@{
#define TWIPS_CONST 20
#define TWIPS_CONST_FLOAT 20.0f
#define NS_POINTS_TO_TWIPS_INT(x) ((PRInt32)(TWIPS_CONST * (x)))
#define NS_TWIPS_TO_POINTS_INT(x) ((PRInt32)((x) / TWIPS_CONST))
#define NS_POINTS_TO_TWIPS_FLOAT(x) (TWIPS_CONST_FLOAT * (x))
#define NS_TWIPS_TO_POINTS_FLOAT(x) ((x) / TWIPS_CONST_FLOAT)
#define NS_INCHES_TO_TWIPS(x) (72.0f * TWIPS_CONST_FLOAT * (x)) // 72 points per inch
#define NS_FEET_TO_TWIPS(x) (72.0f * 12.0f * TWIPS_CONST_FLOAT * (x))
#define NS_MILES_TO_TWIPS(x) (72.0f * 12.0f * 5280.0f * TWIPS_CONST_FLOAT * (x))
#define NS_MILLIMETERS_TO_TWIPS(x) (72.0f * 0.03937f * TWIPS_CONST_FLOAT * (x))
#define NS_CENTIMETERS_TO_TWIPS(x) (72.0f * 0.3937f * TWIPS_CONST_FLOAT * (x))
#define NS_METERS_TO_TWIPS(x) (72.0f * 39.37f * TWIPS_CONST_FLOAT * (x))
#define NS_KILOMETERS_TO_TWIPS(x) (72.0f * 39370.0f * TWIPS_CONST_FLOAT * (x))
#define NS_PICAS_TO_TWIPS(x) (12.0f * TWIPS_CONST_FLOAT * (x)) // 12 points per pica
#define NS_DIDOTS_TO_TWIPS(x) ((16.0f / 15.0f) * TWIPS_CONST_FLOAT * (x)) // 15 didots per 16 points
#define NS_CICEROS_TO_TWIPS(x) ((12.0f * 16.0f / 15.0f) * TWIPS_CONST_FLOAT * (x)) // 12 didots per cicero
#define NS_TWIPS_TO_INCHES(x) ((1.0f / (72.0f * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_FEET(x) ((1.0f / (72.0f * 12.0f * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_MILES(x) ((1.0f / (72.0f * 12.0f * 5280.0f * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_MILLIMETERS(x) ((1.0f / (72.0f * 0.03937f * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_CENTIMETERS(x) ((1.0f / (72.0f * 0.3937f * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_METERS(x) ((1.0f / (72.0f * 39.37f * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_KILOMETERS(x) ((1.0f / (72.0f * 39370.0f * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_PICAS(x) ((1.0f / (12.0f * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_DIDOTS(x) ((1.0f / ((16.0f / 15.0f) * TWIPS_CONST_FLOAT)) * (x))
#define NS_TWIPS_TO_CICEROS(x) ((1.0f / ((12.0f * 16.0f / 15.0f) * TWIPS_CONST_FLOAT)) * (x))
//@}
/// use these for all of your rounding needs...
//@{
#define NS_TO_INT_FLOOR(x) ((PRInt32)floor(x))
#define NS_TO_INT_CEIL(x) ((PRInt32)ceil(x))
#define NS_TO_INT_ROUND(x) ((PRInt32)floor((x) + 0.5))
#define NS_TO_INT_ROUND_EXCLUSIVE(x) ((PRInt32)floor((x) + 0.4999999999999999))
//@}
#define NS_INT_PIXELS_TO_TWIPS(pixels, factor) ((((float)pixels)*factor) + 0.4999999999999999)
#define NS_FLOAT_PIXELS_TO_TWIPS(pixels, factor) ((pixels*factor) + 0.4999999999999999)
#endif

View File

@@ -0,0 +1,212 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsVoidArray.h"
#include "nsCRT.h"
#include "nsISizeOfHandler.h"
static PRInt32 kGrowArrayBy = 8;
nsVoidArray::nsVoidArray()
{
mArray = nsnull;
mArraySize = 0;
mCount = 0;
}
nsVoidArray::nsVoidArray(PRInt32 aCount)
{
NS_PRECONDITION(aCount > 0, "bad count");
mCount = mArraySize = aCount;
mArray = new void*[mCount];
nsCRT::memset(mArray, 0, mCount * sizeof(void*));
}
nsVoidArray& nsVoidArray::operator=(const nsVoidArray& other)
{
if (nsnull != mArray) {
delete mArray;
}
PRInt32 otherCount = other.mCount;
mArraySize = otherCount;
mCount = otherCount;
if (otherCount != 0) {
mArray = new void*[otherCount];
nsCRT::memcpy(mArray, other.mArray, otherCount * sizeof(void*));
} else {
mArray = nsnull;
}
return *this;
}
nsVoidArray::~nsVoidArray()
{
if (nsnull != mArray) {
delete [] mArray;
}
}
void
nsVoidArray::SizeOf(nsISizeOfHandler* aHandler) const
{
aHandler->Add(sizeof(*this));
aHandler->Add(sizeof(void*) * mArraySize);
}
void* nsVoidArray::ElementAt(PRInt32 aIndex) const
{
if (PRUint32(aIndex) >= PRUint32(mCount)) {
return nsnull;
}
return mArray[aIndex];
}
PRInt32 nsVoidArray::IndexOf(void* aPossibleElement) const
{
void** ap = mArray;
void** end = ap + mCount;
while (ap < end) {
if (*ap == aPossibleElement) {
return ap - mArray;
}
ap++;
}
return -1;
}
PRBool nsVoidArray::InsertElementAt(void* aElement, PRInt32 aIndex)
{
PRInt32 oldCount = mCount;
if (PRUint32(aIndex) > PRUint32(oldCount)) {
// An invalid index causes the insertion to fail
return PR_FALSE;
}
if (oldCount + 1 > mArraySize) {
// We have to grow the array
PRInt32 newCount = oldCount + kGrowArrayBy;
void** newArray = new void*[newCount];
if (mArray != nsnull && aIndex != 0)
nsCRT::memcpy(newArray, mArray, aIndex * sizeof(void*));
PRInt32 slide = oldCount - aIndex;
if (0 != slide) {
// Slide data over to make room for the insertion
nsCRT::memcpy(newArray + aIndex + 1, mArray + aIndex,
slide * sizeof(void*));
}
if (mArray != nsnull)
delete [] mArray;
mArray = newArray;
mArraySize = newCount;
} else {
// The array is already large enough
PRInt32 slide = oldCount - aIndex;
if (0 != slide) {
// Slide data over to make room for the insertion
nsCRT::memmove(mArray + aIndex + 1, mArray + aIndex,
slide * sizeof(void*));
}
}
mArray[aIndex] = aElement;
mCount++;
return PR_TRUE;
}
PRBool nsVoidArray::ReplaceElementAt(void* aElement, PRInt32 aIndex)
{
if (PRUint32(aIndex) >= PRUint32(mCount)) {
// An invalid index causes the replace to fail
return PR_FALSE;
}
mArray[aIndex] = aElement;
return PR_TRUE;
}
PRBool nsVoidArray::RemoveElementAt(PRInt32 aIndex)
{
PRInt32 oldCount = mCount;
if (PRUint32(aIndex) >= PRUint32(oldCount)) {
// An invalid index causes the replace to fail
return PR_FALSE;
}
// We don't need to move any elements if we're removing the
// last element in the array
if (aIndex < (oldCount - 1)) {
nsCRT::memmove(mArray + aIndex, mArray + aIndex + 1,
(oldCount - 1 - aIndex) * sizeof(void*));
}
mCount--;
return PR_TRUE;
}
PRBool nsVoidArray::RemoveElement(void* aElement)
{
void** ep = mArray;
void** end = ep + mCount;
while (ep < end) {
void* e = *ep++;
if (e == aElement) {
ep--;
return RemoveElementAt(PRInt32(ep - mArray));
}
}
return PR_FALSE;
}
void nsVoidArray::Clear()
{
mCount = 0;
}
void nsVoidArray::Compact()
{
PRInt32 count = mCount;
if (mArraySize != count) {
void** newArray = new void*[count];
if (nsnull != newArray) {
nsCRT::memcpy(newArray, mArray, count * sizeof(void*));
delete [] mArray;
mArray = newArray;
mArraySize = count;
}
}
}
PRBool nsVoidArray::EnumerateForwards(nsVoidArrayEnumFunc aFunc, void* aData)
{
PRInt32 index = -1;
PRBool running = PR_TRUE;
while (running && (++index < mCount)) {
running = (*aFunc)(mArray[index], aData);
}
return running;
}
PRBool nsVoidArray::EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData)
{
PRInt32 index = mCount;
PRBool running = PR_TRUE;
while (running && (0 <= --index)) {
running = (*aFunc)(mArray[index], aData);
}
return running;
}

View File

@@ -0,0 +1,74 @@
/* -*- Mode: C++; tab-width: 2; 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 nsVoidArray_h___
#define nsVoidArray_h___
#include "nscore.h"
class nsISizeOfHandler;
// Enumerator callback function. Return PR_FALSE to stop
typedef PRBool (*nsVoidArrayEnumFunc)(void* aElement, void *aData);
/// A basic zero-based array of void*'s that manages its own memory
class NS_BASE nsVoidArray {
public:
nsVoidArray();
nsVoidArray(PRInt32 aCount); // initial count of aCount elements set to nsnull
~nsVoidArray();
nsVoidArray& operator=(const nsVoidArray& other);
void SizeOf(nsISizeOfHandler* aHandler) const;
PRInt32 Count() const {
return mCount;
}
void* ElementAt(PRInt32 aIndex) const;
void* operator[](PRInt32 aIndex) const { return ElementAt(aIndex); }
PRInt32 IndexOf(void* aPossibleElement) const;
PRBool InsertElementAt(void* aElement, PRInt32 aIndex);
PRBool ReplaceElementAt(void* aElement, PRInt32 aIndex);
PRBool AppendElement(void* aElement) {
return InsertElementAt(aElement, mCount);
}
PRBool RemoveElement(void* aElement);
PRBool RemoveElementAt(PRInt32 aIndex);
void Clear();
void Compact();
PRBool EnumerateForwards(nsVoidArrayEnumFunc aFunc, void* aData);
PRBool EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData);
protected:
void** mArray;
PRInt32 mArraySize;
PRInt32 mCount;
private:
/// Copy constructors are not allowed
nsVoidArray(const nsVoidArray& other);
};
#endif /* nsVoidArray_h___ */

110
mozilla/base/src/nscore.h Normal file
View File

@@ -0,0 +1,110 @@
/* -*- Mode: C++; tab-width: 2; 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 nscore_h___
#define nscore_h___
#ifdef _WIN32
#define NS_WIN32 1
#endif
#if defined(__unix)
#define NS_UNIX 1
#endif
#include "prtypes.h"
#include "nsDebug.h"
/** ucs2 datatype for 2 byte unicode characters */
typedef PRUint16 PRUcs2;
/** ucs4 datatype for 4 byte unicode characters */
typedef PRUint32 PRUcs4;
#ifdef NS_UCS4
typedef PRUcs4 PRUnichar;
#else
typedef PRUcs2 PRUnichar;
#endif
/// The preferred symbol for null.
#define nsnull 0
/* Define brackets for protecting C code from C++ */
#ifdef __cplusplus
#define NS_BEGIN_EXTERN_C extern "C" {
#define NS_END_EXTERN_C }
#else
#define NS_BEGIN_EXTERN_C
#define NS_END_EXTERN_C
#endif
/*----------------------------------------------------------------------*/
/* Import/export defines */
#ifdef NS_WIN32
#define NS_IMPORT _declspec(dllimport)
#define NS_EXPORT _declspec(dllexport)
#else
/* XXX do something useful? */
#define NS_IMPORT
#define NS_EXPORT
#endif
#ifdef _IMPL_NS_BASE
#define NS_BASE NS_EXPORT
#else
#define NS_BASE NS_IMPORT
#endif
#ifdef _IMPL_NS_NET
#define NS_NET NS_EXPORT
#else
#define NS_NET NS_IMPORT
#endif
#ifdef _IMPL_NS_DOM
#define NS_DOM NS_EXPORT
#else
#define NS_DOM NS_IMPORT
#endif
#ifdef _IMPL_NS_WIDGET
#define NS_WIDGET NS_EXPORT
#else
#define NS_WIDGET NS_IMPORT
#endif
#ifdef _IMPL_NS_VIEW
#define NS_VIEW NS_EXPORT
#else
#define NS_VIEW NS_IMPORT
#endif
#ifdef _IMPL_NS_GFXNONXP
#define NS_GFXNONXP NS_EXPORT
#else
#define NS_GFXNONXP NS_IMPORT
#endif
#ifdef _IMPL_NS_GFX
#define NS_GFX NS_EXPORT
#else
#define NS_GFX NS_IMPORT
#endif
#endif /* nscore_h___ */

View File

@@ -0,0 +1,43 @@
#!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 = ../../..
LIBRARY_NAME = gmbaseunix
MODULE=raptor
REQUIRES=xpcom raptor
DEFINES = -D_IMPL_NS_WIDGET
CPPSRCS= \
nsTimer.cpp
CPP_OBJS= \
./$(OBJDIR)/nsTimer.o \
$(NULL)
include $(DEPTH)/config/config.mk
TARGETS = $(LIBRARY)
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,171 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsITimer.h"
#include "nsITimerCallback.h"
#include "nsCRT.h"
#include "prlog.h"
#include <stdio.h>
#include <limits.h>
#include "Xm/Xm.h"
static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID);
// Hack for now. This is Bad because it creates a dependency between the widget
// library and this library. This needs to be replaced with having code
// to pass an interface which can be queried for the app context.
extern XtAppContext gAppContext;
extern void nsTimerExpired(XtPointer aCallData);
/*
* Implementation of timers using Xt timer facility
*/
class TimerImpl : public nsITimer {
public:
public:
TimerImpl();
virtual ~TimerImpl();
virtual nsresult Init(nsTimerCallbackFunc aFunc,
void *aClosure,
// PRBool aRepeat,
PRUint32 aDelay);
virtual nsresult Init(nsITimerCallback *aCallback,
// PRBool aRepeat,
PRUint32 aDelay);
NS_DECL_ISUPPORTS
virtual void Cancel();
virtual PRUint32 GetDelay() { return mDelay; }
virtual void SetDelay(PRUint32 aDelay) { mDelay=aDelay; };
void FireTimeout();
private:
nsresult Init(PRUint32 aDelay);
PRUint32 mDelay;
nsTimerCallbackFunc mFunc;
void *mClosure;
nsITimerCallback *mCallback;
// PRBool mRepeat;
TimerImpl *mNext;
XtIntervalId mTimerId;
};
void TimerImpl::FireTimeout()
{
if (mFunc != NULL) {
(*mFunc)(this, mClosure);
}
else if (mCallback != NULL) {
mCallback->Notify(this); // Fire the timer
}
// Always repeating here
// if (mRepeat)
// mTimerId = XtAppAddTimeOut(gAppContext, GetDelay(),(XtTimerCallbackProc)nsTimerExpired, this);
}
TimerImpl::TimerImpl()
{
NS_INIT_REFCNT();
mFunc = NULL;
mCallback = NULL;
mNext = NULL;
mTimerId = 0;
mDelay = 0;
}
TimerImpl::~TimerImpl()
{
}
nsresult
TimerImpl::Init(nsTimerCallbackFunc aFunc,
void *aClosure,
// PRBool aRepeat,
PRUint32 aDelay)
{
mFunc = aFunc;
mClosure = aClosure;
// mRepeat = aRepeat;
mTimerId = XtAppAddTimeOut(gAppContext, aDelay,(XtTimerCallbackProc)nsTimerExpired, this);
return Init(aDelay);
}
nsresult
TimerImpl::Init(nsITimerCallback *aCallback,
// PRBool aRepeat,
PRUint32 aDelay)
{
mCallback = aCallback;
// mRepeat = aRepeat;
mTimerId = XtAppAddTimeOut(gAppContext, aDelay, (XtTimerCallbackProc)nsTimerExpired, this);
return Init(aDelay);
}
nsresult
TimerImpl::Init(PRUint32 aDelay)
{
mDelay = aDelay;
NS_ADDREF(this);
return NS_OK;
}
NS_IMPL_ISUPPORTS(TimerImpl, kITimerIID)
void
TimerImpl::Cancel()
{
XtRemoveTimeOut(mTimerId);
}
NS_BASE nsresult NS_NewTimer(nsITimer** aInstancePtrResult)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
TimerImpl *timer = new TimerImpl();
if (nsnull == timer) {
return NS_ERROR_OUT_OF_MEMORY;
}
return timer->QueryInterface(kITimerIID, (void **) aInstancePtrResult);
}
void nsTimerExpired(XtPointer aCallData)
{
TimerImpl* timer = (TimerImpl *)aCallData;
timer->FireTimeout();
}

View File

@@ -0,0 +1,40 @@
#!nmake
#
# 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=..\..\..
IGNORE_MANIFEST=1
DEFINES=-D_IMPL_NS_BASE
LIBRARY_NAME=gmbase
MODULE=raptor
REQUIRES=xpcom raptor
CPPSRCS=nsTimer.cpp
CPP_OBJS=.\$(OBJDIR)\nsTimer.obj
LINCS=-I$(XPDIST)\public\xpcom -I$(XPDIST)\public\raptor
LCFLAGS = \
$(LCFLAGS) \
-D_IMPL_NS_BASE \
$(NULL)
include <$(DEPTH)\config\rules.mak>
libs:: $(OBJS)
$(MAKE_INSTALL) $(OBJDIR)\nsTimer.obj ..\$(OBJDIR)

View File

@@ -0,0 +1,364 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsITimer.h"
#include "nsITimerCallback.h"
#include "nsCRT.h"
#include "prlog.h"
#include <stdio.h>
#include <windows.h>
#include <limits.h>
static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID);
/*
* Implementation of timers lifted from Windows front-end file timer.cpp
*/
class TimerImpl : public nsITimer {
public:
static TimerImpl *gTimerList;
static UINT gWindowsTimer;
static DWORD gNextFire;
static DWORD gSyncHack;
static void ProcessTimeouts(DWORD aNow);
static void SyncTimeoutPeriod(DWORD aTickCount);
public:
TimerImpl();
~TimerImpl();
virtual nsresult Init(nsTimerCallbackFunc aFunc,
void *aClosure,
// PRBool aRepeat,
PRUint32 aDelay);
virtual nsresult Init(nsITimerCallback *aCallback,
// PRBool aRepeat,
PRUint32 aDelay);
NS_DECL_ISUPPORTS
virtual void Cancel();
void Fire(DWORD aNow);
virtual PRUint32 GetDelay() { return mDelay; }
virtual void SetDelay(PRUint32 aDelay) {};
private:
nsresult Init(PRUint32 aDelay);
PRUint32 mDelay;
nsTimerCallbackFunc mFunc;
void *mClosure;
nsITimerCallback *mCallback;
DWORD mFireTime;
// PRBool mRepeat;
TimerImpl *mNext;
};
TimerImpl *TimerImpl::gTimerList = NULL;
UINT TimerImpl::gWindowsTimer = 0;
DWORD TimerImpl::gNextFire = (DWORD)-1;
DWORD TimerImpl::gSyncHack = 0;
void CALLBACK FireTimeout(HWND aWindow,
UINT aMessage,
UINT aTimerID,
DWORD aTime)
{
static BOOL bCanEnter = TRUE;
// Don't allow old timer messages in here.
if(aMessage != WM_TIMER) {
PR_ASSERT(0);
return;
}
if(aTimerID != TimerImpl::gWindowsTimer) {
return;
}
// Block only one entry into this function, or else.
if(bCanEnter) {
bCanEnter = FALSE;
// see if we need to fork off any timeout functions
if(TimerImpl::gTimerList) {
TimerImpl::ProcessTimeouts(aTime);
}
bCanEnter = TRUE;
}
}
// Function to correctly have the timer be set.
void
TimerImpl::SyncTimeoutPeriod(DWORD aTickCount)
{
// May want us to set tick count ourselves.
if(aTickCount == 0) {
if(gSyncHack == 0) {
aTickCount = ::GetTickCount();
}
else {
aTickCount = gSyncHack;
}
}
// If there's no list, we should clear the timer.
if(!gTimerList) {
if(gWindowsTimer) {
::KillTimer(NULL, gWindowsTimer);
gWindowsTimer = 0;
gNextFire = (DWORD)-1;
}
}
else {
// See if we need to clear the current timer.
// Curcumstances are that if the timer will not
// fire on time for the next timeout.
BOOL bSetTimer = FALSE;
TimerImpl *pTimeout = gTimerList;
if(gWindowsTimer) {
if(pTimeout->mFireTime != gNextFire) {
::KillTimer(NULL, gWindowsTimer);
gWindowsTimer = 0;
gNextFire = (DWORD)-1;
// Set the timer.
bSetTimer = TRUE;
}
}
else {
// No timer set, attempt.
bSetTimer = TRUE;
}
if(bSetTimer) {
DWORD dwFireWhen = pTimeout->mFireTime > aTickCount ?
pTimeout->mFireTime - aTickCount : 0;
if(dwFireWhen > UINT_MAX) {
dwFireWhen = UINT_MAX;
}
UINT uFireWhen = (UINT)dwFireWhen;
PR_ASSERT(gWindowsTimer == 0);
gWindowsTimer = ::SetTimer(NULL, 0, uFireWhen, (TIMERPROC)FireTimeout);
if(gWindowsTimer) {
// Set the fire time.
gNextFire = pTimeout->mFireTime;
}
}
}
}
// Walk down the timeout list and launch anyone appropriate
void
TimerImpl::ProcessTimeouts(DWORD aNow)
{
TimerImpl *p = gTimerList;
if(aNow == 0) {
aNow = ::GetTickCount();
}
BOOL bCalledSync = FALSE;
// Set the hack, such that when FE_ClearTimeout
// calls SyncTimeoutPeriod, that GetTickCount()
// overhead is not incurred.
gSyncHack = aNow;
// loop over all entries
while(p) {
// send it
if(p->mFireTime < aNow) {
p->Fire(aNow);
// Clear the timer.
// Period synced.
p->Cancel();
bCalledSync = TRUE;
// Reset the loop (can't look at p->pNext now, and called
// code may have added/cleared timers).
// (could do this by going recursive and returning).
p = gTimerList;
} else {
// Make sure we fire an timer.
// Also, we need to check to see if things are backing up (they
// may be asking to be fired long before we ever get to them,
// and we don't want to pass in negative values to the real
// timer code, or it takes days to fire....
if(bCalledSync == FALSE) {
SyncTimeoutPeriod(aNow);
bCalledSync = TRUE;
}
// Get next timer.
p = p->mNext;
}
}
gSyncHack = 0;
}
TimerImpl::TimerImpl()
{
NS_INIT_REFCNT();
mFunc = NULL;
mCallback = NULL;
mNext = NULL;
}
TimerImpl::~TimerImpl()
{
}
nsresult
TimerImpl::Init(nsTimerCallbackFunc aFunc,
void *aClosure,
// PRBool aRepeat,
PRUint32 aDelay)
{
mFunc = aFunc;
mClosure = aClosure;
// mRepeat = aRepeat;
return Init(aDelay);
}
nsresult
TimerImpl::Init(nsITimerCallback *aCallback,
// PRBool aRepeat,
PRUint32 aDelay)
{
mCallback = aCallback;
// mRepeat = aRepeat;
return Init(aDelay);
}
nsresult
TimerImpl::Init(PRUint32 aDelay)
{
DWORD dwNow = ::GetTickCount();
mDelay = aDelay;
mFireTime = (DWORD) aDelay + dwNow;
mNext = NULL;
// add it to the list
if(!gTimerList) {
// no list add it
gTimerList = this;
}
else {
// is it before everything else on the list?
if(mFireTime < gTimerList->mFireTime) {
mNext = gTimerList;
gTimerList = this;
} else {
TimerImpl * pPrev = gTimerList;
TimerImpl * pCurrent = gTimerList;
while(pCurrent && (pCurrent->mFireTime <= mFireTime)) {
pPrev = pCurrent;
pCurrent = pCurrent->mNext;
}
PR_ASSERT(pPrev);
// insert it after pPrev (this could be at the end of the list)
mNext = pPrev->mNext;
pPrev->mNext = this;
}
}
NS_ADDREF(this);
// Sync the timer fire period.
SyncTimeoutPeriod(dwNow);
return NS_OK;
}
NS_IMPL_ISUPPORTS(TimerImpl, kITimerIID)
void
TimerImpl::Fire(DWORD aNow)
{
if (mFunc != NULL) {
(*mFunc)(this, mClosure);
}
else if (mCallback != NULL) {
mCallback->Notify(this);
}
}
void
TimerImpl::Cancel()
{
TimerImpl *me = this;
if(gTimerList == this) {
// first element in the list lossage
gTimerList = mNext;
} else {
// walk until no next pointer
for(TimerImpl * p = gTimerList; p && p->mNext && (p->mNext != this); p = p->mNext)
;
// if we found something valid pull it out of the list
if(p && p->mNext && p->mNext == this) {
p->mNext = mNext;
} else {
// get out before we delete something that looks bogus
return;
}
}
// if we got here it must have been a valid element so trash it
NS_RELEASE(me);
// If there's now no be sure to clear the timer.
SyncTimeoutPeriod(0);
}
NS_BASE nsresult NS_NewTimer(nsITimer** aInstancePtrResult)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
TimerImpl *timer = new TimerImpl();
if (nsnull == timer) {
return NS_ERROR_OUT_OF_MEMORY;
}
return timer->QueryInterface(kITimerIID, (void **) aInstancePtrResult);
}

View File

@@ -0,0 +1,104 @@
/* -*- Mode: C++; tab-width: 2; 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 <stdio.h>
#include "nsIUnicharInputStream.h"
#include "nsIURL.h"
#include "nsCRT.h"
#include "nsString.h"
#include "prprf.h"
#include "prtime.h"
static nsCharSetID ConvertCharacterSetName(const char* aName)
{
if (nsCRT::strcasecmp(aName, "iso-latin-1") == 0) {
return eCharSetID_IsoLatin1;
}
return (nsCharSetID) -1;
}
int main(int argc, char** argv)
{
if (3 != argc) {
printf("usage: CvtURL url character-set-name\n");
return -1;
}
char* characterSetName = argv[2];
nsCharSetID cset = ConvertCharacterSetName(characterSetName);
if (PRInt32(cset) < 0) {
printf("illegal character set name: '%s'\n", characterSetName);
return -1;
}
// Create url object
char* urlName = argv[1];
nsIURL* url;
nsresult rv = NS_NewURL(&url, urlName);
if (NS_OK != rv) {
printf("invalid URL: '%s'\n", urlName);
return -1;
}
// Get an input stream from the url
PRInt32 ec;
nsIInputStream* in = url->Open(&ec);
if (nsnull == in) {
printf("open of url('%s') failed: error=%x\n", urlName, ec);
return -1;
}
// Translate the input using the argument character set id into unicode
nsIUnicharInputStream* uin;
rv = NS_NewConverterStream(&uin, nsnull, in, 0, cset);
if (NS_OK != rv) {
printf("can't create converter input stream: %d\n", rv);
return -1;
}
// Read the input and write some output
PRTime start = PR_Now();
PRInt32 count = 0;
for (;;) {
PRUnichar buf[1000];
PRInt32 nb = uin->Read(&ec, buf, 0, 1000);
if (nb <= 0) {
if (nb < 0) {
printf("i/o error: %d\n", ec);
}
break;
}
count += nb;
}
PRTime end = PR_Now();
PRTime conversion, ustoms;
LL_I2L(ustoms, 1000);
LL_SUB(conversion, end, start);
LL_DIV(conversion, conversion, ustoms);
char buf[500];
PR_snprintf(buf, sizeof(buf),
"converting and discarding %d bytes took %lldms",
count, conversion);
puts(buf);
// Release the objects
in->Release();
uin->Release();
url->Release();
return 0;
}

View File

@@ -0,0 +1,57 @@
#!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=../..
REQUIRES=xpcom netlib
include $(DEPTH)/config/config.mk
CPPSRCS = \
TestAtoms.cpp \
TestCRT.cpp \
$(NULL)
INCLUDES+=-I../src
OBJS = $(CPPSRCS:.cpp=.o)
EX_LIBS = \
$(DIST)/lib/libraptorbase.a \
$(DIST)/lib/libxpcom.a \
$(DIST)/lib/libplc21.a \
$(DIST)/lib/libplds21.a \
$(DIST)/lib/libnspr21.a \
$(NULL)
PROGS = $(addprefix $(OBJDIR)/, $(CPPSRCS:.cpp=))
TARGETS = $(PROGS)
include $(DEPTH)/config/rules.mk
$(OBJDIR)/%.o: %.cpp
@$(MAKE_OBJDIR)
$(CCC) -o $@ $(CFLAGS) -c $*.cpp
$(PROGS):$(OBJDIR)/%: $(OBJDIR)/%.o $(EX_LIBS)
@$(MAKE_OBJDIR)
$(CCC) -o $@ $@.o $(LDFLAGS) $(EX_LIBS) $(OS_LIBS)
install:: $(TARGETS)
$(INSTALL) $(PROGS) $(DIST)/bin

View File

@@ -0,0 +1,108 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsIAtom.h"
#include "nsString.h"
#include "prprf.h"
#include "prtime.h"
#include <stdio.h>
extern "C" int _CrtSetDbgFlag(int);
int main(int argc, char** argv)
{
FILE* fp = fopen("words.txt", "r");
if (nsnull == fp) {
printf("can't open words.txt\n");
return -1;
}
PRInt32 count = 0;
PRUnichar** strings = new PRUnichar*[60000];
nsIAtom** ids = new nsIAtom*[60000];
nsAutoString s1, s2;
PRTime start = PR_Now();
for (PRInt32 i = 0; i < 60000; i++) {
char buf[1000];
char* s = fgets(buf, sizeof(buf), fp);
if (nsnull == s) {
break;
}
nsAutoString sb(buf);
strings[count++] = sb.ToNewUnicode();
sb.ToUpperCase();
strings[count++] = sb.ToNewUnicode();
}
PRTime end0 = PR_Now();
// Find and create idents
for (i = 0; i < count; i++) {
ids[i] = NS_NewAtom(strings[i]);
}
PRUnichar qqs[1]; qqs[0] = 0;
nsIAtom* qq = NS_NewAtom(qqs);
PRTime end1 = PR_Now();
// Now make sure we can find all the idents we just made
for (i = 0; i < count; i++) {
nsIAtom* id = NS_NewAtom(ids[i]->GetUnicode());
if (id != ids[i]) {
id->ToString(s1);
ids[i]->ToString(s2);
printf("find failed: id='%s' ids[%d]='%s'\n",
s1.ToNewCString(), i, s2.ToNewCString());
return -1;
}
NS_RELEASE(id);
}
PRTime end2 = PR_Now();
// Destroy all the atoms we just made
NS_RELEASE(qq);
for (i = 0; i < count; i++) {
NS_RELEASE(ids[i]);
}
// Print out timings
PRTime end3 = PR_Now();
PRTime creates, finds, lookups, dtor, ustoms;
LL_I2L(ustoms, 1000);
LL_SUB(creates, end0, start);
LL_DIV(creates, creates, ustoms);
LL_SUB(finds, end1, end0);
LL_DIV(finds, finds, ustoms);
LL_SUB(lookups, end2, end1);
LL_DIV(lookups, lookups, ustoms);
LL_SUB(dtor, end3, end2);
char buf[500];
PR_snprintf(buf, sizeof(buf), "making %d ident strings took %lldms",
count, creates);
puts(buf);
PR_snprintf(buf, sizeof(buf), "%d new idents took %lldms",
count, finds);
puts(buf);
PR_snprintf(buf, sizeof(buf), "%d ident lookups took %lldms",
count, lookups);
puts(buf);
PR_snprintf(buf, sizeof(buf), "dtor took %lldusec", dtor);
puts(buf);
printf("%d live atoms\n", NS_GetNumberOfAtoms());
NS_POSTCONDITION(0 == NS_GetNumberOfAtoms(), "dangling atoms");
return 0;
}

View File

@@ -0,0 +1,89 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsCRT.h"
#include "nsString.h"
#include "plstr.h"
#include <stdlib.h>
// Verify that nsCRT versions of string comparison routines get the
// same answers as the native non-unicode versions. We only pass in
// iso-latin-1 strings, so the comparision must be valid.
static void Check(const char* s1, const char* s2, PRIntn n)
{
PRIntn clib = PL_strcmp(s1, s2);
PRIntn clib_n = PL_strncmp(s1, s2, n);
PRIntn clib_case = PL_strcasecmp(s1, s2);
PRIntn clib_case_n = PL_strncasecmp(s1, s2, n);
nsAutoString t1(s1), t2(s2);
PRUnichar* us1 = t1.GetUnicode();
PRUnichar* us2 = t2.GetUnicode();
PRIntn u = nsCRT::strcmp(us1, s2);
PRIntn u_n = nsCRT::strncmp(us1, s2, n);
PRIntn u_case = nsCRT::strcasecmp(us1, s2);
PRIntn u_case_n = nsCRT::strncasecmp(us1, s2, n);
PRIntn u2 = nsCRT::strcmp(us1, us2);
PRIntn u2_n = nsCRT::strncmp(us1, us2, n);
PRIntn u2_case = nsCRT::strcasecmp(us1, us2);
PRIntn u2_case_n = nsCRT::strncasecmp(us1, us2, n);
NS_ASSERTION(clib == u, "strcmp");
NS_ASSERTION(clib_n == u_n, "strncmp");
NS_ASSERTION(clib_case == u_case, "strcasecmp");
NS_ASSERTION(clib_case_n == u_case_n, "strncasecmp");
NS_ASSERTION(clib == u2, "strcmp");
NS_ASSERTION(clib_n == u2_n, "strncmp");
NS_ASSERTION(clib_case == u2_case, "strcasecmp");
NS_ASSERTION(clib_case_n == u2_case_n, "strncasecmp");
}
struct Test {
const char* s1;
const char* s2;
PRIntn n;
};
static Test tests[] = {
{ "foo", "foo", 3 },
{ "foo", "fo", 3 },
{ "foo", "bar", 3 },
{ "foo", "ba", 3 },
{ "foo", "zap", 3 },
{ "foo", "za", 3 },
{ "bar", "foo", 3 },
{ "bar", "fo", 3 },
{ "bar", "foo", 3 },
{ "bar", "fo", 3 },
};
#define NUM_TESTS (sizeof(tests) / sizeof(tests[0]))
void main()
{
Test* tp = tests;
for (PRIntn i = 0; i < NUM_TESTS; i++, tp++) {
Check(tp->s1, tp->s2, tp->n);
}
}

View File

@@ -0,0 +1,202 @@
/* -*- Mode: C++; tab-width: 2; 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 "prtypes.h"
#include "nsVoidArray.h"
#include "nsITimer.h"
#include "nsITimerCallback.h"
#include <stdio.h>
#include <stdlib.h>
#include "resources.h"
#include <windows.h>
static char* class1Name = "TimerTest";
static HANDLE gInstance, gPrevInstance;
static nsVoidArray *gTimeouts = NULL;
static void CreateRepeat(PRUint32 aDelay);
void
MyCallback (nsITimer *aTimer, void *aClosure)
{
printf("Timer executed with delay %d\n", (int)aClosure);
if (gTimeouts->RemoveElement(aTimer) == PR_TRUE) {
NS_RELEASE(aTimer);
}
}
void
MyRepeatCallback (nsITimer *aTimer, void *aClosure)
{
printf("Timer executed with delay %d\n", (int)aClosure);
if (gTimeouts->RemoveElement(aTimer) == PR_TRUE) {
NS_RELEASE(aTimer);
}
CreateRepeat((PRUint32)aClosure);
}
static void
CreateOneShot(PRUint32 aDelay)
{
nsITimer *timer;
NS_NewTimer(&timer);
timer->Init(MyCallback, (void *)aDelay, aDelay);
gTimeouts->AppendElement(timer);
}
static void
CreateRepeat(PRUint32 aDelay)
{
nsITimer *timer;
NS_NewTimer(&timer);
timer->Init(MyRepeatCallback, (void *)aDelay, aDelay);
gTimeouts->AppendElement(timer);
}
static void
CancelAll()
{
int i, count = gTimeouts->Count();
for (i=0; i < count; i++) {
nsITimer *timer = (nsITimer *)gTimeouts->ElementAt(i);
if (timer != NULL) {
timer->Cancel();
NS_RELEASE(timer);
}
}
gTimeouts->Clear();
}
long PASCAL
WndProc(HWND hWnd, UINT msg, WPARAM param, LPARAM lparam)
{
HMENU hMenu;
switch (msg) {
case WM_COMMAND:
hMenu = GetMenu(hWnd);
switch (LOWORD(param)) {
case TIMER_EXIT:
::DestroyWindow(hWnd);
exit(0);
case TIMER_1SECOND:
CreateOneShot(1000);
break;
case TIMER_5SECOND:
CreateOneShot(5000);
break;
case TIMER_10SECOND:
CreateOneShot(10000);
break;
case TIMER_1REPEAT:
CreateRepeat(1000);
break;
case TIMER_5REPEAT:
CreateRepeat(5000);
break;
case TIMER_10REPEAT:
CreateRepeat(10000);
break;
case TIMER_CANCEL:
CancelAll();
break;
default:
break;
}
default:
break;
}
return DefWindowProc(hWnd, msg, param, lparam);
}
static HWND CreateTopLevel(const char* clazz, const char* title,
int aWidth, int aHeight)
{
// Create a simple top level window
HWND window = ::CreateWindowEx(WS_EX_CLIENTEDGE,
clazz, title,
WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT,
aWidth, aHeight,
HWND_DESKTOP,
NULL,
gInstance,
NULL);
::ShowWindow(window, SW_SHOW);
::UpdateWindow(window);
return window;
}
int PASCAL
WinMain(HANDLE instance, HANDLE prevInstance, LPSTR cmdParam, int nCmdShow)
{
gInstance = instance;
if (!prevInstance) {
WNDCLASS wndClass;
wndClass.style = 0;
wndClass.lpfnWndProc = WndProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = gInstance;
wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndClass.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
wndClass.lpszMenuName = class1Name;
wndClass.lpszClassName = class1Name;
RegisterClass(&wndClass);
}
// Create our first top level window
HWND window = CreateTopLevel(class1Name, "Raptor HTML Viewer", 620, 400);
gTimeouts = new nsVoidArray();
// Process messages
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
void main(int argc, char **argv)
{
WinMain(GetModuleHandle(NULL), NULL, 0, SW_SHOW);
}

View File

@@ -0,0 +1,75 @@
#!nmake
#
# 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=..\..
MAKE_OBJ_TYPE = EXE
PROG0 = .\$(OBJDIR)\TimerTest.exe
PROG1 = .\$(OBJDIR)\TestAtoms.exe
PROG2 = .\$(OBJDIR)\CvtURL.exe
PROG3 = .\$(OBJDIR)\TestCRT.exe
RESFILE = timer.res
PROGRAMS = $(PROG0) $(PROG1) $(PROG2) $(PROG3)
LINCS=-I..\src -I$(PUBLIC)\xpcom -I$(PUBLIC)\netlib
LLIBS= \
$(DIST)\lib\xpcom32.lib \
$(DIST)\lib\raptorbase.lib \
$(DIST)\lib\netlib.lib \
$(LIBNSPR) \
$(DIST)\lib\libplc21.lib \
$(RESFILE)
include <$(DEPTH)\config\rules.mak>
install:: $(PROGRAMS)
$(MAKE_INSTALL) $(PROG0) $(DIST)\bin
$(MAKE_INSTALL) $(PROG1) $(DIST)\bin
$(MAKE_INSTALL) $(PROG2) $(DIST)\bin
$(MAKE_INSTALL) $(PROG3) $(DIST)\bin
clobber::
rm -f $(DIST)\bin\TimerTest.exe
rm -f $(DIST)\bin\TestAtoms.exe
rm -f $(DIST)\bin\CvtURL.exe
rm -f $(DIST)\bin\TestCRT.exe
# Move this into config/obj.inc when it's allowed
.cpp{.\$(OBJDIR)\}.exe:
$(CC) @<<$(CFGFILE)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
$(LLIBS)
$(OS_LIBS)
-Fd$(PBDFILE)
-Fe.\$(OBJDIR)\
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).cpp
<<KEEP
$(PROG0): $(OBJDIR) TimerTest.cpp $(RESFILE)
$(PROG1): $(OBJDIR) TestAtoms.cpp
$(PROG2): $(OBJDIR) CvtURL.cpp
$(PROG2): $(OBJDIR) TestCRT.cpp

View File

@@ -0,0 +1,32 @@
/* -*- Mode: C++; tab-width: 2; 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 resources_h___
#define resources_h___
#define TIMER_1SECOND 40000
#define TIMER_5SECOND 40001
#define TIMER_10SECOND 40002
#define TIMER_1REPEAT 40003
#define TIMER_5REPEAT 40004
#define TIMER_10REPEAT 40005
#define TIMER_CANCEL 40006
#define TIMER_EXIT 40010
#endif /* resources_h___ */

View File

@@ -0,0 +1,38 @@
/*
* 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 "resources.h"
TIMERTEST MENU DISCARDABLE
{
POPUP "Debug"
{
POPUP "One Shot"
{
MENUITEM "1 second", TIMER_1SECOND
MENUITEM "5 second", TIMER_5SECOND
MENUITEM "10 second", TIMER_10SECOND
}
POPUP "Repeated"
{
MENUITEM "1 second", TIMER_1REPEAT
MENUITEM "5 second", TIMER_5REPEAT
MENUITEM "10 second", TIMER_10REPEAT
}
MENUITEM "Cancel All", TIMER_CANCEL
MENUITEM "Exit", TIMER_EXIT
}
}

View File

@@ -0,0 +1 @@
5009808600

25
mozilla/build/genrc.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
#
# 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.
#
DATATYPE="$1"
INFILE="$2"
echo "${DATATYPE} RCDATA"
sed 's/"/""/g' ${INFILE} | awk 'BEGIN { printf("BEGIN\n") } { printf("\"%s\\r\\n\",\n", $0) } END { printf("\"\\0\"\nEND\n") }'
exit 0

45
mozilla/build/hcc Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
#
# 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.
#
#
# Fix brain-damaged compilers that don't understand -o and -c together
#
DASH_C=0
DASH_O=0
for i in $*
do
case $i in
-c) DASH_C=1;;
-o) DASH_O=1;;
*.c) C_SRC=$i;;
*.s) S_SRC=$i;;
*.o) OBJECT=$i;;
esac
done
cc $* || exit $?
# if there was no -c and -o we're done
[ $DASH_C = 1 -a $DASH_O = 1 ] || exit 0
# cc always creates the .o from the .c name
[ $C_SRC ] && OBJ=`basename $C_SRC .c`.o
# or the .o from the .s name
[ $S_SRC ] && OBJ=`basename $S_SRC .s`.o
[ -f $OBJECT ] || [ -f $OBJ ] && mv -f $OBJ $OBJECT

86
mozilla/build/hcpp Executable file
View File

@@ -0,0 +1,86 @@
#!/bin/sh
#
# 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.
#
#
# Wrapper for brain-damaged compilers that don't understand -o and -c together.
#
DUMMY="XxxXxxX"
DASH_C=0
DASH_O=0
GET_OBJECT=0
C_SRC="${DUMMY}"
CC_SRC="${DUMMY}"
CPP_SRC="${DUMMY}"
S_SRC="${DUMMY}"
OBJECT="${DUMMY}"
for i in $*
do
if [ ${GET_OBJECT} -eq 1 ]; then
OBJECT="$i"
GET_OBJECT=0
fi
case $i in
-c)
DASH_C=1
;;
-o)
DASH_O=1
GET_OBJECT=1
;;
*.c)
C_SRC="$i"
;;
+.*)
;;
*.cpp)
CPP_SRC="$i"
;;
*.cc)
CC_SRC="$i"
;;
*.s)
S_SRC="$i"
;;
esac
done
CC $* || exit $?
# LAME!!!
if [ -f -O ]; then
mv -f -- -O ${OBJECT}
fi
# if there was no -c and -o we're done
[ ${DASH_C} -eq 1 -a ${DASH_O} -eq 1 ] || exit 0
# cc always creates the .o from the .c name
if [ "${C_SRC}" != "${DUMMY}" ]; then
OBJ=`basename ${C_SRC} .c`.o
elif [ "${CPP_SRC}" != "${DUMMY}" ]; then
OBJ=`basename ${CPP_SRC} .cpp`.o
elif [ "${CC_SRC}" != "${DUMMY}" ]; then
OBJ=`basename ${CC_SRC} .cc`.o
# or the .o from the .s name
elif [ "${S_SRC}" != "${DUMMY}" ]; then
OBJ=`basename ${S_SRC} .s`.o
fi
[ -f ${OBJECT} ] || [ -f ${OBJ} ] && mv -f ${OBJ} ${OBJECT}

View File

@@ -0,0 +1,302 @@
#!perl
package BuildList;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(BuildMozilla DistMozilla);
=head1 NAME
BuildList - build the [ordered] set of projects needed to construct Mozilla
=head1 SYNOPSIS
...
=head1 COPYRIGHT
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.
=cut
use Moz;
use File::Path;
sub BuildMozilla()
{
if ( $main::DEBUG )
{
$D = "Debug";
$dist_dir = ":mozilla:dist:client_debug:";
}
else
{
$D = "";
$dist_dir = ":mozilla:dist:client:";
}
#
# Build the appropriate target of each project
#
BuildProjectClean(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "Stubs");
BuildProjectClean(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "Stubs");
BuildProjectClean(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "Stubs");
BuildProjectClean(":mozilla:cmd:macfe:projects:client:NavigatorStubs.mcp", "Stubs");
BuildProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "NSRuntime$D.shlb");
MakeAlias(":mozilla:lib:mac:NSRuntime:NSRuntime$D.shlb", "$dist_dir");
BuildProject(":mozilla:cmd:macfe:restext:StringLib.mcp", "Strings$D.shlb");
MakeAlias(":mozilla:cmd:macfe:restext:Strings$D.shlb", "$dist_dir");
BuildProject(":mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.mcp", "MoreFiles$D.shlb");
MakeAlias(":mozilla:lib:mac:MoreFiles:build:MoreFiles$D.shlb", "$dist_dir");
BuildProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb");
MakeAlias(":mozilla:nsprpub:macbuild:NSPR20$D.shlb", "$dist_dir");
BuildProject(":mozilla:dbm:macbuild:DBMPPC.mcp", "DBM$D.shlb");
MakeAlias(":mozilla:dbm:macbuild:DBM$D.shlb", "$dist_dir");
BuildProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "MemAllocator$D.shlb");
MakeAlias(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator$D.shlb", "$dist_dir");
BuildProject(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "NSStdLib$D.shlb");
MakeAlias(":mozilla:lib:mac:NSStdLib:NSStdLib$D.shlb", "$dist_dir");
BuildProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp", "xpcom$D.shlb");
MakeAlias(":mozilla:xpcom:macbuild:xpcom$D.shlb", "$dist_dir");
BuildProject(":mozilla:lib:mac:PowerPlant:PowerPlant.mcp", "PowerPlant$D.shlb");
MakeAlias(":mozilla:lib:mac:PowerPlant:PowerPlant$D.shlb", "$dist_dir");
BuildProject(":mozilla:modules:zlib:macbuild:zlib.mcp", "zlib$D.shlb");
MakeAlias(":mozilla:modules:zlib:macbuild:zlib$D.shlb", "$dist_dir");
BuildProject(":mozilla:jpeg:macbuild:JPEG.mcp", "JPEG$D.shlb");
MakeAlias(":mozilla:jpeg:macbuild:JPEG$D.shlb", "$dist_dir");
BuildProject(":mozilla:sun-java:stubs:macbuild:JavaStubs.mcp", "JavaRuntime$D.shlb");
MakeAlias(":mozilla:sun-java:stubs:macbuild:JavaRuntime$D.shlb", "$dist_dir");
BuildProject(":mozilla:js:jsj:macbuild:JSJ_PPC.mcp", "JSJ$D.o");
BuildProject(":mozilla:js:macbuild:JavaScriptPPC.mcp", "JavaScript$D.shlb");
MakeAlias(":mozilla:js:macbuild:JavaScript$D.shlb", "$dist_dir");
BuildProject(":mozilla:nav-java:stubs:macbuild:NavJavaStubs.mcp", "NavJava$D.shlb");
MakeAlias(":mozilla:nav-java:stubs:macbuild:NavJava$D.shlb", "$dist_dir");
BuildProject(":mozilla:modules:rdf:macbuild:RDF.mcp", "RDF$D.shlb");
MakeAlias(":mozilla:modules:rdf:macbuild:RDF$D.shlb", "$dist_dir");
BuildProject(":mozilla:modules:xml:macbuild:XML.mcp", "XML$D.shlb");
MakeAlias(":mozilla:modules:xml:macbuild:XML$D.shlb", "$dist_dir");
BuildProject(":mozilla:modules:schedulr:macbuild:Schedulr.mcp", "Scheduler$D.shlb");
MakeAlias(":mozilla:modules:schedulr:macbuild:Scheduler$D.shlb", "$dist_dir");
BuildProject(":mozilla:build:mac:CustomLib:CustomLib.mcp", "CustomLib$D.shlb");
MakeAlias(":mozilla:build:mac:CustomLib:CustomLib$D.shlb", "$dist_dir");
BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "Security.o");
BuildProject(":mozilla:modules:libfont:macbuild:FontBroker.mcp", "FontBroker$D.o");
BuildProject(":mozilla:lib:libmocha:macbuild:LibMocha.mcp", "LibMocha$D.o");
BuildProject(":mozilla:network:macbuild:network.mcp", "Network$D.o");
BuildProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o");
BuildProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.o");
BuildProject(":mozilla:build:mac:CustomLib:CustomLib.mcp", "CustomStaticLib$D.o");
if ( $main::MOZ_MEDIUM == 1 || $main::MOZ_DARK == 1 )
{
BuildProject(":mozilla:cmd:macfe:Composer:build:Composer.mcp", "Composer$D.o");
if ( $main::MOZ_DARK == 1 )
{
BuildProject(":mozilla:lib:libmsg:macbuild:MsgLib.mcp", "MsgLib$D.o");
BuildProject(":mozilla:cmd:macfe:MailNews:build:MailNews.mcp", "MailNews$D.o");
BuildProject(":mozilla:directory:c-sdk:ldap:libraries:macintosh:LDAPClient.mcp","LDAPClient$D.o");
}
else
{
BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "MsgLib$D.o");
BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "MailNews$D.o");
BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "LDAPClient$D.o");
}
# Build the appropriate resources target
BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Moz_Resources");
}
else
{
# Build a project with dummy targets to make stub libraries
BuildProject("cmd:macfe:projects:dummies:MakeDummies.mcp", "Composer$D.o");
# Build the appropriate resources target
BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Nav_Resources");
}
BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Client$D");
}
sub DistMozilla()
{
mkpath([ ":mozilla:dist:", ":mozilla:dist:client:", ":mozilla:dist:client_debug:", ":mozilla:dist:client_stubs:" ]);
#INCLUDE
InstallFromManifest(":mozilla:config:mac:MANIFEST", ":mozilla:dist:config:");
InstallFromManifest(":mozilla:include:MANIFEST", ":mozilla:dist:include:");
InstallFromManifest(":mozilla:cmd:macfe:pch:MANIFEST", ":mozilla:dist:include:");
#MAC_COMMON
InstallFromManifest(":mozilla:build:mac:MANIFEST", ":mozilla:dist:mac:common:");
InstallFromManifest(":mozilla:lib:mac:NSStdLib:include:MANIFEST", ":mozilla:dist:mac:common:");
InstallFromManifest(":mozilla:lib:mac:MacMemoryAllocator:include:MANIFEST", ":mozilla:dist:mac:common:");
InstallFromManifest(":mozilla:lib:mac:Misc:MANIFEST", ":mozilla:dist:mac:common:");
InstallFromManifest(":mozilla:lib:mac:MoreFiles:MANIFEST", ":mozilla:dist:mac:common:morefiles:");
InstallFromManifest(":mozilla:cmd:macfe:MANIFEST", ":mozilla:dist:mac:macfe:");
#NSPR
InstallFromManifest(":mozilla:nsprpub:pr:include:MANIFEST", ":mozilla:dist:nspr:");
InstallFromManifest(":mozilla:nsprpub:pr:src:md:mac:MANIFEST", ":mozilla:dist:nspr:mac:");
InstallFromManifest(":mozilla:nsprpub:lib:ds:MANIFEST", ":mozilla:dist:nspr:");
InstallFromManifest(":mozilla:nsprpub:lib:libc:include:MANIFEST", ":mozilla:dist:nspr:");
InstallFromManifest(":mozilla:nsprpub:lib:msgc:include:MANIFEST", ":mozilla:dist:nspr:");
#DBM
InstallFromManifest(":mozilla:dbm:include:MANIFEST", ":mozilla:dist:dbm:");
#LIBIMAGE
InstallFromManifest(":mozilla:modules:libimg:png:MANIFEST", ":mozilla:dist:libimg:");
InstallFromManifest(":mozilla:modules:libimg:src:MANIFEST", ":mozilla:dist:libimg:");
InstallFromManifest(":mozilla:modules:libimg:public:MANIFEST", ":mozilla:dist:libimg:");
#SECURITY_freenav
InstallFromManifest(":mozilla:modules:security:freenav:MANIFEST", ":mozilla:dist:security:");
#XPCOM
InstallFromManifest(":mozilla:xpcom:src:MANIFEST", ":mozilla:dist:xpcom:");
#ZLIB
InstallFromManifest(":mozilla:modules:zlib:src:MANIFEST", ":mozilla:dist:zlib:");
#JPEG
InstallFromManifest(":mozilla:jpeg:MANIFEST", ":mozilla:dist:jpeg:");
#JSJ
InstallFromManifest(":mozilla:js:jsj:MANIFEST", ":mozilla:dist:jsj:");
#JSDEBUG
InstallFromManifest(":mozilla:js:jsd:MANIFEST", ":mozilla:dist:jsdebug:");
#JS
InstallFromManifest(":mozilla:js:src:MANIFEST", ":mozilla:dist:js:");
#RDF
InstallFromManifest(":mozilla:modules:rdf:include:MANIFEST", ":mozilla:dist:rdf:");
#XML
InstallFromManifest(":mozilla:modules:xml:glue:MANIFEST", ":mozilla:dist:xml:");
InstallFromManifest(":mozilla:modules:xml:expat:xmlparse:MANIFEST", ":mozilla:dist:xml:");
#LIBFONT
InstallFromManifest(":mozilla:modules:libfont:MANIFEST", ":mozilla:dist:libfont:");
InstallFromManifest(":mozilla:modules:libfont:src:MANIFEST", ":mozilla:dist:libfont:");
#LDAP
if ( $main::MOZ_LDAP || $main::MOZ_DARK )
{
InstallFromManifest(":mozilla:directory:c-sdk:ldap:include:MANIFEST", ":mozilla:dist:ldap:");
}
#SCHEDULER
InstallFromManifest(":mozilla:modules:schedulr:public:MANIFEST", ":mozilla:dist:schedulr:");
#NETWORK
InstallFromManifest(":mozilla:network:cache:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:client:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:cnvts:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:cstream:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:main:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:mimetype:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:util:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:about:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:certld:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:dataurl:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:file:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:ftp:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:gopher:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:http:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:js:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:mailbox:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:marimba:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:nntp:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:pop3:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:remote:MANIFEST", ":mozilla:dist:network:");
InstallFromManifest(":mozilla:network:protocol:smtp:MANIFEST", ":mozilla:dist:network:");
#HTML_DIALOGS
InstallFromManifest(":mozilla:lib:htmldlgs:MANIFEST", ":mozilla:dist:htmldlgs:");
#LAYOUT
InstallFromManifest(":mozilla:lib:layout:MANIFEST", ":mozilla:dist:layout:");
#LAYERS
InstallFromManifest(":mozilla:lib:liblayer:include:MANIFEST", ":mozilla:dist:layers:");
#PARSE
InstallFromManifest(":mozilla:lib:libparse:MANIFEST", ":mozilla:dist:libparse:");
#STYLE
InstallFromManifest(":mozilla:lib:libstyle:MANIFEST", ":mozilla:dist:libstyle:");
#PLUGIN
InstallFromManifest(":mozilla:lib:plugin:MANIFEST", ":mozilla:dist:plugin:");
#LIBHOOK
InstallFromManifest(":mozilla:modules:libhook:public:MANIFEST", ":mozilla:dist:libhook:");
#LIBPREF
InstallFromManifest(":mozilla:modules:libpref:public:MANIFEST", ":mozilla:dist:libpref:");
#LIBREG
InstallFromManifest(":mozilla:modules:libreg:include:MANIFEST", ":mozilla:dist:libreg:");
#LIBUTIL
InstallFromManifest(":mozilla:modules:libutil:public:MANIFEST", ":mozilla:dist:libutil:");
#PROGRESS
InstallFromManifest(":mozilla:modules:progress:public:MANIFEST", ":mozilla:dist:progress:");
#EDTPLUG
InstallFromManifest(":mozilla:modules:edtplug:include:MANIFEST", ":mozilla:dist:edtplug:");
#NAV_JAVA
InstallFromManifest(":mozilla:nav-java:stubs:include:MANIFEST", ":mozilla:dist:nav-java:");
InstallFromManifest(":mozilla:nav-java:stubs:macjri:MANIFEST", ":mozilla:dist:nav-java:");
#SUN_JAVA
InstallFromManifest(":mozilla:sun-java:stubs:include:MANIFEST", ":mozilla:dist:sun-java:");
InstallFromManifest(":mozilla:sun-java:stubs:macjri:MANIFEST", ":mozilla:dist:sun-java:");
}
1;

View File

@@ -0,0 +1,143 @@
#!perl
package BuildListObsolete;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(BuildMozilla);
=head1 NAME
BuildList - build the [ordered] set of projects needed to construct Mozilla
=head1 SYNOPSIS
...
=head1 COPYRIGHT
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.
=cut
sub BuildMozilla()
{
use Moz;
chdir(":::"); # assuming this script is in "...:mozilla:build:mac:", change dir to just inside "mozilla"
if ( $main::DEBUG )
{
$D = " (Debug)";
$LibD = "Debug";
$dist_dir = ":dist:client_debug:";
}
else
{
$D = "";
$LibD = "";
$dist_dir = ":dist:client:";
}
#
# Build the appropriate target of each project
#
BuildProjectClean(":lib:mac:NSStdLib:NSStdLib.mcp", "Stub Library");
BuildProjectClean(":lib:mac:MacMemoryAllocator:MemAllocator.mcp", "Stub Library");
BuildProjectClean(":cmd:macfe:projects:client:Navigator.mcp", "Stub Library");
BuildProject(":lib:mac:NSRuntime:NSRuntime.mcp");
MakeAlias(":lib:mac:NSRuntime:NSRuntimePPCLib", "$dist_dir");
BuildProject(":cmd:macfe:restext:NavStringLibPPC.mcp");
MakeAlias(":cmd:macfe:restext:StringsPPCLib", "$dist_dir");
BuildProject(":lib:mac:MoreFiles:build:MoreFilesPPC.prj");
MakeAlias(":lib:mac:MoreFiles:build:MoreFilesPPC.lib", "$dist_dir");
BuildProject(":nsprpub:macbuild:NSPR20PPC".$LibD.".mcp");
MakeAlias(":nsprpub:macbuild:NSPR20PPC".$LibD."Lib", "$dist_dir");
BuildProject(":dbm:macbuild:DBMPPC".$LibD.".mcp");
MakeAlias(":dbm:macbuild:DBMPPC".$LibD."Lib", "${dist_dir}");
BuildProject(":lib:mac:MacMemoryAllocator:MemAllocator.mcp", "PPC Shared Library$D");
MakeAlias(":lib:mac:MacMemoryAllocator:MemAllocatorPPC".$LibD."Lib", "$dist_dir");
BuildProject(":lib:mac:NSStdLib:NSStdLib.mcp", "PPC Shared Library");
MakeAlias(":lib:mac:NSStdLib:NSStdLibPPCLib", "$dist_dir");
BuildProject(":modules:security:freenav:macbuild:NoSecurity.mcp", "PPC Shared Library$D");
MakeAlias(":modules:security:freenav:macbuild:NoSecurity".$LibD."Lib", "$dist_dir");
BuildProject(":xpcom:macbuild:xpcomPPC".$LibD.".mcp");
MakeAlias(":xpcom:macbuild:xpcomPPC".$LibD."Lib", "$dist_dir");
BuildProject(":lib:mac:PowerPlant:PowerPlant.mcp");
MakeAlias(":lib:mac:PowerPlant:PowerPlantPPC".$LibD."Lib", "$dist_dir");
BuildProject(":modules:zlib:macbuild:zlib.mcp", "PPC Shared Library$D");
MakeAlias(":modules:zlib:macbuild:zlibPPC".$LibD."Lib", "$dist_dir");
BuildProject(":jpeg:macbuild:JPEG.mcp", "PPC Shared Library$D");
MakeAlias(":jpeg:macbuild:JPEGPPC".$LibD."Lib", "$dist_dir");
BuildProject(":sun-java:stubs:macbuild:JavaStubs.mcp", "PPC Shared Library$D");
MakeAlias(":sun-java:stubs:macbuild:JavaRuntimePPC".$LibD."Lib", "$dist_dir");
BuildProject(":js:jsj:macbuild:JSJ_PPC".$LibD.".mcp");
BuildProject(":js:macbuild:JavaScriptPPC".$LibD.".mcp");
MakeAlias(":js:macbuild:JavaScriptPPC".$LibD."Lib", "$dist_dir");
BuildProject(":nav-java:stubs:macbuild:NavJavaStubs.mcp", "PPC Shared Library$D");
MakeAlias(":nav-java:stubs:macbuild:NavJavaPPC".$LibD."Lib", "$dist_dir");
if ( $main::DEBUG )
{
BuildProject(":modules:rdf:macbuild:RDF.mcp", "PPC Shared Library +D -LDAP");
MakeAlias(":modules:rdf:macbuild:RDFPPCDebugLib", "${dist_dir}");
}
else
{
Moz::BuildProject(":modules:rdf:macbuild:RDF.mcp", "PPC Shared Library -LDAP");
MakeAlias(":modules:rdf:macbuild:RDFPPCLib", "${dist_dir}");
}
BuildProject(":modules:xml:macbuild:XML.mcp", "PPC Shared Library$D");
MakeAlias(":modules:xml:macbuild:XMLPPC".$LibD."Lib", "$dist_dir");
BuildProject(":modules:libfont:macbuild:FontBroker.mcp", "PPC Library$D");
BuildProject(":modules:schedulr:macbuild:Schedulr.mcp", "PPC Shared Library$D");
MakeAlias(":modules:schedulr:macbuild:Schedulr".$LibD."PPCLib", "$dist_dir");
BuildProject(":network:macbuild:network.mcp", "PPC Library (Debug Moz)");
if ( $main::MOZ_LITE == 0 )
{
BuildProject(":cmd:macfe:Composer:build:Composer.mcp", "PPC Library$D");
}
BuildProject(":cmd:macfe:projects:client:Navigator.mcp", "Moz PPC App$D");
}
1;

View File

@@ -0,0 +1,40 @@
#!perl
#
# 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.
#
use Moz;
use BuildList;
$DEBUG = 0;
# One of them should be 1. This will come from a config file at some stage.
# In the meanwhile, it should match mozilla/config/mac/MacConfig.h
$MOZ_LITE = 0;
$MOZ_MEDIUM = 1;
$MOZ_DARK = 0;
Moz::OpenErrorLog(":::Mozilla.BuildLog");
Moz::StopForErrors();
chdir("::::");
# Make and popuplate the dist directory
DistMozilla();
# Now build the projects
BuildMozilla();

View File

@@ -0,0 +1,124 @@
#!perl
package BuildMozilla;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(BuildMozilla);
=head1 NAME
BuildMozilla - build the [ordered] set of projects needed to construct Mozilla
=head1 COPYRIGHT
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.
=cut
sub BuildMozilla()
{
use Moz;
chdir("::::"); # assuming this script is in "...:mozilla:build:mac:", change dir to just above "mozilla"
# Ideally, we would set the target name like so:
# $target = $main::DEBUG ? "debug" : "optimized";
# ...and all projects would have corresponding targets
$D = $main::DEBUG ? " (Debug)" : ""; # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
#
# Build the appropriate target of each project
#
Moz::BuildProject(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "Stub Library");
Moz::BuildProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "Stub Library");
Moz::BuildProject(":mozilla:cmd:macfe:projects:client:Navigator.mcp", "Stub Library");
Moz::BuildProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp");
Moz::BuildProject(":mozilla:cmd:macfe:restext:NavStringLibPPC.mcp");
Moz::BuildProject(":mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.prj");
if ( $main::DEBUG )
{
Moz::BuildProject(":mozilla:nsprpub:macbuild:NSPR20PPCDebug.mcp");
Moz::BuildProject(":mozilla:dbm:macbuild:DBMPPCDebug.mcp");
}
else
{
Moz::BuildProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp");
Moz::BuildProject(":mozilla:dbm:macbuild:DBMPPC.mcp");
}
Moz::BuildProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "PPC Shared Library$D");
Moz::BuildProject(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "PPC Shared Library");
Moz::BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "PPC Shared Library$D");
if ( $main::DEBUG )
{
Moz::BuildProject(":mozilla:xpcom:macbuild:xpcomPPCDebug.mcp");
}
else
{
Moz::BuildProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp");
}
Moz::BuildProject(":mozilla:lib:mac:PowerPlant:PowerPlant.mcp");
Moz::BuildProject(":mozilla:modules:zlib:macbuild:zlib.mcp", "PPC Shared Library$D");
Moz::BuildProject(":mozilla:jpeg:macbuild:JPEG.mcp", "PPC Shared Library$D");
Moz::BuildProject(":mozilla:sun-java:stubs:macbuild:JavaStubs.mcp", "PPC Shared Library$D");
if ( $main::DEBUG )
{
Moz::BuildProject(":mozilla:js:jsj:macbuild:JSJ_PPCDebug.mcp");
Moz::BuildProject(":mozilla:js:macbuild:JavaScriptPPCDebug.mcp");
}
else
{
Moz::BuildProject(":mozilla:js:jsj:macbuild:JSJ_PPC.mcp");
Moz::BuildProject(":mozilla:js:macbuild:JavaScriptPPC.mcp");
}
Moz::BuildProject(":mozilla:nav-java:stubs:macbuild:NavJavaStubs.mcp", "PPC Shared Library$D");
# the following `if' can be fixed when we either rename the debug target of the RDF project, or of all the other projects
if ( $main::DEBUG )
{
Moz::BuildProject(":mozilla:modules:rdf:macbuild:RDF.mcp", "PPC Shared Library +D -LDAP");
}
else
{
Moz::BuildProject(":mozilla:modules:rdf:macbuild:RDF.mcp", "PPC Shared Library -LDAP");
}
Moz::BuildProject(":mozilla:modules:xml:macbuild:XML.mcp", "PPC Shared Library$D");
Moz::BuildProject(":mozilla:modules:libfont:macbuild:FontBroker.mcp", "PPC Library$D");
Moz::BuildProject(":mozilla:modules:schedulr:macbuild:Schedulr.mcp", "PPC Shared Library$D");
Moz::BuildProject(":mozilla:network:macbuild:network.mcp", "PPC Library (Debug Moz)");
Moz::BuildProject(":mozilla:cmd:macfe:Composer:build:Composer.mcp", "PPC Library$D");
Moz::BuildProject(":mozilla:cmd:macfe:projects:client:Navigator.mcp", "Moz PPC App$D");
}
1;

View File

@@ -0,0 +1,40 @@
#!perl
#
# 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.
#
use Moz;
use BuildList;
$DEBUG = 1;
# One of them should be 1. This will come from a config file at some stage.
# In the meanwhile, it should match mozilla/config/mac/MacConfig.h
$MOZ_LITE = 0;
$MOZ_MEDIUM = 1;
$MOZ_DARK = 0;
Moz::OpenErrorLog(":::Mozilla.BuildLog");
Moz::StopForErrors();
chdir("::::");
# Make and popuplate the dist directory
DistMozilla();
# Now build the projects
BuildMozilla();

View File

@@ -0,0 +1,128 @@
#!perl
#
# 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.
#
#
# nglayout build script (debug)
#
use NGLayoutBuildList;
use Cwd;
use Moz;
# configuration variables
$DEBUG = 1;
$pull{all} = 0;
$pull{lizard} = 0;
$pull{xpcom} = 0;
$pull{imglib} = 0;
$pull{netlib} = 0;
$pull{nglayout} = 0;
$pull{mac} = 0;
$build{all} = 0;
$build{dist} = 0;
$build{common}= 0;
$build{nglayout}= 0;
#
# UI
#
@choices = ("pull_and_build_all",
"pull_all",
"build_all",
"pull_nglayout",
"build_dist",
"build_projects");
#damn, this does not work on
if (0)
{
while (GetFrontProcess () != GetCurrentProcess())
{
SetFrontProcess( GetCurrentProcess() );
}
@pick = MacPerl::Pick("What would you like to do?", @choices);
$pull{all} = 0;
$build{all} = 1;
foreach $i (@pick)
{
if ($i eq "pull_and_build_all")
{
$pull{all} = 1;
$build{all} = 1;
}
elsif ($i eq "pull_all")
{
$pull{all} = 1;
}
elsif ($i eq "build_all")
{
$build{all} = 1;
}
elsif ($i eq "build_dist")
{
$build{dist} = 1;
}
elsif ($i eq "build_projects")
{
$build{projects} = 1;
}
}
}
else
{
$pull{all} = 1;
$build{all} = 1;
# $pull{netlib} = 1;
# $pull{nglayout} = 1;
# $build{common} = 1;
# $build{nglayout} = 1;
# $build{dist} = 1;
# $pull{nglayout} = 1;
}
if ($pull{all})
{
foreach $k (keys(%pull))
{
$pull{$k} = 1;
}
}
if ($build{all})
{
foreach $k (keys(%build))
{
$build{$k} = 1;
}
}
# do the work
# you should not have to edit anything bellow
chdir("::::");
$MOZ_SRC = cwd();
Moz::StopForErrors();
#Moz::DontStopForErrors();
OpenErrorLog("::NGLayoutBuildLog");
Checkout();
chdir($MOZ_SRC);
BuildDist();
chdir($MOZ_SRC);
BuildProjects();
print "Build layout complete\n";

Binary file not shown.

View File

@@ -0,0 +1,78 @@
#
# 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.
#
if {#} != 1
echo "CopyExports requires 1 parameters:"
echo "Parameter 1: path relative to {SourceRootDir} of the file which contains"
echo " the list of files to be copied, one per line. This path"
echo " may not begin with a colon"
echo
Exit 1
end if
Set SourceList "{SourceRootDir}{1}"
Set ScriptsDir "{SourceRootDir}mozilla:build:mac:"
#set sourceList "{SourceRootDir}mozilla:{1}"
if {verbose}
echo "Source list is in file ¶"{SourceList}¶""
echo "Scripts directory is ¶"{ScriptsDir}¶""
end if
# for each line in the source file, remove it if it starts with #, otherwise quote it
for curLine in `streamedit "{sourceList}" -e '/¥#Å/ Delete; /¥/ Replace /(Å)¨1/ "¶""¨1"¶""'`
echo "{curLine}"
# ignore empty lines
if `evaluate "{{curLine}}" != ""`
echo "{curLine}"
# strip out trailing comments
if `evaluate "{curLine}" =~ /(Å)¨1[ ¶t]+(#Å)¨2/`
set sourceLine "{¨1}"
# echo "Discarding comment {¨2}"
else
set sourceLine "{curLine}"
end if
if `evaluate "{sourceLine}" =~ /([Â ¶t]+)¨1[ ¶t]+[:]*(Å)¨2/`
if {verbose}
echo "Cur line is {sourceLine}"
end if
set exportFile "{¨1}"
set theTarget "{¨2}"
if {verbose}
echo "Export file name is {exportFile}"
echo "Target directory is {theTarget}"
end if
"{ScriptsDir}CopyList.script" "{exportFile}" "{theTarget}"
end if
end if
end for

View File

@@ -0,0 +1,81 @@
#
# 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 controlling script for a set of scripts that copy public
# header files in one or more source trees into a single, "dist" directory.
#
# It relies on the two accompanying scripts, ÒCopyList.scriptÓ and
# ÒCopyExports.scriptÓ, which must be in the same directory.
#
# To execute this script, select everything from "# Get the..." to
# " the end" and hit the Enter key.
#
# Known bugs:
# Header files are always copied if the export.mac file contains
# non-local paths.
# Spurious output is produced even when verbose is off.
#
# Uncomment this to get some progress information
# set -e verbose 1
# Get the root of everything
set magicfilepath "{systempfolder}filepath" # Temporary items folder, "filepath"
if !`Exists "{{magicFilePath}}"`
Echo "No file path file seems to have been created in the temporary items folder."
Echo "Was this script executed from the perl script? That's the way it was designed."
Exit 1
end if
set myDirectory "`catenate "{{magicFilePath}}"`"
delete -i "{{magicFilePath}}"
Set SourceList "{myDirectory}{1}"
(Evaluate "{myDirectory}" =~ /(Å:)¨1[Â:]+:[Â:]+:[Â:]+/) #·· dev:null
Set -e mozillaDir "{¨1}"
if !`Exists "{{mozillaDir}}"`
Echo "A file path was passed, but it doesn't seem to be the mozilla directory."
Exit 1
end if
echo "Mozilla directory found at {mozillaDir}"
#Calculate the root directory by stripping off the leaf name.
(Evaluate "{mozillaDir}" =~ /(Å:)¨1([Â:]+)¨2/) #·· dev:null
Set -e SourceRootDir "{¨1}"
Set -e DestRootDir "{mozillaDir}dist:"
# Ensure the build and stubs folders exist
if !`exists -d "{mozillaDir}dist"`
newfolder "{mozillaDir}dist"
end if
if !`exists -d "{mozillaDir}dist:client"`
newfolder "{mozillaDir}dist:client"
end if
if !`exists -d "{mozillaDir}dist:client_debug"`
newfolder "{mozillaDir}dist:client_debug"
end if
if !`exists -d "{mozillaDir}dist:client_stubs"`
newfolder "{mozillaDir}dist:client_stubs"
end if
"{SourceRootDir}mozilla:build:mac:CopyExports.script" "mozilla:build:mac:MacExportListPublic"
# the end

View File

@@ -0,0 +1,97 @@
#
# 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.
#
if {#} != 2
echo "CopyList requires 2 parameters:"
echo "Parameter 1: path relative to {SourceRootDir} of the file which contains"
echo " the list of files to be copied, one per line. This path"
echo " may not begin with a colon"
echo
echo "Parameter 2: path relative to {DestRootDir} of the directory where all the"
echo " files are to be copied. No initial colons!"
echo
Exit 1
end if
set debugEcho "" # This setting will actually duplicate the files
#set debugEcho "echo" # This setting will merely print the "duplicate" commands.
set sourceList "{SourceRootDir}{1}"
set targetDir "{DestRootDir}{2}"
# targetDir may not end in a colon for this script to work.
if `Evaluate "{targetDir}" =~ /(Å)¨1:/`
#echo "Removed a colon"
set targetDir "{¨1}"
end if
#Ensure the target hierarchy exists
# Volume name
(Evaluate "{TargetDir}" =~ /([Â:]+)¨1:Å/) ·· dev:null
Set PartialPath "{¨1}"
Loop
(Evaluate "{TargetDir}" =~ /("{PartialPath}":[Â:]+)¨1([:]*)¨2Å/) ·· dev:null
Set PartialPath "{¨1}"
Set Exit 0
(NewFolder "{PartialPath}") ·· dev:null
Set Exit 1
break if "{¨2}" == ""
End Loop
#Calculate the source directory by stripping off the leaf name.
(Evaluate "{SourceList}" =~ /(Å:)¨1([Â:]+)¨2/) #·· dev:null
Set SourceDir "{¨1}"
if {verbose}
echo "Source list is in file ¶"{sourceList}¶""
echo "Source directory is ¶"{SourceDir}¶""
echo "Target directory is ¶"{targetDir}¶""
end if
# Strip all comment lines, pipe the stripped lines into the "for" loop.
# We quote each whole line here so that we deal with a line at a time in the
# for loop. Don't ya just love MPW quoting rulesÉ
for f in `streamedit "{sourceList}" -e '/¥#Å/ Delete; /¥/ Replace /(Å)¨1/ "¶""¨1"¶""'`
if `evaluate "{{f}}" != ""`
# strip out trailing comments (in fact, anything following whitespace)
if `evaluate "{f}" =~ /([Â ¶t]+)¨1[ ¶t]+([#]*Å)¨2/`
set sourceFile "{¨1}"
# echo "Discarding comment {¨2}"
else
set sourceFile "{f}"
end if
# sourceFile can be a relative path, so need to get the file name for date comparisons
if `evaluate "{sourceFile}" =~ /Å:([Â:]+)¨1/`
set filename "{¨1}"
else
set filename "{sourceFile}"
end if
# now copy the file if newer
if "`Newer "{sourceDir}{sourceFile}" "{targetDir}:{filename}"`" #|| !`Exists "{targetDir}:{filename}"`
if {verbose} ; echo "{sourceDir}{sourceFile} is newer than {targetDir}:{filename}" ; end if
#{debugEcho} duplicate -y "{sourceDir}{sourceFile}" "{targetDir}"
{debugEcho} newalias "{sourceDir}{sourceFile}" "{targetDir}:{filename}"
end if
end if
end for

View File

@@ -0,0 +1,4 @@
/* This library only exists to provide a dummy library for the final project */
/* There is nothing to do here. */

Binary file not shown.

View File

@@ -0,0 +1,69 @@
#
# 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 controlling script for a set of scripts that copy public
# header files in one or more source trees into a single, "dist" directory.
#
# It relies on the two accompanying scripts, ÒCopyList.scriptÓ and
# ÒCopyExports.scriptÓ, which must be in the same directory.
#
# To execute this script, select everything from "# Get the..." to
# " the end" and hit the Enter key.
#
# Known bugs:
# Spurious output is produced even when verbose is off.
#
# Uncomment this to get some progress information
# set -e verbose 1
# Get the root of everything
set moz ""
loop
set mozillaDir `GetFileName -d -m "Please select the ÒmozillaÓ directory"`
#set SourceRootDir
(Evaluate "{mozillaDir}" =~ /(Å:)¨1([Â:]+)¨2:/) #·· dev:null
set moz "{¨2}"
break if "{moz}" == "mozilla"
Alert "Sorry, this only works if you select the folder called ÒmozillaÓ."
end loop
#Calculate the root directory by stripping off the leaf name.
(Evaluate "{mozillaDir}" =~ /(Å:)¨1([Â:]+)¨2/) #·· dev:null
Set -e SourceRootDir "{¨1}"
Set -e DestRootDir "{mozillaDir}dist:"
# Ensure the build and stubs folders exist
if !`exists -d "{mozillaDir}dist"`
newfolder "{mozillaDir}dist"
end if
if !`exists -d "{mozillaDir}dist:client"`
newfolder "{mozillaDir}dist:client"
end if
if !`exists -d "{mozillaDir}dist:client_debug"`
newfolder "{mozillaDir}dist:client_debug"
end if
if !`exists -d "{mozillaDir}dist:client_stubs"`
newfolder "{mozillaDir}dist:client_stubs"
end if
"{SourceRootDir}mozilla:build:mac:CopyExports.script" "mozilla:build:mac:MacExportListPublic"
# the end

View File

@@ -0,0 +1,94 @@
/* -*- 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 file overrides all option settings in the IDE. It is an attempt to allow all builds
to have the same options.
Note: We can't use ConditionalMacros.h in this file because it will conflict with
the PowerPlant precompiled headers.
*/
/* warning pragmas */
#pragma warn_hidevirtual on
#pragma warn_emptydecl on
#pragma warn_unusedvar on
#pragma warn_extracomma on
#pragma warn_illpragma on
#pragma warn_possunwant on
#pragma warn_unusedarg off /* turned off to reduce warnings */
#pragma check_header_flags on
/* Language features that must be the same across libraries... */
#pragma enumsalwaysint on
#pragma unsigned_char off
#pragma exceptions on
#pragma bool on
/* Save as much space as possible with strings... */
#pragma pool_strings on
#pragma dont_reuse_strings off
#pragma options align=native
#pragma sym on /* Takes no memory. OK in non-debug. */
#ifdef powerc /* ...generating PowerPC */
#pragma toc_data on
#pragma fp_contract on
#pragma readonly_strings on
#ifdef DEBUG
#pragma traceback on
#pragma global_optimizer off
#pragma scheduling off
#pragma peephole off
#pragma optimize_for_size off
#else
#pragma traceback off
#pragma global_optimizer on
#pragma optimization_level 4
#pragma scheduling 604
#pragma peephole on
#pragma optimize_for_size on
#endif
#else /* ...generating 68k */
#pragma code68020 on
#pragma code68881 off
/* Far everything... */
#pragma far_code
#pragma far_data on
#pragma far_strings on
#pragma far_vtables on
#pragma fourbyteints on /* 4-byte ints */
#pragma IEEEdoubles on /* 8-byte doubles (as required by Java and NSPR) */
#ifdef DEBUG
#pragma macsbug on
#pragma oldstyle_symbols off
#else
#pragma macsbug off
#endif
#endif

View File

@@ -0,0 +1,5 @@
#
# This is a list of local files which get copied to the mozilla:dist directory
#
IDE_Options.h

198
mozilla/build/mac/MacCVS.pm Normal file
View File

@@ -0,0 +1,198 @@
#!perl -w
package MacCVS;
# package Mac::Apps::MacCVS; this should really be the name of the package
# but due to our directory hierarchy in mozilla, I am not doing it
require 5.004;
require Exporter;
use strict;
use vars qw($VERSION @ISA @EXPORT $MacCVSLib);
use Mac::StandardFile;
use Moz;
use Cwd;
use Exporter;
use File::Basename;
@ISA = qw(Exporter);
@EXPORT = qw( new print checkout);
$VERSION = "1.00";
# Architecture:
# cvs session object:
# name - session name
# session_file - session file
#
# globals
# $MacCVSLib - location of MacCVS applescript library
#
#
#
# utility routines
#
# just like Mac::DoAppleScript, 1 is success, 0 is failure
sub _myDoAppleScript($)
{
my($script) = @_;
my $asresult = MacPerl::DoAppleScript($script);
if ($asresult eq "0")
{
return 1;
}
else
{
print STDERR "AppleScript error: $asresult\n";
print STDERR "AppleScript was: \n $script \n";
return 0;
}
}
# _useMacCVSLib
# returns 1 on success
# Search the include path for the file called MacCVSLib
sub _useMacCVSLib()
{
unless ( defined($MacCVSLib) )
{
my($libname) = "MacCVSLib";
# try the directory we were run from
my($c) = dirname($0) . ":" . $libname;
if ( -e $c)
{
$MacCVSLib = $c;
}
else
{
# now search the include directories
foreach (@INC)
{
unless ( m/^Dev:Pseudo/ ) # This is some bizarre MacPerl special-case directory
{
$c = $_ . $libname;
if (-e $c)
{
$MacCVSLib = $c;
last;
}
}
}
}
if (! (-e $MacCVSLib))
{
print STDERR "MacCVS lib could not be found! $MacCVSLib";
return 0;
}
}
return 1;
}
#
# Session object methods
#
sub new {
my ( $proto, $session_file) = @_;
my $class = ref($proto) || $proto;
my $self = {};
if ( defined($session_file) && ( -e $session_file) )
{
$self->{"name"} = basename( $session_file );
$self->{"session_file"} = $session_file;
bless $self, $class;
return $self;
}
else
{
print STDERR "MacCVS->new cvs file < $session_file > does not exist\n";
return;
}
}
# makes sure that the session is open
# assertSessionOpen()
# returns 1 on failure
sub assertSessionOpen() {
my ($self) = shift;
_useMacCVSLib() || die "Could not load MacCVSLib\n";
my $script = <<END_OF_APPLESCRIPT;
tell (load script file "$MacCVSLib") to OpenSession("$self->{session_file}")
END_OF_APPLESCRIPT
return _myDoAppleScript($script);
}
# prints the cvs object, used mostly for debugging
sub print {
my($self) = shift;
print "MacCVS:: name: ", $self->{name}, " session file: ", $self->{session_file}, "\n";
}
# checkout( self, module, revision, date)
# MacCVS checkout command
# returns 1 on failure
sub checkout {
my($self, $module, $revision, $date ) = @_;
unless( defined ($module) ) { $module = ""; } # get rid of the pesky undefined warnings
unless( defined ($revision) ) { $revision = ""; }
unless( defined ($date) ) { $date = ""; }
$self->assertSessionOpen() || return 1;
my $script = <<END_OF_APPLESCRIPT;
tell (load script file "$MacCVSLib") to Checkout given sessionName:"$self->{name}", module:"$module", revision:"$revision", date:"$date"
END_OF_APPLESCRIPT
return _myDoAppleScript($script);
}
1;
=pod
=head1 NAME
MacCVS - Interface to MacCVS
=head1 SYNOPSIS
use MacCVS;
$session = MacCVS->new( <session_file_path>) || die "cannot create session";
$session->checkout([module] [revision] [date]) || die "Could not check out";
=head1 DESCRIPTION
This is a MacCVS interface for talking to MacCVS Pro client.
MacCVSSession is the class used to manipulate the session
=item new
MacCVS->new( <cvs session file path>);
Creates a new session. Returns undef on failure.
=item checkout( <module> [revision] [date] )
cvs checkout command. Revision and date are optional
returns 0 on failure
=cut
=head1 SEE ALSO
=over
=item MacCVS Home Page
http://www.maccvs.org/
=back
=head1 AUTHORS
Aleks Totic atotic@netscape.com
=cut
__END__

BIN
mozilla/build/mac/MacCVSLib Normal file

Binary file not shown.

View File

@@ -0,0 +1,159 @@
#
# 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 a list of paths to export.mac files, and destination
# directories for the copied headers. Destinations are relative
# to "mozilla:dist".
###################
# PUBLIC TREE
###################
# LDAP
mozilla:directory:c-sdk:ldap:include:MANIFEST :ldap
#INCLUDE
mozilla:config:mac:export.mac :config
mozilla:include:export.mac :include
mozilla:cmd:macfe:pch:export.mac :include
#MAC_COMMON
mozilla:build:mac:export.mac :mac:common
mozilla:lib:mac:NSStdLib:include:export.mac :mac:common
mozilla:lib:mac:MacMemoryAllocator:include:export.mac :mac:common
mozilla:lib:mac:Misc:export.mac :mac:common
mozilla:lib:mac:MoreFiles:export.mac :mac:common:morefiles
mozilla:cmd:macfe:export.mac :mac:macfe
#NSPR
mozilla:nsprpub:pr:include:export.mac :nspr
mozilla:nsprpub:pr:src:md:mac:export.mac :nspr:mac
mozilla:nsprpub:lib:ds:export.mac :nspr
mozilla:nsprpub:lib:libc:include:export.mac :nspr
mozilla:nsprpub:lib:msgc:include:export.mac :nspr
#DBM
mozilla:dbm:include:export.mac :dbm
#LIBIMAGE
mozilla:modules:libimg:png:export.mac :libimg
mozilla:modules:libimg:src:export.mac :libimg
mozilla:modules:libimg:public:export.mac :libimg
#SECURITY_freenav
mozilla:modules:security:freenav:export.mac :security
#XPCOM
mozilla:xpcom:src:export.mac :xpcom
#ZLIB
mozilla:modules:zlib:src:export.mac :zlib
#JPEG
mozilla:jpeg:export.mac :jpeg
#JSJ
mozilla:js:jsj:export.mac :jsj
#JSDEBUG
mozilla:js:jsd:export.mac :jsdebug
#JS
mozilla:js:src:export.mac :js
#RDF
mozilla:modules:rdf:include:export.mac :rdf
#XML
mozilla:modules:xml:glue:export.mac :xml
mozilla:modules:xml:expat:xmlparse:export.mac :xml
#LIBFONT
mozilla:modules:libfont:public:export.mac :libfont
mozilla:modules:libfont:src:export.mac :libfont
#SCHEDULER
mozilla:modules:schedulr:public:export.mac :schedulr
#NETWORK
#This stuff is all in libnet on the branch.
#mozilla:network:cache:export.mac :network
#mozilla:network:client:export.mac :network
#mozilla:network:cnvts:export.mac :network
#mozilla:network:cstream:export.mac :network
#mozilla:network:main:export.mac :network
#ozilla:network:protocol:about:export.mac :network
#mozilla:network:protocol:certld:export.mac :network
#mozilla:network:protocol:dataurl:export.mac :network
#mozilla:network:protocol:file:export.mac :network
#mozilla:network:protocol:ftp:export.mac :network
#mozilla:network:protocol:gopher:export.mac :network
#mozilla:network:protocol:http:export.mac :network
#mozilla:network:protocol:js:export.mac :network
#mozilla:network:protocol:mailbox:export.mac :network
#mozilla:network:protocol:marimba:export.mac :network
#mozilla:network:protocol:nntp:export.mac :network
#mozilla:network:protocol:pop3:export.mac :network
#mozilla:network:protocol:remote:export.mac :network
#mozilla:network:protocol:smtp:export.mac :network
#NORMANDY_BRANCH only
mozilla:lib:libnet:export.mac :libnet
#HTML_DIALOGS
mozilla:lib:htmldlgs:export.mac :htmldlgs
#LAYOUT
mozilla:lib:layout:export.mac :layout
#LAYERS
mozilla:lib:liblayer:include:export.mac :layers
#PARSE
mozilla:lib:libparse:export.mac :libparse
#STYLE
mozilla:lib:libstyle:export.mac :libstyle
#LIBHOOK
mozilla:modules:libhook:public:export.mac :libhook
#LIBPREF
mozilla:modules:libpref:public:export.mac :libpref
#LIBREG
mozilla:modules:libreg:include:export.mac :libreg
#LIBUTIL
mozilla:modules:libutil:public:export.mac :libutil
#OJI
mozilla:modules:oji:src:export.mac :oji
#PROGRESS
mozilla:modules:progress:public:export.mac :progress
#SOFTUPDATE
mozilla:modules:softupdt:include:export.mac :softupdate
#NAV_JAVA
mozilla:nav-java:stubs:macjri:export.mac :nav-java:macjri
mozilla:nav-java:stubs:include:export.mac :nav-java
#SUN_JAVA
mozilla:sun-java:stubs:include:export.mac :sun-java:include
mozilla:sun-java:stubs:macjri:export.mac :sun-java:macjri

Binary file not shown.

373
mozilla/build/mac/Moz.pm Normal file
View File

@@ -0,0 +1,373 @@
=head1 NAME
B<Moz> - routines for automating CodeWarrior builds, and some extra-curricular activities related to building Mozilla
=head1 SYNOPSIS
use Moz;
OpenErrorLog(":::BuildLog");
StopForErrors();
$Moz::QUIET = 1;
InstallFromManifest(":projects:MANIFEST", $dist_dir);
BuildProjectClean(":projects:SomeProject.mcp", "SomeTarget");
MakeAlias(":projects:SomeProject.shlb", $dist_dir);
DontStopForErrors();
BuildProject(":projects:SomeOtherProject.mcp", "SomeTarget");
=head1 DESCRIPTION
B<Moz> comprises the routines needed to slap CodeWarrior around, force it to build a sequence of projects, report the results, and a few other things.
=cut
package Moz;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(BuildProject BuildProjectClean OpenErrorLog MakeAlias StopForErrors DontStopForErrors InstallFromManifest);
@EXPORT_OK = qw(CloseErrorLog UseCodeWarriorLib QUIET);
use Cwd;
use File::Path;
use ExtUtils::Manifest 'maniread';
sub current_directory()
{
my $current_directory = cwd();
chop($current_directory) if ( $current_directory =~ m/:$/ );
return $current_directory;
}
sub full_path_to($)
{
my ($path) = @_;
if ( $path =~ m/^[^:]+$/ )
{
$path = ":" . $path;
}
if ( $path =~ m/^:/ )
{
$path = current_directory() . $path;
}
return $path;
}
=head2 Setup
Pretty much, everything is taken care of for you.
However, B<Moz> does use a little compiled AppleScript library (the file CodeWarriorLib) for some of its communcication with CodeWarrior.
If this library isn't in the same directory as "Moz.pm", then you need to tell B<Moz> where to find it.
Call C<UseCodeWarriorLib($path_to_CodeWarriorLib)>.
This routine is not exported by default, nor are you likely to need it.
=cut
sub UseCodeWarriorLib($)
{
($CodeWarriorLib) = @_;
$CodeWarriorLib = full_path_to($CodeWarriorLib);
}
sub activate_CodeWarrior()
{
MacPerl::DoAppleScript(<<END_OF_APPLESCRIPT);
tell (load script file "$CodeWarriorLib") to ActivateCodeWarrior()
END_OF_APPLESCRIPT
}
BEGIN
{
UseCodeWarriorLib(":CodeWarriorLib");
activate_CodeWarrior();
}
$logging = 0;
$recent_errors_file = "";
$stop_on_1st_error = 1;
$QUIET = 0;
=head2 Logging all the errors and warnings - C<OpenErrorLog($log_file)>, C<CloseErrorLog()>
The warnings and errors generated in the course of building projects can be logged to a file.
Tinderbox uses this facility to show why a remote build failed.
Logging is off by default.
Start logging at any point in your build process with C<OpenErrorLog($log_file)>.
Stop with C<CloseErrorLog()>.
You never need to close the log explicitly, unless you want to just log a couple of projects in the middle of a big list.
C<CloseErrorLog()> is not exported by default.
=cut
sub CloseErrorLog()
{
if ( $logging )
{
close(ERROR_LOG);
$logging = 0;
StopForErrors() if $stop_on_1st_error;
}
}
sub OpenErrorLog($)
{
my ($log_file) = @_;
CloseErrorLog();
if ( $log_file )
{
$log_file = full_path_to($log_file);
open(ERROR_LOG, ">$log_file");
$log_file =~ m/.+:(.+)/;
$recent_errors_file = full_path_to("$1.part");
$logging = 1;
}
}
=head2 Stopping before it's too late - C<StopForErrors()>, C<DontStopForErrors()>
When building a long list of projects, you decide whether to continue building subsequent projects when one fails.
By default, your build script will C<die> after the first project that generates an error while building.
Change this behavior with C<DontStopForErrors()>.
Re-enable it with C<StopForErrors()>.
=cut
sub StopForErrors()
{
$stop_on_1st_error = 1;
# Can't stop for errors unless we notice them.
# Can't notice them unless we are logging.
# If the user didn't explicitly request logging, log to a temporary file.
if ( ! $recent_errors_file )
{
OpenErrorLog("${TMPDIR}BuildResults");
}
}
sub DontStopForErrors()
{
$stop_on_1st_error = 0;
}
sub log_message($)
{
if ( $logging )
{
my ($message) = @_;
print ERROR_LOG $message;
}
}
sub log_message_with_time($)
{
if ( $logging )
{
my ($message) = @_;
my $time_stamp = localtime();
log_message("$message ($time_stamp)\n");
}
}
sub log_recent_errors($)
{
my ($project_name) = @_;
my $found_errors = 0;
if ( $logging )
{
open(RECENT_ERRORS, "<$recent_errors_file");
while( <RECENT_ERRORS> )
{
if ( /^Error/ || /^CouldnÕt find project file/ )
{
$found_errors = 1;
}
print ERROR_LOG $_;
}
close(RECENT_ERRORS);
unlink("$recent_errors_file");
}
if ( $stop_on_1st_error && $found_errors )
{
print ERROR_LOG "### Build failed.\n";
die "### Errors encountered building \"$project_name\".\n";
}
}
sub build_project($$$)
{
my ($project_path, $target_name, $clean_build) = @_;
$project_path = full_path_to($project_path);
$project_path =~ m/.+:(.+)/;
my $project_name = $1;
log_message_with_time("### Building \"$project_path\"");
# Check that the given project exists
if (! -e $project_path)
{
print ERROR_LOG "### Build failed.\n";
die "### Can't find project file \"$project_path\".\n";
}
print "Building \"$project_path\"\n";
$had_errors =
MacPerl::DoAppleScript(<<END_OF_APPLESCRIPT);
tell (load script file "$CodeWarriorLib") to BuildProject("$project_path", "$project_name", "$target_name", "$recent_errors_file", $clean_build)
END_OF_APPLESCRIPT
# Append any errors to the globally accumulated log file
if ( $had_errors )
{
log_recent_errors($project_path);
}
}
=head2 Getting CodeWarrior to build projects - C<BuildProject($project, $opt_target)>, C<BuildProjectClean($project, $opt_target)>
C<BuildProject()> and C<BuildProjectClean()> are identical, except that the latter first removes object code.
In both, CodeWarrior opens the project if it wasn't already open; builds the given (or else current) target; and finally closes
the project, if it wasn't already open.
=cut
sub BuildProject($;$)
{
my ($project_path, $target_name) = @_;
build_project($project_path, $target_name, "false");
}
sub BuildProjectClean($;$)
{
my ($project_path, $target_name) = @_;
build_project($project_path, $target_name, "true");
}
=head2 Miscellaneous
C<MakeAlias($old_file, $new_file)> functions like C<symlink()>, except with better argument defaulting and more explicit error messages.
=cut
sub MakeAlias($$)
{
my ($old_file, $new_file) = @_;
# if the directory to hold $new_file doesn't exist, create it
if ( ($new_file =~ m/(.+:)/) && !-d $1 )
{
mkpath($1);
}
# if a leaf name wasn't specified for $new_file, use the leaf from $old_file
if ( ($new_file =~ m/:$/) && ($old_file =~ m/.+:(.+)/) )
{
$new_file .= $1;
}
my $message = "Can't create a Finder alias (at \"$new_file\")\n for \"$old_file\";";
# die "$message symlink doesn't work on directories.\n" if -d $old_file;
die "$message because \"$old_file\" doesn't exist.\n" unless -e $old_file;
#check if the alias is already pointing to the right direction
my ($aliasto) = readlink($new_file);
my ($full_old_file) = ( $old_file =~ m/^:/ ) ? cwd() . $old_file : $old_file;
unless ($aliasto && ($aliasto eq $full_old_file))
{
unlink $new_file;
# print "symlink(\"$old_file\", \"$new_file\");\n";
symlink($old_file, $new_file) || die "$message symlink returned an unexpected error.\n";
}
}
=pod
C<InstallFromManifest()>
=cut
sub InstallFromManifest($;$)
{
my ($manifest_file, $dest_dir) = @_;
$dest_dir ||= ":";
$manifest_file =~ m/(.+):/;
my $source_dir = $1;
chop($dest_dir) if $dest_dir =~ m/:$/;
print "Doing manifest on \"$manifest_file\"\n" unless $QUIET;
my $read = maniread(full_path_to($manifest_file));
foreach $file (keys %$read)
{
next unless $file;
$subdir = ":";
if ( $file =~ /:.+:/ )
{
$subdir = $&;
}
$file = ":$file" unless $file =~ m/^:/;
MakeAlias("$source_dir$file", "$dest_dir$subdir");
}
}
1;
=head1 AUTHORS
Scott Collins <scc@netscape.com>, Simon Fraser <sfraser@netscape.com>
=head1 SEE ALSO
BuildMozillaDebug.pl (et al), BuildList.pm, CodeWarriorLib (an AppleScript library)
=head1 COPYRIGHT
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.
=cut

View File

@@ -0,0 +1,388 @@
#!perl -w
package NGLayoutBuildList;
require 5.004;
require Exporter;
use strict;
use vars qw( @ISA @EXPORT );
# perl includes
use Mac::StandardFile;
use Mac::Processes;
use Cwd;
use File::Path;
# homegrown
use Moz;
use MacCVS;
@ISA = qw(Exporter);
@EXPORT = qw( Checkout BuildDist BuildProjects BuildCommonProjects BuildLayoutProjects);
# NGLayoutBuildList builds the nglayout project
# it is configured by setting the following variables in the caller:
# Usage:
# caller variables that affect behaviour:
# DEBUG : 1 if we are building a debug version
# 3-part build process: checkout, dist, and build_projects
# Hack alert:
# NGLayout defines are located in :mozilla:config:mac:NGLayoutConfigInclude.h
# An alias "MacConfigInclude.h" to this file is created inside dist:config
# Note that the name of alias is different than the name of the file. This
# is to trick CW into including NGLayout defines
#
# Utility routines
#
# pickWithMemoryFile stores the information about the user pick inside
# the file $session_storage
sub _pickWithMemoryFile($)
{
my ($sessionStorage) = @_;
my $cvsfile;
if (( -e $sessionStorage) &&
open( SESSIONFILE, $sessionStorage ))
{
# Read in the path if available
$cvsfile = <SESSIONFILE>;
chomp $cvsfile;
close SESSIONFILE;
if ( ! -e $cvsfile )
{
print STDERR "$cvsfile has disappeared\n";
undef $cvsfile;
}
}
unless (defined ($cvsfile))
{
print "Choose a CVS session file in file dialog box:\n"; # no way to display a prompt?
# make sure that MacPerl is a front process
while (GetFrontProcess () != GetCurrentProcess())
{
SetFrontProcess( GetCurrentProcess() );
}
# prompt user for the file name, and store it
my $macFile = StandardGetFile( 0, "McvD");
if ( $macFile->sfGood() )
{
$cvsfile = $macFile->sfFile();
# save the choice if we can
if ( open (SESSIONFILE, ">" . $sessionStorage))
{
printf SESSIONFILE $cvsfile, "\n";
close SESSIONFILE;
}
else
{
print STDERR "Could not open storage file\n";
}
}
}
return $cvsfile;
}
# assert that we are in the correct directory for the build
sub _assertRightDirectory()
{
unless (-e ":mozilla")
{
my($dir) = cwd();
print STDERR "NGLayoutBuildList called from incorrect directory: $dir";
}
}
sub _getDistDirectory()
{
return $main::DEBUG ? ":mozilla:dist:viewer_debug:" : ":mozilla:dist:viewer:";
}
#
# MAIN ROUTINES
#
sub Checkout()
{
_assertRightDirectory();
my($cvsfile) = _pickWithMemoryFile("::nglayout.cvsloc");
my($session) = MacCVS->new( $cvsfile );
unless (defined($session)) { die "Checkout aborted. Cannot create session file: $session" }
if ($main::pull{lizard})
{
$session->checkout("mozilla/LICENSE") || die "checkout failure";
$session->checkout("mozilla/LEGAL") || die "checkout failure";
$session->checkout("mozilla/config") || die "checkout failure";
$session->checkout("mozilla/lib/liblayer") || die "checkout failure";
$session->checkout("mozilla/modules/zlib") || die "checkout failure";
$session->checkout("mozilla/modules/libutil") || die "checkout failure";
$session->checkout("mozilla/nsprpub") || die "checkout failure";
$session->checkout("mozilla/sun-java") || die "checkout failure";
$session->checkout("mozilla/nav-java") || die "checkout failure";
$session->checkout("mozilla/js") || die "checkout failure";
$session->checkout("mozilla/modules/security/freenav") || die "checkout failure";
$session->checkout("mozilla/modules/libpref") || die "checkout failure";
$session->checkout("mozilla/lib/libparse") || die "checkout failure";
$session->checkout("mozilla/lib/layout") || die "checkout failure";
$session->checkout("mozilla/lib/libstyle") || die "checkout failure";
$session->checkout("mozilla/lib/libpwcac") || die "checkout failure";
}
if ($main::pull{xpcom})
{
$session->checkout("mozilla/modules/libreg ") || die "checkout failure";
$session->checkout("mozilla/xpcom") || die "checkout failure";
}
if ($main::pull{imglib})
{
my($IMGLIB_BRANCH) = "MODULAR_IMGLIB_BRANCH";
$session->checkout("mozilla/jpeg ", $IMGLIB_BRANCH) || die "checkout failure";
$session->checkout("mozilla/modules/libutil", $IMGLIB_BRANCH) || die "checkout failure";
$session->checkout("mozilla/modules/libimg", $IMGLIB_BRANCH) || die "checkout failure";
}
if ($main::pull{netlib})
{
$session->checkout("mozilla/lib/xp ") || die "checkout failure";
$session->checkout("mozilla/network") || die "checkout failure";
$session->checkout("mozilla/include") || die "checkout failure";
}
if ($main::pull{nglayout})
{
$session->checkout("mozilla/base ") || die "checkout failure";
$session->checkout("mozilla/dom") || die "checkout failure";
$session->checkout("mozilla/gfx") || die "checkout failure";
$session->checkout("mozilla/htmlparser") || die "checkout failure";
$session->checkout("mozilla/layout") || die "checkout failure";
$session->checkout("mozilla/view") || die "checkout failure";
$session->checkout("mozilla/webshell") || die "checkout failure";
$session->checkout("mozilla/widget") || die "checkout failure";
}
if ($main::pull{mac})
{
$session->checkout("mozilla/build/mac ") || die "checkout failure";
$session->checkout("mozilla/cmd/macfe") || die "checkout failure";
$session->checkout("mozilla/lib/mac/MacMemoryAllocator") || die "checkout failure";
$session->checkout("mozilla/lib/mac/NSStdLib") || die "checkout failure";
$session->checkout("mozilla/lib/mac/MoreFiles") || die "checkout failure";
$session->checkout("mozilla/lib/mac/NSRuntime") || die "checkout failure";
$session->checkout("mozilla/lib/mac/Misc") || die "checkout failure";
}
}
# builds the dist directory
sub BuildDist()
{
unless ( $main::build{dist} ) { return;}
_assertRightDirectory();
# we really do not need all these paths, but many client projects include them
mkpath([ ":mozilla:dist:", ":mozilla:dist:client:", ":mozilla:dist:client_debug:", ":mozilla:dist:client_stubs:" ]);
mkpath([ ":mozilla:dist:viewer:", ":mozilla:dist:viewer_debug:" ]);
my($distdirectory) = ":mozilla:dist";
my($distlist) = [
#MAC_COMMON
[":mozilla:build:mac:MANIFEST", "$distdirectory:mac:common:"],
[":mozilla:lib:mac:NSStdLib:include:MANIFEST", "$distdirectory:mac:common:"],
[":mozilla:lib:mac:MacMemoryAllocator:include:MANIFEST", "$distdirectory:mac:common:"],
[":mozilla:lib:mac:Misc:MANIFEST", "$distdirectory:mac:common:"],
[":mozilla:lib:mac:MoreFiles:MANIFEST", "$distdirectory:mac:common:morefiles:"],
#INCLUDE
[":mozilla:config:mac:MANIFEST", "$distdirectory:config:"],
[":mozilla:include:MANIFEST", "$distdirectory:include:"],
[":mozilla:cmd:macfe:pch:MANIFEST", "$distdirectory:include:"],
#NSPR
[":mozilla:nsprpub:pr:include:MANIFEST", "$distdirectory:nspr:"],
[":mozilla:nsprpub:pr:src:md:mac:MANIFEST", "$distdirectory:nspr:mac:"],
[":mozilla:nsprpub:lib:ds:MANIFEST", "$distdirectory:nspr:"],
[":mozilla:nsprpub:lib:libc:include:MANIFEST", "$distdirectory:nspr:"],
[":mozilla:nsprpub:lib:msgc:include:MANIFEST", "$distdirectory:nspr:"],
#JPEG
[":mozilla:jpeg:MANIFEST", "$distdirectory:jpeg:"],
#LIBREG
[":mozilla:modules:libreg:include:MANIFEST", "$distdirectory:libreg:"],
#XPCOM
[":mozilla:xpcom:src:MANIFEST", "$distdirectory:xpcom:"],
#ZLIB
[":mozilla:modules:zlib:src:MANIFEST", "$distdirectory:zlib:"],
#LIBUTIL
[":mozilla:modules:libutil:public:MANIFEST", "$distdirectory:libutil:"],
#SUN_JAVA
[":mozilla:sun-java:stubs:include:MANIFEST", "$distdirectory:sun-java:"],
[":mozilla:sun-java:stubs:macjri:MANIFEST", "$distdirectory:sun-java:"],
#NAV_JAVA
[":mozilla:nav-java:stubs:include:MANIFEST", "$distdirectory:nav-java:"],
[":mozilla:nav-java:stubs:macjri:MANIFEST", "$distdirectory:nav-java:"],
#JS
[":mozilla:js:src:MANIFEST", "$distdirectory:js:"],
#SECURITY_freenav
[":mozilla:modules:security:freenav:MANIFEST", "$distdirectory:security:"],
#LIBPREF
[":mozilla:modules:libpref:public:MANIFEST", "$distdirectory:libpref:"],
#LIBIMAGE
[":mozilla:modules:libimg:png:MANIFEST", "$distdirectory:libimg:"],
[":mozilla:modules:libimg:src:MANIFEST", "$distdirectory:libimg:"],
[":mozilla:modules:libimg:public:MANIFEST", "$distdirectory:libimg:"],
#PARSE
[":mozilla:lib:libparse:MANIFEST", "$distdirectory:libparse:"],
#OLD LAYOUT
[":mozilla:lib:layout:MANIFEST", "$distdirectory:layout:"],
#STYLE
[":mozilla:lib:libstyle:MANIFEST", "$distdirectory:libstyle:"],
#LAYERS
[":mozilla:lib:liblayer:include:MANIFEST", "$distdirectory:layers:"],
#NETWORK
[":mozilla:network:cache:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:client:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:cnvts:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:cstream:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:main:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:mimetype:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:util:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:about:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:certld:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:dataurl:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:file:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:ftp:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:gopher:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:http:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:js:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:mailbox:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:marimba:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:nntp:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:pop3:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:remote:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:protocol:smtp:MANIFEST", "$distdirectory:network:"],
[":mozilla:network:module:MANIFEST","$distdirectory:network:module"],
#BASE
[":mozilla:base:src:MANIFEST", "$distdirectory:base:"],
[":mozilla:base:public:MANIFEST", "$distdirectory:base:"],
#WEBSHELL
[":mozilla:webshell:public:MANIFEST", "$distdirectory:webshell:"],
#LAYOUT
[":mozilla:layout:base:public:MANIFEST", "$distdirectory:layout:"],
[":mozilla:layout:html:style:public:MANIFEST", "$distdirectory:layout:"],
[":mozilla:layout:html:base:src:MANIFEST", "$distdirectory:layout:"],
[":mozilla:layout:html:document:public:MANIFEST", "$distdirectory:layout:"],
#WIDGET
[":mozilla:widget:public:MANIFEST", "$distdirectory:widget:"],
#GFX
[":mozilla:gfx:src:MANIFEST", "$distdirectory:gfx:"],
#VIEW
[":mozilla:view:public:MANIFEST", "$distdirectory:view:"],
#DOM
[":mozilla:dom:public:MANIFEST", "$distdirectory:dom:"],
[":mozilla:dom:public:coreDom:MANIFEST", "$distdirectory:dom:"],
[":mozilla:dom:public:coreEvents:MANIFEST", "$distdirectory:dom:"],
[":mozilla:dom:public:events:MANIFEST", "$distdirectory:dom:"],
#HTMLPARSER
[":mozilla:htmlparser:src:MANIFEST", "$distdirectory:htmlparser:"],
];
foreach $a (@$distlist)
{
InstallFromManifest( $a->[0], $a->[1]);
}
# To get out defines in all the project, dummy alias NGLayoutConfigInclude.h into MacConfigInclude.h
MakeAlias(":mozilla:config:mac:NGLayoutConfigInclude.h", ":mozilla:dist:config:MacConfigInclude.h");
}
# builds all projects
# different targets controlled by $main::build
sub BuildCommonProjects()
{
unless( $main::build{common} ) { return; }
_assertRightDirectory();
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
my($D) = $main::DEBUG ? "Debug" : "";
my($dist_dir) = _getDistDirectory();
# clean projects
Moz::BuildProjectClean(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "Stubs");
Moz::BuildProjectClean(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "Stubs");
Moz::BuildProjectClean(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "Stubs");
# shared
Moz::BuildProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp");
MakeAlias(":mozilla:lib:mac:NSRuntime:NSRuntime$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:lib:mac:NSRuntime:NSRuntime$D.shlb.xSYM", "$dist_dir") : 0;
Moz::BuildProject(":mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.mcp", "MoreFiles$D.shlb");
MakeAlias(":mozilla:lib:mac:MoreFiles:build:MoreFiles$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:lib:mac:MoreFiles:build:MoreFiles$D.shlb.xSYM", "$dist_dir") : 0;
BuildProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb");
MakeAlias(":mozilla:nsprpub:macbuild:NSPR20$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:nsprpub:macbuild:NSPR20$D.shlb.xSYM", "$dist_dir") : 0;
BuildProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "MemAllocator$D.shlb");
MakeAlias(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator$D.shlb.xSYM", "$dist_dir") : 0;
BuildProject(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "NSStdLib$D.shlb");
MakeAlias(":mozilla:lib:mac:NSStdLib:NSStdLib$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:lib:mac:NSStdLib:NSStdLib$D.shlb.xSYM", "$dist_dir") : 0;
BuildProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp", "xpcom$D.shlb");
MakeAlias(":mozilla:xpcom:macbuild:xpcom$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:xpcom:macbuild:xpcom$D.shlb.xSYM", "$dist_dir") : 0;
BuildProject(":mozilla:jpeg:macbuild:JPEG.mcp", "JPEG$D.shlb");
MakeAlias(":mozilla:jpeg:macbuild:JPEG$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:jpeg:macbuild:JPEG$D.shlb.xSYM", "$dist_dir") : 0;
BuildProject(":mozilla:js:macbuild:JavaScriptPPC.mcp", "JavaScriptNoJSJ$D.shlb");
MakeAlias(":mozilla:js:macbuild:JavaScript$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:js:macbuild:JavaScript$D.shlb.xSYM", "$dist_dir") : 0;
BuildProject(":mozilla:modules:zlib:macbuild:zlib.mcp", "zlib$D.shlb");
MakeAlias(":mozilla:modules:zlib:macbuild:zlib$D.shlb", "$dist_dir");
$main::DEBUG ? MakeAlias(":mozilla:modules:zlib:macbuild:zlib$D.shlb.xSYM", "$dist_dir") : 0;
# static
BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "Security.o");
BuildProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o");
BuildProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.o");
BuildProject(":mozilla:network:macbuild:network.mcp", "networkModular$D.o");
}
sub BuildLayoutProjects()
{
unless( $main::build{nglayout} ) { return; }
_assertRightDirectory();
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
my($D) = $main::DEBUG ? "Debug" : "";
my($dist_dir) = _getDistDirectory();
BuildProject(":mozilla:base:macbuild:base.mcp", "base$D.o");
BuildProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.o");
BuildProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.o");
BuildProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.o");
BuildProject(":mozilla:layout:macbuild:layout.mcp", "layout$D.o");
BuildProject(":mozilla:webshell:macbuild:webshell.mcp", "webshell$D.o");
BuildProject(":mozilla:webshell:tests:viewer:mac:viewer.mcp", "viewer$D");
}
sub BuildProjects()
{
BuildCommonProjects();
BuildLayoutProjects();
}

View File

@@ -0,0 +1,43 @@
/* -*- 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.
*/
#error "DonÕt use me!"
#define OLDROUTINELOCATIONS 0
#define XP_MAC 1
#ifndef NSPR20
#define NSPR20 1
#endif
#define _NSPR 1
#define _NO_FAST_STRING_INLINES_ 1
#define HAVE_BOOLEAN 1
#define NETSCAPE 1
#define OTUNIXERRORS 1 /* We want OpenTransport error codes */
#define OJI 1
#define MOCHA 1
/*
This compiles in heap dumping utilities and other good stuff
for developers -- maybe we only want it in for a special SDK
nspr/java runtime(?):
*/
#define DEVELOPER_DEBUG 1
#define MAX(_a,_b) ((_a) < (_b) ? (_b) : (_a))
#define MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))

Binary file not shown.

View File

@@ -0,0 +1,40 @@
#!perl
#
# 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.
#
use Moz;
use BuildList;
$DEBUG = 1;
# One of them should be 1. This will come from a config file at some stage.
# In the meanwhile, it should match mozilla/config/mac/MacConfig.h
$MOZ_LITE = 0;
$MOZ_MEDIUM = 1;
$MOZ_DARK = 0;
Moz::OpenErrorLog("::::Mozilla.BuildLog");
#Moz::StopForErrors();
chdir("::::");
# Make and popuplate the dist directory
DistMozilla();
# Now build the projects
BuildMozilla();

View File

@@ -0,0 +1,5 @@
#
# This is a list of local files which get copied to the mozilla:dist directory
#
IDE_Options.h

View File

@@ -0,0 +1,26 @@
/* -*- 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.
*/
/*
The only job of this file is for make dependencies:
include files here that you want to cause MakeDist
to happen again when they change.
*/
#include "MacExportListPublic"

View File

@@ -0,0 +1,76 @@
#
# 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 controlling script for a set of scripts that copy public
# header files in one or more source trees into a single, "dist" directory.
#
# It relies on the two accompanying scripts, ÒCopyList.scriptÓ and
# ÒCopyExports.scriptÓ, which must be in the same directory.
#
#
# Known bugs:
# Header files are always copied if the export.mac file contains
# non-local paths.
# Spurious output is produced even when verbose is off.
#
set echo 0
Evaluate % = ("{{SourceFile}}" =~ /(Å:)¨0Å/)
Directory "{{¨0}}"
set mozillaDir "{¨0}"
if `evaluate "{mozillaDir}" =~ /(Å:)¨1[Â:]+:[Â:]+:/`
set -e mozillaDir "{¨1}"
else
echo "Failed to find mozilla directory. Exitting"
exit 1;
end if
# Sanity check for mozilla
if !`exists -d "{mozillaDir}"`
echo "Failed to find mozilla directory. Exitting"
exit 1;
end if
# Calculate the root directory by stripping off the leaf name.
(Evaluate "{mozillaDir}" =~ /(Å:)¨1([Â:]+)¨2:/)
Set -e SourceRootDir "{¨1}"
Set -e DestRootDir "{mozillaDir}dist:"
# Ensure the build and stubs folders exist
if !`exists -d "{mozillaDir}dist"`
newfolder "{mozillaDir}dist"
end if
if !`exists -d "{mozillaDir}dist:client"`
newfolder "{mozillaDir}dist:client"
end if
if !`exists -d "{mozillaDir}dist:client_debug"`
newfolder "{mozillaDir}dist:client_debug"
end if
if !`exists -d "{mozillaDir}dist:client_stubs"`
newfolder "{mozillaDir}dist:client_stubs"
end if
# Now do the grunt work of copying headers. This can take some time
"{SourceRootDir}mozilla:build:mac:CopyExports.script" "mozilla:build:mac:MacExportListPublic"

267
mozilla/client.mak Normal file
View File

@@ -0,0 +1,267 @@
# 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.
# Enable builds on any drive if defined.
!if !defined(MOZ_SRC)
MOZ_SRC=y:
!endif
# Enable builds from user defined top level directory.
!if !defined(MOZ_TOP)
MOZ_TOP=mozilla
!endif
#//------------------------------------------------------------------------
#// Defines specific to MOZ_NGLAYOUT
#//------------------------------------------------------------------------
!if defined(MOZ_NGLAYOUT)
NGLAYOUT_MAKEFILE=nglayout.mak
NGLAYOUT_ENV_VARS=STANDALONE_IMAGE_LIB=1 MODULAR_NETLIB=1 NGLAYOUT_BUILD_PREFIX=1
MOZNGLAYOUT_BRANCH=RAPTOR_INTEGRATION0_BRANCH
CVSCO = cvs -q co -P
!endif
#//------------------------------------------------------------------------
#// Figure out how to do the pull.
#//------------------------------------------------------------------------
!if "$(MOZ_BRANCH)" != ""
CVS_BRANCH=-r $(MOZ_BRANCH)
HAVE_BRANCH=1
!else
HAVE_BRANCH=0
!endif
!if "$(MOZ_DATE)" != ""
CVS_BRANCH=-D "$(MOZ_DATE)"
HAVE_DATE=1
!else
HAVE_DATE=0
!endif
!if $(HAVE_DATE) && $(HAVE_BRANCH)
ERR_MESSAGE=$(ERR_MESSAGE)^
Cannot specify both MOZ_BRANCH and MOZ_DATE
!endif
NMAKE=@nmake -nologo -$(MAKEFLAGS)
#//------------------------------------------------------------------------
#//
#// Stuff a do complete pull and build
#//
#//------------------------------------------------------------------------
default:: build_all
pull_and_build_all:: pull_all \
build_all
#// Do this when you pull a new tree, or else you will often get bugs
#// when replaceing an old dist with a new dist.
pull_clobber_build_all:: pull_all \
clobber_all \
build_all
clobber_build_all:: clobber_all \
build_all
!if defined(MOZ_NGLAYOUT)
# The MOZ_NGLAYOUT pull is complicated, be very careful choosing which files are on
# the tip and which are on the branches.
pull_all:: pull_client_source_product pull_nglayout pull_netlib repull_ngl_integration pull_imglib repull_include
!else
pull_all:: pull_client_source_product
!endif
!if defined(MOZ_NGLAYOUT)
pull_nglayout:
@cd $(MOZ_SRC)
$(CVSCO) $(MOZ_TOP)/$(NGLAYOUT_MAKEFILE)
@cd $(MOZ_SRC)/$(MOZ_TOP)
$(NMAKE) -f $(NGLAYOUT_MAKEFILE) pull_nglayout $(NGLAYOUT_ENV_VARS)
pull_netlib:
@cd $(MOZ_SRC)/$(MOZ_TOP)
$(NMAKE) -f $(NGLAYOUT_MAKEFILE) pull_netlib $(NGLAYOUT_ENV_VARS)
# Here is where we pull everything on the layout integration branch
repull_ngl_integration:
@cd $(MOZ_SRC)
$(CVSCO) -r $(MOZNGLAYOUT_BRANCH) $(MOZ_TOP)/include $(MOZ_TOP)/cmd $(MOZ_TOP)/lib $(MOZ_TOP)/modules
@cd $(MOZ_SRC)/$(MOZ_TOP)
# Careful to put this after repull_ngl_integration, want modules/libutil and
# modules/libimg to be on imglib branch
pull_imglib:
@cd $(MOZ_SRC)/$(MOZ_TOP)
$(NMAKE) -f $(NGLAYOUT_MAKEFILE) pull_imglib $(NGLAYOUT_ENV_VARS)
# Want certain files in the include directory to be on the tip
repull_include:
@cd $(MOZ_SRC)
$(CVSCO) -A $(MOZ_TOP)/include/net.h
!endif
pull_client_source_product:
@echo +++ client.mak: checking out the client with "$(CVS_BRANCH)"
cd $(MOZ_SRC)\.
-cvs -q co $(CVS_BRANCH) MozillaSourceWin
!if defined(MOZ_NGLAYOUT)
# Build NGLayout first.
build_all: build_nglayout \
build_dist \
build_client
!else
build_all: build_dist \
build_client
!endif
!if defined(MOZ_NGLAYOUT)
build_nglayout:
cd $(MOZ_SRC)\$(MOZ_TOP)
$(NMAKE) -f $(NGLAYOUT_MAKEFILE) $(NGLAYOUT_ENV_VARS)
!endif
build_dist:
@echo +++ client.mak: building dist
cd $(MOZ_SRC)\$(MOZ_TOP)
$(NMAKE) -f makefile.win
build_client:
@echo +++ client.mak: building client
cd $(MOZ_SRC)\$(MOZ_TOP)\cmd\winfe\mkfiles32
!if "$(MOZ_BITS)" == "16"
$(NMAKE) -f mozilla.mak exports
!endif
$(NMAKE) -f mozilla.mak DEPEND=1
$(NMAKE) -f mozilla.mak
#
# remove all source files from the tree and print a report of what was missed
#
!if defined(MOZ_NGLAYOUT)
clobber_all:: clobber_moz clobber_nglayout
!else
clobber_all:: clobber_moz
!endif
clobber_moz:
cd $(MOZ_SRC)\$(MOZ_TOP)
$(NMAKE) -f makefile.win clobber_all
cd $(MOZ_SRC)\$(MOZ_TOP)\cmd\winfe\mkfiles32
$(NMAKE) -f mozilla.mak clobber_all
!if !defined(MOZ_MEDIUM)
cd $(MOZ_SRC)\$(MOZ_TOP)\netsite\ldap\libraries\msdos\winsock
$(NMAKE) -f nsldap.mak clobber_all
!endif
!if defined(MOZ_NGLAYOUT)
clobber_nglayout:
cd $(MOZ_SRC)\$(MOZ_TOP)
$(NMAKE) -f $(NGLAYOUT_MAKEFILE) clobber $(NGLAYOUT_ENV_VARS)
!endif
depend:
-del /s /q make.dep
$(NMAKE) -f makefile.win depend
#//------------------------------------------------------------------------
#// Utility stuff...
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
# Verify that MOZ_SRC is set correctly
#//------------------------------------------------------------------------
# Check to see if it is set at all
!if "$(MOZ_SRC)"!=""
#
# create a temp file at the root and make sure it is visible from MOZ_SRC
#
!if [copy $(MAKEDIR)\client.mak $(MAKEDIR)\xyzzy.tmp > NUL] == 0
!endif
!if !EXIST( $(MOZ_SRC)\$(MOZ_TOP)\xyzzy.tmp )
ERR_MESSAGE=$(ERR_MESSAGE)^
MOZ_SRC isn't set correctly: [$(MOZ_SRC)\$(MOZ_TOP)]!=[$(MAKEDIR)]
!endif
!if [del $(MAKEDIR)\xyzzy.tmp]
!endif
!else
# MOZ_SRC isn't set at all
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_SRC isn't set.
!endif
#//------------------------------------------------------------------------
# Verify that MOZ_BITS is set
#//------------------------------------------------------------------------
!if !defined(MOZ_BITS)
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_BITS isn't set.
!endif
!if !defined(MOZ_TOOLS)
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_TOOLS isn't set.
!endif
#//------------------------------------------------------------------------
#// Display error
#//------------------------------------------------------------------------
!if "$(ERR_MESSAGE)" != ""
ERR_MESSAGE = ^
client.mak: ^
$(ERR_MESSAGE) ^
^
client.mak: usage^
^
nmake -f client.mak [MOZ_BRANCH=<cvs_branch_name>] ^
[MOZ_DATE=<cvs_date>]^
[pull_and_build_all]^
[pull_all]^
[pull_dist]^
[pull_client]^
[build_all]^
[build_dist]^
[build_ldap]^
[build_client]^
^
Environment variables:^
^
MOZ_BITS set to either 32 or 16 ^
MOZ_SRC set to the directory above $(MOZ_TOP) or "$(MAKEDIR)\.."^
MOZ_TOOLS set to the directory containing the java compiler see ^
http://warp/tools/nt^
JAVA_HOME set to the same thing as MOZ_TOOLS^
CVSROOT set to the public mozilla cvs server^
!ERROR $(ERR_MESSAGE)
!endif

21
mozilla/cmd/Makefile Normal file
View File

@@ -0,0 +1,21 @@
#
# 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 = ..
DIRS = xfe patcher
include $(DEPTH)/config/rules.mk

View File

@@ -0,0 +1,57 @@
<!-- -*- Mode: HTML; tab-width: 8; indent-tabs-mode: nil -*-
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.
-->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
<HTML>
<HEAD>
<TITLE>Account Setup</TITLE>
<SCRIPT LANGUAGE = "JavaScript" ARCHIVE="asw.jar" SRC="1step.js"></SCRIPT>
<LINK REL=STYLESHEET TYPE="text/JavaScript" ARCHIVE="asw.jar" HREF="sheet.js"></LINK>
</HEAD>
<BODY BACKGROUND="images/bg.gif" BGCOLOR="cccccc" onLoad="loadData()" ID="1step100">
<!-- The layer below contains the Account Setup identifier. -->
<LAYER NAME = "tagtext" LEFT = 420 TOP = 0 VISIBILITY = SHOW>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200 ID="nospace">
<TR><TD HEIGHT=20 VALIGN=MIDDLE BACKGROUND="images/tag.gif">
<B CLASS="previewtag">ACCOUNT SETUP</B>
</TD></TR>
</TABLE>
</LAYER>
<!-- The layer below contains the headline and text of this screen -->
<P CLASS="title"><B>Connecting to the Internet <BR>account server...</B></P>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH=500>
<TR>
</TR>
</TABLE>
<SPACER TYPE=HORIZONTAL SIZE=42>
<APPLET ARCHIVE="asw.jar" CODE="netscape/asw/CPGeneratorProgress.class" HEIGHT=140 WIDTH=400></APPLET>
</BODY>
</HTML>

View File

@@ -0,0 +1,242 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
*
* 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.
*/
<!-- to hide script contents from old browsers
var globals = parent.parent.globals;
var plugin = globals.document.setupPlugin;
var documentVars = globals.document.vars;
function go( msg )
{
parent.parent.globals.debug( "1step go" );
if ( parent.parent.globals.document.vars.editMode.value == "yes" )
return true;
else
return checkData();
}
function checkData()
{
return true;
}
function configureDialer( configFolder, acctSetupIni, regFile )
{
globals.debug( "Configuring dialer" );
var intlFlag = globals.GetNameValuePair( acctSetupIni, "Mode Selection", "IntlMode" );
intlFlag = intlFlag.toLowerCase();
// * determine name of scripting file
var scriptEnabledFlag = "FALSE";
var scriptFile = globals.GetNameValuePair( regFile, "Dial-In Configuration", "ScriptFileName" );
if ( scriptFile != null && scriptFile != "" )
{
scriptFile = configFolder + scriptFile;
scriptEnabledFlag = "TRUE";
}
else
{
scriptFile = "";
scriptEnabledFlag = "FALSE";
}
// * determine tty
var ttyFlag = globals.GetNameValuePair( regFile, "Security", "SecurityDevice" );
ttyFlag = ttyFlag.toLowerCase();
if ( ttyFlag == "yes" )
ttyFlag = "TRUE";
else
ttyFlag = "FALSE";
// * determine outside line access string
var outsideLineAccessStr = "";
if ( documentVars.prefixData.value != "" )
{
outsideLineAccessStr = documentVars.prefixData.value;
x = outsideLineAccessStr.indexOf( "," );
if ( x < 0 )
outsideLineAccessStr = outsideLineAccessStr + ",";
}
// * configure dialer for Registration Server
dialerData = plugin.newStringArray( 28 ); // increment this # as new dialer strings are added
dialerData[ 0 ] = "FileName=" + regFile;
dialerData[ 1 ] = "AccountName=" + globals.GetNameValuePair( regFile, "Dial-In Configuration", "SiteName" );
dialerData[ 2 ] = "ISPPhoneNum=" + globals.GetNameValuePair( regFile, "Dial-In Configuration", "Phone" );
dialerData[ 3 ] = "LoginName=" + globals.GetNameValuePair( regFile, "Dial-In Configuration", "Name" );
dialerData[ 4 ] = "Password=" + globals.GetNameValuePair( regFile, "Dial-In Configuration", "Password" );
dialerData[ 5 ] = "DNSAddress=" + globals.GetNameValuePair( regFile, "IP", "DNSAddress" );
dialerData[ 6 ] = "DNSAddress2=" + globals.GetNameValuePair( regFile, "IP", "DNSAddress2" );
dialerData[ 7 ] = "DomainName=" + globals.GetNameValuePair( regFile, "IP", "DomainName" );
dialerData[ 8 ] = "IPAddress=" + globals.GetNameValuePair( regFile, "IP", "IPAddress" );
dialerData[ 9 ] = "IntlMode=" + ( ( intlFlag == "yes" ) ? "TRUE" : "FALSE" );
dialerData[ 10 ] = "DialOnDemand=TRUE";
dialerData[ 11 ] = "ModemName=" + globals.document.vars.modem.value;
dialerData[ 12 ] = "ModemType=" + plugin.GetModemType( documentVars.modem.value );
dialerData[ 13 ] = "DialType=" + documentVars.dialMethod.value;
dialerData[ 14 ] = "OutsideLineAccess=" + outsideLineAccessStr;
dialerData[ 15 ] = "DisableCallWaiting=" + ( ( documentVars.cwData.value != "" ) ? "TRUE" : "FALSE" );
dialerData[ 16 ] = "DisableCallWaitingCode=" + documentVars.cwData.value;
dialerData[ 17 ] = "UserAreaCode=" + documentVars.modemAreaCode.value; // XXX what to do if international mode?
dialerData[ 18 ] = "CountryCode=" + documentVars.countryCode.value;
dialerData[ 19 ] = "LongDistanceAccess=1"; // XXX
dialerData[ 20 ] = "DialAsLongDistance=TRUE"; // XXX
dialerData[ 21 ] = "DialAreaCode=TRUE"; // XXX
dialerData[ 22 ] = "ScriptEnabled=" + scriptEnabledFlag;
dialerData[ 23 ] = "ScriptFileName=" + scriptFile;
dialerData[ 24 ] = "NeedsTTYWindow=" + ttyFlag;
dialerData[ 25 ] = "Location=Home";
dialerData[ 26 ] = "DisconnectTime=" + globals.GetNameValuePair( acctSetupIni, "Mode Selection", "Dialer_Disconnect_After" );
dialerData[ 27 ] = "Path=Server";
// * write out dialer data to Java Console
if ( documentVars.debugMode.value.toLowerCase() == "yes" )
{
globals.debug( "\nDialer data (for Registration Server): " );
var numElements = dialerData.length;
for ( var x = 0; x < numElements; x++ )
globals.debug( " " + x + ": " + dialerData[ x ] );
}
// * configure the dialer
plugin.DialerConfig( dialerData, true );
// * check if we need to reboot
if ( plugin.NeedReboot() == true )
{
// XXX hardcode in name of next screen???
globals.forceReboot( "1step.htm" );
return;
}
if ( plugin.DialerConnect() == false )
{
plugin.DialerHangup();
// XXX hardcode in name of next screen???
window.location.replace( "error.htm" );
return;
}
}
function loadData()
{
netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
if ( parent.controls.generateControls )
parent.controls.generateControls();
// * only connect to reggie if editmode is off
if ( documentVars.editMode.value != "yes" )
{
var configFolder = globals.getConfigFolder( self );
var acctSetupIni = globals.getAcctSetupFilename( self );
var regFile = configFolder + documentVars.regServer.value;
var regSource = globals.GetNameValuePair( acctSetupIni, "Mode Selection", "RegSource" );
var localFlag = globals.GetNameValuePair( regFile, "Dial-In Configuration", "LocalMode" );
localFlag = localFlag.toLowerCase();
globals.debug( "localFlag:" + localFlag );
if ( localFlag != "yes" )
{
globals.debug( "LocalMode==no" );
var connectStatusFlag = plugin.IsDialerConnected();
if ( connectStatusFlag == true )
{
if ( confirm( "Account Setup can't connect until you close your current connection. Close the connection now?" ) == false )
return;
plugin.DialerHangup();
}
configureDialer( configFolder, acctSetupIni, regFile );
}
regCGI = globals.GetNameValuePair( regFile, "IP", "RegCGI" );
regRoot = globals.GetNameValuePair( regFile, "Configuration", "RegRoot" );
metadataMode = globals.GetNameValuePair( regFile, "Configuration", "MetadataMode" );
if ( metadataMode == "no" )
globals.debug( "MetadataMode==no, you will not be downloading necessary metadata" );
if ( regCGI == null || regCGI == "" )
{
alert( "Internal problem determining the Registration Server." );
return;
}
if ( regRoot == null )
{
alert( "Internal problem determining location of Registration Server data file repository (RegRoot)." );
return;
}
/*
// * write out reggie data to Java Console
if ( documentVars.debugMode.value.toLowerCase() == "yes" )
{
globals.debug( "\nRegServer data: " + document.forms[ 0 ].action );
var numElements = document.forms[ 0 ].length;
for ( var x = 0; x < document.forms[ 0 ].length; x++ )
globals.debug( " " + x + ": " + document.forms[ 0 ].elements[ x ].name + "=" + document.forms[ 0 ].elements[ x ].value );
}
*/
// * submit reggie data
navigator.preference( "security.warn_submit_insecure", false );
navigator.preference( "security.warn_entering_secure", false );
navigator.preference( "security.warn_leaving_secure", false );
// * automatically submit form to registration server
//document.forms[ 0 ].submit();
reggieData = plugin.newStringArray( 8 ); // increment this # as new dialer strings are added
reggieData[ 0 ] = "CST_PHONE_NUMBER=" + documentVars.modemPhoneNumber.value;
reggieData[ 1 ] = "REG_SOURCE=" + regSource;
reggieData[ 2 ] = "CLIENT_LANGUAGE=" + navigator.language;
reggieData[ 3 ] = "CST_AREA_CODE_1=" + documentVars.modemAreaCode.value;
reggieData[ 4 ] = "CST_AREA_CODE_2=" + documentVars.altAreaCode1.value;
reggieData[ 5 ] = "CST_AREA_CODE_3=" + documentVars.altAreaCode2.value;
reggieData[ 6 ] = "CST_AREA_CODE_4=" + documentVars.altAreaCode3.value;
reggieData[ 7 ] = "CST_COUNTRY_CODE=" + "1";
/*documentVars.countryCode.value;*/
//if ( localFlag != "yes" )
// globals.set1StepMode( 1 );
var result = plugin.GenerateComparePage( globals.getFolder( self ), regCGI, regRoot, metadataMode, reggieData );
plugin.DialerHangup();
//if ( localFlag != "yes" )
// globals.oneStepSemaphore = true;
if ( result == true )
window.location.replace( "compwrap.htm" );
else
window.location.replace( "error.htm" );
}
}
function saveData()
{
}
// end hiding contents from old browsers -->

View File

@@ -0,0 +1,60 @@
<!-- -*- Mode: HTML; tab-width: 8; indent-tabs-mode: nil -*-
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.
-->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
<HTML>
<HEAD>
<TITLE>Account Setup</TITLE>
<SCRIPT LANGUAGE="JavaScript" ARCHIVE="asw.jar" SRC="2step.js"></SCRIPT>
<LINK REL=STYLESHEET TYPE="text/JavaScript" ARCHIVE="asw.jar" HREF="sheet.js"></LINK>
</HEAD>
<BODY BACKGROUND="images/bg.gif" BGCOLOR="cccccc" onLoad="loadData()" ID="2step100">
<!-- The layer below contains the Account Setup identifier. -->
<LAYER NAME="tagtext" LEFT=420 TOP=0 VISIBILITY=SHOW>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200 ID="nospace">
<TR><TD HEIGHT=20 VALIGN=MIDDLE BACKGROUND="images/tag.gif">
<B CLASS="previewtag">ACCOUNT SETUP</B>
</TD></TR>
</TABLE>
</LAYER>
<!-- The layer below contains the headline and text of this screen -->
<P CLASS="title"><B>Connect to
<SCRIPT LANGUAGE="JavaScript" ID="2step101">insertISPName();</SCRIPT>
</B></P>
<P>Account Setup will now connect you to
<SCRIPT LANGUAGE="JavaScript" ID="2step102">insertISPName();</SCRIPT>
so that you can create an account with this ISP. (Note: It may take a minute for your modem to connect to this ISP.)</P>
<P>After you have connected to
<SCRIPT LANGUAGE="JavaScript" ID="2step103">insertISPName();</SCRIPT>
you will be asked to supply account and billing information, such as your desired electronic mail name and password, and credit card information.</P>
<CENTER>
<SCRIPT LANGUAGE="JavaScript" ID="2step104">
generatePopNumberList();
</SCRIPT>
</CENTER>
</BODY>
</HTML>

View File

@@ -0,0 +1,91 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
*
* 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.
*/
<!-- to hide script contents from old browsers
var globals = parent.parent.globals;
var controls = parent.controls;
function go( msg )
{
netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
// * skip if we're in edit mode
if ( globals.document.vars.editMode.value != "yes" )
{
if ( document.forms && document.forms[ 0 ] && document.forms[ 0 ].popList )
globals.document.setupPlugin.CreateConfigIAS(
globals.selectedISP, document.forms[ 0 ].popList.selectedIndex );
else
globals.document.setupPlugin.CreateConfigIAS( globals.selectedISP, -1 );
return true;
}
else
{
return false;
}
}
function checkData()
{
return true;
}
function saveData()
{
}
function insertISPName()
{
document.write( globals.getSelectedISPName() );
}
function loadData()
{
//parent.twostepfooter.document.writeln( "<BODY BACKGROUND='images/bg.gif' BGCOLOR='cccccc'>" );
//parent.twostepfooter.document.writeln( "<P>If you have trouble setting up your account call " );
//parent.twostepfooter.document.writeln( globals.getSelectedISPName() );
//parent.twostepfooter.document.writeln( "at (support number).</P>" );
//parent.twostepfooter.document.close();
if ( controls.generateControls )
controls.generateControls();
}
function generatePopNumberList()
{
netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
var list = globals.document.setupPlugin.GetISPPopList( globals.selectedISP );
globals.debug( "generating pop list" );
if ( list && list.length > 0 )
{
globals.debug( "emitting table" );
document.writeln( "<TABLE CELLPADDING=2 CELLSPACING=0 ID='minspace'><TR><TD ALIGN=LEFT VALIGN=TOP HEIGHT=25><spacer type=vertical size=2><B>Pick a phone number from the following list to connect to:</B></TD><TD ALIGN=LEFT VALIGN=TOP><FORM><SELECT NAME='popList'>");
for ( var x = 0; x < list.length; x++ )
{
var name = list[ x ];
var selected = ( x == 0 ) ? " SELECTED" : "";
document.writeln( "<OPTION VALUE='" + x + "'" + selected + ">" + name );
}
document.writeln( "</SELECT></FORM></TD></TR></TABLE>" );
}
}
// end hiding contents from old browsers -->

View File

@@ -0,0 +1,134 @@
<!-- -*- Mode: HTML; tab-width: 8; indent-tabs-mode: nil -*-
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.
-->
<HTML>
<HEAD>
<SCRIPT LANGUAGE = "JavaScript" ARCHIVE="asw.jar" SRC="aboutbox.js">
</SCRIPT>
</HEAD>
<BODY BGCOLOR=EEEEEE onLoad="loadData()" ID="aboutbox100">
<LAYER NAME="programName" VISIBILITY=hidden LEFT=-100 TOP=0 HEIGHT=100 WIDTH=100>
<TABLE BORDER=0 WIDTH="100%">
<TR>
<TD ALIGN=center VALIGN=top><STRONG>Account Setup</STRONG><BR>4.0</TD>
</TR>
</TABLE>
</LAYER>
<LAYER NAME="programDesc" VISIBILITY=hidden LEFT=250 TOP=-100 HEIGHT=100 WIDTH=100>
<TABLE BORDER=0 WIDTH="100%">
<TR>
<TD ALIGN=center VALIGN=top><STRONG>Internet<BR>Signup<BR>Program</STRONG></TD>
</TR>
</TABLE>
</LAYER>
<LAYER NAME="programCopyRight" VISIBILITY=hidden LEFT=740 TOP=0 HEIGHT=100 WIDTH=200>
<TABLE BORDER=0 WIDTH="100%">
<TR>
<TD ALIGN=center VALIGN=top>Copyright &copy 1996, 1997<BR>Netscape Communications Corp.<BR>All Rights Reserved.</TD>
</TR>
</TABLE>
</LAYER>
<LAYER NAME="ProgramThanks" VISIBILITY=hidden LEFT=10 TOP=480 WIDTH=580>
<CENTER>Brought to you by:</CENTER>
<BR>
<TABLE BORDER=0 WIDTH="100%" BGCOLOR=CCCCCC>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Client Engineering</STRONG></TD>
<TD>Robert John Churchill, Rex Lam, Tim McClarren, Arshad Tayyeb, Cathleen Wang, Stella Yun</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>FreePPP</STRONG></TD>
<TD>Steve Dagley</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Server Engineering</STRONG></TD>
<TD>Steve Elmer, Lucy Wu</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Documentation/Help</STRONG></TD>
<TD>Dirk Dougherty, Robin Foster, Kate O'Day</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>User Experience</STRONG></TD>
<TD>Jim Corban, Valerie Hunter</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Kwality Assurance</STRONG></TD>
<TD>Aracely Areas, John Bennett, Bruce Gay, Sarah Groves, Vashti Holt, Brent Martin, Dylan Shea, John Unruh, Pascal Vin</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Release Engineering</STRONG></TD>
<TD>Don Bragg, Doug Turner, Chris Yeh</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>International</STRONG></TD>
<TD>David Yett</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Management</STRONG></TD>
<TD>Leland Hambley, Nancy Wang, Monique Barbanson</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Marketing</STRONG></TD>
<TD>Ken Hickman, Debra Evans, John Freeborg, Julie Herendeen</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Thanks!</STRONG></TD>
<TD>The entire Communicator team!</TD>
</TR>
<TR>
<TD ALIGN=center VALIGN=middle><STRONG>Thank Goodness for...</STRONG></TD>
<TD>Mountain Dew!</TD>
</TR>
</TABLE>
</CENTER>
</LAYER>
<LAYER NAME="NetscapeIcon" VISIBILITY=hidden LEFT=250 TOP=90 WIDTH=100 HEIGHT=50>
<CENTER>
<IMG SRC="images/netscape.gif" WIDTH=32 HEIGHT=32 BORDER=0><BR>
<LAYER NAME="NetscapeString" VISIBILITY=hidden LEFT=16>
Go Netscape!
</LAYER>
</CENTER>
</LAYER>
</LAYER>
</BODY>
</HTML>

View File

@@ -0,0 +1,113 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
*
* 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.
*/
<!-- to hide script contents from old browsers
function go( msg )
{
if ( msg=="Back" )
return true;
return false;
}
function checkData()
{
return true;
}
function loadData()
{
if ( parent && parent.controls && parent.controls.generateControls )
{
parent.controls.generateControls();
}
document.layers[ "programName" ].visibility = "SHOW";
animate1();
}
function saveData()
{
}
function animate1()
{
if ( document.layers[ "programName" ].left < 100 )
{
document.layers[ "programName" ].moveBy( 10, 0 );
setTimeout( "animate1()", 100 );
}
else
{
document.layers[ "programDesc" ].visibility = "SHOW";
animate2();
}
}
function animate2()
{
if ( document.layers[ "programDesc" ].top < 0 )
{
document.layers[ "programDesc" ].moveBy( 0, 10 );
setTimeout( "animate2()", 100 );
}
else
{
document.layers[ "programCopyRight" ].visibility = "SHOW";
animate3();
}
}
function animate3()
{
if ( document.layers[ "programCopyRight" ].left > 380 )
{
document.layers[ "programCopyRight" ].moveBy( -10, 0);
setTimeout( "animate3()", 100 );
}
else
{
document.layers[ "NetscapeIcon" ].visibility = "SHOW";
document.layers[ "ProgramThanks" ].visibility = "SHOW";
animate4();
}
}
function animate4()
{
if ( document.layers[ "ProgramThanks" ].top > 50 )
{
document.layers[ "NetscapeIcon" ].moveBy( 0, 5 );
document.layers[ "ProgramThanks" ].moveBy( 0, -10 );
setTimeout( "animate4()", 100 );
}
else
{
document.layers[ "NetscapeIcon" ].document.layers[ "NetscapeString" ].visibility = "SHOW";
}
}
// end hiding contents from old browsers -->

View File

@@ -0,0 +1,104 @@
<!-- -*- Mode: HTML; tab-width: 8; indent-tabs-mode: nil -*-
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.
-->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
<HTML>
<HEAD>
<TITLE>Account Setup</TITLE>
<SCRIPT LANGUAGE = "JavaScript" ARCHIVE="asw.jar" SRC="accounts.js">
</SCRIPT>
<LINK REL=STYLESHEET TYPE="text/JavaScript" ARCHIVE="asw.jar" HREF="sheet.js">
</LINK>
</HEAD>
<BODY BACKGROUND="images/bg.gif" BGCOLOR="cccccc" ONLOAD="loadData()" ID="accounts100">
<!-- The layer below contains the Account Setup identifier. -->
<LAYER NAME = "tagtext" LEFT = 420 TOP = 0 VISIBILITY = SHOW>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200 ID="nospace">
<TR><TD HEIGHT=20 VALIGN=MIDDLE BACKGROUND="images/tag.gif">
<B CLASS="previewtag">ACCOUNT SETUP</B>
</TD></TR>
</TABLE>
</LAYER>
<!-- The layer below contains the headline and text of this screen -->
<FORM>
<P CLASS="title"><B>Welcome to Account Setup</B></P>
<!-- ÇSPACER TYPE=VERTICAL SIZE=16È -->
<P>Please click one of the buttons below to choose whether you would like to create a new Internet account or set up Communicator to access an account that you already have.</P>
<SPACER TYPE=HORIZONTAL SIZE=72>
<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="500">
<TR>
<TD ALIGN=LEFT VALIGN="TOP" WIDTH="66" HEIGHT="54" ALIGN="LEFT">
<A HREF="about:blank" ONCLICK="document.images['new'].src='images/str_dn.gif'; setPath('New Path'); return false" ONMOUSEOVER="document.images['new'].src='images/str_mo.gif'" ONMOUSEOUT="document.images['new'].src='images/start.gif'" ID="accounts101">
<IMG NAME="new" SRC="images/start.gif" LOWSRC="images/str_dn.gif" BORDER=0 HEIGHT=53 WIDTH=54></A>
</TD>
<TD ALIGN=LEFT WIDTH="358" VALIGN="TOP" CLASS="accounts">
<B>I want to create a new Internet account.</B>
<SPACER TYPE=VERTICAL SIZE=4>
If you're new to the Internet, Account Setup helps you create an Internet account that you can use right away. You can also choose this option if you want to create a second Internet account or change your Internet service provider.
</TD>
</TR>
<TR>
<TD><SPACER TYPE=VERTICAL SIZE=16>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="66" HEIGHT="54" ALIGN="LEFT">
<A HREF="about:blank" ONCLICK="document.images['existing'].src='images/str_dn.gif'; setPath('Existing Path'); return false" ONMOUSEOVER="document.images['existing'].src='images/str_mo.gif'" ONMOUSEOUT="document.images['existing'].src='images/start.gif'" ID="accounts102">
<IMG NAME="existing" SRC="images/start.gif" LOWSRC="images/str_dn.gif" BORDER=0 HEIGHT=53 WIDTH=54></A>
</TD>
<TD ALIGN="LEFT" WIDTH="358" VALIGN="TOP" CLASS="accounts">
<B>I already have an Internet account. I want to set up Communicator to access my account.</B>
<SPACER TYPE=VERTICAL SIZE=4>
If you already have an Internet account with an Internet service provider, Account Setup helps you quickly set up Communicator to access your account.
</TD>
</TR>
</TABLE>
</BODY>
</HTML>

View File

@@ -0,0 +1,67 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
*
* 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.
*/
<!-- to hide script contents from old browsers
function go(msg)
{
if (msg == parent.parent.globals.document.vars.path.value) {
return(true);
}
return(false);
}
function doGo()
{
parent.controls.go("Next");
}
function setPath(msg)
{
parent.parent.globals.document.vars.path.value = msg;
setTimeout("doGo()",1);
}
function checkData()
{
return(true);
}
function loadData()
{
if (parent.controls.generateControls) parent.controls.generateControls();
}
function saveData()
{
}
// end hiding contents from old browsers -->

View File

@@ -0,0 +1,120 @@
<!-- -*- Mode: HTML; tab-width: 2; indent-tabs-mode: nil -*-
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.
-->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
<HTML>
<HEAD>
<TITLE>Account Setup</TITLE>
<SCRIPT LANGUAGE = "JavaScript" ARCHIVE="asw.jar" SRC="acctInfo.js">
</SCRIPT>
<LINK REL=STYLESHEET TYPE="text/JavaScript" ARCHIVE="asw.jar" HREF="sheet.js">
</LINK>
</HEAD>
<BODY BACKGROUND="images/bg.gif" BGCOLOR="cccccc" onLoad="loadData()" ID="acctInfo100">
<!-- The layer below contains the Account Setup identifier. -->
<LAYER NAME = "tagtext" LEFT = 420 TOP = 0 VISIBILITY = SHOW>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200 ID="nospace">
<TR><TD HEIGHT=20 VALIGN=MIDDLE BACKGROUND="images/tag.gif">
<B CLASS="previewtag">ACCOUNT SETUP</B>
</TD></TR>
</TABLE>
</LAYER>
<!-- The layer below contains the headline and text of this screen -->
<FORM>
<P CLASS="title"><B>Information About Yourself</B></P>
<P>Please enter your name and, optionally, you organization name below. Account Setup sets Communicator to add this information to the email you send and the web pages you create. </P>
<CENTER>
<TABLE CELLPADDING="3" CELLSPACING="0" border="0" WIDTH=100>
<TR>
<TD></TD>
<TD ALIGN="CENTER" VALIGN="BOTTOM" CLASS="tabletext">
First:
</TD>
<TD ALIGN="CENTER" VALIGN="BOTTOM" CLASS="tabletext">
Last:
</TD>
</TR>
<TR>
<TD VALIGN="BOTTOM" ALIGN="RIGHT" CLASS="tabletext">
<B>Name:</B>
<spacer type=vertical size=2>
</FONT>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP" CLASS="tabletext">
<INPUT NAME="first" TYPE="text" SIZE=25 MAXLENGTH=30>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP" CLASS="tabletext">
<INPUT NAME="last" TYPE="text" SIZE=26 MAXLENGTH=30>
</TD>
</TR>
<TR>
<TD COLSPAN="3">
<spacer type=vertical size=2>
</TD>
</TR>
<TR>
<TD VALIGN="BOTTOM" ALIGN="RIGHT" CLASS="tabletext">
<B>Organization:</B>
<spacer type=vertical size=2>
</FONT>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP" COLSPAN="2" CLASS="tabletext">
<INPUT NAME="company" TYPE="text" SIZE=54 MAXLENGTH=30>
</TD>
</TR>
</TABLE>
</CENTER>
</FORM>
</BODY>
</HTML>

View File

@@ -0,0 +1,107 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
*
* 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.
*/
<!-- to hide script contents from old browsers
function go()
{
if (parent.parent.globals.document.vars.editMode.value == "yes")
return true;
else
return(checkData());
}
function checkData()
{
if (document.forms[0].first.value == "") {
alert("You must enter a first name.");
document.forms[0].first.focus();
document.forms[0].first.select();
return false;
}
if (document.forms[0].last.value == "") {
alert("You must enter a last name.");
document.forms[0].last.focus();
document.forms[0].last.select();
return false;
}
/*
if (document.forms[0].areaCode.value == "") {
alert("You must enter an area code.");
document.forms[0].areaCode.focus();
document.forms[0].areaCode.select();
return false;
}
if (document.forms[0].phoneNumber.value == "") {
alert("You must enter a telephone number.");
document.forms[0].phoneNumber.focus();
document.forms[0].phoneNumber.select();
return false;
}
*/
return true;
}
function loadData()
{
// make sure all data objects/element exists and valid; otherwise, reload. SUCKS!
if (((document.forms[0].first == "undefined") || (document.forms[0].first == "[object InputArray]")) ||
((document.forms[0].last == "undefined") || (document.forms[0].last == "[object InputArray]")) ||
((document.forms[0].company == "undefined") || (document.forms[0].company == "[object InputArray]")))
{
parent.controls.reloadDocument();
return;
}
document.forms[0].first.value = parent.parent.globals.document.vars.first.value;
document.forms[0].last.value = parent.parent.globals.document.vars.last.value;
document.forms[0].company.value = parent.parent.globals.document.vars.company.value;
// document.forms[0].areaCode.value = parent.parent.globals.document.vars.areaCode.value;
// document.forms[0].phoneNumber.value = parent.parent.globals.document.vars.phoneNumber.value;
parent.parent.globals.setFocus(document.forms[0].first);
if (parent.controls.generateControls) parent.controls.generateControls();
}
function saveData()
{
// make sure all form element are valid objects, otherwise just skip & return!
if (((document.forms[0].first == "undefined") || (document.forms[0].first == "[object InputArray]")) ||
((document.forms[0].last == "undefined") || (document.forms[0].last == "[object InputArray]")) ||
((document.forms[0].company == "undefined") || (document.forms[0].company == "[object InputArray]")))
{
parent.controls.reloadDocument();
return;
}
parent.parent.globals.document.vars.first.value = document.forms[0].first.value;
parent.parent.globals.document.vars.last.value = document.forms[0].last.value;
parent.parent.globals.document.vars.company.value = document.forms[0].company.value;
// parent.parent.globals.document.vars.areaCode.value = document.forms[0].areaCode.value;
// parent.parent.globals.document.vars.phoneNumber.value = document.forms[0].phoneNumber.value;
}
// end hiding contents from old browsers -->

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