Compare commits

..

6 Commits

Author SHA1 Message Date
pavlov%netscape.com
0e5b7ae45d branch
git-svn-id: svn://10.0.0.236/branches/IMGLIB2_20010309_BRANCH@89235 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-10 07:11:19 +00:00
pavlov%netscape.com
3cda3c6757 branch
git-svn-id: svn://10.0.0.236/branches/IMGLIB2_20010309_BRANCH@89231 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-10 07:01:56 +00:00
pavlov%netscape.com
6b2837e42a files for imglib2
git-svn-id: svn://10.0.0.236/branches/IMGLIB2_20010309_BRANCH@89230 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-10 07:00:06 +00:00
pavlov%netscape.com
5ff2c07420 more stuff on new branch
git-svn-id: svn://10.0.0.236/branches/IMGLIB2_20010309_BRANCH@89216 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-10 03:41:32 +00:00
pavlov%netscape.com
d51c3a6fa1 gfx to new branch
git-svn-id: svn://10.0.0.236/branches/IMGLIB2_20010309_BRANCH@89214 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-10 03:39:13 +00:00
(no author)
8a8d2539db This commit was manufactured by cvs2svn to create branch
'IMGLIB2_20010309_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/IMGLIB2_20010309_BRANCH@89211 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-10 03:23:36 +00:00
1099 changed files with 354612 additions and 106012 deletions

43
mozilla/LEGAL Normal file
View File

@@ -0,0 +1,43 @@
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.
D) Netscape Communications Corporation ("Netscape") does not guarantee
that any source code or executable code available from the mozilla.org
domain is Year 2000 compliant.

567
mozilla/LICENSE Normal file
View File

@@ -0,0 +1,567 @@
MOZILLA PUBLIC LICENSE
Version 1.1
---------------
1. Definitions.
1.0.1. "Commercial Use" means distribution or otherwise making the
Covered Code available to a third party.
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.8.1. "Licensable" means having the right to grant, to the maximum
extent possible, whether at the time of the initial grant or
subsequently acquired, any and all of the rights conveyed herein.
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.10.1. "Patent Claims" means any patent claim(s), now owned or
hereafter acquired, including without limitation, method, process,
and apparatus claims, in any patent Licensable by grantor.
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 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" (or "Your") 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 more than fifty percent
(50%) 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) under intellectual property rights (other than patent or
trademark) Licensable by Initial Developer to use, reproduce,
modify, display, perform, sublicense and distribute the Original
Code (or portions thereof) with or without Modifications, and/or
as part of a Larger Work; and
(b) under Patents Claims infringed by the making, using or
selling of Original Code, to make, have made, use, practice,
sell, and offer for sale, and/or otherwise dispose of the
Original Code (or portions thereof).
(c) the licenses granted in this Section 2.1(a) and (b) are
effective on the date Initial Developer first distributes
Original Code under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is
granted: 1) for code that You delete from the Original Code; 2)
separate from the Original Code; or 3) for infringements caused
by: i) the modification of the Original Code or ii) the
combination of the Original Code with other software or devices.
2.2. Contributor Grant.
Subject to third party intellectual property claims, each Contributor
hereby grants You a world-wide, royalty-free, non-exclusive license
(a) under intellectual property rights (other than patent or
trademark) Licensable by Contributor, 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
and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or
selling of Modifications made by that Contributor either alone
and/or in combination with its Contributor Version (or portions
of such combination), to make, use, sell, offer for sale, have
made, and/or otherwise dispose of: 1) Modifications made by that
Contributor (or portions thereof); and 2) the combination of
Modifications made by that Contributor with its Contributor
Version (or portions of such combination).
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
effective on the date Contributor first makes Commercial Use of
the Covered Code.
(d) Notwithstanding Section 2.2(b) above, no patent license is
granted: 1) for any code that Contributor has deleted from the
Contributor Version; 2) separate from the Contributor Version;
3) for infringements caused by: i) third party modifications of
Contributor Version or ii) the combination of Modifications made
by that Contributor with other software (except as part of the
Contributor Version) or other devices; or 4) under Patent Claims
infringed by Covered Code in the absence of Modifications made by
that Contributor.
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 Contributor has knowledge that a license under a third party's
intellectual property rights is required to exercise the rights
granted by such Contributor under Sections 2.1 or 2.2,
Contributor 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 Contributor obtains such knowledge after
the Modification is made available as described in Section 3.2,
Contributor shall promptly modify the LEGAL file in all copies
Contributor makes 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 Contributor's Modifications include an application programming
interface and Contributor has knowledge of patent licenses which
are reasonably necessary to implement that API, Contributor must
also include this information in the LEGAL file.
(c) Representations.
Contributor represents that, except as disclosed pursuant to
Section 3.4(a) above, Contributor believes that Contributor's
Modifications are Contributor's original creation(s) and/or
Contributor has sufficient rights to grant the rights conveyed by
this License.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code. 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) where a user would be likely
to look for such a notice. If You created one or more Modification(s)
You may add your name as a Contributor to the notice described in
Exhibit A. You must also duplicate this License in any documentation
for the Source Code where You describe recipients' rights or ownership
rights relating to Covered Code. 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 or ownership rights 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, judicial order, 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",
"MPL", "NPL" or any confusingly similar phrase do not appear in your
license (except to note that your license differs from this 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.
8.1. 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.
8.2. If You initiate litigation by asserting a patent infringement
claim (excluding declatory judgment actions) against Initial Developer
or a Contributor (the Initial Developer or Contributor against whom
You file such action is referred to as "Participant") alleging that:
(a) such Participant's Contributor Version directly or indirectly
infringes any patent, then any and all rights granted by such
Participant to You under Sections 2.1 and/or 2.2 of this License
shall, upon 60 days notice from Participant terminate prospectively,
unless if within 60 days after receipt of notice You either: (i)
agree in writing to pay Participant a mutually agreeable reasonable
royalty for Your past and future use of Modifications made by such
Participant, or (ii) withdraw Your litigation claim with respect to
the Contributor Version against such Participant. If within 60 days
of notice, a reasonable royalty and payment arrangement are not
mutually agreed upon in writing by the parties or the litigation claim
is not withdrawn, the rights granted by Participant to You under
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
the 60 day notice period specified above.
(b) any software, hardware, or device, other than such Participant's
Contributor Version, directly or indirectly infringes any patent, then
any rights granted to You by such Participant under Sections 2.1(b)
and 2.2(b) are revoked effective as of the date You first made, used,
sold, distributed, or had made, Modifications made by that
Participant.
8.3. If You assert a patent infringement claim against Participant
alleging that such Participant's Contributor Version directly or
indirectly infringes any patent where such claim is resolved (such as
by license or settlement) prior to the initiation of patent
infringement litigation, then the reasonable value of the licenses
granted by such Participant under Sections 2.1 or 2.2 shall be taken
into account in determining the amount or value of any payment or
license.
8.4. In the event of termination under Sections 8.1 or 8.2 above,
all end user license agreements (excluding distributors and resellers)
which have been validly granted by You or any distributor hereunder
prior to termination shall survive termination.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY 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
THIS 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, any litigation relating to this License 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.
As between Initial Developer and the Contributors, each party is
responsible for claims and damages arising, directly or indirectly,
out of its utilization of rights under this License and You agree to
work with Initial Developer and Contributors to distribute such
responsibility on an equitable basis. Nothing herein is intended or
shall be deemed to constitute any admission of liability.
13. MULTIPLE-LICENSED CODE.
Initial Developer may designate portions of the Covered Code as
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
Developer permits you to utilize portions of the Covered Code under
Your choice of the NPL or the alternative licenses, if any, specified
by the Initial Developer in the file described in Exhibit A.
EXHIBIT A -Mozilla Public License.
``The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is ______________________________________.
The Initial Developer of the Original Code is ________________________.
Portions created by ______________________ are Copyright (C) ______
_______________________. All Rights Reserved.
Contributor(s): ______________________________________.
Alternatively, the contents of this file may be used under the terms
of the _____ license (the "[___] License"), in which case the
provisions of [______] License are applicable instead of those
above. If you wish to allow use of your version of this file only
under the terms of the [____] License and not to allow others to use
your version of this file under the MPL, indicate your decision by
deleting the provisions above and replace them with the notice and
other provisions required by the [___] License. If you do not delete
the provisions above, a recipient may use your version of this file
under either the MPL or the [___] License."
[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. You should
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]
----------------------------------------------------------------------
AMENDMENTS
The Netscape Public License Version 1.1 ("NPL") consists of the
Mozilla Public License Version 1.1 with the following Amendments,
including Exhibit A-Netscape Public License. Files identified with
"Exhibit A-Netscape Public License" are governed by the Netscape
Public License Version 1.1.
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 trademarks
"Netscape", the "Netscape N and horizon" logo or the "Netscape
lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
"Smart Browsing" even if such marks are included in the Original
Code or Modifications.
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 Netscape Branded Code becoming subject to the terms of
this License, and may license such Netscape Branded Code on
different terms from those contained in this License.
VI. Litigation.
Notwithstanding the limitations of Section 11 above, the
provisions regarding litigation in Section 11(a), (b) and (c) of
the License shall apply to all disputes relating to this License.
EXHIBIT A-Netscape Public License.
"The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla 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-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s): ______________________________________.
Alternatively, the contents of this file may be used under the
terms of the _____ license (the "[___] License"), in which case
the provisions of [______] License are applicable instead of
those above. If you wish to allow use of your version of this
file only under the terms of the [____] License and not to allow
others to use your version of this file under the NPL, indicate
your decision by deleting the provisions above and replace them
with the notice and other provisions required by the [___]
License. If you do not delete the provisions above, a recipient
may use your version of this file under either the NPL or the
[___] License."

180
mozilla/Makefile.in Normal file
View File

@@ -0,0 +1,180 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = .
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/build/unix/modules.mk
ifneq ($(BUILD_MODULES),all)
DIRS = $(BUILD_MODULE_DIRS)
EXPORT_DIRS = $(BUILD_MODULE_DEP_DIRS)
else
DIRS = config build
ifdef MOZ_L10N
DIRS += l10n
endif
ifdef MOZ_JAVA_SUPPLEMENT
DIRS += \
java/util \
java/webclient \
$(NULL)
endif
# boehm needs to be built before XPCOM
ifdef GC_LEAK_DETECTOR
DIRS += gc/boehm
endif
DIRS += $(NSPRPUB_DIR)
DIRS += dbm modules/libreg js string xpcom js/src/xpconnect
ifdef MOZ_OJI
DIRS += js/src/liveconnect
endif
ifndef MOZ_NATIVE_ZLIB
DIRS += modules/zlib
endif
ifndef MOZ_NATIVE_JPEG
DIRS += jpeg
endif
ifdef MOZ_ENABLE_XLIB
DIRS += gfx/src/xlibrgb widget/src/xlibxtbin
endif
ifdef MOZ_ENABLE_GTK
DIRS += widget/src/gtksuperwin widget/src/gtkxtbin
endif
# Linux and Solaris installer needs standalone libjar, hence standalone zlib
ifneq (,$(filter Linux SunOS,$(OS_ARCH)))
DIRS += modules/zlib/standalone
endif
DIRS += \
widget/timer \
include \
modules/libutil \
netwerk \
modules/mpfilelocprovider \
uriloader \
intl \
modules/libpref \
modules/libimg \
modules/oji \
modules/libjar \
caps \
rdf \
expat \
htmlparser \
gfx \
$(NULL)
ifdef USE_IMG2
DIRS += gfx2 modules/libpr0n
endif
DIRS += \
modules/plugin \
dom \
view \
widget \
content \
layout \
db \
docshell \
webshell \
embedding \
editor \
sun-java \
profile \
themes \
$(NULL)
# This must preceed xpfe
ifdef MOZ_JPROF
DIRS += tools/jprof
endif
ifdef MOZ_BUILD_XPFE
DIRS += xpfe
endif
DIRS += xpinstall
ifdef MOZ_EXTENSIONS
DIRS += extensions
endif
ifdef MOZ_MAIL_NEWS
DIRS += mailnews
endif
ifdef MOZ_LEAKY
DIRS += tools/leaky
endif
ifdef ENABLE_TESTS
DIRS += xpcom/tests
endif
ifdef MOZ_LDAP_XPCOM
DIRS += directory/c-sdk/ldap directory/xpcom
endif
DIRS += l10n
ifdef MOZ_STATIC_COMPONENTS
DIRS += modules/staticmod
endif
endif # BUILD_MODULES == all
STATIC_MAKEFILES := $(NSPRPUB_DIR)
GARBAGE_DIRS += dist
DIST_GARBAGE = config.cache config.log config.status config-defs.h \
dependencies.beos config/autoconf.mk config/myrules.mk config/myconfig.mk \
unallmakefiles \
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
include $(topsrcdir)/config/rules.mk
export::
+$(LOOP_OVER_EXPORT_DIRS)
distclean::
cat unallmakefiles | $(XARGS) rm -f
rm -f unallmakefiles $(DIST_GARBAGE)

12
mozilla/aclocal.m4 vendored Normal file
View File

@@ -0,0 +1,12 @@
dnl
dnl Local autoconf macros used with mozilla
dnl The contents of this file are under the Public Domain.
dnl
builtin(include, build/autoconf/glib.m4)dnl
builtin(include, build/autoconf/gtk.m4)dnl
builtin(include, build/autoconf/libIDL.m4)dnl
dnl
define(MOZ_TOPSRCDIR,.)dnl MOZ_TOPSRCDIR is used in altoptions.m4
builtin(include, build/autoconf/altoptions.m4)dnl

1140
mozilla/allmakefiles.sh Executable file

File diff suppressed because it is too large Load Diff

494
mozilla/client.mak Normal file
View File

@@ -0,0 +1,494 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=.
!if !defined(MOZ_TOP)
#enable builds from changed top level directories
MOZ_TOP=mozilla
!endif
MOZ_SRC_FLIPPED = $(MOZ_SRC:\=/)
MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mozilla/dist
!ifdef MOZ_DEBUG
MOZ_OBJDIR = WIN32_D.OBJ
!else
MOZ_OBJDIR = WIN32_O.OBJ
!endif
#
# Command macro defines
#
#//------------------------------------------------------------------------
#// Figure out how to do the pull.
#//------------------------------------------------------------------------
# uncomment these, modify branch tag, and check in to branch for milestones
#MOZ_BRANCH=SeaMonkey_M17_BRANCH
#NSPR_CO_TAG=SeaMonkey_M17_BRANCH
#PSM_CO_TAG=SeaMonkey_M17_BRANCH
#LDAPCSDK_CO_TAG=SeaMonkey_M17_BRANCH
#IMGLIB2_BRANCH=SeaMonkey_M17_BRANCH
#GFX2_BRANCH=SeaMonkey_M17_BRANCH
!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
!if "$(MOZ_CVS_FLAGS)" != ""
CVS_FLAGS=$(MOZ_CVS_FLAGS)
!endif
# let's be explicit about CVSROOT... some windows cvs clients
# are too stupid to correctly work without the -d option
#
# if they are too stupid, they should fail. I am
# commenting this out because this does not work
# under 4nt. (%'s are evaluted differently)
#
# If it breaks you, mail dougt@netscape.com
# and leaf@mozilla.org
#
!if 0
!if defined(CVSROOT)
CVS_FLAGS=$(CVS_FLAGS) -d "$(CVSROOT)"
!endif
!endif
CVSCO = cvs -q $(CVS_FLAGS) co $(CVS_BRANCH) -P
CVSCO_TAG = cvs -q co -P
# Branch tags we use
IMGLIB2_BRANCH =
GFX2_BRANCH =
PLUGIN_BRANCH =
XPCOM_BRANCH =
!if defined(MOZ_DATE)
# CVS commands to pull the appropriate branch versions
CVSCO_LIBPREF = $(CVSCO)
CVSCO_PLUGIN = $(CVSCO)
!else
# CVS commands to pull the appropriate branch versions
CVSCO_LIBPREF = $(CVSCO) -A
CVSCO_PLUGIN = $(CVSCO) -A
!endif
CVSCO_XPCOM = $(CVSCO)
CVSCO_IMGLIB2 = $(CVSCO)
CVSCO_GFX2 = $(CVSCO)
CVSCO_RAPTOR = $(CVSCO)
CVSCO_LIZARD = $(CVSCO)
CVSCO_NETWORK = $(CVSCO)
#//------------------------------------------------------------------------
#// Figure out how to pull NSPR.
#// If no NSPR_CO_TAG is specified, use the default static tag
#//------------------------------------------------------------------------
!if "$(NSPR_CO_TAG)" != ""
NSPR_CO_FLAGS=-r $(NSPR_CO_TAG)
!else
NSPR_CO_FLAGS=-r NSPRPUB_CLIENT_BRANCH
!endif
CVSCO_NSPR = cvs -q $(CVS_FLAGS) co $(NSPR_CO_FLAGS) -P
#//------------------------------------------------------------------------
#// Figure out how to pull NSS and PSM libs.
#// If no NSS_CO_TAG or PSM_CO_TAG is specified, use the default static tag
#//------------------------------------------------------------------------
!if "$(NSS_CO_TAG)" != ""
NSS_CO_FLAGS=-r $(NSS_CO_TAG)
!else
NSS_CO_FLAGS= -r NSS_CLIENT_TAG
!endif
CVSCO_NSS = cvs -q $(CVS_FLAGS) co $(NSS_CO_FLAGS) -P
!if "$(PSM_CO_TAG)" != ""
PSM_CO_FLAGS=-r $(PSM_CO_TAG)
!else
PSM_CO_FLAGS=
!endif
CVSCO_PSM = cvs -q $(CVS_FLAGS) co $(PSM_CO_FLAGS) -P
#//------------------------------------------------------------------------
#// Figure out how to pull LDAP C SDK client libs.
#// If no LDAPCSDK_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!if "$(LDAPCSDK_CO_TAG)" != ""
LDAPCSDK_CO_FLAGS=-r $(LDAPCSDK_CO_TAG)
!else
LDAPCSDK_CO_FLAGS=-r LDAPCSDK_40_BRANCH
!endif
CVSCO_LDAPCSDK = cvs -q $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS) -P
#//------------------------------------------------------------------------
#// Figure out how to pull new image library.
#// If no IMGLIB2_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!if "$(IMGLIB2_CO_TAG)" != ""
IMGLIB2_CO_FLAGS=-r $(IMGLIB2_CO_TAG)
!else
IMGLIB2_CO_FLAGS=
!endif
CVSCO_IMGLIB2 = cvs -q $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS) -P
#//------------------------------------------------------------------------
#// Figure out how to pull new image library.
#// If no GFX2_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!if "$(GFX2_CO_TAG)" != ""
GFX2_CO_FLAGS=-r $(GFX2_CO_TAG)
!else
GFX2_CO_FLAGS=
!endif
CVSCO_GFX2 = cvs -q $(CVS_FLAGS) co $(GFX2_CO_FLAGS) -P
## The master target
############################################################
pull_and_build_all: pull_all depend build_all
## Rules for pulling the source from the cvs repository
############################################################
pull_clobber_and_build_all: pull_all clobber_all build_all
pull_all: pull_nspr pull_psm pull_ldapcsdk pull_gfx2 pull_imglib2 pull_seamonkey
pull_nspr: pull_clientmak
cd $(MOZ_SRC)\.
$(CVSCO_NSPR) mozilla/nsprpub
pull_nss:
cd $(MOZ_SRC)\.
$(CVSCO_NSS) mozilla/security/coreconf
$(CVSCO_NSS) mozilla/security/nss
pull_psm: pull_nss
cd $(MOZ_SRC)\.
$(CVSCO_PSM) mozilla/security/manager
$(CVSCO_PSM) mozilla/security/psm
$(CVSCO_PSM) mozilla/security/makefile.win
pull_ldapcsdk:
cd $(MOZ_SRC)\.
$(CVSCO_LDAPCSDK) mozilla/directory/c-sdk
pull_gfx2:
cd $(MOZ_SRC)\.
$(CVSCO_GFX2) mozilla/gfx2
pull_imglib2:
cd $(MOZ_SRC)\.
$(CVSCO_IMGLIB2) mozilla/modules/libpr0n
pull_xpconnect: pull_nspr
cd $(MOZ_SRC)\.
$(CVSCO) mozilla/include
$(CVSCO) mozilla/config
$(CVSCO) -l mozilla/js
$(CVSCO) -l mozilla/js/src
$(CVSCO) mozilla/js/src/fdlibm
$(CVSCO) mozilla/js/src/xpconnect
$(CVSCO) mozilla/modules/libreg
$(CVSCO) mozilla/xpcom
$(CVSCO) mozilla/string
# pull either layout only or seamonkey the browser
pull_layout:
cd $(MOZ_SRC)\.
$(CVSCO) RaptorWin
pull_seamonkey: pull_clientmak
cd $(MOZ_SRC)\.
$(CVSCO) SeaMonkeyAll
pull_clientmak:
cd $(MOZ_SRC)\.
$(CVSCO) mozilla/client.mak
############################################################
# nmake has to be hardcoded, or we have to depend on mozilla/config
# being pulled already to figure out what $(NMAKE) should be.
clobber_all: clobber_nspr clobber_psm clobber_seamonkey
build_all: build_nspr build_seamonkey
distclean:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win distclean MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
@cd $(MOZ_SRC)\$(MOZ_TOP)
nmake /f client.mak clobber_psm
nmake /f client.mak clobber_seamonkey
clobber_nspr:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
clobber_psm:
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
nmake -f makefile.win clobber_all
clobber_xpconnect:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
-rd /s /q dist
set DIST_DIRS=1
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\js
nmake -f makefile.win clobber_all
clobber_seamonkey:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
-rd /s /q dist
set DIST_DIRS=1
set LAYOUT_DIRS=1
set CLIENT_DIRS=1
nmake -f makefile.win clobber_all
depend:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
set DIST_DIRS=1
set LAYOUT_DIRS=1
set CLIENT_DIRS=1
nmake -f makefile.win depend
depend_xpconnect:
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
nmake -f makefile.win depend
build_nspr:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
build_psm:
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
nmake -f makefile.win
build_xpconnect: build_nspr
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win export
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win install
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
nmake -f makefile.win all
build_seamonkey:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
set DIST_DIRS=1
set LAYOUT_DIRS=1
set CLIENT_DIRS=1
nmake -f makefile.win all
build_client:
@cd $(MOZ_SRC)\mozilla\.
set CLIENT_DIRS=1
nmake -f makefile.win all
build_layout:
@cd $(MOZ_SRC)\mozilla\.
set LAYOUT_DIRS=1
nmake -f makefile.win all
build_dist:
@cd $(MOZ_SRC)\mozilla\.
set DIST_DIRS=1
nmake -f makefile.win all
install:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
set DIST_DIRS=1
set LAYOUT_DIRS=1
set CLIENT_DIRS=1
nmake -f makefile.win install
export:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
nmake -f makefile.win export
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
set DIST_DIRS=1
set LAYOUT_DIRS=1
set CLIENT_DIRS=1
nmake -f makefile.win export
clobber_dist:
@cd $(MOZ_SRC)\mozilla\.
set DIST_DIRS=1
nmake -f makefile.win clobber_all
clobber_client:
@cd $(MOZ_SRC)\mozilla\.
set CLIENT_DIRS=1
nmake -f makefile.win clobber_all
clobber_layout:
@cd $(MOZ_SRC)\mozilla\.
set LAYOUT_DIRS=1
nmake -f makefile.win clobber_all
browse_info::
cd $(MOZ_SRC)\$(MOZ_TOP)
-dir /s /b *.sbr > sbrlist.tmp
-bscmake /Es /o mozilla.bsc @sbrlist.tmp
-rm sbrlist.tmp
regchrome::
@cd $(MOZ_SRC)\mozilla\.
set DIST_DIRS=1
set LAYOUT_DIRS=1
set CLIENT_DIRS=1
nmake /f makefile.win regchrome
deliver::
@cd $(MOZ_SRC)\mozilla\.
set DIST_DIRS=1
set LAYOUT_DIRS=1
set CLIENT_DIRS=1
nmake /f makefile.win splitsymbols
#//------------------------------------------------------------------------
#// 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)\mozilla\xyzzy.tmp )
ERR_MESSAGE=$(ERR_MESSAGE)^
MOZ_SRC isn't set correctly: [$(MOZ_SRC)\mozilla]!=[$(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]^
[build_all]^
^
Environment variables:^
^
MOZ_BITS set to 32^
MOZ_SRC set to the directory above mozilla or "$(MAKEDIR)\.."^
MOZ_TOOLS set to the directory containing the needed tools ^
!ERROR $(ERR_MESSAGE)
!endif

486
mozilla/client.mk Normal file
View File

@@ -0,0 +1,486 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Stephen Lamm
# Build the Mozilla client.
#
# This needs CVSROOT set to work, e.g.,
# setenv CVSROOT :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
# or
# setenv CVSROOT :pserver:username%somedomain.org@cvs.mozilla.org:/cvsroot
#
# To checkout and build a tree,
# 1. cvs co mozilla/client.mk
# 2. cd mozilla
# 3. gmake -f client.mk
#
# Other targets (gmake -f client.mk [targets...]),
# checkout
# build
# clean (realclean is now the same as clean)
# distclean
#
# See http://www.mozilla.org/build/unix.html for more information.
#
# Options:
# MOZ_OBJDIR - Destination object directory
# MOZ_CO_DATE - Date tag to use for checkout (default: none)
# MOZ_CO_MODULE - Module to checkout (default: SeaMonkeyAll)
# MOZ_CVS_FLAGS - Flags to pass cvs (default: -q -z3)
# MOZ_CO_FLAGS - Flags to pass after 'cvs co' (default: -P)
# MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
# MOZ_CO_BRANCH - Branch tag (Depricated. Use MOZ_CO_TAG below.)
#
#######################################################################
# Checkout Tags
#
# For branches, uncomment the MOZ_CO_TAG line with the proper tag,
# and commit this file on that tag.
#MOZ_CO_TAG = <tag>
NSPR_CO_TAG = NSPRPUB_CLIENT_BRANCH
PSM_CO_TAG = #We will now build PSM from the tip instead of a branch.
NSS_CO_TAG = NSS_CLIENT_TAG
LDAPCSDK_CO_TAG = LDAPCSDK_40_BRANCH
GFX2_CO_TAG =
IMGLIB2_CO_TAG =
BUILD_MODULES = all
#######################################################################
# Defines
#
CWD := $(shell pwd)
ifeq "$(CWD)" "/"
CWD := /.
endif
ifneq (, $(wildcard client.mk))
# Ran from mozilla directory
ROOTDIR := $(shell dirname $(CWD))
TOPSRCDIR := $(CWD)
else
# Ran from mozilla/.. directory (?)
ROOTDIR := $(CWD)
TOPSRCDIR := $(CWD)/mozilla
endif
# on os2, TOPSRCDIR may have two forward slashes in a row, which doesn't
# work; replace first instance with one forward slash
TOPSRCDIR := $(shell echo "$(TOPSRCDIR)" | sed -e 's%//%/%')
# if ROOTDIR equals only drive letter (i.e. "C:"), set to "/"
DIRNAME := $(shell echo "$(ROOTDIR)" | sed -e 's/^.://')
ifeq ($(DIRNAME),)
ROOTDIR := /.
endif
AUTOCONF := autoconf
MKDIR := mkdir
SH := /bin/sh
ifndef MAKE
MAKE := gmake
endif
CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
ifdef CONFIG_GUESS_SCRIPT
CONFIG_GUESS = $(shell $(CONFIG_GUESS_SCRIPT))
else
_IS_FIRST_CHECKOUT := 1
endif
####################################
# CVS
# Add the CVS root to CVS_FLAGS if needed
CVS_ROOT_IN_TREE := $(shell cat $(TOPSRCDIR)/CVS/Root 2>/dev/null)
ifneq ($(CVS_ROOT_IN_TREE),)
ifneq ($(CVS_ROOT_IN_TREE),$(CVSROOT))
CVS_FLAGS := -d $(CVS_ROOT_IN_TREE)
endif
endif
CVSCO = $(strip cvs $(CVS_FLAGS) co $(CVS_CO_FLAGS))
CVSCO_LOGFILE := $(ROOTDIR)/cvsco.log
CVSCO_LOGFILE := $(shell echo $(CVSCO_LOGFILE) | sed s%//%/%)
ifdef MOZ_CO_TAG
CVS_CO_FLAGS := -r $(MOZ_CO_TAG)
endif
####################################
# Load mozconfig Options
# See build pages, http://www.mozilla.org/build/unix.html,
# for how to set up mozconfig.
MOZCONFIG_LOADER := mozilla/build/autoconf/mozconfig2client-mk
MOZCONFIG_FINDER := mozilla/build/autoconf/mozconfig-find
MOZCONFIG_MODULES := mozilla/build/unix/modules.mk
run_for_side_effects := \
$(shell cd $(ROOTDIR); \
if test "$(_IS_FIRST_CHECKOUT)"; then \
$(CVSCO) $(MOZCONFIG_FINDER) $(MOZCONFIG_LOADER) $(MOZCONFIG_MODULES); \
else true; \
fi; \
$(MOZCONFIG_LOADER) $(TOPSRCDIR) mozilla/.mozconfig.mk > mozilla/.mozconfig.out)
include $(TOPSRCDIR)/.mozconfig.mk
include $(TOPSRCDIR)/build/unix/modules.mk
####################################
# Options that may come from mozconfig
# Change CVS flags if anonymous root is requested
ifdef MOZ_CO_USE_MIRROR
CVS_FLAGS := -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
endif
# MOZ_CVS_FLAGS - Basic CVS flags
ifeq "$(origin MOZ_CVS_FLAGS)" "undefined"
CVS_FLAGS := $(CVS_FLAGS) -q -z 3
else
CVS_FLAGS := $(MOZ_CVS_FLAGS)
endif
# This option is depricated. The best way to have client.mk pull a tag
# is to set MOZ_CO_TAG (see above) and commit that change on the tag.
ifdef MOZ_CO_BRANCH
CVS_CO_FLAGS := -r $(MOZ_CO_BRANCH)
endif
# MOZ_CO_FLAGS - Anything that we should use on all checkouts
ifeq "$(origin MOZ_CO_FLAGS)" "undefined"
CVS_CO_FLAGS := $(CVS_CO_FLAGS) -P
else
CVS_CO_FLAGS := $(CVS_CO_FLAGS) $(MOZ_CO_FLAGS)
endif
ifdef MOZ_CO_DATE
CVS_CO_DATE_FLAGS := -D "$(MOZ_CO_DATE)"
endif
ifeq "$(origin MOZ_MAKE_FLAGS)" "undefined"
MOZ_MAKE_ENV :=
else
MOZ_MAKE_ENV := MAKE="$(MAKE) $(MOZ_MAKE_FLAGS)"
endif
ifdef MOZ_OBJDIR
OBJDIR := $(MOZ_OBJDIR)
MOZ_MAKE := $(MOZ_MAKE_ENV) $(MAKE) -C $(OBJDIR)
else
OBJDIR := $(TOPSRCDIR)
MOZ_MAKE := $(MOZ_MAKE_ENV) $(MAKE)
endif
####################################
# CVS defines for PSM
#
PSM_CO_MODULE= mozilla/security/psm mozilla/security/manager mozilla/security/Makefile.in
PSM_CO_FLAGS := -P -A
ifdef PSM_CO_TAG
PSM_CO_FLAGS := $(PSM_CO_FLAGS) -r $(PSM_CO_TAG)
endif
CVSCO_PSM = cvs $(CVS_FLAGS) co $(PSM_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(PSM_CO_MODULE)
####################################
# CVS defines for NSS
#
NSS_CO_MODULE= mozilla/security/nss mozilla/security/coreconf
NSS_CO_FLAGS := -P
ifdef NSS_CO_TAG
NSS_CO_FLAGS := $(NSS_CO_FLAGS) -r $(NSS_CO_TAG)
endif
CVSCO_NSS = cvs $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSS_CO_MODULE)
####################################
# CVS defines for NSPR
#
NSPR_CO_MODULE = mozilla/nsprpub
NSPR_CO_FLAGS := -P
ifdef NSPR_CO_TAG
NSPR_CO_FLAGS := $(NSPR_CO_FLAGS) -r $(NSPR_CO_TAG)
endif
CVSCO_NSPR = cvs $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSPR_CO_MODULE)
####################################
# CVS defines for the C LDAP SDK
#
LDAPCSDK_CO_MODULE = mozilla/directory/c-sdk
LDAPCSDK_CO_FLAGS := -P
ifdef LDAPCSDK_CO_TAG
LDAPCSDK_CO_FLAGS := $(LDAPCSDK_CO_FLAGS) -r $(LDAPCSDK_CO_TAG)
endif
CVSCO_LDAPCSDK = cvs $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(LDAPCSDK_CO_MODULE)
####################################
# CVS defines for gfx2
#
GFX2_CO_MODULE = mozilla/gfx2
GFX2_CO_FLAGS := -P
ifdef GFX2_CO_TAG
GFX2_CO_FLAGS := $(GFX2_CO_FLAGS) -r $(GFX2_CO_TAG)
endif
CVSCO_GFX2 = cvs $(CVS_FLAGS) co $(GFX2_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(GFX2_CO_MODULE)
####################################
# CVS defines for new image library
#
IMGLIB2_CO_MODULE = mozilla/modules/libpr0n
IMGLIB2_CO_FLAGS := -P
ifdef IMGLIB2_CO_TAG
IMGLIB2_CO_FLAGS := $(IMGLIB2_CO_FLAGS) -r $(IMGLIB2_CO_TAG)
endif
CVSCO_IMGLIB2 = cvs $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(IMGLIB2_CO_MODULE)
####################################
# CVS defines for standalone modules
#
ifneq ($(BUILD_MODULES),all)
MOZ_CO_MODULE := $(filter-out $(NSPRPUB_DIR) security directory/c-sdk, $(BUILD_MODULE_CVS))
MOZ_CO_MODULE += allmakefiles.sh client.mk aclocal.m4 configure configure.in
MOZ_CO_MODULE += Makefile.in
MOZ_CO_MODULE := $(addprefix mozilla/, $(MOZ_CO_MODULE))
NOSUBDIRS_MODULE := $(addprefix mozilla/, $(BUILD_MODULE_CVS_NS))
ifneq ($(NOSUBDIRS_MODULE),)
CVSCO_NOSUBDIRS := $(CVSCO) -l $(CVS_CO_DATE_FLAGS) $(NOSUBDIRS_MODULE)
endif
ifeq (,$(filter $(NSPRPUB_DIR), $(BUILD_MODULE_CVS)))
CVSCO_NSPR :=
endif
ifeq (,$(filter security security/manager, $(BUILD_MODULE_CVS)))
CVSCO_PSM :=
CVSCO_NSS :=
endif
ifeq (,$(filter directory/c-sdk, $(BUILD_MODULE_CVS)))
CVSCO_LDAPCSDK :=
endif
ifeq (,$(filter gfx2, $(BUILD_MODULE_CVS)))
CVSCO_GFX2 :=
endif
ifeq (,$(filter modules/libpr0n, $(BUILD_MODULE_CVS)))
CVSCO_IMGLIB2 :=
endif
else
# Do not pull PSM/NSS by default
CVSCO_PSM :=
CVSCO_NSS :=
endif
####################################
# CVS defines for SeaMonkey
#
ifeq ($(MOZ_CO_MODULE),)
MOZ_CO_MODULE := SeaMonkeyAll
endif
CVSCO_SEAMONKEY := $(CVSCO) $(CVS_CO_DATE_FLAGS) $(MOZ_CO_MODULE)
#######################################################################
# Rules
#
# Print out any options loaded from mozconfig.
all build checkout clean depend distclean export install realclean::
@if test -f .mozconfig.out; then \
cat .mozconfig.out; \
rm -f .mozconfig.out; \
else true; \
fi
ifdef _IS_FIRST_CHECKOUT
all:: checkout build
else
all:: checkout depend build
endif
# Windows equivalents
pull_all: checkout
build_all: build
clobber clobber_all: clean
pull_and_build_all: checkout depend build
# Do everything from scratch
everything: checkout clean build
####################################
# CVS checkout
#
checkout::
# @: Backup the last checkout log.
@if test -f $(CVSCO_LOGFILE) ; then \
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
else true; \
fi
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
@echo '$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk'; \
cd $(ROOTDIR); \
$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk && \
$(MAKE) -f mozilla/client.mk real_checkout
real_checkout:
# @: Start the checkout. Split the output to the tty and a log file. \
# : If it fails, touch an error file because "tee" hides the error.
@failed=.cvs-failed.tmp; rm -f $$failed*; \
cvs_co() { echo "$$@" ; \
("$$@" || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
if test -f $$failed; then false; else true; fi; }; \
cvs_co $(CVSCO_NSPR) && \
cvs_co $(CVSCO_PSM) && \
cvs_co $(CVSCO_NSS) && \
cvs_co $(CVSCO_LDAPCSDK) && \
cvs_co $(CVSCO_GFX2) && \
cvs_co $(CVSCO_IMGLIB2) && \
cvs_co $(CVSCO_SEAMONKEY) && \
cvs_co $(CVSCO_NOSUBDIRS)
@echo "checkout finish: "`date` | tee -a $(CVSCO_LOGFILE)
# @: Check the log for conflicts. ;
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
if test "$$conflicts" ; then \
echo "$(MAKE): *** Conflicts during checkout." ;\
echo "$$conflicts" ;\
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
false; \
else true; \
fi
####################################
# Web configure
WEBCONFIG_FILE := $(HOME)/.mozconfig
MOZCONFIG2CONFIGURATOR := build/autoconf/mozconfig2configurator
webconfig:
@cd $(TOPSRCDIR); \
url=`$(MOZCONFIG2CONFIGURATOR) $(TOPSRCDIR)`; \
echo Running netscape with the following url: ;\
echo ;\
echo $$url ;\
netscape -remote "openURL($$url)" || netscape $$url ;\
echo ;\
echo 1. Fill out the form on the browser. ;\
echo 2. Save the results to $(WEBCONFIG_FILE)
#####################################################
# First Checkout
ifdef _IS_FIRST_CHECKOUT
# First time, do build target in a new process to pick up new files.
build::
$(MAKE) -f $(TOPSRCDIR)/client.mk
else
#####################################################
# After First Checkout
####################################
# Configure
CONFIG_STATUS := $(wildcard $(OBJDIR)/config.status)
CONFIG_CACHE := $(wildcard $(OBJDIR)/config.cache)
ifdef RUN_AUTOCONF_LOCALLY
EXTRA_CONFIG_DEPS := \
$(TOPSRCDIR)/aclocal.m4 \
$(TOPSRCDIR)/build/autoconf/gtk.m4 \
$(TOPSRCDIR)/build/autoconf/altoptions.m4 \
$(NULL)
$(TOPSRCDIR)/configure: $(TOPSRCDIR)/configure.in $(EXTRA_CONFIG_DEPS)
@echo Generating $@ using autoconf
cd $(TOPSRCDIR); $(AUTOCONF)
endif
CONFIG_STATUS_DEPS_L10N := $(wildcard $(TOPSRCDIR)/l10n/makefiles.all)
CONFIG_STATUS_DEPS := \
$(TOPSRCDIR)/configure \
$(TOPSRCDIR)/allmakefiles.sh \
$(TOPSRCDIR)/.mozconfig.mk \
$(wildcard $(TOPSRCDIR)/nsprpub/configure) \
$(wildcard $(TOPSRCDIR)/directory/c-sdk/ldap/configure) \
$(wildcard $(TOPSRCDIR)/mailnews/makefiles) \
$(CONFIG_STATUS_DEPS_L10N) \
$(wildcard $(TOPSRCDIR)/themes/makefiles) \
$(NULL)
# configure uses the program name to determine @srcdir@. Calling it without
# $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
# path of $(TOPSRCDIR).
ifeq ($(TOPSRCDIR),$(OBJDIR))
CONFIGURE := ./configure
else
CONFIGURE := $(TOPSRCDIR)/configure
endif
$(OBJDIR)/Makefile $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
@if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi
@echo cd $(OBJDIR);
@echo $(CONFIGURE)
@cd $(OBJDIR) && $(CONFIGURE_ENV_ARGS) $(CONFIGURE) \
|| ( echo "*** Fix above errors and then restart with\
\"$(MAKE) -f client.mk build\"" && exit 1 )
@touch $(OBJDIR)/Makefile
ifdef CONFIG_STATUS
$(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
cd $(OBJDIR); \
CONFIG_FILES=config/autoconf.mk ./config.status
endif
####################################
# Depend
depend:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) $@;
####################################
# Build it
build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) export && $(MOZ_MAKE) install
####################################
# Other targets
# Pass these target onto the real build system
install export clean realclean distclean:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) $@
cleansrcdir:
@cd $(TOPSRCDIR); \
if [ -f webshell/embed/gtk/Makefile ]; then \
$(MAKE) -C webshell/embed/gtk distclean; \
fi; \
if [ -f Makefile ]; then \
$(MAKE) distclean ; \
else \
echo "Removing object files from srcdir..."; \
rm -fr `find . -type d \( -name .deps -print -o -name CVS \
-o -exec test ! -d {}/CVS \; \) -prune \
-o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
build/autoconf/clean-config.sh; \
fi;
# (! IS_FIRST_CHECKOUT)
endif
.PHONY: checkout real_checkout depend build export install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything

116
mozilla/config/Makefile.in Normal file
View File

@@ -0,0 +1,116 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PROGRAM = nsinstall$(BIN_SUFFIX)
ifdef CROSS_COMPILE
HOST_PROGRAM = host_nsinstall
endif
CSRCS = nsinstall.c pathsub.c
PLSRCS = nfspwd.pl revdepth.pl
ifdef CROSS_COMPILE
HOST_CSRCS = $(CSRCS)
endif
TARGETS = $(HOST_PROGRAM) $(PROGRAM) $(PLSRCS:.pl=)
# Generate the build number on the fly.
TARGETS += build_number nsBuildID.h
ifdef USE_ELF_DYNSTR_GC
TARGETS += elf-dynstr-gc
endif
# IMPORTANT: Disable NSBUILDROOT for this directory only, otherwise we have
# a recursive rule for finding nsinstall and the Perl scripts.
ifdef NSBUILDROOT
override NSBUILDROOT :=
endif
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH), Linux)
DEFINES += -D_BSD_SOURCE
endif
ifeq ($(MOZ_OS2_TOOLS),VACPP)
LOCAL_INCLUDES += -I$(srcdir)/os2
HSRCS += dirent.h getopt.h
endif
ifeq ($(OS_CONFIG),SunOS4.1)
NSPR_CFLAGS += -I$(srcdir)/../nsprpub/pr/include/md
endif
ifeq ($(OS_CONFIG),Rhapsody10.0)
NSPR_CFLAGS += -DGETCWD_CANT_MALLOC
endif
export:: $(TARGETS)
$(INSTALL) -m 444 nsBuildID.h $(DIST)/include
ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(INSTALL) -m 444 $(srcdir)/os2/dirent.h $(DIST)/include
$(INSTALL) -m 444 $(srcdir)/os2/getopt.h $(DIST)/include
endif
GARBAGE += build_number nsBuildId.h
ifneq ($(origin BUILD_OFFICIAL)_$(origin MOZILLA_OFFICIAL),undefined_undefined)
_BN_OFFICIAL=1
else
_BN_OFFICIAL=
endif
build_number: FORCE
$(PERL) -I$(srcdir) $(srcdir)/bdate.pl $@ $(_BN_OFFICIAL)
nsBuildID.h: nsBuildID.h.in build_number
$(RM) $@
$(PERL) -I$(srcdir) $(srcdir)/aboutime.pl $@ build_number $<
elf-dynstr-gc: elf-dynstr-gc.c Makefile Makefile.in
$(CC) $(COMPILE_CFLAGS) $(GLIB_CFLAGS) $(GLIB_LIBS) $(LDFLAGS) -o $@ $<
ifdef USE_ELF_DYNSTR_GC
export:: elf-dynstr-gc
$(INSTALL) -m 555 elf-dynstr-gc $(DIST)/bin
endif
FORCE:
ifdef MKDEPEND_DIR
clean clobber realclean clobber_all::
cd $(MKDEPEND_DIR); $(MAKE) $@
endif
ifdef MOZILLA_DETECT
clean clobber realclean clobber_all::
cd $(MOZILLA_DETECT_DIR); $(MAKE) $@
endif

71
mozilla/config/OpenVMS.mk Normal file
View File

@@ -0,0 +1,71 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# Even though we use AUTOCONF, there are just too many things that need
# fixing up to do it any other way than via an architecture specific file.
#
# If we're not using NSBUILDROOT, then make sure we use multiple object
# directories. We want this name to be relatively short, and to be different
# from what NSPR uses (so that we can wipe out Mozilla objects without
# wiping NSPR objects.
# We don't want -KPIC as it forces the compiler to generate a .i file.
DSO_PIC_CFLAGS =
# We don't want the standard set of UNIX libraries.
OS_LIBS =
# Define VMS
OS_CFLAGS += -DVMS -DVMS_AS_IS -Wc,names=\(short,as\)
OS_CXXFLAGS += -DVMS -DVMS_AS_IS -Wc,names=\(short,as\)
# If we are building POSIX images, then these HOST symbols get used.
# We don't want to compile any POSIX image debug, so always remove -g.
# xpild accvio's if built with -O, so don't.
HOST_CC = c89
HOST_CXX = cxx
ifeq ($(PROGRAM),xpidl)
HOST_CFLAGS = $(filter-out -g -O,$(OS_CFLAGS)) -DGETCWD_CANT_MALLOC
else
HOST_CFLAGS = $(filter-out -g -O,$(OS_CFLAGS)) -DGETCWD_CANT_MALLOC -O
endif
HOST_CXXFLAGS = $(filter-out -g -O,$(OS_CXXFLAGS)) -O
# In addition, we want to lose the OS_FLAGS for POSIX builds.
ifdef INTERNAL_TOOLS
OS_LDFLAGS =
endif
# Although IS_COMPONENT is set in the Makefile, for xpconnect it is not set
# until AFTER config.mk (and therefore this file) included, hence it appears
# as unset. So for this module only, set IS_COMPONENT here.
ifeq ($(MODULE),xpconnect)
IS_COMPONENT = 1
endif
# This is where our Sharable Image trickery goes.
AS = vmsas $(OS_CFLAGS)
ifdef IS_COMPONENT
OS_LDFLAGS += IS_COMPONENT SRCDIR=$(srcdir)
endif
LD = vmsld $(OS_LDFLAGS)
DSO_LDOPTS =
MKSHLIB = $(LD)

BIN
mozilla/config/W95MAKE.EXE Executable file

Binary file not shown.

BIN
mozilla/config/W95MKDIR.EXE Executable file

Binary file not shown.

83
mozilla/config/W95make.c Normal file
View File

@@ -0,0 +1,83 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
/*
* A feeble attempt at recursive make on win95 - spider 1/98
*
* argv[1] == target
* argv[2] == end directory (full)
* argv[3...n] == list of source directories
*
*/
void main(int argc, char **argv)
{
char *args[7];
int n = 0 ;
int rc = 0 ;
/* Set up parameters to be sent: Sorry for the hardcode!*/
args[0] = "-nologo";
args[1] = "-nologo";
args[2] = "-S";
args[3] = "-f";
args[4] = "makefile.win";
args[5] = argv[1] ;
args[6] = NULL ;
if (argc < 3) {
fprintf(stderr, "w95make: Not enough arguments, you figure it out\n");
exit (666) ;
}
while(argv[n+3] != NULL) {
if (_chdir(argv[n+3]) != 0) {
fprintf(stderr, "w95make: Could not change to directory %s ... skipping\n", argv[n+3]);
} else {
fprintf(stdout, "w95make: Entering Directory %s\\%s with target %s\n", argv[2], argv[n+3], argv[1]);
if ((rc = _spawnvp(_P_WAIT,"nmake", args)) != 0) {
fprintf(stderr, "w95make: nmake failed in directory %s with error code %d\n", argv[n+3], rc);
exit(rc);
}
if (_chdir(argv[2]) != 0) {
fprintf(stderr, "w95make: Could not change back to directory %s\n", argv[2]);
exit (666) ;
}
fprintf(stdout, "w95make: Leaving Directory %s\\%s with target %s\n", argv[2], argv[n+3], argv[1]);
}
n++;
}
exit(0);
}

42
mozilla/config/W95mkdir.c Normal file
View File

@@ -0,0 +1,42 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
/*
* win95 mkdir that responds nicely if the directory already exists - spider 1/98
*
*/
void main(int argc, char **argv)
{
if (argc < 1) {
fprintf(stderr, "w95mkdir: Not enough arguments, you figure it out\n");
exit (666) ;
}
_mkdir(argv[1]);
}

117
mozilla/config/WIN16 Normal file
View File

@@ -0,0 +1,117 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#//------------------------------------------------------------------------
#//
#// Win16 Configuration file
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Define the OS dependent commands used by MAKE
#//
#//------------------------------------------------------------------------
CC=cl
LD=$(MOZ_TOOLS)\bin\optlinks.exe
AR=$(DEPTH)\CONFIG\TLIB.EXE /P64 /C
#AR=lib /NOLOGO /BATCH /NOIGNORECASE
RC=rc
#RM=del /F /Q
#RM_R=del /F /S /Q
RM=rm -f
RM_R=rm -fr
CP=cp
AWK=$(MOZ_TOOLS)\bin\gawk.exe
RANLIB=$(DEPTH)\config\true.bat
!ifndef MOZ_DEBUG
JAVAH_PROG=$(DEPTH)\dist\$(DIST_PREFIX)32_o.obj\bin\javah.exe
!else
JAVAH_PROG=$(DEPTH)\dist\$(DIST_PREFIX)32_d.obj\bin\javah.exe
!endif
#//------------------------------------------------------------------------
#//
#// Define Debug and optimization flags
#//
#//------------------------------------------------------------------------
!ifndef MOZ_DEBUG
!ifndef OPTIMIZER
OPTIMIZER=-Ox -Os -DDEVELOPER_DEBUG
!endif
OS_LFLAGS=
!else
!if defined(MOZ_FULL_DEBUG_INFO) || ("$(MAKE_OBJ_TYPE)" == "DLL")
OPTIMIZER=-Z7
!else if defined(MOZ_DEBUG_FLAG)
OPTIMIZER=$(MOZ_DEBUG_FLAG)
!else
OPTIMIZER=-Zd
!endif
OPTIMIZER=$(OPTIMIZER) -Od -DDEBUG -UNDEBUG
OS_LFLAGS=/CO
!endif
!if defined (MOZ_LITE)
OPTIMIZER=$(OPTIMIZER) -DMOZ_LITE
!endif
#//------------------------------------------------------------------------
#//
#// Specify the OS dependent compiler flags, linker flags and libraries
#//
#//------------------------------------------------------------------------
!ifdef 286_INSTRUCTIONS
INSTRUCTIONS=-G2
!else
INSTRUCTIONS=-G3
!endif
OS_CFLAGS=$(INSTRUCTIONS) -AL -Gx- -Gf -Gd -Gs -W3 -nologo \
!ifdef MOZ_JAVA
-DSEG_ARRAY \
!endif
-D_X86_ -D_WINDOWS -DXP_PC -DSW_THREADS
OS_LFLAGS=$(OS_LFLAGS) /NOE /NOD /NOI /XNOI \
/ALIGN:16 /BYORDINAL /FARCALL \
/PACKC:61440 /PACKD /REORDERSEGMENTS \
/DETAILEDMAP /XREF /ONERROR:NOEXE /NOLOGO /WARNDUPS
OS_LIBS=LIBW.LIB TOOLHELP.LIB
#//------------------------------------------------------------------------
#//
#// Specify the special flags for creating EXEs
#//
#//------------------------------------------------------------------------
EXE_CFLAGS=/GA /Gt3
EXE_LFLAGS=/STACK:20000
EXE_LIBS=OLDNAMES.LIB LLIBCEW.LIB
#//------------------------------------------------------------------------
#//
#// Specify the special flags for creating DLLs
#//
#//------------------------------------------------------------------------
!ifndef DLL_CFLAGS
DLL_CFLAGS=/GD /D "_WINDLL"
!endif
DLL_LFLAGS=
DLL_LIBS=OLDNAMES.LIB LDLLCEW.LIB

184
mozilla/config/WIN32 Normal file
View File

@@ -0,0 +1,184 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#//------------------------------------------------------------------------
#//
#// Win32 Configuration file
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Define the OS dependent commands used by MAKE
#//
#//------------------------------------------------------------------------
CC=cl
LD=link
AR=lib
RC=rc
#RM=del /F /Q
#RM_R=del /F /S /Q
RM=rm -f
RM_R=rm -fr
CP=cp
AWK=$(MOZ_TOOLS)\bin\gawk.exe
RANLIB=$(DEPTH)\config\true.bat
JAVAH=$(DIST)\bin\javah.exe
JAVA=$(MOZ_TOOLS)\bin\java.exe
!ifndef JAVAH_IN_JAVA
JAVAH_PROG = $(DIST)\bin\javah.exe
!else
JAVAH_PROG = $(JAVA) netscape.tools.jric.Main
!endif
#//------------------------------------------------------------------------
#//
#// Define Debug and optimization flags
#//
#//------------------------------------------------------------------------
!ifdef MOZ_DEBUG
#
# Uncomment for MSVC debug malloc logging...
#
#OPTIMIZER=-Zi -DDEBUG -UNDEBUG -D_DEBUG -D_CRTDBG_MAP_ALLOC
OPTIMIZER=-Zi -DDEBUG -UNDEBUG -D_DEBUG
!if defined(GLOWCODE) && "$(MOZ_BITS)"=="32"
OS_LFLAGS=/DEBUG /DEBUGTYPE:BOTH /INCLUDE:_GlowCode /PDB:NONE
!else
OS_LFLAGS=/DEBUG /DEBUGTYPE:CV /PDB:$(PDBFILE)
!endif
!else
# if MOZ_DEBUG is not set and MOZ_PROFILE is set, then we generate
# an optimized build with debugging symbols. Useful for debugging
# compiler optimization bugs, as well as running with Quantify.
!ifdef MOZ_PROFILE
OS_LFLAGS=/DEBUG /DEBUGTYPE:CV /PDB:NONE /OPT:REF /OPT:nowin98
OPTIMIZER=-Zi -O1 -UDEBUG -DNDEBUG
!else
# MOZ_PROFILE not set.
# optimize it, no symbols
#
OPTIMIZER=-O1 -UDEBUG -DNDEBUG
OS_LFLAGS=/OPT:nowin98
!endif
# MOZ_PROFILE
!endif
# MOZ_DEBUG
#//------------------------------------------------------------------------
#//
#// Select the correct RTL to link...
#//
#// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
#// DLL version of the RTL is used...
#//
#//------------------------------------------------------------------------
!ifdef USE_STATIC_LIBS
RTL_FLAGS=-MT # Statically linked multithreaded RTL
!ifdef MOZ_DEBUG
RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
!endif
!else ifdef USE_NON_MT_LIBS
RTL_FLAGS=-ML # Statically linked non-multithreaded LIBC RTL
!ifdef MOZ_DEBUG
RTL_FLAGS=-MLd # Statically linked non-multithreaded LIBC debug RTL
!endif
!else
RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
!ifdef MOZ_DEBUG
!ifndef MOZ_NO_DEBUG_RTL
RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
!endif
!endif
!endif
#//------------------------------------------------------------------------
#//
#// Specify the OS dependent compiler flags, linker flags and libraries
#//
#//------------------------------------------------------------------------
OS_CFLAGS=$(OPTIMIZER) $(RTL_FLAGS) -W3 -nologo -D_X86_ -D_WINDOWS -DWIN32 \
-DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS -DWINVER=0x400 -Gy
OS_CFLAGS=$(OS_CFLAGS) -DMSVC4
!ifdef MOZ_DEBUG
# Enable browse info in VC++
!ifdef MOZ_BROWSE_INFO
OS_CFLAGS=$(OS_CFLAGS) /FR
!endif
!endif
## Removed MOZ_LITE/MOZ_MEDIUM stuff from OS_CFLAGS
OS_LFLAGS=$(OS_LFLAGS)
OS_LIBS=kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib
#//------------------------------------------------------------------------
#//
#// Specify the special flags for creating EXEs
#//
#//------------------------------------------------------------------------
!if defined(SWAPTUNER) || (defined(GLOWCODE) && defined(GLOWPROF) && "$(MOZ_BITS)"=="32")
# this seems to get lost
EXE_CFLAGS=/Gh
!else
EXE_CFLAGS=/Gy
!endif
!if defined(MOZ_PROFILE)
EXE_LFLAGS=/FIXED:NO
!else
EXE_LFLAGS=
!endif
EXE_LIBS=
!if defined(MOZ_COVERAGE) && !defined(MOZ_NO_COVERAGE)
EXE_LIBS=$(EXE_LIBS) $(DIST)/lib/trace.lib
!endif
#//------------------------------------------------------------------------
#//
#// Specify the special flags for creating DLLs
#//
#//------------------------------------------------------------------------
DLL_CFLAGS=
DLL_LFLAGS=/SUBSYSTEM:WINDOWS
DLL_LIBS=
!if defined(MOZ_COVERAGE) && !defined(MOZ_NO_COVERAGE)
DLL_LIBS=$(DLL_LIBS) $(DIST)/lib/trace.lib
!endif
#//------------------------------------------------------------------------
#//
#// rebase setting, msvc systems better have this
#//
#//------------------------------------------------------------------------
REBASE=rebase.exe

12
mozilla/config/aboutime.pl Executable file
View File

@@ -0,0 +1,12 @@
use strict;
use mozBDate;
my $outfile = $ARGV[0];
my $build_num_file = $ARGV[1];
my $infile = "";
$infile = $ARGV[2] if ("$ARGV[2]" ne "");
&mozBDate::SubstituteBuildNumber($outfile, $build_num_file, $infile);

View File

@@ -0,0 +1,87 @@
#!/perl
use File::Path;
use Fcntl qw(:DEFAULT :flock);
use Getopt::Std;
use IO::File;
getopts("l");
my $installedChromeFile = $ARGV[0];
my $disableJarPackaging = $ARGV[1];
my $chromeType = $ARGV[2];
my $pkgName = $ARGV[3];
my $jarFileName = $ARGV[4];
#print "add-chrome $installedChromeFile $disableJarPackaging $chromeType $pkgName $jarFileName\n";
my $nofilelocks = 0;
if (defined($::opt_l)) {
$nofilelocks = 1;
}
if ($jarFileName =~ /(.*)\.jar/) {
$jarFileName = $1;
}
my $line;
if ($disableJarPackaging) {
$line = "$chromeType,install,url,resource:/chrome/$jarFileName/$chromeType/$pkgName/";
}
else {
$line = "$chromeType,install,url,jar:resource:/chrome/$jarFileName.jar!/$chromeType/$pkgName/";
}
my $lockfile = "$installedChromeFile.lck";
my $lockhandle = new IO::File;
if (!$nofilelocks) {
open($lockhandle,">$lockfile") ||
die("WARNING: Could not create lockfile for $lockfile. Exiting.\n");
flock($lockhandle, LOCK_EX);
}
if (open(FILE, "<$installedChromeFile")) {
while (<FILE>) {
chomp;
if ($_ =~ $line) {
# line already appears in installed-chrome.txt file
# just update the mod date
close(FILE) || die "error: can't close $installedChromeFile: $!";
if (!$nofilelocks) {
unlink($lockfile);
flock($lockhandle, LOCK_UN);
}
my $now = time;
utime($now, $now, $installedChromeFile) || die "couldn't touch $installedChromeFile";
print "+++ updating chrome $installedChromeFile\n+++\t$line\n";
exit;
}
}
close(FILE) || die "error: can't close $installedChromeFile: $!";
}
if (!$nofilelocks) {
unlink($lockfile);
flock($lockhandle, LOCK_UN);
}
my $dir = $installedChromeFile;
if ("$dir" =~ /([\w\d.\-\\\/]+)[\\\/]([\w\d.\-]+)/) {
$dir = $1;
}
mkpath($dir, 0, 0755);
if (!$nofilelocks) {
open($lockhandle,">$lockfile") ||
die("WARNING: Could not create lockfile for $lockfile. Exiting.\n");
flock($lockhandle, LOCK_EX);
}
open(FILE, ">>$installedChromeFile") || die "can't open $installedChromeFile: $!";
print FILE "$line\n";
close(FILE) || die "error: can't close $installedChromeFile: $!";
if (!$nofilelocks) {
unlink($lockfile);
flock($lockhandle, LOCK_UN);
}
print "+++ adding chrome $installedChromeFile\n+++\t$line\n";

View File

@@ -0,0 +1,334 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is this file as it was released upon August 6, 1998.
#
# The Initial Developer of the Original Code is Christopher
# Seawood. Portions created by Christopher Seawood are
# Copyright (C) 1998 Christopher Seawood. All
# Rights Reserved.
#
# Contributor(s):
# A netscape style .mk file for autoconf builds
INCLUDED_AUTOCONF_MK = 1
USE_AUTOCONF = 1
MOZILLA_CLIENT = 1
NO_MDUPDATE = 1
BUILD_MODULES = @BUILD_MODULES@
DIST = $(DEPTH)/dist
MOZ_DISABLE_JAR_PACKAGING = @MOZ_DISABLE_JAR_PACKAGING@
MOZ_TRACK_MODULE_DEPS = @MOZ_TRACK_MODULE_DEPS@
MOZ_WIDGET_TOOLKIT = @MOZ_WIDGET_TOOLKIT@
MOZ_GFX_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)
MOZ_MONOLITHIC_TOOLKIT = @MOZ_MONOLITHIC_TOOLKIT@
USE_NSPR_AUTOCONF = @USE_NSPR_AUTOCONF@
### XXX ### BROKEN MOZ_XLIBRGB_LDFLAGS = @MOZ_XLIBRGB_LDFLAGS@
### XXX ### BROKEN MOZ_USING_XLIBRGB = @MOZ_USING_XLIBRGB@
MOZ_JS_LIBS = @MOZ_JS_LIBS@
MOZ_REGISTRY_LIBS = $(DIST)/lib/libmozreg_s.$(LIB_SUFFIX)
MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/libwidgetsupport_s.$(LIB_SUFFIX)
MOZ_GFX_TOOLKIT_LDFLAGS = @MOZ_GFX_TOOLKIT_LDFLAGS@
MOZ_WIDGET_TOOLKIT_LDFLAGS = @MOZ_WIDGET_TOOLKIT_LDFLAGS@
MOZ_SECURITY = @MOZ_SECURITY@
MOZ_DEBUG = @MOZ_DEBUG@
MOZ_DEBUG_MODULES = @MOZ_DEBUG_MODULES@
MOZ_PROFILE_MODULES = @MOZ_PROFILE_MODULES@
MOZ_DEBUG_ENABLE_DEFS = @MOZ_DEBUG_ENABLE_DEFS@
MOZ_DEBUG_DISABLE_DEFS = @MOZ_DEBUG_DISABLE_DEFS@
MOZ_DEBUG_FLAGS = @MOZ_DEBUG_FLAGS@
MOZ_DBGRINFO_MODULES = @MOZ_DBGRINFO_MODULES@
MOZ_EXTENSIONS = @MOZ_EXTENSIONS@
MOZ_PERF_METRICS = @MOZ_PERF_METRICS@
MOZ_LEAKY = @MOZ_LEAKY@
MOZ_JPROF = @MOZ_JPROF@
MOZ_XPCTOOLS = @MOZ_XPCTOOLS@
ENABLE_EAZEL_PROFILER=@ENABLE_EAZEL_PROFILER@
EAZEL_PROFILER_CFLAGS=@EAZEL_PROFILER_CFLAGS@
EAZEL_PROFILER_LIBS=@EAZEL_PROFILER_LIBS@
DETECT_WEBSHELL_LEAKS = @DETECT_WEBSHELL_LEAKS@
GC_LEAK_DETECTOR = @GC_LEAK_DETECTOR@
NS_TRACE_MALLOC = @NS_TRACE_MALLOC@
USE_ELF_DYNSTR_GC = @USE_ELF_DYNSTR_GC@
MOZ_MAIL_NEWS = @MOZ_MAIL_NEWS@
MOZ_BRPROF = @MOZ_BRPROF@
NO_UNIX_ASYNC_DNS = @NO_UNIX_ASYNC_DNS@
NO_SHARED_LIB = @NO_SHARED_LIB@
NO_NETSCAPE_SHARED = @NO_SHARED_LIB@
NO_STATIC_LIB = @NO_STATIC_LIB@
NO_NETSCAPE_STATIC = @NO_STATIC_LIB@
ENABLE_TESTS = @ENABLE_TESTS@
IBMBIDI = @IBMBIDI@
BUILD_IDLC = @BUILD_IDLC@
MOZ_ENDER_LITE = @MOZ_ENDER_LITE@
MOZ_LDAP_XPCOM = @MOZ_LDAP_XPCOM@
XPCOM_USE_LEA = @XPCOM_USE_LEA@
MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS = @MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS@
MOZ_COMPONENT_NSPR_LIBS=@MOZ_COMPONENT_NSPR_LIBS@
MOZ_COMPONENT_XPCOM_LIBS=@MOZ_COMPONENT_XPCOM_LIBS@
XPCOM_LIBS=@XPCOM_LIBS@
ClientWallet=1
CookieManagement=1
SingleSignon=1
MOZ_OJI=1
MOZ_POST_DSO_LIB_COMMAND = @MOZ_POST_DSO_LIB_COMMAND@
MOZ_POST_PROGRAM_COMMAND = @MOZ_POST_PROGRAM_COMMAND@
MOZ_BUILD_ROOT = @MOZ_BUILD_ROOT@
MOZ_GLE = @MOZ_GLE@
MOZ_NATIVE_ZLIB = @SYSTEM_ZLIB@
MOZ_NATIVE_JPEG = @SYSTEM_JPEG@
MOZ_NATIVE_PNG = @SYSTEM_PNG@
MOZ_NATIVE_MNG = @SYSTEM_MNG@
MOZ_UPDATE_XTERM = @MOZ_UPDATE_XTERM@
MOZ_MATHML = @MOZ_MATHML@
MOZ_SVG = @MOZ_SVG@
MOZ_XSL = @MOZ_XSL@
MOZ_INSURE = @MOZ_INSURE@
MOZ_INSURIFYING = @MOZ_INSURIFYING@
MOZ_INSURE_DIRS = @MOZ_INSURE_DIRS@
MOZ_INSURE_EXCLUDE_DIRS = @MOZ_INSURE_EXCLUDE_DIRS@
MOZ_BUILD_XPFE = @MOZ_BUILD_XPFE@
MOZ_NATIVE_NSPR = @MOZ_NATIVE_NSPR@
CROSS_COMPILE = @CROSS_COMPILE@
OS_CPPFLAGS = @CPPFLAGS@
OS_CFLAGS = $(OS_CPPFLAGS) @CFLAGS@
OS_CXXFLAGS = $(OS_CPPFLAGS) @CXXFLAGS@
OS_LDFLAGS = @LDFLAGS@
OS_COMPILE_CFLAGS = $(OS_CPPFLAGS) @COMPILE_CFLAGS@
OS_COMPILE_CXXFLAGS = $(OS_CPPFLAGS) @COMPILE_CXXFLAGS@
OS_INCLUDES = $(NSPR_CFLAGS) $(JPEG_CFLAGS) $(PNG_CFLAGS) $(MNG_CFLAGS) $(ZLIB_CFLAGS)
OS_LIBS = @LIBS@
ACDEFINES = @DEFS@
XCFLAGS = @XCFLAGS@
XLDFLAGS = @XLDFLAGS@
XLIBS = @XLIBS@
AIX_SHLIB_BIN = @AIX_SHLIB_BIN@
AR = @AR@
AR_FLAGS = @AR_FLAGS@
AR_EXTRACT = @AR_EXTRACT@
AR_LIST = @AR_LIST@
AR_DELETE = @AR_DELETE@
AS = @AS@
ASFLAGS = @ASFLAGS@
AS_DASH_C_FLAG = @AS_DASH_C_FLAG@
LD = @LD@
DLLTOOL = @DLLTOOL@
WINDRES = @WINDRES@
USE_SHORT_LIBNAME = @USE_SHORT_LIBNAME@
IMPLIB = @IMPLIB@
FILTER = @FILTER@
BIN_FLAGS = @BIN_FLAGS@
OBJ_SUFFIX = @OBJ_SUFFIX@
LIB_SUFFIX = @LIB_SUFFIX@
DLL_SUFFIX = @DLL_SUFFIX@
BIN_SUFFIX = @BIN_SUFFIX@
USE_N32 = @USE_N32@
# Temp hack. It is not my intention to leave this crap in here for ever.
# Im talking to fur right now to solve the problem without introducing
# NS_USE_NATIVE to the build system -ramiro.
NS_USE_NATIVE = @NS_USE_NATIVE@
CC = @CC@
CXX = @CXX@
GNU_CC = @GNU_CC@
GNU_CXX = @GNU_CXX@
HOST_CC = @HOST_CC@
HOST_CXX = @HOST_CXX@
HOST_CFLAGS = @HOST_CFLAGS@
HOST_CXXFLAGS = @HOST_CXXFLAGS@
HOST_NSPR_MDCPUCFG = @HOST_NSPR_MDCPUCFG@
HOST_AR = @HOST_AR@
HOST_RANLIB = @HOST_RANLIB@
HOST_LIBIDL_CONFIG = @HOST_LIBIDL_CONFIG@
HOST_LIBIDL_CFLAGS = @HOST_LIBIDL_CFLAGS@
HOST_LIBIDL_LIBS = @HOST_LIBIDL_LIBS@
TARGET_NSPR_MDCPUCFG = @TARGET_NSPR_MDCPUCFG@
TARGET_CPU = @TARGET_CPU@
TARGET_OS = @TARGET_OS@
TARGET_MD_ARCH = @TARGET_MD_ARCH@
AUTOCONF = @AUTOCONF@
EMACS = @EMACS@
PERL = @PERL@
RANLIB = @RANLIB@
WHOAMI = @WHOAMI@
UNZIP_PROG = @UNZIP@
ZIP_PROG = @ZIP@
XARGS = @XARGS@
STRIP = @STRIP@
ifdef MOZ_NATIVE_JPEG
JPEG_CFLAGS = @JPEG_CFLAGS@
JPEG_LIBS = @JPEG_LIBS@
JPEG_REQUIRES =
else
JPEG_CFLAGS = @MOZ_JPEG_CFLAGS@
JPEG_LIBS = @MOZ_JPEG_LIBS@
JPEG_REQUIRES = jpeg
endif
ifdef MOZ_NATIVE_ZLIB
ZLIB_CFLAGS = @ZLIB_CFLAGS@
ZLIB_LIBS = @ZLIB_LIBS@
ZLIB_REQUIRES =
else
ZLIB_CFLAGS = @MOZ_ZLIB_CFLAGS@
ZLIB_LIBS = @MOZ_ZLIB_LIBS@
ZLIB_REQUIRES = zlib
endif
ifdef MOZ_NATIVE_PNG
PNG_CFLAGS = @PNG_CFLAGS@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES =
else
PNG_CFLAGS = @MOZ_PNG_CFLAGS@
PNG_LIBS = @MOZ_PNG_LIBS@
PNG_REQUIRES = png
endif
ifdef MOZ_NATIVE_MNG
MNG_CFLAGS = @MNG_CFLAGS@
MNG_LIBS = @MNG_LIBS@
MNG_REQUIRES =
else
MNG_CFLAGS = @MOZ_MNG_CFLAGS@
MNG_LIBS = @MOZ_MNG_LIBS@
MNG_REQUIRES = mng
endif
NSPR_CFLAGS = @NSPR_CFLAGS@
NSPR_LIBS = @NSPR_LIBS@
NSPR_INCLUDE_DIR= @NSPR_INCLUDE_DIR@
# MKSHLIB_FORCE_ALL is used to force the linker to include all object
# files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker
# to normal behavior. Makefile's that create shared libraries out of
# archives use these flags to force in all of the .o files in the
# archives into the shared library.
ifndef NO_SHARED_LIB
WRAP_MALLOC_LIB = @WRAP_MALLOC_LIB@
WRAP_MALLOC_CFLAGS = @WRAP_MALLOC_CFLAGS@
DSO_CFLAGS = @DSO_CFLAGS@
DSO_PIC_CFLAGS = @DSO_PIC_CFLAGS@
MKSHLIB = @MKSHLIB@
MKCSHLIB = @MKCSHLIB@
MKSHLIB_FORCE_ALL = @MKSHLIB_FORCE_ALL@
MKSHLIB_UNFORCE_ALL = @MKSHLIB_UNFORCE_ALL@
DSO_LDOPTS = @DSO_LDOPTS@
DLL_SUFFIX = @DLL_SUFFIX@
endif
NO_LD_ARCHIVE_FLAGS = @NO_LD_ARCHIVE_FLAGS@
GTK_CONFIG = @GTK_CONFIG@
TK_CFLAGS = @TK_CFLAGS@
TK_LIBS = @TK_LIBS@
MOZ_TOOLKIT_REGISTRY_CFLAGS = \
-DWIDGET_DLL=@WIDGET_DLL@ \
-DGFXWIN_DLL=@GFXWIN_DLL@ \
$(TK_CFLAGS)
MOZ_ENABLE_GTK = @MOZ_ENABLE_GTK@
MOZ_ENABLE_MOTIF = @MOZ_ENABLE_MOTIF@
MOZ_ENABLE_XLIB = @MOZ_ENABLE_XLIB@
MOZ_ENABLE_QT = @MOZ_ENABLE_QT@
MOZ_ENABLE_PHOTON = @MOZ_ENABLE_PHOTON@
MOZ_ENABLE_XREMOTE = @MOZ_ENABLE_XREMOTE@
MOZ_GTK_CFLAGS = @MOZ_GTK_CFLAGS@
MOZ_GTK_LDFLAGS = @MOZ_GTK_LDFLAGS@
MOZ_MOTIF_CFLAGS = @MOZ_MOTIF_CFLAGS@
MOZ_MOTIF_LDFLAGS = @MOZ_MOTIF_LDFLAGS@
MOZ_XLIB_CFLAGS = @MOZ_XLIB_CFLAGS@
MOZ_XLIB_LDFLAGS = @MOZ_XLIB_LDFLAGS@
MOZ_QT_CFLAGS = @MOZ_QT_CFLAGS@
MOZ_QT_LDFLAGS = @MOZ_QT_LDFLAGS@
MOZ_XPRINT_CFFLAGS = @MOZ_XPRINT_CFLAGS@
MOZ_XPRINT_LDFLAGS = @MOZ_XPRINT_LDFLAGS@
MOZ_ENABLE_XPRINT = @MOZ_ENABLE_XPRINT@
MOZ_ENABLE_XINERAMA = @MOZ_ENABLE_XINERAMA@
MOZ_XINERAMA_LIBS = @MOZ_XINERAMA_LIBS@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
LIBIDL_CFLAGS = @LIBIDL_CFLAGS@
LIBIDL_LIBS = @LIBIDL_LIBS@
MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@
# Used for LD_LIBRARY_PATH
LIBS_PATH = @LIBS_PATH@
COMPILER_DEPEND = @COMPILER_DEPEND@
MDDEPDIR := @MDDEPDIR@
MOZ_DISABLE_DTD_DEBUG = @MOZ_DISABLE_DTD_DEBUG@
MOZ_DEMANGLE_SYMBOLS = @MOZ_DEMANGLE_SYMBOLS@
# For the use of the Fullcircle Talkback tool, if available.
MOZ_FULLCIRCLE = @MOZ_FULLCIRCLE@
FULLCIRCLE_LIBS = @FULLCIRCLE_LIBS@
# XXX - these need to be cleaned up and have real checks added -cls
CM_BLDTYPE=dbg
AWT_11=1
MOZ_BITS=32
OS_TARGET=@OS_TARGET@
OS_ARCH=@OS_ARCH@
OS_RELEASE=@OS_RELEASE@
OS_TEST=@OS_TEST@
# For OS/2 build
MOZ_OS2_TOOLS = @MOZ_OS2_TOOLS@
MOZ_OS2_EMX_OBJECTFORMAT = @MOZ_OS2_EMX_OBJECTFORMAT@
HAVE_MOVEMAIL=@HAVE_MOVEMAIL@
MOZ_NEW_CACHE=@MOZ_NEW_CACHE@
USE_IMG2=@USE_IMG2@

48
mozilla/config/bdate.c Normal file
View File

@@ -0,0 +1,48 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
**
** bdate.c: Possibly cross-platform date-based build number
** generator. Output is YYJJJ, where YY == 2-digit
** year, and JJJ is the Julian date (day of the year).
**
** Author: briano@netscape.com
**
*/
#include <stdio.h>
#include <time.h>
#ifdef SUNOS4
#include "sunos4.h"
#endif
void main(void)
{
time_t t = time(NULL);
struct tm *tms;
tms = localtime(&t);
printf("500%02d%03d%02d\n", tms->tm_year, 1+tms->tm_yday, tms->tm_hour);
exit(0);
}

28
mozilla/config/bdate.pl Executable file
View File

@@ -0,0 +1,28 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
use mozBDate;
# Both "generate" args are optional
$file = $ARGV[0] if ("$ARGV[0]" ne "");
$official = 1 if ("$ARGV[1]" ne "");
&mozBDate::UpdateBuildNumber($file, $official);

118
mozilla/config/bin2rc.c Normal file
View File

@@ -0,0 +1,118 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include <stdio.h>
#include <sys\stat.h>
int main(int iArgc, char **ppArgv) {
int iRetval = 1;
/* First argument, the filename to convert.
* Output to stdout, redirect to save.
*/
char *pFileName = ppArgv[1];
if(pFileName) {
FILE *pFile = fopen(pFileName, "rb");
if(pFile) {
struct stat sInfo;
/* Stat the file for size.
*/
if(!fstat(fileno(pFile), &sInfo)) {
int iChar;
int iX = 0;
int iFirsttime = 1;
/* Begin RCDATA
*/
printf("BEGIN\n");
/* First string identifies created via bin2rc.
* Users of the RCDATA must check for this to
* assume the format of the remainder of
* the data.
*/
printf("\t\"bin2rc generated resource\\0\",\t// bin2rc identity string\n");
/* Next string is optional parameter on command
* line. If not present, an empty string.
* Users of the RCDATA must understand this is
* the optional string that can be used for
* about any purpose they desire.
*/
printf("\t\"%s\\0\",\t// optional command line string\n", ppArgv[2] ? ppArgv[2] : "");
/* Next string is the size of the original file.
* Users of the RCDATA must understand that this
* is the size of the file's actual contents.
*/
printf("\t\"%ld\\0\"\t// data size header\n", sInfo.st_size);
while(EOF != (iChar = fgetc(pFile))) {
/* Comma?
*/
if(0 == iFirsttime) {
iX += printf(",");
}
else {
iFirsttime = 0;
}
/* Newline?
*/
if(iX >= 72) {
printf("\n");
iX = 0;
}
/* Tab?
*/
if(0 == iX) {
printf("\t");
iX += 8;
}
/* Octal byte.
*/
iX += printf("\"\\%.3o\"", iChar);
}
/* End RCDATA
*/
if(0 != iX) {
printf("\n");
}
printf("END\n");
/* All is well.
*/
iRetval = 0;
}
fclose(pFile);
pFile = NULL;
}
}
return(iRetval);
}

BIN
mozilla/config/bin2rc.exe Executable file

Binary file not shown.

View File

@@ -0,0 +1,46 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla Communicator client code.
#
# 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):
my $progname = $0;
my $contents;
# this script needs to be run in config
my $numberfile = "build_number";
my $fcsutil = "$ENV{MOZ_TOOLS}\\bin\\fcsutil.pl";
$fcsutil =~ s/\\/\\\\/g;
# This is the preferences file that gets read and written.
open(NUMBER, "<$numberfile") || die "no build_number file\n";
while ( <NUMBER> ) {
$build_number = $_
}
close (NUMBER);
chop($build_number);
print "$fcsutil\n";
open(OUTPUT, ">master.pl");
print OUTPUT "system(\"perl $fcsutil -newbuild -deployment Netscape/Communicator5.0/Win32/1 -output master.ini $build_number -server cyclone.mcom.com\")";
close(OUTPUT);

View File

@@ -0,0 +1,12 @@
open INFILE, "<$ARGV[1]";
$build = <INFILE>;
close INFILE;
chop $build;
open OUTFILE, ">$ARGV[0]" || die;
print OUTFILE "/* THIS IS A GENERATED FILE!\n*\n";
print OUTFILE "* See mozilla/config/build_header.pl */\n*\n*/";
print OUTFILE "\n\#define NS_BUILD_ID " . $build . "\n";
close OUTFILE;

View File

@@ -0,0 +1,43 @@
@echo off
rem The contents of this file are subject to the Netscape Public
rem License Version 1.1 (the "License"); you may not use this file
rem except in compliance with the License. You may obtain a copy of
rem the License at http://www.mozilla.org/NPL/
rem
rem Software distributed under the License is distributed on an "AS
rem IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
rem implied. See the License for the specific language governing
rem rights and limitations under the License.
rem
rem The Original Code is mozilla.org code.
rem
rem The Initial Developer of the Original Code is Netscape
rem Communications Corporation. Portions created by Netscape are
rem Copyright (C) 1998 Netscape Communications Corporation. All
rem Rights Reserved.
rem
rem Contributor(s):
@echo on
@echo off
if not exist %2\NUL echo Warning: %2 does not exist! (you may need to check it out)
if not exist %2\NUL exit 1
cd %2
goto NO_CAFE
if "%MOZ_CAFE%"=="" goto NO_CAFE
mkdir %MOZ_SRC%\mozilla\dist\classes\%2
%MOZ_TOOLS%\bin\sj.exe -classpath %MOZ_SRC%\mozilla\dist\classes;%MOZ_SRC%\mozilla\sun-java\classsrc -d %MOZ_SRC%\mozilla\dist\classes *.java
goto END
:NO_CAFE
perl.exe %MOZ_SRC%\mozilla\config\outofdate.pl -d %MOZ_SRC%\mozilla\dist\classes\%2 -cfg %1 *.java > doit.bat
call doit.bat
del doit.bat
:END

126
mozilla/config/clobber_miss.pl Executable file
View File

@@ -0,0 +1,126 @@
#!perl5
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# Searches the tree for unclobbered files
# should be relatively cross platform
#
$start_dir = $ENV{"MOZ_SRC"};
@ignore_list = ("make.dep","manifest.mnw");
$missed = 0;
print "\n\nChecking for unclobbered files\n" .
"------------------------------\n";
GoDir("ns");
GoDir("mozilla");
if( $missed ){
die "\nError: $missed files or directories unclobbered\n";
}
else {
print "No unclobbered files found\n";
}
sub GoDir {
local($dir) = @_;
local(%filelist,$iscvsdir);
local($k,$v,$d,$fn,$rev, $mod_time);
local($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks);
if(! chdir "$start_dir/$dir" ){
return;
}
while(<*.*> ){
if( $_ ne '.' && $_ ne '..' && $_ ne 'CVS'
&& $_ ne 'nuke' ){
$filelist{$_} = 1;
}
}
if( -r "CVS/Entries" ){
$iscvsdir=1;
open(ENT, "CVS/Entries" ) ||
die "Cannot open CVS/Entries for reading\n";
while(<ENT>){
chop;
($d,$fn,$rev,$mod_time) = split(/\//);
if( $fn ne "" ){
if( $d eq "D" ){
$filelist{$fn} = 3;
}
else {
$filelist{$fn} = 2;
}
}
}
close(ENT);
}
while( ($k,$v) = each %filelist ){
if( $v == 1 && $iscvsdir && !IgnoreFile( $k ) ){
if( ! -d $k ){
print " file: $dir/$k\n";
$missed++;
}
else {
if( ! -r "$k/CVS/Entries" ){
print "directory: $dir/$k\n";
$missed++;
}
else {
$filelist{$k} = 3;
}
}
}
}
while( ($k,$v) = each %filelist ){
if( $v == 3 ){
GoDir("$dir/$k");
}
}
# while( ($k,$v) = each %filelist ){
# print "$k: $v\n";
# }
}
sub IgnoreFile {
local($fn) = @_;
local($i);
for $i (@ignore_list){
if( $fn eq $i ){
return 1;
}
}
return 0;
}

141
mozilla/config/common.mk Normal file
View File

@@ -0,0 +1,141 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
INCLUDED_COMMON_MK = 1
######################################################################
# Cross-platform defines used on all platforms (in theory)
######################################################################
#
# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
# Since the longest of these is 5 characters without the suffix,
# be sure to not set VERSION_NUMBER to anything longer than 3
# characters for Win16's sake.
#
# Also... If you change this value, there are several other places
# you'll need to change (because they're not reached by this
# variable):
# sun-java/nsjava/nsjava32.def
# sun-java/nsjava/nsjava16.def
# sun-java/classsrc/sun/audio/AudioDevice.java
# sun-java/classsrc/sun/awt/windows/WToolkit.java
#
VERSION_NUMBER = 50
# jar for core java classes:
JAR_NAME = java$(VERSION_NUMBER).jar
# jar for navigator-specific java code:
NAV_JAR_NAME = nav$(VERSION_NUMBER).jar
######################################################################
# Cross-Platform Java Stuff
######################################################################
# java interpreter
# get class files from the directory they are compiled to
JAVA_CLASSPATH = $(JAVAC_ZIP)$(PATH_SEPARATOR)$(JAVA_DESTPATH)
JAVA_FLAGS = -classpath $(JAVA_CLASSPATH) -ms8m
JAVA = $(JAVA_PROG) $(JAVA_FLAGS)
#
# NOTE: If a new DLL is being added to this define you will have to update
# ns/sun-java/include/javadefs.h in order not to break win16.
#
JAVA_DEFINES = -DJAR_NAME=\"$(JAR_NAME)\" -DJRTDLL=\"$(JRTDLL)\" -DMMDLL=\"$(MMDLL)\" \
-DAWTDLL=\"$(AWTDLL)\" -DJITDLL=\"$(JITDLL)\" -DJPWDLL=\"$(JPWDLL)\"
######################################################################
# javac
#
# java wants '-ms8m' and kaffe wants '-ms 8m', so this needs to be
# overridable.
#
JINT_FLAGS = -ms8m
# to run the compiler in the interpreter
JAVAC_PROG = $(JINT_FLAGS) $(PDJAVA_FLAGS) -classpath $(JAVAC_ZIP) sun.tools.javac.Main
JAVAC = $(JAVA_PROG) $(JAVAC_PROG) $(JAVAC_FLAGS)
# std set of options passed to the compiler
JAVAC_FLAGS = -classpath $(JAVAC_CLASSPATH) $(JAVAC_OPTIMIZER) -d $(JAVA_DESTPATH)
#
# The canonical Java classpath is:
# JAVA_DESTPATH, JAVA_SOURCEPATH, JAVA_LIBS
#
# appropriately delimited, in that order
#
JAVAC_CLASSPATH = $(JAVAC_ZIP)$(PATH_SEPARATOR)$(JAVA_DESTPATH)$(PATH_SEPARATOR)$(JAVA_SOURCEPATH)
######################################################################
# javadoc
# Rules to build java .html files from java source files
JAVADOC_PROG = $(JAVA) sun.tools.javadoc.Main
JAVADOC_FLAGS = -classpath $(JAVAC_CLASSPATH)
JAVADOC = $(JAVADOC_PROG) $(JAVADOC_FLAGS)
######################################################################
# javah
JAVAH_FLAGS = -classpath $(JAVAC_ZIP)$(PATH_SEPARATOR)$(JAVA_DESTPATH)
JAVAH = $(JAVAH_PROG) $(JAVAH_FLAGS)
######################################################################
# jmc
JMCSRCDIR = $(DIST)/_jmc
JMC_PROG = $(JAVA) netscape.tools.jmc.Main
JMC_CLASSPATH = $(JMCSRCDIR)$(PATH_SEPARATOR)$(JAVAC_CLASSPATH)
JMC_FLAGS = -classpath $(JMC_CLASSPATH) -verbose
JMC = $(JMC_PROG) $(JMC_FLAGS)
######################################################################
# zip
ZIP = $(ZIP_PROG) $(ZIP_FLAGS)
######################################################################
# idl2java
ORBTOOLS = $(DEPTH)/modules/iiop/tools/orbtools.zip
ORB_CLASSPATH = $(ORBTOOLS)$(PATH_SEPARATOR)$(JAVA_CLASSPATH)
IDL2JAVA_PROG = $(JAVA_PROG)
IDL2JAVA_FLAGS = -classpath $(ORB_CLASSPATH) pomoco.tools.idl2java
IDL2JAVA = $(IDL2JAVA_PROG) $(IDL2JAVA_FLAGS)
######################################################################
# lex and yacc
JAVALEX_PROG = $(JAVA_PROG) -classpath $(ORB_CLASSPATH) sbktech.tools.jax.driver
JAVALEX_FLAGS =
JAVALEX = $(JAVALEX_PROG) $(JAVALEX_FLAGS)
JAVACUP_PROG = $(JAVA_PROG) -classpath $(ORB_CLASSPATH) java_cup.Main
JAVACUP_FLAGS =
JAVACUP = $(JAVACUP_PROG) $(JAVACUP_FLAGS)

530
mozilla/config/config.mak Normal file
View File

@@ -0,0 +1,530 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
!if !defined(CONFIG_CONFIG_MAK)
CONFIG_CONFIG_MAK=1
#//------------------------------------------------------------------------
#//
#// Define public make variables:
#//
#// OBJDIR - Specifies the location of intermediate files (ie. objs...)
#// Currently, the names are WINxx_O.OBJ or WINxx_D.OBJ for
#// optimized and debug builds respectively.
#//
#// DIST - Specifies the location of the distribution directory where
#// all targets are delivered.
#//
#// CFGFILE - Specifies the name of the temporary configuration file
#// containing the arguments to the current command.
#//
#// INCS - Default include paths.
#//
#// CFLAGS - Default compiler options.
#//
#// LFLAGS - Default linker options.
#//
#//------------------------------------------------------------------------
#//-----------------------------------------------------------------------
#//
#// Detect WinNT vs. Win9x and set WINOS appropriately.
#//
#// Set WINOS in your environment to avoid the timewasting uname call
#//
#//-----------------------------------------------------------------------
!if !defined(WINOS)
!if [$(MOZ_TOOLS)\bin\uname > osuname.inc]
!endif
WINOS=\
!include "osuname.inc"
WINOS=$(WINOS: =)^
!if [del osuname.inc]
!endif
!endif
#//-----------------------------------------------------------------------
#//
#// DIST DEFINITION
#//
#//-----------------------------------------------------------------------
XPDIST=$(DEPTH)\dist
PUBLIC=$(XPDIST)\include
!ifdef NGLAYOUT_BUILD_PREFIX
DIST_PREFIX=NGL
!else
!ifdef MOZ_NAV_BUILD_PREFIX
DIST_PREFIX=NAV
!else
DIST_PREFIX=WIN
!endif
!endif
!ifndef MOZ_DEBUG
OBJDIR=$(DIST_PREFIX)$(MOZ_BITS)$(OBJTYPE)_O.OBJ
JAVA_OPTIMIZER = -O
!ifdef NO_CAFE
JAVAC_OPTIMIZER =
!else
#JAVAC_OPTIMIZER= -O -noinline
JAVAC_OPTIMIZER =
!endif
!else
OBJDIR=$(DIST_PREFIX)$(MOZ_BITS)$(OBJTYPE)_D.OBJ
JAVA_OPTIMIZER = -g
JAVAC_OPTIMIZER = -g
!endif
#//
#// DIST DEFINES SHOULD NEVER BE COMPONENT SPECIFIC.
#//
!ifndef MOZ_DEBUG
DIST=$(XPDIST)\$(DIST_PREFIX)$(MOZ_BITS)_O.OBJ
!else
DIST=$(XPDIST)\$(DIST_PREFIX)$(MOZ_BITS)_D.OBJ
!endif
# This will always give the location of NGLayout's dist, even if "NGLAYOUT_BUILD_PREFIX" is not defined.
!if defined(MOZ_NGLAYOUT)
!ifndef MOZ_DEBUG
NGLAYOUT_DIST=$(XPDIST)\NGL$(MOZ_BITS)_O.OBJ
!else
NGLAYOUT_DIST=$(XPDIST)\NGL$(MOZ_BITS)_D.OBJ
!endif
!endif
#//-----------------------------------------------------------------------
#//
#// Basic configuration settings
#//
#//-----------------------------------------------------------------------
CFGFILE=$(OBJDIR)\cmd.cfg
INCS=$(INCS) -I$(PUBLIC) -I$(DIST)\include
!if "$(MOZ_BITS)" == "16"
CFLAGS=$(MOZ_JAVA_FLAG) -DEDITOR $(OS_CFLAGS) $(MOZ_CFLAGS)
!else
CFLAGS=$(MOZ_JAVA_FLAG) $(OS_CFLAGS) $(MOZ_CFLAGS)
!endif
!ifdef IBMBIDI
CFLAGS=$(CFLAGS) -DIBMBIDI
!endif
LFLAGS=$(OS_LFLAGS) $(LLFLAGS) $(MOZ_LFLAGS)
# 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(?):
!if "$(MOZ_BITS)"=="32" || defined(MOZ_DEBUG)
CFLAGS = $(CFLAGS) -DDEVELOPER_DEBUG
!endif
!ifdef MOZ_BSCFILE
CFLAGS = $(CFLAGS) -FR
!endif
#//-----------------------------------------------------------------------
#//
#// feature-specific configuration settings
#//
#//-----------------------------------------------------------------------
# Crash-reporting system. http://www.fullcirclesoftware.com
!ifdef MOZ_FULLCIRCLE
CFLAGS=$(CFLAGS) -DMOZ_FULLCIRCLE
!endif
# For modular netlib support.
CFLAGS=$(CFLAGS) -DNS_MT_SUPPORTED -DNETLIB_THREAD -DNS_NET_FILE
# Defines for cookie management feature...
CFLAGS=$(CFLAGS) -DCookieManagement
# Defines for single signon and client wallet features...
!ifndef MOZ_NO_WALLET_HACK
CFLAGS=$(CFLAGS) -DSingleSignon -DClientWallet
!endif
# TODO Cleanup later -Gagan
!ifdef NU_CACHE
CFLAGS=$(CFLAGS) -DNU_CACHE
!endif
# always need these:
CFLAGS = $(CFLAGS) -DNETSCAPE
# Specify that we are building a client.
# This will instruct the cross platform libraries to
# include all the client specific cruft.
!if defined(SERVER_BUILD)
CFLAGS = $(CFLAGS) -DSERVER_BUILD
!elseif defined(LIVEWIRE)
CFLAGS = $(CFLAGS) -DLIVEWIRE
!else
CFLAGS = $(CFLAGS) -DMOZILLA_CLIENT
!endif
# need this everywhere jsapi.h might be included
CFLAGS=$(CFLAGS) -DJS_THREADSAFE
!if "$(STAND_ALONE_JAVA)" == "1"
CFLAGS=$(CFLAGS) -DSTAND_ALONE_JAVA
!endif
NECKO=1
CFLAGS=$(CFLAGS) -DNECKO
!if defined(XPCOM_STANDALONE)
CFLAGS=$(CFLAGS) -DXPCOM_STANDALONE
!endif
!if defined(XPCONNECT_STANDALONE)
CFLAGS=$(CFLAGS) -DXPCONNECT_STANDALONE
!endif
# Enable output of performance metrics if MOZ_PERF is set
!ifdef MOZ_PERF
CFLAGS=$(CFLAGS) -DMOZ_PERF_METRICS
!endif
!ifndef MOZ_JAVA
MOZ_OJI = 1 # on by default now
!endif
!ifdef MOZ_LIBTEST
MOZ_LIBTEST = 1
CFLAGS=$(CFLAGS) -DLAYPROBE_API
!endif
!ifdef MOZ_JAVA
MOZ_JAVA_FLAG=-DJAVA
!ifdef MOZ_OJI
!error You can't define both MOZ_JAVA and MOZ_OJI anymore.
!endif
JAVA_OR_OJI = 1
JAVA_OR_NSJVM = 1
!endif
!ifdef NSJVM
JAVA_OR_NSJVM = 1
AWT_11 = 1 # always build awt 1.1 with nsjvm now
!endif
!ifdef MOZ_OJI
CFLAGS=$(CFLAGS) -DOJI
JAVA_OR_OJI=1
!endif
!ifdef SMART_MAIL
CFLAGS=$(CFLAGS) -DSMART_MAIL
!endif
!ifdef MOZ_TRACE_XPCOM_REFCNT
CFLAGS=$(CFLAGS) -DMOZ_TRACE_XPCOM_REFCNT
!endif
!ifdef MOZ_TRACE_MALLOC
CFLAGS=$(CFLAGS) -DNS_TRACE_MALLOC
!endif
!ifdef MOZ_SMOOTH_PROGRESS
CFLAGS=$(CFLAGS) -DSMOOTH_PROGRESS
!endif
!if defined(USE_STRING2)
CFLAGS = $(CFLAGS) -DUSE_STRING2
!endif
#!ifdef MOZ_XUL
MOZ_XUL=1
CFLAGS=$(CFLAGS) -DINCLUDE_XUL -DMOZ_XUL
#!endif
!ifdef MOZ_MATHML
CFLAGS=$(CFLAGS) -DMOZ_MATHML
!endif
!ifdef MOZ_SVG
CFLAGS=$(CFLAGS) -DMOZ_SVG
!endif
!ifdef MOZ_REFLOW_PERF
CFLAGS=$(CFLAGS) -DMOZ_REFLOW_PERF
!endif
#//-----------------------------------------------------------------------
#//
#// build tools
#//
#//-----------------------------------------------------------------------
NMAKE=nmake -nologo -$(MAKEFLAGS)
# grab the perl from the user's path (probably need 5.005)
PERL = perl.exe
#if MOZILLA_OFFICIAL is set, then define splitsym
!if defined (MOZILLA_OFFICIAL)
SPLITSYM = $(MOZ_TOOLS)\bin\splitsym
!endif
# use find
!ifndef FIND
FIND = find.exe
!endif
MASM = $(MOZ_TOOLS)\bin\ml.exe
!if "$(WINOS)" == "WIN95"
MKDIR = $(DEPTH)\config\w95mkdir
QUIET =
!else
MKDIR = mkdir
QUIET=@
!endif
#//------------------------------------------------------------------------
#//
#// Include the OS dependent configuration information
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/WIN$(MOZ_BITS)>
!ifdef MOZ_DEBUG
!ifdef USERNAME
CFLAGS = $(CFLAGS) -DDEBUG_$(USERNAME)
!endif
!endif
!if (defined(MOZ_COVERAGE) && !defined(MOZ_NO_COVERAGE)) || (defined(GLOWCODE) && defined(GLOWPROF) && "$(MOZ_BITS)"=="32")
CFLAGS = $(CFLAGS) /Gh
!endif
#//------------------------------------------------------------------------
#//
#// Define the global make commands.
#//
#// MAKE_INSTALL - Copy a target to the distribution directory.
#//
#// MAKE_OBJDIRS - Create an object directory (if necessary).
#//
#// MAKE_MANGLE - Convert all long filenames into 8.3 names
#//
#// MAKE_UNMANGLE - Restore all long filenames
#//
#//------------------------------------------------------------------------
!if !defined(MOZ_SRC)
#enable builds on any drive if defined.
MOZ_SRC=y:
!endif
MAKE_INSTALL=$(QUIET)$(DEPTH)\config\makecopy.exe
MAKE_MANGLE=$(DEPTH)\config\mangle.exe
MAKE_UNMANGLE=if exist unmangle.bat call unmangle.bat
!if defined(MOZ_PURIFY)
# add #line directive to header files for purify
MKCPYFLAGS= -i
!endif
#//------------------------------------------------------------------------
#//
#// Common Libraries
#//
#//------------------------------------------------------------------------
NSPR_VERSION=4
LIBNSPR=$(DIST)\lib\nspr$(NSPR_VERSION).lib $(DIST)\lib\plds$(NSPR_VERSION).lib $(DIST)\lib\plc$(NSPR_VERSION).lib
LIBPLC=$(DIST)\lib\plc$(NSPR_VERSION).lib
NSPRDIR = nsprpub
CFLAGS = $(CFLAGS) -DNSPR20
LIBJPEG=$(DIST)\lib\jpeg$(MOZ_BITS)$(VERSION_NUMBER).lib
#//------------------------------------------------------------------------
#//
#// Windows-Specific Java Stuff
#//
#// (Is this used anymore? Even if it is should it be in config.mak?)
#//
#//------------------------------------------------------------------------
PATH_SEPARATOR = ;
!ifndef JAVA_HOME
JAVA_HOME=$(JDKHOME)
!endif
# where the bytecode will go
!if "$(AWT_11)" == "1"
JAVA_DESTPATH = $(MOZ_SRC)\mozilla\dist\classes11
!else
JAVA_DESTPATH = $(MOZ_SRC)\mozilla\dist\classes
!endif
# where the source are
DEFAULT_JAVA_SOURCEPATH = $(MOZ_SRC)\mozilla\sun-java\classsrc
!ifndef JAVA_SOURCEPATH
!if "$(AWT_11)" == "1"
JAVA_SOURCEPATH = $(MOZ_SRC)\mozilla\sun-java\classsrc11;$(DEFAULT_JAVA_SOURCEPATH)
!else
JAVA_SOURCEPATH = $(DEFAULT_JAVA_SOURCEPATH)
!endif
!endif
JAVA_PROG=$(MOZ_TOOLS)\bin\java.exe
#JAVA_PROG=$(DIST)\bin\java
JAVAC_ZIP=$(JAVA_HOME)\lib\classes.zip
ZIP_PROG = $(MOZ_TOOLS)\bin\zip
UNZIP_PROG = $(MOZ_TOOLS)\bin\unzip
ZIP_COMPR = 9
ZIP_FLAGS = -$(ZIP_COMPR)r
CFLAGS = $(CFLAGS) -DOS_HAS_DLL
DLL_SUFFIX = dll
LIB_SUFFIX = lib
!if "$(STAND_ALONE_JAVA)" == "1"
STAND_ALONE_JAVA_DLL_SUFFIX=s
!else
STAND_ALONE_JAVA_DLL_SUFFIX=
!endif
MOD_JRT=jrt$(MOZ_BITS)$(VERSION_NUMBER)
MOD_MM =mm$(MOZ_BITS)$(VERSION_NUMBER)
MOD_AWT=awt$(MOZ_BITS)$(VERSION_NUMBER)
MOD_AWTS=awt$(MOZ_BITS)$(VERSION_NUMBER)$(STAND_ALONE_JAVA_DLL_SUFFIX)
MOD_JIT=jit$(MOZ_BITS)$(VERSION_NUMBER)
MOD_JSJ=jsj$(MOZ_BITS)$(VERSION_NUMBER)
MOD_NET=net$(MOZ_BITS)$(VERSION_NUMBER)
MOD_JBN=jbn$(MOZ_BITS)$(VERSION_NUMBER)
MOD_NSC=nsc$(MOZ_BITS)$(VERSION_NUMBER)
MOD_JPW=jpw$(MOZ_BITS)$(VERSION_NUMBER)
MOD_JDB=jdb$(MOZ_BITS)$(VERSION_NUMBER)
MOD_ZPW=zpw$(MOZ_BITS)$(VERSION_NUMBER)
MOD_CON=con$(MOZ_BITS)$(VERSION_NUMBER)
MOD_NPJ=npj$(MOZ_BITS)$(VERSION_NUMBER)
JRTDLL=$(MOD_JRT).$(DLL_SUFFIX)
MMDLL =$(MOD_MM).$(DLL_SUFFIX)
AWTDLL=$(MOD_AWT).$(DLL_SUFFIX)
AWTSDLL=$(MOD_AWT)$(STAND_ALONE_JAVA_DLL_SUFFIX).$(DLL_SUFFIX)
JITDLL=$(MOD_JIT).$(DLL_SUFFIX)
JSJDLL=$(MOD_JSJ).$(DLL_SUFFIX)
NETDLL=$(MOD_NET).$(DLL_SUFFIX)
JBNDLL=$(MOD_JBN).$(DLL_SUFFIX)
NSCDLL=$(MOD_NSC).$(DLL_SUFFIX)
JPWDLL=$(MOD_JPW).$(DLL_SUFFIX)
JDBDLL=$(MOD_JDB).$(DLL_SUFFIX)
ZPWDLL=$(MOD_ZPW).$(DLL_SUFFIX)
CONDLL=$(MOD_CON).$(DLL_SUFFIX)
NPJDLL=$(MOD_NPJ).$(DLL_SUFFIX)
AWTLIB=$(DIST)\lib\$(MOD_AWT).$(LIB_SUFFIX)
######################################################################
include <$(DEPTH)/config/common.mk>
JAVA_DEFINES = \
-DJAR_NAME=\"$(JAR_NAME)\" \
-DJRTDLL=\"$(JRTDLL)\" \
-DMMDLL=\"$(MMDLL)\" \
-DAWTDLL=\"$(AWTDLL)\" \
-DAWTSDLL=\"$(AWTSDLL)\" \
-DJSJDLL=\"$(JSJDLL)\" \
-DJITDLL=\"$(JITDLL)\" \
-DNETDLL=\"$(NETDLL)\" \
-DJBNDLL=\"$(JBNDLL)\" \
-DNSCDLL=\"$(NSCDLL)\" \
-DJDBDLL=\"$(JDBDLL)\" \
-DJPWDLL=\"$(JPWDLL)\" \
-DZPWDLL=\"$(ZPWDLL)\" \
-DCONDLL=\"$(CONDLL)\"
!if "$(MOZ_BITS)" == "16"
# Override JAVA_DEFINES to make command line short for win16.
# Put any new defines into javadefs.h in ns/sun-java/include.
# This is to shorten the command line in order not to break Win16.
JAVA_DEFINES = -DJAR_NAME=\"$(JAR_NAME)\" -DMOZ_BITS=\"$(MOZ_BITS)\" -DVERSION_NUMBER=\"$(VERSION_NUMBER)\" -DDLL_SUFFIX=\".$(DLL_SUFFIX)\"
!endif
!if "$(AWT_11)" == "1"
JAVA_DEFINES = $(JAVA_DEFINES) -DAWT_11
!else
JAVA_DEFINES = $(JAVA_DEFINES) -DAWT_102
!endif
#JAVA_CLASSPATH = $(JAVA_CLASSPATH:/=\)
JMCSRCDIR = $(JMCSRCDIR:/=\)
JAVA_BOOT_CLASSPATH = $(JAVA_BOOT_CLASSPATH:/=\)
########
# Get the cwd to prepend to all compiled source
# files. Will allow debugger to automatically find sources
# instead of asking for the path info.
# Win16 will break if enabled, guess we continue to live in pain
# therein.
########
!if "$(MOZ_BITS)" == "32"
CURDIR=$(MAKEDIR)^\
!endif
XPIDL_PROG=$(DIST)\bin\xpidl.exe
XPTLINK_PROG=$(DIST)\bin\xpt_link.exe
# XXX If you change this name, be _sure_ to update rules.mak;
# specifically, the rules that compute XPIDL_HEADERS and
# XPIDL_TYPELIBS. 'nmake' is too dumb to allow recursive macro
# substitution.
XPIDL_GEN_DIR=.\_xpidlgen
#MOZ_DISABLE_JAR_PACKAGING=1 # temporary
!endif # CONFIG_CONFIG_MAK

572
mozilla/config/config.mk Normal file
View File

@@ -0,0 +1,572 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# config.mk
#
# Determines the platform and builds the macros needed to load the
# appropriate platform-specific .mk file, then defines all (most?)
# of the generic macros.
#
# Define an include-at-most-once flag
INCLUDED_CONFIG_MK = 1
ifndef topsrcdir
topsrcdir = $(DEPTH)
endif
ifndef INCLUDED_AUTOCONF_MK
include $(DEPTH)/config/autoconf.mk
endif
ifndef INCLUDED_INSURE_MK
ifdef MOZ_INSURIFYING
include $(topsrcdir)/config/insure.mk
endif
endif
ifndef INCLUDED_COMMON_MK
include $(topsrcdir)/config/common.mk
endif
BUILD_TOOLS = $(topsrcdir)/build/unix
CONFIG_TOOLS = $(DEPTH)/config
AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
#
# Tweak the default OS_ARCH and OS_RELEASE macros as needed.
#
ifeq ($(OS_ARCH),AIX)
OS_RELEASE := $(shell uname -v).$(shell uname -r)
endif
ifeq ($(OS_ARCH),BSD_386)
OS_ARCH := BSD_OS
endif
ifeq ($(OS_ARCH),dgux)
OS_ARCH := DGUX
endif
ifeq ($(OS_ARCH),IRIX64)
OS_ARCH := IRIX
endif
ifeq ($(OS_ARCH),UNIX_SV)
ifneq ($(findstring NCR,$(shell grep NCR /etc/bcheckrc | head -1 )),)
OS_ARCH := NCR
else
OS_ARCH := UNIXWARE
OS_RELEASE := $(shell uname -v)
endif
endif
ifeq ($(OS_ARCH),ncr)
OS_ARCH := NCR
endif
# This is the only way to correctly determine the actual OS version on NCR boxes.
ifeq ($(OS_ARCH),NCR)
OS_RELEASE := $(shell awk '{print $$3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$$/\2.\3/')
endif
ifeq ($(OS_ARCH),UNIX_System_V)
OS_ARCH := NEC
endif
ifeq ($(OS_ARCH),OSF1)
OS_SUB := $(shell uname -v)
# Until I know the other possibilities, or an easier way to compute them, this is all there's gonna be.
#ifeq ($(OS_SUB),240)
#OS_RELEASE := V2.0
#endif
ifeq ($(OS_SUB),148)
OS_RELEASE := V3.2C
endif
ifeq ($(OS_SUB),564)
OS_RELEASE := V4.0B
endif
ifeq ($(OS_SUB),878)
OS_RELEASE := V4.0D
endif
endif
ifneq (,$(findstring OpenVMS,$(OS_ARCH)))
OS_ARCH := OpenVMS
OS_RELEASE := $(shell uname -v)
CPU_ARCH := $(shell uname -Wh)
CPU_ARCH_TAG := _$(CPU_ARCH)
PERL := perl
endif
ifeq ($(OS_ARCH),QNX)
ifeq ($(OS_TARGET),NTO)
LD := qcc -Vgcc_ntox86 -nostdlib
else
OS_RELEASE := $(shell uname -v | sed 's/^\([0-9]\)\([0-9]*\)$$/\1.\2/')
LD := $(CC)
endif
OS_TEST := x86
endif
ifeq ($(OS_ARCH),SCO_SV)
OS_ARCH := SCOOS
OS_RELEASE := 5.0
endif
ifneq (,$(filter SINIX-N SINIX-Y SINIX-Z ReliantUNIX-M,$(OS_ARCH)))
OS_ARCH := SINIX
OS_TEST := $(shell uname -p)
endif
ifeq ($(OS_ARCH),UnixWare)
OS_ARCH := UNIXWARE
OS_RELEASE := $(shell uname -v)
endif
ifeq ($(OS_ARCH),OS_2)
OS_ARCH := OS2
OS_RELEASE := $(shell uname -v)
endif
ifeq ($(OS_ARCH),Mac OS)
ifeq ($(OS_RELEASE),10.0)
OS_ARCH := Rhapsody
endif
endif
ifeq ($(OS_ARCH),BeOS)
BEOS_ADDON_WORKAROUND = 1
endif
#
# Strip off the excessively long version numbers on these platforms,
# but save the version to allow multiple versions of the same base
# platform to be built in the same tree.
#
ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
OS_RELEASE := $(basename $(OS_RELEASE))
# Allow the user to ignore the OS_VERSION, which is usually irrelevant.
ifdef WANT_MOZILLA_CONFIG_OS_VERSION
OS_VERS := $(suffix $(OS_RELEASE))
OS_VERSION := $(shell echo $(OS_VERS) | sed 's/-.*//')
endif
endif
OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
# determine debug-related options
DEBUG_FLAGS :=
ifndef MOZ_DEBUG
#global debugging is disabled - check if it was explicitly enabled for this module
ifneq (, $(findstring $(MODULE), $(MOZ_DEBUG_MODULES)))
MOZ_DEBUG:=1
endif
else
#global debugging is enabled - check if it was explicitly disabled for this module
ifneq (, $(findstring ^$(MODULE), $(MOZ_DEBUG_MODULES)))
MOZ_DEBUG:=
endif
endif
ifdef MOZ_DEBUG
DEBUG_FLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
else
DEBUG_FLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
endif
ifdef MOZ_DEBUG
# debugging is enabled - determine if -g should be passed to the compiler, based on
# the current module, and the value of MOZ_DBGRINFO_MODULES
pattern:=ALL_MODULES ^ALL_MODULES
ifdef MODULE
# our current Makefile specifies a module name - add it to our pattern
pattern += $(MODULE) ^$(MODULE)
endif
# start by finding the first relevant module name (remember that the order of the
# module names in MOZ_DBGRINFO_MODULES is reversed from the order the user
# specified to configure - this allows the user to put general names at the beginning
# of the list, and to override them with explicit module names later in the list)
first_match:=$(firstword $(filter $(pattern), $(MOZ_DBGRINFO_MODULES)))
ifeq ($(first_match), $(MODULE))
# the user specified explicitly that this module should be compiled with -g
DEBUG_FLAGS += $(MOZ_DEBUG_FLAGS)
else
ifeq ($(first_match), ^$(MODULE))
# the user specified explicitly that this module should not be compiled with -g
# (nothing to do)
else
ifeq ($(first_match), ALL_MODULES)
# the user didn't mention this module explicitly, but wanted all modules to be
# compiled with -g
DEBUG_FLAGS += $(MOZ_DEBUG_FLAGS)
else
ifeq ($(first_match), ^ALL_MODULES)
# the user didn't mention this module explicitly, but wanted all modules to be
# compiled without -g (nothing to do)
endif
endif
endif
endif
endif
# append debug flags (these might have been above when processing
# MOZ_DBGRINFO_MODULES)
OS_CFLAGS += $(DEBUG_FLAGS)
OS_CXXFLAGS += $(DEBUG_FLAGS)
#
# Personal makefile customizations go in these optional make include files.
#
MY_CONFIG := $(DEPTH)/config/myconfig.mk
MY_RULES := $(DEPTH)/config/myrules.mk
#
# Relative pathname from top-of-tree to current source directory
#
ifneq ($(OS_ARCH),OS2)
REVDEPTH = $(CONFIG_TOOLS)/revdepth
endif
#
# Provide the means to easily override our tool directory locations.
#
ifdef NETSCAPE_HIERARCHY
CONTRIB_BIN := /tools/contrib/bin/
JAVA_BIN := /usr/local/java/bin/
LOCAL_BIN := /usr/local/bin/
LOCAL_SUN4 := /usr/local/sun4/bin/
NS_BIN := /tools/ns/bin/
NS_LIB := /tools/ns/lib
JAVA_LIB := /usr/local/netscape/java/lib
else
NS_LIB := .
JAVA_LIB := .
endif
# Allow NETSCAPE_COMMERCIAL to include XFEPRIVDIR
ifdef NETSCAPE_COMMERCIAL
XFEPRIVDIR := $(DEPTH)/../ns/cmd/xfe/
endif
#
# Default command macros; can be overridden in <arch>.mk.
#
CCC = $(CXX)
CCF = $(CC) $(CFLAGS)
LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
NFSPWD = $(CONFIG_TOOLS)/nfspwd
PURIFY = purify $(PURIFYOPTIONS)
QUANTIFY = quantify $(QUANTIFYOPTIONS)
MOC = moc
ifdef CROSS_COMPILE
XPIDL_COMPILE = $(DIST)/host/bin/host_xpidl$(BIN_SUFFIX)
XPIDL_LINK = $(DIST)/host/bin/host_xpt_link$(BIN_SUFFIX)
else
XPIDL_COMPILE = $(DIST)/bin/xpidl$(BIN_SUFFIX)
XPIDL_LINK = $(DIST)/bin/xpt_link$(BIN_SUFFIX)
endif
ifeq ($(OS_ARCH),OS2)
PATH_SEPARATOR := \;
else
PATH_SEPARATOR := :
ifeq ($(AWT_11),1)
JAVA_PROG = $(NS_BIN)java
JAVAC_ZIP = $(NS_LIB)/classes.zip
else
JAVA_PROG = $(LOCAL_BIN)java
ifdef JDKHOME
JAVAC_ZIP = $(JAVA_LIB)/classes.zip
else
JAVAC_ZIP = $(JAVA_LIB)/javac.zip
endif
endif
TAR = tar
endif # OS2
ifeq ($(OS_ARCH),OpenVMS)
include $(topsrcdir)/config/$(OS_ARCH).mk
endif
XBCFLAGS =
ifdef MOZ_DEBUG
JAVA_OPTIMIZER = -g
XBCFLAGS = -FR$*
endif
ifdef MOZ_TRACK_MODULE_DEPS
REQ_INCLUDES = $(foreach d,$(REQUIRES),-I$(DIST)/include/$d)
endif
INCLUDES = $(LOCAL_INCLUDES) $(REQ_INCLUDES) -I$(PUBLIC) -I$(DIST)/include $(OS_INCLUDES)
LIBNT = $(DIST)/lib/libnt.$(LIB_SUFFIX)
LIBAWT = $(DIST)/lib/libawt.$(LIB_SUFFIX)
LIBMMEDIA = $(DIST)/lib/libmmedia.$(LIB_SUFFIX)
NSPRDIR = nsprpub
LIBNSPR = $(DIST)/lib/libplds3.$(LIB_SUFFIX) $(DIST)/lib/libnspr3.$(LIB_SUFFIX)
PURELIBNSPR = $(DIST)/lib/purelibplds3.$(LIB_SUFFIX) $(DIST)/lib/purelibnspr3.$(LIB_SUFFIX)
ifdef DBMALLOC
LIBNSPR += $(DIST)/lib/libdbmalloc.$(LIB_SUFFIX)
endif
ifeq ($(OS_ARCH),OS2)
ifneq ($(MOZ_WIDGET_TOOLKIT), os2)
LIBNSJAVA = $(DIST)/lib/jrt$(MOZ_BITS)$(VERSION_NUMBER).$(LIB_SUFFIX)
LIBMD = $(DIST)/lib/libjmd.$(LIB_SUFFIX)
LIBJAVA = $(DIST)/lib/libjrt.$(LIB_SUFFIX)
LIBNSPR = $(DIST)/lib/pr$(MOZ_BITS)$(VERSION_NUMBER).$(LIB_SUFFIX)
LIBXP = $(DIST)/lib/libxp.$(LIB_SUFFIX)
endif
else
LIBNSJAVA = $(DIST)/lib/nsjava32.$(LIB_SUFFIX)
endif
CFLAGS = $(OS_CFLAGS)
CXXFLAGS = $(OS_CXXFLAGS)
COMPILE_CFLAGS = $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(OS_COMPILE_CFLAGS)
COMPILE_CXXFLAGS = $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(OS_COMPILE_CXXFLAGS)
LDFLAGS = $(OS_LDFLAGS)
#
# Some platforms (Solaris) might require builds using either
# (or both) compiler(s).
#
ifdef SHOW_CC_TYPE
COMPILER = _$(notdir $(CC))
endif
#
# Name of the binary code directories
#
# Override defaults
# We need to know where to find the libraries we
# put on the link line for binaries, and should
# we link statically or dynamic? Assuming dynamic for now.
LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
# Default location of include files
# Note: NSPR doesn't have $(PUBLIC) and
# will always install its headers to $(DIST)/include
ifdef MOZ_TRACK_MODULE_DEPS
PUBLIC = $(DIST)/include/$(MODULE)
else
PUBLIC = $(DIST)/include
endif
DEPENDENCIES = .md
MOZ_COMPONENT_LIBS=$(MOZ_COMPONENT_NSPR_LIBS) $(MOZ_COMPONENT_XPCOM_LIBS)
ifdef GC_LEAK_DETECTOR
MOZ_COMPONENT_XPCOM_LIBS += -lboehm
XPCOM_LIBS += -lboehm
endif
ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES)))
DEFINES += -DXPCONNECT_STANDALONE
endif
ifeq ($(OS_ARCH),OS2)
ELF_DYNSTR_GC = echo
else
ELF_DYNSTR_GC = :
endif
ifndef CROSS_COMPILE
ifdef USE_ELF_DYNSTR_GC
ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
ELF_DYNSTR_GC = $(DIST)/bin/elf-dynstr-gc
endif
endif
endif
ifneq ($(OS_ARCH),WINNT)
ifdef MOZ_NATIVE_MAKEDEPEND
MKDEPEND_DIR =
# Adding the '-w' flag shortens the depend.mk files by allowing
# more dependencies on one line. It may even speed up makedepend.
# (Picking 3000 somewhat arbitrarily.)
MKDEPEND = $(MOZ_NATIVE_MAKEDEPEND) -Y -w 3000
else
MKDEPEND_DIR = $(DEPTH)/config/mkdepend
MKDEPEND = $(MKDEPEND_DIR)/mkdepend
endif
MKDEPENDENCIES = depend.mk
endif
#
# Include any personal overrides the user might think are needed.
#
-include $(MY_CONFIG)
######################################################################
# Now test variables that might have been set or overridden by $(MY_CONFIG).
DEFINES += -DOSTYPE=\"$(OS_CONFIG)\"
ifdef MOZ_SECURITY
DEFINES += -DMOZ_SECURITY
endif
#
# Platform dependent switching off of JAVA
#
ifdef MOZ_JAVA
DEFINES += -DJAVA
ifdef MOZ_OJI
error You can't define both MOZ_JAVA and MOZ_OJI anymore.
endif
JAVA_OR_OJI = 1
JAVA_OR_NSJVM = 1
endif
ifdef NSJVM
JAVA_OR_NSJVM = 1
endif
ifdef MOZ_OJI
DEFINES += -DOJI
JAVA_OR_OJI = 1
endif
ifdef JAVA_OR_NSJVM # XXX fix -- su can't depend on java
MOZ_SMARTUPDATE = 1
endif
ifdef FORTEZZA
DEFINES += -DFORTEZZA
endif
# For profiling
ifdef ENABLE_EAZEL_PROFILER
ifndef INTERNAL_TOOLS
ifneq ($(LIBRARY_NAME), xpt)
ifneq (, $(findstring $(shell $(topsrcdir)/build/unix/print-depth-path.sh | awk -F/ '{ print $$2; }'), $(MOZ_PROFILE_MODULES)))
PROFILER_CFLAGS = $(EAZEL_PROFILER_CFLAGS) -DENABLE_EAZEL_PROFILER
PROFILER_LIBS = $(EAZEL_PROFILER_LIBS)
endif
endif
endif
endif
######################################################################
GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
ifneq (,$(filter-out WINNT, $(OS_ARCH)))
ifdef CROSS_COMPILE
NSINSTALL = $(CONFIG_TOOLS)/host_nsinstall
else
NSINSTALL = $(CONFIG_TOOLS)/nsinstall
endif
ifeq ($(NSDISTMODE),copy)
# copy files, but preserve source mtime
INSTALL = $(NSINSTALL) -t
else
ifeq ($(NSDISTMODE),absolute_symlink)
# install using absolute symbolic links
INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
else
# install using relative symbolic links
INSTALL = $(NSINSTALL) -R
endif
endif
endif
######################################################################
### Java Stuff - see common.mk
######################################################################
# where the bytecode will go
JAVA_DESTPATH = $(DIST)/classes
# where the sources for the module you are compiling are
# default is sun-java/classsrc, override for other modules
ifndef JAVA_SOURCEPATH
JAVA_SOURCEPATH = $(DEPTH)/sun-java/classsrc
endif
ifndef JAVAH_IN_JAVA
ifeq ($(MOZ_OS2_TOOLS),VACPP)
JAVAH_PROG = flipper $(DIST)/bin/javah
else
JAVAH_PROG = $(DIST)/bin/javah
endif
else
JAVAH_PROG = $(JAVA) netscape.tools.jric.Main
endif
ifneq ($(JDKHOME),)
JAVAH_PROG = $(JDKHOME)/bin/javah
JAVAC_PROG = $(JDKHOME)/bin/javac $(JAVAC_FLAGS)
JAVAC = $(JAVAC_PROG)
endif
ifeq ($(STAND_ALONE_JAVA),1)
STAND_ALONE_JAVA_DLL_SUFFIX = s
endif
ifeq ($(MOZ_OS2_TOOLS),OLD_IBM_BUILD) # These DLL names are no longer valid for OS/2
AWTDLL = awt$(MOZ_BITS)$(VERSION_NUMBER).$(DLL_SUFFIX)
AWTSDLL = awt$(MOZ_BITS)$(VERSION_NUMBER)$(STAND_ALONE_JAVA_DLL_SUFFIX).$(DLL_SUFFIX)
CONDLL = con.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JBNDLL = jbn.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JDBCDLL = jdb.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JITDLL = jit.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JPWDLL = jpw.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JRTDLL = jrt$(MOZ_BITS)$(VERSION_NUMBER).$(DLL_SUFFIX)
JSJDLL = jsj.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
MMDLL = mm$(MOZ_BITS)$(VERSION_NUMBER).$(DLL_SUFFIX)
NETDLL = net.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
NSCDLL = nsc.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
ZIPDLL = zip.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
ZPWDLL = zpw.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
else
AWTDLL = libawt.$(DLL_SUFFIX)
AWTSDLL = libawt$(STAND_ALONE_JAVA_DLL_SUFFIX).$(DLL_SUFFIX)
CONDLL = libcon.$(DLL_SUFFIX)
JBNDLL = libjbn.$(DLL_SUFFIX)
JDBCDLL = libjdb.$(DLL_SUFFIX)
JITDLL = libjit.$(DLL_SUFFIX)
JPWDLL = libjpw.$(DLL_SUFFIX)
JRTDLL = libjrt.$(DLL_SUFFIX)
JSJDLL = libjsj.$(DLL_SUFFIX)
MMDLL = libmm.$(DLL_SUFFIX)
NETDLL = libnet.$(DLL_SUFFIX)
NSCDLL = libnsc.$(DLL_SUFFIX)
ZIPDLL = libzip.$(DLL_SUFFIX)
ZPWDLL = libzpw.$(DLL_SUFFIX)
endif
JAVA_DEFINES += -DAWTSDLL=\"$(AWTSDLL)\" -DCONDLL=\"$(CONDLL)\" -DJBNDLL=\"$(JBNDLL)\" -DJDBDLL=\"$(JDBDLL)\" \
-DJSJDLL=\"$(JSJDLL)\" -DNETDLL=\"$(NETDLL)\" -DNSCDLL=\"$(NSCDLL)\" -DZPWDLL=\"$(ZPWDLL)\" \
-DJAR_NAME=\"$(JAR_NAME)\"
ifeq ($(AWT_11),1)
JAVA_DEFINES += -DAWT_11
else
JAVA_DEFINES += -DAWT_102
endif
#caca:
# @echo $(PROFILER_CFLAGS)

66
mozilla/config/cvsco.pl Executable file
View File

@@ -0,0 +1,66 @@
#!/usr/bin/env perl
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Stephen Lamm
#
sub usage {
warn "usage: cvsco.pl <checkout_command>\n"
." <checkout_command> is the entire cvs co command\n"
." (e.g. cvs -q -z3 co SeaMonkeyAll).\n";
}
usage(), die "Error: Not enough arguments\n" if $#ARGV < 0;
usage(), die "Error: Wrong cwd. Must chdir to mozilla/..\n"
unless -r 'mozilla/config/cvsco.pl';
$co_command = join ' ', @ARGV;
$logfile = 'cvslog.txt';
$old_logfile = 'cvslog-old.txt';
sub dblprint {
print LOG @_;
print STDERR @_;
}
if (-r $logfile) {
rename $logfile, $old_logfile;
print "rename $logfile, $old_logfile\n";
}
open LOG, ">$logfile";
open CVSCO, "$co_command|";
dblprint "\ncheckout start: ".scalar(localtime)."\n";
dblprint "$co_command | tee cvslog.txt\n";
while (<CVSCO>) {
dblprint $_;
push @conflicts, $_ if /^C /;
}
if (@conflicts) {
print "Error: cvs conflicts during checkout:\n";
die join('', @conflicts);
}
close(CVSCO) or die "cvs error.\n";
dblprint 'checkout finish: '.scalar(localtime)."\n";

96
mozilla/config/dll.inc Normal file
View File

@@ -0,0 +1,96 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build 16 and 32 bit
#// DLLs.
#//
#//------------------------------------------------------------------------
!if defined(DLL) && !defined(CONFIG_DLL_INC)
CONFIG_DLL_INC=1
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#//
#// Rule to build a 16-bit DLL using the DLL target
#//
#//------------------------------------------------------------------------
$(DLL): $(OBJDIR) $(OBJS) $(LLIBS) $(RESFILE) $(DEFFILE) $(MISCDEP) makefile.win $(DEPTH)\config\dll.inc
echo +++ make: Creating DLL: $@
# //
# // create response file for the command. The format is:
# // Object files, Output file, Map file, Libraries, DEF file, RES file
# //
echo $(LFLAGS) > $(CFGFILE)
echo /implib:$*.lib >> $(CFGFILE)
for %%d in ($(OBJS)) do echo %%d + >> $(CFGFILE)
echo. >> $(CFGFILE)
echo $(OBJDIR)\$(*B).dll, >> $(CFGFILE)
!ifdef MAPFILE
echo $(MAPFILE), >> $(CFGFILE)
!endif
echo $(LLIBS) $(WIN_LIBS) $(OS_LIBS) >> $(CFGFILE)
!ifdef DEFFILE
echo $(DEFFILE), >> $(CFGFILE)
!else
echo. >> $(CFGFILE)
!endif
!ifdef RESFILE
echo $(RESFILE), >> $(CFGFILE)
!else
echo. >> $(CFGFILE)
!endif
# //
# // execute the commands
# //
$(LD) @$(CFGFILE)
!else
#//------------------------------------------------------------------------
#//
#// Rule to build a 32-bit DLL using the DLL target
#//
#//------------------------------------------------------------------------
$(DLL): $(OBJDIR) $(OBJS) $(LLIBS) $(RESFILE) $(DEFFILE) $(MISCDEP) makefile.win $(DEPTH)\config\dll.inc
echo +++ make: Creating DLL: $@
$(LD) @<<$(CFGFILE)
/NOLOGO /DLL /OUT:$@
/PDB:$(PDBFILE)
!ifdef DEFFILE
/DEF:$(DEFFILE)
!endif
!ifdef MAPFILE
/MAP:$(MAPFILE)
!endif
!if exist(win32.order) && !defined(MOZ_DEBUG)
/ORDER:@win32.order
!endif
$(LFLAGS)
$(OBJS)
$(RESFILE)
$(LLIBS) $(WIN_LIBS) $(OS_LIBS)
<<KEEP
!endif
!endif # DLL && ! CONFIG_DLL_INC

File diff suppressed because it is too large Load Diff

91
mozilla/config/exe.inc Normal file
View File

@@ -0,0 +1,91 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build 16 and 32 bit
#// executables.
#//
#//------------------------------------------------------------------------
!if defined(PROGRAM) && !defined(CONFIG_EXE_INC)
CONFIG_EXE_INC=1
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#//
#// Rule to build a 16-bit executable using the PROGRAM target
#//
#//------------------------------------------------------------------------
$(PROGRAM):: $(OBJDIR) $(OBJS) $(LLIBS) $(RESFILE) $(DEFFILE) $(MISCDEP) makefile.win $(DEPTH)\config\exe.inc
echo +++ make: Creating EXE: $@
# //
# // create response file for the command. The format is:
# // Object files, Output file, Map file, Libraries, DEF file, RES file
# //
echo $(LFLAGS) > $(CFGFILE)
for %%d in ($(OBJS)) do echo %%d + >> $(CFGFILE)
echo. >> $(CFGFILE)
echo $(OBJDIR)\$(*B).exe, >> $(CFGFILE)
echo $(MAPFILE), >> $(CFGFILE)
echo $(LLIBS) $(WIN_LIBS) $(OS_LIBS)>> $(CFGFILE)
!ifdef DEFFILE
echo $(DEFFILE), >> $(CFGFILE)
!else
echo. >> $(CFGFILE)
!endif
!ifdef RESFILE
echo $(RESFILE), >> $(CFGFILE)
!else
echo. >> $(CFGFILE)
!endif
# //
# // execute the command
# //
$(LD) /ST:8192 @$(CFGFILE)
!else
#//------------------------------------------------------------------------
#//
#// Rule to build a 32-bit executable using the PROGRAM target
#//
#//------------------------------------------------------------------------
$(PROGRAM):: $(OBJDIR) $(OBJS) $(LLIBS) $(RESFILE) $(DEFFILE) $(MISCDEP) makefile.win $(DEPTH)\config\exe.inc
echo +++ make: Creating EXE: $@
$(LD) @<<$(CFGFILE)
/NOLOGO /OUT:$@
/PDB:$(PDBFILE)
!ifdef DEFFILE
/DEF:$(DEFFILE)
!endif
!ifdef MAPFILE
/MAP:$(MAPFILE)
!endif
$(LFLAGS)
$(OBJS)
$(RESFILE)
$(LLIBS) $(WIN_LIBS) $(OS_LIBS)
<<KEEP
!endif
!endif # PROGRAM && ! CONFIG_EXE_INC

150
mozilla/config/fast-update.pl Executable file
View File

@@ -0,0 +1,150 @@
#!/usr/bin/env perl
use Getopt::Long;
my $hours=24;
my $branch;
my $module="SeaMonkeyAll";
my $maxdirs=5;
my $rootdir = "";
# pull out the current directory
# if there is no such file, this will all just fail, which is ok
open REPOSITORY, "<CVS/Repository";
$rootdir = <REPOSITORY>;
chop $rootdir;
close REPOSITORY;
print "Current dir = $rootdir\n";
&GetOptions('h=s' => \$hours, 'm=s' => \$module, 'r=s' => \$branch);
# try to guess the current branch by looking at all the
# files in CVS/Entries
if (!$branch) {
my $foundbranch =0;
open ENTRIES, "<CVS/Entries";
while (<ENTRIES>) {
chop;
@entry = split(/\//);
my ($type, $file, $ver, $date, $unknown, $tag) = @entry;
# the tag usually starts with "T"
$thisbranch = substr($tag, 1);
# look for more than one branch
if ($type eq "") {
if ($foundbranch and ($lastbranch ne $thisbranch)) {
die "Multiple branches in this directory, cannot determine branch\n";
}
$foundbranch = 1;
$lastbranch = $thisbranch;
}
}
$branch = $lastbranch if ($foundbranch);
close ENTRIES;
}
my $url = "http://bonsai.mozilla.org/cvsquery.cgi?module=${module}&branch=${branch}&branchtype=match&sortby=File&date=hours&hours=${hours}&cvsroot=%2Fcvsroot";
print "Contacting bonsai for updates to ${module} ";
print "on the ${branch} branch " if ($branch);
print "in the last ${hours} hours ";
print "within the $rootdir directory..\n" if ($rootdir);
# first try wget, then try lynx
# this is my lame way of checking if a command succeeded AND getting
# output from it. I'd love a better way. -alecf@netscape.com
my $have_checkins = 0;
@args = ("wget", "--quiet", "--output-document=-", "\"$url\"");
open CHECKINS,"wget --quiet --output-document=- \"$url\"|" or
die "Error opening wget: $!\n";
$header = <CHECKINS> and $have_checkins=1;
if (!$have_checkins) {
open CHECKINS, "lynx -source '$url'|" or die "Error opening lynx: $!\n";
$header = <CHECKINS> and $have_checkins = 1;
}
$have_checkins || die "Couldn't get checkins\n";
open REALOUT, ">foo" || die "argh $!\n";
print "Processing checkins..\n";
while (<CHECKINS>) {
print REALOUT $_;
if (/js_file_menu\((.*),\s*\'(.*)\'\s*,\s*(.*),\s*(.*),\s*(.*),\s*(.*)\)/) {
my ($repos, $dir, $file, $rev, $branch, $event) =
($1, $2, $3, $4, $5, $6);
push @dirlist, $dir;
}
}
close REALOUT;
my $lastdir = "";
my @uniquedirs;
foreach $dir (sort @dirlist) {
next if ($lastdir eq $dir);
my $strippeddir = "";
$lastdir = $dir;
# now strip out $rootdir
if ($rootdir) {
# only deal with directories that start with $rootdir
if (substr($dir, 0, (length $rootdir)) eq $rootdir) {
if ($dir eq $rootdir) {
$strippeddir = ".";
} else {
$strippeddir = substr($dir,(length $rootdir) + 1 );
}
}
} else {
$strippeddir = $dir;
}
if ($strippeddir) {
push @uniquedirs, $strippeddir;
}
}
if ($#uniquedirs < 0) {
print "No directories to update.\n";
exit 0;
}
print "Updating tree..\n";
my $i=0;
my $dirlist = "";
foreach $dir (sort @uniquedirs) {
$dirlist .= "$dir ";
$i++;
if ($i == 5) {
system "cvs up -l $dirlist\n";
$dirlist = "";
$i=0;
}
}
if ($i < 5) {
system "cvs up -l -d $dirlist\n";
}
close CHECKINS;
print "done.\n";

57
mozilla/config/fastcwd.pl Normal file
View File

@@ -0,0 +1,57 @@
#!perl5
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# By John Bazik
#
# Usage: $cwd = &fastcwd;
#
# This is a faster version of getcwd. It's also more dangerous because
# you might chdir out of a directory that you can't chdir back into.
#
sub fastcwd {
local($odev, $oino, $cdev, $cino, $tdev, $tino);
local(@path, $path);
local(*DIR);
($cdev, $cino) = stat('.');
for (;;) {
($odev, $oino) = ($cdev, $cino);
chdir('..');
($cdev, $cino) = stat('.');
last if $odev == $cdev && $oino == $cino;
opendir(DIR, '.');
for (;;) {
$_ = readdir(DIR);
next if $_ eq '.';
next if $_ eq '..';
last unless $_;
($tdev, $tino) = lstat($_);
last unless $tdev != $odev || $tino != $oino;
}
closedir(DIR);
unshift(@path, $_);
}
chdir($path = '/' . join('/', @path));
$path;
}
1;

218
mozilla/config/glibcversion.sh Executable file
View File

@@ -0,0 +1,218 @@
#!/bin/sh
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
##############################################################################
##
## Name: glibcversion.sh - Print __GLIBC__ version if gnu libc 2 is
## found.
##
## Description: This script is needed by the mozilla build system. It needs
## to determine whether the current platform (mostly the
## various linux "platforms") are based on the gnu libc2. This
## information is later used in mozilla to determine whether
## gnu libc 2 specific "features" need to be handled, such
## as broken locales.
##
## Author: Ramiro Estrugo <ramiro@netscape.com>
##
##############################################################################
##
## Command Line Flags Supported:
##
## -g | --is-glibc2: Print True/False if detected __GLIBC__.
##
## -v | --print-version: Print value of __GLIBC__ if found, or none.
##
## -o | --set-object-name: Set object name for current system.
## -cc | --set-compiler: Set compiler for building test program.
##
##
## Constants
##
GLIBC_PROG_PREFIX=./get_glibc_info
##
## Defaults
##
GLIBC_PRINT_IS_GLIBC2=False
GLIBC_PRINT_VERSION=False
GLIBC_OBJECT_NAME=`uname`-`uname -r`
GLIBC_CC=cc
function glibc_usage()
{
echo
echo "Usage: `basename $0` [options]"
echo
echo " -g, --is-glibc2: Print True/False if detected __GLIBC__."
echo
echo " -v, --print-version: Print value of __GLIBC__ if found, or none."
echo
echo " -o, --set-object-name: Set object name for current system."
echo " -cc, --set-compiler: Set compiler for building test program."
echo
echo " -h, --help: Print this blurb."
echo
echo "The default is '-v' if no options are given."
echo
}
##
## Parse the command line
##
while [ "$*" ]; do
case $1 in
-h | --help)
shift
glibc_usage
exit 0
;;
-g | --is-glibc2)
shift
GLIBC_PRINT_IS_GLIBC2=True
;;
-v | --print-version)
shift
GLIBC_PRINT_VERSION=True
;;
-o | --set-object-name)
shift
GLIBC_OBJECT_NAME="$1"
shift
;;
-cc | --set-compiler)
shift
GLIBC_CC="$1"
shift
;;
-*)
echo "`basename $0`: invalid option '$1'"
shift
glibc_usage
exit 0
;;
esac
done
##
## Motif info program name
##
GLIBC_PROG="$GLIBC_PROG_PREFIX"_"$GLIBC_OBJECT_NAME"
GLIBC_SRC="$GLIBC_PROG_PREFIX"_"$GLIBC_OBJECT_NAME.c"
##
## Cleanup the dummy test source/program
##
function glibc_cleanup()
{
true
# rm -f $GLIBC_PROG
# rm -f $GLIBC_SRC
}
glibc_cleanup
if [ ! -f $GLIBC_SRC ]
then
cat << EOF > $GLIBC_SRC
#include <stdio.h>
int main(int argc,char ** argv)
{
#ifdef __GLIBC__
fprintf(stdout,"%d\n",__GLIBC__);
#else
fprintf(stdout,"none\n");
#endif
return 0;
}
EOF
fi
if [ ! -f $GLIBC_SRC ]
then
echo
echo "Could not create test program source $GLIBC_SRC."
echo
glibc_cleanup
exit
fi
##
## Compile the dummy test program if needed
##
if [ ! -x $GLIBC_PROG ]
then
$GLIBC_CC -o $GLIBC_PROG $GLIBC_SRC
fi
if [ ! -x $GLIBC_PROG ]
then
echo
echo "Could not create test program $GLIBC_PROG."
echo
glibc_cleanup
exit
fi
##
## Execute the dummy test program
##
GLIBC_PROG_OUTPUT=`$GLIBC_PROG`
##
## -g | --is-glibc2
##
if [ "$GLIBC_PRINT_IS_GLIBC2" = "True" ]
then
if [ "$GLIBC_PROG_OUTPUT" = "2" ]
then
echo True
else
echo False
fi
glibc_cleanup
exit 0
fi
echo $GLIBC_PROG_OUTPUT
glibc_cleanup

2794
mozilla/config/gtscc.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
@echo off
rem The contents of this file are subject to the Netscape Public
rem License Version 1.1 (the "License"); you may not use this file
rem except in compliance with the License. You may obtain a copy of
rem the License at http://www.mozilla.org/NPL/
rem
rem Software distributed under the License is distributed on an "AS
rem IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
rem implied. See the License for the specific language governing
rem rights and limitations under the License.
rem
rem The Original Code is mozilla.org code.
rem
rem The Initial Developer of the Original Code is Netscape
rem Communications Corporation. Portions created by Netscape are
rem Copyright (C) 1998 Netscape Communications Corporation. All
rem Rights Reserved.
rem
rem Contributor(s):
@echo on
@if not exist %2\nul mkdir %2
@rm -f %2\%1
@cp %1 %2

View File

@@ -0,0 +1,175 @@
#!perl -w
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla 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-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
#
use Cwd;
return(1);
sub InstallChrome()
{
# inOsType - type of OS being run under
# inType - type of reg file to create (jar or resource)
# inTargetPath - path to where the bin\chrome dir
($inOsType, $inType, $inTargetPath) = @_;
my($mOutFilenameTmp) = "installed-chrome_tmp.txt";
my($mFinalFilename) = "installed-chrome.txt";
if($inOsType =~ /win32/i)
{
$gPathDelimiter="\\";
}
elsif($inOsType =~ /mac/i)
{
$gPathDelimiter=":";
}
elsif($inOsType =~ /unix/i)
{
$gPathDelimiter="/";
}
if($inOsType =~ /win32/i)
{
# Convert all '/' to '\\' or else win32 will have problems
$inTargetPath =~ s/\//\\/g;
}
# Make sure $inTargetPath exists
if(!(-e "$inTargetPath"))
{
return(1);
}
open(fpOutFileTmp, ">$inTargetPath$gPathDelimiter$mOutFilenameTmp") || die "\nCould not open $inTargetPath$gPathDelimiter$mOutFilenameTmp: $!\n";
CreateChromeTextFile($inType, $inTargetPath, "locales", "loc");
CreateChromeTextFile($inType, $inTargetPath, "packages", "pkg");
CreateChromeTextFile($inType, $inTargetPath, "skins", "skn");
if(-e "$inTargetPath$gPathDelimiter$mFinalFilename")
{
open(fpInFile, "$inTargetPath$gPathDelimiter$mFinalFilename") || die "\nCould not open $inTargetPath$gPathDelimiter$mFinalFilename: $!\n";
while($line = <fpInFile>)
{
print fpOutFileTmp "$line";
}
close(fpInFile);
unlink "$inTargetPath$gPathDelimiter$mFinalFilename";
}
close(fpOutFileTmp);
if(!rename("$inTargetPath$gPathDelimiter$mOutFilenameTmp", "$inTargetPath$gPathDelimiter$mFinalFilename"))
{
die "\n Error $!: rename (\"$inTargetPath$gPathDelimiter$mOutFilenameTmp\", \"$inTargetPath$gPathDelimiter$mFinalFilename\")\n";
}
return(0);
}
sub CreateChromeTextFile()
{
my($inType, $inTargetPath, $inChromeDir, $inExt) = @_;
@dlChromeDir = <$inTargetPath\\$inChromeDir\\*>;
foreach $dir (@dlChromeDir)
{
if($inOsType =~ /win32/i)
{
# Convert all '/' to '\\' or else win32 will have problems
$dir =~ s/\//\\/g;
}
# Get the leaf dir name from full path
if($inOsType =~ /win32/i)
{
@dirItem = split(/\\/, $dir);
}
elsif($inOsType =~ /mac/i)
{
@dirItem = split(/:/, $dir);
}
elsif($inOsType =~ /unix/i)
{
@dirItem = split(/\//, $dir);
}
$dirName = $dirItem[$#dirItem];
# Make sure the path is valid
if(-d "$dir")
{
if($inType =~ /jar/i)
{
if(CheckDir("content", "$dir"))
{
print fpOutFileTmp "content,install,url,jar:resource:/chrome/$dirName.$inExt!/\n";
}
if(CheckDir("locale", "$dir"))
{
print fpOutFileTmp "locale,install,url,jar:resource:/chrome/$dirName.$inExt!/\n";
}
if(CheckDir("skin", "$dir"))
{
print fpOutFileTmp "skin,install,url,jar:resource:/chrome/$dirName.$inExt!/\n";
}
}
else
{
if(CheckDir("content", "$dir"))
{
print fpOutFileTmp "content,install,url,resource:/chrome/$inChromeDir/$dirName/\n";
}
if(CheckDir("locale", "$dir"))
{
print fpOutFileTmp "locale,install,url,resource:/chrome/$inChromeDir/$dirName/\n";
}
if(CheckDir("skin", "$dir"))
{
print fpOutFileTmp "skin,install,url,resource:/chrome/$inChromeDir/$dirName/\n";
}
}
}
}
return(0);
}
sub CheckDir()
{
my($dirType, $inPath) = @_;
@dlDirType = <$inPath$gPathDelimiter*>;
foreach $dir (@dlDirType)
{
if($inOsType =~ /win32/i)
{
# Convert all '/' to '\\' or else win32 will have problems
$dir =~ s/\//\\/g;
}
if(-d "$dir$gPathDelimiter$dirType")
{
return(1);
}
}
return(0);
}

View File

@@ -0,0 +1,44 @@
#!perl -w
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla 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-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
#
# Make sure there are at least two arguments
if($#ARGV < 1)
{
die "usage: $0 <os> <type> <target path>
os : mac, unix, win32
type : jar or resource
target path: path to where the chrome dir is at
ie: $0 win32 resource $ENV{MOZ_SRC}\\mozilla\\dist\\win32_d.obj\\bin\\chrome
\n";
}
require "$ENV{MOZ_SRC}/mozilla/config/installcfunc.pl";
if(&InstallChrome($ARGV[0], $ARGV[1], $ARGV[2]) != 0)
{
die "\n Error: InstallChrome($ARGV[0], $ARGV[1], $ARGV[2]): $!\n";
}

37
mozilla/config/insure.mk Normal file
View File

@@ -0,0 +1,37 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
INCLUDED_INSURE_MK = 1
INSURE_MATCH_SCRIPT=$(topsrcdir)/build/autoconf/match-dir.sh
INSURE_EXCLUDE=$(shell $(INSURE_MATCH_SCRIPT) $(MOZ_INSURE_EXCLUDE_DIRS))
INSURE_INCLUDE=$(shell $(INSURE_MATCH_SCRIPT) $(MOZ_INSURE_DIRS))
ifeq ($(INSURE_EXCLUDE),0)
ifeq ($(INSURE_INCLUDE),1)
CC := $(MOZ_INSURE)
CXX := $(MOZ_INSURE)
endif # INSURE_INCLUDE == 1
endif # INSURE_EXCLUDE == 0

238
mozilla/config/java.inc Normal file
View File

@@ -0,0 +1,238 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build Java Header
#// and Stub files
#//
#//------------------------------------------------------------------------
!if !defined(CONFIG_JAVA_INC)
CONFIG_JAVA_INC=1
#//------------------------------------------------------------------------
#// Setup to generate Mac java headers (checkout ns/lib/mac/Java
#//------------------------------------------------------------------------
!ifdef MOZ_GENMAC
MAC_JAVA_HEADERS_DIR = $(DEPTH)/lib/mac/Java
#//------------------------------------------------------------------------
#// 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_TIP)" != ""
CVS_BRANCH=-A
!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
$(MAC_JAVA_HEADERS_DIR):
@echo +++ Checking out $(MAC_JAVA_HEADERS_DIR) +++
$(PERL) $(DEPTH)/config/cvsco.pl $(CVS_BRANCH) ns/lib/mac/Java
@echo +++ Done Checking out $(MAC_JAVA_HEADERS_DIR) +++
!endif
!ifdef JDK_GEN
!ifdef JAVA_OR_OJI
#//------------------------------------------------------------------------
#//
#// Rule to generate Java header files using javah.
#//
#//------------------------------------------------------------------------
$(JDK_GEN):: display_java_header_msg
!$(JAVAH) -d _gen $@
!ifdef NSBUILDROOT
LINCS = $(LINCS) -I$(JDK_GEN_DIR) -I$(XPDIST)
!else
LINCS = $(LINCS) -I$(JDK_GEN_DIR)
!endif
display_java_header_msg:
echo +++ make: Generating java header files...
!ifdef MOZ_GENMAC
$(JDK_GEN)::display_java_header_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JDK header for $@
!$(JAVAH) -mac -d $(MAC_JAVA_HEADERS_DIR)/_gen $@
display_java_header_msg_mac:
echo +++ make: Generating Macintosh JDK header files +++
!endif
!endif # JAVA_OR_OJI
!endif
!ifdef JDK_GEN
!ifdef JAVA_OR_OJI
#//------------------------------------------------------------------------
#//
#// Rules to generate Java stub files using javah.
#//
#//------------------------------------------------------------------------
$(JDK_GEN)::display_java_stub_msg
!$(JAVAH) -stubs -d _stubs $@
display_java_stub_msg:
echo +++ make: Generating java stub files...
!ifdef MOZ_GENMAC
$(JDK_GEN)::display_java_stub_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JDK stub for $@
!$(JAVAH) -mac -stubs -d $(MAC_JAVA_HEADERS_DIR)/_stubs $@
display_java_stub_msg_mac:
echo +++ make: Generating Macintosh JDK stub files +++
!endif
export:: $(JDK_GEN)
!endif # JAVA_OR_OJI
!endif
!ifdef JAVA_LIBSTUB_FILES
!ifdef JAVA_OR_OJI
#//------------------------------------------------------------------------
#//
#// Rules to generate libstubs.c using javah.
#//
#//------------------------------------------------------------------------
libstubs.c::$(JAVA_LIBSTUB_FILES)
echo +++ make: Generating libstubs.c...
$(JAVAH) -o libstubs.c -stubs $**
stubs$(MOZ_BITS).c::$(JAVA_LIBSTUB_FILES)
echo +++ make: Generating stubs$(MOZ_BITS).c...
$(JAVAH) -o stubs$(MOZ_BITS).c -stubs $**
!endif # JAVA_OR_OJI
!endif
!ifdef JRI_GEN
!ifdef JAVA_OR_OJI
#//------------------------------------------------------------------------
#//
#// Rule to generate JRI header files using javah.
#//
#//------------------------------------------------------------------------
$(JRI_GEN):: display_jri_header_msg
!$(JAVAH) -jri -d _jri $@
!ifdef NSBUILDROOT
LINCS = $(LINCS) -I$(JRI_GEN_DIR) -I$(XPDIST)
!else
LINCS = $(LINCS) -I$(JRI_GEN_DIR)
!endif
display_jri_header_msg:
echo +++ make: Generating JRI header files...
!ifdef MOZ_GENMAC
$(JRI_GEN)::display_jri_header_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JRI header for $@
!$(JAVAH) -mac -jri -d $(MAC_JAVA_HEADERS_DIR)/_jri $@
display_jri_header_msg_mac:
echo +++ make: Generating Macintosh java JRI header files +++
!endif
!endif # JAVA_OR_OJI
!endif
!ifdef JRI_GEN
!ifdef JAVA_OR_OJI
#//------------------------------------------------------------------------
#//
#// Rules to generate JRI stub files using javah.
#//
#//------------------------------------------------------------------------
$(JRI_GEN)::display_jri_stub_msg
!$(JAVAH) -stubs -jri -d _jri $@
display_jri_stub_msg:
echo +++ make: Generating JRI stub files...
!ifdef MOZ_GENMAC
$(JRI_GEN)::display_jri_stub_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JRI stub for $@
!$(JAVAH) -mac -jri -stubs -d $(MAC_JAVA_HEADERS_DIR)/_jri $@
display_jri_stub_msg_mac:
echo +++ make: Generating Macintosh java JRI stub files +++
!endif
export:: $(JRI_GEN)
!endif # JAVA_OR_OJI
!endif
!ifdef JNI_GEN
!ifdef JAVA_OR_OJI
#//------------------------------------------------------------------------
#//
#// Rule to generate JNI header files using javah.
#//
#//------------------------------------------------------------------------
$(JNI_GEN):: display_jni_header_msg
!echo $(JAVAH) -jni -d _jni $@
!$(JAVAH) -jni -d _jni $@
!ifdef NSBUILDROOT
LINCS = $(LINCS) -I$(JNI_GEN_DIR) -I$(XPDIST)
!else
LINCS = $(LINCS) -I$(JNI_GEN_DIR)
!endif
display_jni_header_msg:
echo +++ make: Generating JNI header files...
!ifdef MOZ_GENMAC
$(JNI_GEN)::display_jni_header_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JRI header for $@
!$(JAVAH) -mac -jni -d $(MAC_JAVA_HEADERS_DIR)/_jni $@
display_jni_header_msg_mac:
echo +++ make: Generating Macintosh java JNI header files +++
!endif
!endif # JAVA_OR_OJI
export:: $(JNI_GEN)
!endif # JNI_GEN
!endif # CONFIG_JAVA_INC

View File

@@ -0,0 +1,168 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# This file contains make rules for building java files using mozilla's
# make system. To use this file, you must include this file before
# including rules.mak. Like this:
# include <$(DEPTH)\config\javarules.mak>
# include <$(DEPTH)\config\rules.mak>
!ifdef JDIRS
!if defined(JAVA_OR_NSJVM)
#//------------------------------------------------------------------------
#//
#// Rule to recursively make all subdirectories specified by the JDIRS target
#//
#//------------------------------------------------------------------------
export:: $(JAVA_DESTPATH) $(JDIRS)
$(JDIRS):: $(JAVA_DESTPATH) $(TMPDIR)
!if "$(WINOS)" == "WIN95"
JDIRS = $(JDIRS:/=\)
!endif
!if defined(NO_CAFE)
$(JDIRS)::
@echo +++ make: building package: $@
@echo $(JAVAC_PROG) $(JAVAC_FLAGS) > $(TMPDIR)\javac.cfg
-@$(DEPTH)\config\buildpkg $(TMPDIR)\javac.cfg $@
@$(RM) $(TMPDIR)\javac.cfg
@$(DEPTH)\config\buildpkg $@ $(DEPTH)\dist\classes
!else
# compile using symantec cafe's super-speedy compiler!
$(JDIRS)::
@echo +++ make: building package $@
!if "$(WINOS)" == "WIN95"
-@$(MKDIR) $(DEPTH)\dist\classes\$(@:/=\)
!else
-@$(MKDIR) $(DEPTH)\dist\classes\$@ 2> NUL
!endif
$(MOZ_TOOLS)\bin\sj -classpath $(JAVA_DESTPATH);$(JAVA_SOURCEPATH) \
-d $(JAVA_DESTPATH) $(JAVAC_OPTIMIZER) $@\*.java
!endif # NO_CAFE
clobber clobber_all::
-for %g in ($(JDIRS)) do $(RM_R) $(XPDIST:/=\)/classes/%g
!endif # JAVA_OR_NSJVM
!endif # JDIRS
#//------------------------------------------------------------------------
#//
#// JMC
#//
#// JSRCS .java files to be compiled (.java extension included)
#//
#//------------------------------------------------------------------------
!if defined(JAVA_OR_NSJVM)
!if defined(JSRCS)
JSRCS_DEPS = $(JAVA_DESTPATH) $(JAVA_DESTPATH)\$(PACKAGE) $(TMPDIR)
# Can't get moz cafe to compile a single file
!if defined(NO_CAFE)
export:: $(JSRCS_DEPS)
@echo +++ make: building package: $(PACKAGE)
$(PERL) $(DEPTH)\config\outofdate.pl \
-d $(JAVA_DESTPATH)\$(PACKAGE) $(JSRCS) >> $(TMPDIR)\javac.cfg
-$(JAVAC_PROG) -argfile $(TMPDIR)\javac.cfg
@echo $(TMPDIR)
# @$(RM) $(TMPDIR)\javac.cfg
!else
# compile using symantec cafe's super-speedy compiler!
export:: $(JSRC_DEPS)
@echo +++ make: building package: $(PACKAGE)
@echo -d $(JAVA_DESTPATH) $(JAVAC_OPTIMIZER) \
-classpath $(JAVA_DESTPATH);$(JAVA_SOURCEPATH) > $(TMPDIR)\javac.cfg
@$(PERL) $(DEPTH)\config\sj.pl \
$(JAVA_DESTPATH)\$(PACKAGE)\ $(TMPDIR)\javac.cfg <<
$(JSRCS)
<<
!endif #NO_CAFE
clobber::
-for %g in ($(JSRCS:.java=.class)) do $(RM) $(XPDIST:/=\)/classes/$(PACKAGE:/=\)/%g
!endif # JSRCS
#//------------------------------------------------------------------------
#//
#// JMC
#//
#// JMC_EXPORT .class files to be copied from XPDIST/classes/PACKAGE to
#// XPDIST/jmc (without the .class extension)
#//
#//------------------------------------------------------------------------
!if defined(JMC_EXPORT)
export:: $(JMCSRCDIR)
for %g in ($(JMC_EXPORT)) do $(MAKE_INSTALL:/=\) $(JAVA_DESTPATH)\$(PACKAGE:/=\)\%g.class $(JMCSRCDIR)
clobber::
-for %f in ($(JMC_EXPORT)) do $(RM) $(JMCSRCDIR:/=\)\%f.class
!endif # JMC_EXPORT
!endif # JAVA_OR_NSJVM
#//------------------------------------------------------------------------
#//
#// JMC
#//
#// JMC_GEN Names of classes to be run through JMC
#// Generated .h and .c files go to JMC_GEN_DIR
#//
#//------------------------------------------------------------------------
!if defined(JAVA_OR_NSJVM)
!if defined(JMC_GEN)
export:: $(JMC_HEADERS)
# Don't delete them if they don't compile (makes it hard to debug)
.PRECIOUS: $(JMC_HEADERS) $(JMC_STUBS)
# They may want to generate/compile the stubs
!if defined(CCJMC)
{$(JMC_GEN_DIR)\}.c{$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-c $(CFLAGS)
-I. -I$(JMC_GEN_DIR)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(JMC_GEN_DIR)\$(*B).c
<<KEEP
export:: $(JMC_STUBS) $(OBJDIR) $(JMC_OBJS)
!endif # CCJMC
!endif # JMC_GEN
!endif # JAVA_OR_NSJVM

71
mozilla/config/lib.inc Normal file
View File

@@ -0,0 +1,71 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build 16 and 32 bit
#// libraries.
#//
#//------------------------------------------------------------------------
!if defined(LIBRARY) && !defined(CONFIG_LIB_INC)
CONFIG_LIB_INC=1
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#//
#// Rule to build a 16-bit Library
#//
#//------------------------------------------------------------------------
$(LIBRARY):: $(OBJDIR) $(OBJS) makefile.win $(DEPTH)\config\lib.inc
# //
# // create response file for the command. The format is:
# // LIBNAME, -+foo.obj -+bar.obj , LISTFILE, NEWLIB
# //
rm -f $(CFGFILE)
!if "$(OS)" == "Windows_NT"
for %%d in ($(OBJS)) do echo -+%%d ^& >> $(CFGFILE)
!else
for %%d in ($(OBJS)) do echo -+%%d & >> $(CFGFILE)
!endif
echo * >> $(CFGFILE)
# //
# // execute the commands
# //
$(RM) $@
$(AR) $@ @$(CFGFILE)
$(RANLIB) $@
!else
#//------------------------------------------------------------------------
#//
#// Rule to build a 32-bit Library
#//
#//------------------------------------------------------------------------
$(LIBRARY):: $(OBJDIR) $(OBJS) makefile.win $(DEPTH)\config\lib.inc
$(RM) $@ 2> NUL
$(AR) @<<$(CFGFILE)
-NOLOGO -OUT:$@
$(OBJS)
<<
$(RANLIB) $@
!endif
!endif # LIBRARY && ! CONFIG_LIB_INC

View File

@@ -0,0 +1,170 @@
#!/usr/local/bin/perl5 -w
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla Communicator client code.
#
# 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):
#
# set-timebomb.pl --- set the timebomb to N days from today's date.
#
# Modified: Chris Yeh <cyeh@netscape.com>, 31-Aug-98
# Created: Jamie Zawinski <jwz@mozilla.org>, 24-Aug-98.
my $progname = $0;
my $contents;
# This is the preferences file that gets read and written.
# So run this script with src/mozilla/build/ as the current directory.
#
my $prefs = ":mozilla:modules:libpref:src:init:all.js";
# from noah, who should be shot
sub ctime {
local (@weekday, @month, $time, $TZ);
local ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
@weekday = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
@month = ("Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
$time = (length (@_) > 0)? $_[0] : time() ;
$TZ = defined($ENV{'TZ'}) ? ( $ENV{'TZ'} ? $ENV{'TZ'} : 'UTC' ) : '';
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
($TZ eq 'UTC') ? gmtime($time) : localtime($time);
if ($TZ =~ /^([^:\d+\-,]{3,})([+-]?\d{1,2}(:\d{1,2}){0,2})([^\d+\-,]{3,})?/o)
{
$TZ = $isdst ? $4 : $1;
}
if ($TZ ne "") { $TZ .= " "; }
$year += ($year < 70) ? 2000 : 1900;
return sprintf ("%s %s %02d %02d:%02d:%02d %s%4d",
$weekday[$wday], $month[$mon], $mday, $hour, $min, $sec,
$TZ, $year);
}
sub read_file {
$contents = "";
open(IN, "<$prefs");
while (<IN>) {
$contents .= $_;
}
close(IN);
}
sub write_file {
open(OUT, ">$prefs");
print OUT $contents;
close(OUT);
# print STDERR "$progname: wrote $prefs\n";
}
sub get_pref {
my ($lvalue) = @_;
$_ = $contents;
die ("$lvalue unset?\n") unless m@^config\("$lvalue","(.*)"\);@m;
return $1;
}
sub set_pref {
my ($lvalue,$rvalue) = @_;
$_ = $contents;
# die("$lvalue unset?\n") unless (m@^(pref|config)\("$lvalue",@m);
die("$lvalue unset?\n")
unless s@^(pref|config)(\("$lvalue",)(.*)(\).*)$@$1$2$rvalue$4@m;
$contents = $_;
}
# no longer used?
sub set_indirected_bomb {
my ($bomb) = @_;
my ($secret) = get_pref("timebomb.relative_timebomb_secret_name");
set_pref($secret, $bomb);
}
sub time_diff {
use Time::Local;
my($time, $result) = @_;
my $diff = 2082830400 - (timegm(localtime) - time);
return $result =~ /mac/ ?
$time + $diff : $time - $diff;
}
sub set_bomb {
my ($warning_days, $bomb_days) = @_;
# die("warning_days ($warning_days) must be greater than 0.")
# unless ($warning_days > 0);
die("bomb_days ($bomb_days) must be greater than 0.")
unless ($bomb_days > 0);
die("warning_days ($warning_days) must be less than " .
"bomb_days ($bomb_days)\n")
unless ($warning_days < $bomb_days);
my $mactime = time;
# MacPerl stores date and times from 1904 instead of 1970
# Conversion routine thanks to Chris Nandor (pudge@pobox.com)
$now = time_diff($mactime, 'unix');
my $bomb = $now + ($bomb_days * 24 * 60 * 60);
my $warn = $now + ($warning_days * 24 * 60 * 60);
set_pref("timebomb.expiration_time", $bomb);
set_pref("timebomb.warning_time", $warn);
set_pref("timebomb.relative_timebomb_days", -1);
set_pref("timebomb.relative_timebomb_warning_days", -1);
set_indirected_bomb(0);
# print STDERR sprintf("%s: timebomb goes off in %2d days (%s)\n",
# $progname, $bomb_days, ctime($bomb));
# print STDERR sprintf("%s: warning goes off in %2d days (%s)\n",
# $progname, $warning_days, ctime($warn));
}
sub main {
my ($warning_days, $bomb_days) = @_;
die ("usage: $progname [ days-until-warning [ days-until-timebomb ]]\n")
if ($#_ >= 2);
if ($#_ == 0) {
$bomb_days = $warning_days;
$warning_days = -1;
}
if (!$bomb_days || $bomb_days <= 0) {
$bomb_days = 30;
}
if ($warning_days < 0) {
$warning_days = $bomb_days - int($bomb_days / 3);
if ($warning_days < $bomb_days - 10) {
$warning_days = $bomb_days - 10;
}
}
read_file();
set_bomb($warning_days, $bomb_days);
write_file();
return 0;
}
exit(&main(@ARGV));

259
mozilla/config/make-jars.pl Normal file
View File

@@ -0,0 +1,259 @@
#!/perl
# make-jars [-f] [-v] [-l] [-d <chromeDir>] [-s <srcdir>] < <jar.mn>
use strict;
use Getopt::Std;
use Cwd;
use File::stat;
use Time::localtime;
use Cwd;
use File::Copy;
use File::Path;
use Fcntl qw(:DEFAULT :flock);
use IO::File;
my $objdir = getcwd;
getopts("d:s:vfl");
my $baseFilesDir = ".";
if (defined($::opt_s)) {
$baseFilesDir = $::opt_s;
}
my $chromeDir = ".";
if (defined($::opt_d)) {
$chromeDir = $::opt_d;
}
my $verbose = 0;
if (defined($::opt_v)) {
$verbose = 1;
}
my $flatfilesonly = 0;
if (defined($::opt_f)) {
$flatfilesonly = 1;
}
my $nofilelocks = 0;
if (defined($::opt_l)) {
$nofilelocks = 1;
}
if ($verbose) {
print "make-jars "
. "-v -d $chromeDir "
. ($flatfilesonly ? "-f " : "")
. ($nofilelocks ? "-l " : "")
. ($baseFilesDir ? "-s $baseFilesDir " : "")
. "\n";
}
sub zipErrorCheck($$$)
{
my ($err,$lockfile,$lockhandle) = @_;
return if ($err == 0 || $err == 12);
if (!$nofilelocks) {
unlink($lockfile);
flock($lockhandle, LOCK_UN);
}
die ("Error invoking zip: $err");
}
sub JarIt
{
my ($destPath, $jarfile, $args, $overrides) = @_;
if ($flatfilesonly) {
return 0;
}
my $oldDir = cwd();
chdir("$destPath/$jarfile");
#print "cd $destPath/$jarfile\n";
my $lockfile = "../$jarfile.lck";
my $lockhandle = new IO::File;
if (!$nofilelocks) {
open($lockhandle,">$lockfile") ||
die("WARNING: Could not create lockfile for $lockfile. Exiting.\n");
flock($lockhandle, LOCK_EX);
}
if (!($args eq "")) {
my $cwd = getcwd;
my $err = 0;
#print "zip -u ../$jarfile.jar $args\n";
# Handle posix cmdline limits (4096)
while (length($args) > 4000) {
#print "Exceeding POSIX cmdline limit: " . length($args) . "\n";
my $subargs = substr($args, 0, 3999);
my $pos = rindex($subargs, " ");
$subargs = substr($args, 0, $pos);
$args = substr($args, $pos);
#print "zip -u ../$jarfile.jar $subargs\n";
#print "Length of subargs: " . length($subargs) . "\n";
system("zip -u ../$jarfile.jar $subargs") == 0 or
$err = $? >> 8;
zipErrorCheck($err,$lockfile,$lockhandle);
}
#print "Length of args: " . length($args) . "\n";
#print "zip -u ../$jarfile.jar $args\n";
system("zip -u ../$jarfile.jar $args") == 0 or
$err = $? >> 8;
zipErrorCheck($err,$lockfile,$lockhandle);
}
if (!($overrides eq "")) {
my $err = 0;
print "+++ overriding $overrides\n";
while (length($args) > 4000) {
#print "Exceeding POSIX cmdline limit: " . length($args) . "\n";
my $subargs = substr($args, 0, 3999);
my $pos = rindex($subargs, " ");
$subargs = substr($args, 0, $pos);
$args = substr($args, $pos);
#print "zip ../$jarfile.jar $subargs\n";
#print "Length of subargs: " . length($subargs) . "\n";
system("zip ../$jarfile.jar $subargs") == 0 or
$err = $? >> 8;
zipErrorCheck($err,$lockfile,$lockhandle);
}
#print "zip ../$jarfile.jar $overrides\n";
system("zip ../$jarfile.jar $overrides\n") == 0 or
$err = $? >> 8;
zipErrorCheck($err,$lockfile,$lockhandle);
}
if (!$nofilelocks) {
unlink("$lockfile");
flock($lockhandle, LOCK_UN);
}
chdir($oldDir);
#print "cd $oldDir\n";
}
sub EnsureFileInDir
{
my ($destPath, $srcPath, $destFile, $srcFile, $override) = @_;
#print "EnsureFileInDir($destPath, $srcPath, $destFile, $srcFile, $override)\n";
my $src = $srcFile;
if (defined($src)) {
if (! -e $src ) {
$src = "$srcPath/$srcFile";
}
}
else {
$src = "$srcPath/$destFile";
# check for the complete jar path in the dest dir
if (!-e $src) {
#else check for just the file name in the dest dir
my $dir = "";
my $file;
if ($destFile =~ /([\w\d.\-\_\\\/]+)[\\\/]([\w\d.\-\_]+)/) {
$dir = $1;
$file = $2;
}
else {
die "file not found: $srcPath/$destFile";
}
$src = "$srcPath/$file";
if (!-e $src) {
die "file not found: $srcPath/$destFile";
}
}
}
$srcPath = $src;
$destPath = "$destPath/$destFile";
my $srcStat = stat($srcPath);
my $srcMtime = $srcStat ? $srcStat->mtime : 0;
my $destStat = stat($destPath);
my $destMtime = $destStat ? $destStat->mtime : 0;
#print "destMtime = $destMtime, srcMtime = $srcMtime\n";
if (!-e $destPath || $destMtime < $srcMtime || $override) {
#print "copying $destPath, from $srcPath\n";
my $dir = "";
my $file;
if ($destPath =~ /([\w\d.\-\_\\\/]+)[\\\/]([\w\d.\-\_]+)/) {
$dir = $1;
$file = $2;
}
else {
$file = $destPath;
}
if ($srcPath) {
$file = $srcPath;
}
if (!-e $file) {
die "error: file '$file' doesn't exist";
}
if (!-e $dir) {
mkpath($dir, 0, 0775) || die "can't mkpath $dir: $!";
}
unlink $destPath; # in case we had a symlink on unix
copy($file, $destPath) || die "copy($file, $destPath) failed: $!";
# fix the mod date so we don't jar everything (is this faster than just jarring everything?)
my $atime = stat($file)->atime || die $!;
my $mtime = stat($file)->mtime || die $!;
utime($atime, $mtime, $destPath);
return 1;
}
return 0;
}
while (<STDIN>) {
chomp;
start:
if (/^([\w\d.\-\_\\\/]+).jar\:\s*$/) {
my $jarfile = $1;
my $args = "";
my $overrides = "";
my $cwd = cwd();
print "+++ making chrome $cwd => $chromeDir/$jarfile.jar\n";
while (<STDIN>) {
if (/^\s+([\w\d.\-\_\\\/]+)\s*(\([\w\d.\-\_\\\/]+\))?$\s*/) {
my $dest = $1;
my $srcPath = defined($2) ? substr($2, 1, -1) : $2;
EnsureFileInDir("$chromeDir/$jarfile", $baseFilesDir, $dest, $srcPath, 0);
$args = "$args$dest ";
} elsif (/^\+\s+([\w\d.\-\_\\\/]+)\s*(\([\w\d.\-\_\\\/]+\))?$\s*/) {
my $dest = $1;
my $srcPath = defined($2) ? substr($2, 1, -1) : $2;
EnsureFileInDir("$chromeDir/$jarfile", $baseFilesDir, $dest, $srcPath, 1);
$overrides = "$overrides$dest ";
} elsif (/^\s*$/) {
# end with blank line
last;
} else {
JarIt($chromeDir, $jarfile, $args, $overrides);
goto start;
}
}
JarIt($chromeDir, $jarfile, $args, $overrides);
} elsif (/^\s*\#.*$/) {
# skip comments
} elsif (/^\s*$/) {
# skip blank lines
} else {
close;
die "bad jar rule head at: $_";
}
}

593
mozilla/config/makecopy.cpp Normal file
View File

@@ -0,0 +1,593 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Modified by David.Gardiner@unisa.edu.au
* added -i option, which prepends a #line with the absolute path of the file. Useful
* for debugging Mozilla on Windows.
* added hard symbolic link instead of copy for NTFS partitions
* added multi-copy, so a number of files can be copied to the same destination at once.
*
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <direct.h>
#include <sys/stat.h>
#include <sys/utime.h>
#include <io.h>
#include <fcntl.h>
/*
Unicode calls are linked at run-time, so that the application can run under
Windows NT and 95 (which doesn't support the Unicode calls)
The following APIs are linked:
BackupWrite
CreateFileW
GetFullPathNameW
*/
//static const char *prog;
BOOL insertHashLine = FALSE;
BOOL trySymlink = FALSE;
BOOL recurse = FALSE;
typedef WINBASEAPI BOOL (WINAPI* LPFNBackupWrite)(HANDLE, LPBYTE, DWORD, LPDWORD, BOOL, BOOL, LPVOID *);
typedef WINBASEAPI HANDLE (WINAPI* LPFNCreateFileW)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
typedef WINBASEAPI DWORD (WINAPI* LPFNGetFullPathNameW)(LPCWSTR, DWORD, LPWSTR, LPWSTR *);
// Function pointers (used for NTFS hard links)
LPFNBackupWrite lpfnDllBackupWrite = NULL;
LPFNCreateFileW lpfnDllCreateFileW = NULL;
LPFNGetFullPathNameW lpfnDllGetFullPathNameW = NULL;
// Handle to DLL
HINSTANCE hDLL = NULL;
/*
** Flip any "unix style slashes" into "dos style backslashes"
*/
inline void FlipSlashes(char *name)
{
for( int i=0; name[i]; i++ ) {
if( name[i] == '/' ) name[i] = '\\';
}
}
/*
* Flip any "dos style backslashes" into "unix style slashes"
*/
inline void UnflipSlashes(char *name)
{
for( int i=0; name[i]; i++ ) {
if( name[i] == '\\' ) name[i] = '/';
}
}
int MakeDir( char *path )
{
char *cp, *pstr;
struct stat sb;
pstr = path;
while( cp = strchr(pstr, '\\') ) {
*cp = '\0';
if( !(stat(path, &sb) == 0 && (sb.st_mode & _S_IFDIR) )) {
/* create the new sub-directory */
printf("+++ makecopy: creating directory %s\n", path);
if( mkdir(path) < 0 ) {
return -1;
}
} /* else sub-directory already exists.... */
*cp = '\\';
pstr = cp+1;
}
return 0;
}
/*
* Display error code and message for last error
*/
int ReportError()
{
LPVOID lpMsgBuf = NULL;
DWORD err = GetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL,
err,
0,
(LPTSTR) &lpMsgBuf,
0,
NULL);
fprintf(stderr, "%u, %s\n", err, (LPCTSTR) lpMsgBuf ) ;
LocalFree( lpMsgBuf );
return -1;
}
int ReportError(const char* msg)
{
fprintf(stderr, "%Error: s\n", msg);
return ReportError();
}
/*
Creates an NTFS hard link of src at dest.
NT5 will have a CreateHardLink API which will do the same thing, but a lot simpler
This is based on the MSDN code sample Q153181
*/
BOOL hardSymLink(LPCSTR src, LPCSTR dest)
{
WCHAR FileLink[ MAX_PATH + 1 ];
WCHAR FileSource[ MAX_PATH + 1 ];
WCHAR FileDest[ MAX_PATH + 1 ];
LPWSTR FilePart;
WIN32_STREAM_ID StreamId;
DWORD dwBytesWritten;
DWORD cbPathLen;
BOOL bSuccess;
// Convert src and dest to Unicode
if (!MultiByteToWideChar(CP_ACP, 0, src, -1, FileSource, MAX_PATH)) {
ReportError("Convert to WCHAR (source)");
return FALSE;
}
if (!MultiByteToWideChar(CP_ACP, 0, dest, -1, FileDest, MAX_PATH)) {
ReportError("Convert to WCHAR (destination)");
return FALSE;
}
//
// open existing file that we link to
//
HANDLE hFileSource = lpfnDllCreateFileW(
FileSource,
FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, // sa
OPEN_EXISTING,
0,
NULL
);
if(hFileSource == INVALID_HANDLE_VALUE) {
ReportError("CreateFile (source)");
return FALSE;
}
//
// validate and sanitize supplied link path and use the result
// the full path MUST be Unicode for BackupWrite
//
cbPathLen = lpfnDllGetFullPathNameW( FileDest, MAX_PATH, FileLink, &FilePart);
if(cbPathLen == 0) {
ReportError("GetFullPathName");
return FALSE;
}
cbPathLen = (cbPathLen + 1) * sizeof(WCHAR); // adjust for byte count
//
// it might also be a good idea to verify the existence of the link,
// (and possibly bail), as the file specified in FileLink will be
// overwritten if it already exists
//
//
// prepare and write the WIN32_STREAM_ID out
//
LPVOID lpContext = NULL;
StreamId.dwStreamId = BACKUP_LINK;
StreamId.dwStreamAttributes = 0;
StreamId.dwStreamNameSize = 0;
StreamId.Size.HighPart = 0;
StreamId.Size.LowPart = cbPathLen;
//
// compute length of variable size WIN32_STREAM_ID
//
DWORD StreamHeaderSize = (LPBYTE)&StreamId.cStreamName - (LPBYTE)&
StreamId+ StreamId.dwStreamNameSize ;
bSuccess = lpfnDllBackupWrite(
hFileSource,
(LPBYTE)&StreamId, // buffer to write
StreamHeaderSize, // number of bytes to write
&dwBytesWritten,
FALSE, // don't abort yet
FALSE, // don't process security
&lpContext
);
if(bSuccess) {
//
// write out the buffer containing the path
//
bSuccess = lpfnDllBackupWrite(
hFileSource,
(LPBYTE)FileLink, // buffer to write
cbPathLen, // number of bytes to write
&dwBytesWritten,
FALSE, // don't abort yet
FALSE, // don't process security
&lpContext
);
//
// free context
//
lpfnDllBackupWrite(
hFileSource,
NULL, // buffer to write
0, // number of bytes to write
&dwBytesWritten,
TRUE, // abort
FALSE, // don't process security
&lpContext
);
}
CloseHandle( hFileSource );
if(!bSuccess) {
ReportError("BackupWrite");
return FALSE;
}
return TRUE;
}
int CopyIfNecessary(char *oldFile, char *newFile)
{
struct stat newsb;
struct stat oldsb;
// Use stat to find file details
if (stat(oldFile, &oldsb)) {
return -1;
}
// skip directories unless recursion flag is set
if ( oldsb.st_mode & _S_IFDIR ) {
if (!recurse) {
printf(" Skipping directory %s\n", oldFile);
return 0;
}
else {
char *lastDir;
char *oldFileName; // points to where file name starts in oldFile
char *newFileName; // points to where file name starts in newFile
WIN32_FIND_DATA findFileData;
// weed out special "." and ".." directories
lastDir = strrchr(oldFile, '\\');
if ( lastDir )
++lastDir;
else
lastDir = oldFile;
if ( strcmp( lastDir, "." ) == 0 || strcmp( lastDir, ".." ) == 0 )
return 0;
// find and process the contents of the directory
oldFileName = oldFile + strlen(oldFile);
strcpy(oldFileName, "\\*");
++oldFileName;
newFileName = newFile + strlen(newFile);
strcpy(newFileName, "\\");
++newFileName;
if( MakeDir(newFile) < 0 ) {
fprintf(stderr, "\n+++ makecopy: unable to create directory %s\n", newFile);
return 1;
}
HANDLE hFindFile = FindFirstFile(oldFile, &findFileData);
if (hFindFile != INVALID_HANDLE_VALUE) {
do {
strcpy(oldFileName, findFileData.cFileName);
strcpy(newFileName, findFileData.cFileName);
CopyIfNecessary(oldFile, newFile);
} while (FindNextFile(hFindFile, &findFileData) != 0);
} else {
fprintf(stderr, "\n+++ makecopy: no such file: %s\n", oldFile);
}
FindClose(hFindFile);
}
// nothing more we can do with a directory
return 0;
}
if (!stat(newFile, &newsb)) {
// If file times are equal, don't copy
if (newsb.st_mtime == oldsb.st_mtime) {
#if 0
printf("+++ makecopy: %s is up to date\n", newFile);
#endif
return 0;
}
}
char fullPathName[ MAX_PATH + 1 ];
LPTSTR filenamePart = NULL;
char buffer[8192];
DWORD bytesRead = 0;
DWORD bytesWritten = 0;
// find out required size
GetFullPathName(oldFile, MAX_PATH, fullPathName, &filenamePart);
// If we need to insert #line, the copying is a bit involved.
if (insertHashLine == TRUE) {
struct _utimbuf utim;
printf(" #Installing %s into %s\n", oldFile, newFile);
utim.actime = oldsb.st_atime;
utim.modtime = oldsb.st_mtime; // modification time
HANDLE hNewFile = CreateFile(newFile, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
NULL);
if (hNewFile == INVALID_HANDLE_VALUE) {
return ReportError("CreateFile");
}
HANDLE hOldFile = CreateFile(oldFile, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
if (hOldFile == INVALID_HANDLE_VALUE) {
return ReportError("CreateFile");
}
// Insert first line.
sprintf(buffer, "#line 1 \"%s\"\r\n", fullPathName);
// convert to unix.
UnflipSlashes(buffer);
WriteFile(hNewFile, buffer, strlen(buffer), &bytesWritten, NULL);
// Copy file.
do {
if (!ReadFile(hOldFile, buffer, sizeof(buffer), &bytesRead, NULL)) {
return ReportError("ReadFile");
}
if (!WriteFile(hNewFile, buffer, bytesRead, &bytesWritten, NULL)) {
return ReportError("WriteFile");
}
} while (bytesRead > 0);
CloseHandle(hNewFile);
CloseHandle(hOldFile);
// make copy have same time
_utime(newFile, &utim);
// If we don't need to do a #line, use an API to copy the file..
} else {
BOOL isNTFS = FALSE;
// Find out what kind of volume this is.
if ( trySymlink ) {
char rootPathName[MAX_PATH];
char *c = strchr(fullPathName, '\\');
if (c != NULL) {
TCHAR fileSystemName[50];
strncpy(rootPathName, fullPathName, (c - fullPathName) + 1);
if (!GetVolumeInformation(rootPathName, NULL, 0, NULL, NULL, NULL, fileSystemName, sizeof(rootPathName))) {
return ReportError("GetVolumeInformation");
}
isNTFS = (strcmp(fileSystemName, "NTFS") == 0);
}
}
if (isNTFS) {
printf(" Symlinking %s into %s\n", oldFile, newFile);
if (! hardSymLink(oldFile, newFile) ) {
return 1;
}
} else {
printf(" Installing %s into %s\n", oldFile, newFile);
if( ! CopyFile(oldFile, newFile, FALSE) ) {
ReportError("CopyFile");
return 1;
}
}
}
return 0;
}
void Usage(void)
{
fprintf(stderr, "makecopy: [-cisx] <file1> [file2 ... fileN] <dir-path>\n");
fprintf(stderr, " -c copy [default], cancels -s\n");
fprintf(stderr, " -i add #line directive\n");
fprintf(stderr, " -r recurse subdirectories\n");
fprintf(stderr, " -s use symlinks on NT when possible\n");
fprintf(stderr, " -x cancel -i\n");
}
int main( int argc, char *argv[] )
{
char old_path[4096];
char new_path[4096];
char *oldFileName; // points to where file name starts in old_path
char *newFileName; // points to where file name starts in new_path
WIN32_FIND_DATA findFileData;
int rv = 0;
int i = 1;
if (argc < 3) {
Usage();
return 2;
}
// parse option flags
for ( ; *argv[i] == '-' ; ++i) {
char *opt = argv[i]+1;
for ( ; *opt; ++opt) {
switch (*opt) {
case 'c':
trySymlink = FALSE;
break;
case 'i':
insertHashLine = TRUE;
break;
case 'r':
recurse = TRUE;
break;
case 's':
trySymlink = TRUE;
break;
case 'x':
insertHashLine = FALSE;
break;
default:
Usage();
return 2;
}
}
}
if ( trySymlink ) {
OSVERSIONINFO osvi;
// Symlinking supported only on WinNT, not Win9x
// Is this Windows NT?
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx(&osvi)) {
return ReportError();
}
trySymlink = (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT);
if ( trySymlink ) {
hDLL = LoadLibrary("Kernel32");
if (hDLL != NULL)
{
lpfnDllBackupWrite = (LPFNBackupWrite)GetProcAddress(hDLL, "BackupWrite");
lpfnDllCreateFileW = (LPFNCreateFileW)GetProcAddress(hDLL, "CreateFileW");
lpfnDllGetFullPathNameW = (LPFNGetFullPathNameW) GetProcAddress(hDLL, "GetFullPathNameW");
if ((!lpfnDllBackupWrite) || (!lpfnDllCreateFileW) || (!lpfnDllGetFullPathNameW))
{
// handle the error
int r = ReportError("GetProcAddress");
FreeLibrary(hDLL);
return r;
}
} else {
return ReportError();
}
}
}
// destination path is last argument
strcpy(new_path, argv[argc-1]);
// append backslash to path if not already there
if (new_path[strlen(new_path)] != '\\') {
strcat(new_path, "\\");
}
//sprintf(new_path, "%s\\", argv[i+1]);
FlipSlashes(new_path);
newFileName = new_path + strlen(new_path);
if( MakeDir(new_path) < 0 ) {
fprintf(stderr, "\n+++ makecopy: unable to create directory %s\n", new_path);
return 1;
}
// copy all named source files
while (i < (argc - 1)) {
strcpy(old_path, argv[i]);
FlipSlashes(old_path);
oldFileName = strrchr(old_path, '\\');
if (oldFileName) {
oldFileName++;
} else {
oldFileName = old_path;
}
HANDLE hFindFile = FindFirstFile(old_path, &findFileData);
if (hFindFile != INVALID_HANDLE_VALUE) {
do {
strcpy(oldFileName, findFileData.cFileName);
strcpy(newFileName, findFileData.cFileName);
rv = CopyIfNecessary(old_path, new_path);
} while (FindNextFile(hFindFile, &findFileData) != 0);
} else {
fprintf(stderr, "\n+++ makecopy: no such file: %s\n", old_path);
}
FindClose(hFindFile);
i++;
}
if ( trySymlink ) {
FreeLibrary(hDLL);
}
return 0;
}

BIN
mozilla/config/makecopy.exe Executable file

Binary file not shown.

871
mozilla/config/makedep.cpp Normal file
View File

@@ -0,0 +1,871 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
// Dependency building hack
//
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <ctype.h>
#include <afxcoll.h>
#include <afxtempl.h>
int mainReturn = 0;
BOOL b16 = FALSE;
BOOL bSimple = FALSE;
// freopen won't work on stdout in win16
FILE *pAltFile = stdout;
CStringArray includeDirectories;
// turn a file, relative path or other into an absolute path
// This function copied from MFC 1.52
BOOL PASCAL _AfxFullPath(LPSTR lpszPathOut, LPCSTR lpszFileIn)
// lpszPathOut = buffer of _MAX_PATH
// lpszFileIn = file, relative path or absolute path
// (both in ANSI character set)
{
OFSTRUCT of;
if (OpenFile(lpszFileIn, &of, OF_PARSE) != HFILE_ERROR)
{
// of.szPathName is in the OEM character set
OemToAnsi(of.szPathName, lpszPathOut);
AnsiUpper(lpszPathOut); // paths in upper case just to be sure
return TRUE;
}
else
{
TRACE1("Warning: could not parse the path %Fs\n", lpszFileIn);
lstrcpy(lpszPathOut, lpszFileIn); // take it literally
AnsiUpper(lpszPathOut); // paths in upper case just to be sure
return FALSE;
}
}
void AddIncludeDirectory( char *pString ){
CString s = pString;
int len = s.GetLength();
if(len > 0 && s[len - 1] != '\\' ){
s += "\\";
}
includeDirectories.Add(s);
}
BOOL FileExists( const char *pString ){
struct _stat buf;
int result;
result = _stat( pString, &buf );
return (result == 0);
}
void FixPathName(CString& str) {
str.MakeUpper(); // all upper case
// now switch all forward slashes to back slashes
int index;
while ((index = str.Find('/')) != -1) {
str.SetAt(index, '\\');
}
}
void FATName(CString& csLONGName)
{
// Only relevant for 16 bits.
if(b16) {
// Convert filename to FAT (8.3) equivalent.
char aBuffer[2048];
if(GetShortPathName(csLONGName, aBuffer, 2048)) {
csLONGName = aBuffer;
}
}
}
class CFileRecord {
public:
CString m_shortName;
CString m_pathName;
CPtrArray m_includes; // pointers to CFileRecords in fileMap
BOOL m_bVisited;
BOOL m_bSystem;
BOOL m_bSource;
static CMapStringToPtr fileMap; // contains all allocated CFileRecords
static CStringArray orderedFileNames;
static CMapStringToPtr includeMap; // pointer to CFileRecords in fileMap
static CMapStringToPtr noDependMap;
CFileRecord( const char *shortName, const char* pFullName, BOOL bSystem, BOOL bSource):
m_shortName( shortName ),
m_pathName(),
m_includes(),
m_bVisited(FALSE),
m_bSource( bSource ),
m_bSystem(bSystem){
m_pathName = pFullName;
FixPathName(m_pathName); // all upper case for consistency
ASSERT(FindFileRecord(m_pathName) == NULL); // make sure it's not already in the map
fileMap[m_pathName] = this; // add this to the filemap, using the appropriate name as the key
if (bSource) {
orderedFileNames.Add(m_pathName); // remember the order we saw source files in
}
}
//
// open the file and grab all the includes.
//
void ProcessFile(){
FILE *f;
CString fullName;
BOOL bSystem;
DWORD lineCntr = 0;
char *a = new char[2048];
memset(a, 0, 2048);
char srcPath[_MAX_PATH];
// construct the full path
if (!_AfxFullPath(srcPath, m_pathName)) {
strcpy(srcPath, m_pathName);
}
// strip off the source filename to end up with just the path
LPSTR pTemp = strrchr(srcPath, '\\');
if (pTemp) {
*(pTemp + 1) = 0;
}
f = fopen(m_pathName, "r");
if(f != NULL && f != (FILE *)-1) {
setvbuf(f, NULL, _IOFBF, 32768); // use a large file buffer
while(fgets(a, 2047, f)) {
// if the string "//{{NO_DEPENDENCIES}}" is at the start of one of the
// first 10 lines of a file, don't build dependencies on it or any
// of the files it includes
if (lineCntr < 10) {
static char* pDependStr = "//{{NO_DEPENDENCIES}}";
if (strncmp(a, pDependStr, strlen(pDependStr)) == 0) {
noDependMap[m_pathName] = 0; // add it to the noDependMap
break; // no need for further processing of this file
}
}
++lineCntr;
// have to handle a variety of legal syntaxes that we find in our source files:
// #include
// # include
// #include
// if the first non-whitespace char is a '#', consider this line
pTemp = a;
pTemp += strspn(pTemp, " \t"); // skip whitespace
if (*pTemp == '#') {
++pTemp; // skip the '#'
pTemp += strspn(pTemp, " \t"); // skip more whitespace
if( !strncmp(pTemp, "include", 7) ){
pTemp += 7; // skip the "include"
pTemp += strspn(pTemp, " \t"); // skip more whitespace
bSystem = (*pTemp == '<'); // mark if it's a system include or not
// forget system files -- we just have to search all the paths
// every time and never find them! This change alone speeds a full
// depend run on my system from 5 minutes to 3:15
// if (bSystem || (*pTemp == '"')) {
if (*pTemp == '"') {
LPSTR pStart = pTemp + 1; // mark the start of the string
pTemp = pStart + strcspn(pStart, ">\" "); // find the end of the string
*pTemp = 0; // terminate the string
// construct the full pathname from the path part of the
// source file and the name listed here
fullName = srcPath;
fullName += pStart;
CFileRecord *pAddMe = AddFile( pStart, fullName, bSystem );
if (pAddMe) {
m_includes.Add(pAddMe);
}
}
}
}
}
fclose(f);
}
delete [] a;
}
void PrintIncludes(){
int i = 0;
while( i < m_includes.GetSize() ){
CFileRecord *pRec = (CFileRecord*) m_includes[i];
// Don't write out files that don't exist or are not in the namespace
// of the programs using it (netscape_AppletMozillaContext.h doesn't
// mix well with 16 bits).
// Also don't write out files that are in the noDependMap
void* lookupJunk;
if( !pRec->m_bVisited && pRec->m_pathName.GetLength() != 0 && !noDependMap.Lookup(pRec->m_pathName, lookupJunk)) {
// not supposed to have a file in the list that doesn't exist
ASSERT(FileExists(pRec->m_pathName));
CString csOutput;
csOutput = pRec->m_pathName;
FATName(csOutput);
fprintf(pAltFile, "\\\n %s ", (const char *) csOutput );
// mark this one as done so we don't do it more than once
pRec->m_bVisited = TRUE;
pRec->PrintIncludes();
}
i++;
}
}
void PrintDepend(){
CFileRecord *pRec;
BOOL bFound;
POSITION next;
CString name;
// clear all the m_bVisisted flags so we can use it to keep track
// of whether we've already output this file as a dependency
next = fileMap.GetStartPosition();
while( next ){
fileMap.GetNextAssoc( next, name, *(void**)&pRec );
pRec->m_bVisited = FALSE;
}
char fname[_MAX_FNAME];
if (pRec->m_pathName.GetLength() != 0) {
if( bSimple ){
fprintf(pAltFile, "\n\n\n%s:\t", m_pathName );
}
else {
CString csOutput;
csOutput = m_pathName;
FATName(csOutput);
_splitpath( csOutput, NULL, NULL, fname, NULL );
fprintf(pAltFile, "\n\n\n$(OUTDIR)\\%s.obj: %s ", fname, (const char*) csOutput );
}
m_bVisited = TRUE; // mark it as done so we won't do it again
PrintIncludes();
}
}
static CString NormalizeFileName( const char* pName ){
return CString(pName);
}
static CFileRecord* FindFileRecord( const char *pName ){
CFileRecord* pRec = NULL;
CString name(pName);
FixPathName(name);
fileMap.Lookup(name, (void*&)pRec);
return(pRec);
}
public:
static CFileRecord* AddFile( const char* pShortName, const char* pFullName, BOOL bSystem = FALSE,
BOOL bSource = FALSE ){
char fullName[_MAX_PATH];
BOOL bFound = FALSE;
CString foundName;
CString fixedShortName;
CString s;
// normalize the name
fixedShortName = pShortName;
FixPathName(fixedShortName);
pShortName = fixedShortName;
// if it is source, we might be getting an obj file. If we do,
// convert it to a c or c++ file.
if( bSource && (strcmp(GetExt(pShortName),".obj") == 0) ){
char path_buffer[_MAX_PATH];
char fname[_MAX_FNAME] = "";
CString s;
_splitpath( pShortName, NULL, NULL, fname, NULL );
if( FileExists( s = CString(fname) + ".cpp") ){
pShortName = s;
pFullName = s;
}
else if( FileExists( s = CString(fname) + ".c" ) ){
pShortName = s;
pFullName = s;
}
else {
return 0;
}
}
// if pFullName was not constructed, construct it here based on the current directory
if (!pFullName) {
_AfxFullPath(fullName, pShortName);
pFullName = fullName;
}
// first check to see if we already have this exact file
CFileRecord *pRec = FindFileRecord(pFullName);
// if not found and not a source file check the header list --
// all files we've found in include directories are in the includeMap.
// we can save gobs of time by getting it from there
if (!pRec && !bSource)
includeMap.Lookup(fixedShortName, (void*&)pRec);
if (!pRec) {
// not in one of our lists, start scrounging on disk
// check the fullname first
if (FileExists(pFullName)) {
foundName = pFullName;
bFound = TRUE;
}
else {
// if still not found, search the include paths
int i = 0;
while( i < includeDirectories.GetSize() ){
if( FileExists( includeDirectories[i] + pShortName ) ){
foundName = includeDirectories[i] + pShortName;
bFound = TRUE;
break;
}
i++;
}
}
}
else {
// we found it
bFound = TRUE;
}
// source files are not allowed to be missing
if (bSource && !pRec && !bFound) {
fprintf(stderr, "Source file: %s doesn't exist\n", pFullName);
mainReturn = -1; // exit with an error, don't write out the results
}
#ifdef _DEBUG
if (!pRec && !bFound && !bSystem) {
fprintf(stderr, "Header not found: %s (%s)\n", pShortName, pFullName);
}
#endif
// if none of the above logic found it already in the list,
// must be a new file, add it to the list
if (bFound && (pRec == NULL)) {
pRec = new CFileRecord( pShortName, foundName, bSystem, bSource);
// if this one isn't a source file add it to the includeMap
// for performance reasons (so we can find it there next time rather
// than having to search the file system again)
if (!bSource) {
includeMap[pShortName] = pRec;
}
}
return pRec;
}
static void PrintDependancies(){
CFileRecord *pRec;
BOOL bFound;
POSITION next;
CString name;
// use orderedFileNames to preserve order
for (int pos = 0; pos < orderedFileNames.GetSize(); pos++) {
pRec = FindFileRecord(orderedFileNames[pos]);
if(pRec && pRec->m_bSource ){
pRec->PrintDepend();
}
}
}
void PrintDepend2(){
CFileRecord *pRec;
int i;
if( m_includes.GetSize() != 0 ){
fprintf(pAltFile, "\n\n\n%s: \\\n",m_pathName );
i = 0;
while( i < m_includes.GetSize() ){
pRec = (CFileRecord*) m_includes[i];
fprintf(pAltFile, "\t\t\t%s\t\\\n",pRec->m_pathName );
i++;
}
}
}
static void PrintDependancies2(){
CFileRecord *pRec;
BOOL bFound;
POSITION next;
CString name;
next = fileMap.GetStartPosition();
while( next ){
fileMap.GetNextAssoc( next, name, *(void**)&pRec );
pRec->PrintDepend2();
}
}
static void PrintTargets(const char *pMacroName, const char *pDelimeter){
CFileRecord *pRec;
BOOL bFound;
POSITION next;
CString name;
BOOL bNeedDelimeter = FALSE;
fprintf(pAltFile, "%s = ", pMacroName);
// use orderedFileNames to preserve target order
for (int pos = 0; pos < orderedFileNames.GetSize(); pos++) {
pRec = FindFileRecord(orderedFileNames[pos]);
ASSERT(pRec);
if( pRec && pRec->m_bSource && pRec->m_pathName.GetLength() != 0){
char fname[_MAX_FNAME];
CString csOutput;
csOutput = pRec->m_pathName;
FATName(csOutput);
_splitpath( csOutput, NULL, NULL, fname, NULL );
if(bNeedDelimeter) {
fprintf(pAltFile, "%s\n", pDelimeter);
bNeedDelimeter = FALSE;
}
fprintf(pAltFile, " $(OUTDIR)\\%s.obj ", fname );
bNeedDelimeter = TRUE;
}
}
fprintf(pAltFile, "\n\n\n");
}
static CString DirDefine( const char *pPath ){
char path_buffer[_MAX_PATH];
char dir[_MAX_DIR] = "";
char dir2[_MAX_DIR] = "";
char fname[_MAX_FNAME] = "";
char ext[_MAX_EXT] = "";
CString s;
_splitpath( pPath, 0, dir, 0, ext );
BOOL bDone = FALSE;
while( dir && !bDone){
// remove the trailing slash
dir[ strlen(dir)-1] = 0;
_splitpath( dir, 0, dir2, fname, 0 );
if( strcmp( fname, "SRC" ) == 0 ){
strcpy( dir, dir2 );
}
else {
bDone = TRUE;
}
}
s = CString(fname) + "_" + (ext+1);
return s;
}
static void PrintSources(){
int i;
CString dirName, newDirName;
for( i=0; i< orderedFileNames.GetSize(); i++ ){
newDirName= DirDefine( orderedFileNames[i] );
if( newDirName != dirName ){
fprintf( pAltFile, "\n\n\nFILES_%s= $(FILES_%s) \\",
(const char*)newDirName, (const char*)newDirName );
dirName = newDirName;
}
fprintf( pAltFile, "\n\t%s^", (const char*)orderedFileNames[i] );
}
}
static CString SourceDirName( const char *pPath, BOOL bFileName){
char path_buffer[_MAX_PATH];
char drive[_MAX_DRIVE] = "";
char dir[_MAX_DIR] = "";
char fname[_MAX_FNAME] = "";
char ext[_MAX_EXT] = "";
CString s;
_splitpath( pPath, drive, dir, fname, ext );
s = CString(drive) + dir;
if( bFileName ){
s += CString("FNAME") + ext;
}
else {
// remove the trailing slash
s = s.Left( s.GetLength() - 1 );
}
return s;
}
static CString GetExt( const char *pPath){
char ext[_MAX_EXT] = "";
_splitpath( pPath, 0,0,0, ext );
CString s = CString(ext);
s.MakeLower();
return s;
}
static void PrintBuildRules(){
int i;
CString dirName;
CMapStringToPtr dirList;
for( i=0; i< orderedFileNames.GetSize(); i++ ){
dirList[ SourceDirName(orderedFileNames[i], TRUE) ]= 0;
}
POSITION next;
CString name;
void *pVal;
next = dirList.GetStartPosition();
while( next ){
dirList.GetNextAssoc( next, name, pVal);
CString dirDefine = DirDefine( name );
CString ext = GetExt( name );
name = SourceDirName( name, FALSE );
CString response = dirDefine.Left(8);
fprintf( pAltFile,
"\n\n\n{%s}%s{$(OUTDIR)}.obj:\n"
"\t@rem <<$(OUTDIR)\\%s.cl\n"
"\t$(CFILEFLAGS)\n"
"\t$(CFLAGS_%s)\n"
"<<KEEP\n"
"\t$(CPP) @$(OUTDIR)\\%s.cl %%s\n",
(const char*)name,
(const char*)ext,
(const char*)response,
(const char*)dirDefine,
(const char*)response
);
fprintf( pAltFile,
"\n\n\nBATCH_%s:\n"
"\t@rem <<$(OUTDIR)\\%s.cl\n"
"\t$(CFILEFLAGS)\n"
"\t$(CFLAGS_%s)\n"
"\t$(FILES_%s)\n"
"<<KEEP\n"
"\t$(TIMESTART)\n"
"\t$(CPP) @$(OUTDIR)\\%s.cl\n"
"\t$(TIMESTOP)\n",
(const char*)dirDefine,
(const char*)response,
(const char*)dirDefine,
(const char*)dirDefine,
(const char*)response
);
}
//
// Loop through one more time and build the final batch build
// rule
//
fprintf( pAltFile,
"\n\n\nBATCH_BUILD_OBJECTS:\t\t\\\n");
next = dirList.GetStartPosition();
while( next ){
dirList.GetNextAssoc( next, name, pVal);
CString dirDefine = DirDefine( name );
fprintf( pAltFile,
"\tBATCH_%s\t\t\\\n", dirDefine );
}
fprintf( pAltFile,
"\n\n");
}
static void ProcessFiles(){
CFileRecord *pRec;
BOOL bFound;
POSITION next;
CString name;
// search all the files for headers, adding each one to the list when found
// rather than do it recursively, it simple marks each one it's done
// and starts over, stopping only when all are marked as done
next = fileMap.GetStartPosition();
while( next ){
fileMap.GetNextAssoc( next, name, *(void**)&pRec );
if( pRec->m_bVisited == FALSE && pRec->m_bSystem == FALSE ){
// mark this file as already done so we don't read it again
// to find its headers
pRec->m_bVisited = TRUE;
pRec->ProcessFile();
// Start searching from the beginning again
// because ProcessFile may have added new files
// and changed the GetNextAssoc order
next = fileMap.GetStartPosition();
}
}
}
};
CMapStringToPtr CFileRecord::fileMap; // contains all allocated CFileRecords
CStringArray CFileRecord::orderedFileNames;
CMapStringToPtr CFileRecord::includeMap; // pointers to CFileRecords in fileMap
CMapStringToPtr CFileRecord::noDependMap; // no data, just an index
int main( int argc, char** argv ){
int i = 1;
char *pStr;
static int iRecursion = 0; // Track levels of recursion.
static CString outputFileName;
// Entering.
iRecursion++;
while( i < argc ){
if( argv[i][0] == '-' || argv[i][0] == '/' ){
switch( argv[i][1] ){
case 'i':
case 'I':
if( argv[i][2] != 0 ){
pStr = &(argv[i][2]);
}
else {
i++;
pStr = argv[i];
}
if( pStr == 0 || *pStr == '-' || *pStr == '/' ){
goto usage;
}
else {
AddIncludeDirectory( pStr );
}
break;
case 'f':
case 'F':
if( argv[i][2] != 0 ){
pStr = &(argv[i][2]);
}
else {
i++;
pStr = argv[i];
}
if( pStr == 0 || *pStr == '-' || *pStr == '/'){
goto usage;
}
else {
CStdioFile f;
CString s;
if( f.Open( pStr, CFile::modeRead ) ){
while(f.ReadString(s)){
s.TrimLeft();
s.TrimRight();
if( s.GetLength() ){
CFileRecord::AddFile( s, NULL, FALSE, TRUE );
}
}
f.Close();
}
else {
fprintf(stderr,"makedep: file not found: %s", pStr );
exit(-1);
}
}
break;
case 'o':
case 'O':
if( argv[i][2] != 0 ){
pStr = &(argv[i][2]);
}
else {
i++;
pStr = argv[i];
}
if( pStr == 0 || *pStr == '-' || *pStr == '/'){
goto usage;
}
else {
CStdioFile f;
CString s;
outputFileName = pStr;
if(!(pAltFile = fopen(pStr, "w+"))) {
fprintf(stderr, "makedep: file not found: %s", pStr );
exit(-1);
}
}
break;
case '1':
if( argv[i][2] == '6') {
b16 = TRUE;
}
break;
case 's':
case 'S':
bSimple = TRUE;
break;
case 'h':
case 'H':
case '?':
usage:
fprintf(stderr, "usage: makedep -I <dirname> -F <filelist> <filename>\n"
" -I <dirname> Directory name, can be repeated\n"
" -F <filelist> List of files to scan, one per line\n"
" -O <outputFile> File to write output, default stdout\n");
exit(-1);
}
}
else if( argv[i][0] == '@' ){
// file contains our commands.
CStdioFile f;
CString s;
int iNewArgc = 0;
char **apNewArgv = new char*[5000];
memset(apNewArgv, 0, sizeof(apNewArgv));
// First one is always the name of the exe.
apNewArgv[0] = argv[0];
iNewArgc++;
const char *pTraverse;
const char *pBeginArg;
if( f.Open( &argv[i][1], CFile::modeRead ) ){
while( iNewArgc < 5000 && f.ReadString(s) ) {
// Scan the string for args, and do the right thing.
pTraverse = (const char *)s;
while(iNewArgc < 5000 && *pTraverse) {
if(isspace(*pTraverse)) {
pTraverse++;
continue;
}
// Extract to next space.
pBeginArg = pTraverse;
do {
pTraverse++;
}
while(*pTraverse && !isspace(*pTraverse));
apNewArgv[iNewArgc] = new char[pTraverse - pBeginArg + 1];
memset(apNewArgv[iNewArgc], 0, pTraverse - pBeginArg + 1);
strncpy(apNewArgv[iNewArgc], pBeginArg, pTraverse - pBeginArg);
iNewArgc++;
}
}
f.Close();
}
// Recurse if needed.
if(iNewArgc > 1) {
main(iNewArgc, apNewArgv);
}
// Free off the argvs (but not the very first one which we didn't allocate).
while(iNewArgc > 1) {
iNewArgc--;
delete [] apNewArgv[iNewArgc];
}
delete [] apNewArgv;
}
else {
CFileRecord::AddFile( argv[i], NULL, FALSE, TRUE );
}
i++;
}
// Only of the very bottom level of recursion do we do this.
if(iRecursion == 1) {
// only write the results out if no errors encountered
if (mainReturn == 0) {
CFileRecord::ProcessFiles();
if( !bSimple ){
CFileRecord::PrintTargets("OBJ_FILES", "\\");
if(b16) {
CFileRecord::PrintTargets("LINK_OBJS", "+\\");
}
else {
CFileRecord::PrintTargets("LINK_OBJS", "^");
}
CFileRecord::PrintSources();
CFileRecord::PrintBuildRules();
}
CFileRecord::PrintDependancies();
}
if(pAltFile != stdout) {
fclose(pAltFile);
if (mainReturn != 0) {
remove(outputFileName); // kill output file if returning an error
}
}
}
iRecursion--;
if (iRecursion == 0 )
{
// last time through -- clean up allocated CFileRecords!
CFileRecord *pFRec;
CString name;
POSITION next;
next = CFileRecord::fileMap.GetStartPosition();
while( next ){
CFileRecord::fileMap.GetNextAssoc( next, name, *(void**)&pFRec );
delete pFRec;
}
}
return mainReturn;
}

BIN
mozilla/config/makedep.exe Executable file

Binary file not shown.

147
mozilla/config/makefile.win Normal file
View File

@@ -0,0 +1,147 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#//------------------------------------------------------------------------
#//
#// Makefile for MOZILLA/CONFIG - various commands used by other makefiles
#//
#//------------------------------------------------------------------------
!if "$(MOZ_BITS)" == "16"
!error This makefile must be build using 32-bit tools
!endif
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of MOZILLA
#//
#//------------------------------------------------------------------------
DEPTH = ..
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
#// (these must come before the common makefiles are included)
#//
#// DIRS - There is a subdirectory to process
#// INSTALL_FILES - Files to be installed in the distribution area
#//
#//------------------------------------------------------------------------
!ifdef MOZ_FULLCIRCLE
INSTALL_FILE_LIST=$(MOZ_TOOLS)\bin\fullsoft.dll $(MOZ_TOOLS)\bin\talkback.cnt $(MOZ_TOOLS)\bin\talkback.exe $(MOZ_TOOLS)\bin\talkback.hlp
INSTALL_DIR=$(DIST)\bin
!endif
GARBAGE = *.obj *.sbr *.pdb build_number nsBuildID.h
!ifdef MOZ_COVERAGE
GARBAGE = $(GARBAGE) trace.dll trace.lib trace.exp
!endif
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/config.mak>
include <$(DEPTH)/config/rules.mak>
!ifdef MOZILLA_OFFICIAL
_BN_OFFICIAL=1
!else
_BN_OFFICIAL=
!endif
# update build number from within make script
build_number:
$(PERL) -I. bdate.pl $@ $(_BN_OFFICIAL)
nsBuildID.h: build_number nsBuildID.h.in
$(RM) $@
$(PERL) -I. aboutime.pl $@ build_number nsBuildID.h.in
#// Rule to set the timebomb on official mozilla builds
#//
#// Rules to build make utils
#//
#CFLAGS = /FR /Zi -MDd /W4
CFLAGS = /O2 /GB /MD
makecopy.exe:: makecopy.cpp
$(CC) $(CFLAGS) $**
mangle.exe:: mangle.c
$(CC) $(CFLAGS) $**
mantomak.exe:: mantomak.c
$(CC) $(CFLAGS) $**
bin2rc.exe:: bin2rc.c
$(CC) $(CFLAGS) $**
makedep.exe:: makedep.cpp
$(CC) -MT /O2 /GB $**
trace.dll:: trace.obj pldhash.obj
link /nologo /debug /libpath:$(DIST)/lib /dll /out:$@ $** nspr4.lib imagehlp.lib
pldhash.obj:: $(DEPTH)/xpcom/ds/pldhash.c
$(CC) /c /nologo /Od /Z7 /I$(DEPTH)/xpcom/ds /I$(DIST)/include $**
trace.obj:: trace.cpp
$(CC) /c /nologo /Od /Z7 /DMOZ_SRC=\"$(MOZ_SRC)\" /I$(DEPTH)/xpcom/ds /I$(DIST)/include $**
export:: \
makecopy.exe \
mangle.exe \
mantomak.exe \
bin2rc.exe \
makedep.exe \
build_number \
nsBuildID.h \
!ifdef MOZ_COVERAGE
trace.dll \
!endif
$(NULL)
$(MAKE_INSTALL) nsBuildID.h $(PUBLIC)
!ifdef MOZ_COVERAGE
$(MAKE_INSTALL) trace.dll $(DIST)/bin
$(MAKE_INSTALL) trace.lib $(DIST)/lib
!endif
!ifdef MOZ_FULLCIRCLE
master.pl: build_number
$(PERL) build-number.pl
master.ini: master.pl
$(RM) $@
$(PERL) master.pl
install:: master.ini
$(MAKE_INSTALL) master.ini $(DIST)\bin\
!endif
#install::
# $(RM) $(DIST)\bin\chrome\installed-chrome.txt
FORCE::

124
mozilla/config/mangle.c Normal file
View File

@@ -0,0 +1,124 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
HANDLE hMangleFile;
void Usage(void)
{
fprintf(stderr, "MANGLE: <file>\n");
}
BOOL MangleFile( const char *real_name, const char *mangle_name )
{
int len;
DWORD dwWritten;
char buffer[2048];
if( mangle_name && *mangle_name && strcmpi(real_name, mangle_name) ) {
printf("Mangle: renaming %s to %s\n", real_name, mangle_name);
if( ! MoveFile(real_name, "X_MANGLE.TMP") ) {
fprintf(stderr, "MANGLE: cannot rename %s to X_MANGLE.TMP\n",
real_name);
return FALSE;
}
if( ! MoveFile("X_MANGLE.TMP", mangle_name) ) {
MoveFile("X_MANGLE.TMP", real_name);
fprintf(stderr, "MANGLE: cannot rename X_MANGLE.TMP to %s\n",
mangle_name);
return FALSE;
}
len = sprintf(buffer, "mv %s %s\r\n", mangle_name, real_name);
if( (WriteFile( hMangleFile, buffer, len, &dwWritten, NULL ) == FALSE) ||
(dwWritten != len) ) {
fprintf(stderr, "MANGLE: error writing to UNMANGLE.BAT\n");
return FALSE;
}
}
return TRUE;
}
int main( int argc, char *argv[] )
{
WIN32_FIND_DATA find_data;
HANDLE hFoundFile;
if( argc != 1 ) {
Usage();
return 2;
}
hMangleFile = CreateFile("unmangle.bat", /* name */
GENERIC_READ|GENERIC_WRITE, /* access mode */
0, /* share mode */
NULL, /* security descriptor */
CREATE_NEW, /* how to create */
FILE_ATTRIBUTE_NORMAL, /* file attributes */
NULL ); /* template file */
if( hMangleFile == INVALID_HANDLE_VALUE ) {
if( GetLastError() == ERROR_FILE_EXISTS ) {
fprintf(stderr, "MANGLE: UNMANGLE.BAT already exists\n");
} else {
fprintf(stderr, "MANGLE: cannot open UNMANGLE.BAT\n");
}
return 1;
}
if( (hFoundFile = FindFirstFile("*.*", &find_data)) == INVALID_HANDLE_VALUE ) {
fprintf(stderr, "MANGLE: cannot read directory\n");
return 1;
}
do {
if( !MangleFile(find_data.cFileName, find_data.cAlternateFileName) ) {
fprintf(stderr, "MANGLE: cannot rename %s to %s\n",
find_data.cFileName, find_data.cAlternateFileName );
FindClose( hFoundFile );
CloseHandle( hMangleFile );
return 1;
}
} while( FindNextFile(hFoundFile, &find_data) );
FindClose( hFoundFile );
{
int len;
DWORD dwWritten;
char buffer[255];
len = sprintf(buffer, "del unmangle.bat\r\n");
WriteFile ( hMangleFile, buffer, len, &dwWritten, NULL );
}
CloseHandle( hMangleFile );
return 0;
}

BIN
mozilla/config/mangle.exe Executable file

Binary file not shown.

994
mozilla/config/mantomak.c Normal file
View File

@@ -0,0 +1,994 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define DEFAULT_MANIFEST_EXT ".mn"
#define DEFAULT_MAKEFILE_EXT ".win"
typedef struct char_list_struct {
char *m_pString;
struct char_list_struct *m_pNext;
} char_list;
typedef struct macro_list_struct {
char *m_pMacro;
char_list *m_pValue;
struct macro_list_struct *m_pNext;
} macro_list;
void help(void);
char *input_filename(const char *);
char *output_filename(const char *, const char *);
int input_to_output(FILE *, FILE *);
int output_rules(FILE *);
int output_end(FILE *);
int buffer_to_output(char *, FILE *);
macro_list *extract_macros(char *);
char *find_macro(char *, char **);
void add_macro(char *, macro_list **);
int macro_length(char *);
int value_length(char *);
void add_values(char *, char_list **);
char *skip_white(char *);
int write_macros(macro_list *, FILE *);
int write_values(char_list *, FILE *, int);
void free_macro_list(macro_list *);
void free_char_list(char_list *);
void morph_macro(macro_list **, char *, char *, char *);
void slash_convert(macro_list *, char *);
int explicit_rules(macro_list *, char *, FILE *);
void create_classroot(macro_list **ppList );
int main(int argc, char *argv[])
{
int iOS = 0;
char *pInputFile = NULL;
char *pOutputFile = NULL;
/* Figure out arguments.
* [REQUIRED] First argument is input file.
* [OPTIONAL] Second argument is output file.
*/
if(argc > 1) {
FILE *pInputStream = NULL;
FILE *pOutputStream = NULL;
/* Form respective filenames.
*/
pInputFile = input_filename(argv[1]);
pOutputFile = output_filename(pInputFile, argc > 2 ? argv[2] : NULL);
if(pInputFile == NULL) {
fprintf(stderr, "MANTOMAK: Unable to form input filename\n");
iOS = 1;
}
else {
pInputStream = fopen(pInputFile, "rb");
if(pInputStream == NULL) {
fprintf(stderr, "MANTOMAK: Unable to open input file %s\n", pInputFile);
iOS = 1;
}
}
if(pOutputFile == NULL) {
fprintf(stderr, "MANTOMAK: Unable to form output filename\n");
iOS = 1;
}
else if(pInputStream != NULL) {
pOutputStream = fopen(pOutputFile, "wt");
if(pOutputStream == NULL) {
fprintf(stderr, "MANTOMAK: Unable to open output file %s\n", pOutputFile);
iOS = 1;
}
}
/* Only do the real processing if our error code is not
* already set.
*/
if(iOS == 0) {
iOS = input_to_output(pInputStream, pOutputStream);
}
if(pInputStream != NULL) {
fclose(pInputStream);
pInputStream = NULL;
}
if(pOutputStream != NULL) {
fclose(pOutputStream);
pOutputStream = NULL;
}
}
else {
help();
iOS = 1;
}
if(pInputFile) {
free(pInputFile);
pInputFile = NULL;
}
if(pOutputFile) {
free(pOutputFile);
pOutputFile = NULL;
}
return(iOS);
}
void help(void)
{
fprintf(stderr, "USAGE:\tmantomak.exe InputFile [OutputFile]\n\n");
fprintf(stderr, "InputFile:\tManifest file. If without extension, \"%s\" assumed.\n", DEFAULT_MANIFEST_EXT);
fprintf(stderr, "OutputFile:\tNMake file. If not present, \"InputFile%s\" assumed.\n", DEFAULT_MAKEFILE_EXT);
}
char *input_filename(const char *pInputFile)
{
char aResult[_MAX_PATH];
char aDrive[_MAX_DRIVE];
char aDir[_MAX_DIR];
char aName[_MAX_FNAME];
char aExt[_MAX_EXT];
if(pInputFile == NULL) {
return(NULL);
}
_splitpath(pInputFile, aDrive, aDir, aName, aExt);
if(aExt[0] == '\0') {
/* No extension provided.
* Use the default.
*/
strcpy(aExt, DEFAULT_MANIFEST_EXT);
}
aResult[0] = '\0';
_makepath(aResult, aDrive, aDir, aName, aExt);
if(aResult[0] == '\0') {
return(NULL);
}
else {
return(strdup(aResult));
}
}
char *output_filename(const char *pInputFile, const char *pOutputFile)
{
char aResult[_MAX_PATH];
char aDrive[_MAX_DRIVE];
char aDir[_MAX_DIR];
char aName[_MAX_FNAME];
char aExt[_MAX_EXT];
if(pOutputFile != NULL) {
return(strdup(pOutputFile));
}
/* From here on out, we have to create our own filename,
* implied from the input file name.
*/
if(pInputFile == NULL) {
return(NULL);
}
_splitpath(pInputFile, aDrive, aDir, aName, aExt);
strcpy(aExt, DEFAULT_MAKEFILE_EXT);
aResult[0] = '\0';
_makepath(aResult, aDrive, aDir, aName, aExt);
if(aResult[0] == '\0') {
return(NULL);
}
else {
return(strdup(aResult));
}
}
int input_to_output(FILE *pInput, FILE *pOutput)
{
char *pHog = NULL;
long lSize = 0;
int iRetval = 0;
/* Read the entire file into memory.
*/
fseek(pInput, 0, SEEK_END);
lSize = ftell(pInput);
fseek(pInput, 0, SEEK_SET);
pHog = (char *)malloc(lSize + 1);
if(pHog) {
*(pHog + lSize) = '\0';
fread(pHog, lSize, 1, pInput);
iRetval = buffer_to_output(pHog, pOutput);
free(pHog);
pHog = NULL;
}
else {
fprintf(stderr, "MANTOMAK: Out of Memory....\n");
iRetval = 1;
}
return(iRetval);
}
int output_rules(FILE *pOutput)
{
int iRetval = 0;
if(EOF ==
fputs("\n"
"!if \"$(MANIFEST_LEVEL)\"==\"RULES\""
"\n",
pOutput))
{
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
}
return(iRetval);
}
int output_end(FILE *pOutput)
{
int iRetval = 0;
if(EOF ==
fputs("\n"
"!endif"
"\n",
pOutput))
{
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
}
return(iRetval);
}
int buffer_to_output(char *pBuffer, FILE *pOutput)
{
int iRetval = 0;
macro_list *pMacros = NULL;
/* Tokenize the macros and their corresponding values.
*/
pMacros = extract_macros(pBuffer);
if(pMacros != NULL) {
/* Perform forward to backslash conversion on those macros known to be
* path information only.
*/
slash_convert(pMacros, "JBOOTDIRS");
slash_convert(pMacros, "JDIRS");
slash_convert(pMacros, "DEPTH");
slash_convert(pMacros, "NS_DEPTH");
slash_convert(pMacros, "PACKAGE");
slash_convert(pMacros, "JMC_GEN_DIR");
slash_convert(pMacros, "DIST_PUBLIC");
/* Process some of the macros, and convert them
* into different macros with different data.
*/
morph_macro(&pMacros, "JMC_GEN", "JMC_HEADERS", "$(JMC_GEN_DIR)\\%s.h");
morph_macro(&pMacros, "JMC_GEN", "JMC_STUBS", "$(JMC_GEN_DIR)\\%s.c");
morph_macro(&pMacros, "JMC_GEN", "JMC_OBJS", ".\\$(OBJDIR)\\%s.obj");
morph_macro(&pMacros, "CSRCS", "C_OBJS", ".\\$(OBJDIR)\\%s.obj");
morph_macro(&pMacros, "CPPSRCS", "CPP_OBJS", ".\\$(OBJDIR)\\%s.obj");
morph_macro(&pMacros, "REQUIRES", "LINCS", "-I$(XPDIST)\\public\\%s");
create_classroot( &pMacros );
/* Output the Macros and the corresponding values.
*/
iRetval = write_macros(pMacros, pOutput);
/* Output rule file inclusion
*/
if(iRetval == 0) {
iRetval = output_rules(pOutput);
}
/* Output explicit build rules/dependencies for JMC_GEN.
*/
if(iRetval == 0) {
iRetval = explicit_rules(pMacros, "JMC_GEN", pOutput);
}
if(iRetval == 0) {
iRetval = output_end(pOutput);
}
/* Free off the macro list.
*/
free_macro_list(pMacros);
pMacros = NULL;
}
return(iRetval);
}
int explicit_rules(macro_list *pList, char *pMacro, FILE *pOutput)
{
int iRetval = 0;
macro_list *pEntry = NULL;
if(pList == NULL || pMacro == NULL || pOutput == NULL) {
return(0);
}
/* Find macro of said name.
* Case insensitive.
*/
pEntry = pList;
while(pEntry) {
if(stricmp(pEntry->m_pMacro, pMacro) == 0) {
break;
}
pEntry = pEntry->m_pNext;
}
if(pEntry) {
/* Decide style of rule depending on macro name.
*/
if(stricmp(pEntry->m_pMacro, "JMC_GEN") == 0) {
char_list *pNames = NULL;
char *pModuleName = NULL;
char *pClassName = NULL;
pNames = pEntry->m_pValue;
while(pNames) {
pModuleName = pNames->m_pString;
pClassName = pModuleName + 1;
fprintf(pOutput, "$(JMC_GEN_DIR)\\%s.h", pModuleName);
fprintf(pOutput, ": ");
fprintf(pOutput, "$(JMCSRCDIR)\\%s.class", pClassName);
fprintf(pOutput, "\n ");
fprintf(pOutput, "$(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=)");
fprintf(pOutput, "\n");
fprintf(pOutput, "$(JMC_GEN_DIR)\\%s.c", pModuleName);
fprintf(pOutput, ": ");
fprintf(pOutput, "$(JMCSRCDIR)\\%s.class", pClassName);
fprintf(pOutput, "\n ");
fprintf(pOutput, "$(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=)");
fprintf(pOutput, "\n");
pNames = pNames->m_pNext;
}
}
else {
/* Don't know how to format macro.
*/
iRetval = 69;
}
}
return(iRetval);
}
void slash_convert(macro_list *pList, char *pMacro)
{
macro_list *pEntry = NULL;
if(pList == NULL || pMacro == NULL) {
return;
}
/* Find macro of said name.
* Case insensitive.
*/
pEntry = pList;
while(pEntry) {
if(stricmp(pEntry->m_pMacro, pMacro) == 0) {
break;
}
pEntry = pEntry->m_pNext;
}
if(pEntry) {
char *pConvert = NULL;
char_list *pValue = pEntry->m_pValue;
while(pValue) {
pConvert = pValue->m_pString;
while(pConvert && *pConvert) {
if(*pConvert == '/') {
*pConvert = '\\';
}
pConvert++;
}
pValue = pValue->m_pNext;
}
}
}
void morph_macro(macro_list **ppList, char *pMacro, char *pMorph, char *pPrintf)
{
macro_list *pEntry = NULL;
if(ppList == NULL || pMacro == NULL || pMorph == NULL || pPrintf == NULL) {
return;
}
/* Find macro of said name.
* Case insensitive.
*/
pEntry = *ppList;
while(pEntry) {
if(stricmp(pEntry->m_pMacro, pMacro) == 0) {
break;
}
pEntry = pEntry->m_pNext;
}
if(pEntry) {
char_list *pFilename = NULL;
char aPath[_MAX_PATH];
char aDrive[_MAX_DRIVE];
char aDir[_MAX_DIR];
char aFName[_MAX_FNAME];
char aExt[_MAX_EXT];
char *pBuffer = NULL;
/* Start with buffer size needed.
* We expand this as we go along if needed.
*/
pBuffer = (char *)malloc(strlen(pMorph) + 2);
strcpy(pBuffer, pMorph);
strcat(pBuffer, "=");
/* Go through each value, converting over to new macro.
*/
pFilename = pEntry->m_pValue;
while(pFilename) {
_splitpath(pFilename->m_pString, aDrive, aDir, aFName, aExt);
/* Expand buffer by required amount.
*/
sprintf(aPath, pPrintf, aFName);
strcat(aPath, " ");
pBuffer = (char *)realloc(pBuffer, _msize(pBuffer) + strlen(aPath));
strcat(pBuffer, aPath);
pFilename = pFilename->m_pNext;
}
/* Add the macro.
*/
add_macro(pBuffer, ppList);
free(pBuffer);
pBuffer = NULL;
}
}
void create_classroot(macro_list **ppList )
{
char cwd[512];
int i, i2;
macro_list *pEntry = NULL;
macro_list *pE;
/* Find macro of said name.
* Case insensitive.
*/
pEntry = *ppList;
while(pEntry) {
if(stricmp(pEntry->m_pMacro, "PACKAGE") == 0) {
break;
}
pEntry = pEntry->m_pNext;
}
if(pEntry == 0 || pEntry->m_pValue == 0 || pEntry->m_pValue->m_pString == 0) {
return;
}
_getcwd( cwd, 512 );
i = strlen( pEntry->m_pValue->m_pString );
i2 = strlen( cwd );
cwd[i2-i-1] = 0;
pE = NULL;
pE = (macro_list *)calloc(sizeof(macro_list),1);
pE->m_pMacro = strdup("CLASSROOT");
pE->m_pValue = (char_list *)calloc(sizeof(char_list),1);
pE->m_pValue->m_pString = strdup(cwd);
while(*ppList) {
ppList = &((*ppList)->m_pNext);
}
*ppList = pE;
}
int write_macros(macro_list *pList, FILE *pOutput)
{
int iRetval = 0;
int iLineLength = 0;
if(pList == NULL || pOutput == NULL) {
return(0);
}
if(EOF ==
fputs("\n"
"!if \"$(MANIFEST_LEVEL)\"==\"MACROS\""
"\n",
pOutput))
{
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
return(1);
}
while(pList) {
int bIgnoreForWin16 = 0;
/* The following macros should not be emitted for Win16 */
if (0 == strcmp(pList->m_pMacro, "LINCS")) {
bIgnoreForWin16 = 1;
}
if (bIgnoreForWin16) {
if(0 > fprintf(pOutput, "!if \"$(MOZ_BITS)\" != \"16\"\n")) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
}
if(0 > fprintf(pOutput, "%s=", pList->m_pMacro)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength += strlen(pList->m_pMacro) + 1;
iRetval = write_values(pList->m_pValue, pOutput, iLineLength);
if(iRetval) {
break;
}
if(EOF == fputc('\n', pOutput)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength = 0;
pList = pList->m_pNext;
if (bIgnoreForWin16) {
if(0 > fprintf(pOutput, "!endif\n")) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
bIgnoreForWin16 = 0;
}
}
if(EOF ==
fputs("\n"
"!endif"
"\n",
pOutput))
{
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
return(1);
}
return(iRetval);
}
int write_values(char_list *pList, FILE *pOutput, int iLineLength)
{
int iRetval = 0;
if(pList == NULL || pOutput == NULL) {
return(0);
}
while(pList) {
if(iLineLength == 0) {
if(EOF == fputs(" ", pOutput)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength += 4;
if(0 > fprintf(pOutput, "%s ", pList->m_pString)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength += strlen(pList->m_pString) + 1;
}
else if(iLineLength + strlen(pList->m_pString) > 72) {
if(EOF == fputs("\\\n", pOutput)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength = 0;
continue;
}
else {
if(0 > fprintf(pOutput, "%s ", pList->m_pString)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength += strlen(pList->m_pString) + 1;
}
pList = pList->m_pNext;
}
return(iRetval);
}
macro_list *extract_macros(char *pBuffer)
{
macro_list *pRetval = NULL;
char *pTraverse = NULL;
char *pMacro = NULL;
pTraverse = pBuffer;
while(pTraverse) {
pMacro = NULL;
pTraverse = find_macro(pTraverse, &pMacro);
if(pMacro) {
add_macro(pMacro, &pRetval);
}
}
return(pRetval);
}
void add_macro(char *pString, macro_list **ppList)
{
macro_list *pEntry = NULL;
int iLength = 0;
if(pString == NULL || *pString == '\0' || ppList == NULL) {
return;
}
/* Allocate a new list entry for the macro.
*/
pEntry = (macro_list *)malloc(sizeof(macro_list));
memset(pEntry, 0, sizeof(macro_list));
/* Very first part of the string is the macro name.
* How long is it?
*/
iLength = macro_length(pString);
pEntry->m_pMacro = (char *)malloc(iLength + 1);
memset(pEntry->m_pMacro, 0, iLength + 1);
strncpy(pEntry->m_pMacro, pString, iLength);
/* Skip to the values.
* These are always on the right side of an '='
*/
pString = strchr(pString, '=');
if(pString) {
pString++;
}
add_values(pString, &(pEntry->m_pValue));
/* Add the macro to the end of the macro list.
*/
while(*ppList) {
ppList = &((*ppList)->m_pNext);
}
*ppList = pEntry;
}
void add_values(char *pString, char_list **ppList)
{
char_list **ppTraverse = NULL;
char_list *pEntry = NULL;
int iLength = 0;
int iBackslash = 0;
if(pString == NULL || *pString == '\0' || ppList == NULL) {
return;
}
while(pString) {
/* Find start of value.
*/
iBackslash = 0;
while(*pString) {
if(*pString == '\\') {
iBackslash++;
}
else if(*pString == '\n') {
if(iBackslash == 0) {
/* End of values.
* Setting to NULL gets out of all loops.
*/
pString = NULL;
break;
}
iBackslash = 0;
}
else if(!isspace(*pString)) {
/* Backslashes part of string.
* This screws up if a backslash is in the middle of the string.
*/
pString -= iBackslash;
break;
}
pString++;
}
if(pString == NULL || *pString == '\0') {
break;
}
/* Do not honor anything beginning with a #
*/
if(*pString == '#') {
/* End of line.
*/
while(*pString && *pString != '\n') {
pString++;
}
continue;
}
/* Very first part of the string is value name.
* How long is it?
*/
iLength = value_length(pString);
/* Do not honor $(NULL)
*/
if(_strnicmp(pString, "$(NULL)", 7) == 0) {
pString += iLength;
continue;
}
/* Allocate a new list entry for the next value.
*/
pEntry = (char_list *)malloc(sizeof(char_list));
memset(pEntry, 0, sizeof(char_list));
pEntry->m_pString = (char *)malloc(iLength + 1);
memset(pEntry->m_pString, 0, iLength + 1);
strncpy(pEntry->m_pString, pString, iLength);
/* Add new value entry to the end of the list.
*/
ppTraverse = ppList;
while(*ppTraverse) {
ppTraverse = &((*ppTraverse)->m_pNext);
}
*ppTraverse = pEntry;
/* Go on to next value.
*/
pString += iLength;
}
}
char *find_macro(char *pBuffer, char **ppMacro)
{
char *pRetval = NULL;
int iBackslash = 0;
if(pBuffer == NULL || ppMacro == NULL) {
return(NULL);
}
/* Skip any whitespace in the buffer.
* If comments need to be skipped also, this is the place.
*/
while(1) {
while(*pBuffer && isspace(*pBuffer)) {
pBuffer++;
}
if(*pBuffer == '#') {
/* Go to the end of the line, it's a comment.
*/
while(*pBuffer && *pBuffer != '\n') {
pBuffer++;
}
continue;
}
break;
}
if(*pBuffer) {
/* Should be at the start of a macro.
*/
*ppMacro = pBuffer;
}
/* Find the end of the macro for the return value.
* This is the end of a line which does not contain a backslash at the end.
*/
while(*pBuffer) {
if(*pBuffer == '\\') {
iBackslash++;
}
else if(*pBuffer == '\n') {
if(iBackslash == 0) {
pRetval = pBuffer + 1;
break;
}
iBackslash = 0;
}
else if(!isspace(*pBuffer)) {
iBackslash = 0;
}
pBuffer++;
}
return(pRetval);
}
int macro_length(char *pMacro)
{
int iRetval = 0;
if(pMacro == NULL) {
return(0);
}
/* Length is no big deal.
* Problem is finding the end:
* whitespace
* '='
*/
while(*pMacro) {
if(*pMacro == '=') {
break;
}
else if(isspace(*pMacro)) {
break;
}
pMacro++;
iRetval++;
}
return(iRetval);
}
int value_length(char *pValue)
{
int iRetval = 0;
if(pValue == NULL) {
return(0);
}
/* Length is no big deal.
* Problem is finding the end:
* whitespace
* '\\'whitespace
*/
while(*pValue) {
if(*pValue == '\\') {
char *pFindNewline = pValue + 1;
/* If whitespace to end of line, break here.
*/
while(isspace(*pFindNewline)) {
if(*pFindNewline == '\n') {
break;
}
pFindNewline++;
}
if(*pFindNewline == '\n') {
break;
}
}
else if(isspace(*pValue)) {
break;
}
pValue++;
iRetval++;
}
return(iRetval);
}
char *skip_white(char *pString)
{
if(pString == NULL) {
return(NULL);
}
while(*pString && isspace(*pString)) {
pString++;
}
return(pString);
}
void free_macro_list(macro_list *pList)
{
macro_list *pFree = NULL;
if(pList == NULL) {
return;
}
while(pList) {
pFree = pList;
pList = pList->m_pNext;
pFree->m_pNext = NULL;
free_char_list(pFree->m_pValue);
pFree->m_pValue = NULL;
free(pFree->m_pMacro);
pFree->m_pMacro = NULL;
free(pFree);
pFree = NULL;
}
}
void free_char_list(char_list *pList)
{
char_list *pFree = NULL;
if(pList == NULL) {
return;
}
while(pList) {
pFree = pList;
pList = pList->m_pNext;
pFree->m_pNext = NULL;
free(pFree->m_pString);
pFree->m_pString = NULL;
free(pFree);
pFree = NULL;
}
}

BIN
mozilla/config/mantomak.exe Executable file

Binary file not shown.

131
mozilla/config/mozBDate.pm Executable file
View File

@@ -0,0 +1,131 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
package mozBDate;
use strict;
use IO::File;
BEGIN {
use Exporter ();
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(&UpdateBuildNumber &SubstituteBuildNumber);
%EXPORT_TAGS = ( );
@EXPORT_OK = qw();
}
sub write_number($) {
my ($file, $num) = @_;
unlink($file);
open(OUT, ">$file") || die "$file: $!\n";
print OUT "$num\n";
close(OUT);
}
sub UpdateBuildNumber($$) {
my ($outfile, $official) = @_;
# XP way of doing the build date.
# 1998091509 = 1998, September, 15th, 9am local time zone
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
# localtime returns year minus 1900
$year = $year + 1900;
my $build_number = sprintf("%04d%02d%02d%02d", $year, 1+$mon, $mday, $hour);
if ("$outfile" eq "") {
print "$build_number\n";
return;
}
if ($official) {
&write_number($outfile, $build_number);
} else {
my $old_num = -1;
# Only overwrite file if contents are not already set to 0
if ( -e $outfile ) {
open(OLD, "<$outfile") || die "$outfile: $!\n";
$old_num = <OLD>;
chomp($old_num);
close(OLD);
}
if ($old_num != 0) {
&write_number($outfile, "0000000000");
}
}
return;
}
sub SubstituteBuildNumber($$$) {
my ($outfile, $build_num, $infile) = @_;
my $INFILE = new IO::File;
my $OUTFILE = new IO::File;
open $INFILE, "<$build_num";
my $build = <$INFILE>;
close $INFILE;
chomp $build;
if ($infile ne "") {
open($INFILE, "< $infile") || die "$infile: $!\n";
} else {
open($INFILE, "< $outfile") || die "$outfile: $!\n";
}
open $OUTFILE, ">${outfile}.old" || die;
while (<$INFILE>) {
my $id = $_;
my $temp;
if ($id =~ "Build ID:") {
$temp = "Build ID: " . $build;
$id =~ s/Build ID:\s\d+/$temp/;
print $OUTFILE $id;
}
elsif ($id =~ "NS_BUILD_ID") {
$temp = "NS_BUILD_ID " . $build;
$id =~ s/NS_BUILD_ID\s\d+/$temp/;
print $OUTFILE $id;
}
else {
print $OUTFILE $_;
}
}
close $INFILE;
close $OUTFILE;
unlink $outfile;
rename "${outfile}.old", "$outfile";
}
END {};
1;

34
mozilla/config/nfspwd.pl Normal file
View File

@@ -0,0 +1,34 @@
#! perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
require "fastcwd.pl";
$_ = &fastcwd;
if (m@^/[uh]/@o || s@^/tmp_mnt/@/@o) {
print("$_\n");
} elsif ((($user, $rest) = m@^/usr/people/(\w+)/(.*)@o)
&& readlink("/u/$user") eq "/usr/people/$user") {
print("/u/$user/$rest\n");
} else {
chop($host = `hostname`);
print("/h/$host$_\n");
}

46
mozilla/config/nodl.pl Normal file
View File

@@ -0,0 +1,46 @@
#! perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# Print out the nodltab.
# Usage: nodl.pl table-name sym1 sym2 ... symN
#
$table = $ARGV[0];
shift(@ARGV);
print "/* Automatically generated file; do not edit */\n\n";
print "#include \"prtypes.h\"\n\n";
print "#include \"prlink.h\"\n\n";
foreach $symbol (@ARGV) {
print "extern void ",$symbol,"();\n";
}
print "\n";
print "PRStaticLinkTable ",$table,"[] = {\n";
foreach $symbol (@ARGV) {
print " { \"",$symbol,"\", ",$symbol," },\n";
}
print " { 0, 0, },\n";
print "};\n";

View File

@@ -0,0 +1,8 @@
/* Build ID file.
*
* If building MOZILLLA_OFFICIAL (release build) NS_BUILD_ID will be updated
* to a current build id. This will be used to determine if we need to
* re-register components.
*
*/
#define NS_BUILD_ID 0000000000

451
mozilla/config/nsinstall.c Normal file
View File

@@ -0,0 +1,451 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
** Netscape portable install command.
**
** Brendan Eich, 7/20/95
*/
#ifdef XP_OS2_VACPP
#include "getopt.c"
#include "dirent.c"
#endif
#include <stdio.h> /* OSF/1 requires this before grp.h, so put it first */
#include <assert.h>
#include <fcntl.h>
#include <errno.h>
#ifndef XP_OS2_VACPP
#include <grp.h>
#include <pwd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef XP_OS2_VACPP
#include <unistd.h>
#include <utime.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include "pathsub.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#ifdef XP_OS2_VACPP
#include <dirent.h>
#include <direct.h>
#include <io.h>
#include <sys\utime.h>
#include <sys\types.h>
#endif
#ifdef SUNOS4
#include "sunos4.h"
#endif
#ifdef NEXTSTEP
#include <bsd/libc.h>
#endif
#ifdef __QNX__
#include <unix.h>
#endif
#ifdef NEED_S_ISLNK
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
#endif
#endif
#ifdef NEED_FCHMOD_PROTO
extern int fchmod(int fildes, mode_t mode);
#endif
#ifdef XP_OS2
/*Note: OS/2 has no concept of users or groups, or symbolic links...*/
#define lstat stat
/*looks reasonably safe based on OS/2's stat.h...*/
#define S_ISLNK(mode) 0 /*no way in hell on a file system that doesn't support it*/
#ifdef XP_OS2_VACPP
typedef unsigned short mode_t;
typedef unsigned short uid_t;
typedef unsigned short gid_t;
#define mkdir(path, mode) mkdir(path)
#define W_OK 1
#endif /* XP_OS2_VACPP */
#define touid(spam) 0
#define togid(spam) 0
#define access(spam, spam2) 0
#define chown(spam1, spam2, spam3) 0
#define lchown(spam1, spam2, spam3) 0
#define fchown(spam1, spam2, spam3) 0
#define readlink(spam1, spam2, spam3) -1
#define symlink(spam1, spam2) -1
#ifndef XP_OS2_VACPP
unsigned long DosSetFileSize(int, int);
#endif /* XP_OS2_VACPP */
#define ftruncate(spam1, spam2) (DosSetFileSize(spam1, spam2)?-1:0)
#endif /* XP_OS2 */
static void
usage(void)
{
fprintf(stderr,
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
" %*s [-DdltR] file [file ...] directory\n",
program, (int) strlen(program), "");
exit(2);
}
static int
mkdirs(char *path, mode_t mode)
{
char *cp;
struct stat sb;
int res;
int l;
/* strip trailing "/." */
l = strlen(path);
if(l > 1 && path[l - 1] == '.' && path[l - 2] == '/')
path[l - 2] = 0;
while (*path == '/' && path[1] == '/')
path++;
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
*cp = '\0';
if (cp && cp != path) {
*cp = '\0';
if ((lstat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
mkdirs(path, mode) < 0) {
return -1;
}
*cp = '/';
}
res = mkdir(path, mode);
if ((res != 0) && (errno == EEXIST))
return 0;
else
return res;
}
#ifndef XP_OS2
static uid_t
touid(char *owner)
{
struct passwd *pw;
uid_t uid;
char *cp;
pw = getpwnam(owner);
if (pw)
return pw->pw_uid;
uid = strtol(owner, &cp, 0);
if (uid == 0 && cp == owner)
fail("cannot find uid for %s", owner);
return uid;
}
static gid_t
togid(char *group)
{
struct group *gr;
gid_t gid;
char *cp;
gr = getgrnam(group);
if (gr)
return gr->gr_gid;
gid = strtol(group, &cp, 0);
if (gid == 0 && cp == group)
fail("cannot find gid for %s", group);
return gid;
}
#endif
int
main(int argc, char **argv)
{
int onlydir, dodir, dolink, dorelsymlink, dotimes, opt, len, lplen, tdlen, bnlen, exists, fromfd, tofd, cc, wc;
mode_t mode = 0755;
char *linkprefix, *owner, *group, *cp, *cwd, *todir, *toname, *name, *base, *linkname, *bp, buf[BUFSIZ];
uid_t uid;
gid_t gid;
struct stat sb, tosb, fromsb;
struct utimbuf utb;
program = argv[0];
cwd = linkname = linkprefix = owner = group = 0;
onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0;
while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) {
switch (opt) {
case 'C':
cwd = optarg;
break;
case 'D':
onlydir = 1;
break;
case 'd':
dodir = 1;
break;
case 'l':
dolink = 1;
break;
case 'L':
linkprefix = optarg;
lplen = strlen(linkprefix);
dolink = 1;
break;
case 'R':
#ifdef XP_OS2
/* treat like -t since no symbolic links on OS2 */
dotimes = 1;
#else
dolink = dorelsymlink = 1;
#endif
break;
case 'm':
mode = strtoul(optarg, &cp, 8);
if (mode == 0 && cp == optarg)
usage();
break;
case 'o':
owner = optarg;
break;
case 'g':
group = optarg;
break;
case 't':
dotimes = 1;
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
if (argc < 2 - onlydir)
usage();
todir = argv[argc-1];
if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
mkdirs(todir, 0777) < 0) {
fail("cannot make directory %s", todir);
}
if (onlydir)
return 0;
if (!cwd) {
#ifndef NEEDS_GETCWD
#ifndef GETCWD_CANT_MALLOC
cwd = getcwd(0, PATH_MAX);
#else
cwd = malloc(PATH_MAX + 1);
cwd = getcwd(cwd, PATH_MAX);
#endif
#else
cwd = malloc(PATH_MAX + 1);
cwd = getwd(cwd);
#endif
}
xchdir(todir);
#ifndef NEEDS_GETCWD
#ifndef GETCWD_CANT_MALLOC
todir = getcwd(0, PATH_MAX);
#else
todir = malloc(PATH_MAX + 1);
todir = getcwd(todir, PATH_MAX);
#endif
#else
todir = malloc(PATH_MAX + 1);
todir = getwd(todir);
#endif
tdlen = strlen(todir);
xchdir(cwd);
tdlen = strlen(todir);
uid = owner ? touid(owner) : (uid_t)(-1);
gid = group ? togid(group) : (gid_t)(-1);
while (--argc > 0) {
name = *argv++;
len = strlen(name);
base = xbasename(name);
bnlen = strlen(base);
toname = xmalloc((unsigned int)(tdlen + 1 + bnlen + 1));
sprintf(toname, "%s/%s", todir, base);
exists = (lstat(toname, &tosb) == 0);
if (dodir) {
/* -d means create a directory, always */
if (exists && !S_ISDIR(tosb.st_mode)) {
(void) unlink(toname);
exists = 0;
}
if (!exists && mkdir(toname, mode) < 0)
fail("cannot make directory %s", toname);
if ((owner || group) && chown(toname, uid, gid) < 0)
fail("cannot change owner of %s", toname);
} else if (dolink) {
if (access(name, R_OK) != 0) {
fail("cannot access %s", name);
}
if (*name == '/') {
/* source is absolute pathname, link to it directly */
linkname = 0;
} else {
if (linkprefix) {
/* -L implies -l and prefixes names with a $cwd arg. */
len += lplen + 1;
linkname = xmalloc((unsigned int)(len + 1));
sprintf(linkname, "%s/%s", linkprefix, name);
} else if (dorelsymlink) {
/* Symlink the relative path from todir to source name. */
linkname = xmalloc(PATH_MAX);
if (*todir == '/') {
/* todir is absolute: skip over common prefix. */
lplen = relatepaths(todir, cwd, linkname);
strcpy(linkname + lplen, name);
} else {
/* todir is named by a relative path: reverse it. */
reversepath(todir, name, len, linkname);
xchdir(cwd);
}
len = strlen(linkname);
}
name = linkname;
}
/* Check for a pre-existing symlink with identical content. */
#ifdef XP_OS2_VACPP
#pragma info(nocnd)
#endif
if ((exists && (!S_ISLNK(tosb.st_mode) ||
readlink(toname, buf, sizeof buf) != len ||
strncmp(buf, name, (unsigned int)len) != 0)) ||
((stat(name, &fromsb) == 0) &&
(fromsb.st_mtime > tosb.st_mtime))) {
#ifdef XP_OS2_VACPP
#pragma info(restore)
#endif
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
exists = 0;
}
if (!exists && symlink(name, toname) < 0)
fail("cannot make symbolic link %s", toname);
#ifdef HAVE_LCHOWN
if ((owner || group) && lchown(toname, uid, gid) < 0)
fail("cannot change owner of %s", toname);
#endif
if (linkname) {
free(linkname);
linkname = 0;
}
} else {
/* Copy from name to toname, which might be the same file. */
#ifdef XP_OS2_FIX
fromfd = open(name, O_RDONLY | O_BINARY);
#else
fromfd = open(name, O_RDONLY);
#endif
if (fromfd < 0 || fstat(fromfd, &sb) < 0)
fail("cannot access %s", name);
if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0))
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
#ifdef XP_OS2
chmod(toname, S_IREAD | S_IWRITE);
#endif
#ifdef XP_OS2_FIX
tofd = open(toname, O_CREAT | O_WRONLY | O_BINARY, 0666);
#else
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
#endif
if (tofd < 0)
fail("cannot create %s", toname);
bp = buf;
while ((cc = read(fromfd, bp, sizeof buf)) > 0) {
while ((wc = write(tofd, bp, (unsigned int)cc)) > 0) {
if ((cc -= wc) == 0)
break;
bp += wc;
}
if (wc < 0)
fail("cannot write to %s", toname);
}
if (cc < 0)
fail("cannot read from %s", name);
if (ftruncate(tofd, sb.st_size) < 0)
fail("cannot truncate %s", toname);
#ifndef XP_OS2
if (dotimes) {
utb.actime = sb.st_atime;
utb.modtime = sb.st_mtime;
if (utime(toname, &utb) < 0)
fail("cannot set times of %s", toname);
}
#ifdef HAVE_FCHMOD
if (fchmod(tofd, mode) < 0)
#else
if (chmod(toname, mode) < 0)
#endif
fail("cannot change mode of %s", toname);
#endif
if ((owner || group) && fchown(tofd, uid, gid) < 0)
fail("cannot change owner of %s", toname);
/* Must check for delayed (NFS) write errors on close. */
if (close(tofd) < 0)
fail("cannot write to %s", toname);
close(fromfd);
#ifdef XP_OS2
if (dotimes) {
utb.actime = sb.st_atime;
utb.modtime = sb.st_mtime;
if (utime(toname, &utb) < 0)
fail("cannot set times of %s", toname);
}
if (chmod(toname, (mode & (S_IREAD | S_IWRITE))) < 0)
fail("cannot change mode of %s", toname);
#endif
}
free(toname);
}
free(cwd);
free(todir);
return 0;
}

268
mozilla/config/obj.inc Normal file
View File

@@ -0,0 +1,268 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build 16 and 32 bit
#// object files.
#//
#//------------------------------------------------------------------------
!if !defined(CONFIG_OBJ_INC)
CONFIG_OBJ_INC=1
#// objs must be rebuilt if any of the makefiles change, otherwise compiler
#// settings and the like will be missed.
#// -- the two space definition worries me, fragile! --
!if "$(OBJS)" != " "
$(OBJS): makefile.win \
$(DEPTH)\config\rules.mak \
$(DEPTH)\config\config.mak \
$(DEPTH)\config\win32 \
$(DEPTH)\config\obj.inc
!endif
#//------------------------------------------------------------------------
#//
#// Rules for compiling 16/32 bit object files from either c or c++ source
#//
#//------------------------------------------------------------------------
.c.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
$(CURDIR)$(*B).c
<<KEEP
.c{.\$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).c
<<KEEP
{.\_jmc\}.c{.\$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)_jmc\$(*B).c
<<KEEP
.cpp.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
$(CURDIR)$(*B).cpp
<<KEEP
.cpp{.\$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).cpp
<<KEEP
{.\_jmc\}.cpp{.\$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)_jmc\$(*B).cpp
<<KEEP
#//------------------------------------------------------------------------
#//
#// Rule for compiling resource files
#//
#//------------------------------------------------------------------------
.rc{.\$(OBJDIR)\}.res:
# //
# // execute the command
# //
echo Creating Resource file: $*.res
$(RC) $(RCFLAGS) -r -Fo.\$(OBJDIR)\$(*B).res $(*B).rc
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#//
#// Rule for building simple 16 bit executables
#//
#//------------------------------------------------------------------------
.c{.\$(OBJDIR)\}.exe:
$(CC) @<<$(CFGFILE)
-c
$(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).c
<<
$(LD) @<<$(CFGFILE)
$(LFLAGS)
$(OBJDIR)\$(*B).obj,
$(OBJDIR)\$(*B).exe,
$(MAPFILE),
$(LLIBS) $(WIN_LIBS) $(OS_LIBS),
$(DEFFILE),
$(RESFILE),
<<
!else
#//------------------------------------------------------------------------
#//
#// Rule for building simple 32 bit executables
#//
#//------------------------------------------------------------------------
.c{.\$(OBJDIR)\}.exe:
$(CC) @<<$(CFGFILE)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
$(LLIBS)
$(OS_LIBS)
-Fd$(PDBFILE)
-Fe.\$(OBJDIR)\
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).c
<<KEEP
.cpp{.\$(OBJDIR)\}.exe:
$(CC) @<<$(CFGFILE)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
$(LLIBS)
$(WIN_LIBS)
$(OS_LIBS)
/link $(LFLAGS)
-Fd$(PDBFILE)
-Fe.\$(OBJDIR)\
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).cpp
<<KEEP
!endif
#//------------------------------------------------------------------------
#//
#// Rule for creating .i file containing c preprocessor output
#//
#//------------------------------------------------------------------------
.c.i:
@$(CC) @<<$(CFGFILE)
/P -c
$(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
$(CURDIR)$(*B).c
<<KEEP
.c{.\$(OBJDIR)\}.i:
@$(CC) @<<$(CFGFILE)
/P -c
$(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).c
<<KEEP
.cpp.i:
@$(CC) @<<$(CFGFILE)
/P -c
$(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
$(CURDIR)$(*B).cpp
<<KEEP
.cpp{.\$(OBJDIR)\}.i:
@$(CC) @<<$(CFGFILE)
/P -c
$(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).cpp
<<KEEP
!endif # CONFIG_OBJ_INC

134
mozilla/config/outofdate.pl Normal file
View File

@@ -0,0 +1,134 @@
#!perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
#Input: [-d dir] foo1.java foo2.java
#Compares with: foo1.class foo2.class (if -d specified, checks in 'dir',
# otherwise assumes .class files in same directory as .java files)
#Returns: list of input arguments which are newer than corresponding class
#files (non-existant class files are considered to be real old :-)
#
$found = 1;
# GLOBALS
$SEP = 0; # the paltform independent path separator
$CFG = 0; # the value of the -cfg flag
# determine the path separator
$_ = $ENV{"PATH"};
if (m|/|) {
$SEP = "/";
}
else {
$SEP = "\\";
}
if ($ARGV[0] eq '-d') {
$classdir = $ARGV[1];
$classdir .= $SEP;
shift;
shift;
} else {
$classdir = "." . $SEP;
}
# if -cfg is specified, print out the contents of the cfg file to stdout
if ($ARGV[0] eq '-cfg') {
$CFG = $ARGV[1];
shift;
shift;
}
$_ = $ARGV[0];
if (m/\*.java/) {
# Account for the fact that the shell didn't expand *.java by doing it
# manually.
&manuallyExpandArgument("java");
}
$printFile = 0;
foreach $filename (@ARGV) {
$classfilename = $classdir;
$classfilename .= $filename;
$classfilename =~ s/.java$/.class/;
# workaround to only build sun/io/* classes when necessary
# change the pathname of target file to be consistent
# with sun/io subdirectories
#
# sun/io was always getting rebuilt because the java files
# were split into subdirectories, but the package names
# remained the same. This was confusing outofdate.pl
#
$classfilename =~ s/sun\/io\/extended.\//sun\/io\//;
$classfilename =~ s/\.\.\/\.\.\/sun-java\/classsrc\///;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
$ctime,$blksize,$blocks) = stat($filename);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime,
$ctime,$blksize,$blocks) = stat($classfilename);
# print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n";
if ($mtime > $classmtime) {
# Only print the file header if we actually have some files to
# compile.
if (!$printFile) {
$printFile = 1;
&printFile($CFG);
}
print $filename, " ";
$found = 0;
}
}
print "\n";
# push onto $ARG array all filenames with extension $ext
# @param ext the extension of the file
sub manuallyExpandArgument {
local($ext) = @_;
$ext = "\." . $ext; # put it in regexp
$result = opendir(DIR, ".");
@allfiles = grep(/$ext/, readdir(DIR));
$i = 0;
foreach $file (@allfiles) {
#skip emacs save files
$_ = $file;
if (!/~/) {
$ARGV[$i++] = $file;
}
}
}
sub printFile {
local($file) = @_;
$result = open(CFG, $file);
while (<CFG>) {
chop;
print $_;
}
}

240
mozilla/config/pathsub.c Normal file
View File

@@ -0,0 +1,240 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
** Pathname subroutines.
**
** Brendan Eich, 8/29/95
*/
#include <assert.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if !defined(XP_OS2_VACPP)
#include <unistd.h>
#endif
#include <sys/stat.h>
#include "pathsub.h"
#ifdef USE_REENTRANT_LIBC
#include <libc_r.h>
#endif
#if defined(XP_OS2_VACPP)
#include <direct.h>
#include <io.h>
#include <sys/utime.h>
#include <sys/types.h>
#endif
#ifdef SUNOS4
#include "sunos4.h"
#endif
#ifndef D_INO
#define D_INO d_ino
#endif
char *program;
void
fail(char *format, ...)
{
int error;
va_list ap;
#ifdef USE_REENTRANT_LIBC
R_STRERROR_INIT_R();
#endif
error = errno;
fprintf(stderr, "%s: ", program);
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
if (error)
#ifdef USE_REENTRANT_LIBC
R_STRERROR_R(errno);
fprintf(stderr, ": %s", r_strerror_r);
#else
fprintf(stderr, ": %s", strerror(errno));
#endif
putc('\n', stderr);
exit(1);
}
char *
getcomponent(char *path, char *name)
{
if (*path == '\0')
return 0;
if (*path == '/') {
*name++ = '/';
} else {
do {
*name++ = *path++;
} while (*path != '/' && *path != '\0');
}
*name = '\0';
while (*path == '/')
path++;
return path;
}
#ifdef LAME_READDIR
#include <sys/param.h>
/*
** The static buffer in Unixware's readdir is too small.
*/
struct dirent *readdir(DIR *d)
{
static struct dirent *buf = NULL;
if(buf == NULL)
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAXPATHLEN);
return(readdir_r(d, buf));
}
#endif
char *
ino2name(ino_t ino, char *dir)
{
DIR *dp;
struct dirent *ep;
char *name;
dp = opendir("..");
if (!dp)
fail("cannot read parent directory");
for (;;) {
if (!(ep = readdir(dp)))
fail("cannot find current directory");
if (ep->D_INO == ino)
break;
}
name = xstrdup(ep->d_name);
closedir(dp);
return name;
}
void *
xmalloc(size_t size)
{
void *p = malloc(size);
if (!p)
fail("cannot allocate %u bytes", size);
return p;
}
char *
xstrdup(char *s)
{
return strcpy(xmalloc(strlen(s) + 1), s);
}
char *
xbasename(char *path)
{
char *cp;
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
*cp = '\0';
if (!cp) return path;
return cp + 1;
}
void
xchdir(char *dir)
{
if (chdir(dir) < 0)
fail("cannot change directory to %s", dir);
}
int
relatepaths(char *from, char *to, char *outpath)
{
char *cp, *cp2;
int len;
char buf[NAME_MAX];
assert(*from == '/' && *to == '/');
for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++)
if (*cp == '\0')
break;
while (cp[-1] != '/')
cp--, cp2--;
if (cp - 1 == to) {
/* closest common ancestor is /, so use full pathname */
len = strlen(strcpy(outpath, to));
if (outpath[len] != '/') {
outpath[len++] = '/';
outpath[len] = '\0';
}
} else {
len = 0;
while ((cp2 = getcomponent(cp2, buf)) != 0) {
strcpy(outpath + len, "../");
len += 3;
}
while ((cp = getcomponent(cp, buf)) != 0) {
sprintf(outpath + len, "%s/", buf);
len += strlen(outpath + len);
}
}
return len;
}
void
reversepath(char *inpath, char *name, int len, char *outpath)
{
char *cp, *cp2;
char buf[NAME_MAX];
struct stat sb;
cp = strcpy(outpath + PATH_MAX - (len + 1), name);
cp2 = inpath;
while ((cp2 = getcomponent(cp2, buf)) != 0) {
if (strcmp(buf, ".") == 0)
continue;
if (strcmp(buf, "..") == 0) {
if (stat(".", &sb) < 0)
fail("cannot stat current directory");
name = ino2name(sb.st_ino, "..");
len = strlen(name);
cp -= len + 1;
strcpy(cp, name);
cp[len] = '/';
free(name);
xchdir("..");
} else {
cp -= 3;
strncpy(cp, "../", 3);
xchdir(buf);
}
}
strcpy(outpath, cp);
}

59
mozilla/config/pathsub.h Normal file
View File

@@ -0,0 +1,59 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef pathsub_h___
#define pathsub_h___
/*
** Pathname subroutines.
**
** Brendan Eich, 8/29/95
*/
#include <limits.h>
#include <sys/types.h>
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
/*
* Just prevent stupidity
*/
#undef NAME_MAX
#define NAME_MAX 256
extern char *program;
extern void fail(char *format, ...);
extern char *getcomponent(char *path, char *name);
extern char *ino2name(ino_t ino, char *dir);
extern void *xmalloc(size_t size);
extern char *xstrdup(char *s);
extern char *xbasename(char *path);
extern void xchdir(char *dir);
/* Relate absolute pathnames from and to returning the result in outpath. */
extern int relatepaths(char *from, char *to, char *outpath);
/* XXX changes current working directory -- caveat emptor */
extern void reversepath(char *inpath, char *name, int len, char *outpath);
#endif /* pathsub_h___ */

31
mozilla/config/pkg2dpth.pl Executable file
View File

@@ -0,0 +1,31 @@
#!perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# Transform package paths to depths:
# foo/bar ==> ../..
#
# Why don't we need .. here?
$ARGV[0] =~ s@[^/\\]+@..@g;
print $ARGV[0]

View File

@@ -0,0 +1,32 @@
#! perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
require "/ns/config/fastcwd.pl";
$cur = &fastcwd;
chdir($ARGV[0]);
$newcur = &fastcwd;
$newcurlen = length($newcur);
# Skip common separating / unless $newcur is "/"
$cur = substr($cur, $newcurlen + ($newcurlen > 1));
print $cur;

View File

@@ -0,0 +1,35 @@
#! perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
unshift(@INC, '/usr/lib/perl');
unshift(@INC, '/usr/local/lib/perl');
require "fastcwd.pl";
$cur = &fastcwd;
chdir($ARGV[0]);
$newcur = &fastcwd;
$newcurlen = length($newcur);
# Skip common separating / unless $newcur is "/"
$cur = substr($cur, $newcurlen + ($newcurlen > 1));
print $cur;

793
mozilla/config/rules.mak Normal file
View File

@@ -0,0 +1,793 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the common rules shared by all other
#// makefiles.
#//
#//------------------------------------------------------------------------
!if !defined(CONFIG_RULES_MAK)
CONFIG_RULES_MAK=1
#//------------------------------------------------------------------------
#// Assumed variables by the manifest.
#//------------------------------------------------------------------------
!if !defined(PACKAGE)
PACKAGE=.
!endif # PACKAGE
!if !defined(JDK_GEN_DIR)
JDK_GEN_DIR=_gen
!endif
!if !defined(JDK_STUB_DIR)
JDK_STUB_DIR=_stubs
!endif
!if !defined(JMC_GEN_DIR)
!if defined(JAVA_OR_NSJVM)
JMC_GEN_DIR=_jmc
!else
JMC_GEN_DIR=$(LOCAL_JMC_SUBDIR)
!endif
!endif
!if !defined(JRI_GEN_DIR)
JRI_GEN_DIR=_jri
!endif
!if !defined(JNI_GEN_DIR)
JNI_GEN_DIR=_jni
!endif
#//------------------------------------------------------------------------
#// Make sure that JDIRS is set after the manifest file is included
#// and before the rules for JDIRS get generated. We cannot put this line
#// in the makefile.win after including rules.mak as the rules would already
#// be generated based on JDIRS set in manifest.mn. We cannot put in ifdefs in
#// manifest.mn too I was told.
#//------------------------------------------------------------------------
!ifdef JDIRS
JDIRS=$(JDIRS) $(JSCD)
!if "$(STAND_ALONE_JAVA)" == "1"
JDIRS=$(JDIRS) $(SAJDIRS)
!endif
!endif
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#// All public win16 headers go to a single directory
#// due to compiler limitations.
#//------------------------------------------------------------------------
MODULE=win16
!endif # 16
OBJS=$(OBJS) $(C_OBJS) $(CPP_OBJS)
include <$(DEPTH)/config/config.mak>
#//------------------------------------------------------------------------
#//
#// Specify a default target if non was set...
#//
#//------------------------------------------------------------------------
!ifndef TARGETS
TARGETS=$(PROGRAM) $(LIBRARY) $(DLL)
!endif
!ifndef MAKE_ARGS
#MAKE_ARGS=all
!endif
!if "$(WINOS)" == "WIN95"
W95MAKE=$(DEPTH)\config\w95make.exe
W32OBJS = $(OBJS:.obj=.obj, )
W32LOBJS = $(OBJS: .= +-.)
!endif
all::
$(NMAKE) -f makefile.win export
$(NMAKE) -f makefile.win install
#//------------------------------------------------------------------------
#//
#// Setup tool flags for the appropriate type of objects being built
#// (either DLL or EXE)
#//
#//------------------------------------------------------------------------
!if "$(MAKE_OBJ_TYPE)" == "DLL"
CFLAGS=$(DLL_CFLAGS) $(CFLAGS)
LFLAGS=$(DLL_LFLAGS) $(LFLAGS)
OS_LIBS=$(DLL_LIBS) $(OS_LIBS)
!else
CFLAGS=$(EXE_CFLAGS) $(CFLAGS)
LFLAGS=$(EXE_LFLAGS) $(LFLAGS)
OS_LIBS=$(EXE_LIBS) $(OS_LIBS)
!endif
#//------------------------------------------------------------------------
#//
#// Use various library names as default name for PDB Files
#//
#// LIBRARY_NAME - Static Library
#// DLLNAME - Dynamic Load Library
#//
#//
#//------------------------------------------------------------------------
# Replace optimizer and pdb related flags to use our own conventions
!ifdef LIBRARY_NAME
PDBFILE=$(LIBRARY_NAME)
!endif
# Replace optimizer and pdb related flags to use our own conventions
!ifdef DLLNAME
PDBFILE=$(DLLNAME)
!endif
#//------------------------------------------------------------------------
#//
#// Prepend the "object directory" to any public make variables.
#// PDBFILE - File containing debug info
#// RESFILE - Compiled resource file
#// MAPFILE - MAP file for an executable
#//
#//------------------------------------------------------------------------
!ifdef PDBFILE
PDBFILE=.\$(OBJDIR)\$(PDBFILE).pdb
!else
PDBFILE=.\$*.pdb # used for executables
!endif
!ifdef RESFILE
RESFILE=.\$(OBJDIR)\$(RESFILE)
!endif
!ifdef MAPFILE
MAPFILE=.\$(OBJDIR)\$(MAPFILE)
!endif
!ifdef DIRS
#//------------------------------------------------------------------------
#//
#// Rule to recursively make all subdirectories specified by the DIRS target
#//
#//------------------------------------------------------------------------
$(DIRS)::
!if "$(WINOS)" == "WIN95"
!if defined(VERBOSE)
@echo +++ make: cannot recursively make on win95 using command.com, use w95make.
!endif
!else
@echo +++ make: %MAKE_ARGS% in $(MAKEDIR)\$@
@cd $@
@$(NMAKE) -f makefile.win %%MAKE_ARGS%%
@cd $(MAKEDIR)
!endif
!endif # DIRS
#//------------------------------------------------------------------------
#//
#// Created directories
#//
#//------------------------------------------------------------------------
$(JAVA_DESTPATH):
!if "$(AWT_11)" == "1"
-mkdir $(XPDIST:/=\)\classes11
!else
-mkdir $(XPDIST:/=\)\classes
!endif
$(JAVA_DESTPATH)\$(PACKAGE): $(JAVA_DESTPATH)
!if "$(AWT_11)" == "1"
-mkdir $(XPDIST:/=\)\classes11\$(PACKAGE:/=\)
!else
-mkdir $(XPDIST:/=\)\classes\$(PACKAGE:/=\)
!endif
$(JMCSRCDIR):
-mkdir $(JMCSRCDIR)
$(PUBLIC):
-mkdir $(XPDIST:/=\)\include
!ifdef IDL_GEN
#//------------------------------------------------------------------------
#//
#// IDL Stuff
#//
#//------------------------------------------------------------------------
idl::
@echo +++ make: Starting osagent
@start $(DEPTH)\modules\iiop\tools\win32\osagent
@echo +++ make: idl2java $(IDL_GEN)
@type <<cmd.cfg
$(IDL2JAVA_FLAGS) $(IDL_GEN)
<<
@$(IDL2JAVA_PROG) -argfile cmd.cfg
@del cmd.cfg
!endif # IDL_GEN
TMPDIR=$(MOZ_SRC)\tmp
$(TMPDIR):
-mkdir $(TMPDIR)
!if defined(INSTALL_FILE_LIST) && defined(INSTALL_DIR)
#//------------------------------------------------------------------------
#//
#// Rule to install the files specified by the INSTALL_FILE_LIST variable
#// into the directory specified by the INSTALL_DIR variable
#//
#//------------------------------------------------------------------------
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#// All public win16 headers go to a single directory
#// due to compiler limitations.
#//------------------------------------------------------------------------
INSTALL_DIR=$(PUBLIC)\win16
!endif # 16
INSTALL_FILES: $(INSTALL_FILE_LIST)
!$(MAKE_INSTALL) $** $(INSTALL_DIR)
!endif # INSTALL_FILES
!ifdef LIBRARY_NAME
LIBRARY=$(OBJDIR)\$(LIBRARY_NAME)$(LIBRARY_SUFFIX).lib
!endif
#//------------------------------------------------------------------------
#//
#// Global rules...
#//
#//------------------------------------------------------------------------
#//
#// Set the MAKE_ARGS variable to indicate the target being built... This is used
#// when processing subdirectories via the $(DIRS) rule
#//
#
# Nasty hack to get around the win95 shell's inability to set
# environment variables whilst in a set of target commands
#
!if "$(WINOS)" == "WIN95"
clean::
!ifdef DIRS
@$(W95MAKE) clean $(MAKEDIR) $(DIRS)
!endif
-$(RM) $(OBJS) $(NOSUCHFILE) NUL 2> NUL
clobber::
!ifdef DIRS
@$(W95MAKE) clobber $(MAKEDIR) $(DIRS)
!endif
clobber_all::
!ifdef DIRS
@$(W95MAKE) clobber_all $(MAKEDIR) $(DIRS)
!endif
export::
!ifdef DIRS
@$(W95MAKE) export $(MAKEDIR) $(DIRS)
!endif # DIRS
install::
!ifdef DIRS
@$(W95MAKE) install $(MAKEDIR) $(DIRS)
!endif # DIRS
depend::
!ifdef DIRS
@$(W95MAKE) depend $(MAKEDIR) $(DIRS)
!endif # DIRS
mangle::
!ifdef DIRS
@$(W95MAKE) mangle $(MAKEDIR) $(DIRS)
!endif # DIRS
$(MAKE_MANGLE)
unmangle::
!ifdef DIRS
@$(W95MAKE) unmangle $(MAKEDIR) $(DIRS)
!endif # DIRS
-$(MAKE_UNMANGLE)
!else
clean::
@set MAKE_ARGS=$@
clobber::
@set MAKE_ARGS=$@
clobber_all::
@set MAKE_ARGS=$@
export::
@set MAKE_ARGS=$@
libs::
@set MAKE_ARGS=$@
install::
@set MAKE_ARGS=$@
mangle::
@set MAKE_ARGS=$@
unmangle::
@set MAKE_ARGS=$@
depend::
@set MAKE_ARGS=$@
!endif
#//------------------------------------------------------------------------
#// DEPEND
#//
#// If you ever need to change the set of includes (e.g., you go whack
#// the build rules over in obj.inc), make sure to update the input
#// to $(MAKEDEP). It only looks through the directories that you tell
#// it to.
#//
#//------------------------------------------------------------------------
MAKEDEP=$(MOZ_SRC)\mozilla\config\makedep.exe
MAKEDEPFILE=.\$(OBJDIR:/=\)\make.dep
MAKEDEPDETECT=$(OBJS)
MAKEDEPDETECT=$(MAKEDEPDETECT: =)
MAKEDEPDETECT=$(MAKEDEPDETECT: =)
!if !defined(NODEPEND) && "$(MAKEDEPDETECT)" != ""
depend:: $(OBJDIR)
@echo Analyzing dependencies...
$(MAKEDEP) -s -o $(MAKEDEPFILE) @<<
$(LINCS)
$(LINCS_1)
$(INCS)
-I$(MAKEDIR)
$(OBJS)
<<
!endif
!IF EXIST($(MAKEDEPFILE))
!INCLUDE <$(MAKEDEPFILE)>
!ENDIF
export:: $(DIRS)
libs::
@echo The libs build phase is obsolete.
install:: $(DIRS) $(LIBRARY)
depend:: $(DIRS)
mangle:: $(DIRS)
$(MAKE_MANGLE)
unmangle:: $(DIRS)
-$(MAKE_UNMANGLE)
alltags::
@echo +++ Making emacs tags
c:\\mksnt\\find . -name dist -prune -o ( -name '*.[hc]' -o -name '*.cpp' -o -name '*.idl' ) -print | c:\\mksnt\\xargs etags -a
#//------------------------------------------------------------------------
#//
#// Rule to create the object directory (if necessary)
#//
#//------------------------------------------------------------------------
$(OBJDIR):
@echo +++ make: Creating directory: $(OBJDIR)
-mkdir $(OBJDIR)
#//------------------------------------------------------------------------
#//
#// Include the makefile for building the various targets...
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/obj.inc>
include <$(DEPTH)/config/exe.inc>
include <$(DEPTH)/config/dll.inc>
include <$(DEPTH)/config/lib.inc>
include <$(DEPTH)/config/java.inc>
#//------------------------------------------------------------------------
#//
#// EXPORTS
#//
#// Names of headers to be copied to common include directory
#//
#//------------------------------------------------------------------------
!if "$(EXPORTS)" != "$(NULL)"
export:: $(EXPORTS)
@echo +++ make: exporting headers
$(MAKE_INSTALL:/=\) $(MKCPYFLAGS) $(EXPORTS) $(PUBLIC)
#// don't delete exported stuff on a local clobber, use clobber_all
#clobber::
#!if exist($(PUBLIC))
# @cd $(PUBLIC)
# -$(RM) $(EXPORTS)
# @cd $(MAKEDIR)
#!endif # $(PUBLIC) exists
clobber_all::
!if exist($(PUBLIC))
@cd $(PUBLIC)
-$(RM) $(EXPORTS)
@cd $(MAKEDIR)
!endif # $(PUBLIC) exists
!endif # EXPORTS
#//------------------------------------------------------------------------
#// These rules must follow all lines that define the macros they use
#//------------------------------------------------------------------------
!if defined(JAVA_OR_NSJVM)
GARBAGE = $(GARBAGE) $(JMC_GEN_DIR) $(JMC_HEADERS) $(JMC_STUBS) \
$(JDK_STUB_DIR) $(JRI_GEN_DIR) $(JDK_GEN_DIR) $(JNI_GEN_DIR)
!endif
clean:: $(DIRS)
-$(RM) $(OBJS) $(NOSUCHFILE) NUL 2> NUL
clobber:: $(DIRS)
!if defined(GARBAGE) || exist($(OBJDIR))
-$(RM_R) $(GARBAGE) $(OBJDIR) 2> NUL
!endif
clobber_all:: $(DIRS)
!if defined(GARBAGE) || "$(TARGETS)" != " " || exist($(OBJDIR))
-$(RM_R) $(TARGETS) $(GARBAGE) $(OBJDIR) 2> NUL
!endif
!if "$(MOZ_BITS)"=="32"
CFLAGS = $(CFLAGS) -DNO_JNI_STUBS
!endif
#//------------------------------------------------------------------------
#// XPIDL rules
#//------------------------------------------------------------------------
!if "$(XPIDLSRCS)" != "$(NULL)"
!if "$(MODULE)" != "$(NULL)"
# Generate header files and type libraries from the XPIDLSRCS variable.
.SUFFIXES: .idl .xpt
# XXX Note the direct use of '.\_xpidlgen' instead of
# $(XPIDL_GEN_DIR). 'nmake' is too stupid to deal with recursive macro
# substitution.
XPIDL_INCLUDES=$(XPIDL_INCLUDES) -I$(XPDIST)\idl
XPIDL_HEADERS=$(XPIDLSRCS:.idl=.h)
XPIDL_HEADERS=$(XPIDL_HEADERS:.\=.\_xpidlgen\)
!ifndef NO_GEN_XPT
XPIDL_TYPELIBS=$(XPIDLSRCS:.idl=.xpt)
XPIDL_TYPELIBS=$(XPIDL_TYPELIBS:.\=.\_xpidlgen\)
.idl{$(XPIDL_GEN_DIR)}.xpt:
$(XPIDL_PROG) -m typelib -w $(XPIDL_INCLUDES) -o $* $<
!ifndef XPIDL_MODULE
XPIDL_MODULE = $(MODULE)
!endif
TYPELIB = $(XPIDL_GEN_DIR)\$(XPIDL_MODULE).xpt
$(TYPELIB): $(XPIDL_TYPELIBS) $(XPTLINK_PROG)
@echo +++ make: Creating typelib: $(TYPELIB)
$(XPTLINK_PROG) $(TYPELIB) $(XPIDL_TYPELIBS)
!endif
$(XPIDL_GEN_DIR):
@echo +++ make: Creating directory: $(XPIDL_GEN_DIR)
-mkdir $(XPIDL_GEN_DIR)
$(XPIDL_HEADERS): $(XPIDL_PROG)
.idl{$(XPIDL_GEN_DIR)}.h:
$(XPIDL_PROG) -m header -w $(XPIDL_INCLUDES) -o $* $<
$(DIST)\include:
@echo +++ make: Creating directory: $(DIST)\include
-mkdir $(DIST)\include
$(XPDIST)\idl:
@echo +++ make: Creating directory: $(XPDIST)\idl
-mkdir $(XPDIST)\idl
export:: $(XPDIST)\idl
@echo +++ make: exporting IDL files
$(MAKE_INSTALL) $(XPIDLSRCS:/=\) $(XPDIST)\idl
export:: $(XPIDL_GEN_DIR) $(XPIDL_HEADERS) $(PUBLIC)
@echo +++ make: exporting generated XPIDL header files
$(MAKE_INSTALL) $(XPIDL_HEADERS:/=\) $(PUBLIC)
!ifndef NO_GEN_XPT
install:: $(XPIDL_GEN_DIR) $(TYPELIB)
@echo +++ make: installing typelib '$(TYPELIB)' to components directory
$(MAKE_INSTALL) $(TYPELIB) $(DIST)\bin\components
!endif
clobber::
-$(RM_R) $(XPIDL_GEN_DIR) 2> NUL
clobber_all::
-$(RM_R) $(XPIDL_GEN_DIR) 2> NUL
!if exist($(PUBLIC))
@cd $(PUBLIC)
-$(RM) $(XPIDLSRCS:.idl=.h)
@cd $(MAKEDIR)
!endif
!if exist($(XPDIST:/=\)\idl)
@cd $(XPDIST:/=\)\idl
-$(RM) $(XPIDLSRCS)
@cd $(MAKEDIR)
!endif
!if exist($(DIST)\bin\components)
-$(RM) $(DIST)\bin\components\$(XPIDL_MODULE).xpt
!endif
!endif
!endif
################################################################################
## CHROME PACKAGING
JAR_MANIFEST = jar.mn
chrome::
install:: chrome
!ifdef MOZ_DISABLE_JAR_PACKAGING
_JAR_FLAT_FILES_ONLY=-f
_JAR_REGCHROME_JAR=1
!else
_JAR_FLAT_FILES_ONLY=
_JAR_REGCHROME_JAR=0
!endif
!if "$(OS_TARGET)" == "WIN95"
_NO_FLOCK=-l
!else
_NO_FLOCK=
!endif
REGCHROME = @perl $(DEPTH)\config\add-chrome.pl $(_NO_FLOCK) $(DIST)\bin\chrome\installed-chrome.txt $(_JAR_REGCHROME_JAR)
!ifndef MOZ_OLD_JAR_PACKAGING
!if exist($(JAR_MANIFEST))
chrome:: $(CHROME_DEPS)
$(PERL) $(DEPTH)\config\make-jars.pl $(_JAR_FLAT_FILES_ONLY) $(_NO_FLOCK) -d $(DIST)\bin\chrome < $(JAR_MANIFEST)
!endif
regchrome:
!else # !MOZ_OLD_JAR_PACKAGING
################################################################################
# Generate chrome building rules.
#
# You need to set these in your makefile.win to utilize this support:
# CHROME_DIR - specifies the chrome subdirectory where your chrome files
# go; e.g., CHROME_DIR=navigator or CHROME_DIR=global
#
# Note: All file listed in the next three macros MUST be prefaced with .\ (or ./)!
#
# CHROME_CONTENT - list of chrome content files; these can be prefaced with
# arbitrary paths; e.g., CHROME_CONTENT=./content/default/foobar.xul
# CHROME_SKIN - list of skin files
# CHROME_L10N - list of localization files, e.g., CHROME_L10N=./locale/en-US/foobar.dtd
#
# These macros are optional, if not specified, each defaults to ".".
# CHROME_CONTENT_DIR - Specifies a subdirectory within CHROME_DIR where
# all CHROME_CONTENT files will be installed.
# CHROME_SKIN_DIR - Like above, but for skin files
# CHROME_L10N_DIR - Like above, but for localization files
# CHROME_TYPE - The type of chrome being generated (content, skin, locale).
# Top-level makefiles (the same one copying the rdf manifests
# and generating the jar file) should define this macro.
# This will notify the chrome registry of a new installation.
!if "$(CHROME_DIR)" != "$(NULL)"
# Figure out root of chrome dist dir.
CHROME_DIST=$(DIST)\bin\chrome\$(CHROME_DIR:/=\)
# Content
!if "$(CHROME_CONTENT)" != "$(NULL)"
CHROME_CONTENT=$(CHROME_CONTENT:/=\)
# Content goes to CHROME_DIR unless specified otherwise.
!if "$(CHROME_CONTENT_DIR)" == "$(NULL)"
CHROME_CONTENT_DIR=.
!endif
# Export content files by copying to dist.
chrome:: $(CHROME_CONTENT:.\=INSTALL\.\)
# Pseudo-target specifying how to install content files.
$(CHROME_CONTENT:.\=INSTALL\.\):
$(MAKE_INSTALL) $(@:INSTALL\.=.) $(CHROME_DIST)\$(CHROME_CONTENT_DIR)
# Clobber content files.
clobber_all:: $(CHROME_CONTENT:.\=CLOBBER\.\)
# Pseudo-target specifying how to clobber content files.
$(CHROME_CONTENT:.\=CLOBBER\.\):
-@$(RM) $(CHROME_DIST)\$(CHROME_CONTENT_DIR)\$(@:CLOBBER\.=.)
!endif # content
# Skin
!if "$(CHROME_SKIN)" != "$(NULL)"
CHROME_SKIN=$(CHROME_SKIN:/=\)
# Skin goes to CHROME_DIR unless specified otherwise.
!if "$(CHROME_SKIN_DIR)" == "$(NULL)"
CHROME_SKIN_DIR=.
!endif
# Export skin files by copying to dist.
chrome:: $(CHROME_SKIN:.\=INSTALL\.\)
# Pseudo-target specifying how to install chrome files.
$(CHROME_SKIN:.\=INSTALL\.\):
$(MAKE_INSTALL) $(@:INSTALL\.=.) $(CHROME_DIST)\$(CHROME_SKIN_DIR)
# Clobber content files.
clobber_all:: $(CHROME_SKIN:.\=CLOBBER\.\)
# Pseudo-target specifying how to clobber content files.
$(CHROME_SKIN:.\=CLOBBER\.\):
-@$(RM) $(CHROME_DIST)\$(CHROME_SKIN_DIR)\$(@:CLOBBER\.=.)
!endif # skin
# Localization.
!if "$(CHROME_L10N)" != "$(NULL)"
CHROME_L10N=$(CHROME_L10N:/=\)
# L10n goes to CHROME_DIR unless specified otherwise.
!if "$(CHROME_L10N_DIR)" == "$(NULL)"
CHROME_L10N_DIR=.
!endif
# Export l10n files by copying to dist.
chrome:: $(CHROME_L10N:.\=INSTALL\.\)
# Pseudo-target specifying how to install l10n files.
$(CHROME_L10N:.\=INSTALL\.\):
$(MAKE_INSTALL) $(@:INSTALL\.=.) $(CHROME_DIST)\$(CHROME_L10N_DIR)
# Clobber l10n files.
clobber_all:: $(CHROME_L10N:.\=CLOBBER\.\)
# Pseudo-target specifying how to clobber l10n files.
$(CHROME_L10N:.\=CLOBBER\.\):
-@$(RM) $(CHROME_DIST)\$(CHROME_L10N_DIR)\$(@:CLOBBER\.=.)
!endif # localization
# miscellaneous chrome
!if "$(CHROME_MISC)" != "$(NULL)"
CHROME_MISC=$(CHROME_MISC:/=\)
# misc goes to CHROME_DIR unless specified otherwise.
!if "$(CHROME_MISC_DIR)" == "$(NULL)"
CHROME_MISC_DIR=.
!endif
# Export misc files by copying to dist.
chrome:: $(CHROME_MISC:.\=INSTALL\.\)
# Pseudo-target specifying how to install misc files.
$(CHROME_MISC:.\=INSTALL\.\):
$(MAKE_INSTALL) $(@:INSTALL\.=.) $(CHROME_DIST)\$(CHROME_MISC_DIR)
# Clobber misc files.
clobber_all:: $(CHROME_MISC:.\=CLOBBER\.\)
# Pseudo-target specifying how to clobber misc files.
$(CHROME_MISC:.\=CLOBBER\.\):
-@$(RM) $(CHROME_DIST)\$(CHROME_MISC_DIR)\$(@:CLOBBER\.=.)
!endif # miscellaneous chrome
!ifdef MOZ_DISABLE_JAR_PACKAGING
!if "$(CHROME_TYPE)" != "$(NULL)"
chrome::
-for %t in ($(CHROME_TYPE)) do echo %t,install,url,resource:/chrome/$(CHROME_DIR:\=/)/ >>$(DIST)\bin\chrome\installed-chrome.txt
!endif
!endif
chrome::
@echo.
@echo ****************** IF YOU ADD OR REMOVE CHROME FILES, PLEASE UPDATE $(MAKEDIR)\$(JAR_MANIFEST) (or tell warren@netscape.com) **********************
@echo.
!endif # chrome
regchrome:
!if !defined(MOZ_DISABLE_JAR_PACKAGING)
$(PERL) $(DEPTH)\config\zipchrome.pl win32 update $(DIST)\bin\chrome
$(PERL) $(DEPTH)\config\installchrome.pl win32 jar $(DIST)\bin\chrome
!else
# XXX do it this way once everyone has perl installed. For now some
# people apparently have trouble with that so do the rules.mak stuff instead
# $(PERL) $(DEPTH)\config\installchrome.pl win32 resource $(DIST)\bin\chrome
!endif
!endif # !MOZ_OLD_JAR_PACKAGING
################################################################################
# Easier than typing it by hand, works from any directory:
debug::
start msdev $(DIST)\bin\mozilla.exe
# Easier than typing it by hand, works from any directory:
run::
$(DIST)\bin\mozilla.exe
################################################################################
!endif # CONFIG_RULES_MAK
################################################################################

1471
mozilla/config/rules.mk Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,156 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla Communicator client code.
#
# 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):
#
# set-timebomb.pl --- set the timebomb to N days from today's date.
# Created: Jamie Zawinski <jwz@mozilla.org>, 24-Aug-98.
my $progname = $0;
my $contents;
# This is the preferences file that gets read and written.
# So run this script with src/mozilla/build/ as the current directory.
#
my $sourcefile = "../xpfe/xpviewer/src/nsViewerApp.cpp";
# from noah, who should be shot
sub ctime {
local (@weekday, @month, $time, $TZ);
local ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
@weekday = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
@month = ("Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
$time = (length (@_) > 0)? $_[0] : time() ;
$TZ = defined($ENV{'TZ'}) ? ( $ENV{'TZ'} ? $ENV{'TZ'} : 'UTC' ) : '';
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
($TZ eq 'UTC') ? gmtime($time) : localtime($time);
if ($TZ =~ /^([^:\d+\-,]{3,})([+-]?\d{1,2}(:\d{1,2}){0,2})([^\d+\-,]{3,})?/o)
{
$TZ = $isdst ? $4 : $1;
}
if ($TZ ne "") { $TZ .= " "; }
$year += ($year < 70) ? 2000 : 1900;
#return sprintf ("%s %s %02d %02d:%02d:%02d %s%4d",
# $weekday[$wday], $month[$mon], $mday, $hour, $min, $sec,
# $TZ, $year);
# the following is for shaver's timebomb hack
return sprintf ("%s %02d %2d %02d:%02d:%02d",
$month[$mon], $mday, $year, $hour, $min, $sec);
}
sub read_file {
$contents = "";
open(IN, "<$sourcefile");
while (<IN>) {
$contents .= $_;
}
close(IN);
}
sub write_file {
open(OUT, ">$sourcefile");
print OUT $contents;
close(OUT);
print STDERR "$progname: wrote $sourcefile\n";
}
sub get_pref {
my ($lvalue) = @_;
$_ = $contents;
die ("$lvalue unset?\n") unless m@^config\("$lvalue","(.*)"\);@m;
return $1;
}
sub set_pref {
my ($lvalue,$rvalue) = @_;
$_ = $contents;
# die("$lvalue unset?\n") unless (m@^(pref|config)\("$lvalue",@m);
die("$lvalue unset?\n")
unless s@^(pref|config)(\("$lvalue",)(.*)(\).*)$@$1$2$rvalue$4@m;
$contents = $_;
}
sub set_bomb {
my ($warning_days, $bomb_days) = @_;
# support no warning days so that user is confronted with warnings
# on every launch of Mozilla. cyeh@netscape.com
#
# die("warning_days ($warning_days) must be greater than 0.")
# unless ($warning_days > 0);
die("bomb_days ($bomb_days) must be greater than 0.")
unless ($bomb_days > 0);
die("warning_days ($warning_days) must be less than " .
"bomb_days ($bomb_days)\n")
unless ($warning_days < $bomb_days);
my $now = time;
my $bomb = $now + ($bomb_days * 24 * 60 * 60);
my $warn = $now + ($warning_days * 24 * 60 * 60);
$bomb = ctime($bomb); #convert for the timebomb-code-of-the-week
$_ = $contents;
s@/\*\s*TIMEBOMB_GOES_HERE\s*\*/@\#define MOZ_TIMEBOMB "$bomb"@;
$contents = $_;
print STDERR sprintf("%s: timebomb goes off in %2d days (%s)\n",
$progname, $bomb_days, $bomb);
# $progname, $bomb_days, ctime($bomb));
print STDERR sprintf("%s: warning goes off in %2d days (%s)\n",
$progname, $warning_days, ctime($warn));
}
sub main {
my ($warning_days, $bomb_days) = @_;
die ("usage: $progname [ days-until-warning [ days-until-timebomb ]]\n")
if ($#_ >= 2);
if ($#_ == 0) {
$bomb_days = $warning_days;
$warning_days = -1;
}
if (!$bomb_days || $bomb_days <= 0) {
$bomb_days = 30;
}
if ($warning_days < 0) {
$warning_days = $bomb_days - int($bomb_days / 3);
if ($warning_days < $bomb_days - 10) {
$warning_days = $bomb_days - 10;
}
}
read_file();
set_bomb($warning_days, $bomb_days);
write_file();
return 0;
}
exit(&main(@ARGV));

93
mozilla/config/sj.pl Executable file
View File

@@ -0,0 +1,93 @@
#!perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# Input: output_class_dir argfile javafilelist
#
$classdir = $ARGV[0];
$argfile = $ARGV[1];
$filelist = $ARGV[2];
shift;
$sjcmd = $ENV{'MOZ_TOOLS'} . '\bin\sj.exe';
open(FL, "<$filelist" ) || die "can't open $filelist for reading";
while( <FL> ){
# print;
@java_files = (@java_files, split(/[ \t\n]/));
}
close (FL);
open(FL, "<$argfile" ) || die "can't open $argfile for reading";
while( <FL> ){
chop;
$args .= $_;
}
close (FL);
print "Java Files: @java_files\n";
# compile as many java files as we can in one invocation
# given the limitations of the command line
foreach $filename (@java_files) {
$classfilename = $classdir;
$classfilename .= $filename;
$classfilename =~ s/.java$/.class/;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
$ctime,$blksize,$blocks) = stat($filename);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime,
$ctime,$blksize,$blocks) = stat($classfilename);
# print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n";
if ($mtime > $classmtime) {
# are we too big?
$len += length($filename);
if( $len >= 512 ) {
print "$sjcmd $args $outofdate\n";
$status = system "$sjcmd $args $outofdate";
if( $status != 0 ) {
exit( $status / 256 );
}
$outofdate = "";
$len = length($filename);
}
$outofdate .= $filename;
$outofdate .= " ";
}
}
if( length($outofdate) > 0 ) {
print "$sjcmd $args $outofdate\n";
$status = system "$sjcmd $args $outofdate";
if( $status != 0 ) {
exit( $status / 256 );
}
} else {
print "Files are up to date.\n";
}
print "\n";

283
mozilla/config/trace.cpp Normal file
View File

@@ -0,0 +1,283 @@
/* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
*/
/*
This is part of a MOZ_COVERAGE build. (set MOZ_COVERAGE=1 and rebuild)
When trace.dll is linked in to the build, it counts the number of times
each function is called. When the program exits, it breaks out the
functions by module, sorts them by number of calls, then dumps them into
win32.order where the module is built. The order files are used by the
liker to rearrange the functions in the library.
*/
#include <windows.h>
#include <imagehlp.h>
#include <stdio.h>
#include "pldhash.h"
class Reporter {
public:
~Reporter();
};
static Reporter theReporter;
/*
Hash of function names, and call counts]
*/
static PLDHashTable Calls;
struct CallEntry {
struct PLDHashEntryHdr hdr;
const void* addr;
unsigned count;
};
static PLDHashTableOps Ops = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashGetKeyStub,
PL_DHashVoidPtrKeyStub,
PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub,
PL_DHashClearEntryStub,
PL_DHashFinalizeStub
};
class Node {
public:
Node() {function = 0; count = 0; next = 0;};
char* function;
int count;
Node* next;
};
/*
Hash of each module. Contains a sorted linked list of each function and
its number of calls for that module.
*/
static PLDHashTable Modules;
struct ModulesEntry {
struct PLDHashEntryHdr hdr;
char* moduleName;
Node* byCount;
};
BOOL CRT_CALL
ModuleMatchEntry(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry,
const void* aKey)
{
ModulesEntry* mod = (ModulesEntry*) aEntry;
return ( !strcmp(mod->moduleName,(char*)aKey) );
}
static PLDHashTableOps ModOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashGetKeyStub,
PL_DHashStringKey,
ModuleMatchEntry, // PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub,
PL_DHashClearEntryStub,
PL_DHashFinalizeStub
};
/*
Counts the number of times a function is called.
*/
extern "C"
static void
Log(void* addr)
{
static int initialized = 0;
addr = (void*) ((unsigned) addr - 5);
if (! initialized) {
initialized = 1;
PL_DHashTableInit(&Calls, &Ops, 0, sizeof(CallEntry), 16);
}
CallEntry* entry
= (CallEntry*) PL_DHashTableOperate(&Calls, addr, PL_DHASH_LOOKUP);
if (PL_DHASH_ENTRY_IS_FREE(&entry->hdr)) {
entry = (CallEntry*) PL_DHashTableOperate(&Calls, addr, PL_DHASH_ADD);
entry->addr = addr;
entry->count = 0;
}
++entry->count;
}
/*
assembly to call Log, and count this function
*/
extern "C"
__declspec(naked dllexport)
void _penter()
{
__asm {
push ecx // save ecx for caller
push dword ptr [esp+4] // the caller's address is the only param
call Log // ...to Log()
add esp,4
pop ecx // restore ecx for caller
ret
}
}
/*
Steps through the hash of modules and dumps the function counts out to
win32.order
*/
static PLDHashOperator CRT_CALL
DumpFiles(PLDHashTable* table, PLDHashEntryHdr* hdr,
PRUint32 number, void* arg)
{
ModulesEntry* entry = (ModulesEntry*) hdr;
Node* cur = entry->byCount;
char dest[256];
char ilkName[256];
FILE* orderFile;
strcpy(ilkName, entry->moduleName);
strcat(ilkName, ".ilk");
if ( !::FindExecutableImage(ilkName, MOZ_SRC, dest) ) {
printf("+++ERROR Could not find %s\n",ilkName);
return PL_DHASH_NEXT;
}
dest[strlen(dest)-strlen(ilkName)-strlen("WIN32_D.OBJ\\")] = 0;
strcat(dest,"win32.order");
orderFile = fopen(dest,"w");
printf("Creating order file %s\n",dest);
while( cur ) {
fprintf(orderFile,"%s ; %d\n", cur->function, cur->count );
cur = cur->next;
}
fflush(orderFile);
fclose(orderFile);
return PL_DHASH_NEXT;
}
/*
We have a function name. Figure out which module it is from. Then add that
function and its call count into the module's sorted list.
*/
static PLDHashOperator CRT_CALL
ListCounts(PLDHashTable* table, PLDHashEntryHdr* hdr,
PRUint32 number, void* arg)
{
BOOL ok;
CallEntry* entry = (CallEntry*) hdr;
IMAGEHLP_MODULE module;
module.SizeOfStruct = sizeof(module);
ok = ::SymGetModuleInfo(::GetCurrentProcess(),
(unsigned) entry->addr,
&module);
char buf[sizeof(IMAGEHLP_SYMBOL) + 512];
PIMAGEHLP_SYMBOL symbol = (PIMAGEHLP_SYMBOL) buf;
symbol->SizeOfStruct = sizeof(buf);
symbol->MaxNameLength = 512;
DWORD displacement;
ok = ::SymGetSymFromAddr(::GetCurrentProcess(),
(unsigned) entry->addr,
&displacement,
symbol);
if (ok)
{
static int modInitialized = 0;
if (! modInitialized) {
modInitialized = 1;
PL_DHashTableInit(&Modules, &ModOps, 0, sizeof(ModulesEntry), 16);
}
ModulesEntry* mod
= (ModulesEntry*) PL_DHashTableOperate(&Modules,
module.ModuleName,
PL_DHASH_LOOKUP);
if (PL_DHASH_ENTRY_IS_FREE(&mod->hdr)) {
mod = (ModulesEntry*) PL_DHashTableOperate(&Modules,
module.ModuleName,
PL_DHASH_ADD);
mod->moduleName = strdup(module.ModuleName);
mod->byCount = new Node();
mod->byCount->function = strdup(symbol->Name);
mod->byCount->count = entry->count;
} else {
// insertion sort.
Node* cur = mod->byCount;
Node* foo = new Node();
foo->function = strdup(symbol->Name);
foo->count = entry->count;
if ( cur->count < entry->count ) {
foo->next = mod->byCount;
mod->byCount = foo;
} else {
while ( cur->next ) {
if ( cur->next->count > entry->count ) { cur = cur->next; }
else { break; }
}
foo->next = cur->next;
cur->next = foo;
}
}
} // if (ok)
return PL_DHASH_NEXT;
}
Reporter::~Reporter()
{
SymInitialize(GetCurrentProcess(), 0, TRUE);
DWORD options = SymGetOptions();
// We want the nasty name, as we'll have to pass it back to the
// linker.
options &= ~SYMOPT_UNDNAME;
SymSetOptions(options);
// break the function names out by module and sort them.
PL_DHashTableEnumerate(&Calls, ListCounts, NULL);
// dump the order files for each module.
PL_DHashTableEnumerate(&Modules, DumpFiles, NULL);
SymCleanup(GetCurrentProcess());
}

22
mozilla/config/true.bat Normal file
View File

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

1
mozilla/config/xterm.str Normal file
View File

@@ -0,0 +1 @@
]2;gmake: Y

207
mozilla/config/zipcfunc.pl Normal file
View File

@@ -0,0 +1,207 @@
#!perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla 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-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
#
use Cwd;
return(1);
sub ZipChrome()
{
# inOsType - Os type
# inUpdate - update or noupdate
# update - enables time/date compare file update of chrome archives
# noupdate - disables time/date compare file update of chrome archives.
# it will always update chrome files regardless of time/date stamp.
# inSourcePath - path to where the tmpchrome dir
# inTargetPath - path to where the bin\chrome dir
($inOsType, $inUpdate, $inSourcePath, $inTargetPath) = @_;
# check Os type
if($inOsType =~ /win32/i)
{
$gPathDelimiter="\\";
}
elsif($inOsType =~ /mac/i)
{
$gPathDelimiter=":";
}
elsif($inOsType =~ /unix/i)
{
$gPathDelimiter="/";
}
else
{
return(2);
}
# Verify Update
if(!($inUpdate =~ /update/i) &&
!($inUpdate =~ /noupdate/i))
{
return(2);
}
if($inOsType =~ /win32/i)
{
# Convert all '/' to '\\' or else win32 will have problems
$inSourcePath =~ s/\//\\/g;
$inTargetPath =~ s/\//\\/g;
}
# Make sure $inSourcePath exists
if(!(-e "$inSourcePath"))
{
return(1);
}
# Make sure $inTargetPath exists
if(!(-e "$inTargetPath"))
{
mkdir("$inTargetPath", 775);
}
# Call CreateArchive() on locales, packages, and skins
# CreateArchive("loc", $inSourcePath . $gPathDelimiter . "locales", "$inTargetPath");
# CreateArchive("pkg", $inSourcePath . $gPathDelimiter . "packages", "$inTargetPath");
# CreateArchive("skn", $inSourcePath . $gPathDelimiter . "skins", "$inTargetPath");
CreateArchive("jar", $inSourcePath . $gPathDelimiter, "$inTargetPath");
return(0);
}
sub CreateArchive()
{
my($inExtension, $inSrc, $inDest) = @_;
my($dir);
my(@dirList);
my(@dirItem);
my($dirName);
my($saveCwdir);
my($mZipParam);
# Make sure $inSrc exists
if(!(-e "$inSrc"))
{
return(0);
}
# Make sure $inSrc is a directory
if(!(-d "$inSrc"))
{
return(0);
}
# Make sure $inDest exists
if(!(-e "$inDest"))
{
mkdir("$inDest", 775);
}
# Check for extension, if none is passed, use .jar as default
if($inExtension eq "")
{
$inExtension = "jar";
}
# Save current working directory
$saveCwdir = cwd();
chdir($inSrc);
# For all the subdirectories within $inSrc, create an archive
# using the name of the subdirectory, but with the extension passed
# in as a parameter.
@dirList = <*>;
foreach $dir (@dirList)
{
if($inOsType =~ /win32/i)
{
# Convert all '/' to '\\' or else win32 will have problems
$dir =~ s/\//\\/g;
}
# Get the leaf dir name of full path
# Get the leaf dir name from full path
if($inOsType =~ /win32/i)
{
@dirItem = split(/\\/, $dir);
}
elsif($inOsType =~ /mac/i)
{
@dirItem = split(/:/, $dir);
}
elsif($inOsType =~ /unix/i)
{
@dirItem = split(/\//, $dir);
}
$dirName = $dirItem[$#dirItem];
if(-d "$dir")
{
# Zip only works for win32 and unix systems
if(($inOsType =~ /win32/i) || ($inOsType =~ /unix/i))
{
if($inUpdate =~ /noupdate/i)
{
print "\n";
if(-e "$dirName.$inExtension")
{
# Delete archive is one already exists in target location
print " Removing $dirName.$inExtension\n";
unlink "$dirName.$inExtension";
}
print " Creating $dirName.$inExtension\n";
$mZipParam = "";
}
elsif($inUpdate =~ /update/i)
{
if(!(-e "$dirName.$inExtension"))
{
print "\n";
print " Creating $dirName.$inExtension\n";
$mZipParam = "";
}
else
{
print " Updating $dirName.$inExtension\n";
$mZipParam = "-u";
}
}
# Create the archive in $inDest
chdir("$dirName");
if(system("zip $mZipParam -r ..$gPathDelimiter$dirName.$inExtension *") != 0)
{
print "Error: zip $mZipParam -r ..$gPathDelimiter$dirName.$inExtension *\n";
chdir("..");
return(1);
}
chdir("..");
}
}
}
# Restore to the current working dir
chdir($saveCwdir);
return(0);
}

View File

@@ -0,0 +1,72 @@
#!perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla 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-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
#
# Make sure there are at least four arguments
if(($#ARGV < 2) ||
((!($ARGV[0] =~ /^win32$/i)) &&
(!($ARGV[0] =~ /^mac$/i)) &&
(!($ARGV[0] =~ /^unix$/i))) ||
((!($ARGV[1] =~ /^update$/i)) &&
(!($ARGV[1] =~ /^noupdate$/i))))
{
PrintUsage();
exit(1);
}
require "$ENV{MOZ_SRC}/mozilla/config/zipcfunc.pl";
if($#ARGV == 2)
{
if(&ZipChrome($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[2]) != 0)
{
die "\n Error: ZipChrome($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[2])\n";
}
}
else
{
if(&ZipChrome($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[3]) != 0)
{
die "\n Error: ZipChrome($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[3])\n";
}
}
exit(0);
sub PrintUsage()
{
print "usage: $0 <os> <update> <source path> [target path]
os : win32, mac, unix
update : update - enables time/date compare file update of chrome archives
noupdate - disables time/date compare file update of chrome archives.
it will always update chrome files regardless of time/date stamp.
source path : path to where the chrome dir is at
target path : (optional) path to where the chrome jar files should be copied to
ie: $0 update $ENV{MOZ_SRC}\\mozilla\\dist\\win32_d.obj\\tmpchrome $ENV{MOZ_SRC}\\mozilla\\dist\\win32_d.obj\\bin\\chrome
\n";
}

13316
mozilla/configure vendored Executable file

File diff suppressed because it is too large Load Diff

4432
mozilla/configure.in Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsIHTMLContent_h___
#define nsIHTMLContent_h___
#include "nsIXMLContent.h"
#include "nsHTMLValue.h"
class nsString;
class nsIFrame;
class nsIStyleRule;
class nsIMutableStyleContext;
class nsIPresContext;
class nsIHTMLMappedAttributes;
class nsIURI;
// IID for the nsIHTMLContent class
#define NS_IHTMLCONTENT_IID \
{ 0xb9e110b0, 0x94d6, 0x11d1, \
{0x89, 0x5c, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
typedef void (*nsMapAttributesFunc)(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext);
// Abstract interface for all html content
class nsIHTMLContent : public nsIXMLContent
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTMLCONTENT_IID)
/**
* If this html content is a container, then compact asks it to minimize
* it's storage usage.
*/
NS_IMETHOD Compact() = 0;
NS_IMETHOD SetHTMLAttribute(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
PRBool aNotify) = 0;
NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute,
nsHTMLValue& aValue) const = 0;
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const = 0;
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const = 0;
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult) = 0;
/**
* Get the base URL for any relative URLs within this piece
* of content. Generally, this is the document's base URL,
* but certain content carries a local base for backward
* compatibility.
*/
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const = 0;
/**
* Get the base target for any links within this piece
* of content. Generally, this is the document's base target,
* but certain content carries a local base for backward
* compatibility.
*/
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const = 0;
};
#endif /* nsIHTMLContent_h___ */

View File

@@ -0,0 +1,143 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "GenericElementCollection.h"
#include "nsIDOMElement.h"
#include "nsGenericHTMLElement.h"
GenericElementCollection::GenericElementCollection(nsIContent *aParent,
nsIAtom *aTag)
: nsGenericDOMHTMLCollection()
{
mParent = aParent;
mTag = aTag;
NS_IF_ADDREF(aTag);
}
GenericElementCollection::~GenericElementCollection()
{
// we do NOT have a ref-counted reference to mParent, so do NOT
// release it! this is to avoid circular references. The
// instantiator who provided mParent is responsible for managing our
// reference for us.
// Release reference on the tag
NS_IF_RELEASE(mTag);
}
// we re-count every call. A better implementation would be to set ourselves up as
// an observer of contentAppended, contentInserted, and contentDeleted
NS_IMETHODIMP
GenericElementCollection::GetLength(PRUint32* aLength)
{
if (nsnull==aLength)
return NS_ERROR_NULL_POINTER;
*aLength=0;
nsresult result = NS_OK;
if (nsnull!=mParent)
{
nsIContent *child=nsnull;
PRUint32 childIndex=0;
mParent->ChildAt(childIndex, child);
while (nsnull!=child)
{
nsIAtom *childTag;
child->GetTag(childTag);
if (mTag==childTag)
{
(*aLength)++;
}
NS_RELEASE(childTag);
NS_RELEASE(child);
childIndex++;
mParent->ChildAt(childIndex, child);
}
}
return result;
}
NS_IMETHODIMP
GenericElementCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
*aReturn=nsnull;
PRUint32 theIndex = 0;
nsresult rv = NS_OK;
if (nsnull!=mParent)
{
nsIContent *child=nsnull;
PRUint32 childIndex=0;
mParent->ChildAt(childIndex, child);
while (nsnull!=child)
{
nsIAtom *childTag;
child->GetTag(childTag);
if (mTag==childTag)
{
if (aIndex==theIndex)
{
child->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)aReturn); // out-param addref
NS_ASSERTION(nsnull!=aReturn, "content element must be an nsIDOMNode");
NS_RELEASE(childTag);
NS_RELEASE(child);
break;
}
theIndex++;
}
NS_RELEASE(childTag);
NS_RELEASE(child);
childIndex++;
mParent->ChildAt(childIndex, child);
}
}
return rv;
}
NS_IMETHODIMP
GenericElementCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsresult rv = NS_OK;
if (nsnull!=mParent)
{
}
return rv;
}
NS_IMETHODIMP
GenericElementCollection::ParentDestroyed()
{
// see comment in destructor, do NOT release mParent!
mParent = nsnull;
return NS_OK;
}
#ifdef DEBUG
nsresult
GenericElementCollection::SizeOf(nsISizeOfHandler* aSizer,
PRUint32* aResult) const
{
if (!aResult) return NS_ERROR_NULL_POINTER;
*aResult = sizeof(*this);
return NS_OK;
}
#endif

View File

@@ -0,0 +1,58 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#ifndef GenericElementCollection_h__
#define GenericElementCollection_h__
#include "nsGenericDOMHTMLCollection.h"
class nsIContent;
class nsIAtom;
/**
* This class provides a late-bound collection of elements that are
* direct decendents of an element.
* mParent is NOT ref-counted to avoid circular references
*/
class GenericElementCollection : public nsGenericDOMHTMLCollection
{
public:
GenericElementCollection(nsIContent *aParent,
nsIAtom *aTag);
virtual ~GenericElementCollection();
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
NS_IMETHOD ParentDestroyed();
#ifdef DEBUG
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
#endif
protected:
nsIContent * mParent;
nsIAtom * mTag;
};
#endif

View File

@@ -0,0 +1,7 @@
#
# This is a list of local files which get copied to the mozilla:dist:content directory
#
nsGenericHTMLElement.h
nsIHTMLTableCellElement.h
nsIHTMLTableColElement.h
nsIAttributeContent.h

View File

@@ -0,0 +1,124 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = layout
LIBRARY_NAME = gkconhtmlcon_s
REQUIRES = xpcom string widget dom js locale webshell htmlparser necko unicharutil view pref oji java plugin docshell uriloader xpconnect xuldoc caps editor intl uconv
CPPSRCS = \
nsAttributeContent.cpp \
nsGenericHTMLElement.cpp \
nsGenericDOMHTMLCollection.cpp \
GenericElementCollection.cpp \
nsHTMLAnchorElement.cpp \
nsHTMLAppletElement.cpp \
nsHTMLAreaElement.cpp \
nsHTMLBRElement.cpp \
nsHTMLBaseElement.cpp \
nsHTMLBaseFontElement.cpp \
nsHTMLBodyElement.cpp \
nsHTMLButtonElement.cpp \
nsHTMLDListElement.cpp \
nsHTMLDelElement.cpp \
nsHTMLDirectoryElement.cpp \
nsHTMLDivElement.cpp \
nsHTMLEmbedElement.cpp \
nsHTMLFieldSetElement.cpp \
nsHTMLFontElement.cpp \
nsHTMLFormElement.cpp \
nsHTMLFrameElement.cpp \
nsHTMLFrameSetElement.cpp \
nsHTMLHRElement.cpp \
nsHTMLHeadElement.cpp \
nsHTMLHeadingElement.cpp \
nsHTMLHtmlElement.cpp \
nsHTMLIFrameElement.cpp \
nsHTMLImageElement.cpp \
nsHTMLInputElement.cpp \
nsHTMLInsElement.cpp \
nsHTMLIsIndexElement.cpp \
nsHTMLLIElement.cpp \
nsHTMLLabelElement.cpp \
nsHTMLLegendElement.cpp \
nsHTMLLinkElement.cpp \
nsHTMLMapElement.cpp \
nsHTMLMenuElement.cpp \
nsHTMLMetaElement.cpp \
nsHTMLModElement.cpp \
nsHTMLOListElement.cpp \
nsHTMLObjectElement.cpp \
nsHTMLOptionElement.cpp \
nsHTMLOptGroupElement.cpp \
nsHTMLParagraphElement.cpp \
nsHTMLParamElement.cpp \
nsHTMLPreElement.cpp \
nsHTMLQuoteElement.cpp \
nsHTMLScriptElement.cpp \
nsHTMLSelectElement.cpp \
nsHTMLSpacerElement.cpp \
nsHTMLSpanElement.cpp \
nsHTMLStyleElement.cpp \
nsHTMLTableElement.cpp \
nsHTMLTableCaptionElement.cpp \
nsHTMLTableCellElement.cpp \
nsHTMLTableColElement.cpp \
nsHTMLTableColGroupElement.cpp \
nsHTMLTableRowElement.cpp \
nsHTMLTableSectionElement.cpp \
nsHTMLTextAreaElement.cpp \
nsHTMLTitleElement.cpp \
nsHTMLUListElement.cpp \
nsHTMLUnknownElement.cpp \
nsHTMLUtils.cpp \
nsHTMLWBRElement.cpp \
$(NULL)
EXPORTS = \
nsIAttributeContent.h \
nsIHTMLTableCellElement.h \
nsIHTMLTableColElement.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
override NO_SHARED_LIB=1
override NO_STATIC_LIB=
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_HTML
ifdef MOZ_ENDER_LITE
DEFINES += -DENDER_LITE
endif
INCLUDES += \
-I$(srcdir)/../../style/src \
-I$(srcdir)/../../../base/src \
-I$(srcdir)/../../base/src \
$(NULL)

View File

@@ -0,0 +1,191 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..
LIBRARY_NAME = contenthtmlcontent_s
MODULE=raptor
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
!if defined(XP_NEW_SELECTION)
DEFINES = $(DEFINES) -DXP_NEW_SELECTION
!endif
EXPORTS= \
nsIAttributeContent.h \
nsIHTMLTableCellElement.h \
nsIHTMLTableColElement.h \
$(NULL)
CPPSRCS= \
nsAttributeContent.cpp \
nsGenericHTMLElement.cpp \
nsGenericDOMHTMLCollection.cpp \
nsHTMLUtils.cpp \
GenericElementCollection.cpp \
nsHTMLAnchorElement.cpp \
nsHTMLAppletElement.cpp \
nsHTMLAreaElement.cpp \
nsHTMLBRElement.cpp \
nsHTMLBaseElement.cpp \
nsHTMLBaseFontElement.cpp \
nsHTMLBodyElement.cpp \
nsHTMLButtonElement.cpp \
nsHTMLDListElement.cpp \
nsHTMLDelElement.cpp \
nsHTMLDirectoryElement.cpp \
nsHTMLDivElement.cpp \
nsHTMLEmbedElement.cpp \
nsHTMLFieldSetElement.cpp \
nsHTMLFontElement.cpp \
nsHTMLFormElement.cpp \
nsHTMLFrameElement.cpp \
nsHTMLFrameSetElement.cpp \
nsHTMLHRElement.cpp \
nsHTMLHeadElement.cpp \
nsHTMLHeadingElement.cpp \
nsHTMLHtmlElement.cpp \
nsHTMLIFrameElement.cpp \
nsHTMLImageElement.cpp \
nsHTMLInputElement.cpp \
nsHTMLInsElement.cpp \
nsHTMLIsIndexElement.cpp \
nsHTMLLIElement.cpp \
nsHTMLLabelrElement.cpp \
nsHTMLLegendElement.cpp \
nsHTMLLinkElement.cpp \
nsHTMLMapElement.cpp \
nsHTMLMenuElement.cpp \
nsHTMLMetaElement.cpp \
nsHTMLModElement.cpp \
nsHTMLOListElement.cpp \
nsHTMLObjectElement.cpp \
nsHTMLOptionElement.cpp \
nsHTMLOptGroupElement.cpp \
nsHTMLParagraphElement.cpp \
nsHTMLParamElement.cpp \
nsHTMLPreElement.cpp \
nsHTMLQuoteElement.cpp \
nsHTMLScriptElement.cpp \
nsHTMLSelectElement.cpp \
nsHTMLSpacerElement.cpp \
nsHTMLSpanElement.cpp \
nsHTMLStyleElement.cpp \
nsHTMLTableElement.cpp \
nsHTMLTableCaptionElement.cpp \
nsHTMLTableCellElement.cpp \
nsHTMLTableColElement.cpp \
nsHTMLTableColGroupElement.cpp \
nsHTMLTableRowElement.cpp \
nsHTMLTableSectionElement.cpp \
nsHTMLTextAreaElement.cpp \
nsHTMLTitleElement.cpp \
nsHTMLUListElement.cpp \
nsHTMLUnknownElement.cpp \
nsHTMLWBRElement.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsAttributeContent.obj \
.\$(OBJDIR)\nsGenericHTMLElement.obj \
.\$(OBJDIR)\nsGenericDOMHTMLCollection.obj \
.\$(OBJDIR)\nsHTMLUtils.obj \
.\$(OBJDIR)\GenericElementCollection.obj \
.\$(OBJDIR)\nsHTMLAnchorElement.obj \
.\$(OBJDIR)\nsHTMLAppletElement.obj \
.\$(OBJDIR)\nsHTMLAreaElement.obj \
.\$(OBJDIR)\nsHTMLBRElement.obj \
.\$(OBJDIR)\nsHTMLBaseElement.obj \
.\$(OBJDIR)\nsHTMLBaseFontElement.obj \
.\$(OBJDIR)\nsHTMLBodyElement.obj \
.\$(OBJDIR)\nsHTMLButtonElement.obj \
.\$(OBJDIR)\nsHTMLDListElement.obj \
.\$(OBJDIR)\nsHTMLDelElement.obj \
.\$(OBJDIR)\nsHTMLDirectoryElement.obj \
.\$(OBJDIR)\nsHTMLDivElement.obj \
.\$(OBJDIR)\nsHTMLEmbedElement.obj \
.\$(OBJDIR)\nsHTMLFieldSetElement.obj \
.\$(OBJDIR)\nsHTMLFontElement.obj \
.\$(OBJDIR)\nsHTMLFormElement.obj \
.\$(OBJDIR)\nsHTMLFrameElement.obj \
.\$(OBJDIR)\nsHTMLFrameSetElement.obj \
.\$(OBJDIR)\nsHTMLHRElement.obj \
.\$(OBJDIR)\nsHTMLHeadElement.obj \
.\$(OBJDIR)\nsHTMLHeadingElement.obj \
.\$(OBJDIR)\nsHTMLHtmlElement.obj \
.\$(OBJDIR)\nsHTMLIFrameElement.obj \
.\$(OBJDIR)\nsHTMLImageElement.obj \
.\$(OBJDIR)\nsHTMLInputElement.obj \
.\$(OBJDIR)\nsHTMLInsElement.obj \
.\$(OBJDIR)\nsHTMLIsIndexElement.obj \
.\$(OBJDIR)\nsHTMLLIElement.obj \
.\$(OBJDIR)\nsHTMLLabelElement.obj \
.\$(OBJDIR)\nsHTMLLegendElement.obj \
.\$(OBJDIR)\nsHTMLLinkElement.obj \
.\$(OBJDIR)\nsHTMLMapElement.obj \
.\$(OBJDIR)\nsHTMLMenuElement.obj \
.\$(OBJDIR)\nsHTMLMetaElement.obj \
.\$(OBJDIR)\nsHTMLModElement.obj \
.\$(OBJDIR)\nsHTMLOListElement.obj \
.\$(OBJDIR)\nsHTMLObjectElement.obj \
.\$(OBJDIR)\nsHTMLOptionElement.obj \
.\$(OBJDIR)\nsHTMLOptGroupElement.obj \
.\$(OBJDIR)\nsHTMLParagraphElement.obj \
.\$(OBJDIR)\nsHTMLParamElement.obj \
.\$(OBJDIR)\nsHTMLPreElement.obj \
.\$(OBJDIR)\nsHTMLQuoteElement.obj \
.\$(OBJDIR)\nsHTMLScriptElement.obj \
.\$(OBJDIR)\nsHTMLSelectElement.obj \
.\$(OBJDIR)\nsHTMLSpacerElement.obj \
.\$(OBJDIR)\nsHTMLSpanElement.obj \
.\$(OBJDIR)\nsHTMLStyleElement.obj \
.\$(OBJDIR)\nsHTMLTableElement.obj \
.\$(OBJDIR)\nsHTMLTableCaptionElement.obj \
.\$(OBJDIR)\nsHTMLTableCellElement.obj \
.\$(OBJDIR)\nsHTMLTableColElement.obj \
.\$(OBJDIR)\nsHTMLTableColGroupElement.obj \
.\$(OBJDIR)\nsHTMLTableRowElement.obj \
.\$(OBJDIR)\nsHTMLTableSectionElement.obj \
.\$(OBJDIR)\nsHTMLTextAreaElement.obj \
.\$(OBJDIR)\nsHTMLTitleElement.obj \
.\$(OBJDIR)\nsHTMLUListElement.obj \
.\$(OBJDIR)\nsHTMLUnknownElement.obj \
.\$(OBJDIR)\nsHTMLWBRElement.obj \
$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
-I..\..\style\src \
-I..\..\..\base\src -I..\..\base\src \
-I$(PUBLIC)\plugin -I$(PUBLIC)\oji -I$(PUBLIC)\java
LCFLAGS = \
-DENDER_LITE \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,559 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
#include "nsIAttributeContent.h"
#include "nsGenericElement.h"
#include "nsIDocument.h"
#include "nsIEventListenerManager.h"
#include "nsIDocument.h"
#include "nsIDOMRange.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentFragment.h"
#include "nsRange.h"
#include "nsISelection.h"
#include "nsIEnumerator.h"
#include "nsCRT.h"
#include "nsIEventStateManager.h"
#include "nsIPrivateDOMEvent.h"
#include "nsISizeOfHandler.h"
#include "nsIDOMEvent.h"
#include "nsIDOMText.h"
#include "nsIDOMScriptObjectFactory.h"
#include "prprf.h"
#include "nsCOMPtr.h"
#include "nsIContent.h"
#include "nsTextFragment.h"
#include "nsVoidArray.h"
#include "nsINameSpaceManager.h"
#include "nsITextContent.h"
class nsIDOMAttr;
class nsIDOMEventListener;
class nsIDOMNodeList;
class nsIEventListenerManager;
class nsIFrame;
class nsIStyleContext;
class nsIStyleRule;
class nsISupportsArray;
class nsIDOMText;
// XXX share all id's in this dir
class nsAttributeContent : public nsITextContent, public nsIAttributeContent {
public:
friend nsresult NS_NewAttributeContent(nsAttributeContent** aNewFrame);
nsAttributeContent();
virtual ~nsAttributeContent();
NS_IMETHOD Init(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttrName);
// nsISupports
NS_DECL_ISUPPORTS
// Implementation for nsIContent
NS_IMETHOD GetDocument(nsIDocument*& aResult) const;
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers);
NS_IMETHOD GetParent(nsIContent*& aResult) const;
NS_IMETHOD SetParent(nsIContent* aParent);
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const {
aID = kNameSpaceID_None;
return NS_OK;
}
NS_IMETHOD GetTag(nsIAtom*& aResult) const {
aResult = nsnull;
return NS_OK;
}
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const {
aResult = nsnull;
return NS_OK;
}
NS_IMETHOD NormalizeAttributeString(const nsAReadableString& aStr,
nsINodeInfo*& aNodeInfo) {
aNodeInfo = nsnull;
return NS_OK;
}
NS_IMETHOD SetFocus(nsIPresContext* aPresContext) { return NS_OK; }
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext) { return NS_OK; }
NS_IMETHOD GetBindingParent(nsIContent** aContent) {
return NS_OK;
}
NS_IMETHOD SetBindingParent(nsIContent* aParent) {
return NS_OK;
}
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue,
PRBool aNotify) { return NS_OK; }
NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue,
PRBool aNotify) { return NS_OK; }
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAWritableString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsAWritableString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName, nsIAtom*& aPrefix) const {
aName = nsnull;
aPrefix = nsnull;
return NS_ERROR_ILLEGAL_VALUE;
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { aResult = 0; return NS_OK; }
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { return NS_OK; }
NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const { return NS_OK; }
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus);
NS_IMETHOD GetContentID(PRUint32* aID) {
*aID = 0;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD SetContentID(PRUint32 aID) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD RangeAdd(nsIDOMRange& aRange);
NS_IMETHOD RangeRemove(nsIDOMRange& aRange);
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const;
// Implementation for nsIContent
NS_IMETHOD CanContainChildren(PRBool& aResult) const { aResult = PR_FALSE; return NS_OK; }
NS_IMETHOD ChildCount(PRInt32& aResult) const { aResult = 0; return NS_OK; }
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { aResult = nsnull; return NS_OK; }
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const { aResult = -1; return NS_OK; }
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) { return NS_OK; }
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) { return NS_OK; }
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) { return NS_OK; }
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) { return NS_OK; }
NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn){ return NS_OK; }
///////////////////
// Implementation for nsITextContent
NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult);
NS_IMETHOD GetTextLength(PRInt32* aLengthResult);
NS_IMETHOD CopyText(nsAWritableString& aResult);
NS_IMETHOD SetText(const PRUnichar* aBuffer,
PRInt32 aLength,
PRBool aNotify);
NS_IMETHOD SetText(const nsAReadableString& aStr,
PRBool aNotify);
NS_IMETHOD SetText(const char* aBuffer,
PRInt32 aLength,
PRBool aNotify);
NS_IMETHOD IsOnlyWhitespace(PRBool* aResult);
NS_IMETHOD CloneContent(PRBool aCloneText, nsITextContent** aClone);
//----------------------------------------
void ValidateTextFragment();
void ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const;
// Up pointer to the real content object that we are
// supporting. Sometimes there is work that we just can't do
// ourselves, so this is needed to ask the real object to do the
// work.
nsIContent* mContent;
nsIDocument* mDocument;
nsIContent* mParent;
nsTextFragment mText;
PRInt32 mNameSpaceID;
nsIAtom* mAttrName;
};
NS_IMPL_ADDREF(nsAttributeContent)
NS_IMPL_RELEASE(nsAttributeContent)
nsresult
NS_NewAttributeContent(nsIContent** aContent)
{
NS_PRECONDITION(aContent, "null OUT ptr");
if (nsnull == aContent) {
return NS_ERROR_NULL_POINTER;
}
nsAttributeContent* it = new nsAttributeContent;
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_SUCCEEDED(it->QueryInterface(NS_GET_IID(nsIContent), (void **)aContent)) ?
NS_OK : NS_ERROR_FAILURE;
}
//----------------------------------------------------------------------
nsAttributeContent::nsAttributeContent()
: mText()
{
NS_INIT_REFCNT();
mDocument = nsnull;
mParent = nsnull;
mContent = nsnull;
mAttrName = nsnull;
}
//----------------------------------------------------------------------
nsAttributeContent::~nsAttributeContent()
{
NS_IF_RELEASE(mAttrName);
//NS_IF_RELEASE(mDocument);
}
//----------------------------------------------------------------------
NS_IMETHODIMP
nsAttributeContent::Init(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttrName)
{
NS_ASSERTION((nsnull == mContent) && (nsnull != aContent), "null ptr");
mContent = aContent;
NS_IF_RELEASE(mAttrName);
mNameSpaceID = aNameSpaceID;
mAttrName = aAttrName;
NS_ADDREF(mAttrName);
return NS_OK;
}
/**
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsAttributeContent::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(NS_GET_IID(nsIContent))) {
*aInstancePtr = (void*) ((nsIContent*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsITextContent))) {
*aInstancePtr = (void*) ((nsITextContent*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAttributeContent))) {
*aInstancePtr = (void*) ((nsIAttributeContent*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = (void*) ((nsISupports*)(nsIContent*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
//----------------------------------------------------------------------
// Implementation of nsIContent
void
nsAttributeContent::ToCString(nsAWritableString& aBuf, PRInt32 aOffset,
PRInt32 aLen) const
{
}
nsresult
nsAttributeContent::GetDocument(nsIDocument*& aResult) const
{
aResult = mDocument;
NS_IF_ADDREF(mDocument);
return NS_OK;
}
nsresult
nsAttributeContent::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers)
{
mDocument = aDocument;
//NS_IF_ADDREF(mDocument);
return NS_OK;
}
nsresult
nsAttributeContent::GetParent(nsIContent*& aResult) const
{
NS_IF_ADDREF(mParent);
aResult = mParent;
return NS_OK;;
}
nsresult
nsAttributeContent::SetParent(nsIContent* aParent)
{
mParent = aParent;
return NS_OK;
}
nsresult
nsAttributeContent::HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus)
{
nsresult ret = NS_OK;
return ret;
}
nsresult
nsAttributeContent::RangeAdd(nsIDOMRange& aRange)
{
return NS_ERROR_FAILURE;
}
nsresult
nsAttributeContent::RangeRemove(nsIDOMRange& aRange)
{
return NS_ERROR_FAILURE;
}
nsresult
nsAttributeContent::GetRangeList(nsVoidArray*& aResult) const
{
return NS_ERROR_FAILURE;
}
//----------------------------------------------------------------------
// Implementation of the nsITextContent interface
void
nsAttributeContent::ValidateTextFragment()
{
if (nsnull != mContent) {
nsAutoString result;
mContent->GetAttribute(mNameSpaceID, mAttrName, result);
PRUnichar * text = result.ToNewUnicode();
mText.SetTo(text, result.Length());
nsCRT::free(text);
}
else {
mText.SetTo("", 0);
}
}
nsresult
nsAttributeContent::GetText(const nsTextFragment** aFragmentsResult)
{
ValidateTextFragment();
if (nsnull != mContent) {
*aFragmentsResult = &mText;
return NS_OK;
}
// XXX is this a good idea, or should we just return an empty
// fragment with no data in it?
return NS_ERROR_FAILURE;
}
nsresult
nsAttributeContent::GetTextLength(PRInt32* aLengthResult)
{
if (!aLengthResult) {
return NS_ERROR_NULL_POINTER;
}
ValidateTextFragment();
*aLengthResult = mText.GetLength();
return NS_OK;
}
nsresult
nsAttributeContent::CopyText(nsAWritableString& aResult)
{
ValidateTextFragment();
if (mText.Is2b()) {
aResult.Assign(mText.Get2b(), mText.GetLength());
}
else {
aResult.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()).get(), mText.GetLength());
}
return NS_OK;
}
// XXX shouldn't these update mContent's attribute?
nsresult
nsAttributeContent::SetText(const PRUnichar* aBuffer, PRInt32 aLength,
PRBool aNotify)
{
NS_PRECONDITION((aLength >= 0) && (nsnull != aBuffer), "bad args");
if (aLength < 0) {
return NS_ERROR_ILLEGAL_VALUE;
}
if (nsnull == aBuffer) {
return NS_ERROR_NULL_POINTER;
}
mText.SetTo(aBuffer, aLength);
// Trigger a reflow
if (aNotify && (nsnull != mDocument)) {
mDocument->ContentChanged(mContent, nsnull);
}
return NS_OK;
}
NS_IMETHODIMP
nsAttributeContent::SetText(const nsAReadableString& aStr,
PRBool aNotify)
{
mText = aStr;
// Trigger a reflow
if (aNotify && (nsnull != mDocument)) {
mDocument->ContentChanged(mContent, nsnull);
}
return NS_OK;
}
// XXX shouldn't these update mContent's attribute?
nsresult
nsAttributeContent::SetText(const char* aBuffer,
PRInt32 aLength,
PRBool aNotify)
{
NS_PRECONDITION((aLength >= 0) && (nsnull != aBuffer), "bad args");
if (aLength < 0) {
return NS_ERROR_ILLEGAL_VALUE;
}
if (nsnull == aBuffer) {
return NS_ERROR_NULL_POINTER;
}
mText.SetTo(aBuffer, aLength);
// Trigger a reflow
if (aNotify && (nsnull != mDocument)) {
mDocument->ContentChanged(mContent, nsnull);
}
return NS_OK;
}
nsresult
nsAttributeContent::IsOnlyWhitespace(PRBool* aResult)
{
ValidateTextFragment();
nsTextFragment& frag = mText;
if (frag.Is2b()) {
const PRUnichar* cp = frag.Get2b();
const PRUnichar* end = cp + frag.GetLength();
while (cp < end) {
PRUnichar ch = *cp++;
if (!XP_IS_SPACE(ch)) {
*aResult = PR_FALSE;
return NS_OK;
}
}
}
else {
const char* cp = frag.Get1b();
const char* end = cp + frag.GetLength();
while (cp < end) {
PRUnichar ch = PRUnichar(*(unsigned char*)cp);
cp++;
if (!XP_IS_SPACE(ch)) {
*aResult = PR_FALSE;
return NS_OK;
}
}
}
*aResult = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsAttributeContent::CloneContent(PRBool aCloneText, nsITextContent** aReturn)
{
nsresult result = NS_OK;
nsAttributeContent* it;
NS_NEWXPCOM(it, nsAttributeContent);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
result = it->QueryInterface(NS_GET_IID(nsITextContent), (void**) aReturn);
if (NS_FAILED(result)) {
return result;
}
result = it->Init(mContent, mNameSpaceID, mAttrName);
if (NS_FAILED(result) || !aCloneText) {
return result;
}
it->mText = mText;
return result;
}
NS_IMETHODIMP
nsAttributeContent::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
if (!aResult) return NS_ERROR_NULL_POINTER;
*aResult = sizeof(*this);
return NS_OK;
}

View File

@@ -0,0 +1,79 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nslayout.h"
#include "nsGenericDOMHTMLCollection.h"
nsGenericDOMHTMLCollection::nsGenericDOMHTMLCollection()
{
NS_INIT_REFCNT();
mScriptObject = nsnull;
}
nsGenericDOMHTMLCollection::~nsGenericDOMHTMLCollection()
{
}
nsresult
nsGenericDOMHTMLCollection::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(NS_GET_IID(nsIDOMHTMLCollection))) {
*aInstancePtr = (void*)(nsIDOMHTMLCollection*)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIScriptObjectOwner))) {
*aInstancePtr = (void*)(nsIScriptObjectOwner*)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = (void*)(nsISupports*)(nsIDOMHTMLCollection*)this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ADDREF(nsGenericDOMHTMLCollection)
NS_IMPL_RELEASE(nsGenericDOMHTMLCollection)
NS_IMETHODIMP
nsGenericDOMHTMLCollection::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
res = NS_NewScriptHTMLCollection(aContext, (nsISupports *)(nsIDOMHTMLCollection *)this, nsnull, (void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
return res;
}
NS_IMETHODIMP
nsGenericDOMHTMLCollection::SetScriptObject(void *aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}

View File

@@ -0,0 +1,62 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#ifndef nsGenericDOMHTMLCollection_h__
#define nsGenericDOMHTMLCollection_h__
#include "nsISupports.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIScriptObjectOwner.h"
/**
* This is a base class for a generic HTML collection. The base class
* provides implementations for nsISupports and nsIScriptObjectOwner,
* but it is up to the subclass to implement the core HTML collection
* methods:
* GetLength
* Item
* NamedItem
*
*/
class nsGenericDOMHTMLCollection : public nsIDOMHTMLCollection,
public nsIScriptObjectOwner
{
public:
nsGenericDOMHTMLCollection();
virtual ~nsGenericDOMHTMLCollection();
NS_DECL_ISUPPORTS
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject(void *aScriptObject);
// The following need to be defined in the subclass
// nsIDOMHTMLCollection interface
NS_IMETHOD GetLength(PRUint32* aLength)=0;
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0;
protected:
void* mScriptObject;
};
#endif // nsGenericDOMHTMLCollection_h__

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,797 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#ifndef nsGenericHTMLElement_h___
#define nsGenericHTMLElement_h___
#include "nsGenericElement.h"
#include "nsHTMLParts.h"
#include "nsIDOMHTMLElement.h"
#include "nsIContent.h"
#include "nsHTMLValue.h"
#include "nsVoidArray.h"
#include "nsIJSScriptObject.h"
#include "nsINameSpaceManager.h" // for kNameSpaceID_HTML
#include "nsIFormControl.h"
#include "nsIStatefulFrame.h"
class nsIDOMAttr;
class nsIDOMEventListener;
class nsIDOMNodeList;
class nsIEventListenerManager;
class nsIFrame;
class nsIHTMLAttributes;
class nsIHTMLMappedAttributes;
class nsIHTMLContent;
class nsIMutableStyleContext;
class nsIStyleRule;
class nsISupportsArray;
class nsIDOMScriptObjectFactory;
class nsChildContentList;
class nsDOMCSSDeclaration;
class nsIDOMCSSStyleDeclaration;
class nsIURI;
class nsIFormControlFrame;
class nsIForm;
class nsIPresState;
class nsIPluginInstance;
class nsGenericHTMLElement : public nsGenericElement {
public:
nsGenericHTMLElement();
virtual ~nsGenericHTMLElement();
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
static nsresult DOMQueryInterface(nsIDOMHTMLElement *aElement,
REFNSIID aIID, void **aInstancePtr);
NS_METHOD CopyInnerTo(nsIContent* aSrcContent,
nsGenericHTMLElement* aDest,
PRBool aDeep);
// Implementation for nsIDOMNode
NS_METHOD GetNodeName(nsAWritableString& aNodeName);
NS_METHOD GetLocalName(nsAWritableString& aLocalName);
// Implementation for nsIDOMElement
NS_METHOD GetAttribute(const nsAReadableString& aName,
nsAWritableString& aReturn)
{
return nsGenericElement::GetAttribute(aName, aReturn);
}
NS_METHOD SetAttribute(const nsAReadableString& aName,
const nsAReadableString& aValue)
{
return nsGenericElement::SetAttribute(aName, aValue);
}
NS_METHOD GetTagName(nsAWritableString& aTagName);
NS_METHOD GetElementsByTagName(const nsAReadableString& aTagname,
nsIDOMNodeList** aReturn);
// Implementation for nsIDOMHTMLElement
NS_METHOD GetId(nsAWritableString& aId);
NS_METHOD SetId(const nsAReadableString& aId);
NS_METHOD GetTitle(nsAWritableString& aTitle);
NS_METHOD SetTitle(const nsAReadableString& aTitle);
NS_METHOD GetLang(nsAWritableString& aLang);
NS_METHOD SetLang(const nsAReadableString& aLang);
NS_METHOD GetDir(nsAWritableString& aDir);
NS_METHOD SetDir(const nsAReadableString& aDir);
NS_METHOD GetClassName(nsAWritableString& aClassName);
NS_METHOD SetClassName(const nsAReadableString& aClassName);
NS_METHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle);
NS_METHOD GetOffsetTop(PRInt32* aOffsetTop);
NS_METHOD GetOffsetLeft(PRInt32* aOffsetLeft);
NS_METHOD GetOffsetWidth(PRInt32* aOffsetWidth);
NS_METHOD GetOffsetHeight(PRInt32* aOffsetHeight);
NS_METHOD GetOffsetParent(nsIDOMElement** aOffsetParent);
NS_METHOD GetInnerHTML(nsAWritableString& aInnerHTML);
NS_METHOD SetInnerHTML(const nsAReadableString& aInnerHTML);
NS_METHOD GetOffsetRect(nsRect& aRect,
nsIAtom* aOffsetParentTag,
nsIContent** aOffsetParent);
// Implementation for nsIContent
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers);
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const;
NS_IMETHOD NormalizeAttributeString(const nsAReadableString& aStr,
nsINodeInfo*& aNodeInfo);
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAReadableString& aValue,
PRBool aNotify);
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo,
const nsAReadableString& aValue,
PRBool aNotify);
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAWritableString& aResult) const;
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsAWritableString& aResult) const;
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
PRBool aNotify);
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName,
nsIAtom*& aPrefix) const;
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const;
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const;
nsresult HandleDOMEventForAnchors(nsIContent* aOuter,
nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus);
// Implementation for nsIHTMLContent
NS_IMETHOD SetHTMLAttribute(nsIAtom* aAttribute, const nsHTMLValue& aValue,
PRBool aNotify);
NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute, nsHTMLValue& aValue) const;
NS_IMETHOD GetID(nsIAtom*& aResult) const;
NS_IMETHOD GetClasses(nsVoidArray& aArray) const;
NS_IMETHOD HasClass(nsIAtom* aClass) const;
NS_IMETHOD GetContentStyleRules(nsISupportsArray* aRules);
NS_IMETHOD GetInlineStyleRules(nsISupportsArray* aRules);
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const;
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const;
//----------------------------------------
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const;
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const;
void ListAttributes(FILE* out) const;
PRUint32 BaseSizeOf(nsISizeOfHandler* aSizer) const;
//----------------------------------------
// Attribute parsing utilities
struct EnumTable {
const char* tag;
PRInt32 value;
};
static PRBool ParseEnumValue(const nsAReadableString& aValue,
EnumTable* aTable,
nsHTMLValue& aResult);
static PRBool ParseCaseSensitiveEnumValue(const nsAReadableString& aValue,
EnumTable* aTable,
nsHTMLValue& aResult);
static PRBool EnumValueToString(const nsHTMLValue& aValue,
EnumTable* aTable,
nsAWritableString& aResult,
PRBool aFoldCase=PR_TRUE);
static PRBool ParseValueOrPercent(const nsAReadableString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit);
static PRBool ParseValueOrPercentOrProportional(const nsAReadableString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit);
static PRBool ValueOrPercentToString(const nsHTMLValue& aValue,
nsAWritableString& aResult);
static PRBool ValueOrPercentOrProportionalToString(const nsHTMLValue& aValue,
nsAWritableString& aResult);
static PRBool ParseValue(const nsAReadableString& aString, PRInt32 aMin,
nsHTMLValue& aResult, nsHTMLUnit aValueUnit);
static PRBool ParseValue(const nsAReadableString& aString, PRInt32 aMin,
PRInt32 aMax, nsHTMLValue& aResult,
nsHTMLUnit aValueUnit);
static PRBool ParseColor(const nsAReadableString& aString,
nsIDocument* aDocument, nsHTMLValue& aResult);
static PRBool ColorToString(const nsHTMLValue& aValue,
nsAWritableString& aResult);
static PRBool ParseCommonAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
static PRBool ParseAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult);
PRBool ParseDivAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const;
PRBool DivAlignValueToString(const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
PRBool ParseTableHAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const;
PRBool TableHAlignValueToString(const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
PRBool ParseTableCellHAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const;
PRBool TableCellHAlignValueToString(const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
static PRBool ParseTableVAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult);
static PRBool TableVAlignValueToString(const nsHTMLValue& aValue,
nsAWritableString& aResult);
static PRBool AlignValueToString(const nsHTMLValue& aValue,
nsAWritableString& aResult);
static PRBool ParseImageAttribute(nsIAtom* aAttribute,
const nsAReadableString& aString,
nsHTMLValue& aResult);
static PRBool ImageAttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult);
static PRBool ParseFrameborderValue(PRBool aStandardMode,
const nsAReadableString& aString,
nsHTMLValue& aResult);
static PRBool FrameborderValueToString(PRBool aStandardMode,
const nsHTMLValue& aValue,
nsAWritableString& aResult);
static PRBool ParseScrollingValue(PRBool aStandardMode,
const nsAReadableString& aString,
nsHTMLValue& aResult);
static PRBool ScrollingValueToString(PRBool aStandardMode,
const nsHTMLValue& aValue,
nsAWritableString& aResult);
nsresult ReparseStyleAttribute(void);
nsresult ParseStyleAttribute(const nsAReadableString& aValue,
nsHTMLValue& aResult);
/** Attribute Mapping Helpers
*
* All attributes that are mapped into style contexts must have a
* matched set of mapping function and impact getter
*/
static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aStyleContext,
nsIPresContext* aPresContext);
static PRBool GetCommonMappedAttributesImpact(const nsIAtom* aAttribute,
PRInt32& aHint);
static void MapImageAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext);
static PRBool GetImageMappedAttributesImpact(const nsIAtom* aAttribute,
PRInt32& aHint);
static void MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext);
static PRBool GetImageAlignAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint);
static void MapImageBorderAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext,
nscolor aBorderColors[4]);
static PRBool GetImageBorderAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint);
static void MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext);
static PRBool GetBackgroundAttributesImpact(const nsIAtom* aAttribute,
PRInt32& aHint);
//XXX These three create a dependency between content and frames
static nsresult GetPrimaryFrame(nsIHTMLContent* aContent,
nsIFormControlFrame *&aFormControlFrame,
PRBool aFlushNotifications=PR_TRUE);
static nsresult GetPrimaryPresState(nsIHTMLContent* aContent,
nsIStatefulFrame::StateType aStateType,
nsIPresState** aPresState);
static nsresult GetPresContext(nsIHTMLContent* aContent,
nsIPresContext** aPresContext);
static nsresult GetBaseURL(const nsHTMLValue& aBaseHref,
nsIDocument* aDocument,
nsIURI** aResult);
// Form Helper Routines
static nsIContent* FindFormParentContent(nsIContent* aParent);
static nsresult FindAndSetFormParent(nsIContent* aParent,
nsIFormControl* aControl);
// See if the content object is in a document that has nav-quirks
// mode enabled.
static PRBool InNavQuirksMode(nsIDocument* aDoc);
nsIHTMLAttributes* mAttributes;
protected:
nsresult GetPluginInstance(nsIPluginInstance** aPluginInstance);
nsresult GetPluginScriptObject(nsIScriptContext* aContext,
void** aScriptObject);
PRBool GetPluginProperty(JSContext *aContext, JSObject *aObj, jsval aID,
jsval *aVp);
};
//----------------------------------------------------------------------
class nsGenericHTMLLeafElement : public nsGenericHTMLElement {
public:
nsGenericHTMLLeafElement();
virtual ~nsGenericHTMLLeafElement();
NS_METHOD CopyInnerTo(nsIContent* aSrcContent,
nsGenericHTMLLeafElement* aDest,
PRBool aDeep);
// Remainder of nsIDOMHTMLElement (and nsIDOMNode)
NS_METHOD GetChildNodes(nsIDOMNodeList** aChildNodes);
NS_METHOD HasChildNodes(PRBool* aHasChildNodes) {
*aHasChildNodes = PR_FALSE;
return NS_OK;
}
NS_METHOD GetFirstChild(nsIDOMNode** aFirstChild) {
*aFirstChild = nsnull;
return NS_OK;
}
NS_METHOD GetLastChild(nsIDOMNode** aLastChild) {
*aLastChild = nsnull;
return NS_OK;
}
NS_METHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIDOMNode** aReturn) {
return NS_ERROR_FAILURE;
}
NS_METHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn) {
return NS_ERROR_FAILURE;
}
NS_METHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) {
return NS_ERROR_FAILURE;
}
NS_METHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) {
return NS_ERROR_FAILURE;
}
// Remainder of nsIHTMLContent (and nsIContent)
NS_IMETHOD Compact() {
return NS_OK;
}
NS_IMETHOD CanContainChildren(PRBool& aResult) const {
aResult = PR_FALSE;
return NS_OK;
}
NS_IMETHOD ChildCount(PRInt32& aResult) const {
aResult = 0;
return NS_OK;
}
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const {
aResult = nsnull;
return NS_OK;
}
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const {
aResult = -1;
return NS_OK;
}
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) {
return NS_OK;
}
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) {
return NS_OK;
}
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) {
return NS_OK;
}
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) {
return NS_OK;
}
};
//----------------------------------------------------------------------
class nsGenericHTMLContainerElement : public nsGenericHTMLElement
{
public:
nsGenericHTMLContainerElement();
virtual ~nsGenericHTMLContainerElement();
NS_METHOD CopyInnerTo(nsIContent* aSrcContent,
nsGenericHTMLContainerElement* aDest,
PRBool aDeep);
// Remainder of nsIDOMHTMLElement (and nsIDOMNode)
NS_METHOD GetChildNodes(nsIDOMNodeList** aChildNodes);
NS_METHOD HasChildNodes(PRBool* aHasChildNodes);
NS_METHOD GetFirstChild(nsIDOMNode** aFirstChild);
NS_METHOD GetLastChild(nsIDOMNode** aLastChild);
NS_METHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
nsIDOMNode** aReturn)
{
return nsGenericElement::doInsertBefore(aNewChild, aRefChild, aReturn);
}
NS_METHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
nsIDOMNode** aReturn)
{
return nsGenericElement::doReplaceChild(aNewChild, aOldChild, aReturn);
}
NS_METHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
return nsGenericElement::doRemoveChild(aOldChild, aReturn);
}
NS_METHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return nsGenericElement::doInsertBefore(aNewChild, nsnull, aReturn);
}
// Remainder of nsIHTMLContent (and nsIContent)
NS_IMETHOD Compact();
NS_IMETHOD CanContainChildren(PRBool& aResult) const;
NS_IMETHOD ChildCount(PRInt32& aResult) const;
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const;
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const;
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify);
nsCheapVoidArray mChildren;
};
//----------------------------------------------------------------------
class nsGenericHTMLContainerFormElement : public nsGenericHTMLContainerElement,
public nsIFormControl
{
public:
nsGenericHTMLContainerFormElement();
virtual ~nsGenericHTMLContainerFormElement();
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
// nsIFormControl
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm);
NS_IMETHOD Init();
NS_IMETHOD SetParent(nsIContent *aParent);
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers);
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAReadableString& aValue, PRBool aNotify);
NS_METHOD SetAttribute(const nsAReadableString& aName,
const nsAReadableString& aValue)
{
return nsGenericHTMLElement::SetAttribute(aName, aValue);
}
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
protected:
nsIForm* mForm;
};
//----------------------------------------------------------------------
class nsGenericHTMLLeafFormElement : public nsGenericHTMLLeafElement,
public nsIFormControl
{
public:
nsGenericHTMLLeafFormElement();
~nsGenericHTMLLeafFormElement();
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
// nsIFormControl
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm);
NS_IMETHOD Init();
NS_IMETHOD SetParent(nsIContent *aParent);
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers);
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAReadableString& aValue, PRBool aNotify);
NS_METHOD SetAttribute(const nsAReadableString& aName,
const nsAReadableString& aValue)
{
return nsGenericHTMLElement::SetAttribute(aName, aValue);
}
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
protected:
nsIForm* mForm;
};
//----------------------------------------------------------------------
#define NS_IMPL_HTMLCONTENT_QI0(_class, _base) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
return NS_NOINTERFACE; \
}
#define NS_IMPL_HTMLCONTENT_QI(_class, _base, _if) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
nsISupports *inst = nsnull; \
\
if (aIID.Equals(NS_GET_IID(_if))) { \
inst = NS_STATIC_CAST(_if *, this); \
} else { \
return NS_NOINTERFACE; \
} \
\
NS_ADDREF(inst); \
\
*aInstancePtr = inst; \
\
return NS_OK; \
}
#define NS_IMPL_HTMLCONTENT_QI2(_class, _base, _if1, _if2) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
nsISupports *inst = nsnull; \
\
if (aIID.Equals(NS_GET_IID(_if1))) { \
inst = NS_STATIC_CAST(_if1 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if2))) { \
inst = NS_STATIC_CAST(_if2 *, this); \
} else { \
return NS_NOINTERFACE; \
} \
\
NS_ADDREF(inst); \
\
*aInstancePtr = inst; \
\
return NS_OK; \
}
#define NS_IMPL_HTMLCONTENT_QI3(_class, _base, _if1, _if2, _if3) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
nsISupports *inst = nsnull; \
\
if (aIID.Equals(NS_GET_IID(_if1))) { \
inst = NS_STATIC_CAST(_if1 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if2))) { \
inst = NS_STATIC_CAST(_if2 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if3))) { \
inst = NS_STATIC_CAST(_if3 *, this); \
} else { \
return NS_NOINTERFACE; \
} \
\
NS_ADDREF(inst); \
\
*aInstancePtr = inst; \
\
return NS_OK; \
}
#define NS_IMPL_HTMLCONTENT_QI4(_class, _base, _if1, _if2, _if3, _if4) \
nsresult \
_class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
NS_ENSURE_ARG_POINTER(aInstancePtr); \
\
*aInstancePtr = nsnull; \
\
nsresult rv; \
\
rv = _base::QueryInterface(aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
\
if (NS_SUCCEEDED(rv)) \
return rv; \
\
nsISupports *inst = nsnull; \
\
if (aIID.Equals(NS_GET_IID(_if1))) { \
inst = NS_STATIC_CAST(_if1 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if2))) { \
inst = NS_STATIC_CAST(_if2 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if3))) { \
inst = NS_STATIC_CAST(_if3 *, this); \
} else if (aIID.Equals(NS_GET_IID(_if4))) { \
inst = NS_STATIC_CAST(_if4 *, this); \
} else { \
return NS_NOINTERFACE; \
} \
\
NS_ADDREF(inst); \
\
*aInstancePtr = inst; \
\
return NS_OK; \
}
/**
* A macro to implement the getter and setter for a given string
* valued content property. The method uses the generic SetAttr and
* GetAttribute methods.
*/
#define NS_IMPL_STRING_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(nsAWritableString& aValue) \
{ \
NS_STATIC_CAST(nsIHTMLContent *, this)->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue); \
return NS_OK; \
} \
NS_IMETHODIMP \
_class::Set##_method(const nsAReadableString& aValue) \
{ \
return NS_STATIC_CAST(nsIHTMLContent *, this)->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue, PR_TRUE); \
}
/**
* A macro to implement the getter and setter for a given boolean
* valued content property. The method uses the generic SetAttr and
* GetAttribute methods.
*/
#define NS_IMPL_BOOL_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(PRBool* aValue) \
{ \
nsHTMLValue val; \
nsresult rv; \
rv = NS_STATIC_CAST(nsIHTMLContent *, this)->GetHTMLAttribute(nsHTMLAtoms::_atom, val); \
*aValue = NS_CONTENT_ATTR_NOT_THERE != rv; \
return NS_OK; \
} \
NS_IMETHODIMP \
_class::Set##_method(PRBool aValue) \
{ \
nsHTMLValue empty(eHTMLUnit_Empty); \
if (aValue) { \
return NS_STATIC_CAST(nsIHTMLContent *, this)->SetHTMLAttribute(nsHTMLAtoms::_atom, empty, PR_TRUE); \
} \
else { \
NS_STATIC_CAST(nsIHTMLContent *, this)->UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, PR_TRUE); \
return NS_OK; \
} \
}
/**
* A macro to implement the getter and setter for a given integer
* valued content property. The method uses the generic SetAttr and
* GetAttribute methods.
*/
#define NS_IMPL_INT_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(PRInt32* aValue) \
{ \
nsHTMLValue value; \
*aValue = -1; \
if (NS_CONTENT_ATTR_HAS_VALUE == \
NS_STATIC_CAST(nsIHTMLContent *, this)->GetHTMLAttribute(nsHTMLAtoms::_atom, value)) { \
if (value.GetUnit() == eHTMLUnit_Integer) { \
*aValue = value.GetIntValue(); \
} \
} \
return NS_OK; \
} \
NS_IMETHODIMP \
_class::Set##_method(PRInt32 aValue) \
{ \
nsHTMLValue value(aValue, eHTMLUnit_Integer); \
return NS_STATIC_CAST(nsIHTMLContent *, this)->SetHTMLAttribute(nsHTMLAtoms::_atom, value, PR_TRUE); \
}
#endif /* nsGenericHTMLElement_h___ */

View File

@@ -0,0 +1,703 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsCOMPtr.h"
#include "nsHTMLUtils.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMNSHTMLAnchorElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsILink.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIEventStateManager.h"
#include "nsIURL.h"
#include "nsIEventStateManager.h"
#include "nsIDOMEvent.h"
#include "nsNetUtil.h"
#include "nsCOMPtr.h"
#include "nsIFrameManager.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIHTMLAttributes.h"
#include "prprf.h"
// XXX suppress
// XXX either suppress is handled in the event code below OR we need a
// custom frame
class nsHTMLAnchorElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLAnchorElement,
public nsIDOMNSHTMLAnchorElement,
public nsILink
{
public:
nsHTMLAnchorElement();
virtual ~nsHTMLAnchorElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLAnchorElement
NS_DECL_IDOMHTMLANCHORELEMENT
// nsIDOMNSHTMLAnchorElement
NS_DECL_IDOMNSHTMLANCHORELEMENT
// nsILink
NS_IMETHOD GetLinkState(nsLinkState &aState);
NS_IMETHOD SetLinkState(nsLinkState aState);
NS_IMETHOD GetHrefCString(char* &aBuf);
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers);
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
nsEventStatus* aEventStatus);
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
protected:
nsresult RegUnRegAccessKey(PRBool aDoReg);
// The cached visited state
nsLinkState mLinkState;
};
nsresult
NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLAnchorElement* it = new nsHTMLAnchorElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLAnchorElement::nsHTMLAnchorElement() : mLinkState(eLinkState_Unknown)
{
nsHTMLUtils::AddRef(); // for GetHrefCString
}
nsHTMLAnchorElement::~nsHTMLAnchorElement()
{
nsHTMLUtils::Release(); // for GetHrefCString
}
NS_IMPL_ADDREF_INHERITED(nsHTMLAnchorElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLAnchorElement, nsGenericElement)
NS_IMPL_HTMLCONTENT_QI3(nsHTMLAnchorElement, nsGenericHTMLContainerElement,
nsIDOMHTMLAnchorElement, nsIDOMNSHTMLAnchorElement,
nsILink)
nsresult
nsHTMLAnchorElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLAnchorElement* it = new nsHTMLAnchorElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, AccessKey, accesskey)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Charset, charset)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Coords, coords)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Hreflang, hreflang)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Name, name)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rel, rel)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rev, rev)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Shape, shape)
NS_IMPL_INT_ATTR(nsHTMLAnchorElement, TabIndex, tabindex)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Target, target)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type)
// This goes and gets the proper PresContext in order
// for it to get the EventStateManager so it can register
// the access key
nsresult nsHTMLAnchorElement::RegUnRegAccessKey(PRBool aDoReg)
{
// first check to see if it even has an acess key
nsAutoString accessKey;
PRInt32 nameSpaceID;
GetNameSpaceID(nameSpaceID);
nsresult rv;
rv = NS_STATIC_CAST(nsIContent *, this)->GetAttribute(nameSpaceID,
nsHTMLAtoms::accesskey,
accessKey);
if (NS_CONTENT_ATTR_NOT_THERE != rv) {
nsCOMPtr<nsIPresContext> presContext;
GetPresContext(this, getter_AddRefs(presContext));
// With a valid PresContext we can get the EVM
// and register the access key
if (presContext) {
nsCOMPtr<nsIEventStateManager> stateManager;
presContext->GetEventStateManager(getter_AddRefs(stateManager));
if (stateManager) {
if (aDoReg) {
return stateManager->RegisterAccessKey(nsnull, this,
(PRUint32)accessKey.First());
} else {
return stateManager->UnregisterAccessKey(nsnull, this,
(PRUint32)accessKey.First());
}
}
}
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsHTMLAnchorElement::SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers)
{
// The document gets set to null before it is destroyed,
// so we unregister the the access key here (if it has one)
// before setting it to null
if (aDocument == nsnull) {
RegUnRegAccessKey(PR_FALSE);
}
nsresult rv;
rv = nsGenericHTMLContainerElement::SetDocument(aDocument,
aDeep,
aCompileEventHandlers);
// Register the access key here (if it has one)
// if the document isn't null
if (aDocument != nsnull) {
RegUnRegAccessKey(PR_TRUE);
}
return rv;
}
NS_IMETHODIMP
nsHTMLAnchorElement::Blur()
{
nsCOMPtr<nsIPresContext> presContext;
GetPresContext(this, getter_AddRefs(presContext));
return RemoveFocus(presContext);
}
NS_IMETHODIMP
nsHTMLAnchorElement::Focus()
{
nsCOMPtr<nsIDocument> doc; // Strong
nsresult rv = GetDocument(*getter_AddRefs(doc));
if (NS_FAILED(rv)) { return rv; }
if (!doc) { return NS_ERROR_NULL_POINTER; }
PRInt32 numShells = doc->GetNumberOfShells();
nsCOMPtr<nsIPresContext> context;
for (PRInt32 i=0; i<numShells; i++) {
nsCOMPtr<nsIPresShell> shell = getter_AddRefs(doc->GetShellAt(i));
if (!shell) { return NS_ERROR_NULL_POINTER; }
rv = shell->GetPresContext(getter_AddRefs(context));
if (NS_FAILED(rv)) {
return rv;
}
if (!context) {
return NS_ERROR_NULL_POINTER;
}
rv = SetFocus(context);
if (NS_FAILED(rv)) {
return rv;
}
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAnchorElement::SetFocus(nsIPresContext* aPresContext)
{
// don't make the link grab the focus if there is no link handler
nsCOMPtr<nsILinkHandler> handler;
nsresult rv = aPresContext->GetLinkHandler(getter_AddRefs(handler));
if (NS_SUCCEEDED(rv) && (nsnull != handler)) {
nsCOMPtr<nsIEventStateManager> stateManager;
aPresContext->GetEventStateManager(getter_AddRefs(stateManager));
if (stateManager) {
stateManager->SetContentState(this, NS_EVENT_STATE_FOCUS);
// Make sure the presentation is up-to-date
if (mDocument) {
mDocument->FlushPendingNotifications();
}
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
nsIFrame* frame = nsnull;
presShell->GetPrimaryFrameFor(this, &frame);
if (frame) {
presShell->ScrollFrameIntoView(frame, NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE);
}
}
}
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAnchorElement::RemoveFocus(nsIPresContext* aPresContext)
{
// If we are disabled, we probably shouldn't have focus in the
// first place, so allow it to be removed.
nsresult rv = NS_OK;
nsCOMPtr<nsIEventStateManager> esm;
aPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm) {
nsCOMPtr<nsIDocument> doc;
GetDocument(*getter_AddRefs(doc));
if (!doc)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIContent> rootContent;
rootContent = getter_AddRefs(doc->GetRootContent());
rv = esm->SetContentState(rootContent, NS_EVENT_STATE_FOCUS);
}
return rv;
}
NS_IMETHODIMP
nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::tabindex) {
if (ParseValue(aValue, 0, 32767, aResult, eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::suppress) {
if (nsCRT::strcasecmp(nsPromiseFlatString(aValue).get(),
NS_LITERAL_STRING("true").get())) {
aResult.SetEmptyValue(); // XXX? shouldn't just leave "true"
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return NS_CONTENT_ATTR_NOT_THERE;
}
// XXX support suppress in here
NS_IMETHODIMP
nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus)
{
return HandleDOMEventForAnchors(this, aPresContext, aEvent, aDOMEvent,
aFlags, aEventStatus);
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHref(nsAWritableString& aValue)
{
char *buf;
nsresult rv = GetHrefCString(buf);
if (NS_FAILED(rv)) return rv;
if (buf) {
aValue.Assign(NS_ConvertASCIItoUCS2(buf));
nsCRT::free(buf);
}
// NS_IMPL_STRING_ATTR does nothing where we have (buf == null)
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAnchorElement::SetHref(const nsAReadableString& aValue)
{
// Clobber our "cache", so we'll recompute it the next time
// somebody asks for it.
mLinkState = eLinkState_Unknown;
return NS_STATIC_CAST(nsIContent *, this)->SetAttribute(kNameSpaceID_HTML,
nsHTMLAtoms::href,
aValue, PR_TRUE);
}
NS_IMETHODIMP
nsHTMLAnchorElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetProtocol(nsAWritableString& aProtocol)
{
nsAutoString href;
nsCOMPtr<nsIURI> url;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(getter_AddRefs(url), href);
if (NS_FAILED(result))
return result;
char* protocol;
result = url->GetScheme(&protocol);
if (NS_FAILED(result))
return result;
aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol));
aProtocol.Append(PRUnichar(':'));
nsCRT::free(protocol);
}
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHost(nsAWritableString& aHost)
{
nsAutoString href;
nsCOMPtr<nsIURI> url;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(getter_AddRefs(url), href);
if (NS_OK == result) {
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
aHost.Assign(NS_ConvertASCIItoUCS2(host));
nsCRT::free(host);
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
aHost.Append(NS_LITERAL_STRING(":"));
nsAutoString portStr;
portStr.AppendInt(port);
aHost.Append(portStr);
}
}
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHostname(nsAWritableString& aHostname)
{
nsAutoString href;
nsIURI *url;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(&url, href);
if (NS_OK == result) {
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
aHostname.Assign(NS_ConvertASCIItoUCS2(host));
nsCRT::free(host);
}
NS_RELEASE(url);
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetPathname(nsAWritableString& aPathname)
{
nsAutoString href;
nsCOMPtr<nsIURI> uri;
nsresult result = NS_OK;
aPathname.Truncate();
result = GetHref(href);
if (NS_FAILED(result)) {
return result;
}
result = NS_NewURI(getter_AddRefs(uri), href);
if (NS_FAILED(result)) {
return result;
}
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
if (!url) {
return NS_OK;
}
char* file;
result = url->GetFilePath(&file);
if (NS_FAILED(result)) {
return result;
}
aPathname.Assign(NS_ConvertASCIItoUCS2(file));
nsCRT::free(file);
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetSearch(nsAWritableString& aSearch)
{
nsAutoString href;
nsCOMPtr<nsIURI> uri;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(getter_AddRefs(uri), href);
if (NS_OK == result) {
char *search;
nsIURL* url;
result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url);
if (NS_SUCCEEDED(result)) {
result = url->GetEscapedQuery(&search);
NS_RELEASE(url);
}
if (NS_SUCCEEDED(result) && search && (*search)) {
aSearch.Assign(PRUnichar('?'));
aSearch.Append(NS_ConvertASCIItoUCS2(search));
nsCRT::free(search);
}
else {
aSearch.SetLength(0);
}
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetPort(nsAWritableString& aPort)
{
nsAutoString href;
nsCOMPtr<nsIURI> url;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(getter_AddRefs(url), href);
if (NS_OK == result) {
aPort.Truncate(0);
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
nsAutoString portStr;
portStr.AppendInt(port);
aPort.Append(portStr);
}
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHash(nsAWritableString& aHash)
{
nsAutoString href;
nsCOMPtr<nsIURI> uri;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(getter_AddRefs(uri), href);
if (NS_OK == result) {
char *ref;
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
if (url) {
result = url->GetRef(&ref);
}
if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) {
aHash.Assign(PRUnichar('#'));
aHash.Append(NS_ConvertASCIItoUCS2(ref));
nsCRT::free(ref);
}
else {
aHash.SetLength(0);
}
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetText(nsAWritableString& aText)
{
aText.Truncate();
nsCOMPtr<nsIDOMNode> child;
GetFirstChild(getter_AddRefs(child));
if (child) {
child->GetNodeValue(aText);
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetLinkState(nsLinkState &aState)
{
aState = mLinkState;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAnchorElement::SetLinkState(nsLinkState aState)
{
mLinkState = aState;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHrefCString(char* &aBuf)
{
// Get href= attribute (relative URL).
nsAutoString relURLSpec;
if (NS_CONTENT_ATTR_HAS_VALUE ==
NS_STATIC_CAST(nsIContent *, this)->GetAttribute(kNameSpaceID_HTML,
nsHTMLAtoms::href,
relURLSpec)) {
// Clean up any leading or trailing whitespace
relURLSpec.Trim(" \t\n\r");
// Get base URL.
nsCOMPtr<nsIURI> baseURL;
GetBaseURL(*getter_AddRefs(baseURL));
if (baseURL) {
// Get absolute URL.
NS_MakeAbsoluteURIWithCharset(&aBuf, relURLSpec, mDocument, baseURL,
nsHTMLUtils::IOService,
nsHTMLUtils::CharsetMgr);
}
else {
// Absolute URL is same as relative URL.
aBuf = relURLSpec.ToNewUTF8String();
}
}
else {
// Absolute URL is null to say we have no HREF.
aBuf = nsnull;
}
return NS_OK;
}

View File

@@ -0,0 +1,374 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
#include "nsIDOMHTMLAppletElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIObjectFrame.h"
#include "nsIServiceManager.h"
#include "nsIJVMManager.h"
#include "nsILiveConnectManager.h"
#include "nsIPluginInstance.h"
#include "nsIJVMPluginInstance.h"
#include "nsLayoutAtoms.h"
// XXX this is to get around conflicts with windows.h defines
// introduced through jni.h
#ifdef XP_PC
#undef GetClassName
#undef GetObject
#endif
class nsHTMLAppletElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLAppletElement
{
public:
nsHTMLAppletElement();
virtual ~nsHTMLAppletElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLAppletElement
NS_DECL_IDOMHTMLAPPLETELEMENT
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject);
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
protected:
PRBool mReflectedApplet;
};
nsresult
NS_NewHTMLAppletElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLAppletElement* it = new nsHTMLAppletElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLAppletElement::nsHTMLAppletElement()
{
mReflectedApplet = PR_FALSE;
}
nsHTMLAppletElement::~nsHTMLAppletElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLAppletElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLAppletElement, nsGenericElement)
NS_IMPL_HTMLCONTENT_QI(nsHTMLAppletElement, nsGenericHTMLContainerElement,
nsIDOMHTMLAppletElement)
nsresult
nsHTMLAppletElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLAppletElement* it = new nsHTMLAppletElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Align, align)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Alt, alt)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Archive, archive)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Code, code)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, CodeBase, codebase)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Height, height)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Hspace, hspace)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Name, name)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Object, object)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Vspace, vspace)
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Width, width)
NS_IMETHODIMP
nsHTMLAppletElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
if (nsGenericHTMLElement::ParseAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (nsGenericHTMLElement::ParseImageAttribute(aAttribute,
aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP
nsHTMLAppletElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
nsGenericHTMLElement::AlignValueToString(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (nsGenericHTMLElement::ImageAttributeToString(aAttribute,
aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
return nsGenericHTMLContainerElement::AttributeToString(aAttribute, aValue,
aResult);
}
static void
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext)
{
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext,
aPresContext);
nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext,
aPresContext);
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext,
aPresContext);
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext,
aPresContext, nsnull);
}
NS_IMETHODIMP
nsHTMLAppletElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const
{
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
}
}
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAppletElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const
{
aFontMapFunc = nsnull;
aMapFunc = &MapAttributesInto;
return NS_OK;
}
/**
* For backwards compatibility an applet element's JavaScript object
* should expose both the public fields of the applet, and the
* attributes of the applet tag. The call to
* nsGenericElement::GetScriptObject takes case of the tag
* attributes. Here we generate a JavaScript reference to the applet
* object itself, and set its __proto__ property to the tag
* object. That way, if the Java applet has public fields that shadow
* the tag attributes, the applet's fields take precedence.
*/
NS_IMETHODIMP
nsHTMLAppletElement::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIJVMManager> jvm(do_GetService(nsIJVMManager::GetCID(), &rv));
if (NS_SUCCEEDED(rv)) {
if (!mReflectedApplet) {
// 0. Make sure the presentation is up-to-date
if (mDocument) {
mDocument->FlushPendingNotifications();
}
// 1. get the script object corresponding to the <APPLET> element itself.
JSObject* elementObject = nsnull;
rv = nsGenericHTMLContainerElement::GetScriptObject(aContext,
(void**)&elementObject);
if (NS_FAILED(rv))
return rv;
// 2. get the plugin instance corresponding to this element.
nsCOMPtr<nsIPresShell> shell;
if (mDocument)
shell = dont_AddRef(mDocument->GetShellAt(0));
nsIFrame* frame = nsnull;
if (shell) {
shell->GetPrimaryFrameFor(this, &frame);
}
if (frame) {
nsCOMPtr<nsIAtom> frameType;
frame->GetFrameType(getter_AddRefs(frameType));
if(nsLayoutAtoms::objectFrame != frameType.get()) {
*aScriptObject = elementObject;
return rv;
}
}
// 3. get the Java object corresponding to this applet, and
// reflect it into JavaScript using the LiveConnect manager.
JSContext* context = (JSContext*)aContext->GetNativeContext();
JSObject* wrappedAppletObject = nsnull;
nsCOMPtr<nsIPluginInstance> pluginInstance;
GetPluginInstance(getter_AddRefs(pluginInstance));
if (pluginInstance) {
nsCOMPtr<nsIJVMPluginInstance> javaPluginInstance;
javaPluginInstance = do_QueryInterface(pluginInstance);
if (javaPluginInstance) {
jobject appletObject = nsnull;
rv = javaPluginInstance->GetJavaObject(&appletObject);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsILiveConnectManager> manager;
manager = do_GetService(nsIJVMManager::GetCID());
if (manager) {
rv = manager->WrapJavaObject(context, appletObject,
&wrappedAppletObject);
}
}
}
}
// 4. set the __proto__ field of the applet object to be the
// element script object.
if (wrappedAppletObject) {
JS_SetPrototype(context, wrappedAppletObject, elementObject);
// Cache the wrapped applet object as our script object.
SetScriptObject(wrappedAppletObject);
mReflectedApplet = PR_TRUE;
*aScriptObject = wrappedAppletObject;
} else {
// We didn't wrap the applet object so we'll fall back and use
// the plain DOM script object.
*aScriptObject = elementObject;
}
}
else {
rv = nsGenericHTMLContainerElement::GetScriptObject(aContext,
aScriptObject);
}
}
else {
rv = nsGenericHTMLContainerElement::GetScriptObject(aContext,
aScriptObject);
}
return rv;
}
NS_IMETHODIMP
nsHTMLAppletElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}

View File

@@ -0,0 +1,502 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMNSHTMLAreaElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsILink.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIEventStateManager.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsHTMLUtils.h"
class nsHTMLAreaElement : public nsGenericHTMLLeafElement,
public nsIDOMHTMLAreaElement,
public nsIDOMNSHTMLAreaElement,
public nsILink
{
public:
nsHTMLAreaElement();
virtual ~nsHTMLAreaElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLAreaElement
NS_DECL_IDOMHTMLAREAELEMENT
// nsIDOMNSHTMLAreaElement
NS_DECL_IDOMNSHTMLAREAELEMENT
// nsILink
NS_IMETHOD GetLinkState(nsLinkState &aState);
NS_IMETHOD SetLinkState(nsLinkState aState);
NS_IMETHOD GetHrefCString(char* &aBuf);
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
nsEventStatus* aEventStatus);
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
protected:
// The cached visited state
nsLinkState mLinkState;
};
nsresult
NS_NewHTMLAreaElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLAreaElement* it = new nsHTMLAreaElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLAreaElement::nsHTMLAreaElement()
: mLinkState(eLinkState_Unknown)
{
nsHTMLUtils::AddRef(); // for GetHrefCString
}
nsHTMLAreaElement::~nsHTMLAreaElement()
{
nsHTMLUtils::Release(); // for GetHrefCString
}
NS_IMPL_ADDREF_INHERITED(nsHTMLAreaElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLAreaElement, nsGenericElement)
NS_IMPL_HTMLCONTENT_QI3(nsHTMLAreaElement, nsGenericHTMLLeafElement,
nsIDOMHTMLAreaElement, nsIDOMNSHTMLAreaElement,
nsILink)
nsresult
nsHTMLAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLAreaElement* it = new nsHTMLAreaElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, AccessKey, accesskey)
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Alt, alt)
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Coords, coords)
NS_IMPL_BOOL_ATTR(nsHTMLAreaElement, NoHref, nohref)
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Shape, shape)
NS_IMPL_INT_ATTR(nsHTMLAreaElement, TabIndex, tabindex)
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Target, target)
NS_IMETHODIMP
nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::nohref) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aAttribute == nsHTMLAtoms::tabindex) {
if (ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP
nsHTMLAreaElement::HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus)
{
return HandleDOMEventForAnchors(this, aPresContext, aEvent, aDOMEvent,
aFlags, aEventStatus);
}
NS_IMETHODIMP
nsHTMLAreaElement::SetFocus(nsIPresContext* aPresContext)
{
nsIEventStateManager* esm;
if (NS_OK == aPresContext->GetEventStateManager(&esm)) {
esm->SetContentState(this, NS_EVENT_STATE_FOCUS);
NS_RELEASE(esm);
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaElement::RemoveFocus(nsIPresContext* aPresContext)
{
nsIEventStateManager* esm;
if (NS_OK == aPresContext->GetEventStateManager(&esm)) {
esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
NS_RELEASE(esm);
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHref(nsAWritableString& aValue)
{
char *buf;
nsresult rv = GetHrefCString(buf);
if (NS_FAILED(rv)) return rv;
if (buf) {
aValue.Assign(NS_ConvertASCIItoUCS2(buf));
nsCRT::free(buf);
}
// NS_IMPL_STRING_ATTR does nothing where we have (buf == null)
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaElement::SetHref(const nsAReadableString& aValue)
{
// Clobber our "cache", so we'll recompute it the next time somebody
// asks for it.
mLinkState = eLinkState_Unknown;
return NS_STATIC_CAST(nsIContent *, this)->SetAttribute(kNameSpaceID_HTML,
nsHTMLAtoms::href,
aValue, PR_TRUE);
}
NS_IMETHODIMP
nsHTMLAreaElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetProtocol(nsAWritableString& aProtocol)
{
nsAutoString href;
nsIURI *url;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(&url, href);
if (NS_OK == result) {
char* protocol;
result = url->GetScheme(&protocol);
if (result == NS_OK) {
aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol));
aProtocol.Append(PRUnichar(':'));
nsCRT::free(protocol);
}
NS_RELEASE(url);
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHost(nsAWritableString& aHost)
{
nsAutoString href;
nsIURI *url;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(&url, href);
if (NS_OK == result) {
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
aHost.Assign(NS_ConvertASCIItoUCS2(host));
nsCRT::free(host);
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
aHost.Append(PRUnichar(':'));
nsAutoString portStr;
portStr.AppendInt(port, 10);
aHost.Append(portStr);
}
}
NS_RELEASE(url);
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHostname(nsAWritableString& aHostname)
{
nsAutoString href;
nsIURI *url;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(&url, href);
if (NS_OK == result) {
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
aHostname.Assign(NS_ConvertASCIItoUCS2(host));
nsCRT::free(host);
}
NS_RELEASE(url);
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetPathname(nsAWritableString& aPathname)
{
nsAutoString href;
nsCOMPtr<nsIURI> uri;
nsresult result = NS_OK;
aPathname.Truncate();
result = GetHref(href);
NS_ENSURE_SUCCESS(result, result);
result = NS_NewURI(getter_AddRefs(uri), href);
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
NS_ENSURE_TRUE(url, NS_OK);
char* file;
result = url->GetFilePath(&file);
NS_ENSURE_SUCCESS(result, result);
aPathname.Assign(NS_ConvertASCIItoUCS2(file));
nsCRT::free(file);
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetSearch(nsAWritableString& aSearch)
{
nsAutoString href;
nsCOMPtr<nsIURI> uri;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_SUCCEEDED(result)) {
result = NS_NewURI(getter_AddRefs(uri), href);
if (NS_SUCCEEDED(result)) {
char *search;
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
if (url) {
result = url->GetEscapedQuery(&search);
}
if (NS_SUCCEEDED(result) && search && *search) {
aSearch.Assign(PRUnichar('?'));
aSearch.Append(NS_ConvertASCIItoUCS2(search));
nsCRT::free(search);
}
else {
aSearch.SetLength(0);
}
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetPort(nsAWritableString& aPort)
{
nsAutoString href;
nsCOMPtr<nsIURI> url;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_SUCCEEDED(result)) {
result = NS_NewURI(getter_AddRefs(url), href);
if (NS_SUCCEEDED(result)) {
aPort.SetLength(0);
PRInt32 port;
url->GetPort(&port);
if (-1 != port) {
nsAutoString portStr;
portStr.AppendInt(port, 10);
aPort.Append(portStr);
}
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHash(nsAWritableString& aHash)
{
nsAutoString href;
nsCOMPtr<nsIURI> uri;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(getter_AddRefs(uri), href);
if (NS_SUCCEEDED(result)) {
char *ref;
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
if (url) {
result = url->GetRef(&ref);
}
if (NS_SUCCEEDED(result) && ref && *ref) {
aHash.Assign(PRUnichar('#'));
aHash.Append(NS_ConvertASCIItoUCS2(ref));
nsCRT::free(ref);
}
else {
aHash.SetLength(0);
}
}
}
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetLinkState(nsLinkState &aState)
{
aState = mLinkState;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaElement::SetLinkState(nsLinkState aState)
{
mLinkState = aState;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHrefCString(char* &aBuf)
{
// Get href= attribute (relative URL).
nsAutoString relURLSpec;
if (NS_CONTENT_ATTR_HAS_VALUE ==
NS_STATIC_CAST(nsIContent *, this)->GetAttribute(kNameSpaceID_HTML,
nsHTMLAtoms::href,
relURLSpec)) {
// Clean up any leading or trailing whitespace
relURLSpec.Trim(" \t\n\r");
// Get base URL.
nsCOMPtr<nsIURI> baseURL;
GetBaseURL(*getter_AddRefs(baseURL));
if (baseURL) {
// Get absolute URL.
NS_MakeAbsoluteURIWithCharset(&aBuf, relURLSpec, mDocument, baseURL,
nsHTMLUtils::IOService, nsHTMLUtils::CharsetMgr);
}
else {
// Absolute URL is same as relative URL.
aBuf = relURLSpec.ToNewUTF8String();
}
}
else {
// Absolute URL is empty because we have no HREF.
aBuf = nsnull;
}
return NS_OK;
}

View File

@@ -0,0 +1,227 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsIDOMHTMLBRElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
class nsHTMLBRElement : public nsGenericHTMLLeafElement,
public nsIDOMHTMLBRElement
{
public:
nsHTMLBRElement();
virtual ~nsHTMLBRElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLBRElement
NS_DECL_IDOMHTMLBRELEMENT
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const;
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
};
nsresult
NS_NewHTMLBRElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLBRElement* it = new nsHTMLBRElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLBRElement::nsHTMLBRElement()
{
}
nsHTMLBRElement::~nsHTMLBRElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLBRElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLBRElement, nsGenericElement)
NS_IMPL_HTMLCONTENT_QI(nsHTMLBRElement, nsGenericHTMLLeafElement,
nsIDOMHTMLBRElement)
nsresult
nsHTMLBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLBRElement* it = new nsHTMLBRElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLBRElement, Clear, clear)
static nsGenericHTMLElement::EnumTable kClearTable[] = {
{ "left", NS_STYLE_CLEAR_LEFT },
{ "right", NS_STYLE_CLEAR_RIGHT },
{ "all", NS_STYLE_CLEAR_LEFT_AND_RIGHT },
{ "both", NS_STYLE_CLEAR_LEFT_AND_RIGHT },
{ 0 }
};
NS_IMETHODIMP
nsHTMLBRElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::clear) {
if (ParseEnumValue(aValue, kClearTable, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP
nsHTMLBRElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::clear) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
EnumValueToString(aValue, kClearTable, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return nsGenericHTMLLeafElement::AttributeToString(aAttribute, aValue,
aResult);
}
static void
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext)
{
nsStyleDisplay* display = (nsStyleDisplay*)
aContext->GetMutableStyleData(eStyleStruct_Display);
nsHTMLValue value;
aAttributes->GetAttribute(nsHTMLAtoms::clear, value);
if (value.GetUnit() == eHTMLUnit_Enumerated) {
display->mBreakType = value.GetIntValue();
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext,
aPresContext);
}
NS_IMETHODIMP
nsHTMLBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const
{
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (nsHTMLAtoms::clear == aAttribute) {
aHint = NS_STYLE_HINT_REFLOW;
}
else {
aHint = NS_STYLE_HINT_CONTENT;
}
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const
{
aFontMapFunc = nsnull;
aMapFunc = &MapAttributesInto;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLBRElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}

View File

@@ -0,0 +1,142 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsIDOMHTMLBaseElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
class nsHTMLBaseElement : public nsGenericHTMLLeafElement,
public nsIDOMHTMLBaseElement
{
public:
nsHTMLBaseElement();
virtual ~nsHTMLBaseElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLBaseElement
NS_DECL_IDOMHTMLBASEELEMENT
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
};
nsresult
NS_NewHTMLBaseElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo* aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLBaseElement* it = new nsHTMLBaseElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLBaseElement::nsHTMLBaseElement()
{
}
nsHTMLBaseElement::~nsHTMLBaseElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLBaseElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLBaseElement, nsGenericElement)
NS_IMPL_HTMLCONTENT_QI(nsHTMLBaseElement, nsGenericHTMLLeafElement,
nsIDOMHTMLBaseElement)
nsresult
nsHTMLBaseElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLBaseElement* it = new nsHTMLBaseElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLBaseElement, Href, href)
NS_IMPL_STRING_ATTR(nsHTMLBaseElement, Target, target)
NS_IMETHODIMP
nsHTMLBaseElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}

View File

@@ -0,0 +1,161 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsIDOMHTMLBaseFontElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
class nsHTMLBaseFontElement : public nsGenericHTMLLeafElement,
public nsIDOMHTMLBaseFontElement
{
public:
nsHTMLBaseFontElement();
virtual ~nsHTMLBaseFontElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLBaseElement
NS_DECL_IDOMHTMLBASEFONTELEMENT
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
};
nsresult
NS_NewHTMLBaseFontElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLBaseFontElement* it = new nsHTMLBaseFontElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLBaseFontElement::nsHTMLBaseFontElement()
{
}
nsHTMLBaseFontElement::~nsHTMLBaseFontElement()
{
}
NS_IMPL_ADDREF(nsHTMLBaseFontElement)
NS_IMPL_RELEASE(nsHTMLBaseFontElement)
NS_IMPL_HTMLCONTENT_QI(nsHTMLBaseFontElement, nsGenericHTMLLeafElement,
nsIDOMHTMLBaseFontElement)
nsresult
nsHTMLBaseFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLBaseFontElement* it = new nsHTMLBaseFontElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Color, color)
NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Face, face)
NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Size, size)
NS_IMETHODIMP
nsHTMLBaseFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const
{
if ((nsHTMLAtoms::color == aAttribute) ||
(nsHTMLAtoms::face == aAttribute) ||
(nsHTMLAtoms::size == aAttribute)) {
aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; // XXX this seems a bit harsh, perhaps we need a reflow_all?
}
else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLBaseFontElement::SizeOf(nsISizeOfHandler* aSizer,
PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,497 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsIDOMHTMLButtonElement.h"
#include "nsIDOMNSHTMLButtonElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIFormControl.h"
#include "nsIForm.h"
#include "nsIURL.h"
#include "nsIFormControlFrame.h"
#include "nsIEventStateManager.h"
#include "nsIDOMEvent.h"
#include "nsISizeOfHandler.h"
#include "nsIDocument.h"
class nsHTMLButtonElement : public nsGenericHTMLContainerFormElement,
public nsIDOMHTMLButtonElement,
public nsIDOMNSHTMLButtonElement
{
public:
nsHTMLButtonElement();
virtual ~nsHTMLButtonElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerFormElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerFormElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLButtonElement
NS_DECL_IDOMHTMLBUTTONELEMENT
// nsIDOMNSHTMLButtonElement
NS_DECL_IDOMNSHTMLBUTTONELEMENT
// overrided nsIFormControl method
NS_IMETHOD GetType(PRInt32* aType);
// nsIContent overrides...
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAWritableString& aResult) const;
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAReadableString& aValue, PRBool aNotify);
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus);
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
protected:
PRInt8 mType;
};
// Construction, destruction
nsresult
NS_NewHTMLButtonElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLButtonElement* it = new nsHTMLButtonElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = NS_STATIC_CAST(nsGenericElement *, it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLButtonElement::nsHTMLButtonElement()
{
mType = NS_FORM_BUTTON_BUTTON; // default
}
nsHTMLButtonElement::~nsHTMLButtonElement()
{
// Null out form's pointer to us - no ref counting here!
SetForm(nsnull);
}
// nsISupports
NS_IMPL_ADDREF_INHERITED(nsHTMLButtonElement, nsGenericElement);
NS_IMPL_RELEASE_INHERITED(nsHTMLButtonElement, nsGenericElement);
NS_IMPL_HTMLCONTENT_QI2(nsHTMLButtonElement, nsGenericHTMLContainerFormElement,
nsIDOMHTMLButtonElement, nsIDOMNSHTMLButtonElement);
NS_IMETHODIMP
nsHTMLButtonElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAWritableString& aResult) const
{
if (aName == nsHTMLAtoms::disabled) {
nsresult rv = nsGenericHTMLContainerFormElement::GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, aResult);
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
aResult.Assign(NS_LITERAL_STRING("false"));
} else {
aResult.Assign(NS_LITERAL_STRING("true"));
}
return rv;
}
return nsGenericHTMLContainerFormElement::GetAttribute(aNameSpaceID, aName,
aResult);
}
NS_IMETHODIMP
nsHTMLButtonElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAReadableString& aValue,
PRBool aNotify)
{
nsAutoString value(aValue);
if (aName == nsHTMLAtoms::disabled &&
value.EqualsWithConversion("false", PR_TRUE)) {
return UnsetAttribute(aNameSpaceID, aName, aNotify);
}
return nsGenericHTMLContainerFormElement::SetAttribute(aNameSpaceID, aName,
aValue, aNotify);
}
// nsIDOMHTMLButtonElement
nsresult
nsHTMLButtonElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLButtonElement* it = new nsHTMLButtonElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement *, it)->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
// nsIContent
NS_IMETHODIMP
nsHTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
return nsGenericHTMLContainerFormElement::GetForm(aForm);
}
NS_IMETHODIMP
nsHTMLButtonElement::GetType(nsAWritableString& aType)
{
return AttributeToString(nsHTMLAtoms::type,
nsHTMLValue(mType, eHTMLUnit_Enumerated),
aType);
}
NS_IMPL_STRING_ATTR(nsHTMLButtonElement, AccessKey, accesskey)
NS_IMPL_BOOL_ATTR(nsHTMLButtonElement, Disabled, disabled)
NS_IMPL_STRING_ATTR(nsHTMLButtonElement, Name, name)
NS_IMPL_INT_ATTR(nsHTMLButtonElement, TabIndex, tabindex)
NS_IMPL_STRING_ATTR(nsHTMLButtonElement, Value, value)
NS_IMETHODIMP
nsHTMLButtonElement::Blur()
{
nsCOMPtr<nsIPresContext> presContext;
GetPresContext(this, getter_AddRefs(presContext));
return RemoveFocus(presContext);
}
NS_IMETHODIMP
nsHTMLButtonElement::Focus()
{
nsCOMPtr<nsIPresContext> presContext;
GetPresContext(this, getter_AddRefs(presContext));
return SetFocus(presContext);
}
NS_IMETHODIMP
nsHTMLButtonElement::SetFocus(nsIPresContext* aPresContext)
{
// first see if we are disabled or not. If disabled then do nothing.
nsAutoString disabled;
if (NS_CONTENT_ATTR_HAS_VALUE == GetAttribute(kNameSpaceID_HTML,
nsHTMLAtoms::disabled,
disabled)) {
return NS_OK;
}
nsCOMPtr<nsIEventStateManager> esm;
if (NS_OK == aPresContext->GetEventStateManager(getter_AddRefs(esm))) {
esm->SetContentState(this, NS_EVENT_STATE_FOCUS);
}
nsIFormControlFrame* formControlFrame = nsnull;
nsresult rv = GetPrimaryFrame(this, formControlFrame);
if (NS_SUCCEEDED(rv)) {
formControlFrame->SetFocus(PR_TRUE, PR_TRUE);
formControlFrame->ScrollIntoView(aPresContext);
}
return rv;
}
NS_IMETHODIMP
nsHTMLButtonElement::RemoveFocus(nsIPresContext* aPresContext)
{
// If we are disabled, we probably shouldn't have focus in the
// first place, so allow it to be removed.
nsresult rv = NS_OK;
nsIFormControlFrame* formControlFrame = nsnull;
rv = GetPrimaryFrame(this, formControlFrame);
if (NS_SUCCEEDED(rv)) {
formControlFrame->SetFocus(PR_FALSE, PR_FALSE);
}
nsCOMPtr<nsIEventStateManager> esm;
if (NS_OK == aPresContext->GetEventStateManager(getter_AddRefs(esm))) {
nsCOMPtr<nsIDocument> doc;
GetDocument(*getter_AddRefs(doc));
if (!doc)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIContent> rootContent;
rootContent = getter_AddRefs(doc->GetRootContent());
rv = esm->SetContentState(rootContent, NS_EVENT_STATE_FOCUS);
}
return rv;
}
static nsGenericHTMLElement::EnumTable kButtonTypeTable[] = {
{ "button", NS_FORM_BUTTON_BUTTON },
{ "reset", NS_FORM_BUTTON_RESET },
{ "submit", NS_FORM_BUTTON_SUBMIT },
{ 0 }
};
NS_IMETHODIMP
nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::tabindex) {
if (ParseValue(aValue, 0, 32767, aResult, eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::type) {
nsGenericHTMLElement::EnumTable *table = kButtonTypeTable;
nsAutoString val(aValue);
while (nsnull != table->tag) {
if (val.EqualsIgnoreCase(table->tag)) {
aResult.SetIntValue(table->value, eHTMLUnit_Enumerated);
mType = table->value;
return NS_CONTENT_ATTR_HAS_VALUE;
}
table++;
}
}
else if (aAttribute == nsHTMLAtoms::disabled) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_HAS_VALUE;
}
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP
nsHTMLButtonElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::type) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
EnumValueToString(aValue, kButtonTypeTable, aResult, PR_FALSE);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return nsGenericHTMLContainerFormElement::AttributeToString(aAttribute,
aValue, aResult);
}
NS_IMETHODIMP
nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus)
{
NS_ENSURE_ARG(aPresContext);
NS_ENSURE_ARG_POINTER(aEventStatus);
// Do not process any DOM events if the element is disabled
PRBool bDisabled;
nsresult rv = GetDisabled(&bDisabled);
if (NS_FAILED(rv) || bDisabled) {
return rv;
}
// Try script event handlers first
nsresult ret;
ret = nsGenericHTMLContainerFormElement::HandleDOMEvent(aPresContext,
aEvent, aDOMEvent,
aFlags,
aEventStatus);
if ((NS_OK == ret) && (nsEventStatus_eIgnore == *aEventStatus) &&
!(aFlags & NS_EVENT_FLAG_CAPTURE)) {
switch (aEvent->message) {
case NS_KEY_PRESS:
case NS_KEY_UP:
{
// For backwards compat, trigger buttons with space or enter
// (bug 25300)
nsKeyEvent * keyEvent = (nsKeyEvent *)aEvent;
if ((keyEvent->keyCode == NS_VK_RETURN && NS_KEY_PRESS == aEvent->message) ||
keyEvent->keyCode == NS_VK_SPACE && NS_KEY_UP == aEvent->message) {
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event;
event.eventStructType = NS_MOUSE_EVENT;
event.message = NS_MOUSE_LEFT_CLICK;
event.isShift = PR_FALSE;
event.isControl = PR_FALSE;
event.isAlt = PR_FALSE;
event.isMeta = PR_FALSE;
event.clickCount = 0;
event.widget = nsnull;
rv = HandleDOMEvent(aPresContext, &event, nsnull,
NS_EVENT_FLAG_INIT, &status);
}
}
break;// NS_KEY_PRESS
case NS_MOUSE_LEFT_CLICK:
{
// Tell the frame about the click
nsIFormControlFrame* formControlFrame = nsnull;
rv = GetPrimaryFrame(this, formControlFrame);
if (NS_SUCCEEDED(rv)) {
formControlFrame->MouseClicked(aPresContext);
}
}
break;// NS_MOUSE_LEFT_CLICK
case NS_MOUSE_LEFT_BUTTON_DOWN:
{
nsIEventStateManager *stateManager;
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
stateManager->SetContentState(this, NS_EVENT_STATE_ACTIVE |
NS_EVENT_STATE_FOCUS);
NS_RELEASE(stateManager);
}
*aEventStatus = nsEventStatus_eConsumeNoDefault;
}
break;
// cancel all of these events for buttons
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
case NS_MOUSE_MIDDLE_BUTTON_UP:
case NS_MOUSE_MIDDLE_DOUBLECLICK:
case NS_MOUSE_RIGHT_DOUBLECLICK:
case NS_MOUSE_RIGHT_BUTTON_DOWN:
case NS_MOUSE_RIGHT_BUTTON_UP:
if (aDOMEvent != nsnull && *aDOMEvent != nsnull) {
(*aDOMEvent)->PreventBubble();
} else {
ret = NS_ERROR_FAILURE;
}
break;
case NS_MOUSE_ENTER_SYNTH:
{
nsIEventStateManager *stateManager;
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
stateManager->SetContentState(this, NS_EVENT_STATE_HOVER);
NS_RELEASE(stateManager);
}
*aEventStatus = nsEventStatus_eConsumeNoDefault;
}
break;
// XXX this doesn't seem to do anything yet
case NS_MOUSE_EXIT_SYNTH:
{
nsIEventStateManager *stateManager;
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
stateManager->SetContentState(nsnull, NS_EVENT_STATE_HOVER);
NS_RELEASE(stateManager);
}
*aEventStatus = nsEventStatus_eConsumeNoDefault;
}
break;
default:
break;
}
}
return ret;
}
NS_IMETHODIMP
nsHTMLButtonElement::GetType(PRInt32* aType)
{
if (aType) {
*aType = mType;
return NS_OK;
} else {
return NS_FORM_NOTOK;
}
}
NS_IMETHODIMP
nsHTMLButtonElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}

View File

@@ -0,0 +1,201 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsIDOMHTMLDListElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
class nsHTMLDListElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLDListElement
{
public:
nsHTMLDListElement();
virtual ~nsHTMLDListElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLDListElement
NS_IMETHOD GetCompact(PRBool* aCompact);
NS_IMETHOD SetCompact(PRBool aCompact);
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const;
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
};
nsresult
NS_NewHTMLDListElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLDListElement* it = new nsHTMLDListElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLDListElement::nsHTMLDListElement()
{
}
nsHTMLDListElement::~nsHTMLDListElement()
{
}
NS_IMPL_ADDREF(nsHTMLDListElement);
NS_IMPL_RELEASE(nsHTMLDListElement);
NS_IMPL_HTMLCONTENT_QI(nsHTMLDListElement, nsGenericHTMLContainerElement,
nsIDOMHTMLDListElement);
nsresult
nsHTMLDListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLDListElement* it = new nsHTMLDListElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_BOOL_ATTR(nsHTMLDListElement, Compact, compact)
NS_IMETHODIMP
nsHTMLDListElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::compact) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_NO_VALUE;
}
return NS_CONTENT_ATTR_NOT_THERE;
}
static void
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext)
{
if (nsnull != aAttributes) {
nsHTMLValue value;
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
if (value.GetUnit() == eHTMLUnit_Empty) {
// XXX set
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
}
NS_IMETHODIMP
nsHTMLDListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const
{
if (aAttribute == nsHTMLAtoms::compact) {
aHint = NS_STYLE_HINT_CONTENT; // handled by ua.css?
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const
{
aFontMapFunc = nsnull;
aMapFunc = &MapAttributesInto;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDListElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}

View File

@@ -0,0 +1,142 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsIDOMHTMLModElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
class nsHTMLDelElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLModElement
{
public:
nsHTMLDelElement();
virtual ~nsHTMLDelElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLModElement
NS_DECL_IDOMHTMLMODELEMENT
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
};
nsresult
NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLDelElement* it = new nsHTMLDelElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLDelElement::nsHTMLDelElement()
{
}
nsHTMLDelElement::~nsHTMLDelElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLDelElement, nsGenericElement);
NS_IMPL_RELEASE_INHERITED(nsHTMLDelElement, nsGenericElement);
NS_IMPL_HTMLCONTENT_QI(nsHTMLDelElement, nsGenericHTMLContainerElement,
nsIDOMHTMLModElement);
nsresult
nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLDelElement* it = new nsHTMLDelElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLDelElement, Cite, cite)
NS_IMPL_STRING_ATTR(nsHTMLDelElement, DateTime, datetime)
NS_IMETHODIMP
nsHTMLDelElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}

View File

@@ -0,0 +1,244 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* 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):
*/
#include "nsIDOMHTMLDirectoryElement.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
// XXX nav4 has type= start= (same as OL/UL)
extern nsGenericHTMLElement::EnumTable kListTypeTable[];
class nsHTMLDirectoryElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLDirectoryElement
{
public:
nsHTMLDirectoryElement();
virtual ~nsHTMLDirectoryElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
// nsIDOMElement
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLElement
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLDirectoryElement
NS_DECL_IDOMHTMLDIRECTORYELEMENT
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const;
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
};
nsresult
NS_NewHTMLDirectoryElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLDirectoryElement* it = new nsHTMLDirectoryElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLDirectoryElement::nsHTMLDirectoryElement()
{
}
nsHTMLDirectoryElement::~nsHTMLDirectoryElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLDirectoryElement, nsGenericElement);
NS_IMPL_RELEASE_INHERITED(nsHTMLDirectoryElement, nsGenericElement);
NS_IMPL_HTMLCONTENT_QI(nsHTMLDirectoryElement, nsGenericHTMLContainerElement,
nsIDOMHTMLDirectoryElement);
nsresult
nsHTMLDirectoryElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLDirectoryElement* it = new nsHTMLDirectoryElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_BOOL_ATTR(nsHTMLDirectoryElement, Compact, compact)
NS_IMETHODIMP
nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
if (ParseEnumValue(aValue, kListTypeTable, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::start) {
if (ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::compact) {
aResult.SetEmptyValue();
return NS_CONTENT_ATTR_NO_VALUE;
}
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP
nsHTMLDirectoryElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::type) {
EnumValueToString(aValue, kListTypeTable, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
return nsGenericHTMLContainerElement::AttributeToString(aAttribute, aValue,
aResult);
}
static void
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsIMutableStyleContext* aContext,
nsIPresContext* aPresContext)
{
if (nsnull != aAttributes) {
nsHTMLValue value;
nsStyleList* list = (nsStyleList*)
aContext->GetMutableStyleData(eStyleStruct_List);
// type: enum
aAttributes->GetAttribute(nsHTMLAtoms::type, value);
if (value.GetUnit() == eHTMLUnit_Enumerated) {
list->mListStyleType = value.GetIntValue();
}
else if (value.GetUnit() != eHTMLUnit_Null) {
list->mListStyleType = NS_STYLE_LIST_STYLE_BASIC;
}
// compact: empty
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
if (value.GetUnit() == eHTMLUnit_Empty) {
// XXX set
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
}
NS_IMETHODIMP
nsHTMLDirectoryElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32& aHint) const
{
if (aAttribute == nsHTMLAtoms::type) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (aAttribute == nsHTMLAtoms::compact) {
aHint = NS_STYLE_HINT_CONTENT; // XXX
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDirectoryElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
nsMapAttributesFunc& aMapFunc) const
{
aFontMapFunc = nsnull;
aMapFunc = &MapAttributesInto;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDirectoryElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}

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