Compare commits
47 Commits
BASE_17_FE
...
N2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
233427693e | ||
|
|
8a5d6cea8a | ||
|
|
060c6b2ea2 | ||
|
|
09b0cb9dac | ||
|
|
edba634cae | ||
|
|
a7365899d1 | ||
|
|
c3389b3323 | ||
|
|
718ec18100 | ||
|
|
7d190a8dd4 | ||
|
|
e1ebb3e092 | ||
|
|
59705f110a | ||
|
|
10d067c837 | ||
|
|
0995f00878 | ||
|
|
44c6ee7bd0 | ||
|
|
6b475c2062 | ||
|
|
6445d6fc19 | ||
|
|
504987c7f8 | ||
|
|
3c3c9de879 | ||
|
|
4fb4cdbaf9 | ||
|
|
6c56d63c2b | ||
|
|
6360bf628f | ||
|
|
17afc12ff5 | ||
|
|
d2c8923434 | ||
|
|
d962f6c931 | ||
|
|
c467d95fcc | ||
|
|
7d6ab18c04 | ||
|
|
2267821c34 | ||
|
|
f652521f1f | ||
|
|
4df60ddcca | ||
|
|
2a952c444d | ||
|
|
b1d8f9e682 | ||
|
|
d2229d1d13 | ||
|
|
1165868b3c | ||
|
|
f74ec1b6ec | ||
|
|
2946bb22b6 | ||
|
|
071e3adc48 | ||
|
|
46e56a76cd | ||
|
|
7a5a6134fc | ||
|
|
57dafff70d | ||
|
|
34420a2e9d | ||
|
|
81aeb86448 | ||
|
|
5586abebc4 | ||
|
|
76c32f445f | ||
|
|
ca07152e56 | ||
|
|
aa16a83c74 | ||
|
|
df7795dbf4 | ||
|
|
74ce2dfd5d |
40
mozilla/LEGAL
Normal file
40
mozilla/LEGAL
Normal file
@@ -0,0 +1,40 @@
|
||||
Please be apprised of the following Legal Notices:
|
||||
|
||||
A) The U.S. District Court for the Eastern District of Virginia has
|
||||
ruled that the Netscape Navigator code does not infringe Wang's U.S.
|
||||
Patent No. 4,751,669 ("the '669 Patent") because: 1) HTML is not
|
||||
Videotex as defined by the '669 patent; 2) web servers are not central
|
||||
suppliers; and 3) Navigator does not "connect," as defined by the '669
|
||||
Patent, to web servers on the Internet. Wang may appeal this decision to
|
||||
the Federal Circuit. Wang contended that its Patent disclosing a
|
||||
"Videotext" system, is infringed by the following functionality in the
|
||||
Netscape Navigator code: 1) the animated logo and status line indicators
|
||||
--See Claims 1,8 and 9; 2) the "File Save As" function --See Claims
|
||||
23-27; 3) Bookmarks and Rename Bookmarks in the Properties window --See
|
||||
Claims 20-22; 4) storing HTML, GIF, and JPEG files and adding filename
|
||||
extensions --See Claim 38
|
||||
|
||||
B) Intermind owns pending U.S. patent applications on communications
|
||||
systems which employ metadata ("channel objects") to define a control
|
||||
structure for information transfer. The Netscape code does not infringe
|
||||
as released; however, modifications which utilize channel objects as
|
||||
described by Intermind should be considered carefully. The following is
|
||||
a statement from Intermind: "Intermind's claims fundamentally involve
|
||||
the use of a control structure to automate communications. ...The
|
||||
essence of Intermind's top claim is that two devices sender and
|
||||
receiver have persistent storage, communicate over a network,
|
||||
and exchange a control structure including metadata which describes: 1)
|
||||
what information is to be updated, 2) when to update this information,
|
||||
and 3) how to transfer the updated information. In addition, at least
|
||||
the receiving device must be able to process the metadata in order to
|
||||
perform the update determination and transfer. Any digital
|
||||
communications system which incorporates all of these elements will be
|
||||
covered by Intermind's patents." See Intermind.com.
|
||||
|
||||
C) Stac, Inc., and its licensing agent Hi/fn, own several patents which
|
||||
disclose data compression methods implementing an LZS compression
|
||||
algorithm, including U.S. Patent Nos. 4,701,745 and 5,016, 009 ("the
|
||||
Stac Patents"). The Netscape Communicator code does not perform
|
||||
compression. If you modify the Netscape source code to perform
|
||||
compression, please take notice of the Stac Patents.
|
||||
|
||||
421
mozilla/LICENSE
Normal file
421
mozilla/LICENSE
Normal file
@@ -0,0 +1,421 @@
|
||||
NETSCAPE PUBLIC LICENSE
|
||||
Version 1.0
|
||||
|
||||
----------------
|
||||
|
||||
1. Definitions.
|
||||
|
||||
1.1. ``Contributor'' means each entity that creates or contributes to
|
||||
the creation of Modifications.
|
||||
|
||||
1.2. ``Contributor Version'' means the combination of the Original
|
||||
Code, prior Modifications used by a Contributor, and the Modifications
|
||||
made by that particular Contributor.
|
||||
|
||||
1.3. ``Covered Code'' means the Original Code or Modifications or the
|
||||
combination of the Original Code and Modifications, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.4. ``Electronic Distribution Mechanism'' means a mechanism generally
|
||||
accepted in the software development community for the electronic
|
||||
transfer of data.
|
||||
|
||||
1.5. ``Executable'' means Covered Code in any form other than Source
|
||||
Code.
|
||||
|
||||
1.6. ``Initial Developer'' means the individual or entity identified as
|
||||
the Initial Developer in the Source Code notice required by Exhibit A.
|
||||
|
||||
1.7. ``Larger Work'' means a work which combines Covered Code or
|
||||
portions thereof with code not governed by the terms of this License.
|
||||
|
||||
1.8. ``License'' means this document.
|
||||
|
||||
1.9. ``Modifications'' means any addition to or deletion from the
|
||||
substance or structure of either the Original Code or any previous
|
||||
Modifications. When Covered Code is released as a series of files, a
|
||||
Modification is:
|
||||
|
||||
A. Any addition to or deletion from the contents of a file
|
||||
containing Original Code or previous Modifications.
|
||||
|
||||
B. Any new file that contains any part of the Original Code or
|
||||
previous Modifications.
|
||||
|
||||
1.10. ``Original Code'' means Source Code of computer software code
|
||||
which is described in the Source Code notice required by Exhibit A as
|
||||
Original Code, and which, at the time of its release under this License
|
||||
is not already Covered Code governed by this License.
|
||||
|
||||
1.11. ``Source Code'' means the preferred form of the Covered Code for
|
||||
making modifications to it, including all modules it contains, plus any
|
||||
associated interface definition files, scripts used to control
|
||||
compilation and installation of an Executable, or a list of source code
|
||||
differential comparisons against either the Original Code or another
|
||||
well known, available Covered Code of the Contributor's choice. The
|
||||
Source Code can be in a compressed or archival form, provided the
|
||||
appropriate decompression or de-archiving software is widely available
|
||||
for no charge.
|
||||
|
||||
1.12. ``You'' means an individual or a legal entity exercising rights
|
||||
under, and complying with all of the terms of, this License or a future
|
||||
version of this License issued under Section 6.1. For legal entities,
|
||||
``You'' includes any entity which controls, is controlled by, or is
|
||||
under common control with You. For purposes of this definition,
|
||||
``control'' means (a) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (b) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares or beneficial ownership of such entity.
|
||||
|
||||
2. Source Code License.
|
||||
|
||||
2.1. The Initial Developer Grant.
|
||||
The Initial Developer hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license, subject to third party intellectual property
|
||||
claims:
|
||||
|
||||
(a) to use, reproduce, modify, display, perform, sublicense and
|
||||
distribute the Original Code (or portions thereof) with or without
|
||||
Modifications, or as part of a Larger Work; and
|
||||
|
||||
(b) under patents now or hereafter owned or controlled by Initial
|
||||
Developer, to make, have made, use and sell (``Utilize'') the
|
||||
Original Code (or portions thereof), but solely to the extent that
|
||||
any such patent is reasonably necessary to enable You to Utilize
|
||||
the Original Code (or portions thereof) and not to any greater
|
||||
extent that may be necessary to Utilize further Modifications or
|
||||
combinations.
|
||||
|
||||
2.2. Contributor Grant.
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license, subject to third party intellectual property
|
||||
claims:
|
||||
|
||||
(a) to use, reproduce, modify, display, perform, sublicense and
|
||||
distribute the Modifications created by such Contributor (or
|
||||
portions thereof) either on an unmodified basis, with other
|
||||
Modifications, as Covered Code or as part of a Larger Work; and
|
||||
|
||||
(b) under patents now or hereafter owned or controlled by
|
||||
Contributor, to Utilize the Contributor Version (or portions
|
||||
thereof), but solely to the extent that any such patent is
|
||||
reasonably necessary to enable You to Utilize the Contributor
|
||||
Version (or portions thereof), and not to any greater extent that
|
||||
may be necessary to Utilize further Modifications or combinations.
|
||||
|
||||
3. Distribution Obligations.
|
||||
|
||||
3.1. Application of License.
|
||||
The Modifications which You create or to which You contribute are
|
||||
governed by the terms of this License, including without limitation
|
||||
Section 2.2. The Source Code version of Covered Code may be distributed
|
||||
only under the terms of this License or a future version of this
|
||||
License released under Section 6.1, and You must include a copy of this
|
||||
License with every copy of the Source Code You distribute. You may not
|
||||
offer or impose any terms on any Source Code version that alters or
|
||||
restricts the applicable version of this License or the recipients'
|
||||
rights hereunder. However, You may include an additional document
|
||||
offering the additional rights described in Section 3.5.
|
||||
|
||||
3.2. Availability of Source Code.
|
||||
Any Modification which You create or to which You contribute must be
|
||||
made available in Source Code form under the terms of this License
|
||||
either on the same media as an Executable version or via an accepted
|
||||
Electronic Distribution Mechanism to anyone to whom you made an
|
||||
Executable version available; and if made available via Electronic
|
||||
Distribution Mechanism, must remain available for at least twelve (12)
|
||||
months after the date it initially became available, or at least six
|
||||
(6) months after a subsequent version of that particular Modification
|
||||
has been made available to such recipients. You are responsible for
|
||||
ensuring that the Source Code version remains available even if the
|
||||
Electronic Distribution Mechanism is maintained by a third party.
|
||||
|
||||
3.3. Description of Modifications.
|
||||
You must cause all Covered Code to which you contribute to contain a
|
||||
file documenting the changes You made to create that Covered Code and
|
||||
the date of any change. You must include a prominent statement that the
|
||||
Modification is derived, directly or indirectly, from Original Code
|
||||
provided by the Initial Developer and including the name of the Initial
|
||||
Developer in (a) the Source Code, and (b) in any notice in an
|
||||
Executable version or related documentation in which You describe the
|
||||
origin or ownership of the Covered Code.
|
||||
|
||||
3.4. Intellectual Property Matters
|
||||
|
||||
(a) Third Party Claims.
|
||||
If You have knowledge that a party claims an intellectual property
|
||||
right in particular functionality or code (or its utilization
|
||||
under this License), you must include a text file with the source
|
||||
code distribution titled ``LEGAL'' which describes the claim and
|
||||
the party making the claim in sufficient detail that a recipient
|
||||
will know whom to contact. If you obtain such knowledge after You
|
||||
make Your Modification available as described in Section 3.2, You
|
||||
shall promptly modify the LEGAL file in all copies You make
|
||||
available thereafter and shall take other steps (such as notifying
|
||||
appropriate mailing lists or newsgroups) reasonably calculated to
|
||||
inform those who received the Covered Code that new knowledge has
|
||||
been obtained.
|
||||
|
||||
(b) Contributor APIs.
|
||||
If Your Modification is an application programming interface and
|
||||
You own or control patents which are reasonably necessary to
|
||||
implement that API, you must also include this information in the
|
||||
LEGAL file.
|
||||
|
||||
3.5. Required Notices.
|
||||
You must duplicate the notice in Exhibit A in each file of the Source
|
||||
Code, and this License in any documentation for the Source Code, where
|
||||
You describe recipients' rights relating to Covered Code. If You
|
||||
created one or more Modification(s), You may add your name as a
|
||||
Contributor to the notice described in Exhibit A. If it is not possible
|
||||
to put such notice in a particular Source Code file due to its
|
||||
structure, then you must include such notice in a location (such as a
|
||||
relevant directory file) where a user would be likely to look for such
|
||||
a notice. You may choose to offer, and to charge a fee for, warranty,
|
||||
support, indemnity or liability obligations to one or more recipients
|
||||
of Covered Code. However, You may do so only on Your own behalf, and
|
||||
not on behalf of the Initial Developer or any Contributor. You must
|
||||
make it absolutely clear than any such warranty, support, indemnity or
|
||||
liability obligation is offered by You alone, and You hereby agree to
|
||||
indemnify the Initial Developer and every Contributor for any liability
|
||||
incurred by the Initial Developer or such Contributor as a result of
|
||||
warranty, support, indemnity or liability terms You offer.
|
||||
|
||||
3.6. Distribution of Executable Versions.
|
||||
You may distribute Covered Code in Executable form only if the
|
||||
requirements of Section 3.1-3.5 have been met for that Covered Code,
|
||||
and if You include a notice stating that the Source Code version of the
|
||||
Covered Code is available under the terms of this License, including a
|
||||
description of how and where You have fulfilled the obligations of
|
||||
Section 3.2. The notice must be conspicuously included in any notice in
|
||||
an Executable version, related documentation or collateral in which You
|
||||
describe recipients' rights relating to the Covered Code. You may
|
||||
distribute the Executable version of Covered Code under a license of
|
||||
Your choice, which may contain terms different from this License,
|
||||
provided that You are in compliance with the terms of this License and
|
||||
that the license for the Executable version does not attempt to limit
|
||||
or alter the recipient's rights in the Source Code version from the
|
||||
rights set forth in this License. If You distribute the Executable
|
||||
version under a different license You must make it absolutely clear
|
||||
that any terms which differ from this License are offered by You alone,
|
||||
not by the Initial Developer or any Contributor. You hereby agree to
|
||||
indemnify the Initial Developer and every Contributor for any liability
|
||||
incurred by the Initial Developer or such Contributor as a result of
|
||||
any such terms You offer.
|
||||
|
||||
3.7. Larger Works.
|
||||
You may create a Larger Work by combining Covered Code with other code
|
||||
not governed by the terms of this License and distribute the Larger
|
||||
Work as a single product. In such a case, You must make sure the
|
||||
requirements of this License are fulfilled for the Covered Code.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation.
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Code due to statute
|
||||
or regulation then You must: (a) comply with the terms of this License
|
||||
to the maximum extent possible; and (b) describe the limitations and
|
||||
the code they affect. Such description must be included in the LEGAL
|
||||
file described in Section 3.4 and must be included with all
|
||||
distributions of the Source Code. Except to the extent prohibited by
|
||||
statute or regulation, such description must be sufficiently detailed
|
||||
for a recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Application of this License.
|
||||
|
||||
This License applies to code to which the Initial Developer has
|
||||
attached the notice in Exhibit A, and to related Covered Code.
|
||||
|
||||
6. Versions of the License.
|
||||
|
||||
6.1. New Versions.
|
||||
Netscape Communications Corporation (``Netscape'') may publish revised
|
||||
and/or new versions of the License from time to time. Each version will
|
||||
be given a distinguishing version number.
|
||||
|
||||
6.2. Effect of New Versions.
|
||||
Once Covered Code has been published under a particular version of the
|
||||
License, You may always continue to use it under the terms of that
|
||||
version. You may also choose to use such Covered Code under the terms
|
||||
of any subsequent version of the License published by Netscape. No one
|
||||
other than Netscape has the right to modify the terms applicable to
|
||||
Covered Code created under this License.
|
||||
|
||||
6.3. Derivative Works.
|
||||
If you create or use a modified version of this License (which you may
|
||||
only do in order to apply it to code which is not already Covered Code
|
||||
governed by this License), you must (a) rename Your license so that the
|
||||
phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL'' or
|
||||
any confusingly similar phrase do not appear anywhere in your license
|
||||
and (b) otherwise make it clear that your version of the license
|
||||
contains terms which differ from the Mozilla Public License and
|
||||
Netscape Public License. (Filling in the name of the Initial Developer,
|
||||
Original Code or Contributor in the notice described in Exhibit A shall
|
||||
not of themselves be deemed to be modifications of this License.)
|
||||
|
||||
7. DISCLAIMER OF WARRANTY.
|
||||
|
||||
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
|
||||
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
|
||||
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
|
||||
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
||||
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
||||
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
||||
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
||||
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
||||
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||
|
||||
8. TERMINATION.
|
||||
|
||||
This License and the rights granted hereunder will terminate
|
||||
automatically if You fail to comply with terms herein and fail to cure
|
||||
such breach within 30 days of becoming aware of the breach. All
|
||||
sublicenses to the Covered Code which are properly granted shall
|
||||
survive any termination of this License. Provisions which, by their
|
||||
nature, must remain in effect beyond the termination of this License
|
||||
shall survive.
|
||||
|
||||
9. LIMITATION OF LIABILITY.
|
||||
|
||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
|
||||
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL
|
||||
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
|
||||
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER
|
||||
PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
|
||||
GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND
|
||||
ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE
|
||||
BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
|
||||
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
|
||||
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
||||
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT
|
||||
EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
10. U.S. GOVERNMENT END USERS.
|
||||
|
||||
The Covered Code is a ``commercial item,'' as that term is defined in
|
||||
48 C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer
|
||||
software'' and ``commercial computer software documentation,'' as such
|
||||
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
|
||||
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
|
||||
all U.S. Government End Users acquire Covered Code with only those
|
||||
rights set forth herein.
|
||||
|
||||
11. MISCELLANEOUS.
|
||||
|
||||
This License represents the complete agreement concerning subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. This License shall be governed by
|
||||
California law provisions (except to the extent applicable law, if any,
|
||||
provides otherwise), excluding its conflict-of-law provisions. With
|
||||
respect to disputes in which at least one party is a citizen of, or an
|
||||
entity chartered or registered to do business in, the United States of
|
||||
America: (a) unless otherwise agreed in writing, all disputes relating
|
||||
to this License (excepting any dispute relating to intellectual
|
||||
property rights) shall be subject to final and binding arbitration,
|
||||
with the losing party paying all costs of arbitration; (b) any
|
||||
arbitration relating to this Agreement shall be held in Santa Clara
|
||||
County, California, under the auspices of JAMS/EndDispute; and (c) any
|
||||
litigation relating to this Agreement shall be subject to the
|
||||
jurisdiction of the Federal Courts of the Northern District of
|
||||
California, with venue lying in Santa Clara County, California, with
|
||||
the losing party responsible for costs, including without limitation,
|
||||
court costs and reasonable attorneys fees and expenses. The application
|
||||
of the United Nations Convention on Contracts for the International
|
||||
Sale of Goods is expressly excluded. Any law or regulation which
|
||||
provides that the language of a contract shall be construed against the
|
||||
drafter shall not apply to this License.
|
||||
|
||||
12. RESPONSIBILITY FOR CLAIMS.
|
||||
|
||||
Except in cases where another Contributor has failed to comply with
|
||||
Section 3.4, You are responsible for damages arising, directly or
|
||||
indirectly, out of Your utilization of rights under this License, based
|
||||
on the number of copies of Covered Code you made available, the
|
||||
revenues you received from utilizing such rights, and other relevant
|
||||
factors. You agree to work with affected parties to distribute
|
||||
responsibility on an equitable basis.
|
||||
|
||||
AMENDMENTS
|
||||
Additional Terms applicable to the Netscape Public License.
|
||||
|
||||
I. Effect.
|
||||
These additional terms described in this Netscape Public License --
|
||||
Amendments shall apply to the Mozilla Communicator client code and to
|
||||
all Covered Code under this License.
|
||||
|
||||
II. ``Netscape's Branded Code'' means Covered Code that Netscape
|
||||
distributes and/or permits others to distribute under one or more
|
||||
trademark(s) which are controlled by Netscape but which are not
|
||||
licensed for use under this License.
|
||||
|
||||
III. Netscape and logo.
|
||||
This License does not grant any rights to use the trademark
|
||||
``Netscape'', the ``Netscape N and horizon'' logo or the Netscape
|
||||
lighthouse logo, even if such marks are included in the Original Code.
|
||||
|
||||
IV. Inability to Comply Due to Contractual Obligation.
|
||||
Prior to licensing the Original Code under this License, Netscape has
|
||||
licensed third party code for use in Netscape's Branded Code. To the
|
||||
extent that Netscape is limited contractually from making such third
|
||||
party code available under this License, Netscape may choose to
|
||||
reintegrate such code into Covered Code without being required to
|
||||
distribute such code in Source Code form, even if such code would
|
||||
otherwise be considered ``Modifications'' under this License.
|
||||
|
||||
V. Use of Modifications and Covered Code by Initial Developer.
|
||||
|
||||
V.1. In General.
|
||||
The obligations of Section 3 apply to Netscape, except to the
|
||||
extent specified in this Amendment, Section V.2 and V.3.
|
||||
|
||||
V.2. Other Products.
|
||||
Netscape may include Covered Code in products other than the
|
||||
Netscape's Branded Code which are released by Netscape during the
|
||||
two (2) years following the release date of the Original Code,
|
||||
without such additional products becoming subject to the terms of
|
||||
this License, and may license such additional products on
|
||||
different terms from those contained in this License.
|
||||
|
||||
V.3. Alternative Licensing.
|
||||
Netscape may license the Source Code of Netscape's Branded Code,
|
||||
including Modifications incorporated therein, without such
|
||||
additional products becoming subject to the terms of this License,
|
||||
and may license such additional products on different terms from
|
||||
those contained in this License.
|
||||
|
||||
VI. Arbitration and Litigation.
|
||||
Notwithstanding the limitations of Section 11 above, the provisions
|
||||
regarding arbitration and litigation in Section 11(a), (b) and (c) of
|
||||
the License shall apply to all disputes relating to this License.
|
||||
|
||||
EXHIBIT A.
|
||||
|
||||
``The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released March
|
||||
31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape Communications
|
||||
Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
Contributor(s): ______________________________________.''
|
||||
|
||||
[NOTE: The text of this Exhibit A may differ slightly from the text of
|
||||
the notices in the Source Code files of the Original Code. This is due
|
||||
to time constraints encountered in simultaneously finalizing the
|
||||
License and in preparing the Original Code for release. You should use
|
||||
the text of this Exhibit A rather than the text found in the Original
|
||||
Code Source Code for Your Modifications.]
|
||||
96
mozilla/Makefile.in
Normal file
96
mozilla/Makefile.in
Normal file
@@ -0,0 +1,96 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = .
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# The list of directories that need to be built to build the standalone
|
||||
# nglayout test program. The order is important.
|
||||
DIRS = \
|
||||
config \
|
||||
dbm \
|
||||
nsprpub \
|
||||
$(NULL)
|
||||
|
||||
ifndef MOZ_NATIVE_JPEG
|
||||
DIRS += \
|
||||
jpeg \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
DIRS += \
|
||||
modules/libreg \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
DIRS += \
|
||||
modules/zlib \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
DIRS += \
|
||||
modules/libutil \
|
||||
intl \
|
||||
sun-java \
|
||||
nav-java \
|
||||
js \
|
||||
modules/security/freenav \
|
||||
modules/libpref \
|
||||
modules/libimg \
|
||||
modules/oji \
|
||||
modules/plugin \
|
||||
base \
|
||||
caps \
|
||||
lib/xp \
|
||||
lib/libpwcac \
|
||||
network \
|
||||
lib/liblayer/include \
|
||||
htmlparser \
|
||||
gfx \
|
||||
dom \
|
||||
view \
|
||||
widget \
|
||||
layout \
|
||||
rdf \
|
||||
webshell \
|
||||
editor \
|
||||
silentdl
|
||||
|
||||
|
||||
DIRS += xpfe
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
real_all: all
|
||||
|
||||
real_export: export
|
||||
|
||||
real_libs: libs
|
||||
|
||||
real_install: install
|
||||
|
||||
real_clobber: clobber
|
||||
|
||||
real_depend: depend
|
||||
|
||||
BIN
mozilla/README/mozilla/IDEMenuBar.gif
Normal file
BIN
mozilla/README/mozilla/IDEMenuBar.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
mozilla/README/mozilla/IDEPrefs.gif
Normal file
BIN
mozilla/README/mozilla/IDEPrefs.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
443
mozilla/README/mozilla/classic-mac.html
Normal file
443
mozilla/README/mozilla/classic-mac.html
Normal file
@@ -0,0 +1,443 @@
|
||||
|
||||
<HEAD>
|
||||
<TITLE>Building Mozilla on the Macintosh PPC platform</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B">
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
|
||||
</P>
|
||||
|
||||
<H1>Building Mozilla on the Macintosh PPC platform</H1>
|
||||
|
||||
<H2>Daniel Nunes, <A HREF="mailto:leaf@netscape.com"><TT>leaf@netscape.com</TT></A></H2>
|
||||
|
||||
<P>v 1.1, 1998-9-29<BR>
|
||||
updated for the Pro4 IDE</P>
|
||||
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
|
||||
<I>How to build Mozilla on a Macintosh PPC System.</I>
|
||||
|
||||
<HR>
|
||||
|
||||
</P>
|
||||
|
||||
<H2>1. <A HREF="#s1">Introduction</A></H2>
|
||||
|
||||
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="#ss2.1">2.1 Get the Code </A></LI>
|
||||
|
||||
<LI><A HREF="#ss2.2">2.2 Requirements</A></LI>
|
||||
|
||||
<LI><A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
|
||||
|
||||
<LI><A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
|
||||
</UL>
|
||||
|
||||
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
|
||||
|
||||
<H2>4. <A HREF="#s4"> Credits </A></H2>
|
||||
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
|
||||
</P>
|
||||
|
||||
<H2><A NAME=s1></A>1. Introduction</H2>
|
||||
|
||||
<P>What this document is: A guide to building the Mozilla
|
||||
application. This includes:</P>
|
||||
|
||||
<OL>
|
||||
<LI>A listing of the development tools you will need to build
|
||||
Mozilla.</LI>
|
||||
|
||||
<LI>A list of environment variables you will need to set before
|
||||
building.</LI>
|
||||
</OL>
|
||||
|
||||
<P>If you're looking for documentation on developing features or
|
||||
fixing bugs, the Mozilla <A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical
|
||||
Documents </A> or <A HREF="http://www.mozilla.org/library.html">
|
||||
Library </A> are probably what you're looking for.</P>
|
||||
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
|
||||
</P>
|
||||
|
||||
<H2><A NAME=s2></A>2. Building Mozilla</H2>
|
||||
|
||||
<P> </P>
|
||||
|
||||
<UL>
|
||||
<LI>Each of the following subsections describes, or gives
|
||||
references to descriptions of, the steps necessary to build
|
||||
Mozilla.
|
||||
|
||||
<H2><A NAME="ss2.1"></A>2.1 Get the Code</H2>
|
||||
|
||||
<P> </P>
|
||||
|
||||
<UL>
|
||||
<LI>There are two principal ways of getting the code, <A HREF="http://www.mozilla.org/download.html">
|
||||
ftp</A> and <A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
|
||||
CVS will provide the most current code for building, but is
|
||||
slower than ftp. Ftp drops are generally produced once per
|
||||
month, and are known to compile.</LI>
|
||||
</UL>
|
||||
|
||||
<P> </P>
|
||||
|
||||
<H2><A NAME="ss2.2"></A>2.2 Requirements</H2>
|
||||
|
||||
<P>The following need to be installed:</P>
|
||||
|
||||
<UL>
|
||||
<LI>CodeWarrior (CW) Pro4 - obtainable from <A HREF="http://www.metrowerks.com">Metrowerks</A>.
|
||||
See <A HREF="#s3">Common Sticking Points</A> if you have a
|
||||
different version. Mozilla will no longer build with anything
|
||||
earlier.</LI>
|
||||
|
||||
<LI>PowerPlant - obtainable from the CodeWarrior CD.</LI>
|
||||
|
||||
<LI>MSL - the Metrowerks Standard Library, obtainable from the
|
||||
CodeWarrior CD</LI>
|
||||
|
||||
<LI><A HREF="ftp://ftp.boingo.com//dan/WASTE/waste-13.hqx">WASTE
|
||||
1.3</A></LI>
|
||||
|
||||
<LI><A HREF="http://www.bact.wisc.edu/CWASTEEdit/CWASTEEdit.sit.hqx">CWASTE
|
||||
1.6.2</A></LI>
|
||||
|
||||
<LI><A HREF="ftp://ftp.scripting.com/userland/menuSharingToolkit4.1.sit.hqx">Menu
|
||||
Sharing Toolkit</A> (from UserLand)</LI>
|
||||
|
||||
<LI><A HREF="ftp://ftp.share.com/pub/internet-configuration/ICProgKit1.4.sit">Internet
|
||||
Config 1.4 SDK</A></LI>
|
||||
|
||||
<LI><A HREF="http://www.mooseyard.com/Jens/Software/">AEGizmos
|
||||
1.4.2</A></LI>
|
||||
|
||||
<LI><A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_tool.bin">MacPerl
|
||||
5 MPW Tool</A></LI>
|
||||
|
||||
<LI><A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_appl.bin">MacPerl
|
||||
5 Application</A></LI>
|
||||
|
||||
<LI>The module Mac:AppleEvents:Simple, which should be stored
|
||||
in your Perl library folder under :Mac:AppleEvents:Simple.pm,
|
||||
may be downloaded <A HREF="http://www.perl.com/CPAN-local/modules/by-module/Mac/Mac-AppleEvents-Simple-0.10.tgz">here</A>.</LI>
|
||||
|
||||
<LI>The module Mac:Apps:Launch, which should be stored in your
|
||||
Perl library folder under :Mac:Apps:Launch.pm, may be
|
||||
downloaded <A HREF="http://www.perl.com/CPAN-local/modules/by-module/Mac/Mac-Apps-Launch-1.30.tar.gz">here</A>.</LI>
|
||||
|
||||
<LI>MakeStub - MPW (installed with CodeWarrior Heaven option).
|
||||
If you choose not to install MPW, it is located on the MacOS
|
||||
Tools CD in "CW Pro 4 Tools:CodeWarrior MPW:MPW:Tools"</LI>
|
||||
|
||||
<LI>RunTSScript - in Mozilla source distribution
|
||||
(mozilla:build:mac:RunTSScript), needs to be installed by
|
||||
hand</LI>
|
||||
|
||||
<LI><A HREF="ftp://dev.apple.com/devworld/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/ToolServer.sit.hqx">ToolServer</A>
|
||||
- or in the CW distribution (CW Pro 4 Tools:Apple Development
|
||||
Tools:ToolServer 3.4.1.sit). <B>We recommend pulling it off the
|
||||
CD</B> because it comes with configuration files for
|
||||
CodeWarrior which you would have to create manually were you to
|
||||
pull it off the net.</LI>
|
||||
|
||||
<LI><A HREF="http://sunsite.cnlab-switch.ch/ftp/software/platform/macos/src/HTML/MPW_C.html">patch
|
||||
2.1</A></LI>
|
||||
</UL>
|
||||
|
||||
<P>Hardware/OS</P>
|
||||
|
||||
<UL>
|
||||
<LI>To build Navigator, you need a fast PPC Mac. The faster the
|
||||
better.</LI>
|
||||
|
||||
<LI>You will need about 96 MB of physical RAM to "fast link"
|
||||
the app. You can still fast link if you give your machine 96 MB
|
||||
of virtual memory, but then the VM hit is large enough to
|
||||
counteract any improvement. One of our beta testers had a
|
||||
machine with only 64MB of physical RAM (VM was off) and it ran
|
||||
out of memory trying to link. Turning VM on got it to link, but
|
||||
build time increased greatly.</LI>
|
||||
|
||||
<LI>Reports from the net indicate that the optimized version
|
||||
(MozillaPPC) take much less RAM to build than the 96MB we
|
||||
suggest. If you are running out of memory, try building that
|
||||
instead of the debug version (the debug symbols require a lot
|
||||
of RAM come link time).</LI>
|
||||
|
||||
<LI>You should be ok with a 400MB disk partition, even when
|
||||
fully built. This does not include tools like the IDE, just
|
||||
source.</LI>
|
||||
|
||||
<LI>On an HFS+ volume, a full build takes about 110MB. HFS+ is
|
||||
good, but utilities are sparse.</LI>
|
||||
</UL>
|
||||
|
||||
<P> </P>
|
||||
|
||||
<H2><A NAME="ss2.3"></A>2.3 Setup the Build Environment</H2>
|
||||
|
||||
<P> </P>
|
||||
|
||||
<OL>
|
||||
<LI>Install CodeWarrior from the CD. While it is large,
|
||||
installing the "CodeWarrior Heaven" option will guarantee that
|
||||
you have everything you need. This will give you PowerPlant,
|
||||
MSL, and MPW. If you choose to install less, proceed at your
|
||||
own risk.</LI>
|
||||
|
||||
<LI>In the Finder, increase the memory partition of the IDE to
|
||||
15MB (you can get by with 12, if need be).</LI>
|
||||
|
||||
<LI>Uncompress the StuffIt Archive for ToolServer. The goal is
|
||||
to let ToolServer and MPW share the same Tools directory so you
|
||||
don't need to have multiple versions of tools. Do the
|
||||
following:
|
||||
|
||||
<OL>
|
||||
<LI>Open ToolServer's Tools folder. There is one file called
|
||||
"RMetrowerks".</LI>
|
||||
|
||||
<LI>Move RMetrowerks to Tools folder of MPW. MPW folder must
|
||||
be at "Metrowerks:Codewarrior MPW:MPW" if you installed
|
||||
Codewarrior Heaven.</LI>
|
||||
|
||||
<LI>Remove ToolServer's Tools folder.</LI>
|
||||
|
||||
<LI>Now create an alias of Tools folder in "CodeWarrior MPW"
|
||||
and move it to your ToolServer folder. Rename the alias
|
||||
(probably called "Tools alias") to "Tools"</LI>
|
||||
|
||||
<LI><FONT COLOR="#FF0000"><B>IMPORTANT</B></FONT>: Make sure
|
||||
you only have one instance of ToolServer on your machine. If
|
||||
the build script finds the wrong one, the correct tools will
|
||||
not be found and strange things will happen.</LI>
|
||||
</OL>
|
||||
</LI>
|
||||
|
||||
<LI>After installing the MacPerl MPW Tool distribution (run the
|
||||
InstallerVISE application), in the "MacPerl ƒ" folder,
|
||||
there will be an MPW tool named "perl". Install this in MPW's
|
||||
tools folder.</LI>
|
||||
|
||||
<LI>Install the MacPerl Application (run the InstallerVISE
|
||||
application). You can install this anywhere, but it is
|
||||
recommended that you install it inside of your CodeWarrior
|
||||
folder for easy reference. After installation, you will need to
|
||||
set a preference to enable double-click launch of the perl
|
||||
scripts. This preference is set by going under the Edit Menu to
|
||||
Preferences. Click on the "Script" button and hit the radio
|
||||
button "Run Scripts opened from Finder"</LI>
|
||||
|
||||
<LI>Install the "patch" and "MakeStub" Tools in the tools
|
||||
folder. Note that "MakeStub" is automatically installed by the
|
||||
"CodeWarrior Heaven" install option.</LI>
|
||||
|
||||
<LI>Install RunTSScript (found in the Mozilla source
|
||||
distribution) in the compilers folder in your build environment
|
||||
("Metrowerks:Metrowerks Codewarrior:Codewarrior
|
||||
Plugins:Compilers")</LI>
|
||||
|
||||
<LI>Next, after downloading all the 3rd party software
|
||||
components, drag WASTE, CWASTE, Menu Sharing, Internet Config,
|
||||
and the AEGizmo folders (just as they are) into the "MacOS
|
||||
Support" folder in your build environment.</LI>
|
||||
|
||||
<LI>Create a folder inside the PowerPlant folder
|
||||
(Metrowerks:Metrowerks CodeWarrior:MacOS Support:PowerPlant)
|
||||
called "_Will Be Obsolete" Make sure you include the leading
|
||||
underscore.</LI>
|
||||
|
||||
<LI>Unstuff the obsolete LGA classes (located on the Reference
|
||||
CD in "CodeWarrior Examples:MacOS Examples:PowerPlant
|
||||
Examples:Obsolete PP Items:Old GA Classes.sit) and place the
|
||||
resulting folder into the "_Will Be Obsolete" folder you
|
||||
created in the previous step.</LI>
|
||||
|
||||
<LI>Start ToolServer from within CodeWarrior (or use MPW if you
|
||||
are brave enough). We're about to patch some files. Make sure
|
||||
the ToolServer menu is in the CodeWarrior menu bar by turning
|
||||
on the <A HREF="IDEPrefs.gif">preference</A> under the "Extras"
|
||||
panel in the IDE Preferences (not the project preferences!).
|
||||
The menu bar should look like this:
|
||||
|
||||
<P><IMG SRC="IDEMenuBar.gif" WIDTH=359 HEIGHT=20 X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
|
||||
|
||||
<P>Choose "Start ToolServer" from the ToolServer menu (this is
|
||||
the icon menu between "Window" and "Help" in the menubar
|
||||
above). You will now see a window with no close box. This is
|
||||
your ToolServer Worksheet where you will type (or cut &
|
||||
paste) the commands for the following steps.</P>
|
||||
|
||||
<P>In case you have never used MPW/ToolServer before, the
|
||||
following is <B>very important</B>. Pressing "return" does not
|
||||
execute commands like you might think. It just inserts a
|
||||
newline into the worksheet like a normal text editor. <B>To
|
||||
actually get ToolServer to execute the command, you must press
|
||||
"Enter" (lower right of numeric keypad).</B> This executes the
|
||||
line that the cursor is on, and only that line. If you want to
|
||||
execute multiple lines at once, select them all and hit
|
||||
Enter.</P></LI>
|
||||
|
||||
<LI>Set the shell variables {IDE} and {Source} to the correct
|
||||
paths for your build environment. {IDE} is where your
|
||||
CodeWarrior IDE is located. {Source} is the folder containing
|
||||
the toplevel "ns" folder of the Mozilla source. Mine look like
|
||||
this (don't forget to keep the quotes if your path includes
|
||||
spaces), yours will almost certainly be different
|
||||
(<FONT COLOR="#FF0000">to punctuate this, the things you need
|
||||
to change are in red</FONT>).
|
||||
|
||||
<PRE>Set IDE "<FONT COLOR="#FF0000">Develop:CW Pro 4:Metrowerks CodeWarrior:</FONT>"
|
||||
Set Source "<FONT COLOR="#FF0000">Source:FreeSource:</FONT>"</PRE></LI>
|
||||
|
||||
<LI>Execute the following lines to patch menusharing.c to allow
|
||||
it to compile with the new Universal Headers. It references an
|
||||
obsolete header file (GestaltEqu.h).
|
||||
|
||||
<PRE>directory "{IDE}MacOS Support:Menu Sharing Toolkit 4.1:"
|
||||
patch menusharing.c "{Source}mozilla:lib:mac:patches:menusharing.patch"</PRE></LI>
|
||||
|
||||
<LI>You need to patch stat.mac.h to fix a problem in MSL where
|
||||
lines were omitted.
|
||||
|
||||
<PRE>directory "{IDE}Metrowerks Standard Library:MSL C:MSL Mac:Public Includes"
|
||||
patch stat.mac.h "{Source}mozilla:lib:mac:patches:stat.mac.h.patch"</PRE></LI>
|
||||
|
||||
<LI>Congratulations! Now you are ready to build. Once these
|
||||
steps are done, you don't have to repeat these setups the next
|
||||
time!</LI>
|
||||
</OL>
|
||||
|
||||
<P> </P>
|
||||
|
||||
<H2><A NAME="ss2.4"></A>2.4 Run the build</H2>
|
||||
|
||||
<UL>
|
||||
<LI>In the folder mozilla:build:mac:, there are several Perl
|
||||
scripts with names of the form BuildMozillaXXX.pl, where XXX is
|
||||
"Optimized", "Debug", "Tinderbox", et al. Each script builds
|
||||
the corresponding version of Mozilla. If you configured the
|
||||
MacPerl application to execute scripts that are opened from the
|
||||
finder, all you have to do is double click on the appropriate
|
||||
one; otherwise, launch MacPerl, and run the appropriate script
|
||||
from the "Run Script..." menu item.
|
||||
|
||||
<P>These `configured build' scripts are simple, and you might
|
||||
want to make your own to force your build to StopForErrors(),
|
||||
or alternatively DontStopForErrors(), et al. You can set up
|
||||
certain build-script variables and (soon) compile-time flags.
|
||||
Compare the supplied scripts to figure out what you might want.
|
||||
Note that CodeWarriorLib, Moz.pm, and BuildList.pm, are
|
||||
AppleScript libraries and Perl modules meant to be used by a
|
||||
`configured build'. Use your favorite POD viewer (Shuck comes
|
||||
with MacPerl) to view the documentation in the Perl
|
||||
scripts.</P>
|
||||
|
||||
<P>If there were any errors in any of the projects along the
|
||||
way, the script will stop at that point and the IDE will tell
|
||||
you the errors. You can fix them and make sure they current
|
||||
project builds, but to continue the automation, you have to
|
||||
start from the beginning by double-clicking the script again.
|
||||
This isn't quite as bad as it sounds because the previous
|
||||
projects are already built (unless you changed some major
|
||||
header file). Please note that stopping the script once it has
|
||||
started is difficult. We are working to address this issue.</P>
|
||||
|
||||
<P>After the build is complete, you can find aliases to the
|
||||
built libraries and the final Mozilla application. Debug builds
|
||||
are built to Mozilla:dist:client_debug, while optimized builds
|
||||
are built to Mozilla:dist:client.</P>
|
||||
|
||||
<P>Don't worry too much about the numerous warnings generated
|
||||
during the build. We try our best to get the XP teams to use
|
||||
real compilers, but alas, they continue to write warning-laden
|
||||
code. There is also some generated code (Java is one example)
|
||||
that has a lot of warnings that we can't help either. If you
|
||||
write any new code, please help us in our quest to get zero
|
||||
warnings.</P></LI>
|
||||
</UL>
|
||||
</LI>
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
|
||||
</P>
|
||||
|
||||
<H2><A NAME=s3></A>3. Common Sticking Points</H2>
|
||||
|
||||
<UL>
|
||||
<LI><B>I only have CodeWarrior Pro3 or Pro2. How do i build with
|
||||
it?</B>
|
||||
|
||||
<UL>
|
||||
<LI>Currently, the answer is, "You don't." We make use of
|
||||
several classes in PowerPlant which recently appeared in Pro4.
|
||||
Time to upgrade, I'm afraid. Don't even try opening the
|
||||
projects with Pro2 because you will get data loss and have to
|
||||
throw the project away (it won't even prompt you!)</LI>
|
||||
</UL>
|
||||
</LI>
|
||||
|
||||
<LI><B>I'm having problems building. MacPerl tells me it can't
|
||||
fine MemAllocatorStubs</B>
|
||||
|
||||
<UL>
|
||||
<LI>It sounds like your ToolServer environment is not setup
|
||||
correctly. Make sure you follow the directions to the letter.
|
||||
You could also be seeing this if you have multiple versions of
|
||||
ToolServer on your computer and the Finder lauches the wrong
|
||||
one. This is very common, as the <I>Carbon Dater</I> app from
|
||||
Apple DTS contains a copy of ToolServer. Either remove all the
|
||||
other versions of ToolServer or make sure you launch the
|
||||
appropriate version before you start building.</LI>
|
||||
</UL>
|
||||
</LI>
|
||||
|
||||
<LI><B>The IDE runs out of memory building jsinterp.c. What do I
|
||||
do?</B>
|
||||
|
||||
<UL>
|
||||
<LI>We have seen this every now and then, and it only appears
|
||||
to show up when building optimized (non-debug) builds. You can
|
||||
normally get around this by building that file by itself
|
||||
(select it and choose "Compile") and then continuing the make.
|
||||
We're not sure why this is happening, so if you have any
|
||||
answers or solutions, please let us know!</LI>
|
||||
</UL>
|
||||
</LI>
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
|
||||
</P>
|
||||
|
||||
<H2><A NAME=s4></A>4. Credits</H2>
|
||||
|
||||
<UL>
|
||||
<LI>The majority of this document is taken from the build document
|
||||
included in the Mozilla source distribution at
|
||||
README:mozilla:macbuild.htm written by Mike Pinkerton, <A HREF="mailto:pinkerton@netscape.com">
|
||||
pinkerton@netscape.com</A>.</LI>
|
||||
</UL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
158
mozilla/README/mozilla/classic-unix.html
Normal file
158
mozilla/README/mozilla/classic-unix.html
Normal file
@@ -0,0 +1,158 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Building Mozilla on unix platforms</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
<HR>
|
||||
<H1>
|
||||
Building Mozilla on Unix platforms</H1>
|
||||
|
||||
<H2>
|
||||
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT></H2>
|
||||
v 1.1, June 1998
|
||||
|
||||
<P>
|
||||
<HR><I>How to build Mozilla on a Unix System.</I>
|
||||
<HR>
|
||||
<H2>1. <A HREF="#s1">Introduction</A></H2>
|
||||
|
||||
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.2">2.2 Requirements</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.5">2.5 Run the Lizard </A></LI>
|
||||
</UL>
|
||||
|
||||
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Introduction</A></H2>
|
||||
|
||||
<P>
|
||||
What this document is: A guide to building the Mozilla application.
|
||||
<BR>
|
||||
This includes:
|
||||
<OL>
|
||||
<LI> A listing of the development tools you will need to build Mozilla. </LI>
|
||||
<LI> A list of environment variables you will need to set before building. </LI>
|
||||
</OL>
|
||||
<P>
|
||||
If you're looking for documentation on developing features or fixing bugs,
|
||||
the Mozilla
|
||||
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
|
||||
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
|
||||
are probably what you're looking for.
|
||||
<P>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Building Mozilla </A></H2>
|
||||
<P>
|
||||
<UL>Each of the following subsections describes, or gives references to
|
||||
descriptions of, the steps necessary to build Mozilla.
|
||||
</UL>
|
||||
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
There are two principal ways of getting the code,
|
||||
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
|
||||
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
|
||||
CVS will provide the most current code for building, but is
|
||||
slower than ftp. Ftp drops are generally produced once per month,
|
||||
and are known to compile.
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
|
||||
<UL>
|
||||
The following should be installed:
|
||||
<UL>
|
||||
<LI>Motif 1.2
|
||||
<LI>The native C/C++ compiler (or GNU C/C++ compiler 2.7.2 in lieu of the
|
||||
native compiler)
|
||||
<LI>GNU make 3.74 or better
|
||||
<LI>Perl (or, if you have no Perl, then set <CODE>PERL=/bin/echo</CODE>)
|
||||
</UL>
|
||||
<P>
|
||||
Your hardware should be equal to, or better than:
|
||||
<UL>
|
||||
32 MB RAM, 128 MB swap (64 MB RAM recommended)
|
||||
</UL>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
The following environment variables need to be set:
|
||||
<CODE>
|
||||
<PRE>
|
||||
MOZILLA_CLIENT=1
|
||||
MOZ_MEDIUM=1
|
||||
NO_MDUPDATE=1
|
||||
</PRE>
|
||||
</CODE>
|
||||
Optionally, you can set <CODE>BUILD_OPT=1</CODE> if you don't want a debug
|
||||
build.
|
||||
<P>
|
||||
If your Motif libraries are installed in a non-standard place, you can tell
|
||||
the Mozilla makefiles where to look by setting
|
||||
<CODE>MOZILLA_MOTIF_SEARCH_PATH</CODE> to point to the directory in which
|
||||
your Motif installation resides.
|
||||
<P>
|
||||
Environment variables are set by the shell, and there are two common ways
|
||||
of setting them. <BR>
|
||||
Type <CODE>setenv VARIABLE value</CODE> or <CODE>export VARIABLE=value</CODE>.
|
||||
<P>
|
||||
</UL>
|
||||
|
||||
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
|
||||
<UL>
|
||||
Change to the directory you copied the source into (for example,
|
||||
<CODE>cd /builds</CODE>). If this directory was empty before you
|
||||
installed the source, there should be two directories here:
|
||||
<CODE>README</CODE> and <CODE>mozilla</CODE>.
|
||||
<CODE>
|
||||
<PRE>
|
||||
cd mozilla
|
||||
gmake
|
||||
</PRE>
|
||||
</CODE>
|
||||
</UL>
|
||||
<H2><A NAME="ss2.5">2.5 After the build </A></H2>
|
||||
<UL>
|
||||
You may notice that if you try running mozilla-export right after the build,
|
||||
you'll run into a problem. You need to set <CODE>LD_LIBRARY_PATH</CODE> to
|
||||
<CODE>
|
||||
${LD_LIBRARY_PATH}:/PATH_TO_SOURCE/mozilla/dist/Linux2.0.32_x86_OPT.OBJ/bin
|
||||
</CODE> (where <CODE>PATH_TO_SOURCE</CODE> is the full path to your source
|
||||
tree) before the dynamically linked binary will run. <BR><BR>
|
||||
This varies by platform:<br>
|
||||
<UL>
|
||||
<LI>On HP-UX, the equivalent environment variable is <CODE>SHLIB_PATH</CODE>.
|
||||
<LI>On AIX, the equivalent environment variable is <CODE>LIBPATH</CODE>.
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
|
||||
<LI>My linker dies with this error: undefined reference to `_Xsetlocale'
|
||||
<UL>If this error occurs, you might have to recompile libX11.so
|
||||
with the -DX_LOCALE flag (thanks to Scott Lampert,
|
||||
<A HREF="mailto:fortunato@heavymetal.org">fortunato@heavymetal.org</A>).
|
||||
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
217
mozilla/README/mozilla/classic-win.html
Normal file
217
mozilla/README/mozilla/classic-win.html
Normal file
@@ -0,0 +1,217 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Building Mozilla on Microsoft Windows 32-bit platforms</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
<HR>
|
||||
<H1>
|
||||
Building Mozilla on Microsoft Windows 32-bit platforms</H1>
|
||||
|
||||
<H2>
|
||||
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
|
||||
</H2>
|
||||
v 1.0, June 1998
|
||||
|
||||
<P>
|
||||
<HR><I>How to build Mozilla on a Microsoft Windows 32-bit System.</I>
|
||||
<HR>
|
||||
<H2>1. <A HREF="#s1">Introduction</A></H2>
|
||||
|
||||
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.2">2.2 Requirements</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
|
||||
</UL>
|
||||
|
||||
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Introduction</A></H2>
|
||||
|
||||
<P>
|
||||
What this document is: A guide to building the Mozilla application.
|
||||
<BR>
|
||||
This includes:
|
||||
<OL>
|
||||
<LI> A listing of the development tools you will need to build Mozilla. </LI>
|
||||
<LI> A list of environment variables you will need to set before building. </LI>
|
||||
</OL>
|
||||
<P>
|
||||
If you're looking for documentation on developing features or fixing bugs,
|
||||
the Mozilla
|
||||
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
|
||||
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
|
||||
are probably what you're looking for.
|
||||
<P>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Building Mozilla </A></H2>
|
||||
<P>
|
||||
<UL>Each of the following subsections describes, or gives references to
|
||||
descriptions of, the steps necessary to build Mozilla.
|
||||
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
There are two principal ways of getting the code,
|
||||
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
|
||||
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
|
||||
CVS will provide the most current code for building, but is
|
||||
slower than ftp. Ftp drops are generally produced once per month,
|
||||
and are known to compile.
|
||||
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
|
||||
<UL>
|
||||
The following need to be installed:
|
||||
<UL>
|
||||
<LI>Microsoft Visual C++ version 4.2 or later
|
||||
<LI>GNU Tools for Microsoft Windows, located:
|
||||
<UL>
|
||||
<LI><A HREF="http://www.cygnus.com/misc/gnu-win32">Cygnus</A></LI>
|
||||
<LI><A HREF="http://www.gnu.org/order/ftp.html">GNU home page</A></LI>
|
||||
<LI><A HREF="ftp://prep.ai.mit.edu/pub/gnu">MIT</A></LI>
|
||||
</UL>
|
||||
Specifically, you'll need:
|
||||
<UL><CODE>
|
||||
cp.exe<BR>
|
||||
rm.exe<BR>
|
||||
uname.exe<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
Netscape has internally modified version of gmake, shmsdos and win32gnu
|
||||
that we use to get around some problems we were having keeping in sync
|
||||
with the Unix version of gmake. This version of gmake can be found in the
|
||||
Windows Build Tools package, which can be ftp'd from
|
||||
<A HREF="http://www.mozilla.org/download-mozilla.html"> the Mozilla
|
||||
Download page</A>.
|
||||
The three files you will need are:
|
||||
<UL><CODE>
|
||||
gmake.exe<BR>
|
||||
shmsdos.exe<BR>
|
||||
uname.exe<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
|
||||
</UL>
|
||||
<P>
|
||||
Hardware/OS
|
||||
<UL>
|
||||
<LI>Pentium 133 MHz or better</LI>
|
||||
<LI>64 MB RAM, 128 MB recommended</LI>
|
||||
<LI>250 MB NTFS or 500 MB FAT disk space</LI>
|
||||
<LI>NT 4.0 is preferred; NT 3.51 will also work.
|
||||
</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
The following environment variables need to be set:
|
||||
<UL>
|
||||
<CODE>
|
||||
set MOZ_BITS=32
|
||||
<BR>
|
||||
set MOZ_DEBUG=1 (set this only if you want to build a debug build)
|
||||
<BR>
|
||||
set MOZ_MEDIUM=1
|
||||
<BR>
|
||||
set MOZ_NT=351 (if running NT3.51)
|
||||
<BR>
|
||||
set MOZ_OUT=(optional: specifies location of resultant executable)
|
||||
<BR>
|
||||
set MOZ_SRC=(top of your tree, for example: set MOZ_SRC=d:\mozilla_source
|
||||
if this is the directory where you checked or unzipped the source into)
|
||||
<BR>
|
||||
set MOZ_TOOLS=(the parent directory of the GNU tools 'bin' directory. The build
|
||||
looks for MOZ_TOOLS\bin\gmake.exe, so make sure that the gmake.exe from
|
||||
the Windows Build Tools package resides there.)
|
||||
<BR>
|
||||
set NSPR20=1
|
||||
<BR>
|
||||
set _MSC_VER=1100 (if you are running VC++ 5.0) or 1200
|
||||
(if you are running VC++ 6.0)
|
||||
<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
<BR>
|
||||
<P>
|
||||
</UL>
|
||||
|
||||
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
|
||||
<UL>
|
||||
Change to the directory you copied the source into (for example,
|
||||
<CODE>cd d:\mozilla_source</CODE>). If this directory was empty before you
|
||||
installed the source, there should be two directories here:
|
||||
<CODE>README</CODE> and <CODE>mozilla</CODE>.
|
||||
<CODE>
|
||||
<PRE>
|
||||
cd mozilla\config
|
||||
nmake /f makefile.win
|
||||
cd ..
|
||||
nmake /f client.mak
|
||||
</PRE>
|
||||
</CODE>
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
|
||||
<UL>
|
||||
<LI><B>nmake has a 'fatal error', listing one of the GNU commands and a
|
||||
hexadecimal return code.</B>
|
||||
<UL>
|
||||
This will happen as a result of not having the GNU tools and Windows Build
|
||||
tools in your path. Add the directories with the appropriate binaries to your
|
||||
path.
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>It fails with the message "'.\WIN32' unexpected": </B>
|
||||
<UL>
|
||||
You didn't properly
|
||||
set the environment variables -- you must not include a space at the end
|
||||
of the set statements (be careful if you are cut'n'pasting).
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>It fails to build, with directory-related errors: </B>
|
||||
<UL>
|
||||
The full path
|
||||
to the source must not include any spaces. Additionally, the source must
|
||||
be extracted with an intact directory structure by a utility that understands
|
||||
long filenames. If in doubt, grab Info-Zip at
|
||||
<A HREF="ftp://ftp.cdrom.com/pub/infozip">ftp://ftp.cdrom.com/pub/infozip</A>
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>It fails immediately with the message "Cannot find specified directory":
|
||||
</B>
|
||||
<UL>
|
||||
You didn't properly set the environment variable MOZ_TOOLS;
|
||||
this needs to be set to the path up to, but not including, the final \bin
|
||||
directory in the path to the gnu tools. So, the path to the tool executables
|
||||
is '%MOZ_TOOLS%\bin\<executable>'.
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>I'm not running a 32-bit windows system, how do i build?</B>
|
||||
<UL>
|
||||
Currently, the build process depends on a 32-bit operating system.
|
||||
Windows NT 4.0 is the recommended windows operating system.
|
||||
</UL>
|
||||
</UL>
|
||||
<HR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
400
mozilla/README/mozilla/mac-build.html
Normal file
400
mozilla/README/mozilla/mac-build.html
Normal file
@@ -0,0 +1,400 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Building Mozilla on the Macintosh PPC platform</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
<HR>
|
||||
<H1>
|
||||
Building Mozilla on the Macintosh PPC platform</H1>
|
||||
|
||||
<H2>
|
||||
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
|
||||
</H2>
|
||||
v 1.0, June 1998
|
||||
|
||||
<P>
|
||||
<HR><I>How to build Mozilla on a Macintosh PPC System.</I>
|
||||
<HR>
|
||||
<H2>1. <A HREF="#s1">Introduction</A></H2>
|
||||
|
||||
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.2">2.2 Requirements</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
|
||||
</UL>
|
||||
|
||||
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
|
||||
|
||||
<H2>4. <A HREF="#s4"> Credits </A></H2>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Introduction</A></H2>
|
||||
|
||||
<P>
|
||||
What this document is: A guide to building the Mozilla application.
|
||||
This includes:
|
||||
<OL>
|
||||
<LI> A listing of the development tools you will need to build Mozilla. </LI>
|
||||
<LI> A list of environment variables you will need to set before building. </LI>
|
||||
</OL>
|
||||
<P>
|
||||
If you're looking for documentation on developing features or fixing bugs,
|
||||
the Mozilla
|
||||
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
|
||||
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
|
||||
are probably what you're looking for.
|
||||
<P>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Building Mozilla </A></H2>
|
||||
<P>
|
||||
<UL>Each of the following subsections describes, or gives references to
|
||||
descriptions of, the steps necessary to build Mozilla.
|
||||
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
There are two principal ways of getting the code,
|
||||
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
|
||||
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
|
||||
CVS will provide the most current code for building, but is
|
||||
slower than ftp (takes longer to download).
|
||||
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
|
||||
The following need to be installed:
|
||||
<UL>
|
||||
<LI>CodeWarrior (CW) 2 - obtainable from
|
||||
<A HREF="http://www.metrowerks.com">Metrowerks</A>.
|
||||
See <A HREF="#s3">Common Sticking Points</A> if you have a different
|
||||
version.
|
||||
</LI>
|
||||
|
||||
<LI>PowerPlant 1.8 - obtainable from the CodeWarrior CD.</LI>
|
||||
|
||||
<LI>MSL - the Metrowerks Standard Library, obtainable from the
|
||||
CodeWarrior CD</LI>
|
||||
|
||||
<LI><A HREF="ftp://ftp.boingo.com//dan/WASTE/waste-13.hqx">WASTE
|
||||
1.3</A></LI>
|
||||
|
||||
<LI><A HREF="http://www.bact.wisc.edu/CWASTEEdit/CWASTEEdit.sit.hqx">CWASTE
|
||||
1.6.2</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://ftp.scripting.com/userland/menuSharingToolkit4.1.sit.hqx">
|
||||
Menu Sharing Toolkit</A> (from UserLand)</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://ftp.digitalalchemy.com/pub/digitalalchemy/mercutio-SDK.sit.bin">
|
||||
Mercutio 1.5 SDK</A> (only download the SDK, not the entire package, else
|
||||
the access paths will be wrong)</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://ftp.share.com/pub/internet-configuration/ICProgKit1.4.sit">
|
||||
Internet Config 1.4 SDK</A></LI>
|
||||
|
||||
<LI><A HREF="http://www.mooseyard.com/Jens/Software/">AEGizmos
|
||||
1.4.2</A></LI>
|
||||
|
||||
<LI><A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_tool.bin">
|
||||
MacPerl 5 MPW Tool</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_appl.bin">MacPerl 5 Application</A></LI>
|
||||
|
||||
<LI>MakeStub - MPW (installed with CodeWarrior Heaven option). If
|
||||
you choose not to install MPW, it is located on the MacOS Tools CD
|
||||
in "CW Pro 2 Tools:CodeWarrior MPW:MPW:Tools"</LI>
|
||||
|
||||
<LI>RunTSScript - in Mozilla source distribution
|
||||
(mozilla:build:mac:RunTSScript), needs to be installed by hand</LI>
|
||||
|
||||
<LI><A HREF="ftp://dev.apple.com/devworld/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/ToolServer.sit.hqx">ToolServer</A>
|
||||
- or in the CW distribution (CW Pro 2 Tools:Apple Development
|
||||
Tools:ToolServer 3.4.1.sit). <B>We recommend pulling it off the
|
||||
CD</B> because it comes with configuration files for CodeWarrior
|
||||
which you would have to create manually were you to pull it off
|
||||
the net.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://people.netscape.com/sfraser/software/NewAlias_tool.sit.hqx">
|
||||
New Alias MPW Tool</A> An MPW tool that creates Finder aliases for files.
|
||||
</LI>
|
||||
|
||||
<LI>StreamEdit MPW Tool - MPW (installed with CodeWarrior Heaven option). If
|
||||
you choose not to install MPW, it is located on the MacOS Tools CD
|
||||
in "CW Pro 2 Tools:CodeWarrior MPW:MPW:Tools"</LI>
|
||||
</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://dev.apple.com/devworld/Periodicals/develop/develop25/develop_Issue_25_code/ToolFrontEnd.sit.hqx">ToolFrontEnd</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://sunsite.cnlab-switch.ch/ftp/software/platform/macos/src/HTML/MPW_C.html">
|
||||
patch 2.1</A></LI>
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
Hardware/OS
|
||||
<UL>
|
||||
<LI>To build Navigator, you need a fast PPC Mac. The faster the
|
||||
better. You can't build with a 68K machine because we have too many
|
||||
resources, and the build process will crash when trying to generate
|
||||
resources out of our cross-platform strings. See the discussion below
|
||||
for a way around this.
|
||||
</LI>
|
||||
<LI>You will need about 96 MB of physical RAM to "fast link" the app.
|
||||
You can still fast link if you give your machine 96 MB of virtual
|
||||
memory, but then the VM hit is large enough to counteract any
|
||||
improvement. One of our beta testers had a machine with only 64MB of
|
||||
physical RAM (VM was off) and it ran out of memory trying to link.
|
||||
Turning VM on got it to link, but build time increased greatly.
|
||||
</LI>
|
||||
<LI>Reports from the net indicate that the optimized version
|
||||
(MozillaPPC) take much less RAM to build than the 96MB we suggest. If
|
||||
you are running out of memory, try building that instead of the debug
|
||||
version (the debug symbols require a lot of RAM come link time).
|
||||
</LI>
|
||||
<LI>You should be ok with a 400MB disk partition, even when fully
|
||||
built. This does not include tools like the IDE, just source.
|
||||
</LI>
|
||||
<LI>On an HFS+ volume, a full build takes about 110MB. HFS+ is good,
|
||||
but utilities are sparse.
|
||||
</LI>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>Install CodeWarrior from the CD. While it is large, installing
|
||||
the "CodeWarrior Heaven" option will guarantee that you have
|
||||
everything you need. This will give you PowerPlant, MSL, and MPW.
|
||||
If you choose to install less, proceed at your own risk.</LI>
|
||||
|
||||
<LI>In the Finder, increase the memory partition of the IDE to
|
||||
15MB (you can get by with 12, if need be).</LI>
|
||||
|
||||
<LI>Download ToolFrontEnd. After expanding it, in "ToolFrontEnd
|
||||
Folder:Drop-Ins" there are three items:
|
||||
|
||||
<UL>
|
||||
<LI><I>#include</I></LI>
|
||||
|
||||
<LI><I>ToolFrontEnd</I></LI>
|
||||
|
||||
<LI><I>ToolFrontEnd Panel</I></LI>
|
||||
</UL>
|
||||
|
||||
<P>Create a folder named "Include Scanners". Place the file
|
||||
"#include" into the Include Scanners folder. Move the Include
|
||||
Scanners folder to the CodeWarrior Plugins folder. Create a folder
|
||||
named "ToolFrontEnd". Place the files "ToolFrontEnd" and
|
||||
"ToolFrontEnd Panel" into the ToolFrontEnd folder. Place this
|
||||
folder in the CodeWarrior Plugins folder.</P></LI>
|
||||
|
||||
<LI>Open "ToolFrontEnd Panel" with ResEdit. Change the file type
|
||||
from <B>'Panl'</B> to <B>'PanL'</B>. Save.</LI>
|
||||
|
||||
<LI>Uncompress the StuffIt Archive for ToolServer. The goal is to
|
||||
let ToolServer and MPW share the same Tools directory so you don't
|
||||
need to have multiple versions of tools. Do the following:
|
||||
|
||||
<OL>
|
||||
<LI>Open ToolServer's Tools folder. There is one file called
|
||||
"RMetrowerks". </LI>
|
||||
|
||||
<LI>Move RMetrowerks to Tools folder of MPW. MPW folder must be
|
||||
at "Metrowerks:Codewarrior MPW:MPW" if you installed
|
||||
Codewarrior Heaven. </LI>
|
||||
|
||||
<LI>Remove ToolServer's Tools folder.</LI>
|
||||
|
||||
<LI>Now create an alias of Tools folder in "CodeWarrior MPW"
|
||||
and move it to your ToolServer folder. Rename the alias
|
||||
(probably called "Tools alias") to "Tools"</LI>
|
||||
|
||||
|
||||
<LI><FONT COLOR="#FF0000"><B>IMPORTANT</B></FONT>: Make sure
|
||||
you only have one instance of ToolServer on your machine. If
|
||||
the build script finds the wrong one, the correct tools will
|
||||
not be found and strange things will happen.</LI>
|
||||
</OL>
|
||||
</LI>
|
||||
|
||||
<LI>After installing the MacPerl MPW Tool distribution (run the
|
||||
InstallerVISE application), in the "MacPerl ƒ" folder, there
|
||||
will be an MPW tool named "perl". Install this in MPW's tools
|
||||
folder.</LI>
|
||||
|
||||
<LI>Install the MacPerl Application (run the
|
||||
InstallerVISE application). You can install this anywhere, but it is
|
||||
recommended that you install it inside of your CodeWarrior folder for
|
||||
easy reference. After installation, you will need to set a preference
|
||||
to enable double-click launch of the perl scripts. This preference is set
|
||||
by going under the Edit Menu to Preferences. Click on the "Script" button
|
||||
and hit the radio button "Run Scripts opened from Finder"</LI>
|
||||
|
||||
<LI>Install the "patch", "MakeStub", "NewAlias" and "StreamEdit" Tools in the
|
||||
tools
|
||||
folder. Note that "MakeStub" and "StreamEdit" are automatically installed by the
|
||||
"CodeWarrior Heaven" install option.</LI>
|
||||
|
||||
<LI>Install RunTSScript (found in the Mozilla source distribution)
|
||||
in the compilers folder in your build environment
|
||||
("Metrowerks:Metrowerks Codewarrior:Codewarrior
|
||||
Plugins:Compilers")</LI>
|
||||
|
||||
<LI>Next, after downloading all the 3rd party software components,
|
||||
drag WASTE, CWASTE, Menu Sharing, Mercutio, Internet Config, and
|
||||
the AEGizmo folders (just as they are) into the "MacOS Support"
|
||||
folder in your build environment.</LI>
|
||||
|
||||
<LI>Start ToolServer from within CodeWarrior (or use MPW if you
|
||||
are brave enough). We're about to patch some files. Make sure the
|
||||
ToolServer menu is in the CodeWarrior menu bar by turning on the
|
||||
<A HREF="IDEPrefs.gif">preference</A> under the "Extras" panel in
|
||||
the IDE Preferences (not the project preferences!). The menu bar
|
||||
should look like this:
|
||||
|
||||
|
||||
<P><IMG SRC="IDEMenuBar.gif" WIDTH=359 HEIGHT=20 X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
|
||||
|
||||
<P>Choose "Start ToolServer" from the ToolServer menu (this is the
|
||||
icon menu between "Window" and "Help" in the menubar above). You
|
||||
will now see a window with no close box. This is your ToolServer
|
||||
Worksheet where you will type (or cut & paste) the commands
|
||||
for the following steps.</P>
|
||||
|
||||
<P>In case you have never used MPW/ToolServer before, the
|
||||
following is <B>very important</B>. Pressing "return" does not
|
||||
execute commands like you might think. It just inserts a newline
|
||||
into the worksheet like a normal text editor. <B>To actually get
|
||||
ToolServer to execute the command, you must press "Enter" (lower
|
||||
right of numeric keypad).</B> This executes the line that the
|
||||
cursor is on, and only that line. If you want to execute multiple
|
||||
lines at once, select them all and hit Enter.</P></LI>
|
||||
|
||||
<LI>Set the shell variables {IDE} and {Source} to the correct
|
||||
paths for your build environment. {IDE} is where your CodeWarrior
|
||||
IDE is located. {Source} is the folder containing the toplevel
|
||||
"ns" folder of the Mozilla source. Mine look like this (don't
|
||||
forget to keep the quotes if your path includes spaces), yours
|
||||
will almost certainly be different (<FONT COLOR="#FF0000">to
|
||||
punctuate this, the things you need to change are in red</FONT>).
|
||||
|
||||
<PRE>Set IDE "<FONT COLOR="#FF0000">Develop:Source331 Build Environment:CW Pro 2:Metrowerks CodeWarrior:</FONT>"
|
||||
Set Source "<FONT COLOR="#FF0000">Source:FreeSource:</FONT>"</PRE>
|
||||
</LI>
|
||||
|
||||
<LI>If you are using CWPro2, execute the following lines to patch
|
||||
LDropFlag to draw correcly over non-white backgrounds.
|
||||
|
||||
<PRE>directory "{IDE}MacOS Support:PowerPlant:_In Progress:_Table Classes:"
|
||||
patch LDropFlag.cp "{Source}mozilla:lib:mac:patches:LDropFlag.patch"
|
||||
duplicate -y "{Source}mozilla:lib:mac:patches:DropFlag Icons.rsrc" "{IDE}MacOS Support:PowerPlant:PowerPlant Resources:"</PRE></LI>
|
||||
|
||||
<LI>Execute the following lines to patch menusharing.c to allow it
|
||||
to compile with the new Universal Headers. It references an
|
||||
obsolete header file (GestaltEqu.h).
|
||||
|
||||
<PRE>directory "{IDE}MacOS Support:Menu Sharing Toolkit 4.1:"
|
||||
patch menusharing.c "{Source}mozilla:lib:mac:patches:menusharing.patch"</PRE></LI>
|
||||
|
||||
|
||||
<LI>If you are using CWPro2 straight off the CD, you need to patch
|
||||
AppleEvents.r to fix a problem with the Universal Headers (the
|
||||
definition of the 'aedt' resource was omitted). <B>You do not have
|
||||
to do this if you have applied the netborne patch to Pro2e
|
||||
</B> because it has been fixed.
|
||||
|
||||
<PRE>directory "{IDE}MacOS Support:Headers:Rez Headers:"
|
||||
patch AppleEvents.r "{Source}mozilla:lib:mac:patches:AppleEvents.r.patch"</PRE></LI>
|
||||
|
||||
<LI>You need to patch stat.mac.h to fix a problem in MSL where
|
||||
lines were omitted.
|
||||
|
||||
<PRE>directory "{IDE}Metrowerks Standard Library:MSL C:MSL Mac:Public Includes"
|
||||
patch stat.mac.h "{Source}mozilla:lib:mac:patches:stat.mac.h.patch"</PRE></LI>
|
||||
|
||||
<LI>Congratulations! Now you are ready to build. Once these steps
|
||||
are done, you don't have to repeat these setups the next
|
||||
time!</LI>
|
||||
</OL>
|
||||
|
||||
|
||||
<P>
|
||||
|
||||
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
|
||||
<UL>
|
||||
<P>In the folder mozilla:build:mac:, there are several Perl scripts with
|
||||
names of the form BuildMozillaXXX.pl, where XXX is "Optimized",
|
||||
"Debug", "Tinderbox", et al. Each script builds the corresponding
|
||||
version of Mozilla. If you configured the MacPerl application to
|
||||
execute scripts that are opened from the finder, all you have to do is
|
||||
double click on the appropriate one; otherwise, launch MacPerl, and
|
||||
run the appropriate script from the "Run Script..." menu item.</P>
|
||||
|
||||
<P>These `configured build' scripts are simple, and you might want to
|
||||
make your own to force your build to StopForErrors(), or alternatively
|
||||
DontStopForErrors(), et al. You can set up certain build-script
|
||||
variables and (soon) compile-time flags. Compare the supplied scripts
|
||||
to figure out what you might want. Note that CodeWarriorLib, Moz.pm,
|
||||
and BuildList.pm, are AppleScript libraries and Perl modules meant to
|
||||
be used by a `configured build'. Use your favorite POD viewer (Shuck
|
||||
comes with MacPerl) to view the documentation in the Perl scripts.</P>
|
||||
|
||||
<P>If there were any errors in any of the projects along the way, the
|
||||
script will stop at that point and the IDE will tell you the errors.
|
||||
You can fix them and make sure they current project builds, but to
|
||||
continue the automation, you have to start from the beginning by
|
||||
double-clicking the script again. This isn't quite as bad as it
|
||||
sounds because the previous projects are already built (unless you
|
||||
changed some major header file). Please note that stopping the script
|
||||
once it has started is difficult. We are working to address
|
||||
this issue.</P>
|
||||
|
||||
<P>After the build is complete, you can find aliases to the built libraries
|
||||
and the final Mozilla application. Debug builds are built to
|
||||
Mozilla:dist:client_debug, while optimized builds are built to Mozilla:dist:client.
|
||||
</P>
|
||||
|
||||
<P>Don't worry too much about the numerous warnings generated during
|
||||
the build. We try our best to get the XP teams to use real compilers,
|
||||
but alas, they continue to write warning-laden code. There is also
|
||||
some generated code (Java is one example) that has a lot of warnings
|
||||
that we can't help either. If you write any new code, please help us
|
||||
in our quest to get zero warnings.</P>
|
||||
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
|
||||
<UL>
|
||||
<LI><B>I have CodeWarrior3, how do i build with it?</B>
|
||||
<UL> Currently, the answer is, "You don't." Eventually, the distribution
|
||||
will be modified to allow building using CodeWarrior3, but for now
|
||||
CodeWarrior2 is the only IDE that is supported.
|
||||
</UL>
|
||||
</LI>
|
||||
</UL>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4. Credits</A></H2>
|
||||
<UL>
|
||||
The majority of this document is taken from the build document included
|
||||
in the Mozilla source distribution at README:mozilla:macbuild.htm written
|
||||
by Mike Pinkerton, <A HREF="mailto:pinkerton@netscape.com">
|
||||
pinkerton@netscape.com</A>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
163
mozilla/README/mozilla/unix-build.html
Normal file
163
mozilla/README/mozilla/unix-build.html
Normal file
@@ -0,0 +1,163 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Building the Mozilla client on unix platforms</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
<HR>
|
||||
<H1>Building the Mozilla client on Unix platforms</H1>
|
||||
|
||||
<H2>
|
||||
Daniel Nunes, <TT><A HREF="mailto:leaf@mozilla.org">leaf@mozilla.org</A></TT></H2>
|
||||
v 1.2, 1998-11-02
|
||||
|
||||
<P>
|
||||
<HR><I>How to build Mozilla on a Unix System.</I>
|
||||
<HR>
|
||||
<H2>1. <A HREF="#s1">Introduction</A></H2>
|
||||
|
||||
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.2">2.2 Requirements</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.3">2.3 Build the Lizard</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.4">2.4 After the Build</A></LI>
|
||||
</UL>
|
||||
|
||||
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Introduction</A></H2>
|
||||
|
||||
<P>
|
||||
Perhaps you are interested in building classic Mozilla, before the
|
||||
fall of the old layout engine, and the rise of the new. If so, the
|
||||
<B><A HREF="classic-unix.html">Classic Mozilla Build document</A></B>
|
||||
is what you're looking for.
|
||||
|
||||
<P>
|
||||
|
||||
<P>
|
||||
What this document is: A guide to building the Mozilla application.
|
||||
<BR>
|
||||
This includes:
|
||||
<OL>
|
||||
<LI> A listing of the development tools you will need to build Mozilla. </LI>
|
||||
<LI> A sample set of commands to build Mozilla using the Autoconf
|
||||
build system. </LI>
|
||||
</OL>
|
||||
<P>
|
||||
If you're looking for documentation on developing features or fixing bugs,
|
||||
the Mozilla
|
||||
<A HREF="../tplist.html">Technical Documents</A> or
|
||||
<A HREF="../../../library.html"> Library </A>
|
||||
are probably what you're looking for.
|
||||
<P>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Building Mozilla </A></H2>
|
||||
<P>
|
||||
<UL>Each of the following subsections describes, or gives references to
|
||||
descriptions of, the steps necessary to build Mozilla.
|
||||
</UL>
|
||||
<UL>
|
||||
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
|
||||
Eventually, there will be two principal ways of getting the code,
|
||||
<A HREF="../../../download.html"> ftp</A> and
|
||||
<A HREF="../../../cvs.html"> CVS</A>.
|
||||
CVS will provide the most current code for building, but is
|
||||
slower than ftp. Ftp drops are generally produced once per month,
|
||||
and are known to compile on some machine, somewhere.
|
||||
|
||||
<B>For now</B>, however, you must do the following to obtain the newest
|
||||
browser source:
|
||||
<BR>
|
||||
<CODE>
|
||||
cvs co mozilla/nglayout.mk<BR>
|
||||
cd mozilla<BR>
|
||||
gmake -f nglayout.mk pull_all<BR>
|
||||
</CODE>
|
||||
<BR>
|
||||
This should pull all the right source.
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
|
||||
<UL>
|
||||
The following should be installed:
|
||||
<UL>
|
||||
<LI>Motif 1.2
|
||||
<LI>The native C/C++ compiler (or GNU C/C++ compiler 2.7.2 in lieu of the
|
||||
native compiler)
|
||||
<LI>GNU make 3.74 or better
|
||||
<LI>Perl5
|
||||
<LI><A HREF="../../../projects/autoconf/">Autconf</A> requirements,
|
||||
including NSPR.
|
||||
<LI><CODE>LD_LIBRARY_PATH</CODE> must include the path to the NSPR
|
||||
shared objects.<BR>
|
||||
For most people, this means adding <CODE>/usr/local/nspr/lib</CODE>
|
||||
to <CODE>LD_LIBRARY_PATH</CODE>
|
||||
(either:
|
||||
<BR>
|
||||
<CODE>setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/usr/local/nspr/lib</CODE>
|
||||
<BR>
|
||||
or
|
||||
<BR>
|
||||
<CODE>export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/nspr/lib</CODE>
|
||||
.<BR>
|
||||
If you get an error like "No such variable" then omit the
|
||||
<CODE>${LD_LIBRARY_PATH}:</CODE> part
|
||||
)
|
||||
</UL>
|
||||
<P>
|
||||
Your hardware should be equal to, or better than:
|
||||
<UL>
|
||||
32 MB RAM, 128 MB swap (64 MB RAM recommended)
|
||||
</UL>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Build the Lizard</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
<CODE>
|
||||
autoconf<BR>
|
||||
mkdir obj-`./build/autoconf/config.guess`<BR>
|
||||
cd obj-`./build/autoconf/config.guess`<BR>
|
||||
../configure --with-nspr=/usr/local/nspr --enable-toolkit=motif<BR>
|
||||
gmake depend<BR>
|
||||
gmake<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
<H2><A NAME="ss2.4">2.4 After the build </A></H2>
|
||||
<UL>
|
||||
|
||||
<LI> <CODE>cd dist/bin</CODE> and you should see links to the objects you
|
||||
need to run <CODE>main</CODE>.
|
||||
|
||||
<LI>On most unixen LD_LIBRARY_PATH must be set to wherever the necessary
|
||||
libraries are.
|
||||
|
||||
<UL>
|
||||
<LI>On HP-UX, the equivalent environment variable is <CODE>SHLIB_PATH</CODE>.
|
||||
<LI>On AIX, the equivalent environment variable is <CODE>LIBPATH</CODE>.
|
||||
</UL>
|
||||
</UL>
|
||||
</UL>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
|
||||
<LI>I'm sure there are bound to be some. Send
|
||||
<A HREF="mailto:leaf@mozilla.org"> me</A> mail.
|
||||
<HR>
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
209
mozilla/README/mozilla/win-build.html
Normal file
209
mozilla/README/mozilla/win-build.html
Normal file
@@ -0,0 +1,209 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Building Mozilla on Microsoft Windows 32-bit platforms</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
<HR>
|
||||
<H1>
|
||||
Building Mozilla on Microsoft Windows 32-bit platforms</H1>
|
||||
|
||||
<H2>
|
||||
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
|
||||
</H2>
|
||||
v 1.0, June 1998
|
||||
|
||||
<P>
|
||||
<HR><I>How to build Mozilla on a Microsoft Windows 32-bit System.</I>
|
||||
<HR>
|
||||
<H2>1. <A HREF="#s1">Introduction</A></H2>
|
||||
|
||||
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.2">2.2 Requirements</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
|
||||
</UL>
|
||||
|
||||
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Introduction</A></H2>
|
||||
|
||||
<P>
|
||||
What this document is: A guide to building the Mozilla application.
|
||||
<BR>
|
||||
This includes:
|
||||
<OL>
|
||||
<LI> A listing of the development tools you will need to build Mozilla. </LI>
|
||||
<LI> A list of environment variables you will need to set before building. </LI>
|
||||
</OL>
|
||||
<P>
|
||||
If you're looking for documentation on developing features or fixing bugs,
|
||||
the Mozilla
|
||||
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
|
||||
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
|
||||
are probably what you're looking for.
|
||||
<P>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Building Mozilla </A></H2>
|
||||
<P>
|
||||
<UL>Each of the following subsections describes, or gives references to
|
||||
descriptions of, the steps necessary to build Mozilla.
|
||||
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
There are two principal ways of getting the code,
|
||||
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
|
||||
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
|
||||
CVS will provide the least outdated code for building, but is
|
||||
slower than ftp.
|
||||
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
|
||||
<UL>
|
||||
The following need to be installed:
|
||||
<UL>
|
||||
<LI>Microsoft Visual C++ version 4.2 or later
|
||||
<LI>GNU Tools for Microsoft Windows, located:
|
||||
<UL>
|
||||
<LI><A HREF="http://www.cygnus.com/misc/gnu-win32">Cygnus</A></LI>
|
||||
<LI><A HREF="http://www.gnu.org/order/ftp.html">GNU home page</A></LI>
|
||||
<LI><A HREF="ftp://prep.ai.mit.edu/pub/gnu">MIT</A></LI>
|
||||
</UL>
|
||||
Specifically, you'll need:
|
||||
<UL><CODE>
|
||||
cp.exe<BR>
|
||||
rm.exe<BR>
|
||||
uname.exe<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
Netscape has internally modified version of gmake, shmsdos and win32gnu
|
||||
that we use to get around some problems we were having keeping in sync
|
||||
with the Unix version of gmake. This version of gmake can be found in the
|
||||
Windows Build Tools package, which can be ftp'd from
|
||||
<A HREF="http://www.mozilla.org/download-mozilla.html"> the Mozilla
|
||||
Download page</A>.
|
||||
The three files you will need are:
|
||||
<UL><CODE>
|
||||
gmake.exe<BR>
|
||||
shmsdos.exe<BR>
|
||||
uname.exe<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
|
||||
</UL>
|
||||
<P>
|
||||
Hardware/OS
|
||||
<UL>
|
||||
<LI>Pentium 133 MHz or better</LI>
|
||||
<LI>64 MB RAM, 128 MB recommended</LI>
|
||||
<LI>250 MB NTFS or 500 MB FAT disk space</LI>
|
||||
<LI>NT 4.0 is preferred; NT 3.51 will also work.
|
||||
</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
The following environment variables need to be set:
|
||||
<UL>
|
||||
<CODE>
|
||||
set MOZ_BITS=32
|
||||
<BR>
|
||||
set MOZ_DEBUG=1 (set this only if you want to build a debug build)
|
||||
<BR>
|
||||
set MOZ_GOLD=1
|
||||
<BR>
|
||||
set MOZ_MEDIUM=1
|
||||
<BR>
|
||||
set MOZ_NT=351 (if running NT3.51)
|
||||
<BR>
|
||||
set MOZ_OUT=(optional: specifies location of resultant executable)
|
||||
<BR>
|
||||
set MOZ_SRC=(top of your tree, for example: set MOZ_SRC=d:\mozilla_source
|
||||
if this is the directory where you checked or unzipped the source into)
|
||||
<BR>
|
||||
set MOZ_TOOLS=(location of the bin directory of your GNU tools. The build
|
||||
looks for MOZ_TOOLS\bin\gmake.exe, so make sure that the gmake.exe from
|
||||
the Windows Build Tools package resides there.)
|
||||
<BR>
|
||||
set NO_SECURITY=1
|
||||
<BR>
|
||||
set NSPR20=1
|
||||
<BR>
|
||||
set _MSC_VER=1100 (if you are running VC++ 5.0 or higher)
|
||||
<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
<BR>
|
||||
<P>
|
||||
</UL>
|
||||
|
||||
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
|
||||
<UL>
|
||||
Change to the directory you copied the source into (for example,
|
||||
<CODE>cd d:\mozilla_source</CODE>). If this directory was empty before you
|
||||
installed the source, there should be two directories here:
|
||||
<CODE>README</CODE> and <CODE>mozilla</CODE>.
|
||||
<CODE>
|
||||
<PRE>
|
||||
cd mozilla\config
|
||||
nmake /f makefile.win
|
||||
cd ..
|
||||
nmake /f client.mak
|
||||
</PRE>
|
||||
</CODE>
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
|
||||
<UL>
|
||||
<LI><B>nmake has a 'fatal error', listing one of the GNU commands and a
|
||||
hexadecimal return code.</B>
|
||||
<UL>
|
||||
This will happen as a result of not having the GNU tools and Windows Build
|
||||
tools in your path. Add the directories with the appropriate binaries to your
|
||||
path.
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>It fails with the message "'.\WIN32' unexpected": </B>
|
||||
<UL>
|
||||
You didn't properly
|
||||
set the environment variables -- you must not include a space at the end
|
||||
of the set statements (be careful if you are cut'n'pasting).
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>It fails to build, with directory-related errors: </B>
|
||||
<UL>
|
||||
The full path
|
||||
to the source must not include any spaces. Additionally, the source must
|
||||
be extracted with an intact directory structure by a utility that understands
|
||||
long filenames. If in doubt, grab Info-Zip at
|
||||
<A HREF="ftp://ftp.cdrom.com/pub/infozip">ftp://ftp.cdrom.com/pub/infozip</A>
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>I'm not running a 32-bit windows system, how do i build?</B>
|
||||
<UL>
|
||||
Currently, the build process depends on a 32-bit operating system.
|
||||
Windows NT 4.0 is the recommended windows operating system.
|
||||
</UL>
|
||||
</UL>
|
||||
<HR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
53
mozilla/README/mozilla/wininstall.htm
Normal file
53
mozilla/README/mozilla/wininstall.htm
Normal file
@@ -0,0 +1,53 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="Author" CONTENT="Chris Yeh">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en]C-NSCP (WinNT; U) [Netscape]">
|
||||
<TITLE>Running Mozilla...</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<H2>
|
||||
<FONT FACE="Arial,Helvetica">Running Mozilla Without Trashing Netscape
|
||||
Installation</FONT></H2>
|
||||
This document explains how to run <TT>mozilla.exe</TT> separately from
|
||||
<TT>netscape.exe</TT> without trashing your regular installation of Netscape
|
||||
Communicator. This is necessary if, for example, you want to use Communicator's
|
||||
mail client while you work on Mozilla development.
|
||||
<BR>
|
||||
<HR WIDTH="100%">
|
||||
<OL>
|
||||
<LI>
|
||||
Before running <TT>mozilla.exe</TT>, create a new user profile either from
|
||||
a Netscape 4.0x installation using the "User Profile Manager" shortcut
|
||||
in the Utilities folder (on Windows) or by using the <TT>-new_account</TT>
|
||||
option on the command line of either <TT>netscape.exe</TT> or <TT>mozilla.exe</TT>.
|
||||
We suggest calling the profile "<TT>mozilla</TT>."</LI>
|
||||
|
||||
<LI>
|
||||
Always use that new account when running <TT>mozilla.exe</TT>, and never
|
||||
run <TT>netscape.exe</TT> using that same account profile.</LI>
|
||||
</OL>
|
||||
To make things easier, you can start the application with the user account
|
||||
on the command line, for example:
|
||||
<UL><TT>mozilla.exe -P"mozilla"</TT></UL>
|
||||
This assures that prefs and the cache will not interfere between the two
|
||||
versions. This will be especially
|
||||
<BR>important as new prefs are added to the Mozilla product. Note that
|
||||
you must use quotes around the name and there can be no space between the
|
||||
"P" and the profile name. Otherwise, the application won't catch the profile
|
||||
switch, and it will try to load the profile name as the initial URL.
|
||||
|
||||
<P>
|
||||
<HR WIDTH="100%">
|
||||
<BR>You can copy your <TT>bookmark.htm</TT> file from an existing profile
|
||||
to your new profile directory if you want to share bookmarks.
|
||||
|
||||
<P>After the initial 3/31 release, we will add some code to Mozilla to
|
||||
prevent running with a profile that is already being used by <TT>netscape.exe</TT>.
|
||||
<BR>
|
||||
<HR WIDTH="100%">
|
||||
<BR><FONT SIZE=-1>Copyright © 1998 <A HREF="http://home.netscape.com/misc/contact_info.html">Netscape
|
||||
Communications Corporation</A></FONT>
|
||||
</BODY>
|
||||
</HTML>
|
||||
184
mozilla/README/nglayout/winbuild.html
Normal file
184
mozilla/README/nglayout/winbuild.html
Normal file
@@ -0,0 +1,184 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=x-mac-roman">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (WinNT; I) [Netscape]">
|
||||
<META NAME="KeyWords" CONTENT="client, source, documentation">
|
||||
<META NAME="Author" CONTENT="Kipp E.B. Hickman">
|
||||
<TITLE>NGLayout Windows Build Instructions</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
|
||||
<H2>
|
||||
<FONT FACE="Arial,Helvetica">NGLayout Windows Build Instructions</FONT></H2>
|
||||
This document explains how to build NGLayout for the Windows platform.
|
||||
<HR><B><FONT SIZE=+1>Required Tools:</FONT></B>
|
||||
<UL>
|
||||
<LI>
|
||||
<B>Microsoft Visual C++ version 4.2 or later</B></LI>
|
||||
|
||||
<LI>
|
||||
<B>The same set of tools for building <A HREF="http://www.mozilla.org/docs/tplist/catBuild/winbuild.htm">Mozilla</A></B></LI>
|
||||
</UL>
|
||||
<B><FONT SIZE=+1>Setting up:</FONT></B>
|
||||
<UL>
|
||||
<LI>
|
||||
You need a Pentium with at least a 133 MHz processor and at least 250 megs
|
||||
(NTFS partition) or 500 megs (FAT partition) of hard drive space. You need
|
||||
to have a minimum of 64 megs of memory in order to build this tree. These
|
||||
numbers are approximations.</LI>
|
||||
|
||||
<LI>
|
||||
The preferred platform is NT 4.0. NT 3.51 will also work, and Win95 might
|
||||
work if you're lucky. Maybe.</LI>
|
||||
|
||||
<LI>
|
||||
Install MSVC. If you don't choose to have the MSVC install modify your
|
||||
environment variables for PATH, INCLUDE, and LIB information, be sure to
|
||||
run VCVARS32.BAT out of the MSVC bin directory prior to attempting to build.</LI>
|
||||
|
||||
<LI>
|
||||
Download and install GNU tools. Put them in your path.</LI>
|
||||
|
||||
<LI>
|
||||
Install NGLayout source.</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
cd <your-source-area></LI>
|
||||
|
||||
<LI>
|
||||
unzip -o -q win-19980415.zip</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
There are several environment variables you will need to set, either manually
|
||||
or via a script within a command session, or by setting them in your system
|
||||
environment located through the Control Panel | System icon.</LI>
|
||||
|
||||
|
||||
<P> <B>Note: There is an additional variable for building NGLayout!
|
||||
Use this list carefully!</B>
|
||||
|
||||
<P> The variables are:
|
||||
<UL>
|
||||
<LI>
|
||||
set MOZ_BITS=32</LI>
|
||||
|
||||
<LI>
|
||||
set MOZ_DEBUG=1 (don't set this if you want to build an optimized release
|
||||
build)</LI>
|
||||
|
||||
<LI>
|
||||
set MOZ_GOLD=1</LI>
|
||||
|
||||
<LI>
|
||||
set MOZ_MEDIUM=1</LI>
|
||||
|
||||
<LI>
|
||||
set MOZ_NT=351 (if running NT 3.51, don't set otherwise)</LI>
|
||||
|
||||
<LI>
|
||||
set MOZ_OUT=(location of resulting executable and totally optional, see
|
||||
Notes for more details)</LI>
|
||||
|
||||
<LI>
|
||||
set MOZ_SRC=(top of your tree, drive letter and path, i.e. set MOZ_SRC=d:\mozilla_src.
|
||||
The topmost directory under this should be mozilla)</LI>
|
||||
|
||||
<LI>
|
||||
set MOZ_TOOLS=(location of the bin directory containing your GNU tools.
|
||||
The build looks for MOZ_TOOLS\bin\gmake.exe, so make sure your MOZ_TOOLS
|
||||
is figured appropriately)</LI>
|
||||
|
||||
<LI>
|
||||
set NO_SECURITY=1</LI>
|
||||
|
||||
<LI>
|
||||
set NSPR20=1</LI>
|
||||
|
||||
<LI>
|
||||
if you are running VC++ 5.0 or higher: set _MSC_VER=1100; if you are running
|
||||
VC++ 4.2 then set MOZ_VCVER=42</LI>
|
||||
|
||||
<LI>
|
||||
<B>set STANDALONE_IMAGE_LIB=1</B></LI>
|
||||
|
||||
<LI>
|
||||
<B>set MODULAR_NETLIB=1</B></LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<B><FONT SIZE=+1>Building:</FONT></B>
|
||||
<UL>
|
||||
<LI>
|
||||
You need to be running a vanilla command prompt. Other shells may work,
|
||||
but you might have to tweak makefiles.</LI>
|
||||
|
||||
<LI>
|
||||
<B>Build the tools:</B> This generates several tools that handle things
|
||||
like dependency generation</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
cd mozilla\config</LI>
|
||||
|
||||
<LI>
|
||||
nmake /f makefile.win</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
<B>Build the NGLayout:</B> This will do a complete build of the source
|
||||
tree. You will end up with a viewer.exe at the end. The viewer.exe will
|
||||
be in your dist\win32_[OD].obj\bin directory (O will be used when you don't
|
||||
set MOZ_DEBUG; D will be used when you set MOZ_DEBUG).</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
cd mozilla</LI>
|
||||
|
||||
<LI>
|
||||
nmake /f nglayout.mak</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<B><FONT SIZE=+1>Running:</FONT></B>
|
||||
<UL>
|
||||
<LI>
|
||||
Once you have built the system, do this to run the viewer program (the
|
||||
viewer program is a simple test program that uses the nsIWebWidget API
|
||||
to embed a web widget object). The viewer program has a few basic menu
|
||||
items, include "Samples" which load sample tests.</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
cd mozilla\dist\win32_[OD].obj\bin</LI>
|
||||
|
||||
<LI>
|
||||
.\viewer.exe</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<B><FONT SIZE=+1>Notes:</FONT></B>
|
||||
<UL>
|
||||
<LI>
|
||||
This build process does not use Visual C++ generated project files for
|
||||
several reasons having to do with (among other things) size, maintainability,
|
||||
and the long term desire to start using more of tools like gmake, or plug
|
||||
and play developer tools. This does not preclude you from using the Visual
|
||||
C++ IDE, or it's debugger. Once you have built a viewer.exe do this to
|
||||
run it under the debugger:</LI>
|
||||
</UL>
|
||||
|
||||
<UL>
|
||||
<UL>
|
||||
<LI>
|
||||
cd mozilla\dist\win32_[OD].obj\bin</LI>
|
||||
|
||||
<LI>
|
||||
msdev viewer.exe</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<HR WIDTH="100%">
|
||||
<CENTER><FONT SIZE=-1>Copyright © 1998 <A HREF="http://home.netscape.com/misc/contact_info.html">Netscape
|
||||
Communications Corporation</A></FONT></CENTER>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
7
mozilla/aclocal.m4
vendored
Normal file
7
mozilla/aclocal.m4
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
dnl
|
||||
dnl Local autoconf macros used with mozilla
|
||||
dnl The contents of this file are under the Public Domain.
|
||||
dnl
|
||||
|
||||
builtin(include, gtk.m4)dnl
|
||||
|
||||
@@ -22,11 +22,9 @@ srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
DIRS = public src
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += tests
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -2,7 +2,6 @@
|
||||
mozilla/base/src/mac/nsTimerMac.cpp
|
||||
mozilla/base/src/nsArena.cpp
|
||||
mozilla/base/src/nsAtomTable.cpp
|
||||
mozilla/base/src/nsBaseDLL.cpp
|
||||
mozilla/base/src/nsBTree.cpp
|
||||
mozilla/base/src/nsByteBuffer.cpp
|
||||
mozilla/base/src/nsCRT.cpp
|
||||
@@ -11,7 +10,6 @@ mozilla/base/src/nsEscape.cpp
|
||||
mozilla/base/src/nsFileSpec.cpp
|
||||
mozilla/base/src/nsFileStream.cpp
|
||||
mozilla/base/src/nsRBTree.cpp
|
||||
mozilla/base/src/nsProperties.cpp
|
||||
mozilla/base/src/nsSizeOfHandler.cpp
|
||||
mozilla/base/src/nsString.cpp
|
||||
mozilla/base/src/nsUnicharBuffer.cpp
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
# This is a list of local files which get copied to the mozilla:dist:base directory
|
||||
#
|
||||
|
||||
nsAutoLock.h
|
||||
nsISizeOfHandler.h
|
||||
nsFileStream.h
|
||||
nsIFileStream.h
|
||||
nsFileSpec.h
|
||||
nsRepeater.h
|
||||
nsIProperties.h
|
||||
nsCaretProperties.h
|
||||
nsRepeater.h
|
||||
@@ -25,14 +25,10 @@ include $(DEPTH)/config/autoconf.mk
|
||||
DEFINES += -D_IMPL_NS_BASE
|
||||
|
||||
EXPORTS = \
|
||||
nsAutoLock.h \
|
||||
nsIProperties.h \
|
||||
nsISizeOfHandler.h \
|
||||
nsCaretProperties.h \
|
||||
nsEscape.h \
|
||||
nsFileSpec.h \
|
||||
nsFileStream.h \
|
||||
nsIFileStream.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
@@ -20,16 +20,12 @@ IGNORE_MANIFEST=1
|
||||
|
||||
DEFINES = -D_IMPL_NS_BASE
|
||||
|
||||
EXPORTS = \
|
||||
nsAutoLock.h \
|
||||
nsCaretProperties.h \
|
||||
nsIProperties.h \
|
||||
nsISizeOfHandler.h \
|
||||
nsEscape.h \
|
||||
nsFileSpec.h \
|
||||
nsFileStream.h \
|
||||
nsIFileStream.h \
|
||||
$(NULL)
|
||||
EXPORTS = \
|
||||
nsIProperties.h \
|
||||
nsISizeOfHandler.h \
|
||||
nsFileSpec.h \
|
||||
nsFileStream.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = raptor
|
||||
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
A stack-based lock object that makes using PRLock a bit more
|
||||
convenient. It acquires the monitor when constructed, and releases
|
||||
it when it goes out of scope.
|
||||
|
||||
For example,
|
||||
|
||||
class Foo {
|
||||
private:
|
||||
PRLock* mLock;
|
||||
|
||||
public:
|
||||
Foo(void) {
|
||||
mLock = PR_NewLock();
|
||||
}
|
||||
|
||||
virtual ~Foo(void) {
|
||||
PR_DestroyLock(mLock);
|
||||
}
|
||||
|
||||
void ThreadSafeMethod(void) {
|
||||
// we're don't hold the lock yet...
|
||||
|
||||
nsAutoLock lock(mLock);
|
||||
// ...but now we do.
|
||||
|
||||
// we even can do wacky stuff like return from arbitrary places w/o
|
||||
// worrying about forgetting to release the lock
|
||||
if (some_weird_condition)
|
||||
return;
|
||||
|
||||
// otherwise do some other stuff
|
||||
}
|
||||
|
||||
void ThreadSafeBlockScope(void) {
|
||||
// we're not in the lock here...
|
||||
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
// but we are now, at least until the block scope closes
|
||||
}
|
||||
|
||||
// ...now we're not in the lock anymore
|
||||
}
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsAutoLock_h__
|
||||
#define nsAutoLock_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "prlock.h"
|
||||
#include "prlog.h"
|
||||
|
||||
// If you ever decide that you need to add a non-inline method to this
|
||||
// class, be sure to change the class declaration to "class NS_BASE
|
||||
// nsAutoLock".
|
||||
|
||||
class nsAutoLock {
|
||||
private:
|
||||
PRLock* mLock;
|
||||
|
||||
// Not meant to be implemented. This makes it a compiler error to
|
||||
// construct or assign an nsAutoLock object incorrectly.
|
||||
nsAutoLock(void) {}
|
||||
nsAutoLock(nsAutoLock& aLock) {}
|
||||
nsAutoLock& operator =(nsAutoLock& aLock) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Not meant to be implemented. This makes it a compiler error to
|
||||
// attempt to create an nsAutoLock object on the heap.
|
||||
static void* operator new(size_t size) {
|
||||
return nsnull;
|
||||
}
|
||||
static void operator delete(void* memory) {}
|
||||
|
||||
public:
|
||||
nsAutoLock(PRLock* aLock) : mLock(aLock) {
|
||||
PR_ASSERT(mLock);
|
||||
|
||||
// This will assert deep in the bowels of NSPR if you attempt
|
||||
// to re-enter the lock.
|
||||
PR_Lock(mLock);
|
||||
}
|
||||
|
||||
|
||||
~nsAutoLock(void) {
|
||||
PR_Unlock(mLock);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // nsAutoLock_h__
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#define _ESCAPE_H_
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nscore.h"
|
||||
|
||||
/* valid mask values for NET_Escape() and NET_EscapedSize(). */
|
||||
typedef enum {
|
||||
@@ -34,20 +33,19 @@ typedef enum {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
NS_BASE char * nsEscape(const char * str, nsEscapeMask mask);
|
||||
char * nsEscape(const char * str, nsEscapeMask mask);
|
||||
/* Caller must use delete [] on the result */
|
||||
|
||||
NS_BASE char * nsUnescape(char * str);
|
||||
char * nsUnescape(char * str);
|
||||
/* decode % escaped hex codes into character values,
|
||||
* modifies the parameter, returns the same buffer
|
||||
*/
|
||||
|
||||
NS_BASE char * nsEscapeCount(const char * str, PRInt32 len, nsEscapeMask mask, PRInt32* out_len);
|
||||
char * nsEscapeCount(const char * str, PRInt32 len, nsEscapeMask mask, PRInt32* out_len);
|
||||
/* Like nsEscape, but if out_len is non-null, return result string length
|
||||
* in *out_len, and uses len instead of NUL termination.
|
||||
* Caller must use delete [] on the result.
|
||||
*/
|
||||
NS_BASE PRInt32 nsUnescapeCount (char * str);
|
||||
PRInt32 nsUnescapeCount (char * str);
|
||||
/* decode % escaped hex codes into character values,
|
||||
* modifies the parameter buffer, returns the length of the result
|
||||
* (result may contain \0's).
|
||||
|
||||
@@ -24,16 +24,7 @@
|
||||
//
|
||||
// Classes defined:
|
||||
//
|
||||
// nsFilePath, nsFileURL, nsFileSpec, nsPersistentFileDescriptor.
|
||||
//
|
||||
// Q. How should I represent files at run time?
|
||||
// A. Use nsFileSpec. Using char* will lose information on some platforms.
|
||||
//
|
||||
// Q. Then what are nsFilePath and nsFileURL for?
|
||||
// A. Only when you need a char* parameter for legacy code.
|
||||
//
|
||||
// Q. How should I represent files in a persistent way (eg, in a disk file)?
|
||||
// A. Use nsPersistentFileDescriptor. Convert to and from nsFileSpec at run time.
|
||||
// nsFilePath, nsFileURL, nsNativeFileSpec.
|
||||
//
|
||||
// This suite provides the following services:
|
||||
//
|
||||
@@ -72,7 +63,7 @@
|
||||
//
|
||||
// Initialize a native file spec from a URL
|
||||
//
|
||||
// nsFileSpec fileSpec(fileURL);
|
||||
// nsNativeFileSpec fileSpec(fileURL);
|
||||
//
|
||||
// Make the spec unique (this one has no suffix).
|
||||
//
|
||||
@@ -112,7 +103,6 @@
|
||||
#define _FILESPEC_H_
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsError.h"
|
||||
|
||||
//========================================================================================
|
||||
// Compiler-specific macros, as needed
|
||||
@@ -126,13 +116,11 @@
|
||||
#define NS_NAMESPACE_PROTOTYPE
|
||||
#define NS_NAMESPACE namespace
|
||||
#define NS_NAMESPACE_END
|
||||
#define NS_EXPLICIT explicit
|
||||
#else
|
||||
|
||||
#define NS_NAMESPACE_PROTOTYPE static
|
||||
#define NS_NAMESPACE struct
|
||||
#define NS_NAMESPACE_END ;
|
||||
#define NS_EXPLICIT
|
||||
|
||||
#endif
|
||||
//=========================== End Compiler-specific macros ===============================
|
||||
@@ -149,50 +137,33 @@
|
||||
// Here are the allowable ways to describe a file.
|
||||
//========================================================================================
|
||||
|
||||
class nsFileSpec; // Preferred. For i/o use nsInputFileStream, nsOutputFileStream
|
||||
class nsFilePath; // This can be passed to NSPR file I/O routines, if you must.
|
||||
class nsFilePath; // This can be passed to NSPR file I/O routines.
|
||||
class nsFileURL;
|
||||
class nsPersistentFileDescriptor; // Used for storage across program launches.
|
||||
class nsNativeFileSpec;
|
||||
|
||||
#define kFileURLPrefix "file://"
|
||||
#define kFileURLPrefixLength (7)
|
||||
|
||||
class nsOutputStream;
|
||||
class nsInputStream;
|
||||
class nsOutputFileStream;
|
||||
class nsInputFileStream;
|
||||
class nsBasicOutStream;
|
||||
|
||||
//========================================================================================
|
||||
// Conversion of native file errors to nsresult values. These are really only for use
|
||||
// in the file module, clients of this interface shouldn't really need them.
|
||||
// Error results returned from this interface have, in the low-order 16 bits,
|
||||
// native errors that are masked to 16 bits. Assumption: a native error of 0 is success
|
||||
// on all platforms. Note the way we define this using an inline function. This
|
||||
// avoids multiple evaluation if people go NS_FILE_RESULT(function_call()).
|
||||
#define NS_FILE_RESULT(x) ns_file_convert_result((PRInt32)x)
|
||||
nsresult ns_file_convert_result(PRInt32 nativeErr);
|
||||
#define NS_FILE_FAILURE NS_FILE_RESULT(-1)
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsFileSpec
|
||||
class NS_BASE nsNativeFileSpec
|
||||
// This is whatever each platform really prefers to describe files as. Declared first
|
||||
// because the other two types have an embeded nsFileSpec object.
|
||||
// because the other two types have an embeded nsNativeFileSpec object.
|
||||
//========================================================================================
|
||||
{
|
||||
public:
|
||||
nsFileSpec();
|
||||
NS_EXPLICIT nsFileSpec(const char* inString, PRBool inCreateDirs = PR_FALSE);
|
||||
NS_EXPLICIT nsFileSpec(const nsFilePath& inPath);
|
||||
NS_EXPLICIT nsFileSpec(const nsFileURL& inURL);
|
||||
NS_EXPLICIT nsFileSpec(const nsPersistentFileDescriptor& inURL);
|
||||
nsFileSpec(const nsFileSpec& inPath);
|
||||
virtual ~nsFileSpec();
|
||||
nsNativeFileSpec();
|
||||
explicit nsNativeFileSpec(const char* inString, bool inCreateDirs = false);
|
||||
explicit nsNativeFileSpec(const nsFilePath& inPath);
|
||||
explicit nsNativeFileSpec(const nsFileURL& inURL);
|
||||
nsNativeFileSpec(const nsNativeFileSpec& inPath);
|
||||
virtual ~nsNativeFileSpec();
|
||||
|
||||
void operator = (const char* inPath);
|
||||
void operator = (const nsFilePath& inPath);
|
||||
void operator = (const nsFileURL& inURL);
|
||||
void operator = (const nsFileSpec& inOther);
|
||||
void operator = (const nsPersistentFileDescriptor& inOther);
|
||||
void operator = (const nsNativeFileSpec& inOther);
|
||||
|
||||
#ifndef XP_MAC
|
||||
operator const char* () const { return mPath; }
|
||||
@@ -204,22 +175,23 @@ class NS_BASE nsFileSpec
|
||||
#ifdef XP_MAC
|
||||
// For Macintosh people, this is meant to be useful in its own right as a C++ version
|
||||
// of the FSSpec struct.
|
||||
nsFileSpec(
|
||||
nsNativeFileSpec(
|
||||
short vRefNum,
|
||||
long parID,
|
||||
ConstStr255Param name);
|
||||
nsFileSpec(const FSSpec& inSpec)
|
||||
: mSpec(inSpec), mError(NS_OK) {}
|
||||
nsNativeFileSpec(const FSSpec& inSpec)
|
||||
: mSpec(inSpec), mError(noErr) {}
|
||||
|
||||
operator FSSpec* () { return &mSpec; }
|
||||
operator const FSSpec* const () { return &mSpec; }
|
||||
operator FSSpec& () { return mSpec; }
|
||||
operator const FSSpec& () const { return mSpec; }
|
||||
OSErr Error() const { return mError; }
|
||||
void MakeAliasSafe();
|
||||
// Called for the spec of an alias. Copies the alias to
|
||||
// a secret temp directory and modifies the spec to point
|
||||
// to it. Sets mError.
|
||||
void ResolveAlias(PRBool& wasAliased);
|
||||
void ResolveAlias(bool& wasAliased);
|
||||
// Called for the spec of an alias. Modifies the spec to
|
||||
// point to the original. Sets mError.
|
||||
void MakeUnique(ConstStr255Param inSuggestedLeafName);
|
||||
@@ -227,15 +199,15 @@ class NS_BASE nsFileSpec
|
||||
ConstStr255Param GetLeafPName() const { return mSpec.name; }
|
||||
#endif // end of Macintosh utility methods.
|
||||
|
||||
PRBool Valid() const { return NS_SUCCEEDED(Error()); }
|
||||
nsresult Error() const { return mError; }
|
||||
#ifdef XP_MAC
|
||||
bool Valid() const { return mError == noErr; }
|
||||
#else
|
||||
bool Valid() const { return true; } // Fixme.
|
||||
#endif // XP_MAC
|
||||
|
||||
#if DEBUG
|
||||
friend NS_BASE nsOutputStream& operator << (
|
||||
nsOutputStream& s,
|
||||
const nsFileSpec& spec); // THIS IS FOR DEBUGGING ONLY.
|
||||
// see PersistentFileDescriptor for the real deal.
|
||||
#endif
|
||||
friend NS_BASE nsBasicOutStream& operator << (
|
||||
nsBasicOutStream& s,
|
||||
const nsNativeFileSpec& spec);
|
||||
|
||||
//--------------------------------------------------
|
||||
// Queries and path algebra. These do not modify the disk.
|
||||
@@ -246,7 +218,7 @@ class NS_BASE nsFileSpec
|
||||
// inLeafName can be a relative path, so this allows
|
||||
// one kind of concatenation of "paths".
|
||||
|
||||
void GetParent(nsFileSpec& outSpec) const;
|
||||
void GetParent(nsNativeFileSpec& outSpec) const;
|
||||
// Return the filespec of the parent directory. Used
|
||||
// in conjunction with GetLeafName(), this lets you
|
||||
// parse a path into a list of node names. Beware,
|
||||
@@ -254,7 +226,7 @@ class NS_BASE nsFileSpec
|
||||
// but a spec. Volumes on Macintosh can have identical
|
||||
// names. Perhaps could be used for an operator --() ?
|
||||
|
||||
nsFileSpec operator + (const char* inRelativePath) const;
|
||||
nsNativeFileSpec operator + (const char* inRelativePath) const;
|
||||
void operator += (const char* inRelativePath);
|
||||
// Concatenate the relative path to this directory.
|
||||
// Used for constructing the filespec of a descendant.
|
||||
@@ -268,24 +240,19 @@ class NS_BASE nsFileSpec
|
||||
void MakeUnique();
|
||||
void MakeUnique(const char* inSuggestedLeafName);
|
||||
|
||||
PRBool IsDirectory() const;
|
||||
bool IsDirectory() const;
|
||||
// More stringent than Exists()
|
||||
PRBool IsFile() const;
|
||||
bool IsFile() const;
|
||||
// More stringent than Exists()
|
||||
PRBool Exists() const;
|
||||
bool Exists() const;
|
||||
|
||||
//--------------------------------------------------
|
||||
// Creation and deletion of objects. These can modify the disk.
|
||||
//--------------------------------------------------
|
||||
|
||||
void CreateDirectory(int mode = 0700 /* for unix */);
|
||||
void Delete(PRBool inRecursive);
|
||||
void Delete(bool inRecursive);
|
||||
|
||||
nsresult Rename(const char* inNewName); // not const: gets updated
|
||||
nsresult Copy(const nsFileSpec& inNewParentDirectory) const;
|
||||
nsresult Move(const nsFileSpec& inNewParentDirectory) const;
|
||||
nsresult Execute(const char* args) const;
|
||||
|
||||
//--------------------------------------------------
|
||||
// Data
|
||||
//--------------------------------------------------
|
||||
@@ -294,15 +261,11 @@ class NS_BASE nsFileSpec
|
||||
friend class nsFilePath;
|
||||
#ifdef XP_MAC
|
||||
FSSpec mSpec;
|
||||
OSErr mError;
|
||||
#else
|
||||
char* mPath;
|
||||
#endif
|
||||
nsresult mError;
|
||||
}; // class nsFileSpec
|
||||
|
||||
// FOR HISTORICAL REASONS:
|
||||
|
||||
typedef nsFileSpec nsNativeFileSpec;
|
||||
}; // class nsNativeFileSpec
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsFileURL
|
||||
@@ -313,9 +276,9 @@ class NS_BASE nsFileURL
|
||||
{
|
||||
public:
|
||||
nsFileURL(const nsFileURL& inURL);
|
||||
NS_EXPLICIT nsFileURL(const char* inString, PRBool inCreateDirs = PR_FALSE);
|
||||
NS_EXPLICIT nsFileURL(const nsFilePath& inPath);
|
||||
NS_EXPLICIT nsFileURL(const nsFileSpec& inPath);
|
||||
explicit nsFileURL(const char* inString, bool inCreateDirs = false);
|
||||
explicit nsFileURL(const nsFilePath& inPath);
|
||||
explicit nsFileURL(const nsNativeFileSpec& inPath);
|
||||
virtual ~nsFileURL();
|
||||
|
||||
// nsString GetString() const { return mPath; }
|
||||
@@ -325,14 +288,14 @@ class NS_BASE nsFileURL
|
||||
void operator = (const nsFileURL& inURL);
|
||||
void operator = (const char* inString);
|
||||
void operator = (const nsFilePath& inOther);
|
||||
void operator = (const nsFileSpec& inOther);
|
||||
void operator = (const nsNativeFileSpec& inOther);
|
||||
|
||||
friend NS_BASE nsOutputStream& operator << (
|
||||
nsOutputStream& s, const nsFileURL& spec);
|
||||
friend NS_BASE nsBasicOutStream& operator << (
|
||||
nsBasicOutStream& s, const nsFileURL& spec);
|
||||
|
||||
#ifdef XP_MAC
|
||||
// Accessor to allow quick assignment to a mFileSpec
|
||||
const nsFileSpec& GetFileSpec() const { return mFileSpec; }
|
||||
// Accessor to allow quick assignment to a mNativeFileSpec
|
||||
const nsNativeFileSpec& GetNativeSpec() const { return mNativeFileSpec; }
|
||||
#endif
|
||||
private:
|
||||
// Should not be defined (only nsFilePath is to be treated as strings.
|
||||
@@ -343,8 +306,8 @@ class NS_BASE nsFileURL
|
||||
char* mURL;
|
||||
#ifdef XP_MAC
|
||||
// Since the path on the macintosh does not uniquely specify a file (volumes
|
||||
// can have the same name), stash the secret nsFileSpec, too.
|
||||
nsFileSpec mFileSpec;
|
||||
// can have the same name), stash the secret nsNativeFileSpec, too.
|
||||
nsNativeFileSpec mNativeFileSpec;
|
||||
#endif
|
||||
}; // class nsFileURL
|
||||
|
||||
@@ -356,9 +319,9 @@ class NS_BASE nsFilePath
|
||||
{
|
||||
public:
|
||||
nsFilePath(const nsFilePath& inPath);
|
||||
NS_EXPLICIT nsFilePath(const char* inString, PRBool inCreateDirs = PR_FALSE);
|
||||
NS_EXPLICIT nsFilePath(const nsFileURL& inURL);
|
||||
NS_EXPLICIT nsFilePath(const nsFileSpec& inPath);
|
||||
explicit nsFilePath(const char* inString, bool inCreateDirs = false);
|
||||
explicit nsFilePath(const nsFileURL& inURL);
|
||||
explicit nsFilePath(const nsNativeFileSpec& inPath);
|
||||
virtual ~nsFilePath();
|
||||
|
||||
|
||||
@@ -374,12 +337,12 @@ class NS_BASE nsFilePath
|
||||
void operator = (const nsFilePath& inPath);
|
||||
void operator = (const char* inString);
|
||||
void operator = (const nsFileURL& inURL);
|
||||
void operator = (const nsFileSpec& inOther);
|
||||
void operator = (const nsNativeFileSpec& inOther);
|
||||
|
||||
#ifdef XP_MAC
|
||||
public:
|
||||
// Accessor to allow quick assignment to a mFileSpec
|
||||
const nsFileSpec& GetFileSpec() const { return mFileSpec; }
|
||||
// Accessor to allow quick assignment to a mNativeFileSpec
|
||||
const nsNativeFileSpec& GetNativeSpec() const { return mNativeFileSpec; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
@@ -387,59 +350,26 @@ class NS_BASE nsFilePath
|
||||
char* mPath;
|
||||
#ifdef XP_MAC
|
||||
// Since the path on the macintosh does not uniquely specify a file (volumes
|
||||
// can have the same name), stash the secret nsFileSpec, too.
|
||||
nsFileSpec mFileSpec;
|
||||
// can have the same name), stash the secret nsNativeFileSpec, too.
|
||||
nsNativeFileSpec mNativeFileSpec;
|
||||
#endif
|
||||
}; // class nsFilePath
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsPersistentFileDescriptor
|
||||
//========================================================================================
|
||||
{
|
||||
public:
|
||||
nsPersistentFileDescriptor() : mDescriptorString(nsnull) {}
|
||||
// For use prior to reading in from a stream
|
||||
nsPersistentFileDescriptor(const nsPersistentFileDescriptor& inPath);
|
||||
virtual ~nsPersistentFileDescriptor();
|
||||
void operator = (const nsPersistentFileDescriptor& inPath);
|
||||
|
||||
// Conversions
|
||||
nsPersistentFileDescriptor(const nsFileSpec& inPath);
|
||||
void operator = (const nsFileSpec& inPath);
|
||||
|
||||
friend NS_BASE nsInputStream& operator >> (nsInputStream&, nsPersistentFileDescriptor&);
|
||||
// reads the data from a file
|
||||
friend NS_BASE nsOutputStream& operator << (nsOutputStream&, const nsPersistentFileDescriptor&);
|
||||
// writes the data to a file
|
||||
friend class nsFileSpec;
|
||||
|
||||
private:
|
||||
// Here are the ways to get data in and out of a file.
|
||||
void GetData(void*& outData, PRInt32& outSize) const;
|
||||
// DON'T FREE the returned data!
|
||||
void SetData(const void* inData, PRInt32 inSize);
|
||||
|
||||
private:
|
||||
|
||||
char* mDescriptorString;
|
||||
|
||||
}; // class nsPersistentFileDescriptor
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsDirectoryIterator
|
||||
// Example:
|
||||
//
|
||||
// nsFileSpec parentDir(...); // directory over whose children we shall iterate
|
||||
// nsNativeFileSpec parentDir(...); // directory over whose children we shall iterate
|
||||
// for (nsDirectoryIterator i(parentDir); i; i++)
|
||||
// {
|
||||
// // do something with (const nsFileSpec&)i
|
||||
// // do something with (const nsNativeFileSpec&)i
|
||||
// }
|
||||
//
|
||||
// or:
|
||||
//
|
||||
// for (nsDirectoryIterator i(parentDir, PR_FALSE); i; i--)
|
||||
// for (nsDirectoryIterator i(parentDir, false); i; i--)
|
||||
// {
|
||||
// // do something with (const nsFileSpec&)i
|
||||
// // do something with (const nsNativeFileSpec&)i
|
||||
// }
|
||||
//
|
||||
// Currently, the only platform on which backwards iteration actually goes backwards
|
||||
@@ -448,21 +378,21 @@ class NS_BASE nsDirectoryIterator
|
||||
{
|
||||
public:
|
||||
nsDirectoryIterator(
|
||||
const nsFileSpec& parent,
|
||||
const nsNativeFileSpec& parent,
|
||||
int iterateDirection = +1);
|
||||
#ifndef XP_MAC
|
||||
// Macintosh currently doesn't allocate, so needn't clean up.
|
||||
virtual ~nsDirectoryIterator();
|
||||
#endif
|
||||
PRBool Exists() const { return mExists; }
|
||||
operator bool() const { return mExists; }
|
||||
nsDirectoryIterator& operator ++(); // moves to the next item, if any.
|
||||
nsDirectoryIterator& operator ++(int) { return ++(*this); } // post-increment.
|
||||
nsDirectoryIterator& operator --(); // moves to the previous item, if any.
|
||||
nsDirectoryIterator& operator --(int) { return --(*this); } // post-decrement.
|
||||
operator nsFileSpec&() { return mCurrent; }
|
||||
operator nsNativeFileSpec&() { return mCurrent; }
|
||||
private:
|
||||
nsFileSpec mCurrent;
|
||||
bool mExists; // MUST be bool.
|
||||
nsNativeFileSpec mCurrent;
|
||||
bool mExists;
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
DIR* mDir;
|
||||
|
||||
@@ -19,31 +19,14 @@
|
||||
// First checked in on 98/11/20 by John R. McMullen in the wrong directory.
|
||||
// Checked in again 98/12/04.
|
||||
// Polished version 98/12/08.
|
||||
// Completely rewritten to integrate with nsIInputStream and nsIOutputStream (the
|
||||
// xpcom stream objects.
|
||||
|
||||
//========================================================================================
|
||||
//
|
||||
// Classes defined:
|
||||
//
|
||||
// nsInputStream, nsOutputStream
|
||||
// These are the lightweight STATICALLY LINKED wrappers for
|
||||
// the xpcom objects nsIInputStream and nsIOutputstream.
|
||||
// Possible uses:
|
||||
// If you are implementing a function that accepts one of these xpcom
|
||||
// streams, just make one of these little jobbies on the stack, and
|
||||
// the handy << or >> notation can be yours.
|
||||
//
|
||||
// nsInputFileStream, nsOutputFileStream
|
||||
// These are the STATICALLY LINKED versions of the file i/o streams,
|
||||
// which wrap the NSPR file i/o plus console i/o.
|
||||
// single-byte char:
|
||||
//
|
||||
// Related files:
|
||||
// prio.h the NSPR file i/o C API), which is wrapped by
|
||||
// THIS FILE statically linked C++ wrappers, which in turn are wrapped by
|
||||
// nsIFileStream.h COM wrappers for this file, which are wrapped by
|
||||
// nsAutoFileStream.h more easily used, nicer syntax wrappers for the
|
||||
// COMified ones. Wrapper of a wrapper of a wrapper.
|
||||
// nsInputFileStream, nsOutputFileStream
|
||||
//
|
||||
// This suite provide the following services:
|
||||
//
|
||||
@@ -58,13 +41,13 @@
|
||||
//
|
||||
// Basic example:
|
||||
//
|
||||
// nsFileSpec myPath("/Development/iotest.txt");
|
||||
// nsFilePath myPath("/Development/iotest.txt");
|
||||
//
|
||||
// nsOutputFileStream testStream(myPath);
|
||||
// testStream << "Hello World" << nsEndl;
|
||||
//
|
||||
// 4. Requires streams to be constructed using typesafe nsFileSpec specifier
|
||||
// (not the notorious and bug prone const char*), namely nsFileSpec. See
|
||||
// 4. Requires streams to be constructed using typesafe nsFilePath specifier
|
||||
// (not the notorious and bug prone const char*), namely nsFilePath. See
|
||||
// nsFileSpec.h for more details.
|
||||
//
|
||||
// 5. Fixes a bug that have been there for a long time, and
|
||||
@@ -90,13 +73,7 @@
|
||||
#else
|
||||
#include "prio.h"
|
||||
#endif
|
||||
|
||||
#include "nsIFileStream.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsFileSpec;
|
||||
class nsInputFileStream;
|
||||
class nsOutputFileStream;
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
//========================================================================================
|
||||
// Compiler-specific macros, as needed
|
||||
@@ -156,392 +133,200 @@ using std::ostream;
|
||||
//=========================== End Compiler-specific macros ===============================
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsInputStream
|
||||
// This is a convenience class, for use on the STACK ("new" junkies: get detoxed first).
|
||||
// Given a COM-style stream, this allows you to use the >> operators. It also acquires and
|
||||
// reference counts its stream.
|
||||
// Please read the comments at the top of this file
|
||||
class NS_BASE nsBasicFileStream
|
||||
//========================================================================================
|
||||
{
|
||||
public:
|
||||
nsInputStream(nsIInputStream* inStream)
|
||||
: mInputStream(do_QueryInterface(inStream))
|
||||
, mEOF(PR_FALSE)
|
||||
{}
|
||||
virtual ~nsInputStream();
|
||||
|
||||
nsCOMPtr<nsIInputStream> GetIStream() const
|
||||
{
|
||||
return mInputStream;
|
||||
}
|
||||
char eof() const { return mEOF; }
|
||||
char get();
|
||||
PRInt32 read(void* s, PRInt32 n)
|
||||
{
|
||||
if (!mInputStream)
|
||||
return 0;
|
||||
PRInt32 result = 0;
|
||||
mInputStream->Read((char*)s, 0, n, (PRUint32*)&result);
|
||||
if (result < n)
|
||||
mEOF = PR_TRUE;
|
||||
return result;
|
||||
}
|
||||
nsBasicFileStream();
|
||||
nsBasicFileStream(PRFileDesc* desc, int nsprMode);
|
||||
nsBasicFileStream(
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode);
|
||||
virtual ~nsBasicFileStream();
|
||||
|
||||
// Input streamers. Add more as needed (int&, unsigned int& etc). (but you have to
|
||||
// add delegators to the derived classes, too, because these operators don't inherit).
|
||||
nsInputStream& operator >> (char& ch);
|
||||
|
||||
// Support manipulators
|
||||
nsInputStream& operator >> (nsInputStream& (*pf)(nsInputStream&))
|
||||
inline PRBool is_open() const { return mFileDesc != 0; }
|
||||
void open(
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode);
|
||||
void close();
|
||||
PRIntn tell() const;
|
||||
void seek(PRInt32 offset) { seek(PR_SEEK_SET, offset); }
|
||||
void seek(PRSeekWhence whence, PRInt32 offset);
|
||||
PRBool eof() const { return mEOF; }
|
||||
PRBool failed() const { return mFailed; }
|
||||
// call PR_GetError() for details
|
||||
protected:
|
||||
|
||||
PRFileDesc* GetFileDescriptor() const { return mFileDesc; }
|
||||
|
||||
protected:
|
||||
|
||||
friend class nsBasicInStream;
|
||||
friend class nsBasicOutStream;
|
||||
|
||||
PRFileDesc* mFileDesc;
|
||||
int mNSPRMode;
|
||||
PRBool mFailed;
|
||||
PRBool mEOF;
|
||||
}; // class nsBasicFileStream
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsBasicInStream
|
||||
//========================================================================================
|
||||
{
|
||||
protected:
|
||||
nsBasicInStream(nsBasicFileStream& inStream, istream* stream);
|
||||
|
||||
public:
|
||||
|
||||
nsBasicInStream& operator >> (nsBasicInStream& (*pf)(nsBasicInStream&))
|
||||
{
|
||||
return pf(*this);
|
||||
}
|
||||
private:
|
||||
}
|
||||
void get(char& c);
|
||||
PRInt32 read(void* s, PRInt32 n);
|
||||
PRBool readline(char* s, PRInt32 n);
|
||||
// Result always null-terminated
|
||||
// false result indicates line was truncated
|
||||
// to fit buffer, or an error occurred.
|
||||
|
||||
nsInputStream& operator >> (char* buf); // TOO DANGEROUS. DON'T DEFINE.
|
||||
// Input streamers. Add more as needed
|
||||
nsBasicInStream& operator >> (char& ch);
|
||||
|
||||
istream* GetStandardStream() const { return mStdStream; }
|
||||
|
||||
// DATA
|
||||
protected:
|
||||
nsCOMPtr<nsIInputStream> mInputStream;
|
||||
PRBool mEOF;
|
||||
}; // class nsInputStream
|
||||
|
||||
typedef nsInputStream nsBasicInStream; // historic support for this name
|
||||
nsBasicFileStream& mBase;
|
||||
istream* mStdStream;
|
||||
}; // class nsBasicInStream
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsOutputStream
|
||||
// This is a convenience class, for use on the STACK ("new" junkies, get detoxed first).
|
||||
// Given a COM-style stream, this allows you to use the << operators. It also acquires and
|
||||
// reference counts its stream.
|
||||
// Please read the comments at the top of this file
|
||||
class NS_BASE nsBasicOutStream
|
||||
//========================================================================================
|
||||
{
|
||||
protected:
|
||||
|
||||
nsBasicOutStream(nsBasicFileStream& inStream, ostream* stream);
|
||||
|
||||
public:
|
||||
nsOutputStream() {}
|
||||
nsOutputStream(nsIOutputStream* inStream)
|
||||
: mOutputStream(do_QueryInterface(inStream))
|
||||
{}
|
||||
|
||||
virtual ~nsOutputStream();
|
||||
|
||||
nsCOMPtr<nsIOutputStream> GetIStream() const
|
||||
nsBasicOutStream& operator << (nsBasicOutStream& (*pf)(nsBasicOutStream&))
|
||||
{
|
||||
return mOutputStream;
|
||||
return pf(*this);
|
||||
}
|
||||
void put(char c);
|
||||
PRInt32 write(const void* s, PRInt32 n)
|
||||
{
|
||||
if (!mOutputStream)
|
||||
return 0;
|
||||
PRInt32 result = 0;
|
||||
mOutputStream->Write((char*)s, 0, n, (PRUint32*)&result);
|
||||
return result;
|
||||
}
|
||||
virtual void flush();
|
||||
|
||||
// Output streamers. Add more as needed (but you have to add delegators to the derived
|
||||
// classes, too, because these operators don't inherit).
|
||||
nsOutputStream& operator << (const char* buf);
|
||||
nsOutputStream& operator << (char ch);
|
||||
nsOutputStream& operator << (short val);
|
||||
nsOutputStream& operator << (unsigned short val);
|
||||
nsOutputStream& operator << (long val);
|
||||
nsOutputStream& operator << (unsigned long val);
|
||||
|
||||
// Support manipulators
|
||||
nsOutputStream& operator << (nsOutputStream& (*pf)(nsOutputStream&))
|
||||
{
|
||||
return pf(*this);
|
||||
}
|
||||
|
||||
// DATA
|
||||
protected:
|
||||
nsCOMPtr<nsIOutputStream> mOutputStream;
|
||||
}; // class nsOutputStream
|
||||
|
||||
typedef nsOutputStream nsBasicOutStream; // Historic support for this name
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsFileClient
|
||||
// Because COM does not allow us to write functions which return a boolean value etc,
|
||||
// this class is here to take care of the tedious "declare variable then call with
|
||||
// the address of the variable" chores.
|
||||
//========================================================================================
|
||||
{
|
||||
public:
|
||||
nsFileClient() // for delayed opening
|
||||
: mResult(NS_OK)
|
||||
{
|
||||
}
|
||||
nsFileClient(const nsCOMPtr<nsIFile>& inFile)
|
||||
: mFile(do_QueryInterface(inFile))
|
||||
, mResult(NS_OK)
|
||||
{
|
||||
}
|
||||
PRInt32 write(const void* s, PRInt32 n);
|
||||
void flush();
|
||||
|
||||
PRBool is_file() const
|
||||
{
|
||||
return mFile ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
void open(
|
||||
const nsFileSpec& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode)
|
||||
{
|
||||
if (mFile)
|
||||
mResult = mFile->Open(inFile, nsprMode, accessMode);
|
||||
}
|
||||
PRBool is_open() const
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
if (mFile)
|
||||
mFile->GetIsOpen(&result);
|
||||
return result;
|
||||
}
|
||||
PRBool failed() const
|
||||
{
|
||||
return NS_FAILED(mResult);
|
||||
}
|
||||
void seek(PRInt32 offset)
|
||||
{
|
||||
seek(PR_SEEK_SET, offset);
|
||||
}
|
||||
// Output streamers. Add more as needed
|
||||
nsBasicOutStream& operator << (const char* buf);
|
||||
nsBasicOutStream& operator << (char ch);
|
||||
nsBasicOutStream& operator << (short val);
|
||||
nsBasicOutStream& operator << (unsigned short val);
|
||||
nsBasicOutStream& operator << (long val);
|
||||
nsBasicOutStream& operator << (unsigned long val);
|
||||
|
||||
ostream* GetStandardStream() const { return mStdStream; }
|
||||
|
||||
void seek(PRSeekWhence whence, PRInt32 offset)
|
||||
{
|
||||
if (mFile)
|
||||
mResult = mFile->Seek(whence, offset);
|
||||
}
|
||||
PRIntn tell()
|
||||
{
|
||||
PRIntn result = -1;
|
||||
if (mFile)
|
||||
mResult = mFile->Tell(&result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// DATA
|
||||
protected:
|
||||
nsCOMPtr<nsIFile> mFile;
|
||||
PRBool mResult;
|
||||
}; // class nsFileClient
|
||||
|
||||
nsBasicFileStream& mBase;
|
||||
ostream* mStdStream;
|
||||
}; // class nsBasicOutStream
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsInputFileStream
|
||||
// Please read the comments at the top of this file
|
||||
//========================================================================================
|
||||
: public nsInputStream
|
||||
, public nsFileClient
|
||||
: public nsBasicFileStream
|
||||
, public nsBasicInStream
|
||||
{
|
||||
public:
|
||||
enum { kDefaultMode = PR_RDONLY };
|
||||
nsInputFileStream(nsIInputStream* inStream)
|
||||
: nsInputStream(inStream)
|
||||
, nsFileClient(do_QueryInterface(inStream))
|
||||
, mFileInputStream(do_QueryInterface(inStream))
|
||||
{
|
||||
}
|
||||
nsInputFileStream(istream* stream = CONSOLE_IN);
|
||||
nsInputFileStream(
|
||||
const nsFileSpec& inFile,
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode = kDefaultMode,
|
||||
PRIntn accessMode = 00700) // <- OCTAL
|
||||
: nsInputStream(nsnull)
|
||||
{
|
||||
nsISupports* stream;
|
||||
NS_NewIOFileStream(
|
||||
&stream,
|
||||
inFile, nsprMode, accessMode);
|
||||
mFile = nsQueryInterface(stream);
|
||||
mInputStream = nsQueryInterface(stream);
|
||||
mFileInputStream = nsQueryInterface(stream);
|
||||
}
|
||||
: nsBasicFileStream(inFile, nsprMode, accessMode)
|
||||
, nsBasicInStream(*this, 0)
|
||||
{}
|
||||
|
||||
PRBool readline(char* s, PRInt32 n);
|
||||
// Result always null-terminated.
|
||||
// Check eof() before each call.
|
||||
// CAUTION: false result only indicates line was truncated
|
||||
// to fit buffer, or an error occurred (OTHER THAN eof).
|
||||
|
||||
void Open(
|
||||
const nsFileSpec& inFile,
|
||||
void open(
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode = kDefaultMode,
|
||||
PRIntn accessMode = 00700) // <- OCTAL
|
||||
{
|
||||
if (mFile)
|
||||
mFile->Open(inFile, nsprMode, accessMode);
|
||||
nsBasicFileStream::open(inFile, nsprMode, accessMode);
|
||||
}
|
||||
private:
|
||||
|
||||
// Input streamers. Unfortunately, they don't inherit!
|
||||
nsInputStream& operator >> (char& ch)
|
||||
{ return nsInputStream::operator >>(ch); }
|
||||
nsInputStream& operator >> (nsInputStream& (*pf)(nsInputStream&))
|
||||
{ return nsInputStream::operator >>(pf); }
|
||||
nsInputFileStream& operator >> (char* buf); // TOO DANGEROUS. DON'T DEFINE.
|
||||
|
||||
// DATA
|
||||
protected:
|
||||
nsCOMPtr<nsIFileInputStream> mFileInputStream;
|
||||
}; // class nsInputFileStream
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsOutputFileStream
|
||||
// Please read the comments at the top of this file
|
||||
//========================================================================================
|
||||
: public nsOutputStream
|
||||
, public nsFileClient
|
||||
: public nsBasicFileStream
|
||||
, public nsBasicOutStream
|
||||
{
|
||||
public:
|
||||
enum { kDefaultMode = (PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE) };
|
||||
|
||||
nsOutputFileStream() {}
|
||||
nsOutputFileStream(nsIOutputStream* inStream)
|
||||
: nsOutputStream(inStream)
|
||||
, nsFileClient(do_QueryInterface(inStream))
|
||||
, mFileOutputStream(do_QueryInterface(inStream))
|
||||
{
|
||||
}
|
||||
nsOutputFileStream(ostream* stream = CONSOLE_OUT);
|
||||
nsOutputFileStream(
|
||||
const nsFileSpec& inFile,
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode = kDefaultMode,
|
||||
PRIntn accessMode = 00700) // <- OCTAL
|
||||
: nsOutputStream(nsnull)
|
||||
{
|
||||
nsISupports* stream;
|
||||
if (NS_FAILED(NS_NewIOFileStream(
|
||||
&stream,
|
||||
inFile, nsprMode, accessMode)))
|
||||
return;
|
||||
mFile = nsQueryInterface(stream);
|
||||
mOutputStream = nsQueryInterface(stream);
|
||||
mFileOutputStream = nsQueryInterface(stream);
|
||||
}
|
||||
: nsBasicFileStream(inFile, nsprMode, accessMode)
|
||||
, nsBasicOutStream(*this, 0)
|
||||
{}
|
||||
|
||||
virtual void flush();
|
||||
|
||||
// Output streamers. Unfortunately, they don't inherit!
|
||||
nsOutputStream& operator << (const char* buf)
|
||||
{ return nsOutputStream::operator << (buf); }
|
||||
nsOutputStream& operator << (char ch)
|
||||
{ return nsOutputStream::operator << (ch); }
|
||||
nsOutputStream& operator << (short val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (unsigned short val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (long val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (unsigned long val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (nsOutputStream& (*pf)(nsOutputStream&))
|
||||
{ return nsOutputStream::operator << (pf); }
|
||||
|
||||
// DATA
|
||||
protected:
|
||||
nsCOMPtr<nsIFileOutputStream> mFileOutputStream;
|
||||
inline void open(
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode = kDefaultMode,
|
||||
PRIntn accessMode = 00700) // <- OCTAL
|
||||
{
|
||||
nsBasicFileStream::open(inFile, nsprMode, accessMode);
|
||||
}
|
||||
}; // class nsOutputFileStream
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsOutputConsoleStream
|
||||
// Please read the comments at the top of this file
|
||||
//========================================================================================
|
||||
: public nsOutputFileStream
|
||||
{
|
||||
public:
|
||||
|
||||
nsOutputConsoleStream()
|
||||
{
|
||||
nsISupports* stream;
|
||||
if (NS_FAILED(NS_NewOutputConsoleStream(&stream)))
|
||||
return;
|
||||
mFile = nsQueryInterface(stream);
|
||||
mOutputStream = nsQueryInterface(stream);
|
||||
mFileOutputStream = nsQueryInterface(stream);
|
||||
}
|
||||
|
||||
// Output streamers. Unfortunately, they don't inherit!
|
||||
nsOutputStream& operator << (const char* buf)
|
||||
{ return nsOutputStream::operator << (buf); }
|
||||
nsOutputStream& operator << (char ch)
|
||||
{ return nsOutputStream::operator << (ch); }
|
||||
nsOutputStream& operator << (short val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (unsigned short val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (long val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (unsigned long val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (nsOutputStream& (*pf)(nsOutputStream&))
|
||||
{ return nsOutputStream::operator << (pf); }
|
||||
|
||||
}; // class nsOutputConsoleStream
|
||||
|
||||
//========================================================================================
|
||||
class NS_BASE nsIOFileStream
|
||||
// Please read the comments at the top of this file
|
||||
//========================================================================================
|
||||
: public nsInputFileStream
|
||||
, public nsOutputStream
|
||||
: public nsBasicFileStream
|
||||
, public nsBasicOutStream
|
||||
, public nsBasicInStream
|
||||
{
|
||||
public:
|
||||
enum { kDefaultMode = (PR_RDWR | PR_CREATE_FILE) };
|
||||
|
||||
nsIOFileStream(
|
||||
nsIInputStream* inInputStream
|
||||
, nsIOutputStream* inOutputStream)
|
||||
: nsInputFileStream(inInputStream)
|
||||
, nsOutputStream(inOutputStream)
|
||||
, mFileOutputStream(do_QueryInterface(inOutputStream))
|
||||
{
|
||||
}
|
||||
nsIOFileStream(
|
||||
const nsFileSpec& inFile,
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode = kDefaultMode,
|
||||
PRIntn accessMode = 00700) // <- OCTAL
|
||||
: nsInputFileStream(nsnull)
|
||||
, nsOutputStream(nsnull)
|
||||
: nsBasicFileStream(inFile, nsprMode, accessMode)
|
||||
, nsBasicInStream(*this, 0)
|
||||
, nsBasicOutStream(*this, 0)
|
||||
{}
|
||||
|
||||
inline void open(
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode = kDefaultMode,
|
||||
PRIntn accessMode = 00700) // <- OCTAL
|
||||
{
|
||||
nsISupports* stream;
|
||||
if (NS_FAILED(NS_NewIOFileStream(
|
||||
&stream,
|
||||
inFile, nsprMode, accessMode)))
|
||||
return;
|
||||
mFile = nsQueryInterface(stream);
|
||||
mInputStream = nsQueryInterface(stream);
|
||||
mOutputStream = nsQueryInterface(stream);
|
||||
mFileInputStream = nsQueryInterface(stream);
|
||||
mFileOutputStream = nsQueryInterface(stream);
|
||||
nsBasicFileStream::open(inFile, nsprMode, accessMode);
|
||||
}
|
||||
|
||||
// Output streamers. Unfortunately, they don't inherit!
|
||||
nsOutputStream& operator << (const char* buf)
|
||||
{ return nsOutputStream::operator << (buf); }
|
||||
nsOutputStream& operator << (char ch)
|
||||
{ return nsOutputStream::operator << (ch); }
|
||||
nsOutputStream& operator << (short val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (unsigned short val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (long val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (unsigned long val)
|
||||
{ return nsOutputStream::operator << (val); }
|
||||
nsOutputStream& operator << (nsOutputStream& (*pf)(nsOutputStream&))
|
||||
{ return nsOutputStream::operator << (pf); }
|
||||
|
||||
// Input streamers. Unfortunately, they don't inherit!
|
||||
nsInputStream& operator >> (char& ch)
|
||||
{ return nsInputStream::operator >>(ch); }
|
||||
nsInputStream& operator >> (nsInputStream& (*pf)(nsInputStream&))
|
||||
{ return nsInputStream::operator >>(pf); }
|
||||
// DATA
|
||||
protected:
|
||||
nsCOMPtr<nsIFileOutputStream> mFileOutputStream;
|
||||
}; // class nsIOFileStream
|
||||
|
||||
|
||||
//========================================================================================
|
||||
// Manipulators
|
||||
//========================================================================================
|
||||
|
||||
NS_BASE nsOutputStream& nsEndl(nsOutputStream& os); // outputs and FLUSHES.
|
||||
|
||||
NS_BASE nsBasicOutStream& nsEndl(nsBasicOutStream& os);
|
||||
|
||||
|
||||
#endif /* _FILESTREAM_H_ */
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef nsIFileStream_h___
|
||||
#define nsIFileStream_h___
|
||||
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "prio.h"
|
||||
|
||||
class nsFileSpec;
|
||||
|
||||
/* a6cf90e8-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_IFILE_IID \
|
||||
{ 0xa6cf90e8, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
//========================================================================================
|
||||
class nsIFile
|
||||
// Represents a file, and supports Open, Tell etc.
|
||||
//========================================================================================
|
||||
: public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IFILE_IID; return iid; }
|
||||
NS_IMETHOD Open(
|
||||
const nsFileSpec& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode) = 0;
|
||||
// Note: Open() is only needed after
|
||||
// an explicit Close(). All file streams
|
||||
// are automatically opened on construction.
|
||||
NS_IMETHOD Seek(PRSeekWhence whence, PRInt32 offset) = 0;
|
||||
NS_IMETHOD GetIsOpen(PRBool* outOpen) = 0;
|
||||
NS_IMETHOD Tell(PRIntn* outWhere) = 0;
|
||||
}; // class nsIFile
|
||||
|
||||
/* a6cf90e6-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_IFILEINPUTSTREAM_IID \
|
||||
{ 0xa6cf90e6, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
//========================================================================================
|
||||
class nsIFileInputStream
|
||||
// These are additional file-specific methods that files have, above what
|
||||
// nsIInputStream supports. The current implementation supports both
|
||||
// interfaces.
|
||||
//========================================================================================
|
||||
: public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IFILEINPUTSTREAM_IID; return iid; }
|
||||
}; // class nsIFileInputStream
|
||||
|
||||
/* a6cf90e7-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_IFILEOUTPUTSTREAM_IID \
|
||||
{ 0xa6cf90e7, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
//========================================================================================
|
||||
class nsIFileOutputStream
|
||||
// These are additional file-specific methods that files have, above what
|
||||
// nsIOutputStream supports. The current implementation supports both
|
||||
// interfaces.
|
||||
//========================================================================================
|
||||
: public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IFILEOUTPUTSTREAM_IID; return iid; }
|
||||
NS_IMETHOD Flush() = 0;
|
||||
// Forces a write to disk.
|
||||
}; // class nsIFileOutputStream
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE nsresult NS_NewTypicalInputFileStream(
|
||||
nsISupports** aStreamResult,
|
||||
const nsFileSpec& inFile
|
||||
/*Default nsprMode == PR_RDONLY*/
|
||||
/*Default accessmode = 0700 (octal)*/);
|
||||
// Factory method to get an nsInputStream from a file, using most common options
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
extern "C" NS_BASE nsresult NS_NewOutputConsoleStream(
|
||||
nsISupports** aStreamResult);
|
||||
// Factory method to get an nsOutputStream to the console.
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
extern "C" NS_BASE nsresult NS_NewTypicalOutputFileStream(
|
||||
nsISupports** aStreamResult, // will implement all the above interfaces
|
||||
const nsFileSpec& inFile
|
||||
/*default nsprMode= (PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE)*/
|
||||
/*Default accessMode= 0700 (octal)*/);
|
||||
// Factory method to get an nsOutputStream to a file - most common case.
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
extern "C" NS_BASE nsresult NS_NewTypicalIOFileStream(
|
||||
nsISupports** aStreamResult, // will implement all the above interfaces
|
||||
const nsFileSpec& inFile
|
||||
/*default nsprMode = (PR_RDWR | PR_CREATE_FILE)*/
|
||||
/*Default accessMode = 0700 (octal)*/);
|
||||
// Factory method to get an object that implements both nsIInputStream
|
||||
// and nsIOutputStream, associated with a single file.
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
extern "C" NS_BASE nsresult NS_NewIOFileStream(
|
||||
nsISupports** aStreamResult, // will implement all the above interfaces
|
||||
const nsFileSpec& inFile,
|
||||
PRInt32 nsprMode,
|
||||
PRInt32 accessMode);
|
||||
// Factory method to get an object that implements both nsIInputStream
|
||||
// and nsIOutputStream, associated with a single file.
|
||||
|
||||
#endif /* nsIFileStream_h___ */
|
||||
@@ -19,11 +19,9 @@
|
||||
#ifndef nsRepeater_h___
|
||||
#define nsRepeater_h___
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
class EventRecord;
|
||||
|
||||
class NS_BASE Repeater {
|
||||
class Repeater {
|
||||
public:
|
||||
|
||||
Repeater();
|
||||
|
||||
@@ -31,7 +31,6 @@ LIBRARY_NAME = raptorbase
|
||||
CPPSRCS = \
|
||||
nsArena.cpp \
|
||||
nsAtomTable.cpp \
|
||||
nsBaseDLL.cpp \
|
||||
nsBTree.cpp \
|
||||
nsByteBuffer.cpp \
|
||||
nsCRT.cpp \
|
||||
@@ -39,8 +38,6 @@ CPPSRCS = \
|
||||
nsEscape.cpp \
|
||||
nsFileSpec.cpp \
|
||||
nsFileStream.cpp \
|
||||
nsIFileStream.cpp \
|
||||
nsProperties.cpp \
|
||||
nsRBTree.cpp \
|
||||
nsSizeOfHandler.cpp \
|
||||
nsString.cpp \
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <Folders.h>
|
||||
#include <Errors.h>
|
||||
#include <TextUtils.h>
|
||||
#include <Processes.h>
|
||||
|
||||
const unsigned char* kAliasHavenFolderName = "\pnsAliasHaven";
|
||||
|
||||
@@ -75,7 +74,7 @@ namespace MacFileHelpers
|
||||
// to support attaching of aliases in mail.
|
||||
void EnsureAliasHaven();
|
||||
void SetNoResolve(Boolean inResolve);
|
||||
PRBool IsAliasSafe(const FSSpec& inSpec);
|
||||
bool IsAliasSafe(const FSSpec& inSpec);
|
||||
OSErr MakeAliasSafe(FSSpec& inOutSpec);
|
||||
OSErr ResolveAliasFile(FSSpec& inOutSpec, Boolean& wasAliased);
|
||||
|
||||
@@ -132,8 +131,8 @@ char* MacFileHelpers::EncodeMacPath(
|
||||
// Method: Swap ':' and '/', hex escape the result
|
||||
//-----------------------------------
|
||||
{
|
||||
if (inPath == nsnull)
|
||||
return nsnull;
|
||||
if (inPath == NULL)
|
||||
return NULL;
|
||||
int pathSize = strlen(inPath);
|
||||
|
||||
// XP code sometimes chokes if there's a final slash in the unix path.
|
||||
@@ -146,8 +145,8 @@ char* MacFileHelpers::EncodeMacPath(
|
||||
pathSize--;
|
||||
}
|
||||
|
||||
char * newPath = nsnull;
|
||||
char * finalPath = nsnull;
|
||||
char * newPath = NULL;
|
||||
char * finalPath = NULL;
|
||||
|
||||
if (prependSlash)
|
||||
{
|
||||
@@ -189,10 +188,10 @@ OSErr MacFileHelpers::MakeAliasSafe(FSSpec& inOutSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
EnsureAliasHaven();
|
||||
nsFileSpec dstDirSpec(sAliasHavenVRefNum, sAliasHavenDirID, "\p");
|
||||
nsNativeFileSpec dstDirSpec(sAliasHavenVRefNum, sAliasHavenDirID, "\p");
|
||||
|
||||
// Make sure its name is unique
|
||||
nsFileSpec havenSpec(sAliasHavenVRefNum, sAliasHavenDirID, "\pG'day");
|
||||
nsNativeFileSpec havenSpec(sAliasHavenVRefNum, sAliasHavenDirID, "\pG'day");
|
||||
if (havenSpec.Valid())
|
||||
havenSpec.MakeUnique(inOutSpec.name);
|
||||
// Copy the file into the haven directory
|
||||
@@ -222,9 +221,9 @@ char* MacFileHelpers::MacPathFromUnixPath(const char* unixPath)
|
||||
{
|
||||
char* dst = result;
|
||||
const char* src = unixPath;
|
||||
if (*src == '/') // * full path
|
||||
if (*src == '/') // ¥ full path
|
||||
src++;
|
||||
else if (strchr(src, '/')) // * partial path, and not just a leaf name
|
||||
else if (strchr(src, '/')) // ¥ partial path, and not just a leaf name
|
||||
*dst++ = ':';
|
||||
strcpy(dst, src);
|
||||
nsUnescape(dst); // Hex Decode
|
||||
@@ -347,7 +346,7 @@ void MacFileHelpers::EnsureAliasHaven()
|
||||
} // MacFileHelpers::EnsureAliasHaven
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool MacFileHelpers::IsAliasSafe(const FSSpec& inSpec)
|
||||
bool MacFileHelpers::IsAliasSafe(const FSSpec& inSpec)
|
||||
// Returns true if the alias is in the alias haven directory, or if alias resolution
|
||||
// has been turned off.
|
||||
//----------------------------------------------------------------------------------------
|
||||
@@ -380,7 +379,7 @@ OSErr MacFileHelpers::FSSpecFromFullUnixPath(
|
||||
// then it is combined with inOutSpec's vRefNum and parID to form a new spec.
|
||||
//-----------------------------------
|
||||
{
|
||||
if (unixPath == nsnull)
|
||||
if (unixPath == NULL)
|
||||
return badFidErr;
|
||||
char* macPath = MacPathFromUnixPath(unixPath);
|
||||
if (!macPath)
|
||||
@@ -414,7 +413,7 @@ char* MacFileHelpers::PathNameFromFSSpec( const FSSpec& inSpec, Boolean wantLeaf
|
||||
OSErr err = noErr;
|
||||
|
||||
short fullPathLength = 0;
|
||||
Handle fullPath = nsnull;
|
||||
Handle fullPath = NULL;
|
||||
|
||||
FSSpec tempSpec = inSpec;
|
||||
if ( tempSpec.parID == fsRtParID )
|
||||
@@ -472,7 +471,7 @@ char* MacFileHelpers::PathNameFromFSSpec( const FSSpec& inSpec, Boolean wantLeaf
|
||||
tempSpec.name[tempSpec.name[0]] = ':';
|
||||
|
||||
/* Add directory name to beginning of fullPath */
|
||||
(void) Munger(fullPath, 0, nsnull, 0, &tempSpec.name[1], tempSpec.name[0]);
|
||||
(void) Munger(fullPath, 0, NULL, 0, &tempSpec.name[1], tempSpec.name[0]);
|
||||
err = MemError();
|
||||
}
|
||||
} while ( err == noErr && pb.dirInfo.ioDrDirID != fsRtDirID );
|
||||
@@ -501,19 +500,19 @@ Clean:
|
||||
} // MacFileHelpers::PathNameFromFSSpec
|
||||
|
||||
//========================================================================================
|
||||
// Macintosh nsFileSpec implementation
|
||||
// Macintosh nsNativeFileSpec implementation
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec()
|
||||
nsNativeFileSpec::nsNativeFileSpec()
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mError(NS_OK)
|
||||
: mError(noErr)
|
||||
{
|
||||
mSpec.name[0] = '\0';
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const nsFileSpec& inSpec)
|
||||
nsNativeFileSpec::nsNativeFileSpec(const nsNativeFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mSpec(inSpec.mSpec)
|
||||
, mError(inSpec.Error())
|
||||
@@ -521,90 +520,87 @@ nsFileSpec::nsFileSpec(const nsFileSpec& inSpec)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const char* inString, PRBool inCreateDirs)
|
||||
nsNativeFileSpec::nsNativeFileSpec(const char* inString, bool inCreateDirs)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mError = NS_FILE_RESULT(MacFileHelpers::FSSpecFromFullUnixPath(
|
||||
inString, mSpec, false, true, inCreateDirs));
|
||||
mError = MacFileHelpers::FSSpecFromFullUnixPath(
|
||||
inString, mSpec, true, true, inCreateDirs);
|
||||
// allow a partial path, create as necessary
|
||||
if (mError == NS_FILE_RESULT(fnfErr))
|
||||
mError = NS_OK;
|
||||
} // nsFileSpec::nsFileSpec
|
||||
if (mError == fnfErr)
|
||||
mError = noErr;
|
||||
} // nsNativeFileSpec::nsNativeFileSpec
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(
|
||||
nsNativeFileSpec::nsNativeFileSpec(
|
||||
short vRefNum,
|
||||
long parID,
|
||||
ConstStr255Param name)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mError = NS_FILE_RESULT(::FSMakeFSSpec(vRefNum, parID, name, &mSpec));
|
||||
if (mError == NS_FILE_RESULT(fnfErr))
|
||||
mError = ::FSMakeFSSpec(vRefNum, parID, name, &mSpec);
|
||||
if (mError == fnfErr)
|
||||
mError = noErr;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const nsFilePath& inPath)
|
||||
nsNativeFileSpec::nsNativeFileSpec(const nsFilePath& inPath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
*this = inPath.GetFileSpec();
|
||||
*this = inPath.GetNativeSpec();
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& operator << (nsOutputStream& s, const nsFileSpec& spec)
|
||||
nsBasicOutStream& operator << (nsBasicOutStream& s, const nsNativeFileSpec& spec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
s << spec.mSpec.vRefNum << ", " << spec.mSpec.parID << ", \"";
|
||||
s.write((const char*)&spec.mSpec.name[1], spec.mSpec.name[0]);
|
||||
return s << "\"";
|
||||
} // nsOutputStream& operator << (nsOutputStream&, const nsFileSpec&)
|
||||
#endif
|
||||
} // nsOutputFileStream& operator << (nsOutputFileStream&, const nsNativeFileSpec&)
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const char* inString)
|
||||
void nsNativeFileSpec::operator = (const char* inString)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mError = NS_FILE_RESULT(MacFileHelpers::FSSpecFromFullUnixPath(inString, mSpec, false));
|
||||
} // nsFileSpec::operator =
|
||||
mError = MacFileHelpers::FSSpecFromFullUnixPath(inString, mSpec, true);
|
||||
} // nsNativeFileSpec::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const nsFileSpec& inSpec)
|
||||
void nsNativeFileSpec::operator = (const nsNativeFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mSpec = inSpec.mSpec;
|
||||
mError = inSpec.Error();
|
||||
} // nsFileSpec::operator =
|
||||
} // nsNativeFileSpec::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const nsFilePath& inPath)
|
||||
void nsNativeFileSpec::operator = (const nsFilePath& inPath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
*this = inPath.GetFileSpec();
|
||||
} // nsFileSpec::operator =
|
||||
*this = inPath.GetNativeSpec();
|
||||
} // nsNativeFileSpec::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::Exists() const
|
||||
bool nsNativeFileSpec::Exists() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
FSSpec temp;
|
||||
return ::FSMakeFSSpec(mSpec.vRefNum, mSpec.parID, mSpec.name, &temp) == noErr;
|
||||
} // nsFileSpec::operator =
|
||||
} // nsNativeFileSpec::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::SetLeafName(const char* inLeafName)
|
||||
void nsNativeFileSpec::SetLeafName(const char* inLeafName)
|
||||
// In leaf name can actually be a partial path...
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// what about long relative paths? Hmm?
|
||||
Str255 partialPath;
|
||||
MacFileHelpers::PLstrcpy(partialPath, inLeafName);
|
||||
mError = NS_FILE_RESULT(
|
||||
::FSMakeFSSpec(mSpec.vRefNum, mSpec.parID, partialPath, &mSpec));
|
||||
} // nsFileSpec::SetLeafName
|
||||
mError = FSMakeFSSpec(mSpec.vRefNum, mSpec.parID, partialPath, &mSpec);
|
||||
} // nsNativeFileSpec::SetLeafName
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
char* nsFileSpec::GetLeafName() const
|
||||
char* nsNativeFileSpec::GetLeafName() const
|
||||
// Result needs to be delete[]ed.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
@@ -612,206 +608,131 @@ char* nsFileSpec::GetLeafName() const
|
||||
memcpy(leaf, &mSpec.name[1], mSpec.name[0]);
|
||||
leaf[mSpec.name[0]] = '\0';
|
||||
return nsFileSpecHelpers::StringDup(leaf);
|
||||
} // nsFileSpec::GetLeafName
|
||||
} // nsNativeFileSpec::GetLeafName
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::MakeAliasSafe()
|
||||
void nsNativeFileSpec::MakeAliasSafe()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mError = NS_FILE_RESULT(MacFileHelpers::MakeAliasSafe(mSpec));
|
||||
} // nsFileSpec::MakeAliasSafe
|
||||
mError = MacFileHelpers::MakeAliasSafe(mSpec);
|
||||
} // nsNativeFileSpec::MakeAliasSafe
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::MakeUnique(ConstStr255Param inSuggestedLeafName)
|
||||
void nsNativeFileSpec::MakeUnique(ConstStr255Param inSuggestedLeafName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (inSuggestedLeafName[0] > 0)
|
||||
MacFileHelpers::PLstrcpy(mSpec.name, inSuggestedLeafName);
|
||||
|
||||
MakeUnique();
|
||||
} // nsFileSpec::MakeUnique
|
||||
} // nsNativeFileSpec::MakeUnique
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::ResolveAlias(PRBool& wasAliased)
|
||||
void nsNativeFileSpec::ResolveAlias(bool& wasAliased)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
Boolean wasAliased2;
|
||||
mError = NS_FILE_RESULT(MacFileHelpers::ResolveAliasFile(mSpec, wasAliased2));
|
||||
mError = MacFileHelpers::ResolveAliasFile(mSpec, wasAliased2);
|
||||
wasAliased = (wasAliased2 != false);
|
||||
} // nsFileSpec::ResolveAlias
|
||||
} // nsNativeFileSpec::ResolveAlias
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsFile() const
|
||||
bool nsNativeFileSpec::IsFile() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
long dirID;
|
||||
Boolean isDirectory;
|
||||
return (noErr == FSpGetDirectoryID(&mSpec, &dirID, &isDirectory) && !isDirectory);
|
||||
} // nsFileSpec::IsFile
|
||||
} // nsNativeFileSpec::IsFile
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsDirectory() const
|
||||
bool nsNativeFileSpec::IsDirectory() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
long dirID;
|
||||
Boolean isDirectory;
|
||||
return (noErr == FSpGetDirectoryID(&mSpec, &dirID, &isDirectory) && isDirectory);
|
||||
} // nsFileSpec::IsDirectory
|
||||
} // nsNativeFileSpec::IsDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
||||
void nsNativeFileSpec::GetParent(nsNativeFileSpec& outSpec) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (NS_SUCCEEDED(mError))
|
||||
outSpec.mError
|
||||
= NS_FILE_RESULT(::FSMakeFSSpec(mSpec.vRefNum, mSpec.parID, nsnull, outSpec));
|
||||
} // nsFileSpec::GetParent
|
||||
if (mError == noErr)
|
||||
outSpec.mError = FSMakeFSSpec(mSpec.vRefNum, mSpec.parID, NULL, outSpec);
|
||||
} // nsNativeFileSpec::GetParent
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator += (const char* inRelativePath)
|
||||
void nsNativeFileSpec::operator += (const char* inRelativePath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
long dirID;
|
||||
Boolean isDirectory;
|
||||
mError = NS_FILE_RESULT(::FSpGetDirectoryID(&mSpec, &dirID, &isDirectory));
|
||||
if (NS_SUCCEEDED(mError) && isDirectory)
|
||||
mError = FSpGetDirectoryID(&mSpec, &dirID, &isDirectory);
|
||||
if (mError == noErr && isDirectory)
|
||||
{
|
||||
Str255 partialPath;
|
||||
MacFileHelpers::PLstrcpy(partialPath, inRelativePath);
|
||||
mError = NS_FILE_RESULT(::FSMakeFSSpec(mSpec.vRefNum, dirID, partialPath, *this));
|
||||
//if (NS_SUCCEEDED(mError))
|
||||
// SetLeafName(inRelativePath);
|
||||
mError = FSMakeFSSpec(mSpec.vRefNum, dirID, "\pG'day", *this);
|
||||
if (mError == noErr)
|
||||
SetLeafName(inRelativePath);
|
||||
}
|
||||
} // nsFileSpec::operator +=
|
||||
} // nsNativeFileSpec::operator +=
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::CreateDirectory(int /* unix mode */)
|
||||
void nsNativeFileSpec::CreateDirectory(int /* unix mode */)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
long ignoredDirID;
|
||||
FSpDirCreate(&mSpec, smCurrentScript, &ignoredDirID);
|
||||
} // nsFileSpec::CreateDirectory
|
||||
} // nsNativeFileSpec::CreateDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::Delete(PRBool inRecursive)
|
||||
void nsNativeFileSpec::Delete(bool inRecursive)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (inRecursive)
|
||||
{
|
||||
// MoreFilesExtras
|
||||
mError = NS_FILE_RESULT(::DeleteDirectory(
|
||||
mError = DeleteDirectory(
|
||||
mSpec.vRefNum,
|
||||
mSpec.parID,
|
||||
const_cast<unsigned char*>(mSpec.name)));
|
||||
const_cast<unsigned char*>(mSpec.name));
|
||||
}
|
||||
else
|
||||
mError = NS_FILE_RESULT(FSpDelete(&mSpec));
|
||||
} // nsFileSpec::Delete
|
||||
mError = FSpDelete(&mSpec);
|
||||
} // nsNativeFileSpec::Delete
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Rename(const char* inNewName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (strchr(inNewName, '/'))
|
||||
return -1; // no relative paths here!
|
||||
Str255 pName;
|
||||
MacFileHelpers::PLstrcpy(pName, inNewName);
|
||||
if (FSpRename(&mSpec, pName) != noErr)
|
||||
return -1;
|
||||
SetLeafName(inNewName);
|
||||
return 0;
|
||||
} // nsFileSpec::Rename
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Copy(const nsFileSpec& newParentDir) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// We can only copy into a directory, and (for now) can not copy entire directories
|
||||
|
||||
if (!newParentDir.IsDirectory() || (IsDirectory() ) )
|
||||
return NS_FILE_FAILURE;
|
||||
|
||||
|
||||
nsresult result = NS_FILE_RESULT(::FSpFileCopy( &mSpec,
|
||||
&newParentDir.mSpec,
|
||||
const_cast<StringPtr>(GetLeafPName()),
|
||||
nsnull,
|
||||
0,
|
||||
true));
|
||||
|
||||
return result;
|
||||
|
||||
} // nsFileSpec::Copy
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Move(const nsFileSpec& newParentDir) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// We can only move into a directory
|
||||
|
||||
if (!newParentDir.IsDirectory())
|
||||
return NS_FILE_FAILURE;
|
||||
|
||||
nsresult result = NS_FILE_RESULT(::FSpMoveRenameCompat(&mSpec,
|
||||
&newParentDir.mSpec,
|
||||
const_cast<StringPtr>(GetLeafPName())));
|
||||
|
||||
return result;
|
||||
} // nsFileSpec::Move
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Execute(const char* /*args - how can this be cross-platform? problem! */ ) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (IsDirectory())
|
||||
return NS_FILE_FAILURE;
|
||||
|
||||
LaunchParamBlockRec launchThis;
|
||||
launchThis.launchAppSpec = const_cast<FSSpec*>(&mSpec);
|
||||
launchThis.launchAppParameters = nsnull; // args;
|
||||
/* launch the thing */
|
||||
launchThis.launchBlockID = extendedBlock;
|
||||
launchThis.launchEPBLength = extendedBlockLen;
|
||||
launchThis.launchFileFlags = nsnull;
|
||||
launchThis.launchControlFlags = launchContinue + launchNoFileFlags + launchUseMinimum;
|
||||
launchThis.launchControlFlags += launchDontSwitch;
|
||||
|
||||
nsresult result = NS_FILE_RESULT(::LaunchApplication(&launchThis));
|
||||
return result;
|
||||
|
||||
} // nsFileSpec::Execute
|
||||
|
||||
//========================================================================================
|
||||
// Macintosh nsFilePath implementation
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFilePath::nsFilePath(const char* inString, PRBool inCreateDirs)
|
||||
nsFilePath::nsFilePath(const char* inString, bool inCreateDirs)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(nsnull)
|
||||
, mFileSpec(inString, inCreateDirs)
|
||||
, mNativeFileSpec(inString, inCreateDirs)
|
||||
{
|
||||
// Make canonical and absolute.
|
||||
char * path = MacFileHelpers::PathNameFromFSSpec( mFileSpec, TRUE );
|
||||
char * path = MacFileHelpers::PathNameFromFSSpec( mNativeFileSpec, TRUE );
|
||||
mPath = MacFileHelpers::EncodeMacPath(path, true, true);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFilePath::nsFilePath(const nsFileSpec& inSpec)
|
||||
nsFilePath::nsFilePath(const nsNativeFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mFileSpec(inSpec)
|
||||
: mNativeFileSpec(inSpec)
|
||||
{
|
||||
char * path = MacFileHelpers::PathNameFromFSSpec( inSpec.mSpec, TRUE );
|
||||
mPath = MacFileHelpers::EncodeMacPath(path, true, true);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFilePath::operator = (const nsFileSpec& inSpec)
|
||||
void nsFilePath::operator = (const nsNativeFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
delete [] mPath;
|
||||
char * path = MacFileHelpers::PathNameFromFSSpec( inSpec.mSpec, TRUE );
|
||||
mPath = MacFileHelpers::EncodeMacPath(path, true, true);
|
||||
mFileSpec = inSpec;
|
||||
mNativeFileSpec = inSpec;
|
||||
} // nsFilePath::operator =
|
||||
|
||||
//========================================================================================
|
||||
@@ -819,14 +740,14 @@ void nsFilePath::operator = (const nsFileSpec& inSpec)
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileURL::nsFileURL(const char* inString, PRBool inCreateDirs)
|
||||
nsFileURL::nsFileURL(const char* inString, bool inCreateDirs)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mURL(nsnull)
|
||||
, mFileSpec(inString + kFileURLPrefixLength, inCreateDirs)
|
||||
, mNativeFileSpec(inString + kFileURLPrefixLength, inCreateDirs)
|
||||
{
|
||||
NS_ASSERTION(strstr(inString, kFileURLPrefix) == inString, "Not a URL!");
|
||||
// Make canonical and absolute.
|
||||
char* path = MacFileHelpers::PathNameFromFSSpec( mFileSpec, TRUE );
|
||||
char* path = MacFileHelpers::PathNameFromFSSpec( mNativeFileSpec, TRUE );
|
||||
char* escapedPath = MacFileHelpers::EncodeMacPath(path, true, true);
|
||||
mURL = nsFileSpecHelpers::StringDup(kFileURLPrefix, kFileURLPrefixLength + strlen(escapedPath));
|
||||
strcat(mURL, escapedPath);
|
||||
@@ -839,7 +760,7 @@ nsFileURL::nsFileURL(const char* inString, PRBool inCreateDirs)
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsDirectoryIterator::nsDirectoryIterator(
|
||||
const nsFileSpec& inDirectory
|
||||
const nsNativeFileSpec& inDirectory
|
||||
, int inIterateDirection)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mCurrent(inDirectory)
|
||||
@@ -849,7 +770,7 @@ nsDirectoryIterator::nsDirectoryIterator(
|
||||
CInfoPBRec pb;
|
||||
DirInfo* dipb = (DirInfo*)&pb;
|
||||
// Sorry about this, there seems to be a bug in CWPro 4:
|
||||
const FSSpec& inSpec = inDirectory.nsFileSpec::operator const FSSpec&();
|
||||
const FSSpec& inSpec = inDirectory.nsNativeFileSpec::operator const FSSpec&();
|
||||
Str255 outName;
|
||||
MacFileHelpers::PLstrcpy(outName, inSpec.name);
|
||||
pb.hFileInfo.ioNamePtr = outName;
|
||||
@@ -863,7 +784,7 @@ nsDirectoryIterator::nsDirectoryIterator(
|
||||
if ( (err != noErr ) || !( dipb->ioFlAttrib & 0x0010 ) )
|
||||
return;
|
||||
// Sorry about this, there seems to be a bug in CWPro 4:
|
||||
FSSpec& currentSpec = mCurrent.nsFileSpec::operator FSSpec&();
|
||||
FSSpec& currentSpec = mCurrent.nsNativeFileSpec::operator FSSpec&();
|
||||
currentSpec.vRefNum = inSpec.vRefNum;
|
||||
currentSpec.parID = dipb->ioDrDirID;
|
||||
mMaxIndex = pb.dirInfo.ioDrNmFls;
|
||||
@@ -886,10 +807,10 @@ OSErr nsDirectoryIterator::SetToIndex()
|
||||
CInfoPBRec cipb;
|
||||
DirInfo *dipb=(DirInfo *)&cipb;
|
||||
Str255 objectName;
|
||||
dipb->ioCompletion = nsnull;
|
||||
dipb->ioCompletion = NULL;
|
||||
dipb->ioFDirIndex = mIndex;
|
||||
// Sorry about this, there seems to be a bug in CWPro 4:
|
||||
FSSpec& currentSpec = mCurrent.nsFileSpec::operator FSSpec&();
|
||||
FSSpec& currentSpec = mCurrent.nsNativeFileSpec::operator FSSpec&();
|
||||
dipb->ioVRefNum = currentSpec.vRefNum; /* Might need to use vRefNum, not sure*/
|
||||
dipb->ioDrDirID = currentSpec.parID;
|
||||
dipb->ioNamePtr = objectName;
|
||||
|
||||
@@ -39,16 +39,12 @@ class TimerImpl : public nsITimer
|
||||
// TimerImpl implements nsITimer API
|
||||
//========================================================================================
|
||||
{
|
||||
friend class TimerPeriodical;
|
||||
|
||||
private:
|
||||
nsTimerCallbackFunc mCallbackFunc;
|
||||
nsITimerCallback * mCallbackObject;
|
||||
void * mClosure;
|
||||
PRUint32 mDelay;
|
||||
PRUint32 mFireTime; // Timer should fire when TickCount >= this number
|
||||
TimerImpl * mPrev;
|
||||
TimerImpl * mNext;
|
||||
|
||||
public:
|
||||
|
||||
@@ -107,10 +103,10 @@ class TimerPeriodical : public Repeater
|
||||
// TimerPeriodical is a singleton Repeater subclass that fires
|
||||
// off TimerImpl. The firing is done on idle.
|
||||
//========================================================================================
|
||||
{
|
||||
{
|
||||
static TimerPeriodical * gPeriodical;
|
||||
|
||||
TimerImpl* mTimers;
|
||||
list<TimerImpl*> mTimers;
|
||||
|
||||
public:
|
||||
// Returns the singleton instance
|
||||
@@ -144,8 +140,6 @@ TimerImpl::TimerImpl()
|
||||
, mClosure(nsnull)
|
||||
, mDelay(0)
|
||||
, mFireTime(0)
|
||||
, mPrev(nsnull)
|
||||
, mNext(nsnull)
|
||||
#if DEBUG
|
||||
, mSignature(eGoodTimerSignature)
|
||||
#endif
|
||||
@@ -191,6 +185,7 @@ nsresult TimerImpl::Init(nsITimerCallback *aCallback,
|
||||
void TimerImpl::Cancel()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
TimerPeriodical::GetPeriodical()->RemoveTimer(this);
|
||||
}
|
||||
|
||||
@@ -256,70 +251,26 @@ TimerPeriodical * TimerPeriodical::GetPeriodical()
|
||||
|
||||
TimerPeriodical::TimerPeriodical()
|
||||
{
|
||||
mTimers = nsnull;
|
||||
}
|
||||
|
||||
TimerPeriodical::~TimerPeriodical()
|
||||
{
|
||||
PR_ASSERT(mTimers == 0);
|
||||
PR_ASSERT(mTimers.size() == 0);
|
||||
}
|
||||
|
||||
nsresult TimerPeriodical::AddTimer( TimerImpl * aTimer)
|
||||
{
|
||||
// make sure it's not already there
|
||||
RemoveTimer(aTimer);
|
||||
// keep list sorted by fire time
|
||||
if (mTimers)
|
||||
{
|
||||
if (aTimer->GetFireTime() < mTimers->GetFireTime())
|
||||
{
|
||||
mTimers->mPrev = aTimer;
|
||||
aTimer->mNext = mTimers;
|
||||
mTimers = aTimer;
|
||||
}
|
||||
else
|
||||
{
|
||||
TimerImpl *t = mTimers;
|
||||
TimerImpl *prevt;
|
||||
// we know we will enter the while loop at least the first
|
||||
// time, and thus prevt will be initialized
|
||||
while (t && (t->GetFireTime() <= aTimer->GetFireTime()))
|
||||
{
|
||||
prevt = t;
|
||||
t = t->mNext;
|
||||
}
|
||||
aTimer->mPrev = prevt;
|
||||
aTimer->mNext = prevt->mNext;
|
||||
prevt->mNext = aTimer;
|
||||
if (aTimer->mNext) aTimer->mNext->mPrev = aTimer;
|
||||
}
|
||||
}
|
||||
else mTimers = aTimer;
|
||||
|
||||
mTimers.remove(aTimer);
|
||||
mTimers.push_back(aTimer);
|
||||
StartRepeating();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult TimerPeriodical::RemoveTimer( TimerImpl * aTimer)
|
||||
{
|
||||
TimerImpl* t = mTimers;
|
||||
TimerImpl* next_t = nsnull;
|
||||
if (t) next_t = t->mNext;
|
||||
while (t)
|
||||
{
|
||||
if (t == aTimer)
|
||||
{
|
||||
if (mTimers == t) mTimers = t->mNext;
|
||||
if (t->mPrev) t->mPrev->mNext = t->mNext;
|
||||
if (t->mNext) t->mNext->mPrev = t->mPrev;
|
||||
t->mNext = nsnull;
|
||||
t->mPrev = nsnull;
|
||||
}
|
||||
t = next_t;
|
||||
if (t) next_t = t->mNext;
|
||||
}
|
||||
|
||||
if ( mTimers == nsnull )
|
||||
mTimers.remove(aTimer);
|
||||
if ( mTimers.size() == 0 )
|
||||
StopRepeating();
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -329,23 +280,33 @@ nsresult TimerPeriodical::RemoveTimer( TimerImpl * aTimer)
|
||||
// fires off the appropriate ones
|
||||
void TimerPeriodical::RepeatAction( const EventRecord &inMacEvent)
|
||||
{
|
||||
PRBool done = false;
|
||||
while (!done)
|
||||
list<TimerImpl*>::iterator iter = mTimers.begin();
|
||||
list<TimerImpl*> fireList;
|
||||
|
||||
while (iter != mTimers.end())
|
||||
{
|
||||
TimerImpl* t = mTimers;
|
||||
while (t)
|
||||
{
|
||||
NS_ASSERTION(t->IsGoodTimer(), "Bad timer!");
|
||||
TimerImpl* timer = *iter;
|
||||
|
||||
if (t->GetFireTime() <= inMacEvent.when)
|
||||
{
|
||||
RemoveTimer(t);
|
||||
t->Fire();
|
||||
break;
|
||||
}
|
||||
t = t->mNext;
|
||||
NS_ASSERTION(timer->IsGoodTimer(), "Bad timer!");
|
||||
|
||||
if (timer->GetFireTime() <= inMacEvent.when)
|
||||
{
|
||||
mTimers.erase(iter++);
|
||||
NS_ADDREF(timer);
|
||||
fireList.push_back(timer);
|
||||
}
|
||||
done = true;
|
||||
else
|
||||
{
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
if ( mTimers.size() == 0 )
|
||||
StopRepeating();
|
||||
|
||||
for (iter=fireList.begin(); iter!=fireList.end(); iter++)
|
||||
{
|
||||
(*iter)->Fire();
|
||||
NS_RELEASE(*iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ CPPSRCS = \
|
||||
nsVoidArray.cpp \
|
||||
nsFileSpec.cpp \
|
||||
nsFileStream.cpp \
|
||||
nsEscape.cpp \
|
||||
nsIFileStream.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
@@ -61,8 +59,6 @@ CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsVoidArray.obj \
|
||||
.\$(OBJDIR)\nsFileSpec.obj \
|
||||
.\$(OBJDIR)\nsFileStream.obj \
|
||||
.\$(OBJDIR)\nsEscape.obj \
|
||||
.\$(OBJDIR)\nsIFileStream.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS=nscore.h nsIArena.h nsIAtom.h nsIByteBuffer.h \
|
||||
@@ -75,10 +71,10 @@ EXPORTS=nscore.h nsIArena.h nsIAtom.h nsIByteBuffer.h \
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
REQUIRES=xpcom netlib raptor uconv
|
||||
REQUIRES=xpcom netlib raptor
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\netlib \
|
||||
-I$(PUBLIC)\raptor -I$(PUBLIC)\uconv -I$(PUBLIC)\unicharutil
|
||||
-I$(PUBLIC)\raptor
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
DLLNAME = raptorbase
|
||||
|
||||
@@ -130,7 +130,7 @@ NS_BASE nsIAtom* NS_NewAtom(const PRUnichar* us)
|
||||
(PLHashComparator) nsnull,
|
||||
nsnull, nsnull);
|
||||
}
|
||||
PRUint32 uslen;
|
||||
PRInt32 uslen;
|
||||
PRUint32 hashCode = nsCRT::HashValue(us, &uslen);
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gAtomHashTable, hashCode, us);
|
||||
PLHashEntry* he = *hep;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "nsProperties.h"
|
||||
#include "nsRepository.h"
|
||||
|
||||
PRInt32 gLockCount = 0;
|
||||
extern "C" PRInt32 gLockCount = 0;
|
||||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
extern PRInt32 gLockCount;
|
||||
extern "C" PRInt32 gLockCount;
|
||||
|
||||
#endif /* nsBaseDLL_h___ */
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "nsUnicharUtilCIID.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICaseConversion.h"
|
||||
|
||||
|
||||
// XXX Bug: These tables don't lowercase the upper 128 characters properly
|
||||
|
||||
@@ -113,77 +109,21 @@ static const PRUnichar kIsoLatin1ToUCS2[256] = {
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#define TOLOWER(_ucs2) \
|
||||
(((_ucs2) < 128) ? PRUnichar(kUpper2Lower[_ucs2]) : _ToLower(_ucs2))
|
||||
(((_ucs2) < 256) ? PRUnichar(kUpper2Lower[_ucs2]) : _ToLower(_ucs2))
|
||||
|
||||
#define TOUPPER(_ucs2) \
|
||||
(((_ucs2) < 128) ? PRUnichar(kLower2Upper[_ucs2]) : _ToUpper(_ucs2))
|
||||
|
||||
class HandleCaseConversionShutdown : public nsIShutdownListener {
|
||||
public :
|
||||
NS_IMETHOD OnShutdown(const nsCID& cid, nsISupports* service);
|
||||
HandleCaseConversionShutdown(void) { NS_INIT_REFCNT(); }
|
||||
virtual ~HandleCaseConversionShutdown(void) {}
|
||||
NS_DECL_ISUPPORTS
|
||||
};
|
||||
static NS_DEFINE_CID(kUnicharUtilCID, NS_UNICHARUTIL_CID);
|
||||
static NS_DEFINE_IID(kICaseConversionIID, NS_ICASECONVERSION_IID);
|
||||
|
||||
static nsICaseConversion * gCaseConv = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kIShutdownListenerIID, NS_ISHUTDOWNLISTENER_IID);
|
||||
NS_IMPL_ISUPPORTS(HandleCaseConversionShutdown, kIShutdownListenerIID);
|
||||
|
||||
nsresult
|
||||
HandleCaseConversionShutdown::OnShutdown(const nsCID& cid, nsISupports* service)
|
||||
{
|
||||
if (cid.Equals(kUnicharUtilCID)) {
|
||||
NS_ASSERTION(service == gCaseConv, "wrong service!");
|
||||
nsrefcnt cnt = gCaseConv->Release();
|
||||
gCaseConv = NULL;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static HandleCaseConversionShutdown* gListener = NULL;
|
||||
|
||||
static void StartUpCaseConversion()
|
||||
{
|
||||
nsresult err;
|
||||
|
||||
if ( NULL == gListener )
|
||||
{
|
||||
gListener = new HandleCaseConversionShutdown();
|
||||
gListener->AddRef();
|
||||
}
|
||||
err = nsServiceManager::GetService(kUnicharUtilCID, kICaseConversionIID,
|
||||
(nsISupports**) &gCaseConv, gListener);
|
||||
}
|
||||
static void CheckCaseConversion()
|
||||
{
|
||||
if(NULL == gCaseConv )
|
||||
StartUpCaseConversion();
|
||||
|
||||
NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
|
||||
}
|
||||
(((_ucs2) < 256) ? PRUnichar(kLower2Upper[_ucs2]) : _ToUpper(_ucs2))
|
||||
|
||||
static PRUnichar _ToLower(PRUnichar aChar)
|
||||
{
|
||||
PRUnichar oLower;
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(aChar, &oLower);
|
||||
NS_ASSERTION( NS_SUCCEEDED(err), "failed to communicate to UnicharUtil");
|
||||
return ( NS_SUCCEEDED(err) ) ? oLower : aChar ;
|
||||
// XXX need i18n code here
|
||||
return aChar;
|
||||
}
|
||||
|
||||
static PRUnichar _ToUpper(PRUnichar aChar)
|
||||
{
|
||||
nsresult err;
|
||||
PRUnichar oUpper;
|
||||
CheckCaseConversion();
|
||||
err = gCaseConv->ToUpper(aChar, &oUpper);
|
||||
NS_ASSERTION( NS_SUCCEEDED(err), "failed to communicate to UnicharUtil");
|
||||
return ( NS_SUCCEEDED(err) ) ? oUpper : aChar ;
|
||||
// XXX need i18n code here
|
||||
return aChar;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -198,53 +138,9 @@ PRUnichar nsCRT::ToLower(PRUnichar aChar)
|
||||
return TOLOWER(aChar);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// My lovely strtok routine
|
||||
|
||||
#define IS_DELIM(m, c) ((m)[(c) >> 3] & (1 << ((c) & 7)))
|
||||
#define SET_DELIM(m, c) ((m)[(c) >> 3] |= (1 << ((c) & 7)))
|
||||
#define DELIM_TABLE_SIZE 32
|
||||
|
||||
char* nsCRT::strtok(char* str, const char* delims, char* *newStr)
|
||||
PRInt32 nsCRT::strlen(const PRUnichar* s)
|
||||
{
|
||||
NS_ASSERTION(str, "Unlike regular strtok, the first argument cannot be null.");
|
||||
|
||||
char delimTable[DELIM_TABLE_SIZE];
|
||||
PRUint32 i;
|
||||
char* result;
|
||||
|
||||
for (i = 0; i < DELIM_TABLE_SIZE; i++)
|
||||
delimTable[i] = '\0';
|
||||
|
||||
for (i = 0; i < DELIM_TABLE_SIZE && delims[i]; i++) {
|
||||
SET_DELIM(delimTable, delims[i]);
|
||||
}
|
||||
NS_ASSERTION(delims[i] == '\0', "too many delimiters");
|
||||
|
||||
// skip to beginning
|
||||
while (*str && IS_DELIM(delimTable, *str)) {
|
||||
str++;
|
||||
}
|
||||
result = str;
|
||||
|
||||
// fix up the end of the token
|
||||
while (*str) {
|
||||
if (IS_DELIM(delimTable, *str)) {
|
||||
*str++ = '\0';
|
||||
break;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
*newStr = str;
|
||||
|
||||
return str == result ? NULL : result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PRUint32 nsCRT::strlen(const PRUnichar* s)
|
||||
{
|
||||
PRUint32 len = 0;
|
||||
PRInt32 len = 0;
|
||||
if(s) {
|
||||
while (*s++ != 0) {
|
||||
len++;
|
||||
@@ -284,11 +180,11 @@ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2)
|
||||
* @param s1 and s2 both point to unichar strings
|
||||
* @return 0 if they match, -1 if s1<s2; 1 if s1>s2
|
||||
*/
|
||||
PRInt32 nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, PRUint32 n)
|
||||
PRInt32 nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n)
|
||||
{
|
||||
if(s1 && s2) {
|
||||
if(n != 0) {
|
||||
do {
|
||||
if(0<n) {
|
||||
while (--n >= 0) {
|
||||
PRUnichar c1 = *s1++;
|
||||
PRUnichar c2 = *s2++;
|
||||
if (c1 != c2) {
|
||||
@@ -296,7 +192,7 @@ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, PRUint32 n)
|
||||
return 1;
|
||||
}
|
||||
if ((0==c1) || (0==c2)) break;
|
||||
} while (--n != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -338,7 +234,7 @@ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const PRUnichar* s2)
|
||||
* @param s1 and s2 both point to unichar strings
|
||||
* @return 0 if they match, -1 if s1<s2; 1 if s1>s2
|
||||
*/
|
||||
PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const PRUnichar* s2, PRUint32 n)
|
||||
PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n)
|
||||
{
|
||||
if(s1 && s2) {
|
||||
if(0<n){
|
||||
@@ -394,11 +290,11 @@ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const char* s2)
|
||||
* @param s2 points to cstring
|
||||
* @return 0 if they match, -1 if s1<s2; 1 if s1>s2
|
||||
*/
|
||||
PRInt32 nsCRT::strncmp(const PRUnichar* s1, const char* s2, PRUint32 n)
|
||||
PRInt32 nsCRT::strncmp(const PRUnichar* s1, const char* s2, PRInt32 n)
|
||||
{
|
||||
if(s1 && s2) {
|
||||
if(n != 0){
|
||||
do {
|
||||
if(0<n){
|
||||
while (--n >= 0) {
|
||||
PRUnichar c1 = *s1++;
|
||||
PRUnichar c2 = kIsoLatin1ToUCS2[*(const unsigned char*)s2++];
|
||||
if (c1 != c2) {
|
||||
@@ -406,7 +302,7 @@ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const char* s2, PRUint32 n)
|
||||
return 1;
|
||||
}
|
||||
if ((0==c1) || (0==c2)) break;
|
||||
} while (--n != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -448,11 +344,11 @@ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const char* s2)
|
||||
* @param s2 points to cstring
|
||||
* @return 0 if they match, -1 if s1<s2; 1 if s1>s2
|
||||
*/
|
||||
PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const char* s2, PRUint32 n)
|
||||
PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const char* s2, PRInt32 n)
|
||||
{
|
||||
if(s1 && s2){
|
||||
if(n != 0){
|
||||
do {
|
||||
if(0<n){
|
||||
while (--n >= 0) {
|
||||
PRUnichar c1 = *s1++;
|
||||
PRUnichar c2 = kIsoLatin1ToUCS2[*(const unsigned char*)s2++];
|
||||
if (c1 != c2) {
|
||||
@@ -464,7 +360,7 @@ PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const char* s2, PRUint32 n)
|
||||
}
|
||||
}
|
||||
if (c1 == 0) break;
|
||||
} while (--n != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -472,7 +368,7 @@ PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const char* s2, PRUint32 n)
|
||||
|
||||
PRUnichar* nsCRT::strdup(const PRUnichar* str)
|
||||
{
|
||||
PRUint32 len = nsCRT::strlen(str) + 1; // add one for null
|
||||
PRInt32 len = nsCRT::strlen(str) + 1; // add one for null
|
||||
PRUnichar* rslt = new PRUnichar[len];
|
||||
if (rslt == NULL) return NULL;
|
||||
nsCRT::memcpy(rslt, str, len * sizeof(PRUnichar));
|
||||
@@ -492,10 +388,10 @@ PRUint32 nsCRT::HashValue(const PRUnichar* us)
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRUint32 nsCRT::HashValue(const PRUnichar* us, PRUint32* uslenp)
|
||||
PRUint32 nsCRT::HashValue(const PRUnichar* us, PRInt32* uslenp)
|
||||
{
|
||||
PRUint32 rv = 0;
|
||||
PRUint32 len = 0;
|
||||
PRInt32 len = 0;
|
||||
PRUnichar ch;
|
||||
while ((ch = *us++) != 0) {
|
||||
// FYI: rv = rv*37 + ch
|
||||
|
||||
@@ -23,38 +23,28 @@
|
||||
#include "plstr.h"
|
||||
#include "nscore.h"
|
||||
|
||||
#define CR '\015'
|
||||
#define LF '\012'
|
||||
#define VTAB '\013'
|
||||
#define FF '\014'
|
||||
#define TAB '\011'
|
||||
#define CRLF "\015\012" /* A CR LF equivalent string */
|
||||
|
||||
|
||||
|
||||
/// This is a wrapper class around all the C runtime functions.
|
||||
|
||||
class NS_BASE nsCRT {
|
||||
public:
|
||||
|
||||
/** Copy bytes from aSrc to aDest.
|
||||
@param aDest the destination address
|
||||
@param aSrc the source address
|
||||
@param aCount the number of bytes to copy
|
||||
*/
|
||||
static void memcpy(void* aDest, const void* aSrc, PRUint32 aCount) {
|
||||
static void memcpy(void* aDest, const void* aSrc, PRInt32 aCount) {
|
||||
::memcpy(aDest, aSrc, (size_t)aCount);
|
||||
}
|
||||
|
||||
static void memmove(void* aDest, const void* aSrc, PRUint32 aCount) {
|
||||
static void memmove(void* aDest, const void* aSrc, PRInt32 aCount) {
|
||||
::memmove(aDest, aSrc, (size_t)aCount);
|
||||
}
|
||||
|
||||
static void memset(void* aDest, PRUint8 aByte, PRUint32 aCount) {
|
||||
static void memset(void* aDest, PRUint8 aByte, PRInt32 aCount) {
|
||||
::memset(aDest, aByte, aCount);
|
||||
}
|
||||
|
||||
static void zero(void* aDest, PRUint32 aCount) {
|
||||
static void zero(void* aDest, PRInt32 aCount) {
|
||||
::memset(aDest, 0, (size_t)aCount);
|
||||
}
|
||||
|
||||
@@ -62,18 +52,13 @@ public:
|
||||
@param s the string in question
|
||||
@return the length of s
|
||||
*/
|
||||
static PRUint32 strlen(const char* s) {
|
||||
return PRUint32(::strlen(s));
|
||||
static PRInt32 strlen(const char* s) {
|
||||
return PRInt32(::strlen(s));
|
||||
}
|
||||
|
||||
/// Compare s1 and s2.
|
||||
static PRInt32 strcmp(const char* s1, const char* s2) {
|
||||
return PRUint32(PL_strcmp(s1, s2));
|
||||
}
|
||||
|
||||
static PRUint32 strncmp(const char* s1, const char* s2,
|
||||
PRUint32 aMaxLen) {
|
||||
return PRInt32(PL_strncmp(s1, s2, aMaxLen));
|
||||
return PRInt32(PL_strcmp(s1, s2));
|
||||
}
|
||||
|
||||
/// Case-insensitive string comparison.
|
||||
@@ -82,63 +67,40 @@ public:
|
||||
}
|
||||
|
||||
/// Case-insensitive string comparison with length
|
||||
static PRInt32 strncasecmp(const char* s1, const char* s2, PRUint32 aMaxLen) {
|
||||
static PRInt32 strncasecmp(const char* s1, const char* s2, PRInt32 aMaxLen) {
|
||||
return PRInt32(PL_strncasecmp(s1, s2, aMaxLen));
|
||||
}
|
||||
|
||||
static PRInt32 strncmp(const char* s1, const char* s2, PRInt32 aMaxLen) {
|
||||
return PRInt32(PL_strncmp(s1,s2,aMaxLen));
|
||||
}
|
||||
|
||||
static char* strdup(const char* str) {
|
||||
return PL_strdup(str);
|
||||
}
|
||||
|
||||
/**
|
||||
How to use this fancy (thread-safe) version of strtok:
|
||||
|
||||
void main( void ) {
|
||||
printf( "%s\n\nTokens:\n", string );
|
||||
// Establish string and get the first token:
|
||||
char* newStr;
|
||||
token = nsCRT::strtok( string, seps, &newStr );
|
||||
while( token != NULL ) {
|
||||
// While there are tokens in "string"
|
||||
printf( " %s\n", token );
|
||||
// Get next token:
|
||||
token = nsCRT::strtok( newStr, seps, &newStr );
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
static char* strtok(char* str, const char* delims, char* *newStr);
|
||||
|
||||
/// Like strlen except for ucs2 strings
|
||||
static PRUint32 strlen(const PRUnichar* s);
|
||||
static PRInt32 strlen(const PRUnichar* s);
|
||||
|
||||
/// Like strcmp except for ucs2 strings
|
||||
static PRInt32 strcmp(const PRUnichar* s1, const PRUnichar* s2);
|
||||
/// Like strcmp except for ucs2 strings
|
||||
static PRInt32 strncmp(const PRUnichar* s1, const PRUnichar* s2,
|
||||
PRUint32 aMaxLen);
|
||||
PRInt32 aMaxLen);
|
||||
|
||||
/// Like strcasecmp except for ucs2 strings
|
||||
static PRInt32 strcasecmp(const PRUnichar* s1, const PRUnichar* s2);
|
||||
/// Like strncasecmp except for ucs2 strings
|
||||
static PRInt32 strncasecmp(const PRUnichar* s1, const PRUnichar* s2,
|
||||
PRUint32 aMaxLen);
|
||||
PRInt32 aMaxLen);
|
||||
|
||||
/// Like strcmp with a char* and a ucs2 string
|
||||
static PRInt32 strcmp(const PRUnichar* s1, const char* s2);
|
||||
/// Like strncmp with a char* and a ucs2 string
|
||||
static PRInt32 strncmp(const PRUnichar* s1, const char* s2,
|
||||
PRUint32 aMaxLen);
|
||||
PRInt32 aMaxLen);
|
||||
|
||||
/// Like strcasecmp with a char* and a ucs2 string
|
||||
static PRInt32 strcasecmp(const PRUnichar* s1, const char* s2);
|
||||
/// Like strncasecmp with a char* and a ucs2 string
|
||||
static PRInt32 strncasecmp(const PRUnichar* s1, const char* s2,
|
||||
PRUint32 aMaxLen);
|
||||
PRInt32 aMaxLen);
|
||||
|
||||
// Note: uses new[] to allocate memory, so you must use delete[] to
|
||||
// free the memory
|
||||
@@ -148,7 +110,7 @@ public:
|
||||
static PRUint32 HashValue(const PRUnichar* s1);
|
||||
|
||||
/// Same as above except that we return the length in s1len
|
||||
static PRUint32 HashValue(const PRUnichar* s1, PRUint32* s1len);
|
||||
static PRUint32 HashValue(const PRUnichar* s1, PRInt32* s1len);
|
||||
|
||||
/// String to integer.
|
||||
static PRInt32 atoi( const PRUnichar *string );
|
||||
|
||||
@@ -67,9 +67,7 @@ PRInt32 nsDeque::GetSize(void) const {
|
||||
* @return
|
||||
*/
|
||||
nsDeque& nsDeque::Empty() {
|
||||
if((0<mCapacity) && (mData)) {
|
||||
nsCRT::zero(mData,mCapacity*sizeof(mData));
|
||||
}
|
||||
nsCRT::zero(mData,mCapacity*sizeof(mData));
|
||||
mSize=0;
|
||||
mOrigin=0;
|
||||
return *this;
|
||||
|
||||
@@ -53,7 +53,7 @@ const int netCharType[256] =
|
||||
#define HEX_ESCAPE '%'
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE char* nsEscape(const char * str, nsEscapeMask mask)
|
||||
char* nsEscape(const char * str, nsEscapeMask mask)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if(!str)
|
||||
@@ -62,7 +62,7 @@ NS_BASE char* nsEscape(const char * str, nsEscapeMask mask)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE char* nsEscapeCount(const char * str, PRInt32 len, nsEscapeMask mask, PRInt32 * out_len)
|
||||
char* nsEscapeCount(const char * str, PRInt32 len, nsEscapeMask mask, PRInt32 * out_len)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
int32 i, extra = 0;
|
||||
@@ -109,7 +109,7 @@ NS_BASE char* nsEscapeCount(const char * str, PRInt32 len, nsEscapeMask mask, PR
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE char* nsUnescape(char * str)
|
||||
char* nsUnescape(char * str)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsUnescapeCount(str);
|
||||
@@ -117,7 +117,7 @@ NS_BASE char* nsUnescape(char * str)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE PRInt32 nsUnescapeCount(char * str)
|
||||
PRInt32 nsUnescapeCount(char * str)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
register char *src = str;
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
#include "nsDebug.h"
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "plstr.h"
|
||||
#include "plbase64.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -43,7 +40,7 @@ NS_NAMESPACE nsFileSpecHelpers
|
||||
char inSeparator,
|
||||
const char* inLeafName);
|
||||
#ifndef XP_MAC
|
||||
NS_NAMESPACE_PROTOTYPE void Canonify(char*& ioPath, PRBool inMakeDirs);
|
||||
NS_NAMESPACE_PROTOTYPE void Canonify(char*& ioPath, bool inMakeDirs);
|
||||
NS_NAMESPACE_PROTOTYPE void MakeAllDirectories(const char* inPath, int mode);
|
||||
#endif
|
||||
NS_NAMESPACE_PROTOTYPE char* GetLeaf(const char* inPath, char inSeparator); // allocated
|
||||
@@ -57,14 +54,6 @@ NS_NAMESPACE nsFileSpecHelpers
|
||||
#endif
|
||||
} NS_NAMESPACE_END
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult ns_file_convert_result(PRInt32 nativeErr)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return nativeErr ?
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES,((nativeErr)&0xFFFF))
|
||||
: NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
char* nsFileSpecHelpers::StringDup(
|
||||
@@ -76,7 +65,7 @@ char* nsFileSpecHelpers::StringDup(
|
||||
allocLength = strlen(inString);
|
||||
char* newPath = inString || allocLength ? new char[allocLength + 1] : nsnull;
|
||||
if (!newPath)
|
||||
return nsnull;
|
||||
return NULL;
|
||||
strcpy(newPath, inString);
|
||||
return newPath;
|
||||
} // nsFileSpecHelpers::StringDup
|
||||
@@ -88,7 +77,7 @@ char* nsFileSpecHelpers::AllocCat(
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (!inString1)
|
||||
return inString2 ? StringDup(inString2) : (char*)nsnull;
|
||||
return inString2 ? StringDup(inString2) : (char*)NULL;
|
||||
if (!inString2)
|
||||
return StringDup(inString1);
|
||||
char* outString = StringDup(inString1, strlen(inString1) + strlen(inString2));
|
||||
@@ -106,7 +95,7 @@ char* nsFileSpecHelpers::StringAssign(
|
||||
if (!inString2)
|
||||
{
|
||||
delete [] ioString;
|
||||
ioString = (char*)nsnull;
|
||||
ioString = (char*)NULL;
|
||||
return ioString;
|
||||
}
|
||||
if (!ioString || (strlen(inString2) > strlen(ioString)))
|
||||
@@ -136,19 +125,8 @@ void nsFileSpecHelpers::LeafReplace(
|
||||
}
|
||||
char* lastSeparator = strrchr(ioPath, inSeparator);
|
||||
int oldLength = strlen(ioPath);
|
||||
PRBool trailingSeparator = (lastSeparator + 1 == ioPath + oldLength);
|
||||
if (trailingSeparator)
|
||||
{
|
||||
*lastSeparator = '\0';
|
||||
lastSeparator = strrchr(ioPath, inSeparator);
|
||||
}
|
||||
if (lastSeparator)
|
||||
lastSeparator++; // point at the trailing string
|
||||
else
|
||||
lastSeparator = ioPath; // the full monty
|
||||
*lastSeparator = '\0'; // strip the current leaf name
|
||||
|
||||
int newLength = (lastSeparator - ioPath) + strlen(inLeafName) + int(trailingSeparator);
|
||||
*(++lastSeparator) = '\0'; // strip the current leaf name
|
||||
int newLength = lastSeparator - ioPath + strlen(inLeafName);
|
||||
if (newLength > oldLength)
|
||||
{
|
||||
char* newPath = StringDup(ioPath, newLength + 1);
|
||||
@@ -156,14 +134,7 @@ void nsFileSpecHelpers::LeafReplace(
|
||||
ioPath = newPath;
|
||||
}
|
||||
strcat(ioPath, inLeafName);
|
||||
if (trailingSeparator)
|
||||
{
|
||||
// If the original ended in a slash, then the new one should, too.
|
||||
char sepStr[2] = "/";
|
||||
*sepStr = inSeparator;
|
||||
strcat(ioPath, sepStr);
|
||||
}
|
||||
} // nsFileSpecHelpers::LeafReplace
|
||||
} // nsNativeFileSpec::LeafReplace
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
char* nsFileSpecHelpers::GetLeaf(const char* inPath, char inSeparator)
|
||||
@@ -171,32 +142,12 @@ char* nsFileSpecHelpers::GetLeaf(const char* inPath, char inSeparator)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (!inPath)
|
||||
return nsnull;
|
||||
const char* lastSeparator = strrchr(inPath, inSeparator);
|
||||
|
||||
// If there was no separator, then return a copy of the caller's path.
|
||||
if (!lastSeparator)
|
||||
return StringDup(inPath);
|
||||
|
||||
// So there's at least one separator. What's just after it?
|
||||
// If the separator was not the last character, return the trailing string.
|
||||
const char* leafPointer = lastSeparator + 1;
|
||||
if (*leafPointer)
|
||||
return StringDup(leafPointer);
|
||||
|
||||
// So now, separator was the last character. Poke in a null instead.
|
||||
*(char*)lastSeparator = '\0'; // Should use const_cast, but Unix has old compiler.
|
||||
leafPointer = strrchr(inPath, inSeparator);
|
||||
char* result = leafPointer ? StringDup(leafPointer++) : StringDup(inPath);
|
||||
// Restore the poked null before returning.
|
||||
*(char*)lastSeparator = inSeparator;
|
||||
#ifdef XP_PC
|
||||
// If it's a drive letter use the colon notation.
|
||||
if (!leafPointer && strlen(result) == 2 && result[1] == '|')
|
||||
result[1] = ':';
|
||||
#endif
|
||||
return result;
|
||||
} // nsFileSpecHelpers::GetLeaf
|
||||
return NULL;
|
||||
char* lastSeparator = strrchr(inPath, inSeparator);
|
||||
if (lastSeparator)
|
||||
return StringDup(++lastSeparator);
|
||||
return StringDup(inPath);
|
||||
} // nsNativeFileSpec::GetLeaf
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_PC)
|
||||
|
||||
@@ -226,7 +177,7 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode)
|
||||
if (currentEnd)
|
||||
{
|
||||
*currentEnd = '\0';
|
||||
nsFileSpec spec(nsFilePath(pathCopy, PR_FALSE));
|
||||
nsNativeFileSpec spec(nsFilePath(pathCopy, false));
|
||||
do
|
||||
{
|
||||
// If the node doesn't exist, and it is not the initial node in a full path,
|
||||
@@ -258,7 +209,7 @@ char* nsFileSpecHelpers::ReallocCat(char*& ioString, const char* inString1)
|
||||
delete [] ioString;
|
||||
ioString = newString;
|
||||
return ioString;
|
||||
} // nsFileSpecHelpers::ReallocCat
|
||||
} // nsNativeFileSpec::ReallocCat
|
||||
|
||||
#if defined(XP_PC)
|
||||
#include "windows/nsFileSpecWin.cpp" // Windows-specific implementations
|
||||
@@ -274,7 +225,7 @@ char* nsFileSpecHelpers::ReallocCat(char*& ioString, const char* inString1)
|
||||
|
||||
#ifndef XP_MAC
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileURL::nsFileURL(const char* inString, PRBool inCreateDirs)
|
||||
nsFileURL::nsFileURL(const char* inString, bool inCreateDirs)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mURL(nsnull)
|
||||
{
|
||||
@@ -292,7 +243,7 @@ nsFileURL::nsFileURL(const nsFileURL& inOther)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mURL(nsFileSpecHelpers::StringDup(inOther.mURL))
|
||||
#ifdef XP_MAC
|
||||
, mFileSpec(inOther.GetFileSpec())
|
||||
, mNativeFileSpec(inOther.GetNativeSpec())
|
||||
#endif
|
||||
{
|
||||
} // nsFileURL::nsFileURL
|
||||
@@ -302,16 +253,16 @@ nsFileURL::nsFileURL(const nsFilePath& inOther)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mURL(nsFileSpecHelpers::AllocCat(kFileURLPrefix, (const char*)inOther))
|
||||
#ifdef XP_MAC
|
||||
, mFileSpec(inOther.GetFileSpec())
|
||||
, mNativeFileSpec(inOther.GetNativeSpec())
|
||||
#endif
|
||||
{
|
||||
} // nsFileURL::nsFileURL
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileURL::nsFileURL(const nsFileSpec& inOther)
|
||||
nsFileURL::nsFileURL(const nsNativeFileSpec& inOther)
|
||||
: mURL(nsFileSpecHelpers::AllocCat(kFileURLPrefix, (const char*)nsFilePath(inOther)))
|
||||
#ifdef XP_MAC
|
||||
, mFileSpec(inOther)
|
||||
, mNativeFileSpec(inOther)
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
@@ -331,7 +282,7 @@ void nsFileURL::operator = (const char* inString)
|
||||
nsFileSpecHelpers::StringAssign(mURL, inString);
|
||||
NS_ASSERTION(strstr(inString, kFileURLPrefix) == inString, "Not a URL!");
|
||||
#ifdef XP_MAC
|
||||
mFileSpec = inString + kFileURLPrefixLength;
|
||||
mNativeFileSpec = inString + kFileURLPrefixLength;
|
||||
#endif
|
||||
} // nsFileURL::operator =
|
||||
|
||||
@@ -341,7 +292,7 @@ void nsFileURL::operator = (const nsFileURL& inOther)
|
||||
{
|
||||
mURL = nsFileSpecHelpers::StringAssign(mURL, inOther.mURL);
|
||||
#ifdef XP_MAC
|
||||
mFileSpec = inOther.GetFileSpec();
|
||||
mNativeFileSpec = inOther.GetNativeSpec();
|
||||
#endif
|
||||
} // nsFileURL::operator =
|
||||
|
||||
@@ -352,45 +303,35 @@ void nsFileURL::operator = (const nsFilePath& inOther)
|
||||
delete [] mURL;
|
||||
mURL = nsFileSpecHelpers::AllocCat(kFileURLPrefix, (const char*)inOther);
|
||||
#ifdef XP_MAC
|
||||
mFileSpec = inOther.GetFileSpec();
|
||||
mNativeFileSpec = inOther.GetNativeSpec();
|
||||
#endif
|
||||
} // nsFileURL::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileURL::operator = (const nsFileSpec& inOther)
|
||||
void nsFileURL::operator = (const nsNativeFileSpec& inOther)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
delete [] mURL;
|
||||
mURL = nsFileSpecHelpers::AllocCat(kFileURLPrefix, (const char*)nsFilePath(inOther));
|
||||
#ifdef XP_MAC
|
||||
mFileSpec = inOther;
|
||||
mNativeFileSpec = inOther;
|
||||
#endif
|
||||
} // nsFileURL::operator =
|
||||
|
||||
#if DEBUG
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& operator << (nsOutputStream& s, const nsFileURL& url)
|
||||
nsBasicOutStream& operator << (nsBasicOutStream& s, const nsFileURL& url)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return (s << url.mURL);
|
||||
}
|
||||
#endif
|
||||
|
||||
//========================================================================================
|
||||
// nsFilePath implementation
|
||||
//========================================================================================
|
||||
|
||||
nsFilePath::nsFilePath(const nsFilePath& inPath)
|
||||
: mPath(nsFileSpecHelpers::StringDup(inPath.mPath))
|
||||
#ifdef XP_MAC
|
||||
, mFileSpec(inPath.mFileSpec)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef XP_MAC
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFilePath::nsFilePath(const char* inString, PRBool inCreateDirs)
|
||||
nsFilePath::nsFilePath(const char* inString, bool inCreateDirs)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(nsFileSpecHelpers::StringDup(inString))
|
||||
{
|
||||
@@ -413,14 +354,14 @@ nsFilePath::nsFilePath(const nsFileURL& inOther)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(nsFileSpecHelpers::StringDup(inOther.mURL + kFileURLPrefixLength))
|
||||
#ifdef XP_MAC
|
||||
, mFileSpec(inOther.GetFileSpec())
|
||||
, mNativeFileSpec(inOther.GetNativeSpec())
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef XP_UNIX
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFilePath::nsFilePath(const nsFileSpec& inOther)
|
||||
nsFilePath::nsFilePath(const nsNativeFileSpec& inOther)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(nsFileSpecHelpers::StringDup(inOther.mPath))
|
||||
{
|
||||
@@ -436,7 +377,7 @@ nsFilePath::~nsFilePath()
|
||||
|
||||
#ifdef XP_UNIX
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFilePath::operator = (const nsFileSpec& inOther)
|
||||
void nsFilePath::operator = (const nsNativeFileSpec& inOther)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mPath = nsFileSpecHelpers::StringAssign(mPath, inOther.mPath);
|
||||
@@ -449,14 +390,14 @@ void nsFilePath::operator = (const char* inString)
|
||||
{
|
||||
NS_ASSERTION(strstr(inString, kFileURLPrefix) != inString, "URL passed as path");
|
||||
#ifdef XP_MAC
|
||||
mFileSpec = inString;
|
||||
nsFileSpecHelpers::StringAssign(mPath, (const char*)nsFilePath(mFileSpec));
|
||||
mNativeFileSpec = inString;
|
||||
nsFileSpecHelpers::StringAssign(mPath, (const char*)nsFilePath(mNativeFileSpec));
|
||||
#else
|
||||
#ifdef XP_PC
|
||||
nsFileSpecHelpers::UnixToNative(mPath);
|
||||
#endif
|
||||
// Make canonical and absolute.
|
||||
nsFileSpecHelpers::Canonify(mPath, PR_FALSE /* XXX? */);
|
||||
nsFileSpecHelpers::Canonify(mPath, false /* XXX? */);
|
||||
#ifdef XP_PC
|
||||
nsFileSpecHelpers::NativeToUnix(mPath);
|
||||
#endif
|
||||
@@ -469,56 +410,45 @@ void nsFilePath::operator = (const nsFileURL& inOther)
|
||||
{
|
||||
nsFileSpecHelpers::StringAssign(mPath, (const char*)nsFilePath(inOther));
|
||||
#ifdef XP_MAC
|
||||
mFileSpec = inOther.GetFileSpec();
|
||||
mNativeFileSpec = inOther.GetNativeSpec();
|
||||
#endif
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
// nsFileSpec implementation
|
||||
// nsNativeFileSpec implementation
|
||||
//========================================================================================
|
||||
|
||||
#ifndef XP_MAC
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec()
|
||||
nsNativeFileSpec::nsNativeFileSpec()
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(nsnull)
|
||||
, mError(NS_OK)
|
||||
: mPath(NULL)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const nsPersistentFileDescriptor& inDescriptor)
|
||||
nsNativeFileSpec::nsNativeFileSpec(const nsFileURL& inURL)
|
||||
//----------------------------------------------------------------------------------------
|
||||
#ifndef XP_MAC
|
||||
: mPath(nsnull)
|
||||
#endif
|
||||
{
|
||||
*this = inDescriptor;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const nsFileURL& inURL)
|
||||
//----------------------------------------------------------------------------------------
|
||||
#ifndef XP_MAC
|
||||
: mPath(nsnull)
|
||||
: mPath(NULL)
|
||||
#endif
|
||||
{
|
||||
*this = nsFilePath(inURL); // convert to unix path first
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::MakeUnique(const char* inSuggestedLeafName)
|
||||
void nsNativeFileSpec::MakeUnique(const char* inSuggestedLeafName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (inSuggestedLeafName && *inSuggestedLeafName)
|
||||
SetLeafName(inSuggestedLeafName);
|
||||
|
||||
MakeUnique();
|
||||
} // nsFileSpec::MakeUnique
|
||||
} // nsNativeFileSpec::MakeUnique
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::MakeUnique()
|
||||
void nsNativeFileSpec::MakeUnique()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (!Exists())
|
||||
@@ -549,82 +479,51 @@ void nsFileSpec::MakeUnique()
|
||||
if (*suffix)
|
||||
delete [] suffix;
|
||||
delete [] leafName;
|
||||
} // nsFileSpec::MakeUnique
|
||||
} // nsNativeFileSpec::MakeUnique
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const nsFileURL& inURL)
|
||||
void nsNativeFileSpec::operator = (const nsFileURL& inURL)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
*this = nsFilePath(inURL); // convert to unix path first
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const nsPersistentFileDescriptor& inDescriptor)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
void* data;
|
||||
PRInt32 dataSize;
|
||||
inDescriptor.GetData(data, dataSize);
|
||||
|
||||
#ifdef XP_MAC
|
||||
char* decodedData = PL_Base64Decode((const char*)data, (int)dataSize, nsnull);
|
||||
// Cast to an alias record and resolve.
|
||||
AliasHandle aliasH = nsnull;
|
||||
mError = NS_FILE_RESULT(PtrToHand(decodedData, &(Handle)aliasH, (dataSize * 3) / 4));
|
||||
PR_Free(decodedData);
|
||||
if (NS_SUCCEEDED(mError))
|
||||
return; // not enough memory?
|
||||
|
||||
Boolean changed;
|
||||
mError = NS_FILE_RESULT(::ResolveAlias(nsnull, aliasH, &mSpec, &changed));
|
||||
DisposeHandle((Handle) aliasH);
|
||||
#else
|
||||
nsFileSpecHelpers::StringAssign(mPath, (char*)data);
|
||||
mError = NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
// UNIX & WIN nsFileSpec implementation
|
||||
// UNIX & WIN nsNativeFileSpec implementation
|
||||
//========================================================================================
|
||||
|
||||
#ifdef XP_UNIX
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const nsFilePath& inPath)
|
||||
nsNativeFileSpec::nsNativeFileSpec(const nsFilePath& inPath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(nsFileSpecHelpers::StringDup((const char*)inPath))
|
||||
, mError(NS_OK)
|
||||
{
|
||||
}
|
||||
#endif // XP_UNIX
|
||||
|
||||
#ifdef XP_UNIX
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const nsFilePath& inPath)
|
||||
void nsNativeFileSpec::operator = (const nsFilePath& inPath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpecHelpers::StringAssign(mPath, (const char*)inPath);
|
||||
mError = NS_OK;
|
||||
}
|
||||
#endif //XP_UNIX
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_PC)
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const nsFileSpec& inSpec)
|
||||
nsNativeFileSpec::nsNativeFileSpec(const nsNativeFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(nsFileSpecHelpers::StringDup(inSpec.mPath))
|
||||
, mError(NS_OK)
|
||||
{
|
||||
}
|
||||
#endif //XP_UNIX
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_PC)
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const char* inString, PRBool inCreateDirs)
|
||||
nsNativeFileSpec::nsNativeFileSpec(const char* inString, bool inCreateDirs)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(nsFileSpecHelpers::StringDup(inString))
|
||||
, mError(NS_OK)
|
||||
{
|
||||
// Make canonical and absolute.
|
||||
nsFileSpecHelpers::Canonify(mPath, inCreateDirs);
|
||||
@@ -632,7 +531,7 @@ nsFileSpec::nsFileSpec(const char* inString, PRBool inCreateDirs)
|
||||
#endif //XP_UNIX,PC
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::~nsFileSpec()
|
||||
nsNativeFileSpec::~nsNativeFileSpec()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
#ifndef XP_MAC
|
||||
@@ -642,160 +541,39 @@ nsFileSpec::~nsFileSpec()
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_PC)
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const nsFileSpec& inSpec)
|
||||
void nsNativeFileSpec::operator = (const nsNativeFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mPath = nsFileSpecHelpers::StringAssign(mPath, inSpec.mPath);
|
||||
mError = inSpec.Error();
|
||||
}
|
||||
#endif //XP_UNIX
|
||||
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_PC)
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const char* inString)
|
||||
void nsNativeFileSpec::operator = (const char* inString)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mPath = nsFileSpecHelpers::StringAssign(mPath, inString);
|
||||
// Make canonical and absolute.
|
||||
nsFileSpecHelpers::Canonify(mPath, PR_TRUE /* XXX? */);
|
||||
mError = NS_OK;
|
||||
nsFileSpecHelpers::Canonify(mPath, true /* XXX? */);
|
||||
}
|
||||
#endif //XP_UNIX
|
||||
|
||||
#if DEBUG
|
||||
#if (defined(XP_UNIX) || defined(XP_PC))
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& operator << (nsOutputStream& s, const nsFileSpec& spec)
|
||||
nsBasicOutStream& operator << (nsBasicOutStream& s, const nsNativeFileSpec& spec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return (s << (const char*)spec.mPath);
|
||||
}
|
||||
#endif // DEBUG && XP_UNIX
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec nsFileSpec::operator + (const char* inRelativePath) const
|
||||
nsNativeFileSpec nsNativeFileSpec::operator + (const char* inRelativePath) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpec result = *this;
|
||||
nsNativeFileSpec result = *this;
|
||||
result += inRelativePath;
|
||||
return result;
|
||||
} // nsFileSpec::operator +
|
||||
|
||||
//========================================================================================
|
||||
// class nsPersistentFileDescriptor
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsPersistentFileDescriptor::nsPersistentFileDescriptor(const nsPersistentFileDescriptor& inDesc)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mDescriptorString(nsFileSpecHelpers::StringDup(inDesc.mDescriptorString))
|
||||
{
|
||||
} // nsPersistentFileDescriptor::nsPersistentFileDescriptor
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsPersistentFileDescriptor::operator = (const nsPersistentFileDescriptor& inDesc)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpecHelpers::StringAssign(mDescriptorString, inDesc.mDescriptorString);
|
||||
} // nsPersistentFileDescriptor::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsPersistentFileDescriptor::nsPersistentFileDescriptor(const nsFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mDescriptorString(nsnull)
|
||||
{
|
||||
*this = inSpec;
|
||||
} // nsPersistentFileDescriptor::nsPersistentFileDescriptor
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsPersistentFileDescriptor::operator = (const nsFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
if (inSpec.Error())
|
||||
return;
|
||||
AliasHandle aliasH;
|
||||
OSErr err = NewAlias(nil, inSpec.operator const FSSpec* const (), &aliasH);
|
||||
if (err != noErr)
|
||||
return;
|
||||
|
||||
PRUint32 bytes = GetHandleSize((Handle) aliasH);
|
||||
HLock((Handle) aliasH);
|
||||
char* buf = PL_Base64Encode((const char*)*aliasH, bytes, nsnull);
|
||||
DisposeHandle((Handle) aliasH);
|
||||
|
||||
nsFileSpecHelpers::StringAssign(mDescriptorString, buf);
|
||||
PR_Free(buf);
|
||||
#else
|
||||
nsFileSpecHelpers::StringAssign(mDescriptorString, inSpec);
|
||||
#endif // XP_MAC
|
||||
} // nsPersistentFileDescriptor::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsPersistentFileDescriptor::~nsPersistentFileDescriptor()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
delete [] mDescriptorString;
|
||||
} // nsPersistentFileDescriptor::~nsPersistentFileDescriptor
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsPersistentFileDescriptor::GetData(void*& outData, PRInt32& outSize) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
outSize = PL_strlen(mDescriptorString);
|
||||
outData = mDescriptorString;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsPersistentFileDescriptor::SetData(const void* inData, PRInt32 inSize)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
delete [] mDescriptorString;
|
||||
mDescriptorString = new char[1 + inSize];
|
||||
if (!mDescriptorString)
|
||||
return;
|
||||
memcpy(mDescriptorString, inData, inSize);
|
||||
mDescriptorString[inSize] = '\0';
|
||||
}
|
||||
|
||||
#define MAX_PERSISTENT_DATA_SIZE 1000
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsInputStream& operator >> (nsInputStream& s, nsPersistentFileDescriptor& d)
|
||||
// reads the data from a file
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char bigBuffer[MAX_PERSISTENT_DATA_SIZE + 1];
|
||||
// The first 8 bytes of the data should be a hex version of the data size to follow.
|
||||
PRInt32 bytesRead = 8;
|
||||
bytesRead = s.read(bigBuffer, bytesRead);
|
||||
if (bytesRead != 8)
|
||||
return (nsInputFileStream&)s;
|
||||
bigBuffer[8] = '\0';
|
||||
sscanf(bigBuffer, "%lx", &bytesRead);
|
||||
if (bytesRead > MAX_PERSISTENT_DATA_SIZE)
|
||||
return (nsInputFileStream&)s; // preposterous.
|
||||
// Now we know how many bytes to read, do it.
|
||||
s.read(bigBuffer, bytesRead);
|
||||
d.SetData(bigBuffer, bytesRead);
|
||||
return (nsInputFileStream&)s;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& operator << (nsOutputStream& s, const nsPersistentFileDescriptor& d)
|
||||
// writes the data to a file
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char littleBuf[9];
|
||||
PRInt32 dataSize;
|
||||
void* data;
|
||||
d.GetData(data, dataSize);
|
||||
// First write (in hex) the length of the data to follow. Exactly 8 bytes
|
||||
sprintf(littleBuf, "%0.8x", dataSize);
|
||||
s << littleBuf;
|
||||
// Now write the data itself
|
||||
s << d.mDescriptorString;
|
||||
return s;
|
||||
}
|
||||
} // nsNativeFileSpec::operator +
|
||||
|
||||
@@ -22,171 +22,419 @@
|
||||
|
||||
#include "nsFileStream.h"
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <Errors.h>
|
||||
#endif
|
||||
|
||||
//========================================================================================
|
||||
// nsInputStream
|
||||
// nsBasicFileStream
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsInputStream::~nsInputStream()
|
||||
nsBasicFileStream::nsBasicFileStream()
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mFileDesc(0)
|
||||
, mNSPRMode(0)
|
||||
, mFailed(false)
|
||||
, mEOF(false)
|
||||
{
|
||||
mInputStream->Close();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
char nsInputStream::get()
|
||||
nsBasicFileStream::nsBasicFileStream(
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mFileDesc(0)
|
||||
, mNSPRMode(0)
|
||||
, mFailed(false)
|
||||
, mEOF(false)
|
||||
{
|
||||
char c;
|
||||
read(&c, sizeof(c));
|
||||
return c;
|
||||
open(inFile, nsprMode, accessMode);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
static void TidyEndOfLine(char*& cp)
|
||||
// Assumes that cp is pointing at \n or \r. Nulls out the character, checks for
|
||||
// a second terminator (of the opposite persuasion), and returns cp pointing past the
|
||||
// entire eol construct (one or two characters).
|
||||
nsBasicFileStream::nsBasicFileStream(PRFileDesc* desc, int nsprMode)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mFileDesc(desc)
|
||||
, mNSPRMode(nsprMode)
|
||||
, mFailed(false)
|
||||
, mEOF(false)
|
||||
{
|
||||
char ch = *cp;
|
||||
*cp++ = '\0'; // terminate at the newline, then skip past it
|
||||
if ((ch == '\n' && *cp == '\r') || (ch == '\r' && *cp == '\n'))
|
||||
cp++; // possibly a pair.
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsInputStream& nsInputStream::operator >> (char& c)
|
||||
nsBasicFileStream::~nsBasicFileStream()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
c = get();
|
||||
close();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsBasicFileStream::open(
|
||||
const nsFilePath& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mFileDesc)
|
||||
return;
|
||||
|
||||
const int nspr_modes[]={
|
||||
PR_WRONLY | PR_CREATE_FILE,
|
||||
PR_WRONLY | PR_CREATE_FILE | PR_APPEND,
|
||||
PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
|
||||
PR_RDONLY,
|
||||
PR_RDONLY | PR_APPEND,
|
||||
PR_RDWR | PR_CREATE_FILE,
|
||||
PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE,
|
||||
// "wb",
|
||||
// "ab",
|
||||
// "wb",
|
||||
// "rb",
|
||||
// "r+b",
|
||||
// "w+b",
|
||||
0 };
|
||||
const int* currentLegalMode = nspr_modes;
|
||||
while (*currentLegalMode && nsprMode != *currentLegalMode)
|
||||
++currentLegalMode;
|
||||
if (!*currentLegalMode)
|
||||
return;
|
||||
|
||||
#ifdef XP_MAC
|
||||
// Use the file spec to open the file, because one path can be common to
|
||||
// several files on the Macintosh (you can have several volumes with the
|
||||
// same name, see).
|
||||
mFileDesc = 0;
|
||||
if (inFile.GetNativeSpec().Error() != noErr)
|
||||
return;
|
||||
OSErr err = noErr;
|
||||
#if DEBUG
|
||||
const OSType kCreator = 'CWIE';
|
||||
#else
|
||||
const OSType kCreator = 'MOSS';
|
||||
#endif
|
||||
nsNativeFileSpec nativeSpec = inFile.GetNativeSpec();
|
||||
FSSpec* spec = (FSSpec*)nativeSpec;
|
||||
if (nsprMode & PR_CREATE_FILE)
|
||||
err = FSpCreate(spec, kCreator, 'TEXT', 0);
|
||||
if (err == dupFNErr)
|
||||
err = noErr;
|
||||
if (err != noErr)
|
||||
return;
|
||||
|
||||
SInt8 perm;
|
||||
if (nsprMode & PR_RDWR)
|
||||
perm = fsRdWrPerm;
|
||||
else if (nsprMode & PR_WRONLY)
|
||||
perm = fsWrPerm;
|
||||
else
|
||||
perm = fsRdPerm;
|
||||
|
||||
short refnum;
|
||||
err = FSpOpenDF(spec, perm, &refnum);
|
||||
|
||||
if (err == noErr && (nsprMode & PR_TRUNCATE))
|
||||
err = SetEOF(refnum, 0);
|
||||
if (err == noErr && (nsprMode & PR_APPEND))
|
||||
err = SetFPos(refnum, fsFromLEOF, 0);
|
||||
if (err != noErr)
|
||||
return;
|
||||
|
||||
if ((mFileDesc = PR_ImportFile(refnum)) == 0)
|
||||
return;
|
||||
#else
|
||||
// Platforms other than Macintosh...
|
||||
// Another bug in NSPR: Mac PR_Open assumes a unix style path, but Win PR_Open assumes
|
||||
// a windows path.
|
||||
if ((mFileDesc = PR_Open((const char*)nsNativeFileSpec(inFile), nsprMode, accessMode)) == 0)
|
||||
return;
|
||||
#endif
|
||||
mNSPRMode = nsprMode;
|
||||
} // nsFileStreamHelpers::open
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsBasicFileStream::close()
|
||||
// Must precede the destructor because both are inline.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || mFileDesc == 0)
|
||||
return;
|
||||
if (PR_Close(mFileDesc) == PR_SUCCESS)
|
||||
mFileDesc = 0;
|
||||
} // nsBasicFileStream::close
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsBasicFileStream::seek(PRSeekWhence whence, PRInt32 offset)
|
||||
// Must precede the destructor because both are inline.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || mFileDesc == 0)
|
||||
return;
|
||||
mFailed = false; // reset on a seek.
|
||||
mEOF = false; // reset on a seek.
|
||||
PRInt32 position = PR_Seek(mFileDesc, 0, PR_SEEK_CUR);
|
||||
PRInt32 available = PR_Available(mFileDesc);
|
||||
PRInt32 fileSize = position + available;
|
||||
PRInt32 newPosition;
|
||||
switch (whence)
|
||||
{
|
||||
case PR_SEEK_CUR: newPosition = position + offset; break;
|
||||
case PR_SEEK_SET: newPosition = offset; break;
|
||||
case PR_SEEK_END: newPosition = fileSize + offset; break;
|
||||
}
|
||||
if (newPosition < 0)
|
||||
{
|
||||
newPosition = 0;
|
||||
mFailed = true;
|
||||
}
|
||||
else if (newPosition >= fileSize)
|
||||
{
|
||||
newPosition = fileSize;
|
||||
mEOF = true;
|
||||
}
|
||||
if (PR_Seek(mFileDesc, newPosition, PR_SEEK_SET) < 0)
|
||||
mFailed = true;
|
||||
} // nsBasicFileStream::seek
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRIntn nsBasicFileStream::tell() const
|
||||
// Must precede the destructor because both are inline.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || mFileDesc == 0)
|
||||
return -1;
|
||||
return PR_Seek(mFileDesc, 0, PR_SEEK_CUR);
|
||||
} // nsBasicFileStream::tell
|
||||
|
||||
//========================================================================================
|
||||
// nsBasicInStream
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicInStream::nsBasicInStream(nsBasicFileStream& inBasicStream, istream* inStream)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mBase(inBasicStream)
|
||||
, mStdStream(inStream)
|
||||
{
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsBasicInStream::get(char& c)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
read(&c, sizeof(char));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsBasicInStream::readline(char* s, PRInt32 n)
|
||||
// This will truncate if the buffer is too small. Result will always be null-terminated.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
PRBool bufferLargeEnough = true; // result
|
||||
if (!s || !n)
|
||||
return true;
|
||||
PRIntn position = mBase.tell();
|
||||
if (position < 0)
|
||||
return false;
|
||||
PRInt32 bytesRead = read(s, n - 1);
|
||||
if (mBase.failed())
|
||||
return false;
|
||||
s[bytesRead] = '\0'; // always terminate at the end of the buffer
|
||||
char* tp = strpbrk(s, "\n\r");
|
||||
if (tp)
|
||||
{
|
||||
char ch = *tp;
|
||||
*tp++ = '\0'; // terminate at the newline, then skip past it
|
||||
if ((ch == '\n' && *tp == '\r') || (ch == '\r' && *tp == '\n'))
|
||||
tp++; // possibly a pair.
|
||||
bytesRead = (tp - s);
|
||||
}
|
||||
else if (!mBase.eof())
|
||||
bufferLargeEnough = false;
|
||||
position += bytesRead;
|
||||
mBase.seek(position);
|
||||
return bufferLargeEnough;
|
||||
} // nsBasicInStream::getline
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRInt32 nsBasicInStream::read(void* s, PRInt32 n)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
#ifndef NS_USE_PR_STDIO
|
||||
// Calling PR_Read on stdin is sure suicide on Macintosh.
|
||||
if (GetStandardStream())
|
||||
{
|
||||
GetStandardStream()->read((char*)s, n);
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
if (!mBase.is_open() || mBase.failed())
|
||||
return -1;
|
||||
PRInt32 bytesRead = PR_Read(mBase.GetFileDescriptor(), s, n);
|
||||
if (bytesRead < 0)
|
||||
mBase.mFailed = true;
|
||||
else if (bytesRead < n)
|
||||
mBase.mEOF = true;
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicInStream& nsBasicInStream::operator >> (char& c)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
get(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
// nsOutputStream
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream::~nsOutputStream()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mOutputStream->Close();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsOutputStream::put(char c)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
write(&c, sizeof(c));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsOutputStream::flush()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& nsOutputStream::operator << (char c)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
put(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& nsOutputStream::operator << (const char* s)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
write(s, strlen(s));
|
||||
return *this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& nsOutputStream::operator << (short val)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%d", val);
|
||||
return (*this << buf);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& nsOutputStream::operator << (unsigned short val)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%ud", val);
|
||||
return (*this << buf);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& nsOutputStream::operator << (long val)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%ld", val);
|
||||
return (*this << buf);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& nsOutputStream::operator << (unsigned long val)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%uld", val);
|
||||
return (*this << buf);
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
// nsInputFileStream
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsInputFileStream::readline(char* s, PRInt32 n)
|
||||
// This will truncate if the buffer is too small. Result will always be null-terminated.
|
||||
nsInputFileStream::nsInputFileStream(istream* stream)
|
||||
//----------------------------------------------------------------------------------------
|
||||
#ifndef NS_USE_PR_STDIO
|
||||
: nsBasicFileStream(0, kDefaultMode)
|
||||
, nsBasicInStream(*this, stream)
|
||||
#else
|
||||
: nsBasicFileStream(PR_STDIN, kDefaultMode)
|
||||
, nsBasicInStream(*this, 0)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
// nsBasicOutStream
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicOutStream::nsBasicOutStream(nsBasicFileStream& inBase, ostream* stream)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mBase(inBase)
|
||||
, mStdStream(stream)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsBasicOutStream::put(char c)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
PRBool bufferLargeEnough = PR_TRUE; // result
|
||||
if (!s || !n)
|
||||
return PR_TRUE;
|
||||
write(&c, sizeof(c));
|
||||
}
|
||||
|
||||
PRIntn position = tell();
|
||||
if (position < 0)
|
||||
return PR_FALSE;
|
||||
PRInt32 bytesRead = read(s, n - 1);
|
||||
if (failed())
|
||||
return PR_FALSE;
|
||||
s[bytesRead] = '\0'; // always terminate at the end of the buffer
|
||||
char* tp = strpbrk(s, "\n\r");
|
||||
if (tp)
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRInt32 nsBasicOutStream::write(const void* s, PRInt32 n)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
#ifndef NS_USE_PR_STDIO
|
||||
// Calling PR_Write on stdout is sure suicide.
|
||||
if (mStdStream)
|
||||
{
|
||||
TidyEndOfLine(tp);
|
||||
bytesRead = (tp - s);
|
||||
mStdStream->write((const char*)s, n);
|
||||
return n;
|
||||
}
|
||||
else if (!eof())
|
||||
bufferLargeEnough = PR_FALSE;
|
||||
position += bytesRead;
|
||||
seek(position);
|
||||
return bufferLargeEnough;
|
||||
} // nsInputStream::readline
|
||||
#endif
|
||||
if (!mBase.mFileDesc || mBase.failed())
|
||||
return -1;
|
||||
PRInt32 bytesWrit = PR_Write(mBase.mFileDesc, s, n);
|
||||
if (bytesWrit != n)
|
||||
mBase.mFailed = true;
|
||||
return bytesWrit;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicOutStream& nsBasicOutStream::operator << (char c)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
put(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicOutStream& nsBasicOutStream::operator << (const char* s)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
write(s, strlen(s));
|
||||
return *this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicOutStream& nsBasicOutStream::operator << (short val)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%d", val);
|
||||
return *this << buf;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicOutStream& nsBasicOutStream::operator << (unsigned short val)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%ud", val);
|
||||
return *this << buf;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicOutStream& nsBasicOutStream::operator << (long val)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%ld", val);
|
||||
return *this << buf;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsBasicOutStream& nsBasicOutStream::operator << (unsigned long val)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%uld", val);
|
||||
return *this << buf;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsBasicOutStream::flush()
|
||||
// Must precede the destructor because both are inline.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
#ifndef NS_USE_PR_STDIO
|
||||
if (mStdStream)
|
||||
{
|
||||
mStdStream->flush();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (mBase.mFileDesc == 0)
|
||||
return;
|
||||
PRBool itFailed = PR_Sync(mBase.mFileDesc) != PR_SUCCESS;
|
||||
#ifdef XP_MAC
|
||||
// On unix, it seems to fail always.
|
||||
if (itFailed)
|
||||
mBase.mFailed = true;
|
||||
#endif
|
||||
} // nsBasicOutStream::flush
|
||||
|
||||
//========================================================================================
|
||||
// nsOutputFileStream
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsOutputFileStream::flush()
|
||||
nsOutputFileStream::nsOutputFileStream(ostream* stream)
|
||||
//----------------------------------------------------------------------------------------
|
||||
#ifndef NS_USE_PR_STDIO
|
||||
: nsBasicFileStream(0, kDefaultMode)
|
||||
, nsBasicOutStream(*this, stream)
|
||||
#else
|
||||
: nsBasicFileStream(PR_STDOUT, kDefaultMode)
|
||||
, nsBasicOutStream(*this, 0)
|
||||
#endif
|
||||
{
|
||||
if (mFileOutputStream)
|
||||
mFileOutputStream->Flush();
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
@@ -194,10 +442,19 @@ void nsOutputFileStream::flush()
|
||||
//========================================================================================
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsOutputStream& nsEndl(nsOutputStream& os)
|
||||
nsBasicOutStream& nsEndl(nsBasicOutStream& os)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
os.put('\n');
|
||||
os.flush();
|
||||
return os;
|
||||
} // nsEndl
|
||||
#ifndef NS_USE_PR_STDIO
|
||||
// Calling PR_Write on stdout is sure suicide on Macintosh.
|
||||
ostream* stream = os.GetStandardStream();
|
||||
if (stream)
|
||||
{
|
||||
*stream << std::endl;
|
||||
return os;
|
||||
}
|
||||
#endif
|
||||
os.put('\n');
|
||||
os.flush();
|
||||
return os;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#include "nsCaretProperties.h"
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
nsCaretProperties::nsCaretProperties()
|
||||
: mCaretWidth(eDefaultCaretWidth)
|
||||
, mBlinkRate(eDefaulBlinkRate)
|
||||
{
|
||||
// in your platform-specific class, get data from the OS in your constructor
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
nsCaretProperties* NewCaretProperties()
|
||||
{
|
||||
return new nsCaretProperties();
|
||||
}
|
||||
@@ -35,8 +35,6 @@ class nsISizeOfHandler;
|
||||
*/
|
||||
class nsIAtom : public nsISupports {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IATOM_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Translate the unicode string into the stringbuf.
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
class nsIBaseStream : public nsISupports {
|
||||
public:
|
||||
|
||||
static const nsIID& IID() { static nsIID iid = NS_IBASESTREAM_IID; return iid; }
|
||||
|
||||
/** Close the stream. */
|
||||
NS_IMETHOD
|
||||
Close(void) = 0;
|
||||
|
||||
@@ -1,451 +0,0 @@
|
||||
#include "nsIFileStream.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
#include "prerror.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include "pprio.h" // To get PR_ImportFile
|
||||
#else
|
||||
#include "prio.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <Errors.h>
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
//========================================================================================
|
||||
class FileImpl
|
||||
: public nsIOutputStream
|
||||
, public nsIInputStream
|
||||
, public nsIFileOutputStream
|
||||
, public nsIFileInputStream
|
||||
, public nsIFile
|
||||
//========================================================================================
|
||||
{
|
||||
public:
|
||||
FileImpl(PRFileDesc* inDesc)
|
||||
: mFileDesc(inDesc)
|
||||
, mFailed(PR_FALSE)
|
||||
, mEOF(PR_FALSE)
|
||||
, mLength(-1)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
FileImpl(
|
||||
const nsFileSpec& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode)
|
||||
: mFileDesc(nsnull)
|
||||
, mFailed(PR_FALSE)
|
||||
, mEOF(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
Open(inFile, nsprMode, accessMode);
|
||||
}
|
||||
virtual ~FileImpl()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFile interface
|
||||
NS_IMETHOD Open(
|
||||
const nsFileSpec& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode);
|
||||
NS_IMETHOD Close();
|
||||
NS_IMETHOD Seek(PRSeekWhence whence, PRInt32 offset);
|
||||
|
||||
NS_IMETHOD GetIsOpen(PRBool* outOpen)
|
||||
{
|
||||
*outOpen = (mFileDesc != nsnull);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Tell(PRIntn* outWhere);
|
||||
|
||||
// nsIInputStream interface
|
||||
NS_IMETHOD GetLength(PRUint32 *aLength)
|
||||
{
|
||||
NS_PRECONDITION(aLength != nsnull, "null ptr");
|
||||
if (!aLength)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (mLength < 0)
|
||||
return NS_FILE_RESULT(NS_ERROR_UNEXPECTED);
|
||||
*aLength = mLength;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Read(char* aBuf,
|
||||
PRUint32 aOffset,
|
||||
PRUint32 aCount,
|
||||
PRUint32 *aReadCount)
|
||||
{
|
||||
NS_PRECONDITION(aBuf != nsnull, "null ptr");
|
||||
if (!aBuf)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_PRECONDITION(aReadCount != nsnull, "null ptr");
|
||||
if (!aReadCount)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (!mFileDesc)
|
||||
return NS_FILE_RESULT(PR_BAD_DESCRIPTOR_ERROR);
|
||||
if (mFailed)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (aOffset)
|
||||
PR_Seek(mFileDesc, aOffset, PR_SEEK_CUR);
|
||||
PRInt32 bytesRead = PR_Read(mFileDesc, aBuf, aCount);
|
||||
if (bytesRead < 0)
|
||||
{
|
||||
*aReadCount = 0;
|
||||
mFailed = PR_TRUE;
|
||||
return NS_FILE_RESULT(PR_GetError());
|
||||
}
|
||||
*aReadCount = bytesRead;
|
||||
return NS_OK;
|
||||
}
|
||||
// nsIOutputStream interface
|
||||
NS_IMETHOD Write(const char* aBuf,
|
||||
PRUint32 aOffset,
|
||||
PRUint32 aCount,
|
||||
PRUint32 *aWriteCount)
|
||||
{
|
||||
NS_PRECONDITION(aBuf != nsnull, "null ptr");
|
||||
NS_PRECONDITION(aWriteCount != nsnull, "null ptr");
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
// Calling PR_Write on stdout is sure suicide.
|
||||
if (mFileDesc == PR_STDOUT || mFileDesc == PR_STDERR)
|
||||
{
|
||||
cout.write(aBuf, aCount);
|
||||
*aWriteCount = aCount;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
if (!mFileDesc)
|
||||
return NS_FILE_RESULT(PR_BAD_DESCRIPTOR_ERROR);
|
||||
if (mFailed)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (aOffset)
|
||||
PR_Seek(mFileDesc, aOffset, PR_SEEK_CUR);
|
||||
PRInt32 bytesWrit = PR_Write(mFileDesc, aBuf, aCount);
|
||||
if (bytesWrit != aCount)
|
||||
{
|
||||
mFailed = PR_TRUE;
|
||||
*aWriteCount = 0;
|
||||
return NS_FILE_RESULT(PR_GetError());
|
||||
}
|
||||
*aWriteCount = bytesWrit;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Flush();
|
||||
|
||||
protected:
|
||||
|
||||
PRFileDesc* mFileDesc;
|
||||
int mNSPRMode;
|
||||
PRBool mFailed;
|
||||
PRBool mEOF;
|
||||
PRInt32 mLength;
|
||||
}; // class FileImpl
|
||||
|
||||
#define SAY_I_IMPLEMENT(classname) \
|
||||
if (aIID.Equals(classname::IID())) \
|
||||
{ \
|
||||
*aInstancePtr = (void*)((classname*)this); \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
NS_IMPL_RELEASE(FileImpl)
|
||||
NS_IMPL_ADDREF(FileImpl)
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP FileImpl::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (!aInstancePtr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aInstancePtr = nsnull;
|
||||
|
||||
SAY_I_IMPLEMENT(nsIFile)
|
||||
SAY_I_IMPLEMENT(nsIOutputStream)
|
||||
SAY_I_IMPLEMENT(nsIInputStream)
|
||||
SAY_I_IMPLEMENT(nsIFileInputStream)
|
||||
SAY_I_IMPLEMENT(nsIFileOutputStream)
|
||||
// Note that we derive from two copies of nsIBaseStream (and hence
|
||||
// of nsISupports), one through
|
||||
// nsIOutputStream, the other through nsIInputStream. Resolve this
|
||||
// by giving them a specific one
|
||||
if (aIID.Equals(((nsIBaseStream*)(nsIOutputStream*)this)->IID()))
|
||||
{
|
||||
*aInstancePtr = (void*)((nsIBaseStream*)(nsIOutputStream*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(((nsISupports*)(nsIOutputStream*)this)->IID()))
|
||||
{
|
||||
*aInstancePtr = (void*)((nsISupports*)(nsIOutputStream*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
} // FileImpl::QueryInterface
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP FileImpl::Open(
|
||||
const nsFileSpec& inFile,
|
||||
int nsprMode,
|
||||
PRIntn accessMode)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mFileDesc)
|
||||
if ((nsprMode & mNSPRMode) == nsprMode)
|
||||
return NS_OK;
|
||||
else
|
||||
return NS_FILE_RESULT(PR_ILLEGAL_ACCESS_ERROR);
|
||||
|
||||
const int nspr_modes[]={
|
||||
PR_WRONLY | PR_CREATE_FILE,
|
||||
PR_WRONLY | PR_CREATE_FILE | PR_APPEND,
|
||||
PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
|
||||
PR_RDONLY,
|
||||
PR_RDONLY | PR_APPEND,
|
||||
PR_RDWR | PR_CREATE_FILE,
|
||||
PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE,
|
||||
// "wb",
|
||||
// "ab",
|
||||
// "wb",
|
||||
// "rb",
|
||||
// "r+b",
|
||||
// "w+b",
|
||||
0 };
|
||||
const int* currentLegalMode = nspr_modes;
|
||||
while (*currentLegalMode && nsprMode != *currentLegalMode)
|
||||
++currentLegalMode;
|
||||
if (!*currentLegalMode)
|
||||
return NS_FILE_RESULT(PR_ILLEGAL_ACCESS_ERROR);
|
||||
|
||||
#ifdef XP_MAC
|
||||
// Use the file spec to open the file, because one path can be common to
|
||||
// several files on the Macintosh (you can have several volumes with the
|
||||
// same name, see).
|
||||
mFileDesc = 0;
|
||||
if (inFile.Error() != noErr)
|
||||
return NS_FILE_RESULT(inFile.Error());
|
||||
OSErr err = noErr;
|
||||
#if DEBUG
|
||||
const OSType kCreator = 'CWIE';
|
||||
#else
|
||||
const OSType kCreator = 'MOSS';
|
||||
#endif
|
||||
// Resolve the alias to the original file.
|
||||
nsFileSpec original = inFile;
|
||||
PRBool ignoredResult;
|
||||
original.ResolveAlias(ignoredResult);
|
||||
const FSSpec& spec = original.operator const FSSpec&();
|
||||
if (nsprMode & PR_CREATE_FILE)
|
||||
err = FSpCreate(&spec, kCreator, 'TEXT', 0);
|
||||
if (err == dupFNErr)
|
||||
err = noErr;
|
||||
if (err != noErr)
|
||||
return NS_FILE_RESULT(err);
|
||||
|
||||
SInt8 perm;
|
||||
if (nsprMode & PR_RDWR)
|
||||
perm = fsRdWrPerm;
|
||||
else if (nsprMode & PR_WRONLY)
|
||||
perm = fsWrPerm;
|
||||
else
|
||||
perm = fsRdPerm;
|
||||
|
||||
short refnum;
|
||||
err = FSpOpenDF(&spec, perm, &refnum);
|
||||
|
||||
if (err == noErr && (nsprMode & PR_TRUNCATE))
|
||||
err = SetEOF(refnum, 0);
|
||||
if (err == noErr && (nsprMode & PR_APPEND))
|
||||
err = SetFPos(refnum, fsFromLEOF, 0);
|
||||
if (err != noErr)
|
||||
return NS_FILE_RESULT(err);
|
||||
|
||||
if ((mFileDesc = PR_ImportFile(refnum)) == 0)
|
||||
return NS_FILE_RESULT(PR_GetError());
|
||||
#else
|
||||
// Platforms other than Macintosh...
|
||||
// Another bug in NSPR: Mac PR_Open assumes a unix style path, but Win PR_Open assumes
|
||||
// a windows path.
|
||||
if ((mFileDesc = PR_Open((const char*)nsFileSpec(inFile), nsprMode, accessMode)) == 0)
|
||||
return NS_FILE_RESULT(PR_GetError());
|
||||
#endif
|
||||
mNSPRMode = nsprMode;
|
||||
mLength = PR_Available(mFileDesc);
|
||||
return NS_OK;
|
||||
} // FileImpl::Open
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP FileImpl::Seek(PRSeekWhence whence, PRInt32 offset)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || !mFileDesc)
|
||||
return NS_FILE_RESULT(PR_BAD_DESCRIPTOR_ERROR);
|
||||
mFailed = PR_FALSE; // reset on a seek.
|
||||
mEOF = PR_FALSE; // reset on a seek.
|
||||
PRInt32 position = PR_Seek(mFileDesc, 0, PR_SEEK_CUR);
|
||||
PRInt32 available = PR_Available(mFileDesc);
|
||||
PRInt32 fileSize = position + available;
|
||||
PRInt32 newPosition;
|
||||
switch (whence)
|
||||
{
|
||||
case PR_SEEK_CUR: newPosition = position + offset; break;
|
||||
case PR_SEEK_SET: newPosition = offset; break;
|
||||
case PR_SEEK_END: newPosition = fileSize + offset; break;
|
||||
}
|
||||
if (newPosition < 0)
|
||||
{
|
||||
newPosition = 0;
|
||||
mFailed = PR_TRUE;
|
||||
}
|
||||
else if (newPosition >= fileSize)
|
||||
{
|
||||
newPosition = fileSize;
|
||||
mEOF = PR_TRUE;
|
||||
}
|
||||
if (PR_Seek(mFileDesc, newPosition, PR_SEEK_SET) < 0)
|
||||
mFailed = PR_TRUE;
|
||||
return NS_OK;
|
||||
} // FileImpl::Seek
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP FileImpl::Tell(PRIntn* outWhere)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || !mFileDesc)
|
||||
return NS_FILE_RESULT(PR_BAD_DESCRIPTOR_ERROR);
|
||||
*outWhere = PR_Seek(mFileDesc, 0, PR_SEEK_CUR);
|
||||
return NS_OK;
|
||||
} // FileImpl::Tell
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP FileImpl::Close()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || !mFileDesc)
|
||||
return NS_OK;
|
||||
if (PR_Close(mFileDesc) == PR_SUCCESS)
|
||||
mFileDesc = 0;
|
||||
else
|
||||
return NS_FILE_RESULT(PR_GetError());
|
||||
return NS_OK;
|
||||
} // FileImpl::close
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP FileImpl::Flush()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
if (mFileDesc == PR_STDOUT || mFileDesc == PR_STDERR)
|
||||
{
|
||||
cout.flush();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
if (!mFileDesc)
|
||||
return NS_FILE_RESULT(PR_BAD_DESCRIPTOR_ERROR);
|
||||
PRBool itFailed = PR_Sync(mFileDesc) != PR_SUCCESS;
|
||||
#ifdef XP_MAC
|
||||
// On unix, it seems to fail always.
|
||||
if (itFailed)
|
||||
mFailed = PR_TRUE;
|
||||
#endif
|
||||
return NS_OK;
|
||||
} // FileImpl::flush
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE nsresult NS_NewTypicalInputFileStream(
|
||||
nsISupports** aResult,
|
||||
const nsFileSpec& inFile
|
||||
/*Default nsprMode == PR_RDONLY*/
|
||||
/*Default accessmode = 0700 (octal)*/)
|
||||
// Factory method to get an nsInputStream from a file, using most common options
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return NS_NewIOFileStream(aResult, inFile, PR_RDONLY, 0700);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE nsresult NS_NewOutputConsoleStream(
|
||||
nsISupports** aResult)
|
||||
// Factory method to get an nsOutputStream to the console.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
FileImpl* stream = new FileImpl(PR_STDOUT);
|
||||
if (! stream)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(stream);
|
||||
*aResult = (nsISupports*)(void*)stream;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE nsresult NS_NewTypicalOutputFileStream(
|
||||
nsISupports** aResult,
|
||||
const nsFileSpec& inFile
|
||||
/*default nsprMode= (PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE)*/
|
||||
/*Default accessMode= 0700 (octal)*/)
|
||||
// Factory method to get an nsOutputStream to a file - most common case.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return NS_NewIOFileStream(
|
||||
aResult,
|
||||
inFile,
|
||||
(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE),
|
||||
0700);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE nsresult NS_NewIOFileStream(
|
||||
nsISupports** aResult,
|
||||
const nsFileSpec& inFile,
|
||||
PRInt32 nsprMode /*default = (PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE)*/,
|
||||
PRInt32 accessMode /*Default = 0700 (octal)*/)
|
||||
// Factory method to get an object that implements both nsIInputStream
|
||||
// and nsIOutputStream, associated with a file.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
FileImpl* stream = new FileImpl(inFile, nsprMode, accessMode);
|
||||
if (! stream)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(stream);
|
||||
*aResult = (nsISupports*)(void*)stream;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_BASE nsresult NS_NewTypicalIOFileStream(
|
||||
nsISupports** aResult,
|
||||
const nsFileSpec& inFile
|
||||
/*default nsprMode= (PR_RDWR | PR_CREATE_FILE)*/
|
||||
/*Default accessMode= 0700 (octal)*/)
|
||||
// Factory method to get an object that implements both nsIInputStream
|
||||
// and nsIOutputStream, associated with a single file.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return NS_NewIOFileStream(
|
||||
aResult,
|
||||
inFile,
|
||||
(PR_RDWR | PR_CREATE_FILE),
|
||||
0700);
|
||||
}
|
||||
@@ -28,8 +28,6 @@
|
||||
class nsIInputStream : public nsIBaseStream {
|
||||
public:
|
||||
|
||||
static const nsIID& IID() { static nsIID iid = NS_IINPUTSTREAM_IID; return iid; }
|
||||
|
||||
/** Return the number of bytes in the stream
|
||||
* @param aLength out parameter to hold the length
|
||||
* of the stream. if an error occurs, the length
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
class nsIOutputStream : public nsIBaseStream {
|
||||
public:
|
||||
|
||||
static const nsIID& IID() { static nsIID iid = NS_IOUTPUTSTREAM_IID; return iid; }
|
||||
|
||||
/** Write data into the stream.
|
||||
* @param aBuf the buffer into which the data is read
|
||||
* @param aOffset the start offset of the data
|
||||
|
||||
@@ -25,6 +25,11 @@ class nsString;
|
||||
{ 0x2d97fbf0, 0x93b5, 0x11d1, \
|
||||
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
|
||||
#define NS_IB2UCONVERTER_IID \
|
||||
{ 0x35e40290, 0x93b5, 0x11d1, \
|
||||
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
|
||||
|
||||
/** Abstract unicode character input stream
|
||||
* @see nsIInputStream
|
||||
*/
|
||||
@@ -47,6 +52,21 @@ extern NS_BASE nsresult
|
||||
NS_NewStringUnicharInputStream(nsIUnicharInputStream** aInstancePtrResult,
|
||||
nsString* aString);
|
||||
|
||||
/// Abstract interface for converting from bytes to unicode characters
|
||||
class nsIB2UConverter : public nsISupports {
|
||||
public:
|
||||
/** aDstLen is updated to indicate how much data was translated into
|
||||
* aDst; aSrcLen is updated to indicate how much data was used in
|
||||
* the source buffer.
|
||||
*/
|
||||
NS_IMETHOD Convert(PRUnichar* aDst,
|
||||
PRUint32 aDstOffset,
|
||||
PRUint32& aDstLen,
|
||||
const char* aSrc,
|
||||
PRUint32 aSrcOffset,
|
||||
PRUint32& aSrcLen) = 0;
|
||||
};
|
||||
|
||||
/** Create a new nsUnicharInputStream that provides a converter for the
|
||||
* byte input stream aStreamToWrap. If no converter can be found then
|
||||
* nsnull is returned and the error code is set to
|
||||
@@ -59,4 +79,13 @@ extern NS_BASE nsresult
|
||||
PRInt32 aBufferSize = 0,
|
||||
nsString* aCharSet = nsnull);
|
||||
|
||||
/** Create a new nsB2UConverter for the given character set. When given
|
||||
* nsnull, the converter for iso-latin1 to unicode is provided. If no
|
||||
* converter can be found, nsnull is returned.
|
||||
*/
|
||||
extern NS_BASE nsresult
|
||||
NS_NewB2UConverter(nsIB2UConverter** aInstancePtrResult,
|
||||
nsISupports* aOuter,
|
||||
nsString* aCharSet = nsnull);
|
||||
|
||||
#endif /* nsUnicharInputStream_h___ */
|
||||
|
||||
@@ -32,7 +32,7 @@ class nsProperties : public nsIProperties
|
||||
{
|
||||
public:
|
||||
nsProperties();
|
||||
virtual ~nsProperties();
|
||||
~nsProperties();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
@@ -61,19 +61,9 @@ nsProperties::nsProperties()
|
||||
mTable = nsnull;
|
||||
}
|
||||
|
||||
PR_CALLBACK PRIntn
|
||||
FreeHashEntries(PLHashEntry* he, PRIntn i, void* arg)
|
||||
{
|
||||
delete[] (PRUnichar*)he->key;
|
||||
delete[] (PRUnichar*)he->value;
|
||||
return HT_ENUMERATE_REMOVE;
|
||||
}
|
||||
|
||||
nsProperties::~nsProperties()
|
||||
{
|
||||
if (mTable) {
|
||||
// Free the PRUnicode* pointers contained in the hash table entries
|
||||
PL_HashTableEnumerateEntries(mTable, FreeHashEntries, 0);
|
||||
PL_HashTableDestroy(mTable);
|
||||
mTable = nsnull;
|
||||
}
|
||||
@@ -136,8 +126,7 @@ nsProperties::Load(nsIInputStream *aIn)
|
||||
}
|
||||
}
|
||||
mIn->Close();
|
||||
NS_RELEASE(mIn);
|
||||
NS_ASSERTION(!mIn, "unexpected remaining reference");
|
||||
mIn = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -158,11 +147,7 @@ NS_IMETHODIMP
|
||||
nsProperties::SetProperty(const nsString& aKey, nsString& aNewValue,
|
||||
nsString& aOldValue)
|
||||
{
|
||||
// XXX The ToNewCString() calls allocate memory using "new" so this code
|
||||
// causes a memory leak...
|
||||
#if 0
|
||||
cout << "will add " << aKey.ToNewCString() << "=" << aNewValue.ToNewCString() << endl;
|
||||
#endif
|
||||
if (!mTable) {
|
||||
mTable = PL_NewHashTable(8, (PLHashFunction) HashKey,
|
||||
(PLHashComparator) CompareKeys,
|
||||
@@ -172,16 +157,16 @@ nsProperties::SetProperty(const nsString& aKey, nsString& aNewValue,
|
||||
}
|
||||
}
|
||||
|
||||
const PRUnichar *key = aKey.GetUnicode(); // returns internal pointer (not a copy)
|
||||
PRUint32 len;
|
||||
PRUnichar *key = aKey.ToNewUnicode();
|
||||
PRInt32 len;
|
||||
PRUint32 hashValue = nsCRT::HashValue(key, &len);
|
||||
PLHashEntry **hep = PL_HashTableRawLookup(mTable, hashValue, key);
|
||||
PLHashEntry *he = *hep;
|
||||
if (he && aOldValue) {
|
||||
// XXX fix me
|
||||
}
|
||||
PL_HashTableRawAdd(mTable, hep, hashValue, aKey.ToNewUnicode(),
|
||||
aNewValue.ToNewUnicode());
|
||||
PL_HashTableRawAdd(mTable, hep, hashValue, key,
|
||||
new nsString(aNewValue.ToNewUnicode()));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -205,13 +190,13 @@ nsProperties::Subclass(nsIProperties* aSubclass)
|
||||
NS_IMETHODIMP
|
||||
nsProperties::GetProperty(const nsString& aKey, nsString& aValue)
|
||||
{
|
||||
const PRUnichar *key = aKey;
|
||||
PRUint32 len;
|
||||
PRUnichar *key = aKey;
|
||||
PRInt32 len;
|
||||
PRUint32 hashValue = nsCRT::HashValue(key, &len);
|
||||
PLHashEntry **hep = PL_HashTableRawLookup(mTable, hashValue, key);
|
||||
PLHashEntry *he = *hep;
|
||||
if (he) {
|
||||
aValue = (const PRUnichar*)he->value;
|
||||
((nsString *) he->value)->Copy(aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -262,15 +247,6 @@ nsProperties::SkipLine(PRInt32 c)
|
||||
return c;
|
||||
}
|
||||
|
||||
nsPropertiesFactory::nsPropertiesFactory()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsPropertiesFactory::~nsPropertiesFactory()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsPropertiesFactory, kIFactoryIID);
|
||||
|
||||
@@ -21,12 +21,9 @@
|
||||
|
||||
#include "nsIFactory.h"
|
||||
|
||||
class nsPropertiesFactory : public nsIFactory
|
||||
class nsPropertiesFactory : nsIFactory
|
||||
{
|
||||
public:
|
||||
nsPropertiesFactory();
|
||||
virtual ~nsPropertiesFactory();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports* aOuter, REFNSIID aIID,
|
||||
|
||||
@@ -27,11 +27,6 @@
|
||||
#include "prdtoa.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
|
||||
#include "nsUnicharUtilCIID.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICaseConversion.h"
|
||||
|
||||
const PRInt32 kGrowthDelta = 8;
|
||||
const PRInt32 kNotFound = -1;
|
||||
PRUnichar gBadChar = 0;
|
||||
@@ -101,57 +96,6 @@ public:
|
||||
};
|
||||
static CTableConstructor gTableConstructor;
|
||||
|
||||
//---- XPCOM code to connect with UnicharUtil
|
||||
|
||||
class HandleCaseConversionShutdown2 : public nsIShutdownListener {
|
||||
public :
|
||||
NS_IMETHOD OnShutdown(const nsCID& cid, nsISupports* service);
|
||||
HandleCaseConversionShutdown2(void) { NS_INIT_REFCNT(); }
|
||||
virtual ~HandleCaseConversionShutdown2(void) {}
|
||||
NS_DECL_ISUPPORTS
|
||||
};
|
||||
static NS_DEFINE_CID(kUnicharUtilCID, NS_UNICHARUTIL_CID);
|
||||
static NS_DEFINE_IID(kICaseConversionIID, NS_ICASECONVERSION_IID);
|
||||
|
||||
static nsICaseConversion * gCaseConv = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kIShutdownListenerIID, NS_ISHUTDOWNLISTENER_IID);
|
||||
NS_IMPL_ISUPPORTS(HandleCaseConversionShutdown2, kIShutdownListenerIID);
|
||||
|
||||
nsresult
|
||||
HandleCaseConversionShutdown2::OnShutdown(const nsCID& cid, nsISupports* service)
|
||||
{
|
||||
if (cid.Equals(kUnicharUtilCID)) {
|
||||
NS_ASSERTION(service == gCaseConv, "wrong service!");
|
||||
nsrefcnt cnt = gCaseConv->Release();
|
||||
gCaseConv = NULL;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static HandleCaseConversionShutdown2* gListener = NULL;
|
||||
|
||||
static void StartUpCaseConversion()
|
||||
{
|
||||
nsresult err;
|
||||
|
||||
if ( NULL == gListener )
|
||||
{
|
||||
gListener = new HandleCaseConversionShutdown2();
|
||||
gListener->AddRef();
|
||||
}
|
||||
err = nsServiceManager::GetService(kUnicharUtilCID, kICaseConversionIID,
|
||||
(nsISupports**) &gCaseConv, gListener);
|
||||
}
|
||||
static void CheckCaseConversion()
|
||||
{
|
||||
if(NULL == gCaseConv )
|
||||
StartUpCaseConversion();
|
||||
|
||||
NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
IMPLEMENTATION NOTES:
|
||||
|
||||
@@ -350,7 +294,7 @@ const PRUnichar* nsString::GetUnicode(void) const{
|
||||
return mStr;
|
||||
}
|
||||
|
||||
nsString::operator const PRUnichar*() const{
|
||||
nsString::operator PRUnichar*() const{
|
||||
return mStr;
|
||||
}
|
||||
|
||||
@@ -487,14 +431,6 @@ nsString nsString::operator+(PRUnichar aChar) {
|
||||
*/
|
||||
void nsString::ToLowerCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
chartype* cp = mStr;
|
||||
chartype* end = cp + mLength;
|
||||
while (cp < end) {
|
||||
@@ -512,14 +448,6 @@ void nsString::ToLowerCase()
|
||||
*/
|
||||
void nsString::ToUpperCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
chartype* cp = mStr;
|
||||
chartype* end = cp + mLength;
|
||||
while (cp < end) {
|
||||
@@ -540,8 +468,7 @@ void nsString::ToUCS2(PRInt32 aStartOffset){
|
||||
chartype* end = cp + mLength;
|
||||
while (cp < end) {
|
||||
unsigned char ch = (unsigned char)*cp;
|
||||
if( 0x0080 == (0xFFE0 & (*cp)) ) // limit to only 0x0080 to 0x009F
|
||||
*cp=gToUCS2[ch];
|
||||
*cp=gToUCS2[ch];
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
@@ -559,17 +486,6 @@ void nsString::ToLowerCase(nsString& aOut) const
|
||||
{
|
||||
aOut.EnsureCapacityFor(mLength);
|
||||
aOut.mLength = mLength;
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
|
||||
chartype* to = aOut.mStr;
|
||||
chartype* from = mStr;
|
||||
chartype* end = from + mLength;
|
||||
@@ -593,16 +509,6 @@ void nsString::ToUpperCase(nsString& aOut) const
|
||||
{
|
||||
aOut.EnsureCapacityFor(mLength);
|
||||
aOut.mLength = mLength;
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
chartype* to = aOut.mStr;
|
||||
chartype* from = mStr;
|
||||
chartype* end = from + mLength;
|
||||
@@ -1358,13 +1264,12 @@ nsString& nsString::Trim(const char* aTrimSet,
|
||||
nsString& nsString::CompressWhitespace( PRBool aEliminateLeading,
|
||||
PRBool aEliminateTrailing)
|
||||
{
|
||||
|
||||
Trim(" \r\n\t",aEliminateLeading,aEliminateTrailing);
|
||||
|
||||
PRUnichar* from = mStr;
|
||||
PRUnichar* end = mStr + mLength;
|
||||
PRUnichar* to = from;
|
||||
|
||||
Trim(" \r\n\t",aEliminateLeading,aEliminateTrailing);
|
||||
|
||||
//this code converts /n, /t, /r into normal space ' ';
|
||||
//it also eliminates runs of whitespace...
|
||||
while (from < end) {
|
||||
@@ -1400,28 +1305,6 @@ nsString& nsString::StripWhitespace()
|
||||
return StripChars("\r\t\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to replace all occurances of the
|
||||
* given source char with the given dest char
|
||||
*
|
||||
* @param
|
||||
* @return *this
|
||||
*/
|
||||
nsString& nsString::ReplaceChar(PRUnichar aSourceChar, PRUnichar aDestChar) {
|
||||
PRUnichar* from = mStr;
|
||||
PRUnichar* end = mStr + mLength;
|
||||
|
||||
while (from < end) {
|
||||
PRUnichar ch = *from;
|
||||
if(ch==aSourceChar) {
|
||||
*from = aDestChar;
|
||||
}
|
||||
from++;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
@@ -1798,7 +1681,6 @@ PRInt32 nsString::Compare(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 aL
|
||||
PRBool nsString::operator==(const nsString &S) const {return Equals(S);}
|
||||
PRBool nsString::operator==(const char *s) const {return Equals(s);}
|
||||
PRBool nsString::operator==(const PRUnichar *s) const {return Equals(s);}
|
||||
PRBool nsString::operator==(PRUnichar *s) const {return Equals(s);}
|
||||
PRBool nsString::operator!=(const nsString &S) const {return PRBool(Compare(S)!=0);}
|
||||
PRBool nsString::operator!=(const char *s) const {return PRBool(Compare(s)!=0);}
|
||||
PRBool nsString::operator!=(const PRUnichar *s) const {return PRBool(Compare(s)!=0);}
|
||||
|
||||
@@ -136,7 +136,7 @@ const PRUnichar* GetUnicode(void) const;
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
operator const PRUnichar*() const;
|
||||
operator PRUnichar*() const;
|
||||
|
||||
/**
|
||||
* Retrieve unicode char at given index
|
||||
@@ -499,15 +499,6 @@ nsString& Cut(PRInt32 anOffset,PRInt32 aCount);
|
||||
*/
|
||||
nsString& StripChars(const char* aSet);
|
||||
|
||||
/**
|
||||
* This method is used to replace all occurances of the
|
||||
* given source char with the given dest char
|
||||
*
|
||||
* @param
|
||||
* @return *this
|
||||
*/
|
||||
nsString& ReplaceChar(PRUnichar aSourceChar, PRUnichar aDestChar);
|
||||
|
||||
/**
|
||||
* This method strips whitespace throughout the string
|
||||
*
|
||||
@@ -657,7 +648,6 @@ virtual PRInt32 Compare(const PRUnichar *aString,PRBool aIgnoreCase=PR_FALSE,PRI
|
||||
PRBool operator==(const nsString &aString) const;
|
||||
PRBool operator==(const char *aString) const;
|
||||
PRBool operator==(const PRUnichar* aString) const;
|
||||
PRBool operator==(PRUnichar* aString) const;
|
||||
|
||||
/**
|
||||
* These methods perform a !compare of a given string type to this
|
||||
@@ -786,7 +776,6 @@ public:
|
||||
virtual ~nsAutoString();
|
||||
|
||||
nsAutoString& operator=(const nsString& aString) {nsString::operator=(aString); return *this;}
|
||||
nsAutoString& operator=(const nsAutoString& aString) {nsString::operator=(aString); return *this;}
|
||||
nsAutoString& operator=(const char* aCString) {nsString::operator=(aCString); return *this;}
|
||||
nsAutoString& operator=(char aChar) {nsString::operator=(aChar); return *this;}
|
||||
nsAutoString& operator=(const PRUnichar* aBuffer) {nsString::operator=(aBuffer); return *this;}
|
||||
|
||||
@@ -15,14 +15,9 @@
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define NS_IMPL_IDS
|
||||
#include "nsIUnicharInputStream.h"
|
||||
#include "nsIByteBuffer.h"
|
||||
#include "nsIUnicharBuffer.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include <fcntl.h>
|
||||
@@ -120,34 +115,66 @@ NS_NewStringUnicharInputStream(nsIUnicharInputStream** aInstancePtrResult,
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This function used to be public, with the NS_BASE declaration. I am
|
||||
* changing it right now into a module private visibility because there are
|
||||
* better and more xpcom-like ways to get a Converter.
|
||||
*/
|
||||
nsresult
|
||||
NS_NewB2UConverter(nsIUnicodeDecoder** aInstancePtrResult,
|
||||
class IsoLatin1Converter : public nsIB2UConverter {
|
||||
public:
|
||||
IsoLatin1Converter();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD Convert(PRUnichar* aDst,
|
||||
PRUint32 aDstOffset,
|
||||
PRUint32& aDstLen,
|
||||
const char* aSrc,
|
||||
PRUint32 aSrcOffset,
|
||||
PRUint32& aSrcLen);
|
||||
};
|
||||
|
||||
IsoLatin1Converter::IsoLatin1Converter()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIB2UConverterIID, NS_IB2UCONVERTER_IID);
|
||||
NS_IMPL_ISUPPORTS(IsoLatin1Converter,kIB2UConverterIID);
|
||||
|
||||
nsresult IsoLatin1Converter::Convert(PRUnichar* aDst,
|
||||
PRUint32 aDstOffset,
|
||||
PRUint32& aDstLen,
|
||||
const char* aSrc,
|
||||
PRUint32 aSrcOffset,
|
||||
PRUint32& aSrcLen)
|
||||
{
|
||||
PRUint32 amount = aSrcLen;
|
||||
if (aSrcLen > aDstLen) {
|
||||
amount = aDstLen;
|
||||
}
|
||||
const char* end = aSrc + amount;
|
||||
while (aSrc < end) {
|
||||
PRUint8 isoLatin1 = PRUint8(*aSrc++);
|
||||
/* XXX insert table based lookup converter here */
|
||||
*aDst++ = isoLatin1;
|
||||
}
|
||||
aDstLen = amount;
|
||||
aSrcLen = amount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_BASE nsresult
|
||||
NS_NewB2UConverter(nsIB2UConverter** aInstancePtrResult,
|
||||
nsISupports* aOuter,
|
||||
nsString* aCharSet)
|
||||
{
|
||||
if (nsnull != aOuter) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
// Create converter
|
||||
nsresult res;
|
||||
nsICharsetConverterManager * ccm;
|
||||
nsAutoString defaultCharset("ISO-8859-1");
|
||||
|
||||
if (aCharSet == nsnull) aCharSet = &defaultCharset;
|
||||
res = nsServiceManager::GetService(kCharsetConverterManagerCID,
|
||||
kICharsetConverterManagerIID, (nsISupports**)&ccm);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = ccm->GetUnicodeDecoder(aCharSet, aInstancePtrResult);
|
||||
nsServiceManager::ReleaseService(kCharsetConverterManagerCID, ccm);
|
||||
|
||||
return res;
|
||||
// We cannot use enum to pass charset id
|
||||
if ((nsnull != aCharSet) && (! aCharSet->EqualsIgnoreCase( "iso-8859-1" ))){
|
||||
return NS_BASE_STREAM_NO_CONVERTER;
|
||||
}
|
||||
IsoLatin1Converter* it = new IsoLatin1Converter();
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIB2UConverterIID, (void**)aInstancePtrResult);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -155,7 +182,7 @@ NS_NewB2UConverter(nsIUnicodeDecoder** aInstancePtrResult,
|
||||
class ConverterInputStream : public nsIUnicharInputStream {
|
||||
public:
|
||||
ConverterInputStream(nsIInputStream* aStream,
|
||||
nsIUnicodeDecoder* aConverter,
|
||||
nsIB2UConverter* aConverter,
|
||||
PRUint32 aBufSize);
|
||||
~ConverterInputStream();
|
||||
|
||||
@@ -170,7 +197,7 @@ protected:
|
||||
PRInt32 Fill(nsresult * aErrorCode);
|
||||
|
||||
nsIInputStream* mInput;
|
||||
nsIUnicodeDecoder* mConverter;
|
||||
nsIB2UConverter* mConverter;
|
||||
nsIByteBuffer* mByteData;
|
||||
PRUint32 mByteDataOffset;
|
||||
nsIUnicharBuffer* mUnicharData;
|
||||
@@ -179,7 +206,7 @@ protected:
|
||||
};
|
||||
|
||||
ConverterInputStream::ConverterInputStream(nsIInputStream* aStream,
|
||||
nsIUnicodeDecoder* aConverter,
|
||||
nsIB2UConverter* aConverter,
|
||||
PRUint32 aBufferSize)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
@@ -273,10 +300,10 @@ PRInt32 ConverterInputStream::Fill(nsresult * aErrorCode)
|
||||
NS_ASSERTION(remainder + nb == mByteData->GetLength(), "bad nb");
|
||||
|
||||
// Now convert as much of the byte buffer to unicode as possible
|
||||
PRInt32 dstLen = mUnicharData->GetBufferSize();
|
||||
PRInt32 srcLen = remainder + nb;
|
||||
*aErrorCode = mConverter->Convert(mUnicharData->GetBuffer(), 0, &dstLen,
|
||||
mByteData->GetBuffer(), 0, &srcLen);
|
||||
PRUint32 dstLen = mUnicharData->GetBufferSize();
|
||||
PRUint32 srcLen = remainder + nb;
|
||||
*aErrorCode = mConverter->Convert(mUnicharData->GetBuffer(), 0, dstLen,
|
||||
mByteData->GetBuffer(), 0, srcLen);
|
||||
mUnicharDataOffset = 0;
|
||||
mUnicharDataLength = dstLen;
|
||||
mByteDataOffset += srcLen;
|
||||
@@ -296,7 +323,7 @@ NS_NewConverterStream(nsIUnicharInputStream** aInstancePtrResult,
|
||||
}
|
||||
|
||||
// Create converter
|
||||
nsIUnicodeDecoder* converter;
|
||||
nsIB2UConverter* converter;
|
||||
nsresult rv = NS_NewB2UConverter(&converter, nsnull, aCharSet);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
@@ -305,7 +332,7 @@ NS_NewConverterStream(nsIUnicharInputStream** aInstancePtrResult,
|
||||
// Create converter input stream
|
||||
ConverterInputStream* it =
|
||||
new ConverterInputStream(aStreamToWrap, converter, aBufferSize);
|
||||
NS_RELEASE(converter);
|
||||
converter->Release();
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@@ -25,10 +25,9 @@
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "nsError.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpecHelpers::Canonify(char*& ioPath, PRBool inMakeDirs)
|
||||
void nsFileSpecHelpers::Canonify(char*& ioPath, bool inMakeDirs)
|
||||
// Canonify, make absolute, and check whether directories exist
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
@@ -77,78 +76,75 @@ void nsFileSpecHelpers::Canonify(char*& ioPath, PRBool inMakeDirs)
|
||||
} // nsFileSpecHelpers::Canonify
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::SetLeafName(const char* inLeafName)
|
||||
void nsNativeFileSpec::SetLeafName(const char* inLeafName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpecHelpers::LeafReplace(mPath, '/', inLeafName);
|
||||
} // nsFileSpec::SetLeafName
|
||||
} // nsNativeFileSpec::SetLeafName
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
char* nsFileSpec::GetLeafName() const
|
||||
char* nsNativeFileSpec::GetLeafName() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return nsFileSpecHelpers::GetLeaf(mPath, '/');
|
||||
} // nsFileSpec::GetLeafName
|
||||
} // nsNativeFileSpec::GetLeafName
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::Exists() const
|
||||
bool nsNativeFileSpec::Exists() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return 0 == stat(mPath, &st);
|
||||
} // nsFileSpec::Exists
|
||||
} // nsNativeFileSpec::Exists
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsFile() const
|
||||
bool nsNativeFileSpec::IsFile() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return 0 == stat(mPath, &st) && S_ISREG(st.st_mode);
|
||||
} // nsFileSpec::IsFile
|
||||
} // nsNativeFileSpec::IsFile
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsDirectory() const
|
||||
bool nsNativeFileSpec::IsDirectory() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return 0 == stat(mPath, &st) && S_ISDIR(st.st_mode);
|
||||
} // nsFileSpec::IsDirectory
|
||||
} // nsNativeFileSpec::IsDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
||||
void nsNativeFileSpec::GetParent(nsNativeFileSpec& outSpec) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpecHelpers::StringAssign(outSpec.mPath, mPath);
|
||||
char* cp = strrchr(outSpec.mPath, '/');
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
} // nsFileSpec::GetParent
|
||||
} // nsNativeFileSpec::GetParent
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator += (const char* inRelativePath)
|
||||
void nsNativeFileSpec::operator += (const char* inRelativePath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (!inRelativePath || !mPath)
|
||||
return;
|
||||
|
||||
char endChar = mPath[strlen(mPath) - 1];
|
||||
if (endChar == '/')
|
||||
nsFileSpecHelpers::ReallocCat(mPath, "x");
|
||||
else
|
||||
nsFileSpecHelpers::ReallocCat(mPath, "/x");
|
||||
if (mPath[strlen(mPath) - 1] != '/')
|
||||
char* newPath = nsFileSpecHelpers::ReallocCat(mPath, "/");
|
||||
SetLeafName(inRelativePath);
|
||||
} // nsFileSpec::operator +=
|
||||
} // nsNativeFileSpec::operator +=
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::CreateDirectory(int mode)
|
||||
void nsNativeFileSpec::CreateDirectory(int mode)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// Note that mPath is canonical!
|
||||
mkdir(mPath, mode);
|
||||
} // nsFileSpec::CreateDirectory
|
||||
} // nsNativeFileSpec::CreateDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::Delete(PRBool inRecursive)
|
||||
void nsNativeFileSpec::Delete(bool inRecursive)
|
||||
// To check if this worked, call Exists() afterwards, see?
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
@@ -156,9 +152,9 @@ void nsFileSpec::Delete(PRBool inRecursive)
|
||||
{
|
||||
if (inRecursive)
|
||||
{
|
||||
for (nsDirectoryIterator i(*this); i.Exists(); i++)
|
||||
for (nsDirectoryIterator i(*this); i; i++)
|
||||
{
|
||||
nsFileSpec& child = (nsFileSpec&)i;
|
||||
nsNativeFileSpec& child = (nsNativeFileSpec&)i;
|
||||
child.Delete(inRecursive);
|
||||
}
|
||||
}
|
||||
@@ -166,148 +162,7 @@ void nsFileSpec::Delete(PRBool inRecursive)
|
||||
}
|
||||
else
|
||||
remove(mPath);
|
||||
} // nsFileSpec::Delete
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Rename(const char* inNewName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// This function should not be used to move a file on disk.
|
||||
if (strchr(inNewName, '/'))
|
||||
return NS_FILE_FAILURE;
|
||||
|
||||
if (PR_Rename(mPath, inNewName) != 0)
|
||||
{
|
||||
return NS_FILE_FAILURE;
|
||||
}
|
||||
SetLeafName(inNewName);
|
||||
return NS_OK;
|
||||
} // nsFileSpec::Rename
|
||||
|
||||
static int CrudeFileCopy(const char* in, const char* out)
|
||||
{
|
||||
struct stat in_stat;
|
||||
int stat_result = -1;
|
||||
|
||||
char buf [1024];
|
||||
FILE *ifp, *ofp;
|
||||
int rbytes, wbytes;
|
||||
|
||||
if (!in || !out)
|
||||
return -1;
|
||||
|
||||
stat_result = stat (in, &in_stat);
|
||||
|
||||
ifp = fopen (in, "r");
|
||||
if (!ifp)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
ofp = fopen (out, "w");
|
||||
if (!ofp)
|
||||
{
|
||||
fclose (ifp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((rbytes = fread (buf, 1, sizeof(buf), ifp)) > 0)
|
||||
{
|
||||
while (rbytes > 0)
|
||||
{
|
||||
if ( (wbytes = fwrite (buf, 1, rbytes, ofp)) < 0 )
|
||||
{
|
||||
fclose (ofp);
|
||||
fclose (ifp);
|
||||
unlink(out);
|
||||
return -1;
|
||||
}
|
||||
rbytes -= wbytes;
|
||||
}
|
||||
}
|
||||
fclose (ofp);
|
||||
fclose (ifp);
|
||||
|
||||
if (stat_result == 0)
|
||||
{
|
||||
chmod (out, in_stat.st_mode & 0777);
|
||||
}
|
||||
|
||||
return 0;
|
||||
} // nsFileSpec::Rename
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Copy(const nsFileSpec& inParentDirectory) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// We can only copy into a directory, and (for now) can not copy entire directories
|
||||
nsresult result = NS_FILE_FAILURE;
|
||||
|
||||
if (inParentDirectory.IsDirectory() && (! IsDirectory() ) )
|
||||
{
|
||||
char *leafname = GetLeafName();
|
||||
char* destPath = nsFileSpecHelpers::StringDup(inParentDirectory, ( strlen(inParentDirectory) + 1 + strlen(leafname) ) );
|
||||
strcat(destPath, "/");
|
||||
strcat(destPath, leafname);
|
||||
delete [] leafname;
|
||||
|
||||
result = NS_FILE_RESULT(CrudeFileCopy(*this, destPath));
|
||||
|
||||
delete [] destPath;
|
||||
}
|
||||
return result;
|
||||
} // nsFileSpec::Copy
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Move(const nsFileSpec& inNewParentDirectory) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// We can only copy into a directory, and (for now) can not copy entire directories
|
||||
nsresult result = NS_FILE_FAILURE;
|
||||
|
||||
if (inNewParentDirectory.IsDirectory() && (! IsDirectory() ) )
|
||||
{
|
||||
char *leafname = GetLeafName();
|
||||
char* destPath
|
||||
= nsFileSpecHelpers::StringDup(
|
||||
inNewParentDirectory,
|
||||
strlen(inNewParentDirectory) + 1 + strlen(leafname));
|
||||
strcat(destPath, "/");
|
||||
strcat(destPath, leafname);
|
||||
delete [] leafname;
|
||||
|
||||
result = NS_FILE_RESULT(CrudeFileCopy(*this, destPath));
|
||||
if (result == NS_OK)
|
||||
{
|
||||
Delete(PR_FALSE);
|
||||
}
|
||||
delete [] destPath;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Execute(const char* inArgs ) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsresult result = NS_FILE_FAILURE;
|
||||
|
||||
if (! IsDirectory())
|
||||
{
|
||||
char* fileNameWithArgs
|
||||
= nsFileSpecHelpers::StringDup(mPath, strlen(mPath) + 1 + strlen(inArgs));
|
||||
strcat(fileNameWithArgs, " ");
|
||||
strcat(fileNameWithArgs, inArgs);
|
||||
|
||||
result = NS_FILE_RESULT(system(fileNameWithArgs));
|
||||
delete [] fileNameWithArgs;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
} // nsFileSpec::Execute
|
||||
} // nsNativeFileSpec::Delete
|
||||
|
||||
//========================================================================================
|
||||
// nsDirectoryIterator
|
||||
@@ -315,7 +170,7 @@ nsresult nsFileSpec::Execute(const char* inArgs ) const
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsDirectoryIterator::nsDirectoryIterator(
|
||||
const nsFileSpec& inDirectory
|
||||
const nsNativeFileSpec& inDirectory
|
||||
, int inIterateDirection)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mCurrent(inDirectory)
|
||||
|
||||
@@ -23,18 +23,9 @@
|
||||
#include <direct.h>
|
||||
#include <stdlib.h>
|
||||
#include "prio.h"
|
||||
#include "nsError.h"
|
||||
|
||||
#include "windows.h"
|
||||
|
||||
#ifdef UNICODE
|
||||
#define CreateDirectoryW CreateDirectory
|
||||
#else
|
||||
#define CreateDirectoryA CreateDirectory
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpecHelpers::Canonify(char*& ioPath, PRBool inMakeDirs)
|
||||
void nsFileSpecHelpers::Canonify(char*& ioPath, bool inMakeDirs)
|
||||
// Canonify, make absolute, and check whether directories exist. This
|
||||
// takes a (possibly relative) native path and converts it into a
|
||||
// fully qualified native path.
|
||||
@@ -134,7 +125,7 @@ void nsFileSpecHelpers::NativeToUnix(char*& ioPath)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFileSpec::nsFileSpec(const nsFilePath& inPath)
|
||||
nsNativeFileSpec::nsNativeFileSpec(const nsFilePath& inPath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(NULL)
|
||||
{
|
||||
@@ -142,16 +133,15 @@ nsFileSpec::nsFileSpec(const nsFilePath& inPath)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator = (const nsFilePath& inPath)
|
||||
void nsNativeFileSpec::operator = (const nsFilePath& inPath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpecHelpers::StringAssign(mPath, (const char*)inPath);
|
||||
nsFileSpecHelpers::UnixToNative(mPath);
|
||||
mError = NS_OK;
|
||||
} // nsFileSpec::operator =
|
||||
} // nsNativeFileSpec::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsFilePath::nsFilePath(const nsFileSpec& inSpec)
|
||||
nsFilePath::nsFilePath(const nsNativeFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mPath(NULL)
|
||||
{
|
||||
@@ -159,7 +149,7 @@ nsFilePath::nsFilePath(const nsFileSpec& inSpec)
|
||||
} // nsFilePath::nsFilePath
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFilePath::operator = (const nsFileSpec& inSpec)
|
||||
void nsFilePath::operator = (const nsNativeFileSpec& inSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpecHelpers::StringAssign(mPath, inSpec.mPath);
|
||||
@@ -167,86 +157,84 @@ void nsFilePath::operator = (const nsFileSpec& inSpec)
|
||||
} // nsFilePath::operator =
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::SetLeafName(const char* inLeafName)
|
||||
void nsNativeFileSpec::SetLeafName(const char* inLeafName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpecHelpers::LeafReplace(mPath, '\\', inLeafName);
|
||||
} // nsFileSpec::SetLeafName
|
||||
} // nsNativeFileSpec::SetLeafName
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
char* nsFileSpec::GetLeafName() const
|
||||
char* nsNativeFileSpec::GetLeafName() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
return nsFileSpecHelpers::GetLeaf(mPath, '\\');
|
||||
} // nsFileSpec::GetLeafName
|
||||
} // nsNativeFileSpec::GetLeafName
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::Exists() const
|
||||
bool nsNativeFileSpec::Exists() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return 0 == stat(mPath, &st);
|
||||
} // nsFileSpec::Exists
|
||||
} // nsNativeFileSpec::Exists
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsFile() const
|
||||
bool nsNativeFileSpec::IsFile() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return 0 == stat(mPath, &st) && (_S_IFREG & st.st_mode);
|
||||
} // nsFileSpec::IsFile
|
||||
} // nsNativeFileSpec::IsFile
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
PRBool nsFileSpec::IsDirectory() const
|
||||
bool nsNativeFileSpec::IsDirectory() const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
struct stat st;
|
||||
return 0 == stat(mPath, &st) && (_S_IFDIR & st.st_mode);
|
||||
} // nsFileSpec::IsDirectory
|
||||
} // nsNativeFileSpec::IsDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
||||
void nsNativeFileSpec::GetParent(nsNativeFileSpec& outSpec) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpecHelpers::StringAssign(outSpec.mPath, mPath);
|
||||
char* cp = strrchr(outSpec.mPath, '\\');
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
} // nsFileSpec::GetParent
|
||||
} // nsNativeFileSpec::GetParent
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::operator += (const char* inRelativePath)
|
||||
void nsNativeFileSpec::operator += (const char* inRelativePath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (!inRelativePath || !mPath)
|
||||
return;
|
||||
|
||||
if (mPath[strlen(mPath) - 1] == '\\')
|
||||
nsFileSpecHelpers::ReallocCat(mPath, "x");
|
||||
else
|
||||
nsFileSpecHelpers::ReallocCat(mPath, "\\x");
|
||||
if (mPath[strlen(mPath) - 1] != '\\')
|
||||
char* newPath = nsFileSpecHelpers::ReallocCat(mPath, "\\");
|
||||
SetLeafName(inRelativePath);
|
||||
} // nsFileSpec::operator +=
|
||||
} // nsNativeFileSpec::operator +=
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::CreateDirectory(int /*mode*/)
|
||||
void nsNativeFileSpec::CreateDirectory(int /*mode*/)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// Note that mPath is canonical!
|
||||
mkdir(mPath);
|
||||
} // nsFileSpec::CreateDirectory
|
||||
} // nsNativeFileSpec::CreateDirectory
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsFileSpec::Delete(PRBool inRecursive)
|
||||
void nsNativeFileSpec::Delete(bool inRecursive)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
if (IsDirectory())
|
||||
{
|
||||
if (inRecursive)
|
||||
{
|
||||
for (nsDirectoryIterator i(*this); i.Exists(); i++)
|
||||
for (nsDirectoryIterator i(*this); i; i++)
|
||||
{
|
||||
nsFileSpec& child = (nsFileSpec&)i;
|
||||
nsNativeFileSpec& child = (nsNativeFileSpec&)i;
|
||||
child.Delete(inRecursive);
|
||||
}
|
||||
}
|
||||
@@ -256,106 +244,7 @@ void nsFileSpec::Delete(PRBool inRecursive)
|
||||
{
|
||||
remove(mPath);
|
||||
}
|
||||
} // nsFileSpec::Delete
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Rename(const char* inNewName)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// This function should not be used to move a file on disk.
|
||||
if (strchr(inNewName, '/'))
|
||||
return NS_FILE_FAILURE;
|
||||
|
||||
if (PR_Rename(*this, inNewName) != NS_OK)
|
||||
{
|
||||
return NS_FILE_FAILURE;
|
||||
}
|
||||
SetLeafName(inNewName);
|
||||
return NS_OK;
|
||||
} // nsFileSpec::Rename
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Copy(const nsFileSpec& inParentDirectory) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// We can only copy into a directory, and (for now) can not copy entire directories
|
||||
|
||||
if (inParentDirectory.IsDirectory() && (! IsDirectory() ) )
|
||||
{
|
||||
char *leafname = GetLeafName();
|
||||
char* destPath = nsFileSpecHelpers::StringDup(inParentDirectory, ( strlen(inParentDirectory) + 1 + strlen(leafname) ) );
|
||||
strcat(destPath, "\\");
|
||||
strcat(destPath, leafname);
|
||||
delete [] leafname;
|
||||
|
||||
// CopyFile returns non-zero if succeeds
|
||||
int copyOK = CopyFile(*this, destPath, true);
|
||||
|
||||
delete[] destPath;
|
||||
|
||||
if (copyOK)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_FILE_FAILURE;
|
||||
} // nsFileSpec::Copy
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Move(const nsFileSpec& nsNewParentDirectory) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// We can only copy into a directory, and (for now) can not copy entire directories
|
||||
|
||||
if (nsNewParentDirectory.IsDirectory() && (! IsDirectory() ) )
|
||||
{
|
||||
char *leafname = GetLeafName();
|
||||
char *destPath = nsFileSpecHelpers::StringDup(nsNewParentDirectory, ( strlen(nsNewParentDirectory) + 1 + strlen(leafname) ));
|
||||
strcat(destPath, "\\");
|
||||
strcat(destPath, leafname);
|
||||
delete [] leafname;
|
||||
|
||||
// MoveFile returns non-zero if succeeds
|
||||
int copyOK = MoveFile(*this, destPath);
|
||||
|
||||
delete [] destPath;
|
||||
|
||||
if (copyOK)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_FILE_FAILURE;
|
||||
} // nsFileSpec::Move
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsFileSpec::Execute(const char* inArgs ) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
if (! IsDirectory())
|
||||
{
|
||||
char* fileNameWithArgs = NULL;
|
||||
|
||||
fileNameWithArgs = nsFileSpecHelpers::StringDup(mPath, ( strlen(mPath) + 1 + strlen(inArgs) ) );
|
||||
strcat(fileNameWithArgs, " ");
|
||||
strcat(fileNameWithArgs, inArgs);
|
||||
|
||||
int execResult = WinExec( fileNameWithArgs, SW_NORMAL );
|
||||
|
||||
delete [] fileNameWithArgs;
|
||||
|
||||
if (execResult > 31)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_FILE_FAILURE;
|
||||
} // nsFileSpec::Execute
|
||||
} // nsNativeFileSpec::Delete
|
||||
|
||||
//========================================================================================
|
||||
// nsDirectoryIterator
|
||||
@@ -363,7 +252,7 @@ nsresult nsFileSpec::Execute(const char* inArgs ) const
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsDirectoryIterator::nsDirectoryIterator(
|
||||
const nsFileSpec& inDirectory
|
||||
const nsNativeFileSpec& inDirectory
|
||||
, int inIterateDirection)
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mCurrent(inDirectory)
|
||||
|
||||
@@ -1,26 +1,7 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "string.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsFileStream.h"
|
||||
|
||||
//#include "string.h"
|
||||
|
||||
struct FilesTest
|
||||
{
|
||||
FilesTest() : mConsole() {}
|
||||
@@ -31,25 +12,18 @@ struct FilesTest
|
||||
int InputStream(const char* relativePath);
|
||||
int OutputStream(const char* relativePath);
|
||||
int IOStream(const char* relativePath);
|
||||
int Parent(const char* relativePath, nsFileSpec& outParent);
|
||||
int Delete(nsFileSpec& victim);
|
||||
int CreateDirectory(nsFileSpec& victim);
|
||||
int IterateDirectoryChildren(nsFileSpec& startChild);
|
||||
int Parent(const char* relativePath, nsNativeFileSpec& outParent);
|
||||
int Delete(nsNativeFileSpec& victim);
|
||||
int CreateDirectory(nsNativeFileSpec& victim);
|
||||
int IterateDirectoryChildren(nsNativeFileSpec& startChild);
|
||||
int CanonicalPath(const char* relativePath);
|
||||
int Persistence(const char* relativePath);
|
||||
|
||||
int Copy(const char* sourceFile, const char* targDir);
|
||||
int Move(const char* sourceFile, const char* targDir);
|
||||
int Rename(const char* sourceFile, const char* newName);
|
||||
|
||||
int Execute(const char* appName, const char* args);
|
||||
|
||||
void Banner(const char* bannerString);
|
||||
void Passed();
|
||||
void Failed();
|
||||
void Inspect();
|
||||
|
||||
nsOutputConsoleStream mConsole;
|
||||
nsOutputFileStream mConsole;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
@@ -67,8 +41,7 @@ void FilesTest::Banner(const char* bannerString)
|
||||
void FilesTest::Passed()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
((nsOutputStream&)mConsole) << "Test passed.";
|
||||
mConsole << nsEndl;
|
||||
mConsole << "Test passed." << nsEndl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
@@ -98,7 +71,7 @@ void FilesTest::WriteStuff(nsOutputFileStream& s)
|
||||
s << "As a unix path: \"" << (const char*)filePath << "\""<< nsEndl;
|
||||
|
||||
// Initialize a native file spec from a URL
|
||||
nsFileSpec fileSpec(fileURL);
|
||||
nsNativeFileSpec fileSpec(fileURL);
|
||||
s << "As a file spec: " << fileSpec << nsEndl;
|
||||
|
||||
// Make the spec unique (this one has no suffix).
|
||||
@@ -128,10 +101,10 @@ int FilesTest::OutputStream(const char* relativePath)
|
||||
{
|
||||
nsFilePath myTextFilePath(relativePath, true); // relative path.
|
||||
const char* pathAsString = (const char*)myTextFilePath;
|
||||
nsFileSpec mySpec(myTextFilePath);
|
||||
nsNativeFileSpec mySpec(myTextFilePath);
|
||||
{
|
||||
mConsole << "WRITING IDENTICAL OUTPUT TO " << pathAsString << nsEndl << nsEndl;
|
||||
nsOutputFileStream testStream(mySpec);
|
||||
nsOutputFileStream testStream(myTextFilePath);
|
||||
if (!testStream.is_open())
|
||||
{
|
||||
mConsole
|
||||
@@ -163,10 +136,9 @@ int FilesTest::IOStream(const char* relativePath)
|
||||
{
|
||||
nsFilePath myTextFilePath(relativePath, true); // relative path.
|
||||
const char* pathAsString = (const char*)myTextFilePath;
|
||||
nsFileSpec mySpec(myTextFilePath);
|
||||
mConsole
|
||||
<< "Replacing \"path\" by \"ZUUL\" in " << pathAsString << nsEndl << nsEndl;
|
||||
nsIOFileStream testStream(mySpec);
|
||||
nsIOFileStream testStream(myTextFilePath);
|
||||
if (!testStream.is_open())
|
||||
{
|
||||
mConsole
|
||||
@@ -193,57 +165,6 @@ int FilesTest::IOStream(const char* relativePath)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::Persistence(
|
||||
const char* relativePathToWrite)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFilePath myTextFilePath(relativePathToWrite, true);
|
||||
const char* pathAsString = (const char*)myTextFilePath;
|
||||
nsFileSpec mySpec(myTextFilePath);
|
||||
|
||||
nsIOFileStream testStream(mySpec, (PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE));
|
||||
if (!testStream.is_open())
|
||||
{
|
||||
mConsole
|
||||
<< "ERROR: File "
|
||||
<< pathAsString
|
||||
<< " could not be opened for input+output"
|
||||
<< nsEndl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nsPersistentFileDescriptor myPersistent(mySpec);
|
||||
mConsole
|
||||
<< "Writing persistent file data " << pathAsString << nsEndl << nsEndl;
|
||||
|
||||
testStream.seek(0); // check that the seek compiles
|
||||
testStream << myPersistent;
|
||||
|
||||
testStream.seek(0);
|
||||
|
||||
nsPersistentFileDescriptor mySecondPersistent;
|
||||
testStream >> mySecondPersistent;
|
||||
|
||||
mySpec = mySecondPersistent;
|
||||
#ifdef XP_MAC
|
||||
if (mySpec.Error())
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!mySpec.Exists())
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Passed();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::InputStream(const char* relativePath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
@@ -251,8 +172,7 @@ int FilesTest::InputStream(const char* relativePath)
|
||||
nsFilePath myTextFilePath(relativePath, true);
|
||||
const char* pathAsString = (const char*)myTextFilePath;
|
||||
mConsole << "READING BACK DATA FROM " << pathAsString << nsEndl << nsEndl;
|
||||
nsFileSpec mySpec(myTextFilePath);
|
||||
nsInputFileStream testStream2(mySpec);
|
||||
nsInputFileStream testStream2(myTextFilePath);
|
||||
if (!testStream2.is_open())
|
||||
{
|
||||
mConsole
|
||||
@@ -277,12 +197,12 @@ int FilesTest::InputStream(const char* relativePath)
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::Parent(
|
||||
const char* relativePath,
|
||||
nsFileSpec& outParent)
|
||||
nsNativeFileSpec& outParent)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFilePath myTextFilePath(relativePath, true);
|
||||
const char* pathAsString = (const char*)myTextFilePath;
|
||||
nsFileSpec mySpec(myTextFilePath);
|
||||
nsNativeFileSpec mySpec(myTextFilePath);
|
||||
|
||||
mySpec.GetParent(outParent);
|
||||
nsFilePath parentPath(outParent);
|
||||
@@ -297,7 +217,7 @@ int FilesTest::Parent(
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::Delete(nsFileSpec& victim)
|
||||
int FilesTest::Delete(nsNativeFileSpec& victim)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// - Test of non-recursive delete
|
||||
@@ -346,7 +266,7 @@ int FilesTest::Delete(nsFileSpec& victim)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::CreateDirectory(nsFileSpec& dirSpec)
|
||||
int FilesTest::CreateDirectory(nsNativeFileSpec& dirSpec)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFilePath dirPath(dirSpec);
|
||||
@@ -368,27 +288,27 @@ int FilesTest::CreateDirectory(nsFileSpec& dirSpec)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::IterateDirectoryChildren(nsFileSpec& startChild)
|
||||
int FilesTest::IterateDirectoryChildren(nsNativeFileSpec& startChild)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
// - Test of directory iterator
|
||||
|
||||
nsFileSpec grandparent;
|
||||
nsNativeFileSpec grandparent;
|
||||
startChild.GetParent(grandparent); // should be the original default directory.
|
||||
nsFilePath grandparentPath(grandparent);
|
||||
|
||||
mConsole << "Forwards listing of " << (const char*)grandparentPath << ":" << nsEndl;
|
||||
for (nsDirectoryIterator i(grandparent, +1); i.Exists(); i++)
|
||||
for (nsDirectoryIterator i(grandparent, +1); i; i++)
|
||||
{
|
||||
char* itemName = ((nsFileSpec&)i).GetLeafName();
|
||||
char* itemName = ((nsNativeFileSpec&)i).GetLeafName();
|
||||
mConsole << '\t' << itemName << nsEndl;
|
||||
delete [] itemName;
|
||||
}
|
||||
|
||||
mConsole << "Backwards listing of " << (const char*)grandparentPath << ":" << nsEndl;
|
||||
for (nsDirectoryIterator j(grandparent, -1); j.Exists(); j--)
|
||||
for (nsDirectoryIterator j(grandparent, -1); j; j--)
|
||||
{
|
||||
char* itemName = ((nsFileSpec&)j).GetLeafName();
|
||||
char* itemName = ((nsNativeFileSpec&)j).GetLeafName();
|
||||
mConsole << '\t' << itemName << nsEndl;
|
||||
delete [] itemName;
|
||||
}
|
||||
@@ -417,110 +337,6 @@ int FilesTest::CanonicalPath(
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::Copy(const char* file, const char* dir)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpec dirPath(dir, true);
|
||||
|
||||
dirPath.CreateDirectory();
|
||||
if (! dirPath.Exists())
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
nsFileSpec mySpec(file, true); // relative path.
|
||||
{
|
||||
nsIOFileStream testStream(mySpec); // creates the file
|
||||
// Scope ends here, file gets closed
|
||||
}
|
||||
|
||||
nsFileSpec filePath(file);
|
||||
if (! filePath.Exists())
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
nsresult error = filePath.Copy(dirPath);
|
||||
|
||||
dirPath += filePath.GetLeafName();
|
||||
if (! dirPath.Exists() || ! filePath.Exists() || NS_FAILED(error))
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Passed();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::Move(const char* file, const char* dir)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpec dirPath(dir, true);
|
||||
|
||||
dirPath.CreateDirectory();
|
||||
if (! dirPath.Exists())
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
nsFileSpec srcSpec(file, true); // relative path.
|
||||
{
|
||||
nsIOFileStream testStream(srcSpec); // creates the file
|
||||
// file gets closed here because scope ends here.
|
||||
};
|
||||
|
||||
if (! srcSpec.Exists())
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
nsresult error = srcSpec.Move(dirPath);
|
||||
|
||||
|
||||
dirPath += srcSpec.GetLeafName();
|
||||
if (! dirPath.Exists() || srcSpec.Exists() || NS_FAILED(error))
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Passed();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::Execute(const char* appName, const char* args)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsFileSpec appPath(appName, false);
|
||||
if (!appPath.Exists())
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
nsresult error = appPath.Execute(args);
|
||||
if (NS_FAILED(error))
|
||||
{
|
||||
Failed();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Passed();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
int FilesTest::RunAllTests()
|
||||
// For use with DEBUG defined.
|
||||
@@ -555,7 +371,7 @@ int FilesTest::RunAllTests()
|
||||
return -1;
|
||||
|
||||
Banner("Parent");
|
||||
nsFileSpec parent;
|
||||
nsNativeFileSpec parent;
|
||||
if (Parent("mumble/iotest.txt", parent) != 0)
|
||||
return -1;
|
||||
|
||||
@@ -571,36 +387,6 @@ int FilesTest::RunAllTests()
|
||||
if (IterateDirectoryChildren(parent) != 0)
|
||||
return -1;
|
||||
|
||||
Banner("Copy");
|
||||
if (Copy("mumble/copyfile.txt", "mumble/copy") != 0)
|
||||
return -1;
|
||||
|
||||
Banner("Move");
|
||||
if (Move("mumble/moveFile.txt", "mumble/move") != 0)
|
||||
return -1;
|
||||
|
||||
Banner("Execute");
|
||||
#ifdef XP_MAC
|
||||
// This path is hard-coded to test on jrm's machine. Finding an app
|
||||
// on an arbitrary Macintosh would cost more trouble than it's worth.
|
||||
// Change path to suit.
|
||||
if NS_FAILED(Execute("/Projects/Nav45_BRANCH/ns/cmd/macfe/"\
|
||||
"projects/client45/Client45PPC", ""))
|
||||
#elif XP_PC
|
||||
if NS_FAILED(Execute("c:\\windows\\notepad.exe", ""))
|
||||
#else
|
||||
if NS_FAILED(Execute("/bin/ls", "/"))
|
||||
#endif
|
||||
return -1;
|
||||
|
||||
Banner("Persistence");
|
||||
if (Persistence("mumble/filedesc.dat") != 0)
|
||||
return -1;
|
||||
|
||||
Banner("Delete again (to clean up our mess)");
|
||||
if (Delete(parent) != 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -609,6 +395,7 @@ int main()
|
||||
// For use with DEBUG defined.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
FilesTest tester;
|
||||
return tester.RunAllTests();
|
||||
} // main
|
||||
|
||||
@@ -21,33 +21,13 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
CPPSRCS = TestAtoms.cpp TestCRT.cpp CvtURL.cpp FilesTest.cpp PropertiesTest.cpp TestAutoLock.cpp
|
||||
REQUIRES = xpcom netlib
|
||||
|
||||
CPPSRCS = TestAtoms.cpp TestCRT.cpp FilesTest.cpp
|
||||
|
||||
LIBS = \
|
||||
-lnetlib \
|
||||
-labouturl \
|
||||
-lfileurl \
|
||||
-lremoturl \
|
||||
-lgophurl \
|
||||
-lnetcnvts \
|
||||
-lsockstuburl \
|
||||
-lftpurl \
|
||||
-lmimetype \
|
||||
-lpwcac \
|
||||
-lhttpurl \
|
||||
-lnetwork \
|
||||
-lnetutil \
|
||||
-lnetcache \
|
||||
-lgmbase$(MOZ_TOOLKIT) \
|
||||
$(TK_LIBS) \
|
||||
-lpref \
|
||||
-lsecfree \
|
||||
-ljs \
|
||||
-lxp \
|
||||
-lraptorbase \
|
||||
-lxpcom \
|
||||
-lreg \
|
||||
$(ZLIB_LIBS) \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@@ -31,32 +31,16 @@
|
||||
|
||||
#define TEST_URL "resource:/res/test.properties"
|
||||
|
||||
#ifdef XP_PC
|
||||
#define NETLIB_DLL "netlib.dll"
|
||||
#define RAPTORBASE_DLL "raptorbase.dll"
|
||||
#define XPCOM_DLL "xpcom32.dll"
|
||||
#else
|
||||
#ifdef XP_MAC
|
||||
#define NETLIB_DLL "NETLIB_DLL"
|
||||
#define RAPTORBASE_DLL "base.shlb"
|
||||
#define XPCOM_DLL "XPCOM_DLL"
|
||||
#else
|
||||
#define NETLIB_DLL "libnetlib.so"
|
||||
#define RAPTORBASE_DLL "libraptorbase.so"
|
||||
#define XPCOM_DLL "libxpcom32.so"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kIPropertiesIID, NS_IPROPERTIES_IID);
|
||||
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
|
||||
|
||||
#ifdef XP_MAC // have not build this on PC and UNIX yet so make it #ifdef XP_MAC
|
||||
extern "C" void NS_SetupRegistry();
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -64,10 +48,6 @@ main(int argc, char *argv[])
|
||||
PR_FALSE);
|
||||
nsRepository::RegisterFactory(kEventQueueServiceCID, XPCOM_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
#ifdef XP_MAC // have not build this on PC and UNIX yet so make it #ifdef XP_MAC
|
||||
NS_SetupRegistry();
|
||||
#endif
|
||||
|
||||
nsresult ret;
|
||||
nsIEventQueueService* pEventQueueService = nsnull;
|
||||
ret = nsServiceManager::GetService(kEventQueueServiceCID,
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Some tests for nsAutoLock.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsAutoLock.h"
|
||||
#include "prthread.h"
|
||||
|
||||
PRLock* gLock;
|
||||
int gCount;
|
||||
|
||||
static void run(void* arg)
|
||||
{
|
||||
for (int i = 0; i < 1000000; ++i) {
|
||||
nsAutoLock guard(gLock);
|
||||
++gCount;
|
||||
PR_ASSERT(gCount == 1);
|
||||
--gCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
gLock = PR_NewLock();
|
||||
gCount = 0;
|
||||
|
||||
// This shouldn't compile
|
||||
//nsAutoLock* l1 = new nsAutoLock(theLock);
|
||||
//delete l1;
|
||||
|
||||
// Create a block-scoped lock. This should compile.
|
||||
{
|
||||
nsAutoLock l2(gLock);
|
||||
}
|
||||
|
||||
// Fork a thread to access the shared variable in a tight loop
|
||||
PRThread* t1 =
|
||||
PR_CreateThread(PR_SYSTEM_THREAD,
|
||||
run,
|
||||
nsnull,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_JOINABLE_THREAD,
|
||||
0);
|
||||
|
||||
// ...and now do the same thing ourselves
|
||||
run(nsnull);
|
||||
|
||||
// Wait for the background thread to finish, if necessary.
|
||||
PR_JoinThread(t1);
|
||||
return 0;
|
||||
}
|
||||
@@ -24,7 +24,6 @@ PROG2 = .\$(OBJDIR)\CvtURL.exe
|
||||
PROG3 = .\$(OBJDIR)\TestCRT.exe
|
||||
PROG4 = .\$(OBJDIR)\FilesTest.exe
|
||||
PROG5 = .\$(OBJDIR)\PropertiesTest.exe
|
||||
PROG6 = .\$(OBJDIR)\TestAutoLock.exe
|
||||
RESFILE = timer.res
|
||||
PROGRAMS = $(PROG0) $(PROG1) \
|
||||
!ifdef MODULAR_NETLIB
|
||||
@@ -33,7 +32,6 @@ PROGRAMS = $(PROG0) $(PROG1) \
|
||||
$(PROG5) \
|
||||
!endif
|
||||
$(PROG4) \
|
||||
$(PROG6) \
|
||||
$(NULL)
|
||||
|
||||
LINCS=-I..\src -I$(PUBLIC)\xpcom -I$(PUBLIC)\netlib -I$(PUBLIC)\raptor
|
||||
@@ -63,7 +61,6 @@ install:: $(PROGRAMS)
|
||||
$(MAKE_INSTALL) test.properties $(DIST)\bin\res
|
||||
!endif
|
||||
$(MAKE_INSTALL) $(PROG4) $(DIST)\bin
|
||||
$(MAKE_INSTALL) $(PROG6) $(DIST)\bin
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\TimerTest.exe
|
||||
@@ -75,7 +72,6 @@ clobber::
|
||||
rm -f $(DIST)\bin\res\test.properties
|
||||
!endif
|
||||
rm -f $(DIST)\bin\FilesTest.exe
|
||||
rm -f $(DIST)\bin\TestAutoLock.exe
|
||||
|
||||
# Move this into config/obj.inc when it's allowed
|
||||
.cpp{.\$(OBJDIR)\}.exe:
|
||||
@@ -106,7 +102,3 @@ $(PROG3): $(OBJDIR) TestCRT.cpp
|
||||
|
||||
$(PROG5): $(OBJDIR) PropertiesTest.cpp
|
||||
!endif
|
||||
|
||||
$(PROG6): $(OBJDIR) TestAutoLock.cpp
|
||||
|
||||
|
||||
|
||||
890
mozilla/build/autoconf/config.guess
vendored
Executable file
890
mozilla/build/autoconf/config.guess
vendored
Executable file
@@ -0,0 +1,890 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit system type (host/target name).
|
||||
#
|
||||
# Only a few systems have been added to this list; please add others
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
fi
|
||||
|
||||
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:*:*)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
fi
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
cat <<EOF >dummy.s
|
||||
.globl main
|
||||
.ent main
|
||||
main:
|
||||
.frame \$30,0,\$26,0
|
||||
.prologue 0
|
||||
.long 0x47e03d80 # implver $0
|
||||
lda \$2,259
|
||||
.long 0x47e20c21 # amask $2,$1
|
||||
srl \$1,8,\$2
|
||||
sll \$2,2,\$2
|
||||
sll \$0,3,\$0
|
||||
addl \$1,\$0,\$0
|
||||
addl \$2,\$0,\$0
|
||||
ret \$31,(\$26),1
|
||||
.end main
|
||||
EOF
|
||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./dummy
|
||||
case "$?" in
|
||||
7)
|
||||
UNAME_MACHINE="alpha"
|
||||
;;
|
||||
15)
|
||||
UNAME_MACHINE="alphaev5"
|
||||
;;
|
||||
14)
|
||||
UNAME_MACHINE="alphaev56"
|
||||
;;
|
||||
10)
|
||||
UNAME_MACHINE="alphapca56"
|
||||
;;
|
||||
16)
|
||||
UNAME_MACHINE="alphaev6"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f dummy.s dummy
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
|
||||
exit 0 ;;
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
exit 0 ;;
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-cbm-sysv4
|
||||
exit 0;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc64:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hkmips:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
arm32:NetBSD:*:*)
|
||||
echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
SR2?01:HI-UX/MPP:*:*)
|
||||
echo hppa1.1-hitachi-hiuxmpp
|
||||
exit 0;;
|
||||
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
|
||||
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo pyramid-pyramid-sysv3
|
||||
else
|
||||
echo pyramid-pyramid-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
NILE:*:*:dcosx)
|
||||
echo pyramid-pyramid-svr4
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||
# it's likely to be more like Solaris than SunOS4.
|
||||
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:*:*)
|
||||
case "`/usr/bin/arch -k`" in
|
||||
Series*|S4*)
|
||||
UNAME_RELEASE=`uname -v`
|
||||
;;
|
||||
esac
|
||||
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
|
||||
exit 0 ;;
|
||||
sun3*:SunOS:*:*)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun*:*:4.2BSD:*)
|
||||
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
|
||||
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
|
||||
case "`/bin/arch`" in
|
||||
sun3)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
;;
|
||||
sun4)
|
||||
echo sparc-sun-sunos${UNAME_RELEASE}
|
||||
;;
|
||||
esac
|
||||
exit 0 ;;
|
||||
aushp:SunOS:*:*)
|
||||
echo sparc-auspex-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:NetBSD:*:*)
|
||||
echo m68k-atari-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:NetBSD:*:*)
|
||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:NetBSD:*:*)
|
||||
echo m68k-apple-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RISC*:Mach:*:*)
|
||||
echo mips-dec-mach_bsd4.3
|
||||
exit 0 ;;
|
||||
RISC*:ULTRIX:*:*)
|
||||
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
2020:CLIX:*:*)
|
||||
echo clipper-intergraph-clix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
int main (argc, argv) int argc; char **argv; {
|
||||
#if defined (host_mips) && defined (MIPSEB)
|
||||
#if defined (SYSTYPE_SYSV)
|
||||
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_SVR4)
|
||||
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
|
||||
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy \
|
||||
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
echo powerpc-harris-powerunix
|
||||
exit 0 ;;
|
||||
m88k:CX/UX:7*:*)
|
||||
echo m88k-harris-cxux7
|
||||
exit 0 ;;
|
||||
m88k:*:4*:R4*)
|
||||
echo m88k-motorola-sysv4
|
||||
exit 0 ;;
|
||||
m88k:*:3*:R3*)
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit 0 ;;
|
||||
M88*:*:R3*:*)
|
||||
# Delta 88k system running SVR3
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
|
||||
echo m88k-tektronix-sysv3
|
||||
exit 0 ;;
|
||||
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
|
||||
echo m68k-tektronix-bsd
|
||||
exit 0 ;;
|
||||
*:IRIX*:*:*)
|
||||
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
|
||||
exit 0 ;;
|
||||
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||
i?86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (!__power_pc())
|
||||
exit(1);
|
||||
puts("powerpc-ibm-aix3.2.5");
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
else
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:AIX:*:4)
|
||||
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
else
|
||||
IBM_REV=4.${UNAME_RELEASE}
|
||||
fi
|
||||
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
|
||||
exit 0 ;;
|
||||
*:AIX:*:*)
|
||||
echo rs6000-ibm-aix
|
||||
exit 0 ;;
|
||||
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
|
||||
echo romp-ibm-bsd4.4
|
||||
exit 0 ;;
|
||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
exit 0 ;;
|
||||
DPX/2?00:B.O.S.:*:*)
|
||||
echo m68k-bull-sysv3
|
||||
exit 0 ;;
|
||||
9000/[34]??:4.3bsd:1.*:*)
|
||||
echo m68k-hp-bsd
|
||||
exit 0 ;;
|
||||
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||
echo m68k-hp-bsd4.4
|
||||
exit 0 ;;
|
||||
9000/[3478]??:HP-UX:*:*)
|
||||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
|
||||
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
|
||||
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
|
||||
results, however. */
|
||||
if (CPU_IS_PA_RISC (cpu))
|
||||
{
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||
}
|
||||
}
|
||||
else if (CPU_IS_HP_MC68K (cpu))
|
||||
puts ("m68k-hitachi-hiuxwe2");
|
||||
else puts ("unknown-hitachi-hiuxwe2");
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
hp8??:OSF1:*:*)
|
||||
echo hppa1.0-hp-osf
|
||||
exit 0 ;;
|
||||
i?86:OSF1:*:*)
|
||||
if [ -x /usr/sbin/sysversion ] ; then
|
||||
echo ${UNAME_MACHINE}-unknown-osf1mk
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-osf1
|
||||
fi
|
||||
exit 0 ;;
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:*:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*[A-Z]90:*:*:*)
|
||||
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
|
||||
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
exit 0 ;;
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
F300:UNIX_System_V:*:*)
|
||||
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
F301:UNIX_System_V:*:*)
|
||||
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin32
|
||||
exit 0 ;;
|
||||
i*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# uname on the ARM produces all sorts of strangeness, and we need to
|
||||
# filter it out.
|
||||
case "$UNAME_MACHINE" in
|
||||
arm* | sa110*) UNAME_MACHINE="arm" ;;
|
||||
esac
|
||||
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
ld_supported_emulations=`echo $ld_help_string \
|
||||
| sed -ne '/supported emulations:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
s/.*supported emulations: *//
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_emulations" in
|
||||
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
|
||||
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
|
||||
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
|
||||
esac
|
||||
|
||||
if test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
sed 's/^ //' <<EOF >dummy.s
|
||||
.globl main
|
||||
.ent main
|
||||
main:
|
||||
.frame \$30,0,\$26,0
|
||||
.prologue 0
|
||||
.long 0x47e03d80 # implver $0
|
||||
lda \$2,259
|
||||
.long 0x47e20c21 # amask $2,$1
|
||||
srl \$1,8,\$2
|
||||
sll \$2,2,\$2
|
||||
sll \$0,3,\$0
|
||||
addl \$1,\$0,\$0
|
||||
addl \$2,\$0,\$0
|
||||
ret \$31,(\$26),1
|
||||
.end main
|
||||
EOF
|
||||
LIBC=""
|
||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./dummy
|
||||
case "$?" in
|
||||
7)
|
||||
UNAME_MACHINE="alpha"
|
||||
;;
|
||||
15)
|
||||
UNAME_MACHINE="alphaev5"
|
||||
;;
|
||||
14)
|
||||
UNAME_MACHINE="alphaev56"
|
||||
;;
|
||||
10)
|
||||
UNAME_MACHINE="alphapca56"
|
||||
;;
|
||||
16)
|
||||
UNAME_MACHINE="alphaev6"
|
||||
;;
|
||||
esac
|
||||
|
||||
objdump --private-headers dummy | \
|
||||
grep ld.so.1 > /dev/null
|
||||
if test "$?" = 0 ; then
|
||||
LIBC="libc1"
|
||||
fi
|
||||
fi
|
||||
rm -f dummy.s dummy
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "mips" ; then
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __MIPSEB__
|
||||
printf ("%s-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
#ifdef __MIPSEL__
|
||||
printf ("%sel-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
else
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld)
|
||||
# or one that does not give us useful --help.
|
||||
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
# If ld does not provide *any* "supported emulations:"
|
||||
# that means it is gnuoldld.
|
||||
echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
|
||||
test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
|
||||
case "${UNAME_MACHINE}" in
|
||||
i?86)
|
||||
VENDOR=pc;
|
||||
;;
|
||||
*)
|
||||
VENDOR=unknown;
|
||||
;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
#include <features.h>
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
#else
|
||||
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
fi ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i?86:DYNIX/ptx:4*:*)
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i?86:UNIX_SV:4.2MP:2.*)
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# I just have to hope. -- rms.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
|
||||
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
pc:*:*:*)
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i386.
|
||||
echo i386-pc-msdosdjgpp
|
||||
exit 0 ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit 0 ;;
|
||||
paragon:*:*:*)
|
||||
echo i860-intel-osf1
|
||||
exit 0 ;;
|
||||
i860:*:4.*:*) # i860-SVR4
|
||||
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
|
||||
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
|
||||
else # Add other i860-SVR4 vendors below as they are discovered.
|
||||
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
|
||||
fi
|
||||
exit 0 ;;
|
||||
mini*:CTIX:SYS*5:*)
|
||||
# "miniframe"
|
||||
echo m68010-convergent-sysv
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
m68*:LynxOS:2.*:*)
|
||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i?86:LynxOS:2.*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
echo sparc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
echo mips-dde-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
*:SINIX-*:*:*)
|
||||
if uname -p 2>/dev/null >/dev/null ; then
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
echo ${UNAME_MACHINE}-sni-sysv4
|
||||
else
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit 0 ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
echo hppa1.1-stratus-sysv4
|
||||
exit 0 ;;
|
||||
*:*:*:FTX*)
|
||||
# From seanf@swdc.stratus.com.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
news*:NEWS-OS:*:6*)
|
||||
echo mips-sony-newsos6
|
||||
exit 0 ;;
|
||||
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
#if !defined (ultrix)
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
#else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#echo '(Unable to guess system type)' 1>&2
|
||||
|
||||
exit 1
|
||||
952
mozilla/build/autoconf/config.sub
vendored
Executable file
952
mozilla/build/autoconf/config.sub
vendored
Executable file
@@ -0,0 +1,952 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
# Each package is responsible for reporting which valid configurations
|
||||
# it does not support. The user should be able to distinguish
|
||||
# a failure to support a valid configuration from a meaningless
|
||||
# configuration.
|
||||
|
||||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or in some cases, the newer four-part form:
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
### recognize some manufacturers as not being operating systems, so we
|
||||
### can provide default operating systems below.
|
||||
case $os in
|
||||
-sun*os*)
|
||||
# Prevent following clause from handling this invalid input.
|
||||
;;
|
||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
-ptx*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||
;;
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
|
||||
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
|
||||
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| sparc | sparclet | sparclite | sparc64 | v850)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[34567]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
||||
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
|
||||
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
|
||||
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| f301-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
altos | altos3068)
|
||||
basic_machine=m68k-altos
|
||||
;;
|
||||
am29k)
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigaos | amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigaos
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c2)
|
||||
basic_machine=c2-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c32)
|
||||
basic_machine=c32-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c34)
|
||||
basic_machine=c34-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c38)
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
;;
|
||||
delta88)
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
;;
|
||||
dpx2* | dpx2*-bull)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
;;
|
||||
elxsi)
|
||||
basic_machine=elxsi-elxsi
|
||||
os=-bsd
|
||||
;;
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
genix)
|
||||
basic_machine=ns32k-ns
|
||||
;;
|
||||
gmicro)
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
h8300hms)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
;;
|
||||
hp300-*)
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp300bsd)
|
||||
basic_machine=m68k-hp
|
||||
os=-bsd
|
||||
;;
|
||||
hp300hpux)
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[34567]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[34567]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[34567]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[34567]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
-irix*)
|
||||
;;
|
||||
*)
|
||||
os=-irix4
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
isi68 | isi)
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
magnum | m3230)
|
||||
basic_machine=mips-mips
|
||||
os=-sysv
|
||||
;;
|
||||
merlin)
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news1000)
|
||||
basic_machine=m68030-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news-3600 | risc-news)
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
;;
|
||||
*)
|
||||
os=-nextstep3
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nh3000)
|
||||
basic_machine=m68k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nh[45]000)
|
||||
basic_machine=m88k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nindy960)
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
paragon)
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | nexen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | k6 | 6x86)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | nexen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | k6-* | 6x86-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
sh)
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
;;
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
sun2os3)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun2os4)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3os3)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun3os4)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4os3)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun4os4)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4sol2)
|
||||
basic_machine=sparc-sun
|
||||
os=-solaris2
|
||||
;;
|
||||
sun3 | sun3-*)
|
||||
basic_machine=m68k-sun
|
||||
;;
|
||||
sun4)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
tx39el)
|
||||
basic_machine=mipstx39el-unknown
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
ultra3)
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
;;
|
||||
vms)
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks68)
|
||||
basic_machine=m68k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks29k)
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
;;
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
basic_machine=orion-highlevel
|
||||
;;
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we canonicalize certain aliases for manufacturers.
|
||||
case $basic_machine in
|
||||
*-digital*)
|
||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||
;;
|
||||
*-commodore*)
|
||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-unixware*)
|
||||
os=-sysv4.2uw
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
-osf*)
|
||||
os=-osf
|
||||
;;
|
||||
-utek*)
|
||||
os=-bsd
|
||||
;;
|
||||
-dynix*)
|
||||
os=-bsd
|
||||
;;
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
;;
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
-svr3)
|
||||
os=-sysv3
|
||||
;;
|
||||
-sysvr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
# Get rid of the `-' at the beginning of $os.
|
||||
os=`echo $os | sed 's/[^-]*-//'`
|
||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
# Here we handle the default operating systems that come with various machines.
|
||||
# The value should be what the vendor currently ships out the door with their
|
||||
# machine or put another way, the most popular os provided with the machine.
|
||||
|
||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||
# "-sun"), then you have to tell the case statement up towards the top
|
||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||
# will signal an error saying that MANUFACTURER isn't an operating
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
os=-ultrix4.2
|
||||
;;
|
||||
m68*-apollo)
|
||||
os=-domain
|
||||
;;
|
||||
i386-sun)
|
||||
os=-sunos4.0.2
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
*-hitachi)
|
||||
os=-hiux
|
||||
;;
|
||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigaos
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
;;
|
||||
*-dolphin)
|
||||
os=-sysv3
|
||||
;;
|
||||
m68k-ccur)
|
||||
os=-rtu
|
||||
;;
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
*-crds)
|
||||
os=-unos
|
||||
;;
|
||||
*-ns)
|
||||
os=-genix
|
||||
;;
|
||||
i370-*)
|
||||
os=-mvs
|
||||
;;
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||
# manufacturer. We pick the logical manufacturer.
|
||||
vendor=unknown
|
||||
case $basic_machine in
|
||||
*-unknown)
|
||||
case $os in
|
||||
-riscix*)
|
||||
vendor=acorn
|
||||
;;
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-unos*)
|
||||
vendor=crds
|
||||
;;
|
||||
-dgux*)
|
||||
vendor=dg
|
||||
;;
|
||||
-luna*)
|
||||
vendor=omron
|
||||
;;
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
186
mozilla/build/autoconf/gtk.m4
Normal file
186
mozilla/build/autoconf/gtk.m4
Normal file
@@ -0,0 +1,186 @@
|
||||
# Configure paths for GTK+
|
||||
# Owen Taylor 97-11-3
|
||||
# (copy of gtk.m4 (public domain))
|
||||
|
||||
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_GTK,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the gtk-config script
|
||||
dnl
|
||||
AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
|
||||
gtk_config_prefix="$withval", gtk_config_prefix="")
|
||||
AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
|
||||
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
|
||||
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
|
||||
, enable_gtktest=yes)
|
||||
|
||||
if test x$gtk_config_exec_prefix != x ; then
|
||||
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
|
||||
if test x${GTK_CONFIG+set} != xset ; then
|
||||
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
|
||||
fi
|
||||
fi
|
||||
if test x$gtk_config_prefix != x ; then
|
||||
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
|
||||
if test x${GTK_CONFIG+set} != xset ; then
|
||||
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
|
||||
min_gtk_version=ifelse([$1], ,0.99.7,$1)
|
||||
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
|
||||
no_gtk=""
|
||||
if test "$GTK_CONFIG" = "no" ; then
|
||||
no_gtk=yes
|
||||
else
|
||||
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
|
||||
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
|
||||
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_gtktest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$LIBS $GTK_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GTK is sufficiently new. (Also sanity
|
||||
dnl checks the results of gtk-config to some extent
|
||||
dnl
|
||||
rm -f conf.gtktest
|
||||
AC_TRY_RUN([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.gtktest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_gtk_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_gtk_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((gtk_major_version != $gtk_config_major_version) ||
|
||||
(gtk_minor_version != $gtk_config_minor_version) ||
|
||||
(gtk_micro_version != $gtk_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
|
||||
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf ("*** was found! If gtk-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
|
||||
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
|
||||
printf("*** before re-running configure\n");
|
||||
}
|
||||
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
|
||||
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
|
||||
(gtk_minor_version != GTK_MINOR_VERSION) ||
|
||||
(gtk_micro_version != GTK_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
|
||||
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
}
|
||||
#endif /* defined (GTK_MAJOR_VERSION) ... */
|
||||
else
|
||||
{
|
||||
if ((gtk_major_version > major) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of gtk-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_gtk" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$GTK_CONFIG" = "no" ; then
|
||||
echo "*** The gtk-config script installed by GTK could not be found"
|
||||
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the GTK_CONFIG environment variable to the"
|
||||
echo "*** full path to gtk-config."
|
||||
else
|
||||
if test -f conf.gtktest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GTK test program, checking why..."
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$LIBS $GTK_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GTK or finding the wrong"
|
||||
echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||
echo "***"
|
||||
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
|
||||
echo "*** came with the system with the command"
|
||||
echo "***"
|
||||
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GTK was incorrectly installed"
|
||||
echo "*** or that you have moved GTK since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GTK_CFLAGS=""
|
||||
GTK_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
rm -f conf.gtktest
|
||||
])
|
||||
119
mozilla/build/autoconf/install-sh
Executable file
119
mozilla/build/autoconf/install-sh
Executable file
@@ -0,0 +1,119 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5; it is not part of GNU.
|
||||
#
|
||||
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
#
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
|
||||
instcmd="$mvprog"
|
||||
chmodcmd=""
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dstdir=`dirname $dst`
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd $dst
|
||||
$doit $mvcmd $dsttmp $dst
|
||||
|
||||
|
||||
exit 0
|
||||
83
mozilla/build/autoconf/update-makefile.sh
Executable file
83
mozilla/build/autoconf/update-makefile.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# This script will generate a single Makefile from a Makefile.in using
|
||||
# the config.status script.
|
||||
#
|
||||
# The config.status script is generated the first time you run
|
||||
# ./configure.
|
||||
#
|
||||
#
|
||||
# Usage: update-makefile.sh
|
||||
#
|
||||
# Send comments, improvements, bugs to ramiro@netscape.com
|
||||
#
|
||||
|
||||
# Make sure a Makefile.in exists
|
||||
if [ ! -f Makefile.in ]
|
||||
then
|
||||
echo
|
||||
echo "There ain't no 'Makefile.in' over here: $pwd"
|
||||
echo
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
# Use DEPTH in the Makefile.in to determine the depth
|
||||
depth=`grep -w DEPTH Makefile.in | grep -e "\.\." | awk -F"=" '{ print $2; }'`
|
||||
|
||||
# Determine the depth count
|
||||
n=`echo $depth | tr '/' ' ' | wc -w`
|
||||
|
||||
# Determine the path (strip anything before the mozilla/ root)
|
||||
path=`pwd | awk -v count=$n -F"/" '\
|
||||
{ for(i=NF-count+1; i <= NF ; i++) \
|
||||
{ \
|
||||
if (i!=NF) \
|
||||
{ printf "%s/", $i } \
|
||||
else \
|
||||
{ printf "%s", $i } \
|
||||
} \
|
||||
}'`
|
||||
|
||||
dir=$path
|
||||
|
||||
# Add a slash only to dirs where depth >= mozilla_root
|
||||
if [ $n -gt 0 ]
|
||||
then
|
||||
dir=${dir}"/"
|
||||
fi
|
||||
|
||||
back=`pwd`
|
||||
|
||||
makefile=${dir}"Makefile"
|
||||
|
||||
cd $depth
|
||||
|
||||
# Make sure config.status exists
|
||||
if [ -f config.status ]
|
||||
then
|
||||
CONFIG_FILES=$makefile ./config.status
|
||||
else
|
||||
echo
|
||||
echo "There ain't no 'config.status' over here: $pwd"
|
||||
echo
|
||||
fi
|
||||
|
||||
cd $back
|
||||
1
mozilla/build/build_number
Normal file
1
mozilla/build/build_number
Normal file
@@ -0,0 +1 @@
|
||||
98091517
|
||||
25
mozilla/build/genrc.sh
Executable file
25
mozilla/build/genrc.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DATATYPE="$1"
|
||||
INFILE="$2"
|
||||
|
||||
echo "${DATATYPE} RCDATA"
|
||||
sed 's/"/""/g' ${INFILE} | awk 'BEGIN { printf("BEGIN\n") } { printf("\"%s\\r\\n\",\n", $0) } END { printf("\"\\0\"\nEND\n") }'
|
||||
|
||||
exit 0
|
||||
91
mozilla/build/hcc
Executable file
91
mozilla/build/hcc
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Fix brain-damaged compilers that don't understand -o and -c together
|
||||
#
|
||||
CC=`echo $1 | sed -e "s|'||g" -e 's|"||g'`
|
||||
shift
|
||||
DASH_C=0
|
||||
DASH_O=0
|
||||
DUMMY="XxxXxxX"
|
||||
GET_OBJECT=0
|
||||
OBJ="${DUMMY}"
|
||||
OBJECT="${DUMMY}"
|
||||
|
||||
for i in $*
|
||||
do
|
||||
[ "${CHECK_O}" = yes ] && {
|
||||
case $i in
|
||||
./*/*.o) OBJECT="$i"
|
||||
OPTS="${OPTS} -o"
|
||||
DASH_O=1
|
||||
;;
|
||||
./*.o) OBJECT="`basename $i`"
|
||||
i=""
|
||||
DASH_O=1
|
||||
;;
|
||||
*.o) if [ $i = `basename $i` ]
|
||||
then
|
||||
OBJECT="$i"
|
||||
i=""
|
||||
else
|
||||
OPTS="${OPTS} -o"
|
||||
fi
|
||||
DASH_O=1
|
||||
;;
|
||||
*) OPTS="${OPTS} -o $i"
|
||||
DASH_O=1
|
||||
i=""
|
||||
;;
|
||||
esac
|
||||
CHECK_O=no
|
||||
}
|
||||
case $i in
|
||||
-c) DASH_C=1
|
||||
OPTS="${OPTS} -c"
|
||||
;;
|
||||
-o) CHECK_O=yes
|
||||
;;
|
||||
*.c) C_SRC=$i
|
||||
OPTS="${OPTS} $i"
|
||||
# cc always creates the .o from the .c name
|
||||
OBJ=`basename $C_SRC .c`.o
|
||||
;;
|
||||
*.s) S_SRC=$i
|
||||
OPTS="${OPTS} $i"
|
||||
# or the .o from the .s name
|
||||
OBJ=`basename $S_SRC .s`.o
|
||||
;;
|
||||
*.o) OBJECT=$i
|
||||
OPTS="${OPTS} $i"
|
||||
;;
|
||||
*) OPTS="${OPTS} $i"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
${CC} ${OPTS} || exit $?
|
||||
|
||||
# if there was no -c and -o we're done
|
||||
[ $DASH_C = 1 -a $DASH_O = 1 ] || exit 0
|
||||
|
||||
# if $OBJ and $OBJECT are the same we're done
|
||||
[ $OBJ = $OBJECT ] && exit 0
|
||||
|
||||
[ -f $OBJ ] && mv -f $OBJ $OBJECT
|
||||
118
mozilla/build/hcpp
Executable file
118
mozilla/build/hcpp
Executable file
@@ -0,0 +1,118 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Wrapper for brain-damaged compilers that don't understand -o and -c together.
|
||||
#
|
||||
CXX=`echo $1 | sed -e "s|'||g" -e 's|"||g'`
|
||||
shift
|
||||
DUMMY="XxxXxxX"
|
||||
DASH_C=0
|
||||
DASH_O=0
|
||||
GET_OBJECT=0
|
||||
C_SRC="${DUMMY}"
|
||||
CC_SRC="${DUMMY}"
|
||||
CPP_SRC="${DUMMY}"
|
||||
S_SRC="${DUMMY}"
|
||||
OBJECT="${DUMMY}"
|
||||
|
||||
for i in $*
|
||||
do
|
||||
[ ${GET_OBJECT} -eq 1 ] && {
|
||||
case $i in
|
||||
./*/*.o) OBJECT="$i"
|
||||
OPTS="${OPTS} -o"
|
||||
DASH_O=1
|
||||
;;
|
||||
./*.o) OBJECT="`basename $i`"
|
||||
i=""
|
||||
DASH_O=1
|
||||
;;
|
||||
*.o) if [ $i = `basename $i` ]
|
||||
then
|
||||
i=""
|
||||
else
|
||||
OPTS="${OPTS} -o"
|
||||
DASH_O=1
|
||||
fi
|
||||
;;
|
||||
*) OPTS="${OPTS} -o $i"
|
||||
DASH_O=1
|
||||
i=""
|
||||
;;
|
||||
esac
|
||||
GET_OBJECT=0
|
||||
}
|
||||
case $i in
|
||||
-c)
|
||||
DASH_C=1
|
||||
OPTS="${OPTS} -c"
|
||||
;;
|
||||
-o)
|
||||
GET_OBJECT=1
|
||||
;;
|
||||
*.c)
|
||||
C_SRC="$i"
|
||||
OPTS="${OPTS} $i"
|
||||
# cc always creates the .o from the .c name
|
||||
OBJ=`basename ${C_SRC} .c`.o
|
||||
;;
|
||||
+.*)
|
||||
OPTS="${OPTS} $i"
|
||||
;;
|
||||
*.cpp)
|
||||
CPP_SRC="$i"
|
||||
OPTS="${OPTS} $i"
|
||||
# cc always creates the .o from the .cpp name
|
||||
OBJ=`basename ${CPP_SRC} .cpp`.o
|
||||
;;
|
||||
*.cc)
|
||||
CC_SRC="$i"
|
||||
OPTS="${OPTS} $i"
|
||||
# cc always creates the .o from the .cc name
|
||||
OBJ=`basename ${CC_SRC} .cc`.o
|
||||
;;
|
||||
*.s)
|
||||
S_SRC="$i"
|
||||
OPTS="${OPTS} $i"
|
||||
# cc always creates the .o from the .s name
|
||||
OBJ=`basename ${S_SRC} .s`.o
|
||||
;;
|
||||
*.o) OBJECT=$i
|
||||
OPTS="${OPTS} $i"
|
||||
;;
|
||||
*) OPTS="${OPTS} $i"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
${CXX} ${OPTS} || exit $?
|
||||
|
||||
# LAME!!!
|
||||
if [ -f -O ]; then
|
||||
mv -f -- -O ${OBJECT}
|
||||
fi
|
||||
|
||||
# if there was no -c and -o we're done
|
||||
[ ${DASH_C} -eq 1 -a ${DASH_O} -eq 1 ] || exit 0
|
||||
|
||||
# if $OBJ and $OBJECT are the same we're done
|
||||
[ $OBJ = $OBJECT ] && exit 0
|
||||
|
||||
[ -f $OBJ ] && mv -f $OBJ $OBJECT
|
||||
|
||||
354
mozilla/build/mac/BuildList.pm
Normal file
354
mozilla/build/mac/BuildList.pm
Normal file
@@ -0,0 +1,354 @@
|
||||
#!perl
|
||||
|
||||
package BuildList;
|
||||
require Exporter;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(BuildMozilla DistMozilla);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
BuildList - build the [ordered] set of projects needed to construct Mozilla
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
...
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "NPL"); you may not use this file except in
|
||||
compliance with the NPL. You may obtain a copy of the NPL at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
for the specific language governing rights and limitations under the
|
||||
NPL.
|
||||
|
||||
The Initial Developer of this code under the NPL is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
Reserved.
|
||||
|
||||
=cut
|
||||
|
||||
use Moz;
|
||||
use File::Path;
|
||||
|
||||
sub BuildMozilla()
|
||||
{
|
||||
if ( $main::DEBUG )
|
||||
{
|
||||
$D = "Debug";
|
||||
$dist_dir = ":mozilla:dist:client_debug:";
|
||||
}
|
||||
else
|
||||
{
|
||||
$D = "";
|
||||
$dist_dir = ":mozilla:dist:client:";
|
||||
}
|
||||
|
||||
#
|
||||
# Build the appropriate target of each project
|
||||
#
|
||||
|
||||
BuildProjectClean(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "Stubs");
|
||||
BuildProjectClean(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "Stubs");
|
||||
BuildProjectClean(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "Stubs");
|
||||
# BuildProjectClean(":mozilla:cmd:macfe:projects:client:Client.mcp", "Stubs");
|
||||
|
||||
if ( $main::CARBON )
|
||||
{
|
||||
BuildProject(":mozilla:cmd:macfe:projects:interfaceLib:Interface.mcp", "Carbon Interfaces");
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildProject(":mozilla:cmd:macfe:projects:interfaceLib:Interface.mcp", "MacOS Interfaces");
|
||||
}
|
||||
|
||||
BuildProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "NSRuntime$D.shlb");
|
||||
MakeAlias(":mozilla:lib:mac:NSRuntime:NSRuntime$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:cmd:macfe:restext:StringLib.mcp", "Strings$D.shlb");
|
||||
MakeAlias(":mozilla:cmd:macfe:restext:Strings$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.mcp", "MoreFiles$D.shlb");
|
||||
MakeAlias(":mozilla:lib:mac:MoreFiles:build:MoreFiles$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb");
|
||||
MakeAlias(":mozilla:nsprpub:macbuild:NSPR20$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:dbm:macbuild:DBMPPC.mcp", "DBM$D.shlb");
|
||||
MakeAlias(":mozilla:dbm:macbuild:DBM$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "MemAllocator$D.shlb");
|
||||
MakeAlias(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "NSStdLib$D.shlb");
|
||||
MakeAlias(":mozilla:lib:mac:NSStdLib:NSStdLib$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp", "xpcom$D.shlb");
|
||||
MakeAlias(":mozilla:xpcom:macbuild:xpcom$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:lib:mac:PowerPlant:PowerPlant.mcp", "PowerPlant$D.shlb");
|
||||
MakeAlias(":mozilla:lib:mac:PowerPlant:PowerPlant$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:modules:progress:macbuild:ProgressPPC.mcp", "Progress$D.shlb");
|
||||
MakeAlias(":mozilla:modules:progress:macbuild:Progress$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:modules:zlib:macbuild:zlib.mcp", "zlib$D.shlb");
|
||||
MakeAlias(":mozilla:modules:zlib:macbuild:zlib$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:jpeg:macbuild:JPEG.mcp", "JPEG$D.shlb");
|
||||
MakeAlias(":mozilla:jpeg:macbuild:JPEG$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:sun-java:stubs:macbuild:JavaStubs.mcp", "JavaRuntime$D.shlb");
|
||||
MakeAlias(":mozilla:sun-java:stubs:macbuild:JavaRuntime$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:js:macbuild:JavaScriptPPC.mcp", "JavaScript$D.shlb");
|
||||
MakeAlias(":mozilla:js:macbuild:JavaScript$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:js:macbuild:LiveConnect.mcp", "LiveConnect$D.shlb");
|
||||
MakeAlias(":mozilla:js:macbuild:LiveConnect$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:nav-java:stubs:macbuild:NavJavaStubs.mcp", "NavJava$D.shlb");
|
||||
MakeAlias(":mozilla:nav-java:stubs:macbuild:NavJava$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:modules:rdf:macbuild:RDF.mcp", "RDF$D.shlb");
|
||||
MakeAlias(":mozilla:modules:rdf:macbuild:RDF$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:modules:xml:macbuild:XML.mcp", "XML$D.shlb");
|
||||
MakeAlias(":mozilla:modules:xml:macbuild:XML$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:modules:schedulr:macbuild:Schedulr.mcp", "Scheduler$D.shlb");
|
||||
MakeAlias(":mozilla:modules:schedulr:macbuild:Scheduler$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:build:mac:CustomLib:CustomLib.mcp", "CustomLib$D.shlb");
|
||||
MakeAlias(":mozilla:build:mac:CustomLib:CustomLib$D.shlb", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "Security.o");
|
||||
BuildProject(":mozilla:modules:libfont:macbuild:FontBroker.mcp", "FontBroker$D.o");
|
||||
BuildProject(":mozilla:modules:oji:macbuild:oji.mcp", "oji$D.o");
|
||||
BuildProject(":mozilla:lib:libmocha:macbuild:LibMocha.mcp", "LibMocha$D.o");
|
||||
|
||||
if ( $main::MOZ_DARK == 1 )
|
||||
{
|
||||
BuildProject(":mozilla:network:macbuild:network.mcp", "Network$D.o (mailnews)");
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildProject(":mozilla:network:macbuild:network.mcp", "Network$D.o");
|
||||
}
|
||||
BuildProject(":mozilla:caps:macbuild:Caps.mcp", "Caps$D.o");
|
||||
|
||||
BuildProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o");
|
||||
BuildProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.o");
|
||||
|
||||
BuildProject(":mozilla:build:mac:CustomLib:CustomLib.mcp", "CustomStaticLib$D.o");
|
||||
|
||||
if ( $main::MOZ_LITE == 1 )
|
||||
{
|
||||
BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "MailNews$D.o");
|
||||
BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "Composer$D.o");
|
||||
BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Nav_Resources");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $main::MOZ_MEDIUM == 1 )
|
||||
{
|
||||
BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "MailNews$D.o");
|
||||
BuildProject(":mozilla:cmd:macfe:Composer:build:Composer.mcp", "Composer$D.o");
|
||||
BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Moz_Resources");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $main::MOZ_DARK == 1 )
|
||||
{
|
||||
BuildProject(":ns:lib:libneo:mac:macbuild:NeoLib.mcp", "NeoLib$D.o");
|
||||
MakeAlias( ":ns:lib:libneo:mac:macbuild:NeoLib$D.o", "$dist_dir");
|
||||
BuildProject(":mozilla:lib:libmsg:macbuild:MsgLib.mcp", "MsgLib$D.o (secure)");
|
||||
MakeAlias( ":mozilla:lib:libmsg:macbuild:MsgLib$D.o", "$dist_dir");
|
||||
BuildProject(":mozilla:directory:c-sdk:ldap:libraries:macintosh:LDAPClient.mcp","LDAPClient$D.o");
|
||||
MakeAlias( ":mozilla:directory:c-sdk:ldap:libraries:macintosh:LDAPClient$D.o", "$dist_dir");
|
||||
|
||||
BuildProject(":mozilla:cmd:macfe:MailNews:build:MailNews.mcp", "MailNews$D.o");
|
||||
BuildProject(":mozilla:cmd:macfe:Composer:build:Composer.mcp", "Composer$D.o");
|
||||
BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "MozDark_Resources");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Client$D");
|
||||
}
|
||||
|
||||
|
||||
sub DistMozilla()
|
||||
{
|
||||
mkpath([ ":mozilla:dist:", ":mozilla:dist:client:", ":mozilla:dist:client_debug:", ":mozilla:dist:client_stubs:" ]);
|
||||
|
||||
#CONFIG
|
||||
InstallFromManifest(":mozilla:config:mac:MANIFEST", ":mozilla:dist:config:");
|
||||
InstallFromManifest(":mozilla:config:mac:MANIFEST_config", ":mozilla:dist:config:");
|
||||
|
||||
#INCLUDE
|
||||
InstallFromManifest(":mozilla:include:MANIFEST", ":mozilla:dist:include:");
|
||||
InstallFromManifest(":mozilla:cmd:macfe:pch:MANIFEST", ":mozilla:dist:include:");
|
||||
|
||||
#MAC_COMMON
|
||||
InstallFromManifest(":mozilla:build:mac:MANIFEST", ":mozilla:dist:mac:common:");
|
||||
InstallFromManifest(":mozilla:lib:mac:NSStdLib:include:MANIFEST", ":mozilla:dist:mac:common:");
|
||||
InstallFromManifest(":mozilla:lib:mac:MacMemoryAllocator:include:MANIFEST", ":mozilla:dist:mac:common:");
|
||||
InstallFromManifest(":mozilla:lib:mac:Misc:MANIFEST", ":mozilla:dist:mac:common:");
|
||||
InstallFromManifest(":mozilla:lib:mac:MoreFiles:MANIFEST", ":mozilla:dist:mac:common:morefiles:");
|
||||
InstallFromManifest(":mozilla:cmd:macfe:MANIFEST", ":mozilla:dist:mac:macfe:");
|
||||
|
||||
#NSPR
|
||||
InstallFromManifest(":mozilla:nsprpub:pr:include:MANIFEST", ":mozilla:dist:nspr:");
|
||||
InstallFromManifest(":mozilla:nsprpub:pr:src:md:mac:MANIFEST", ":mozilla:dist:nspr:mac:");
|
||||
InstallFromManifest(":mozilla:nsprpub:lib:ds:MANIFEST", ":mozilla:dist:nspr:");
|
||||
InstallFromManifest(":mozilla:nsprpub:lib:libc:include:MANIFEST", ":mozilla:dist:nspr:");
|
||||
InstallFromManifest(":mozilla:nsprpub:lib:msgc:include:MANIFEST", ":mozilla:dist:nspr:");
|
||||
|
||||
#DBM
|
||||
InstallFromManifest(":mozilla:dbm:include:MANIFEST", ":mozilla:dist:dbm:");
|
||||
|
||||
#LIBIMAGE
|
||||
InstallFromManifest(":mozilla:modules:libimg:png:MANIFEST", ":mozilla:dist:libimg:");
|
||||
InstallFromManifest(":mozilla:modules:libimg:src:MANIFEST", ":mozilla:dist:libimg:");
|
||||
InstallFromManifest(":mozilla:modules:libimg:public:MANIFEST", ":mozilla:dist:libimg:");
|
||||
|
||||
#SECURITY_freenav
|
||||
InstallFromManifest(":mozilla:modules:security:freenav:MANIFEST", ":mozilla:dist:security:");
|
||||
|
||||
#XPCOM
|
||||
InstallFromManifest(":mozilla:xpcom:public:MANIFEST", ":mozilla:dist:xpcom:");
|
||||
|
||||
#ZLIB
|
||||
InstallFromManifest(":mozilla:modules:zlib:src:MANIFEST", ":mozilla:dist:zlib:");
|
||||
|
||||
#JPEG
|
||||
InstallFromManifest(":mozilla:jpeg:MANIFEST", ":mozilla:dist:jpeg:");
|
||||
|
||||
#JSJ
|
||||
# beard: this conflicts with LiveConnect's jsjava.h.
|
||||
#InstallFromManifest(":mozilla:js:jsj:MANIFEST", ":mozilla:dist:jsj:");
|
||||
|
||||
#JSDEBUG
|
||||
InstallFromManifest(":mozilla:js:jsd:MANIFEST", ":mozilla:dist:jsdebug:");
|
||||
|
||||
#JS
|
||||
InstallFromManifest(":mozilla:js:src:MANIFEST", ":mozilla:dist:js:");
|
||||
|
||||
#LIVECONNECT
|
||||
InstallFromManifest(":mozilla:js:src:liveconnect:MANIFEST", ":mozilla:dist:liveconnect:");
|
||||
|
||||
#RDF
|
||||
InstallFromManifest(":mozilla:modules:rdf:include:MANIFEST", ":mozilla:dist:rdf:");
|
||||
|
||||
#XML
|
||||
InstallFromManifest(":mozilla:modules:xml:glue:MANIFEST", ":mozilla:dist:xml:");
|
||||
InstallFromManifest(":mozilla:modules:xml:expat:xmlparse:MANIFEST", ":mozilla:dist:xml:");
|
||||
|
||||
#LIBFONT
|
||||
InstallFromManifest(":mozilla:modules:libfont:MANIFEST", ":mozilla:dist:libfont:");
|
||||
InstallFromManifest(":mozilla:modules:libfont:src:MANIFEST", ":mozilla:dist:libfont:");
|
||||
|
||||
#LDAP
|
||||
if ( $main::MOZ_LDAP || $main::MOZ_DARK )
|
||||
{
|
||||
InstallFromManifest(":mozilla:directory:c-sdk:ldap:include:MANIFEST", ":mozilla:dist:ldap:");
|
||||
}
|
||||
|
||||
#PRIVACY
|
||||
InstallFromManifest(":mozilla:privacy:public:MANIFEST", ":mozilla:dist:privacy:");
|
||||
|
||||
#SCHEDULER
|
||||
InstallFromManifest(":mozilla:modules:schedulr:public:MANIFEST", ":mozilla:dist:schedulr:");
|
||||
|
||||
#NETWORK
|
||||
InstallFromManifest(":mozilla:network:cache:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:client:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:cnvts:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:cstream:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:main:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:mimetype:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:util:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:about:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:certld:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:dataurl:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:file:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:ftp:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:gopher:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:http:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:imap4:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:js:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:ldap:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:mailbox:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:marimba:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:nntp:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:pop3:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:remote:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:smtp:MANIFEST", ":mozilla:dist:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:sockstub:MANIFEST", ":mozilla:dist:network:");
|
||||
|
||||
#HTML_DIALOGS
|
||||
InstallFromManifest(":mozilla:lib:htmldlgs:MANIFEST", ":mozilla:dist:htmldlgs:");
|
||||
|
||||
#LAYOUT
|
||||
InstallFromManifest(":mozilla:lib:layout:MANIFEST", ":mozilla:dist:layout:");
|
||||
|
||||
#LAYERS
|
||||
InstallFromManifest(":mozilla:lib:liblayer:include:MANIFEST", ":mozilla:dist:layers:");
|
||||
|
||||
#PARSE
|
||||
InstallFromManifest(":mozilla:lib:libparse:MANIFEST", ":mozilla:dist:libparse:");
|
||||
|
||||
#STYLE
|
||||
InstallFromManifest(":mozilla:lib:libstyle:MANIFEST", ":mozilla:dist:libstyle:");
|
||||
|
||||
#PLUGIN
|
||||
InstallFromManifest(":mozilla:modules:plugin:public:MANIFEST", ":mozilla:dist:plugin:");
|
||||
InstallFromManifest(":mozilla:modules:plugin:src:MANIFEST", ":mozilla:dist:plugin:");
|
||||
|
||||
#LIBHOOK
|
||||
InstallFromManifest(":mozilla:modules:libhook:public:MANIFEST", ":mozilla:dist:libhook:");
|
||||
|
||||
#LIBPREF
|
||||
InstallFromManifest(":mozilla:modules:libpref:public:MANIFEST", ":mozilla:dist:libpref:");
|
||||
|
||||
#LIBREG
|
||||
InstallFromManifest(":mozilla:modules:libreg:include:MANIFEST", ":mozilla:dist:libreg:");
|
||||
|
||||
#LIBUTIL
|
||||
InstallFromManifest(":mozilla:modules:libutil:public:MANIFEST", ":mozilla:dist:libutil:");
|
||||
|
||||
#PROGRESS
|
||||
InstallFromManifest(":mozilla:modules:progress:public:MANIFEST", ":mozilla:dist:progress:");
|
||||
|
||||
#EDTPLUG
|
||||
InstallFromManifest(":mozilla:modules:edtplug:include:MANIFEST", ":mozilla:dist:edtplug:");
|
||||
|
||||
#NAV_JAVA
|
||||
InstallFromManifest(":mozilla:nav-java:stubs:include:MANIFEST", ":mozilla:dist:nav-java:");
|
||||
InstallFromManifest(":mozilla:nav-java:stubs:macjri:MANIFEST", ":mozilla:dist:nav-java:");
|
||||
|
||||
#SUN_JAVA
|
||||
InstallFromManifest(":mozilla:sun-java:stubs:include:MANIFEST", ":mozilla:dist:sun-java:");
|
||||
InstallFromManifest(":mozilla:sun-java:stubs:macjri:MANIFEST", ":mozilla:dist:sun-java:");
|
||||
|
||||
#OJI
|
||||
InstallFromManifest(":mozilla:modules:oji:public:MANIFEST", ":mozilla:dist:oji:");
|
||||
InstallFromManifest(":mozilla:modules:oji:src:MANIFEST", ":mozilla:dist:oji:");
|
||||
|
||||
#CAPS
|
||||
InstallFromManifest(":mozilla:caps:include:MANIFEST", ":mozilla:dist:caps:");
|
||||
InstallFromManifest(":mozilla:caps:public:MANIFEST", ":mozilla:dist:caps:");
|
||||
|
||||
#BASE
|
||||
InstallFromManifest(":mozilla:base:public:MANIFEST", ":mozilla:dist:base:");
|
||||
InstallFromManifest(":mozilla:base:src:MANIFEST", ":mozilla:dist:base:");
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
40
mozilla/build/mac/BuildMozilla.pl
Normal file
40
mozilla/build/mac/BuildMozilla.pl
Normal file
@@ -0,0 +1,40 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
use Moz;
|
||||
use BuildList;
|
||||
|
||||
$DEBUG = 0;
|
||||
|
||||
# One of them should be 1. This will come from a config file at some stage.
|
||||
# In the meanwhile, it should match mozilla/config/mac/MacConfig.h
|
||||
$MOZ_LITE = 0;
|
||||
$MOZ_MEDIUM = 1;
|
||||
$MOZ_DARK = 0;
|
||||
|
||||
Moz::OpenErrorLog(":::Mozilla.BuildLog");
|
||||
Moz::StopForErrors();
|
||||
|
||||
chdir("::::");
|
||||
|
||||
# Make and popuplate the dist directory
|
||||
DistMozilla();
|
||||
|
||||
# Now build the projects
|
||||
BuildMozilla();
|
||||
44
mozilla/build/mac/BuildMozillaDebug.pl
Normal file
44
mozilla/build/mac/BuildMozillaDebug.pl
Normal file
@@ -0,0 +1,44 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
use Moz;
|
||||
use BuildList;
|
||||
|
||||
$DEBUG = 1;
|
||||
|
||||
# One of them should be 1. This will come from a config file at some stage.
|
||||
# In the meanwhile, it should match mozilla/config/mac/MacConfig.h
|
||||
$MOZ_LITE = 0;
|
||||
$MOZ_MEDIUM = 1;
|
||||
$MOZ_DARK = 0;
|
||||
|
||||
Moz::OpenErrorLog(":::Mozilla.BuildLog");
|
||||
Moz::StopForErrors();
|
||||
|
||||
chdir("::::");
|
||||
|
||||
# Make and popuplate the dist directory
|
||||
DistMozilla();
|
||||
|
||||
# Set the build number in about-all.html. Commented out for now
|
||||
# until ckid/mcvs resource problem is resolved.
|
||||
# SetBuildNumber();
|
||||
|
||||
# Now build the projects
|
||||
BuildMozilla();
|
||||
51
mozilla/build/mac/BuildMozillaOfficialDebug.pl
Normal file
51
mozilla/build/mac/BuildMozillaOfficialDebug.pl
Normal file
@@ -0,0 +1,51 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
use Moz;
|
||||
use BuildList;
|
||||
|
||||
$DEBUG = 1;
|
||||
|
||||
# One of them should be 1. This will come from a config file at some stage.
|
||||
# In the meanwhile, it should match mozilla/config/mac/MacConfig.h
|
||||
$MOZ_LITE = 0;
|
||||
$MOZ_MEDIUM = 1;
|
||||
$MOZ_DARK = 0;
|
||||
|
||||
Moz::OpenErrorLog(":::Mozilla.BuildLog");
|
||||
Moz::StopForErrors();
|
||||
|
||||
chdir("::::");
|
||||
|
||||
SetBuildNumber();
|
||||
|
||||
SetTimeBomb(0, 30);
|
||||
|
||||
# Make and popuplate the dist directory
|
||||
DistMozilla();
|
||||
|
||||
Delay(10);
|
||||
|
||||
# Set the build number in about-all.html. Commented out for now
|
||||
# until ckid/mcvs resource problem is resolved.
|
||||
|
||||
# SetAgentString();
|
||||
|
||||
# Now build the projects
|
||||
BuildMozilla();
|
||||
95
mozilla/build/mac/BuildNGLayout.pl
Normal file
95
mozilla/build/mac/BuildNGLayout.pl
Normal file
@@ -0,0 +1,95 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# nglayout build script (debug)
|
||||
#
|
||||
use Mac::Processes;
|
||||
use NGLayoutBuildList;
|
||||
use Cwd;
|
||||
use Moz;
|
||||
|
||||
# configuration variables
|
||||
$DEBUG = 0;
|
||||
$ALIAS_SYM_FILES = $DEBUG;
|
||||
$CLOBBER_LIBS = 0;
|
||||
$MOZ_FULLCIRCLE = 0;
|
||||
|
||||
$pull{all} = 0;
|
||||
$pull{lizard} = 0;
|
||||
$pull{xpcom} = 0;
|
||||
$pull{imglib} = 0;
|
||||
$pull{netlib} = 0;
|
||||
$pull{nglayout} = 0;
|
||||
$pull{mac} = 0;
|
||||
|
||||
$build{all} = 1; # turn off to do individual builds
|
||||
$build{dist} = 0;
|
||||
$build{stubs} = 0;
|
||||
$build{common} = 0;
|
||||
$build{nglayout} = 0;
|
||||
$build{resources} = 0;
|
||||
$build{editor} = 0;
|
||||
$build{viewer} = 0;
|
||||
$build{xpapp} = 0;
|
||||
|
||||
if ($pull{all})
|
||||
{
|
||||
foreach $k (keys(%pull))
|
||||
{
|
||||
$pull{$k} = 1;
|
||||
}
|
||||
}
|
||||
if ($build{all})
|
||||
{
|
||||
foreach $k (keys(%build))
|
||||
{
|
||||
$build{$k} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# do the work
|
||||
# you should not have to edit anything bellow
|
||||
|
||||
chdir("::::");
|
||||
$MOZ_SRC = cwd();
|
||||
|
||||
if ($MOZ_FULLCIRCLE)
|
||||
{
|
||||
#// Get the Build Number for the Master.ini(Full Circle) n'stuff
|
||||
$buildnum = Moz::SetBuildNumber();
|
||||
}
|
||||
|
||||
OpenErrorLog("NGLayoutBuildLog");
|
||||
#OpenErrorLog("Mozilla.BuildLog"); # Tinderbox requires that name
|
||||
|
||||
Moz::StopForErrors();
|
||||
#Moz::DontStopForErrors();
|
||||
|
||||
if ($pull{all}) {
|
||||
Checkout();
|
||||
}
|
||||
|
||||
chdir($MOZ_SRC);
|
||||
BuildDist();
|
||||
|
||||
chdir($MOZ_SRC);
|
||||
BuildProjects();
|
||||
|
||||
print "Build layout complete\n";
|
||||
96
mozilla/build/mac/BuildNGLayoutDebug.pl
Normal file
96
mozilla/build/mac/BuildNGLayoutDebug.pl
Normal file
@@ -0,0 +1,96 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# nglayout build script (debug)
|
||||
#
|
||||
use Mac::Processes;
|
||||
use NGLayoutBuildList;
|
||||
use Cwd;
|
||||
use Moz;
|
||||
|
||||
# configuration variables
|
||||
$DEBUG = 1;
|
||||
$ALIAS_SYM_FILES = $DEBUG;
|
||||
$CLOBBER_LIBS = 1; # turn on to clobber existing libs and .xSYM files before
|
||||
# building each project
|
||||
$MOZ_FULLCIRCLE = 0;
|
||||
|
||||
$pull{all} = 0;
|
||||
$pull{lizard} = 0;
|
||||
$pull{xpcom} = 0;
|
||||
$pull{imglib} = 0;
|
||||
$pull{netlib} = 0;
|
||||
$pull{nglayout} = 0;
|
||||
$pull{mac} = 0;
|
||||
|
||||
$build{all} = 1; # turn off to do individual builds
|
||||
$build{dist} = 0;
|
||||
$build{stubs} = 0;
|
||||
$build{common} = 0;
|
||||
$build{nglayout} = 0;
|
||||
$build{resources} = 0;
|
||||
$build{editor} = 0;
|
||||
$build{viewer} = 0;
|
||||
$build{xpapp} = 0;
|
||||
|
||||
if ($pull{all})
|
||||
{
|
||||
foreach $k (keys(%pull))
|
||||
{
|
||||
$pull{$k} = 1;
|
||||
}
|
||||
}
|
||||
if ($build{all})
|
||||
{
|
||||
foreach $k (keys(%build))
|
||||
{
|
||||
$build{$k} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# do the work
|
||||
# you should not have to edit anything bellow
|
||||
|
||||
chdir("::::");
|
||||
$MOZ_SRC = cwd();
|
||||
|
||||
if ($MOZ_FULLCIRCLE)
|
||||
{
|
||||
#// Get the Build Number for the Master.ini(Full Circle) n'stuff
|
||||
$buildnum = Moz::SetBuildNumber();
|
||||
}
|
||||
|
||||
OpenErrorLog("NGLayoutDebugBuildLog");
|
||||
#OpenErrorLog("Mozilla.BuildLog"); # Tinderbox requires that name
|
||||
|
||||
Moz::StopForErrors();
|
||||
#Moz::DontStopForErrors();
|
||||
|
||||
if ($pull{all}) {
|
||||
Checkout();
|
||||
}
|
||||
|
||||
chdir($MOZ_SRC);
|
||||
BuildDist();
|
||||
|
||||
chdir($MOZ_SRC);
|
||||
BuildProjects();
|
||||
|
||||
print "Build layout complete\n";
|
||||
385
mozilla/build/mac/CodeWarriorLib.pm
Normal file
385
mozilla/build/mac/CodeWarriorLib.pm
Normal file
@@ -0,0 +1,385 @@
|
||||
#!perl
|
||||
package CodeWarriorLib;
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
CodeWarriorLib - supply interface to CodeWarrior
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#!perl
|
||||
use CodeWarriorLib;
|
||||
CodeWarriorLib::activate();
|
||||
$had_errors = CodeWarriorLib::build_project(
|
||||
$project_path, $target_name, $recent_errors_file, $clean_build
|
||||
);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Replaces the AppleScript library I<CodeWarriorLib>.
|
||||
|
||||
=over 4
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use Mac::AppleEvents::Simple;
|
||||
use Mac::AppleEvents;
|
||||
use Mac::Processes;
|
||||
use Mac::MoreFiles;
|
||||
use Mac::Types;
|
||||
use File::Basename;
|
||||
|
||||
use vars qw($VERSION);
|
||||
$VERSION = '1.02';
|
||||
|
||||
my($app) = 'CWIE';
|
||||
|
||||
# 0 == don't switch CWIE to front app in do_event(), 1 == do switch
|
||||
# note: activate() still switches when called
|
||||
$Mac::AppleEvents::Simple::SWITCH = 0;
|
||||
|
||||
# supply your own path to the source here
|
||||
#_test('PowerPudgeIV:mozilla:mozilla:');
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item _get_project($full_path)
|
||||
|
||||
A private routine returning a reference to the open project with the given name,
|
||||
or else the empty string (when that project is not open)
|
||||
|
||||
full_path is a string identifying the project to be built and is of the form,
|
||||
e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied.
|
||||
|
||||
=cut
|
||||
|
||||
sub _get_project ($) {
|
||||
my(
|
||||
$full_path, $candidate_projects
|
||||
) = @_;
|
||||
$candidate_projects = _doc_named(basename($full_path, '*'));
|
||||
if ($candidate_projects) {
|
||||
my($cps) = _get_dobj($candidate_projects);
|
||||
my($num) = AECountItems($cps);
|
||||
if ($num) { # is a list
|
||||
foreach (1 .. AECountItems($cps)) {
|
||||
my($cp) = AEGetNthDesc($cps, $_);
|
||||
if ($full_path eq _full_path($cp)) {
|
||||
return($cp);
|
||||
}
|
||||
}
|
||||
} else { # is only one, not a list
|
||||
if ($full_path eq _full_path($cps)) {
|
||||
return($cps);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item build_project
|
||||
|
||||
Build a selected target of a project, saving any errors to a file, if supplied.
|
||||
|
||||
full_path is a string identifying the project to be built and is of the form,
|
||||
e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied.
|
||||
|
||||
If target_name is the empty string, the current target of the selected project
|
||||
will be built, else, target_name should be a string matching a target name in
|
||||
the selected project.
|
||||
|
||||
If error_path is the empty string, errors will not be saved to a file,
|
||||
else, error_path should be the full path of a file to save error messages into.
|
||||
|
||||
=cut
|
||||
|
||||
sub build_project ($;$$$) {
|
||||
my(
|
||||
$full_path, $target_name, $error_path,
|
||||
$remove_object, $p, $project_was_closed, $had_errors
|
||||
) = @_;
|
||||
_close_errors_window();
|
||||
|
||||
while (1) {
|
||||
$p = _get_project($full_path);
|
||||
if (!$p) {
|
||||
if ($project_was_closed) {
|
||||
print "### Error - request for project document failed after opening\n";
|
||||
die "### possibly CW Pro 4 bug: be sure to close your Find window\n";
|
||||
}
|
||||
$project_was_closed = 1;
|
||||
_open_file($full_path);
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$had_errors = 0;
|
||||
if ($target_name eq '') {
|
||||
if ($remove_object) {_remove_object($p)}
|
||||
_build($p);
|
||||
} else {
|
||||
if ($remove_object) {_remove_object($p, $target_name)}
|
||||
_build($p, $target_name);
|
||||
}
|
||||
|
||||
if ($error_path ne '') {
|
||||
_save_errors_window($error_path);
|
||||
}
|
||||
$had_errors = _close_errors_window();
|
||||
|
||||
if ($project_was_closed) {
|
||||
$p = _get_project($full_path);
|
||||
_close($p);
|
||||
}
|
||||
|
||||
return($had_errors);
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item activate()
|
||||
|
||||
Launches CodeWarrior and brings it to the front.
|
||||
|
||||
Once found, path will be saved in ':idepath.txt' for future reference.
|
||||
Edit or delete this file to change the location of the IDE. If app is
|
||||
moved, C<activate()> will prompt for a new location.
|
||||
|
||||
First looks for an open CodeWarrior app. Second, tries to open previously
|
||||
saved location in ':idepath.txt'. Third, tries to find it and allow user
|
||||
to choose it with Navigation Services (if present). Fourth, uses good old
|
||||
GUSI routines built-in to MacPerl for a Choose Directory dialog box.
|
||||
|
||||
=cut
|
||||
|
||||
sub activate () {
|
||||
local(*F);
|
||||
my($filepath, $appath, $psi) = (':idepath.txt');
|
||||
|
||||
foreach $psi (values(%Process)) {
|
||||
if ($psi->processSignature() eq $app) {
|
||||
$appath = $psi->processAppSpec(), "\n";
|
||||
_save_appath($filepath, $appath);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!$appath || ! -x $appath) && open(F, $filepath)) {
|
||||
$appath = <F>;
|
||||
close(F);
|
||||
}
|
||||
|
||||
if (!$appath || ! -x $appath) {
|
||||
if (eval {require Mac::Navigation}) {
|
||||
my($options, $nav);
|
||||
Mac::Navigation->import();
|
||||
$options = NavGetDefaultDialogOptions();
|
||||
$options->message('Where is CodeWarrior IDE?');
|
||||
$options->windowTitle('Find CodeWarrior IDE');
|
||||
$nav = NavChooseObject($Application{$app}, $options);
|
||||
die "CodeWarrior IDE not found.\n" if (!$nav || !$nav->file(1));
|
||||
$appath = $nav->file(1);
|
||||
} else {
|
||||
local(*D);
|
||||
my $cwd = `pwd`;
|
||||
$appath = _get_folder(
|
||||
'Where is the CW IDE folder?',
|
||||
dirname($Application{$app})
|
||||
);
|
||||
die "CodeWarrior IDE not found.\n" if !$appath;
|
||||
opendir(D, $appath) or die $!;
|
||||
chdir($appath);
|
||||
foreach my $file (sort readdir (D)) {
|
||||
my(@app) = MacPerl::GetFileInfo($file);
|
||||
if ($app[0] && $app[1] &&
|
||||
$app[1] eq 'APPL' && $app[0] eq $app
|
||||
) {
|
||||
$appath .= $file;
|
||||
last;
|
||||
}
|
||||
}
|
||||
chomp($cwd);
|
||||
chdir($cwd);
|
||||
}
|
||||
_save_appath($filepath, $appath);
|
||||
}
|
||||
|
||||
my($lp) = LaunchParam->new(
|
||||
launchAppSpec => $appath,
|
||||
launchControlFlags => launchContinue() + launchNoFileFlags()
|
||||
);
|
||||
unless (LaunchApplication($lp)) {
|
||||
unlink($filepath);
|
||||
die $^E;
|
||||
}
|
||||
}
|
||||
|
||||
sub _build ($;$) {
|
||||
my($evt);
|
||||
if ($_[1]) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" .
|
||||
AEPrint($_[0]) . '}';
|
||||
$evt = do_event(qw/CWIE MAKE/, $app, $prm, $_[1]);
|
||||
} else {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
$evt = do_event(qw/CWIE MAKE/, $app, $prm);
|
||||
}
|
||||
}
|
||||
|
||||
sub _remove_object ($;$) {
|
||||
my($evt);
|
||||
if ($_[1]) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" .
|
||||
AEPrint($_[0]) . '}';
|
||||
$evt = do_event(qw/CWIE RMOB/, $app, $prm, $_[1]);
|
||||
} else {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
$evt = do_event(qw/CWIE RMOB/, $app, $prm);
|
||||
}
|
||||
}
|
||||
|
||||
sub _open_file ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), " .
|
||||
q"seld:TEXT(@), from:'null'()}";
|
||||
|
||||
do_event(qw/aevt odoc/, $app, $prm, $_[0]);
|
||||
}
|
||||
|
||||
sub _doc_named ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:test, want:type(docu), from:'null'(), " .
|
||||
q"seld:cmpd{relo:'= ', 'obj1':obj {form:prop, want:type" .
|
||||
q"(prop), seld:type(pnam), from:'exmn'()}, 'obj2':TEXT(@)}}";
|
||||
|
||||
my($evt) = do_event(qw/core getd/, $app, $prm, $_[0]);
|
||||
return($evt->{REPLY} eq 'aevt\ansr{}' ? undef : $evt);
|
||||
}
|
||||
|
||||
sub _full_path ($) {
|
||||
my($obj) = $_[0];
|
||||
my($prm) =
|
||||
q"'----':obj {form:prop, want:type(prop), seld:type(FILE), " .
|
||||
q"from:" . AEPrint($_[0]) . q"}, rtyp:type(TEXT)";
|
||||
my($evt) = do_event(qw/core getd/, $app, $prm);
|
||||
|
||||
return MacPerl::MakePath(
|
||||
MacUnpack('fss ', (
|
||||
AEGetParamDesc($evt->{REP}, keyDirectObject()))->data()->get()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
sub _save_errors_window ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), seld:TEXT(@), from:'null'()}";
|
||||
do_event(qw/MMPR SvMs/, $app, $prm, $_[0]);
|
||||
}
|
||||
|
||||
|
||||
sub _close_errors_window () {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(cwin), " .
|
||||
q"seld:TEXT(@), from:'null'()}";
|
||||
|
||||
my($evt) = do_event(qw/core clos/, $app, $prm, 'Errors & Warnings');
|
||||
return($evt->{REPLY} eq 'aevt\ansr{}' ? 1 : 0);
|
||||
}
|
||||
|
||||
sub _close () {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
do_event(qw/core clos/, $app, $prm);
|
||||
}
|
||||
|
||||
sub _get_dobj ($) {
|
||||
return(AEGetParamDesc($_[0]->{REP}, keyDirectObject()));
|
||||
}
|
||||
|
||||
sub _get_folder ($$) {
|
||||
require 'GUSI.ph';
|
||||
my($prompt, $default) = @_;
|
||||
MacPerl::Choose(
|
||||
GUSI::AF_FILE(), 0, $prompt, '',
|
||||
GUSI::CHOOSE_DIR() + ($default ? &GUSI::CHOOSE_DEFAULT : 0),
|
||||
$default
|
||||
);
|
||||
}
|
||||
|
||||
sub _save_appath ($$) {
|
||||
open(F, '>' . $_[0]) or die $!;
|
||||
print F $_[1];
|
||||
close(F);
|
||||
}
|
||||
|
||||
sub _test ($) {
|
||||
activate();
|
||||
my($path) = $_[0];
|
||||
build_project(
|
||||
"${path}modules:xml:macbuild:XML.mcp", '',
|
||||
"${path}build:mac:Mozilla.BuildLog.part"
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=pod
|
||||
|
||||
=back
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
=over 4
|
||||
|
||||
=item v1.02, September 23, 1998
|
||||
|
||||
Made fixes in finding and saving location of CodeWarrior IDE.
|
||||
|
||||
=item v1.01, June 1, 1998
|
||||
|
||||
Made fixes to C<chdir()> in C<activate()>, made C<activate()> more robust
|
||||
in finding CodeWarrior IDE, added global variable to NOT switch to IDE
|
||||
for each sent event, a few other fixes.
|
||||
|
||||
=item v1.00, May 30, 1998
|
||||
|
||||
First shot
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Chris Nandor F<E<lt>pudge@pobox.comE<gt>>, and the author of the
|
||||
original I<CodeWarriorLib>, Scott Collins F<E<lt>scc@netscape.comE<gt>>.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
BuildProject L<Moz>.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "NPL"); you may not use this file except in
|
||||
compliance with the NPL. You may obtain a copy of the NPL at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
for the specific language governing rights and limitations under the
|
||||
NPL.
|
||||
|
||||
The Initial Developer of this code under the NPL is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
Reserved.
|
||||
|
||||
=cut
|
||||
4
mozilla/build/mac/CustomLib/CustomLib.c
Normal file
4
mozilla/build/mac/CustomLib/CustomLib.c
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
/* This library only exists to provide a dummy library for the final project */
|
||||
|
||||
/* There is nothing to do here. */
|
||||
BIN
mozilla/build/mac/CustomLib/CustomLib.mcp
Normal file
BIN
mozilla/build/mac/CustomLib/CustomLib.mcp
Normal file
Binary file not shown.
BIN
mozilla/build/mac/GenToc
Normal file
BIN
mozilla/build/mac/GenToc
Normal file
Binary file not shown.
260
mozilla/build/mac/GenToc.script
Normal file
260
mozilla/build/mac/GenToc.script
Normal file
@@ -0,0 +1,260 @@
|
||||
(*
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*)
|
||||
|
||||
(*
|
||||
GenToc - Generates a .toc file from the current contents of a project.
|
||||
|
||||
by Patrick C. Beard <beard@netscape.com>
|
||||
*)
|
||||
|
||||
on swapDelimiters(newDelimiters)
|
||||
set oldDelimiters to get AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to newDelimiters
|
||||
return oldDelimiters
|
||||
end swapDelimiters
|
||||
|
||||
on setDelimiters(newDelimiters)
|
||||
set AppleScript's text item delimiters to newDelimiters
|
||||
end setDelimiters
|
||||
|
||||
on setExtension(fileName, newExtension)
|
||||
set oldDelimiters to swapDelimiters(".")
|
||||
set newFileName to (text item 1 of fileName) & newExtension
|
||||
setDelimiters(oldDelimiters)
|
||||
return newFileName
|
||||
end setExtension
|
||||
|
||||
on folderFromPath(filePath)
|
||||
set folderPath to ((filePath's text items 1 thru ((count of filePath's text items) - 1)) as string) & ":"
|
||||
return folderPath
|
||||
end folderFromPath
|
||||
|
||||
on fileFromPath(filePath)
|
||||
return last text item of filePath
|
||||
end fileFromPath
|
||||
|
||||
on openProject(aProjectFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
open aProjectFile
|
||||
end tell
|
||||
end openProject
|
||||
|
||||
on selectProject(aProjectFile)
|
||||
set projectName to fileFromPath(aProjectFile as text)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
if (name of window 1 is not projectName) then
|
||||
select window projectName
|
||||
end if
|
||||
end tell
|
||||
end selectProject
|
||||
|
||||
on getTargets()
|
||||
set targetList to {}
|
||||
set nameList to {}
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
set currentProject to project document 1
|
||||
repeat with targetIndex from 1 to (count of targets of currentProject)
|
||||
set currentTarget to (target targetIndex of currentProject)
|
||||
set targetList to targetList & {currentTarget}
|
||||
set nameList to nameList & {name of currentTarget}
|
||||
end repeat
|
||||
return {target:targetList, names:nameList}
|
||||
end tell
|
||||
end getTargets
|
||||
|
||||
(* uses "sort" scripting addition to sort a list of strings. *)
|
||||
on sortList(aList)
|
||||
if (aList {}) then
|
||||
return sort aList
|
||||
else
|
||||
return {}
|
||||
end if
|
||||
end sortList
|
||||
|
||||
(* uses "info for" scripting addition, to return the file type of a path. *)
|
||||
on getFileType(aFilePath)
|
||||
return file type of (info for alias aFilePath)
|
||||
end getFileType
|
||||
|
||||
(* returns all "TEXT" files of the named target. *)
|
||||
on getTargetFiles(targetKey)
|
||||
set targetFiles to {}
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
set currentProject to project document 1
|
||||
set currentTarget to (target targetKey of currentProject)
|
||||
try
|
||||
-- workaround for CW IDE 3.X bug, loop until error encountered.
|
||||
set fileIndex to 1
|
||||
repeat until false
|
||||
set targetFile to (target file fileIndex of currentTarget)
|
||||
-- only consider text files, since other platforms won't be managing binaries.
|
||||
-- also, only consider if target file is directly linked.
|
||||
if (linked of targetFile) then
|
||||
set targetFilePath to (Access Paths of targetFile)
|
||||
tell me
|
||||
if (getFileType(targetFilePath) = "TEXT") then
|
||||
set targetFiles to targetFiles & {targetFilePath}
|
||||
end if
|
||||
end tell
|
||||
end if
|
||||
set fileIndex to (fileIndex + 1)
|
||||
end repeat
|
||||
on error msg
|
||||
-- display dialog msg & " file count = " & fileIndex
|
||||
end try
|
||||
end tell
|
||||
return sortList(targetFiles)
|
||||
end getTargetFiles
|
||||
|
||||
on addTargetFile(targetFile, targetName)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
add (project document 1) new target file with data {targetFile} to targets {targetName}
|
||||
end tell
|
||||
end addTargetFile
|
||||
|
||||
on setCurrentTarget(currentTargetName)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Set Current Target currentTargetName
|
||||
end tell
|
||||
end setCurrentTarget
|
||||
|
||||
on removeTargetFile(targetFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Remove Files {targetFile}
|
||||
end tell
|
||||
end removeTargetFile
|
||||
|
||||
on quote(aString)
|
||||
return "'" & aString & "'"
|
||||
end quote
|
||||
|
||||
on listContains(aList, anItem)
|
||||
repeat with listItem in aList
|
||||
if (listItem contains anItem) then
|
||||
return true
|
||||
end if
|
||||
end repeat
|
||||
return false
|
||||
end listContains
|
||||
|
||||
on showList(listToShow)
|
||||
choose from list listToShow with prompt "List:" with empty selection allowed
|
||||
end showList
|
||||
|
||||
on replace(aString, oldChar, newChar)
|
||||
set newString to ""
|
||||
repeat with aChar in (every character of aString)
|
||||
if (contents of aChar = oldChar) then
|
||||
set newString to newString & newChar
|
||||
else
|
||||
set newString to newString & aChar
|
||||
end if
|
||||
end repeat
|
||||
return newString
|
||||
end replace
|
||||
|
||||
on substring(aString, anOffset)
|
||||
set aSubString to ""
|
||||
repeat with charIndex from anOffset to (count aString)
|
||||
set aSubString to aSubString & (character charIndex of aString)
|
||||
end repeat
|
||||
return aSubString
|
||||
end substring
|
||||
|
||||
on setFileInfo(aFile, aCreator, aType)
|
||||
tell application "Finder"
|
||||
set creator type of aFile to aCreator
|
||||
set file type of aFile to aType
|
||||
end tell
|
||||
end setFileInfo
|
||||
|
||||
on closeFile(fileRef)
|
||||
try
|
||||
-- make sure it's not currently open.
|
||||
close access fileRef
|
||||
on error
|
||||
-- ignore error closing.
|
||||
end try
|
||||
end closeFile
|
||||
|
||||
on mroFile(aFile)
|
||||
try
|
||||
-- make sure it's modifiable.
|
||||
mro aFile
|
||||
on error
|
||||
-- ignore error MROing.
|
||||
end try
|
||||
end mroFile
|
||||
|
||||
on run
|
||||
-- so we can easily strip off file names from paths.
|
||||
set oldDelimiters to swapDelimiters(":")
|
||||
|
||||
set theProjectFile to (choose file with prompt "Choose a CW Project file." of type {"MMPr"})
|
||||
set theManifestFile to (new file with prompt "Create MANIFEST where?" default name setExtension(fileFromPath(theProjectFile as text), ".toc"))
|
||||
|
||||
set manifestRef to false
|
||||
|
||||
try
|
||||
-- make sure the file is closed & is modifiable.
|
||||
closeFile(theManifestFile)
|
||||
mroFile(theManifestFile)
|
||||
|
||||
-- open the new MANIFEST file.
|
||||
set manifestRef to (open for access theManifestFile with write permission)
|
||||
set eof manifestRef to 0
|
||||
|
||||
-- give it CodeWarrior look and feel.
|
||||
setFileInfo(theManifestFile, "CWIE", "TEXT")
|
||||
|
||||
openProject(theProjectFile)
|
||||
selectProject(theProjectFile)
|
||||
|
||||
set targetsList to getTargets()
|
||||
set targetNames to names of targetsList
|
||||
set targetCount to count items of targetNames
|
||||
|
||||
set mozillaTreePathOffset to (offset of "mozilla" in (theManifestFile as text))
|
||||
|
||||
-- dump all targets into the new MANIFEST file.
|
||||
repeat with targetName in targetNames
|
||||
write ("# target: " & targetName & return) to manifestRef
|
||||
setCurrentTarget(targetName)
|
||||
set targetFiles to getTargetFiles(contents of targetName)
|
||||
repeat with targetFile in targetFiles
|
||||
-- only store the path name relative to the source tree itself.
|
||||
set targetFilePath to substring(contents of targetFile, mozillaTreePathOffset)
|
||||
write (replace(targetFilePath, ":", "/") & return) to manifestRef
|
||||
end repeat
|
||||
end repeat
|
||||
on error msg
|
||||
display dialog msg
|
||||
end try
|
||||
if (manifestRef is not false) then
|
||||
closeFile(manifestRef)
|
||||
end if
|
||||
|
||||
-- shut the project down, and display the result.
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
activate
|
||||
Close Project
|
||||
open theManifestFile
|
||||
end tell
|
||||
|
||||
setDelimiters(oldDelimiters)
|
||||
end run
|
||||
95
mozilla/build/mac/IDE_Options.h
Normal file
95
mozilla/build/mac/IDE_Options.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*
|
||||
|
||||
This file overrides all option settings in the IDE. It is an attempt to allow all builds
|
||||
to have the same options.
|
||||
|
||||
Note: We can't use ConditionalMacros.h in this file because it will conflict with
|
||||
the PowerPlant precompiled headers.
|
||||
|
||||
*/
|
||||
|
||||
/* warning pragmas */
|
||||
#pragma warn_hidevirtual on
|
||||
#pragma warn_emptydecl on
|
||||
#pragma warn_unusedvar on
|
||||
#pragma warn_extracomma on
|
||||
#pragma warn_illpragma on
|
||||
#pragma warn_possunwant on
|
||||
#pragma warn_unusedarg off /* turned off to reduce warnings */
|
||||
|
||||
#pragma check_header_flags on
|
||||
|
||||
/* Language features that must be the same across libraries... */
|
||||
#pragma enumsalwaysint on
|
||||
#pragma unsigned_char off
|
||||
#pragma exceptions on
|
||||
#pragma bool on
|
||||
#pragma RTTI on
|
||||
|
||||
|
||||
/* Save as much space as possible with strings... */
|
||||
#pragma pool_strings on
|
||||
#pragma dont_reuse_strings off
|
||||
|
||||
#pragma options align=native
|
||||
#pragma sym on /* Takes no memory. OK in non-debug. */
|
||||
|
||||
|
||||
|
||||
#ifdef powerc /* ...generating PowerPC */
|
||||
#pragma toc_data on
|
||||
#pragma fp_contract on
|
||||
#pragma readonly_strings on
|
||||
|
||||
#ifdef DEBUG
|
||||
#pragma traceback on
|
||||
#pragma global_optimizer off
|
||||
#pragma scheduling off
|
||||
#pragma peephole off
|
||||
#pragma optimize_for_size off
|
||||
#else
|
||||
#pragma traceback off
|
||||
#pragma global_optimizer on
|
||||
#pragma optimization_level 4
|
||||
#pragma scheduling 604
|
||||
#pragma peephole on
|
||||
#pragma optimize_for_size on
|
||||
#endif
|
||||
|
||||
#else /* ...generating 68k */
|
||||
#pragma code68020 on
|
||||
#pragma code68881 off
|
||||
|
||||
/* Far everything... */
|
||||
#pragma far_code
|
||||
#pragma far_data on
|
||||
#pragma far_strings on
|
||||
#pragma far_vtables on
|
||||
|
||||
#pragma fourbyteints on /* 4-byte ints */
|
||||
#pragma IEEEdoubles on /* 8-byte doubles (as required by Java and NSPR) */
|
||||
|
||||
#ifdef DEBUG
|
||||
#pragma macsbug on
|
||||
#pragma oldstyle_symbols off
|
||||
#else
|
||||
#pragma macsbug off
|
||||
#endif
|
||||
#endif
|
||||
5
mozilla/build/mac/MANIFEST
Normal file
5
mozilla/build/mac/MANIFEST
Normal file
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
IDE_Options.h
|
||||
217
mozilla/build/mac/MANIFESTO.pm
Normal file
217
mozilla/build/mac/MANIFESTO.pm
Normal file
@@ -0,0 +1,217 @@
|
||||
#!perl -w
|
||||
package MANIFESTO;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
#use strict;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT $MANIFESTOLib);
|
||||
use Mac::StandardFile;
|
||||
use Moz;
|
||||
use Cwd;
|
||||
use Exporter;
|
||||
use File::Basename;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(ReconcileProject);
|
||||
$VERSION = "1.00";
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MANIFESTO - drives the Mac Project Reconciliation tool.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
You want to use this script. It will make your life easier.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "NPL"); you may not use this file except in
|
||||
compliance with the NPL. You may obtain a copy of the NPL at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
for the specific language governing rights and limitations under the
|
||||
NPL.
|
||||
|
||||
The Initial Developer of this code under the NPL is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
Reserved.
|
||||
|
||||
=cut
|
||||
|
||||
#
|
||||
# globals
|
||||
# $MANIFESTOLib - location of MANIFESTO applescript library
|
||||
#
|
||||
|
||||
#
|
||||
# utility routines
|
||||
#
|
||||
|
||||
sub current_directory()
|
||||
{
|
||||
my $current_directory = cwd();
|
||||
chop($current_directory) if ( $current_directory =~ m/:$/ );
|
||||
return $current_directory;
|
||||
}
|
||||
|
||||
# Uses the "compile script" extension to compile a script.
|
||||
sub compile_script($;$) {
|
||||
my($scriptPath, $outputPath) = @_;
|
||||
|
||||
#// generate a script to compile a script file.
|
||||
my $script = <<END_OF_APPLESCRIPT;
|
||||
store script (compile script (alias "$scriptPath")) in (file "$outputPath") replacing yes
|
||||
END_OF_APPLESCRIPT
|
||||
|
||||
#// run the script.
|
||||
MacPerl::DoAppleScript($script);
|
||||
}
|
||||
|
||||
# _useMANIFESTOLib()
|
||||
# returns 1 on success
|
||||
# Search the include path for the file called MANIFESTOLib
|
||||
sub _useMANIFESTOLib()
|
||||
{
|
||||
unless ( defined($MANIFESTOLib) )
|
||||
{
|
||||
my($scriptName) = "MANIFESTOLib.script";
|
||||
my($libName) = "MANIFESTOLib";
|
||||
# try the directory we were run from
|
||||
my($scriptPath) = dirname($0) . ":" . $scriptName;
|
||||
my($libPath) = dirname($0) . ":" . $libName;
|
||||
# make sure that the compiled script is up to date with the textual script.
|
||||
unless (-e $libPath && getModificationDate($libPath) >= getModificationDate($scriptPath)) {
|
||||
print "# Recompiling MANIFESTOLib.script.\n";
|
||||
compile_script($scriptPath, $libPath);
|
||||
}
|
||||
if ( -e $libPath) {
|
||||
$MANIFESTOLib = $libPath;
|
||||
} else {
|
||||
# now search the include directories
|
||||
foreach (@INC)
|
||||
{
|
||||
unless ( m/^Dev:Pseudo/ ) # This is some bizarre MacPerl special-case directory
|
||||
{
|
||||
$libPath = $_ . $libName;
|
||||
if (-e $libPath)
|
||||
{
|
||||
$MANIFESTOLib = $libPath;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! (-e $MANIFESTOLib)) {
|
||||
print STDERR "MANIFESTOLib lib could not be found! $MANIFESTOLib";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub getModificationDate($) {
|
||||
my($filePath)=@_;
|
||||
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
|
||||
$atime,$mtime,$ctime,$blksize,$blocks) = stat($filePath);
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
sub setExtension($;$;$) {
|
||||
my($filePath, $oldExtension, $newExtension)=@_;
|
||||
my($name, $dir, $type) = fileparse($filePath, $oldExtension);
|
||||
return "$dir$name$newExtension";
|
||||
}
|
||||
|
||||
#
|
||||
# ReconcileProject(projectPath, manifestoPath)
|
||||
#
|
||||
# Uses MANIFESTOLib AppleScript to reconcile the contents (toc?) of a
|
||||
# CodeWarrior project with an external MANIFEST file.
|
||||
#
|
||||
|
||||
sub ReconcileProject($;$) {
|
||||
#// turn this feature on by removing the following line.
|
||||
return 1;
|
||||
|
||||
my($projectPath, $manifestoPath) = @_;
|
||||
my($sourceTree) = current_directory();
|
||||
my($logPath) = setExtension($manifestoPath, ".toc", ".log");
|
||||
|
||||
print STDERR "# Reconciling Project: $projectPath with $manifestoPath\n";
|
||||
|
||||
#// compare the modification dates of the .toc and .log files. If .log is newer, do nothing.
|
||||
if (-e $logPath && getModificationDate($logPath) >= getModificationDate($manifestoPath)) {
|
||||
print "# Project is up to date.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
_useMANIFESTOLib() || die "Could not load MANIFESTOLib\n";
|
||||
|
||||
my $script = <<END_OF_APPLESCRIPT;
|
||||
tell (load script file "$MANIFESTOLib") to ReconcileProject("$sourceTree:", "$sourceTree$projectPath", "$sourceTree$manifestoPath")
|
||||
END_OF_APPLESCRIPT
|
||||
|
||||
#// run the script, and store the results in a file called "$manifestoPath.log"
|
||||
my $asresult = substr(MacPerl::DoAppleScript($script), 1, -1); #// chops off leading, trailing quotes.
|
||||
|
||||
#// print out to STDOUT to show progress.
|
||||
print $asresult;
|
||||
|
||||
#// store the results in "$manifestoPath.log", which will act as a cache for later checks.
|
||||
open(OUTPUT, ">$logPath") || die "can't open log file $logPath.";
|
||||
print OUTPUT $asresult;
|
||||
close(OUTPUT);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
1;
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MANIFESTO - Scripts to process source .toc files.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MANIFESTO;
|
||||
ReconcileProject(<path to Mac project file>, <path to table of contents file>) || die "cannot reconcile project";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a PERL interface for talking to MANIFESTOLib AppleScripts.
|
||||
|
||||
=item ReconcileProject
|
||||
ReconcileProject(<path to Mac project file>, <path to table of contents file>);
|
||||
|
||||
Reconciles the contents of a project with an external .toc file.
|
||||
|
||||
=cut
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
=over
|
||||
|
||||
=item MacCVS Home Page
|
||||
|
||||
http://www.maccvs.org/
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Patrick Beard beard@netscape.com
|
||||
|
||||
based on work by
|
||||
|
||||
Aleks Totic atotic@netscape.com
|
||||
|
||||
=cut
|
||||
|
||||
__END__
|
||||
BIN
mozilla/build/mac/MANIFESTOLib
Normal file
BIN
mozilla/build/mac/MANIFESTOLib
Normal file
Binary file not shown.
372
mozilla/build/mac/MANIFESTOLib.script
Normal file
372
mozilla/build/mac/MANIFESTOLib.script
Normal file
@@ -0,0 +1,372 @@
|
||||
(*
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*)
|
||||
|
||||
(*
|
||||
MANIFESTOLib - Reconciles a CW Project file with an external table of contents file.
|
||||
|
||||
Uses merge sort, one pass per target.
|
||||
|
||||
by Patrick C. Beard <beard@netscape.com>
|
||||
*)
|
||||
|
||||
(* Global Configuration Properties *)
|
||||
|
||||
property pShowReport : true
|
||||
-- property pSourceTree : "Homeward:Work:Raptor:src:"
|
||||
property pSourceTree : "Morbeus:Projects:Raptor:src:"
|
||||
|
||||
on swapDelimiters(newDelimiters)
|
||||
set oldDelimiters to get AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to newDelimiters
|
||||
return oldDelimiters
|
||||
end swapDelimiters
|
||||
|
||||
on setDelimiters(newDelimiters)
|
||||
set AppleScript's text item delimiters to newDelimiters
|
||||
end setDelimiters
|
||||
|
||||
-- replaces oldChar with newChar in a string.
|
||||
on replace(aString, oldChar, newChar)
|
||||
set newString to ""
|
||||
repeat with aChar in (every character of aString)
|
||||
if (contents of aChar = oldChar) then
|
||||
set newString to newString & newChar
|
||||
else
|
||||
set newString to newString & aChar
|
||||
end if
|
||||
end repeat
|
||||
return newString
|
||||
end replace
|
||||
|
||||
(* uses "sort" scripting addition to sort a list of strings. *)
|
||||
on sortList(aList)
|
||||
if (aList {}) then
|
||||
return sort aList
|
||||
else
|
||||
return {}
|
||||
end if
|
||||
end sortList
|
||||
|
||||
-- reads .toc file into a list.
|
||||
on readManifestFile(sourceTree, manifestFile)
|
||||
set oldDelimiters to swapDelimiters(return)
|
||||
set fileRef to false
|
||||
set fileLines to {}
|
||||
try
|
||||
set fileRef to (open for access manifestFile without write permission)
|
||||
-- read entire file into memory, use text items to delimit lines.
|
||||
set fileContents to (read fileRef)
|
||||
repeat with lineRef in (every text item of fileContents)
|
||||
-- ignore lines that start with "#" or are empty.
|
||||
set fileLine to (contents of lineRef)
|
||||
if (fileLine "") and not (fileLine starts with "#") then
|
||||
set fileLines to fileLines & (sourceTree & replace(fileLine, "/", ":"))
|
||||
end if
|
||||
end repeat
|
||||
on error
|
||||
-- ignore errors.
|
||||
end try
|
||||
if (fileRef is not false) then close access fileRef
|
||||
setDelimiters(oldDelimiters)
|
||||
return sortList(fileLines)
|
||||
end readManifestFile
|
||||
|
||||
(* both of the following depend on ":" as the delimiter character. *)
|
||||
|
||||
on folderFromPath(filePath)
|
||||
return ((filePath's text items 1 thru ((count of filePath's text items) - 1)) as string) & ":"
|
||||
end folderFromPath
|
||||
|
||||
on fileFromPath(filePath)
|
||||
return last text item of filePath
|
||||
end fileFromPath
|
||||
|
||||
(* CW Pro IDE Interface Handlers. *)
|
||||
|
||||
on openProject(aProjectFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
-- activate
|
||||
open aProjectFile
|
||||
end tell
|
||||
end openProject
|
||||
|
||||
(* forces the named project file to be the front window. *)
|
||||
on selectProject(aProjectFile)
|
||||
set projectName to fileFromPath(aProjectFile as text)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
if (name of window 1 is not projectName) then
|
||||
select window projectName
|
||||
end if
|
||||
end tell
|
||||
end selectProject
|
||||
|
||||
on closeProject(aProjectFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Close Project
|
||||
end tell
|
||||
end closeProject
|
||||
|
||||
on getTargets()
|
||||
set targetList to {}
|
||||
set nameList to {}
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
set currentProject to project document 1
|
||||
repeat with targetIndex from 1 to (count of targets of currentProject)
|
||||
set currentTarget to (target targetIndex of currentProject)
|
||||
set targetList to targetList & {currentTarget}
|
||||
set nameList to nameList & {name of currentTarget}
|
||||
end repeat
|
||||
return {target:targetList, names:nameList}
|
||||
end tell
|
||||
end getTargets
|
||||
|
||||
(* uses "info for" scripting addition, to return the file type of a path. *)
|
||||
on getFileType(aFilePath)
|
||||
return file type of (info for alias aFilePath)
|
||||
end getFileType
|
||||
|
||||
(* returns all "TEXT" files of the named target. *)
|
||||
on getTargetFiles(targetKey)
|
||||
set targetFiles to {}
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
set currentProject to project document 1
|
||||
set currentTarget to (target targetKey of currentProject)
|
||||
try
|
||||
-- workaround for CW IDE 3.X bug, loop until error encountered.
|
||||
set fileIndex to 1
|
||||
repeat until false
|
||||
set targetFile to (target file fileIndex of currentTarget)
|
||||
-- only consider text files, since other platforms won't be managing binaries.
|
||||
-- also, only consider if target file is directly linked.
|
||||
if (linked of targetFile) then
|
||||
set targetFilePath to (Access Paths of targetFile)
|
||||
tell me
|
||||
if (getFileType(targetFilePath) = "TEXT") then
|
||||
set targetFiles to targetFiles & {targetFilePath}
|
||||
end if
|
||||
end tell
|
||||
end if
|
||||
set fileIndex to (fileIndex + 1)
|
||||
end repeat
|
||||
on error msg
|
||||
-- display dialog msg & " file count = " & fileIndex
|
||||
end try
|
||||
end tell
|
||||
return sortList(targetFiles)
|
||||
end getTargetFiles
|
||||
|
||||
on addTargetFile(targetFile, targetList)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
add (project document 1) new target file with data {targetFile} to targets targetList
|
||||
end tell
|
||||
end addTargetFile
|
||||
|
||||
global gCurrentTarget
|
||||
|
||||
on setCurrentTarget(currentTargetName)
|
||||
if (gCurrentTarget currentTargetName) then
|
||||
set gCurrentTarget to currentTargetName
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Set Current Target currentTargetName
|
||||
end tell
|
||||
end if
|
||||
end setCurrentTarget
|
||||
|
||||
on removeTargetFile(targetFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Remove Files {targetFile}
|
||||
end tell
|
||||
end removeTargetFile
|
||||
|
||||
on quote(aString)
|
||||
return "'" & aString & "'"
|
||||
end quote
|
||||
|
||||
on listContains(aList, anItem)
|
||||
repeat with listItem in aList
|
||||
if (contents of listItem = anItem) then
|
||||
return true
|
||||
end if
|
||||
end repeat
|
||||
return false
|
||||
end listContains
|
||||
|
||||
on showList(aList)
|
||||
choose from list aList with prompt "List:" with empty selection allowed
|
||||
end showList
|
||||
|
||||
global gProjectModified
|
||||
|
||||
on ModifyReadOnly(aProjectFile)
|
||||
if (not gProjectModified) then
|
||||
set gProjectModified to true
|
||||
-- so CodeWarrior will notice, must close the file before MROing it.
|
||||
closeProject(aProjectFile)
|
||||
mro aProjectFile
|
||||
openProject(aProjectFile)
|
||||
selectProject(aProjectFile)
|
||||
end if
|
||||
end ModifyReadOnly
|
||||
|
||||
on makeStream(itemList)
|
||||
return {streamList:itemList, streamCount:count itemList, streamIndex:0}
|
||||
end makeStream
|
||||
|
||||
(* true is used as the end of stream value. *)
|
||||
property pEOS : true
|
||||
|
||||
on advanceStream(stream)
|
||||
set itemCount to (streamCount of stream)
|
||||
set itemIndex to (streamIndex of stream)
|
||||
if (itemIndex < itemCount) then
|
||||
set itemIndex to (itemIndex + 1)
|
||||
set (streamIndex of stream) to itemIndex
|
||||
return (item itemIndex of streamList of stream)
|
||||
else
|
||||
return pEOS
|
||||
end if
|
||||
end advanceStream
|
||||
|
||||
-- returns true if str2 is INFINITELY great, or str1 is less than str2.
|
||||
on precedes(str1, str2)
|
||||
return (str2 = pEOS) or ((str1 pEOS) and (str1 < str2))
|
||||
end precedes
|
||||
|
||||
on get_current_application()
|
||||
return last text item of ((path to current application) as text)
|
||||
end get_current_application
|
||||
|
||||
on get_frontmost_application()
|
||||
return last text item of ((path to frontmost application) as text)
|
||||
end get_frontmost_application
|
||||
|
||||
on activate_application(applicationName)
|
||||
tell application "Finder"
|
||||
set applicationProcess to (application process applicationName)
|
||||
set frontmost of applicationProcess to true
|
||||
end tell
|
||||
end activate_application
|
||||
|
||||
on ReconcileProject(sourceTree, projectPath, manifestoPath)
|
||||
-- so we can easily strip off file names from paths.
|
||||
set oldDelimiters to swapDelimiters(":")
|
||||
|
||||
-- initialize globals.
|
||||
set gCurrentTarget to ""
|
||||
set gProjectModified to false
|
||||
|
||||
-- convert paths to aliases.
|
||||
set projectFile to alias projectPath
|
||||
set manifestFile to alias manifestoPath
|
||||
|
||||
-- read the MANIFESTO file into a list of paths.
|
||||
set manifestContents to readManifestFile(sourceTree, manifestFile)
|
||||
-- return manifestContents
|
||||
|
||||
-- now, start processing the file items, ensuring that the project contains all items.
|
||||
openProject(projectFile)
|
||||
selectProject(projectFile)
|
||||
set targetsList to getTargets()
|
||||
set targetNames to names of targetsList
|
||||
|
||||
if (pShowReport) then
|
||||
set theReport to ""
|
||||
set addedFiles to ""
|
||||
set removedFiles to ""
|
||||
end if
|
||||
|
||||
-- push current application to front for speed.
|
||||
-- set frontmostApplication to get_frontmost_application()
|
||||
-- set currentApplication to get_current_application()
|
||||
-- activate_application(currentApplication)
|
||||
|
||||
-- reconcile all targets with the MANIFEST file.
|
||||
-- this loop should be recoded in PERL for speed.
|
||||
-- IDEA: with sorted lists, can scan both lists, like a merge sort, and make one pass per target.
|
||||
repeat with targetNameRef in targetNames
|
||||
-- switch targets because getTargetFiles now checks to see if file is linked in current target.
|
||||
set targetName to (contents of targetNameRef)
|
||||
set targetFiles to getTargetFiles(targetName)
|
||||
-- hopefully, this list test is fast.
|
||||
if (targetFiles manifestContents) then
|
||||
-- return {count targetFiles, count manifestContents, targetFiles, manifestContents}
|
||||
-- make sure the project file is modifiable.
|
||||
ModifyReadOnly(projectFile)
|
||||
setCurrentTarget(targetName)
|
||||
set targetStream to makeStream(targetFiles)
|
||||
set targetItem to advanceStream(targetStream)
|
||||
set manifestStream to makeStream(manifestContents)
|
||||
set manifestItem to advanceStream(manifestStream)
|
||||
repeat until (manifestItem is pEOS) and (targetItem is pEOS)
|
||||
-- display dialog "m: " & manifestItem & ", t: " & targetFileItem
|
||||
if (manifestItem = targetItem) then
|
||||
-- items match, advance both.
|
||||
set manifestItem to advanceStream(manifestStream)
|
||||
set targetItem to advanceStream(targetStream)
|
||||
else
|
||||
-- return {manifestItem, targetItem}
|
||||
if (precedes(manifestItem, targetItem)) then
|
||||
-- we have an item in manifest, not in project, so we have to add it to the targets.
|
||||
-- display dialog "adding " & manifestItem
|
||||
addTargetFile(manifestItem, targetNames)
|
||||
if pShowReport then
|
||||
set addedFiles to addedFiles & ("# " & (last text item of manifestItem) & return)
|
||||
end if
|
||||
set manifestItem to advanceStream(manifestStream)
|
||||
else
|
||||
-- we have an item not in manifest, but in project, so it must be removed from this target.
|
||||
-- display dialog "removing " & targetItem
|
||||
removeTargetFile(targetItem)
|
||||
if pShowReport then
|
||||
set removedFiles to removedFiles & ("# " & targetName & " - " & (last text item of targetItem) & return)
|
||||
end if
|
||||
set targetItem to advanceStream(targetStream)
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
-- activate_application(frontmostApplication)
|
||||
|
||||
-- commit the project changes, and optionally display a report.
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
-- leave project open for compilation phase?
|
||||
Close Project
|
||||
if pShowReport then
|
||||
if addedFiles is not "" then set theReport to ("# Added files: " & return & addedFiles)
|
||||
if removedFiles is not "" then set theReport to theReport & ("# Removed files: " & return & removedFiles)
|
||||
if (theReport is "") then set theReport to (" # Project is up to date." & return)
|
||||
-- display dialog theReport buttons {"OK"} default button "OK"
|
||||
end if
|
||||
end tell
|
||||
|
||||
-- restore AppleScript's delimiters.
|
||||
setDelimiters(oldDelimiters)
|
||||
|
||||
-- return 0 to indicate no error.
|
||||
return theReport
|
||||
end ReconcileProject
|
||||
|
||||
on run
|
||||
-- when run interactively,
|
||||
-- ask user which project/MANIFEST files to use.
|
||||
set projectPath to (choose file with prompt "Choose a CW Project file." of type {"MMPr"}) as text
|
||||
set manifestPath to (choose file with prompt "Choose a TOC file to process." of type {"TEXT"}) as text
|
||||
ReconcileProject(pSourceTree, projectPath, manifestPath)
|
||||
end run
|
||||
198
mozilla/build/mac/MacCVS.pm
Normal file
198
mozilla/build/mac/MacCVS.pm
Normal file
@@ -0,0 +1,198 @@
|
||||
#!perl -w
|
||||
package MacCVS;
|
||||
|
||||
# package Mac::Apps::MacCVS; this should really be the name of the package
|
||||
# but due to our directory hierarchy in mozilla, I am not doing it
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT $MacCVSLib);
|
||||
use Mac::StandardFile;
|
||||
use Moz;
|
||||
use Cwd;
|
||||
use Exporter;
|
||||
use File::Basename;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw( new print checkout);
|
||||
$VERSION = "1.00";
|
||||
|
||||
# Architecture:
|
||||
# cvs session object:
|
||||
# name - session name
|
||||
# session_file - session file
|
||||
#
|
||||
# globals
|
||||
# $MacCVSLib - location of MacCVS applescript library
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# utility routines
|
||||
#
|
||||
|
||||
# just like Mac::DoAppleScript, 1 is success, 0 is failure
|
||||
sub _myDoAppleScript($)
|
||||
{
|
||||
my($script) = @_;
|
||||
my $asresult = MacPerl::DoAppleScript($script);
|
||||
if ($asresult eq "0")
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "AppleScript error: $asresult\n";
|
||||
print STDERR "AppleScript was: \n $script \n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
# _useMacCVSLib
|
||||
# returns 1 on success
|
||||
# Search the include path for the file called MacCVSLib
|
||||
sub _useMacCVSLib()
|
||||
{
|
||||
unless ( defined($MacCVSLib) )
|
||||
{
|
||||
my($libname) = "MacCVSLib";
|
||||
# try the directory we were run from
|
||||
my($c) = dirname($0) . ":" . $libname;
|
||||
if ( -e $c)
|
||||
{
|
||||
$MacCVSLib = $c;
|
||||
}
|
||||
else
|
||||
{
|
||||
# now search the include directories
|
||||
foreach (@INC)
|
||||
{
|
||||
unless ( m/^Dev:Pseudo/ ) # This is some bizarre MacPerl special-case directory
|
||||
{
|
||||
$c = $_ . $libname;
|
||||
if (-e $c)
|
||||
{
|
||||
$MacCVSLib = $c;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! (-e $MacCVSLib))
|
||||
{
|
||||
print STDERR "MacCVS lib could not be found! $MacCVSLib";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Session object methods
|
||||
#
|
||||
|
||||
sub new {
|
||||
my ( $proto, $session_file) = @_;
|
||||
my $class = ref($proto) || $proto;
|
||||
my $self = {};
|
||||
|
||||
if ( defined($session_file) && ( -e $session_file) )
|
||||
{
|
||||
$self->{"name"} = basename( $session_file );
|
||||
$self->{"session_file"} = $session_file;
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "MacCVS->new cvs file < $session_file > does not exist\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# makes sure that the session is open
|
||||
# assertSessionOpen()
|
||||
# returns 1 on failure
|
||||
sub assertSessionOpen() {
|
||||
my ($self) = shift;
|
||||
_useMacCVSLib() || die "Could not load MacCVSLib\n";
|
||||
my $script = <<END_OF_APPLESCRIPT;
|
||||
tell (load script file "$MacCVSLib") to OpenSession("$self->{session_file}")
|
||||
END_OF_APPLESCRIPT
|
||||
return _myDoAppleScript($script);
|
||||
}
|
||||
|
||||
# prints the cvs object, used mostly for debugging
|
||||
sub print {
|
||||
my($self) = shift;
|
||||
print "MacCVS:: name: ", $self->{name}, " session file: ", $self->{session_file}, "\n";
|
||||
}
|
||||
|
||||
# checkout( self, module, revision, date)
|
||||
# MacCVS checkout command
|
||||
# returns 1 on failure
|
||||
sub checkout {
|
||||
my($self, $module, $revision, $date ) = @_;
|
||||
unless( defined ($module) ) { $module = ""; } # get rid of the pesky undefined warnings
|
||||
unless( defined ($revision) ) { $revision = ""; }
|
||||
unless( defined ($date) ) { $date = ""; }
|
||||
|
||||
$self->assertSessionOpen() || return 1;
|
||||
|
||||
my $script = <<END_OF_APPLESCRIPT;
|
||||
tell (load script file "$MacCVSLib") to Checkout given sessionName:"$self->{name}", module:"$module", revision:"$revision", date:"$date"
|
||||
END_OF_APPLESCRIPT
|
||||
return _myDoAppleScript($script);
|
||||
}
|
||||
|
||||
1;
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MacCVS - Interface to MacCVS
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MacCVS;
|
||||
$session = MacCVS->new( <session_file_path>) || die "cannot create session";
|
||||
$session->checkout([module] [revision] [date]) || die "Could not check out";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a MacCVS interface for talking to MacCVS Pro client.
|
||||
MacCVSSession is the class used to manipulate the session
|
||||
|
||||
=item new
|
||||
MacCVS->new( <cvs session file path>);
|
||||
|
||||
Creates a new session. Returns undef on failure.
|
||||
|
||||
=item checkout( <module> [revision] [date] )
|
||||
|
||||
cvs checkout command. Revision and date are optional
|
||||
returns 0 on failure
|
||||
|
||||
=cut
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
=over
|
||||
|
||||
=item MacCVS Home Page
|
||||
|
||||
http://www.maccvs.org/
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Aleks Totic atotic@netscape.com
|
||||
|
||||
=cut
|
||||
|
||||
__END__
|
||||
BIN
mozilla/build/mac/MacCVSLib
Normal file
BIN
mozilla/build/mac/MacCVSLib
Normal file
Binary file not shown.
465
mozilla/build/mac/Moz.pm
Normal file
465
mozilla/build/mac/Moz.pm
Normal file
@@ -0,0 +1,465 @@
|
||||
=head1 NAME
|
||||
|
||||
B<Moz> - routines for automating CodeWarrior builds, and some extra-curricular activities related to building Mozilla
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Moz;
|
||||
|
||||
OpenErrorLog(":::BuildLog");
|
||||
StopForErrors();
|
||||
|
||||
$Moz::QUIET = 1;
|
||||
InstallFromManifest(":projects:MANIFEST", $dist_dir);
|
||||
|
||||
BuildProjectClean(":projects:SomeProject.mcp", "SomeTarget");
|
||||
MakeAlias(":projects:SomeProject.shlb", $dist_dir);
|
||||
|
||||
DontStopForErrors();
|
||||
|
||||
BuildProject(":projects:SomeOtherProject.mcp", "SomeTarget");
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<Moz> comprises the routines needed to slap CodeWarrior around, force it to build a sequence of projects, report the results, and a few other things.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
|
||||
|
||||
package Moz;
|
||||
require Exporter;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(BuildProject BuildProjectClean OpenErrorLog MakeAlias StopForErrors DontStopForErrors InstallFromManifest SetBuildNumber SetAgentString SetTimeBomb Delay);
|
||||
@EXPORT_OK = qw(CloseErrorLog UseCodeWarriorLib QUIET);
|
||||
|
||||
use Cwd;
|
||||
use File::Path;
|
||||
use ExtUtils::Manifest 'maniread';
|
||||
|
||||
use CodeWarriorLib;
|
||||
|
||||
sub current_directory()
|
||||
{
|
||||
my $current_directory = cwd();
|
||||
chop($current_directory) if ( $current_directory =~ m/:$/ );
|
||||
return $current_directory;
|
||||
}
|
||||
|
||||
sub full_path_to($)
|
||||
{
|
||||
my ($path) = @_;
|
||||
if ( $path =~ m/^[^:]+$/ )
|
||||
{
|
||||
$path = ":" . $path;
|
||||
}
|
||||
|
||||
if ( $path =~ m/^:/ )
|
||||
{
|
||||
$path = current_directory() . $path;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
=head2 Setup
|
||||
|
||||
Pretty much, everything is taken care of for you.
|
||||
However, B<Moz> does use a little compiled AppleScript library (the file CodeWarriorLib) for some of its communcication with CodeWarrior.
|
||||
If this library isn't in the same directory as "Moz.pm", then you need to tell B<Moz> where to find it.
|
||||
Call C<UseCodeWarriorLib($path_to_CodeWarriorLib)>.
|
||||
This routine is not exported by default, nor are you likely to need it.
|
||||
|
||||
=cut
|
||||
|
||||
sub UseCodeWarriorLib($)
|
||||
{
|
||||
# ($CodeWarriorLib) = @_;
|
||||
# $CodeWarriorLib = full_path_to($CodeWarriorLib);
|
||||
}
|
||||
|
||||
sub activate_CodeWarrior()
|
||||
{
|
||||
#MacPerl::DoAppleScript(<<END_OF_APPLESCRIPT);
|
||||
# tell (load script file "$CodeWarriorLib") to ActivateCodeWarrior()
|
||||
#END_OF_APPLESCRIPT
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
# UseCodeWarriorLib(":CodeWarriorLib");
|
||||
# activate_CodeWarrior();
|
||||
CodeWarriorLib::activate();
|
||||
}
|
||||
|
||||
$logging = 0;
|
||||
$recent_errors_file = "";
|
||||
$stop_on_1st_error = 1;
|
||||
$QUIET = 0;
|
||||
|
||||
|
||||
|
||||
=head2 Logging all the errors and warnings - C<OpenErrorLog($log_file)>, C<CloseErrorLog()>
|
||||
|
||||
The warnings and errors generated in the course of building projects can be logged to a file.
|
||||
Tinderbox uses this facility to show why a remote build failed.
|
||||
|
||||
Logging is off by default.
|
||||
Start logging at any point in your build process with C<OpenErrorLog($log_file)>.
|
||||
Stop with C<CloseErrorLog()>.
|
||||
You never need to close the log explicitly, unless you want to just log a couple of projects in the middle of a big list.
|
||||
C<CloseErrorLog()> is not exported by default.
|
||||
|
||||
=cut
|
||||
|
||||
sub CloseErrorLog()
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
close(ERROR_LOG);
|
||||
$logging = 0;
|
||||
StopForErrors() if $stop_on_1st_error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub OpenErrorLog($)
|
||||
{
|
||||
my ($log_file) = @_;
|
||||
|
||||
CloseErrorLog();
|
||||
if ( $log_file )
|
||||
{
|
||||
$log_file = full_path_to($log_file);
|
||||
|
||||
open(ERROR_LOG, ">$log_file") || die "Can't open logfile, check the file path.\n";
|
||||
MacPerl::SetFileInfo("CWIE", "TEXT", $log_file);
|
||||
|
||||
$log_file =~ m/.+:(.+)/;
|
||||
$recent_errors_file = full_path_to("$1.part");
|
||||
$logging = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=head2 Stopping before it's too late - C<StopForErrors()>, C<DontStopForErrors()>
|
||||
|
||||
When building a long list of projects, you decide whether to continue building subsequent projects when one fails.
|
||||
By default, your build script will C<die> after the first project that generates an error while building.
|
||||
Change this behavior with C<DontStopForErrors()>.
|
||||
Re-enable it with C<StopForErrors()>.
|
||||
|
||||
=cut
|
||||
|
||||
sub StopForErrors()
|
||||
{
|
||||
$stop_on_1st_error = 1;
|
||||
|
||||
# Can't stop for errors unless we notice them.
|
||||
# Can't notice them unless we are logging.
|
||||
# If the user didn't explicitly request logging, log to a temporary file.
|
||||
|
||||
if ( ! $recent_errors_file )
|
||||
{
|
||||
OpenErrorLog("${TMPDIR}BuildResults");
|
||||
}
|
||||
}
|
||||
|
||||
sub DontStopForErrors()
|
||||
{
|
||||
$stop_on_1st_error = 0;
|
||||
}
|
||||
|
||||
sub log_message($)
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
my ($message) = @_;
|
||||
print ERROR_LOG $message;
|
||||
}
|
||||
}
|
||||
|
||||
sub log_message_with_time($)
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
my ($message) = @_;
|
||||
my $time_stamp = localtime();
|
||||
log_message("$message ($time_stamp)\n");
|
||||
}
|
||||
}
|
||||
|
||||
sub log_recent_errors($)
|
||||
{
|
||||
my ($project_name) = @_;
|
||||
my $found_errors = 0;
|
||||
|
||||
if ( $logging )
|
||||
{
|
||||
open(RECENT_ERRORS, "<$recent_errors_file");
|
||||
|
||||
while( <RECENT_ERRORS> )
|
||||
{
|
||||
if ( /^Error/ || /^CouldnÕt find project file/ )
|
||||
{
|
||||
# if (!$found_errors)
|
||||
# print $_;
|
||||
$found_errors = 1;
|
||||
}
|
||||
print ERROR_LOG $_;
|
||||
}
|
||||
|
||||
close(RECENT_ERRORS);
|
||||
unlink("$recent_errors_file");
|
||||
}
|
||||
|
||||
if ( $stop_on_1st_error && $found_errors )
|
||||
{
|
||||
print ERROR_LOG "### Build failed.\n";
|
||||
die "### Errors encountered building \"$project_name\".\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub build_project($$$)
|
||||
{
|
||||
my ($project_path, $target_name, $clean_build) = @_;
|
||||
$project_path = full_path_to($project_path);
|
||||
|
||||
# $project_path =~ m/.+:(.+)/;
|
||||
# my $project_name = $1;
|
||||
|
||||
log_message_with_time("### Building \"$project_path\"");
|
||||
|
||||
# Check that the given project exists
|
||||
if (! -e $project_path)
|
||||
{
|
||||
print ERROR_LOG "### Build failed.\n";
|
||||
die "### Can't find project file \"$project_path\".\n";
|
||||
}
|
||||
|
||||
print "Building \"$project_path\[$target_name\]\"\n";
|
||||
|
||||
$had_errors = CodeWarriorLib::build_project(
|
||||
$project_path, $target_name, $recent_errors_file, $clean_build
|
||||
);
|
||||
|
||||
|
||||
# $had_errors =
|
||||
#MacPerl::DoAppleScript(<<END_OF_APPLESCRIPT);
|
||||
# tell (load script file "$CodeWarriorLib") to BuildProject("$project_path", "$project_name", "$target_name", "$recent_errors_file", $clean_build)
|
||||
#END_OF_APPLESCRIPT
|
||||
|
||||
# Append any errors to the globally accumulated log file
|
||||
if ( $had_errors )
|
||||
{
|
||||
log_recent_errors($project_path);
|
||||
}
|
||||
}
|
||||
|
||||
=head2 Getting CodeWarrior to build projects - C<BuildProject($project, $opt_target)>, C<BuildProjectClean($project, $opt_target)>
|
||||
|
||||
C<BuildProject()> and C<BuildProjectClean()> are identical, except that the latter first removes object code.
|
||||
In both, CodeWarrior opens the project if it wasn't already open; builds the given (or else current) target; and finally closes
|
||||
the project, if it wasn't already open.
|
||||
|
||||
=cut
|
||||
|
||||
sub BuildProject($;$)
|
||||
{
|
||||
my ($project_path, $target_name) = @_;
|
||||
build_project($project_path, $target_name, 0);
|
||||
}
|
||||
|
||||
sub BuildProjectClean($;$)
|
||||
{
|
||||
my ($project_path, $target_name) = @_;
|
||||
build_project($project_path, $target_name, 1);
|
||||
}
|
||||
|
||||
|
||||
=head2 Miscellaneous
|
||||
|
||||
C<MakeAlias($old_file, $new_file)> functions like C<symlink()>, except with better argument defaulting and more explicit error messages.
|
||||
|
||||
=cut
|
||||
|
||||
sub MakeAlias($$)
|
||||
{
|
||||
my ($old_file, $new_file) = @_;
|
||||
|
||||
# if the directory to hold $new_file doesn't exist, create it
|
||||
if ( ($new_file =~ m/(.+:)/) && !-d $1 )
|
||||
{
|
||||
mkpath($1);
|
||||
}
|
||||
|
||||
# if a leaf name wasn't specified for $new_file, use the leaf from $old_file
|
||||
if ( ($new_file =~ m/:$/) && ($old_file =~ m/.+:(.+)/) )
|
||||
{
|
||||
$new_file .= $1;
|
||||
}
|
||||
|
||||
my $message = "Can't create a Finder alias (at \"$new_file\")\n for \"$old_file\"; because ";
|
||||
|
||||
die "$message \"$old_file\" doesn't exist.\n" unless -e $old_file;
|
||||
die "$message I won't replace an existing (non-alias) file with an alias.\n" if ( -e $new_file && ! -l $new_file );
|
||||
|
||||
# now: $old_file exists; $new_file doesn't (or else, is an alias already)
|
||||
|
||||
if ( -l $new_file )
|
||||
{
|
||||
# ...then see if it already points to $old_file
|
||||
my $current_target = full_path_to(readlink($new_file));
|
||||
my $new_target = full_path_to($old_file);
|
||||
|
||||
return if ( $current_target eq $new_target );
|
||||
# if the desired alias already exists and points to the right thing, then we're done
|
||||
|
||||
unlink $new_file;
|
||||
}
|
||||
|
||||
symlink($old_file, $new_file) || die "$message symlink returned an unexpected error.\n";
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
C<InstallFromManifest()>
|
||||
|
||||
=cut
|
||||
|
||||
sub InstallFromManifest($;$)
|
||||
{
|
||||
my ($manifest_file, $dest_dir) = @_;
|
||||
|
||||
$dest_dir ||= ":";
|
||||
|
||||
$manifest_file =~ m/(.+):/;
|
||||
my $source_dir = $1;
|
||||
|
||||
chop($dest_dir) if $dest_dir =~ m/:$/;
|
||||
|
||||
print "Doing manifest on \"$manifest_file\"\n" unless $QUIET;
|
||||
|
||||
my $read = maniread(full_path_to($manifest_file));
|
||||
foreach $file (keys %$read)
|
||||
{
|
||||
next unless $file;
|
||||
|
||||
$subdir = ":";
|
||||
if ( $file =~ /:.+:/ )
|
||||
{
|
||||
$subdir = $&;
|
||||
}
|
||||
|
||||
$file = ":$file" unless $file =~ m/^:/;
|
||||
MakeAlias("$source_dir$file", "$dest_dir$subdir");
|
||||
}
|
||||
}
|
||||
|
||||
sub SetBuildNumber
|
||||
{
|
||||
|
||||
open (OUTPUT, ">:mozilla:config:build_number") || die "could not open buildnumber";
|
||||
|
||||
open (BDATE, "perl :mozilla:config:bdate.pl|");
|
||||
|
||||
while (<BDATE>) {
|
||||
print OUTPUT $_;
|
||||
}
|
||||
|
||||
close (BDATE);
|
||||
close (OUTPUT);
|
||||
|
||||
system ("perl :mozilla:config:aboutime.pl :mozilla:l10n:us:xp:about-all.html :mozilla:config:build_number");
|
||||
|
||||
}
|
||||
|
||||
sub SetAgentString
|
||||
{
|
||||
|
||||
open (BDATE, ":mozilla:config:build_number") || die "could not open buildnumber";
|
||||
|
||||
while (<BDATE>) {
|
||||
$build_number = $_;
|
||||
}
|
||||
|
||||
close (BDATE);
|
||||
|
||||
open (ORIGFILE, ":mozilla:cmd:macfe:restext:custom.r") || die "no original file";
|
||||
open (OUTPUT, ">:mozilla:cmd:macfe:restext:agent.r") || die "no output file";
|
||||
|
||||
chop($build_number);
|
||||
|
||||
while (<ORIGFILE>) {
|
||||
|
||||
$tempstring = $_;
|
||||
if ($tempstring =~ "\#define VERSION_MAJOR_STR") {
|
||||
$tempstring = "\#define VERSION_MAJOR_STR \"5.0a1-" . $build_number . " Development\"\n";
|
||||
}
|
||||
print OUTPUT $tempstring;
|
||||
}
|
||||
|
||||
close (ORIGFILE);
|
||||
close (OUTPUT);
|
||||
|
||||
unlink (":mozilla:cmd:macfe:restext:custom.r");
|
||||
rename (":mozilla:cmd:macfe:restext:agent.r", ":mozilla:cmd:macfe:restext:custom.r");
|
||||
}
|
||||
|
||||
sub SetTimeBomb($$)
|
||||
|
||||
{
|
||||
my ($warn_days, $bomb_days) = @_;
|
||||
|
||||
system("perl :mozilla:config:mac-set-timebomb.pl $warn_days $bomb_days");
|
||||
|
||||
}
|
||||
|
||||
sub Delay($)
|
||||
|
||||
{
|
||||
my ($delay_seconds) = @_;
|
||||
|
||||
$now = time;
|
||||
|
||||
$exit_time = $now + $delay_seconds;
|
||||
|
||||
while ($exit_time > $now) {
|
||||
$now = time;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Scott Collins <scc@netscape.com>, Simon Fraser <sfraser@netscape.com>, Chris Yeh <cyeh@netscape.com>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
BuildMozillaDebug.pl (et al), BuildList.pm, CodeWarriorLib (an AppleScript library)
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "NPL"); you may not use this file except in
|
||||
compliance with the NPL. You may obtain a copy of the NPL at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
for the specific language governing rights and limitations under the
|
||||
NPL.
|
||||
|
||||
The Initial Developer of this code under the NPL is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
Reserved.
|
||||
|
||||
=cut
|
||||
669
mozilla/build/mac/NGLayoutBuildList.pm
Normal file
669
mozilla/build/mac/NGLayoutBuildList.pm
Normal file
@@ -0,0 +1,669 @@
|
||||
#!perl -w
|
||||
package NGLayoutBuildList;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use vars qw( @ISA @EXPORT );
|
||||
|
||||
# perl includes
|
||||
use Mac::StandardFile;
|
||||
use Mac::Processes;
|
||||
use Cwd;
|
||||
use File::Path;
|
||||
|
||||
# homegrown
|
||||
use Moz;
|
||||
use MacCVS;
|
||||
use MANIFESTO;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(Checkout BuildDist BuildProjects BuildCommonProjects BuildLayoutProjects);
|
||||
|
||||
# NGLayoutBuildList builds the nglayout project
|
||||
# it is configured by setting the following variables in the caller:
|
||||
# Usage:
|
||||
# caller variables that affect behaviour:
|
||||
# DEBUG : 1 if we are building a debug version
|
||||
# 3-part build process: checkout, dist, and build_projects
|
||||
# Hack alert:
|
||||
# NGLayout defines are located in :mozilla:config:mac:NGLayoutConfigInclude.h
|
||||
# An alias "MacConfigInclude.h" to this file is created inside dist:config
|
||||
# Note that the name of alias is different than the name of the file. This
|
||||
# is to trick CW into including NGLayout defines
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Utility routines
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
# pickWithMemoryFile stores the information about the user pick inside
|
||||
# the file $session_storage
|
||||
sub _pickWithMemoryFile($)
|
||||
{
|
||||
my ($sessionStorage) = @_;
|
||||
my $cvsfile;
|
||||
|
||||
if (( -e $sessionStorage) &&
|
||||
open( SESSIONFILE, $sessionStorage ))
|
||||
{
|
||||
# Read in the path if available
|
||||
$cvsfile = <SESSIONFILE>;
|
||||
chomp $cvsfile;
|
||||
close SESSIONFILE;
|
||||
if ( ! -e $cvsfile )
|
||||
{
|
||||
print STDERR "$cvsfile has disappeared\n";
|
||||
undef $cvsfile;
|
||||
}
|
||||
}
|
||||
unless (defined ($cvsfile))
|
||||
{
|
||||
print "Choose a CVS session file in file dialog box:\n"; # no way to display a prompt?
|
||||
# make sure that MacPerl is a front process
|
||||
while (GetFrontProcess () != GetCurrentProcess())
|
||||
{
|
||||
SetFrontProcess( GetCurrentProcess() );
|
||||
}
|
||||
# prompt user for the file name, and store it
|
||||
my $macFile = StandardGetFile( 0, "McvD");
|
||||
if ( $macFile->sfGood() )
|
||||
{
|
||||
$cvsfile = $macFile->sfFile();
|
||||
# save the choice if we can
|
||||
if ( open (SESSIONFILE, ">" . $sessionStorage))
|
||||
{
|
||||
printf SESSIONFILE $cvsfile, "\n";
|
||||
close SESSIONFILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "Could not open storage file\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $cvsfile;
|
||||
}
|
||||
|
||||
# assert that we are in the correct directory for the build
|
||||
sub _assertRightDirectory()
|
||||
{
|
||||
unless (-e ":mozilla")
|
||||
{
|
||||
my($dir) = cwd();
|
||||
print STDERR "NGLayoutBuildList called from incorrect directory: $dir";
|
||||
}
|
||||
}
|
||||
|
||||
sub _getDistDirectory()
|
||||
{
|
||||
return $main::DEBUG ? ":mozilla:dist:viewer_debug:" : ":mozilla:dist:viewer:";
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Checkout everything
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub Checkout()
|
||||
{
|
||||
_assertRightDirectory();
|
||||
my($cvsfile) = _pickWithMemoryFile("::nglayout.cvsloc");
|
||||
my($session) = MacCVS->new( $cvsfile );
|
||||
unless (defined($session)) { die "Checkout aborted. Cannot create session file: $session" }
|
||||
|
||||
#//
|
||||
#// Checkout commands
|
||||
#//
|
||||
if ($main::pull{all})
|
||||
{
|
||||
$session->checkout("SeaMonkeyEditor") || die "checkout failure";
|
||||
|
||||
#// beard: additional libraries needed to make shared libraries link.
|
||||
#//$session->checkout("mozilla/lib/mac/PowerPlant") || die "checkout failure";
|
||||
#//$session->checkout("mozilla/lib/xlate") || die "checkout failure";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build the 'dist' directory
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildDist()
|
||||
{
|
||||
unless ( $main::build{dist} ) { return;}
|
||||
_assertRightDirectory();
|
||||
|
||||
# we really do not need all these paths, but many client projects include them
|
||||
mkpath([ ":mozilla:dist:", ":mozilla:dist:client:", ":mozilla:dist:client_debug:", ":mozilla:dist:client_stubs:" ]);
|
||||
mkpath([ ":mozilla:dist:viewer:", ":mozilla:dist:viewer_debug:" ]);
|
||||
|
||||
my($distdirectory) = ":mozilla:dist";
|
||||
|
||||
if ($main::MOZ_FULLCIRCLE)
|
||||
{
|
||||
if ( $main::DEBUG )
|
||||
{
|
||||
mkpath([ "$distdirectory:viewer_debug:TalkBack"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
mkpath([ "$distdirectory:viewer:TalkBack"]);
|
||||
}
|
||||
}
|
||||
|
||||
#MAC_COMMON
|
||||
InstallFromManifest(":mozilla:build:mac:MANIFEST", "$distdirectory:mac:common:");
|
||||
InstallFromManifest(":mozilla:lib:mac:NSStdLib:include:MANIFEST", "$distdirectory:mac:common:");
|
||||
InstallFromManifest(":mozilla:lib:mac:MacMemoryAllocator:include:MANIFEST", "$distdirectory:mac:common:");
|
||||
InstallFromManifest(":mozilla:lib:mac:Misc:MANIFEST", "$distdirectory:mac:common:");
|
||||
InstallFromManifest(":mozilla:lib:mac:MoreFiles:MANIFEST", "$distdirectory:mac:common:morefiles:");
|
||||
|
||||
#INCLUDE
|
||||
InstallFromManifest(":mozilla:config:mac:MANIFEST", "$distdirectory:config:");
|
||||
InstallFromManifest(":mozilla:config:mac:MANIFEST_config", "$distdirectory:config:");
|
||||
InstallFromManifest(":mozilla:include:MANIFEST", "$distdirectory:include:");
|
||||
InstallFromManifest(":mozilla:cmd:macfe:pch:MANIFEST", "$distdirectory:include:");
|
||||
InstallFromManifest(":mozilla:cmd:macfe:utility:MANIFEST", "$distdirectory:include:");
|
||||
|
||||
#NSPR
|
||||
InstallFromManifest(":mozilla:nsprpub:pr:include:MANIFEST", "$distdirectory:nspr:");
|
||||
InstallFromManifest(":mozilla:nsprpub:pr:src:md:mac:MANIFEST", "$distdirectory:nspr:mac:");
|
||||
InstallFromManifest(":mozilla:nsprpub:lib:ds:MANIFEST", "$distdirectory:nspr:");
|
||||
InstallFromManifest(":mozilla:nsprpub:lib:libc:include:MANIFEST", "$distdirectory:nspr:");
|
||||
InstallFromManifest(":mozilla:nsprpub:lib:msgc:include:MANIFEST", "$distdirectory:nspr:");
|
||||
|
||||
#UCONV
|
||||
InstallFromManifest(":mozilla:intl:uconv:public:MANIFEST", "$distdirectory:uconv:");
|
||||
|
||||
#JPEG
|
||||
InstallFromManifest(":mozilla:jpeg:MANIFEST", "$distdirectory:jpeg:");
|
||||
|
||||
#LIBREG
|
||||
InstallFromManifest(":mozilla:modules:libreg:include:MANIFEST", "$distdirectory:libreg:");
|
||||
|
||||
#XPCOM
|
||||
InstallFromManifest(":mozilla:xpcom:public:MANIFEST", "$distdirectory:xpcom:");
|
||||
|
||||
#ZLIB
|
||||
InstallFromManifest(":mozilla:modules:zlib:src:MANIFEST", "$distdirectory:zlib:");
|
||||
|
||||
#LIBUTIL
|
||||
InstallFromManifest(":mozilla:modules:libutil:public:MANIFEST", "$distdirectory:libutil:");
|
||||
|
||||
#SUN_JAVA
|
||||
InstallFromManifest(":mozilla:sun-java:stubs:include:MANIFEST", "$distdirectory:sun-java:");
|
||||
InstallFromManifest(":mozilla:sun-java:stubs:macjri:MANIFEST", "$distdirectory:sun-java:");
|
||||
|
||||
#NAV_JAVA
|
||||
InstallFromManifest(":mozilla:nav-java:stubs:include:MANIFEST", "$distdirectory:nav-java:");
|
||||
InstallFromManifest(":mozilla:nav-java:stubs:macjri:MANIFEST", "$distdirectory:nav-java:");
|
||||
|
||||
#JS
|
||||
InstallFromManifest(":mozilla:js:src:MANIFEST", "$distdirectory:js:");
|
||||
|
||||
#LIVECONNECT
|
||||
InstallFromManifest(":mozilla:js:src:liveconnect:MANIFEST", "$distdirectory:liveconnect:");
|
||||
|
||||
#SECURITY_freenav
|
||||
InstallFromManifest(":mozilla:modules:security:freenav:MANIFEST", "$distdirectory:security:");
|
||||
|
||||
#LIBPREF
|
||||
InstallFromManifest(":mozilla:modules:libpref:public:MANIFEST", "$distdirectory:libpref:");
|
||||
|
||||
#LIBIMAGE
|
||||
InstallFromManifest(":mozilla:modules:libimg:png:MANIFEST", "$distdirectory:libimg:");
|
||||
InstallFromManifest(":mozilla:modules:libimg:src:MANIFEST", "$distdirectory:libimg:");
|
||||
InstallFromManifest(":mozilla:modules:libimg:public:MANIFEST", "$distdirectory:libimg:");
|
||||
|
||||
#PLUGIN
|
||||
InstallFromManifest(":mozilla:modules:plugin:nglsrc:MANIFEST", "$distdirectory:plugin:");
|
||||
InstallFromManifest(":mozilla:modules:plugin:public:MANIFEST", "$distdirectory:plugin:");
|
||||
InstallFromManifest(":mozilla:modules:plugin:src:MANIFEST", "$distdirectory:plugin:");
|
||||
InstallFromManifest(":mozilla:modules:oji:src:MANIFEST", "$distdirectory:oji:");
|
||||
InstallFromManifest(":mozilla:modules:oji:public:MANIFEST", "$distdirectory:oji:");
|
||||
|
||||
#LAYERS (IS THIS STILL NEEDED)
|
||||
InstallFromManifest(":mozilla:lib:liblayer:include:MANIFEST", "$distdirectory:layers:");
|
||||
|
||||
#NETWORK
|
||||
InstallFromManifest(":mozilla:network:public:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:cache:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:client:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:cnvts:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:cstream:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:main:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:mimetype:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:util:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:about:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:certld:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:dataurl:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:file:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:ftp:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:gopher:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:http:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:js:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:mailbox:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:marimba:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:nntp:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:pop3:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:remote:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:smtp:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:protocol:sockstub:MANIFEST", "$distdirectory:network:");
|
||||
InstallFromManifest(":mozilla:network:module:MANIFEST", "$distdirectory:network:module");
|
||||
|
||||
#BASE
|
||||
InstallFromManifest(":mozilla:base:src:MANIFEST", "$distdirectory:base:");
|
||||
InstallFromManifest(":mozilla:base:public:MANIFEST", "$distdirectory:base:");
|
||||
|
||||
#WEBSHELL
|
||||
InstallFromManifest(":mozilla:webshell:public:MANIFEST", "$distdirectory:webshell:");
|
||||
InstallFromManifest(":mozilla:webshell:tests:viewer:public:MANIFEST", "$distdirectory:webshell:");
|
||||
|
||||
#LAYOUT
|
||||
InstallFromManifest(":mozilla:layout:build:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:base:public:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:html:style:public:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:html:style:src:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:html:base:src:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:html:forms:public:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:base:src:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:events:public:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:events:src:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:xml:document:public:MANIFEST", "$distdirectory:layout:");
|
||||
InstallFromManifest(":mozilla:layout:xml:content:public:MANIFEST", "$distdirectory:layout:");
|
||||
|
||||
|
||||
#WIDGET
|
||||
InstallFromManifest(":mozilla:widget:public:MANIFEST", "$distdirectory:widget:");
|
||||
InstallFromManifest(":mozilla:widget:src:mac:MANIFEST", "$distdirectory:widget:");
|
||||
|
||||
#GFX
|
||||
InstallFromManifest(":mozilla:gfx:public:MANIFEST", "$distdirectory:gfx:");
|
||||
|
||||
#VIEW
|
||||
InstallFromManifest(":mozilla:view:public:MANIFEST", "$distdirectory:view:");
|
||||
|
||||
#DOM
|
||||
InstallFromManifest(":mozilla:dom:public:MANIFEST", "$distdirectory:dom:");
|
||||
InstallFromManifest(":mozilla:dom:public:coreDom:MANIFEST", "$distdirectory:dom:");
|
||||
InstallFromManifest(":mozilla:dom:public:coreEvents:MANIFEST", "$distdirectory:dom:");
|
||||
InstallFromManifest(":mozilla:dom:public:events:MANIFEST", "$distdirectory:dom:");
|
||||
InstallFromManifest(":mozilla:dom:public:html:MANIFEST", "$distdirectory:dom:");
|
||||
InstallFromManifest(":mozilla:dom:public:css:MANIFEST", "$distdirectory:dom:");
|
||||
InstallFromManifest(":mozilla:dom:src:jsurl:MANIFEST", "$distdirectory:dom:");
|
||||
|
||||
#HTMLPARSER
|
||||
InstallFromManifest(":mozilla:htmlparser:src:MANIFEST", "$distdirectory:htmlparser:");
|
||||
|
||||
#RDF
|
||||
InstallFromManifest(":mozilla:rdf:base:public:MANIFEST", "$distdirectory:rdf:");
|
||||
InstallFromManifest(":mozilla:rdf:content:public:MANIFEST", "$distdirectory:rdf:");
|
||||
InstallFromManifest(":mozilla:rdf:datasource:public:MANIFEST", "$distdirectory:rdf:");
|
||||
InstallFromManifest(":mozilla:rdf:build:MANIFEST", "$distdirectory:rdf:");
|
||||
|
||||
#EDITOR
|
||||
InstallFromManifest(":mozilla:editor:public:MANIFEST", "$distdirectory:editor:");
|
||||
InstallFromManifest(":mozilla:editor:txmgr:public:MANIFEST", "$distdirectory:editor:txmgr");
|
||||
|
||||
#SILENTDL
|
||||
InstallFromManifest(":mozilla:silentdl:MANIFEST", "$distdirectory:silentdl:");
|
||||
|
||||
#FULL CIRCLE
|
||||
if ($main::MOZ_FULLCIRCLE)
|
||||
{
|
||||
InstallFromManifest(":ns:fullsoft:public:MANIFEST", "$distdirectory");
|
||||
|
||||
if ($main::DEBUG)
|
||||
{
|
||||
#InstallFromManifest(":ns:fullsoft:public:MANIFEST", "$distdirectory:viewer_debug:");
|
||||
}
|
||||
else
|
||||
{
|
||||
#InstallFromManifest(":ns:fullsoft:public:MANIFEST", "$distdirectory:viewer:");
|
||||
InstallFromManifest(":ns:fullsoft:public:MANIFEST", "$distdirectory");
|
||||
}
|
||||
}
|
||||
|
||||
#// To get out defines in all the project, dummy alias NGLayoutConfigInclude.h into MacConfigInclude.h
|
||||
MakeAlias(":mozilla:config:mac:NGLayoutConfigInclude.h", ":mozilla:dist:config:MacConfigInclude.h");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build stub projects
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildStubs()
|
||||
{
|
||||
|
||||
unless( $main::build{stubs} ) { return; }
|
||||
_assertRightDirectory();
|
||||
|
||||
#//
|
||||
#// Clean projects
|
||||
#//
|
||||
BuildProjectClean(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "Stubs");
|
||||
BuildProjectClean(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "Stubs");
|
||||
BuildProjectClean(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "Stubs");
|
||||
# BuildProjectClean(":mozilla:cmd:macfe:projects:client:Client.mcp", "Stubs");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build one project, and make the alias. Parameters
|
||||
#// are project path, target name, make shlb alias (boolean), make xSYM alias (boolean)
|
||||
#//
|
||||
#// Note that this routine assumes that the target name and the shared libary name
|
||||
#// are the same.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildOneProject($$$$$)
|
||||
{
|
||||
my ($project_path, $target_name, $toc_file, $alias_shlb, $alias_xSYM) = @_;
|
||||
|
||||
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
|
||||
my($D) = $main::DEBUG ? "Debug" : "";
|
||||
my($dist_dir) = _getDistDirectory();
|
||||
|
||||
my($project_dir) = $project_path;
|
||||
$project_dir =~ s/:[^:]+$/:/; # chop off leaf name
|
||||
|
||||
if ($main::CLOBBER_LIBS)
|
||||
{
|
||||
unlink "$project_dir$target_name"; # it's OK if these fail
|
||||
unlink "$project_dir$target_name.xSYM";
|
||||
}
|
||||
|
||||
if ($toc_file ne "")
|
||||
{
|
||||
ReconcileProject("$project_path", "$project_dir$toc_file");
|
||||
}
|
||||
|
||||
BuildProject($project_path, $target_name);
|
||||
|
||||
$alias_shlb ? MakeAlias("$project_dir$target_name", "$dist_dir") : 0;
|
||||
$alias_xSYM ? MakeAlias("$project_dir$target_name.xSYM", "$dist_dir") : 0;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build common projects
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildCommonProjects()
|
||||
{
|
||||
unless( $main::build{common} ) { return; }
|
||||
_assertRightDirectory();
|
||||
|
||||
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
|
||||
my($D) = $main::DEBUG ? "Debug" : "";
|
||||
my($dist_dir) = _getDistDirectory();
|
||||
|
||||
#//
|
||||
#// Stub libraries
|
||||
#//
|
||||
BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "Security.o");
|
||||
|
||||
#//
|
||||
#// Shared libraries
|
||||
#//
|
||||
if ( $main::CARBON )
|
||||
{
|
||||
BuildProject(":mozilla:cmd:macfe:projects:interfaceLib:Interface.mcp", "Carbon Interfaces");
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildProject(":mozilla:cmd:macfe:projects:interfaceLib:Interface.mcp", "MacOS Interfaces");
|
||||
}
|
||||
|
||||
BuildOneProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "NSRuntime$D.shlb", "", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.mcp", "MoreFiles$D.shlb", "", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb", "NSPR20.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "MemAllocator$D.shlb", "", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "NSStdLib$D.shlb", "", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:jpeg:macbuild:JPEG.mcp", "JPEG$D.shlb", "JPEG.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp", "xpcom$D.shlb", "xpcom.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:js:macbuild:JavaScript.mcp", "JavaScript$D.shlb", "JavaScript.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:js:macbuild:LiveConnect.mcp", "LiveConnect$D.shlb", "", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:modules:zlib:macbuild:zlib.mcp", "zlib$D.shlb", "zlib.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:modules:libpref:macbuild:libpref.mcp", "libpref$D.shlb", "libpref.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:base:macbuild:base.mcp", "base$D.shlb", "base.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:intl:uconv:macbuild:uconv.mcp", "uconv$D.shlb", "uconv.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvlatin.mcp", "ucvlatin$D.shlb", "uconvlatin.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvja.mcp", "ucvja$D.shlb", "ucvja.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
#// removing powerplant - long live powerplant
|
||||
# BuildOneProject(":mozilla:lib:mac:PowerPlant:PowerPlant.mcp", "PowerPlant$D.shlb", "", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:modules:libutil:macbuild:libutil.mcp", "libutil$D.shlb", "libutil.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
ReconcileProject(":mozilla:modules:libimg:macbuild:png.mcp", ":mozilla:modules:libimg:macbuild:png.toc");
|
||||
BuildProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o");
|
||||
|
||||
BuildOneProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.shlb", "libimg.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:network:macbuild:network.mcp", "NetworkModular$D.shlb", "network.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:rdf:macbuild:rdf.mcp", "rdf$D.shlb", "rdf.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Make resource aliases for one directory
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildFolderResourceAliases($$)
|
||||
{
|
||||
my($src_dir, $dest_dir) = @_;
|
||||
|
||||
# get a list of all the resource files
|
||||
opendir(SRCDIR, $src_dir) || die("can't open $src_dir");
|
||||
my(@resource_files) = readdir(SRCDIR);
|
||||
closedir(SRCDIR);
|
||||
|
||||
# make aliases for each one into the dest directory
|
||||
for ( @resource_files ) {
|
||||
next if $_ eq "CVS";
|
||||
|
||||
my($file_name) = $src_dir . $_;
|
||||
print("Placing alias to file $file_name in $dest_dir\n");
|
||||
MakeAlias($file_name, $dest_dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Make resource aliases
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub MakeResouceAliases()
|
||||
{
|
||||
unless( $main::build{resources} ) { return; }
|
||||
_assertRightDirectory();
|
||||
|
||||
|
||||
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
|
||||
my($D) = $main::DEBUG ? "Debug" : "";
|
||||
my($dist_dir) = _getDistDirectory();
|
||||
|
||||
#//
|
||||
#// Make aliases of resource files
|
||||
#//
|
||||
my($resource_dir) = "$dist_dir" . "res:";
|
||||
MakeAlias(":mozilla:layout:html:document:src:ua.css", "$resource_dir");
|
||||
|
||||
my($html_dir) = "$resource_dir" . "html:";
|
||||
MakeAlias(":mozilla:layout:html:base:src:broken-image.gif", "$html_dir");
|
||||
|
||||
my($throbber_dir) = "$resource_dir" . "throbber:";
|
||||
# BuildFolderResourceAliases(":mozilla:xpfe:xpviewer:src:resources:throbber:", "$throbber_dir");
|
||||
BuildFolderResourceAliases(":mozilla:webshell:tests:viewer:throbber:", "$throbber_dir");
|
||||
|
||||
my($samples_dir) = "$resource_dir" . "samples:";
|
||||
BuildFolderResourceAliases(":mozilla:webshell:tests:viewer:samples:", "$samples_dir");
|
||||
BuildFolderResourceAliases(":mozilla:webshell:tests:viewer:resources:", "$samples_dir");
|
||||
|
||||
my($chrome_dir) = "$resource_dir" . "chrome:";
|
||||
BuildFolderResourceAliases(":mozilla:xpfe:xpviewer:src:resources:chrome:", "$chrome_dir");
|
||||
|
||||
my($toolbar_dir) = "$resource_dir" . "toolbar:";
|
||||
BuildFolderResourceAliases(":mozilla:xpfe:xpviewer:src:resources:toolbar:", "$toolbar_dir");
|
||||
|
||||
my($rdf_dir) = "$resource_dir" . "rdf:";
|
||||
BuildFolderResourceAliases(":mozilla:rdf:resources:", "$rdf_dir");
|
||||
|
||||
# NOTE: this will change as we move the toolbar/appshell chrome files to a real place
|
||||
BuildFolderResourceAliases(":mozilla:xpfe:browser:src:", "$samples_dir");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build NGLayout
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildLayoutProjects()
|
||||
{
|
||||
unless( $main::build{nglayout} ) { return; }
|
||||
_assertRightDirectory();
|
||||
|
||||
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
|
||||
my($D) = $main::DEBUG ? "Debug" : "";
|
||||
my($dist_dir) = _getDistDirectory();
|
||||
|
||||
|
||||
|
||||
#//
|
||||
#// Make WasteLib alias
|
||||
#//
|
||||
local(*F);
|
||||
my($filepath, $appath, $psi) = (':mozilla:build:mac:idepath.txt');
|
||||
if (open(F, $filepath)) {
|
||||
$appath = <F>;
|
||||
close(F);
|
||||
#// beard: use pattern substitution to generate path to WasteLib. (thanks gordon!)
|
||||
$appath =~ s/[^:]*$/MacOS Support:WASTE 1.3 Distribution:WASTELib/;
|
||||
my($wastelibpath) = $appath;
|
||||
MakeAlias("$wastelibpath", "$dist_dir");
|
||||
}
|
||||
else {
|
||||
print STDERR "Can't find $filepath\n";
|
||||
}
|
||||
|
||||
|
||||
#//
|
||||
#// Build Layout projects
|
||||
#//
|
||||
|
||||
BuildOneProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.shlb", "htmlparser.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.shlb", "dom.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb", "gfx.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:modules:plugin:macbuild:plugin.mcp", "plugin$D.shlb", "plugin.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:layout:macbuild:layout.mcp", "layout$D.shlb", "layout.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:view:macbuild:view.mcp", "view$D.shlb", "view.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:widget:macbuild:widget.mcp", "widget$D.shlb", "widget.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:webshell:macbuild:webshell.mcp", "webshell$D.shlb", "webshell.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build Editor Projects
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildEditorProjects()
|
||||
{
|
||||
unless( $main::build{editor} ) { return; }
|
||||
_assertRightDirectory();
|
||||
|
||||
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
|
||||
my($D) = $main::DEBUG ? "Debug" : "";
|
||||
my($dist_dir) = _getDistDirectory();
|
||||
|
||||
BuildOneProject(":mozilla:editor:txmgr:macbuild:txmgr.mcp", "EditorTxmgr$D.shlb", "txmgr.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:editor:guimgr:macbuild:EditorGuiManager.mcp", "EditorGuiManager$D.shlb", "EditorGuiManager.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:editor:macbuild:editor.mcp", "EditorCore$D.shlb", "EditorCore.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build Viewer Projects
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildViewerProjects()
|
||||
{
|
||||
unless( $main::build{viewer} ) { return; }
|
||||
_assertRightDirectory();
|
||||
|
||||
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
|
||||
my($D) = $main::DEBUG ? "Debug" : "";
|
||||
my($dist_dir) = _getDistDirectory();
|
||||
|
||||
BuildOneProject(":mozilla:webshell:tests:viewer:mac:viewer.mcp", "viewer$D", "viewer.toc", 0, 0);
|
||||
|
||||
# BuildOneProject(":mozilla:xpfe:macbuild:xpfeviewer.mcp", "xpfeviewer$D.shlb", "xpfeviewer.toc", 0, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build XPApp Projects
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildXPAppProjects()
|
||||
{
|
||||
unless( $main::build{xpapp} ) { return; }
|
||||
_assertRightDirectory();
|
||||
|
||||
# $D becomes a suffix to target names for selecting either the debug or non-debug target of a project
|
||||
my($D) = $main::DEBUG ? "Debug" : "";
|
||||
my($dist_dir) = _getDistDirectory();
|
||||
|
||||
BuildOneProject(":mozilla:xpfe:appshell:macbuild:AppShell.mcp", "AppShell$D.shlb", "AppShell.toc", 1, $main::ALIAS_SYM_FILES);
|
||||
|
||||
BuildOneProject(":mozilla:xpfe:bootstrap:macbuild:apprunner.mcp", "apprunner$D", "apprunner.toc", 0, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build everything
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildProjects()
|
||||
{
|
||||
BuildStubs();
|
||||
BuildCommonProjects();
|
||||
BuildLayoutProjects();
|
||||
BuildEditorProjects();
|
||||
MakeResouceAliases();
|
||||
BuildViewerProjects();
|
||||
BuildXPAppProjects();
|
||||
}
|
||||
39
mozilla/build/mac/NSCrossProductDefines.h
Normal file
39
mozilla/build/mac/NSCrossProductDefines.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#error "DonÕt use me!"
|
||||
|
||||
#define OLDROUTINELOCATIONS 0
|
||||
#define XP_MAC 1
|
||||
#define NSPR20 1
|
||||
#define _NO_FAST_STRING_INLINES_ 1
|
||||
#define HAVE_BOOLEAN 1
|
||||
#define NETSCAPE 1
|
||||
#define OTUNIXERRORS 1 /* We want OpenTransport error codes */
|
||||
|
||||
#define OJI 1
|
||||
|
||||
/*
|
||||
This compiles in heap dumping utilities and other good stuff
|
||||
for developers -- maybe we only want it in for a special SDK
|
||||
nspr/java runtime(?):
|
||||
*/
|
||||
#define DEVELOPER_DEBUG 1
|
||||
|
||||
#define MAX(_a,_b) ((_a) < (_b) ? (_b) : (_a))
|
||||
#define MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
|
||||
57
mozilla/build/mac/PullNGlayout.pl
Normal file
57
mozilla/build/mac/PullNGlayout.pl
Normal file
@@ -0,0 +1,57 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# nglayout build script (debug)
|
||||
#
|
||||
use Mac::Processes;
|
||||
use NGLayoutBuildList;
|
||||
use Cwd;
|
||||
use Moz;
|
||||
|
||||
# configuration variables
|
||||
$DEBUG = 1;
|
||||
$pull{all} = 1;
|
||||
$pull{lizard} = 0;
|
||||
$pull{xpcom} = 0;
|
||||
$pull{imglib} = 0;
|
||||
$pull{netlib} = 0;
|
||||
$pull{nglayout} = 0;
|
||||
$pull{mac} = 0;
|
||||
|
||||
if ($pull{all})
|
||||
{
|
||||
foreach $k (keys(%pull))
|
||||
{
|
||||
$pull{$k} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# do the work
|
||||
# you should not have to edit anything bellow
|
||||
|
||||
chdir("::::");
|
||||
|
||||
Moz::StopForErrors();
|
||||
#Moz::DontStopForErrors();
|
||||
|
||||
#OpenErrorLog("::NGLayoutBuildLog");
|
||||
OpenErrorLog("NGLayoutPullLog"); # Tinderbox requires that name
|
||||
|
||||
Checkout();
|
||||
BIN
mozilla/build/mac/RunTSScript
Normal file
BIN
mozilla/build/mac/RunTSScript
Normal file
Binary file not shown.
908
mozilla/build/mac/TinderboxAppleScript.txt
Normal file
908
mozilla/build/mac/TinderboxAppleScript.txt
Normal file
@@ -0,0 +1,908 @@
|
||||
global PPCPROJECTFAILED
|
||||
global CVSSESSIONFILE
|
||||
global CVSSESSIONNAME
|
||||
global BUILDLIST
|
||||
global BUILDNAME
|
||||
global FOLDERTIME
|
||||
global SOURCEPATH
|
||||
global CHECKOUTTIME
|
||||
global TINDERBOXTREE
|
||||
global MACHINEADMIN
|
||||
global CLOBBERBUILD
|
||||
global STARTUPDISK
|
||||
global BINARYPATH
|
||||
property CONFIGFILENAME : "Tinderbox Config"
|
||||
|
||||
-------------------------
|
||||
on CreateLogFile(logFilePath)
|
||||
-- creates a "build log" file
|
||||
-------------------------
|
||||
global logFileID
|
||||
set logFileID to 0
|
||||
try
|
||||
set logFileID to open for access file logFilePath with write permission
|
||||
--set the type of alias logFilePath to "CWIE"
|
||||
on error errMsg2 number errNum
|
||||
if (errNum is not -49) then
|
||||
-- nothing to do about such errors
|
||||
error errMsg2 & " error = " & errNum
|
||||
end if
|
||||
end try
|
||||
end CreateLogFile
|
||||
|
||||
-------------------------
|
||||
on CloseLogFile()
|
||||
-- close log file
|
||||
-------------------------
|
||||
global logFileID
|
||||
if logFileID is not 0 then close access logFileID
|
||||
end CloseLogFile
|
||||
|
||||
-------------------------
|
||||
on logMessage(m)
|
||||
-- logs a message to the log file
|
||||
-------------------------
|
||||
global logFileID
|
||||
try
|
||||
if logFileID is not 0 then write (m as string) & (ASCII character 13) to logFileID
|
||||
--display dialog m
|
||||
on error
|
||||
-- hmmm??
|
||||
end try
|
||||
end logMessage
|
||||
|
||||
-------------------------
|
||||
on trim(q)
|
||||
-- strip leading and trailing white space.
|
||||
-------------------------
|
||||
set realLast to length of q
|
||||
repeat
|
||||
if realLast is 0 then exit repeat
|
||||
set c to character realLast of q
|
||||
if c is not space and c is not tab then exit repeat
|
||||
set realLast to realLast - 1
|
||||
end repeat
|
||||
if (realLast is 0) then return ""
|
||||
set realFirst to 1
|
||||
repeat
|
||||
if realFirst > realLast then exit repeat
|
||||
set c to character realFirst of q
|
||||
if c is not space and c is not tab then exit repeat
|
||||
set realFirst to realFirst + 1
|
||||
end repeat
|
||||
if (realFirst > realLast) then return ""
|
||||
return text realFirst through realLast of q
|
||||
end trim
|
||||
|
||||
-------------------------
|
||||
on Token(aString, tokenRequested)
|
||||
-- Return the string up to the first space. Input must be trimmed.
|
||||
-------------------------
|
||||
set tokenFirst to 0 -- offset of first char of current token
|
||||
set tokenCount to 0 -- which token we are examining
|
||||
set tokenScan to 0 -- offset of next character being examined
|
||||
set stringLength to length of aString
|
||||
if (tokenRequested = 0) then return ""
|
||||
repeat
|
||||
set tokenFirst to tokenFirst + 1
|
||||
set tokenCount to tokenCount + 1
|
||||
-- check for inital whitespace
|
||||
repeat
|
||||
set c to character tokenFirst of aString
|
||||
if c is not space and c is not tab then exit repeat
|
||||
set tokenFirst to tokenFirst + 1
|
||||
end repeat
|
||||
-- check for inital quote
|
||||
set isQuotedString to false
|
||||
if c is "\"" then
|
||||
set isQuotedString to true
|
||||
set tokenFirst to tokenFirst + 1
|
||||
end if
|
||||
-- scan for the next white space or the end of string
|
||||
set tokenScan to tokenFirst - 1
|
||||
repeat
|
||||
set tokenScan to tokenScan + 1
|
||||
if tokenScan > stringLength then exit repeat
|
||||
set c to character tokenScan of aString
|
||||
if (isQuotedString) then
|
||||
if c is "\"" then exit repeat
|
||||
else
|
||||
if c is space or c is tab then exit repeat -- whitespace
|
||||
end if
|
||||
end repeat
|
||||
-- Got a token
|
||||
if (tokenCount = tokenRequested) then
|
||||
return trim(text tokenFirst through (tokenScan - 1) of aString)
|
||||
end if
|
||||
if (tokenScan > stringLength) then return ""
|
||||
set tokenFirst to tokenScan
|
||||
end repeat
|
||||
end Token
|
||||
|
||||
-------------------------
|
||||
on monthNumber(dateObj)
|
||||
-------------------------
|
||||
set monthList to {January, February, March, April, May, Â
|
||||
June, July, August, September, October, November, December}
|
||||
set m to month of dateObj
|
||||
repeat with i from 1 to number of items of monthList
|
||||
if m = item i of monthList then
|
||||
return i
|
||||
end if
|
||||
end repeat
|
||||
end monthNumber
|
||||
|
||||
-------------------------
|
||||
on ExtractTimeString(d)
|
||||
-- given a date object, extract hh.mm
|
||||
-------------------------
|
||||
set tstring to ""
|
||||
set t to (time of d as integer)
|
||||
set m to (t div 60 as integer)
|
||||
set h to m div 60
|
||||
set m to (m - h * 60)
|
||||
if (h < 10) then set tstring to tstring & "0"
|
||||
set tstring to tstring & h
|
||||
if (m < 10) then set tstring to tstring & "0"
|
||||
set tstring to tstring & m
|
||||
return tstring
|
||||
end ExtractTimeString
|
||||
|
||||
-------------------------
|
||||
on ExtractDateString(d)
|
||||
-- given a date object, extract yy/mm/dd
|
||||
-------------------------
|
||||
set dstring to (year of d) & "."
|
||||
set m to monthNumber(d)
|
||||
if (m < 10) then set dstring to dstring & "0"
|
||||
set dstring to dstring & m & "."
|
||||
set d to (day of d)
|
||||
if (d < 10) then set dstring to dstring & "0"
|
||||
set dstring to dstring & d
|
||||
return dstring
|
||||
end ExtractDateString
|
||||
|
||||
-------------------------
|
||||
on GetCVSTimeStamp(d)
|
||||
-- turns AppleScript date object into a text CVS type time stamp
|
||||
-- suitable for passing into MacCVS
|
||||
-------------------------
|
||||
set dstring to ""
|
||||
set m to monthNumber(d)
|
||||
if (m < 10) then set dstring to "0"
|
||||
set dstring to m & "/"
|
||||
set dayNum to (day of d)
|
||||
if (dayNum < 10) then set dstring to dstring & "0"
|
||||
set dstring to dstring & dayNum & "/"
|
||||
set theYear to ((year of d) as string)
|
||||
set dstring to dstring & {characters 3 thru 4 of theYear}
|
||||
|
||||
set tstring to ""
|
||||
set t to (time of d as integer)
|
||||
set m to (t div 60 as integer)
|
||||
set h to m div 60
|
||||
set m to (m - h * 60)
|
||||
if (h < 10) then set tstring to tstring & "0"
|
||||
set tstring to tstring & h & ":"
|
||||
if (m < 10) then set tstring to tstring & "0"
|
||||
set tstring to tstring & m & ":"
|
||||
set s to (t mod 60)
|
||||
if (s < 10) then set tstring to tstring & 0
|
||||
set tstring to tstring & s
|
||||
|
||||
set theresult to ((dstring & " " & tstring & " PST") as string)
|
||||
return theresult
|
||||
end GetCVSTimeStamp
|
||||
|
||||
-------------------------
|
||||
on GetTimeStamp()
|
||||
-- returns a numeric string given for a date object
|
||||
-------------------------
|
||||
set d to current date
|
||||
set dstring to ExtractDateString(d) & "." & ExtractTimeString(d)
|
||||
set dstring to dstring as string
|
||||
return dstring
|
||||
end GetTimeStamp
|
||||
|
||||
-------------------------
|
||||
-- given a full path, return the name of the last object
|
||||
on GetCVSSessionName(path)
|
||||
-- given a mac style path, return the string name of the
|
||||
-- last object in a path
|
||||
-------------------------
|
||||
set going to true
|
||||
set i to the length of path
|
||||
|
||||
repeat while going is true
|
||||
set theChar to character i of path
|
||||
if theChar is ":" then
|
||||
set going to false
|
||||
end if
|
||||
set i to i - 1
|
||||
end repeat
|
||||
set sessionName to (characters {i + 2} thru length of path)
|
||||
return sessionName as string
|
||||
end GetCVSSessionName
|
||||
|
||||
-------------------------
|
||||
on doOnePPCProject(projpath, targetName)
|
||||
-- process one PPC project, given path to project and the target
|
||||
-- if target is "" build frontmost target (the default)
|
||||
-------------------------
|
||||
global gDoAliases
|
||||
set noError to false
|
||||
with timeout of 3600 seconds (* one hour*)
|
||||
|
||||
try
|
||||
tell application "CodeWarrior IDE 3.2"
|
||||
open {projpath}
|
||||
end tell
|
||||
on error errMsg number errNum
|
||||
logMessage("Error : Can't open project " & projpath)
|
||||
set PPCPROJECTFAILED to true
|
||||
error
|
||||
end try
|
||||
|
||||
if targetName is not "" then
|
||||
tell application "CodeWarrior IDE 3.2"
|
||||
Set Current Target (targetName as string)
|
||||
end tell
|
||||
end if
|
||||
|
||||
try
|
||||
tell application "CodeWarrior IDE 3.2"
|
||||
set myErrors to Make Project
|
||||
end tell
|
||||
on error number errNum
|
||||
if errNum < 0 then
|
||||
set noError to true
|
||||
end if
|
||||
end try
|
||||
if noError is false then
|
||||
tell application "CodeWarrior IDE 3.2"
|
||||
set theProjectName to my GetProjectName(projpath)
|
||||
Save Error Window As {STARTUPDISK & ":" & FOLDERTIME & ":" & theProjectName & ".txt"}
|
||||
end tell
|
||||
set PPCPROJECTFAILED to true
|
||||
end if
|
||||
tell application "CodeWarrior IDE 3.2"
|
||||
Close Project
|
||||
end tell
|
||||
end timeout
|
||||
return (noError)
|
||||
end doOnePPCProject
|
||||
|
||||
|
||||
-------------------------
|
||||
on ReadLn(fileRefNum)
|
||||
-- strip empty lines and strip terminal comments
|
||||
-------------------------
|
||||
try
|
||||
repeat
|
||||
set q to read fileRefNum before return
|
||||
if q is not "" then
|
||||
set hashOffset to offset of "#" in q
|
||||
if (hashOffset is 0) then set hashOffset to offset of "//" in q
|
||||
if (hashOffset > 1) then
|
||||
set q to text 1 thru (hashOffset - 1) of q
|
||||
end if
|
||||
if hashOffset is not 1 and q is not "" then
|
||||
-- strip trailing white space.
|
||||
set q to trim(q)
|
||||
if q is not "" then return q
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
on error errString number errNum
|
||||
if errNum is -39 then -- no more lines (eof)
|
||||
return ""
|
||||
end if
|
||||
ErrorMessage(errString)
|
||||
error errString
|
||||
return errString
|
||||
end try
|
||||
end ReadLn
|
||||
|
||||
on ProcessList(theListFile)
|
||||
try
|
||||
with timeout of 14400 seconds -- four hours
|
||||
tell application "MacPerl"
|
||||
Do Script {theListFile as alias}
|
||||
end tell
|
||||
end timeout
|
||||
on error
|
||||
end try
|
||||
|
||||
end ProcessList
|
||||
|
||||
(* Initialize script. Read Config file. Get source directory *)
|
||||
on Initialize()
|
||||
|
||||
try
|
||||
-- find the config file at the same level as this applescript
|
||||
-- if you're running this in script debugger, uncomment lines below
|
||||
set oldDelimiters to AppleScript's text item delimiters
|
||||
set myPath to (path to me) as text
|
||||
set AppleScript's text item delimiters to {":"}
|
||||
set pl to (every text item of myPath)
|
||||
set configPath to (items 1 thru ((count of pl) - 1) of pl) as string
|
||||
set configPath to configPath & ":" & CONFIGFILENAME
|
||||
set AppleScript's text item delimiters to oldDelimiters
|
||||
|
||||
set f to 0
|
||||
|
||||
-- DEBUG
|
||||
-- uncomment this for debugging
|
||||
-- set configPath to "Forge:Tinderbox:cm:client:mac:contbuild:Tinderbox Config"
|
||||
set f to open for access {configPath as alias}
|
||||
|
||||
set MACHINEADMIN to ReadLn(f)
|
||||
set TINDERBOXTREE to ReadLn(f)
|
||||
set BUILDNAME to ReadLn(f)
|
||||
|
||||
set clobberstring to ReadLn(f)
|
||||
if clobberstring is "Clobber" then
|
||||
set CLOBBERBUILD to true
|
||||
else
|
||||
set CLOBBERBUILD to false
|
||||
end if
|
||||
|
||||
set CVSSESSIONFILE to ReadLn(f)
|
||||
set BUILDLIST to ReadLn(f)
|
||||
set BINARYPATH to ReadLn(f)
|
||||
|
||||
if f is not 0 then
|
||||
close access f
|
||||
end if
|
||||
on error
|
||||
display dialog "Failed to read config file!"
|
||||
end try
|
||||
|
||||
set CHECKOUTTIME to GetCVSTimeStamp(current date)
|
||||
|
||||
set SOURCEPATH to getLocalCVSRoot(CVSSESSIONFILE)
|
||||
|
||||
tell application "Finder"
|
||||
set STARTUPDISK to name of startup disk
|
||||
end tell
|
||||
|
||||
createLogDirectory(STARTUPDISK & ":")
|
||||
CreateLogFile(STARTUPDISK & ":" & FOLDERTIME & ":" & "Tinderbox Script Log")
|
||||
|
||||
logMessage("Machine Administrator: " & MACHINEADMIN)
|
||||
logMessage("Building to Tinderbox Tree: " & TINDERBOXTREE)
|
||||
logMessage("Building: " & BUILDNAME)
|
||||
|
||||
if (CLOBBERBUILD) then
|
||||
logMessage("Building Clobber")
|
||||
else
|
||||
logMessage("Building Depend")
|
||||
end if
|
||||
logMessage("CVS Session file at: " & CVSSESSIONFILE)
|
||||
logMessage("BuildList at: " & BUILDLIST)
|
||||
logMessage("Binary file at: " & BINARYPATH)
|
||||
return true
|
||||
|
||||
end Initialize
|
||||
|
||||
-- given a full path, return the name of the last object
|
||||
on GetProjectName(path)
|
||||
set going to true
|
||||
set i to the length of path
|
||||
repeat while going is true
|
||||
set theChar to character i of path
|
||||
if theChar is ":" then
|
||||
set going to false
|
||||
end if
|
||||
set i to i - 1
|
||||
end repeat
|
||||
return (characters {i + 2} thru length of path)
|
||||
end GetProjectName
|
||||
|
||||
|
||||
on notifyHook(result)
|
||||
if result is true then
|
||||
tell application "Eudora Pro 3.1"
|
||||
activate
|
||||
set newMsg to make new message at end of mailbox "Out" of mail folder ""
|
||||
set field "Subject:" of newMsg to "Mac Continous Build FAILED"
|
||||
set body of newMsg to "
|
||||
The last Mac Continous Build Failed at: " & " " & {CHECKOUTTIME as text} & "
|
||||
Since you are on the hook, you might be responsible for the breakage.
|
||||
|
||||
Please check the logs at: http://warp/tinderbox/showbuilds.cgi?tree=" & TINDERBOXTREE & "
|
||||
|
||||
to see if you busted the build."
|
||||
set field "To:" of newMsg to "bonsai-hook"
|
||||
activate
|
||||
queue message newMsg
|
||||
connect with sending without checking
|
||||
end tell
|
||||
end if
|
||||
end notifyHook
|
||||
|
||||
on notifyTinderBoxStart()
|
||||
try
|
||||
tell application "Eudora Pro 3.1"
|
||||
activate
|
||||
set newMsg to make new message at end of mailbox "Out" of mail folder ""
|
||||
set body of newMsg to "
|
||||
|
||||
tinderbox: tree: " & TINDERBOXTREE & "
|
||||
tinderbox: builddate: " & CHECKOUTTIME & "
|
||||
tinderbox: status: building
|
||||
tinderbox: build: " & BUILDNAME & "
|
||||
tinderbox: errorparser: mac
|
||||
"
|
||||
set field "To:" of newMsg to "tinderbox-daemon@warp"
|
||||
activate
|
||||
queue message newMsg
|
||||
connect with sending without checking
|
||||
quit
|
||||
end tell
|
||||
on error
|
||||
CloseLogFile()
|
||||
display dialog "MAIL SERVER ERROR: CAN'T SEND COMPLETION E-MAIL. SCRIPT HALTED"
|
||||
error number -128
|
||||
end try
|
||||
|
||||
end notifyTinderBoxStart
|
||||
|
||||
on notifyTinderBox(result)
|
||||
try
|
||||
if result is true then
|
||||
|
||||
tell application "Finder"
|
||||
set thelist to (every file of folder (STARTUPDISK & ":" & FOLDERTIME & ":"))
|
||||
end tell
|
||||
|
||||
set numFiles to count of thelist
|
||||
set i to 1
|
||||
set aliasList to {}
|
||||
|
||||
repeat numFiles times
|
||||
set aliasList to aliasList & (item i of thelist as alias)
|
||||
set i to i + 1
|
||||
end repeat
|
||||
|
||||
tell application "Eudora Pro 3.1"
|
||||
activate
|
||||
set newMsg to make new message at end of mailbox "Out" of mail folder ""
|
||||
attach to newMsg documents aliasList
|
||||
set field "Subject:" of newMsg to "Mac Continous Build FAILED"
|
||||
set body of newMsg to "
|
||||
|
||||
tinderbox: tree: " & TINDERBOXTREE & "
|
||||
tinderbox: builddate: " & CHECKOUTTIME & "
|
||||
tinderbox: status: busted
|
||||
tinderbox: build: " & BUILDNAME & "
|
||||
tinderbox: errorparser: mac
|
||||
"
|
||||
set field "To:" of newMsg to "tinderbox-daemon@warp"
|
||||
activate
|
||||
queue message newMsg
|
||||
connect with sending without checking
|
||||
quit
|
||||
end tell
|
||||
end if
|
||||
|
||||
if result is false then
|
||||
|
||||
tell application "Finder"
|
||||
set thelist to (every file of folder (STARTUPDISK & ":" & FOLDERTIME & ":"))
|
||||
end tell
|
||||
|
||||
set numFiles to count of thelist
|
||||
set i to 1
|
||||
set aliasList to {}
|
||||
|
||||
repeat numFiles times
|
||||
set aliasList to aliasList & (item i of thelist as alias)
|
||||
set i to i + 1
|
||||
end repeat
|
||||
|
||||
tell application "Eudora Pro 3.1"
|
||||
activate
|
||||
set newMsg to make new message at end of mailbox "Out" of mail folder ""
|
||||
set field "Subject:" of newMsg to "Mac Continous Build SUCCEEDED"
|
||||
set body of newMsg to "
|
||||
|
||||
tinderbox: tree: " & TINDERBOXTREE & "
|
||||
tinderbox: builddate: " & CHECKOUTTIME & "
|
||||
tinderbox: status: success
|
||||
tinderbox: build: " & BUILDNAME & "
|
||||
tinderbox: errorparser: mac
|
||||
"
|
||||
set field "To:" of newMsg to "tinderbox-daemon@warp"
|
||||
activate
|
||||
queue message newMsg
|
||||
connect with sending without checking
|
||||
quit
|
||||
end tell
|
||||
end if
|
||||
on error
|
||||
CloseLogFile()
|
||||
display dialog "MAIL SERVER ERROR: CAN'T SEND COMPLETION E-MAIL. SCRIPT HALTED"
|
||||
error number -128
|
||||
end try
|
||||
|
||||
end notifyTinderBox
|
||||
|
||||
on PageAdmin(pageMesg)
|
||||
tell application "Eudora Pro 3.1"
|
||||
activate
|
||||
set newMsg to make new message at end of mailbox "Out" of mail folder ""
|
||||
set field "To:" of newMsg to MACHINEADMIN
|
||||
set field "Subject:" of newMsg to TINDERBOXTREE & " " & BUILDNAME & " Continous Build failed"
|
||||
if pageMesg is not "" then
|
||||
set body of newMsg to pageMesg
|
||||
end if
|
||||
activate
|
||||
queue message newMsg
|
||||
connect with sending without checking
|
||||
quit
|
||||
end tell
|
||||
end PageAdmin
|
||||
|
||||
-- remove all directories from the local root, removing the old tree
|
||||
on removeOldTree()
|
||||
|
||||
try
|
||||
tell application "Finder"
|
||||
open folder (SOURCEPATH as string)
|
||||
select every item of item of container window of folder (SOURCEPATH as string)
|
||||
delete selection
|
||||
close container window of folder (SOURCEPATH as string)
|
||||
empty trash
|
||||
end tell
|
||||
on error
|
||||
CloseLogFile()
|
||||
set PPCPROJECTFAILED to true
|
||||
logMessage("Error : Couldn't delete the old tree.")
|
||||
PageAdmin("Couldn't nuke old tree!")
|
||||
display dialog ("Couldn't nuke old tree! SCRIPT HALTED")
|
||||
error number -128
|
||||
end try
|
||||
|
||||
end removeOldTree
|
||||
|
||||
-- remove the 'dist' directory from the local root
|
||||
on removeOldDist() --¥
|
||||
|
||||
try
|
||||
tell application "Finder"
|
||||
set distPath to SOURCEPATH & ":mozilla:dist"
|
||||
open folder (distPath as string)
|
||||
select every item of item of container window of folder (distPath as string)
|
||||
delete selection
|
||||
close container window of folder (distPath as string)
|
||||
empty trash
|
||||
end tell
|
||||
on error
|
||||
CloseLogFile()
|
||||
set PPCPROJECTFAILED to true
|
||||
logMessage("Error : Couldn't delete the old 'dist' directory.")
|
||||
PageAdmin("Couldn't nuke old 'dist' directory!")
|
||||
display dialog ("Couldn't nuke old 'dist' directory! SCRIPT HALTED")
|
||||
error number -128
|
||||
end try
|
||||
|
||||
end removeOldDist
|
||||
|
||||
on checkoutModule(cvsmodule, cvsRevision)
|
||||
|
||||
try
|
||||
with timeout of 1800 seconds (* 30 minutes *)
|
||||
if cvsRevision is "" then
|
||||
tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
tell session CVSSESSIONNAME
|
||||
activate
|
||||
checkout module cvsmodule
|
||||
end tell
|
||||
end tell
|
||||
else
|
||||
tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
tell session CVSSESSIONNAME
|
||||
activate
|
||||
checkout module cvsmodule revision cvsRevision
|
||||
end tell
|
||||
end tell
|
||||
end if
|
||||
end timeout
|
||||
if cvsRevision is "" then
|
||||
logMessage("Check-out of " & cvsmodule & "successful!")
|
||||
else
|
||||
logMessage("Check-out of " & cvsmodule & "at revision: " & cvsRevision & " successful!")
|
||||
end if
|
||||
on error errMsg number errNum
|
||||
if cvsRevision is "" then
|
||||
set PPCPROJECTFAILED to true
|
||||
logMessage("Error : Can't check out module: " & cvsmodule & " revision: Tip")
|
||||
logMessage("Error : " & errMsg)
|
||||
error "Can't check out module"
|
||||
else
|
||||
set PPCPROJECTFAILED to true
|
||||
logMessage("Error : Can't check out module: " & cvsmodule & " revision: " & cvsRevision)
|
||||
logMessage("Error : " & errMsg)
|
||||
error "Can't check out module"
|
||||
end if
|
||||
end try
|
||||
|
||||
end checkoutModule
|
||||
|
||||
on checkOutTree(pathToCVSSession)
|
||||
|
||||
try
|
||||
set oldDelimiters to AppleScript's text item delimiters
|
||||
set myPath to (path to me) as text
|
||||
set AppleScript's text item delimiters to {":"}
|
||||
set pl to (every text item of myPath)
|
||||
set configPath to (items 1 thru ((count of pl) - 1) of pl) as string
|
||||
set configPath to configPath & ":" & CONFIGFILENAME
|
||||
set AppleScript's text item delimiters to oldDelimiters
|
||||
|
||||
set f to 0
|
||||
|
||||
-- set configPath to "Forge:Tinderbox:cm:client:mac:contbuild:Tinderbox Config"
|
||||
set f to open for access {configPath as alias}
|
||||
(* read past the cruft of the config file *)
|
||||
ReadLn(f)
|
||||
ReadLn(f)
|
||||
ReadLn(f)
|
||||
ReadLn(f)
|
||||
ReadLn(f)
|
||||
ReadLn(f)
|
||||
ReadLn(f)
|
||||
on error
|
||||
CloseLogFile()
|
||||
set PPCPROJECTFAILED to true
|
||||
logMessage("Couldn't check-out the tree: couldn't read modules" & return)
|
||||
logMessage(errMsg)
|
||||
PageAdmin("Couldn't check-out the tree: couldn't read modules")
|
||||
display dialog "Couldn't read modules from config file: SCRIPT HALTED"
|
||||
error number -128
|
||||
end try
|
||||
|
||||
-- open the session
|
||||
tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
activate
|
||||
open {pathToCVSSession as alias}
|
||||
end tell
|
||||
|
||||
try
|
||||
repeat
|
||||
set cvsmodule to ReadLn(f)
|
||||
if cvsmodule is "" then exit repeat
|
||||
if cvsmodule = "CVS Session" then
|
||||
switchCVSSession(f)
|
||||
else
|
||||
set revision to Token(cvsmodule, 2)
|
||||
set cvsmodule to Token(cvsmodule, 1)
|
||||
checkoutModule(cvsmodule, revision)
|
||||
end if
|
||||
end repeat
|
||||
logMessage("### Checked-out all required modules")
|
||||
on error
|
||||
--¥tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
--¥quit
|
||||
--¥end tell
|
||||
-- toss something up to run()
|
||||
error
|
||||
end try
|
||||
|
||||
--¥tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
--¥quit
|
||||
--¥end tell
|
||||
|
||||
end checkOutTree
|
||||
|
||||
on switchCVSSession(f)
|
||||
|
||||
tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
close session CVSSESSIONNAME
|
||||
end tell
|
||||
|
||||
set newSessionPath to ReadLn(f)
|
||||
set newSessionName to GetCVSSessionName(newSessionPath)
|
||||
|
||||
set CVSSESSIONNAME to newSessionName
|
||||
|
||||
tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
activate
|
||||
open {newSessionPath as alias}
|
||||
end tell
|
||||
|
||||
end switchCVSSession
|
||||
|
||||
on getLocalCVSRoot(pathToCVSSession)
|
||||
|
||||
set CVSSESSIONNAME to GetCVSSessionName(pathToCVSSession)
|
||||
try
|
||||
tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
open {pathToCVSSession as alias}
|
||||
tell session CVSSESSIONNAME
|
||||
set theLocalRoot to local root
|
||||
end tell
|
||||
--¥quit
|
||||
end tell
|
||||
set pathLength to {(get the length of (theLocalRoot as text)) as text}
|
||||
return (characters 1 thru {pathLength - 1} of (theLocalRoot as text))
|
||||
on error
|
||||
display dialog "Error : CVS Session path wrong, or doesn't have a local root. SCRIPT HALTED!"
|
||||
error number -128
|
||||
end try
|
||||
|
||||
end getLocalCVSRoot
|
||||
|
||||
on createLogDirectory(destFolder)
|
||||
|
||||
tell application "Finder"
|
||||
set FOLDERTIME to my GetTimeStamp()
|
||||
make new folder at folder (destFolder)
|
||||
set the name of the result to FOLDERTIME
|
||||
end tell
|
||||
|
||||
end createLogDirectory
|
||||
|
||||
on mozillaLives(filePath)
|
||||
|
||||
try
|
||||
tell application "Finder"
|
||||
set fileTest to file filePath
|
||||
set creatorType to get the creator type of fileTest
|
||||
set fileTest to application file filePath
|
||||
set partitionSize to get the partition size of fileTest
|
||||
if (creatorType is "????" and partitionSize > 0) then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end if
|
||||
end tell
|
||||
on error
|
||||
return true
|
||||
end try
|
||||
|
||||
end mozillaLives
|
||||
|
||||
on copyFile(srcPath, destFolder)
|
||||
|
||||
try
|
||||
tell application "Finder"
|
||||
copy file (srcPath as alias) to folder (destFolder as alias)
|
||||
-- set the name of the result to destName
|
||||
end tell
|
||||
on error msgErr
|
||||
logMessage("Error: Could not copy - " & srcPath & msgErr)
|
||||
end try
|
||||
|
||||
end copyFile
|
||||
|
||||
on getDriveName(path)
|
||||
|
||||
set going to true
|
||||
set i to 1
|
||||
|
||||
repeat while going is true
|
||||
set theChar to character i of path
|
||||
if theChar is ":" then
|
||||
set going to false
|
||||
end if
|
||||
set i to i + 1
|
||||
end repeat
|
||||
set driveName to (characters 1 thru {i - 1} of path)
|
||||
return driveName as string
|
||||
|
||||
end getDriveName
|
||||
|
||||
on trashItem(filePath)
|
||||
|
||||
try
|
||||
tell application "Finder"
|
||||
select item (filePath as string)
|
||||
delete selection
|
||||
empty trash
|
||||
end tell
|
||||
on error
|
||||
logMessage("Error : Couldn't delete the old binary.")
|
||||
PageAdmin("Couldn't nuke old binary!")
|
||||
display dialog "Couldn't nuke old binary: SCRIPT HALTED"
|
||||
error number -128
|
||||
end try
|
||||
|
||||
end trashItem
|
||||
|
||||
on run
|
||||
|
||||
-- if we are executing first time, skip time delay check
|
||||
set firstRun to true
|
||||
|
||||
--¥repeat
|
||||
|
||||
-- if we're cycling around, make sure we don't cycle faster than 10 minutes
|
||||
if firstRun is false then
|
||||
if endTime - startTime is less than 600 then
|
||||
repeat while endTime - startTime is less than 600
|
||||
set endTime to current date
|
||||
end repeat
|
||||
end if
|
||||
end if
|
||||
|
||||
set firstRun to false
|
||||
|
||||
set startTime to current date
|
||||
|
||||
-- 2 hour timeout
|
||||
with timeout of 7200 seconds
|
||||
|
||||
set PPCPROJECTFAILED to false
|
||||
|
||||
-- read config file and create log directories
|
||||
Initialize()
|
||||
|
||||
notifyTinderBoxStart()
|
||||
|
||||
if (CLOBBERBUILD) then
|
||||
removeOldTree()
|
||||
else
|
||||
removeOldDist() --¥
|
||||
end if
|
||||
|
||||
(*
|
||||
else
|
||||
trashItem("")
|
||||
end
|
||||
*)
|
||||
|
||||
try
|
||||
checkOutTree(CVSSESSIONFILE)
|
||||
on error
|
||||
PageAdmin("Can't check out tree!")
|
||||
end try
|
||||
|
||||
if PPCPROJECTFAILED is false then
|
||||
set SOURCEPATH to getLocalCVSRoot(CVSSESSIONFILE)
|
||||
set SOURCEPATH to SOURCEPATH as string
|
||||
|
||||
ProcessList(SOURCEPATH & BUILDLIST)
|
||||
|
||||
tell application "CodeWarrior IDE 3.2"
|
||||
quit
|
||||
end tell
|
||||
|
||||
tell application "MacCVS Pro 2.1b2r1 PPC"
|
||||
quit
|
||||
end tell
|
||||
|
||||
tell application "ToolServer"
|
||||
quit
|
||||
end tell
|
||||
|
||||
end if
|
||||
|
||||
-- set builddrive to getDriveName(SOURCEPATH)
|
||||
|
||||
copyFile(SOURCEPATH & ":Mozilla.BuildLog", STARTUPDISK & ":" & FOLDERTIME & ":")
|
||||
set PPCPROJECTFAILED to mozillaLives(SOURCEPATH & BINARYPATH)
|
||||
|
||||
CloseLogFile()
|
||||
|
||||
try
|
||||
notifyTinderBox(PPCPROJECTFAILED)
|
||||
on error
|
||||
PageAdmin("Couldn't send Tinderbox completion message!")
|
||||
end try
|
||||
|
||||
tell application "Finder"
|
||||
select folder FOLDERTIME of startup disk
|
||||
delete selection
|
||||
--¥empty trash
|
||||
restart --¥
|
||||
end tell
|
||||
|
||||
end timeout
|
||||
|
||||
set endTime to current date
|
||||
|
||||
--¥end repeat
|
||||
|
||||
end run
|
||||
40
mozilla/build/mac/TinderboxMozilla.pl
Normal file
40
mozilla/build/mac/TinderboxMozilla.pl
Normal file
@@ -0,0 +1,40 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
use Moz;
|
||||
use BuildList;
|
||||
|
||||
$DEBUG = 1;
|
||||
|
||||
# One of them should be 1. This will come from a config file at some stage.
|
||||
# In the meanwhile, it should match mozilla/config/mac/MacConfig.h
|
||||
$MOZ_LITE = 0;
|
||||
$MOZ_MEDIUM = 1;
|
||||
$MOZ_DARK = 0;
|
||||
|
||||
Moz::OpenErrorLog("::::Mozilla.BuildLog");
|
||||
#Moz::StopForErrors();
|
||||
|
||||
chdir("::::");
|
||||
|
||||
# Make and popuplate the dist directory
|
||||
DistMozilla();
|
||||
|
||||
# Now build the projects
|
||||
BuildMozilla();
|
||||
86
mozilla/build/mac/TinderboxNGLayout.pl
Normal file
86
mozilla/build/mac/TinderboxNGLayout.pl
Normal file
@@ -0,0 +1,86 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# nglayout build script (debug)
|
||||
#
|
||||
use NGLayoutBuildList;
|
||||
use Cwd;
|
||||
use Moz;
|
||||
|
||||
|
||||
# configuration variables
|
||||
|
||||
$DEBUG = 1;
|
||||
$ALIAS_SYM_FILES = 0;
|
||||
$CLOBBER_LIBS = 0;
|
||||
$MOZ_FULLCIRCLE = 0;
|
||||
|
||||
$pull{all} = 0;
|
||||
$pull{lizard} = 0;
|
||||
$pull{xpcom} = 0;
|
||||
$pull{imglib} = 0;
|
||||
$pull{netlib} = 0;
|
||||
$pull{nglayout} = 0;
|
||||
$pull{mac} = 0;
|
||||
|
||||
$build{all} = 0;
|
||||
$build{dist} = 0;
|
||||
$build{stubs} = 0;
|
||||
$build{common} = 0;
|
||||
$build{nglayout} = 0;
|
||||
$build{resources} = 0;
|
||||
$build{editor} = 0;
|
||||
$build{viewer} = 0;
|
||||
$build{xpapp} = 0;
|
||||
|
||||
|
||||
# script
|
||||
|
||||
$pull{all} = 1;
|
||||
$build{all} = 1;
|
||||
|
||||
if ($pull{all})
|
||||
{
|
||||
foreach $k (keys(%pull))
|
||||
{
|
||||
$pull{$k} = 1;
|
||||
}
|
||||
}
|
||||
if ($build{all})
|
||||
{
|
||||
foreach $k (keys(%build))
|
||||
{
|
||||
$build{$k} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# do the work
|
||||
|
||||
OpenErrorLog("::::Mozilla.BuildLog"); # Tinderbox requires that name
|
||||
|
||||
chdir("::::");
|
||||
|
||||
Checkout();
|
||||
|
||||
BuildDist();
|
||||
|
||||
BuildProjects();
|
||||
|
||||
print "Build NGLayout complete\n";
|
||||
BIN
mozilla/build/mac/client.mac/Client.Mac READ ME
Normal file
BIN
mozilla/build/mac/client.mac/Client.Mac READ ME
Normal file
Binary file not shown.
BIN
mozilla/build/mac/client.mac/Client.Mac-Config
Normal file
BIN
mozilla/build/mac/client.mac/Client.Mac-Config
Normal file
Binary file not shown.
BIN
mozilla/build/mac/client.mac/client.mac
Normal file
BIN
mozilla/build/mac/client.mac/client.mac
Normal file
Binary file not shown.
26
mozilla/caps/Makefile.in
Normal file
26
mozilla/caps/Makefile.in
Normal file
@@ -0,0 +1,26 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public include src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
20
mozilla/caps/include/MANIFEST
Normal file
20
mozilla/caps/include/MANIFEST
Normal file
@@ -0,0 +1,20 @@
|
||||
nsZig.h
|
||||
nsPrincipal.h
|
||||
nsPrivilege.h
|
||||
nsPrivilegeManager.h
|
||||
nsPrivilegeTable.h
|
||||
nsSystemPrivilegeTable.h
|
||||
nsTarget.h
|
||||
nsUserTarget.h
|
||||
jpermission.h
|
||||
nsUserDialogHelper.h
|
||||
nsZip.h
|
||||
nsLoadZig.h
|
||||
admin.h
|
||||
nsCaps.h
|
||||
nsCapsEnums.h
|
||||
nsCCapsManager.h
|
||||
nsCCapsManagerFactory.h
|
||||
nsCCertPrincipal.h
|
||||
nsCCodebasePrincipal.h
|
||||
nsCCodeSourcePrincipal.h
|
||||
34
mozilla/caps/include/Makefile.in
Normal file
34
mozilla/caps/include/Makefile.in
Normal file
@@ -0,0 +1,34 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
MODULE = caps
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
EXPORTS = nsZip.h nsZig.h nsLoadZig.h nsPrincipal.h nsPrivilege.h nsPrivilegeManager.h nsPrivilegeTable.h nsSystemPrivilegeTable.h nsTarget.h nsUserTarget.h jpermission.h nsUserDialogHelper.h admin.h nsCaps.h nsCapsEnums.h nsCCapsManagerFactory.h nsCCapsManager.h \
|
||||
nsCCertPrincipal.h \
|
||||
nsCCodebasePrincipal.h \
|
||||
nsCCodeSourcePrincipal.h
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user