Compare commits

..

64 Commits

Author SHA1 Message Date
scullin
c515100b8e Preparing to land.
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@2404 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-27 21:58:34 +00:00
scullin
fe0f4d855f Landing modular netlib on Window.
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@2236 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-23 01:38:10 +00:00
rpotts
3d4019f9c4 Allow POSTing to work...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1810 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-18 07:17:46 +00:00
hardts
9d96048a4b disable plugins
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1775 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 20:29:49 +00:00
rpotts
ae5d3bac86 Refactored streams to support the new nsIBaseStream and nsIOutputStream interfaces...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1724 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:38:22 +00:00
rpotts
dd5a8c0dfa Added support for calling nsIProtocolConnection before NET_GetURL(...) is called... Added a status argument to OnStopBinding(...)
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1723 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:37:40 +00:00
rpotts
a5f43d2a13 Added status code to OnStopBinding(...) and provided the buffer offset argument for the nsIOutputStream interface...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1722 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:36:23 +00:00
rpotts
897d60bb73 Added support for files of type xpFileToPost...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1721 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:35:15 +00:00
rpotts
fd1359cac8 Added a status code argument to OnStopBinding(...)
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1720 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:34:39 +00:00
rpotts
aa88ba7591 nsURLImpl now aggregates the nsHttpUrl object (for http urls). This makes the IPostToServer and IHttpUrl interfaces available...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1719 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:33:33 +00:00
rpotts
0c9f6e6d80 Added new exports and nsHttpUrl.cpp
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1718 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:28:41 +00:00
rpotts
f635646933 Protocol helper object for HTTP URLs...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1717 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:27:23 +00:00
rpotts
74a41b1364 interface which allows a URL protocol helper object to modify the underlying Netlib URL_Struct before NET_GetURL(...) is called
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1716 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:25:47 +00:00
rpotts
dddf36e52d Public interface exposing HTTP specific functionality available from http URLs
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1715 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:24:09 +00:00
rpotts
42f1218f94 Public interface for sending data to a server
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1714 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-15 09:23:23 +00:00
rpotts
9369584965 Started to wire in OnProgress(...) notifications. Added support for canceling network connections by clising the InputStream...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1391 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-11 20:29:42 +00:00
rpotts
644d7cd9c7 starting to wire in OnProgress(...) notifications...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1390 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-11 20:23:48 +00:00
rpotts
cac7b720c3 Added length argument to nsIStreamListener::OnDataAvailable(...). file: and resource: protocols are now processed by libnet
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1222 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-07 06:51:15 +00:00
rpotts
371d44de72 export the new nsIStreamListener interface not nsIStreamNotification...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1197 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-06 23:06:36 +00:00
rpotts
d5840939c7 renamed the nsIStreamNotification interface to nsIStreamListener
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1195 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-06 22:16:02 +00:00
rpotts
2a50f93567 Added support for async URL opening...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1190 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-06 21:19:07 +00:00
rpotts
d2a75afae6 Fixed up reference counting on the nsConnectionInfo...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1050 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-02 00:03:44 +00:00
hardts
8f2a603835 NET_GetRegConverterList and NET_GetDataObject protos don't match actual implementation, XP_List vs. PLList
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@1036 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-01 22:46:46 +00:00
rpotts
d9babead55 export the nsIURL.h header...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@991 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-01 05:34:43 +00:00
rpotts
daa26a48be fixes for nsURL being part of netlib...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@978 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-01 04:50:43 +00:00
rpotts
be77d90b49 The nsIURL object is now provided and used by netlib...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@977 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-01 04:48:33 +00:00
rpotts
e2793376a7 these files were moved from mozilla/base/src
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@976 18797224-902f-48f8-a5cc-f745e15eee43
1998-05-01 04:46:44 +00:00
rpotts
6d54e5f6e3 added SECNAV stubs that were removed, but were still necessary...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@861 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 19:21:12 +00:00
scullin
b0db9a4acd strcasecomp -> PL_strcasecmp
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@860 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 19:03:53 +00:00
scullin
a7a9a03946 Fix missing symbol
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@859 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 19:00:45 +00:00
scullin
5340ef2b1b Fix build bustage.
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@824 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 01:34:47 +00:00
scullin
1043bb4cc9 Fix build problems.
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@823 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 01:31:05 +00:00
scullin
9cb908ce37 Fix merge conflicts
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@817 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 00:55:25 +00:00
hardts
93cf7025ed some functions have been moved to mkutils.c
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@816 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 00:48:40 +00:00
hardts
42b35681a2 bug fixes for doubly linked list
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@815 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 00:47:25 +00:00
ltabb
bd2471c41c scullin wackage
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@792 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-28 21:38:07 +00:00
ltabb
3231691800 scullins broken changes
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@783 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-28 19:16:17 +00:00
ltabb
2bdd74e814 scullins changes
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@781 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-28 19:01:13 +00:00
ltabb
97b4b7a6d1 wills changes
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@779 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-28 18:38:44 +00:00
ltabb
55369bada1 scullins changes
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@777 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-28 18:18:08 +00:00
(no author)
82ed1f72bb This commit was manufactured by cvs2svn to create branch
'MODULAR_NETLIB_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@753 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-28 07:53:29 +00:00
scullin
52d02fe072 Linux build fixes.
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@553 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-23 19:00:38 +00:00
scullin
11e91b2751 IRIX build fixes
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@469 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-21 20:08:55 +00:00
scullin
9c6ac35617 Removed NSPR20 ifdefs
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@467 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-21 18:28:21 +00:00
rpotts
50054acba1 fixed data corruption bug...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@316 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-15 22:18:08 +00:00
rpotts
79a4c9490b Added doc++ to the public interfaces...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@297 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-15 07:59:11 +00:00
scullin
c181b6d7f9 IRIX build fixes.
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@224 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-14 01:58:11 +00:00
scullin
a5e5b98ad8 IRIX build fixes
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@223 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-14 01:55:01 +00:00
kipp
f453d81444 build lib during libs phase
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@166 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-13 20:25:17 +00:00
rpotts
05cb725cfb clean up... I cannot sign these files because they are on a branch *only*
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@155 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-11 07:00:23 +00:00
scullin
46d5611628 Don't need xp_str.c or xp_list.c anymore.
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@146 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-10 18:55:39 +00:00
scullin
d9a5e647f5 NET_SA* and NET_BA* files come home to roost, along with some other
odd functions I just couldn't bring myself to try to put in nspr.


git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@145 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-10 18:55:15 +00:00
scullin
6c07a2ca66 Whacked xp_bool, xp_str functions, xp_list and some other xp stuff.
Added some stuff that should migrate to nspr here for now.


git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@144 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-10 18:47:19 +00:00
rpotts
3c5574eb6e never read more data than was requested!
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@143 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-10 07:00:43 +00:00
rpotts
fee6fe5171 changed user agent to Mozilla/5.0
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@142 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-10 06:58:45 +00:00
rpotts
46e818474a treat a stream abort the same as a stream closing...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@141 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-10 06:55:17 +00:00
rpotts
ac3fe4623e return a data length of 0 (not -1) when EOF is hit...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@133 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-09 05:43:18 +00:00
rpotts
e5430a78e1 close the input stream if the URL exit proc is called (due to a URL loading error) instead of the streams complete function...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@132 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-09 05:41:45 +00:00
rpotts
e8ecd3ec68 Moving standalone netlib work from /m/src to pub.
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@119 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-09 00:25:02 +00:00
rpotts
86e542aa90 Moving standalone netlib work from /m/src into pub
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@116 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 23:56:48 +00:00
rpotts
35f45baaed Moving standalone netlib work from /m/src to pub...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@112 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 23:07:04 +00:00
rpotts
e72757dc16 removed CRs
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@111 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 21:47:25 +00:00
rpotts
f7ac2222ef Moving standalone netlib work from /m/src to the pub tree...
git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@110 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 21:42:24 +00:00
(no author)
4099eb2ef3 This commit was manufactured by cvs2svn to create branch
'MODULAR_NETLIB_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/MODULAR_NETLIB_BRANCH@95 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 04:38:33 +00:00
300 changed files with 145008 additions and 9122 deletions

View File

@@ -1,80 +0,0 @@
#!perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Simon Fraser <sfraser@netscape.com>
#
require 5.004;
use strict;
use Cwd;
use Moz::BuildUtils;
use Moz::BuildCore;
#-------------------------------------------------------------
# Where have the build options gone?
#
# The various build flags have been centralized into one place.
# The master list of options is in MozBuildFlags.txt. However,
# you should never need to edit that file, or this one.
#
# To customize what gets built, or where to start the build,
# edit the $prefs_file_name file in
# System Folder:Preferences:Mozilla build prefs:
# Documentation is provided in that file.
#-------------------------------------------------------------
my($prefs_file_name) = "Mozilla opt build prefs";
my($config_header_file_name) = ":mozilla:config:mac:DefinesOptions.h";
#-------------------------------------------------------------
# hashes to hold build options
#-------------------------------------------------------------
my(%build);
my(%options);
my(%filepaths);
my(%optiondefines);
# Hash of input files for this build. Eventually, there will be
# input files for manifests, and projects too.
my(%inputfiles) = (
"buildflags", "MozillaBuildFlags.txt",
"checkoutdata", "MozillaCheckoutList.txt",
"buildprogress", "¥ Mozilla opt progress",
"buildmodule", "MozillaBuildList.pm",
"checkouttime", "Mozilla last checkout"
);
#-------------------------------------------------------------
# end build hashes
#-------------------------------------------------------------
# set the build root directory, which is the the dir above mozilla
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
# Set up all the flags on $main::, like DEBUG, CARBON etc.
# Override the defaults using the preferences files.
SetupDefaultBuildOptions(0, ":mozilla:dist:viewer:", $config_header_file_name);
my($do_checkout) = 0;
my($do_build) = 1;
RunBuild($do_checkout, $do_build, \%inputfiles, $prefs_file_name);

View File

@@ -1,80 +0,0 @@
#!perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Simon Fraser <sfraser@netscape.com>
#
require 5.004;
use strict;
use Cwd;
use Moz::BuildUtils;
use Moz::BuildCore;
#-------------------------------------------------------------
# Where have the build options gone?
#
# The various build flags have been centralized into one place.
# The master list of options is in MozBuildFlags.txt. However,
# you should never need to edit that file, or this one.
#
# To customize what gets built, or where to start the build,
# edit the $prefs_file_name file in
# System Folder:Preferences:Mozilla build prefs:
# Documentation is provided in that file.
#-------------------------------------------------------------
my($prefs_file_name) = "Mozilla debug build prefs";
my($config_header_file_name) = ":mozilla:config:mac:DefinesOptionsDebug.h";
#-------------------------------------------------------------
# hashes to hold build options
#-------------------------------------------------------------
my(%build);
my(%options);
my(%filepaths);
my(%optiondefines);
# Hash of input files for this build. Eventually, there will be
# input files for manifests, and projects too.
my(%inputfiles) = (
"buildflags", "MozillaBuildFlags.txt",
"checkoutdata", "MozillaCheckoutList.txt",
"buildprogress", "¥ Mozilla debug progress",
"buildmodule", "MozillaBuildList.pm",
"checkouttime", "Mozilla last checkout"
);
#-------------------------------------------------------------
# end build hashes
#-------------------------------------------------------------
# set the build root directory, which is the the dir above mozilla
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
# Set up all the flags on $main::, like DEBUG, CARBON etc.
# Override the defaults using the preferences files.
SetupDefaultBuildOptions(1, ":mozilla:dist:viewer_debug:", $config_header_file_name);
my($do_pull) = 0; # overridden by flags and prefs
my($do_build) = 1;
RunBuild($do_pull, $do_build, \%inputfiles, $prefs_file_name);

View File

@@ -1,595 +0,0 @@
#!perl -w
package Moz::BuildCore;
require 5.004;
require Exporter;
use strict;
use vars qw( @ISA @EXPORT );
# perl includes
use Cwd;
use POSIX;
use Time::Local;
use File::Basename;
use LWP::Simple;
# homegrown
use Moz::Moz;
use Moz::Jar;
use Moz::BuildFlags;
use Moz::BuildUtils;
use Moz::CodeWarriorLib;
# use MozillaBuildList; # eventually, this should go away, and be replaced by data input
@ISA = qw(Exporter);
@EXPORT = qw(
RunBuild
);
#//--------------------------------------------------------------------------------------------------
#// DoPrebuildCheck
#//
#// Check the build tools etc before running the build.
#//--------------------------------------------------------------------------------------------------
sub DoPrebuildCheck()
{
SanityCheckBuildOptions();
# launch codewarrior and persist its location. Have to call this before first
# call to getCodeWarriorPath().
my($ide_path_file) = $main::filepaths{"idepath"};
$ide_path_file = full_path_to($ide_path_file);
LaunchCodeWarrior($ide_path_file);
}
#//--------------------------------------------------------------------------------------------------
#// SanityCheckBuildOptions
#//--------------------------------------------------------------------------------------------------
sub SanityCheckBuildOptions()
{
my($bad_options) = 0;
# Jar options
if (!$main::options{chrome_jars} && !$main::options{chrome_files})
{
print "Warning: Both \$options{chrome_jars} and \$options{chrome_files} are off. You won't get any chrome.\n";
$bad_options = 1;
}
if (!$main::options{chrome_jars} && $main::options{use_jars})
{
print "Warning: \$options{chrome_jars} is off but \$options{use_jars} is on. Your build won't run (expects jars, got files).\n";
$bad_options = 1;
}
if (!$main::options{chrome_files} && !$main::options{use_jars})
{
print "Warning: \$options{chrome_jars} is off but \$options{chrome_files} is on. Your build won't run (expects files, got jars).\n";
$bad_options = 1;
}
if ($main::options{ldap_experimental} && !$main::options{ldap})
{
print "Warning: \$options{ldap_experimental} is on but \$options{ldap} is off. LDAP experimental features will not be built.\n";
$bad_options = 1;
}
if ($main::options{wsp} && !$main::options{xmlextras})
{
print "Warning: \$options{wsp} is on but \$options{xmlextras} is off. wsp will not be built.\n";
$bad_options = 1;
}
if ($bad_options) {
print "Build will start in 5 seconds. Press command-. to stop\n";
DelayFor(5);
}
}
#//--------------------------------------------------------------------------------------------------
#// GenBuildSystemInfo
#//--------------------------------------------------------------------------------------------------
sub GenBuildSystemInfo()
{
# always rebuild the configuration program.
BuildProjectClean(":mozilla:build:mac:tools:BuildSystemInfo:BuildSystemInfo.mcp", "BuildSystemInfo");
# delete the configuration file.
unlink(":mozilla:build:mac:BuildSystemInfo.pm");
# run the program.
system(":mozilla:build:mac:BuildSystemInfo");
# wait for the file to be created.
while (!(-e ":mozilla:build:mac:BuildSystemInfo.pm")) { WaitNextEvent(); }
# wait for BuildSystemInfo to finish, so that we see correct results.
while (IsProcessRunning("BuildSystemInfo")) { WaitNextEvent(); }
# now, evaluate the contents of the file.
open(F, ":mozilla:build:mac:BuildSystemInfo.pm");
while (<F>) { eval; }
close(F);
}
#//--------------------------------------------------------------------------------------------------
#// Make library aliases
#//--------------------------------------------------------------------------------------------------
sub MakeLibAliases()
{
my($dist_dir) = GetBinDirectory();
#// ProfilerLib
if ($main::PROFILE)
{
my($profilerlibpath) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:Profiler:Profiler Common:ProfilerLib");
MakeAlias("$profilerlibpath", "$dist_dir"."Essential Files:");
}
}
#//--------------------------------------------------------------------------------------------------
#// ConfigureBuildSystem
#//
#// defines some build-system configuration variables.
#//--------------------------------------------------------------------------------------------------
sub ConfigureBuildSystem()
{
#// In the future, we may want to do configurations based on the actual build system itself.
#// GenBuildSystemInfo();
#// For now, if we discover a newer header file than existed in Universal Interfaces 3.2,
#// we'll assume that 3.3 or later is in use.
my($universal_interfaces) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:Universal:Interfaces:CIncludes:");
if (-e ($universal_interfaces . "ControlDefinitions.h")) {
$main::UNIVERSAL_INTERFACES_VERSION = 0x0330;
}
#// Rename IC SDK folder in the Mac OS Support folder
my($ic_sdk_folder) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:ICProgKit2.0.2");
if( -e $ic_sdk_folder)
{
my($new_ic_folder_name) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:(ICProgKit2.0.2)");
rename ($ic_sdk_folder, $new_ic_folder_name);
# note that CodeWarrior doesn't descend into folders with () the name
print "Mozilla no longer needs the Internet Config SDK to build:\n Renaming the 'ICProgKit2.0.2' folder to '(ICProgKit2.0.2)'\n";
}
printf("UNIVERSAL_INTERFACES_VERSION = 0x%04X\n", $main::UNIVERSAL_INTERFACES_VERSION);
# alias required CodeWarrior libs into the Essential Files folder (only the Profiler lib now)
MakeLibAliases();
}
#//--------------------------------------------------------------------------------------------------
#// CheckOutModule. Takes variable number of args; first two are required
#//--------------------------------------------------------------------------------------------------
sub CheckOutModule($$$$)
{
my($session, $module, $revision, $date) = @_;
my($result) = $session->checkout($module, $revision, $date);
# result of 1 is success
if ($result) { return; }
my($checkout_err) = $session->getLastError();
if ($checkout_err == 708) {
die "Error: Checkout was cancelled.\n";
} elsif ($checkout_err == 911) {
die "Error: CVS session settings are incorrect. Check your password, and the CVS root settings.\n";
} elsif ($checkout_err == 703) {
die "Error: CVS checkout failed. Unknown module, unknown tag, bad username, or other CVS error.\n";
} elsif ($checkout_err == 711) {
print "Checkout of '$module' failed.\n";
}
}
#//--------------------------------------------------------------------------------------------------
#// getScriptFolder
#//--------------------------------------------------------------------------------------------------
sub getScriptFolder()
{
return dirname($0);
}
#//--------------------------------------------------------------------------------------------------
#// getScriptFolder
#//--------------------------------------------------------------------------------------------------
sub get_url_contents($)
{
my($url) = @_;
my($url_contents) = LWP::Simple::get($url);
$url_contents =~ s/\r\n/\n/g; # normalize linebreaks
$url_contents =~ s/\r/\n/g; # normalize linebreaks
return $url_contents;
}
#//--------------------------------------------------------------------------------------------------
#// get_files_from_content
#//--------------------------------------------------------------------------------------------------
sub uniq
{
my $lastval;
grep(($_ ne $lastval, $lastval = $_)[$[], @_);
}
#//--------------------------------------------------------------------------------------------------
#// get_files_from_content
#//--------------------------------------------------------------------------------------------------
sub get_files_from_content($)
{
my($content) = @_;
my(@jscalls) = grep (/return js_file_menu[^{]*/, split(/\n/, $content));
my $i;
for ($i = 0; $i < @jscalls ; $i++)
{
$jscalls[$i] =~ s/.*\(|\).*//g;
my(@callparams) = split(/,/, $jscalls[$i]);
my ($repos, $dir, $file, $rev) = grep(s/['\s]//g, @callparams);
$jscalls[$i] = "$dir/$file";
}
&uniq(sort(@jscalls));
}
#//--------------------------------------------------------------------------------------------------
#// getLastUpdateTime
#//
#// Get the last time we updated. Return 0 on failure
#//--------------------------------------------------------------------------------------------------
sub getLastUpdateTime($)
{
my($timestamp_file) = @_;
my($time_string);
local(*TIMESTAMP_FILE);
unless (open(TIMESTAMP_FILE, "< $timestamp_file")) { return 0; }
while (<TIMESTAMP_FILE>)
{
my($line) = $_;
chomp($line);
# ignore comments and empty lines
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
next;
}
$time_string = $line;
}
# get the epoch seconds
my($last_update_secs) = $time_string;
$last_update_secs =~ s/\s#.+$//;
print "FAST_UPDATE found that you last updated at ".localtime($last_update_secs)."\n";
# how long ago was this, in hours?
my($gm_now) = time();
my($update_hours) = 1 + ceil(($gm_now - $last_update_secs) / (60 * 60));
return $update_hours;
}
#//--------------------------------------------------------------------------------------------------
#// saveCheckoutTimestamp
#//
#// Create a file on disk containing the current time. Param is time(), which is an Epoch seconds
#// (and therefore in GMT).
#//
#//--------------------------------------------------------------------------------------------------
sub saveCheckoutTimestamp($$)
{
my($gm_secs, $timestamp_file) = @_;
local(*TIMESTAMP_FILE);
open(TIMESTAMP_FILE, ">$timestamp_file") || die "Failed to open $timestamp_file\n";
print(TIMESTAMP_FILE "# time of last checkout or update, in GMT. Used by FAST_UPDATE\n");
print(TIMESTAMP_FILE "$gm_secs \# around ".localtime()." local time\n");
close(TIMESTAMP_FILE);
}
#//--------------------------------------------------------------------------------------------------
#// FastUpdate
#//
#// Use Bonsai url data to update only those dirs which have new files
#//
#//--------------------------------------------------------------------------------------------------
sub FastUpdate($$)
{
my($modules, $timestamp_file) = @_; # list of modules to check out
my($num_hours) = getLastUpdateTime($timestamp_file);
if ($num_hours == 0 || $num_hours > 170) {
print "Can't fast_update; last update was too long ago, or never. Doing normal checkout.\n";
return 0;
}
print "Doing fast update, pulling files changed in the last $num_hours hours\n";
my($cvsfile) = AskAndPersistFile($main::filepaths{"sessionpath"});
my($session) = Moz::MacCVS->new( $cvsfile );
unless (defined($session)) { die "Error: Checkout aborted. Cannot create session file: $session" }
# activate MacCVS
ActivateApplication('Mcvs');
my($checkout_start_time) = time();
#print "Time now is $checkout_start_time ($checkout_start_time + 0)\n";
my($this_co);
foreach $this_co (@$modules)
{
my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]);
# assume that things pulled by date wont change
if ($date ne "") {
print "$module is pulled by date, so ignoring in FastUpdate.\n";
next;
}
my($search_type) = "hours";
my($min_date) = "";
my($max_date) = "";
my($url) = "http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=${module}&branch=${revision}&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=${num_hours}&date=${search_type}&mindate=${min_date}&maxdate=${max_date}&cvsroot=%2Fcvsroot";
if ($revision eq "") {
print "Getting list of checkins to $module from Bonsai...\n";
} else {
print "Getting list of checkins to $module on branch $revision from Bonsai...\n";
}
my(@files) = &get_files_from_content(&get_url_contents($url));
if ($#files > 0)
{
my(@cvs_co_list);
my($co_file);
foreach $co_file (@files)
{
print "Updating $co_file\n";
push(@cvs_co_list, $co_file);
}
my($result) = $session->update($revision, \@cvs_co_list);
# result of 1 is success
if (!$result) { die "Error: Fast update failed\n"; }
} else {
print "No files in this module changed\n";
}
}
saveCheckoutTimestamp($checkout_start_time, $timestamp_file);
return 1;
}
#//--------------------------------------------------------------------------------------------------
#// Checkout
#//--------------------------------------------------------------------------------------------------
sub CheckoutModules($$$)
{
my($modules, $pull_date, $timestamp_file) = @_; # list of modules to check out
my($start_time) = TimeStart();
# assertRightDirectory();
my($cvsfile) = AskAndPersistFile($main::filepaths{"sessionpath"});
my($session) = Moz::MacCVS->new( $cvsfile );
unless (defined($session)) { die "Error: Checkout aborted. Cannot create session file: $session" }
my($checkout_start_time) = time();
# activate MacCVS
ActivateApplication('Mcvs');
my($this_co);
foreach $this_co (@$modules)
{
my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]);
if ($date eq "") {
$date = $pull_date;
}
CheckOutModule($session, $module, $revision, $date);
# print "Checking out $module with ref $revision, date $date\n";
}
saveCheckoutTimestamp($checkout_start_time, $timestamp_file);
TimeEnd($start_time, "Checkout");
}
#//--------------------------------------------------------------------------------------------------
#// ReadCheckoutModulesFile
#//--------------------------------------------------------------------------------------------------
sub ReadCheckoutModulesFile($$)
{
my($modules_file, $co_list) = @_;
my($checkout_file) = getScriptFolder().":".$modules_file;
local(*CHECKOUT_FILE);
open(CHECKOUT_FILE, "< $checkout_file") || die "Error: failed to open checkout list $checkout_file\n";
while (<CHECKOUT_FILE>)
{
my($line) = $_;
chomp($line);
# ignore comments and empty lines
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
next;
}
my(@cvs_co) = ["", "", ""];
my($module, $revision, $date) = (0, 1, 2);
if ($line =~ /\s*([^#,\s]+)\s*\,\s*([^#,\s]+)\s*\,\s*([^#]+)/)
{
@cvs_co[$module] = $1;
@cvs_co[$revision] = $2;
@cvs_co[$date] = $3;
}
elsif ($line =~ /\s*([^#,\s]+)\s*\,\s*([^#,\s]+)\s*(#.+)?/)
{
@cvs_co[$module] = $1;
@cvs_co[$revision] = $2;
}
elsif ($line =~ /\s*([^#,\s]+)\s*\,\s*,\s*([^#,]+)/)
{
@cvs_co[$module] = $1;
@cvs_co[$date] = $2;
}
elsif ($line =~ /\s*([^#,\s]+)/)
{
@cvs_co[$module] = $1;
}
else
{
die "Error: unrecognized line '$line' in $modules_file\n";
}
# strip surrounding space from date
@cvs_co[$date] =~ s/^\s*|\s*$//g;
# print "Going to check out '@cvs_co[$module]', '@cvs_co[$revision]', '@cvs_co[$date]'\n";
push(@$co_list, \@cvs_co);
}
close(CHECKOUT_FILE);
}
#//--------------------------------------------------------------------------------------------------
#// PullFromCVS
#//--------------------------------------------------------------------------------------------------
sub PullFromCVS($$)
{
unless ( $main::build{pull} ) { return; }
my($modules_file, $timestamp_file) = @_;
StartBuildModule("pull");
my(@cvs_co_list);
ReadCheckoutModulesFile($modules_file, \@cvs_co_list);
if ($main::FAST_UPDATE && $main::options{pull_by_date})
{
die "Error: you can't use FAST_UPDATE if you are pulling by date.\n";
}
my($did_fast_update) = $main::FAST_UPDATE && FastUpdate(\@cvs_co_list, $timestamp_file);
if (!$did_fast_update)
{
my($pull_date) = "";
if ($main::options{pull_by_date})
{
# acceptable CVS date formats are (in local time):
# ISO8601 (e.g. "1972-09-24 20:05") and Internet (e.g. "24 Sep 1972 20:05").
# Perl's localtime() string format also seems to work.
$pull_date = localtime().""; # force string interp.
print "Pulling by date $pull_date\n";
}
CheckoutModules(\@cvs_co_list, $pull_date, $timestamp_file);
}
EndBuildModule("pull");
}
#//--------------------------------------------------------------------------------------------------
#// RunBuild
#//--------------------------------------------------------------------------------------------------
sub RunBuild($$$$)
{
my($do_pull, $do_build, $input_files, $build_prefs) = @_;
InitBuildProgress($input_files->{"buildprogress"});
# if we are pulling, we probably want to do a full build, so clear the build progress
if ($do_pull) {
ClearBuildProgress();
}
# read local prefs, and the build progress file, and set flags to say what to build
SetupBuildParams(\%main::build,
\%main::options,
\%main::optiondefines,
\%main::filepaths,
$input_files->{"buildflags"},
$build_prefs);
# If we were told to pull, make sure we do, overriding prefs etc.
if ($do_pull)
{
$main::build{"pull"} = 1;
}
# transfer this flag
$CodeWarriorLib::CLOSE_PROJECTS_FIRST = $main::CLOSE_PROJECTS_FIRST;
# setup the build log
SetupBuildLog($main::filepaths{"buildlogfilepath"}, $main::USE_TIMESTAMPED_LOGS);
StopForErrors();
if ($main::LOG_TO_FILE) {
RedirectOutputToFile($main::filepaths{"scriptlogfilepath"});
}
# run a pre-build check to see that the tools etc are in order
DoPrebuildCheck();
# do the pull
PullFromCVS($input_files->{"checkoutdata"}, $input_files->{"checkouttime"});
unless ($do_build) { return; }
my($build_start) = TimeStart();
# check the build environment
ConfigureBuildSystem();
# here we load and call methods in the build module indirectly.
# we have to use indirection because the build module can be named
# differently for different builds.
chdir(dirname($0)); # change to the script dir
my($build_module) = $input_files->{"buildmodule"};
# load the build module
require $build_module;
{ # scope for no strict 'refs'
no strict 'refs';
my($package_name) = $build_module;
$package_name =~ s/\.pm$//;
chdir($main::MOZ_SRC);
&{$package_name."::BuildDist"}();
chdir($main::MOZ_SRC);
&{$package_name."::BuildProjects"}();
}
# the build finished, so clear the build progress state
ClearBuildProgress();
TimeEnd($build_start, "Build");
print "Build complete\n";
}
1;

View File

@@ -1,425 +0,0 @@
#!perl -w
package Moz::BuildFlags;
require 5.004;
require Exporter;
# Package that attempts to read a file from the Preferences folder,
# and get build settings out of it
use strict;
use Exporter;
use Cwd;
use File::Basename;
use Moz::Moz;
use Moz::Prefs;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(
SetupBuildParams
InitBuildProgress
WriteBuildProgress
ClearBuildProgress
ReadBuildProgress
);
my(@build_flags);
my(@options_flags);
my(@filepath_flags);
my(%arrays_list) = (
"build_flags", \@build_flags,
"options_flags", \@options_flags,
"filepath_flags", \@filepath_flags
);
my($progress_file) = "¥ÊBuild progress";
#-------------------------------------------------------------------------------
# appendArrayFlag
#
# Set a flag in the array
#-------------------------------------------------------------------------------
sub appendArrayFlag(@)
{
my($array_name) = shift;
my($setting) = shift;
my($value) = shift;
my(@optional_values);
foreach (@_) {
push(@optional_values, $_);
}
my(@this_flag) = [$setting, $value, @optional_values];
my($flags_array) = $arrays_list{$array_name};
if ($flags_array)
{
push(@{$flags_array}, @this_flag) || die "Failed to append\n";
}
else
{
die "Error: unknown build flags array $array_name\n";
}
}
#-------------------------------------------------------------------------------
# readFlagsFile
#
# Read the file of build flags from disk. File path is relative to the
# script directory.
#-------------------------------------------------------------------------------
sub readFlagsFile($)
{
my($flags_file) = @_;
my($file_path) = $0;
$file_path =~ s/[^:]+$/$flags_file/;
print "Reading build flags from '$file_path'\n";
local(*FLAGS_FILE);
open(FLAGS_FILE, "< $file_path") || die "Error: failed to open flags file $file_path\n";
my($cur_array) = "";
while(<FLAGS_FILE>)
{
my($line) = $_;
chomp($line);
# ignore comments and empty lines
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
next;
}
# 1-word line, probably array name
if ($line =~ /^([^#\s]+)\s*$/)
{
$cur_array = $1;
next;
}
elsif ($line =~ /^([^#\s]+)\s+\"(.+)\"(\s+#.+)?$/) # quoted option, possible comment
{
my($flag) = $1;
my($setting) = $2;
appendArrayFlag($cur_array, $flag, $setting);
}
elsif ($line =~ /^([^#\s]+)((\s+[^#\s]+)+)(\s+#.+)?$/) # multiple word line, possible comment
{
my($flag) = $1;
appendArrayFlag($cur_array, $flag, split(' ', $2));
}
else
{
die "Error: unknown build flag at '$line'\n";
}
}
close(FLAGS_FILE);
}
#-------------------------------------------------------------------------------
# flagsArrayToHash
#
# Utility routine to migrate flag from a 2D array to a hash, where
# item[n][0] is the hash entry name, and item[n][1] is the hash entry value.
#-------------------------------------------------------------------------------
sub flagsArrayToHash($$)
{
my($src_array, $dest_hash) = @_;
my($item);
foreach $item (@$src_array)
{
$dest_hash->{$item->[0]} = $item->[1];
}
}
#-----------------------------------------------
# printHash
#
# Utility routine to print a hash
#-----------------------------------------------
sub printHash($)
{
my($hash_ref) = @_;
print "Printing hash:\n";
my($key, $value);
while (($key, $value) = each (%$hash_ref))
{
print " $key $value\n";
}
}
#-----------------------------------------------
# printBuildArray
#
# Utility routine to print a 2D array
#-----------------------------------------------
sub printBuildArray($)
{
my($build_array) = @_;
my($entry);
foreach $entry (@$build_array)
{
print "$entry->[0] = $entry->[1]\n";
}
}
#-------------------------------------------------------------------------------
# SetBuildFlags
#-------------------------------------------------------------------------------
sub SetBuildFlags($)
{
my($build) = @_;
flagsArrayToHash(\@build_flags, $build);
}
#-------------------------------------------------------------------------------
# SetBuildOptions
#-------------------------------------------------------------------------------
sub SetBuildOptions($)
{
my($options) = @_;
flagsArrayToHash(\@options_flags, $options);
}
#-------------------------------------------------------------------------------
# SetFilepathFlags
#-------------------------------------------------------------------------------
sub SetFilepathFlags($)
{
my($filepath) = @_;
flagsArrayToHash(\@filepath_flags, $filepath);
}
#-------------------------------------------------------------------------------
# SetOptionDefines
#-------------------------------------------------------------------------------
sub SetOptionDefines($)
{
my($optiondefines) = @_;
foreach my $entry (@options_flags)
{
if (defined($entry->[2])) {
$optiondefines->{$entry->[0]}{$entry->[2]} = 1;
}
}
}
#-------------------------------------------------------------------------------
# PropagateAllFlags
#-------------------------------------------------------------------------------
sub PropagateAllFlags($)
{
my($build_array) = @_;
# if "all" is set, set all the flags to 1
unless ($build_array->[0][0] eq "all") { die "Error: 'all' must come first in the flags array\n"; }
if ($build_array->[0][1] == 1)
{
my($index);
foreach $index (@$build_array)
{
$index->[1] = 1;
}
}
}
#//--------------------------------------------------------------------------------------------------
#// _getBuildProgressFile
#//--------------------------------------------------------------------------------------------------
sub _getBuildProgressFile()
{
return $progress_file;
}
#//--------------------------------------------------------------------------------------------------
#// setBuildProgressStart
#//
#// This automagically sets $build{"all"} to 0
#//--------------------------------------------------------------------------------------------------
sub setBuildProgressStart($$)
{
my($build_array, $name) = @_;
my($index);
foreach $index (@$build_array)
{
$index->[1] = 0;
if ($index->[0] eq $name) {
last;
}
}
print "Building from module after $name, as specified by build progress\n";
}
#//--------------------------------------------------------------------------------------------------
#// InitBuildProgress
#//--------------------------------------------------------------------------------------------------
sub InitBuildProgress($)
{
my($prog_file) = @_;
if ($prog_file ne "") {
$progress_file = full_path_to($prog_file);
print "Writing build progress to $progress_file\n";
}
}
#//--------------------------------------------------------------------------------------------------
#// WriteBuildProgress
#//--------------------------------------------------------------------------------------------------
sub WriteBuildProgress($)
{
my($module_built) = @_;
my($progress_file) = _getBuildProgressFile();
if ($progress_file ne "")
{
open(PROGRESS_FILE, ">>$progress_file") || die "Failed to open $progress_file\n";
print(PROGRESS_FILE "$module_built\n");
close(PROGRESS_FILE);
}
}
#//--------------------------------------------------------------------------------------------------
#// ClearBuildProgress
#//--------------------------------------------------------------------------------------------------
sub ClearBuildProgress()
{
my($progress_file) = _getBuildProgressFile();
if ($progress_file ne "") {
unlink $progress_file;
}
}
#//--------------------------------------------------------------------------------------------------
#// WipeBuildProgress
#//--------------------------------------------------------------------------------------------------
sub WipeBuildProgress()
{
print "Ignoring build progress\n";
ClearBuildProgress();
$progress_file = "";
}
#//--------------------------------------------------------------------------------------------------
#// ReadBuildProgress
#//--------------------------------------------------------------------------------------------------
sub ReadBuildProgress($)
{
my($build_array) = @_;
my($progress_file) = _getBuildProgressFile();
my($last_module);
if (open(PROGRESS_FILE, "< $progress_file"))
{
print "Getting build progress from $progress_file\n";
while (<PROGRESS_FILE>)
{
my($line) = $_;
chomp($line);
$last_module = $line;
}
close(PROGRESS_FILE);
}
if ($last_module)
{
setBuildProgressStart($build_array, $last_module);
}
}
#-------------------------------------------------------------------------------
# clearOldBuildSettings
#-------------------------------------------------------------------------------
sub clearOldBuildSettings($$$$)
{
my($build, $options, $optiondefines, $filepaths) = @_;
# empty the arrays in case we're being called twice
@build_flags = ();
@options_flags = ();
@filepath_flags = ();
# and empty the hashes
%$build = ();
%$options = ();
%$optiondefines = ();
%$filepaths = ();
}
#-------------------------------------------------------------------------------
# SetupBuildParams
#-------------------------------------------------------------------------------
sub SetupBuildParams($$$$$$)
{
my($build, $options, $optiondefines, $filepaths, $flags_file, $prefs_file) = @_;
# Empty the hashes and arrays, to wipe out any stale data.
# Needed because these structures persist across two build scripts
# called using 'do' from a parent script.
clearOldBuildSettings($build, $options, $optiondefines, $filepaths);
# Read from the flags file, which sets up the various arrays
readFlagsFile($flags_file);
# If 'all' is set in the build array, propagate that to all entries
PropagateAllFlags(\@build_flags);
# read the user pref file, that can change values in the array
ReadMozUserPrefs($prefs_file, \@build_flags, \@options_flags, \@filepath_flags);
# If build progress exists, this clears flags in the array up to a certain point
if ($main::USE_BUILD_PROGRESS) {
ReadBuildProgress(\@build_flags);
} else {
WipeBuildProgress();
}
# printBuildArray(\@build_flags);
# printBuildArray(\@options_flags);
SetBuildFlags($build);
SetBuildOptions($options);
SetOptionDefines($optiondefines);
SetFilepathFlags($filepaths);
# printHash($build);
# printHash($options);
}
1;

View File

@@ -1,786 +0,0 @@
package Moz::BuildUtils;
require 5.004;
require Exporter;
# Package that contains build util functions specific to the Mozilla build
# process.
use strict;
use Exporter;
use Cwd;
use File::Path;
use File::Basename;
use Mac::Events;
use Mac::StandardFile;
use Moz::Moz;
use Moz::BuildFlags;
use Moz::MacCVS;
#use Moz::ProjectXML; #optional; required for static build only
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(
SetupDefaultBuildOptions
SetupBuildRootDir
StartBuildModule
EndBuildModule
GetBinDirectory
BuildOneProjectWithOutput
BuildOneProject
BuildProject
BuildProjectClean
BuildIDLProject
BuildFolderResourceAliases
AskAndPersistFile
DelayFor
TimeStart
TimeEnd
EmptyTree
SetupBuildLog
SetBuildNumber
SetTimeBomb
UpdateConfigHeader
);
#//--------------------------------------------------------------------------------------------------
#// SetupDefaultBuildOptions
#//--------------------------------------------------------------------------------------------------
sub SetupDefaultBuildOptions($$$)
{
my($debug, $bin_dir, $config_header_file_name) = @_;
# Here we set up defaults for the various build flags.
# If you want to override any of these, it's best to do
# so via the relevant preferences file, which lives in
# System Folder:Preferences:Mozilla build prefs:{build prefs file}.
# For the name of the prefs file, see the .pl script that you
# run to start this build. The prefs files are created when
# you run the build, and contain some documentation.
#-------------------------------------------------------------
# configuration variables that globally affect what is built
#-------------------------------------------------------------
$main::DEBUG = $debug;
$main::PROFILE = 0;
$main::RUNTIME = 0; # turn on to just build runtime support and NSPR projects
$main::GC_LEAK_DETECTOR = 0; # turn on to use GC leak detection
$main::MOZILLA_OFFICIAL = 0; # generate build number
$main::LOG_TO_FILE = 0; # write perl output to a file
#-------------------------------------------------------------
# configuration variables that affect the manner of building,
# but possibly affecting the outcome.
#-------------------------------------------------------------
$main::ALIAS_SYM_FILES = $main::DEBUG;
$main::CLOBBER_LIBS = 1; # turn on to clobber existing libs and .xSYM files before
# building each project
# The following two options will delete all dist files (if you have $main::build{dist} turned on),
# but leave the directory structure intact.
$main::CLOBBER_DIST_ALL = 1; # turn on to clobber all aliases/files inside dist (headers/xsym/libs)
$main::CLOBBER_DIST_LIBS = 0; # turn on to clobber only aliases/files for libraries/sym files in dist
$main::CLOBBER_IDL_PROJECTS = 0; # turn on to clobber all IDL projects.
$main::CLOBBER_PROJECTS = 0; # turn on to remove object code from each project before building it
$main::UNIVERSAL_INTERFACES_VERSION = 0x0320;
#-------------------------------------------------------------
# configuration variables that are preferences for the build,
# style and do not affect what is built.
#-------------------------------------------------------------
$main::CLOSE_PROJECTS_FIRST = 0;
# 1 = close then make (for development),
# 0 = make then close (for tinderbox).
$main::USE_TIMESTAMPED_LOGS = 0;
$main::USE_BUILD_PROGRESS = 1; # track build progress for restartable builds
#-------------------------------------------------------------
# END OF CONFIG SWITCHES
#-------------------------------------------------------------
$main::BIN_DIRECTORY = $bin_dir;
$main::DEFINESOPTIONS_FILE = $config_header_file_name;
}
#//--------------------------------------------------------------------------------------------------
#// SetupBuildRootDir
#//--------------------------------------------------------------------------------------------------
sub SetupBuildRootDir($)
{
my($rel_path_to_script) = @_;
my($cur_dir) = cwd();
$cur_dir =~ s/$rel_path_to_script$//;
chdir($cur_dir) || die "Error: failed to set build root directory to '$cur_dir'.\nYou probably need to put 'mozilla' one level down (in a folder).\n";
$main::MOZ_SRC = cwd();
}
#//--------------------------------------------------------------------------------------------------
#// StartBuildModule
#//--------------------------------------------------------------------------------------------------
sub StartBuildModule($)
{
my($module) = @_;
print("---- Start of $module ----\n");
}
#//--------------------------------------------------------------------------------------------------
#// EndBuildModule
#//--------------------------------------------------------------------------------------------------
sub EndBuildModule($)
{
my($module) = @_;
WriteBuildProgress($module);
print("---- End of $module ----\n");
}
#--------------------------------------------------------------------------------------------------
# GetBinDirectory
#--------------------------------------------------------------------------------------------------
sub GetBinDirectory()
{
if ($main::BIN_DIRECTORY eq "") { die "Dist directory not set\n"; }
return $main::BIN_DIRECTORY;
}
#--------------------------------------------------------------------------------------------------
# AskAndPersistFile stores the information about the user pick inside
# the file $session_storage
#--------------------------------------------------------------------------------------------------
sub AskAndPersistFile($)
{
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))
{
# make sure that MacPerl is a front process
ActivateApplication('McPL');
MacPerl::Answer("Could not find your MacCVS session file. Please choose one", "OK");
# 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 $sessionStorage for saving $cvsfile\n";
}
}
}
return $cvsfile;
}
#--------------------------------------------------------------------------------------------------
# BuildIDLProject
#
#--------------------------------------------------------------------------------------------------
sub BuildIDLProject($$)
{
my ($project_path, $module_name) = @_;
if ($main::CLOBBER_IDL_PROJECTS)
{
my (@suffix_list) = (".mcp", ".xml");
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
if ($suffix eq "") { die "Error: Project, $project_path must end in .xml or .mcp\n"; }
my($datafolder_path);
if ($suffix eq ".xml")
{
$datafolder_path = $project_dir . "_" . $project_name . " Data:";
}
else {
$datafolder_path = $project_dir . $project_name . " Data:";
}
print STDERR "Deleting IDL data folder: $datafolder_path\n";
EmptyTree($datafolder_path);
}
BuildOneProject($project_path, "headers", 0, 0, 0);
BuildOneProject($project_path, $module_name.".xpt", 1, 0, 1);
}
#--------------------------------------------------------------------------------------------------
# CreateStaticLibTargets
#
#--------------------------------------------------------------------------------------------------
sub CreateXMLStaticLibTargets($)
{
my($xml_path) = @_;
my (@suffix_list) = (".xml");
my ($project_name, $project_dir, $suffix) = fileparse($xml_path, @suffix_list);
if ($suffix eq "") { die "XML munging: $xml_path must end in .xml\n"; }
#sniff the file to see if we need to fix up broken Pro5-exported XML
print "Parsing $xml_path\n";
my $ide_version = Moz::ProjectXML::SniffProjectXMLIDEVersion($xml_path);
if ($ide_version eq "4.0")
{
my $new_file = $project_dir.$project_name."2.xml";
print "Cleaning up Pro 5 xml to $new_file\n";
Moz::ProjectXML::CleanupPro5XML($xml_path, $new_file);
unlink $xml_path;
rename ($new_file, $xml_path);
}
my $doc = Moz::ProjectXML::ParseXMLDocument($xml_path);
my @target_list = Moz::ProjectXML::GetTargetsList($doc);
my $target;
my %target_hash; # for easy lookups below
foreach $target (@target_list) { $target_hash{$target} = 1; }
foreach $target (@target_list)
{
if ($target =~ /(.+).shlb$/) # if this is a shared lib target
{
my $target_base = $1;
my $static_target = $target_base.".o";
# ensure that this does not exist already
if ($target_hash{$static_target}) {
print "Static target $static_target already exists in project. Not making\n";
next;
}
print "Making static target '$static_target' from target '$target'\n";
Moz::ProjectXML::CloneTarget($doc, $target, $static_target);
Moz::ProjectXML::SetAsStaticLibraryTarget($doc, $static_target, $static_target);
}
}
print "Writing XML file to $xml_path\n";
my $temp_path = $project_dir."_".$project_name.".xml";
Moz::ProjectXML::WriteXMLDocument($doc, $temp_path, $ide_version);
Moz::ProjectXML::DisposeXMLDocument($doc);
if (-e $temp_path)
{
unlink $xml_path;
rename ($temp_path, $xml_path);
}
else
{
die "Error: Failed to add new targets to XML project\n";
}
}
#//--------------------------------------------------------------------------------------------------
#// ProcessProjectXML
#//
#// Helper routine to allow for XML pre-processing. This should read in the XML, process it,
#// and replace the original file with the processed version.
#//--------------------------------------------------------------------------------------------------
sub ProcessProjectXML($)
{
my($xml_path) = @_;
# we need to manually load Moz::ProjectXML, becaues not everyone will have the
# required perl modules in their distro.
my($cur_dir) = cwd();
chdir(dirname($0)); # change to the script dir
eval "require Moz::ProjectXML";
if ($@) { die "Error: could not do Project XML munging because you do not have the correct XML modules installed. Error is:\n################\n $@################"; }
chdir($cur_dir);
CreateXMLStaticLibTargets($xml_path);
}
#//--------------------------------------------------------------------------------------------------
#// Build one project, and make the alias. Parameters are project path, target name, shared library
#// name, make shlb alias (boolean), make xSYM alias (boolean), and is component (boolean).
#//--------------------------------------------------------------------------------------------------
sub BuildOneProjectWithOutput($$$$$$)
{
my ($project_path, $target_name, $output_name, $alias_lib, $alias_xSYM, $component) = @_;
unless ($project_path =~ m/^$main::BUILD_ROOT.+/) { return; }
my (@suffix_list) = (".mcp", ".xml");
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
if ($suffix eq "") { die "Error: Project, $project_path must end in .xml or .mcp\n"; }
my($dist_dir) = GetBinDirectory();
# Put libraries in "Essential Files" folder, Components in "Components" folder
my($output_dir) = $component ? "Components:" : "Essential Files:";
my($output_path) = $dist_dir.$output_dir;
if ($main::options{static_build})
{
if ($output_name =~ /\.o$/ || $output_name =~ /\.[Ll]ib$/)
{
$alias_xSYM = 0;
$alias_lib = 1;
$output_path = $main::DEBUG ? ":mozilla:dist:static_libs_debug:" : ":mozilla:dist:static_libs:";
}
}
# if the flag is on to export projects to XML, export and munge them
if ($main::EXPORT_PROJECTS && !($project_path =~ /IDL\.mcp$/))
{
my $xml_out_path = $project_path;
$xml_out_path =~ s/\.mcp$/\.xml/;
# only do this if project is newer?
if (! -e $xml_out_path)
{
ExportProjectToXML(full_path_to($project_path), full_path_to($xml_out_path));
ProcessProjectXML($xml_out_path);
}
}
# if the flag is set to use XML projects, default to XML if the file
# is present.
if ($main::USE_XML_PROJECTS && !($project_path =~ /IDL\.mcp$/))
{
my $xml_project_path = $project_dir.$project_name.".xml";
if (-e $xml_project_path)
{
$project_path = $xml_project_path;
$suffix = ".xml";
}
}
if ($suffix eq ".xml")
{
my($xml_path) = $project_path;
# Prepend an "_" onto the name of the generated project file so it doesn't conflict
$project_path = $project_dir . "_" . $project_name . ".mcp";
my($project_modtime) = (-e $project_path ? GetFileModDate($project_path) : 0);
my($xml_modtime) = (-e $xml_path ? GetFileModDate($xml_path) : 0);
if ($xml_modtime > $project_modtime)
{
print("Importing $project_path from $project_name.xml.\n");
unlink($project_path);
# Might want to delete the "xxx.mcp Data" dir ???
ImportXMLProject(full_path_to($xml_path), full_path_to($project_path));
}
}
if ($main::CLOBBER_LIBS)
{
unlink "$project_dir$output_name"; # it's OK if these fail
unlink "$project_dir$output_name.xSYM";
}
DoBuildProject($project_path, $target_name, $main::CLOBBER_PROJECTS);
$alias_lib ? MakeAlias("$project_dir$output_name", "$output_path") : 0;
$alias_xSYM ? MakeAlias("$project_dir$output_name.xSYM", "$output_path") : 0;
}
#//--------------------------------------------------------------------------------------------------
#// For compatiblity with existing scripts, BuildOneProject now just calls
#// BuildOneProjectWithOutput, with the output name and target name identical.
#// Note that this routine assumes that the target name and the shared libary name
#// are the same.
#//--------------------------------------------------------------------------------------------------
sub BuildOneProject($$$$$)
{
my ($project_path, $target_name, $alias_lib, $alias_xSYM, $component) = @_;
BuildOneProjectWithOutput($project_path, $target_name, $target_name,
$alias_lib, $alias_xSYM, $component);
}
#//--------------------------------------------------------------------------------------------------
#// For compatiblity with existing scripts, BuildProject now just calls
#// BuildOneProjectWithOutput, with the output name and target name identical.
#// Note that this routine assumes that the target name and the shared libary name
#// are the same. No aliases of the output are made.
#//--------------------------------------------------------------------------------------------------
sub BuildProject($$)
{
my ($project_path, $target_name) = @_;
BuildOneProjectWithOutput($project_path, $target_name, $target_name, 0, 0, 0);
}
#//--------------------------------------------------------------------------------------------------
#// Identical to BuildProject but clobbers the project before building it.
#//--------------------------------------------------------------------------------------------------
sub BuildProjectClean($$)
{
my ($project_path, $target_name) = @_;
my ($save_clobber_flag) = $main::CLOBBER_PROJECTS;
$main::CLOBBER_PROJECTS = 1;
BuildOneProjectWithOutput($project_path, $target_name, $target_name, 0, 0, 0);
$main::CLOBBER_PROJECTS = $save_clobber_flag;
}
#//--------------------------------------------------------------------------------------------------
#// 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
print("Placing aliases to all files from $src_dir in $dest_dir\n");
for ( @resource_files )
{
next if $_ eq "CVS";
#print(" Doing $_\n");
if (-l $src_dir.$_)
{
print(" $_ is an alias\n");
next;
}
my($file_name) = $src_dir . $_;
MakeAlias($file_name, $dest_dir);
}
}
#//--------------------------------------------------------------------------------------------------
#// DelayFor
#//
#// Delay for the given number of seconds, allowing the script to be cancelled
#//--------------------------------------------------------------------------------------------------
sub DelayFor($)
{
my($delay_secs) = @_;
STDOUT->autoflush(1);
my($end_time) = time() + $delay_secs;
my($last_time) = 0;
my($cur_time) = time();
while ($cur_time < $end_time)
{
$cur_time = time();
if ($cur_time > $last_time)
{
print ".";
$last_time = $cur_time;
}
WaitNextEvent();
}
print "\n";
STDOUT->autoflush(0);
}
#//--------------------------------------------------------------------------------------------------
#// TimeStart
#//--------------------------------------------------------------------------------------------------
sub TimeStart()
{
return time();
}
#//--------------------------------------------------------------------------------------------------
#// TimeEnd
#//--------------------------------------------------------------------------------------------------
sub TimeEnd($$)
{
use integer;
my($start_time, $operation_name) = @_;
my($end_time) = time();
my($tot_sec) = $end_time - $start_time;
my($seconds) = $tot_sec;
my($hours) = $seconds / (60 * 60);
$seconds -= $hours * (60 * 60);
my($minutes) = $seconds / 60;
$seconds -= $minutes * 60;
print "$operation_name took $hours hours $minutes minutes and $seconds seconds\n";
}
#//--------------------------------------------------------------------------------------------------
#// Remove all files from a tree, leaving directories intact (except "CVS").
#//--------------------------------------------------------------------------------------------------
sub EmptyTree($)
{
my ($root) = @_;
#print "EmptyTree($root)\n";
opendir(DIR, $root);
my $sub;
foreach $sub (readdir(DIR))
{
my $fullpathname = $root.$sub; # -f, -d only work on full paths
# Don't call empty tree for the alias of a directory.
# -d returns true for the alias of a directory, false for a broken alias)
if (-d $fullpathname)
{
if (-l $fullpathname) # delete aliases
{
unlink $fullpathname;
next;
}
EmptyTree($fullpathname.":");
if ($sub eq "CVS")
{
#print "rmdir $fullpathname\n";
rmdir $fullpathname;
}
}
else
{
unless (unlink $fullpathname) { die "Failed to delete $fullpathname\n"; }
}
}
closedir(DIR);
}
#//--------------------------------------------------------------------------------------------------
#// Recurse through a directory hierarchy, looking for MANIFEST files.
#// Currently unused.
#//--------------------------------------------------------------------------------------------------
sub ScanForManifestFiles($$$$)
{
my($dir, $theme_root, $theme_name, $dist_dir) = @_;
opendir(DIR, $dir) or die "Cannot open dir $dir\n";
my @files = readdir(DIR);
closedir DIR;
my $file;
foreach $file (@files)
{
my $filepath = $dir.":".$file;
if (-d $filepath)
{
# print "Looking for MANIFEST files in $filepath\n";
ScanForManifestFiles($filepath, $theme_root, $theme_name, $dist_dir);
}
elsif ($file eq "MANIFEST")
{
# print "Doing manifest file $filepath\n";
# Get the dest path from the first line of the file
open(MANIFEST, $filepath) || die "Could not open file $file";
# Read in the path if available
my($dest_line) = <MANIFEST>;
chomp $dest_line;
close MANIFEST;
$dest_line =~ s|^#!dest[\t ]+|| || die "No destination line found in $filepath\n";
my($dest_path) = $dist_dir."chrome:skins:$theme_name:$dest_line";
# print " Destination is $dest_path\n";
InstallResources($filepath, "$dest_path", 0);
}
}
}
#-----------------------------------------------
# SetupBuildLog
#-----------------------------------------------
sub SetupBuildLog($$)
{
my($logfile_path, $timestamped_log) = @_;
my($logdir) = "";
my($logfile) = $logfile_path;
if ($logfile_path =~ /(.+?:)([^:]+)$/) # ? for non-greedy match
{
$logdir = $1;
$logfile = $2;
mkpath($logdir);
}
if ($timestamped_log)
{
#Use time-stamped names so that you don't clobber your previous log file!
my $now = localtime();
while ($now =~ s@:@.@) {} # replace all colons by periods
OpenErrorLog("${logdir}${now}");
}
else
{
OpenErrorLog("${logdir}${logfile}");
}
}
#-----------------------------------------------
# SetBuildNumber
#-----------------------------------------------
sub SetBuildNumber($$)
{
my($build_num_file, $files_to_touch) = @_;
# Make sure we add the config dir to search, to pick up mozBDate.pm
# Need to do this dynamically, because this module can be used before
# mozilla/config has been checked out.
my ($inc_path) = $0; # $0 is the path to the parent script
$inc_path =~ s/:build:mac:build_scripts:.+$/:config/;
push(@INC, $inc_path);
require mozBDate;
mozBDate::UpdateBuildNumber($build_num_file, $main::MOZILLA_OFFICIAL);
my($file);
foreach $file (@$files_to_touch)
{
print "Writing build number to $file from ${file}.in\n";
mozBDate::SubstituteBuildNumber($file, $build_num_file, "${file}.in");
}
}
#-----------------------------------------------
# SetTimeBomb
#-----------------------------------------------
sub SetTimeBomb($$)
{
my ($warn_days, $bomb_days) = @_;
system("perl :mozilla:config:mac-set-timebomb.pl $warn_days $bomb_days");
}
#//--------------------------------------------------------------------------------------------------
#// Regenerate a configuration header file if necessary
#//--------------------------------------------------------------------------------------------------
sub UpdateConfigHeader($)
{
my($config_path) = @_;
my($config, $oldconfig) = ("", "");
my($define, $definevalue, $defines);
my($k, $l,);
foreach $k (keys(%main::options))
{
if ($main::options{$k})
{
foreach $l (keys(%{$main::optiondefines{$k}}))
{
$my::defines{$l} = $main::optiondefines{$k}{$l};
print "Setting up my::defines{$l}\n";
}
}
}
my $config_headerfile = current_directory().$config_path;
if (-e $config_headerfile)
{
open(CONFIG_HEADER, "< $config_headerfile") || die "$config_headerfile: $!\n";
my($line);
while ($line = <CONFIG_HEADER>)
{
if ($line =~ m/#define\s+([^\s]*)\s+([^\s]*)\s*\n/)
{
$define = $1;
$definevalue = $2;
#canonicalize so that whitespace changes are not significant
my $canon_value = "#define " . $define . " " . $definevalue . "\n";
$oldconfig .= $canon_value;
if (exists ($my::defines{$define}) and ($my::defines{$define} == $definevalue))
{
delete $my::defines{$define};
$config .= $canon_value;
}
}
}
close(CONFIG_HEADER);
}
if (%my::defines)
{
foreach $k (keys(%my::defines))
{
$config .= "#define " . $k . " " . $my::defines{$k} . "\n";
}
}
my $file_name = basename($config_headerfile);
if (($config ne $oldconfig) || (!-e $config_headerfile))
{
printf("Writing new configuration header $file_name\n");
open(CONFIG_HEADER, "> $config_headerfile") || die "$config_headerfile: $!\n";
print(CONFIG_HEADER "/* This file is auto-generated based on build options. Do not edit. */\n");
print CONFIG_HEADER ($config);
close(CONFIG_HEADER);
MacPerl::SetFileInfo("CWIE", "TEXT", $config_headerfile);
}
else
{
printf("Configuration header $file_name is up-to-date\n");
}
}
1;

View File

@@ -1,660 +0,0 @@
#!perl
package Moz::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 Cwd;
use File::Basename;
use Mac::Types;
use Mac::Events;
use Mac::AppleEvents;
use Mac::AppleEvents::Simple;
use Mac::Processes;
use Mac::MoreFiles;
use Mac::StandardFile;
use vars qw($VERSION);
$VERSION = '1.02';
my($app) = 'CWIE';
my($scriptDir) = cwd(); # could use $0 for this
my($ide_loc_file) = "";
# 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;
# $Mac::AppleEvents::Simple::WARN = 1;
# supply your own path to the source here
#_test('PowerPudgeIV:mozilla:mozilla:');
# If you want to understand the gobbldeygook that's used to build Apple Events,
# you should start by reading the AEGizmos documentation.
=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 (lc $full_path eq lc _full_path($cp)) {
return($cp);
}
}
} else { # is only one, not a list
if (lc $full_path eq lc _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
$CodeWarriorLib::CLOSE_PROJECTS_FIRST = 0; # If true we close then make. If false, make then close.
my $last_project_built = "";
my $last_project_was_closed = 0;
sub build_project ($;$$$) {
my(
$full_path, $target_name, $error_path,
$remove_object, $p, $project_was_closed, $had_errors
) = @_;
_close_errors_window();
if ($CodeWarriorLib::CLOSE_PROJECTS_FIRST && ($last_project_built ne $full_path))
{
# If we're in "close first" mode, we don't close if the current project
# is the same as the previous one.
if ($last_project_was_closed) {
$p = _get_project($last_project_built);
_close($p);
}
$last_project_built = $full_path;
$last_project_was_closed = 0; # now refers to the new project
}
$project_was_closed = 0;
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;
$last_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 (!$CodeWarriorLib::CLOSE_PROJECTS_FIRST)
{
if ($project_was_closed) {
$p = _get_project($full_path);
_close($p);
}
}
return($had_errors);
}
=pod
=item appIsRunning()
=cut
sub _appIsRunning($)
{
my ($appSignature) = @_;
my ($psi);
my ($found) = 0;
my ($appPSN);
foreach $psi (values(%Process))
{
if ($psi->processSignature() eq $appSignature)
{
$appPSN = $psi->processNumber();
$found = 1;
last;
}
}
return $found;
}
=pod
=item appIsFrontmost()
=cut
sub _appIsFrontmost($)
{
my ($appSignature) = @_;
my ($psi);
my ($found) = 0;
my ($appPSN);
foreach $psi (values(%Process))
{
if ($psi->processSignature() eq $appSignature)
{
$appPSN = $psi->processNumber();
$found = 1;
last;
}
}
return (GetFrontProcess() == $appPSN);
}
=pod
=item activate()
Launches CodeWarrior and brings it to the front.
Once found, path will be saved in $idepath_file 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 ($) {
$ide_loc_file = $_[0]; # save in global
my($filepath, $appath, $psi) = ($ide_loc_file);
foreach $psi (values(%Process)) {
if ($psi->processSignature() eq $app) {
$appath = $psi->processAppSpec();
_save_appath($filepath, $appath);
last;
}
}
if (!$appath || !-x $appath) {
$appath = _read_appath($filepath);
}
if (!$appath || ! -x $appath)
{
# make sure that MacPerl is a front process
#ActivateApplication('McPL');
MacPerl::Answer("Please locate the CodeWarrior application.", "OK");
# prompt user for the file name, and store it
my $macFile = StandardGetFile( 0, "APPL");
if ( $macFile->sfGood() )
{
$appath = $macFile->sfFile();
}
else
{
die "Operation canceled\n";
}
# 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;
}
# wait for CodeWarrior to show up in the list of processes
while (!_appIsRunning('CWIE'))
{
WaitNextEvent();
}
# wait for CodeWarrior to come to the front
while (!_appIsFrontmost('CWIE'))
{
WaitNextEvent();
}
}
=pod
=item getCodeWarriorPath()
Returns a file path relative to the CodeWarrior folder
=cut
sub getCodeWarriorPath($)
{
my($subfolder)=@_;
my($app_path) = _read_appath($ide_loc_file);
if ($app_path eq "") { die "Error: Failed to get CodeWarrior IDE path\n"; }
my($codewarrior_root) = $app_path;
$codewarrior_root =~ s/[^:]*$//;
return ($codewarrior_root . $subfolder);
}
=pod
=item getCodeWarriorIDEName()
Returns the name of the CodeWarrior application
=cut
sub getCodeWarriorIDEName()
{
my($subfolder)=@_;
my($app_path) = _read_appath($ide_loc_file);
if ($app_path eq "") { die "Error: Failed to get CodeWarrior IDE path\n"; }
my(@codewarrior_path) = split(/:/, $app_path);
return pop(@codewarrior_path);
}
=pod
=item quit()
Quits CodeWarrior.
=cut
sub quit() {
$last_project_built = "";
$last_project_was_closed = 0;
my($evt) = do_event(qw/aevt quit/, $app);
}
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 import_project ($$) {
my($xml_file, $project_path) = @_;
my($prm) = "kocl:type(PRJD), rtyp:TEXT(@), data:TEXT(@), &subj:'null'()";
my($evt) = do_event(qw/core crel/, $app, $prm, $project_path, $xml_file);
my($result) = _get_event_result($evt);
if ($result eq "") {
_close(_get_project($project_path));
}
return $result;
}
sub export_project ($$) {
my($project_path, $xml_out_path) = @_;
my($p, $project_was_closed);
$project_was_closed = 0;
while (1) {
$p = _get_project($project_path);
if (!$p) {
if ($project_was_closed) {
print "### Error - request for project document failed after opening\n";
die "### possibly CW bug: be sure to close your Find window\n";
}
$project_was_closed = 1;
_open_file($project_path);
} else {
last;
}
}
# avoid problems with the Project Messages window
_close_named_window("Project Messages");
my($prm) =
q"'----':obj {form:indx, want:type(PRJD), " .
q"seld:1, from:'null'()}, kfil:TEXT(@)";
my($evt) = do_event(qw/CWIE EXPT/, $app, $prm, $xml_out_path);
if ($project_was_closed) {
$p = _get_project($project_path);
_close($p);
}
return _get_event_result($evt);
}
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 () {
return _close_named_window('Errors & Warnings');
}
sub _close_named_window ($) {
my($window_name) = @_;
my($prm) =
q"'----':obj {form:name, want:type(cwin), " .
q"seld:TEXT(@), from:'null'()}";
my($evt) = do_event(qw/core clos/, $app, $prm, $window_name);
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 _get_event_result ($)
{
my($evt) = @_;
my($result) = $evt->{ERROR};
if ( $result eq "" && $evt->{ERRNO} != 0 )
{
$result = "unknown error (".$evt->{ERRNO}.")";
}
return $result;
}
sub _save_appath ($$) {
my($cwd) = cwd(); # remember the current working dir
chdir($scriptDir); # change dir to the script dir
local(*F);
open(F, '>' . $_[0]) or die $!;
print F $_[1];
close(F);
chdir($cwd); # restore the cwd
}
sub _read_appath ($) {
my($filepath) = @_;
my($cwd) = cwd(); # remember the current working dir
chdir($scriptDir); # change dir to the script dir
if (! -e $filepath) {
return "";
}
local(*F);
open(F, $filepath);
my($appath) = <F>;
close(F);
chdir($cwd); # restore the cwd
return($appath);
}
sub _test ($) {
activate($ide_loc_file);
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.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s):
=cut

View File

@@ -1,573 +0,0 @@
#!perl -w
package Moz::Jar;
#
# Module for creating jar files, either using a jar manifest, or
# simply jarring up folders on disk.
#
require 5.004;
require Exporter;
use strict;
use Archive::Zip;
use File::Path;
use Mac::Files;
use Moz::Moz;
use vars qw( @ISA @EXPORT );
@ISA = qw(Exporter);
@EXPORT = qw(
CreateJarFileFromDirectory
CreateJarFromManifest
WriteOutJarFiles
SanityCheckJarOptions
);
#-------------------------------------------------------------------------------
# Add the contents of a directory to the zip file
#
#-------------------------------------------------------------------------------
sub _addDirToJar($$$$)
{
my($dir, $jar_root, $zip, $compress) = @_;
opendir(DIR, $dir) or die "Error: Cannot open dir $dir\n";
my @files = readdir(DIR);
closedir DIR;
my $unix_jar_root = $jar_root;
$unix_jar_root =~ s|:|/|g; # colon to slash conversion
my $file;
foreach $file (@files)
{
my $filepath = $dir.":".$file;
if (-d $filepath)
{
print "Adding files to jar from $filepath\n";
_addDirToJar($filepath, $jar_root, $zip, $compress);
}
else
{
my $member = Archive::Zip::Member->newFromFile($filepath);
die "Error: Failed to create zip file member $filepath\n" unless $member;
my $unixName = $filepath;
$unixName =~ s|:|/|g; # colon to slash conversion
$unixName =~ s|^$unix_jar_root||; # relativise
$member->fileName($unixName);
# print "Adding $file as $unixName\n";
if ($compress) {
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
} else {
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
}
$zip->addMember($member);
}
}
}
#-------------------------------------------------------------------------------
# Add the contents of a directory to the zip file
#
#-------------------------------------------------------------------------------
sub CreateJarFileFromDirectory($$$)
{
my($srcdir, $jarpath, $compress) = @_;
my $zip = Archive::Zip->new();
_addDirToJar($srcdir, $srcdir, $zip, $compress);
print "Saving zip file...\n";
my $status = $zip->writeToFileNamed($jarpath);
if ($status == 0) {
print "Zipping completed successfully\n";
} else {
print "Error saving zip file\n";
}
# set the file type/creator to something reasonable
MacPerl::SetFileInfo("ZIP ", "ZIP ", $jarpath);
}
#-------------------------------------------------------------------------------
# printZipContents
#
#-------------------------------------------------------------------------------
sub printZipContents($)
{
my($zip) = @_;
my(@members) = $zip->memberNames();
print "Zip contains:\n";
my($member);
foreach $member (@members)
{
print " $member\n";
}
}
#-------------------------------------------------------------------------------
# safeSaveJarFile
#
# Archive::Zip has a problem where you cannot save a zip file on top of
# an existing zip file that it has open, because it holds references
# into that zip. So we have to save to a temp file, then do a swap.
#
# Note that the zip will become invalid after this operation.
# If you want to do further operations on it, you'll have to reread it.
#-------------------------------------------------------------------------------
sub safeSaveJarFile($$)
{
my($zip, $full_dest_path) = @_;
my($temp_file_name) = $full_dest_path."_temp";
($zip->writeToFileNamed($temp_file_name) == Archive::Zip::AZ_OK) || die "Error: died writing jar to temp file $temp_file_name\n";
unlink $full_dest_path;
(rename $temp_file_name, $full_dest_path) || die "Error: Failed to rename $temp_file_name\n";
MacPerl::SetFileInfo("ZIP ", "ZIP ", $full_dest_path);
}
#-------------------------------------------------------------------------------
# addToJarFile
#
# Add a file to a jar file
#
# Parameters:
# 1. Jar ID. Unix path of jar file inside chrome.
# 2. Abs path to jar.mn file (i.e. source) (mac breaks)
# 3. File source, relative to jar.mn path (mac breaks)
# 4. Abs path to the resulting .jar file (mac breaks)
# 5. Relative file path within the jar (unix breaks)
# 6. Reference to hash of jar files
#
#-------------------------------------------------------------------------------
sub addToJarFile($$$$$$$)
{
my($jar_id, $jar_man_dir, $file_src, $jar_path, $file_jar_path, $override, $jars) = @_;
# print "addToJarFile with:\n $jar_man_dir\n $file_src\n $jar_path\n $file_jar_path\n";
unless ($jar_path =~ m/(.+:)([^:]+)$/) { die "Error: Bad jar path $jar_path\n"; }
my($target_dir) = $1;
my($jar_name) = $2;
$target_dir =~ s/[^:]+$//;
# print "¥ $target_dir $jar_name\n";
# find the source file
my($src) = $jar_man_dir.":".$file_src;
if ((!-e $src) && ($file_src =~ m/.+:([^:]+)$/)) # src does not exist. Fall back to looking for src in jar.mn dir
{
$file_src = $1;
$src = $jar_man_dir.":".$file_src;
if (!-e $src) {
die "Error: Can't find chrome file $src\n";
}
}
if ($main::options{chrome_jars})
{
my($zip) = $jars->{$jar_id};
unless ($zip) { die "Error: Can't find Zip entry for $jar_id\n"; }
# print "Adding $file_src to jar file $jar_path at $file_jar_path\n";
my($member) = Archive::Zip::Member->newFromFile($src);
unless ($member) { die "Error: Failed to create zip file member $src\n"; }
$member->fileName($file_jar_path);
my($compress) = 1;
if ($compress) {
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
$member->desiredCompressionLevel(Archive::Zip::COMPRESSION_LEVEL_DEFAULT); # defaults to 6
} else {
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
}
my($old_member) = $zip->memberNamed($file_jar_path);
if ($override)
{
if ($old_member)
{
# print "Overriding $file_jar_path in jar file $jar_id\n";
# need to compare mod dates or use the + here
$zip->removeMember($old_member);
}
$zip->addMember($member);
}
else
{
if ($old_member)
{
#compare dates here
my($member_moddate) = $old_member->lastModTime();
my($file_moddate) = GetFileModDate($src);
if ($file_moddate > $member_moddate)
{
print "Updating older file $file_jar_path in $jar_id\n";
$zip->removeMember($old_member);
$zip->addMember($member);
}
else
{
print "File $file_jar_path in $jar_id is more recent. Not updating.\n";
}
}
else
{
$zip->addMember($member);
}
}
}
if ($main::options{chrome_files}) # we install raw files too
{
my($rel_path) = $file_jar_path;
$rel_path =~ s|/|:|g; # slash to colons
my($dir_name) = $jar_name;
$dir_name =~ s/\.jar$//;
my($dst) = $target_dir.$dir_name.":".$rel_path;
# print "Aliassing $src\n to\n$dst\n";
if ($override)
{
unlink $dst;
MakeAlias($src, $dst); # don't check errors, otherwise we fail on replacement
}
else
{
if (-e $dst)
{
#compare dates here
my($dst_moddate) = GetFileModDate($dst);
my($file_moddate) = GetFileModDate($src);
if ($file_moddate > $dst_moddate)
{
print "Updating older file $rel_path in $dir_name\n";
unlink $dst;
MakeAlias($src, $dst);
}
else
{
print "File $file_jar_path in $jar_id is more recent. Not updating.\n";
}
}
else
{
MakeAlias($src, $dst);
}
}
}
}
#-------------------------------------------------------------------------------
# setupJarFile
#
# setup a zip for writing
#-------------------------------------------------------------------------------
sub setupJarFile($$$)
{
my($jar_id, $dest_path, $jar_hash) = @_;
# print "Creating jar file $jar_id at $jar_path\n";
my($jar_file) = $jar_id;
$jar_file =~ s|/|:|g; # slash to colons
my($full_jar_path) = full_path_to($dest_path.":".$jar_file);
if ($main::options{chrome_jars})
{
my($zip) = $jar_hash->{$jar_id};
if (!$zip) # if we haven't made it already, do so
{
my($zip) = Archive::Zip->new();
$jar_hash->{$jar_id} = $zip;
# does the jar file exist already? If so, read it in
if (-e $full_jar_path)
{
print "Reading in jar file $jar_id\n";
if ($zip->read($full_jar_path) != Archive::Zip::AZ_OK) { die "Error: Failed to re-read $full_jar_path\n"; }
# printZipContents($zip);
}
}
}
else
{
# installing files.
# nothing to do. MakeAlias creates dirs as needed.
# add this jar to the list
$jar_hash->{$jar_id} = 1;
}
}
#-------------------------------------------------------------------------------
# closeJarFile
#
# We're done with this jar file _for this jar.mn_. We may add more entries
# to it later, so keep it open in the hash.
#-------------------------------------------------------------------------------
sub closeJarFile($$)
{
my($jar_path, $jar_hash) = @_;
# print "Closing jar file $jar_path\n";
if ($main::options{chrome_jars})
{
}
else
{
# installing files.
# nothing to do
}
}
#-------------------------------------------------------------------------------
# WriteOutJarFiles
#
# Now we dump out the jars
#-------------------------------------------------------------------------------
sub WriteOutJarFiles($$)
{
my($chrome_dir, $jars) = @_;
unless ($main::options{chrome_jars}) { return; }
my($full_chrome_path) = full_path_to($chrome_dir);
my($key);
foreach $key (keys %$jars)
{
my($zip) = $jars->{$key};
my($rel_path) = $key;
$rel_path =~ s/\//:/g;
my($output_path) = $full_chrome_path.":".$rel_path;
print "Writing zip file $key to $output_path\n";
# ensure the target dirs exist
my($path) = $output_path;
$path =~ s/[^:]+$//;
mkpath($path);
# unlink $output_path; # remove any existing jar
safeSaveJarFile($zip, $output_path);
# $zip is invalid after this operation, so nuke it here
$jars->{$key} = 0;
}
}
#-------------------------------------------------------------------------------
# registerChromePackage
#
# Enter a chrome package into the installed-chrome.txt file
#-------------------------------------------------------------------------------
sub registerChromePackage($$$$$$)
{
my($jar_file, $file_path, $chrome_dir, $jar_hash, $chrome_type, $pkg_name) = @_;
my($manifest_subdir) = $jar_file;
$manifest_subdir =~ s/:/\//g;
my($chrome_entry);
if ($main::options{use_jars}) {
$chrome_entry = "$chrome_type,install,url,jar:resource:/chrome/$manifest_subdir!/$chrome_type/$pkg_name";
} else {
$manifest_subdir =~ s/\.jar$//;
$chrome_entry = "$chrome_type,install,url,resource:/chrome/$manifest_subdir/$chrome_type/$pkg_name";
}
# print "Entering $chrome_entry in installed-chrome.txt\n";
# ensure chrome_dir exists
mkpath($chrome_dir);
my($inst_chrome) = ${chrome_dir}.":installed-chrome.txt";
if (open(CHROMEFILE, "<$inst_chrome")) {
while (<CHROMEFILE>) {
chomp;
if ($_ eq $chrome_entry) {
# $chrome_entry already appears in installed-chrome.txt file
# just update the mod date
my $now = time;
utime($now, $now, $inst_chrome) || die "Error: Couldn't touch $inst_chrome";
print "+++ updating chrome $inst_chrome\n+++\t\t$chrome_entry\n";
close(CHROMEFILE) || die "Error: can't close $inst_chrome: $!";
return 0;
}
}
close(CHROMEFILE) || die "Error: can't close $inst_chrome: $!";
}
open(CHROMEFILE, ">>${inst_chrome}") || die "Error: Failed to open $inst_chrome\n";
print(CHROMEFILE "${chrome_entry}\n");
close(CHROMEFILE) || die "Error: Failed to close $inst_chrome\n";
print "+++ adding chrome $inst_chrome\n+++\t\t$chrome_entry\n";
}
#-------------------------------------------------------------------------------
# Create or add to a jar file from a jar.mn file.
# Both arguments are relative to the mozilla root dir.
#
#
#-------------------------------------------------------------------------------
sub CreateJarFromManifest($$$)
{
my($jar_man_path, $dest_path, $jars) = @_;
if ($main::options{chrome_jars}) {
print "Jarring from $jar_man_path\n";
}
if ($main::options{chrome_files}) {
print "Installing files from $jar_man_path\n";
}
$jar_man_path = full_path_to($jar_man_path);
$dest_path = full_path_to($dest_path);
# if the jars hash is empty, nuke installed-chrome.txt
if (! scalar(%$jars))
{
print "Nuking installed-chrome.txt\n";
my($installed_chrome) = $dest_path.":installed-chrome.txt";
# unlink $installed_chrome;
}
my $jar_man_dir = "";
my $jar_man_file = "";
if ($jar_man_path =~ /(.+):([^:]+)$/)
{
$jar_man_dir = $1; # no trailing :
$jar_man_file = $2;
}
# Keep a hash of jar files, keyed on relative jar path (e.g. "packages/core.jar")
# Entries are open Archive::Zips (if zipping), and installed-chrome entries.
my($jar_id) = ""; # Current foo/bar.jar from jar.mn file
my($jar_file) = ""; # relative path to jar file (from $dest_path), with mac separators
my($full_jar_path);
open(FILE, "<$jar_man_path") || die "Error: could not open \"$jar_man_path\": $!";
while (<FILE>)
{
my($line) = $_;
chomp($line);
# print "$line\n";
if ($line =~ /^\s*\#.*$/) { # skip comments
next;
}
if ($line =~/^([\w\d.\-\_\\\/]+)\:\s*$/) # line start jar file entries
{
$jar_id = $1;
$jar_file = $jar_id;
$jar_file =~ s|/|:|g; # slash to colons
$full_jar_path = $dest_path.":".$jar_file;
setupJarFile($jar_id, $dest_path, $jars);
}
elsif ($line =~ /^(\+?)\s+([\w\d.\-\_\\\/]+)\s*(\([\w\d.\-\_\\\/]+\))?$\s*/) # jar file entry
{
my($override) = ($1 eq "+");
my($file_dest) = $2;
my($file_src) = $3;
if ($file_src) {
$file_src = substr($file_src, 1, -1); #strip the ()
} else {
$file_src = $file_dest;
}
$file_src =~ s|/|:|g;
if ($jar_file ne "") # if jar is open, add to jar
{
if ($file_dest =~ /([\w\d.\-\_]+)\/([\w\d.\-\_\\\/]+)contents.rdf/)
{
my $chrome_type = $1;
my $pkg_name = $2;
registerChromePackage($jar_file, $file_dest, $dest_path, $jars, $chrome_type, $pkg_name);
}
addToJarFile($jar_id, $jar_man_dir, $file_src, $full_jar_path, $file_dest, $override, $jars);
}
else
{
die "Error: bad jar.mn format at $line\n";
}
}
elsif ($line =~ /^\s*$/ ) # blank line
{
if ($jar_file ne "") #if a jar file is open, close it
{
closeJarFile($full_jar_path, $jars);
$jar_file = "";
$full_jar_path = "";
}
}
}
close(FILE);
if ($jar_file ne "") #if a jar file is open, close it
{
closeJarFile($full_jar_path, $jars);
}
}
1;

View File

@@ -1,228 +0,0 @@
#!perl -w
package Moz::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 Exporter;
use vars qw($VERSION @ISA @EXPORT);
use Cwd;
use File::Basename;
use Mac::StandardFile;
use Mac::AppleEvents;
use Mac::AppleEvents::Simple;
@ISA = qw(Exporter);
@EXPORT = qw(new describe checkout update);
$VERSION = "1.00";
# If you want to understand the gobbldeygook that's used to build Apple Events,
# you should start by reading the AEGizmos documentation.
# Architecture:
# cvs session object:
# name - session name
# session_file - session file
#
#
my($last_error) = 0;
my($gAppSig) = 'Mcvs'; # MacCVS Pro
#
# utility routines
#
sub _checkForEventError($)
{
my($evt) = @_;
if ($evt->{ERRNO} != 0)
{
print STDERR "Error. Script returned '$evt->{ERROR} (error $evt->{ERRNO})\n";
$last_error = $evt->{ERRNO};
return 0;
}
return 1; # success
}
#
# 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 success
sub assertSessionOpen()
{
my ($self) = shift;
$last_error = 0;
my($prm) =
q"'----':obj {form:name, want:type(alis), seld:TEXT(@), from:'null'()}";
my($evt) = do_event(qw/aevt odoc/, $gAppSig, $prm, $self->{session_file});
return _checkForEventError($evt);
}
# prints the cvs object, used mostly for debugging
sub describe
{
my($self) = shift;
$last_error = 0;
print "MacCVS:: name: ", $self->{name}, " session file: ", $self->{session_file}, "\n";
}
# checkout( self, module, revision, date)
# MacCVS checkout command
# returns 1 on success.
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 = ""; }
$last_error = 0;
$self->assertSessionOpen() || die "Error: failed to open MacCVS session file at $self->{session_file}\n";
my($revstring) = ($revision ne "") ? $revision : "(none)";
my($datestring) = ($date ne "") ? $date : "(none)";
print "Checking out $module with revision $revstring, date $datestring\n";
my($prm) =
q"'----':obj {form:name, want:type(docu), seld:TEXT(@), from:'null'()}, ".
q"modl:'TEXT'(@), tagr:'TEXT'(@), tagd:'TEXT'(@) ";
my($evt) = do_event(qw/MCvs cout/, $gAppSig, $prm, $self->{name}, $module, $revision, $date);
return _checkForEventError($evt);
}
# update( self, branch tag, list of paths)
# MacCVS udate command
# returns 1 on success.
# NOTE: MacCVS Pro does not correctly support this stuff yet (as of version 2.7d5).
sub update()
{
my($self, $branch, $paths ) = @_;
$last_error = 0;
$self->assertSessionOpen() || die "Error: failed to open MacCVS session file at $self->{session_file}\n";
if ($branch eq "HEAD") {
$branch = "";
}
my($paths_list) = "";
my($path);
foreach $path (@$paths)
{
if ($paths_list ne "") {
$paths_list = $paths_list.", ";
}
$paths_list = $paths_list."Ò".$path."Ó";
}
my($prm) =
q"'----':obj {form:name, want:type(docu), seld:TEXT(@), from:'null'()}, ".
q"tagr:'TEXT'(@), tFls:[";
$prm = $prm.$paths_list."]";
my($evt) = do_event(qw/MCvs updt/, $gAppSig, $prm, $self->{name}, $branch);
return _checkForEventError($evt);
};
sub getLastError()
{
return $last_error;
}
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
Simon Fraser sfraser@netscape.com
=cut
__END__

View File

@@ -1,603 +0,0 @@
=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.
This module should only contain functions that are generic to any build,
not just the Mozilla build.
=cut
package Moz::Moz;
require Exporter;
use Cwd;
use File::Copy;
use File::Path;
use File::Basename;
use Mac::Types;
use Mac::Events;
use Mac::Processes;
use ExtUtils::Manifest 'maniread';
use Moz::CodeWarriorLib;
@ISA = qw(Exporter);
@EXPORT = qw( LaunchCodeWarrior
GetCodeWarriorRelativePath
current_directory
full_path_to
DoBuildProject
ImportXMLProject
ExportProjectToXML
OpenErrorLog
MakeAlias
GetFileModDate
StopForErrors
DontStopForErrors
InstallFromManifest
InstallResources
RedirectOutputToFile
Delay
ActivateApplication
IsProcessRunning);
@EXPORT_OK = qw(CloseErrorLog QUIET);
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;
}
$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 "Error: Can't open $log_file\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/ || /^Link Error/ )
{
# 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 DoBuildProject($$$)
{
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 = Moz::CodeWarriorLib::build_project(
$project_path, $target_name, $recent_errors_file, $clean_build
);
WaitNextEvent();
# $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 ) # Removed this test, because we want warnings, too. -- jrm
{
log_recent_errors($project_path);
}
}
sub ImportXMLProject($$)
{
my ($xml_path, $project_path) = @_;
# my ($codewarrior_ide_name) = Moz::CodeWarriorLib::getCodeWarriorIDEName();
# my $ascript = <<EOS;
# tell application "$codewarrior_ide_name"
# make new (project document) as ("$project_path") with data ("$xml_path")
# end tell
#EOS
# print $ascript."\n";
# my($result) = MacPerl::DoAppleScript($ascript);
# unless ($result) { die "Error: ImportXMLProject AppleScript failed $^E $result\n"; }
#
my($import_error) = Moz::CodeWarriorLib::import_project($xml_path, $project_path);
if ($import_error ne "") {
die "Error: ImportXMLProject failed with error $import_error\n";
}
}
sub ExportProjectToXML($$)
{
my ($project_path, $xml_path) = @_;
my (@suffix_list) = (".mcp");
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
if ($suffix eq "") { die "Project: $project_path doesn't look like a project file.\n"; }
if (-e $xml_path) {
print "$xml_path exists - not exporting $project_path\n";
}
else {
print "Exporting $project_path to $xml_path\n";
my($export_error) = Moz::CodeWarriorLib::export_project($project_path, $xml_path);
if ($export_error ne "") {
die "Error: export_project failed with error '$export_error'\n";
}
if (! -e $xml_path) {
die "Error: XML export to $xml_path failed\n";
}
}
}
=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 "Error: $message \"$old_file\" doesn't exist.\n" unless -e $old_file;
die "Error: $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 "Error: $message symlink returned an unexpected error.\n";
}
=pod
C<InstallFromManifest()>
=cut
sub InstallFromManifest($;$$)
{
my ($manifest_file, $dest_dir, $flat) = @_;
$flat = 0 unless defined($flat); # if $flat, all rel. paths in MANIFEST get aliased to the root of $dest_dir
$dest_dir ||= ":";
$manifest_file =~ m/(.+):/;
my $source_dir = $1;
chop($dest_dir) if $dest_dir =~ m/:$/;
#Mac::Events->import();
WaitNextEvent();
if ($flat)
{
print "Doing manifest on \"$manifest_file\" FLAT\n" unless $QUIET;
}
else
{
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 (!$flat && ($file =~ /:.+:/ ))
{
$subdir = $&;
}
$file = ":$file" unless $file =~ m/^:/;
MakeAlias("$source_dir$file", "$dest_dir$subdir");
}
}
=pod
C<InstallResources()>
=cut
# parameters are path to MANIFEST file, destination dir, true (to make copies) or false (to make aliases)
sub InstallResources($;$;$)
{
my ($manifest_file, $dest_dir, $copy_files) = @_;
$dest_dir ||= ":";
mkpath($dest_dir) if !-d $dest_dir;
$manifest_file =~ m/(.+):/;
my $source_dir = $1;
chop($dest_dir) if $dest_dir =~ m/:$/;
WaitNextEvent();
print "Installing resources from \"$manifest_file\"\n" unless $QUIET;
my $read = maniread(full_path_to($manifest_file));
foreach $file (keys %$read)
{
next unless $file;
if ($copy_files)
{
copy("$source_dir:$file", "$dest_dir:$file");
}
else
{
MakeAlias("$source_dir:$file", "$dest_dir:$file");
}
}
}
#//--------------------------------------------------------------------------------------------------
#// Delay
#//--------------------------------------------------------------------------------------------------
sub Delay($)
{
my ($delay_seconds) = @_;
$now = time;
$exit_time = $now + $delay_seconds;
while ($exit_time > $now) {
$now = time;
}
}
#//--------------------------------------------------------------------------------------------------
#// GetFileModDate
#//--------------------------------------------------------------------------------------------------
sub GetFileModDate($)
{
my($filePath)=@_;
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat($filePath);
return $mtime;
}
#//--------------------------------------------------------------------------------------------------
#// LaunchCodeWarrior
#//--------------------------------------------------------------------------------------------------
sub LaunchCodeWarrior($)
{
my($idepath_file) = @_; # full path to IDE location file
my($cur_dir) = cwd();
# this both launches and writes the IDE path file
Moz::CodeWarriorLib::activate($idepath_file);
chdir($cur_dir);
}
#//--------------------------------------------------------------------------------------------------
#// GetCodeWarriorRelativePath
#//--------------------------------------------------------------------------------------------------
sub GetCodeWarriorRelativePath($)
{
my($rel_path) = @_;
return Moz::CodeWarriorLib::getCodeWarriorPath($rel_path);
}
#//--------------------------------------------------------------------------------------------------
#// RedirectOutputToFile
#//--------------------------------------------------------------------------------------------------
sub RedirectOutputToFile($)
{
my($log_file) = @_;
# ensure that folders in the path exist
my($logdir) = "";
my($logfile) = $log_file;
if ($log_file =~ /(.+?:)([^:]+)$/) # ? for non-greedy match
{
$logdir = $1;
$logfile = $2;
mkpath($logdir);
}
print "Output is now being redirected to the file '$log_file'\n";
open(STDOUT, "> $log_file") || die "Can't redirect stdout";
open(STDERR, ">&STDOUT") || die "Can't dup stdout";
select(STDERR); $| = 1; # make unbuffered
select(STDOUT); $| = 1; # make unbuffered
MacPerl::SetFileInfo("CWIE", "TEXT", $log_file);
}
#//--------------------------------------------------------------------------------------------------
#// ActivateApplication
#//--------------------------------------------------------------------------------------------------
sub ActivateApplication($)
{
my ($appSignature) = @_;
my ($psi, $found);
my ($appPSN);
$found = 0;
foreach $psi (values(%Process))
{
if ($psi->processSignature() eq $appSignature)
{
$appPSN = $psi->processNumber();
$found = 1;
last;
}
}
if ($found == 0 || SameProcess($appPSN, GetFrontProcess()))
{
return;
}
SetFrontProcess($appPSN);
while (GetFrontProcess() != $appPSN)
{
WaitNextEvent();
}
}
#//--------------------------------------------------------------------------------------------------
#// IsProcessRunning
#//--------------------------------------------------------------------------------------------------
sub IsProcessRunning($)
{
my($processName, $psn, $psi) = @_;
while ( ($psn, $psi) = each(%Process) ) {
if ($psi->processName eq $processName) { return 1; }
}
return 0;
}
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.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s):
=cut

View File

@@ -1,272 +0,0 @@
package Moz::Prefs;
require 5.004;
require Exporter;
# Package that attempts to read a file from the Preferences folder,
# and get build settings out of it
use strict;
use Exporter;
use File::Path;
use Mac::Files;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(ReadMozUserPrefs);
#-------------------------------------------------------------------------------
#
# GetPrefsFolder
#
#-------------------------------------------------------------------------------
sub GetPrefsFolder()
{
my($prefs_folder) = FindFolder(kOnSystemDisk, kPreferencesFolderType, 1);
return $prefs_folder.":Mozilla build prefs";
}
#-------------------------------------------------------------------------------
#
# SetArrayValue
#
#-------------------------------------------------------------------------------
sub SetArrayValue($$$)
{
my($array_ref, $index1, $index2) = @_;
my($index);
foreach $index (@$array_ref)
{
if ($index->[0] eq $index1)
{
$index->[1] = $index2;
return 1;
}
}
return 0;
}
#-------------------------------------------------------------------------------
#
# WriteDefaultPrefsFile
#
#-------------------------------------------------------------------------------
sub WriteDefaultPrefsFile($)
{
my($file_path) = @_;
my($file_contents);
$file_contents = <<'EOS';
% You can use this file to customize the Mozilla build system.
% The following kinds of lines are allowable:
% Comment lines, which start with a '%' in the first column
% Lines which modify the default build settings. For the list of flags,
% see MozBuildFlags.pm. Examples are:
%
% build pull 0 % don't pull
% options mng 1 % turn mng on
%
% Line containing the special 'buildfrom' flag, which specifies
% where to start the build. Example:
%
% buildfrom nglayout % where to start the build
%
% Lines which specify the location of the files used to store paths
% to the CodeWarrior IDE, and the MacCVS Pro session file. Note quoting
% of paths containing whitespace. Examples:
%
% filepath idepath ::codewarrior.txt
% filepath sessionpath ":Some folder:MacCVS session path.txt"
%
% Lines which modify the build settings like %main::DEBUG.
% Any lines which do not match either of the above are assumed
% to set variables on $main::. Examples:
%
% MOZILLA_OFFICIAL 1
%
EOS
$file_contents =~ s/%/#/g;
local(*PREFS_FILE);
open(PREFS_FILE, "> $file_path") || die "Could not write default prefs file\n";
print PREFS_FILE ($file_contents);
close(PREFS_FILE);
MacPerl::SetFileInfo("McPL", "TEXT", $file_path);
}
#-------------------------------------------------------------------------------
#
# HandlePrefSet
#
#-------------------------------------------------------------------------------
sub HandlePrefSet($$$$)
{
my($flags, $name, $value, $desc) = @_;
if (SetArrayValue($flags, $name, $value)) {
print "Prefs set $desc flag '$name' to '$value'\n";
} else {
die "$desc setting '$name' is not a valid option\n";
}
}
#-------------------------------------------------------------------------------
#
# HandleBuildFromPref
#
#-------------------------------------------------------------------------------
sub HandleBuildFromPref($$)
{
my($build_array, $name) = @_;
my($setting) = 0;
my($index);
foreach $index (@$build_array)
{
if ($index->[0] eq $name) {
$setting = 1;
}
$index->[1] = $setting;
}
if ($setting == 1) {
print "Building from $name onwards, as specified by prefs\n";
} else {
printf "Failed to find buildfrom setting '$name'\n";
}
}
#-------------------------------------------------------------------------------
#
# ReadPrefsFile
#
#-------------------------------------------------------------------------------
sub ReadPrefsFile($$$$$)
{
my($file_path, $build_flags, $options_flags, $filepath_flags, $create_if_missing) = @_;
local(*PREFS_FILE);
if (open(PREFS_FILE, "< $file_path"))
{
print "Reading build prefs from '$file_path'\n";
while (<PREFS_FILE>)
{
my($line) = $_;
chomp($line);
if ($line =~ /^\#/ || $line =~ /^\s*$/) { # ignore comments and empty lines
next;
}
if (($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+\"(.+)\"(\s+#.+)?/) ||
($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+\'(.+)\'(\s+#.+)?/) ||
($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+([^#\s]+)(\s+#.+)?/))
{
my($array_name) = $1;
my($option_name) = $2;
my($option_value) = $3;
# print "Read '$array_name' '$option_name' '$option_value'\n";
if ($array_name eq "build")
{
HandlePrefSet($build_flags, $option_name, $option_value, "Build");
}
elsif ($array_name eq "options")
{
HandlePrefSet($options_flags, $option_name, $option_value, "Options");
}
elsif ($array_name eq "filepath" && $option_name && $option_value)
{
HandlePrefSet($filepath_flags, $option_name, $option_value, "Filepath");
}
else
{
print "Unknown pref option at $line\n";
}
}
elsif ($line =~ /^\s*buildfrom\s+([^#\s]+)(\s+#.+)?/)
{
my($build_start) = $1;
HandleBuildFromPref($build_flags, $build_start);
}
elsif ($line =~ /^\s*([^#\s]+)\s+([^#\s]+)(\s+#.+)?/)
{
my($build_var) = $1;
my($var_setting) = $2;
print "Setting \$main::$build_var to $var_setting\n";
eval "\$main::$build_var = \"$var_setting\"";
}
else
{
print "Unrecognized input line at $line\n";
}
}
close(PREFS_FILE);
}
elsif ($create_if_missing)
{
print "No prefs file found at $file_path; using defaults\n";
my($folder_path) = $file_path;
$folder_path =~ s/[^:]+$//;
mkpath($folder_path);
WriteDefaultPrefsFile($file_path);
}
}
#-------------------------------------------------------------------------------
#
# ReadMozUserPrefs
#
#-------------------------------------------------------------------------------
sub ReadMozUserPrefs($$$$)
{
my($prefs_file_name, $build_flags, $options_flags, $filepath_flags) = @_;
if ($prefs_file_name eq "") { return; }
# if local prefs exist, just use those. Othewise, look in the prefs folder
if (-e $prefs_file_name)
{
# read local prefs
ReadPrefsFile($prefs_file_name, $build_flags, $options_flags, $filepath_flags, 0);
}
else
{
# first read prefs folder prefs
my($prefs_path) = GetPrefsFolder();
$prefs_path .= ":$prefs_file_name";
ReadPrefsFile($prefs_path, $build_flags, $options_flags, $filepath_flags, 1);
}
}
1;

View File

@@ -1,932 +0,0 @@
#!/usr/bin/perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Simon Fraser <sfraser@netscape.com>
#
package Moz::ProjectXML;
require 5.004;
require Exporter;
use strict;
use Exporter;
use Cwd;
use XML::DOM;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(
ParseXMLDocument
DisposeXMLDocument
WriteXMLDocument
CleanupPro5XML
GetTargetsList
CloneTarget
SetAsSharedLibraryTarget
SetAsStaticLibraryTarget
AddTarget
RemoveTarget
GetTargetSetting
SetTargetSetting
getChildElementTextContents
);
#--------------------------------------------------------------------------------------------------
# A module for reading, manipulating, and writing XML-format CodeWarrior project files.
#
# Sample usage:
#
# use ProjectXML;
#
# my $doc = ProjectXML::ParseXMLDocument("Test.mcp.xml");
# ProjectXML::CloneTarget($doc, "Test.shlb", "Test.lib");
# ProjectXML::SetAsStaticLibraryTarget($doc, "Test.lib", "TestOutput.lib");
# ProjectXML::WriteXMLDocument($doc, "Test_out.xml");
# ProjectXML::DisposeXMLDocument($doc);
#
#--------------------------------------------------------------------------------------------------
#//--------------------------------------------------------------------------------------------------
#// ParseXMLDocument
#// Note that the caller must call DisposeXMLDocument on the returned doc
#//--------------------------------------------------------------------------------------------------
sub ParseXMLDocument($)
{
my($doc_path) = @_;
my $parser = new XML::DOM::Parser(ErrorContext => 2);
my $doc = $parser->parsefile($doc_path);
return $doc;
}
#//--------------------------------------------------------------------------------------------------
#// DisposeXMLDocument
#// Needed to avoid memory leaks - cleanup circular references for garbage collection
#//--------------------------------------------------------------------------------------------------
sub DisposeXMLDocument($)
{
my($doc) = @_;
$doc->dispose();
}
#//--------------------------------------------------------------------------------------------------
#// WriteXMLDocument
#//--------------------------------------------------------------------------------------------------
sub _pro5_tag_compression($$)
{
return 1; # Pro 5 is broken and can't import XML with <foo/> style tags
}
sub _pro6plus_tag_compression($$)
{
return 0; # Pro 6 can deal with empty XML tags like <foo/>
}
sub WriteXMLDocument($$$)
{
my($doc, $file_path, $ide_version) = @_;
if ($ide_version eq "4.0")
{
XML::DOM::setTagCompression(\&_pro5_tag_compression);
}
else
{
XML::DOM::setTagCompression(\&_pro6plus_tag_compression);
}
$doc->printToFile($file_path);
}
#//--------------------------------------------------------------------------------------------------
#// CleanupPro5XML
#// XML Projects exported by Pro 5 contain garbage data under the MWMerge_MacOS_skipResources
#// setting. This routine cleans this up, saving the result to a new file
#//--------------------------------------------------------------------------------------------------
sub CleanupPro5XML($$)
{
my($xml_path, $out_path) = @_;
local(*XML_FILE);
open(XML_FILE, "< $xml_path") || die "Error: failed to open file $xml_path\n";
local(*CLEANED_FILE);
open(CLEANED_FILE, "> $out_path") || die "Error: failed to open file $out_path for writing\n";
my $in_skip_resources_settings = 0;
while(<XML_FILE>)
{
my($line) = $_;
if ($line =~ /^<\?codewarrior/) # is processing inst line
{
my $test_line = $line;
chomp($test_line);
my $out_line = $test_line;
if ($test_line =~ /^<\?codewarrior\s+exportversion=\"(.+)\"\s+ideversion=\"(.+)\"\s*\?>$/)
{
my $export_version = $1;
my $ide_version = $2;
$ide_version = "4.0_mozilla"; # pseudo IDE version so we know we touched it
$out_line = "<?codewarrior exportversion=\"".$export_version."\" ideversion=\"".$ide_version."\"?>";
}
print CLEANED_FILE "$out_line\n";
next;
}
if ($line =~ /MWMerge_MacOS_skipResources/)
{
$in_skip_resources_settings = 1;
print CLEANED_FILE "$line";
}
elsif($in_skip_resources_settings && $line =~ /<!-- Settings for/)
{
# leaving bad settings lines. Write closing tag
print CLEANED_FILE " <!-- Corrupted setting entries removed by script -->\n";
print CLEANED_FILE " </SETTING>\n\n";
print CLEANED_FILE "$line";
$in_skip_resources_settings = 0;
}
elsif (!$in_skip_resources_settings)
{
print CLEANED_FILE "$line";
}
}
close(XML_FILE);
close(CLEANED_FILE);
}
#--------------------------------------------------------------------------------------------------
# SniffProjectXMLIDEVersion
#
#--------------------------------------------------------------------------------------------------
sub SniffProjectXMLIDEVersion($)
{
my($xml_path) = @_;
my $found_version = "";
local(*XML_FILE);
open(XML_FILE, "< $xml_path") || die "Error: failed to open file $xml_path\n";
while(<XML_FILE>)
{
my($line) = $_;
chomp($line);
if ($line =~ /^<\?codewarrior/) # is processing inst line
{
unless ($line =~ /^<\?codewarrior\s+exportversion=\"(.+)\"\s+ideversion=\"(.+)\"\s*\?>$/)
{
die "Error: Failed to find ideversion in $xml_path in line $line\n";
}
my $export_version = $1;
my $ide_version = $2;
$found_version = $ide_version;
last;
}
}
close(XML_FILE);
return $found_version;
}
#//--------------------------------------------------------------------------------------------------
#// GetTargetsList
#// Returns an array of target names
#//--------------------------------------------------------------------------------------------------
sub GetTargetsList($)
{
my($doc) = @_;
my $nodes = $doc->getElementsByTagName("TARGET");
my $n = $nodes->getLength;
my @target_names;
for (my $i = 0; $i < $n; $i++)
{
my ($node) = $nodes->item($i);
my($target_name) = getChildElementTextContents($node, "NAME");
push(@target_names, $target_name);
}
return @target_names;
}
#//--------------------------------------------------------------------------------------------------
#// CloneTarget
#// Clone the named target, renaming it to 'new_name'
#//--------------------------------------------------------------------------------------------------
sub CloneTarget($$$)
{
my($doc, $target_name, $new_name) = @_;
my $target_node = getTargetNode($doc, $target_name);
# clone here
my $target_clone = $target_node->cloneNode(1); # deep clone
# -- munge target settings --
# set the target name field
setChildElementTextContents($doc, $target_clone, "NAME", $new_name);
# set the targetname pref
setTargetNodeSetting($doc, $target_clone, "Targetname", $new_name);
# -- insert new target subtree --
my $target_list = $target_node->getParentNode();
$target_list->appendChild($target_clone);
# -- now add to targetorder --
my (@target_order_nodes) = getChildOfDocument($doc, "TARGETORDER");
my $target_order = @target_order_nodes[0];
my $new_order = $doc->createElement("ORDEREDTARGET");
my $order_name = $doc->createElement("NAME");
$new_order->appendChild($order_name);
setChildElementTextContents($doc, $new_order, "NAME", $new_name);
$target_order->appendChild($new_order);
}
#//--------------------------------------------------------------------------------------------------
#// SetAsSharedLibraryTarget
#//
#//--------------------------------------------------------------------------------------------------
sub SetAsSharedLibraryTarget($$$)
{
my($doc, $target_name, $output_name) = @_;
my $target_node = getTargetNode($doc, $target_name);
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_type", "SharedLibrary");
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_filetype", "1936223330"); #'shlb'
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_outfile", $output_name);
}
#//--------------------------------------------------------------------------------------------------
#// AddFileToTarget
#//
#// Add a file to the specified target(s).
#//
#//--------------------------------------------------------------------------------------------------
sub AddFileToTarget($$$)
{
my($doc, $target_list, $file_name) = @_;
# the file must be added in 3 places:
# 1. in <TARGET><FILELIST><FILE> (with linkage flags if necessary)
# 2. in <TARGET><LINKORDER><FILEREF>
# 3. in <GROUPLIST><GROUP><FILEREF>
die "Write me\n";
}
#//--------------------------------------------------------------------------------------------------
#// RemoveFileFromTarget
#//
#// Remove a file from the specified target, removing it from the entire project
#// if no other targets reference it.
#//
#//--------------------------------------------------------------------------------------------------
sub RemoveFileFromTarget($$$)
{
my($doc, $target_node, $file_name) = @_;
# the file must be removed in 3 places:
# 1. in <TARGET><FILELIST><FILE>
# 2. in <TARGET><LINKORDER><FILEREF>
# 3. in <GROUPLIST><GROUP><FILEREF>
# first, remove from <FILELIST>
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
my $file_node = getChildNodeByGrandchildContents($doc, $filelist_node, "FILE", "PATH", $file_name);
unless ($file_node) { return; }
$filelist_node->removeChild($file_node);
# next, remove from <LINKORDER>
my $linkorder_node = getFirstChildElement($target_node, "LINKORDER");
unless ($linkorder_node) { die "Error: failed to find LINKORDER node\n"; }
my $fileref_node = getChildNodeByGrandchildContents($doc, $linkorder_node, "FILEREF", "PATH", $file_name);
unless ($fileref_node) { die "Error: link order node for file $file_name not found\n"; }
$linkorder_node->removeChild($fileref_node);
# last, remove from <GROUPLIST>
# <GROUPLIST> is cross-target, so we have to be careful here.
my $grouplist_node = getChildOfDocument($doc, "GROUPLIST");
unless ($grouplist_node) { die "Error: failed to find GROUPLIST node\n"; }
# if the file isn't in any other targets, remove it from the groups
if (!GetFileInUse($doc, $file_name))
{
print "File $file_name is in no other targest. Removing from project\n";
my @group_nodes;
getChildElementsOfType($doc, $grouplist_node, "GROUP", \@group_nodes);
my $group_node;
foreach $group_node (@group_nodes)
{
my @fileref_nodes;
getChildElementsOfType($doc, $group_node, "FILEREF", \@fileref_nodes);
my $fileref_node;
foreach $fileref_node (@fileref_nodes)
{
my $path_name = getChildElementTextContents($fileref_node, "PATH");
if ($path_name eq $file_name)
{
print "Removing $file_name from project group list\n";
$group_node->removeChild($fileref_node);
last;
}
}
# can a file appear in more than one group?
}
}
}
#//--------------------------------------------------------------------------------------------------
#// SetAsStaticLibraryTarget
#//
#//--------------------------------------------------------------------------------------------------
sub SetAsStaticLibraryTarget($$$)
{
my($doc, $target_name, $output_name) = @_;
my $target_node = getTargetNode($doc, $target_name);
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_type", "Library");
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_filetype", "1061109567"); #'????'
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_outfile", $output_name);
# static targets don't need any library linkage, so we can remove linkage
# with all .shlb and .Lib files.
my(@obsolete_files) = ("NSStdLibStubs", "InterfacesStubs", "InterfaceLib", "InternetConfigLib");
print " Removing libraries etc. from target\n";
# get all files in target
my @target_files = GetTargetFilesList($doc, $target_name);
my $target_file;
foreach $target_file (@target_files)
{
if ($target_file =~ /(\.shlb|\.lib|\.Lib|\.o|\.exp)$/)
{
RemoveFileFromTarget($doc, $target_node, $target_file);
}
}
print " Removing stub libraries from target\n";
# then remove files with known names
my $obs_file;
foreach $obs_file (@obsolete_files)
{
RemoveFileFromTarget($doc, $target_node, $obs_file);
}
}
#//--------------------------------------------------------------------------------------------------
#// AddTarget
#//
#//--------------------------------------------------------------------------------------------------
sub AddTarget($$)
{
my($doc, $target_name) = @_;
die "Write me\n";
}
#//--------------------------------------------------------------------------------------------------
#// RemoveTarget
#//
#//--------------------------------------------------------------------------------------------------
sub RemoveTarget($$)
{
my($doc, $target_name) = @_;
die "Write me\n";
}
#//--------------------------------------------------------------------------------------------------
#// GetTargetSetting
#// Get the value for the specified setting in the specified target
#//--------------------------------------------------------------------------------------------------
sub GetTargetSetting($$$)
{
my($doc, $target_name, $setting_name) = @_;
my $target_node = getTargetNode($doc, $target_name);
return getTargetNodeSetting($target_node, "VALUE");
}
#//--------------------------------------------------------------------------------------------------
#// SetTargetSetting
#// Set the value for the specified setting in the specified target
#//--------------------------------------------------------------------------------------------------
sub SetTargetSetting($$$$)
{
my($doc, $target_name, $setting_name, $new_value) = @_;
my $target_node = getTargetNode($doc, $target_name);
setTargetNodeSetting($doc, $target_node, "VALUE", $new_value);
}
#//--------------------------------------------------------------------------------------------------
#// GetTargetFilesList
#// Return an array of the files in the target (in filelist order)
#//--------------------------------------------------------------------------------------------------
sub GetTargetFilesList($$)
{
my($doc, $target_name) = @_;
my $target_node = getTargetNode($doc, $target_name);
my @files_list;
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
my @file_nodes;
getChildElementsOfType($doc, $filelist_node, "FILE", \@file_nodes);
my $node;
foreach $node (@file_nodes)
{
my $file_name = getChildElementTextContents($node, "PATH");
push(@files_list, $file_name);
}
return @files_list;
}
#//--------------------------------------------------------------------------------------------------
#// FileIsInTarget
#//
#//--------------------------------------------------------------------------------------------------
sub FileIsInTarget($$$)
{
my($doc, $file_name, $target_name) = @_;
my $target_node = getTargetNode($doc, $target_name);
unless ($target_node) { die "Error: no target found called $target_name\n"; }
my $file_node = GetTargetFileNode($doc, $target_node, $file_name);
if ($file_node) {
return 1;
}
return 0;
}
#//--------------------------------------------------------------------------------------------------
#// GetFileTargetsList
#// Return an array of the targets that a file is in (expensive)
#//--------------------------------------------------------------------------------------------------
sub GetFileTargetsList($$)
{
my ($doc, $file_name) = @_;
my @target_list;
my @targets = GetTargetsList($doc);
my $target;
foreach $target (@targets)
{
if (FileIsInTarget($doc, $file_name, $target))
{
push(@target_list, $target);
}
}
return @target_list;
}
#//--------------------------------------------------------------------------------------------------
#// GetTargetFileNode
#//
#//--------------------------------------------------------------------------------------------------
sub GetTargetFileNode($$$)
{
my($doc, $target_node, $file_name) = @_;
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
my $file_node = getChildNodeByGrandchildContents($doc, $filelist_node, "FILE", "PATH", $file_name);
return $file_node;
}
#//--------------------------------------------------------------------------------------------------
#// GetFileInUse
#// Return true if the file is used by any target
#//--------------------------------------------------------------------------------------------------
sub GetFileInUse($$)
{
my($doc, $file_name) = @_;
my $targetlist_node = getChildOfDocument($doc, "TARGETLIST");
my $target_node = $targetlist_node->getFirstChild();
while ($target_node)
{
if ($target_node->getNodeTypeName eq "ELEMENT_NODE" &&
$target_node->getTagName() eq "TARGET")
{
# if this is a target node
my $file_node = GetTargetFileNode($doc, $target_node, $file_name);
if ($file_node) {
return 1; # found it
}
}
$target_node = $target_node->getNextSibling();
}
# not found
return 0;
}
#//--------------------------------------------------------------------------------------------------
#// getChildOfDocument
#//--------------------------------------------------------------------------------------------------
sub getChildOfDocument($$)
{
my($doc, $child_type) = @_;
return getFirstChildElement($doc->getDocumentElement(), $child_type);
}
#//--------------------------------------------------------------------------------------------------
#// getFirstChildElement
#//--------------------------------------------------------------------------------------------------
sub getFirstChildElement($$)
{
my($node, $element_name) = @_;
my $found_node;
unless ($node) { die "getFirstChildElement called with empty node\n"; }
#look for the first "element_name" child
my $child_node = $node->getFirstChild();
while ($child_node)
{
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
$child_node->getTagName() eq $element_name)
{
$found_node = $child_node;
last;
}
$child_node = $child_node->getNextSibling();
}
return $found_node;
}
#//--------------------------------------------------------------------------------------------------
#// getChildElementsOfType
#//
#// Return an array of refs to child nodes of the given type
#//--------------------------------------------------------------------------------------------------
sub getChildElementsOfType($$$$)
{
my($doc, $node, $child_type, $array_ref) = @_;
my $child_node = $node->getFirstChild();
while ($child_node)
{
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
$child_node->getTagName() eq $child_type)
{
push(@$array_ref, $child_node);
}
$child_node = $child_node->getNextSibling();
}
}
#//--------------------------------------------------------------------------------------------------
#// getChildElementTextContents
#//--------------------------------------------------------------------------------------------------
#
# Given <FOOPY><NERD>Hi!</NERD></FOOPY>, where $node is <FOOPY>,
# returns "Hi!". If > 1 <NERD> node, returns the contents of the first.
#
sub getChildElementTextContents($$)
{
my($node, $tag_name) = @_;
my $first_element = getFirstChildElement($node, $tag_name);
my $text_node = $first_element->getFirstChild();
my $text_contents = "";
# concat adjacent text nodes
while ($text_node)
{
if ($text_node->getNodeTypeName() ne "TEXT_NODE")
{
last;
}
$text_contents = $text_contents.$text_node->getData();
$text_node = $text_node->getNextSibling();
}
return $text_contents;
}
#//--------------------------------------------------------------------------------------------------
#// setChildElementTextContents
#//--------------------------------------------------------------------------------------------------
sub setChildElementTextContents($$$$)
{
my($doc, $node, $tag_name, $contents_text) = @_;
my $first_element = getFirstChildElement($node, $tag_name);
my $new_text_node = $doc->createTextNode($contents_text);
# replace all child elements with a text element
removeAllChildren($first_element);
$first_element->appendChild($new_text_node);
}
#//--------------------------------------------------------------------------------------------------
#// getChildNodeByContents
#//
#// Consider <foo><bar><baz>Foopy</baz></bar><bar><baz>Loopy</baz></bar></foo>
#// This function, when called with getChildNodeByContents($foonode, "bar", "baz", "Loopy")
#// returns the second <bar> node.
#//--------------------------------------------------------------------------------------------------
sub getChildNodeByGrandchildContents($$$$$)
{
my($doc, $node, $child_type, $gc_type, $gc_contents) = @_; # gc = grandchild
my $found_node;
my $child_node = $node->getFirstChild();
while ($child_node)
{
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
$child_node->getTagName() eq $child_type)
{
# check for a child of this node of type
my $child_contents = getChildElementTextContents($child_node, $gc_type);
if ($child_contents eq $gc_contents)
{
$found_node = $child_node;
last;
}
}
$child_node = $child_node->getNextSibling();
}
return $found_node;
}
#//--------------------------------------------------------------------------------------------------
#// getTargetNode
#//--------------------------------------------------------------------------------------------------
sub getTargetNode($$)
{
my($doc, $target_name) = @_;
my $targetlist_node = getChildOfDocument($doc, "TARGETLIST");
return getChildNodeByGrandchildContents($doc, $targetlist_node, "TARGET", "NAME", $target_name);
}
#//--------------------------------------------------------------------------------------------------
#// getTargetNamedSettingNode
#//--------------------------------------------------------------------------------------------------
sub getTargetNamedSettingNode($$)
{
my($target_node, $setting_name) = @_;
my $setting_node;
my $settinglist_node = getFirstChildElement($target_node, "SETTINGLIST");
my $child_node = $settinglist_node->getFirstChild();
while ($child_node)
{
if ($child_node->getNodeTypeName ne "ELEMENT_NODE")
{
$child_node = $child_node->getNextSibling();
next;
}
if ($child_node->getTagName() eq "SETTING")
{
my $set_name = getChildElementTextContents($child_node, "NAME");
if ($set_name eq $setting_name)
{
$setting_node = $child_node;
last;
}
}
$child_node = $child_node->getNextSibling();
}
return $setting_node;
}
#//--------------------------------------------------------------------------------------------------
#// getTargetNodeSetting
#//--------------------------------------------------------------------------------------------------
sub getTargetNodeSetting($$)
{
my($target_node, $setting_name) = @_;
my $setting_node = getTargetNamedSettingNode($target_node, $setting_name);
return getChildElementTextContents($setting_node, "VALUE");
}
#//--------------------------------------------------------------------------------------------------
#// setTargetNodeSetting
#//--------------------------------------------------------------------------------------------------
sub setTargetNodeSetting($$$$)
{
my($doc, $target_node, $setting_name, $new_value) = @_;
my $setting_node = getTargetNamedSettingNode($target_node, $setting_name);
setChildElementTextContents($doc, $setting_node, "VALUE", $new_value);
}
#//--------------------------------------------------------------------------------------------------
#// elementInArray
#//--------------------------------------------------------------------------------------------------
sub elementInArray($$)
{
my($element, $array) = @_;
my $test;
foreach $test (@$array)
{
if ($test eq $element) {
return 1;
}
}
return 0;
}
#//--------------------------------------------------------------------------------------------------
#// removeAllChildren
#//--------------------------------------------------------------------------------------------------
sub removeAllChildren($)
{
my($node) = @_;
my $child_node = $node->getFirstChild();
while ($child_node)
{
$node->removeChild($child_node);
$child_node = $node->getFirstChild();
}
}
#//--------------------------------------------------------------------------------------------------
#// dumpNodeData
#//--------------------------------------------------------------------------------------------------
sub dumpNodeData($)
{
my($node) = @_;
unless ($node) { die "Null node passed to dumpNodeData\n"; }
print "Dumping node $node\n";
my($node_type) = $node->getNodeTypeName();
if ($node_type eq "ELEMENT_NODE")
{
my($node_name) = $node->getTagName();
print "Element $node_name\n";
}
elsif ($node_type eq "TEXT_NODE")
{
my($node_data) = $node->getData;
# my(@node_vals) = unpack("C*", $node_data);
print "Text '$node_data'\n"; # may contain LF chars
}
else
{
print "Node $node_type\n";
}
}
#//--------------------------------------------------------------------------------------------------
#// dumpNodeTree
#//--------------------------------------------------------------------------------------------------
sub dumpNodeTree($)
{
my($node) = @_;
my($child_node) = $node->getFirstChild();
unless ($child_node) { return; }
# recurse
dumpNodeData($child_node);
# then go through child nodes
while ($child_node)
{
dumpNodeTree($child_node);
$child_node = $child_node->getNextSibling();
}
}
1;

View File

@@ -1,90 +0,0 @@
#-------------------------------------------------------------------------------
# These 3 lists are the 'master lists' to control what gets built.
#
# Ordering in these arrays is important; it has to reflect the order in
# which the build occurs.
#
# Setting containing spaces must be quoted with double quotes.
#-------------------------------------------------------------------------------
build_flags
all 1
pull 0
dist 0
config 0
xpidl 0
idl 0
stubs 0
runtime 0
common 0
imglib 0
libimg2 0
necko 0
security 0
browserutils 0
intl 0
nglayout 0
accessiblity 0
editor 0
embedding 0
viewer 0
xpapp 0
extensions 0
plugins 0
mailnews 0
apprunner 0
resources 0
options_flags
pull_by_date 0
chrome_jars 1
chrome_files 0
use_jars 1
transformiix 1
mathml 0 MOZ_MATHML
svg 0 MOZ_SVG
# svg requires libart, which is an lgpl library. You need to pull it
# explicitly.
libart_lgpl 0
mng 1
ldap 1 MOZ_LDAP_XPCOM
ldap_experimental 0 MOZ_LDAP_XPCOM_EXPERIMENTAL
xmlextras 1
wsp 0 MOZ_WSP
inspector 1
mailextras 1
xptlink 0
psm 0 MOZ_PSM
embedding_test 1
embedding_chrome 0
embedding_xulprefs 0
embedding_xulsecurity 0
carbon 0 TARGET_CARBON
useimg2 1 USE_IMG2
lowmem 0 MOZ_MAC_LOWMEM
accessible 1 ACCESSIBILITY
bidi 1 IBMBIDI
p3p 0
jsd 1
venkman 1
moz_logging 1 MOZ_LOGGING
chatzilla 1
content_packs 1
xml_rpc 1
cview 1
help 1
timeline 0 MOZ_TIMELINE
static_build 0 MOZ_STATIC_COMPONENT_LIBS
string_debug 0 DEBUG_STRING
string_stats 0 DEBUG_STRING_STATS
xpctools 0 XPC_TOOLS_SUPPORT
smime 1
mdn 1
print_preview 1 NS_PRINT_PREVIEW
moz_xul 1 MOZ_XUL
filepath_flags
idepath ":CodeWarrior IDE Path.txt"
sessionpath ":Mozilla session path.txt"
buildlogfilepath ":Build Logs:Mozilla build log.txt" # this is a path
scriptlogfilepath ":Build Logs:Mozilla script log.txt"

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +0,0 @@
# List of modules to check out. Format is
# module, (tag), (date)
# where tag and date are optional (non-trailing commas are required)
#
# Examples:
# mozilla/nsprpub, NSPRPUB_CLIENT_TAG
# mozilla/gc, , 10/25/2000 12:00:00
#
mozilla/nsprpub, NETSCAPE_7_0_RTM
mozilla/security/nss, NETSCAPE_7_0_RTM
mozilla/security/manager, NETSCAPE_7_0_RTM
mozilla/accessible, NETSCAPE_7_0_RTM
mozilla/directory/c-sdk, NETSCAPE_7_0_RTM
mozilla/lib/mac/Instrumentation, NETSCAPE_7_0_RTM
mozilla/gfx2, NETSCAPE_7_0_RTM
mozilla/modules/libpr0n, NETSCAPE_7_0_RTM
SeaMonkeyAll, NETSCAPE_7_0_RTM
## You need this if you want to be able to use SVG
## Note that this library is under the LGPL, not the MPL
#mozilla/other-licenses/libart_lgpl

View File

@@ -1,79 +0,0 @@
#!perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Simon Fraser <sfraser@netscape.com>
#
require 5.004;
use strict;
use Cwd;
use Moz::BuildUtils;
use Moz::BuildCore;
#-------------------------------------------------------------
# Where have the build options gone?
#
# The various build flags have been centralized into one place.
# The master list of options is in MozBuildFlags.txt. However,
# you should never need to edit that file, or this one.
#
# To customize what gets built, or where to start the build,
# edit the $prefs_file_name file in
# System Folder:Preferences:Mozilla build prefs:
# Documentation is provided in that file.
#-------------------------------------------------------------
my($prefs_file_name) = "Mozilla pull prefs";
#-------------------------------------------------------------
# hashes to hold build options
#-------------------------------------------------------------
my(%build);
my(%options);
my(%filepaths);
my(%optiondefines);
# Hash of input files for this build. Eventually, there will be
# input files for manifests, and projects too.
my(%inputfiles) = (
"buildflags", "MozillaBuildFlags.txt",
"checkoutdata", "MozillaCheckoutList.txt",
"buildprogress", "",
"buildmodule", "MozillaBuildList.pm",
"checkouttime", "Mozilla last checkout"
);
#-------------------------------------------------------------
# end build hashes
#-------------------------------------------------------------
# set the build root directory, which is the the dir above mozilla
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
# Set up all the flags on $main::, like DEBUG, CARBON etc.
# Override the defaults using the preferences files.
SetupDefaultBuildOptions(0, ":mozilla:dist:viewer:", "");
my($do_checkout) = 1;
my($do_build) = 0;
RunBuild($do_checkout, $do_build, \%inputfiles, $prefs_file_name);

View File

@@ -1,511 +0,0 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=.
!if !defined(MOZ_TOP)
#enable builds from changed top level directories
MOZ_TOP=mozilla
!endif
MOZ_SRC_FLIPPED = $(MOZ_SRC:\=/)
MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mozilla/dist
!ifdef MOZ_DEBUG
MOZ_OBJDIR = WIN32_D.OBJ
!else
MOZ_OBJDIR = WIN32_O.OBJ
!endif
#
# Command macro defines
#
#//------------------------------------------------------------------------
#// Figure out how to do the pull.
#//------------------------------------------------------------------------
# uncomment these, modify branch tag, and check in to branch for milestones
MOZ_BRANCH=NETSCAPE_7_0_RTM
NSPR_CO_TAG=NETSCAPE_7_0_RTM
PSM_CO_TAG=NETSCAPE_7_0_RTM
NSS_CO_TAG=NETSCAPE_7_0_RTM
LDAPCSDK_CO_TAG=NETSCAPE_7_0_RTM
ACCESSIBLE_CO_TAG=NETSCAPE_7_0_RTM
IMGLIB2_CO_TAG=NETSCAPE_7_0_RTM
GFX2_CO_TAG=NETSCAPE_7_0_RTM
!ifdef MOZ_BRANCH
CVS_BRANCH=-r $(MOZ_BRANCH)
!endif
!ifdef MOZ_DATE
CVS_BRANCH=$(CVS_BRANCH) -D "$(MOZ_DATE)"
!endif
# default pull is "quiet" but it can be overridden with MOZ_CVS_VERBOSE
!ifndef MOZ_CVS_VERBOSE
CVS_FLAGS=-q
!endif
# honor any user-defined CVS flags
!ifdef MOZ_CVS_FLAGS
CVS_FLAGS=$(CVS_FLAGS) $(MOZ_CVS_FLAGS)
!endif
# let's be explicit about CVSROOT... some windows cvs clients
# are too stupid to correctly work without the -d option
#
# if they are too stupid, they should fail. I am
# commenting this out because this does not work
# under 4nt. (%'s are evaluted differently)
#
# If it breaks you, mail dougt@netscape.com
# and leaf@mozilla.org
#
!if 0
!if defined(CVSROOT)
CVS_FLAGS=$(CVS_FLAGS) -d "$(CVSROOT)"
!endif
!endif
!ifndef MOZ_CO_FLAGS
MOZ_CO_FLAGS = -P
!endif
CVSCO = cvs $(CVS_FLAGS) co $(MOZ_CO_FLAGS) $(CVS_BRANCH)
#//------------------------------------------------------------------------
#// Figure out how to pull NSPR.
#// If no NSPR_CO_TAG is specified, use the default static tag
#//------------------------------------------------------------------------
!ifndef NSPR_CO_FLAGS
NSPR_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
NSPR_CO_FLAGS=$(NSPR_CO_FLAGS) $(CVS_BRANCH)
CVSCO_NSPR = cvs $(CVS_FLAGS) co $(NSPR_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull NSS and PSM libs.
#// If no NSS_CO_TAG or PSM_CO_TAG is specified, use the default static tag
#//------------------------------------------------------------------------
!ifndef NSS_CO_FLAGS
NSS_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
NSS_CO_FLAGS=$(NSS_CO_FLAGS) $(CVS_BRANCH)
CVSCO_NSS = cvs $(CVS_FLAGS) co $(NSS_CO_FLAGS)
!ifndef PSM_CO_FLAGS
PSM_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
PSM_CO_FLAGS=$(PSM_CO_FLAGS) $(CVS_BRANCH)
CVSCO_PSM = cvs $(CVS_FLAGS) co $(PSM_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull LDAP C SDK client libs.
#// If no LDAPCSDK_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!ifndef LDAPCSDK_CO_FLAGS
LDAPCSDK_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
LDAPCSDK_CO_FLAGS=$(LDAPCSDK_CO_FLAGS) $(CVS_BRANCH)
CVSCO_LDAPCSDK = cvs $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull accessibility libs.
#// If no ACCESSIBLE_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!ifndef ACCESSIBLE_CO_FLAGS
ACCESSIBLE_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
ACCESSIBLE_CO_FLAGS=$(ACCESSIBLE_CO_FLAGS) $(CVS_BRANCH)
CVSCO_ACCESSIBLE = cvs $(CVS_FLAGS) co $(ACCESSIBLE_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull new image library.
#// If no IMGLIB2_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!ifndef IMGLIB2_CO_FLAGS
IMGLIB2_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
IMGLIB2_CO_FLAGS=$(IMGLIB2_CO_FLAGS) $(CVS_BRANCH)
CVSCO_IMGLIB2 = cvs $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull new image library.
#// If no GFX2_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!ifndef GFX2_CO_FLAGS
GFX2_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
GFX2_CO_FLAGS=$(GFX2_CO_FLAGS) $(CVS_BRANCH)
CVSCO_GFX2 = cvs $(CVS_FLAGS) co $(GFX2_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull the internal libart
#// (only pulled and built if MOZ_INTERNAL_LIBART_LGPL is set)
#// If no MOZ_INTERNAL_LIBART_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!if defined(MOZ_SVG) && !defined(MOZ_INTERNAL_LIBART_LGPL)
ERR_MESSAGE = ^
You are trying to build Mozilla with SVG support (MOZ_SVG=1), but you ^
haven not specified that mozilla/other-licenses/libart_lgpl should be ^
pulled and built. At the moment Mozilla SVG builds need this patched ^
version of libart. You either need to disable SVG support (unset MOZ_SVG) ^
or enable pulling and building by setting MOZ_INTERNAL_LIBART_LGPL=1.^
^
If you choose to pull and build libart, note that it is only licensed^
under the terms of the LGPL, not the MPL. (Which is why you have to opt^
in explicitly.)
!endif
!if defined(MOZ_INTERNAL_LIBART_LGPL)
!ifndef MOZ_INTERNAL_LIBART_CO_FLAGS
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
!if "$(MOZ_INTERNAL_LIBART_CO_TAG)" != ""
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_INTERNAL_LIBART_CO_FLAGS) -r $(MOZ_INTERNAL_LIBART_CO_TAG)
!else
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_INTERNAL_LIBART_CO_FLAGS) $(CVS_BRANCH)
!endif
CVSCO_MOZ_INTERNAL_LIBART = cvs $(CVS_FLAGS) co $(MOZ_INTERNAL_LIBART_CO_FLAGS)
!endif
## The master target
############################################################
pull_and_build_all: pull_all build_all_dep
## Rules for pulling the source from the cvs repository
############################################################
pull_clobber_and_build_all: pull_all clobber_all build_all
!if !defined(MOZ_INTERNAL_LIBART_LGPL)
pull_all: pull_nspr pull_psm pull_ldapcsdk pull_accessible pull_gfx2 pull_imglib2 pull_seamonkey
!else
pull_all: pull_nspr pull_psm pull_ldapcsdk pull_accessible pull_gfx2 pull_imglib2 pull_moz_internal_libart pull_seamonkey
!endif
pull_nspr: pull_clientmak
cd $(MOZ_SRC)\.
$(CVSCO_NSPR) mozilla/nsprpub
pull_nss:
cd $(MOZ_SRC)\.
$(CVSCO_NSS) mozilla/security/coreconf
$(CVSCO_NSS) mozilla/security/nss
pull_psm: pull_nss
cd $(MOZ_SRC)\.
$(CVSCO_PSM) mozilla/security/manager
$(CVSCO_PSM) mozilla/security/makefile.win
pull_ldapcsdk:
cd $(MOZ_SRC)\.
$(CVSCO_LDAPCSDK) mozilla/directory/c-sdk
pull_accessible:
cd $(MOZ_SRC)\.
$(CVSCO_ACCESSIBLE) mozilla/accessible
pull_gfx2:
cd $(MOZ_SRC)\.
$(CVSCO_GFX2) mozilla/gfx2
pull_imglib2:
cd $(MOZ_SRC)\.
$(CVSCO_IMGLIB2) mozilla/modules/libpr0n
!if defined(MOZ_INTERNAL_LIBART_LGPL)
pull_moz_internal_libart:
cd $(MOZ_SRC)\.
$(CVSCO_MOZ_INTERNAL_LIBART) mozilla/other-licenses/libart_lgpl
!endif
pull_xpconnect: pull_nspr
cd $(MOZ_SRC)\.
$(CVSCO) mozilla/include
$(CVSCO) mozilla/config
$(CVSCO) -l mozilla/js
$(CVSCO) -l mozilla/js/src
$(CVSCO) mozilla/js/src/fdlibm
$(CVSCO) mozilla/js/src/xpconnect
$(CVSCO) mozilla/modules/libreg
$(CVSCO) mozilla/xpcom
$(CVSCO) mozilla/string
# pull either layout only or seamonkey the browser
pull_layout:
cd $(MOZ_SRC)\.
$(CVSCO) RaptorWin
pull_seamonkey: pull_clientmak
cd $(MOZ_SRC)\.
$(CVSCO) SeaMonkeyAll
pull_clientmak:
cd $(MOZ_SRC)\.
$(CVSCO) mozilla/client.mak
############################################################
# nmake has to be hardcoded, or we have to depend on mozilla/config
# being pulled already to figure out what $(NMAKE) should be.
clobber_all: clobber_nspr clobber_ldapcsdk clobber_psm clobber_seamonkey
build_all: build_nspr build_ldapcsdk build_seamonkey
build_all_dep: depend libs
distclean:
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
gmake -f gmakefile.win distclean MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win distclean MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
@cd $(MOZ_SRC)\$(MOZ_TOP)
nmake /f client.mak clobber_psm
nmake /f client.mak clobber_seamonkey
clobber_ldapcsdk:
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED) \
SHELL=sh
clobber_nspr:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
clobber_psm:
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
nmake -f makefile.win clobber_all
clobber_xpconnect:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
-rd /s /q dist
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\js
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
nmake -f makefile.win clobber_all
clobber_seamonkey:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
-rd /s /q dist
nmake -f makefile.win clobber_all
depend: export
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
nmake -f makefile.win depend
depend_xpconnect:
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
nmake -f makefile.win depend
build_nspr:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
build_ldapcsdk:
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED) SHELL=sh
build_psm:
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
nmake -f makefile.win
build_xpconnect: build_nspr
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win export
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win libs
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
nmake -f makefile.win all
build_seamonkey:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
nmake -f makefile.win all
build_client:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win all
build_layout:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win all
build_dist:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win all
libs:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
nmake -f makefile.win libs
export: build_nspr build_ldapcsdk
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
nmake -f makefile.win export
clobber_dist:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win clobber_all
clobber_client:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win clobber_all
clobber_layout:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win clobber_all
browse_info::
cd $(MOZ_SRC)\$(MOZ_TOP)
-dir /s /b *.sbr > sbrlist.tmp
-bscmake /Es /o mozilla.bsc @sbrlist.tmp
-rm sbrlist.tmp
regchrome::
@cd $(MOZ_SRC)\mozilla\.
nmake /f makefile.win regchrome
deliver::
@cd $(MOZ_SRC)\mozilla\.
nmake /f makefile.win splitsymbols
#//------------------------------------------------------------------------
#// Utility stuff...
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
# Verify that MOZ_SRC is set correctly
#//------------------------------------------------------------------------
# Check to see if it is set at all
!if "$(MOZ_SRC)"==""
MOZ_SRC = $(MAKEDIR)\..
!endif
#
# create a temp file at the root and make sure it is visible from MOZ_SRC
#
!if [copy $(MAKEDIR)\client.mak $(MAKEDIR)\xyzzy.tmp > NUL] == 0
!endif
!if !EXIST( $(MOZ_SRC)\mozilla\xyzzy.tmp )
ERR_MESSAGE=$(ERR_MESSAGE)^
MOZ_SRC isn't set correctly: [$(MOZ_SRC)\mozilla]!=[$(MAKEDIR)]
!endif
!if [del $(MAKEDIR)\xyzzy.tmp]
!endif
#//------------------------------------------------------------------------
# Verify that MOZ_BITS is set
#//------------------------------------------------------------------------
!if !defined(MOZ_BITS)
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_BITS isn't set.
!endif
!if !defined(MOZ_TOOLS)
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_TOOLS isn't set.
!endif
#//------------------------------------------------------------------------
#// Display error
#//------------------------------------------------------------------------
!if "$(ERR_MESSAGE)" != ""
ERR_MESSAGE = ^
client.mak: ^
$(ERR_MESSAGE) ^
^
client.mak: usage^
^
nmake -f client.mak [MOZ_BRANCH=<cvs_branch_name>] ^
[MOZ_DATE=<cvs_date>]^
[pull_and_build_all]^
[pull_all]^
[build_all]^
^
Environment variables:^
^
MOZ_BITS set to 32^
MOZ_TOOLS set to the directory containing the needed tools ^
!ERROR $(ERR_MESSAGE)
!endif

View File

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

3875
mozilla/cmd/winfe/fegui.cpp Executable file

File diff suppressed because it is too large Load Diff

2031
mozilla/cmd/winfe/nsapp.cpp Normal file

File diff suppressed because it is too large Load Diff

123
mozilla/cmd/winfe/stdafx.h Normal file
View File

@@ -0,0 +1,123 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef STDAFX_PCH
#define STDAFX_PCH
#define OEMRESOURCE
#if defined(DEBUG_blythe)
// Set up a flag specific to WFE developers in the client
#define DEBUG_WFE
#endif
/* Very windows specific includes.
*/
/* MFC, KFC, RUN DMC, whatever */
#include <afxwin.h>
#include <afxext.h>
#include <afxpriv.h>
#include <afxole.h>
#include <afxdisp.h>
#include <afxodlgs.h>
#ifdef _WIN32
#include <afxcmn.h>
#endif
/* More XP than anything */
#include "xp.h"
#include "fe_proto.h"
#include "fe_rgn.h"
#include "libi18n.h"
#include "xlate.h"
#include "ntypes.h"
#ifdef EDITOR
#include "edttypes.h"
#endif
#include "xpassert.h"
#include "lo_ele.h"
#include "layers.h"
/* Standard C includes */
#ifndef _WIN32
#include <dos.h>
#endif
#include <malloc.h>
#include <direct.h>
#include <stdarg.h>
#include <time.h>
#include <io.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#ifdef DEBUG
#include <assert.h>
#endif
/* Very windows specific includes.
*/
/* WFE needs a layout file */
extern "C" {
#include "layout.h"
}
/* Some common defines. */
#ifndef _AFXDLL
#define new DEBUG_NEW
#endif
/* All front end forward declarations needed to compile. */
#include "forward.h"
/* Front end Casting macros. */
#include "cast.h"
/* General purpose utilities. */
#include "feutil.h"
/* afxData/sysInfo */
#include "sysinfo.h"
/* Some defines we like everywhere. */
#include "resource.h"
#include "defaults.h"
/* The application include and
* Commonly used, rarely changed headers */
#include "ncapiurl.h"
#include "genedit.h"
#include "genframe.h"
#include "genview.h"
#include "gendoc.h"
#include "intlwin.h"
#include "mozilla.h"
#include "cxwin.h"
#include "winproto.h"
#ifdef DEBUG
#ifdef assert
#undef assert
#endif
#define assert(x) ASSERT(x)
#endif
#endif /* STDAFX_PCH */

22
mozilla/include/Makefile Normal file
View File

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

664
mozilla/include/abcom.h Normal file
View File

@@ -0,0 +1,664 @@
/* -*- Mode: C; tab-width: 8; 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 _AB_COM_H_
#define _AB_COM_H_
#include "xp_core.h"
#include "msgcom.h"
#include "abdefn.h"
#include "dirprefs.h"
#ifdef XP_CPLUSPLUS
class AB_Pane;
class AB_ContainerPane;
class AB_ContainerInfo;
class AB_MailingListPane;
class AB_PersonPane;
#else
typedef struct AB_Pane AB_Pane;
typedef struct AB_ContainerPane AB_ContainerPane;
typedef struct AB_ContainerInfo AB_ContainerInfo;
typedef struct AB_MailingListPane AB_MailingListPane;
typedef struct AB_PersonPane AB_PersonPane;
#endif
XP_BEGIN_PROTOS
#define AB_API extern "C"
#if defined(XP_MAC)
#define FE_IMPLEMENTS_SHOW_PROPERTY_SHEET
#endif
const ABID AB_ABIDUNKNOWN = 0; /* Find a better home for this somewhere! */
/* new errors added by mscott for the 2 pane AB UI. I will eventually name this enumerated type AB_Error */
enum
{
AB_SUCCESS = 0,
AB_FAILURE,
AB_INVALID_PANE,
AB_INVALID_CONTAINER,
AB_INVALID_ATTRIBUTE,
AB_OUT_OF_MEMORY
};
/* these are the types of possible containers */
typedef enum
{
AB_LDAPContainer,
AB_MListContainer, /* a mailing list */
AB_PABContainer /* a personal AB */
} AB_ContainerType;
/* AB_ContainerAttributes define the types of information FEs can ask the BE about
a AB_ContainerInfo in the ABContainerPane. */
typedef enum
{
attribContainerType, /* mailing list? LDAP directory? PAB? */
attribName, /* the name for the container */
attribNumChildren, /* how many child containers does this container have? */
attribDepth, /* container depth in the overall hierarchy. 0 == root ctr, 1 == one level below a root container, etc. */
attribContainerInfo /* FEs might want to get the container Info * for a line in the container pane */
} AB_ContainerAttribute;
typedef struct AB_ContainerAttribValue
{
AB_ContainerAttribute attrib; /* used to determine value of the union */
union{
char * string;
int32 number; /* used by numchildren & depth */
AB_ContainerType containerType;
AB_ContainerInfo * container;
} u;
} AB_ContainerAttribValue;
typedef enum
{
AB_Drag_Not_Allowed = 0x00000000,
AB_Require_Copy = 0x00000001,
AB_Require_Move = 0x00000002,
AB_Default_Drag = 0xFFFFFFFF
} AB_DragEffect;
typedef enum
{
AB_attribUnknown = 0, /* unrecognized attribute */
AB_attribEntryType, /* mailing list or person entry */
AB_attribEntryID,
AB_attribFullName,
AB_attribNickName,
AB_attribGivenName, /* all of the following are person entry specific */
AB_attribMiddleName,
AB_attribFamilyName,
AB_attribCompanyName,
AB_attribLocality,
AB_attribRegion,
AB_attribEmailAddress,
AB_attribInfo,
AB_attribHTMLMail,
AB_attribExpandedName,
AB_attribTitle,
AB_attribPOAddress,
AB_attribStreetAddress,
AB_attribZipCode,
AB_attribCountry,
AB_attribWorkPhone,
AB_attribFaxPhone,
AB_attribHomePhone,
AB_attribDistName,
AB_attribSecurity,
AB_attribCoolAddress,
AB_attribUseServer,
AB_attribPager,
AB_attribCellularPhone,
AB_attribDisplayName,
AB_attribWinCSID, /* character set id */
AB_attribOther /* any attrib with this value or higher is always a string type (our dyanmic attributes) */
} AB_AttribID;
/* WARNING!!! WILL BE PHASING THIS STRUCTURE OUT!!!! */
typedef struct AB_EntryAttributeItem{
AB_AttribID id;
char * description; /* resource string specifying a user-readable descript for the attrib i.e. "First Name" */
XP_Bool sortable; /* is this attribute sortable? (may help FEs display the column if they know if it can be sorted or not */
}AB_EntryAttributeItem;
typedef enum{
AB_MailingList = 0,
AB_Person
} AB_EntryType;
typedef struct AB_AttributeValue
{
AB_AttribID attrib; /* we need this to know how to read the union */
union{
char * string;
XP_Bool boolValue;
AB_EntryType entryType; /* mailing list or person entry */
int16 shortValue; /* use for server type or WinCSID field */
} u;
} AB_AttributeValue;
/* New Column ID structure used to abstract the columns in the AB_Pane used by the FEs from the attributes thos columns actually
represent. */
typedef enum{
AB_ColumnID0 = 0,
AB_ColumnID1,
AB_ColumnID2,
AB_ColumnID3,
AB_ColumnID4,
AB_ColumnID5,
AB_ColumnID6,
AB_NumberOfColumns /* make sure this is always the last one!! */
} AB_ColumnID;
typedef struct AB_ColumnInfo{
AB_AttribID attribID; /* the attrib ID this column is displaying */
char * displayString; /* column display string */
XP_Bool sortable; /* is this column attribute sortable? i.e. phone number is not! */
} AB_ColumnInfo;
/**********************************************************************************************
FE Call back functions. We'll show the types here...NOTE: FEs must now register their call back
functions through these APIs so the back end knows which return to use.
*********************************************************************************************/
/* FEs must register this function with the appropriate pane, it is called by the back end in
response to the following commands: AB_PropertiesCmd, AB_AddUserCmd, AB_AddMailingListCmd */
/* typedef int AB_ShowPropertySheetForEntryFunc (MSG_Pane * pane, AB_EntryType entryType); */
typedef int AB_ShowPropertySheetForEntryFunc (MSG_Pane * pane, MWContext * context);
int AB_SetShowPropertySheetForEntryFunc(
MSG_Pane * abPane,
AB_ShowPropertySheetForEntryFunc * func);
/* BE sets the type for the DIR_Server and hands it to the FEs to be displayed & filled out in a
pane. It is called by the back end in response to the following commands: AB_PropertiesCmd,
AB_NewLDAPDirectory, AB_NewAddressBook. */
typedef int AB_ShowPropertySheetForDirFunc(DIR_Server * server, MWContext * context, XP_Bool newDirectory /* is it a new directory? */);
int AB_SetShowPropertySheetForDirFunc(
MSG_Pane * abcPane, /* container pane */
AB_ShowPropertySheetForDirFunc * func);
/***************************************************************************************
DON'T USE THIS FUNCTION!!!! THIS WILL BE PHASING OUT!!!!!! #mscott 01/21/98
This is a callback into the FE instructing them to bring up a person entry pane or a
mailing list pane. The back end has already created the pane. A type is included to let the FE
determine if the pane is a mailing list or person entry pane. In addition, in the case of a mailing list
pane, the FE must still initialize the mailing list pane before it can be used
***************************************************************************************/
#ifdef FE_IMPLEMENTS_SHOW_PROPERTY_SHEET
extern int FE_ShowPropertySheetForAB2(
MSG_Pane * pane, /* BE created mailing list or person entry pane */
AB_EntryType entryType); /* mailing list or person entry */
#endif
/***************************************************************************************
None pane-specific APIs. These function work on many panes
***************************************************************************************/
int AB_ClosePane(MSG_Pane * pane);
/****************************************************************************************
Address Book Pane General APIs - creating, initializing, closing, changing containers,
searching, etc.
*****************************************************************************************/
int AB_CreateABPane(
MSG_Pane ** abPane,
MWContext * context,
MSG_Master * master);
int AB_InitializeABPane(
MSG_Pane * abPane,
AB_ContainerInfo * abContainer);
/* to change the container the abPane is currently displaying */
int AB_ChangeABContainer(
MSG_Pane * abPane,
AB_ContainerInfo * container); /* the new containerInfo to display */
int AB_GetEntryIndex(
MSG_Pane * abPane,
ABID id, /* entry id in the database */
MSG_ViewIndex * index); /* FE allocated, BE fills with index */
int AB_GetABIDForIndex(
MSG_Pane * abPane,
MSG_ViewIndex index,
ABID * id); /* FE allocated. BE fills with the id you want */
int AB_SearchDirectoryAB2(
MSG_Pane * abPane,
char * searchString);
int AB_LDAPSearchResultsAB2(
MSG_Pane * abPane,
MSG_ViewIndex index,
int32 num);
int AB_FinishSearchAB2(MSG_Pane * abPane);
int AB_CommandAB2(
MSG_Pane * srcPane, /* NOTE: this can be a ABpane or an ABContainerPane!!! you can delete containers & entries */
AB_CommandType command, /* delete or mailto are the only currently supported commands */
MSG_ViewIndex * indices,
int32 numIndices);
int AB_CommandStatusAB2(
MSG_Pane * srcPane, /* NOTE: Can be an ABPane or an ABContainerPane!! */
AB_CommandType command,
MSG_ViewIndex * indices,
int32 numIndices,
XP_Bool * selectable_p,
MSG_COMMAND_CHECK_STATE * selected_p,
const char ** displayString,
XP_Bool * plural_p);
/* still need to add registering and unregistering compose windows */
/****************************************************************************************
AB_ContainerInfo General APIs - adding users and a sender. Doesn't require a pane.
*****************************************************************************************/
int AB_AddUserAB2(
AB_ContainerInfo * abContainer, /* the container to add the person to */
AB_AttributeValue * values, /* FE defined array of attribute values for the new user. FE must free this array */
uint16 numItems,
ABID * entryID); /* BE returns the ABID for this new user */
int AB_AddUserWithUIAB2(
AB_ContainerInfo * abContainer,
AB_AttributeValue * values,
uint16 numItems,
XP_Bool lastOneToAdd);
int AB_AddSenderAB2(
AB_ContainerInfo * abContainer,
char * author,
char * url);
/****************************************************************************************
Drag and Drop Related APIs - vcards, ab lines, containers, etc.
*****************************************************************************************/
int AB_DragEntriesIntoContainer(
MSG_Pane * srcPane, /* could be an ABPane or ABCPane */
const MSG_ViewIndex * srcIndices, /* indices of items to be dragged */
int32 numIndices,
AB_ContainerInfo * destContainer,
AB_DragEffect request); /* copy or move? */
/* FE's should call this function to determine if the drag & drop they want to perform is
valid or not. I would recommend calling it before the FE actually performs the drag & drop call */
AB_DragEffect AB_DragEntriesIntoContainerStatus(
MSG_Pane * abPane,
const MSG_ViewIndex * indices,
int32 numIndices,
AB_ContainerInfo * destContainer,
AB_DragEffect request); /* do you want to do a move? a copy? default drag? */
/****************************************************************************************
Importing and Exporting - ABs from files, vcards...
*****************************************************************************************/
typedef enum
{
AB_Filename, /* char * in import and export APIs contain an FE allocated/freed filename */
AB_PromptForFileName, /* prompt for file name on import or export */
AB_Vcard,
AB_CommaList, /* comma separated list of email addresses */
AB_RawData /* we don't know what it is, will try to extract email addresses */
} AB_ImportExportType;
int AB_ImportData(
AB_ContainerInfo * destContainer,
const char * buffer, /* could be a filename or NULL (if type = prompt for filename) or a block of data to be imported */
int32 bufSize, /* how big is the buffer? */
AB_ImportExportType dataType); /* valid types: All */
/* returns TRUE if the container accepts imports of the data type and FALSE otherwise */
XP_Bool AB_ImportDataStatus(
AB_ContainerInfo * destContainer,
AB_ImportExportType dataType);
/* exporting always occurs to a file unless the data type is vcard. Only valid export data types are: vcard,
filename, prompt for filename */
int AB_ExportData(
AB_ContainerInfo * srcContainer,
char ** buffer, /* filename or NULL. Or if type = Vcard, the BE allocated vcard. FE responosible for freeing it?? */
int32 * bufSize, /* ignored unless VCard is data type in which case FE allocates, BE fills */
AB_ImportExportType dataType); /* valid types: filename, prompt for filename, vcard */
/****************************************************************************************
ABContainer Pane --> Creation, Loading, getting line data for each container.
*****************************************************************************************/
int AB_CreateContainerPane(
MSG_Pane ** abContainerPane, /* BE will pass back ptr to pane through this */
MWContext * context,
MSG_Master * master);
int AB_InitializeContainerPane(MSG_Pane * abContainerPane);
/* this will return MSG_VIEWINDEXNONE if the container info is not in the pane */
MSG_ViewIndex AB_GetIndexForContainer(
MSG_Pane * abContainerPane,
AB_ContainerInfo * container); /* container you want the index for */
/* this will return NULL if the index is invalid */
AB_ContainerInfo * AB_GetContainerForIndex(
MSG_Pane * abContainerPane,
const MSG_ViewIndex index);
/* the following set of APIs support getting/setting container pane line data out such as the container's
name, type, etc. We are going to try a particular discipline for memory management of AB_ContainerAttribValues.
For APIs which get an attribute value, the BE will actually allocate the struct. To free the space, the FE should
call AB_FreeContainerAttribValue. For any API which sets an attribute value, the FE is responsible for allocating and
de-allocating the data. */
int AB_GetContainerAttributeForPane(
MSG_Pane * abContainerPane,
MSG_ViewIndex index, /* index of container you want information for */
AB_ContainerAttribute attrib, /* attribute FE wants to know */
AB_ContainerAttribValue ** value); /* BE allocates struct. FE should call AB_FreeContainerAttribValue to free space when done */
int AB_SetContainerAttributeForPane(
MSG_Pane * abContainerPane,
MSG_ViewIndex index,
AB_ContainerAttribValue * value); /* FE handles all memory allocation! */
int AB_GetContainerAttribute(
AB_ContainerInfo * ctr,
AB_ContainerAttribute attrib,
AB_ContainerAttribValue ** value); /* BE allocates struct. FE should call AB_FreeContainerAttribValue to free space when donee */
int AB_SetContainerAttribute(
AB_ContainerInfo * ctr,
AB_ContainerAttribValue * value); /* FE handles all memory allocateion / deallocation! */
int AB_GetContainerAttributes(
AB_ContainerInfo * ctr,
AB_ContainerAttribute * attribsArray,
AB_ContainerAttribValue ** valuesArray,
uint16 * numItems);
int AB_SetContainerAttributes(
AB_ContainerInfo * ctr,
AB_ContainerAttribValue * valuesArray,
uint16 numItems);
/* getting and setting multiple container attributes on a per container pane basis */
int AB_GetContainerAttributesForPane(
MSG_Pane * abContainerPane,
MSG_ViewIndex index,
AB_ContainerAttribute * attribsArray,
AB_ContainerAttribValue ** valuesArray,
uint16 * numItems);
int AB_SetContainerAttributesForPane(
MSG_Pane * abContainerPane,
MSG_ViewIndex index,
AB_ContainerAttribValue * valuesArray,
uint16 numItems);
int AB_FreeContainerAttribValue(AB_ContainerAttribValue * value); /* BE will free the attribute value */
int AB_FreeContainerAttribValues(AB_ContainerAttribValue * valuesArray, uint16 numItems);
XP_Bool AB_IsStringContainerAttribValue(AB_ContainerAttribValue * value); /* use this to determine if your attrib is a string attrib */
/* Use the following two functions to build the combo box in the Address Window of all the root level containers.
You first ask for the number of root level (PABs and LDAP directories). Use this number to allocate an array of
AB_ContainerInfo ptrs. Give this array to the back end and we will fill it. FE can destroy array when done with it.
FE shoud NOT be deleting the individual AB_ContainerInfo ptrs. */
int AB_GetNumRootContainers(
MSG_Pane * abContainerPane,
int32 * numRootContainers);
int AB_GetOrderedRootContainers(
MSG_Pane * abContainerPane,
AB_ContainerInfo ** ctrArray, /* FE Allocated & Freed */
int32 * numCtrs); /* in - # of elements in ctrArray. out - BE fills with # root containers stored in ctrArray */
/* sometimes you want to get a handle on the DIR_Sever for a particular container. Both return NULL if for some
reason there wasn't a DIR_Server. If the container is a mailing list, returns DIR_Server of the PAB the list is in.
NOTE: If you modify any of the DIR_Server properties, you should call AB_UpdateDIRServerForContainer to make sure that the container
(and hence any pane views on the container) are updated */
DIR_Server * AB_GetDirServerForContainer(AB_ContainerInfo * container);
/* Please don't call this function. It is going away!!! Use AB_UpdateDirServerForContainerPane instead!! */
int AB_UpdateDIRServerForContainer(AB_ContainerInfo * container);
/* will create a new container in the container pane if the directory does not already exist. Otherwise updates the
directory's container in the pane */
int AB_UpdateDIRServerForContainerPane(
MSG_Pane * abContainerPane,
DIR_Server * directory);
/*******************************************************************************************************************
Old Column Header APIs. These will be phased out!!! Please don't use them
******************************************************************************************************************/
int AB_GetNumEntryAttributesForContainer(
AB_ContainerInfo * container,
uint16 * numItems); /* BE will fill this integer with the number of available attributes for the container */
int AB_GetEntryAttributesForContainer(
AB_ContainerInfo * container,
AB_EntryAttributeItem * items, /* FE allocated array which BE fills with values */
uint16 * maxItems); /* FE passes in # elements allocated in array. BE returns # elements filled in array */
/********************************************************************************************************************
Our New Column Header APIs. We'll be phasing out AB_GetNumEntryAttributesForContainer and AB_GetEntryAttributesForContainer
********************************************************************************************************************/
AB_ColumnInfo * AB_GetColumnInfo(
AB_ContainerInfo * container,
AB_ColumnID columnID);
int AB_GetNumColumnsForContainer(AB_ContainerInfo * container);
int AB_GetColumnAttribIDs(
AB_ContainerInfo * container,
AB_AttribID * attribIDs, /* FE allocated array of attribs. BE fills with values */
int * numAttribs); /* FE passes in # elements allocated in array. BE returns # elements filled */
int AB_FreeColumnInfo(AB_ColumnInfo * columnInfo);
/****************************************************************************************
AB Pane List Data -> how to get ab pane line attributes such as name, address, phone, etc.
*****************************************************************************************/
/* to actually get an entry attribute */
int AB_GetEntryAttributeForPane(
MSG_Pane * abPane,
MSG_ViewIndex index,
AB_AttribID attrib, /* what attribute do you want? */
AB_AttributeValue ** valueArray); /* BE handles memory allocation. FE must call AB_FreeEntryAttributeValue when done */
int AB_GetEntryAttribute(
AB_ContainerInfo * container,
ABID entryid, /* an identifier or key used to name the object in the container */
AB_AttribID attrib, /* attribute type the FE wants to know */
AB_AttributeValue ** valueArray); /* BE handles memory allocation. FE must call AB_FreeEntryAttributeValue when done */
int AB_SetEntryAttribute(
AB_ContainerInfo * container,
ABID entryid, /* an identifier or key used to name the object in the container */
AB_AttributeValue * value); /* FE handles all memory allocation */
int AB_SetEntryAttributeForPane(
MSG_Pane * abPane,
MSG_ViewIndex index,
AB_AttributeValue * value); /* FE handles all memory allocation */
/* we also allow you to set entry attributes in batch by passing in an array of attribute values */
int AB_SetEntryAttributes(
AB_ContainerInfo * container,
ABID entryID,
AB_AttributeValue * valuesArray, /* FE allocated array of attribute values to set */
uint16 numItems); /* FE passes in # items in array */
int AB_SetEntryAttributesForPane(
MSG_Pane * abPane,
MSG_ViewIndex index,
AB_AttributeValue * valuesArray,
uint16 numItems);
int AB_GetEntryAttributes(
AB_ContainerInfo * container,
ABID entryID,
AB_AttribID * attribs, /* FE allocated array of attribs that you want */
AB_AttributeValue ** values, /* BE allocates & fills an array of values for the input array of attribs */
uint16 * numItems); /* IN: size of attribs array. OUT: # of values in value array */
int AB_GetEntryAttributesForPane(
MSG_Pane * abPane,
MSG_ViewIndex index,
AB_AttribID * attribs, /* FE allocated array of attribs that you want */
AB_AttributeValue ** values,
uint16 * numItems);
/* Memory allocation APIs for setting/getting entry attribute values */
int AB_FreeEntryAttributeValue(AB_AttributeValue * value /* pointer to a value */);
int AB_FreeEntryAttributeValues(AB_AttributeValue * values /* array of values */, uint16 numItems);
int AB_CopyEntryAttributeValue(
AB_AttributeValue * srcValue, /* already allocated attribute value you want to copy from */
AB_AttributeValue * destValue); /* already allocated attribute value you want to copy into */
XP_Bool AB_IsStringEntryAttributeValue(AB_AttributeValue * value);
/****************************************************************************************
Sorting
*****************************************************************************************/
/* sorting by first name is a global setting. It is set per abPane and does not change
when you load a new container into the abPane */
XP_Bool AB_GetSortByFirstNameAB2(MSG_Pane * abPane); /* is the pane sorting by first name? */
void AB_SortByFirstNameAB2(
MSG_Pane * abPane,
XP_Bool sortByFirstName); /* true for sort by first, false for last first */
/* Insert our sort by column stuff here */
int AB_SortByAttribute(
MSG_Pane * abPane,
AB_AttribID id, /* attribute we want to sort by */
XP_Bool sortAscending);
int AB_GetPaneSortedByAB2(
MSG_Pane * abPane,
AB_AttribID * attribID); /* BE fills with the attribute we are sorting by */
XP_Bool AB_GetPaneSortedAscendingAB2(MSG_Pane * abPane);
/*****************************************************************************************
APIs for the Mailing List Pane. In addition to these, the mailing list pane responds to
previous AB APIs such as AB_Close, MSG_GetNumLines().
****************************************************************************************/
int AB_InitializeMailingListPaneAB2(MSG_Pane * mailingListPane);
AB_ContainerInfo * AB_GetContainerForMailingList(MSG_Pane * mailingListPane);
/* this could return ABID = 0 for a new entry that is not in the database */
ABID AB_GetABIDForMailingListIndex(
MSG_Pane * mailingListPane,
const MSG_ViewIndex index);
MSG_ViewIndex AB_GetMailingListIndexForABID(
MSG_Pane * mailingListPane,
ABID entryID); /* this function could return MSG_VIEWINDEXNONE if entryID = 0 or not in list */
/* Use these two APIs to get Mailing List ENTRY attributes (i.e. people or other mailing list attributes in this mailing list) */
int AB_SetMailingListEntryAttributes(
MSG_Pane * pane,
const MSG_ViewIndex index,
AB_AttributeValue * valuesArray, /* FE allocated array of attribute values you want to set */
uint16 numItems);
int AB_GetMailingListEntryAttributes(
MSG_Pane * mailingListPane,
const MSG_ViewIndex index,
AB_AttribID * attribs, /* FE allocated & freed array of attribs you want */
AB_AttributeValue ** values, /* BE allocates & fills values for the input array of attribs */
uint16 * numItems); /* FE provides # attribs in array. BE fills with # values returned in values */
/* Use these two APIs to Set and Get the Mailing List properties. */
int AB_GetMailingListAttributes(
MSG_Pane * mailingListPane,
AB_AttribID * attribs, /* FE allocated array of attribs */
AB_AttributeValue ** values, /* BE allocates & fills values. FE must call a free to the back end */
uint16 * numItems);
int AB_SetMailingListAttributes(
MSG_Pane * mailingListPane,
AB_AttributeValue * valuesArray, /* FE allocated array of attribute values you want to set */
uint16 numItems);
/*******************************************************************************************
APIs for the person entry pane aka the person property sheets. The person entry pane is created
by the back end and given to the front end in the call FE_ShowPropertySheetFor. In the current
incarnation, person atributes are set and retrieved through the person entry pane and NOT through
the AB_ContainerInfo the person is in. If you "cheat" and go through the container directly, you may
not be getting the correct information. When the person entry pane is committed, the changes are pushed
back into the container. During the commit process, if it is a new person then a new entry is made in the
database.
********************************************************************************************/
AB_ContainerInfo * AB_GetContainerForPerson(MSG_Pane * personPane);
ABID AB_GetABIDForPerson(MSG_Pane * personPane); /* could return 0 if new user */
/* get and set the person attributes here */
int AB_SetPersonEntryAttributes(
MSG_Pane * personPane,
AB_AttributeValue * valuesArray,
uint16 numItems);
int AB_GetPersonEntryAttributes(
MSG_Pane * personPane,
AB_AttribID * attribs, /* FE allocted & freed array of attribs they want */
AB_AttributeValue ** values, /* BE allocates & fills values */
uint16 * numItems); /* in - FE provides # of attribs. out - BE fills with # values */
int AB_CommitChanges(MSG_Pane * pane); /* commits changes to a mailing list pane or a person entry pane! */
XP_END_PROTOS
#endif /* _AB_COM_H */

200
mozilla/include/abdefn.h Normal file
View File

@@ -0,0 +1,200 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _ABDefn_H_
#define _ABDefn_H_
/* max lengths for address book fields */
const int kMaxFullNameLength = 256; /* common name */
const int kMaxNameLength = 64; /* given, middle, family */
const int kMaxCompanyLength = 128; /* company name */
const int kMaxLocalityLength = 128; /* city */
const int kMaxRegionLength = 128; /* state */
const int kMaxCountryLength = 128; /* state */
const int kMaxEmailAddressLength = 256;
const int kMaxInfo = 1024;
const int kMaxTitle = 64;
const int kMaxAddress = 128;
const int kMaxZipCode = 40;
const int kMaxPhone = 32;
const int32 kMaxDN = 32768;
const int kMaxCoolAddress = 256;
const int kMaxAddressEntry = 1000;
const short kDefaultDLS = 0;
const short kSpecificDLS = 1;
const short kHostOrIPAddress = 2;
typedef uint32 ABID;
/* This structure represents a single line in the address book pane
*/
typedef struct AB_EntryLineTag
{
ABID entryType; /* type of entry either person or list */
char fullname[256];
char emailAddress[256];
char companyName[128];
char nickname[64];
char locality[128];
char workPhone[32];
#ifdef XP_CPLUSPLUS
public:
void Initialize();
#endif
} AB_EntryLine;
typedef struct PersonEntryTag {
char * pNickName;
char * pGivenName;
char * pMiddleName;
char * pFamilyName;
char * pCompanyName;
char * pLocality;
char * pRegion;
char * pEmailAddress;
char * pInfo;
XP_Bool HTMLmail;
char * pTitle;
char * pPOAddress;
char * pAddress;
char * pZipCode;
char * pCountry;
char * pWorkPhone;
char * pFaxPhone;
char * pHomePhone;
char * pDistName;
short Security;
char * pCoolAddress;
short UseServer;
int16 WinCSID;
#ifdef XP_CPLUSPLUS
public:
void Initialize();
void CleanUp();
#endif
} PersonEntry;
typedef struct MailingListEntryTag {
char * pFullName;
char * pNickName;
char * pInfo;
char * pDistName;
int16 WinCSID;
#ifdef XP_CPLUSPLUS
public:
void Initialize();
void CleanUp();
#endif
} MailingListEntry;
const ABID ABTypeAll = 35;
const ABID ABTypePerson = 36;
const ABID ABTypeList = 37;
const unsigned long ABTypeEntry = 0x70634944; /* ASCII - 'pcID' */
const unsigned long ABFullName = 0x636E2020; /* ASCII - 'cn ' */
const unsigned long ABNickname = 0x6E69636B; /* ASCII - 'nick' */
const unsigned long ABEmailAddress = 0x6D61696C; /* ASCII - 'mail' */
const unsigned long ABLocality = 0x6C6F6320; /* ASCII - 'loc ' */
const unsigned long ABCompany = 0x6F726720; /* ASCII - 'org ' */
/* defines for vcard support */
#define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard"
#define vCardMimeFormat "text/x-vcard"
typedef enum
{
/* FILE MENU
=========
*/
AB_NewMessageCmd, /* Send a new message to the selected entries */
AB_ImportCmd, /* import a file into the address book */
AB_SaveCmd, /* export to a file */
AB_CloseCmd, /* close the address book window */
AB_NewAddressBook, /* Create a new personal address book */
AB_NewLDAPDirectory, /* Create a new LDAP directory */
/* EDIT MENU
=========
*/
AB_UndoCmd, /* Undoes the last operation. */
AB_RedoCmd, /* Redoes the last undone operation. */
AB_DeleteCmd, /* Causes the given entries to be
deleted. */
AB_DeleteAllCmd, /* Causes all occurrences of the given entries to be deleted. */
AB_LDAPSearchCmd, /* Perform an LDAP search */
/* VIEW/SORT MENUS
===============
*/
AB_SortByTypeCmd, /* Sort alphabetized by type. */
AB_SortByFullNameCmd, /* Sort alphabetizedby full name. */
AB_SortByLocality, /* Sort by state */
AB_SortByNickname, /* Sort by nickname */
AB_SortByEmailAddress, /* Sort by email address */
AB_SortByCompanyName, /* Sort by email address */
AB_SortAscending, /* Sort current column ascending */
AB_SortDescending, /* Sort current column descending */
/* these are the new sort command IDs added for the 2 pane AB. Use these instead of the previous ones...*/
AB_SortByColumnID0,
AB_SortByColumnID1,
AB_SortByColumnID2,
AB_SortByColumnID3,
AB_SortByColumnID4,
AB_SortByColumnID5,
AB_SortByColumnID6,
/* ITEM MENU
============
*/
AB_AddUserCmd, /* Add a user to the address book */
AB_AddMailingListCmd, /* Add a mailing list to the address book */
AB_PropertiesCmd, /* Get the properties of an entry */
AB_CallCmd, /* Call the entry using CallPoint */
AB_ImportLdapEntriesCmd, /* Add a user to the AB from an LDAP directory */
/* Mailing List Pane Specific Commands!!! */
AB_InsertLineCmd, /* Insert a blank entry line into the mailing list pane */
AB_ReplaceLineCmd /* Replace the entry in the mailing list pane with a blank entry */
} AB_CommandType;
#endif

449
mozilla/include/addrbook.h Normal file
View File

@@ -0,0 +1,449 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _AddrBook_H_
#define _AddrBook_H_
#include "xp_core.h"
#include "msgcom.h"
#include "abdefn.h"
#include "dirprefs.h"
#ifdef XP_CPLUSPLUS
class MLPane;
class ABPane;
class AddressPane;
class ABook;
#else
typedef struct MLPane MLPane;
typedef struct ABPane ABPane;
typedef struct AddressPane AddressPane;
typedef struct ABook ABook;
#endif
XP_BEGIN_PROTOS
#define AB_kGromitDbFileName "da5id.nab"
#define AB_CONFIG_USE_GROMIT_FILE_FORMAT 1
/****************************************************************************/
/* Get the address book .*/
/****************************************************************************/
ABook* FE_GetAddressBook(MSG_Pane* pane);
/****************************************************************************/
/* This is a callback into the FE to bring up a modal property sheet */
/* for modifying an existing entry or creating a new one from a */
/* person structure. If entryId != MSG_MESSAGEIDNONE then it is the */
/* entryID of the entry to modify. Each FE should Return TRUE if the user */
/* hit ok return FALSE if they hit cancel and return -1 if there was a */
/* problem creating the window or something */
/****************************************************************************/
int FE_ShowPropertySheetFor (MWContext* context, ABID entryID,
PersonEntry* pPerson);
/****************************************************************************/
/* Return whether or not to attach the users */
/* vcard to outgoing messages */
/****************************************************************************/
XP_Bool AB_AttachUsersvCard(void);
/****************************************************************************/
/* Convert the address book error code to .*/
/****************************************************************************/
int AB_ConvertABErrToMKErr(uint32 err);
/****************************************************************************/
/* Create and initialize the address book pane which is the a view on an */
/* address book. It will provide a sorted list of all the address book */
/* entries ids . This is intended to be used in a two step */
/* process of create and then initialize */
/****************************************************************************/
int AB_InitAddressBookPane(ABPane** ppABookPane,
DIR_Server* dir,
ABook* pABook,
MWContext* context,
MSG_Master* master,
unsigned long sortBy,
XP_Bool sortForward);
/****************************************************************************/
/* Create the address book pane which is the a view on an */
/* address book. */
/****************************************************************************/
int AB_CreateAddressBookPane(ABPane** ppABookPane,
MWContext* context,
MSG_Master* master);
/****************************************************************************/
/* Initialize the address book pane which is the a view on an */
/* address book. It will provide a sorted list of all the address book */
/* entries ids .*/
/****************************************************************************/
int AB_InitializeAddressBookPane(ABPane* ppABookPane,
DIR_Server* dir,
ABook* pABook,
unsigned long sortBy,
XP_Bool sortForward);
/****************************************************************************/
/* Close the address book pane. Called when the view on an address book */
/* is being closed */
/****************************************************************************/
int AB_CloseAddressBookPane(ABPane** ppABookPane);
/****************************************************************************/
/* Create and initialize a mailing list pane which is the a view on an */
/* mailing list. It will provide a sorted view of all the entries in a */
/* mailing list. This is intended to be used in as a one one step process */
/****************************************************************************/
int AB_InitMailingListPane(MLPane** ppABookPane,
ABID* listID,
DIR_Server* dir,
ABook* pABook,
MWContext* context,
MSG_Master* master,
unsigned long sortBy,
XP_Bool sortForward);
/****************************************************************************/
/* Create a mailing list pane which is the a view on an */
/* mailing list. This is intended to be used in a two step */
/* process of create and then initialize */
/****************************************************************************/
int AB_CreateMailingListPane(MLPane** ppABookPane,
MWContext* context,
MSG_Master* master);
/****************************************************************************/
/* Initialize a mailing list pane which is the a view on an */
/* mailing list. It will provide a sorted view of all the entries in a */
/* mailing list.*/
/****************************************************************************/
int AB_InitializeMailingListPane(MLPane* pABookPane,
ABID* listID,
DIR_Server* dir,
ABook* pABook);
/****************************************************************************/
/* Close the mailing list pane. Called when the view on an mailing list */
/* is being closed */
/****************************************************************************/
int AB_CloseMailingListPane(MLPane** ppMLPane);
/****************************************************************************/
/* Register a compose window with the address book */
/* The composition pane should do this everytime it opens */
/* so that name completion can take place */
/****************************************************************************/
int AB_RegisterComposeWindow(ABook* pABook, DIR_Server* directory);
/****************************************************************************/
/* Unregister a compose window with the address book */
/* The composition pane should do this when it is getting closed */
/****************************************************************************/
int AB_UnregisterComposeWindow(ABook* pABook, DIR_Server* directory);
/****************************************************************************/
/* Change the Current directory */
/****************************************************************************/
int AB_ChangeDirectory(ABPane* pABookPane, DIR_Server* directory);
/****************************************************************************/
/* Begin a search on the LDAP directory */
/****************************************************************************/
int AB_SearchDirectory(ABPane* pABookPane, char* searchString);
/****************************************************************************/
/* Process LDAP search results*/
/****************************************************************************/
int AB_LDAPSearchResults(ABPane* pABookPane, MSG_ViewIndex index, int32 num);
/****************************************************************************/
/* Finish an LDAP search */
/****************************************************************************/
int AB_FinishSearch(ABPane* pABookPane, MWContext* context);
/****************************************************************************/
/* Create and initialize the address book database */
/****************************************************************************/
int AB_InitAddressBook(DIR_Server* directory, ABook** ppABook);
/****************************************************************************/
/* Create and initialize the address book database */
/* upgrading the old html address book if we need to*/
/****************************************************************************/
int AB_InitializeAddressBook(DIR_Server* directory, ABook** ppABook,
const char * pOldHTMLBook);
/****************************************************************************/
/* Close the address book database */
/****************************************************************************/
int AB_CloseAddressBook(ABook** ppABook);
/****************************************************************************/
/* Add a person entry to the database */
/****************************************************************************/
int AB_AddUser(DIR_Server* dir, ABook* pABook, PersonEntry* pPerson,
ABID* entryID);
int AB_AddUserWithUI (MWContext *context, PersonEntry *person,
DIR_Server *pab, XP_Bool lastOneToAdd);
/****************************************************************************/
/* Add an entry to the database from a url*/
/****************************************************************************/
int AB_AddSenderToAddBook(ABook* pABook, MWContext* context, char* author,
char* url);
/****************************************************************************/
/* Add a mailing list to the database */
/****************************************************************************/
int AB_AddMailingList(DIR_Server* dir, ABook* pABook,
MailingListEntry* pABList, ABID* entryID);
/****************************************************************************/
/* Perform a command on the selected indices */
/* Right now this will only work on delete and mail to */
/****************************************************************************/
int AB_Command (ABPane* pane, AB_CommandType command,
MSG_ViewIndex* indices, int32 numindices);
/****************************************************************************/
/* Before the front end displays any menu (each time), it should call this */
/* function for each command on that menu to determine how it should be */
/* displayed. */
/****************************************************************************/
int AB_CommandStatus (ABPane* pane,
AB_CommandType command,
MSG_ViewIndex* indices, int32 numindices,
XP_Bool *selectable_p,
MSG_COMMAND_CHECK_STATE *selected_p,
const char **display_string,
XP_Bool *plural_p);
/****************************************************************************/
/* Get and Set how full names are constructed for people entries */
/* first last or last first */
/****************************************************************************/
XP_Bool AB_GetSortByFirstName(ABook* pABook);
void AB_SetSortByFirstName(ABook* pABook, XP_Bool sortby);
/****************************************************************************/
/* Import Export various formats that will prompt for filename */
/****************************************************************************/
int AB_ImportFromFile(ABPane* pABookPane, MWContext* context);
int AB_ExportToFile(ABPane* pABookPane, MWContext* context);
/****************************************************************************/
/* This is only used right now for drop/paste of a vcard */
/****************************************************************************/
int AB_ImportFromVcard(AddressPane* pABookPane, const char* pVcard);
/****************************************************************************/
/* This is only used right now for drop of a vcard */
/* It it a helper function that can be called by the FE to */
/* convert a vcard to an valid rfc822 address that can be used */
/* in the address widget of the compose window */
/****************************************************************************/
int AB_ConvertVCardsToExpandedName(ABook* pABook, const char* vCardString,
XP_List ** ppEntries, int32 * numEntries);
/****************************************************************************/
/* Import Export various formats that wont do any prompting */
/* This is needed for the command line interface and automatic upgrading */
/****************************************************************************/
int AB_ImportFromFileNamed(ABook* pABook, char* filename);
int AB_ExportToFileNamed(ABook* pABook, char* filename);
/****************************************************************************/
/* This function is only called from the backend. */
/* It is used to process the addbook url that is only used in mimevcrd.c */
/* It probably will never be called by an FE */
/****************************************************************************/
int AB_ImportFromVcardURL(ABook* pABook, MWContext* context, const char* pVcard);
/****************************************************************************/
/* This will create a buffer with a vcard in it. It is used for constructing */
/* a buffer that can be used in drag/drop or copy to the clipboard */
/****************************************************************************/
int AB_ExportToVCard(ABook* pABook, DIR_Server* dir, ABID entryID,
char** ppVcard);
int AB_ExportToVCardFromPerson(ABook* pABook, PersonEntry* pPerson,
char** ppVcard);
/****************************************************************************/
/* This will create a temp file for a vcard. This function is only called */
/* from the backend compose window for constructing a vcard attachment */
/* It probably will never be called by an FE */
/****************************************************************************/
int AB_ExportToVCardTempFile(ABook* pABook, DIR_Server* dir, ABID entryID,
char** filename);
/****************************************************************************/
/* Operations on panes/view */
/****************************************************************************/
/****************************************************************************/
/* Get the unique database id at a particular pane index */
/****************************************************************************/
ABID AB_GetEntryIDAt(AddressPane* pABookPane, uint32 index);
uint32 AB_GetIndexOfEntryID (AddressPane* pABookPane, ABID entryID);
int AB_GetEntryLine (ABPane * pABookPane, uint32 index,
AB_EntryLine * pEntryLine);
/****************************************************************************/
/* Get info about how a pane is sorted */
/****************************************************************************/
XP_Bool AB_GetPaneSortedAscending(ABPane * pABookPane);
ABID AB_GetPaneSortedBy(ABPane * pABookPane);
/****************************************************************************/
/* Get number of entries */
/* For the address book you can ask for ALL, people, or mailing lists */
/* For mailing list panes you will only be returned ALL */
/****************************************************************************/
int AB_GetEntryCount(DIR_Server* dir, ABook* pABook, uint32* count,
ABID etype, ABID listID);
/****************************************************************************/
/* Modify information for an entry (person or mailing list) */
/****************************************************************************/
int AB_ModifyUser(DIR_Server* dir, ABook* pABook, ABID entryID, PersonEntry* pPerson);
int AB_ModifyMailingList(DIR_Server* dir, ABook* pABook, ABID entryID,
MailingListEntry* pEntry);
/****************************************************************************/
/* Modify information for a mailing list that has been modified */
/* but not committed in a mailing list pane */
/****************************************************************************/
int AB_ModifyMailingListAndEntries(MLPane* pMLPane, MailingListEntry* pABList);
/****************************************************************************/
/* Modify information for a mailing list that has been modified */
/* but not committed in a mailing list pane. Some of the error checking */
/* that was perfomed in add/replace in a mailing list had to be moved to */
/* here. The fe's should be calling this function instead of the one above */
/****************************************************************************/
int AB_ModifyMailingListAndEntriesWithChecks(MLPane* pMLPane, MailingListEntry* pList,
MSG_ViewIndex *index, MSG_ViewIndex begIndex);
/****************************************************************************/
/* Get information for every entry (person or mailing list) */
/****************************************************************************/
int AB_GetType(DIR_Server* dir, ABook* pABook, ABID entryID, ABID* type);
int AB_GetFullName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
int AB_GetNickname(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
/****************************************************************************/
/* Get information for every person entry */
/****************************************************************************/
int AB_GetGivenName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
int AB_GetMiddleName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
int AB_GetFamilyName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
int AB_GetCompanyName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
int AB_GetLocality(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
int AB_GetRegion(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
int AB_GetEmailAddress(DIR_Server* dir, ABook* pABook, ABID entryID, char* paddress);
int AB_GetInfo(DIR_Server* dir, ABook* pABook, ABID entryID, char* pinfo);
int AB_GetHTMLMail(DIR_Server* dir, ABook* pABook, ABID entryID, XP_Bool* pHTML);
int AB_GetExpandedName(DIR_Server* dir, ABook* pABook, ABID entryID, char** pname);
int AB_GetTitle(DIR_Server* dir, ABook* pABook, ABID entryID, char* ptitle);
int AB_GetPOAddress(DIR_Server* dir, ABook* pABook, ABID entryID, char* ppoaddress);
int AB_GetStreetAddress(DIR_Server* dir, ABook* pABook, ABID entryID, char* pstreet);
int AB_GetZipCode(DIR_Server* dir, ABook* pABook, ABID entryID, char* pzip);
int AB_GetCountry(DIR_Server* dir, ABook* pABook, ABID entryID, char* pcountry);
int AB_GetWorkPhone(DIR_Server* dir, ABook* pABook, ABID entryID, char* pphone);
int AB_GetFaxPhone(DIR_Server* dir, ABook* pABook, ABID entryID, char* pphone);
int AB_GetHomePhone(DIR_Server* dir, ABook* pABook, ABID entryID, char* pphone);
int AB_GetDistName(DIR_Server* dir, ABook* pABook, ABID entryID, char* pname);
int AB_GetSecurity(DIR_Server* dir, ABook* pABook, ABID entryID, short* security);
int AB_GetCoolAddress(DIR_Server* dir, ABook* pABook, ABID entryID, char* paddress);
int AB_GetUseServer(DIR_Server* dir, ABook* pABook, ABID entryID, short* use);
int AB_GetEntryIDForPerson(DIR_Server* dir, ABook* pABook, ABID* entryID,
PersonEntry* pPerson);
/****************************************************************************/
/* Add/Remove entries for a mailing list */
/****************************************************************************/
int AB_GetEntryCountInMailingList(MLPane* pMLPane, uint32* count);
int AB_AddIDToMailingListAt(MLPane* pMLPane, ABID entryID, MSG_ViewIndex index);
int AB_RemoveIDFromMailingListAt(MLPane* pMLPane, MSG_ViewIndex index);
int AB_ReplaceIDInMailingListAt(MLPane* pMLPane, ABID entryID, MSG_ViewIndex index);
int AB_AddPersonToMailingListAt(MLPane* pMLPane, PersonEntry* person,
MSG_ViewIndex index, ABID* entryID);
/****************************************************************************/
/* Find index to first entry in a pane that matches the typedown */
/****************************************************************************/
int AB_GetIndexMatchingTypedown(ABPane* pABookPane,
MSG_ViewIndex* index, const char* aValue, MSG_ViewIndex startIndex);
/****************************************************************************/
/* Return the id of the name/nickname entries that match a string. If we */
/* find a nickname that uniquely matches then return otherwise check the */
/* full name field. */
/****************************************************************************/
int AB_GetIDForNameCompletion(ABook* pABook, DIR_Server* dir, ABID* entryID,
ABID* field, const char* aValue);
/****************************************************************************/
/* Return a string of expanded addresses from the address book */
/****************************************************************************/
char* AB_ExpandHeaderString(ABook* pABook, const char* addresses,
XP_Bool expandfull);
/****************************************************************************/
/* Return the ids of mailing lists that a entry is a member of */
/* This was mentioned at one time as a requirement in the ui but it may */
/* go away */
/****************************************************************************/
int AB_GetMailingListsContainingID(ABook* pABook, MSG_ViewIndex* plist,
ABID entryID);
/****************************************************************************/
/* This should not be called by any of the fes. I placed it here so it */
/* could be called in the backend by other functions such as those in libmsg */
/* This allows for an increase in performance when adding a bunch of entries */
/* to the database */
/****************************************************************************/
int AB_SetIsImporting(ABook* pABook, XP_Bool isImporting);
/****************************************************************************/
/* This should not be called by any of the fes. I placed it here so it */
/* could be called in the backend by other functions in libmsg */
/* This will set the wantsHTML boolean to be set for all address book */
/* entries with that match the name and email address. */
/****************************************************************************/
int AB_SetHTMLForPerson(DIR_Server* dir, ABook* pABook, PersonEntry* pPerson);
/****************************************************************************/
/* This should not be called by any of the fes. I placed it here so it */
/* could be called in the backend by other functions in libmsg */
/* This will break a name apart into first name and last name. */
/* Be sure and set the WinCSID in the person structure */
/****************************************************************************/
int AB_BreakApartFirstName (ABook* pABook, PersonEntry* pPerson);
XP_END_PROTOS
#endif

7878
mozilla/include/allxpstr.h Normal file

File diff suppressed because it is too large Load Diff

7878
mozilla/include/allxpstr.rc Normal file

File diff suppressed because it is too large Load Diff

700
mozilla/include/bkmks.h Normal file
View File

@@ -0,0 +1,700 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef BKMKS_H
#define BKMKS_H
#include "xp_mcom.h"
#include "ntypes.h"
XP_BEGIN_PROTOS
#define BM_LAST_CELL 0xFFFF /* See BMFE_RefreshCells */
typedef time_t BM_Date;
typedef enum {
BM_Cmd_Invalid, /* XFE in particular likes to have an invalid
ID code as one of the entries here...*/
BM_Cmd_Open, /* Open a new bookmark file. */
BM_Cmd_ImportBookmarks, /* Import entries from another bookmark
file. */
BM_Cmd_SaveAs, /* Save these bookmarks into another file. */
BM_Cmd_Close, /* Close the bookmarks window. (NYI ###) */
BM_Cmd_Undo, /* Undo the last command. */
BM_Cmd_Redo, /* Redo the last undone command. */
BM_Cmd_Cut, /* Cut the selected bookmarks. */
BM_Cmd_Copy, /* Copy the selected bookmarks. */
BM_Cmd_Paste, /* Paste in the most recent cut/copy. */
BM_Cmd_Delete, /* Delete the selected bookmarks without
affecting the clipboard. */
BM_Cmd_SelectAllBookmarks, /* Select every bookmark in the window. */
BM_Cmd_Find, /* Find a string. */
BM_Cmd_FindAgain, /* Find the same string again. */
BM_Cmd_BookmarkProps, /* Bring up the properties window. */
BM_Cmd_GotoBookmark, /* Load the selected bookmark in a browser
window. */
/* Sort the bookmarks. NYI### */
BM_Cmd_Sort_Name,
BM_Cmd_Sort_Name_Asc,
BM_Cmd_Sort_Address,
BM_Cmd_Sort_Address_Asc,
BM_Cmd_Sort_AddDate,
BM_Cmd_Sort_AddDate_Asc,
BM_Cmd_Sort_LastVisit,
BM_Cmd_Sort_LastVisit_Asc,
BM_Cmd_Sort_Natural,
BM_Cmd_InsertBookmark, /* Insert a new bookmark (or a new address if
in addressbook). */
BM_Cmd_InsertHeader, /* Insert a new header. */
BM_Cmd_InsertSeparator, /* Insert a separator. */
BM_Cmd_MakeAlias, /* Make an alias of this bookmark. */
BM_Cmd_SetAddHeader, /* Make the current header be the one where new
bookmarks are added. */
BM_Cmd_SetMenuHeader /* Make the current header be the one which the
pulldown menu is created from. */
} BM_CommandType;
#define BM_Cmd_SortBookmarks BM_Cmd_Sort_Name
typedef enum
{
BM_Sort_NONE = -1,
BM_Sort_Name,
BM_Sort_Name_Asc,
BM_Sort_Address,
BM_Sort_Address_Asc,
BM_Sort_AddDate,
BM_Sort_AddDate_Asc,
BM_Sort_LastVisit,
BM_Sort_LastVisit_Asc,
BM_Sort_Natural
} BM_SortType;
/* The various types of bookmark entries (as returned by BM_GetType). */
typedef uint16 BM_Type;
#define BM_TYPE_HEADER 0x0001
#define BM_TYPE_URL 0x0002
#define BM_TYPE_ADDRESS 0x0004
#define BM_TYPE_SEPARATOR 0x0008
#define BM_TYPE_ALIAS 0x0010
/* This represents one line in the bookmarks window -- a URL, a
separater, an addressbook entry, a header, etc. It's also already
defined in ntypes.h, and some compilers bitch and moan about seeing it
twice, so I've commented it out here. */
/* typedef struct BM_Entry_struct BM_Entry; */
/* information for the find dialog */
typedef struct BM_FindInfo {
char* textToFind;
XP_Bool checkNickname; /* Meaningful only in addressbook */
XP_Bool checkName;
XP_Bool checkLocation;
XP_Bool checkDescription;
XP_Bool matchCase;
XP_Bool matchWholeWord;
BM_Entry* lastEntry;
} BM_FindInfo;
struct BM_Entry_Focus {
BM_Entry* saveFocus;
XP_Bool foundSelection;
};
extern XP_Bool BM_IsHeader(BM_Entry* entry);
extern XP_Bool BM_IsUrl(BM_Entry* entry);
extern XP_Bool BM_IsAddress(BM_Entry* entry);
extern XP_Bool BM_IsSeparator(BM_Entry* entry);
extern XP_Bool BM_IsAlias(BM_Entry* entry);
extern XP_Bool BM_IsFolded(BM_Entry* entry);
extern XP_Bool BM_IsSelected(BM_Entry* entry);
/* Returns the state of whether this is a "changed URL"; that is, a URL whose
contents have apparently changed since we last visited it. */
#define BM_CHANGED_YES 1
#define BM_CHANGED_NO 0
#define BM_CHANGED_UNKNOWN -1
extern int32 BM_GetChangedState(BM_Entry* entry);
/* Get/Set the header that is to be the root of the pulldown menu. */
extern BM_Entry* BM_GetMenuHeader(MWContext* context);
extern void BM_SetMenuHeader(MWContext* context, BM_Entry* entry);
/* Get/Set the header that is to be the container of new items added from
browser windows. */
extern BM_Entry* BM_GetAddHeader(MWContext* context);
extern void BM_SetAddHeader(MWContext* context, BM_Entry* entry);
typedef void (*EntryFunc)(MWContext* context, BM_Entry* entry, void* closure);
/* Executes the given function on every single entry in the bookmark file. */
extern void BM_EachEntryDo(MWContext* context, EntryFunc func, void* closure);
/* Executes the given function for every entry that is selected. */
extern void BM_EachSelectedEntryDo(MWContext* context, EntryFunc func,
void* closure);
/* Executes the given function for every entry that is selected and is not a
descendent of a header that is not folded or selected. */
extern void BM_EachProperSelectedEntryDo(MWContext* context, EntryFunc func,
void* closure, struct BM_Entry_Focus* bmFocus);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Front end stubs -- each FE needs to implement these. */
/* Refresh each cell between and including first and last in the bookmarks
widget (if now is TRUE, the FE is expected to redraw them BEFORE returning,
otherwise the FE can simply invalidate them and wait for the redraw to
happen). If BM_LAST_CELL is passed in as last, then it means paint from
the first to the end. */
extern void BMFE_RefreshCells(MWContext* context, int32 first, int32 last,
XP_Bool now);
/* Resize the widget to accomodate "visibleCount" number of entries vertically
and the width of widest entry the actual widget should NOT change size, just
the size of the scrollable area under it */
extern void BMFE_SyncDisplay(MWContext* context);
/* measure the item and assign the width and height required to draw it into
the widget into width and height. This is used only by BM_WidestEntry(); if
you don't need that call, you can just make this an empty stub. */
extern void BMFE_MeasureEntry(MWContext* context, BM_Entry* entry,
uint32* width, uint32* height);
/* Save the given bucket o' bits as the clipboard. This same bucket needs to
be returned later if BMFE_GetClipContents() is called. */
extern void BMFE_SetClipContents(MWContext* context, void* buffer,
int32 length);
/* return the clipboard contents */
extern void* BMFE_GetClipContents(MWContext* context, int32* length);
/* Copy the selected items from a history window to the clipboard (as bookmarks) */
extern char *BM_ClipCopyHistorySelection( void *pHistCsr, uint32 *pSelections, int iCount, int *pSize, XP_Bool bLongFormat );
/* Insert the block into the list */
extern void BM_DropBlockL( MWContext *pContext, char *pData, BM_Entry *firstSelected );
/* Create the bookmarks property window. If one already exists, just bring it
to the front. This will always be immediately followed by a call to
BMFE_EditItem(). */
extern void BMFE_OpenBookmarksWindow(MWContext* context);
/* Edit the given item in the bookmarks property window. If there is no
bookmarks property window currently, then the FE should ignore this call.
If the bookmarks property window is currently displaying some other entry,
then it should save any changes made to that entry (by calling BM_SetName,
etc.) before loading up this entry. */
extern void BMFE_EditItem(MWContext* context, BM_Entry* entry);
/* The given entry is no longer valid (i.e., the user just deleted it). So,
the given pointer is about to become invalid, and the FE should remove any
references to it it may have. In particular, if it is the one being edited
in the bookmarks property window, then the FE should clear that window. */
extern void BMFE_EntryGoingAway(MWContext* context, BM_Entry* entry);
/* The user has requested to view the given url. Show it to him in, using some
appropriate context. Url may be targeted to a different window */
extern void BMFE_GotoBookmark(MWContext* context,
const char* url, const char* target);
/* Create the find dialog, and fill it in as specified in the given
structure. When the user hits the "Find" button in the dialog, call
BM_DoFindBookmark. */
extern void* BMFE_OpenFindWindow(MWContext* context, BM_FindInfo* findInfo);
/* Make sure that the given entry is visible. */
extern void BMFE_ScrollIntoView(MWContext* context, BM_Entry* entry);
/* The list of bookmarks has changed somehow, so any "bookmarks" menu needs to
be recreated. This should be a cheap call, just setting a flag in the FE so
that it knows to recreate the menu later (like, when the user tries to view
it). Recreating it immediately would be bad, because this can get called
much more often than is reasonable. */
extern void BMFE_BookmarkMenuInvalid(MWContext* context);
/* We're in the process of doing a What's Changed operation. The What's
Changed window should update to display the URL, the percentage (calculate
as done*100/total), and the total estimated time (given here as a
pre-formatted string). The What's Changed window should end up looking
something like this:
Checking <URL>... (<13> left)
{===================== } (progress bar)
Estimated time remaining: <2 hours 13 minutes>
(Remaining time depends on the sites selected and
the network traffic).
[ Cancel ]
It's up to the FE to notice the first time this is called and change its
window to display the info instead of the initial What's Changed screen.
If the user ever hits Cancel (or does something equivilant, like destroys
the window), the FE must call BM_CancelWhatsChanged(). */
extern void BMFE_UpdateWhatsChanged(MWContext* context,
const char* url, /* If NULL, just display
"Checking..." */
int32 done, int32 total,
const char* totaltime);
/* We've finished processing What's Changed. The What's Changed window should
change to display the summary of what happened. It should look something
like this:
Done checking <157> Bookmarks.
<134> documents were reached.
<27> documents have changed and are marked in blue.
[ OK ]
When the user clicks on the OK, the FE should just take down the window.
(It doesn't matter if the FE calls BM_CancelWhatsChanged(); it will be a
no-op in this situtation.) */
extern void BMFE_FinishedWhatsChanged(MWContext* context, int32 totalchecked,
int32 numreached, int32 numchanged);
#ifdef XP_WIN
/* The current bookmarks file is about to change */
extern void BMFE_ChangingBookmarksFile(void);
/* The current bookmarks file has been changed */
extern void BMFE_ChangedBookmarksFile(void);
#endif
#ifdef XP_UNIX
/* Use these to know when to allow refresh */
extern void BMFE_StartBatch(MWContext* context);
extern void BMFE_EndBatch(MWContext* context);
#endif
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Initialize a new bookmarks context. (returns negative on failure) */
extern int BM_InitializeBookmarksContext(MWContext* context);
/* Prepare to destroy a bookmarks context. Will save any changes that have
been made. */
extern void BM_CleanupBookmarksContext(MWContext* context);
/* Set some FE data to associate with a bookmarks context. */
extern void BM_SetFEData(MWContext* context, void* data);
/* Get the FE data previously associated with a context. */
extern void* BM_GetFEData(MWContext* context);
/* Create a new url entry. */
extern BM_Entry* BM_NewUrl(const char* name, const char* address,
const char* content_type, BM_Date last_visit);
/* Create a new header. */
extern BM_Entry* BM_NewHeader(const char* name);
/* Create a copy of an existing bookmark. If the bookmark is a folder
it will also contain a copy of all of the bookmarks in the folder.*/
extern BM_Entry* BM_CopyBookmark(MWContext* context, BM_Entry* original);
/* Frees an entry. This should never be called unless you are sure the entry
has not been added to some header, and is not the object of some alias. In
other words, be sure nothing could possibly have a pointer to this it.
If the object is a header, this will also free all of its descendents. */
extern void BM_FreeEntry(MWContext* context, BM_Entry* entry);
/* Get the type of this bookmark. (Returns one of the BM_TYPE_* values.) */
extern BM_Type BM_GetType(BM_Entry* entry);
extern char* BM_GetName(BM_Entry* entry);
extern char* BM_GetAddress(BM_Entry* entry);
extern char* BM_GetTarget(BM_Entry* entry, XP_Bool recurse);
extern char* BM_GetDescription(BM_Entry* entry);
extern char* BM_GetNickName(BM_Entry* entry); /* Only meaningful in address
book. */
/* Get the full name and address of the given entry (which must be an
address book entry or header). Result is returned in a newly allocated
string; free it with XP_FREE() when through. */
extern char* BM_GetFullAddress(MWContext* context, BM_Entry* entry);
/* These return prettily formated info about the bookmark. They each
return the result in a staticly allocated string, so if you call the
same function twice the results get stomped. */
extern char* BM_PrettyLastVisitedDate(BM_Entry* entry);
extern char* BM_PrettyAddedOnDate(BM_Entry* entry);
extern char* BM_PrettyAliasCount(MWContext* context, BM_Entry* entry);
/* Get the root node of a context. */
extern BM_Entry* BM_GetRoot(MWContext* context);
/* Given a node, return the first of its children (if any). */
extern BM_Entry* BM_GetChildren(BM_Entry* entry);
/* Given a node, return the next node that has the same parent (if any). */
extern BM_Entry* BM_GetNext(BM_Entry* entry);
/* Given a node, returns its parent (or NULL if this is the root) */
extern BM_Entry* BM_GetParent(BM_Entry* entry);
/* Does this node have a sibling somewhere below it? */
extern XP_Bool BM_HasNext(BM_Entry* entry);
/* Does this node have a sibling somewhere above it? Note that there is *not*
an API to actually get that sibling, as this is not a simple call. However,
determing the existance of such a child is easy, and that's what Windows
needs to paint its pipes. */
extern XP_Bool BM_HasPrev(BM_Entry* entry);
/* Routines to change the name/address/description of an entry. These routines
will take care of updating the display as necessary. */
extern void BM_SetName(MWContext* context, BM_Entry* entry,
const char* newName);
extern void BM_SetAddress(MWContext* context, BM_Entry* entry,
const char* newAddress);
extern void BM_SetTarget(MWContext* context, BM_Entry* entry,
const char* newTarget);
extern void BM_SetDescription(MWContext* context, BM_Entry* entry,
const char* newDesc);
/* Only meaningful in addressbook (on an address or header or alias to same) */
extern XP_Bool BM_SetNickName(MWContext* context, BM_Entry* entry,
const char* newName);
/* The user just hit "Cancel" on the properties window, which was editing
the given item. This gives the bookmarks code a chance to delete the
item if it was just newly created. */
extern void BM_CancelEdit(MWContext* context, BM_Entry* entry);
/* fold or unfold the header according to "fold" and all its subfolders if
foldAll is TRUE */
extern void BM_FoldHeader(MWContext* context, BM_Entry* entry, XP_Bool fold,
XP_Bool refresh, XP_Bool foldAll);
/* clear all the selection flags, and cause a redisplay if refresh is set. */
extern void BM_ClearAllSelection(MWContext* context, XP_Bool refresh);
/* Clear all the child selections of the passes header and redisplay if refresh
is set. */
extern void BM_ClearAllChildSelection(MWContext* context, BM_Entry* at,
XP_Bool refresh);
/* Select everything. */
extern void BM_SelectAll(MWContext* context, XP_Bool refresh);
/* selects the item, call BMFE_Refresh on it if "refresh" and calls
BM_ClearSelection first if extend is FALSE */
extern void BM_SelectItem(MWContext* context, BM_Entry* item, XP_Bool refresh,
XP_Bool extend, XP_Bool select);
/* Adds a range of bookmarks to the current selection. To be called by the FE
when the user Shift-Clicks in the window. This will unselect everything and
then select a range of bookmarks, from the last bookmark that was selected
with BM_SelectItem to the one given here. */
extern void BM_SelectRangeTo(MWContext* context, BM_Entry* item);
/* toggles the selected state of the item, call BMFE_Refresh on it if "refresh"
and calls BM_ClearSelection if extend is FALSE */
extern void BM_ToggleItem(MWContext* context, BM_Entry* item, XP_Bool refresh,
XP_Bool extend );
/* returns the first selected entry */
extern BM_Entry* BM_FirstSelectedItem(MWContext* context);
extern BM_Date BM_GetLastVisited(BM_Entry *);
extern BM_Date BM_GetAdditionDate(BM_Entry *);
/* return the number of bookmarks */
extern int32 BM_GetCount(MWContext* context);
/* return the number of visible bookmarks */
extern int32 BM_GetVisibleCount(MWContext* context);
/* returns an integer index of the item in the list */
extern int32 BM_GetIndex(MWContext* context, BM_Entry* item);
/* returns an integer index of the item in the list and does not pay attention
to the is_folded value */
extern int32 BM_GetUnfoldedIndex(MWContext* context, BM_Entry* item);
/* returns the object associated with the index returned by BM_GetIndex() */
extern BM_Entry* BM_AtIndex(MWContext* context, int32 index);
/* returns the object associated with the index returned by
BM_GetUnfoldedIndex() */
extern BM_Entry* BM_AtUnfoldedIndex(MWContext* context, int32 index);
/* returns an integer depth of the item in the list starting
at zero */
extern int32 BM_GetDepth(MWContext* context, BM_Entry* item);
/* Execute a find operation according to the data in the given structure. This
will cause the appropriate entry to be selected and made visible. */
extern void BM_DoFindBookmark(MWContext* context, BM_FindInfo* findInfo);
/* For addressbook only: find and return the entry (if any) for the e-mail
address within the given mailto: url. (used by libmsg) */
extern BM_Entry* BM_FindAddress(MWContext* context, const char* mailtourl);
/* For addressbook only: edit the entry for the e-mail address within the
given mailto: url, creating the entry if necessary. (used by libmsg) */
extern void BM_EditAddress(MWContext* context, const char* mailtourl);
/* For addressbook only: if the given list of addresses includes a nickname
from the addresses, then return a new string with the addresses expanded.
If expandfull is True, then all mailing list entries are expanded too,
otherwise, mailing list entries are only expanded to include their name.
(used by libmsg). */
extern char* BM_ExpandHeaderString(MWContext* context, const char* value,
XP_Bool expandfull);
/* Checks every bookmark context for a url and updates the last accessed
time. (For use by global history code; FE's probably don't need this.) */
extern void BM_UpdateBookmarksTime(URL_Struct* URL_s, BM_Date cur_time);
/* returns TRUE if the second argument is a direct descendent of the first
argument, returns FALSE otherwise */
extern XP_Bool BM_IsDescendent(MWContext* context, BM_Entry* parent,
BM_Entry* possible_child);
/* The front end can use this call to determine what the indentation depth is
needed to display all the icons in the bookmarks. The XFE uses this to
dynamically resize the icon column. In true C style, the number returned is
actually one bigger than the biggest depth the FE will ever get. */
extern int BM_GetMaxDepth(MWContext* context);
/* This is called during a drag operation. The user is dragging some bookmarks
and is currently pointing at the given line. (If under is True, then the
user is really pointing between the given line and the next line.) This
returns TRUE if the FE should draw a box around the given line, and FALSE if
it should underline it. */
extern XP_Bool BM_IsDragEffectBox(MWContext* context, int line, XP_Bool under);
/* Actually do a drop in a drag-n-drop reordering operation. The arguments are
the same as BM_IsDragEffectBox(); the selected items will be moved. */
extern void BM_DoDrop(MWContext* ctnx, int line, XP_Bool under);
/* find and return the widest visible entry in the bookmarks tree. This makes
sense only if your FE has defined a meaningful BMFE_MeasureEntry(). */
extern BM_Entry* BM_WidestEntry(MWContext* context);
/* insert an item after another item in the bm if the insert_after item is NULL
or not found the item will be inserted at the end of the list */
extern void BM_InsertItemAfter(MWContext* context, BM_Entry* insert_after,
BM_Entry* insertee);
/* insert an item in a header if "insert_after" is a Header type, or after the
item if "insert after" is not a header type. if the insert_after item is
NULL or not found the item will be inserted at the end of the bm */
extern void BM_InsertItemInHeaderOrAfterItem(MWContext* context,
BM_Entry* insert_after,
BM_Entry* insertee );
/* Cause the given item to be inserted at the end of the given header. The
header passed in here is usually BM_GetAddHeader(). */
extern void BM_AppendToHeader(MWContext* context, BM_Entry* header,
BM_Entry* entry);
extern void BM_PrependChildToHeader(MWContext* context, BM_Entry* parent, BM_Entry* child);
/* Removes the given item from bookmarks without deleting it*/
extern void BM_RemoveChildFromHeader(MWContext* context, BM_Entry* parent, BM_Entry* child);
/* Cause the given bookmark to be displayed in a browser window somewhere.
The given item must be an URL (BM_IsUrl must return TRUE). */
extern void BM_GotoBookmark(MWContext* context, BM_Entry* item);
/* Reads the hostlist from disk, what else? Pass in the bm filename and a
relative URL which represents the original location of the html file. If
you are reading the default bm you should pass in a file URL of the form
file://localhost/PATH */
extern void BM_ReadBookmarksFromDisk(MWContext* context, const char* filename,
const char* relative_url);
/* saves the bm to a file. If the given filename is NULL, then save it back to
where it was loaded from and only if changes have been made. Returns
negative on failure. */
extern int32 BM_SaveBookmarks(MWContext* context, const char* filename);
/* Returns the filename that the bookmarks are saved in. */
extern const char* BM_GetFileName(MWContext* context);
/* read in a new bookmarks file (esp for LI use). */
extern void BM_Open_File(MWContext* context, char* newFile);
/* ability to set the modified to true or false (esp for LI use). */
extern void BM_SetModified(MWContext* context, XP_Bool mod);
/* Whether the file will be written when Save is called. */
extern XP_Bool BM_Modified(MWContext* context);
/* Convert a number of selections in a bm list into a block of memory that the
user can use for cut and paste operations */
extern char* BM_ConvertSelectionsToBlock(MWContext* context,
XP_Bool bLongFormat,
int32* lTotalLen);
/* Take a block of memory and insert the bm items it represents into the
current bm */
extern void BM_InsertBlockAt(MWContext* context, char* pOriginalBlock,
BM_Entry* addTo, XP_Bool bLongFormat,
int32 lTotalLen);
/* select all aliases for an entry */
extern void BM_SelectAliases(MWContext* context, BM_Entry* forEntry );
/* Count how many aliases there are to the given entry. */
extern int32 BM_CountAliases(MWContext* context, BM_Entry* forEntry);
/* Make an alias for each of the currently selected entries. */
extern void BM_MakeAliases(MWContext* context);
/* Returns the real item that an alias points to. The given entry must be an
alias (BM_IsAlias must return TRUE on it). */
extern BM_Entry* BM_GetAliasOriginal(BM_Entry*);
/* Start a What's Changed operation. Before calling this routine, it's up to
the FE to present a dialog like this when What's Changed starts:
Look for documents that have changed on:
(o) All bookmarks
( ) Selected bookmarks
[ Start Checking ] [ Cancel ]
Then the FE calls this routine when the user clicks Start Checking. The FE
will immediately get called via BMFE_UpdateWhatsChanged(), and the FE should
change the dialog box's appearance to match. */
extern int BM_StartWhatsChanged(MWContext* context,
XP_Bool do_only_selected);
/* Cancel a running What's Changed operation. */
extern int BM_CancelWhatsChanged(MWContext* context);
/* Returns whether the given command can be executed right now. Should be
used to decide whether to disable a menu item for this command. */
extern XP_Bool BM_FindCommandStatus(MWContext* context,
BM_CommandType command);
/* Execute the given command. */
extern void BM_ObeyCommand(MWContext* context, BM_CommandType command );
/* Clean up the undo queue */
void BM_ResetUndo(MWContext * context);
XP_END_PROTOS
#endif /* BMLIST_H */

159
mozilla/include/cdefs.h Normal file
View File

@@ -0,0 +1,159 @@
/* -*- 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.
*/
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.7 (Berkeley) 1/21/94
*/
#ifndef _CDEFS_H_
#define _CDEFS_H_
#ifdef __BEGIN_DECLS
#undef __BEGIN_DECLS
#endif
#ifdef __END_DECLS
#undef __END_DECLS
#endif
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
* in between its arguments. __CONCAT can also concatenate double-quoted
* strings produced by the __STRING macro, but this only works with ANSI C.
*/
#undef __P
#undef __CONCAT
#undef __STRING
#if defined(__STDC__) || defined(__cplusplus) || defined(_WINDOWS) || defined(XP_OS2)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT(x,y) x ## y
#define __STRING(x) #x
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#ifndef _WINDOWS
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#else
#ifndef __GNUC__
#define __inline /* delete GCC keyword */
#endif /* !__GNUC__ */
#endif /* !__cplusplus */
#endif /* !_WINDOWS */
#else /* !(__STDC__ || __cplusplus) */
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
#ifndef __GNUC__
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
#define __volatile
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* When using a compiler other than gcc, programs using the ANSI C keywords
* inline, signed etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
* When using "gcc -traditional", we assume that this is the intent; if
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
*/
#ifndef NO_ANSI_KEYWORDS
#define inline /* delete ANSI C keywords */
#define signed
#define volatile
#endif
#endif /* !__GNUC__ */
#endif /* !(__STDC__ || __cplusplus) */
/*
* GCC1 and some versions of GCC2 declare dead (non-returning) and
* pure (no side effects) functions using "volatile" and "const";
* unfortunately, these then cause warnings under "-ansi -pedantic".
* GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
* these work for GNU C++ (modulo a slight glitch in the C++ grammar
* in the distribution version of 2.5.5).
*/
#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define __dead __volatile
#define __pure __const
#endif
#endif
/* Delete pseudo-keywords wherever they are not available or needed. */
#ifndef __dead
#define __dead
#define __pure
#endif
#ifdef AIXV3
/* Wont compile without const. Need a cleaner way to handle this. */
#ifdef const
#undef const
#endif
#endif
#endif /* !_CDEFS_H_ */

76
mozilla/include/cgi.h Normal file
View File

@@ -0,0 +1,76 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef __cgi_h_
#define __cgi_h_
/*
** CGI assist library. Portability layer for writing correctly behaving
** CGI programs.
*/
#include "ds.h"
XP_BEGIN_PROTOS
/*
** Read in the input, generating a single long string out of it. CGI
** programs normally get the value of various forms elements as input.
*/
extern char *CGI_GatherInput(FILE *in);
/*
** Given a null terminated string, compress it in place, converting
** "funny characters" into their ascii equivalent. Maps "+" to space and
** %xx to the binary version of xx, where xx is a pair of hex digits.
*/
extern void CGI_CompressString(char *s);
/*
** Convert a string into an argument vector. This seperates the incoming
** string into pieces, and calls CGI_CompressString to compress the
** pieces. This allocates memory for the return value only.
*/
extern char **CGI_ConvertStringToArgVec(char *string, int *argcp);
/*
** Look for the variable called "name" in the argv. Return a pointer to
** the value portion of the variable if found, zero otherwise. this does
** not malloc memory.
*/
extern char *CGI_GetVariable(char *name, int argc, char **argv);
/* Return non-zero if the variable string is not empty */
#define CGI_IsEmpty(var) (!(var) || ((var)[0] == 0))
/*
** Return true if the server that started the cgi running is using
** security (https).
*/
extern DSBool CGI_IsSecureServer(void);
/*
** Concatenate strings to produce a single string.
*/
extern char *CGI_Cat(char *, ...);
/* Escape a string, cgi style */
char *CGI_Escape(char *in);
XP_END_PROTOS
#endif /* __cgi_h_ */

59
mozilla/include/client.h Normal file
View File

@@ -0,0 +1,59 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.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 should be included after xp_mcom.h
*
* All definitions for intermodule communications in the Netscape
* client should be contained in this file
*/
#ifndef _CLIENT_H_
#define _CLIENT_H_
#define NEW_FE_CONTEXT_FUNCS
/* include header files needed for prototypes/etc */
#include "xp_mcom.h"
#include "ntypes.h" /* typedefs for commonly used Netscape data structures */
#include "fe_proto.h" /* all the standard FE functions */
#include "proto.h" /* library functions */
/* global data structures */
#include "structs.h"
#include "merrors.h"
#ifndef XP_MAC /* don't include everything in the world */
/* --------------------------------------------------------------------- */
/* include other bits of the Netscape client library */
#include "lo_ele.h" /* Layout structures */
#include "net.h"
#include "gui.h"
#include "shist.h"
#include "hotlist.h"
#include "glhist.h"
#include "mime.h"
#endif /* !XP_MAC */
#endif /* _CLIENT_H_ */

220
mozilla/include/csid.h Normal file
View File

@@ -0,0 +1,220 @@
/* -*- 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.
*/
/* csid.h */
#ifndef _CSID_H_
#define _CSID_H_
/* Codeset type */
#define SINGLEBYTE 0x0000 /* 0000 0000 0000 0000 = 0 */
#define MULTIBYTE 0x0100 /* 0000 0001 0000 0000 = 256 */
#define STATEFUL 0x0200 /* 0000 0010 0000 0000 = 512 */
#define WIDECHAR 0x0300 /* 0000 0011 0000 0000 = 768 */
#define CODESET_MASK 0x0F00 /* 0000 1111 0000 0000 = 3840 */
/*
* Check for double byte encodings
* (should distinguish 2 byte from true multibyte)
*/
#define IS_16BIT_ENCODING(x) (((x)&CODESET_MASK) == MULTIBYTE)
/* line-break on spaces */
#define CS_SPACE 0x0400 /* 0000 0100 0000 0000 = 1024 */
/* Auto Detect Mode */
#define CS_AUTO 0x0800 /* 0000 1000 0000 0000 = 2048 */
/* Code Set IDs */
/* CS_DEFAULT: used if no charset param in header */
/* CS_UNKNOWN: used for unrecognized charset */
/* type id */
#define CS_DEFAULT (SINGLEBYTE | 0) /* 0 */
#define CS_ASCII (SINGLEBYTE | 1) /* 1 */
#define CS_LATIN1 (SINGLEBYTE | 2) /* 2 */
#define CS_JIS (STATEFUL | 3) /* 515 */
#define CS_SJIS (MULTIBYTE | 4) /* 260 */
#define CS_EUCJP (MULTIBYTE | 5) /* 261 */
#define CS_JIS_AUTO (CS_AUTO|STATEFUL | 3) /* 2563 */
#define CS_SJIS_AUTO (CS_AUTO|MULTIBYTE | 4) /* 2308 */
#define CS_EUCJP_AUTO (CS_AUTO|MULTIBYTE | 5) /* 2309 */
#define CS_MAC_ROMAN (SINGLEBYTE | 6) /* 6 */
#define CS_BIG5 (MULTIBYTE | 7) /* 263 */
#define CS_GB_8BIT (MULTIBYTE | 8) /* 264 */
#define CS_CNS_8BIT (MULTIBYTE | 9) /* 265 */
#define CS_LATIN2 (SINGLEBYTE | 10) /* 10 */
#define CS_MAC_CE (SINGLEBYTE | 11) /* 11 */
#define CS_KSC_8BIT (MULTIBYTE|CS_SPACE | 12) /* 1292 */
#define CS_KSC_8BIT_AUTO (CS_AUTO | MULTIBYTE|CS_SPACE | 12)
#define CS_2022_KR (STATEFUL | 13) /* 525 */
#define CS_8859_3 (SINGLEBYTE | 14) /* 14 */
#define CS_8859_4 (SINGLEBYTE | 15) /* 15 */
#define CS_8859_5 (SINGLEBYTE | 16) /* 16 ISO Cyrillic */
#define CS_8859_6 (SINGLEBYTE | 17) /* 17 ISO Arabic */
#define CS_8859_7 (SINGLEBYTE | 18) /* 18 ISO Greek */
#define CS_8859_8 (SINGLEBYTE | 19) /* 19 ISO Hebrew */
#define CS_8859_9 (SINGLEBYTE | 20) /* 20 */
#define CS_SYMBOL (SINGLEBYTE | 21) /* 21 */
#define CS_DINGBATS (SINGLEBYTE | 22) /* 22 */
#define CS_DECTECH (SINGLEBYTE | 23) /* 23 */
#define CS_CNS11643_1 (MULTIBYTE | 24) /* 280 */
#define CS_CNS11643_2 (MULTIBYTE | 25) /* 281 */
#define CS_JISX0208 (MULTIBYTE | 26) /* 282 */
#define CS_JISX0201 (SINGLEBYTE | 27) /* 27 */
#define CS_KSC5601 (MULTIBYTE | 28) /* 284 */
#define CS_TIS620 (SINGLEBYTE | 29) /* 29 */
#define CS_JISX0212 (MULTIBYTE | 30) /* 286 */
#define CS_GB2312 (MULTIBYTE | 31) /* 287 */
#define CS_UCS2 (WIDECHAR | 32) /* 810 */
#define CS_UCS4 (WIDECHAR | 33) /* 811 */
#define CS_UTF8 (MULTIBYTE | 34) /* 290 */
#define CS_UTF7 (STATEFUL | 35) /* 35 */
#define CS_NPC (MULTIBYTE | 36) /* 292 */
#define CS_X_BIG5 (MULTIBYTE | 37) /* 293 */
#define CS_USRDEF2 (SINGLEBYTE | 38) /* 38 */
#define CS_KOI8_R (SINGLEBYTE | 39) /* 39 */
#define CS_MAC_CYRILLIC (SINGLEBYTE | 40) /* 40 */
#define CS_CP_1251 (SINGLEBYTE | 41) /* 41 CP1251 Windows Cyrillic */
#define CS_MAC_GREEK (SINGLEBYTE | 42) /* 42 */
/* CS_CP_1253 should be deleted, we should use CS_8859_7 instead */
#define CS_CP_1253 (SINGLEBYTE | 43) /* 43 CP1253 Windows Greek */
#define CS_CP_1250 (SINGLEBYTE | 44) /* 44 CP1250 Windows C. Europe */
/* CS_CP_1254 should be deleted, we should use CS_8859_9 instead */
#define CS_CP_1254 (SINGLEBYTE | 45) /* 45 CP1254 Windows Turkish */
#define CS_MAC_TURKISH (SINGLEBYTE | 46) /* 46 */
#define CS_GB2312_11 (MULTIBYTE | 47) /* 303 */
#define CS_JISX0208_11 (MULTIBYTE | 48) /* 304 */
#define CS_KSC5601_11 (MULTIBYTE | 49) /* 305 */
#define CS_CNS11643_1110 (MULTIBYTE | 50) /* 306 */
#define CS_UCS2_SWAP (WIDECHAR | 51) /* 819 */
#define CS_IMAP4_UTF7 (STATEFUL | 52) /* 564 */
#define CS_CP_850 (SINGLEBYTE | 53) /* 53 PC Latin 1 */
#define CS_CP_852 (SINGLEBYTE | 54) /* 54 PC Latin 2 */
#define CS_CP_855 (SINGLEBYTE | 55) /* 55 PC Cyrillic */
#define CS_CP_857 (SINGLEBYTE | 56) /* 56 PC Turkish */
#define CS_CP_862 (SINGLEBYTE | 57) /* 57 PC Hebrew */
#define CS_CP_864 (SINGLEBYTE | 58) /* 58 PC Arabic */
#define CS_CP_866 (SINGLEBYTE | 59) /* 59 PC Russian */
#define CS_CP_874 (SINGLEBYTE | 60) /* 60 PC Thai */
#define CS_CP_1257 (SINGLEBYTE | 61) /* 61 Windows Baltic */
#define CS_CP_1258 (SINGLEBYTE | 62) /* 62 Windows Vietnamese */
#define INTL_CHAR_SET_MAX 63 /* must be highest + 1 */
#define CS_USER_DEFINED_ENCODING (SINGLEBYTE | 254) /* 254 */
#define CS_UNKNOWN (SINGLEBYTE | 255) /* 255 */
#define IS_UTF8_CSID(x) (((x)&0xFF)== (CS_UTF8&0xFF))
#define IS_UNICODE_CSID(x) \
( (((x)&0xFF)== (CS_UCS2&0xFF)) \
|| (((x)&0xFF)== (CS_UTF8&0xFF)) \
|| (((x)&0xFF)== (CS_UTF7&0xFF)) )
/* The trigger is passing the parameter to
PA_FetchParamValue() to satisfy its signature */
#ifdef XP_MAC
#define CS_FE_ASCII CS_MAC_ROMAN
#else
#define CS_FE_ASCII CS_LATIN1
#endif
/* Codeset # sorted by number */
#if 0
0 CS_DEFAULT 0
1 CS_ASCII 1
2 CS_LATIN1 2
6 CS_MAC_ROMAN 6
10 CS_LATIN2 10
11 CS_MAC_CE 11
14 CS_8859_3 14
15 CS_8859_4 15
16 CS_8859_5 16
17 CS_8859_6 17
18 CS_8859_7 18
19 CS_8859_8 19
20 CS_8859_9 20
21 CS_SYMBOL 21
22 CS_DINGBATS 22
23 CS_DECTECH 23
27 CS_JISX0201 27
29 CS_TIS620 29
35 CS_UTF7 35
38 CS_USRDEF2 38
39 CS_KOI8_R 39
40 CS_MAC_CYRILLIC 40
41 CS_CP_1251 41
42 CS_MAC_GREEK 42
43 CS_CP_1253 43
44 CS_CP_1250 44
45 CS_CP_1254 45
46 CS_MAC_TURKISH 46
53 CS_CP_850 53
54 CS_CP_852 54
55 CS_CP_855 55
56 CS_CP_857 56
57 CS_CP_862 57
58 CS_CP_864 58
59 CS_CP_866 59
59 CS_CP_874 60
60 CS_CP_1257 61
61 CS_CP_1258 62
62 INTL_CHAR_SET_MAX 63
254 CS_USER_DEFINED_ENCODING 254
255 CS_UNKNOWN 255
260 CS_SJIS 260
261 CS_EUCJP 261
263 CS_BIG5 263
264 CS_GB_8BIT 264
265 CS_CNS_8BIT 265
280 CS_CNS11643_1 280
281 CS_CNS11643_2 281
282 CS_JISX0208 282
284 CS_KSC5601 284
286 CS_JISX0212 286
287 CS_GB2312 287
290 CS_UTF8 290
292 CS_NPC 292
293 CS_X_BIG5 293
303 CS_GB2312_11 303
304 CS_JISX0208_11 304
305 CS_KSC5601_11 305
306 CS_CNS11643_1110 306
515 CS_JIS 515
525 CS_2022_KR 525
564 CS_IMAP4_UTF7 564
810 CS_UCS2 810
811 CS_UCS4 811
819 CS_UCS2_SWAP 819
1292 CS_KSC_8BIT 1292
2308 CS_SJIS_AUTO 2308
2309 CS_EUCJP_AUTO 2309
2563 CS_JIS_AUTO 2563
#endif
#endif /* _CSID_H_ */

View File

@@ -0,0 +1,36 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* the context function table
*
* This was typedef'd to ContextFuncs in structs.h
*/
#ifndef _ContextFunctions_
#define _ContextFunctions_
#include "il_types.h"
#include "cl_types.h"
#include "xp_obs.h"
struct _ContextFuncs {
#define MAKE_FE_FUNCS_STRUCT
#include "mk_cx_fn.h"
};
#endif /* _ContextFunctions_ */

View File

@@ -0,0 +1,41 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef CV_ACTIVE
#define CV_ACTIVE
#include "net.h"
/* define a constant to be passed to CV_MakeMultipleDocumentStream
* as the data_object to signify that it should return
* MK_END_OF_MULTIPART_MESSAGE when it gets to the end
* of the multipart instead of waiting for the complete
* function to be called
*/
#define CVACTIVE_SIGNAL_AT_END_OF_MULTIPART 999
XP_BEGIN_PROTOS
extern NET_StreamClass *
CV_MakeMultipleDocumentStream (int format_out,
void *data_object,
URL_Struct *URL_s,
MWContext *window_id);
XP_END_PROTOS
#endif /* CV_ACTIVE */

223
mozilla/include/dirprefs.h Normal file
View File

@@ -0,0 +1,223 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _DIRPREFS_H_
#define _DIRPREFS_H_
#define kCurrentListVersion 1
/* DIR_Server.dirType */
typedef enum
{
LDAPDirectory,
HTMLDirectory,
PABDirectory
} DirectoryType;
typedef enum
{
cn,
givenname,
sn,
mail,
telephonenumber,
o,
ou,
l,
street,
auth,
custom1,
custom2,
custom3,
custom4,
custom5
} DIR_AttributeId;
typedef struct _DIR_ReplicationInfo DIR_ReplicationInfo;
typedef struct DIR_Server
{
char *description; /* human readable name */
char *serverName; /* network host name */
char *searchBase; /* DN suffix to search at */
char *fileName; /* XP path name of local DB */
char *prefId; /* name of this server's tree in JS prefs */
int port; /* network port number */
int maxHits; /* maximum number of hits to return */
XP_Bool isSecure; /* use SSL? */
XP_Bool saveResults;
XP_Bool efficientWildcards; /* server can match substrings */
char *lastSearchString; /* required if saving results */
DirectoryType dirType;
uint32 flags;
/* site-configurable attributes and filters */
XP_List *customFilters;
XP_List *customAttributes;
char *tokenSeps;
XP_Bool stopFiltersOnHit;
XP_Bool isOffline;
/* site-configurable list of attributes whose values are DNs */
char **dnAttributes;
int dnAttributesCount;
/* site-configurable list of attributes we shouldn't display in HTML */
char **suppressedAttributes;
int suppressedAttributesCount;
/* site-configurable list of attributes for the Basic Search dialog */
DIR_AttributeId *basicSearchAttributes;
int basicSearchAttributesCount;
/* site-configurable URL to open LDAP results */
char *customDisplayUrl;
/* authentication fields */
XP_Bool enableAuth; /* Use DN and password when binding? */
XP_Bool savePassword; /* Remember the DN and password we gave? */
char *authDn; /* DN to give to authenticate as */
char *password; /* Password for the DN */
/* replication fields */
DIR_ReplicationInfo *replInfo;
} DIR_Server;
XP_BEGIN_PROTOS
/* Return the list of directory servers
* each front end hangs on to the list
*/
XP_List * FE_GetDirServers(void);
/* Since the strings in DIR_Server are allocated, we have bottleneck
* routines to help with memory mgmt
*/
int DIR_CopyServer (DIR_Server *in, DIR_Server **out);
int DIR_DeleteServer (DIR_Server *);
int DIR_InitServer (DIR_Server *);
int DIR_ValidateServer (DIR_Server *);
XP_Bool DIR_AreServersSame (DIR_Server *first, DIR_Server *second);
int DIR_DeleteServerList(XP_List *wholeList);
int DIR_GetLdapServers (XP_List *wholeList, XP_List *subList);
int DIR_ReorderLdapServers (XP_List *wholeList);
/* These two routines should be called to initialize and save
* directory preferences from the XP Java Script preferences
*/
int DIR_GetServerPreferences (XP_List **list, const char* pabFile);
int DIR_SaveServerPreferences (XP_List *wholeList);
/* This routine will clean up files for deleted directories */
int DIR_CleanUpServerPreferences(XP_List *deletedList);
#if 1
/* Returns a pointer into the list (not allocated, so don't free) */
int DIR_GetPersonalAddressBook (XP_List *wholeList, DIR_Server **pab);
int DIR_GetComposeNameCompletionAddressBook (XP_List *wholeList, DIR_Server **cab);
#else
/* Returns an allocated list of all personal address books, excluding
* LDAP directories, replicated directories, and CABs
*/
XP_List *DIR_GetPersonalAddressBooks (XP_List *wholeList);
XP_List *DIR_GetAddressBooksForCompletion (XP_List *wholeList);
#endif
void DIR_GetServerFileName(char** filename, const char* leafName);
void DIR_SetServerFileName(DIR_Server* pServer, const char* leafName);
/* APIs for site-configurability of LDAP attribute names and
* search filter behavior.
*
* Strings are NOT allocated, and arrays are NULL-terminated
*/
const char *DIR_GetAttributeName (DIR_Server *server, DIR_AttributeId id);
const char **DIR_GetAttributeStrings (DIR_Server *server, DIR_AttributeId id);
const char *DIR_GetFirstAttributeString (DIR_Server *server, DIR_AttributeId id);
const char *DIR_GetFilterString (DIR_Server *server);
const char *DIR_GetTokenSeparators (DIR_Server *server);
XP_Bool DIR_RepeatFilterForTokens (DIR_Server *server, const char *filter);
XP_Bool DIR_SubstStarsForSpaces (DIR_Server *server, const char *filter);
XP_Bool DIR_UseCustomAttribute (DIR_Server *server, DIR_AttributeId id);
XP_Bool DIR_IsDnAttribute (DIR_Server *s, const char *attr);
XP_Bool DIR_IsAttributeExcludedFromHtml (DIR_Server *s, const char *attr);
int DIR_AttributeNameToId (const char *attrName, DIR_AttributeId *id);
/* APIs for authentication */
void DIR_SetAuthDN (DIR_Server *s, const char *dn);
void DIR_SetPassword (DIR_Server *s, const char *password);
/* APIs for unescaping LDAP special chars */
char *DIR_Unescape (const char *src, XP_Bool makeHtml);
XP_Bool DIR_IsEscapedAttribute (DIR_Server *s, const char *attrib);
/* APIs for replication */
int DIR_ValidateRootDSE (DIR_Server *s, int32 gen, int32 first, int32 last);
/* API for building a URL */
char *DIR_BuildUrl (DIR_Server *s, const char *dn, XP_Bool forAddToAB);
/* Flags manipulation */
#define DIR_AUTO_COMPLETE_ENABLED 0x00000001
#define DIR_ENABLE_AUTH 0x00000002
#define DIR_SAVE_PASSWORD 0x00000004
#define DIR_UTF8_DISABLED 0x00000008 /* not used by the FEs */
#define DIR_IS_SECURE 0x00000010
#define DIR_SAVE_RESULTS 0x00000020 /* not used by the FEs */
#define DIR_EFFICIENT_WILDCARDS 0x00000040 /* not used by the FEs */
#define DIR_LDAPV3_SUPPORTED 0x00000080 /* not used by the FEs */
#define DIR_LDAPV3_NOT_SUPPORTED 0x00000100 /* not used by the FEs */
#define DIR_VIRTUAL_LISTBOX_SUPPORTED 0x00000200 /* not used by the FEs */
#define DIR_VIRTUAL_LISTBOX_NOT_SUPPORTED 0x00000400 /* not used by the FEs */
void DIR_SetAutoCompleteEnabled (XP_List *list, DIR_Server *server, XP_Bool onOrOff);
XP_Bool DIR_TestFlag (DIR_Server *server, uint32 flag);
void DIR_SetFlag (DIR_Server *server, uint32 flag);
void DIR_ClearFlag (DIR_Server *server, uint32 flag);
void DIR_ForceFlag (DIR_Server *server, uint32 flag, XP_Bool forceOnOrOff);
char *DIR_ConvertToServerCharSet (DIR_Server *s, char *src, int16 srcCsid);
char *DIR_ConvertFromServerCharSet (DIR_Server *s, char *src, int16 dstCsid);
#ifdef MOZ_LDAP
/* Does the LDAP client lib work for SSL */
#include "ldap.h"
int DIR_SetupSecureConnection (LDAP *ld);
#endif /* MOZ_LDAP */
XP_END_PROTOS
#endif /* dirprefs.h */

267
mozilla/include/ds.h Normal file
View File

@@ -0,0 +1,267 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef __DS_h_
#define __DS_h_
#ifdef XP_WIN32
#include <windows.h>
#endif /* XP_WIN32 */
#ifdef XP_OS2
#define INCL_WIN
#define INCL_GPI
#define TID OS2TID /* global rename in OS2 H's! */
#include <os2.h>
#undef TID /* and restore */
#endif
#include "xp_mcom.h"
XP_BEGIN_PROTOS
/* Typedefs */
typedef struct DSArrayStr DSArray;
typedef struct DSLinkStr DSLink;
typedef struct DSListStr DSList;
typedef struct DSArenaStr DSArena;
#define DS_MIN(a,b) ((a)<(b)?(a):(b))
#define DS_MAX(a,b) ((a)>(b)?(a):(b))
/*
** Your basic boolean. Done as an enum to cause compiler warnings when a
** boolean procedure doesn't return the right value.
** LISA SEZ: Please do not use this; use PRBool instead. Eventually
** (as soon as I can "make it so") DSBool is going away in favor of PRBool.
*/
typedef enum DSBoolEnum {
DSTrue = 1,
DSFalse = 0
} DSBool;
/*
** A status code. Status's are used by procedures that return status
** values. Again the motivation is so that a compiler can generate
** warnings when return values are wrong. Correct testing of status codes:
**
** DSStatus rv;
** rv = some_function (some_argument);
** if (rv != DSSuccess)
** do_an_error_thing();
**
*/
typedef enum DSStatusEnum {
DSWouldBlock = -2,
DSFailure = -1,
DSSuccess = 0
} DSStatus;
/*
** A comparison code. Used for procedures that return comparision
** values. Again the motivation is so that a compiler can generate
** warnings when return values are wrong.
*/
typedef enum DSComparisonEnum {
DSLessThan = -1,
DSEqual = 0,
DSGreaterThan = 1
} DSComparison;
typedef void (*DSElementFreeFunc)(void *e1, DSBool freeit);
typedef int (*DSElementCompareFunc)(void *e1, void *e2);
/************************************************************************/
/*
** Simple variable length array of pointers. The array keeps a NULL
** pointer at the end of the array.
*/
struct DSArrayStr {
void **things;
DSElementFreeFunc freeElement;
};
extern DSArray *DS_CreateArray(int slots);
extern DSStatus DS_GrowArray(DSArray *da, int slots);
extern void DS_SetArrayMethods(DSArray *da, DSElementFreeFunc free);
extern void DS_DestroyArray(DSArray *da, DSBool freeit);
extern void DS_Sort(DSArray *da, DSElementCompareFunc compare);
extern int DS_Elements(DSArray *da);
extern DSStatus DS_AddElement(DSArray *da, void *element);
extern void DS_RemoveElement(DSArray *da, void *element);
/************************************************************************/
/*
** Circular linked list. Each link contains a pointer to the object that
** is actually in the list.
*/
struct DSLinkStr {
DSLink *next;
DSLink *prev;
void *thing;
};
struct DSListStr {
DSLink link;
};
#define DS_InitList(lst) \
{ \
(lst)->link.next = &(lst)->link; \
(lst)->link.prev = &(lst)->link; \
(lst)->link.thing = 0; \
}
#define DS_ListEmpty(lst) \
((lst)->link.next == &(lst)->link)
#define DS_ListHead(lst) \
((lst)->link.next)
#define DS_ListTail(lst) \
((lst)->link.prev)
#define DS_ListIterDone(lst,lnk) \
((lnk) == &(lst)->link)
#define DS_AppendLink(lst,lnk) \
{ \
(lnk)->next = &(lst)->link; \
(lnk)->prev = (lst)->link.prev; \
(lst)->link.prev->next = (lnk); \
(lst)->link.prev = (lnk); \
}
#define DS_InsertLink(lst,lnk) \
{ \
(lnk)->next = (lst)->link.next; \
(lnk)->prev = &(lst)->link; \
(lst)->link.next->prev = (lnk); \
(lst)->link.next = (lnk); \
}
#define DS_RemoveLink(lnk) \
{ \
(lnk)->next->prev = (lnk)->prev; \
(lnk)->prev->next = (lnk)->next; \
(lnk)->next = 0; \
(lnk)->prev = 0; \
}
extern DSLink *DS_NewLink(void *thing);
extern DSLink *DS_FindLink(DSList *lst, void *thing);
extern void DS_DestroyLink(DSLink *lnk, DSBool freeit);
/************************************************************************/
/*
** Memory manager
*/
/*
** at one time XP_Block was a float* to force clients to cast things
** before use. Now DSBlock is defined since that will be most convenient
** for almost all uses.
*/
typedef unsigned char *DSBlock;
/*
** Allocate some memory. Always allocates at least one byte of memory.
*/
extern void *DS_Alloc(size_t bytes);
/*
** Reallocate some memory, growing or shrinking the memory.
*/
extern void *DS_Realloc(void *oldptr, size_t bytes);
/*
** Allocate and then zero some memory. Always allocates at least one byte
** of memory.
*/
extern void *DS_Zalloc(size_t bytes);
/*
** Allocate a block of memory. Always allocates at least one byte of
** memory.
*/
extern DSBlock DS_AllocBlock(size_t bytes);
/*
** Reallocate a block of memory, growing or shrinking the memory block.
*/
extern DSBlock DS_ReallocBlock(DSBlock block, size_t newBytes);
/*
** Free a block of memory. Safe to use on null pointers.
*/
extern void DS_FreeBlock(DSBlock block);
/*
** Free a chunk of memory. Safe to use on null pointers.
*/
extern void DS_Free(void *ptr);
/*
** Zero and then free a chunk of memory. Safe to use on null pointers.
*/
extern void DS_Zfree(void *ptr, size_t bytes);
/*
* Low cost Malloc Arenas.
*
* The chunks are a linked list.
* The beginning of each chunk is a pointer to the next chunk.
*/
struct DSArenaStr {
unsigned long chunkSize; /* size of each chunk */
unsigned int refCount; /* reference count */
void ** firstChunk; /* pointer to first chunk */
void ** lastChunk; /* pointer to last chunk */
void * pLast; /* last item allocated */
void * pCur; /* beginning of free area */
void * pCurEnd; /* end of free area in current chunk */
};
/* make a new arena */
extern DSArena *
DS_NewArena(unsigned long chunkSize);
/* destroy an arena, and free all memory associated with it */
extern void
DS_FreeArena(DSArena *arena, DSBool zero);
/* malloc a chunk of data from the arena */
extern void *
DS_ArenaAlloc(DSArena *arena, unsigned long size);
/* malloc a chunk of data from the arena, zero filling it */
extern void *
DS_ArenaZalloc(DSArena *arena, unsigned long size);
/* change the size of an object, works best if it was the last object
* allocated
*/
extern void *
DS_ArenaGrow(DSArena *arena, void *pOld, unsigned long oldsize,
unsigned long newsize);
XP_END_PROTOS
#endif /* __DS_h_ */

33
mozilla/include/dserr.h Normal file
View File

@@ -0,0 +1,33 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef __DS_ERR_h_
#define __DS_ERR_h_
#define DS_ERROR_BASE (-0x1000)
#define DS_ERROR_LIMIT (DS_ERROR_BASE + 1000)
#define IS_DS_ERROR(code) \
(((code) >= DS_ERROR_BASE) && ((code) < DS_ERROR_LIMIT))
/*
** DS library error codes
*/
#define DS_ERROR_OUT_OF_MEMORY (DS_ERROR_BASE + 0)
#endif /* __DS_ERR_h_ */

1378
mozilla/include/edt.h Normal file

File diff suppressed because it is too large Load Diff

653
mozilla/include/edttypes.h Normal file
View File

@@ -0,0 +1,653 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* File defines external editor types.
*
* These types are remapped internally to the editor.
*/
#ifndef _edt_types_h_
#define _edt_types_h_
#ifndef EDITOR_TYPES
#define ED_Element void
#define ED_Buffer void
#define ED_TagCursor void
#define ED_BitArray void
#endif
#include "xp_core.h"
/* Number of "Netscape Colors" All are in
* Color cube
*/
#define MAX_NS_COLORS 70
typedef int32 ED_BufferOffset;
/*
* Handle to Internal structure used for maintaining links.
*/
typedef struct ED_Link* ED_LinkId;
#define ED_LINK_ID_NONE 0
/* this id is passed to FE_GetImageData.. when it returns, we know to pass
* the call to EDT_SetImageData
*/
#define ED_IMAGE_LOAD_HACK_ID -10
typedef enum {
ED_ELEMENT_NONE, /* Not returned from EDT_GetCurrentElement, needed to have a "not known" value */
ED_ELEMENT_SELECTION, /* a selection instead of a single element */
ED_ELEMENT_TEXT,
ED_ELEMENT_IMAGE,
ED_ELEMENT_HRULE,
ED_ELEMENT_UNKNOWN_TAG,
ED_ELEMENT_TARGET,
ED_ELEMENT_TABLE, /* Keep these at the end so we can use type >= ED_ELEMENT_TABLE to test for any of them */
ED_ELEMENT_CELL,
ED_ELEMENT_ROW, /* May not need these. Currently returning ED_ELEMENT_CELL instead */
ED_ELEMENT_COL
} ED_ElementType;
typedef enum {
ED_CARET_BEFORE = 0,
ED_CARET_AFTER = 1
} ED_CaretObjectPosition;
#define TF_NONE 0
#define TF_BOLD 1
#define TF_ITALIC 2
#define TF_FIXED 4
#define TF_SUPER 8
#define TF_SUB 0x10
#define TF_STRIKEOUT 0x20
#define TF_BLINK 0x40
#define TF_FONT_COLOR 0x80 /* set if font has color */
#define TF_FONT_SIZE 0x100 /* set if font has size */
#define TF_HREF 0x200
#define TF_SERVER 0x400
#define TF_SCRIPT 0x800
#define TF_STYLE 0x1000
#define TF_UNDERLINE 0x2000
#define TF_FONT_FACE 0x4000
#define TF_NOBREAK 0x8000
#define TF_SPELL 0x10000
#define TF_INLINEINPUT 0x20000
#define TF_INLINEINPUTTHICK 0x40000
#define TF_INLINEINPUTDOTTED 0x80000
#define TF_FONT_WEIGHT 0x100000
#define TF_FONT_POINT_SIZE 0x200000
typedef int32 ED_TextFormat; /* Prefered type for the editor text format. */
typedef ED_TextFormat ED_ETextFormat; /* Alias for old code. Remove when possible. */
/* Similar to ED_TextFormat. Used when multiple cells are represented in EDT_TableCellData */
#define CF_NONE 0
#define CF_ALIGN 1
#define CF_VALIGN 2
#define CF_COLSPAN 4
#define CF_ROWSPAN 8
#define CF_HEADER 0x10
#define CF_NOWRAP 0x20
#define CF_WIDTH 0x40
#define CF_HEIGHT 0x80
#define CF_BACK_COLOR 0x100
#define CF_BACK_IMAGE 0x200
#define CF_BACK_NOSAVE 0x400
#define CF_EXTRA_HTML 0x800
typedef int32 ED_CellFormat; /* Prefered type for the editor cell format. */
/*
* The names here are confusing, and have a historical basis that is
* lost in the mists of time. The trouble is that the "ED_ALIGN_CENTER"
* tag is really "abscenter", while the ED_ALIGN_ABSCENTER tag is
* really "center". (and the same for the TOP and BOTTOM tags.)
*
* Someday, if we have a lot of spare time we could switch the names.
*/
/* CLM: Swapped bottom and center tags -- should match latest extensions now?
* Note: BASELINE is not written out (this is default display mode)
*/
typedef enum {
ED_ALIGN_DEFAULT = -1,
ED_ALIGN_CENTER = 0, /* abscenter */
ED_ALIGN_LEFT = 1, /* left */
ED_ALIGN_RIGHT = 2, /* right */
ED_ALIGN_TOP = 3, /* texttop */
ED_ALIGN_BOTTOM = 4, /* absbottom */
ED_ALIGN_BASELINE = 5, /* baseline */
ED_ALIGN_ABSCENTER = 6, /* center */
ED_ALIGN_ABSBOTTOM = 7, /* bottom */
ED_ALIGN_ABSTOP = 8 /* top */
} ED_Alignment;
/*------------------- TABLE SIZING AND SELECTION --------------------*/
/* SizeStyle defines */
#define ED_SIZE_NONE 0
#define ED_SIZE_TOP 0x0001
#define ED_SIZE_RIGHT 0x0002
#define ED_SIZE_BOTTOM 0x0004
#define ED_SIZE_LEFT 0x0008
#define ED_SIZE_ADD_ROWS 0x0010
#define ED_SIZE_ADD_COLS 0x0020
/* Hotspot at corners */
#define ED_SIZE_TOP_RIGHT (ED_SIZE_TOP | ED_SIZE_RIGHT)
#define ED_SIZE_BOTTOM_RIGHT (ED_SIZE_BOTTOM | ED_SIZE_RIGHT)
#define ED_SIZE_TOP_LEFT (ED_SIZE_TOP | ED_SIZE_LEFT)
#define ED_SIZE_BOTTOM_LEFT (ED_SIZE_BOTTOM | ED_SIZE_LEFT)
typedef intn ED_SizeStyle;
typedef enum { /* Return value for EDT_GetTableHitRegion) */
ED_HIT_NONE,
ED_HIT_SEL_TABLE, /* Upper left corner */
ED_HIT_SEL_COL, /* Near top table border */
ED_HIT_SEL_ROW, /* Near left table border */
ED_HIT_SEL_CELL, /* Near top cell border */
ED_HIT_SEL_ALL_CELLS, /* Upper left corner when Ctrl is pressed */
ED_HIT_SIZE_TABLE_WIDTH, /* Near right table border */
ED_HIT_SIZE_TABLE_HEIGHT, /* Near bottom table border */
ED_HIT_SIZE_COL, /* Near right border of a cell and between columns */
ED_HIT_SIZE_ROW, /* Near bottom border of a cell and between columns */
ED_HIT_ADD_ROWS, /* Lower left corner */
ED_HIT_ADD_COLS, /* Lower right corner */
ED_HIT_DRAG_TABLE, /* Near bottom border and between rows when table or cell is already selected */
ED_HIT_CHANGE_COLSPAN, /* Near Right border of cell having COLSPAN (Not used yet) */
ED_HIT_CHANGE_ROWSPAN /* Bottom edge of cell having ROWSPAN (Not used yet) */
} ED_HitType;
typedef enum { /* Return types for EDT_GetTableDragDropRegion */
ED_DROP_NONE, /* Don't allow drop - when pasting wouldn't change anything */
ED_DROP_NORMAL, /* No special table behavior - do the same as any HTML drop */
ED_DROP_INSERT_BEFORE, /* Between columns - near left border of cell when source = column */
ED_DROP_INSERT_AFTER, /* Between columns - near right border of cell when source = column */
ED_DROP_INSERT_ABOVE, /* Between rows - near top border of cell when source = row */
ED_DROP_INSERT_BELOW, /* Between rows - near bottom border of cell when source = row */
ED_DROP_REPLACE_CELL, /* Inside cell - when we want to replace cell contents */
ED_DROP_APPEND_CONTENTS /* Inside cell - when we append to existing contents */
} ED_DropType;
struct _EDT_DragTableData {
ED_HitType iSourceType; /* One of the ED_HIT_SEL_... enums */
ED_DropType iDropType; /* One of above enum values */
LO_Element *pFirstSelectedCell; /* First cell in source being dragged */
LO_Element *pDragOverCell; /* Cell being dragged over */
intn iRows; /* Number of rows */
intn iColumns; /* and columns in selection */
int32 X; /* Location to place highlighting or make caret */
int32 Y; /* to show where to drop cells */
int32 iWidth;
int32 iHeight;
};
typedef struct _EDT_DragTableData EDT_DragTableData;
typedef enum { /* Return values from EDT_GetMergeCellsType */
ED_MERGE_NONE,
ED_MERGE_NEXT_CELL,
ED_MERGE_SELECTED_CELLS
} ED_MergeType;
/* Used with EDT_ChangeTableSelection to tell if we should move
* to next Cell, Row, or Columns along with changing the selected cells
*/
typedef enum {
ED_MOVE_NONE,
ED_MOVE_PREV,
ED_MOVE_NEXT
} ED_MoveSelType;
/*--------------------------- HREF --------------------------------*/
struct _EDT_HREFData {
char *pURL;
char *pExtra;
};
typedef struct _EDT_HREFData EDT_HREFData;
/*--------------------------- Image --------------------------------*/
struct _EDT_ImageData {
XP_Bool bIsMap;
/* char *pUseMap; created with XP_ALLOC() Now in pExtra, hardts */
ED_Alignment align;
char *pSrc;
char *pLowSrc;
char *pName;
char *pAlt;
int32 iWidth;
int32 iHeight;
XP_Bool bWidthPercent; /* Range: 1 - 100 if TRUE, else = pixels (default) */
XP_Bool bHeightPercent;
int32 iHSpace;
int32 iVSpace;
int32 iBorder;
/* Added hardts */
XP_Bool bNoSave;
/* Added by CLM: */
int32 iOriginalWidth; /* Width and Height we got on initial loading */
int32 iOriginalHeight;
EDT_HREFData *pHREFData;
char *pExtra;
};
typedef struct _EDT_ImageData EDT_ImageData;
/*--------------------------- Target --------------------------------*/
struct _EDT_TargetData {
char *pName;
char *pExtra;
};
typedef struct _EDT_TargetData EDT_TargetData;
/*--------------------------- Character --------------------------------*/
#define ED_FONT_POINT_SIZE_DEFAULT 0
#define ED_FONT_POINT_SIZE_MIN 1
#define ED_FONT_POINT_SIZE_MAX 1000
#define ED_FONT_WEIGHT_MIN 100
#define ED_FONT_WEIGHT_NORMAL 400
#define ED_FONT_WEIGHT_BOLD 700
#define ED_FONT_WEIGHT_MAX 900
enum {
ED_FONT_VARIABLE,
ED_FONT_FIXED,
ED_FONT_LOCAL
};
struct _EDT_CharacterData {
ED_TextFormat mask; /* bits to set or get */
ED_TextFormat values; /* values of the bits in the mask */
LO_Color *pColor; /* color if mask bit is set */
int32 iSize; /* size if mask bit is set */
EDT_HREFData *pHREFData; /* href if mask bit is set */
ED_LinkId linkId; /* internal use only */
char* pFontFace; /* FontFace name */
int16 iWeight; /* font weight range = 100-900, 400=Normal, 700=Bold*/
int16 iPointSize; /* not sure what default is! Use 0 to mean "default" */
};
typedef struct _EDT_CharacterData EDT_CharacterData;
/*--------------------------- Horizonal Rule --------------------------------*/
struct _EDT_HorizRuleData {
ED_Alignment align; /* only allows left and right alignment */
int32 size; /* value 1 to 100 indicates line thickness */
int32 iWidth; /* CM: default = 100% */
XP_Bool bWidthPercent; /* Range: 1 - 100 if TRUE(default), else = pixels */
XP_Bool bNoShade;
char *pExtra;
};
typedef struct _EDT_HorizRuleData EDT_HorizRuleData;
/*--------------------------- ContainerData --------------------------------*/
struct _EDT_ContainerData {
ED_Alignment align; /* only allows left and right alignment */
char *pExtra;
};
typedef struct _EDT_ContainerData EDT_ContainerData;
/*--------------------------- TableData --------------------------------*/
struct _EDT_TableData {
ED_Alignment align; /* ED_ALIGN_LEFT, ED_ALIGN_ABSCENTER, ED_ALIGN_RIGHT */
ED_Alignment malign; /* margin alignment: ED_ALIGN_DEFAULT, ED_ALIGN_LEFT, ED_ALIGN_RIGHT */
XP_Bool bUseCols; /* TRUE means COLS= will be output, which speeds up layout in 4.0 */
int32 iRows;
int32 iColumns;
XP_Bool bBorderWidthDefined;
int32 iBorderWidth;
int32 iCellSpacing;
int32 iCellPadding;
int32 iInterCellSpace;
XP_Bool bWidthDefined;
XP_Bool bWidthPercent;
int32 iWidth;
int32 iWidthPixels;
XP_Bool bHeightDefined;
XP_Bool bHeightPercent;
int32 iHeight;
int32 iHeightPixels;
LO_Color *pColorBackground; /* null in the default case */
char *pBackgroundImage; /* null in the default case */
XP_Bool bBackgroundNoSave;
char *pExtra;
};
typedef struct _EDT_TableData EDT_TableData;
/* iTableMode param for SetTableMode() */
#define ED_TABLE_PERCENT 0x0001 /* Convert table and all cells to use % of parent width */
#define ED_TABLE_PIXELS 0x0002 /* Convert table and all cells to use absolute pixels */
#define ED_TABLE_USE_CELL_WIDTH 0x0004 /* Set WIDTH param for all cells (facilitates table resizing) */
#define ED_TABLE_NO_CELL_WIDTH 0x0008 /* Remove WIDTH param for all cells */
#define ED_TABLE_USE_COLS 0x0010 /* Set COLS param for table (use only 1st row for column widths) */
#define ED_TABLE_NO_COLS 0x0020 /* Remove COLS param for table (all cell widths used) */
/*--------------------------- TableCaptionData --------------------------------*/
struct _EDT_TableCaptionData {
ED_Alignment align;
char *pExtra;
};
typedef struct _EDT_TableCaptionData EDT_TableCaptionData;
/*--------------------------- TableRowData --------------------------------*/
struct _EDT_TableRowData {
ED_Alignment align;
ED_Alignment valign;
LO_Color *pColorBackground; /* null in the default case */
char *pBackgroundImage; /* null in the default case */
XP_Bool bBackgroundNoSave;
char *pExtra;
};
typedef struct _EDT_TableRowData EDT_TableRowData;
/*--------------------------- TableCellData --------------------------------*/
struct _EDT_TableCellData {
ED_CellFormat mask; /* bits to tell us what we know for all cells */
ED_HitType iSelectionType; /* Either: ED_HIT_SEL_CELL, ED_HIT_SEL_COL, ED_HIT_SEL_ROW, or ED_HIT_NONE */
intn iSelectedCount; /* Number of cells selected. Usually >= 1 */
ED_Alignment align;
ED_Alignment valign;
int32 iColSpan;
int32 iRowSpan;
XP_Bool bHeader; /* TRUE == th, FALSE == td */
XP_Bool bNoWrap;
int32 X;
int32 Y;
intn iRow;
XP_Bool bWidthDefined;
XP_Bool bWidthPercent;
int32 iWidth;
int32 iWidthPixels;
XP_Bool bHeightDefined;
XP_Bool bHeightPercent;
int32 iHeight;
int32 iHeightPixels;
LO_Color *pColorBackground; /* null in the default case */
char *pBackgroundImage; /* null in the default case */
XP_Bool bBackgroundNoSave;
char *pExtra;
};
typedef struct _EDT_TableCellData EDT_TableCellData;
/*--------------------------- LayerData --------------------------------*/
struct _EDT_LayerData {
char *pExtra;
};
typedef struct _EDT_LayerData EDT_LayerData;
/*--------------------------- DivisionData --------------------------------*/
struct _EDT_DivisionData {
ED_Alignment align;
char *pExtra;
};
typedef struct _EDT_DivisionData EDT_DivisionData;
/*--------------------------- Page Properties --------------------------------*/
struct _EDT_MetaData {
XP_Bool bHttpEquiv; /* true, http-equiv="fdsfds", false name="fdsfds" */
char *pName; /* http-equiv's or name's value */
char *pContent;
};
typedef struct _EDT_MetaData EDT_MetaData;
struct _EDT_PageData {
LO_Color *pColorBackground; /* null in the default case */
LO_Color *pColorLink;
LO_Color *pColorText;
LO_Color *pColorFollowedLink;
LO_Color *pColorActiveLink;
char *pBackgroundImage;
XP_Bool bBackgroundNoSave;
char *pFontDefURL; /* For Web Fonts. */
XP_Bool bFontDefNoSave;
char *pTitle;
XP_Bool bKeepImagesWithDoc;
};
typedef struct _EDT_PageData EDT_PageData;
typedef enum {
ED_COLOR_BACKGROUND,
ED_COLOR_LINK,
ED_COLOR_TEXT,
ED_COLOR_FOLLOWED_LINK
} ED_EColor;
/*
* CLM: Java and PlugIn data structures
*/
struct _EDT_ParamData {
char *pName;
char *pValue;
};
typedef struct _EDT_ParamData EDT_ParamData;
typedef int32 EDT_ParamID;
struct _EDT_PlugInData {
EDT_ParamID ParamID; /* Identifies which Param list is associated */
char *pSrc;
XP_Bool bHidden;
ED_Alignment align;
int32 iWidth;
int32 iHeight;
XP_Bool bWidthPercent; /* Range: 1 - 100 if TRUE, else = pixels default) */
XP_Bool bHeightPercent;
XP_Bool bForegroundPalette; /* PC systems only. For controling 256-color palette wars */
int32 iHSpace;
int32 iVSpace;
int32 iBorder;
};
typedef struct _EDT_PlugInData EDT_PlugInData;
struct _EDT_JavaData {
EDT_ParamID ParamID;
char *pCode;
char *pCodebase;
char *pName;
ED_Alignment align;
char *pSrc;
int32 iWidth;
int32 iHeight;
XP_Bool bWidthPercent; /* Range: 1 - 100 if TRUE, else = pixels default) */
XP_Bool bHeightPercent;
int32 iHSpace;
int32 iVSpace;
int32 iBorder;
};
typedef struct _EDT_JavaData EDT_JavaData;
/* CLM: Error codes for file writing
* Return 0 if no error
*/
typedef enum {
ED_ERROR_NONE,
ED_ERROR_READ_ONLY, /* File is marked read-only */
ED_ERROR_BLOCKED, /* Can't write at this time, edit buffer blocked */
ED_ERROR_BAD_URL, /* URL was not a "file:" type or no string */
ED_ERROR_FILE_OPEN,
ED_ERROR_FILE_WRITE,
ED_ERROR_CREATE_BAKNAME,
ED_ERROR_DELETE_BAKFILE,
ED_ERROR_FILE_RENAME_TO_BAK,
ED_ERROR_CANCEL,
ED_ERROR_FILE_EXISTS, /* We really didn't save -- file existed and no overwrite */
ED_ERROR_SRC_NOT_FOUND,
ED_ERROR_FILE_READ,
/* The following are used internally by the editor and will not be passed to the front end. */
ED_ERROR_PUBLISHING, /* When netlib encounters an error http or ftp publishing. */
ED_ERROR_TAPEFS_COMPLETION /* The tape file system for saving encountered an error when
the Complete() method was called. E.g. an error sending a
mail message. */
} ED_FileError;
typedef enum {
ED_TAG_OK,
ED_TAG_UNOPENED,
ED_TAG_UNCLOSED,
ED_TAG_UNTERMINATED_STRING,
ED_TAG_PREMATURE_CLOSE,
ED_TAG_TAGNAME_EXPECTED
} ED_TagValidateResult;
typedef enum {
ED_LIST_TYPE_DEFAULT,
ED_LIST_TYPE_DIGIT,
ED_LIST_TYPE_BIG_ROMAN,
ED_LIST_TYPE_SMALL_ROMAN,
ED_LIST_TYPE_BIG_LETTERS,
ED_LIST_TYPE_SMALL_LETTERS,
ED_LIST_TYPE_CIRCLE,
ED_LIST_TYPE_SQUARE,
ED_LIST_TYPE_DISC,
ED_LIST_TYPE_CITE /* For Mail Quoting */
} ED_ListType;
struct _EDT_ListData {
/* This should be TagType, but there are problems with the include file dependencies. */
int8 iTagType; /* P_UNUM_LIST, P_NUM_LIST, P_BLOCKQUOTE, */
/* P_DIRECTOR, P_MENU, P_DESC_LIST */
XP_Bool bCompact;
ED_ListType eType;
int32 iStart; /* automatically maps, start is one */
char *pBaseURL; /* If an ED_LIST_TYPE_CITE, this is the URL from the enclosing <BASE> tag.
Don't expose this to users because not actually written out in the HTML. */
char *pExtra;
};
typedef struct _EDT_ListData EDT_ListData;
typedef enum {
ED_BREAK_NORMAL, /* just break the line, ignore images */
ED_BREAK_LEFT, /* break so it passes the image on the left */
ED_BREAK_RIGHT, /* break past the right image */
ED_BREAK_BOTH /* break past both images */
} ED_BreakType;
typedef enum {
ED_SAVE_OVERWRITE_THIS,
ED_SAVE_OVERWRITE_ALL,
ED_SAVE_DONT_OVERWRITE_THIS,
ED_SAVE_DONT_OVERWRITE_ALL,
ED_SAVE_CANCEL
} ED_SaveOption;
/* After saving, what to do with the editor buffer. */
typedef enum {
ED_FINISHED_GOTO_NEW, /* Point the editor to the location of the
newly saved document. */
ED_FINISHED_REVERT_BUFFER, /* Revert the buffer to the state before
the save operation began. */
ED_FINISHED_SAVE_DRAFT, /* Like ED_FINISHED_REVERT_BUFFER, except clears the dirty flag
on success. */
ED_FINISHED_MAIL_SEND /* If we succeed we're going to throw the buffer
away, so don't revert it. If failure, revert the buffer.
Used for mail compose, we don't
want the editor to start any operation that
causes problems when libmsg destroys the editor
context. */
} ED_SaveFinishedOption;
/* For FE_SaveDialogCreate */
typedef enum {
ED_SAVE_DLG_SAVE_LOCAL, /* "saving files to local disk" */
ED_SAVE_DLG_PUBLISH, /* "uploading files to remote server" */
ED_SAVE_DLG_PREPARE_PUBLISH /* "preparing files to publish" */
} ED_SaveDialogType;
typedef int32 EDT_ClipboardResult;
#define EDT_COP_OK 0
#define EDT_COP_DOCUMENT_BUSY 1
#define EDT_COP_SELECTION_EMPTY 2
#define EDT_COP_SELECTION_CROSSES_TABLE_DATA_CELL 3
/* For the result EDT_COP_CLIPBOARD_BAD the XP code has already
* given the user an error dialog. So FE code should not
* give an additional error dialog. (Only occurs on
* paste and paste-like operations.)
*/
#define EDT_COP_CLIPBOARD_BAD 4
#ifdef FIND_REPLACE
#define ED_FIND_FIND_ALL_WORDS 1 /* used to enumerate all words in a */
/* buffer */
#define ED_FIND_MATCH_CASE 2 /* default is to ignore case */
#define ED_FIND_REPLACE 4 /* call back the replace routine */
#define ED_FIND_WHOLE_BUFFER 8 /* start search from the top */
#define ED_FIND_REVERSE 0x10 /* reverse search from this point */
typedef intn ED_FindFlags;
typedef void (*EDT_PFReplaceFunc)( void *pMWContext,
char *pFoundWord,
char **pReplaceWord );
struct _EDT_FindAndReplaceData {
char* pSearchString;
ED_FindFlags fflags;
EDT_PFReplaceFunc pfReplace;
};
typedef struct _EDT_FindAndReplaceData EDT_FindAndReplaceData;
#endif /* FIND_REPLACE */
/* Callback function for image encoder */
typedef int32 EDT_ImageEncoderReference;
typedef unsigned char EDT_ImageEncoderStatus;
#define ED_IMAGE_ENCODER_OK 0
#define ED_IMAGE_ENCODER_USER_CANCELED 1
#define ED_IMAGE_ENCODER_EXCEPTION 2
typedef void (*EDT_ImageEncoderCallbackFn)(EDT_ImageEncoderStatus status, void* hook);
#endif

1274
mozilla/include/fe_proto.h Normal file

File diff suppressed because it is too large Load Diff

133
mozilla/include/fe_rgn.h Normal file
View File

@@ -0,0 +1,133 @@
/* -*- 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.
*/
/* Region-related definitions and prototypes */
#ifndef _FE_RGN_H_
#define _FE_RGN_H_
#ifdef LAYERS
#include "xp_core.h"
#include "xp_rect.h"
/******************Definitions and Types************/
/* For Windows only: Should we use the MFC CRgn class for region stuff? */
#ifdef XP_WIN
#undef FE_RGN_USE_MFC
#endif /* XP_WIN */
#ifdef XP_WIN
#ifdef FE_RGN_USE_MFC
#define FE_GetMDRegion(rgn) ((CRgn *)rgn)
#else
/*
* Note that the resultant CRgn * does not have to be
* explicitly deleted. It is considered a temporary object
* by the MFC and is deleted the next time we have idle
* time in the event loop.
*/
#define FE_GetMDRegion(rgn) ((HRGN)rgn)
#endif /* FE_RGN_USE_MFC */
#elif defined(XP_UNIX)
#define FE_GetMDRegion(rgn) ((Region)rgn)
#elif defined(XP_MAC)
#define FE_GetMDRegion(rgn) ((RgnHandle)rgn)
#else
#define FE_GetMDRegion(rgn) (rgn)
#endif /* XP_WIN */
#ifdef XP_WIN
#define FE_MAX_REGION_COORDINATE 0x7FFFFFFF
#else
#define FE_MAX_REGION_COORDINATE 0x7FFF
#endif
/* Setting the clip region to this effectively unsets the clip */
#define FE_NULL_REGION NULL
#define FE_CLEAR_REGION(region) \
do {FE_SubtractRegion((region), (region), (region)); } while (0)
/* Function called by FE_ForEachRectInRegion */
typedef void (*FE_RectInRegionFunc)(void *closure, XP_Rect *rect);
/*******************Prototypes**********************/
XP_BEGIN_PROTOS
extern FE_Region FE_CreateRegion(void);
/* Creates a region from a rectangle. Returns */
/* NULL if region can't be created. */
extern FE_Region FE_CreateRectRegion(XP_Rect *rect);
/* Destroys region. */
extern void FE_DestroyRegion(FE_Region region);
/* Makes a copy of a region. If dst is NULL, creates a new region */
extern FE_Region FE_CopyRegion(FE_Region src, FE_Region dst);
/* Set an existing region to a rectangle */
extern FE_Region FE_SetRectRegion(FE_Region region, XP_Rect *rect);
/* dst = src1 intersect sr2 */
/* dst can be one of src1 or src2 */
extern void FE_IntersectRegion(FE_Region src1, FE_Region src2, FE_Region dst);
/* dst = src1 union src2 */
/* dst can be one of src1 or src2 */
extern void FE_UnionRegion(FE_Region src1, FE_Region src2, FE_Region dst);
/* dst = src1 - src2 */
/* dst can be one of src1 or src2 */
extern void FE_SubtractRegion(FE_Region src1, FE_Region src2, FE_Region dst);
/* Returns TRUE if the region contains no pixels */
extern XP_Bool FE_IsEmptyRegion(FE_Region region);
/* Returns the bounding rectangle of the region */
extern void FE_GetRegionBoundingBox(FE_Region region, XP_Rect *bbox);
/* TRUE if rgn1 == rgn2 */
extern XP_Bool FE_IsEqualRegion(FE_Region rgn1, FE_Region rgn2);
/* Moves a region by the specified offsets */
extern void FE_OffsetRegion(FE_Region region, int32 xOffset, int32 yOffset);
/* Is any part of the rectangle in the specified region */
extern XP_Bool FE_RectInRegion(FE_Region region, XP_Rect *rect);
/* For each rectangle that makes up this region, call the func */
extern void FE_ForEachRectInRegion(FE_Region region,
FE_RectInRegionFunc func,
void * closure);
#ifdef DEBUG
extern void FE_HighlightRect(void *context, XP_Rect *rect, int how_much);
extern void FE_HighlightRegion(void *context, FE_Region region, int how_much);
#endif /* DEBUG */
XP_END_PROTOS
#endif /* LAYERS */
#endif /* _FE_RGN_H_ */

222
mozilla/include/fullsoft.h Normal file
View File

@@ -0,0 +1,222 @@
/*--------------------------------------------------------------------
* fullsoft.h
*
* Created: 10/15/97
* Author: Matt Kendall
*
* Copyright (C) 1997-98, Full Circle Software, Inc., All Rights Reserved
*
* Full Circle "Spiral" Application API Definition
* - mkk 1/19/98 renamed from "spiral.h" to "fullsoft.h"
*
*--------------------------------------------------------------------*/
#if !defined(__FULLSOFT_H)
#define __FULLSOFT_H
/* define NO_FC_API to disable all calls to the Full Circle library */
/* define FC_TRACE to enable the Full Circle TRACE macro */
/* define FC_ASSERT to enable the Full Circle ASSERT macro */
/* define FC_TRACE_PARAM to enable the Full Circle TRACE_PARAM macro */
/* define FC_ASSERT_PARAM to enable the Full Circle TRACE_PARAM macro */
#if !defined(FAR)
#define FAR
#endif /* !FAR */
#if !defined(FCAPI)
#define FCAPI
#endif /* defined FCAPI */
typedef const char FAR * FC_KEY ;
typedef const char FAR * FC_TRIGGER ;
typedef unsigned long FC_DATE ;
typedef unsigned long FC_UINT32 ;
typedef void FAR * FC_PVOID ;
typedef const char FAR * FC_STRING ;
typedef void FAR * FC_CONTEXT ;
#define FC_CONTEXT_NONE ((FC_CONTEXT) -1)
typedef enum {
FC_DATA_TYPE_BINARY,
FC_DATA_TYPE_STRING,
FC_DATA_TYPE_INTEGER,
FC_DATA_TYPE_DATE,
FC_DATA_TYPE_COUNTER
} FC_DATA_TYPE ;
typedef enum {
FC_ERROR_OK = 0,
FC_ERROR_CANT_INITIALIZE,
FC_ERROR_NOT_INITIALIZED,
FC_ERROR_ALREADY_INITIALIZED,
FC_ERROR_FAILED,
FC_ERROR_OUT_OF_MEMORY,
FC_ERROR_INVALID_PARAMETER
} FC_ERROR ;
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus */
/* define NO_FC_API to disable all calls to the Full Circle library */
#if !defined(NO_FC_API)
FC_ERROR FCAPI
FCInitialize( void ) ;
FC_ERROR FCAPI
FCCreateKey(
FC_KEY key,
FC_DATA_TYPE type,
FC_UINT32 first_count,
FC_UINT32 last_count,
FC_UINT32 max_element_size) ;
FC_ERROR FCAPI
FCCreatePersistentKey(
FC_KEY key,
FC_DATA_TYPE type,
FC_UINT32 first_count,
FC_UINT32 last_count,
FC_UINT32 max_element_size) ;
FC_ERROR FCAPI
FCAddDataToKey(
FC_KEY key,
FC_PVOID buffer,
FC_UINT32 data_length) ;
FC_ERROR FCAPI
FCAddIntToKey(
FC_KEY key,
FC_UINT32 data) ;
FC_ERROR FCAPI
FCAddStringToKey(
FC_KEY key,
FC_STRING string) ;
FC_ERROR FCAPI
FCAddDateToKey(
FC_KEY key,
FC_DATE date) ;
FC_ERROR FCAPI
FCSetCounter(
FC_KEY key,
FC_UINT32 value) ;
FC_ERROR FCAPI
FCIncrementCounter(
FC_KEY key,
FC_UINT32 value) ;
FC_ERROR FCAPI
FCRegisterMemory(
FC_KEY key,
FC_DATA_TYPE type,
FC_PVOID buffer,
FC_UINT32 length,
FC_UINT32 dereference_count,
FC_CONTEXT context) ;
FC_ERROR FCAPI
FCUnregisterMemory( FC_CONTEXT context ) ;
FC_ERROR FCAPI
FCTrigger( FC_TRIGGER trigger ) ;
void FCAPI
FCTrace(FC_STRING fmt, ... ) ;
void FCAPI
FCAssert() ;
void FCAPI
FCTraceParam(
FC_UINT32 track,
FC_UINT32 level,
FC_STRING fmt,
... ) ;
void FCAPI
FCAssertParam(
FC_UINT32 track,
FC_UINT32 level ) ;
#if defined(FC_ASSERT)
#if defined(ASSERT)
#undef ASSERT
#endif /* defined ASSERT */
#define ASSERT(a) { if( !(a) ) FCAssert() ; }
#endif /* FC_ASSERT */
#if defined(FC_TRACE)
#if defined(TRACE)
#undef TRACE
#endif /* defined TRACE */
#define TRACE FCTrace
#endif /* FC_TRACE */
#if defined(FC_ASSERT_PARAM)
#if defined(ASSERT_PARAM)
#undef ASSERT_PARAM
#endif /* defined ASSERT_PARAM */
#define ASSERT_PARAM(a,b,c) { if ( !(c) ) FCAssertParam(a,b) ; }
#endif /* FC_ASSERT_PARAM */
#if defined(FC_TRACE_PARAM)
#if defined(TRACE_PARAM)
#undef TRACE_PARAM
#endif /* defined TRACE_PARAM */
#define TRACE_PARAM FCTraceParam
#endif /* FC_TRACE_PARAM */
#else /* NO_FC_API */
#define FCInitialize() FC_ERROR_OK
#define FCCreateKey(a,b,c,d,e) FC_ERROR_OK
#define FCCreatePersistentKey(a,b,c,d,e) FC_ERROR_OK
#define FCAddDataToKey(a,b,c) FC_ERROR_OK
#define FCAddIntToKey(a,b) FC_ERROR_OK
#define FCAddStringToKey(a,b) FC_ERROR_OK
#define FCAddDateToKey(a,b) FC_ERROR_OK
#define FCRegisterMemory(a,b,c,d,e,f) FC_ERROR_OK
#define FCUnregisterMemory(a) FC_ERROR_OK
#define FCTrigger(a) FC_ERROR_OK
#define FCSetCounter(a,b) FC_ERROR_OK
#define FCIncrementCounter(a,b) FC_ERROR_OK
#if defined(FC_ASSERT)
#define ASSERT(f) ((void)0)
#endif /* FC_ASSERT */
#if defined(FC_TRACE)
void FCAPI FCTrace(FC_STRING fmt,...) ;
#define TRACE 1 ? (void)0 : FCTrace
#endif /* FC_TRACE */
#if defined(FC_ASSERT_PARAM)
#define ASSERT_PARAM(a,b,c) ((void)0)
#endif /* FC_ASSERT_PARAM */
#if defined(FC_TRACE_PARAM)
void FCAPI FCTraceParam(
FC_UINT32 track,
FC_UINT32 level,
FC_STRING fmt,
... ) ;
#define TRACE_PARAM 1 ? (void) 0 : FCTraceParam
#endif /* FC_TRACE_PARAM */
#endif /* NO_FC_API */
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif /* __FULLSOFT_H */

231
mozilla/include/garray.h Normal file
View File

@@ -0,0 +1,231 @@
/* -*- Mode: C; tab-width: 8; 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.
*/
//
// Warning: This is a C++ file.
//
//
// This implements cross platform Growable arrays of Pointers.
//
#ifndef _GARRAY_H_
#define _GARRAY_H_
//
// On Unix (well at least Solaris) we are having troubles with
// templates, so hey, we won't use them...djw.
//
// On Mac we are having troubles as well, so add me to the list.
// Now, why even have templates?...jar
//
#if ! ( defined(XP_WIN16) || defined(XP_UNIX) || defined(XP_MAC) )
#define TEMPLATE_SUPPORT 1
#endif
class CXP_GrowableArray {
protected:
void **m_pData;
int m_iSize;
int m_iAllocSize;
int NewSize( int iMinSize){
int iNewSize = MAX( m_iAllocSize,16) ;
while( iNewSize < iMinSize ){
iNewSize = iNewSize+iNewSize;
}
return iNewSize;
}
//
// this is the routine that does the actual work. Should be in
// its own file.
//
void GuaranteeSize(int iSize){
if(m_iAllocSize <= iSize){
int iNewSize = NewSize( iSize );
if( m_iAllocSize ){
void ** pNewData = new void*[iNewSize];
XP_BCOPY( m_pData, pNewData, m_iAllocSize * sizeof(void*) );
delete [] m_pData;
m_pData = pNewData;
}
else{
m_pData = new void*[iNewSize];
}
m_iAllocSize = iNewSize;
}
}
public:
CXP_GrowableArray(int iStartSize=0): m_pData(0),m_iSize(0),m_iAllocSize(0){
if( iStartSize ){
GuaranteeSize( iStartSize );
}
};
~CXP_GrowableArray(){ delete [] m_pData; }
int Size(){ return m_iSize; }
void SetSize( int iSize ){
GuaranteeSize( iSize );
m_iSize = iSize;
}
void* operator[](int nIndex) const { return m_pData[nIndex]; }
void*& operator[](int nIndex){ return m_pData[nIndex]; }
int Add(void* newElement){
GuaranteeSize(m_iSize+1);
m_pData[m_iSize] = newElement;
/* Return index to last item in list */
return m_iSize++;
}
int Delete( int nIndex ){
if( nIndex < m_iSize )
{
for( int i = nIndex; i < m_iSize-1; i++ )
{
/* Suffle remaining pointers down */
m_pData[nIndex] = m_pData[nIndex+1];
}
m_iSize--;
}
/* Return index to last item in list */
return (m_iSize-1);
}
int Delete( void* element ){
for( int i = 0; i < m_iSize; i++ )
{
if( m_pData[i] == element )
{
return Delete(i);
}
}
return (m_iSize-1);
}
int Find( void* element ){
for( int i = 0; i < m_iSize; i++ )
{
if( m_pData[i] == element )
{
return i;
}
}
return -1;
}
void Empty(){
m_iSize = 0;
}
};
class CXP_PtrStack : public CXP_GrowableArray{
public:
int m_iTop;
CXP_PtrStack(): m_iTop(-1){}
Bool IsEmpty(){ return m_iTop == -1; }
void Push( void* t ){
if( ++m_iTop >= Size() ) {
Add( t );
}
else {
(*this)[m_iTop] = t;
}
}
void* Top(){ return (*this)[m_iTop]; }
void* Pop(){ return (*this)[m_iTop--];}
void Reset(){ m_iTop = -1; }
int StackSize() { return m_iTop + 1; }
};
#ifdef TEMPLATE_SUPPORT
template<class PTRTYPE>
class TXP_GrowableArray: public CXP_GrowableArray {
public:
PTRTYPE operator[](int nIndex) const { return (PTRTYPE)(int32)m_pData[nIndex]; }
PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex]; }
int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add( (void*) newElement ); }
};
#define Declare_GrowableArray(NAME,PTRTYPE) \
typedef TXP_GrowableArray<PTRTYPE> TXP_GrowableArray_##NAME;
#else
#define Declare_GrowableArray(NAME,PTRTYPE) \
class TXP_GrowableArray_##NAME: public CXP_GrowableArray { \
public: \
PTRTYPE operator[](int nIndex) const { return (PTRTYPE)(int32)m_pData[nIndex]; }\
PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex]; } \
int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add( (void*) newElement ); } \
}; \
#endif
//
// PtrStack Imlementation
//
#ifdef TEMPLATE_SUPPORT
template<class PTRTYPE>
class TXP_PtrStack : public TXP_GrowableArray<PTRTYPE> {
public:
int m_iTop;
TXP_PtrStack(): m_iTop(-1){}
Bool IsEmpty(){ return m_iTop == -1; }
void Push( PTRTYPE t ){
if( ++m_iTop >= Size() ) {
Add( t );
}
else {
(*this)[m_iTop] = t;
}
}
PTRTYPE Top(){ return (*this)[m_iTop]; }
PTRTYPE Pop(){ return (*this)[m_iTop--];}
void Reset(){ m_iTop = -1; }
int StackSize(){ return m_iTop + 1; }
};
#define Declare_PtrStack(NAME,PTRTYPE) \
typedef TXP_PtrStack<PTRTYPE> TXP_PtrStack_##NAME;
#else // No template support
#define Declare_PtrStack(NAME, PTRTYPE) \
class TXP_PtrStack_##NAME : public CXP_PtrStack { \
public: \
void Push( PTRTYPE t ){ CXP_PtrStack::Push((void*)(int32)t); } \
PTRTYPE Top(){ return (PTRTYPE)(int32)CXP_PtrStack::Top(); } \
PTRTYPE Pop(){ return (PTRTYPE)(int32)CXP_PtrStack::Pop(); } \
PTRTYPE operator[](int nIndex) const { return (PTRTYPE)(int32)m_pData[nIndex]; }\
PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex]; } \
int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add( (void*)(int32)newElement ); } \
}; \
#endif
#endif

188
mozilla/include/glhist.h Normal file
View File

@@ -0,0 +1,188 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef GLHIST_H
#define GLHIST_H
#include "ntypes.h"
typedef enum gh_SortColumn
{
eGH_NoSort = -1,
eGH_NameSort,
eGH_LocationSort,
eGH_FirstDateSort,
eGH_LastDateSort,
eGH_VisitCountSort
}gh_SortColumn;
typedef struct _gh_HistEntry
{
char * address;
time_t last_accessed;
time_t first_accessed;
int32 iCount;
int32 iFlags;
char * pszName;
}gh_HistEntry;
typedef struct _gh_HistEntryData
{
time_t last_accessed;
time_t first_accessed;
int32 iCount;
int32 iFlags;
char * pszName;
}gh_HistEntryData;
typedef enum gh_FilterOp
{
eGH_FOEquals,
eGH_FOEqualsNot,
eGH_FOGreater,
eGH_FOGreaterEqual,
eGH_FOLess,
eGH_FOLessEqual,
eGH_FOHas,
eGH_FOHasNot
}gh_FilterOp;
typedef enum gh_FilterLogOp
{
eGH_FLOAnd,
eGH_FLOOr
}gh_FilterLogOp;
typedef struct _gh_FilterCondition
{
enum gh_SortColumn enCol;
enum gh_FilterOp enOp;
union
{
char * pszTest;
int32 iTest;
} tests;
}gh_FilterCondition;
typedef struct _gh_Filter
{
int32 iNumConditions;
gh_FilterCondition * pConditions;
gh_FilterLogOp * enOps;
}gh_Filter;
typedef struct _gh_NotifyMsg
{
int32 iNotifyMsg;
char * pszKey;
void * pUserData;
} gh_NotifyMsg;
typedef void * GHHANDLE;
typedef void * GHURHANDLE;
#define GH_NOTIFY_UPDATE 1
#define GH_NOTIFY_DELETE 2
#ifdef XP_WIN
typedef int (__cdecl *GHISTORY_NOTIFYPROC)( gh_NotifyMsg *pMsg );
#else
typedef int (*GHISTORY_NOTIFYPROC)( gh_NotifyMsg *pMsg );
#endif
XP_BEGIN_PROTOS
/* if the url was found in the global history then the then number of seconds since
* the last access is returned. if the url is not found -1 is returned
*/
extern int GH_CheckGlobalHistory(char * url);
/* add or update the url in the global history
*/
extern void GH_UpdateGlobalHistory(URL_Struct * URL_s);
/* save the global history to a file and remove the list from memory
*/
/*extern void GH_CleanupGlobalHistory(void);*/
/* save the global history to a file and remove the list from memory
*/
extern void GH_SaveGlobalHistory(void);
/* free the global history list
*/
extern void GH_FreeGlobalHistory(void);
/* clear the entire global history list
*/
extern void GH_ClearGlobalHistory(void);
#if defined(XP_MAC) || defined(XP_UNIX)
/* set the maximum time for an object in the Global history in
* number of seconds
*/
extern void GH_SetGlobalHistoryTimeout(int32 timeout_interval);
#endif
/* start global history tracking
*/
extern void GH_InitGlobalHistory(void);
/* create an HTML stream and push a bunch of HTML about
* the global history
*
* returns -1
*/
extern int NET_DisplayGlobalHistoryInfoAsHTML( MWContext *context, URL_Struct *URL_s, int format_out );
/*
// Context/Handle based functions to retrieve a pseudo cursor on the
// Global History list (using a specified sort/index).
*/
extern GHHANDLE GH_GetContext( enum gh_SortColumn enGHSort,
gh_Filter * pFilter,
GHISTORY_NOTIFYPROC pfNotifyProc,
GHURHANDLE hUR,
void * pUserData );
extern void GH_ReleaseContext( GHHANDLE pContext, Bool bReleaseUR );
extern gh_HistEntry * GH_GetRecord( GHHANDLE pContext, uint32 uRow );
extern void GH_DeleteRecord( GHHANDLE pContext, uint32 uRow, Bool bGroup );
extern uint32 GH_GetNumRecords( GHHANDLE pContext );
extern gh_SortColumn GH_GetSortField( GHHANDLE pContext );
extern int GH_UpdateURLTitle( URL_Struct *pUrl, char *pszTitle, Bool bFrameCell );
extern int32 GH_GetRecordNum( GHHANDLE pContext, char *pszLocation );
extern int GH_GetMRUPage( char *pszURL, int iMaxLen );
extern void GH_FileSaveAsHTML( GHHANDLE pContext, MWContext *pMWContext );
extern GHURHANDLE GH_GetURContext( GHHANDLE pContext );
extern void GH_SupportUndoRedo( GHHANDLE pContext );
extern void GH_Undo( GHHANDLE pContext );
extern void GH_Redo( GHHANDLE pContext );
extern Bool GH_CanUndo( GHHANDLE pContext );
extern Bool GH_CanRedo( GHHANDLE pContext );
/* AutoComplete stuff */
enum autoCompStatus {foundDone, notFoundDone, stillSearching, dontCallOnIdle};
extern enum autoCompStatus urlMatch(const char *criteria, char **result, Bool freshStart, Bool scroll);
extern void NET_RegisterEnableUrlMatchCallback(void);
XP_END_PROTOS
#endif /* GLHIST_H */

64
mozilla/include/gui.h Normal file
View File

@@ -0,0 +1,64 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _GUI_H_
#define _GUI_H_
/* These are defined in libnet/mkhttp.c.
XP_AppName The name of the client program - usually "Netscape", but
possibly something else for bundled versions, like the
MCI client.
XP_AppCodeName The name sent at the HTTP vendor ID string; regardless of
the value of XP_AppName, this must be "Mozilla" or
everything will break.
XP_AppVersion The version number of the client as a string. This is the
string sent along with the vendor ID string, so it should be
of the form "1.1N (Windows)" or "1.1N (X11; SunOS 4.1.3)".
XP_AppLanguage The language of the navigator client. Usually a two-letter
code (EN, FR) but could be a 5-letter code for translations
where a sub-language designation is appropriate (FR_CA)
XP_AppPlatform The compiled flavor of the navigator (as opposed to what
it may actually be running on).
*/
XP_BEGIN_PROTOS
#if defined(XP_WIN) || defined(XP_OS2)
extern char *XP_AppName, *XP_AppCodeName, *XP_AppVersion;
extern char *XP_AppLanguage, *XP_AppPlatform;
#else
extern const char *XP_AppName, *XP_AppCodeName, *XP_AppVersion;
extern const char *XP_AppLanguage, *XP_AppPlatform;
#endif
XP_END_PROTOS
/* this define is needed for error message efficiency
*
* please don't comment it out for UNIX - LJM
*/
/* this is constant across languages - do NOT localize it */
#define XP_CANONICAL_CLIENT_NAME "Netscape"
/* name of the program */
/* XP_LOCAL_CLIENT_NAME was never used consistently: use XP_AppName instead. */
#endif /* _GUI_H_ */

250
mozilla/include/hotlist.h Normal file
View File

@@ -0,0 +1,250 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef HOTLIST_H
#define HOTLIST_H
#include "xp_mcom.h"
#include "ntypes.h"
XP_BEGIN_PROTOS
typedef enum HOT_Type {
HOT_URLType, HOT_HeaderType, HOT_SeparatorType } HOT_Type;
typedef struct HotlistStruct_ {
HOT_Type type;
Bool is_folded; /* if it's a header is it folded? */
XP_List *children; /* a list of children, only headers have these */
char *name; /* a title */
char *address; /* the URL address */
char *description; /* random text */
time_t last_visit;
time_t addition_date;
char *content_type;
struct HotlistStruct_ *parent; /* My hotlist parent */
XP_List *lParent; /* The XP_List object that points to my parent or NULL */
} HotlistStruct;
/* tell the hotlist code that the hotlist has been modified
* so that it gets saved the next time SaveHotlist is called
*/
extern void HOT_SetModified(void);
/* changes a entry to a header type from a non header type
* and vice versa. If the object was a header and
* has children, the children will be blown away. (very bad)
*/
extern void HOT_ChangeEntryType(HotlistStruct * entry, HOT_Type new_type);
/* Fold or unfold a hotlist header
*
* set the Boolean to True to fold the list and
* False to unfold
*/
extern void HOT_FoldHeader(HotlistStruct * item, Bool fold);
/* checks the hotlist for a url and updates the last accessed
* time
*/
extern void HOT_UpdateHotlistTime(URL_Struct *URL_s, time_t cur_time);
/* Performs regular expression match on hotlist name and address
* fields. Returns the found object, or NULL if not
* found.
*
* start_obj specifies the object to start searching
* on. The start_num object WILL NOT be searched but all those
* after it will be.
* To search the whole list give NULL as start_obj.
*
* If headers became unfolded because of the search then redisplay_all
* will be set to TRUE
*/
extern HotlistStruct * HOT_SearchHotlist(char * search_string,
HotlistStruct * start_obj,
Bool * redisplay_all);
/* returns TRUE if the second argument is a direct
* descendent of the first argument.
*
* returns FALSE otherwise
*/
extern Bool HOT_IsDescendent(HotlistStruct *parent, HotlistStruct *possible_child);
/* Reads the hostlist from disk, what else?
*
* pass in the hotlist filename and a relative URL which represents
* the original location of the html file. If you are reading the
* default hotlist you should pass in a file URL of the form
* file://localhost/PATH
*
*/
extern void HOT_ReadHotlistFromDisk (char * filename, char * relative_url);
/* returns an integer index of the item in the list
*/
extern int HOT_GetIndex(HotlistStruct * item);
/* returns an integer index of the item in the list
* and does not pay attention to the is_folded value
*/
extern int HOT_GetUnfoldedIndex(HotlistStruct * item);
/* returns the object associated with the index returned by
* HOT_GetIndex()
*/
extern HotlistStruct * HOT_IndexOf(int index);
/* returns the object associated with the index returned by
* HOT_GetUnfoldedIndex()
*/
extern HotlistStruct * HOT_UnfoldedIndexOf(int index);
/* returns an integer depth of the item in the list starting at zero
*/
extern int HOT_GetDepth(HotlistStruct * item);
/* return a pointer to the main hotlist list
*
* returns NULL if nothing has ever been
* added to the hotlist
*/
extern XP_List * HOT_GetHotlistList(void);
/* saves the hotlist to a configuration file
*/
extern int HOT_SaveHotlist (char * filename);
/* Free's the entire hotlist
*/
extern void HOT_FreeHotlist (void);
/* create a hotlist entry struct and fill it in with
* the passed in data
*
* returns NULL on out of memory error.
*/
extern HotlistStruct *
HOT_CreateEntry(HOT_Type type,
const char *name,
const char *address,
const char *content_type,
time_t last_visit);
/* free's a hotlist entry
*/
extern void HOT_FreeEntry(HotlistStruct * entry);
/* create a completely new copy of the entry passed in
*/
extern HotlistStruct * HOT_CopyEntry(HotlistStruct * entry);
/* insert an item before another item in the hotlist
*
* if the insert_before item is NULL or not found the item
* will be inserted at the begining of the list
*/
extern void HOT_InsertItemBefore(HotlistStruct * insert_before, HotlistStruct * insertee);
/* insert an item after another item in the hotlist
*
* if the insert_after item is NULL or not found the item
* will be inserted at the end of the list
*/
extern void HOT_InsertItemAfter(HotlistStruct * insert_after, HotlistStruct * insertee);
/* insert an item in a header if "insert_after" is a
* Header type, or after the item if "insert after" is
* not a header type.
*
* if the insert_after item is NULL or not found the item
* will be inserted at the end of the hotlist
*/
extern void
HOT_InsertItemInHeaderOrAfterItem(HotlistStruct * insert_after,
HotlistStruct * insertee);
/* remove an item from the hotlist and free's it
*
* returns TRUE on success, FALSE if not found
*/
extern Bool HOT_RemoveItem(HotlistStruct * old_item);
/* remove an item from the hotlist and doesn't free it
*
* returns TRUE on success, FALSE if not found
*/
extern Bool HOT_RemoveItemFromList(HotlistStruct * old_item);
/* move an item up in the list
*/
extern void HOT_MoveObjectUp(HotlistStruct * item);
/* move an item down in the list
*/
extern void HOT_MoveObjectDown(HotlistStruct * item);
/* returns True if the object can be moved Up
* False if the object cannot be moved Up or if
* it cannot be found in the list
*/
extern Bool HOT_ObjectCanGoUp(HotlistStruct * item);
/* returns True if the object can be moved down
* False if the object cannot be moved down or if
* it cannot be found in the list
*/
extern Bool HOT_ObjectCanGoDown(HotlistStruct * item);
/* Whether the file will be written when Save is called. */
extern Bool HOT_Modified(void);
/*
* Gets the top node of the hotlist
*/
extern HotlistStruct*
HOT_GetHotlist (void);
/*
* Convert a number of selections in a hotlist list into a block of
* memory that the user can use for cut and paste operations
*/
extern char *
HOT_ConvertSelectionsToBlock(HotlistStruct ** list,
int iCount,
int bLongFormat,
int32 * lTotalLen);
/*
* Take a block of memory and insert the hotlist items it represents into
* the current hotlist
*/
extern void
HOT_InsertBlockAt(char * pOriginalBlock,
HotlistStruct * item,
int bLongFormat,
int32 lTotalLen);
XP_END_PROTOS
#endif /* HOTLIST_H */

480
mozilla/include/imap.h Normal file
View File

@@ -0,0 +1,480 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef __imap__
#define __imap__
#include "structs.h"
#include "msgcom.h"
/* used for communication between libmsg and libnet */
#define kNoFlags 0x00 /* RFC flags */
#define kMarked 0x01
#define kUnmarked 0x02
#define kNoinferiors 0x04
#define kNoselect 0x08
#define kImapTrash 0x10 /* Navigator flag */
#define kJustExpunged 0x20 /* This update is a post expunge url update. */
#define kPersonalMailbox 0x40 /* this mailbox is in the personal namespace */
#define kPublicMailbox 0x80 /* this mailbox is in the public namespace */
#define kOtherUsersMailbox 0x100 /* this mailbox is in the other users' namespace */
/* flags for individual messages */
/* currently the ui only offers \Seen and \Flagged */
#define kNoImapMsgFlag 0x0000
#define kImapMsgSeenFlag 0x0001
#define kImapMsgAnsweredFlag 0x0002
#define kImapMsgFlaggedFlag 0x0004
#define kImapMsgDeletedFlag 0x0008
#define kImapMsgDraftFlag 0x0010
#define kImapMsgRecentFlag 0x0020
#define kImapMsgForwardedFlag 0x0040 /* Not always supported, check mailbox folder */
#define kImapMsgMDNSentFlag 0x0080 /* Not always supported. check mailbox folder */
#define kImapMsgSupportUserFlag 0x8000 /* This seems to be the most cost effective way of
* piggying back the server support user flag
* info.
*/
typedef enum {
kPersonalNamespace = 0,
kOtherUsersNamespace,
kPublicNamespace,
kDefaultNamespace,
kUnknownNamespace
} EIMAPNamespaceType;
typedef int32 imap_uid;
#ifdef XP_CPLUSPLUS
class TImapFlagAndUidState;
#else
typedef struct TImapFlagAndUidState TImapFlagAndUidState;
#endif
/* forward declaration */
typedef void ImapActiveEntry;
/* url used to signify that filtering is complete so
we can tell the fe that the inbox thread pane is
loaded */
#define kImapFilteringCompleteURL "Mailbox://?filteringcomplete"
/* url used to signify that online/offline synch is complete */
#define kImapOnOffSynchCompleteURL "Mailbox://?onoffsynchcomplete"
/* if a url creator does not know the hierarchySeparator, use this */
#define kOnlineHierarchySeparatorUnknown ' '
struct mailbox_spec {
int32 folder_UIDVALIDITY;
int32 number_of_messages;
int32 number_of_unseen_messages;
int32 number_of_recent_messages;
uint32 box_flags;
char *allocatedPathName;
char hierarchySeparator;
const char *hostName;
TNavigatorImapConnection *connection;
TImapFlagAndUidState *flagState;
XP_Bool folderSelected;
XP_Bool discoveredFromLsub;
const char *smtpPostAddress;
};
typedef struct mailbox_spec mailbox_spec;
enum EIMAPSubscriptionUpgradeState {
kEverythingDone,
kBringUpSubscribeUI
};
enum ImapOnlineCopyState {
kInProgress,
kSuccessfulCopy,
kFailedCopy,
kSuccessfulDelete,
kFailedDelete,
kReadyForAppendData,
kFailedAppend
};
struct folder_rename_struct {
char *fOldName;
char *fNewName;
};
typedef struct folder_rename_struct folder_rename_struct;
/* this file defines the syntax of the imap4 url's and offers functions
that create url strings. If the functions do not offer enough
functionality then let kevin know before you starting creating strings
from scratch. */
#include "xp_mcom.h"
XP_BEGIN_PROTOS
/* need mailbox status urls to get the number of message and the
number of unread messages */
/* Selecting a mailbox */
/* imap4://HOST?select?MAILBOXPATH */
char *CreateImapMailboxSelectUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
const char *undoDeleteIdentifierList);
/* lite select, used to verify UIDVALIDITY while going on/offline */
char *CreateImapMailboxLITESelectUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator);
/* expunge, used in traditional imap delete model */
char *CreateImapMailboxExpungeUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator);
/* Creating a mailbox */
/* imap4://HOST?create?MAILBOXPATH */
char *CreateImapMailboxCreateUrl(const char *imapHost, const char *mailbox, char hierarchySeparator);
/* discover the children of this mailbox */
char *CreateImapChildDiscoveryUrl(const char *imapHost, const char *mailbox, char hierarchySeparator);
/* discover the n-th level children of this mailbox */
char *CreateImapLevelChildDiscoveryUrl(const char *imapHost, const char *mailbox, char hierarchySeparator, int n);
/* discover the mailboxes of this account */
char *CreateImapAllMailboxDiscoveryUrl(const char *imapHost);
/* discover the mailboxes of this account, and the subscribed mailboxes */
char *CreateImapAllAndSubscribedMailboxDiscoveryUrl(const char *imapHost);
/* deleting a mailbox */
/* imap4://HOST?delete?MAILBOXPATH */
char *CreateImapMailboxDeleteUrl(const char *imapHost, const char *mailbox, char hierarchySeparator);
/* renaming a mailbox */
/* imap4://HOST?rename?OLDNAME?NEWNAME */
char *CreateImapMailboxRenameLeafUrl(const char *imapHost,
const char *oldBoxPathName,
char hierarchySeparator,
const char *newBoxLeafName);
/* renaming a mailbox, moving hierarchy */
/* imap4://HOST?movefolderhierarchy?OLDNAME?NEWNAME */
/* oldBoxPathName is the old name of the child folder */
/* destinationBoxPathName is the name of the new parent */
char *CreateImapMailboxMoveFolderHierarchyUrl(const char *imapHost,
const char *oldBoxPathName,
char oldHierarchySeparator,
const char *destinationBoxPathName,
char newHierarchySeparator);
/* listing available mailboxes */
/* imap4://HOST?list */
char *CreateImapListUrl(const char *imapHost,
const char *mailbox,
const char hierarchySeparator);
/* biff */
char *CreateImapBiffUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
uint32 uidHighWater);
/* fetching RFC822 messages */
/* imap4://HOST?fetch?<UID/SEQUENCE>?MAILBOXPATH?x */
/* 'x' is the message UID or sequence number list */
/* will set the 'SEEN' flag */
char *CreateImapMessageFetchUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
const char *messageIdentifierList,
XP_Bool messageIdsAreUID);
/* fetching the headers of RFC822 messages */
/* imap4://HOST?header?<UID/SEQUENCE>?MAILBOXPATH?x */
/* 'x' is the message UID or sequence number list */
/* will not affect the 'SEEN' flag */
char *CreateImapMessageHeaderUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
const char *messageIdentifierList,
XP_Bool messageIdsAreUID);
/* search an online mailbox */
/* imap4://HOST?search?<UID/SEQUENCE>?MAILBOXPATH?SEARCHSTRING */
char *CreateImapSearchUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
const char *searchString,
XP_Bool messageIdsAreUID);
/* delete messages */
/* imap4://HOST?deletemsg?<UID/SEQUENCE>?MAILBOXPATH?x */
/* 'x' is the message UID or sequence number list */
char *CreateImapDeleteMessageUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
const char *messageIds,
XP_Bool idsAreUids);
/* delete all messages */
/* imap4://HOST?deleteallmsgs?MAILBOXPATH */
char *CreateImapDeleteAllMessagesUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator);
/* store +flags url */
/* imap4://HOST?store+flags?<UID/SEQUENCE>?MAILBOXPATH?x?f */
/* 'x' is the message UID or sequence number list */
/* 'f' is the byte of flags */
char *CreateImapAddMessageFlagsUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
const char *messageIds,
imapMessageFlagsType flags,
XP_Bool idsAreUids);
/* store -flags url */
/* imap4://HOST?store-flags?<UID/SEQUENCE>?MAILBOXPATH?x?f */
/* 'x' is the message UID or sequence number list */
/* 'f' is the byte of flags */
char *CreateImapSubtractMessageFlagsUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
const char *messageIds,
imapMessageFlagsType flags,
XP_Bool idsAreUids);
/* set flags url, make the flags match */
char *CreateImapSetMessageFlagsUrl(const char *imapHost,
const char *mailbox,
char hierarchySeparator,
const char *messageIds,
imapMessageFlagsType flags,
XP_Bool idsAreUids);
/* copy messages from one online box to another */
/* imap4://HOST?onlineCopy?<UID/SEQUENCE>?
SOURCEMAILBOXPATH?x?DESTINATIONMAILBOXPATH */
/* 'x' is the message UID or sequence number list */
char *CreateImapOnlineCopyUrl(const char *imapHost,
const char *sourceMailbox,
char sourceHierarchySeparator,
const char *messageIds,
const char *destinationMailbox,
char destinationHierarchySeparator,
XP_Bool idsAreUids,
XP_Bool isMove); /* cause delete after copy */
/* copy a message from an online box to an offline box */
/* imap4://HOST?ontooffCopy?SOURCEMAILBOXPATH?number=x?
DESTINATIONMAILBOXPATH */
/* 'x' is the message sequence number */
char *CreateImapOnToOfflineCopyUrl( const char *imapHost,
const char *sourceMailbox,
char sourceHierarchySeparator,
const char *messageIds,
const char *destinationMailbox,
XP_Bool idsAreUids,
XP_Bool isMove); /* cause delete after copy */
/* copy messages from an offline box to an online box */
/* imap4://HOST?offtoonCopy?DESTINATIONMAILBOXPATH */
/* the number of messages and their sizes are negotiated later */
char *CreateImapOffToOnlineCopyUrl(const char *imapHost,
const char *destinationMailbox,
char destinationHierarchySeparator);
/* Subscribe to a mailbox on the given IMAP host */
char *CreateIMAPSubscribeMailboxURL(const char *imapHost, const char *mailboxName);
/* Unsubscribe from a mailbox on the given IMAP host */
char *CreateIMAPUnsubscribeMailboxURL(const char *imapHost, const char *mailboxName);
/* get mail account rul */
/* imap4://HOST?NETSCAPE */
char *CreateImapManageMailAccountUrl(const char *imapHost);
/* append message from file */
/* imap4://HOST?appendmsgfromfile?MSGFILEPATH?DESTINATIONMAILBOXPATH */
char *CreateImapAppendMessageFromFileUrl(const char *imapHost,
const char *destinationMailboxPath,
const char hierarchySeparator,
XP_Bool isDraft);
/* refresh the ACL for a folder */
char *CreateIMAPRefreshACLForFolderURL(const char *imapHost, const char *mailbox);
/* refresh the ACL for all folders on given host*/
char *CreateIMAPRefreshACLForAllFoldersURL(const char *imapHost);
/* Run the auto-upgrade to IMAP Subscription */
char *CreateIMAPUpgradeToSubscriptionURL(const char *imapHost, XP_Bool subscribeToAll);
NET_StreamClass *CreateIMAPDownloadMessageStream(ImapActiveEntry *ce, uint32 msgSize);
void UpdateIMAPMailboxInfo(mailbox_spec *adoptedBoxSpec, MWContext *currentContext);
#define kUidUnknown -1
int32 GetUIDValidityForSpecifiedImapFolder(const char *hostName, const char *canonicalimapName, MWContext *currentContext);
enum EMailboxDiscoverStatus {
eContinue,
eContinueNew,
eListMyChildren,
eNewServerDirectory,
eCancelled };
enum EMailboxDiscoverStatus DiscoverIMAPMailbox(mailbox_spec *adoptedBoxSpec, MSG_Master *master, MWContext *currentContext);
void ReportSuccessOfOnlineCopy(MWContext *currentContext, enum ImapOnlineCopyState copyState);
void ReportSuccessOfOnlineDelete(MWContext *currentContext, const char *mailboxName);
void ReportFailureOfOnlineCreate(MWContext *currentContext, const char *mailboxName);
void ReportSuccessOfOnlineRename(MWContext *currentContext, folder_rename_struct *names);
void ReportMailboxDiscoveryDone(MWContext *currentContext, URL_Struct *URL_s);
void ReportSuccessOfChildMailboxDiscovery(MWContext *currentContext);
void NotifyHeaderFetchCompleted(MWContext *currentContext, TNavigatorImapConnection *imapConnection);
void ReportLiteSelectUIDVALIDITY(MSG_Pane *receivingPane, uint32 UIDVALIDITY);
typedef void (UploadCompleteFunctionPointer)(void*);
void BeginMessageUpload(MWContext *currentContext,
PRFileDesc *ioSocket,
UploadCompleteFunctionPointer *completeFunction,
void *completionFunctionArgument);
void IMAP_DoNotDownLoadAnyMessageHeadersForMailboxSelect(TNavigatorImapConnection *connection);
void IMAP_DownLoadMessagesForMailboxSelect(TNavigatorImapConnection *connection,
uint32 *messageKeys, /* uint32* is adopted */
uint32 numberOfKeys);
void IMAP_DownLoadMessageBodieForMailboxSelect(TNavigatorImapConnection *connection,
uint32 *messageKeys, /* uint32* is adopted */
uint32 numberOfKeys);
void IMAP_BodyIdMonitor(TNavigatorImapConnection *connection, XP_Bool enter);
const char *IMAP_GetCurrentConnectionUrl(TNavigatorImapConnection *connection);
void IMAP_UploadAppendMessageSize(TNavigatorImapConnection *connection, uint32 msgSize, imapMessageFlagsType flags);
void IMAP_ResetAnyCachedConnectionInfo();
XP_Bool IMAP_CheckNewMail(TNavigatorImapConnection *connection);
XP_Bool IMAP_NewMailDetected(TNavigatorImapConnection *connection);
TImapFlagAndUidState *IMAP_CreateFlagState(int numberOfMessages);
void IMAP_DeleteFlagState(TImapFlagAndUidState *state);
int IMAP_GetFlagStateNumberOfMessages(TImapFlagAndUidState *state);
imap_uid IMAP_GetUidOfMessage(int zeroBasedIndex, TImapFlagAndUidState *state);
imapMessageFlagsType IMAP_GetMessageFlags(int zeroBasedIndex, TImapFlagAndUidState *state);
imapMessageFlagsType IMAP_GetMessageFlagsFromUID(imap_uid uid, XP_Bool *foundIt, TImapFlagAndUidState *state);
void IMAP_TerminateConnection (TNavigatorImapConnection *connection);
char *IMAP_CreateOnlineSourceFolderNameFromUrl(const char *url);
void IMAP_FreeBoxSpec(mailbox_spec *victim);
const char *IMAP_GetPassword();
void IMAP_SetPassword(const char *password);
/* called once only by MSG_InitMsgLib */
void IMAP_StartupImap();
/* called once only by MSG_ShutdownMsgLib */
void IMAP_ShutdownImap();
/* used to prevent recursive listing of mailboxes during discovery */
int64 IMAP_GetTimeStampOfNonPipelinedList();
/* returns TRUE if either we have a password or we were preAuth'd by SSL certs */
XP_Bool IMAP_HaveWeBeenAuthenticated();
/* used by libmsg when creating an imap message display stream */
int IMAP_InitializeImapFeData (ImapActiveEntry * ce);
MSG_Pane *IMAP_GetActiveEntryPane(ImapActiveEntry * ce);
NET_StreamClass *IMAP_CreateDisplayStream(ImapActiveEntry * ce, XP_Bool clearCacheBit, uint32 msgSize);
/* used by libmsg when a new message is loaded to interrupt the load of the previous message */
void IMAP_PseudoInterruptFetch(MWContext *context);
void IMAP_URLFinished(URL_Struct *URL_s);
XP_Bool IMAP_HostHasACLCapability(const char *hostName);
/**** IMAP Host stuff - used for communication between MSG_IMAPHost (in libmsg) and TImapHostInfo (in libnet) ****/
/* obsolete? */
/*void IMAP_SetNamespacesFromPrefs(const char *hostName, char *personalDir, char *publicDir, char *otherUsersDir);*/
/* Sets the preference of whether or not we should always explicitly LIST the INBOX for given host */
void IMAP_SetShouldAlwaysListInboxForHost(const char *hostName, XP_Bool shouldList);
/* Gets the number of namespaces in use for a given host */
int IMAP_GetNumberOfNamespacesForHost(const char *hostName);
/* Sets the currently-used default personal namespace for a given host. Used for updating from libnet when
we get a NAMESPACE response. */
void MSG_SetNamespacePrefixes(MSG_Master *master, const char *hostName, EIMAPNamespaceType type, const char *prefix);
/* Check to see if we need upgrade to IMAP subscription */
extern XP_Bool MSG_ShouldUpgradeToIMAPSubscription(MSG_Master *mast);
extern void MSG_ReportSuccessOfUpgradeToIMAPSubscription(MWContext *context, enum EIMAPSubscriptionUpgradeState *state);
/* Adds a set of ACL rights for the given folder on the given host for the given user. If userName is NULL, it means
the currently authenticated user (i.e. my rights). */
extern void MSG_AddFolderRightsForUser(MSG_Master *master, const char *hostName, const char*mailboxName, const char *userName, const char *rights);
/* Clears all ACL rights for the given folder on the given host for all users. */
extern void MSG_ClearFolderRightsForFolder(MSG_Master *master, const char *hostName, const char *mailboxName);
/* Refreshes the icon / flags for a given folder, based on new ACL rights */
extern void MSG_RefreshFolderRightsViewForFolder(MSG_Master *master, const char *hostName, const char *mailboxName);
extern XP_Bool MSG_GetFolderNeedsSubscribing(MSG_FolderInfo *folder);
/* Returns TRUE if this folder needs an auto-refresh of the ACL (on a folder open, for example) */
extern XP_Bool MSG_GetFolderNeedsACLListed(MSG_FolderInfo *folder);
/* Returns TRUE if this folder has NEVER (ever) had an ACL retrieved for it */
extern XP_Bool MSG_IsFolderACLInitialized(MSG_Master *master, const char *folderName, const char *hostName);
extern char *IMAP_SerializeNamespaces(char **prefixes, int len);
extern int IMAP_UnserializeNamespaces(const char *str, char **prefixes, int len);
XP_END_PROTOS
#endif

369
mozilla/include/intl_csi.h Normal file
View File

@@ -0,0 +1,369 @@
/* -*- 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.
*/
/* intl_csi.h */
#ifndef INTL_CSI_H
#define INTL_CSI_H
/*
Using the i18n Character-Set-Information (CSI) accessor functions:
1) include the header file
#include "intl_csi.h"
2) get the i18n CSI object (generally from MWContext)
INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(context);
3) access (read/set) the data element
int16 doc_csid = INTL_GetCSIDocCSID(csi);
INTL_SetCSIDocCSID(csi, new_doc_csid);
int16 win_csid = INTL_GetCSIWinCSID(csi);
INTL_SetCSIWinCSID(csi, new_win_csid);
char *mime_name = INTL_GetCSIMimeCharset(csi);
INTL_SetCSIMimeCharset(csi, new_mime_charset);
int16 relayout_flag = INTL_GetCSIRelayoutFlag(csi);
INTL_SetCSIRelayoutFlag(csi, new_relayout_flag);
*/
XP_BEGIN_PROTOS
#include "ntypes.h"
#include "libi18n.h"
/**
* Cookie for INTL_CSIInfo.
*
* This is a Magic Cookie to validate the pointer to INTL_CSIInfo in MWContext.
*
*/
#define INTL_TAG 0x494E544C
/**@name Character Set Information (CSI) */
/*@{*/
/**
* Allocate a new charset info object, and clear it with zeroes.
*
* @return The new charset info object
* @see INTL_CSIInitialize, INTL_CSIDestroy
*/
PUBLIC INTL_CharSetInfo INTL_CSICreate(void);
/**
* Frees the given charset info object.
*
* @param obj Specifies the charset info object
* @see INTL_CSICreate
*/
PUBLIC void INTL_CSIDestroy(
INTL_CharSetInfo obj
);
/**
* Sets all the charset info object fields to initial values.
*
* The override, HTTP, HTML META, document and window charset IDs are all set
* to CS_DEFAULT. The MIME charset is set to NULL. The relayout flag is set
* to METACHARSET_NONE.
*
* @param obj Specifies the charset info object
* @see INTL_CSIInitialize
*/
PUBLIC void INTL_CSIReset(
INTL_CharSetInfo obj
);
/**
* Initializes the charset info object.
*
* <UL>
* <LI>
* If the given is_metacharset_reload argument is FALSE, INTL_CSIReset is
* called, passing the given charset info object.
*
* <LI>
* If the given is_metacharset_reload argument is TRUE, the charset info
* object's relayout flag is set to METACHARSET_RELAYOUTDONE.
*
* <LI>
* Otherwise, if the override charset ID is previously set in this object,
* it is set in the document charset ID field.
*
* <LI>
* Otherwise, if the given HTTP charset is known, it is set in the HTTP
* charset field.
*
* <LI>
* Otherwise, the document charset ID field is set to the given
* defaultDocCharSetID, unless the type is mail/news, in which case CS_DEFAULT
* is used. This is because the META charset in mail/news is sometimes wrong.
*
* <LI>
* Finally, the window charset ID is set, based on the document charset ID.
* </UL>
*
* @param obj Specifies the charset info object
* @param is_metacharset_reload TRUE if it is currently reloading because
* the layout code found HTML META charset.
* FALSE otherwise.
* @param http_charset Specifies the charset name if it is presented in
* HTTP Content-Type header
* @param type Specifies the context type
* @param defaultDocCharSetID Specifies the default document charset ID.
* @see
*/
PUBLIC void INTL_CSIInitialize(
INTL_CharSetInfo obj,
XP_Bool is_metacharset_reload,
char *http_charset,
int type,
uint16 defaultDocCharSetID
);
/**
* Sets HTML META charset info in the given charset info object.
*
* <UL>
* <LI>
* If the given charset is unknown, this function returns.
*
* <LI>
* If the given context type is mail or news, this function returns,
* since mail/news sometimes has wrong HTML META charsets.
*
* <LI>
* If the relayout flag is set to something other than METACHARSET_NONE, this
* function returns, to avoid setting the META charset more than once.
*
* <LI>
* Otherwise, the HTML META charset field is set, and the relayout flag is
* set to METACHARSET_HASCHARSET.
* If the previous document charset was known,
* and was different from the new META charset, the relayout flag is set to
* METACHARSET_REQUESTRELAYOUT.
* The window charset ID is also checked against the new one.
* If they are different, the relayout flag is set to
* METACHARSET_REQUESTRELAYOUT.
* </UL>
*
* @param obj Specifies the charset info object
* @param charset_tag Specifies the HTML META charset
* @param type Specifies the context type
* @see INTL_GetCSIMetaDocCSID, INTL_GetCSIRelayoutFlag
*/
PUBLIC void INTL_CSIReportMetaCharsetTag(
INTL_CharSetInfo obj,
char *charset_tag,
int type
);
/**
* Returns the context's charset info object.
*
* @param context Specifies the context
* @return The context's charset info object
* @see INTL_CSICreate
*/
PUBLIC INTL_CharSetInfo LO_GetDocumentCharacterSetInfo(
MWContext *context
);
/**
* Returns the document charset ID of the given charset info object.
*
* @param obj Specifies the charset info object
* @return The document charset ID
* @see INTL_SetCSIDocCSID
*/
PUBLIC int16 INTL_GetCSIDocCSID(
INTL_CharSetInfo obj
);
/**
* Sets the document charset ID field of the given charset info object.
*
* The document charset ID field is only set if the higher precedence fields
* (override, HTTP and META) are all set to CS_DEFAULT.
*
* @param obj Specifies the charset info object
* @param docCharSetID Specifies the document charset ID
* @see INTL_GetCSIDocCSID
*/
PUBLIC void INTL_SetCSIDocCSID(
INTL_CharSetInfo obj,
int16 docCharSetID
);
/**
* Returns the override document charset ID of the given charset info object.
*
* @param obj Specifies the charset info object
* @return The override document charset ID
* @see INTL_SetCSIOverrideDocCSID
*/
PUBLIC int16 INTL_GetCSIOverrideDocCSID(
INTL_CharSetInfo obj
);
/**
* Sets the override document charset ID of the given charset info object.
*
* @param obj Specifies the charset info object
* @param overrideDocCharSetID Specifies the override document charset ID
* @see INTL_GetCSIOverrideDocCSID
*/
PUBLIC void INTL_SetCSIOverrideDocCSID(
INTL_CharSetInfo obj,
int16 overrideDocCharSetID
);
/**
* Returns the HTML META document charset ID of the given charset info object.
*
* @param obj Specifies the charset info object
* @return The HTML META document charset ID
* @see INTL_SetCSIMetaDocCSID
*/
PUBLIC int16 INTL_GetCSIMetaDocCSID(
INTL_CharSetInfo obj
);
/**
* Sets the HTML META document charset ID of the given charset info object.
*
* The HTML META document charset ID field is only set if the higher precedence
* fields (override and HTTP) are all set to CS_DEFAULT.
*
* @param obj Specifies the charset info object
* @param metaCharSetID Specifies the HTML META document charset ID
* @see INTL_GetCSIMetaDocCSID
*/
PUBLIC void INTL_SetCSIMetaDocCSID(
INTL_CharSetInfo obj,
int16 metaCharSetID
);
/**
* Returns the HTTP document charset ID of the given charset info object.
*
* @param obj Specifies the charset info object
* @return The HTTP document charset ID
* @see INTL_SetCSIHTTPDocCSID
*/
PUBLIC int16 INTL_GetCSIHTTPDocCSID(
INTL_CharSetInfo obj
);
/**
* Sets the HTTP document charset ID of the given charset info object.
*
* The HTTP document charset ID field is only set if the higher precedence
* field (override) is set to CS_DEFAULT.
*
* @param obj Specifies the charset info object
* @param httpDocCharSetID Specifies the HTTP document charset ID
* @see INTL_GetCSIHTTPDocCSID
*/
PUBLIC void INTL_SetCSIHTTPDocCSID(
INTL_CharSetInfo obj,
int16 httpDocCharSetID
);
/**
* Returns the window charset ID of the given charset info object.
*
* @param obj Specifies the charset info object
* @return The window charset ID
* @see INTL_SetCSIWinCSID
*/
PUBLIC int16 INTL_GetCSIWinCSID(
INTL_CharSetInfo obj
);
/**
* Sets the window charset ID field of the given charset info object.
*
* @param obj Specifies the charset info object
* @param winCharSetID Specifies the window charset ID
* @see INTL_GetCSIWinCSID
*/
PUBLIC void INTL_SetCSIWinCSID(
INTL_CharSetInfo obj,
int16 winCharSetID
);
/**
* Returns the MIME charset field of the given charset info object.
*
* @param obj Specifies the charset info object
* @return The MIME charset
* @see INTL_SetCSIMimeCharset
*/
PUBLIC char *INTL_GetCSIMimeCharset(
INTL_CharSetInfo obj
);
/**
* Sets the MIME charset field of the given charset info object.
*
* If the charset info object already contains a pointer to a MIME charset,
* that charset is freed. Then the given charset is copied, and the copy is
* converted to lower case. The copy is then set in the MIME charset field.
*
* @param obj Specifies the charset info object
* @param mime_charset Specifies the MIME charset
* @see INTL_GetCSIMimeCharset
*/
PUBLIC void INTL_SetCSIMimeCharset(
INTL_CharSetInfo obj,
char *mime_charset
);
/**
* Returns the relayout field of the given charset info object.
*
* @param obj Specifies the charset info object
* @return The relayout field
* @see INTL_SetCSIRelayoutFlag
*/
PUBLIC int16 INTL_GetCSIRelayoutFlag(
INTL_CharSetInfo obj
);
/**
* Sets the relayout field of the given charset info object.
*
* @param obj Specifies the charset info object
* @param relayout Specifies the relayout field
* @see INTL_GetCSIRelayoutFlag
*/
PUBLIC void INTL_SetCSIRelayoutFlag(
INTL_CharSetInfo obj,
int16 relayout
);
/*@}*/
XP_END_PROTOS
#endif /* INTL_CSI_H */

176
mozilla/include/itapefs.h Normal file
View File

@@ -0,0 +1,176 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef ITAPEFS_H
#define ITAPEFS_H
#ifdef EDITOR
//
// Abstract output file stream.
//
class IStreamOut {
public:
IStreamOut();
virtual ~IStreamOut();
virtual void Write( char *pBuffer, int32 iCount )=0;
// NOTICE: the implementation is not pure. There is a default
// implementation that implements this function interms of
// 'Write'.
virtual int Printf( char * pFormat, ... );
enum EOutStreamStatus {
EOS_NoError,
EOS_DeviceFull,
EOS_FileError
};
virtual EOutStreamStatus Status(){ return EOS_NoError; }
// implemented in terms of the interface.
void WriteInt( int32 i ){ Write( (char*)&i, sizeof( int32 ) ); }
void WriteZString( char* pString);
void WritePartialZString( char* pString, int32 start, int32 end);
private:
char* stream_buffer; // used to implement Printf
};
//-----------------------------------------------------------------------
// Abstract File System
//-----------------------------------------------------------------------
typedef void
EDT_ITapeFileSystemComplete( XP_Bool bSuccess, void *pArg );
class ITapeFileSystem {
PRBool m_FirstBinary; // is the first file really binary, not text?
public:
ITapeFileSystem() { m_FirstBinary = PR_FALSE; }
// ITapeFileSystem::File, ITapeFileSystem::Publish, or
// ITapeFileSystem::MailSend,
enum {File,Publish,MailSend};
virtual intn GetType() = 0;
// This function is called before anything else. It tells the file
// system the base url for the URLs added in AddFile().
// An actual file, not a directory.
virtual void SetSourceBaseURL( char* pURL )=0;
// DESCRIPTION:
//
// Add a name to the file system. It is up to the file system to localize
// the name. For example, I could add 'http://home.netsacpe.com/
// and the file system might decide that it should be called 'index.html'
// if the file system were DOS, the url might be converted to INDEX.HTML
//
// pMIMEType may be NULL. In this case if the tape file system needs the
// MIME type, it must figure it out by itself.
//
// RETURNS: index of the file (0 based), OR
// ITapeFileSystem::Error if an error adding name, OR
// ITapeFileSystem::SourceDestSame if adding
// this name would result in the source and destination being the same, and thus
// no point in copying the file.
//
// The first file added must be the root HTML document. (It is ok for the root
// document to have the same source and dest URL).
//
virtual intn AddFile( char* pURL, char *pMIMEType, int16 iCharSetID)=0;
// Return the number of files added to the file system.
virtual intn GetNumFiles()=0;
// Returns the absolute version of the URL given in AddFile(), using the
// URL given in SetSourceBaseURL() as the base.
// Allocated with XP_STRDUP().
virtual char* GetSourceURL(intn iFileIndex)=0;
// Return the absolute destination of the HTML doc if meaningful, else return
// NULL. Almost the same as "GetDestPathURL()+GetDestURL(0)" except that this call
// will work before file 0 has been added to the file system.
virtual char* GetDestAbsURL()=0;
// Gets the name of the RELATIVE url to place in the file. String is
// allocated with XP_STRDUP();
//
virtual char* GetDestURL( intn iFileIndex )=0;
// Return the path URL associated with the ITapeFilesystem or NULL if there is none.
// If NULL is returned, all URLs returned by GetDestURL() must be absolute.
//
// i.e. for a file or remote HTTP based ITapeFileSystem, this is the directory where the images are
// stored. For a MHTML ITapeFileSystem this is NULL.
//
// String is allocated with XP_STRDUP().
virtual char* GetDestPathURL() = 0;
//
// Returns the name to display when saving the file, can be the same as
// GetURLName. String is allocated with XP_STRDUP();
//
virtual char* GetHumanName( intn iFileIndex )=0;
enum {
Error = -1, SourceDestSame = -2
};
// Does the file referenced by iFileIndex already exist?
// E.g. for the MHTML version, this will always return FALSE.
virtual XP_Bool FileExists(intn iFileIndex) = 0;
// Will we be creating a new non-temporary file on the local machine.
// Used to update SiteManager.
virtual XP_Bool IsLocalPersistentFile(intn iFileIndex) = 0;
// ### mwelch Added so that multipart/related message saver can properly construct
// messages using quoted/forwarded part data.
// Tell the tape file system the mime type of a particular part.
// Calling this overrides any previously determined mime type for this part.
virtual void CopyURLInfo(intn iFileIndex, const URL_Struct *pURL) = 0;
//
// Opens the output stream. Returns a stream that can be written to or NULL if error. All
// 'AddFile's occur before the first OpenStream.
// Do not delete the returned stream, just call CloseStream() when done.
//
virtual IStreamOut *OpenStream( intn iFileIndex )=0;
virtual void CloseStream( intn iFileIndex )=0;
// Called on completion, TRUE if completed successfully, FALSE if it failed.
// The caller should not reference the ITapeFileSystem after calling Complete().
// Caller does not free up memory for ITapeFileSystem, Complete() causes file system to delete itself.
//
// The tape file system will call pfComplete with pArg and with whether the ITapeFileSystem
// completed successfully. Note: the ITapeFileSystem may call pfComplete() with TRUE even if
// ITapeFileSystem::Complete() was given FALSE.
// pfComplete may be NULL. Call to pfComplete may be synchronous or asynchronous.
//
// The ITapeFileSystem will call pfComplete(success,pArg) before deleting itself. I.e. the ITapeFileSystem is still valid
// when it calls pfComplete().
virtual void Complete( Bool bSuccess, EDT_ITapeFileSystemComplete *pfComplete, void *pArg )=0;
inline PRBool IsFirstBinary(void) { return m_FirstBinary; }
inline void SetFirstBinary(void) { m_FirstBinary = PR_TRUE; }
inline void ResetFirstBinary(void) { m_FirstBinary = PR_FALSE; }
};
#endif // EDITOR
#endif

139
mozilla/include/libc_r.h Normal file
View File

@@ -0,0 +1,139 @@
/* -*- 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.
*/
/* libc_r.h -- macros, defines, etc. to make using reentrant libc calls */
/* a bit easier. This was initially done for AIX pthreads, */
/* but should be usable for anyone... */
/* Most of these use locally defined space instead of static library space. */
/* Because of this, we use the _INIT_R to declare/allocate space (stack), */
/* and the plain routines to actually do it..._WARNING_: avoid allocating */
/* memory wherever possible. Memory allocation is fairly expensive, at */
/* least on AIX...use arrays instead (which allocate from the stack.) */
/* I know the names are a bit strange, but I wanted to be fairly certain */
/* that we didn't have any namespace corruption...in general, the inits are */
/* R_<name>_INIT_R(), and the actual calls are R_<name>_R(). */
#ifndef _LIBC_R_H
#define _LIBC_R_H
/************/
/* strtok */
/************/
#define R_STRTOK_INIT_R() \
char *r_strtok_r=NULL
#define R_STRTOK_R(return,source,delim) \
return=strtok_r(source,delim,&r_strtok_r)
#define R_STRTOK_NORET_R(source,delim) \
strtok_r(source,delim,&r_strtok_r)
/**************/
/* strerror */
/**************/
#define R_MAX_STRERROR_LEN_R 8192 /* Straight from limits.h */
#define R_STRERROR_INIT_R() \
char r_strerror_r[R_MAX_STRERROR_LEN_R]
#define R_STRERROR_R(val) \
strerror_r(val,r_strerror_r,R_MAX_STRERROR_LEN_R)
/*****************/
/* time things */
/*****************/
#define R_ASCTIME_INIT_R() \
char r_asctime_r[26]
#define R_ASCTIME_R(val) \
asctime_r(val,r_asctime_r)
#define R_CTIME_INIT_R() \
char r_ctime_r[26]
#define R_CTIME_R(val) \
ctime_r(val,r_ctime_r)
#define R_GMTIME_INIT_R() \
struct tm r_gmtime_r
#define R_GMTIME_R(time) \
gmtime_r(time,&r_gmtime_r)
#define R_LOCALTIME_INIT_R() \
struct tm r_localtime_r
#define R_LOCALTIME_R(val) \
localtime_r(val,&r_localtime_r)
/***********/
/* crypt */
/***********/
#include <crypt.h>
#define R_CRYPT_INIT_R() \
CRYPTD r_cryptd_r; \
bzero(&r_cryptd_r,sizeof(CRYPTD))
#define R_CRYPT_R(pass,salt) \
crypt_r(pass,salt,&r_cryptd_r)
/**************/
/* pw stuff */
/**************/
#define R_MAX_PW_LEN_R 1024
/* The following must be after the last declaration, but */
/* before the first bit of code... */
#define R_GETPWNAM_INIT_R(pw_ptr) \
struct passwd r_getpwnam_pw_r; \
char r_getpwnam_line_r[R_MAX_PW_LEN_R]; \
pw_ptr = &r_getpwnam_pw_r
#define R_GETPWNAM_R(name) \
getpwnam_r(name,&r_getpwnam_pw_r,r_getpwnam_line_r,R_MAX_PW_LEN_R)
/*******************/
/* gethost stuff */
/*******************/
#define R_GETHOSTBYADDR_INIT_R() \
struct hostent r_gethostbyaddr_r; \
struct hostent_data r_gethostbyaddr_data_r
#define R_GETHOSTBYADDR_R(addr,len,type,xptr_ent) \
bzero(&r_gethostbyaddr_r,sizeof(struct hostent)); \
bzero(&r_gethostbyaddr_data_r,sizeof(struct hostent_data)); \
xptr_ent = &r_gethostbyaddr_r; \
if (gethostbyaddr_r(addr,len,type, \
&r_gethostbyaddr_r,&r_gethostbyaddr_data_r) == -1) { \
xptr_ent = NULL; \
}
#define R_GETHOSTBYNAME_INIT_R() \
struct hostent r_gethostbyname_r; \
struct hostent_data r_gethostbyname_data_r
#define R_GETHOSTBYNAME_R(name,xptr_ent) \
bzero(&r_gethostbyname_r,sizeof(struct hostent)); \
bzero(&r_gethostbyname_data_r,sizeof(struct hostent_data)); \
xptr_ent = &r_gethostbyname_r; \
if (gethostbyname_r(name, \
&r_gethostbyname_r,&r_gethostbyname_data_r) == -1) { \
xptr_ent = NULL; \
}
#endif /* _LIBC_R_H */

209
mozilla/include/libcnv.h Normal file
View File

@@ -0,0 +1,209 @@
/* -*- 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.
*/
//"libcnv.h"
#ifndef _LIBCNV_H
#define _LIBCNV_H
#ifndef _IMAGE_CONVERT
#error _IMAGE_CONVERT SYMBOL NEEDED BEFORE INCLUSION
#endif /*_IMAGE_CONVERT*/
#ifndef __cplusplus
typedef unsigned char BYTE;
typedef uint32 DWORD;
#endif
#include "xp_core.h"/*defines of int32 ect*/
#include "xp_file.h"
#include "xp_mem.h"/*XP_HUGE*/
#define MAXIMAGEPATHLEN 255
typedef enum
{
CONV_CANCEL,
CONV_OK,
CONVERR_INVALIDSOURCE,
CONVERR_INVALIDDEST,
CONVERR_INVALIDFILEHEADER,
CONVERR_INVALIDIMAGEHEADER,
CONVERR_INVALIDBITDEPTH,
CONVERR_INVALIDCOLORMAP,
CONVERR_BADREAD,
CONVERR_OUTOFMEMORY,
CONVERR_JPEGERROR,
CONVERR_COMPRESSED,
CONVERR_BADPLANES,
CONVERR_BADWRITE,
CONVERR_INVALIDPARAMS,
CONVERR_UNKNOWN,
NUM_CONVERR
}CONVERT_IMAGERESULT;
typedef BYTE * CONVERT_IMG_ROW;
typedef CONVERT_IMG_ROW * CONVERT_IMG_ARRAY;
typedef enum
{
conv_unknown,
conv_png,
conv_jpeg,
conv_bmp,
conv_pict,
conv_xpm,
conv_rgb,
conv_plugin
}convimgenum;
typedef struct tagCONVERT_IMG_STREAM
{
XP_HUGE_CHAR_PTR m_mem;
FILE *m_file;/*used only with type 0 -must allready be opened for read or write does not use current index ect.*/
int16 m_type;/*0=CONVERT_FILE 1=CONVERT_MEMORY*/
DWORD m_streamsize;/* 0== unlimited */
DWORD m_currentindex;
}CONVERT_IMG_STREAM;
/*Sent in a BITMAP structure*/
#define CONVERT_MEMORY 1
#define CONVERT_FILE 0
typedef struct tagCONVERT_IMGCONTEXT CONVERT_IMGCONTEXT;
typedef struct tagCONVERT_IMG_INFO CONVERT_IMG_INFO;
typedef CONVERT_IMAGERESULT (*CONVERT_DIALOGIMAGECALLBACK)(CONVERT_IMGCONTEXT *input,
CONVERT_IMGCONTEXT *outputarray,
CONVERT_IMG_INFO *imginfo,
int16 numoutput,
CONVERT_IMG_ARRAY imagearray);
typedef CONVERT_IMAGERESULT (*CONVERT_COMPLETECALLBACK)(CONVERT_IMGCONTEXT *outputarray,int16 p_numoutputs,void *hook);
typedef void (*CONVERT_BUFFERCALLBACK)(void *);/*j_common_ptr);*/
typedef struct tagCONVERT_CALLBACKS
{
CONVERT_DIALOGIMAGECALLBACK m_dialogimagecallback;
CONVERT_BUFFERCALLBACK m_displaybuffercallback;
CONVERT_COMPLETECALLBACK m_completecallback;
}CONVERT_CALLBACKS;
typedef struct tagCONVERT_IMGCONTEXT
{
convimgenum m_imagetype;
CONVERT_IMG_STREAM m_stream;/*used with m_streamtype 1,2*/
int16 m_quality;
char m_filename[MAXIMAGEPATHLEN];/*will not be used to open FILE *. used for output. maybe in future will open file?*/
CONVERT_CALLBACKS m_callbacks;
#ifdef XP_OS2
XP_OS2_ARG(void *m_parentwindow);/*used for callbacks to bring up dialog boxes. void * = CWnd *for Windows*/
#else
XP_WIN_ARG(void *m_parentwindow);/*used for callbacks to bring up dialog boxes. void * = CWnd *for Windows*/
#endif
void *m_pMWContext;//used for callbacks to insert the image. and for plugins
}CONVERT_IMGCONTEXT;
typedef struct tagCONVERT_IMG_INFO
{
BYTE *m_colormap;
int16 m_numcolorentries;
uint16 m_X_density;
uint16 m_Y_density;
int16 m_density_unit;
int16 m_in_color_space;
int16 m_input_components;
int16 m_data_precision;
int16 m_image_width;/*pixel width*/
int16 m_image_height;/*pixel_height*/
int16 m_bitsperpixel;
int16 m_row_width;/*width in bytes*/
int16 m_stride; /*row_width-(pixel_width*bpp)/8 */
DWORD m_image_size; /*informational purposes*/
}CONVERT_IMG_INFO;
#ifdef __cplusplus
extern "C"
{
#endif
/****************************/
/*API CALLS AND DECLARATIONS*/
/****************************/
/*converts input to p_numoutput many outputs*/
/*p_outpuffilenames must be a PREALLOCATED array of char *s at least p_numoutputs char *s these pointers will
point to output filenames that YOU will be responsible to destroy!
you may pass in null for p_outputfilenames and it wil*/
CONVERT_IMAGERESULT convert_stream2image(CONVERT_IMGCONTEXT p_input,CONVERT_IMG_INFO *p_imageinfo,int16 p_numoutputs,char **p_outputfilenames);
/*quantize_pixels will change the imagearray to have only maxcolors distinct values*/
CONVERT_IMAGERESULT convert_quantize_pixels(CONVERT_IMG_ARRAY imagearray,int16 imagewidth,int16 imageheight,int16 maxcolorvalue);
/*given a imagecontext, it will tell you if it is a png,bmp,gif ect*/
convimgenum select_file_type (CONVERT_IMGCONTEXT * p_input);
/****************************/
/*END API CALLS AND DECLARATIONS*/
/****************************/
/****************************/
/*STREAM DECLARATIONS*/
/****************************/
/*CONV_IMG_FREAD taken from JPEG libraries for independence from common header file*/
#define CONV_IMG_FREAD(file,buf,sizeofbuf) \
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define ReadOK(file,buffer,len) (CONV_IMG_FREAD(file,buffer,len) == ((size_t) (len)))
int16 read_mem_stream(CONVERT_IMG_STREAM *p_stream,void *p_dest,uint16 p_bytecount);
BYTE read_mem_stream_byte(CONVERT_IMG_STREAM *p_stream);
int16 read_param(CONVERT_IMG_STREAM *p_input,void *p_dest,uint16 p_bytecount);
BYTE read_param_byte(CONVERT_IMG_STREAM *p_input);
/****************************/
/*END STREAM DECLARATIONS*/
/****************************/
#ifdef __cplusplus
}
#endif
#endif

748
mozilla/include/libevent.h Normal file
View File

@@ -0,0 +1,748 @@
/* -*- 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.
*/
/*
* Header file for event passing between the mozilla thread and
* the mocha thread
*/
#ifndef libevent_h___
#define libevent_h___
#include "libmocha.h"
#include "prtypes.h"
#ifndef NSPR20
#include "prevent.h"
#else
#include "plevent.h"
#endif
#include "shist.h"
#include "fe_proto.h"
#include "lo_ele.h"
NSPR_BEGIN_EXTERN_C
extern PREventQueue * mozilla_event_queue;
/*
* XXX - should we use the same event values as layer events?
*/
/* Event bits stored in the low end of decoder->event_mask. */
#define EVENT_MOUSEDOWN 0x00000001
#define EVENT_MOUSEUP 0x00000002
#define EVENT_MOUSEOVER 0x00000004 /* user is mousing over a link */
#define EVENT_MOUSEOUT 0x00000008 /* user is mousing out of a link */
#define EVENT_MOUSEMOVE 0x00000010
#define EVENT_MOUSEDRAG 0x00000020
#define EVENT_CLICK 0x00000040 /* input element click in progress */
#define EVENT_DBLCLICK 0x00000080
#define EVENT_KEYDOWN 0x00000100
#define EVENT_KEYUP 0x00000200
#define EVENT_KEYPRESS 0x00000400
#define EVENT_DRAGDROP 0x00000800 /* not yet implemented */
#define EVENT_FOCUS 0x00001000 /* input focus event in progress */
#define EVENT_BLUR 0x00002000 /* loss of focus event in progress */
#define EVENT_SELECT 0x00004000 /* input field selection in progress */
#define EVENT_CHANGE 0x00008000 /* field value change in progress */
#define EVENT_RESET 0x00010000 /* form submit in progress */
#define EVENT_SUBMIT 0x00020000 /* form submit in progress */
#define EVENT_SCROLL 0x00040000 /* window is being scrolled */
#define EVENT_LOAD 0x00080000 /* layout parsed a loaded document */
#define EVENT_UNLOAD 0x00100000
#define EVENT_XFER_DONE 0x00200000 /* document has loaded */
#define EVENT_ABORT 0x00400000
#define EVENT_ERROR 0x00800000
#define EVENT_LOCATE 0x01000000
#define EVENT_MOVE 0x02000000
#define EVENT_RESIZE 0x04000000
#define EVENT_FORWARD 0x08000000
#define EVENT_HELP 0x10000000 /* for handling of help events */
#define EVENT_BACK 0x20000000
/* #define EVENT_PRINT 0x20000000 *//* To be removed per joki */
#define STATUS_STOP 0x00000001 /* stop processing */
#define STATUS_IGNORE 0x00000002 /* no new messages */
#define EVENT_ALT_MASK 0x00000001
#define EVENT_CONTROL_MASK 0x00000002
#define EVENT_SHIFT_MASK 0x00000004
#define EVENT_META_MASK 0x00000008
#define ARGTYPE_NULL 0x00000001
#define ARGTYPE_INT32 0x00000002
#define ARGTYPE_BOOL 0x00000004
#define ARGTYPE_STRING 0x00000008
#define SIZE_MAX 0x00000001
#define SIZE_MIN 0X00000002
/*
* When the event has been processed by the backend, there will be
* a front-end callback that gets called. If the event processed
* successfully, the callback will be passed EVENT_OK. If the
* event wasn't successful (i.e. the user canceled it) the return
* status will be EVENT_CANCEL. If something radical happened
* and the front-end should do nothing (i.e. mocha changed the
* underlying context) the status will be EVENT_PANIC and the
* front end should treat the context and element passed to the
* exit routine as bogus
*/
typedef enum {
EVENT_OK,
EVENT_CANCEL,
EVENT_PANIC
} ETEventStatus;
/*
* When a given event gets processed we may need to tell the front
* end about it so that they can update the UI / continue the
* operation. The context, lo_element, lType and whatever
* field are all supplied by the original ET_SendEvent() call.
* See ET_SendEvent() for a description of the values for
* the status parameter
*/
typedef void
(*ETClosureFunc)(MWContext * pContext, LO_Element * lo_element,
int32 lType, void * whatever, ETEventStatus status);
/*
* Someone has initiated a call to LM_EvaluateBuffer(). This function
* gets called back with the result
*/
typedef void
(*ETEvalAckFunc)(void * data, char * result_string, size_t result_length,
char * wysiwyg_url, char * base_href, Bool valid);
/*
* This function is called back after a layer's state has been restored
* in a resize_relayout.
*/
typedef void
(*ETRestoreAckFunc)(void * data, LO_BlockInitializeStruct *param);
/*
* Typedef for a function taking a void pointer and
* returning nothing
*/
typedef void
(*ETVoidPtrFunc)(void * data);
/*
* Typedef for a function taking a void pointer and
* returning a bool
*/
typedef PRBool
(*ETBoolPtrFunc)(void * data);
/*
* Typedef for a function taking a void pointer and
* returning a int32
*/
typedef int32
(*ETIntPtrFunc)(void * data);
/*
* Typedef for a function taking a void pointer and
* returning a char *
*/
typedef char *
(*ETStringPtrFunc)(void * data);
/*
* Struct for passing JS typed variable info through C interface calls
*/
typedef union ArgVal {
int32 intArg;
XP_Bool boolArg;
char * stringArg;
} ArgVal;
typedef struct {
uint8 type; /* arg type as defined at top of file */
ArgVal value;
} JSCompArg;
/*
* Typedef for a function used to verify installed components and
* get back components utility functions.
*/
typedef PRBool
(*ETVerifyComponentFunc)(void **active_callback, void **startup_callback);
/*
* Generic function for JS setting values with native calls.
*/
typedef void
(*ETCompPropSetterFunc)(char *name, void *value);
/*
* Generic function for JS getting values from native calls.
*/
typedef void*
(*ETCompPropGetterFunc)(char *name);
/*
* Generic function for JS calling native methods.
*/
typedef void*
(*ETCompMethodFunc)(int32 argc, JSCompArg *argv);
/* --------------------------------------------------------------------------
* Common prologue for talking between the mocha thread and the mozilla
* thread
*/
typedef struct {
PREvent event; /* the PREvent structure */
MWContext* context; /* context */
int32 doc_id; /* doc id of context when event launched */
PRPackedBool handle_eagerly;
} ETEvent;
/*
* Struct to send back from front end in order to get additional
* event information without having to initialize event object
* until necessary. Yow, there is a lot of junk in here now
* can we make a union out of some of these or are they always
* needed?
*/
typedef struct {
ETEvent ce;
MochaDecoder * decoder;
JSObject * object;
int32 type;
int32 layer_id;
int32 id;
LO_Element * lo_element;
ETClosureFunc fnClosure; /* event sender closure */
void * whatever; /* anything other state */
int32 x,y;
int32 docx,docy;
int32 screenx,screeny;
uint32 which;
uint32 modifiers;
void * data;
uint32 dataSize;
PRPackedBool saved;
PRPackedBool event_handled;
} JSEvent;
/*
* Tell the backend about a new event.
* The event is placed onto an event queue, it is not processed
* immediately. If the event is the type that can be cancelled
* by the backend (i.e. a button click or a submit) the front
* end must wait until the callback routine gets called before
* continuing with the operation. The ETEventStatus will be
* EVENT_OK if the operation is to continue or EVENT_CANCEL
* if it got cancelled.
*
* The processing of the event may cause the document to change
* or even the whole window to close. In those cases the callback
* will still get called in case there is any front-end cleanup
* to do but the ETEventStatus will be set to EVENT_PANIC
*
*/
extern JSBool
ET_SendEvent(MWContext * pContext, LO_Element *pElement, JSEvent *pEvent,
ETClosureFunc fnClosure, void * whatever);
/*
* Tell the backend about a new document load event. We need a
* closure so that libparse/layout knows when its safe to discard
* the old document when they were waiting for onunload events to
* finish processing
*/
extern void
ET_SendLoadEvent(MWContext * pContext, int32 type, ETVoidPtrFunc fnClosure,
NET_StreamClass *stream, int32 layer_id, Bool resize_reload);
/*
* Tell the backend about a new image event. Async. No closure
*/
extern void
ET_SendImageEvent(MWContext * pContext, LO_ImageStruct *image_data,
LM_ImageEvent event);
/*
* Send an interrupt event to the current context
* Remove all pending events for the event queue of the given context.
*/
extern void
ET_InterruptContext(MWContext * pContext);
extern JSBool
ET_ContinueProcessing(MWContext * pContext);
/*
* Tell mocha to destroy the given context's data. The callback
* function gets called when mocha is done with all of its data
* that was associated with the context
*/
extern void
ET_RemoveWindowContext(MWContext * context, ETVoidPtrFunc fn,
void * data);
typedef struct {
uint len, line_no;
char * scope_to;
void * data;
JSVersion version;
JSPrincipals * principals;
JSBool want_result;
JSBool unicode;
} ETEvalStuff;
/*
* Evaluate the mocha code in the given buffer
*/
extern void
ET_EvaluateBuffer(MWContext * context, char * buffer, uint buflen,
uint line_no, char * scope_to, JSBool want_result,
ETEvalAckFunc fn, void * data,
JSVersion ver, struct JSPrincipals *);
extern void
ET_EvaluateScript(MWContext * context, char * buffer, ETEvalStuff * stuff,
ETEvalAckFunc fn);
/*
* Ask Mocha to reflect the given object into JavaScript
*/
extern void
ET_ReflectObject(MWContext * pContext, void * lo_ele, void * tag,
int32 layer_id, uint index, ReflectedObject type);
void
ET_ReflectFormElement(MWContext * pContext, void * form,
LO_FormElementStruct * form_element, PA_Tag * tag);
extern void
ET_ReflectWindow(MWContext * pContext,
PA_Block onLoad, PA_Block onUnload,
PA_Block onFocus, PA_Block onBlur, PA_Block onHelp,
PA_Block onMouseOver, PA_Block onMouseOut, PA_Block onDragDrop,
PA_Block onMove, PA_Block onResize,
PA_Block id, char *all,
Bool bDelete, int newline_count);
/*
* Tell mocha we are processing a form
*/
extern void
ET_SetActiveForm(MWContext * pContext, struct lo_FormData_struct * loElement);
/*
* Tell mocha which layer we are processing
*/
void
ET_SetActiveLayer(MWContext * pContext, int32 layer_id);
/*
** Tell mocha where to send its output
*/
extern void
ET_ClearDecoderStream(MWContext * context, NET_StreamClass * old_stream);
extern void
ET_SetDecoderStream(MWContext * context, NET_StreamClass *stream,
URL_Struct *url_struct, JSBool free_stream_on_close);
/*
** Remember the current nesting URL in the MochaDecoder
*/
extern void
ET_SetNestingUrl(MWContext * context, char * szUrl);
/*
** Remember the current language version in the MochaDecoder
*/
extern void
ET_SetVersion(MWContext * context, JSVersion version);
/*
* Tell mocha to trash the current document. around and around...
*/
extern void
ET_ReleaseDocument(MWContext * pContext, JSBool resize_reload);
/*
* Tell mocha to trash the layer's document.
*/
extern void
ET_DestroyLayer(MWContext * pContext, JSObject *layer_obj);
extern void
ET_MochaStreamComplete(MWContext * context, void * buf, int len,
char * content_type, Bool isUnicode);
extern void
ET_MochaStreamAbort(MWContext * context, int status);
/*
* Called when a layer's contents are changing and we want to create
* a new layer document.
*/
extern void
ET_NewLayerDocument(MWContext *pContext, int32 layer_id);
extern void
ET_DocWriteAck(MWContext *pContext, int status);
extern void
ET_RegisterComponent(char *name, void *active_callback, void *startup_callback);
extern void
ET_RegisterComponentProp(char *comp, char *name, uint8 retType, void *setter,
void *getter);
extern void
ET_RegisterComponentMethod(char *comp, char *name, uint8 retType, void *method,
int32 argc);
/* =============================================================== */
/*
* This event can be sent to both the mozilla thread and the moacha thread
*/
typedef struct {
ETEvent ce;
TimeoutCallbackFunction fnCallback;
void* pClosure;
uint32 ulTime;
void* pTimerId;
} MozillaEvent_Timeout;
/* =============================================================== */
/*
* Busy loop waiting for events to come along
*/
extern void PR_CALLBACK
lm_wait_for_events(void *);
/*
* global mocha event queues. It would be nice to not have these
* exported this globally
*/
extern PREventQueue *lm_InterpretQueue;
extern PREventQueue *lm_PriorityQueue;
/*
* Ways to send events to the front end
*/
extern JSBool
ET_PostMessageBox(MWContext* context, char* szMessage,
JSBool bConfirm);
extern void
ET_PostProgress(MWContext* context, const char* szMessage);
/* --- timeout routines --- */
/*
* Set (or clear) a timeout to go off. The timeout will go off in the
* mozilla thread so we will use the routine ET_FireTimeoutCallBack()
* to get back into our thread to actually run the closure
*/
extern void *
ET_PostSetTimeout(TimeoutCallbackFunction fnCallback,
void * pClosure, uint32 ulTime, int32 doc_id);
extern void
ET_PostClearTimeout(void * stuff);
extern void
ET_FireTimeoutCallBack(void *);
/* --- end of timeout routines --- */
extern void
ET_PostDestroyWindow(MWContext * context);
extern void
ET_PostManipulateForm(MWContext * context, LO_Element * pForm, int32 action);
extern void
ET_PostClearView(MWContext * context);
extern void
ET_PostFreeImageElement(MWContext * context, void * stuff);
extern void
ET_PostFreeImageContext(MWContext *context, IL_GroupContext *img_cx);
extern void
ET_PostFreeAnonImages(MWContext *context, IL_GroupContext *img_cx);
extern void
ET_PostDisplayImage(MWContext *, int, LO_ImageStruct *);
extern void
ET_PostGetUrl(MWContext *, URL_Struct * pUrl);
extern char *
ET_PostPrompt(MWContext* context, const char* szMessage,
const char * szDefault);
extern MWContext *
ET_PostNewWindow(MWContext* context, URL_Struct * pUrl,
char * szName, Chrome * pChrome);
extern void
ET_PostUpdateChrome(MWContext* context, Chrome * pChrome);
extern void
ET_PostQueryChrome(MWContext* context, Chrome * pChrome);
extern void
ET_PostGetScreenSize(MWContext* context, int32 *pX, int32 *pY);
extern void
ET_PostGetAvailScreenRect(MWContext* context, int32 *pX, int32 *pY,
int32 *pLeft, int32 *pTop);
extern void
ET_PostGetColorDepth(MWContext* context, int32 *pPixel, int32 *pPallette);
extern char *
ET_PostGetSelectedText(MWContext* context);
extern void
ET_PostScrollDocTo(MWContext* context, int loc, int32 x, int32 y);
extern void
ET_PostScrollDocBy(MWContext* context, int loc, int32 x, int32 y);
extern void
ET_PostBackCommand(MWContext* context);
extern void
ET_PostForwardCommand(MWContext* context);
extern void
ET_PostHomeCommand(MWContext* context);
extern JSBool
ET_PostFindCommand(MWContext* context, char * szName, JSBool matchCase,
JSBool searchBackward);
extern void
ET_PostPrintCommand(MWContext* context);
extern void
ET_PostOpenFileCommand(MWContext* context);
extern void
ET_MakeHTMLAlert(MWContext * context, const char * szString);
/* respond to events sent to the mocha thread by the mozilla thread */
extern void
ET_PostJsEventAck(MWContext* context, LO_Element * pEle, int type,
ETClosureFunc fnClosure, void * pStuff,
ETEventStatus status);
extern void
ET_PostEvalAck(MWContext * context, int doc_id, void * data,
char * str, size_t len, char * wysiwyg_url,
char * base_href, Bool valid, ETEvalAckFunc fn);
extern void
ET_PostRestoreAck(void *data, LO_BlockInitializeStruct *param,
ETRestoreAckFunc fn);
/* netlib events */
extern char *
ET_net_GetCookie(MWContext* context, int32 doc_id);
extern char *
ET_net_SetCookieString(MWContext* context, char * szCookie, int32 doc_id);
extern NET_StreamClass *
ET_net_CacheConverter(FO_Present_Types format, void * obj,
URL_Struct *pUrl, MWContext * pContext);
extern void
ET_net_FindURLInCache(URL_Struct * pUrl, MWContext * pContext);
extern NET_StreamClass *
ET_net_StreamBuilder(FO_Present_Types format, URL_Struct *pUrl,
MWContext * pContext);
/* layout events */
extern void
ET_lo_ResetForm(MWContext * pContext, LO_Element * ele);
void
ET_fe_SubmitInputElement(MWContext * pContext, LO_Element * ele);
/*
* Synchronously shove the given text down the parser's processing
* queue. If the currently loaded document is not equal to
* doc_id, this message should be ignored since it arrived too
* late for the intended document
*/
extern int
ET_lo_DoDocWrite(JSContext *cx, MWContext * context, NET_StreamClass * stream,
char * str, size_t len, int32 doc_id);
extern void
ET_il_GetImage(const char * str, MWContext * pContext, IL_GroupContext *img_cx,
LO_ImageStruct * image_data, NET_ReloadMethod how);
extern void
ET_il_SetGroupObserver(MWContext * pContext, IL_GroupContext *pImgCX, void *pDpyCX,
JSBool bAddObserver);
extern void
ET_InterruptImgCX(MWContext * pContext);
/*
* Tell layout to trash the current document.
*/
extern void
ET_lo_DiscardDocument(MWContext * pContext);
/*
* Tell layout to prepare a layer for writing.
*/
extern Bool
ET_lo_PrepareLayerForWriting(MWContext *context, int32 layer_id,
const char *referer);
/*
* Return a copy of the current history element. Caller must free
*/
extern History_entry *
ET_shist_GetCurrent(MWContext * pContext);
/*
* Return the current security status.
*/
extern int
ET_GetSecurityStatus(MWContext * pContext);
/*
* Make sure Mocha/Java glue is ready. Returns the same return code as
* LM_InitMoja.
*/
extern int
ET_InitMoja(MWContext * pContext);
/*
* Pack up toys and go home
*/
extern void
ET_FinishMocha(void);
/*
* Used to call a stream completion function in the mozilla
* thread
*/
extern void
ET_moz_CallFunction(ETVoidPtrFunc fn, void * data);
extern void
ET_moz_CallFunctionAsync(ETVoidPtrFunc fn, void * data);
extern PRBool
ET_moz_CallFunctionBool(ETBoolPtrFunc fn, void * data);
extern int32
ET_moz_CallFunctionInt(ETIntPtrFunc fn, void * data);
extern char *
ET_moz_CallFunctionString(ETStringPtrFunc fn, void * data);
extern void
ET_moz_CallAsyncAndSubEventLoop(ETVoidPtrFunc fn, void *data,
MWContext *context);
extern void
ET_moz_Abort(MKStreamAbortFunc fn, void * data, int status);
extern void
ET_moz_SetMochaWriteStream(MochaDecoder * decoder);
extern NET_StreamClass *
ET_moz_DocCacheConverter(MWContext * context, URL_Struct * pUrl,
char * wysiwyg_url, int32 layer_id);
extern PRBool
ET_moz_VerifyComponentFunction(ETVerifyComponentFunc fn, ETBoolPtrFunc *pActive_callback,
ETVoidPtrFunc *pStartup_callback);
extern void
ET_moz_CompSetterFunction(ETCompPropSetterFunc fn, char *name, void *data);
extern void *
ET_moz_CompGetterFunction(ETCompPropGetterFunc fn, char *name);
extern void *
ET_moz_CompMethodFunction(ETCompMethodFunc fn, int32 argc, JSCompArg *argv);
typedef enum {
CL_Move,
CL_MoveX,
CL_MoveY,
CL_Offset,
CL_Resize,
CL_SetBboxWidth,
CL_SetBboxHeight,
CL_SetBboxTop,
CL_SetBboxLeft,
CL_SetBboxBottom,
CL_SetBboxRight,
CL_SetHidden,
CL_MoveInZ,
CL_SetSrc,
CL_SetSrcWidth,
CL_SetZ,
CL_SetBgColor,
CL_SetBackdrop
} ETLayerOp;
extern int
ET_TweakLayer(MWContext * context, CL_Layer * layer, int32 x, int32 y,
void *param_ptr, int32 param_val, ETLayerOp op,
const char *referer, int32 doc_id);
extern void
ET_RestoreLayerState(MWContext *context, int32 layer_id,
LO_BlockInitializeStruct *param, ETRestoreAckFunc fn,
void *data);
extern int32
ET_npl_RefreshPluginList(MWContext* context, XP_Bool refreshInstances);
extern JSBool
ET_HandlePref(JSContext * cx, uint argc, jsval * argv, jsval * rval);
extern void
ET_SetPluginWindow(MWContext * pContext, void * app);
NSPR_END_EXTERN_C
#endif /* libevent_h___ */

2651
mozilla/include/libi18n.h Normal file

File diff suppressed because it is too large Load Diff

538
mozilla/include/libmime.h Normal file
View File

@@ -0,0 +1,538 @@
/* -*- 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.
*/
/* libmime.h --- external interface to libmime.a
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
*/
#ifndef _LIBMIME_H_
#define _LIBMIME_H_
#include "xp.h"
#ifndef MOZILLA_30
# define MIME_DRAFTS
#endif
/* Opaque object describing a block of message headers, and a couple of
routines for extracting data from one.
*/
typedef struct MimeHeaders
{
char *all_headers; /* A char* of the entire header section. */
int32 all_headers_fp; /* The length (it is not NULL-terminated.) */
int32 all_headers_size; /* The size of the allocated block. */
XP_Bool done_p; /* Whether we've read the end-of-headers marker
(the terminating blank line.) */
char **heads; /* An array of length n_headers which points
to the beginning of each distinct header:
just after the newline which terminated
the previous one. This is to speed search.
This is not initialized until all the
headers have been read.
*/
int32 heads_size; /* The length (and consequently, how many
distinct headers are in here.) */
char *obuffer; /* This buffer is used for output. */
int32 obuffer_size;
int32 obuffer_fp;
char *munged_subject; /* What a hack. This is a place to write down
the subject header, after it's been
charset-ified and stuff. Remembered so that
we can later use it to generate the
<TITLE> tag. */
} MimeHeaders;
typedef struct MimeDisplayOptions MimeDisplayOptions;
typedef struct MimeParseStateObject MimeParseStateObject;
#ifndef MOZILLA_30
typedef struct MSG_AttachmentData MSG_AttachmentData;
#endif
XP_BEGIN_PROTOS
/* Given the name of a header, returns the contents of that header as
a newly-allocated string (which the caller must free.) If the header
is not present, or has no contents, NULL is returned.
If `strip_p' is TRUE, then the data returned will be the first token
of the header; else it will be the full text of the header. (This is
useful for getting just "text/plain" from "text/plain; name=foo".)
If `all_p' is FALSE, then the first header encountered is used, and
any subsequent headers of the same name are ignored. If TRUE, then
all headers of the same name are appended together (this is useful
for gathering up all CC headers into one, for example.)
*/
extern char *MimeHeaders_get(MimeHeaders *hdrs,
const char *header_name,
XP_Bool strip_p,
XP_Bool all_p);
/* Given a header of the form of the MIME "Content-" headers, extracts a
named parameter from it, if it exists. For example,
MimeHeaders_get_parameter("text/plain; charset=us-ascii", "charset")
would return "us-ascii".
Returns NULL if there is no match, or if there is an allocation failure.
*/
extern char *MimeHeaders_get_parameter (const char *header_value,
const char *parm_name);
extern MimeHeaders *MimeHeaders_copy (MimeHeaders *srcHeaders);
extern void MimeHeaders_free (MimeHeaders *hdrs);
/* Some defines for various standard header field names.
*/
#define HEADER_BCC "BCC"
#define HEADER_CC "CC"
#define HEADER_CONTENT_BASE "Content-Base"
#define HEADER_CONTENT_DESCRIPTION "Content-Description"
#define HEADER_CONTENT_DISPOSITION "Content-Disposition"
#define HEADER_CONTENT_ENCODING "Content-Encoding"
#define HEADER_CONTENT_LENGTH "Content-Length"
#define HEADER_CONTENT_NAME "Content-Name"
#define HEADER_CONTENT_TRANSFER_ENCODING "Content-Transfer-Encoding"
#define HEADER_CONTENT_TYPE "Content-Type"
#define HEADER_DATE "Date"
#define HEADER_DISTRIBUTION "Distribution"
#define HEADER_FCC "FCC"
#define HEADER_FOLLOWUP_TO "Followup-To"
#define HEADER_FROM "From"
#define HEADER_LINES "Lines"
#define HEADER_MESSAGE_ID "Message-ID"
#define HEADER_MIME_VERSION "MIME-Version"
#define HEADER_NEWSGROUPS "Newsgroups"
#define HEADER_ORGANIZATION "Organization"
#define HEADER_REFERENCES "References"
#define HEADER_REPLY_TO "Reply-To"
#define HEADER_RESENT_COMMENTS "Resent-Comments"
#define HEADER_RESENT_DATE "Resent-Date"
#define HEADER_RESENT_FROM "Resent-From"
#define HEADER_RESENT_MESSAGE_ID "Resent-Message-ID"
#define HEADER_RESENT_SENDER "Resent-Sender"
#define HEADER_RESENT_TO "Resent-To"
#define HEADER_RESENT_CC "Resent-CC"
#define HEADER_SENDER "Sender"
#define HEADER_SUBJECT "Subject"
#define HEADER_TO "To"
#define HEADER_X_MAILER "X-Mailer"
#define HEADER_X_NEWSREADER "X-Newsreader"
#define HEADER_X_POSTING_SOFTWARE "X-Posting-Software"
#define HEADER_X_MOZILLA_STATUS "X-Mozilla-Status"
#define HEADER_X_MOZILLA_NEWSHOST "X-Mozilla-News-Host"
#define HEADER_X_MOZILLA_DRAFT_INFO "X-Mozilla-Draft-Info"
#define HEADER_X_UIDL "X-UIDL"
#define HEADER_XREF "XREF"
#define HEADER_X_SUN_CHARSET "X-Sun-Charset"
#define HEADER_X_SUN_CONTENT_LENGTH "X-Sun-Content-Length"
#define HEADER_X_SUN_CONTENT_LINES "X-Sun-Content-Lines"
#define HEADER_X_SUN_DATA_DESCRIPTION "X-Sun-Data-Description"
#define HEADER_X_SUN_DATA_NAME "X-Sun-Data-Name"
#define HEADER_X_SUN_DATA_TYPE "X-Sun-Data-Type"
#define HEADER_X_SUN_ENCODING_INFO "X-Sun-Encoding-Info"
#define HEADER_X_PRIORITY "X-Priority"
#define HEADER_PARM_BOUNDARY "BOUNDARY"
#define HEADER_PARM_FILENAME "FILENAME"
#define HEADER_PARM_NAME "NAME"
#define HEADER_PARM_TYPE "TYPE"
typedef enum {
MimeHeadersAll, /* Show all headers */
MimeHeadersSome, /* Show all "interesting" headers */
MimeHeadersSomeNoRef, /* Same, but suppress the `References' header
(for when we're printing this message.) */
MimeHeadersMicro, /* Show a one-line header summary */
MimeHeadersMicroPlus, /* Same, but show the full recipient list as
well (To, CC, etc.) */
MimeHeadersCitation /* A one-line summary geared toward use in a
reply citation ("So-and-so wrote:") */
} MimeHeadersState;
/* The signature for various callbacks in the MimeDisplayOptions structure.
*/
typedef char *(*MimeHTMLGeneratorFunction) (const char *data, void *closure,
MimeHeaders *headers);
struct MimeDisplayOptions
{
const char *url; /* Base URL for the document. This string should
be freed by the caller, after the parser
completes (possibly at the same time as the
MimeDisplayOptions itself.) */
#ifndef MOZILLA_30
MSG_Pane* pane; /* The libmsg pane object that corresponds to
what we're showing. This is used by very
little... */
#endif /* !MOZILLA_30 */
MimeHeadersState headers; /* How headers should be displayed. */
XP_Bool fancy_headers_p; /* Whether to do clever formatting of headers
using tables, instead of spaces. */
#ifndef MOZILLA_30
XP_Bool output_vcard_buttons_p; /* Whether to output the buttons */
/* on vcards. */
#endif /* !MOZILLA_30 */
XP_Bool fancy_links_p; /* Whether to insert fancy links, so you can
do things like click on an email address to
add it to your address book. Something you
don't want to do while printing. */
XP_Bool variable_width_plaintext_p; /* Whether text/plain messages should
be in variable width, or fixed. */
XP_Bool wrap_long_lines_p; /* Whether to wrap long lines in text/plain
messages. */
XP_Bool rot13_p; /* Whether text/plain parts should be rotated
Set by "?rot13=true" */
XP_Bool no_inline_p; /* Whether inline display of attachments should
be suppressed. Set by "?inline=false" */
char *part_to_load; /* The particular part of the multipart which
we are extracting. Set by "?part=3.2.4" */
XP_Bool write_html_p; /* Whether the output should be HTML, or raw. */
XP_Bool decrypt_p; /* Whether all traces of encryption should be
eradicated -- this is only meaningful when
write_html_p is FALSE; we set this when
attaching a message for forwarding, since
forwarding someone else a message that wasn't
encrypted for them doesn't work. We have to
decrypt it before sending it.
*/
#ifndef MOZILLA_30
XP_Bool nice_html_only_p; /* If TRUE, then we only should write html if
it's pretty HTML (stuff that we're willing
to get shipped out in mail messages). If we
can't generate nice stuff for some part,
then don't say anything at all. */
XP_Bool dont_touch_citations_p; /* If TRUE, then we should leave citations
alone in plaintext parts. If FALSE, then
go ahead and tweak the fonts according
to preferences. */
#endif /* !MOZILLA_30 */
char *default_charset; /* If this is non-NULL, then it is the charset to
assume when no other one is specified via a
`charset' parameter.
*/
char *override_charset; /* If this is non-NULL, then we will assume that
all data is in this charset, regardless of what
the `charset' parameter of that part says.
This overrides `default_charset' as well.
(This is to cope with the fact that, in the
real world, many messages are mislabelled with
the wrong charset.)
*/
/* =======================================================================
Stream-related callbacks; for these functions, the `closure' argument
is what is found in `options->stream_closure'. (One possible exception
is for output_fn; see "output_closure" below.)
*/
void *stream_closure;
/* For setting up the display stream, so that the MIME parser can inform
the caller of the type of the data it will be getting. */
int (*output_init_fn) (const char *type,
const char *charset,
const char *name,
const char *x_mac_type,
const char *x_mac_creator,
void *stream_closure);
/* How the MIME parser feeds its output (HTML or raw) back to the caller. */
int (*output_fn) (char *buf, int32 size, void *closure);
/* Closure to pass to the above output_fn. If NULL, then the
stream_closure is used. */
void *output_closure;
/* A callback used to encapsulate an HTML section and to reset the
HTML parser to its default state at the end of a section.
start_p indicates whether this is being called just before the
start or immediately after the end of the encapsulated HTML.
layer_encapsulate_p indicates whether or not to put special
ILAYER container tags around the HTML -- Also, when start_p is
FALSE, this function should close off any tags we've left open,
reset the font size and face, etc. This may be called multiple
times -- in particular, it will be called at the end of each
message part which might contain human-generated (and thus
arbitrarily buggy) markup. The `abort_p' argument specifies
whether it's ok for data to be discarded.
*/
int (*set_html_state_fn) (void *stream_closure,
XP_Bool layer_encapsulate_p,
XP_Bool start_p,
XP_Bool abort_p);
/* A hook for the caller to perform charset-conversion before HTML is
returned. Each set of characters which originated in a mail message
(body or headers) will be run through this filter before being converted
into HTML. (This should return bytes which may appear in an HTML file,
ie, we must be able to scan through the string to search for "<" and
turn it in to "&lt;", and so on.)
`input' is a non-NULL-terminated string of a single line from the message.
`input_length' is how long it is.
`input_charset' is a string representing the charset of this string (as
specified by MIME headers.)
`output_charset' is the charset to which conversion is desired.
`output_ret' is where a newly-malloced string is returned. It may be
NULL if no translation is needed.
`output_size_ret' is how long the returned string is (it need not be
NULL-terminated.).
*/
int (*charset_conversion_fn) (const char *input_line, int32 input_length,
const char *input_charset,
const char *output_charset,
char **output_ret, int32 *output_size_ret,
void *stream_closure);
/* A hook for the caller to perform both charset-conversion and decoding of
MIME-2 header fields (using RFC-1522 encoding.) Arguments and returned
values are as for `charset_conversion_fn'.
*/
int (*rfc1522_conversion_fn) (const char *input_line, int32 input_length,
const char *input_charset,
const char *output_charset,
char **output_ret, int32 *output_size_ret,
void *stream_closure);
/* A hook for the caller to translate a time string into a prettier or more
compact or localized form. */
char *(*reformat_date_fn) (const char *old_date, void *stream_closure);
/* A hook for the caller to turn a file name into a content-type. */
char *(*file_type_fn) (const char *filename, void *stream_closure);
/* A hook for the caller to turn a content-type into descriptive text. */
char *(*type_description_fn) (const char *content_type,void *stream_closure);
/* A hook for the caller to turn a content-type into an image icon. */
char *(*type_icon_name_fn) (const char *content_type, void *stream_closure);
/* A hook by which the user may be prompted for a password by the security
library. (This is really of type `SECKEYGetPasswordKey'; see sec.h.) */
void *(*passwd_prompt_fn)(void *arg1, void *arg2);
void *passwd_prompt_fn_arg;
/* =======================================================================
Various callbacks; for all of these functions, the `closure' argument
is what is found in `html_closure'.
*/
void *html_closure;
/* For emitting some HTML before the start of the outermost message
(this is called before any HTML is written to layout.) */
MimeHTMLGeneratorFunction generate_header_html_fn;
/* For emitting some HTML after the outermost header block, but before
the body of the first message. */
MimeHTMLGeneratorFunction generate_post_header_html_fn;
/* For emitting some HTML at the very end (this is called after libmime
has written everything it's going to write.) */
MimeHTMLGeneratorFunction generate_footer_html_fn;
/* For turning a message ID into a loadable URL. */
MimeHTMLGeneratorFunction generate_reference_url_fn;
/* For turning a mail address into a mailto URL. */
MimeHTMLGeneratorFunction generate_mailto_url_fn;
/* For turning a newsgroup name into a news URL. */
MimeHTMLGeneratorFunction generate_news_url_fn;
/* =======================================================================
Callbacks to handle the backend-specific inlined image display
(internal-external-reconnect junk.) For `image_begin', the `closure'
argument is what is found in `stream_closure'; but for all of the
others, the `closure' argument is the data that `image_begin' returned.
*/
/* Begins processing an embedded image; the URL and content_type are of the
image itself. */
void *(*image_begin) (const char *image_url, const char *content_type,
void *stream_closure);
/* Stop processing an image. */
void (*image_end) (void *image_closure, int status);
/* Dump some raw image data down the stream. */
int (*image_write_buffer) (char *buf, int32 size, void *image_closure);
/* What HTML should be dumped out for this image. */
char *(*make_image_html) (void *image_closure);
/* =======================================================================
Other random opaque state.
*/
MimeParseStateObject *state; /* Some state used by libmime internals;
initialize this to 0 and leave it alone.
*/
#ifdef MIME_DRAFTS
/* =======================================================================
Mail Draft hooks -- 09-19-1996
*/
XP_Bool decompose_file_p; /* are we decomposing a mime msg
into separate files */
XP_Bool done_parsing_outer_headers; /* are we done parsing the outer message
headers; this is really useful when
we have multiple Message/RFC822
headers */
XP_Bool is_multipart_msg; /* are we decomposing a multipart
message */
int decompose_init_count; /* used for non multipart message only
*/
XP_Bool signed_p; /* to tell draft this is a signed
message */
/* Callback to gather the outer most headers so we could use the
information to initialize the addressing/subject/newsgroups fields
for the composition window. */
int (*decompose_headers_info_fn) (void *closure,
MimeHeaders *headers);
/* Callbacks to create temporary files for drafts attachments. */
int (*decompose_file_init_fn) (void *stream_closure,
MimeHeaders *headers );
int (*decompose_file_output_fn) (char *buf, int32 size,
void *stream_closure);
int (*decompose_file_close_fn) (void *stream_closure);
#endif /* MIME_DRAFTS */
int32 attachment_icon_layer_id; /* Hackhackhack. This is zero if we have
not yet emitted the attachment layer
stuff. If we have, then this is the
id number for that layer, which is a
unique random number every time, to keep
evil people from writing javascript code
to hack it. */
};
/* Mozilla-specific interfaces
*/
/* Given a URL, this might return a better suggested name to save it as.
When you have a URL, you can sometimes get a suggested name from
URL_s->content_name, but if you're saving a URL to disk before the
URL_Struct has been filled in by netlib, you don't have that yet.
So if you're about to prompt for a file name *before* you call FE_GetURL
with a format_out of FO_SAVE_AS, call this function first to see if it
can offer you advice about what the suggested name for that URL should be.
(This works by looking in a cache of recently-displayed MIME objects, and
seeing if this URL matches. If it does, the remembered content-name will
be used.)
*/
extern char *MimeGuessURLContentName(MWContext *context, const char *url);
/* Given a URL, return the content type for the mime part, if the passed context
recently parsed a message containing the part specified by the URL.
This is used to figure out if we need to open the url in a browser window,
or if we're just going to do a save as, anyay.
*/
extern char *MimeGetURLContentType(MWContext *context, const char *url);
/* Determines whether the given context is currently showing a text/html
message. (Used by libmsg to determine if replys should bring up the
text/html editor. */
extern XP_Bool MimeShowingTextHtml(MWContext* context);
/* Yeech, hack... Determine the URL to use to save just the HTML part of the
currently-displayed message to disk. If the current message doesn't have
a text/html part, returns NULL. Otherwise, the caller must free the
returned string using XP_FREE(). */
extern char* MimeGetHtmlPartURL(MWContext* context);
/* Return how many attachments are in the currently-displayed message. */
extern int MimeGetAttachmentCount(MWContext* context);
/* Returns what attachments are being viewed in the currently-displayed
message. The returned data must be free'd using
MimeFreeAttachmentList(). */
extern int MimeGetAttachmentList(MWContext* context,
MSG_AttachmentData** data);
extern void MimeFreeAttachmentList(MSG_AttachmentData* data);
/* Call this when destroying a context; this frees up some memory.
*/
extern void MimeDestroyContextData(MWContext *context);
/* After a message has been fully displayed (the document has finished
loading) FEs call this with a Mail or News window to determine how
the "security" toolbar button should be rendered.
The first two values are whether it was an encrypted and/or signed
message; the second two are whether it was *valid*.
*/
extern void MIME_GetMessageCryptoState(MWContext *context,
XP_Bool *signed_return,
XP_Bool *encrypted_return,
XP_Bool *signed_ok_return,
XP_Bool *encrypted_ok_return);
#ifndef MOZILLA_30
/* Used only by libnet, this indicates that the user bonked on the "show me
details about attachments" button. */
extern int MIME_DisplayAttachmentPane(MWContext* context);
#endif /* MOZILLA_30 */
XP_END_PROTOS
#endif /* _LIBMIME_H_ */

543
mozilla/include/libmocha.h Normal file
View File

@@ -0,0 +1,543 @@
/* -*- 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.
*/
/*
* Header file for Mocha in the Navigator (libmocha).
*/
#ifndef libmocha_h___
#define libmocha_h___
#include "ntypes.h"
#include "il_types.h"
#include "prtypes.h"
#include "plhash.h"
#include "prthread.h"
#include "jsapi.h"
/* enable JavaScript Debugger support */
#if defined (_WIN32) || defined(XP_UNIX) || defined(powerc) || defined(__powerc) || defined(XP_OS2)
#ifdef JAVA
#define JSDEBUGGER 1
#endif
#endif
NSPR_BEGIN_EXTERN_C
typedef struct JSTimeout JSTimeout;
typedef struct JSPrincipalsList JSPrincipalsList;
typedef struct JSNestingUrl JSNestingUrl;
/*
* There exists one MochaDecoder per top-level MWContext that decodes Mocha,
* either from an HTML page or from a "mocha:[expr]" URL.
*/
typedef struct MochaDecoder {
int32 forw_count; /* forward reference count */
int32 back_count; /* back (up the tree) count */
JSContext *js_context;
MWContext *window_context;
JSObject *window_object;
NET_StreamClass *stream;
int32 stream_owner; /* id of layer that's loading the stream */
URL_Struct *url_struct;
JSTimeout *timeouts;
JSTimeout *saved_timeouts;
uint16 signature_ordinal;
PRPackedBool replace_location;
PRPackedBool resize_reload;
PRPackedBool load_event_sent;
PRPackedBool visited;
PRPackedBool writing_input;
PRPackedBool free_stream_on_close;
PRPackedBool in_window_quota;
PRPackedBool called_win_close;
PRPackedBool principals_compromised;
const char *source_url;
JSNestingUrl *nesting_url;
uint32 error_count;
uint32 event_mask;
int32 active_layer_id;
uint32 active_form_id;
uint32 event_bit;
int32 doc_id;
/*
* Class prototype objects, in alphabetical order. Must be CLEARed (set
* to null) in LM_PutMochaDecoder, HELD (GC roots added) in lm_NewWindow,
* and DROPped (removed as GC roots) in lm_DestroyWindow.
* XXXbe clean up, clear via bzero, using a sub-structure.
*/
JSObject *anchor_prototype;
JSObject *bar_prototype;
JSObject *document_prototype;
JSObject *event_prototype;
JSObject *event_capturer_prototype;
JSObject *event_receiver_prototype;
JSObject *form_prototype;
JSObject *image_prototype;
JSObject *input_prototype;
JSObject *layer_prototype;
JSObject *option_prototype;
JSObject *rect_prototype;
JSObject *url_prototype;
/*
* Window sub-objects. These must also follow the CLEAR/HOLD/DROP
* protocol mentioned above.
*/
JSObject *document;
JSObject *history;
JSObject *location;
JSObject *navigator;
JSObject *components;
JSObject *screen;
JSObject *hardware;
JSObject *crypto;
JSObject *pkcs11;
/*
* Ad-hoc GC roots.
*/
JSObject *event_receiver;
JSObject *opener;
JSVersion firstVersion; /* First JS script tag version. */
/*
* Security info for all of this decoder's scripts, except those
* contained in layers.
*/
JSPrincipals *principals;
JSPrincipalsList*early_access_list;
IL_GroupContext *image_context; /* Image context for anonymous images */
/*
* Table that maintains an id to JS object mapping for reflected
* elements. This is used during resize to reestablish the connection
* between layout elements and their corresponding JS object.
* Form elements are special, since they can't use the same keying
*/
PRHashTable *id_to_object_map;
} MochaDecoder;
/*
* Number of buckets for the id-to-object hash table.
*/
#define LM_ID_TO_OBJ_MAP_SIZE 20
#define LM_FORM_ELEMENT_MAP_SIZE 10
/*
* Types of objects reflected into Mocha
*/
typedef enum {
LM_APPLETS = 0,
LM_FORMS,
LM_LINKS,
LM_NAMEDANCHORS,
LM_EMBEDS,
LM_IMAGES,
LM_FORMELEMENTS,
LM_LAYERS
} ReflectedObject;
/*
* Generates an id-to-object mapping key from the ReflectedObject
* type, the containing layer id and the id of the object itself.
* The key is 4 bits type, 14 bits layer_id and 14 bits id.
*/
#define LM_GET_MAPPING_KEY(obj_type, layer_id, id) \
(void *)(((((uint32)obj_type) << 28) & 0xF0000000UL) | \
((((uint32)layer_id) << 14) & 0x0FFFC000UL) | \
(((uint32)id) & 0x00003FFFUL))
/*
* Public, well-known string constants.
*/
extern char js_language_name[]; /* "JavaScript" */
extern char js_content_type[]; /* "application/x-javascript" */
/*
* Initialize and finalize Mocha-in-the-client.
*/
extern void LM_InitMocha(void);
extern void LM_FinishMocha(void);
/*
* Force mocha on in the given context, even if the user pref is set to
* disable mocha.
*/
extern void LM_ForceJSEnabled(MWContext *cx);
/*
* Initialize and finalize Mocha-Java connection
*/
#define LM_MOJA_UNINITIALIZED 0
#define LM_MOJA_OK 1
#define LM_MOJA_JAVA_FAILED 2
#define LM_MOJA_OUT_OF_MEMORY 3
extern int LM_InitMoja(void);
extern void LM_FinishMoja(void);
extern int LM_IsMojaInitialized(void);
/*
* Enter or leave the big mocha lock. Any thread which wants to
* preserve JavaScript run-to-completion semantics must bracket
* JavaScript evaluation with these calls.
*/
typedef void
(PR_CALLBACK *JSLockReleaseFunc)(void * data);
extern void PR_CALLBACK LM_LockJS(void);
extern void PR_CALLBACK LM_UnlockJS(void);
extern JSBool PR_CALLBACK LM_AttemptLockJS(JSLockReleaseFunc fn, void * data);
extern JSBool PR_CALLBACK LM_ClearAttemptLockJS(JSLockReleaseFunc fn, void * data);
extern PRBool PR_CALLBACK
LM_HandOffJSLock(PRThread * oldOwner, PRThread *newOwner);
/*
* For interruption purposes we will sometimes need to know the
* context who is holding the JS lock
*/
extern void LM_JSLockSetContext(MWContext * context);
extern MWContext * LM_JSLockGetContext(void);
/*
* Enable/disable for Mocha-in-the-client.
*/
#define LM_SwitchMocha(toggle) LM_SetMochaEnabled(toggle)
extern JSBool
LM_GetMochaEnabled(void);
/*
* Get (create if necessary) a MochaDecoder for context, adding a reference
* to its window_object. Put drops the reference, destroying window_object
* when the count reaches zero. These functions should only be called in
* the mocha thread or while holding the JS-lock
*/
extern MochaDecoder *
LM_GetMochaDecoder(MWContext *context);
extern void
LM_PutMochaDecoder(MochaDecoder *decoder);
/*
* Get the source URL for script being loaded by document. This URL will be
* the document's URL for inline script, or the SRC= URL for included script.
* The returned pointer is safe only within the extent of the function that
* calls LM_GetSourceURL().
*/
extern const char *
LM_GetSourceURL(MochaDecoder *decoder);
/*
* Set the current layer and hence the current scope for script evaluation.
*/
extern void
LM_SetActiveLayer(MWContext * context, int32 layer_id);
/*
* Get the current layer and hence the current scope for script evaluation.
*/
extern int32
LM_GetActiveLayer(MWContext * context);
/*
* Evaluate the contents of a SCRIPT tag. You can specify the JSObject
* to use as the base scope. Pass NULL to use the default window_object
*/
extern JSBool
LM_EvaluateBuffer(MochaDecoder *decoder, void *base, size_t length,
uint lineno, char * scope_to, struct JSPrincipals *principals,
JSBool unicode, jsval *result);
/*
* Evaluate an expression entity in an HTML attribute (WIDTH="&{height/2};").
* Returns null on error, otherwise a pointer to the malloc'd string result.
* The caller is responsible for freeing the string result.
*/
extern char *
LM_EvaluateAttribute(MWContext *context, char *expr, uint lineno);
/*
* Remove any MochaDecoder window_context pointer to an MWContext that's
* being destroyed.
*/
extern void
LM_RemoveWindowContext(MWContext *context, History_entry * he);
extern void
LM_DropSavedWindow(MWContext *context, void *window);
/*
* Set and clear the HTML stream and URL for the MochaDecoder
* associated with the given context
*/
extern JSBool
LM_SetDecoderStream(MWContext * context, NET_StreamClass *stream,
URL_Struct *url_struct, JSBool free_stream_on_close);
/*
* Start caching HTML or plain text generated by document.write() where the
* script is running on mc, the document is being generated into decoder's
* window, and url_struct tells about the generator.
*/
extern NET_StreamClass *
LM_WysiwygCacheConverter(MWContext *context, URL_Struct *url_struct,
const char * wysiwyg_url, const char * base_href);
/*
* Skip over the "wysiwyg://docid/" in url_string and return a pointer to the
* real URL hidden after the prefix. If url_string is not of "wysiwyg:" type,
* just return url_string. Never returns null.
*/
extern const char *
LM_StripWysiwygURLPrefix(const char *url_string);
/*
* This function works only on "wysiwyg:" type URLs -- don't call it unless
* you know that NET_URL_Type(url_string) is WYSIWYG_TYPE_URL. It'll return
* null if url_string seems too short, or if it can't find the third slash.
*/
extern const char *
LM_SkipWysiwygURLPrefix(const char *url_string);
/*
* Return a pointer to a malloc'd string of the form "<BASE HREF=...>" where
* the "..." URL is the directory of cx's origin URL. Such a base URL is the
* default base for relative URLs in generated HTML.
*/
extern char *
LM_GetBaseHrefTag(JSContext *cx, JSPrincipals *principals);
/*
* XXX Make these public LO_... typedefs in lo_ele.h/ntypes.h?
*/
struct lo_FormData_struct;
struct lo_NameList_struct;
extern struct lo_FormData_struct *
LO_GetFormDataByID(MWContext *context, int32 layer_id, intn form_id);
extern uint
LO_EnumerateForms(MWContext *context, int32 layer_id);
extern struct LO_ImageStruct_struct *
LO_GetImageByIndex(MWContext *context, int32 layer_id, intn image_id);
extern uint
LO_EnumerateImages(MWContext *context, int32 layer_id);
/*
* Reflect display layers into Mocha.
*/
extern JSObject *
LM_ReflectLayer(MWContext *context, int32 layer_id, int32 parent_layer_id,
PA_Tag *tag);
extern LO_FormElementStruct *
LO_GetFormElementByIndex(struct lo_FormData_struct *form_data, int32 index);
extern uint
LO_EnumerateFormElements(MWContext *context,
struct lo_FormData_struct *form_data);
/*
* Layout helper function to find a named anchor by its index in the
* document.anchors[] array.
*/
extern struct lo_NameList_struct *
LO_GetNamedAnchorByIndex(MWContext *context, int32 layer_id, uint index);
extern uint
LO_EnumerateNamedAnchors(MWContext *context, int32 layer_id);
/*
* Layout Mocha helper function to find an HREF Anchor by its index in the
* document.links[] array.
*/
extern LO_AnchorData *
LO_GetLinkByIndex(MWContext *context, int32 layer_id, uint index);
extern uint
LO_EnumerateLinks(MWContext *context, int32 layer_id);
extern LO_JavaAppStruct *
LO_GetAppletByIndex(MWContext *context, int32 layer_id, uint index);
extern uint
LO_EnumerateApplets(MWContext *context, int32 layer_id);
extern LO_EmbedStruct *
LO_GetEmbedByIndex(MWContext *context, int32 layer_id, uint index);
extern uint
LO_EnumerateEmbeds(MWContext *context, int32 layer_id);
/*
* Get and set a color attribute in the current document state.
*/
extern void
LO_GetDocumentColor(MWContext *context, int type, LO_Color *color);
extern void
LO_SetDocumentColor(MWContext *context, int type, LO_Color *color);
/*
* Layout function to reallocate the lo_FormElementOptionData array pointed at
* by lo_FormElementSelectData's options member to include space for the number
* of options given by selectData->option_cnt.
*/
extern XP_Bool
LO_ResizeSelectOptions(lo_FormElementSelectData *selectData);
/*
* Discard the current document and all its subsidiary objects.
*/
extern void
LM_ReleaseDocument(MWContext *context, JSBool resize_reload);
/*
* Search if a the event is being captured in the frame hierarchy.
*/
extern XP_Bool
LM_EventCaptureCheck(MWContext *context, uint32 current_event);
/*
* Scroll a window to the given point.
*/
extern void LM_SendOnScroll(MWContext *context, int32 x, int32 y);
/*
* Display a help topic.
*/
extern void LM_SendOnHelp(MWContext *context);
/*
* Send a load or abort event for an image to a callback.
*/
typedef enum LM_ImageEvent {
LM_IMGUNBLOCK = 0,
LM_IMGLOAD = 1,
LM_IMGABORT = 2,
LM_IMGERROR = 3,
LM_LASTEVENT = 3
} LM_ImageEvent;
extern void
LM_ProcessImageEvent(MWContext *context, LO_ImageStruct *image_data,
LM_ImageEvent event);
/* This should be called when a named anchor is located. */
extern JSBool
LM_SendOnLocate(MWContext *context, struct lo_NameList_struct *name_rec);
extern JSObject *
LM_ReflectApplet(MWContext *context, LO_JavaAppStruct *applet_data,
PA_Tag * tag, int32 layer_id, uint index);
extern JSObject *
LM_ReflectEmbed(MWContext *context, LO_EmbedStruct *lo_embed,
PA_Tag * tag, int32 layer_id, uint index);
struct lo_FormData_struct;
struct lo_NameList_struct;
extern JSObject *
LM_ReflectForm(MWContext *context, struct lo_FormData_struct *form_data,
PA_Tag * tag, int32 layer_id, uint index);
extern JSObject *
LM_ReflectFormElement(MWContext *context, int32 layer_id, int32 form_id,
int32 element_id, PA_Tag * tag);
extern JSObject *
LM_ReflectLink(MWContext *context, LO_AnchorData *anchor_data, PA_Tag * tag,
int32 layer_id, uint index);
extern JSObject *
LM_ReflectNamedAnchor(MWContext *context, struct lo_NameList_struct *name_rec,
PA_Tag * tag, int32 layer_id, uint index);
extern JSObject *
LM_ReflectImage(MWContext *context, LO_ImageStruct *image_data,
PA_Tag * tag, int32 layer_id, uint index);
extern JSBool
LM_CanDoJS(MWContext *context);
extern JSBool
LM_IsActive(MWContext *context);
/*
* Security.
*/
extern JSPrincipals *
LM_NewJSPrincipals(URL_Struct *archive, char *name, const char *codebase);
extern char *
LM_ExtractFromPrincipalsArchive(JSPrincipals *principals, char *name,
uint *length);
extern JSBool
LM_SetUntransformedSource(JSPrincipals *principals, char *original,
char *transformed);
extern JSPrincipals * PR_CALLBACK
LM_GetJSPrincipalsFromJavaCaller(JSContext *cx, int callerDepth);
/*
* LM_RegisterPrincipals will verify and register a set of principals
* in the decoder, modifying decoder->principals in the process. It
* returns the modified decoder.
*
* The "name" parameter may be NULL if "principals" was created with a name.
*/
extern JSPrincipals *
LM_RegisterPrincipals(MochaDecoder *decoder, JSPrincipals *principals,
char *name, char *src);
/*
* JavaScript Debugger support
*/
#ifdef JSDEBUGGER
extern NET_StreamClass*
LM_StreamBuilder( int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *mwcontext );
extern JSBool
LM_GetJSDebugActive(void);
extern void
LM_JamSourceIntoJSDebug( const char *filename,
const char *str,
int32 len,
MWContext *mwcontext );
#endif
NSPR_END_EXTERN_C
#endif /* libmocha_h___ */

29
mozilla/include/libnet.h Normal file
View File

@@ -0,0 +1,29 @@
/* -*- 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.
*/
/*-----------------------------------------------------------------------------
Collection of all the public libnet functions
-----------------------------------------------------------------------------*/
#ifndef _libnet_
#define _libnet_
#include "mkutils.h"
#include "mkstream.h"
#include "mkgeturl.h"
#endif /* _libnet_ */

View File

@@ -0,0 +1,35 @@
/* -*- 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.
*/
/* libstyle.h --- Exported style sheet routines */
#ifndef __LIBSTYLE_H_
#define __LIBSTYLE_H_
#include "xp_core.h"
#include "libmocha.h"
XP_BEGIN_PROTOS
extern JSBool
JSS_ResolveDocName(JSContext *mc, MWContext *context, JSObject *obj, jsval id);
XP_END_PROTOS
#endif /* __LIBSTYLE_H_ */

1317
mozilla/include/lo_ele.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
/* -*- 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.
*/
/*
** Mac_Convert_Stream.h
** --------------------
**
** The header file for the constructing functions of apple file
** encode/decode stream.
**
** 27sep95 mym created.
*/
#ifndef M_CVStrm_h
#define M_CVStrm_h
XP_BEGIN_PROTOS
PUBLIC NET_StreamClass *
fe_MakeBinHexEncodeStream (int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *window_id,
char* dst_filename);
PUBLIC NET_StreamClass *
fe_MakeBinHexDecodeStream (int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *window_id );
PUBLIC NET_StreamClass *
fe_MakeAppleDoubleDecodeStream (int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *window_id,
XP_Bool write_as_binhex,
char *dst_filename);
PUBLIC NET_StreamClass *
fe_MakeAppleSingleDecodeStream (int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *window_id,
XP_Bool write_as_binhex,
char *dst_filename);
#ifdef XP_MAC
PUBLIC NET_StreamClass *
fe_MakeAppleDoubleEncodeStream (int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *window_id,
char* src_filename,
char* dst_filename,
char* separator);
XP_Bool isMacFile(char* filename);
#endif
PUBLIC NET_StreamClass *
fe_MakeAppleDoubleDecodeStream_1 (int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *window_id);
PUBLIC NET_StreamClass *
fe_MakeAppleSingleDecodeStream_1 (int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *window_id);
XP_END_PROTOS
#endif

View File

@@ -0,0 +1,56 @@
#!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.
#//------------------------------------------------------------------------
#//
#// Makefile to install NSPR/INCLUDE header files into the distribution
#// directory.
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH = ..
#//------------------------------------------------------------------------
#//
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
#// (these must come before the common makefiles are included)
#//
#// DIRS - There is a subdirectory to process
#// INSTALL_FILES - Files to be installed in the distribution area
#//
#//------------------------------------------------------------------------
#INSTALL_FILE_LIST=*.h
#INSTALL_DIR=$(XPDIST)\public\coreincl
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>
#export:: INSTALL_FILES

443
mozilla/include/mcom_db.h Normal file
View File

@@ -0,0 +1,443 @@
/* -*- 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.
*/
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)db.h 8.7 (Berkeley) 6/16/94
*/
#ifndef _DB_H_
#define _DB_H_
#include "prtypes.h"
#ifdef __sgi
#define BYTE_ORDER BIG_ENDIAN
#define BIG_ENDIAN 4321
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
#define __BIT_TYPES_DEFINED__
#endif
#ifdef __sun
#define BIG_ENDIAN 4321
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
#ifndef SVR4
/* compat.h is only in 4.1.3 machines. - dp */
#include <compat.h>
#endif
/* XXX - dp
* Need to find a general way of defining endian-ness in SunOS 5.3
* SunOS 5.4 defines _BIG_ENDIAN and _LITTLE_ENDIAN
* SunOS 5.3 does nothing like this.
*/
#ifndef BYTE_ORDER
#if defined(_BIG_ENDIAN)
#define BYTE_ORDER BIG_ENDIAN
#elif defined(_LITTLE_ENDIAN)
#define BYTE_ORDER LITTLE_ENDIAN
#elif !defined(SVR4)
/* 4.1.3 is always BIG_ENDIAN as it was released only on sparc platforms. */
#define BYTE_ORDER BIG_ENDIAN
#elif !defined(vax) && !defined(ntohl) && !defined(lint) && !defined(i386)
/* 5.3 big endian. Copied this above line from sys/byteorder.h */
/* Now we are in a 5.3 SunOS rather non 5.4 or above SunOS */
#define BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#endif /* !BYTE_ORDER */
#endif /* __sun */
#ifdef __linux
# include <endian.h>
# ifndef BYTE_ORDER
# define BYTE_ORDER __BYTE_ORDER
# define BIG_ENDIAN __BIG_ENDIAN
# define LITTLE_ENDIAN __LITTLE_ENDIAN
# endif
#endif /* __linux */
#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined(NCR) || defined(NEC)
#include <sys/types.h>
#include <sys/byteorder.h>
#endif
#ifdef SCO
#include <sys/bitypes.h>
#define MAXPATHLEN 1024
#endif
#ifdef SNI
#define BYTE_ORDER BIG_ENDIAN
#define BIG_ENDIAN 4321
#define LITTLE_ENDIAN 1234
#endif
#ifdef NCR
#include <sys/endian.h>
#endif
#ifdef macintosh
#include <unix.h>
#endif
#ifndef macintosh
#include <fcntl.h>
#endif
#if defined(_WINDOWS) || defined(XP_OS2)
#include <stdio.h>
#include <io.h>
#include <limits.h>
#ifndef XP_OS2
#define MAXPATHLEN 1024
#else
#include "os2file.h" /* includes dirent.h */
#endif
#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
#ifndef STDERR_FILENO
#define STDIN_FILENO 0 /* ANSI C #defines */
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#endif
#ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#endif
#ifdef BYTE_ORDER
#undef BYTE_ORDER
#endif
#define BYTE_ORDER LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
#define BIG_ENDIAN 4321
#endif
#if defined(_WINDOWS) && !defined(_WIN32)
/* 16 bit windows defines */
#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */
#endif
#ifdef macintosh
#include <stdio.h>
#include "xp_mcom.h"
#ifndef NSPR20
#include "prmacos.h"
#endif
#define BIG_ENDIAN 4321
#define LITTLE_ENDIAN 1234
#define BYTE_ORDER BIG_ENDIAN
#define O_ACCMODE 3 /* Mask for file access modes */
#define EFTYPE 2000
XP_BEGIN_PROTOS
int mkstemp(const char *path);
XP_END_PROTOS
#endif /* MACINTOSH */
#if defined(XP_OS2)
#include <xp_mcom.h>
#include <pros2os.h>
XP_BEGIN_PROTOS
int mkstemp(char *path);
XP_END_PROTOS
#endif
#ifndef macintosh
#include <sys/types.h>
#endif
#if !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2)
#include <sys/stat.h>
#include <errno.h>
#endif
#include "cdefs.h"
#ifndef _WINDOWS /* included above to prevent spurious warnings chouck 12-Sep-95 */
#include <limits.h>
#endif
#ifndef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef MAX
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#define RET_ERROR -1 /* Return values. */
#define RET_SUCCESS 0
#define RET_SPECIAL 1
#if defined(__386BSD__) || defined(SCO)
#define __BIT_TYPES_DEFINED__
#endif
#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */
#ifndef __sgi
typedef uint32 pgno_t;
#endif
#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */
typedef uint16 indx_t;
#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */
typedef uint32 recno_t;
/* define EFTYPE since most don't */
#ifndef EFTYPE
#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
#endif
/* Key/data structure -- a Data-Base Thang. */
typedef struct {
void *data; /* data */
size_t size; /* data length */
} DBT;
/* Routine flags. */
#define R_CURSOR 1 /* del, put, seq */
#define __R_UNUSED 2 /* UNUSED */
#define R_FIRST 3 /* seq */
#define R_IAFTER 4 /* put (RECNO) */
#define R_IBEFORE 5 /* put (RECNO) */
#define R_LAST 6 /* seq (BTREE, RECNO) */
#define R_NEXT 7 /* seq */
#define R_NOOVERWRITE 8 /* put */
#define R_PREV 9 /* seq (BTREE, RECNO) */
#define R_SETCURSOR 10 /* put (RECNO) */
#define R_RECNOSYNC 11 /* sync (RECNO) */
typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
typedef enum { LockOutDatabase, UnlockDatabase } DBLockFlagEnum;
/*
* !!!
* The following flags are included in the dbopen(3) call as part of the
* open(2) flags. In order to avoid conflicts with the open flags, start
* at the top of the 16 or 32-bit number space and work our way down. If
* the open flags were significantly expanded in the future, it could be
* a problem. Wish I'd left another flags word in the dbopen call.
*
* !!!
* None of this stuff is implemented yet. The only reason that it's here
* is so that the access methods can skip copying the key/data pair when
* the DB_LOCK flag isn't set.
*/
#if UINT_MAX > 65535
#define DB_LOCK 0x20000000 /* Do locking. */
#define DB_SHMEM 0x40000000 /* Use shared memory. */
#define DB_TXN 0x80000000 /* Do transactions. */
#else
#define DB_LOCK 0x2000 /* Do locking. */
#define DB_SHMEM 0x4000 /* Use shared memory. */
#define DB_TXN 0x8000 /* Do transactions. */
#endif
/* Access method description structure. */
typedef struct __db {
DBTYPE type; /* Underlying db type. */
int (*close) (struct __db *);
int (*del) (const struct __db *, const DBT *, uint);
int (*get) (const struct __db *, const DBT *, DBT *, uint);
int (*put) (const struct __db *, DBT *, const DBT *, uint);
int (*seq) (const struct __db *, DBT *, DBT *, uint);
int (*sync) (const struct __db *, uint);
void *internal; /* Access method private. */
int (*fd) (const struct __db *);
} DB;
#define BTREEMAGIC 0x053162
#define BTREEVERSION 3
/* Structure used to pass parameters to the btree routines. */
typedef struct {
#define R_DUP 0x01 /* duplicate keys */
uint32 flags;
uint cachesize; /* bytes to cache */
int maxkeypage; /* maximum keys per page */
int minkeypage; /* minimum keys per page */
uint psize; /* page size */
int (*compare) /* comparison function */
(const DBT *, const DBT *);
size_t (*prefix) /* prefix function */
(const DBT *, const DBT *);
int lorder; /* byte order */
} BTREEINFO;
#define HASHMAGIC 0x061561
#define HASHVERSION 2
/* Structure used to pass parameters to the hashing routines. */
typedef struct {
uint bsize; /* bucket size */
uint ffactor; /* fill factor */
uint nelem; /* number of elements */
uint cachesize; /* bytes to cache */
uint32 /* hash function */
(*hash) (const void *, size_t);
int lorder; /* byte order */
} HASHINFO;
/* Structure used to pass parameters to the record routines. */
typedef struct {
#define R_FIXEDLEN 0x01 /* fixed-length records */
#define R_NOKEY 0x02 /* key not required */
#define R_SNAPSHOT 0x04 /* snapshot the input */
uint32 flags;
uint cachesize; /* bytes to cache */
uint psize; /* page size */
int lorder; /* byte order */
size_t reclen; /* record length (fixed-length records) */
uint8 bval; /* delimiting byte (variable-length records */
char *bfname; /* btree file name */
} RECNOINFO;
/* #ifdef __DBINTERFACE_PRIVATE */
/*
* Little endian <==> big endian 32-bit swap macros.
* M_32_SWAP swap a memory location
* P_32_SWAP swap a referenced memory location
* P_32_COPY swap from one location to another
*/
#define M_32_SWAP(a) { \
uint32 _tmp = a; \
((char *)&a)[0] = ((char *)&_tmp)[3]; \
((char *)&a)[1] = ((char *)&_tmp)[2]; \
((char *)&a)[2] = ((char *)&_tmp)[1]; \
((char *)&a)[3] = ((char *)&_tmp)[0]; \
}
#define P_32_SWAP(a) { \
uint32 _tmp = *(uint32 *)a; \
((char *)a)[0] = ((char *)&_tmp)[3]; \
((char *)a)[1] = ((char *)&_tmp)[2]; \
((char *)a)[2] = ((char *)&_tmp)[1]; \
((char *)a)[3] = ((char *)&_tmp)[0]; \
}
#define P_32_COPY(a, b) { \
((char *)&(b))[0] = ((char *)&(a))[3]; \
((char *)&(b))[1] = ((char *)&(a))[2]; \
((char *)&(b))[2] = ((char *)&(a))[1]; \
((char *)&(b))[3] = ((char *)&(a))[0]; \
}
/*
* Little endian <==> big endian 16-bit swap macros.
* M_16_SWAP swap a memory location
* P_16_SWAP swap a referenced memory location
* P_16_COPY swap from one location to another
*/
#define M_16_SWAP(a) { \
uint16 _tmp = a; \
((char *)&a)[0] = ((char *)&_tmp)[1]; \
((char *)&a)[1] = ((char *)&_tmp)[0]; \
}
#define P_16_SWAP(a) { \
uint16 _tmp = *(uint16 *)a; \
((char *)a)[0] = ((char *)&_tmp)[1]; \
((char *)a)[1] = ((char *)&_tmp)[0]; \
}
#define P_16_COPY(a, b) { \
((char *)&(b))[0] = ((char *)&(a))[1]; \
((char *)&(b))[1] = ((char *)&(a))[0]; \
}
/* #endif */
__BEGIN_DECLS
DB *dbopen (const char *, int, int, DBTYPE, const void *);
/* set or unset a global lock flag to disable the
* opening of any DBM file
*/
void dbSetOrClearDBLock(DBLockFlagEnum type);
/* #ifdef __DBINTERFACE_PRIVATE */
DB *__bt_open (const char *, int, int, const BTREEINFO *, int);
DB *__hash_open (const char *, int, int, const HASHINFO *, int);
DB *__rec_open (const char *, int, int, const RECNOINFO *, int);
void __dbpanic (DB *dbp);
/* #endif */
__END_DECLS
#if defined(linux) && !defined(MACLINUX)
/*
* Why you would want to override the system defines?
*/
#if BYTE_ORDER != LITTLE_ENDIAN
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#endif
#if defined(__hpux) || defined(__hppa)
#define BYTE_ORDER BIG_ENDIAN
#define BIG_ENDIAN 4321
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, all NT risc */
#endif
#if defined(AIXV3)
/* BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN are all defined here */
#include <sys/machine.h>
#endif
#ifdef __alpha
#include <endian.h>
#endif
#endif /* !_DB_H_ */

View File

@@ -0,0 +1,94 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Margo Seltzer.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ndbm.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _NDBM_H_
#define _NDBM_H_
#include "mcom_db.h"
/* Map dbm interface onto db(3). */
#define DBM_RDONLY O_RDONLY
/* Flags to dbm_store(). */
#define DBM_INSERT 0
#define DBM_REPLACE 1
/*
* The db(3) support for ndbm(3) always appends this suffix to the
* file name to avoid overwriting the user's original database.
*/
#define DBM_SUFFIX ".db"
typedef struct {
char *dptr;
int dsize;
} datum;
typedef DB DBM;
#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE
__BEGIN_DECLS
void dbm_close (DBM *);
int dbm_delete (DBM *, datum);
datum dbm_fetch (DBM *, datum);
datum dbm_firstkey (DBM *);
long dbm_forder (DBM *, datum);
datum dbm_nextkey (DBM *);
DBM *dbm_open (const char *, int, int);
int dbm_store (DBM *, datum, datum, int);
int dbm_dirfno (DBM *);
__END_DECLS
#endif /* !_NDBM_H_ */

74
mozilla/include/merrors.h Normal file
View File

@@ -0,0 +1,74 @@
/* -*- Mode: C; tab-width: 8; 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.
*/
/* merrors.h --- error codes for netlib. */
#ifndef _MERRORS_H_
#define _MERRORS_H_
/*
* Return codes
*/
#define MK_INTERRUPTED -201
#define MK_UNABLE_TO_CONVERT -208
#define MK_UNABLE_TO_LOGIN -210
#define MK_NO_NEWS_SERVER -224
#define MK_USE_FTP_INSTEAD -225
#define MK_USE_COPY_FROM_CACHE -226
#define MK_EMPTY_NEWS_LIST -227
#define MK_MAILTO_NOT_READY -228
#define MK_OBJECT_NOT_IN_CACHE -239
#define MK_UNABLE_TO_LISTEN_ON_SOCKET -244
#define MK_WAITING_FOR_LOOKUP -248 /* response for async dns */
#define MK_DO_REDIRECT -249 /* tells mkgeturl to redirect */
#define MK_MIME_NEED_B64 -270 /* used internally */
#define MK_MIME_NEED_QP -271 /* used internally */
#define MK_MIME_NEED_TEXT_CONVERTER -272 /* used internally */
#define MK_MIME_NEED_PS_CONVERTER -273 /* used internally */
#define MK_IMAGE_LOSSAGE -277
#define MK_TOO_MANY_OPEN_FILES -310
#define MK_FILE_WRITE_ERROR -350
#define MK_GET_REST_OF_PARTIAL_FILE_FROM_NETWORK -399
#define MK_MULTIPART_MESSAGE_COMPLETED -437
#define MK_OFFLINE -438
/* success codes */
#define MK_DATA_LOADED 1
#define MK_NO_DATA 2
#define MK_NO_ACTION 3
#define MK_CHANGING_CONTEXT 4
#endif /* _MERRORS_H_ */

115
mozilla/include/mime.h Normal file
View File

@@ -0,0 +1,115 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef MIME_H
#define MIME_H
#include "ntypes.h"
#include "mimeenc.h"
XP_BEGIN_PROTOS
extern PUBLIC const char *FE_UsersOrganization(void);
/* Returns the appropriate contents of a From: field of a mail message
originating from the current user. This calls FE_UsersFullName()
and FE_UsersMailAddress() and correctly munges the values, using
MSG_MakeFullAddress()
A new string is returned, which you must free when you're done with it.
*/
extern PUBLIC char *MIME_MakeFromField (void);
extern PUBLIC void MISC_ValidateSignature (MWContext *context,
const char *sig);
/* This does a very rough sanity-check on the return email address specified
in preferences, and pops up a dialog and returns negative if there is
something obviously wrong. MSG_ComposeMessage() calls this, and won't
let messages be composed until the problem is corrected. The FEs should
call this after preferences have been edited as well.
The address should be just the email address, not including the real name.
*/
extern PUBLIC int MISC_ValidateReturnAddress (MWContext *context,
const char *addr);
/* Convert a block of text to the MIME quoted-printable encoding.
Returns a new string and its size, or NULL if it couldn't allocate.
*/
extern PUBLIC void MIME_EncodeQuotedPrintableString(const unsigned char *input,
uint32 input_size,
unsigned char **output,
uint32 *output_size);
/* Convert a block of text to the MIME base64 encoding.
Returns a new string and its size, or NULL if it couldn't allocate.
*/
extern PUBLIC void MIME_EncodeBase64String(const unsigned char *input,
uint32 input_size,
unsigned char **output,
uint32 *output_size);
/* build a mailto: url address given a to field
*
* returns a malloc'd string
*/
extern char *
MIME_BuildMailtoURLAddress(const char * to);
/* build a news: url address to post to, given a partial news-post
* URL and the newsgroups line
*
* returns a malloc'd string
*/
extern char *
MIME_BuildNewspostURLAddress(const char *partial_newspost_url,
const char *newsgroups);
/* If the argument is true, we use quoted-printable encoding on mail and
news messages which have 8bit characters in them. Otherwise, we assume
that the mail and news transport will not strip the eighth bit (a bad
assumption.) */
extern void MIME_ConformToStandard (XP_Bool conform_p);
/* Generate headers for a form post to a mailto: URL.
This lets the URL specify additional headers, but is careful to
ignore headers which would be dangerous. It may modify the URL
(because of CC) so a new URL to actually post to is returned.
*/
extern int MIME_GenerateMailtoFormPostHeaders (const char *old_post_url,
const char *referer,
char **new_post_url_return,
char **headers_return);
extern NET_StreamClass *
NET_MimeMakePartialEncodingConverterStream (int format_out,
void *data_obj,
URL_Struct *URL_s,
MWContext *window_id,
NET_StreamClass *next_stream);
extern int MIME_HasAttachments(MWContext *context);
XP_END_PROTOS
#endif /* mime.h */

85
mozilla/include/mimeenc.h Normal file
View File

@@ -0,0 +1,85 @@
/* -*- 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.
*/
/* mimeenc.c --- MIME encoders and decoders, version 2 (see mimei.h)
Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
*/
#ifndef _MIMEENC_H_
#define _MIMEENC_H_
#include "xp.h"
/* This file defines interfaces to generic implementations of Base64,
Quoted-Printable, and UU decoders; and of Base64 and Quoted-Printable
encoders.
*/
/* Opaque objects used by the encoder/decoder to store state. */
typedef struct MimeDecoderData MimeDecoderData;
typedef struct MimeEncoderData MimeEncoderData;
XP_BEGIN_PROTOS
/* functions for creating that opaque data.
*/
MimeDecoderData *MimeB64DecoderInit(int (*output_fn) (const char *buf,
int32 size,
void *closure),
void *closure);
MimeDecoderData *MimeQPDecoderInit (int (*output_fn) (const char *buf,
int32 size,
void *closure),
void *closure);
MimeDecoderData *MimeUUDecoderInit (int (*output_fn) (const char *buf,
int32 size,
void *closure),
void *closure);
MimeEncoderData *MimeB64EncoderInit(int (*output_fn) (const char *buf,
int32 size,
void *closure),
void *closure);
MimeEncoderData *MimeQPEncoderInit (int (*output_fn) (const char *buf,
int32 size,
void *closure),
void *closure);
MimeEncoderData *MimeUUEncoderInit (char *filename,
int (*output_fn) (const char *buf,
int32 size,
void *closure),
void *closure);
/* Push data through the encoder/decoder, causing the above-provided write_fn
to be called with encoded/decoded data. */
int MimeDecoderWrite (MimeDecoderData *data, const char *buffer, int32 size);
int MimeEncoderWrite (MimeEncoderData *data, const char *buffer, int32 size);
/* When you're done encoding/decoding, call this to free the data. If
abort_p is FALSE, then calling this may cause the write_fn to be called
one last time (as the last buffered data is flushed out.)
*/
int MimeDecoderDestroy(MimeDecoderData *data, XP_Bool abort_p);
int MimeEncoderDestroy(MimeEncoderData *data, XP_Bool abort_p);
XP_END_PROTOS
#endif /* _MIMEENC_H_ */

123
mozilla/include/minicom.h Normal file
View File

@@ -0,0 +1,123 @@
/* -*- 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.
*/
/*******************************************************************************
* Mini Component Object Model
******************************************************************************/
#ifndef MINICOM_H
#define MINICOM_H
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************/
#if defined(XP_PC) && !defined(XP_OS2)
#if defined(_WIN32)
#include "objbase.h"
#else
#include <windows.h>
#include "compobj.h"
#endif
#else /* !XP_PC or XP_OS2*/
#if defined(XP_OS2)
#define TID OS2TID /* global rename in OS2 H's! */
#include <os2.h>
#undef TID /* and restore */
#endif
typedef struct _GUID {
long Data1;
short Data2;
short Data3;
char Data4[8];
} GUID;
typedef GUID IID;
typedef GUID CLSID;
typedef IID* REFIID;
typedef GUID* REFGUID;
typedef CLSID* REFCLSID;
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C
#endif /* cplusplus */
#ifndef INITGUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID name
#else
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#endif /* INITGUID */
#endif /* !XP_PC or XP_OS2*/
#define JRI_DEFINE_GUID(name, l, w1, w2) \
DEFINE_GUID(name, l, w1, w2, \
0xbb, 0x58, 0x00, 0x80, 0x5f, 0x74, 0x03, 0x79)
typedef long
(*MCOM_QueryInterface_t)(void* self, REFIID id, void* *result);
typedef long
(*MCOM_AddRef_t)(void* self);
typedef long
(*MCOM_Release_t)(void* self);
#if !defined(XP_PC) || defined(XP_OS2)
typedef struct IUnknown {
MCOM_QueryInterface_t QueryInterface;
MCOM_AddRef_t AddRef;
MCOM_Release_t Release;
} IUnknown;
#define IUnknown_QueryInterface(self, interfaceID, resultingInterface) \
(((*((IUnknown**)self))->QueryInterface)(self, interfaceID, resultingInterface))
#define IUnknown_AddRef(self) \
(((*((IUnknown**)self))->AddRef)(self))
#define IUnknown_Release(self) \
(((*((IUnknown**)self))->Release)(self))
#endif /* !XP_PC or XP_OS2*/
typedef long
(*MCOM_CreateInstance_t)(void* self, IUnknown* outer, REFIID interfaceID,
void** newInstance);
typedef long
(*MCOM_LockServer_t)(void* self, int doLock);
/******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* MINICOM_H */
/******************************************************************************/

149
mozilla/include/mk_cx_fn.h Normal file
View File

@@ -0,0 +1,149 @@
/* -*- 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 is Michael Toy's fault. If you hate it or have troubles figuring
** it out, you should bother him about it.
**
** This file generates both the fields of the front end structure, and the
** fe specific prototypes for your front end implementations, AND the
** the code to fill in the structure in your context initilization code
**
** To use it:
**
** #define MAKE_FE_FUNCS_STRUCT
** #include "mk_cx_fn.h"
** This will generate the field definitions for the structure.
**
** #define MAKE_FE_FUNCS_PREFIX(func) prefix_##func
** #define MAKE_FE_FUNCS_ASSIGN cx->
** #include "mk_cx_fn.h"
** Substitute your naming prefix for "prefix" (e.g XFE)
** This will generate the assignment statements to fill in the structure,
** the definition of MAKE_FE_FUNCS_ASSIGN will be the left hand side of the
** assignment statement.
**
** #define MAKE_FE_FUNCS_PREFIX(func) prefix_##func
** #define MAKE_FE_FUNCS_EXTERN
** #include "mk_cx_fn.h"
** This will generate the prototypes for all your front end functions.
*/
#if defined(MAKE_FE_FUNCS_TYPES)
#define FE_DEFINE(func, returns, args) typedef returns (*MAKE_FE_TYPES_PREFIX(func)) args;
#elif defined(MAKE_FE_FUNCS_STRUCT)
#define FE_DEFINE(func, returns, args) returns (*func) args;
#elif defined(MAKE_FE_FUNCS_EXTERN)
#define FE_DEFINE(func, returns, args) extern returns MAKE_FE_FUNCS_PREFIX(func) args;
#elif defined(MAKE_FE_FUNCS_ASSIGN)
#define FE_DEFINE(func, returns, args) MAKE_FE_FUNCS_ASSIGN func = MAKE_FE_FUNCS_PREFIX(func);
#elif !defined(FE_DEFINE)
You;Should;Read;The;Header;For;This;File;Before;Including;Error;Error;Error;
#endif
FE_DEFINE(CreateNewDocWindow, MWContext*, (MWContext * calling_context,URL_Struct * URL))
FE_DEFINE(LayoutNewDocument, void, (MWContext *context, URL_Struct *url_struct, int32 *iWidth, int32 *iHeight, int32 *mWidth, int32 *mHeight))
FE_DEFINE(SetDocTitle,void, (MWContext * context, char * title))
FE_DEFINE(FinishedLayout,void, (MWContext *context))
FE_DEFINE(TranslateISOText,char *, (MWContext * context, int charset, char *ISO_Text))
FE_DEFINE(GetTextInfo,int, (MWContext * context, LO_TextStruct *text, LO_TextInfo *text_info))
#ifdef XP_MAC
FE_DEFINE(MeasureText,int, (MWContext * context, LO_TextStruct *text, short *charLocs))
#endif
FE_DEFINE(GetEmbedSize,void, (MWContext * context, LO_EmbedStruct *embed_struct, NET_ReloadMethod force_reload))
FE_DEFINE(GetJavaAppSize,void, (MWContext * context, LO_JavaAppStruct *java_struct, NET_ReloadMethod force_reload))
FE_DEFINE(GetFormElementInfo,void, (MWContext * context, LO_FormElementStruct * form_element))
FE_DEFINE(GetFormElementValue,void, (MWContext * context, LO_FormElementStruct * form_element, XP_Bool hide))
FE_DEFINE(ResetFormElement,void, (MWContext * context, LO_FormElementStruct * form_element))
FE_DEFINE(SetFormElementToggle,void, (MWContext * context, LO_FormElementStruct * form_element, XP_Bool toggle))
FE_DEFINE(FreeEmbedElement,void, (MWContext *context, LO_EmbedStruct *))
FE_DEFINE(CreateEmbedWindow, void, (MWContext *context, NPEmbeddedApp *app))
FE_DEFINE(SaveEmbedWindow, void, (MWContext *context, NPEmbeddedApp *app))
FE_DEFINE(RestoreEmbedWindow, void, (MWContext *context, NPEmbeddedApp *app))
FE_DEFINE(DestroyEmbedWindow, void, (MWContext *context, NPEmbeddedApp *app))
FE_DEFINE(FreeJavaAppElement,void, (MWContext *context, struct LJAppletData *appletData))
FE_DEFINE(HideJavaAppElement,void, (MWContext *context, struct LJAppletData *))
FE_DEFINE(FreeEdgeElement,void, (MWContext *context, LO_EdgeStruct *))
FE_DEFINE(FormTextIsSubmit,void, (MWContext * context, LO_FormElementStruct * form_element))
FE_DEFINE(DisplaySubtext,void, (MWContext * context, int iLocation, LO_TextStruct *text, int32 start_pos, int32 end_pos, XP_Bool need_bg))
FE_DEFINE(DisplayText,void, (MWContext * context, int iLocation, LO_TextStruct *text, XP_Bool need_bg))
FE_DEFINE(DisplayEmbed,void, (MWContext * context, int iLocation ,LO_EmbedStruct *embed_struct))
FE_DEFINE(DisplayJavaApp,void, (MWContext * context, int iLocation ,LO_JavaAppStruct *java_struct))
FE_DEFINE(DisplayEdge,void, (MWContext * context, int iLocation ,LO_EdgeStruct *edge_struct))
FE_DEFINE(DisplayTable,void, (MWContext * context, int iLocation ,LO_TableStruct *table_struct))
FE_DEFINE(DisplayCell,void, (MWContext * context, int iLocation ,LO_CellStruct *cell_struct))
#ifdef XP_MAC
FE_DEFINE(InvalidateEntireTableOrCell,void, (MWContext * context, LO_Element *element))
FE_DEFINE(DisplayAddRowOrColBorder,void, (MWContext * context, XP_Rect* r ,XP_Bool bErase))
#endif
FE_DEFINE(DisplaySubDoc,void, (MWContext * context, int iLocation ,LO_SubDocStruct *subdoc_struct))
FE_DEFINE(DisplayLineFeed,void, (MWContext * context, int iLocation , LO_LinefeedStruct *line_feed, XP_Bool need_bg))
FE_DEFINE(DisplayHR,void, (MWContext * context, int iLocation , LO_HorizRuleStruct *HR_struct))
FE_DEFINE(DisplayBullet,void, (MWContext *context, int iLocation, LO_BullettStruct *bullet))
FE_DEFINE(DisplayFormElement,void, (MWContext * context, int iLocation, LO_FormElementStruct * form_element))
FE_DEFINE(DisplayBorder,void, (MWContext *context, int iLocation, int x, int y, int width, int height, int bw, LO_Color *color, LO_LineStyle style))
#ifdef XP_MAC
FE_DEFINE(UpdateEnableStates,void, (MWContext *context))
#endif
FE_DEFINE(DisplayFeedback,void, (MWContext *context, int iLocation, LO_Element *element))
FE_DEFINE(ClearView,void, (MWContext * context, int which))
FE_DEFINE(SetDocDimension,void, (MWContext *context, int iLocation, int32 iWidth, int32 iLength))
FE_DEFINE(SetDocPosition,void, (MWContext *context, int iLocation, int32 iX, int32 iY))
FE_DEFINE(GetDocPosition,void, (MWContext *context, int iLocation, int32 *iX, int32 *iY))
FE_DEFINE(BeginPreSection,void, (MWContext *context))
FE_DEFINE(EndPreSection,void, (MWContext *context))
FE_DEFINE(SetProgressBarPercent,void, (MWContext *context, int32 percent))
FE_DEFINE(SetBackgroundColor,void, (MWContext *context, uint8 red, uint8 green, uint8 blue))
FE_DEFINE(Progress, void, (MWContext * cx, const char *msg))
FE_DEFINE(Alert, void, (MWContext * cx, const char *msg))
FE_DEFINE(SetCallNetlibAllTheTime, void, (MWContext * win_id))
FE_DEFINE(ClearCallNetlibAllTheTime, void, (MWContext * win_id))
FE_DEFINE(GraphProgressInit, void, (MWContext *context, URL_Struct *URL_s, int32 content_length))
FE_DEFINE(GraphProgressDestroy, void, (MWContext *context, URL_Struct *URL_s, int32 content_length, int32 total_bytes_read))
FE_DEFINE(GraphProgress, void, (MWContext *context, URL_Struct *URL_s, int32 bytes_received, int32 bytes_since_last_time, int32 content_length))
FE_DEFINE(UseFancyFTP, XP_Bool, (MWContext * window_id))
FE_DEFINE(UseFancyNewsgroupListing, XP_Bool, (MWContext *window_id))
FE_DEFINE(FileSortMethod, int, (MWContext * window_id))
FE_DEFINE(ShowAllNewsArticles, XP_Bool, (MWContext *window_id))
FE_DEFINE(Confirm, XP_Bool,(MWContext * context, const char * Msg))
FE_DEFINE(Prompt,char*,(MWContext * context, const char * Msg, const char * dflt))
FE_DEFINE(PromptWithCaption,char*,(MWContext * context, const char *caption, const char * Msg, const char * dflt))
FE_DEFINE(PromptUsernameAndPassword, XP_Bool, (MWContext *,const char *,char **, char **))
FE_DEFINE(PromptPassword,char*,(MWContext * context, const char * Msg))
FE_DEFINE(EnableClicking,void,(MWContext*))
FE_DEFINE(AllConnectionsComplete,void,(MWContext * context))
#ifdef XP_OS2 /* performance */
FE_DEFINE(GetMaxWidth,int, (MWContext * context, LO_TextStruct *text))
#endif
#ifdef LAYERS
FE_DEFINE(EraseBackground, void, (MWContext *, int, int32, int32, uint32, uint32, LO_Color *))
FE_DEFINE(SetDrawable, void, (MWContext *, CL_Drawable *))
FE_DEFINE(GetTextFrame, void, (MWContext *, LO_TextStruct *, int32, int32, XP_Rect *))
#ifdef XP_MAC
FE_DEFINE(GetDefaultBackgroundColor, void, (MWContext* context, LO_Color* color))
#endif
#endif
/* these functions are to allow dealyed native window applet creation and transparent applet */
FE_DEFINE(HandleClippingView, void, (MWContext *pContext, struct LJAppletData *appletD, int x, int y, int width, int height))
FE_DEFINE(DrawJavaApp, void, (MWContext *pContext, int iLocation, LO_JavaAppStruct *pJava))
#undef FE_DEFINE
#undef MAKE_FE_FUNCS_PREFIX
#undef MAKE_FE_FUNCS_ASSIGN
#undef MAKE_FE_FUNCS_EXTERN
#undef MAKE_FE_FUNCS_STRUCT

219
mozilla/include/msg_filt.h Normal file
View File

@@ -0,0 +1,219 @@
/* -*- 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.
*/
/* foobar Public API for mail (and news?) filters */
#ifndef MSG_RULE_H
#define MSG_RULE_H
/*
Terminology - Filter - either a Rule (defined with GUI) or a (Java) Script
Rule -
*/
#include "msg_srch.h"
typedef enum
{
FilterError_Success = 0, /* no error */
FilterError_First = SearchError_Last + 1, /* no functions return this; just for bookkeeping */
FilterError_NotImplemented, /* coming soon */
FilterError_OutOfMemory, /* out of memory */
FilterError_FileError, /* error reading or writing the rules file */
FilterError_InvalidVersion, /* invalid filter file version */
FilterError_InvalidIndex, /* Invalid filter index */
FilterError_InvalidMotion, /* invalid filter move motion */
FilterError_InvalidFilterType, /* method doesn't accept this filter type */
FilterError_NullPointer, /* a required pointer parameter was null */
FilterError_NotRule, /* tried to get rule for non-rule filter */
FilterError_NotScript, /* tried to get a script name for a non-script filter */
FilterError_InvalidAction, /* invalid action */
FilterError_SearchError, /* error in search code */
FilterError_Last /* no functions return this; just for bookkeeping */
} MSG_FilterError;
typedef enum
{
acNone, /* uninitialized state */
acMoveToFolder,
acChangePriority,
acDelete,
acMarkRead,
acKillThread,
acWatchThread
} MSG_RuleActionType;
typedef enum
{
filterInboxRule = 0x1,
filterInboxJavaScript = 0x2,
filterInbox = 0x3,
filterNewsRule = 0x4,
filterNewsJavaScript = 0x8,
filterNews=0xb,
filterAll=0xf
} MSG_FilterType;
typedef enum
{
filterUp,
filterDown
} MSG_FilterMotion;
typedef int32 MSG_FilterIndex;
/* opaque struct defs - defined in libmsg/pmsgfilt.h */
#ifdef XP_CPLUSPLUS
struct MSG_Filter;
struct MSG_Rule;
struct MSG_RuleAction;
struct MSG_FilterList;
#else
typedef struct MSG_FilterList MSG_FilterList;
typedef struct MSG_Filter MSG_Filter;
typedef struct MSG_Rule MSG_Rule;
typedef struct MSG_RuleAction MSG_RuleAction;
#endif
XP_BEGIN_PROTOS
/* Front ends call MSG_OpenFilterList to get a handle to a FilterList, of existing MSG_Filter *.
These are manipulated by the front ends as a result of user interaction
with dialog boxes. To apply the new list, fe's call MSG_CloseFilterList.
For example, if the user brings up the rule management UI, deletes a rule,
and presses OK, the front end calls MSG_RemoveFilterListAt, and
then MSG_CloseFilterList.
*/
MSG_FilterError MSG_OpenFilterList(MSG_Master *master, MSG_FilterType type, MSG_FilterList **filterList);
MSG_FilterError MSG_OpenFolderFilterList(MSG_Pane *pane, MSG_FolderInfo *folder, MSG_FilterType type, MSG_FilterList **filterList);
MSG_FilterError MSG_CloseFilterList(MSG_FilterList *filterList);
MSG_FilterError MSG_SaveFilterList(MSG_FilterList *filterList); /* save without deleting */
MSG_FilterError MSG_CancelFilterList(MSG_FilterList *filterList);
MSG_FolderInfo *MSG_GetFolderInfoForFilterList(MSG_FilterList *filterList);
MSG_FilterError MSG_GetFilterCount(MSG_FilterList *filterList, int32 *pCount);
MSG_FilterError MSG_GetFilterAt(MSG_FilterList *filterList,
MSG_FilterIndex filterIndex, MSG_Filter **filter);
/* these methods don't delete filters - they just change the list. FE still must
call MSG_DestroyFilter to delete a filter.
*/
MSG_FilterError MSG_SetFilterAt(MSG_FilterList *filterList,
MSG_FilterIndex filterIndex, MSG_Filter *filter);
MSG_FilterError MSG_RemoveFilterAt(MSG_FilterList *filterList,
MSG_FilterIndex filterIndex);
MSG_FilterError MSG_MoveFilterAt(MSG_FilterList *filterList,
MSG_FilterIndex filterIndex, MSG_FilterMotion motion);
MSG_FilterError MSG_InsertFilterAt(MSG_FilterList *filterList,
MSG_FilterIndex filterIndex, MSG_Filter *filter);
MSG_FilterError MSG_EnableLogging(MSG_FilterList *filterList, XP_Bool enable);
XP_Bool MSG_IsLoggingEnabled(MSG_FilterList *filterList);
/* In general, any data gotten with MSG_*Get is good until the owning object
is deleted, or the data is replaced with a MSG_*Set call. For example, the name
returned in MSG_GetFilterName is valid until either the filter is destroyed,
or MSG_SetFilterName is called on the same filter.
*/
MSG_FilterError MSG_CreateFilter (MSG_FilterType type, char *name, MSG_Filter **result);
MSG_FilterError MSG_DestroyFilter(MSG_Filter *filter);
MSG_FilterError MSG_GetFilterType(MSG_Filter *, MSG_FilterType *filterType);
MSG_FilterError MSG_EnableFilter(MSG_Filter *, XP_Bool enable);
MSG_FilterError MSG_IsFilterEnabled(MSG_Filter *, XP_Bool *enabled);
MSG_FilterError MSG_GetFilterRule(MSG_Filter *, MSG_Rule ** result);
MSG_FilterError MSG_GetFilterName(MSG_Filter *, char **name);
MSG_FilterError MSG_SetFilterName(MSG_Filter *, const char *name);
MSG_FilterError MSG_GetFilterDesc(MSG_Filter *, char **description);
MSG_FilterError MSG_SetFilterDesc(MSG_Filter*, const char *description);
MSG_FilterError MSG_GetFilterScript(MSG_Filter *, char **name);
MSG_FilterError MSG_SetFilterScript(MSG_Filter *, const char *name);
MSG_FilterError MSG_RuleAddTerm(MSG_Rule *,
MSG_SearchAttribute attrib, /* attribute for this term */
MSG_SearchOperator op, /* operator e.g. opContains */
MSG_SearchValue *value, /* value e.g. "Dogbert" */
XP_Bool BooleanAND, /* TRUE if AND is the boolean operator. FALSE if OR is the boolean operators */
char * arbitraryHeader); /* arbitrary header specified by user. ignored unless attrib = attribOtherHeader */
MSG_FilterError MSG_RuleGetNumTerms(MSG_Rule *, int32 *numTerms);
MSG_FilterError MSG_RuleGetTerm(MSG_Rule *, int32 termIndex,
MSG_SearchAttribute *attrib, /* attribute for this term */
MSG_SearchOperator *op, /* operator e.g. opContains */
MSG_SearchValue *value, /* value e.g. "Dogbert" */
XP_Bool *BooleanAnd, /* TRUE if AND is the boolean operator. FALSE if OR is the boolean operator */
char ** arbitraryHeader); /* arbitrary header specified by user. ignore unless attrib = attribOtherHeader */
MSG_FilterError MSG_RuleSetScope(MSG_Rule *, MSG_ScopeTerm *scope);
MSG_FilterError MSG_RuleGetScope(MSG_Rule *, MSG_ScopeTerm **scope);
/* if type is acChangePriority, value is a pointer to priority.
If type is acMoveToFolder, value is pointer to folder name.
Otherwise, value is ignored.
*/
MSG_FilterError MSG_RuleSetAction(MSG_Rule *, MSG_RuleActionType type, void *value);
MSG_FilterError MSG_RuleGetAction(MSG_Rule *, MSG_RuleActionType *type, void **value);
/* help FEs manage menu choices in Filter dialog box */
/* Use this to help build menus in the filter dialogs. See APIs below */
typedef struct MSG_RuleMenuItem
{
int16 attrib;
char name[32];
} MSG_RuleMenuItem;
MSG_FilterError MSG_GetRuleActionMenuItems (
MSG_FilterType type, /* type of filter */
MSG_RuleMenuItem *items, /* array of caller-allocated structs */
uint16 *maxItems); /* in- max array size; out- num returned */
MSG_FilterError MSG_GetFilterWidgetForAction( MSG_RuleActionType action,
MSG_SearchValueWidget *widget );
MSG_SearchError MSG_GetValuesForAction( MSG_RuleActionType action,
MSG_SearchMenuItem *items,
uint16 *maxItems);
void MSG_ViewFilterLog(MSG_Pane *pane);
/*
** Adding/editting javascript filters.
**
** The FE calls one of the below functions, along with a callback and some closure
** data. This callback is invoked when the user clicks OK in the JS filter dialog.
** If CANCEL is pressed, the callback is not invoked.
**
** If the user called MSG_EditJSFilter, the filter_index parameter of the callback
** is the same one passed in. If the user called MSG_NewJSFilter, the filter_index
** parameter is -1.
**
** The filter_changed parameter is TRUE if the user modified any of the fields of
** the javascript filter, and FALSE otherwise.
*/
typedef void (*JSFilterCallback)(void* arg, MSG_FilterIndex filter_index, XP_Bool filter_changed);
void MSG_EditJSFilter(MWContext *context, MSG_FilterList *filter_list,
MSG_FilterIndex filter_index,
JSFilterCallback cb, void *arg);
void MSG_NewJSFilter(MWContext *context, MSG_FilterList *filter_list,
MSG_FilterType filter_type, JSFilterCallback cb, void *arg);
XP_END_PROTOS
#endif

447
mozilla/include/msg_srch.h Normal file
View File

@@ -0,0 +1,447 @@
/* -*- 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.
*/
/*
* Public API for searching mail, news, and LDAP
* pieces of this API are also used by filter rules and address book
*
*/
#ifndef _MSG_SRCH_H
#define _MSG_SRCH_H
#include "msgcom.h" /* for MSG_PRIORITY, MessageKey */
#include "dirprefs.h" /* for DIR_AttributeId */
#define FE_IMPLEMENTS_BOOLEAN_OR
#define B3_SEARCH_API
typedef enum
{
SearchError_First, /* no functions return this; just for bookkeeping */
SearchError_Success, /* no error */
SearchError_NotImplemented, /* coming soon */
SearchError_OutOfMemory, /* can't allocate required memory */
SearchError_NullPointer, /* a req'd pointer parameter was null */
SearchError_ScopeAgreement, /* attr or op not supp in this scope */
SearchError_ListTooSmall, /* menu item array not big enough */
SearchError_ResultSetEmpty, /* search done, no matches found */
SearchError_ResultSetTooBig, /* too many matches to get them all */
SearchError_InvalidAttribute, /* specified attrib not in enum */
SearchError_InvalidScope, /* specified scope not in enum */
SearchError_InvalidOperator, /* specified op not in enum */
SearchError_InvalidSearchTerm, /* cookie for search term is bogus */
SearchError_InvalidScopeTerm, /* cookie for scope term is bogus */
SearchError_InvalidResultElement, /* cookie for result element is bogus */
SearchError_InvalidPane, /* context probably bogus */
SearchError_InvalidStream, /* in strm bad (too short? bad magic?) */
SearchError_InvalidFolder, /* given folderInfo isn't searchable */
SearchError_InvalidIndex, /* the passed index is invalid */
SearchError_HostNotFound, /* couldn't connect to server */
SearchError_Timeout, /* network didn't respond */
SearchError_DBOpenFailed, /* couldn't open off-line msg db */
SearchError_NotAMatch, /* used internally for term eval */
SearchError_ScopeDone, /* used internally for scope list eval */
SearchError_Unknown, /* some random error */
SearchError_Last /* no functions return this; just for bookkeeping */
} MSG_SearchError;
typedef enum
{
scopeMailFolder,
scopeNewsgroup,
scopeLdapDirectory,
scopeOfflineNewsgroup,
scopeAllSearchableGroups
} MSG_ScopeAttribute;
/* NB: If you add elements to this enum, add only to the end, since
* RULES.DAT stores enum values persistently
*/
typedef enum
{
attribSender = 0, /* mail and news */
attribSubject,
attribBody,
attribDate,
attribPriority, /* mail only */
attribMsgStatus,
attribTo,
attribCC,
attribToOrCC,
attribCommonName, /* LDAP only */
attrib822Address,
attribPhoneNumber,
attribOrganization,
attribOrgUnit,
attribLocality,
attribStreetAddress,
attribSize,
attribAnyText, /* any header or body */
attribKeywords,
attribDistinguishedName, /* LDAP result elem only */
attribObjectClass,
attribJpegFile,
attribLocation, /* result list only */
attribMessageKey, /* message result elems */
attribAgeInDays, /* for purging old news articles */
attribGivenName, /* for sorting LDAP results */
attribSurname,
attribFolderInfo, /* for "view thread context" from result */
attribCustom1, /* custom LDAP attributes */
attribCustom2,
attribCustom3,
attribCustom4,
attribCustom5,
attribMessageId,
attribOtherHeader, /* for mail and news. MUST ALWAYS BE LAST attribute since we can have an arbitrary # of these...*/
kNumAttributes /* must be last attribute */
} MSG_SearchAttribute;
/* NB: If you add elements to this enum, add only to the end, since
* RULES.DAT stores enum values persistently
*/
typedef enum
{
opContains = 0, /* for text attributes */
opDoesntContain,
opIs, /* is and isn't also apply to some non-text attrs */
opIsnt,
opIsEmpty,
opIsBefore, /* for date attributes */
opIsAfter,
opIsHigherThan, /* for priority. opIs also applies */
opIsLowerThan,
opBeginsWith,
opEndsWith,
opSoundsLike, /* for LDAP phoenetic matching */
opLdapDwim, /* Do What I Mean for simple search */
opIsGreaterThan,
opIsLessThan,
kNumOperators /* must be last operator */
} MSG_SearchOperator;
/* FEs use this to help build the search dialog box */
typedef enum
{
widgetText,
widgetDate,
widgetMenu,
widgetInt, /* added to account for age in days which requires an integer field */
widgetNone
} MSG_SearchValueWidget;
/* Use this to specify the value of a search term */
typedef struct MSG_SearchValue
{
MSG_SearchAttribute attribute;
union
{
char *string;
MSG_PRIORITY priority;
time_t date;
uint32 msgStatus; /* see MSG_FLAG in msgcom.h */
uint32 size;
MessageKey key;
uint32 age; /* in days */
MSG_FolderInfo *folder;
} u;
} MSG_SearchValue;
/* Use this to help build menus in the search dialog. See APIs below */
#define kSearchMenuLength 64
typedef struct MSG_SearchMenuItem
{
int16 attrib;
char name[kSearchMenuLength];
XP_Bool isEnabled;
} MSG_SearchMenuItem;
#ifdef XP_CPLUSPLUS
struct MSG_ScopeTerm;
struct MSG_ResultElement;
struct DIR_Server;
#else
#include "dirprefs.h"
typedef struct MSG_ScopeTerm MSG_ScopeTerm;
typedef struct MSG_ResultElement MSG_ResultElement;
#endif
XP_BEGIN_PROTOS
/* manage lifetime of internal search memory */
MSG_SearchError MSG_SearchAlloc (MSG_Pane *); /* alloc memory in context */
MSG_SearchError MSG_SearchFree (MSG_Pane *); /* free memory in context */
MSG_SearchError MSG_AddSearchTerm (
MSG_Pane *searchPane, /* ptr to pane to add criteria */
MSG_SearchAttribute attrib, /* attribute for this term */
MSG_SearchOperator op, /* operator e.g. opContains */
MSG_SearchValue *value, /* value e.g. "Dogbert" */
XP_Bool BooleanAND, /* set to true if associated boolean operator is AND */
char * arbitraryHeader); /* user defined arbitrary header. ignored unless attrib = attribOtherHeader */
/* It's generally not necessary for the FE to read the list of terms after
* the list has been built. However, in our Basic/Advanced LDAP search dialogs
* the FE is supposed to remember the criteria, and since that information is
* lying around in the backend anyway, we'll just make it available to the FE
*/
MSG_SearchError MSG_CountSearchTerms (
MSG_Pane *searchPane,
int *numTerms);
MSG_SearchError MSG_GetNthSearchTerm (
MSG_Pane *searchPane,
int whichTerm,
MSG_SearchAttribute *attrib,
MSG_SearchOperator *op,
MSG_SearchValue *value);
MSG_SearchError MSG_CountSearchScopes (
MSG_Pane *searchPane,
int *numScopes);
MSG_SearchError MSG_GetNthSearchScope (
MSG_Pane *searchPane,
int which,
MSG_ScopeAttribute *scopeId,
void **scope);
/* add a scope (e.g. a mail folder) to the search */
MSG_SearchError MSG_AddScopeTerm (
MSG_Pane *searchPane, /* ptr to pane to add search scope */
MSG_ScopeAttribute attrib, /* what kind of scope term is this */
MSG_FolderInfo *folder); /* which folder to search */
/* special cases for LDAP since LDAP isn't really a folderInfo */
MSG_SearchError MSG_AddLdapScope (
MSG_Pane *searchPane,
DIR_Server *server);
MSG_SearchError MSG_AddAllLdapScopes (
MSG_Pane *searchPane,
XP_List *dirServerList);
/* Call this function everytime the scope changes! It informs the FE if
the current scope support custom header use. FEs should not display the
custom header dialog if custom headers are not supported */
XP_Bool MSG_ScopeUsesCustomHeaders(
MSG_Master * master,
MSG_ScopeAttribute scope,
void * selection, /* could be a folder or server based on scope */
XP_Bool forFilters); /* is this a filter we are talking about? */
XP_Bool MSG_IsStringAttribute( /* use this to determine if your attribute is a string attrib */
MSG_SearchAttribute);
/* add all scopes of a given type to the search */
MSG_SearchError MSG_AddAllScopes (
MSG_Pane *searchPane, /* ptr to pane to add scopes */
MSG_Master *master, /* mail or news scopes */
MSG_ScopeAttribute attrib); /* what kind of scopes to add */
/* begin execution of the search */
MSG_SearchError MSG_Search (
MSG_Pane *searchPane); /* So we know how to work async */
/* manage elements in list of search hits */
MSG_SearchError MSG_GetResultElement (
MSG_Pane *searchPane, /* ptr to pane containing results */
MSG_ViewIndex idx, /* zero-based index of result to get */
MSG_ResultElement **result); /* filled in resultElement. NOT allocated */
MSG_SearchError MSG_GetResultAttribute (
MSG_ResultElement *elem, /* which result elem to get value for */
MSG_SearchAttribute attrib, /* which attribute to get value for */
MSG_SearchValue **result); /* filled in value */
MSG_SearchError MSG_OpenResultElement (
MSG_ResultElement *elem, /* which result elem to open */
void *window); /* MSG_Pane* for mail/news, contxt for LDAP */
MWContextType MSG_GetResultElementType (
MSG_ResultElement *elem); /* context type needed for this elem */
MWContext *MSG_IsResultElementOpen (
MSG_ResultElement *elem); /* current context if open, NULL if not */
MSG_SearchError MSG_SortResultList (
MSG_Pane *searchPane, /* ptr to pane containing results */
MSG_SearchAttribute sortKey, /* which attribute is the sort key */
XP_Bool descending); /* T- sort descending, F- sort ascending */
MSG_SearchError MSG_DestroySearchValue (
MSG_SearchValue *value); /* free struct and heap-based struct elems */
MSG_SearchError MSG_ModifyLdapResult (
MSG_ResultElement *elem, /* which result element to modify */
MSG_SearchValue *val); /* new value to stuff in */
MSG_SearchError MSG_AddLdapResultsToAddressBook(
MSG_Pane *searchPane, /* ptr to pane containing results */
MSG_ViewIndex *indices, /* selection array */
int count); /* size of array */
MSG_SearchError MSG_ComposeFromLdapResults(
MSG_Pane *searchPane, /* ptr to pane containing results */
MSG_ViewIndex *indices, /* selection array */
int count); /* size of array */
/* help FEs manage menu selections in Search dialog box */
MSG_SearchError MSG_GetSearchWidgetForAttribute (
MSG_SearchAttribute attrib, /* which attr to get UI widget type for */
MSG_SearchValueWidget *widget); /* what kind of UI widget specifies attr */
/* For referring to DIR_Servers and MSG_FolderInfos polymorphically */
typedef struct MSG_ScopeUnion
{
MSG_ScopeAttribute *attribute;
union
{
DIR_Server *server;
MSG_FolderInfo *folder;
} u;
} MSG_ScopeUnion;
/* always call this routine b4 calling MSG_GetAttributesForSearchScopes to
determine how many elements your MSG_SearchMenuItem array needs to be */
MSG_SearchError MSG_GetNumAttributesForSearchScopes(
MSG_Master *master,
MSG_ScopeAttribute scope,
void ** selArray, /* selected items for LCD calculation */
uint16 selCount, /* number of selected items */
uint16 *numItems); /* out - number of attribute items for scope */
MSG_SearchError MSG_GetAttributesForSearchScopes (
MSG_Master *master,
MSG_ScopeAttribute scope,
void **selArray, /* selected items for LCD calculation */
uint16 selCount, /* number of selected items */
MSG_SearchMenuItem *items, /* array of caller-allocated structs */
uint16 *maxItems); /* in- max array size; out- num returned */
MSG_SearchError MSG_GetOperatorsForSearchScopes (
MSG_Master *master,
MSG_ScopeAttribute scope,
void **selArray, /* selected items for LCD calculation */
uint16 selCount, /* number of selected items */
MSG_SearchAttribute attrib, /* return available ops for this attrib */
MSG_SearchMenuItem *items, /* array of caller-allocated structs */
uint16 *maxItems); /* in- max array size; out- num returned */
MSG_SearchError MSG_GetScopeMenuForSearchMessages (
MSG_Master *master,
MSG_FolderInfo **selArray,
uint16 selCount,
MSG_SearchMenuItem *items,
uint16 *maxItems);
/* always call this routine b4 calling MSG_GetAttributesForFilterScopes to
determine how many elements your MSG_SearchMenuItem array needs to be */
MSG_SearchError MSG_GetNumAttributesForFilterScopes(
MSG_Master *master,
MSG_ScopeAttribute scope,
void ** selArray, /* selected items for LCD calculation */
uint16 selCount, /* number of selected items */
uint16 *numItems); /* out - number of attribute items for scope */
MSG_SearchError MSG_GetAttributesForFilterScopes (
MSG_Master *master,
MSG_ScopeAttribute scope,
void **selArray, /* selected items for LCD calculation */
uint16 selCount, /* number of selected items */
MSG_SearchMenuItem *items, /* array of caller-allocated structs */
uint16 *maxItems); /* in- max array size; out- num returned */
MSG_SearchError MSG_GetOperatorsForFilterScopes (
MSG_Master *master,
MSG_ScopeAttribute scope,
void **selArray, /* selected items for LCD calculation */
uint16 selCount, /* number of selected items */
MSG_SearchAttribute attrib, /* return available ops for this attrib */
MSG_SearchMenuItem *items, /* array of caller-allocated structs */
uint16 *maxItems); /* in- max array size; out- num returned */
/*****************************************************************************
These two functions have been added to the search APIs to help support Arbitrary
Headers. In particular, the FEs need to be able to grab a semaphore when they
create an edit headers dialog (we only want to allow 1 dialog to be open at a time).
AcquireEditHeadersSemaphore returns TRUE if the FE successfully acquired the semaphore
and FALSE if someone else acquired it. ReleaseEditHeaderSemaphore returns TRUE if you
were the original holder of the semaphore and the semaphore was released. FALSE if you
were not the original holder
**********************************************************************************/
XP_Bool MSG_AcquireEditHeadersSemaphore (MSG_Master * master, void * holder);
XP_Bool MSG_ReleaseEditHeadersSemaphore (MSG_Master * master, void * holder);
MSG_SearchError MSG_SearchAttribToDirAttrib (
MSG_SearchAttribute searchAttrib,
DIR_AttributeId *dirAttrib);
MSG_SearchError MSG_GetBasicLdapSearchAttributes (
DIR_Server *server,
MSG_SearchMenuItem *items,
int *maxItems);
/* maybe these belong in msgcom.h? */
void MSG_GetPriorityName (MSG_PRIORITY priority, char *name, uint16 max);
void MSG_GetUntranslatedPriorityName (MSG_PRIORITY priority,
char *name, uint16 max);
void MSG_GetStatusName (uint32 status, char *name, uint16 max);
MSG_PRIORITY MSG_GetPriorityFromString(const char *priority);
/* support for profile searching in Dredd */
MSG_SearchError MSG_SaveProfileStatus (MSG_Pane *searchPane, XP_Bool *enabled);
MSG_SearchError MSG_SaveProfile (MSG_Pane *searchPane, const char *profileName);
/* support for searching all Dredd groups + all subscribed groups */
MSG_SearchError MSG_AddAllSearchableGroupsStatus(MSG_Pane *searchPane, XP_Bool *enabled);
/* support for opening a search result in its thread pane context */
XP_Bool MSG_GoToFolderStatus (MSG_Pane *searchPane,
MSG_ViewIndex *indices,
int32 numIndices);
/* used between libnet and libmsg to allow searching for characters which
* are otherwise significant in news: URLs
*/
extern char *MSG_EscapeSearchUrl (const char *value);
extern char *MSG_UnEscapeSearchUrl (const char *value);
/* This is how "search:" of different mail/news folder types works */
extern int MSG_ProcessSearch (MWContext *context);
extern int MSG_InterruptSearch (MWContext *context);
XP_END_PROTOS
#endif /* _MSG_SRCH_H */

3116
mozilla/include/msgcom.h Normal file

File diff suppressed because it is too large Load Diff

80
mozilla/include/msgmapi.h Normal file
View File

@@ -0,0 +1,80 @@
/* -*- 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.
*/
/*
** msgmapi.h -- implements XP mail/news support for the Microsoft Mail API (MAPI)
**
*/
#ifndef _MSGMAPI_H
#define _MSGMAPI_H
#ifdef XP_WIN
#include "msgcom.h"
#include "abcom.h"
// rhp - to fix the problem caused by MSFT...grrrrr...
#ifndef MAPI_OLE // Because MSFT doesn't do this for us :-(
#include <mapi.h> // for MAPI specific types...
#endif
#ifdef XP_CPLUSPLUS
class MSG_MapiListContext;
#else
typedef struct MSG_MapiListContext MSG_MapiListContext;
#endif
XP_BEGIN_PROTOS
MessageKey MSG_GetFirstKeyInFolder (MSG_FolderInfo *folder, MSG_MapiListContext **cookie);
MessageKey MSG_GetNextKeyInFolder (MSG_MapiListContext *cookie);
XP_Bool MSG_GetMapiMessageById (MSG_FolderInfo *folder, MessageKey key, lpMapiMessage *message);
XP_Bool MSG_MarkMapiMessageRead (MSG_FolderInfo *folder, MessageKey key, XP_Bool read);
void MSG_FreeMapiMessage (lpMapiMessage msg);
/* Address Book Specific APIs to support MAPI calls for MAPIDetails and MAPIResolveName */
int AB_MAPI_ResolveName(
char * string,
AB_ContainerInfo ** ctr, /* caller allocates ptr to ctr, BE fills. Caller must close the ctr when done */
ABID * id);
/* Caller must free the character strings returned by these functions using XP_FREE */
char * AB_MAPI_GetEmailAddress(AB_ContainerInfo * ctr,ABID id);
char * AB_MAPI_GetFullName(AB_ContainerInfo * ctr, ABID id);
char * AB_MAPI_ConvertToDescription(AB_ContainerInfo * ctr);
AB_ContainerInfo * AB_MAPI_ConvertToContainer(char * description);
int AB_MAPI_CreatePropertySheetPane(
MWContext * context,
MSG_Master * master,
AB_ContainerInfo * ctr,
ABID id,
MSG_Pane ** personPane); /* BE fills the ptr with a person pane */
void AB_MAPI_CloseContainer(AB_ContainerInfo ** ctr);
XP_END_PROTOS
#endif /* XP_WIN */
#endif /* _MSGMAPI_H */

491
mozilla/include/msgnet.h Normal file
View File

@@ -0,0 +1,491 @@
/* -*- 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.
*/
/* msgnet.h --- prototypes for API's between libmsg and libnet.
*/
#ifndef _MSGNET_H_
#define _MSGNET_H_
#include "msgcom.h"
XP_BEGIN_PROTOS
/* so libnet can mark expired articles as read. */
extern int MSG_MarkMessageKeyRead (MSG_Pane *pane, MessageKey key, const char *xref);
/* record imap message flags in the db of the current pane (message or thread panes) */
extern void MSG_RecordImapMessageFlags(MSG_Pane* pane,
MessageKey msgKey,
imapMessageFlagsType flags);
/* notify libmsg of deleted messages */
extern void MSG_ImapMsgsDeleted(MSG_Pane *urlPane,
const char *onlineMailboxName,
XP_Bool deleteAllMsgs,
const char *doomedKeyString);
/* called to setup state before a copy download */
extern void MSG_StartImapMessageToOfflineFolderDownload(MWContext* context);
/* notify libmsg that inbox filtering is complete */
extern void MSG_ImapInboxFilteringComplete(MSG_Pane *urlPane);
/* notify libmsg that the online/offline synch is complete */
extern void MSG_ImapOnOffLineSynchComplete(MSG_Pane *urlPane);
/* notify libmsg that an imap folder load was interrupted */
extern void MSG_InterruptImapFolderLoad(MSG_Pane *urlPane, const char *hostName, const char *onlineFolderPath);
/* find a reference or NULL to the specified imap folder */
extern MSG_FolderInfo* MSG_FindImapFolder(MSG_Pane *urlPane, const char *hostName, const char *onlineFolderPath);
/* If there is a cached connection, for this folder, uncache it and return it */
extern TNavigatorImapConnection* MSG_UnCacheImapConnection(MSG_Master* master, const char *host, const char *folderName);
/* Cache this connection and return TRUE if there is not one there already, else false */
extern XP_Bool MSG_TryToCacheImapConnection(MSG_Master* master, const char *host, const char *folderName, TNavigatorImapConnection *connection);
extern void MSG_SetIMAPMessageUID (MessageKey key,
void *state);
extern const char *MSG_GetMessageIdFromState (void *state);
extern XP_Bool MSG_IsSaveDraftDeliveryState (void *state);
extern void MSG_SetUserAuthenticated (MSG_Master* master, XP_Bool bAuthenticated);
extern XP_Bool MSG_IsUserAuthenticated (MSG_Master* master);
extern void MSG_SetMailAccountURL(MSG_Master* master, const char *urlString);
extern const char *MSG_GetMailAccountURL(MSG_Master* master);
extern void MSG_SetNewsgroupUsername(MSG_Pane* pane, const char *username);
extern const char *MSG_GetNewsgroupUsername(MSG_Pane *pane);
extern void MSG_SetNewsgroupPassword(MSG_Pane* pane, const char *password);
extern const char *MSG_GetNewsgroupPassword(MSG_Pane *pane);
extern const char* MSG_GetPopHost(MSG_Prefs* prefs);
extern XP_Bool MSG_GetUseSSLForIMAP4(MSG_Pane *pane);
extern int32 MSG_GetIMAPSSLPort(MSG_Pane *pane);
/* called from libnet to clean up state from mailbox:copymessages */
extern void MSG_MessageCopyIsCompleted (struct MessageCopyInfo**);
/* called from libnet to determine if the current copy is finished */
extern XP_Bool MSG_IsMessageCopyFinished(struct MessageCopyInfo*);
/* called from mailbox and url libnet modules */
extern
int MSG_BeginCopyingMessages(MWContext *context);
extern
int MSG_FinishCopyingMessages(MWContext *context);
extern const char *MSG_GetIMAPHostUsername(MSG_Master *master, const char *hostName);
extern const char *MSG_GetIMAPHostPassword(MSG_Master *master, const char *hostName);
extern void MSG_SetIMAPHostPassword(MSG_Master *master, const char *hostName, const char *password);
extern int MSG_GetIMAPHostIsUsingSubscription(MSG_Master *master, const char *hostName, XP_Bool *usingSubscription);
extern XP_Bool MSG_GetIMAPHostDeleteIsMoveToTrash(MSG_Master *master, const char *hostName);
extern int IMAP_AddIMAPHost(const char *hostName, XP_Bool usingSubscription, XP_Bool overrideNamespaces,
const char *personalNamespacePrefix, const char *publicNamespacePrefixes, const char *otherUsersNamespacePrefixes);
typedef enum
{ MSG_NotRunning = 0x00000000
, MSG_RunningOnline = 0x00000001
, MSG_RunningOffline = 0x00000002
} MSG_RunningState;
extern MSG_FolderInfo *MSG_SetFolderRunningIMAPUrl(MSG_Pane *urlPane, const char *hostName, const char *onlineFolderPath, MSG_RunningState runningState);
extern void MSG_IMAPUrlFinished(MSG_FolderInfo *folder, URL_Struct *URL_s);
/* ===========================================================================
OFFLINE IMAP
===========================================================================
*/
extern uint32 MSG_GetImapMessageFlags(MSG_Pane *urlPane,
const char *hostName,
const char *onlineBoxName,
uint32 key);
extern void MSG_StartOfflineImapRetrieval(MSG_Pane *urlPane,
const char *hostName,
const char *onlineBoxName,
uint32 key,
void **offLineRetrievalData);
extern uint32 MSG_GetOfflineMessageSize(void *offLineRetrievalData);
extern int MSG_ProcessOfflineImap(void *offLineRetrievalData, char *socketBuffer, uint32 read_size);
extern int MSG_InterruptOfflineImap(void *offLineRetrievalData);
extern void MSG_GetNextURL(MSG_Pane *pane);
/* Returns the original pane that a progress pane was associated with. If
the given pane is not a progresspane, returns NULL. */
extern MSG_Pane* MSG_GetParentPane(MSG_Pane* progresspane);
/* do an imap biff of the imap inbox */
extern void MSG_ImapBiff(MWContext* context, MSG_Prefs* prefs);
/* The NNTP module of netlib calls these to feed XOVER data to the message
library, in response to a news:group.name URL having been opened.
If MSG_FinishXOVER() returns a message ID, that message will be loaded
next (used for selecting the first unread message in a group after
listing that group.)
The "out" arguments are (if non-NULL) a file descriptor to write the XOVER
line to, followed by a "\n". This is used by the XOVER-caching code.
*/
extern int MSG_InitXOVER (MSG_Pane* pane,
MSG_NewsHost* host,
const char* group_name,
uint32 first_msg, uint32 last_msg,
uint32 oldest_msg, uint32 youngest_msg,
void **data);
extern int MSG_ProcessXOVER (MSG_Pane* pane, char *line, void **data);
extern int MSG_ProcessNonXOVER (MSG_Pane* pane, char *line, void **data);
extern int MSG_FinishXOVER (MSG_Pane* pane, void **data, int status);
/* In case of XOVER failed due to the authentication process, we need to
do some clean up. So that we could have a fresh start once we pass the
authentication check.
*/
extern int MSG_ResetXOVER (MSG_Pane* pane, void **data);
/* These calls are used by libnet to determine which articles it ought to
get in a big newsgroup. */
extern int
MSG_GetRangeOfArtsToDownload(MSG_Pane* pane, void** data, MSG_NewsHost* host,
const char* group_name,
int32 first_possible, /* Oldest article available
from newsserver*/
int32 last_possible, /* Newest article available
from newsserver*/
int32 maxextra,
int32* first,
int32* last);
extern int
MSG_AddToKnownArticles(MSG_Pane *pane, MSG_NewsHost* host,
const char* groupname, int32 first, int32 last);
extern int MSG_InitAddArticleKeyToGroup(MSG_Pane *pane, MSG_NewsHost* host,
const char* groupName, void **parseState);
extern int MSG_AddArticleKeyToGroup(void *parse_state, int32 first);
extern int MSG_FinishAddArticleKeyToGroup(MSG_Pane *pane, void **parse_state);
/* After displaying a list of newsgroups, we need the NNTP module to go and
run "GROUP" commands for the ones for which we don't know the unread
article count. This function returns a count of how many groups we think
we're going to need this for (so we can display progress in a reasonable
way).
*/
extern int32 MSG_GetNewsRCCount(MSG_Pane* pane, MSG_NewsHost* host);
/* Gets the name of the next group that we want to get article counts for.
The caller must free the given name using XP_FREE().
MSG_DisplaySubscribedGroup() should get called with this group before
this call happens again. */
extern char* MSG_GetNewsRCGroup(MSG_Pane* pane, MSG_NewsHost* host);
/* In response to a "news://host/" URL; this is called once for each group
that was returned by MSG_GetNewsRCGroup(), after the NNTP GROUP command has
been run. It's also called whenever we actually visit the group (the user
clicks on the newsgroup line), in case the data has changed since the
initial passthrough. The "nowvisiting" parameter is TRUE in the latter
case, FALSE otherwise. */
extern int MSG_DisplaySubscribedGroup(MSG_Pane* pane,
MSG_NewsHost* host,
const char *group,
int32 oldest_message,
int32 youngest_message,
int32 total_messages,
XP_Bool nowvisiting);
/* In response to an NNTP GROUP command, the server said the group doesn't exist */
extern int MSG_GroupNotFound(MSG_Pane* pane,
MSG_NewsHost* host,
const char *group,
XP_Bool opening);
/* In response to a "news://host/?newgroups" URL, to ask the server for a
list of recently-added newsgroups. Similar to MSG_DisplaySubscribedGroup,
except that in this case, the group is not already in the list. */
extern int MSG_DisplayNewNewsGroup (MWContext *context,
MSG_NewsHost* host, const char *group_name,
int32 oldest_message,
int32 youngest_message);
/* News servers work better if you ask for message numbers instead of IDs.
So, the NNTP module asks us what the group and number of an ID is with
this. If we don't know, we return 0 for both. If the pane is not a
thead or message pane, this routine will fail.
*/
extern void MSG_NewsGroupAndNumberOfID (MSG_Pane *pane,
const char *message_id,
const char **group_return,
uint32 *message_number_return);
/* This routine is used by netlib to see if we have this article off-line
It might be combined with the above routine, but I'm not sure if this
is the way we're ultimately going to do this.
*/
extern XP_Bool MSG_IsOfflineArticle (MSG_Pane *pane,
const char *message_id,
const char **group_return,
uint32 *message_number_return);
extern int MSG_StartOfflineRetrieval(MSG_Pane *pane,
const char *group,
uint32 message_number,
void **offlineState);
extern int MSG_ProcessOfflineNews(void *offlineState, char *outputBuffer, int outputBufSize);
extern int MSG_InterruptOfflineNews(void *offlineState);
/* libnet callbacks for Dredd NNTP extensions */
extern void MSG_SupportsNewsExtensions (MSG_NewsHost *host, XP_Bool supports);
extern void MSG_AddNewsExtension (MSG_NewsHost *host, const char *ext);
extern XP_Bool MSG_QueryNewsExtension (MSG_NewsHost *host, const char *ext);
extern XP_Bool MSG_NeedsNewsExtension (MSG_NewsHost *host, const char *ext);
extern void MSG_AddSearchableGroup (MSG_NewsHost *host, const char *group);
extern void MSG_AddSearchableHeader (MSG_NewsHost *host, const char *header);
extern int MSG_AddProfileGroup (MSG_Pane *pane,
MSG_NewsHost* host,
const char *groupName);
extern int MSG_AddPrettyName(MSG_NewsHost* host,
const char *groupName, const char *prettyName);
extern int MSG_SetXActiveFlags(MSG_Pane *pane, char *groupName,
int32 firstPossibleArt,
int32 lastPossibleArt,
char *flags);
extern int MSG_AddSubscribedGroup (MSG_Pane *pane, const char *groupUrl);
extern void MSG_AddPropertyForGet (MSG_NewsHost *host, const char *property,
const char *value);
/* libnet calls this if it got an error 441 back from the newsserver. That
error almost certainly means that the newsserver already has a message
with the same message id. If this routine returns TRUE, then we were
pretty much expecting that error code, because we know we tried twice to
post the same message, and we can just ignore it. */
extern XP_Bool MSG_IsDuplicatePost(MSG_Pane* comppane);
/* libnet uses this on an error condition to tell libmsg to generate a new
message-id for the given composition. */
extern void MSG_ClearCompositionMessageID(MSG_Pane* comppane);
/* libnet uses this to determine the message-id for the given composition (so
it can test if this message was already posted.) */
extern const char* MSG_GetCompositionMessageID(MSG_Pane* comppane);
/* The "news:" and "mailbox:" protocol handlers call this when a message is
displayed, so that we can use the contents of the headers when composing
replies.
*/
extern void
MSG_ActivateReplyOptions(MSG_Pane* messagepane, MimeHeaders *headers);
/* Tell the subscribe pane about a new newsgroup we noticed. */
extern int
MSG_AddNewNewsGroup(MSG_Pane* pane, MSG_NewsHost* host,
const char* groupname, int32 oldest, int32 youngest,
const char *flag, XP_Bool bXactiveFlags);
/* tell the host info database that we're going to need to get the extra info
for this new newsgroup
*/
extern int MSG_SetGroupNeedsExtraInfo(MSG_NewsHost *host,
const char* groupname, XP_Bool needsExtra);
/* returns the name of the first group which needs extra info */
extern char *MSG_GetFirstGroupNeedingExtraInfo(MSG_NewsHost *host);
/* Find out from libmsg when we last checked for new newsgroups (so we know
what date to give the "newgroups" command.) */
extern time_t
MSG_NewsgroupsLastUpdatedTime(MSG_NewsHost* host);
/* The "mailbox:" protocol module uses these routines to invoke the mailbox
parser in libmsg.
*/
extern int MSG_BeginOpenFolderSock (MSG_Pane* pane,
const char *folder_name,
const char *message_id, int32 msgnum,
void **folder_ptr);
extern int MSG_FinishOpenFolderSock (MSG_Pane* pane,
const char *folder_name,
const char *message_id, int32 msgnum,
void **folder_ptr);
extern void MSG_CloseFolderSock (MSG_Pane* pane, const char *folder_name,
const char *message_id, int32 msgnum,
void *folder_ptr);
extern int MSG_OpenMessageSock (MSG_Pane* messagepane, const char *folder_name,
const char *msg_id, int32 msgnum,
void *folder_ptr, void **message_ptr,
int32 *content_length);
extern int MSG_ReadMessageSock (MSG_Pane* messagepane, const char *folder_name,
void *message_ptr, const char *message_id,
int32 msgnum, char *buffer, int32 buffer_size);
extern void MSG_CloseMessageSock (MSG_Pane* messagepane,
const char *folder_name,
const char *message_id, int32 msgnum,
void *message_ptr);
extern void MSG_PrepareToIncUIDL(MSG_Pane* messagepane, URL_Struct* url,
const char* uidl);
/* This is how "mailbox:?empty-trash" works
*/
extern int MSG_BeginEmptyTrash(MSG_Pane* folderpane, URL_Struct* url,
void** closure);
extern int MSG_FinishEmptyTrash(MSG_Pane* folderpane, URL_Struct* url,
void* closure);
extern int MSG_CloseEmptyTrashSock(MSG_Pane* folderpane, URL_Struct* url,
void* closure);
/* This is how "mailbox:?compress-folder" and
"mailbox:/foo/baz/nsmail/inbox?compress-folder" works. */
extern int MSG_BeginCompressFolder(MSG_Pane* pane, URL_Struct* url,
const char* foldername, void** closure);
extern int MSG_FinishCompressFolder(MSG_Pane* pane, URL_Struct* url,
const char* foldername, void* closure);
extern int MSG_CloseCompressFolderSock(MSG_Pane* pane, URL_Struct* url,
void* closure);
/* This is how "mailbox:?deliver-queued" works
*/
extern int MSG_BeginDeliverQueued(MSG_Pane* pane, URL_Struct* url,
void** closure);
extern int MSG_FinishDeliverQueued(MSG_Pane* pane, URL_Struct* url,
void* closure);
extern int MSG_CloseDeliverQueuedSock(MSG_Pane* pane, URL_Struct* url,
void* closure);
/* This is how "mailbox:?background" works */
extern int MSG_ProcessBackground(URL_Struct* urlstruct);
/* libnet --> libmsg glue for newsgroup searching */
extern void MSG_AddNewsXpatHit (MWContext *context, uint32 artNum);
extern void MSG_AddNewsSearchHit (MWContext *context, const char *resultLine);
/* libnet --> libmsg glue for imap mail folder searching */
extern void MSG_AddImapSearchHit (MWContext *context, const char *resultLine);
/* The POP3 protocol module uses these routines to hand us new messages.
*/
extern XP_Bool MSG_BeginMailDelivery (MSG_Pane* folderpane);
extern void MSG_AbortMailDelivery (MSG_Pane* folderpane);
extern void MSG_EndMailDelivery (MSG_Pane* folderpane);
extern void *MSG_IncorporateBegin (MSG_Pane* folderpane,
FO_Present_Types format_out,
char *pop3_uidl,
URL_Struct *url,
uint32 flags);
extern int MSG_IncorporateWrite (MSG_Pane* folderpane, void *closure,
const char *block, int32 length);
extern int MSG_IncorporateComplete(MSG_Pane* folderpane, void *closure);
extern int MSG_IncorporateAbort (MSG_Pane* folderpane, void *closure,
int status);
extern void MSG_ClearSenderAuthedFlag(MSG_Pane* folderpane, void *closure);
/* This is how the netlib registers the converters relevant to MIME message
display and composition.
*/
void MSG_RegisterConverters (void);
extern void
MSG_StartMessageDelivery (MSG_Pane *pane,
void *fe_data,
MSG_CompositionFields *fields,
XP_Bool digest_p,
XP_Bool dont_deliver_p,
const char *attachment1_type,
const char *attachment1_body,
uint32 attachment1_body_length,
const struct MSG_AttachmentData *attachments,
void *mimeRelatedPart, /* only used in compose pane */
void (*message_delivery_done_callback)
(MWContext *context,
void *fe_data,
int status,
const char *error_message));
/* When a message which has the `partial' bit set, meaning we only downloaded
the first 20 lines because it was huge, this function will be called to
return some HTML to tack onto the end of the message to explain that it
is truncated, and provide a clickable link which will download the whole
message.
*/
extern char *MSG_GeneratePartialMessageBlurb (MSG_Pane* messagepane,
URL_Struct *url, void *closure,
MimeHeaders *headers);
extern int MSG_GetUrlQueueSize (const char *url, MWContext *context);
extern XP_Bool MSG_RequestForReturnReceipt(MSG_Pane* pane);
extern XP_Bool MSG_SendingMDNInProgress(MSG_Pane* pane);
extern uint32 MSG_GetIMAPMessageSizeFromDB(MSG_Pane *masterPane, const char *hostName, char *folderName, char *id, XP_Bool idIsUid);
extern void MSG_RefreshFoldersForUpdatedIMAPHosts(MWContext *context);
extern XP_Bool MSG_MailCheck(MWContext *context, MSG_Prefs *prefs);
extern void MSG_Pop3MailCheck(MWContext *context);
extern int NET_parse_news_url (const char *url,
char **host_and_portP,
XP_Bool *securepP,
char **groupP,
char **message_idP,
char **command_specific_dataP);
extern char *MSG_GetArbitraryHeadersForHost(MSG_Master *master, const char *hostName);
XP_END_PROTOS
#endif

View File

@@ -0,0 +1,45 @@
/* -*- 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.
*/
/* msgtypes.h --- types for the mail/news reader module.
*/
#ifndef _MSGTYPES_H_
#define _MSGTYPES_H_
/* This file defines types that are used by libmsg. Actually, it's rather
underpopulated right now; much more should be moved here from msgcom.h. */
/* Instances of MSG_Pane are used to represent the various panes in the user
interfaces. The FolderPanes and MessagePanes must have a context associated
with them, but the ThreadPane generally does not. MSG_Pane is deliberately
an opaque type; FE's can't manipulate them except via the calls defined
here. */
#ifdef XP_CPLUSPLUS
class MSG_Pane;
#else
typedef struct MSG_Pane MSG_Pane;
#endif
#endif /* _MSGTYPES_H_ */

250
mozilla/include/ncompat.h Normal file
View File

@@ -0,0 +1,250 @@
/* -*- 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.
*/
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)compat.h 8.13 (Berkeley) 2/21/94
*/
#ifndef _COMPAT_H_
#define _COMPAT_H_
#include <sys/types.h>
/*
* If your system doesn't typedef u_long, u_short, or u_char, change
* the 0 to a 1.
*/
/*DSR041497 - these are defined in pmwsock.h, so only need for DOUGSOCK*/
#ifdef XP_OS2_DOUGSOCK
typedef unsigned char u_char; /* 4.[34]BSD names. */
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short u_short;
#endif
/* If your system doesn't typedef size_t, change the 0 to a 1. */
#if 0
typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */
#endif
/* If your system doesn't typedef ssize_t, change the 0 to a 1. */
#if 0
typedef int ssize_t; /* POSIX names. */
#endif
/*
* If your system doesn't have the POSIX type for a signal mask,
* change the 0 to a 1.
*/
#if 0 /* POSIX 1003.1 signal mask type. */
typedef unsigned int sigset_t;
#endif
/*
* If your system's vsprintf returns a char *, not an int,
* change the 0 to a 1.
*/
#if defined (__sun) && !defined(SVR4) /* SUNOS */
#define VSPRINTF_CHARSTAR
#endif
/*
* If you don't have POSIX 1003.1 signals, the signal code surrounding the
* temporary file creation is intended to block all of the possible signals
* long enough to create the file and unlink it. All of this stuff is
* intended to use old-style BSD calls to fake POSIX 1003.1 calls.
*/
#ifdef NO_POSIX_SIGNALS
#define sigemptyset(set) (*(set) = 0)
#define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
#define sigaddset(set,signo) (*(set) |= sigmask(signo), 0)
#define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0)
#define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0)
#define SIG_BLOCK 1
#define SIG_UNBLOCK 2
#define SIG_SETMASK 3
static int __sigtemp; /* For the use of sigprocmask */
/* Repeated test of oset != NULL is to avoid "*0". */
#define sigprocmask(how, set, oset) \
((__sigtemp = \
(((how) == SIG_BLOCK) ? \
sigblock(0) | *(set) : \
(((how) == SIG_UNBLOCK) ? \
sigblock(0) & ~(*(set)) : \
((how) == SIG_SETMASK ? \
*(set) : sigblock(0))))), \
((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \
sigsetmask(__sigtemp)), 0)
#endif
/*
* If your system doesn't have an include file with the appropriate
* byte order set, make sure you specify the correct one.
*/
#ifndef BYTE_ORDER
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define BYTE_ORDER BIG_ENDIAN /* Set for your system. */
#endif
#if defined(SYSV) || defined(SYSTEM5) || defined(__sun)
#define index(a, b) strchr(a, b)
#define rindex(a, b) strrchr(a, b)
#define bzero(a, b) memset(a, 0, b)
#define bcmp(a, b, n) memcmp(a, b, n)
#define bcopy(a, b, n) memmove(b, a, n)
#endif
#if defined(BSD) || defined(BSD4_3)
#define strchr(a, b) index(a, b)
#define strrchr(a, b) rindex(a, b)
#define memcmp(a, b, n) bcmp(a, b, n)
#define memmove(a, b, n) bcopy(b, a, n)
#endif
/*
* 32-bit machine. The db routines are theoretically independent of
* the size of u_shorts and u_longs, but I don't know that anyone has
* ever actually tried it. At a minimum, change the following #define's
* if you are trying to compile on a different type of system.
*/
#ifndef USHRT_MAX
#define USHRT_MAX 0xFFFF
#define ULONG_MAX 0xFFFFFFFF
#endif
#ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#endif
#ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */
#define _POSIX2_RE_DUP_MAX 255
#endif
/*
* If you can't provide lock values in the open(2) call. Note, this
* allows races to happen.
*/
#ifndef O_EXLOCK /* 4.4BSD extension. */
#define O_EXLOCK 0
#endif
#ifndef O_SHLOCK /* 4.4BSD extension. */
#define O_SHLOCK 0
#endif
#ifndef EFTYPE
#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
#endif
#ifndef WCOREDUMP /* 4.4BSD extension */
#define WCOREDUMP(a) 0
#endif
#ifndef STDERR_FILENO
#define STDIN_FILENO 0 /* ANSI C #defines */
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#endif
#ifndef SEEK_END
#define SEEK_SET 0 /* POSIX 1003.1 seek values */
#define SEEK_CUR 1
#define SEEK_END 2
#endif
#ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */
#define _POSIX_VDISABLE 0 /* Some systems used 0. */
#endif
#ifndef TCSASOFT /* 4.4BSD extension. */
#define TCSASOFT 0
#endif
#ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */
#define _POSIX2_RE_DUP_MAX 255
#endif
#ifndef NULL /* ANSI C #defines NULL everywhere. */
#define NULL 0
#endif
#ifndef MAX /* Usually found in <sys/param.h>. */
#define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
#endif
#ifndef MIN /* Usually found in <sys/param.h>. */
#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
#endif
/* Default file permissions. */
#ifndef DEFFILEMODE /* 4.4BSD extension. */
#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
#endif
#ifndef __sun
#ifndef S_ISDIR /* POSIX 1003.1 file type tests. */
#define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */
#define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */
#define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */
#define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */
#define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */
#endif
#ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */
#define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */
#define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */
#endif
#endif /* __sun */
/* The type of a va_list. */
#ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */
#define _BSD_VA_LIST_ char *
#endif
#endif /* !_COMPAT_H_ */

2103
mozilla/include/net.h Normal file

File diff suppressed because it is too large Load Diff

133
mozilla/include/np.h Normal file
View File

@@ -0,0 +1,133 @@
/* -*- Mode: C; tab-width: 8; 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.
*/
/*
* np.h $Revision: 3.1 $
* Prototypes for functions exported by libplugin and called by the FEs or other XP libs.
* Prototypes for functions exported by the FEs and called by libplugin are in nppg.h.
*/
#ifndef _NP_H
#define _NP_H
#include "lo_ele.h"
#include "npapi.h"
#include "net.h"
#ifdef XP_UNIX
/* Aaagh. npapi.h include Xlib.h. Bool is being #defined by Xlib and
we are typedeffing it in the navigator. */
#ifdef Bool
#undef Bool
#endif /* Bool */
#endif
typedef enum { NP_Untyped = 0, NP_OLE, NP_Plugin } NPAppType;
typedef enum { NP_FullPage = 1, NP_Embedded } NPPageType;
typedef void* NPReference;
#define NPRefFromStart ((NPReference)NULL)
/* it's lame that this is supposed to support more than plugins but
it has plugin specific junk (wdata) in it -jg */
struct _NPEmbeddedApp {
struct _NPEmbeddedApp *next;
NPAppType type;
void *fe_data;
void *np_data;
NPWindow *wdata;
NPPageType pagePluginType;
};
/* Uncomment this to enable ANTHRAX. .c files affected: npglue.c, layembed.c, layobj.c */
/* amusil 1.8.98 */
/* #define ANTHRAX */
XP_BEGIN_PROTOS
extern void NPL_Init(void);
extern void NPL_Shutdown(void);
extern void NPL_RegisterDefaultConverters(void);
extern NPError NPL_RegisterPluginFile(const char* pluginname, const char* filename,
const char* description, void* pd);
extern NPError NPL_RegisterPluginType(NPMIMEType type, const char *extentstring,
const char* description, void* fileType, void* pd, XP_Bool enabled);
extern NPError NPL_RefreshPluginList(XP_Bool reloadPages);
extern NPBool NPL_IteratePluginFiles(NPReference* ref, char** name, char** filename, char** description);
extern NPBool NPL_IteratePluginTypes(NPReference* ref, NPReference plugin, NPMIMEType* type,
char*** extents, char** description, void** fileType);
extern char** NPL_FindPluginsForType(const char* typeToFind);
extern char* NPL_FindPluginEnabledForType(const char* typeToFind);
extern NPError NPL_EnablePlugin(NPMIMEType type,
const char* pluginname,
XP_Bool enabled);
extern NPError NPL_EnablePluginType(NPMIMEType type, void* pdesc, XP_Bool enabled);
extern NPError NPL_DisablePlugin(NPMIMEType type);
extern NPEmbeddedApp* NPL_EmbedCreate(MWContext *context, LO_EmbedStruct *embed_struct);
extern NPError NPL_EmbedStart(MWContext* cx, LO_EmbedStruct* embed_struct, NPEmbeddedApp* app);
extern void NPL_EmbedSize(NPEmbeddedApp *app);
/* ~~av the following is used in CGenericDoc::FreeEmbedElement */
extern int32 NPL_GetEmbedReferenceCount(NPEmbeddedApp *app);
extern void NPL_EmbedDelete(MWContext *context, LO_EmbedStruct *embed_struct);
extern XP_Bool NPL_IsLiveConnected(LO_EmbedStruct *embed);
extern int NPL_HandleEvent(NPEmbeddedApp *app, void *event, void* window); /* window may be NULL */
extern void NPL_Print(NPEmbeddedApp *app, void *printData);
extern void NPL_SamePage(MWContext *context);
extern void NPL_SameElement(LO_EmbedStruct *embed);
extern void NPL_DeleteSessionData(MWContext* context, void* sessionData);
extern XP_Bool NPL_HandleURL(MWContext *pContext, FO_Present_Types iFormatOut, URL_Struct *pURL,
Net_GetUrlExitFunc *pExitFunc);
#ifndef XP_MAC
extern void NPL_DisplayPluginsAsHTML(FO_Present_Types format_out, URL_Struct *urls, MWContext *cx);
#endif
extern void NPL_PreparePrint(MWContext* context, SHIST_SavedData* savedData);
extern NET_StreamClass* NPL_NewEmbedStream(FO_Present_Types format_out, void *type, URL_Struct *urls, MWContext *cx);
extern NET_StreamClass* NPL_NewPresentStream(FO_Present_Types format_out, void *type, URL_Struct *urls, MWContext *cx);
extern unsigned int NPL_WriteReady(NET_StreamClass *stream);
extern int NPL_Write(NET_StreamClass *stream, const unsigned char *str, int32 len);
extern void NPL_Complete(NET_StreamClass *stream);
extern void NPL_Abort(NET_StreamClass *stream, int status);
extern XP_Bool NPL_IsEmbedWindowed(NPEmbeddedApp *app);
extern void NPL_URLExit(URL_Struct *urls, int status, MWContext *cx);
#ifdef ANTHRAX
extern char** NPL_FindAppletsForType(const char* typeToFind);
extern char* NPL_FindAppletEnabledForMimetype(const char* mimetype);
extern NPError NPL_RegisterAppletType(NPMIMEType type);
#endif /* ANTHRAX */
PR_EXTERN(void) NPL_SetPluginWindow(void *data);
XP_END_PROTOS
#endif /* _NP_H */

575
mozilla/include/npapi.h Normal file
View File

@@ -0,0 +1,575 @@
/* -*- 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.
*/
/*
* npapi.h $Revision: 3.1.10.1 $
* Netscape client plug-in API spec
*/
#ifndef _NPAPI_H_
#define _NPAPI_H_
#ifdef __OS2__
#pragma pack(1)
#endif
#if defined(JAVA)
#include "jri.h" /* Java Runtime Interface */
#endif
#if defined (__OS2__ ) || defined (OS2)
# ifndef XP_OS2
# define XP_OS2 1
# endif /* XP_OS2 */
#endif /* __OS2__ */
#ifdef _WINDOWS
# ifndef XP_WIN
# define XP_WIN 1
# endif /* XP_WIN */
#endif /* _WINDOWS */
#ifdef __MWERKS__
# define _declspec __declspec
# ifdef macintosh
# ifndef XP_MAC
# define XP_MAC 1
# endif /* XP_MAC */
# endif /* macintosh */
# ifdef __INTEL__
# undef NULL
# ifndef XP_WIN
# define XP_WIN 1
# endif /* __INTEL__ */
# endif /* XP_PC */
#endif /* __MWERKS__ */
#ifdef XP_MAC
#include <Quickdraw.h>
#include <Events.h>
#endif
#ifdef XP_UNIX
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
/*----------------------------------------------------------------------*/
/* Plugin Version Constants */
/*----------------------------------------------------------------------*/
#define NP_VERSION_MAJOR 0
#define NP_VERSION_MINOR 12
/* The OS/2 version of Netscape uses RC_DATA to define the
mime types, file extentions, etc that are required.
Use a vertical bar to seperate types, end types with \0.
FileVersion and ProductVersion are 32bit ints, all other
entries are strings the MUST be terminated wwith a \0.
AN EXAMPLE:
RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
RCDATA NP_INFO_MIMEType { "video/x-video|",
"video/x-flick\0" }
RCDATA NP_INFO_FileExtents { "avi|",
"flc\0" }
RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
"MMOS2 Flc/Fli player(*.flc)\0" }
RCDATA NP_INFO_FileVersion { 1,0,0,1 }
RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
RCDATA NP_INFO_InternalName { "NPAVI32\0" )
RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
*/
/* RC_DATA types for version info - required */
#define NP_INFO_ProductVersion 1
#define NP_INFO_MIMEType 2
#define NP_INFO_FileOpenName 3
#define NP_INFO_FileExtents 4
/* RC_DATA types for version info - used if found */
#define NP_INFO_FileDescription 5
#define NP_INFO_ProductName 6
/* RC_DATA types for version info - optional */
#define NP_INFO_CompanyName 7
#define NP_INFO_FileVersion 8
#define NP_INFO_InternalName 9
#define NP_INFO_LegalCopyright 10
#define NP_INFO_OriginalFilename 11
#ifndef RC_INVOKED
/*----------------------------------------------------------------------*/
/* Definition of Basic Types */
/*----------------------------------------------------------------------*/
#ifndef _UINT16
typedef unsigned short uint16;
#endif
#ifndef _UINT32
#if defined(__alpha)
typedef unsigned int uint32;
#else /* __alpha */
typedef unsigned long uint32;
#endif /* __alpha */
#endif
#ifndef _INT16
typedef short int16;
#endif
#ifndef _INT32
#if defined(__alpha)
typedef int int32;
#else /* __alpha */
typedef long int32;
#endif /* __alpha */
#endif
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (1)
#endif
#ifndef NULL
#define NULL (0L)
#endif
typedef unsigned char NPBool;
typedef int16 NPError;
typedef int16 NPReason;
typedef char* NPMIMEType;
/*----------------------------------------------------------------------*/
/* Structures and definitions */
/*----------------------------------------------------------------------*/
#ifdef XP_MAC
#pragma options align=mac68k
#endif
/*
* NPP is a plug-in's opaque instance handle
*/
typedef struct _NPP
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
} NPP_t;
typedef NPP_t* NPP;
typedef struct _NPStream
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
const char* url;
uint32 end;
uint32 lastmodified;
void* notifyData;
} NPStream;
typedef struct _NPByteRange
{
int32 offset; /* negative offset means from the end */
uint32 length;
struct _NPByteRange* next;
} NPByteRange;
typedef struct _NPSavedData
{
int32 len;
void* buf;
} NPSavedData;
typedef struct _NPRect
{
uint16 top;
uint16 left;
uint16 bottom;
uint16 right;
} NPRect;
typedef struct _NPSize
{
int32 width;
int32 height;
} NPSize;
#ifdef XP_UNIX
/*
* Unix specific structures and definitions
*/
/*
* Callback Structures.
*
* These are used to pass additional platform specific information.
*/
enum {
NP_SETWINDOW = 1,
NP_PRINT
};
typedef struct
{
int32 type;
} NPAnyCallbackStruct;
typedef struct
{
int32 type;
Display* display;
Visual* visual;
Colormap colormap;
unsigned int depth;
} NPSetWindowCallbackStruct;
typedef struct
{
int32 type;
FILE* fp;
} NPPrintCallbackStruct;
#endif /* XP_UNIX */
/*
* List of variable names for which NPP_GetValue shall be implemented
*/
typedef enum {
NPPVpluginNameString = 1,
NPPVpluginDescriptionString,
NPPVpluginWindowBool,
NPPVpluginTransparentBool,
NPPVjavaClass,
NPPVpluginWindowSize
} NPPVariable;
/*
* List of variable names for which NPN_GetValue is implemented by Mozilla
*/
typedef enum {
NPNVxDisplay = 1,
NPNVxtAppContext,
NPNVnetscapeWindow,
NPNVjavascriptEnabledBool,
NPNVasdEnabledBool,
NPNVisOfflineBool
} NPNVariable;
/*
* The type of a NPWindow - it specifies the type of the data structure
* returned in the window field.
*/
typedef enum {
NPWindowTypeWindow = 1,
NPWindowTypeDrawable
} NPWindowType;
typedef struct _NPWindow
{
void* window; /* Platform specific window handle */
/* OS/2: x - Position of bottom left corner */
/* OS/2: y - relative to visible netscape window */
uint32 x; /* Position of top left corner relative */
uint32 y; /* to a netscape page. */
uint32 width; /* Maximum window size */
uint32 height;
NPRect clipRect; /* Clipping rectangle in port coordinates */
/* Used by MAC only. */
#ifdef XP_UNIX
void * ws_info; /* Platform-dependent additonal data */
#endif /* XP_UNIX */
NPWindowType type; /* Is this a window or a drawable? */
} NPWindow;
typedef struct _NPFullPrint
{
NPBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */
/* printing */
NPBool printOne; /* TRUE if plugin should print one copy */
/* to default printer */
void* platformPrint; /* Platform-specific printing info */
} NPFullPrint;
typedef struct _NPEmbedPrint
{
NPWindow window;
void* platformPrint; /* Platform-specific printing info */
} NPEmbedPrint;
typedef struct _NPPrint
{
uint16 mode; /* NP_FULL or NP_EMBED */
union
{
NPFullPrint fullPrint; /* if mode is NP_FULL */
NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
} print;
} NPPrint;
#ifdef XP_MAC
typedef EventRecord NPEvent;
#elif defined(XP_WIN)
typedef struct _NPEvent
{
uint16 event;
uint32 wParam;
uint32 lParam;
} NPEvent;
#elif defined(XP_OS2)
typedef struct _NPEvent
{
uint32 event;
uint32 wParam;
uint32 lParam;
} NPEvent;
#elif defined (XP_UNIX)
typedef XEvent NPEvent;
#else
typedef void* NPEvent;
#endif /* XP_MAC */
#ifdef XP_MAC
typedef RgnHandle NPRegion;
#elif defined(XP_WIN)
typedef HRGN NPRegion;
#elif defined(XP_UNIX)
typedef Region NPRegion;
#else
typedef void *NPRegion;
#endif /* XP_MAC */
#ifdef XP_MAC
/*
* Mac-specific structures and definitions.
*/
typedef struct NP_Port
{
CGrafPtr port; /* Grafport */
int32 portx; /* position inside the topmost window */
int32 porty;
} NP_Port;
/*
* Non-standard event types that can be passed to HandleEvent
*/
#define getFocusEvent (osEvt + 16)
#define loseFocusEvent (osEvt + 17)
#define adjustCursorEvent (osEvt + 18)
#endif /* XP_MAC */
/*
* Values for mode passed to NPP_New:
*/
#define NP_EMBED 1
#define NP_FULL 2
/*
* Values for stream type passed to NPP_NewStream:
*/
#define NP_NORMAL 1
#define NP_SEEK 2
#define NP_ASFILE 3
#define NP_ASFILEONLY 4
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
#ifdef XP_MAC
#pragma options align=reset
#endif
/*----------------------------------------------------------------------*/
/* Error and Reason Code definitions */
/*----------------------------------------------------------------------*/
/*
* Values of type NPError:
*/
#define NPERR_BASE 0
#define NPERR_NO_ERROR (NPERR_BASE + 0)
#define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
#define NPERR_INVALID_PARAM (NPERR_BASE + 9)
#define NPERR_INVALID_URL (NPERR_BASE + 10)
#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
#define NPERR_NO_DATA (NPERR_BASE + 12)
#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
/*
* Values of type NPReason:
*/
#define NPRES_BASE 0
#define NPRES_DONE (NPRES_BASE + 0)
#define NPRES_NETWORK_ERR (NPRES_BASE + 1)
#define NPRES_USER_BREAK (NPRES_BASE + 2)
/*
* Don't use these obsolete error codes any more.
*/
#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
/*
* Version feature information
*/
#define NPVERS_HAS_STREAMOUTPUT 8
#define NPVERS_HAS_NOTIFICATION 9
#define NPVERS_HAS_LIVECONNECT 9
#define NPVERS_WIN16_HAS_LIVECONNECT 9
#define NPVERS_68K_HAS_LIVECONNECT 11
#define NPVERS_HAS_WINDOWLESS 11
/*----------------------------------------------------------------------*/
/* Function Prototypes */
/*----------------------------------------------------------------------*/
#if defined(_WINDOWS) && !defined(WIN32)
#define NP_LOADDS _loadds
#else
#if defined(__OS2__)
#define NP_LOADDS _System
#else
#define NP_LOADDS
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* NPP_* functions are provided by the plugin and called by the navigator.
*/
#ifdef XP_UNIX
char* NPP_GetMIMEDescription(void);
#endif /* XP_UNIX */
NPError NP_LOADDS NPP_Initialize(void);
void NP_LOADDS NPP_Shutdown(void);
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc, char* argn[],
char* argv[], NPSavedData* saved);
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
NPStream* stream, NPBool seekable,
uint16* stype);
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
int32 len, void* buffer);
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
const char* fname);
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
NPReason reason, void* notifyData);
#if defined(JAVA)
jref NP_LOADDS NPP_GetJavaClass(void);
#endif
NPError NP_LOADDS NPP_GetValue(void *instance, NPPVariable variable,
void *value);
NPError NP_LOADDS NPP_SetValue(void *instance, NPNVariable variable,
void *value);
/*
* NPN_* functions are provided by the navigator and called by the plugin.
*/
void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
int* netscape_major, int* netscape_minor);
NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
const char* target, void* notifyData);
NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
const char* target);
NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
const char* target, uint32 len,
const char* buf, NPBool file,
void* notifyData);
NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
const char* target, uint32 len,
const char* buf, NPBool file);
NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
const char* target, NPStream** stream);
int32 NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32 len,
void* buffer);
NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
void NP_LOADDS NPN_Status(NPP instance, const char* message);
const char* NP_LOADDS NPN_UserAgent(NPP instance);
void* NP_LOADDS NPN_MemAlloc(uint32 size);
void NP_LOADDS NPN_MemFree(void* ptr);
uint32 NP_LOADDS NPN_MemFlush(uint32 size);
void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
#if defined(JAVA)
JRIEnv* NP_LOADDS NPN_GetJavaEnv(void);
jref NP_LOADDS NPN_GetJavaPeer(NPP instance);
#endif
NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
void *value);
NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
void *value);
void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
void NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
void NP_LOADDS NPN_ForceRedraw(NPP instance);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* RC_INVOKED */
#ifdef __OS2__
#pragma pack()
#endif
#endif /* _NPAPI_H_ */

52
mozilla/include/npassoc.h Normal file
View File

@@ -0,0 +1,52 @@
/* -*- 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.
*/
/*
* npassoc.h $Revision: 3.1 $
* xp filetype associations
*/
#ifndef _NPASSOC_H
#define _NPASSOC_H
#include "xp_core.h"
typedef struct _NPFileTypeAssoc {
char* type; /* a MIME type */
char* description; /* Intelligible description */
char** extentlist; /* a NULL-terminated list of file extensions */
char* extentstring; /* the same extensions, as a single string */
void* fileType; /* platform-specific file selector magic */
struct _NPFileTypeAssoc* pNext;
} NPFileTypeAssoc;
XP_BEGIN_PROTOS
extern NPFileTypeAssoc* NPL_NewFileAssociation(const char *type, const char *extensions,
const char *description, void *fileType);
extern void* NPL_DeleteFileAssociation(NPFileTypeAssoc *fassoc);
extern void NPL_RegisterFileAssociation(NPFileTypeAssoc *fassoc);
extern NPFileTypeAssoc* NPL_RemoveFileAssociation(NPFileTypeAssoc *fassoc);
extern NPFileTypeAssoc* NPL_GetFileAssociation(const char *type);
XP_END_PROTOS
#endif /* _NPASSOC_H */

19
mozilla/include/nsldap.h Normal file
View File

@@ -0,0 +1,19 @@
/* -*- 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.
*/
/* blank ldap header just to satisfy MSVC dependency generator */

54
mozilla/include/nslocks.h Normal file
View File

@@ -0,0 +1,54 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nspr_locks_h___
#define nspr_locks_h___
/* many people in libnet [mkautocf.c ...] (and possibly others) get
* NSPR20 for free by including nslocks.h. To minimize changes during
* the javaectomy effort, we are including this file (where previously
* it was only included if java was included.
*/
#include "prmon.h"
#ifdef NSPR20
#ifdef XP_MAC
#include "prpriv.h" /* for MonitorEntryCount */
#else
#include "private/prpriv.h"
#endif
#endif /* NSPR20 */
#if defined(JAVA)
XP_BEGIN_PROTOS
extern PRMonitor* libnet_asyncIO;
XP_END_PROTOS
#define LIBNET_LOCK() PR_EnterMonitor(libnet_asyncIO)
#define LIBNET_UNLOCK() PR_ExitMonitor(libnet_asyncIO)
#define LIBNET_IS_LOCKED() PR_InMonitor(libnet_asyncIO)
#else /* !JAVA */
#define LIBNET_LOCK()
#define LIBNET_UNLOCK()
#define LIBNET_IS_LOCKED() 1
#endif /* JAVA */
#endif /* nspr_locks_h___ */

120
mozilla/include/ntos.h Normal file
View File

@@ -0,0 +1,120 @@
/* -*- 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.
*/
/**********************************************************************
* ntOS.h - functionality used bt NT Operating System
*
**********************************************************************/
#ifndef _ntos_h
#define _ntos_h
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
/* prototypes for info.c */
typedef enum {
OS_WIN95,
OS_WINNT,
OS_WIN32S,
OS_UNKNOWN
} OS_TYPE;
typedef enum {
PROCESSOR_I386,
PROCESSOR_ALPHA,
PROCESSOR_MIPS,
PROCESSOR_PPC,
PROCESSOR_UNKNOWN
} PROCESSOR_TYPE;
OS_TYPE INFO_GetOperatingSystem ();
DWORD INFO_GetOperatingSystemMajorVersion ();
DWORD INFO_GetOperatingSystemMinorVersion ();
void OS_GetComputerName (LPTSTR computerName, int nComputerNameLength );
PROCESSOR_TYPE OS_GetProcessor ();
/* prototypes for path.c */
DWORD WINAPI PATH_RemoveRelative ( char * path );
DWORD WINAPI PATH_ConvertNtSlashesToUnix( LPCTSTR lpszNtPath, LPSTR lpszUnixPath );
/* prototypes for registry.c */
BOOL REG_CheckIfKeyExists( HKEY hKey, LPCTSTR registryKey );
BOOL REG_CreateKey( HKEY hKey, LPCTSTR registryKey );
BOOL REG_DeleteKey( HKEY hKey, LPCTSTR registryKey );
BOOL
REG_GetRegistryParameter(
HKEY hKey,
LPCTSTR registryKey,
LPTSTR QueryValueName,
LPDWORD ValueType,
LPBYTE ValueBuffer,
LPDWORD ValueBufferSize
);
BOOL
REG_SetRegistryParameter(
HKEY hKey,
LPCTSTR registryKey,
LPTSTR valueName,
DWORD valueType,
LPCTSTR ValueString,
DWORD valueStringLength
);
BOOL
REG_GetSubKeysInfo(
HKEY hKey,
LPCTSTR registryKey,
LPDWORD lpdwNumberOfSubKeys,
LPDWORD lpdwMaxSubKeyLength
);
BOOL
REG_GetSubKey( HKEY hKey,
LPCTSTR registryKey,
DWORD nSubKeyIndex,
LPTSTR registrySubKeyBuffer,
DWORD subKeyBufferSize
);
/* prototypes for service.c */
#define SERVRET_ERROR 0
#define SERVRET_INSTALLED 1
#define SERVRET_STARTING 2
#define SERVRET_STARTED 3
#define SERVRET_STOPPING 4
#define SERVRET_REMOVED 5
DWORD SERVICE_GetNTServiceStatus(LPCTSTR serviceName, LPDWORD lpLastError );
DWORD SERVICE_InstallNTService(LPCTSTR serviceName, LPCTSTR serviceExe );
DWORD SERVICE_RemoveNTService(LPCTSTR serviceName);
DWORD SERVICE_StartNTService(LPCTSTR serviceName);
DWORD SERVICE_StopNTService(LPCTSTR serviceName);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

201
mozilla/include/ntypes.h Normal file
View File

@@ -0,0 +1,201 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _NetscapeTypes_
#define _NetscapeTypes_
#include "xp_core.h"
/*
netlib
*/
typedef int FO_Present_Types;
typedef struct URL_Struct_ URL_Struct;
typedef struct _NET_StreamClass NET_StreamClass;
/*
* libi18n
*/
typedef struct OpaqueCCCDataObject *CCCDataObject;
typedef struct OpaqueINTL_CharSetInfo *INTL_CharSetInfo;
/* How to refill when there's a cache miss */
typedef enum NET_ReloadMethod
{
NET_DONT_RELOAD, /* use the cache */
NET_RESIZE_RELOAD, /* use the cache -- special for resizing */
NET_NORMAL_RELOAD, /* use IMS gets for reload */
NET_SUPER_RELOAD, /* retransfer everything */
NET_CACHE_ONLY_RELOAD /* Don't do anything if we miss in the cache.
(For the image library) */
} NET_ReloadMethod;
/*
plugins
*/
typedef struct _NPEmbeddedApp NPEmbeddedApp;
/*
history
*/
typedef struct _History_entry History_entry;
typedef struct History_ History;
/*
bookmarks (so shist.h doesn't have to include all of bkmks.h.)
Note, BM_Entry_struct is defined in bkmks.c. Not good practice
since this hides dependency info about the struct i.e., if you
change the struct, clients of the struct in other source files
will not indirectly recompile.
*/
typedef struct BM_Entry_struct BM_Entry;
/*
parser
*/
typedef struct _PA_Functions PA_Functions;
typedef struct PA_Tag_struct PA_Tag;
/*
layout
*/
typedef union LO_Element_struct LO_Element;
typedef struct LO_AnchorData_struct LO_AnchorData;
typedef struct LO_Color_struct LO_Color;
typedef struct LO_TextAttr_struct LO_TextAttr;
typedef struct LO_TextInfo_struct LO_TextInfo;
typedef struct LO_TextStruct_struct LO_TextStruct;
typedef struct LO_ImageAttr_struct LO_ImageAttr;
typedef struct LO_ImageStruct_struct LO_ImageStruct;
typedef struct LO_SubDocStruct_struct LO_SubDocStruct;
typedef struct LO_EmbedStruct_struct LO_EmbedStruct;
typedef struct LO_JavaAppStruct_struct LO_JavaAppStruct;
typedef struct LO_EdgeStruct_struct LO_EdgeStruct;
typedef struct LO_ObjectStruct_struct LO_ObjectStruct;
typedef union LO_FormElementData_struct LO_FormElementData;
typedef struct lo_FormElementOptionData_struct lo_FormElementOptionData;
typedef struct lo_FormElementSelectData_struct lo_FormElementSelectData;
typedef struct lo_FormElementTextData_struct lo_FormElementTextData;
typedef struct lo_FormElementTextareaData_struct lo_FormElementTextareaData;
typedef struct lo_FormElementMinimalData_struct lo_FormElementMinimalData;
typedef struct lo_FormElementToggleData_struct lo_FormElementToggleData;
typedef struct lo_FormElementObjectData_struct lo_FormElementObjectData;
typedef struct lo_FormElementKeygenData_struct lo_FormElementKeygenData;
typedef struct LO_Any_struct LO_Any;
typedef struct LO_FormSubmitData_struct LO_FormSubmitData;
typedef struct LO_FormElementStruct_struct LO_FormElementStruct;
typedef struct LO_LinefeedStruct_struct LO_LinefeedStruct;
typedef struct LO_HorizRuleStruct_struct LO_HorizRuleStruct;
typedef struct LO_BulletStruct_struct LO_BulletStruct;
/* was misspelled as LO_BullettStruct */
#define LO_BullettStruct LO_BulletStruct
typedef struct LO_TableStruct_struct LO_TableStruct;
typedef struct LO_CellStruct_struct LO_CellStruct;
typedef struct LO_Position_struct LO_Position;
typedef struct LO_Selection_struct LO_Selection;
typedef struct LO_HitLineResult_struct LO_HitLineResult;
typedef struct LO_HitElementResult_struct LO_HitElementResult;
typedef union LO_HitResult_struct LO_HitResult;
/* Line style parameter for displaying borders */
typedef enum {
LO_SOLID,
LO_DASH,
LO_BEVEL
} LO_LineStyle;
/*#ifndef NO_TAB_NAVIGATION */
typedef struct LO_tabFocus_struct LO_TabFocusData;
/* NO_TAB_NAVIGATION */
/*
XLation
*/
typedef struct PrintInfo_ PrintInfo;
typedef struct PrintSetup_ PrintSetup;
/*
mother of data structures
*/
typedef struct MWContext_ MWContext;
/*
Chrome structure
*/
typedef struct _Chrome Chrome;
/*
Editor
*/
#include "edttypes.h"
typedef enum
{
MWContextAny = -1, /* Used as a noopt when searching for a context of a particular type */
MWContextBrowser, /* A web browser window */
MWContextMail, /* A mail reader window */
MWContextNews, /* A news reader window */
MWContextMailMsg, /* A window to display a mail msg */
MWContextNewsMsg, /* A window to display a news msg */
MWContextMessageComposition, /* A news-or-mail message editing window */
MWContextSaveToDisk, /* The placeholder window for a download */
MWContextText, /* non-window context for text conversion */
MWContextPostScript, /* non-window context for PS conversion */
MWContextBiff, /* non-window context for background mail
notification */
MWContextJava, /* non-window context for Java */
MWContextBookmarks, /* Context for the bookmarks */
MWContextAddressBook, /* Context for the addressbook */
MWContextOleNetwork, /* non-window context for the OLE network1 object */
MWContextPrint, /* non-window context for printing */
MWContextDialog, /* non-browsing dialogs. view-source/security */
MWContextMetaFile, /* non-window context for Windows metafile support */
MWContextEditor, /* An Editor Window */
MWContextSearch, /* a window for modeless search dialog */
MWContextSearchLdap, /* a window for modeless LDAP search dialog */
MWContextHTMLHelp, /* HTML Help context to load map files */
MWContextMailFilters, /* Mail filters context */
MWContextHistory, /* A history window */
MWContextMailNewsProgress, /* a progress pane for mail/news URLs */
MWContextPane, /* Misc browser pane/window in weird parts of
* the UI, such as the navigation center */
MWContextRDFSlave, /* Slave context for RDF network loads */
MWContextProgressModule, /* Progress module (PW_ functions) */
MWContextIcon /* Context for loading images as icons */
} MWContextType;
#define MAIL_NEWS_TYPE(x) ( \
((x) == MWContextMail) || \
((x) == MWContextNews) || \
((x) == MWContextMailMsg) || \
((x) == MWContextNewsMsg) )
struct LJAppletData;
#endif /* _NetscapeTypes_ */

73
mozilla/include/os2file.h Normal file
View File

@@ -0,0 +1,73 @@
/* -*- 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.
*/
/* ---------------------------------------------------------------------------
Stuff to fake unix file I/O on os2 boxes
------------------------------------------------------------------------*/
#ifndef OS2FILE_H
#define OS2FILE_H
#if defined(XP_OS2)
/* 32-bit stuff here */
#define INCL_DOSPROCESS
#define INCL_DOS
#define INCL_DOSERRORS
#define INCL_DOSFILEMGR
#define INCL_DOSMODULEMGR
#define INCL_PM
#define INCL_WIN
#define INCL_WINATOM
#define INCL_GPI
#define TID OS2TID /* global rename in OS2 H's! */
#include <os2.h>
#undef TID /* and restore */
/*DAK these are empty.. #include <windef.h> */
/*DAK these are empty.. #include <winbase.h>*/
#include <stdlib.h>
#include <sys\types.h>
#include <sys\stat.h>
#include "dirent.h"
/*DSR020697 - now using dirent.h for DIR...*/
#define _ST_FSTYPSZ 16
typedef unsigned long mode_t;
typedef long uid_t;
typedef long gid_t;
#ifndef XP_OS2
typedef long off_t;
#endif
typedef unsigned long nlink_t;
typedef struct timestruc {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
} timestruc_t;
/*DSR020697 - now using dirent.h for dirent, S_ISDIR...*/
#endif /* XP_OS2 */
#define CONST const
#endif /* OS2FILE_H */

68
mozilla/include/os2sock.h Normal file
View File

@@ -0,0 +1,68 @@
/* -*- 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.
*/
/* New file created by IBM-VPB050196 */
#ifndef _OS2SOCK_H
#define _OS2SOCK_H
#if !defined(RC_INVOKED)
#include "mcom_db.h"
#endif
/*DSR050297 - this is based on types.h in the TCP/IP headers... */
/*I'm not including types.h because that causes all sorts of damage... */
#define MAXHOSTNAMELEN 120
#if defined(XP_OS2_DOUGSOCK)
#ifndef BSD_SELECT
#error you need BSD_SELECT defined in your command line for all files
#endif
#include <nerrno.h>
#include <sys\socket.h>
#include <sys\select.h>
#include <sys\time.h>
#include <sys\ioctl.h>
#include <netdb.h>
#include <utils.h>
#else
/*DSR072196 - replaced many files with pmwsock.h...*/
#include <pmwsock.h>
#ifndef IP_MULTICAST_IF
#define IP_MULTICAST_IF 2 /* set/get IP multicast interface*/
#define IP_MULTICAST_TTL 3 /* set/get IP multicast timetolive*/
#define IP_MULTICAST_LOOP 4 /* set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 5 /* add an IP group membership */
#define IP_DROP_MEMBERSHIP 6 /* drop an IP group membership */
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf*/
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
*/
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
#endif
#endif
#endif

66
mozilla/include/pics.h Normal file
View File

@@ -0,0 +1,66 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef PICS_H
#define PICS_H
typedef struct {
char *service;
XP_Bool generic;
char *fur; /* means 'for' */
XP_List *ratings;
} PICS_RatingsStruct;
typedef struct {
char *name;
double value;
} PICS_RatingValue;
typedef enum {
PICS_RATINGS_PASSED,
PICS_RATINGS_FAILED,
PICS_NO_RATINGS
} PICS_PassFailReturnVal;
void PICS_FreeRatingsStruct(PICS_RatingsStruct *rs);
/* return NULL or ratings struct */
PICS_RatingsStruct * PICS_ParsePICSLable(char * label);
/* returns TRUE if page should be censored
* FALSE if page is allowed to be shown
*/
PICS_PassFailReturnVal PICS_CompareToUserSettings(PICS_RatingsStruct *rs, char *cur_page_url);
XP_Bool PICS_IsPICSEnabledByUser(void);
XP_Bool PICS_AreRatingsRequired(void);
/* returns a URL string from a RatingsStruct
* that includes the service URL and rating info
*/
char * PICS_RStoURL(PICS_RatingsStruct *rs, char *cur_page_url);
void PICS_Init(MWContext *context);
XP_Bool PICS_CanUserEnableAdditionalJavaCapabilities(void);
XP_Bool PICS_CheckForValidTreeRating(char *url_address);
#endif /* PICS_H */

View File

@@ -0,0 +1,26 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* Prefetching H file */
#ifndef PREFETCH_H
#define PREFETCH_H
extern void PRE_AddToList(MWContext* context, char* url, double value);
extern void PRE_Fetch(MWContext* context);
extern void PRE_Enable(XP_Bool enabled);
#endif /* PREFETCH_H */

420
mozilla/include/proto.h Normal file
View File

@@ -0,0 +1,420 @@
/* -*- Mode: C; tab-width: 8; 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 should contain prototypes of all public functions for all
modules in the client library.
This file will be included automatically when source includes "client.h".
By the time this file is included, all global typedefs have been executed.
*/
/* make sure we only include this once */
#ifndef _PROTO_H_
#define _PROTO_H_
#include "ntypes.h"
#include "lo_ele.h"
#ifndef NSPR20
#if defined(__sun)
# include "sunos4.h"
#endif /* __sun */
#endif /* NSPR20 */
XP_BEGIN_PROTOS
/* put your prototypes here..... */
/* --------------------------------------------------------------------------
* Parser stuff
*/
extern intn PA_ParserInit(PA_Functions *);
extern NET_StreamClass *PA_BeginParseMDL(FO_Present_Types, void *,
URL_Struct *, MWContext *);
extern intn PA_ParseBlock(NET_StreamClass *, const char *, int);
extern void PA_MDLComplete(NET_StreamClass *);
extern void PA_MDLAbort(NET_StreamClass *, int);
extern Bool PA_HasMocha(PA_Tag *tag);
extern PA_Tag * PA_CloneMDLTag(PA_Tag * src);
extern intn PA_ParseStringToTags(MWContext *, char *, int32, void *);
extern const char *PA_TagString(int32);
extern int32 PA_TagIndex(char *);
/* --------------------------------------------------------------------------
* Layout stuff
*/
/*#ifndef NO_TAB_NAVIGATION */
extern Bool LO_isTabableElement(MWContext *context, LO_TabFocusData *pCurrentFocus );
extern Bool LO_isTabableFormElement( LO_FormElementStruct * next_ele );
extern Bool LO_isFormElementNeedTextTabFocus( LO_FormElementStruct *pElement );
extern LO_Element * LO_getFirstLastElement(MWContext *context, int wantFirst );
extern Bool LO_getNextTabableElement( MWContext *context, LO_TabFocusData *currentFocus, int forward );
/* NO_TAB_NAVIGATION */
extern LO_FormElementStruct *
LO_ReturnNextFormElement(MWContext *context,
LO_FormElementStruct *current_element);
extern LO_FormElementStruct *
LO_ReturnPrevFormElement(MWContext *context,
LO_FormElementStruct *current_element);
/* NO_TAB_NAVIGATION,
LO_ReturnNextFormElementInTabGroup() is used to tab through form elements.
Since the winfe now has TAB_NAVIGATION, it is not used any more.
If mac and Unix don't use it either, it can be removed.
*/
extern LO_FormElementStruct *
LO_ReturnNextFormElementInTabGroup(MWContext *context,
LO_FormElementStruct *current_element,
XP_Bool go_backwards);
extern intn LO_ProcessTag(void *, PA_Tag *, intn);
extern void LO_RefreshArea(MWContext *context, int32 left, int32 top,
uint32 width, uint32 height);
extern Bool LO_CheckForUnload(MWContext *context);
#ifdef LAYERS
extern void LO_MoveLayer(CL_Layer *layer, int32 x, int32 y);
extern int32 LO_GetLayerXOffset(CL_Layer *layer);
extern int32 LO_GetLayerYOffset(CL_Layer *layer);
extern int32 LO_GetLayerWrapWidth(CL_Layer *layer);
extern int32 LO_GetLayerScrollWidth(CL_Layer *layer);
extern int32 LO_GetLayerScrollHeight(CL_Layer *layer);
extern void LO_SetLayerScrollWidth(CL_Layer *layer, uint32 width);
extern void LO_SetLayerScrollHeight(CL_Layer *layer, uint32 height);
extern void LO_SetLayerBbox(CL_Layer *layer, XP_Rect *bbox);
extern void LO_SetLayerBgColor(CL_Layer *layer, LO_Color *color);
extern LO_Color * LO_GetLayerBgColor(CL_Layer *layer);
extern void LO_SetLayerBackdropURL(CL_Layer *layer, const char *url);
extern const char *LO_GetLayerBackdropURL(CL_Layer *layer);
extern LO_ImageStruct *LO_GetLayerBackdropImage(CL_Layer *layer);
extern void LO_SetImageURL(MWContext *context, IL_GroupContext *mocha_img_cx,
LO_ImageStruct *image, const char *url,
NET_ReloadMethod reload_policy);
extern void LO_SetDocBgColor(MWContext *context, LO_Color *rgb);
extern void
lo_SetLayerClipExpansionPolicy(CL_Layer *layer, int policy);
extern int
lo_GetLayerClipExpansionPolicy(CL_Layer *layer);
#ifdef JAVA
/* Java Applet layer code */
extern void LO_SetJavaAppTransparent(LO_JavaAppStruct *javaData);
#endif
extern void LO_SetEmbedType(LO_EmbedStruct *embed, PRBool is_windowed);
extern void LO_SetEmbedSize( MWContext *context, LO_EmbedStruct *embed, int32 width, int32 height );
#ifdef JAVA
extern void LO_SetJavaAppTransparent(LO_JavaAppStruct *javaData);
#endif
extern void *LO_GetLayerMochaObjectFromId(MWContext *context, int32 layer_id);
extern void *LO_GetLayerMochaObjectFromLayer(MWContext *context,
CL_Layer *layer);
extern void LO_SetLayerMochaObject(MWContext *context, int32 layer_id,
void *mocha_object);
extern CL_Layer *LO_GetLayerFromId(MWContext *context, int32 layer_id);
extern int32 LO_GetIdFromLayer(MWContext *context, CL_Layer *layer);
extern int32 LO_GetNumberOfLayers(MWContext *context);
#endif
extern NET_ReloadMethod LO_GetReloadMethod(MWContext *context);
#ifdef LAYERS
extern LO_Element *LO_XYToElement(MWContext *, int32, int32, CL_Layer *);
extern LO_Element *LO_XYToNearestElement(MWContext *, int32, int32,
CL_Layer *);
#else
extern LO_Element *LO_XYToElement(MWContext *, int32, int32);
extern LO_Element *LO_XYToNearestElement(MWContext *, int32, int32);
#endif /* LAYERS */
extern void LO_MoveGridEdge(MWContext *context, LO_EdgeStruct *edge,
int32 x, int32 y);
extern void LO_SetImageInfo(MWContext *context, int32 ele_id,
int32 width, int32 height);
extern void LO_SetForceLoadImage(char *url, XP_Bool all_images);
extern void LO_SetUserOverride(Bool override);
extern void LO_SetDefaultBackdrop(char *url);
extern void LO_SetDefaultColor(intn type, uint8 red, uint8 green, uint8 blue);
extern Bool LO_ParseRGB(char *rgb, uint8 *red, uint8 *green, uint8 *blue);
extern Bool LO_ParseStyleSheetRGB(char *rgb, uint8 *red, uint8 *green, uint8 *blue);
extern void LO_ClearBackdropBlock(MWContext *context,
LO_ImageStruct *image, Bool fg_ok);
extern void LO_ClearEmbedBlock(MWContext *context, LO_EmbedStruct *embed);
extern Bool LO_BlockedOnImage(MWContext *, LO_ImageStruct *image);
extern void LO_CloseAllTags(MWContext *);
extern void LO_DiscardDocument(MWContext *);
extern LO_FormSubmitData *LO_SubmitForm(MWContext *context,
LO_FormElementStruct *form_element);
extern LO_FormSubmitData *LO_SubmitImageForm(MWContext *context,
LO_ImageStruct *image, int32 x, int32 y);
extern void LO_ResetForm(MWContext *context,
LO_FormElementStruct *form_element);
extern LO_FormElementStruct *
LO_FormRadioSet(MWContext *context, LO_FormElementStruct *form_element);
extern void LO_SaveFormData(MWContext *context);
extern void LO_CloneFormData(SHIST_SavedData *, MWContext *context,
URL_Struct *url_struct);
extern void LO_HighlightAnchor(MWContext *context, LO_Element *element,Bool on);
#ifdef OLD_POS_HIST
extern void LO_SetDocumentPosition(MWContext *context, int32 x, int32 y);
#endif /* OLD_POS_HIST */
extern void LO_SetDocumentDimensions(MWContext *context,
int32 width, int32 height);
#ifdef LAYERS
extern void LO_StartSelection(MWContext *context, int32 x, int32 y,
CL_Layer *layer);
#else
extern void LO_StartSelection(MWContext *context, int32 x, int32 y);
#endif /* LAYERS */
typedef enum {
SMALL_BM_ICON,
LARGE_BM_ICON
} BMIconType;
extern char * LO_GetBookmarkIconURLForPage(MWContext *context, BMIconType type);
/* Re-layout layout elements on resize without destroying them and reloading page
from scratch */
extern void LO_RelayoutOnResize(MWContext *context, int32 width, int32 height, int32 leftMargin, int32 topMargin);
/* Re-layout layout elements when one changes size. */
extern void LO_RelayoutFromElement(MWContext *context, LO_Element *element);
extern void LO_ExtendSelection(MWContext *context, int32 x, int32 y);
extern void LO_EndSelection(MWContext *context);
extern void LO_ClearSelection(MWContext *context);
extern XP_Block LO_GetSelectionText(MWContext *context);
extern Bool LO_FindText(MWContext *context, char *text,
LO_Element **start_ele_loc, int32 *start_position,
LO_Element **end_ele_loc, int32 *end_position,
Bool use_case, Bool forward);
extern Bool LO_FindGridText(MWContext *context, MWContext **ret_context,
char *text,
LO_Element **start_ele_loc, int32 *start_position,
LO_Element **end_ele_loc, int32 *end_position,
Bool use_case, Bool forward);
extern Bool LO_SelectAll(MWContext *context);
extern void LO_SelectText(MWContext *context, LO_Element *start,int32 start_pos,
LO_Element *end, int32 end_pos, int32 *x, int32 *y);
extern void LO_RefreshAnchors(MWContext *context);
extern Bool LO_HaveSelection(MWContext *context);
extern void LO_GetSelectionEndpoints(MWContext *context,
LO_Element **start, LO_Element **end, int32 *start_pos, int32 *end_pos, CL_Layer **sel_layer);
extern void LO_FreeSubmitData(LO_FormSubmitData *submit_data);
extern void LO_FreeDocumentFormListData(MWContext *context, void *form_data);
extern void LO_FreeDocumentEmbedListData(MWContext *context, void *embed_data);
extern void LO_FreeDocumentGridData(MWContext *context, void *grid_data);
extern void LO_FreeDocumentAppletData(MWContext *context, void *applet_data);
extern void LO_RedoFormElements(MWContext *context);
extern void LO_InvalidateFontData(MWContext *context);
extern void LO_GetDocumentMargins(MWContext *context,
int32 *margin_width, int32 *margin_height);
extern Bool LO_HasBGImage(MWContext *context);
extern Bool LO_LocateNamedAnchor(MWContext *context, URL_Struct *url_struct,
int32 *xpos, int32 *ypos);
extern int32 LO_EmptyRecyclingBin(MWContext *context);
extern LO_AnchorData *LO_MapXYToAreaAnchor(MWContext *context,
LO_ImageStruct *image, int32 x, int32 y);
extern intn LO_DocumentInfo(MWContext *context, NET_StreamClass *stream);
extern intn LO_ChangeFontSize(intn size, char *size_str);
extern double LO_GetScalingFactor(int32 scaler);
extern int16 LO_WindowWidthInFixedChars(MWContext *context);
extern void LO_CleanupGridHistory(MWContext *context);
extern void LO_UpdateGridHistory(MWContext *context);
extern Bool LO_BackInGrid(MWContext *context);
extern Bool LO_ForwardInGrid(MWContext *context);
extern Bool LO_GridCanGoForward(MWContext *context);
extern Bool LO_GridCanGoBackward(MWContext *context);
#ifdef LAYERS
extern Bool LO_Click( MWContext *context, int32 x, int32 y,
Bool requireCaret, CL_Layer *layer );
extern void LO_Hit(MWContext *context, int32 x, int32 y,
Bool requireCaret, LO_HitResult *result, CL_Layer *layer);
#else
extern Bool LO_Click( MWContext *context, int32 x, int32 y, Bool requireCaret );
extern void LO_Hit(MWContext *context, int32 x, int32 y,
Bool requireCaret, LO_HitResult *result);
#endif /* LAYERS */
extern int32 LO_TextElementWidth(MWContext *context, LO_TextStruct *text_ele, int charOffset);
extern void LO_AddEmbedData(MWContext* context, LO_EmbedStruct* embed, void* data);
extern void LO_CopySavedEmbedData(MWContext* context, SHIST_SavedData* newdata);
extern NET_StreamClass* LO_NewObjectStream(FO_Present_Types format_out, void* type,
URL_Struct* urls, MWContext* context);
extern void LO_CreateReblockTag(MWContext* context, LO_Element* element);
extern void LO_LockLayout(void);
extern void LO_UnlockLayout(void);
extern Bool LO_VerifyUnlockedLayout();
extern void LO_NetlibComplete(MWContext * context);
extern void LO_UpdateTextData(lo_FormElementTextData * textData, const char * text);
#ifdef EDITOR
/* --------------------------------------------------------------------------
* Layout stuff specific to the editor
*/
#ifdef LAYERS
extern void LO_PositionCaret( MWContext *context, int32 x, int32 y,
CL_Layer *layer);
extern void LO_DoubleClick( MWContext *context, int32 x, int32 y,
CL_Layer *layer );
#else
extern void LO_PositionCaret( MWContext *context, int32 x, int32 y );
extern void LO_DoubleClick( MWContext *context, int32 x, int32 y );
#endif /* LAYERS */
void LO_PositionCaretBounded(MWContext *context, int32 x, int32 y,
int32 minY, int32 maxY );
extern ED_Buffer* LO_GetEDBuffer( MWContext *context);
extern void LO_GetEffectiveCoordinates( MWContext *pContext, LO_Element *pElement, int32 position,
int32* pX, int32* pY, int32* pWidth, int32* pHeight );
extern void LO_UpDown( MWContext *pContext, LO_Element *pElement, int32 position, int32 iDesiredX, Bool bSelect, Bool bForward );
extern Bool LO_PreviousPosition( MWContext *pContext,LO_Element *pElement, intn iOffset,
ED_Element **ppEdElement, intn* pOffset);
extern Bool LO_NextPosition( MWContext *pContext,LO_Element *pElement, intn iOffset,
ED_Element **ppEdElement, intn* pOffset);
extern Bool LO_NavigateChunk( MWContext *pContext, intn chunkType, Bool bSelect, Bool bForward );
extern Bool LO_ComputeNewPosition( MWContext *context, intn chunkType,
Bool bSelect, Bool bDeselecting, Bool bForward,
LO_Element** pElement, int32* pPosition );
extern LO_Element* LO_BeginOfLine( MWContext *pContext, LO_Element *pElement );
extern LO_Element* LO_EndOfLine( MWContext *pContext, LO_Element *pElement);
extern LO_Element* LO_FirstElementOnLine( MWContext *pContext,
int32 x, int32 y, int32 *pLineNum);
#ifdef LAYERS
extern void LO_StartSelectionFromElement( MWContext *context, LO_Element *eptr,
int32 new_pos, CL_Layer *layer );
#else
extern void LO_StartSelectionFromElement( MWContext *context, LO_Element *eptr,
int32 new_pos );
#endif /* LAYERS */
extern void LO_ExtendSelectionFromElement( MWContext *context, LO_Element *eptr,
int32 position, Bool bFromStart );
extern Bool LO_SelectElement( MWContext *context, LO_Element *eptr,
int32 position, Bool bFromStart );
extern void LO_SelectRegion( MWContext *context, LO_Element *begin,
int32 beginPosition, LO_Element *end, int32 endPosition,
Bool fromStart, Bool forward );
extern Bool LO_IsSelected( MWContext *context );
extern Bool LO_IsSelectionStarted( MWContext *context );
extern void LO_GetSelectionEndPoints( MWContext *context,
LO_Element **ppStart, intn *pStartOffset, LO_Element **ppEnd,
intn *pEndOffset, Bool *pbFromStart, Bool *pbSingleElementSelection );
extern void LO_GetSelectionNewPoint( MWContext *context,
LO_Element **ppNew, intn *pNewOffset);
extern LO_Element* LO_PreviousEditableElement( LO_Element *pElement );
extern LO_Element* LO_NextEditableElement( LO_Element *pElement );
extern LO_ImageStruct* LO_NewImageElement( MWContext* context );
extern void LO_SetBackgroundImage( MWContext *context, char *pUrl );
extern void LO_RefetchWindowDimensions( MWContext *pContext );
extern void LO_Relayout( MWContext *context, ED_TagCursor *pCursor,
int32 iLine, int iStartEditOffset, XP_Bool bDisplayTables );
#endif /*EDITOR*/
extern void LO_SetBaseURL( MWContext *pContext, char *pURL );
extern char* LO_GetBaseURL( MWContext *pContext );
#if 0
extern Bool LO_Click( MWContext *context, int32 x, int32 y, Bool requireCaret );
extern void LO_Hit(MWContext *context, int32 x, int32 y, Bool requireCaret, LO_HitResult *result);
#endif
#ifdef LAYERS
extern void LO_SelectObject( MWContext *context, int32 x, int32 y,
CL_Layer *layer );
#else
extern void LO_SelectObject( MWContext *context, int32 x, int32 y );
#endif /* LAYERS */
#ifdef LAYERS
extern LO_LayerType LO_GetLayerType(CL_Layer *layer);
extern Bool LO_PrepareLayerForWriting(MWContext *context, int32 layer_id,
const char *referer, int32 width);
extern Bool LO_SetLayerSrc(MWContext *context, int32 layer_id, char *str,
const char *referer, int32 width);
extern int32 LO_CreateNewLayer(MWContext *context, int32 wrap_width, int32 parent_layer_id);
#endif /* LAYERS */
#ifdef XP_UNIX
extern void LO_DisplayFormElement(LO_FormElementStruct *form);
#endif /* XP_UNIX */
/* Allows front ends to test for empty cell.
* Used in Composer to display "zero width border"
* in cells that layout would normally not display
*/
XP_Bool LO_IsEmptyCell(LO_CellStruct *cell);
#ifdef DOM
/* Returns true if the layout element is enclosed
in <SPAN> </SPAN> */
Bool LO_IsWithinSpan( LO_Element *ele );
#endif
/*
* This is probably the wrong place to add this, but tough,
* this stuff shouldn't have to exist anyways.
*/
extern void XP_InitializeContext(MWContext *context);
extern MWContext *XP_NewContext(void);
extern void XP_DeleteContext(MWContext *context);
extern XP_List *XP_GetGlobalContextList(void);
extern void XP_AddContextToList(MWContext *context);
extern Bool XP_IsContextInList(MWContext *context);
extern void XP_RemoveContextFromList(MWContext *context);
extern MWContext *XP_GetNonGridContext(MWContext *context);
extern Bool XP_IsChildContext(MWContext* parent, MWContext* child);
extern MWContext *XP_FindNamedContextInList(MWContext * context, char *name);
extern MWContext *XP_FindContextOfType(MWContext *, MWContextType);
extern MWContext *XP_FindSomeContext(void);
extern Bool XP_FindNamedAnchor(MWContext * context, URL_Struct * url,
int32 *xpos, int32 *ypos);
extern void XP_RefreshAnchors(void);
extern void XP_InterruptContext(MWContext * context);
extern Bool XP_IsContextBusy(MWContext * context);
extern Bool XP_IsContextStoppable(MWContext * context);
extern void XP_UpdateParentContext(MWContext * context);
extern int XP_GetSecurityStatus(MWContext *pContext);
extern int XP_ContextCount(MWContextType cxType, XP_Bool bTopLevel);
XP_END_PROTOS
# endif /* _PROTO_H_ */

View File

@@ -0,0 +1,99 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef PWCACAPI_H
#define PWCACAPI_H
/* contains a null terminated array of name and value stings
*
* end index of name should always be equal to the end index of value
*
*/
typedef struct _PCNameValuePair PCNameValuePair;
typedef struct _PCNameValueArray PCNameValueArray;
typedef void PCDataInterpretFunc (
char *module,
char *key,
char *data, int32 data_size,
char *type_buffer, int32 type_buffer_size,
char *url_buffer, int32 url_buffer_size,
char *username_buffer, int32 username_buffer_size,
char *password_buffer, int32 password_buffer_size);
/* returns 0 on success -1 on error
*/
extern int PC_RegisterDataInterpretFunc(char *module,
PCDataInterpretFunc *func);
extern int PC_PromptUsernameAndPassword(MWContext *context,
char *prompt,
char **username,
char **password,
XP_Bool *remember_password,
XP_Bool is_secure);
extern char *PC_PromptPassword(MWContext *context,
char *prompt,
XP_Bool *remember_password,
XP_Bool is_secure);
extern char *PC_Prompt(MWContext *context,
char *prompt,
char *deft,
XP_Bool *remember,
XP_Bool is_secure);
void PC_FreeNameValueArray(PCNameValueArray *array);
PCNameValueArray * PC_NewNameValueArray();
uint32 PC_ArraySize(PCNameValueArray *array);
char * PC_FindInNameValueArray(PCNameValueArray *array, char *name);
int PC_DeleteNameFromNameValueArray(PCNameValueArray *array, char *name);
void PC_EnumerateNameValueArray(PCNameValueArray *array, char **name, char **value, XP_Bool beginning);
int PC_AddToNameValueArray(PCNameValueArray *array, char *name, char *value);
void PC_CheckForStoredPasswordData(char *module, char *key, char **data, int32 *len);
int PC_DeleteStoredPassword(char *module, char *key);
PCNameValueArray * PC_CheckForStoredPasswordArray(char *module, char *key);
int PC_StoreSerializedPassword(char *module, char *key, char *data, int32 len);
int PC_StorePasswordNameValueArray(char *module, char *key, PCNameValueArray *array);
void PC_SerializeNameValueArray(PCNameValueArray *array, char **data, int32 *len);
PCNameValueArray * PC_CharToNameValueArray(char *data, int32 len);
/*, returns status
*/
int PC_DisplayPasswordCacheAsHTML(URL_Struct *URL_s,
FO_Present_Types format_out,
MWContext *context);
void PC_Shutdown();
#endif /* PWCACAPI_H */

101
mozilla/include/resdef.h Normal file
View File

@@ -0,0 +1,101 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _RESDEF_H_
#define _RESDEF_H_
#include "xp_core.h"
#define RES_OFFSET 7000
#ifndef RESOURCE_STR
#ifdef WANT_ENUM_STRING_IDS
#define RES_START
#if defined(XP_WIN) && _MSC_VER == 1100
/* VC50 has a bug, where large enumerations cause an
* internal compiler error. Do some hack here to fix without
* breaking the other platforms.
*/
#define BEGIN_STR(arg)
#define ResDef(name,id,msg) enum { name=id };
#define END_STR(arg)
#else /* XP_WIN _MSC_VER */
#define BEGIN_STR(arg) enum {
#define ResDef(name,id,msg) name=id,
#if defined(XP_WIN)
#define END_STR(arg) };
#else
#define END_STR(arg) arg=0 };
#endif
#endif /* XP_WIN _MSC_VER */
#else /* WANT_ENUM_STRING_IDS */
#define RES_START
#define BEGIN_STR(arg)
#ifdef XP_WIN16
/* Get these ints out of DGROUP (/Gt3 compiler switch)
* so we can increase the stack size
*/
#define ResDef(name,id,msg) int __far name = (id);
#else
#define ResDef(name,id,msg) int name = (id);
#endif
#define END_STR(arg)
#endif /* WANT_ENUM_STRING_IDS */
#else /* RESOURCE_STR, the definition here is for building resources */
#if defined(XP_WIN) || defined(XP_OS2)
#ifndef MOZILLA_CLIENT
#define RES_START
#define BEGIN_STR(arg) static char * (arg) (int16 i) { switch (i) {
#define ResDef(name,id,msg) case (id)+RES_OFFSET: return (msg);
#define END_STR(arg) } return NULL; }
#else /* MOZILLA_CLIENT */
#define RES_START STRINGTABLE DISCARDABLE
#define BEGIN_STR(arg) BEGIN
#define ResDef(name,id,msg) id+RES_OFFSET msg
#define END_STR(arg) END
#endif /* not MOZILLA_CLIENT */
#elif defined(XP_MAC)
/* Do nothing -- leave ResDef() to be perl'ized via MPW */
#define ResDef(name,id,msg) ResDef(name,id,msg)
#elif defined(XP_UNIX)
#ifdef RESOURCE_STR_X
#define RES_START
#define BEGIN_STR(arg) static char *(arg)(void) {
#define ResDef(name,id,msg) output((id)+RES_OFFSET, (msg));
#define END_STR(arg) }
#else
#define RES_START
#define BEGIN_STR(arg) static char *(arg)(int16 i) { switch (i) {
#define ResDef(name,id,msg) case (id)+RES_OFFSET: return (msg);
#define END_STR(arg) } return NULL; }
#endif /* RESOURCE_STR_X */
#endif /* XP_WIN */
#endif /* RESOURCE_STR */
#endif /* _RESDEF_H_ */

163
mozilla/include/shist.h Normal file
View File

@@ -0,0 +1,163 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef SHIST_H
#define SHIST_H
#include "xp_list.h"
#include "ntypes.h"
#include "hotlist.h"
/* see shistele.h for the structure definitions. :(
*/
/* --------------------------------------------------------------------------
* Session history module routines
*/
struct MWContext_;
struct URL_Struct_;
#define HIST_NEW_OBJECT 0
#define HIST_MOVE_FORWARD 1
#define HIST_MOVE_BACK 2
/* Max length of the URL when title is unknown */
#define HIST_MAX_URL_LEN 30
XP_BEGIN_PROTOS
/* Front-End Specialized Functions */
extern void SHIST_InitSession(struct MWContext_ * ctxt);
extern void SHIST_EndSession(MWContext * ctxt);
/* copys all the session data from the old context into the
* new context. Does not effect data in old_context session history
*
* if new_context has not had SHIST_InitSession called for it
* it will be called to initalize it.
*/
extern void
SHIST_CopySession(MWContext * new_context, MWContext * old_context);
/* make a new copy of the given history entry */
extern History_entry * SHIST_CloneEntry(History_entry * old_entry);
/*
* someone (like another thread) needs to keep this entry around for
* a while, increase the reference count so it doesn't disappear
* on us. Return the held reference to entry. Tolerate NULL entry.
*/
extern History_entry * SHIST_HoldEntry(History_entry * entry);
#define SHIST_DropEntry SHIST_FreeHistoryEntry
/* these update position and buttons! */
extern void SHIST_AddDocument(struct MWContext_ * ctxt, History_entry * entry);
extern History_entry * SHIST_GetPrevious(struct MWContext_ * ctxt);
extern History_entry * SHIST_GetNext(struct MWContext_ * ctxt);
/* convenience functions */
extern char* SHIST_StripProtocol ( char* inURL ) ;
extern History_entry * SHIST_CreateHistoryEntry (struct URL_Struct_ * URL_s, char * title);
extern URL_Struct * SHIST_CreateURLStructFromHistoryEntry(struct MWContext_ * ctxt,
History_entry * entry);
extern URL_Struct * SHIST_CreateWysiwygURLStruct(struct MWContext_ * ctxt,
History_entry * entry);
extern BM_Entry* SHIST_CreateHotlistStructFromHistoryEntry(History_entry * h);
extern void SHIST_FreeHistoryEntry (MWContext * ctxt, History_entry * entry);
/* Standard History Functions */
extern int SHIST_CanGoBack(MWContext * ctxt);
extern int SHIST_CanGoForward(MWContext * ctxt);
extern History_entry * SHIST_GetEntry(History * hist, int entry_number);
extern History_entry * SHIST_GetCurrent(History * hist);
extern XP_List * SHIST_GetList(MWContext * ctxt);
/* Functions to handle Page Services functionality */
extern int SHIST_CurrentHandlesPageServices(MWContext * ctxt);
extern char * SHIST_GetCurrentPageServicesURL(MWContext * ctxt);
/* sets the current doc pointer to the index specified in the call
*
* entry numbering begins at one.
*/
extern void SHIST_SetCurrent(History * hist, int entry_number);
/* set the title of the current document
*
* TODO: All FEs should use the XP_WIN version asap.
*/
#if defined(XP_WIN) || defined(XP_MAC) || defined(XP_OS2)
extern void SHIST_SetTitleOfCurrentDoc(MWContext * context);
#else
extern void SHIST_SetTitleOfCurrentDoc(History * hist, char * title);
#endif
/* set the layout specific form data neccessary to recreate the user settable
* entries within a form
*/
PUBLIC void
SHIST_SetCurrentDocFormListData(MWContext * context, void * form_data);
/* set the layout-plugin specific embed data neccessary to recreate the
* last session state within the embedded object.
*/
PUBLIC void
SHIST_SetCurrentDocEmbedListData(MWContext * context, void * embed_data);
/* set the layout grid data neccessary to recreate the
* grid when revisited through history.
*/
PUBLIC void
SHIST_SetCurrentDocGridData(MWContext * context, void * grid_data);
/* set the window object for a grid being resized.
*/
PUBLIC void
SHIST_SetCurrentDocWindowData(MWContext * context, void * window_data);
/* set the layout applet data neccessary to recreate the
* applet when revisited through history.
*/
PUBLIC void
SHIST_SetCurrentDocAppletData(MWContext * context, void * applet_data);
/* set the position of the current document
*/
extern void SHIST_SetPositionOfCurrentDoc(History * hist, int32 position_tag);
/* gets an index associated with the entry
*
* entry numbering begins at one.
*
* zero is returned if object not found
*/
extern int SHIST_GetIndex(History * hist, History_entry * entry);
/* return the n'th object
*/
extern History_entry * SHIST_GetObjectNum(History * hist, int n);
XP_END_PROTOS
#endif /* SHIST_H */

129
mozilla/include/shistele.h Normal file
View File

@@ -0,0 +1,129 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef SHISTELE_H
#define SHISTELE_H
#include "xp_list.h"
/*
** This structure holds pointer so all saved data in the history. It is
** also used by URL_Structs and is ultimately fed to layout.
**
** Warning: Don't change the names of the fields because they're used by
** macros.
*/
typedef struct SHIST_SavedData {
void* FormList; /* layout data to recreate forms */
void* EmbedList; /* layout data to recreate embeds and applets */
void* Grid; /* layout data to recreate grids */
#ifdef MOCHA
void* Window; /* window object for grid being resized */
/* XXX none of this would be necessary if frameset docs were reparsed */
void* OnLoad; /* JavaScript onload event handler source */
void* OnUnload; /* JavaScript onunload event handler source */
void* OnFocus; /* JavaScript onfocus event handler source */
void* OnBlur; /* JavaScript onblur event handler source */
void* OnHelp; /* JavaScript onhelp event handler source */
void* OnMouseOver; /* JavaScript onmouseover event handler source */
void* OnMouseOut; /* JavaScript onmouseout event handler source */
void* OnDragDrop; /* JavaScript ondragdrop event handler source */
void* OnMove; /* JavaScript onmove event handler source */
void* OnResize; /* JavaScript onresize event handler source */
void* style_stack; /* JSSS style stack info */
#endif
} SHIST_SavedData;
/*
This structure encapsulates all of the information needed for the
session history. It should contain stuff like a list of all of the
documents in the current history and a pointer to where the currently
viewed document sits in the chain.
WARNING!! Some slots of this structure are shared with URL_Struct and
net_CacheObject. If you add a slot, decide whether it needs to be
shared as well.
*/
struct _History_entry {
char * title; /* title for this entry */
char * address; /* URL address string */
char * content_name; /* Server-provided "real name", used for
default file name when saving. */
int method; /* method of acessing URL */
char * referer; /* What document points to this url */
char * post_data; /* post data */
int32 post_data_size; /* post data size */
Bool post_data_is_file; /* is the post data a filename? */
char * post_headers; /* content type for posted data */
int32 position_tag; /* layout specific data for determining
* where in the document the user was
*/
time_t last_modified; /* time of last modification */
time_t last_access; /* time of last access */
int history_num; /* special hack to add navigation */
SHIST_SavedData savedData; /* layout data */
PRPackedBool
is_binary, /* is this a binary object pretending
* to be HTML?
*/
is_active, /* is it an active stream? */
is_netsite, /* did it come from netsite? */
replace; /* did it come from netsite? */
int transport_method; /* network, disk cache, memory cache */
uint32 refresh; /* refresh interval */
char *refresh_url; /* URL to refresh */
char *wysiwyg_url; /* URL for WYSIWYG printing/saving */
/* Security information */
int security_on; /* is security on? */
/* Security info on a connection is opaque */
unsigned char *sec_info;
/* Unique identifier */
int32 unique_id;
int32 ref_count;
/* Page services*/
char *page_services_url; /* If it supports services, what link is used */
/* HTTP_11 support*/
char *etag; /* Unique entity tag */
char *origin_url; /* original referrer of javascript: URL */
};
#define SHIST_CAME_FROM_NETWORK 0
#define SHIST_CAME_FROM_DISK_CACHE 1
#define SHIST_CAME_FROM_MEMORY_CACHE 2
struct History_ {
XP_List * list_ptr; /* pointer to linked list */
int cur_doc; /* an index into the list that points to the current document */
History_entry *cur_doc_ptr; /* a ptr to the current doc entry */
int32 num_entries; /* size of the history list */
int32 max_entries; /* maximum size of list; -1 == no limit */
};
#endif /* SHISTELE_H */

70
mozilla/include/shr_str.h Normal file
View File

@@ -0,0 +1,70 @@
/* -*- 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.
*/
/*
* shr_str.h
* ---------
*
* Error codes that are shared by more than one module of
* Netscape Navigator. This file is probably a temporary
* workaround until we can get a more sophisticated sharing
* mechanism in place.
*
* Codes are represented as fixed numbers, not offsets off
* of a base, to avoid namespace collision.
*
*/
#ifndef SHR_STR_H
#define SHR_STR_H
#define MK_OUT_OF_MEMORY -207
#define MK_UNABLE_TO_OPEN_FILE -223
#define MK_DISK_FULL -250
#define MK_UNABLE_TO_OPEN_TMP_FILE -253
#define MK_MIME_NO_RECIPIENTS -267
#define MK_NNTP_SERVER_NOT_CONFIGURED -307
#define MK_UNABLE_TO_DELETE_FILE -327
#define MK_MSG_DELIV_MAIL 15412
#define MK_MSG_DELIV_NEWS 15414
#define MK_MSG_SAVE_AS 15483
#define MK_MSG_NO_HEADERS 15528
#define MK_MSG_MIME_MAC_FILE 15530
#define MK_MSG_CANT_OPEN 15540
#define XP_MSG_UNKNOWN 15572
#define XP_EDIT_NEW_DOC_NAME 15629
#define XP_ALERT_TITLE_STRING -7956
#define XP_SEC_SHOWCERT -7963
#define XP_SEC_SHOWORDER -7962
#ifdef XP_WIN
/* for Winsock defined error codes */
#include "winsock.h"
#define XP_ERRNO_ECONNREFUSED WSAECONNREFUSED
#define XP_ERRNO_EIO WSAECONNREFUSED
#define XP_ERRNO_EISCONN WSAEISCONN
#define XP_ERRNO_EWOULDBLOCK EWOULDBLOCK
#endif /* XP_WIN */
#endif

199
mozilla/include/spellchk.h Normal file
View File

@@ -0,0 +1,199 @@
/* -*- Mode: C++; tab-width: 8; 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.
*/
/* *
*
*
***************************************************************************
* spellchk.h
* Public header file for the Spell Checker library.
****************************************************************************/
#ifndef _SPELLCHK_H_
#define _SPELLCHK_H_
/* In WIN16 DLL exported functions require __loadds keywords for the DS
* register to be set to the DLL's data-segment value and restored on return
* from the function.
*/
#ifdef WINDOWS
#define SCAPI __loadds
#elif defined(WIN32)
#define SCAPI __cdecl
#else
#define SCAPI
#endif
#ifdef MAC
#include <Files.h>
#endif
/* Language and Dialect codes. */
#define L_AFRIKAANS 101
#define L_CATALAN 102
#define L_CZECH 103
#define L_DANISH 104
#define L_DUTCH 105
#define L_ENGLISH 106
#define L_FINNISH 107
#define L_FRENCH 108
#define L_GERMAN 109
#define L_GREEK 110
#define L_HUNGARIAN 111
#define L_ITALIAN 112
#define L_NORWEGIAN 113
#define L_POLISH 114
#define L_PORTUGUESE 115
#define L_RUSSIAN 116
#define L_SPANISH 117
#define L_SWEDISH 118
#define D_DEFAULT 0xFFFF
#define D_AUS_ENGLISH 0x1001
#define D_US_ENGLISH 0x1010
#define D_UK_ENGLISH 0x1100
#define D_DOPPEL 0x2001 /* German */
#define D_SCHARFES 0x2010
#define D_BRAZILIAN 0x4001 /* Portuguese */
#define D_EUROPEAN 0x4010
#define D_BOKMAL 0x8001 /* Norwegian */
#define D_NYNORSK 0x8010
/* ISpellChecker - This class specifies the interface to the Spell Checker. A client
* application instatiates a spell checker object using the exported function SC_Create().
* The client application then performs spell checking using the member functions of this
* class. The spell checker object is destroyed by using the exported function SC_Destroy().
*/
class ISpellChecker
{
public:
/* Needs to be called by the client app once before calling any other functions.
* Return: 0 = success, non-zero = error
*/
#ifdef MAC
virtual int SCAPI Initialize(int LangCode, int DialectCode,
FSSpec *DbPath, FSSpec *PersonalDbFile) = 0;
#else
virtual int SCAPI Initialize(int LangCode, int DialectCode,
const char *DbPath, const char *PersonalDbFile) = 0;
#endif
/* Functions to set and get the current language and dialect settings.
* Returns: 0 = success, non-zero = failure
*/
virtual int SCAPI SetCurrentLanguage(int LangCode, int DialectCode) = 0;
virtual int SCAPI GetCurrentLanguage(int &LangCode, int &DialectCode) = 0;
/* Get the list of dictionaries available */
virtual int SCAPI GetNumOfDictionaries() = 0;
/* Get the language and dialect id for an available dictionary.
* Index = 0-based index into the list of available dictionaries.
* Returns: 0 = success, non-zero = failure.
*/
virtual int SCAPI GetDictionaryLanguage(int Index, int &LangCode, int &DialectCode) = 0;
/* Called by the client application to initialize a buffer for spell checking.
* It returns immediately without parsing the buffer. The client controls parsing of
* the buffer by calling GetNextMisspelledWord() and SetNewBuf().
* Return: 0 = success, non-zero = error
*/
virtual int SCAPI SetBuf(const char *pBuf) = 0;
/* Initialize a buffer with selection */
virtual int SCAPI SetBuf(const char *pBuf, unsigned long SelStart, unsigned long SelEnd) = 0;
/* Replace the current mispelled word with a new word */
virtual int SCAPI ReplaceMisspelledWord(const char *NewWord, int AllInstances) = 0;
/* Get the size of the current buffer */
virtual unsigned long SCAPI GetBufSize() = 0;
/* Copy the current buffer */
virtual int SCAPI GetBuf(char *pBuf, unsigned long BufSize) = 0;
/* Called by the client application to parse the buffer and return the next misspelled
* word in the buffer.
* Return: 0 = found a misspelled word.
* *Offset = Offset of the word from the beginning of the buffer
* *Len = Length of the word
* non-zero = no more misspelled word
*/
virtual int SCAPI GetNextMisspelledWord(unsigned long &Offset, unsigned long &Len) = 0;
/* The orginal buffer was changed by the client.
* ReparseFromStart = 1 - reparse the new buffer from the beginning
* = 0 - parse from the last offset into the original buffer
*/
virtual void SCAPI SetNewBuf(const char *pBuf, int ReparseFromStart) = 0;
/* Called by the client application to spell check a work.
* Return: 1 = valid word, 0 = not in dictionary
*/
virtual int SCAPI CheckWord(const char *pWord) = 0;
/* Get the number of possible alternatives found in the dictionary for the input word. */
virtual int SCAPI GetNumAlternatives(const char *pWord) = 0;
/* Get an alternative string. The "Index" is zero based.
* Return: 0 = success, -1 = error(bad Index),
* +ve value = BufSize too small, size needed
*/
virtual int SCAPI GetAlternative(int Index, char *pBuf, unsigned int BufSize) = 0;
/* The following functions interact with the personal database */
/* Add a word to the personal dictionary */
virtual int SCAPI AddWordToPersonalDictionary(const char *pWord) = 0;
/* Remove a word from the personal dictionary */
virtual int SCAPI RemoveWordFromPersonalDictionary(const char *pWord) = 0;
/* Ignore all references to a word in the current session */
virtual int SCAPI IgnoreWord(const char *pWord) = 0;
/* GetFirstPersonalDictionaryWord & GetNextPersonalDictionaryWord
* These functions retrieve words in the personal dictionary
* Returns: 0 = success, pBuf contains the next word
* -1 = no more words
* +ve = required buffer size. Size passed is too small.
*/
virtual int SCAPI GetFirstPersonalDictionaryWord(char *pBuf, int BufSize) = 0;
virtual int SCAPI GetNextPersonalDictionaryWord(char *pBuf, int BufSize) = 0;
/* Resets the contents of the personal dictionary */
virtual int SCAPI ResetPersonalDictionary() = 0;
/* destructor */
virtual ~ISpellChecker() {};
};
/* Exported library functions to create and destroy ISpellChecker objects. */
extern "C"
{
ISpellChecker * SCAPI SC_Create();
void SCAPI SC_Destroy(ISpellChecker *pSpellChecker);
}
#endif

457
mozilla/include/structs.h Normal file
View File

@@ -0,0 +1,457 @@
/* -*- 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 is included by client.h
*
* It can be included by hand after mcom.h
*
* All intermodule data structures (i.e. MWContext, etc) should be included
* in this file
*/
#ifndef _STRUCTS_H_
#define _STRUCTS_H_
#include "ntypes.h"
#include "xp_mcom.h"
#include "il_types.h"
#include "lo_ele.h"
#include "shistele.h"
#include "edttypes.h"
#ifdef JAVA
#include "prlong.h"
#include "prclist.h"
#endif /* JAVA */
/* ------------------------------------------------------------------------ */
/* ============= Typedefs for the global context structure ================ */
/* will come out of the ctxtfunc.h file eventually
*/
typedef struct _ContextFuncs ContextFuncs;
/*
* This stuff is front end specific. Add whatever you need.
*/
#if defined(OSF1) && defined(__cplusplus)
struct fe_ContextData;
#endif
#if defined(XP_MAC) && defined(__cplusplus)
class NetscapeContext;
class CHyperView;
class CNSContext;
class CHTMLView;
#endif
#if ( defined(XP_WIN) || defined(XP_OS2) ) && defined(__cplusplus)
class CAbstractCX;
class CEditView;
class CSaveProgress;
#endif
typedef struct FEstruct_ {
#ifndef MOZILLA_CLIENT
void * generic_data;
#elif defined(XP_WIN) || defined(XP_OS2)
#ifdef __cplusplus
CAbstractCX *cx;
#else
void *cx;
#endif
#elif defined(XP_TEXT)
int doc_cols;
int doc_lines;
int cur_top_line;
int num_anchors;
int cur_anchor;
#elif defined(XP_UNIX)
struct fe_ContextData *data;
#elif defined(XP_MAC)
#ifdef __cplusplus
class NetscapeContext* realContext;
class CHyperView* view;
class CNSContext* newContext;
class CHTMLView* newView;
#else
void* realContext;
void* view;
void* newContext;
void* newView;
#endif
/*
** These members are only used by the EDITOR... However, if they
** are removed for non-editor builds the MWContext structure
** becomes skewed for java (and the rest of DIST)...
*/
#ifdef __cplusplus
class CEditView* editview;
class CSaveProgress* savedialog;
#else
void* editview;
void* savedialog;
#endif
#endif
} FEstruct;
#define FEUNITS_X(x,context) ((int32) ((MWContext *)context)->convertPixX * (x))
#define FEUNITS_Y(y,context) ((int32) ((MWContext *)context)->convertPixY * (y))
struct MessageCopyInfo;
/*
This is a generic context structure. There should be one context
per document window. The context will allow assorted modules to
pull out things like the URL of the current document as well as
giving them a place to hand their window specific stuff.
*/
#if defined (OSF1)
/* Forward declaration to make compiler happy on OSF1 */
struct MSG_SearchFrame;
#ifdef XP_CPLUSPLUS
class MSG_IMAPFolderInfoMail;
class MSG_Master;
class MSG_Pane;
class TImapServerState;
#endif
#endif
struct MWContext_ {
MWContextType type;
char *url; /* URL of current document */
char * name; /* name of this context */
History hist; /* Info needed for the window history module */
FEstruct fe; /* Front end specific stuff */
PRPackedBool fancyFTP; /* use fancy ftp ? */
PRPackedBool fancyNews; /* use fancy news ? */
PRPackedBool intrupt; /* the user just interrupted things */
PRPackedBool graphProgress; /* should the user get visual feedback */
PRPackedBool waitingMode; /* Has a transfer been initiated? Once a */
/* transfer is started, the user cannot select another */
/* anchor until either the transfer is aborted, has */
/* started to layout, or has been recognized as a */
/* separate document handled through an external stream/viewer */
PRPackedBool reSize; /* the user wants to resize the window once the */
/* current transfer is over */
int fileSort; /* file sorting method */
char * save_as_name; /* name to save current file as */
char * title; /* title (if supplied) of current document */
Bool is_grid_cell; /* Is this a grid cell */
struct MWContext_ *grid_parent; /* pointer to parent of grid cell */
XP_List * grid_children; /* grid children of this context */
int convertPixX; /* convert from pixels to fe-specific coords */
int convertPixY; /* convert from pixels to fe-specific coords */
ContextFuncs * funcs; /* function table of display routines */
PrintSetup *prSetup; /* Info about print job */
PrintInfo *prInfo; /* State information for printing process */
/* XXXM12N Stuff for the new, modular Image Library. *********************/
IL_GroupContext *img_cx; /* Created by Front Ends. Passed into Image
Library function calls. */
IL_ColorSpace *color_space; /* Colorspace information for images. This
should become a part of the FE's display
context when MWContext goes away. */
IL_IRGB *transparent_pixel; /* Background color to be passed into
IL_GetImage. Set by Front Ends (?) */
/*************************************************************************/
int32 images; /* # of distinct images on this page */
/* ! do not use these ! */
/* ! these are going away soon ! */
/* instead see intl_csi.h for the i18n accessor functions */
int16 do_not_use_win_csid; /* code set ID of current window */
int16 do_not_use_doc_csid; /* code set ID of current document */
int16 do_not_use_relayout; /* tell conversion to treat relayout case */
char *do_not_use_mime_charset; /* MIME charset from URL */
struct MSG_CompositionFrame *msg_cframe; /* ditto. */
struct MSG_SearchFrame *msg_searchFrame; /*state for search, for search contexts*/
struct MSG_BiffFrame *biff_frame; /* Biff info for this context, if any. */
struct BM_Frame *bmframe; /* Bookmarks info for this context, if any. */
/* for now, add IMAP mail stuff here */
#ifdef XP_CPLUSPLUS
class MSG_IMAPFolderInfoMail *currentIMAPfolder;
class MSG_Pane *imapURLPane; /* used when updated folders */
class MSG_Master *mailMaster;
class TNavigatorImapConnection *imapConnection;
#else
struct MSG_IMAPFolderInfoMail *currentIMAPfolder;
struct MSG_Pane *imapURLPane; /* used when updated folders */
struct MSG_Master *mailMaster;
struct TNavigatorImapConnection *imapConnection;
#endif
/* for now, add message copy info stuff here */
struct MessageCopyInfo *msgCopyInfo;
NPEmbeddedApp *pluginList; /* plugins on this page */
void *pluginReconnect; /* yet another full screen hack */
struct MimeDisplayData *mime_data; /* opaque data used by MIME message
parser (not Mail/News specific,
since MIME objects can show up
in Browser windows too.) */
/* Also overloaded by progress module to hold private crap! */
#ifdef MOCHA
struct JSContext *mocha_context; /* opaque handle to Mocha state */
uint32 event_bit; /* sum of all event capturing objects */
XP_Bool js_drag_enabled; /* indicates JS drag enabled */
int8 js_dragging; /* indicates which button has JS drag in process */
XP_List * js_dependent_list; /* lifetime-linked children of this context */
MWContext *js_parent;
int32 js_timeouts_pending; /* Number of pending JavaScript timeouts */
#endif
XP_Bool restricted_target; /* TRUE if window is off-limits for opening links into
from mail or other window-grabbing functions.*/
NPEmbeddedApp *pEmbeddedApp; /* yet another full screen hack */
char * defaultStatus; /* What string to show in the status area
whenever there's nothing better to show.
FE's should implement FE_Progress so that
if it is passed NULL or "" it will instead
display this string. libmsg changes this
string all the time for mail and news
contexts. */
#ifdef LAYERS
CL_Compositor *compositor; /* The compositor associated with this context */
XP_Bool blink_hidden; /* State of blink layers */
void *blink_timeout; /* Timeout used for blink hiding/unhiding */
#endif /* LAYERS */
int32 doc_id; /* unique identifier for generated documents */
int32 context_id; /* unique identifier for context */
void *pHelpInfo; /* pointer to additional help information;
see ns/lib/libnet/mkhelp.c [EA] */
#ifdef JAVA
/* See ns/sun-java/netscape/net/netStubs.c for the next 2 items: */
/*
** This mysterious list is used in two ways: (1) If you're a real
** window context, it's a list of all dummy java contexts that were
** created for java's network connections. (2) If you're a dummy java
** context, it's where you're linked into the list of connections for
** the real context:
*/
PRCList javaContexts;
/*
** Second, if you're a dummy java context, you'll need a pointer to
** the stream data so that you can shut down the netlib connection:
*/
struct nsn_JavaStreamData* javaContextStreamData;
/*
** Stuff for GraphProgress. See lj_embed.c
*/
Bool displayingMeteors;
int64 timeOfFirstMeteorShower;
int16 numberOfSimultaneousShowers;
#endif /* JAVA */
/*
** Put the editor stuff at the end so that people can still use the
** the Java DLL from the 2.0 dist build with Navigator Gold.
*/
PRPackedBool is_editor; /* differentiates between Editor and Browser modes */
PRPackedBool is_new_document; /* quick access to new doc state (unsaved-no file yet)*/
PRPackedBool display_paragraph_marks; /* True if we should display paragraph and hard-return symbols. */
PRPackedBool display_table_borders; /* True if we should display dotted lines around tables with invisible borders. */
PRPackedBool edit_view_source_hack;
PRPackedBool edit_loading_url; /* Hack to let us run the net while in a modal dialog */
PRPackedBool edit_saving_url; /* " */
PRPackedBool edit_has_backup; /* Editor has made a session backup */
PRPackedBool bIsComposeWindow; /* Editor is a compose window */
/*
* Webfonts that were loaded by this context
*/
void *webfontsList;
/* web font stuff */
/* On Windows, they are initialized to 0 in cxdc.cpp */
int16 WebFontDownLoadCount; /* # of download for this doc( one download can have multiple fonts) */
int16 MissedFontFace; /* have we missed any font? */
/* number of pixels per point-size */
double XpixelsPerPoint;
double YpixelsPerPoint;
Bool bJavaScriptCalling;
/* Allow JavaScript in certain internally generated contexts even
* when the "enable javascript" pref is turned off.
* This flag will also be inherited by child grid cells.
*/
PRPackedBool forceJSEnabled;
/* For increase and decrease font */
double fontScalingPercentage;
int INTL_tag; /* used to tell that we have a valid INTL_CSIInfo */
INTL_CharSetInfo INTL_CSIInfo; /* new home of private i18n data */
/* the current tab focused data */
LO_TabFocusData *tab_focus_data;
void *ncast_channel_context;
};
/* This tells libmime.a whether it has the mime_data slot in MWContext
(which should always be true eventually, but having this #define here
makes life easier for me today.) -- jwz */
#define HAVE_MIME_DATA_SLOT
/* this is avialible even in non GOLD builds. */
#define EDT_IS_EDITOR(context) (context != NULL && context->is_editor)
#define EDT_DISPLAY_PARAGRAPH_MARKS(context) (context && context->is_editor && context->display_paragraph_marks)
#define EDT_DISPLAY_TABLE_BORDERS(context) (context && context->is_editor && context->display_table_borders)
#define EDT_RELAYOUT_FLAG (0x2)
#define EDT_IN_RELAYOUT(context) (context != NULL && ((context->is_editor & EDT_RELAYOUT_FLAG) != 0))
#ifdef JAVA
/*
** This macro is used to recover the MWContext* from the javaContexts
** list pointer:
*/
#define MWCONTEXT_PTR(context) \
((MWContext*) ((char*) (context) - offsetof(MWContext,javaContexts)))
#endif /* JAVA */
/* ------------------------------------------------------------------------ */
/* ====================== NASTY UGLY SHORT TERM HACKS ===================== */
#define XP_CONTEXTID(ctxt) ((ctxt)->context_id)
#define XP_DOCID(ctxt) ((ctxt)->doc_id)
#define XP_SET_DOCID(ctxt, id) ((ctxt)->doc_id = (id))
/* ------------------------------------------------------------------------ */
/* ============= Typedefs for the parser module structures ================ */
/*
* I *think* (but am unsure) that these should be forked off into a
* parser specific client level include file
*
*/
typedef int8 TagType;
struct PA_Tag_struct {
TagType type;
PRPackedBool is_end;
uint16 newline_count;
#if defined(XP_WIN) || defined(XP_OS2)
union { /* use an anonymous union for debugging purposes*/
PA_Block data;
char* data_str;
};
#else
PA_Block data;
#endif
int32 data_len;
int32 true_len;
void *lo_data;
struct PA_Tag_struct *next;
ED_Element *edit_element;
};
#define PA_HAS_PDATA( tag ) (tag->pVoid != 0 )
#ifdef XP_UNIX
typedef char *PAAllocate (intn byte_cnt);
typedef void PAFree (char *ptr);
#else
typedef void *PAAllocate (unsigned int byte_cnt);
typedef void PAFree (void *ptr);
#endif
typedef intn PA_OutputFunction (void *data_object, PA_Tag *tags, intn status);
struct _PA_Functions {
PAAllocate *mem_allocate;
PAFree *mem_free;
PA_OutputFunction *PA_ParsedTag;
};
typedef struct PA_InitData_struct {
PA_OutputFunction *output_func;
} PA_InitData;
/* Structure that defines the characteristics of a new window.
* Each entry should be structured so that 0 should be the
* default normal value. Currently all 0 values
* bring up a chromeless MWContextBrowser type window of
* arbitrary size.
*/
struct _Chrome {
MWContextType type; /* Must be set to the correct type you want,
* if doesn't exist, define one!!!
*/
Bool show_button_bar; /* TRUE to display button bar */
Bool show_url_bar; /* TRUE to show URL entry area */
Bool show_directory_buttons; /* TRUE to show directory buttons */
Bool show_bottom_status_bar; /* TRUE to show bottom status bar */
Bool show_menu; /* TRUE to show menu bar */
Bool show_security_bar; /* TRUE to show security bar */
Bool hide_title_bar; /* TRUE to hide title bar and window controls */
int32 w_hint, h_hint; /* hints for width and height */
int32 outw_hint, outh_hint; /* hints for outer window width and height */
int32 l_hint, t_hint; /* hints for left and top window positioning */
Bool topmost; /* TRUE for window alwaysOnTop */
Bool bottommost; /* TRUE for 'desktop' window */
Bool z_lock; /* TRUE for window which cannot move within z-order */
Bool is_modal; /* TRUE to make window be modal */
Bool show_scrollbar; /* TRUE to show scrollbars on window */
Bool location_is_chrome; /* TRUE if top or left is specified */
Bool allow_resize; /* TRUE to allow resize of windows */
Bool allow_close; /* TRUE to allow window to be closed */
Bool copy_history; /* TRUE to copy history of prototype context*/
Bool dependent; /* TRUE if this window is to be closed with its parent*/
Bool disable_commands; /* TRUE if user has set hot-keys / menus off */
Bool restricted_target; /* TRUE if window is off-limits for opening links into
from mail or other window-grabbing functions.*/
void (* close_callback)(void *close_arg); /* called on window close */
void *close_arg; /* passed to close_callback */
};
#endif /* _STRUCTS_H_ */

126
mozilla/include/undo.h Normal file
View File

@@ -0,0 +1,126 @@
/* -*- 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.
*/
/*
undo.h --- creating and maintaining an undo list.
Created: Terry Weissman <terry@netscape.com>, 9-Sept-95.
*/
#ifndef _UNDO_H_
#define _UNDO_H_
typedef struct UndoState UndoState;
XP_BEGIN_PROTOS
/* Create a new undo state. (Returns NULL if no memory available). State will
be saved to execute up to "maxdepth" undos in a row.*/
extern UndoState* UNDO_Create(int maxdepth);
/* Throw away the undo state. */
extern void UNDO_Destroy(UndoState* state);
/* Throw away all the queued events in the undo state. If we are in the middle
of a batch (there are outstanding calls to UNDO_StartBatch()), then future
events in the batch are also thrown away. */
extern void UNDO_DiscardAll(UndoState* state);
/* Mark the beginning of a bunch of actions that should be undone as one user
action. Should always be matched by a later call to UNDO_EndBatch().
These calls can nest. They fail only if running out of memory, in which
case they will call UNDO_DiscardAll(). */
/* Note you can use the tag arguments to associate a batch of events with
some user defined tag e.g., a name or object identifying the batch of events */
extern int UNDO_StartBatch(UndoState* state);
extern int UNDO_EndBatch(UndoState* state, void (*freetag)(void*), void* tag);
/* Returns TRUE if undoing will do something (i.e., the menu item for "Undo"
should be selectable). */
extern XP_Bool UNDO_CanUndo(UndoState* state);
/* Returns TRUE if redoing will do something (i.e., the menu item for "Redo"
should be selectable). */
extern XP_Bool UNDO_CanRedo(UndoState* state);
/* Actually do an undo. Should only be called if UNDO_CanUndo returned TRUE.
May not be called if there are any pending calls to UNDO_StartBatch. */
extern int UNDO_DoUndo(UndoState* state);
/* Actually do an redo. Should only be called if UNDO_CanRedo returned TRUE.
May not be called if there are any pending calls to UNDO_StartBatch. */
extern int UNDO_DoRedo(UndoState* state);
/* Log an event. The "undoit" function is to be called with the closure to
undo an event that just happened. It returns a success code; if negative,
the code will be propagated up to the call to UNDO_DoUndo and UNDO_DoRedo,
and UNDO_DiscardAll will be called. Note that the undoit function almost
always ends up calling UNDO_LogEvent again, to log the function to undo thie
undoing of this action. If you get my drift.
The "freeit" function is called when the undo library decides it will never
ever call undoit function. It is called with the closure to free storage
used by the closure.
If this fails (we ran out of memory), then it will return a negative failure
code, and call UNDO_DiscardAll() and the freeit func. */
/* Note you can use the tag arguments to associate the event with
some user defined tag e.g., a name or object identifying the event. */
#ifdef XP_OS2
typedef int (*PNSLUFN)(void *);
typedef void (*PNSLFFN)(void *);
extern int UNDO_LogEvent(UndoState* state, PNSLUFN undoit,
PNSLFFN freeit, void* closure,
PNSLFFN freetag, void* tag);
#else
extern int UNDO_LogEvent(UndoState* state, int (*undoit)(void*),
void (*freeit)(void*), void* closure,
void (*freetag)(void*), void* tag);
#endif
/* Retrieve the undo/redo tag from the top of the corresponding stack. The
tag is the "thing" YOU assigned during either an UNDO_EndBatch() or
UNDO_LogEvent call. You most likely use the tag to identify the event[s]
that can be undone/redone.
e.g., Label the Edit|Undo menu item with, say, Edit|Undo Delete. */
extern void *UNDO_PeekUndoTag(UndoState* state);
extern void *UNDO_PeekRedoTag(UndoState* state);
XP_END_PROTOS
#endif /* !_UNDO_H_ */

View File

@@ -0,0 +1,71 @@
/* -*- Mode: C; tab-width: 8; 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.
*/
/*
* dns.h --- portable nonblocking DNS for Unix
* Created: Jamie Zawinski <jwz@netscape.com>, 19-Dec-96.
*/
#ifndef __UNIX_DNS_H__
#define __UNIX_DNS_H__
/* Kick off an async DNS lookup;
The returned value is an id representing this transaction;
the result_callback will be run (in the main process) when we
have a result. Returns negative if something went wrong.
If `status' is negative,`result' is an error message.
If `status' is positive, `result' is a 4-character string of
the IP address.
If `status' is 0, then the lookup was prematurely aborted
via a call to DNS_AbortHostLookup().
*/
extern int DNS_AsyncLookupHost(const char *name,
int (*result_callback) (void *id,
void *closure,
int status,
const char *result),
void *closure,
void **id_return);
/* Prematurely give up on the given host-lookup transaction.
The `id' is what was returned by DNS_AsyncLookupHost.
This causes the result_callback to be called with a negative
status.
*/
extern int DNS_AbortHostLookup(void *id);
/* Call this from main() to initialize the async DNS library.
Returns a file descriptor that should be selected for, or
negative if something went wrong. Pass it the argc/argv
that your `main' was called with (it needs these pointers
in order to give its forked subprocesses sensible names.)
*/
extern int DNS_SpawnProcess(int argc, char **argv);
/* The main select() loop of your program should call this when the fd
that was returned by DNS_SpawnProcess comes active. This may cause
some of the result_callback functions to run.
If this returns negative, then a fatal error has happened, and you
should close `fd' and not select() for it again. Call gethostbyname()
in the foreground or something.
*/
extern int DNS_ServiceProcess(int fd);
#endif /* __UNIX_DNS_H__ */

76
mozilla/include/vcc.h Normal file
View File

@@ -0,0 +1,76 @@
/* -*- 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.
*/
/***************************************************************************
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
For purposes of this license notice, the term Licensors shall mean,
collectively, Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
The term Licensor shall mean any of the Licensors.
Subject to acceptance of the following conditions, permission is hereby
granted by Licensors without the need for written agreement and without
license or royalty fees, to use, copy, modify and distribute this
software for any purpose.
The above copyright notice and the following four paragraphs must be
reproduced in all copies of this software and any software including
this software.
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
MODIFICATIONS.
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
***************************************************************************/
#ifndef __VCC_H__
#define __VCC_H__ 1
XP_BEGIN_PROTOS
#include "vobject.h"
VObject* Parse_MIME(const char *input, unsigned long len);
VObject* Parse_MIME_FromFile(XP_File file);
VObject* Parse_MIME_FromFileName(char* fname);
typedef void (*MimeErrorHandler)(char *);
void registerMimeErrorHandler(MimeErrorHandler);
XP_END_PROTOS
#endif /* __VCC_H__ */

424
mozilla/include/vobject.h Normal file
View File

@@ -0,0 +1,424 @@
/* -*- 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.
*/
/***************************************************************************
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
For purposes of this license notice, the term Licensors shall mean,
collectively, Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
The term Licensor shall mean any of the Licensors.
Subject to acceptance of the following conditions, permission is hereby
granted by Licensors without the need for written agreement and without
license or royalty fees, to use, copy, modify and distribute this
software for any purpose.
The above copyright notice and the following four paragraphs must be
reproduced in all copies of this software and any software including
this software.
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
MODIFICATIONS.
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
***************************************************************************/
/*
The vCard/vCalendar C interface is implemented in the set
of files as follows:
vcc.y, yacc source, and vcc.c, the yacc output you will use
implements the core parser
vobject.c implements an API that insulates the caller from
the parser and changes in the vCard/vCalendar BNF
port.h defines compilation environment dependent stuff
vcc.h and vobject.h are header files for their .c counterparts
vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
which you may find useful.
test.c is a standalone test driver that exercises some of
the features of the APIs provided. Invoke test.exe on a
VCARD/VCALENDAR input text file and you will see the pretty
print output of the internal representation (this pretty print
output should give you a good idea of how the internal
representation looks like -- there is one such output in the
following too). Also, a file with the .out suffix is generated
to show that the internal representation can be written back
in the original text format.
For more information on this API see the readme.txt file
which accompanied this distribution.
Also visit:
http://www.versit.com
http://www.ralden.com
*/
#ifndef __VOBJECT_H__
#define __VOBJECT_H__ 1
#include "xp.h"
#include "xp_file.h"
/*
Unfortunately, on the Mac (and possibly other platforms) with our current, out-dated
libraries (Plauger), |wchar_t| is defined incorrectly, which breaks vcards.
We can't fix Plauger because it doesn't come with source. Later, when we
upgrade to MSL, we can make this evil hack go away. In the mean time,
vcards are not allowed to use the (incorrectly defined) |wchar_t| type. Instead,
they will use an appropriately defined local type |vwchar_t|.
*/
#ifdef XP_MAC
typedef uint16 vwchar_t;
#else
typedef wchar_t vwchar_t;
#endif
XP_BEGIN_PROTOS
#define VC7bitProp "7bit"
#define VC8bitProp "8bit"
#define VCAAlarmProp "aalarm"
#define VCAdditionalNamesProp "addn"
#define VCAdrProp "adr"
#define VCAgentProp "agent"
#define VCAIFFProp "aiff"
#define VCAOLProp "aol"
#define VCAppleLinkProp "applelink"
#define VCAttachProp "attach"
#define VCAttendeeProp "attendee"
#define VCATTMailProp "attmail"
#define VCAudioContentProp "audiocontent"
#define VCAVIProp "avi"
#define VCBase64Prop "base64"
#define VCBBSProp "bbs"
#define VCBirthDateProp "bday"
#define VCBMPProp "bmp"
#define VCBodyProp "body"
#define VCBusinessRoleProp "role"
#define VCCalProp "vcalendar"
#define VCCaptionProp "cap"
#define VCCardProp "vcard"
#define VCCarProp "car"
#define VCCategoriesProp "categories"
#define VCCellularProp "cell"
#define VCCGMProp "cgm"
#define VCCharSetProp "cs"
#define VCCIDProp "cid"
#define VCCISProp "cis"
#define VCCityProp "l"
#define VCClassProp "class"
#define VCCommentProp "note"
#define VCCompletedProp "completed"
#define VCContentIDProp "content-id"
#define VCCountryNameProp "c"
#define VCDAlarmProp "dalarm"
#define VCDataSizeProp "datasize"
#define VCDayLightProp "daylight"
#define VCDCreatedProp "dcreated"
#define VCDeliveryLabelProp "label"
#define VCDescriptionProp "description"
#define VCDIBProp "dib"
#define VCDisplayStringProp "displaystring"
#define VCDomesticProp "dom"
#define VCDTendProp "dtend"
#define VCDTstartProp "dtstart"
#define VCDueProp "due"
#define VCEmailAddressProp "email"
#define VCEncodingProp "encoding"
#define VCEndProp "end"
#define VCEventProp "vevent"
#define VCEWorldProp "eworld"
#define VCExNumProp "exnum"
#define VCExpDateProp "exdate"
#define VCExpectProp "expect"
#define VCExtAddressProp "ext add"
#define VCFamilyNameProp "f"
#define VCFaxProp "fax"
#define VCFullNameProp "fn"
#define VCGeoProp "geo"
#define VCGeoLocationProp "geo"
#define VCGIFProp "gif"
#define VCGivenNameProp "g"
#define VCGroupingProp "grouping"
#define VCHomeProp "home"
#define VCIBMMailProp "ibmmail"
#define VCInlineProp "inline"
#define VCInternationalProp "intl"
#define VCInternetProp "internet"
#define VCISDNProp "isdn"
#define VCJPEGProp "jpeg"
#define VCLanguageProp "lang"
#define VCLastModifiedProp "last-modified"
#define VCLastRevisedProp "rev"
#define VCLocationProp "location"
#define VCLogoProp "logo"
#define VCMailerProp "mailer"
#define VCMAlarmProp "malarm"
#define VCMCIMailProp "mcimail"
#define VCMessageProp "msg"
#define VCMETProp "met"
#define VCModemProp "modem"
#define VCMPEG2Prop "mpeg2"
#define VCMPEGProp "mpeg"
#define VCMSNProp "msn"
#define VCNamePrefixesProp "npre"
#define VCNameProp "n"
#define VCNameSuffixesProp "nsuf"
#define VCNoteProp "note"
#define VCOrgNameProp "orgname"
#define VCOrgProp "org"
#define VCOrgUnit2Prop "oun2"
#define VCOrgUnit3Prop "oun3"
#define VCOrgUnit4Prop "oun4"
#define VCOrgUnitProp "oun"
#define VCPagerProp "pager"
#define VCPAlarmProp "palarm"
#define VCParcelProp "parcel"
#define VCPartProp "part"
#define VCPCMProp "pcm"
#define VCPDFProp "pdf"
#define VCPGPProp "pgp"
#define VCPhotoProp "photo"
#define VCPICTProp "pict"
#define VCPMBProp "pmb"
#define VCPostalBoxProp "box"
#define VCPostalCodeProp "pc"
#define VCPostalProp "postal"
#define VCPowerShareProp "powershare"
#define VCPreferredProp "pref"
#define VCPriorityProp "priority"
#define VCProcedureNameProp "procedurename"
#define VCProdIdProp "prodid"
#define VCProdigyProp "prodigy"
#define VCPronunciationProp "sound"
#define VCPSProp "ps"
#define VCPublicKeyProp "key"
#define VCQPProp "qp"
#define VCQuickTimeProp "qtime"
#define VCQuotedPrintableProp "quoted-printable"
#define VCRDateProp "rdate"
#define VCRegionProp "r"
#define VCRelatedToProp "related-to"
#define VCRepeatCountProp "repeatcount"
#define VCResourcesProp "resources"
#define VCRNumProp "rnum"
#define VCRoleProp "role"
#define VCRRuleProp "rrule"
#define VCRSVPProp "rsvp"
#define VCRunTimeProp "runtime"
#define VCSequenceProp "sequence"
#define VCSnoozeTimeProp "snoozetime"
#define VCStartProp "start"
#define VCStatusProp "status"
#define VCStreetAddressProp "street"
#define VCSubTypeProp "subtype"
#define VCSummaryProp "summary"
#define VCTelephoneProp "tel"
#define VCTIFFProp "tiff"
#define VCTimeZoneProp "tz"
#define VCTitleProp "title"
#define VCTLXProp "tlx"
#define VCTodoProp "vtodo"
#define VCTranspProp "transp"
#define VCUniqueStringProp "uid"
#define VCURLProp "url"
#define VCURLValueProp "urlval"
#define VCValueProp "value"
#define VCVersionProp "version"
#define VCVideoProp "video"
#define VCVoiceProp "voice"
#define VCWAVEProp "wave"
#define VCWMFProp "wmf"
#define VCWorkProp "work"
#define VCX400Prop "x400"
#define VCX509Prop "x509"
#define VCXRuleProp "xrule"
#define VCCooltalk "x-mozilla-cpt"
#define VCCooltalkAddress "x-moxilla-cpadr"
#define VCUseServer "x-mozilla-cpsrv"
#define VCUseHTML "x-mozilla-html"
/* return type of vObjectValueType: */
#define VCVT_NOVALUE 0
/* if the VObject has no value associated with it. */
#define VCVT_STRINGZ 1
/* if the VObject has value set by setVObjectStringZValue. */
#define VCVT_USTRINGZ 2
/* if the VObject has value set by setVObjectUStringZValue. */
#define VCVT_UINT 3
/* if the VObject has value set by setVObjectIntegerValue. */
#define VCVT_ULONG 4
/* if the VObject has value set by setVObjectLongValue. */
#define VCVT_RAW 5
/* if the VObject has value set by setVObjectAnyValue. */
#define VCVT_VOBJECT 6
/* if the VObject has value set by setVObjectVObjectValue. */
#define NAME_OF(o) o->id
#define VALUE_TYPE(o) o->valType
#define STRINGZ_VALUE_OF(o) o->val.strs
#define USTRINGZ_VALUE_OF(o) o->val.ustrs
#define INTEGER_VALUE_OF(o) o->val.i
#define LONG_VALUE_OF(o) o->val.l
#define ANY_VALUE_OF(o) o->val.any
#define VOBJECT_VALUE_OF(o) o->val.vobj
typedef struct VObject VObject;
typedef union ValueItem {
const char *strs;
const vwchar_t *ustrs;
unsigned int i;
unsigned long l;
void *any;
VObject *vobj;
} ValueItem;
struct VObject {
VObject *next;
const char *id;
VObject *prop;
unsigned short valType;
ValueItem val;
};
typedef struct StrItem StrItem;
struct StrItem {
StrItem *next;
const char *s;
unsigned int refCnt;
};
typedef struct OFile {
XP_File fp;
char *s;
int len;
int limit;
int alloc:1;
int fail:1;
} OFile;
typedef struct VObjectIterator {
VObject* start;
VObject* next;
} VObjectIterator;
VObject* newVObject(const char *id);
void deleteVObject(VObject *p);
char* dupStr(const char *s, unsigned int size);
void deleteStr(const char *p);
void unUseStr(const char *s);
void setVObjectName(VObject *o, const char* id);
void setVObjectStringZValue(VObject *o, const char *s);
void setVObjectStringZValue_(VObject *o, const char *s);
void setVObjectUStringZValue(VObject *o, const vwchar_t *s);
void setVObjectUStringZValue_(VObject *o, const vwchar_t *s);
void setVObjectIntegerValue(VObject *o, unsigned int i);
void setVObjectLongValue(VObject *o, unsigned long l);
void setVObjectAnyValue(VObject *o, void *t);
VObject* setValueWithSize(VObject *prop, void *val, unsigned int size);
VObject* setValueWithSize_(VObject *prop, void *val, unsigned int size);
const char* vObjectName(VObject *o);
const char* vObjectStringZValue(VObject *o);
const vwchar_t* vObjectUStringZValue(VObject *o);
unsigned int vObjectIntegerValue(VObject *o);
unsigned long vObjectLongValue(VObject *o);
void* vObjectAnyValue(VObject *o);
VObject* vObjectVObjectValue(VObject *o);
void setVObjectVObjectValue(VObject *o, VObject *p);
VObject* addVObjectProp(VObject *o, VObject *p);
VObject* addProp(VObject *o, const char *id);
VObject* addProp_(VObject *o, const char *id);
VObject* addPropValue(VObject *o, const char *p, const char *v);
VObject* addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
VObject* addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
VObject* addGroup(VObject *o, const char *g);
void addList(VObject **o, VObject *p);
VObject* isAPropertyOf(VObject *o, const char *id);
VObject* nextVObjectInList(VObject *o);
void initPropIterator(VObjectIterator *i, VObject *o);
int moreIteration(VObjectIterator *i);
VObject* nextVObject(VObjectIterator *i);
extern void printVObject(XP_File fp,VObject *o);
void printVObject_(XP_File fp, VObject *o, int level);
extern void writeVObject(XP_File fp, VObject *o);
void writeVObject_(OFile *fp, VObject *o, XP_Bool expandSpaces);
char* writeMemVObject(char *s, int *len, VObject *o);
char* writeMemVObjects(char *s, int *len, VObject *list, XP_Bool expandSpaces);
const char* lookupStr(const char *s);
void cleanStrTbl();
void cleanVObject(VObject *o);
void cleanVObjects(VObject *list);
const char* lookupProp(const char* str);
const char* lookupProp_(const char* str);
vwchar_t* fakeUnicode(const char *ps, int *bytes);
int uStrLen(const vwchar_t *u);
char* fakeCString(const vwchar_t *u);
void printVObjectToFile(char *fname,VObject *o);
void printVObjectsToFile(char *fname,VObject *list);
void writeVObjectToFile(char *fname, VObject *o);
void writeVObjectsToFile(char *fname, VObject *list);
#define MAXPROPNAMESIZE 256
#define MAXMOZPROPNAMESIZE 16
XP_END_PROTOS
#endif /* __VOBJECT_H__ */

117
mozilla/include/winfile.h Normal file
View File

@@ -0,0 +1,117 @@
/* -*- 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.
*/
/* ---------------------------------------------------------------------------
Stuff to fake unix file I/O on windows boxes
------------------------------------------------------------------------*/
#ifndef WINFILE_H
#define WINFILE_H
#ifdef _WINDOWS
#if defined(XP_WIN32) || defined(_WIN32)
/* 32-bit stuff here */
#include <windows.h>
#include <stdlib.h>
#include <sys\types.h>
#include <sys\stat.h>
typedef struct DIR_Struct {
void * directoryPtr;
WIN32_FIND_DATA data;
} DIR;
#define _ST_FSTYPSZ 16
#ifndef __BORLANDC__
typedef unsigned long mode_t;
typedef long uid_t;
typedef long gid_t;
typedef long off_t;
typedef unsigned long nlink_t;
#endif
typedef struct timestruc {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
} timestruc_t;
struct dirent { /* data from readdir() */
ino_t d_ino; /* inode number of entry */
off_t d_off; /* offset of disk direntory entry */
unsigned short d_reclen; /* length of this record */
char d_name[_MAX_FNAME]; /* name of file */
};
#ifndef __BORLANDC__
#define S_ISDIR(s) ((s) & _S_IFDIR)
#endif
#else /* _WIN32 */
/* 16-bit windows stuff */
#include <sys\types.h>
#include <sys\stat.h>
#include <dos.h>
/* Getting cocky to support multiple file systems */
typedef struct dirStruct_tag {
struct _find_t file_data;
char c_checkdrive;
} dirStruct;
typedef struct DIR_Struct {
void * directoryPtr;
dirStruct data;
} DIR;
#define _ST_FSTYPSZ 16
typedef unsigned long mode_t;
typedef long uid_t;
typedef long gid_t;
typedef long off_t;
typedef unsigned long nlink_t;
typedef struct timestruc {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
} timestruc_t;
struct dirent { /* data from readdir() */
ino_t d_ino; /* inode number of entry */
off_t d_off; /* offset of disk direntory entry */
unsigned short d_reclen; /* length of this record */
#ifdef XP_WIN32
char d_name[_MAX_FNAME]; /* name of file */
#else
char d_name[20]; /* name of file */
#endif
};
#define S_ISDIR(s) ((s) & _S_IFDIR)
#endif /* 16-bit windows */
#define CONST const
#endif /* _WINDOWS */
#endif /* WINFILE_H */

179
mozilla/include/xlate.h Normal file
View File

@@ -0,0 +1,179 @@
/* -*- 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.
*/
/*
** External points of interest for the translation library
*/
#ifndef XLATE_H
#define XLATE_H
typedef void (*XL_CompletionRoutine)(PrintSetup*);
typedef void* XL_TextTranslation;
typedef void* XL_PostscriptTranslation;
XP_BEGIN_PROTOS
extern void XL_InitializePrintSetup(PrintSetup *p);
extern void XL_InitializeTextSetup(PrintSetup *p);
extern void XL_TranslatePostscript(MWContext*, URL_Struct *u,
SHIST_SavedData *sd, PrintSetup*p);
extern XL_TextTranslation
XL_TranslateText(MWContext *, URL_Struct *u, PrintSetup*p);
extern void XL_GetTextImage(LO_ImageStruct *image);
extern void
XL_DisplayTextImage(MWContext *cx, int iLocation, LO_ImageStruct *img);
extern XP_Bool XP_CheckElementSpan(MWContext*, int top, int height);
extern void XP_InitializePrintInfo(MWContext *);
extern void XP_CleanupPrintInfo(MWContext *);
extern void XP_DrawForPrint(MWContext *, int );
extern void XP_LayoutForPrint(MWContext *cx, int32 doc_height);
XP_END_PROTOS
typedef struct LineRecord_struct LineRecord;
/*
** PAGE coordinates are 720/inch, layout happens in this space
** POINT coordinates are 72/inch, the printer wants these
*/
#define INCH_TO_PAGE(f) ((int) (.5 + (f)*720))
#define PAGE_TO_POINT_I(f) ((int) ((f) / 10.0))
#define PAGE_TO_POINT_F(f) ((f) / 10.0)
#define POINT_TO_PAGE(p) ((p)*10)
/*
** Used to pass info into text and/or postscript translation
*/
struct PrintSetup_ {
int top; /* Margins (PostScript Only) */
int bottom;
int left;
int right;
int width; /* Paper size, # of cols for text xlate */
int height;
char* header;
char* footer;
int *sizes;
XP_Bool reverse; /* Output order */
XP_Bool color; /* Image output */
XP_Bool deep_color; /* 24 bit color output */
XP_Bool landscape; /* Rotated output */
XP_Bool underline; /* underline links */
XP_Bool scale_images; /* Scale unsized images which are too big */
XP_Bool scale_pre; /* do the pre-scaling thing */
float dpi; /* dpi for externally sized items */
float rules; /* Scale factor for rulers */
int n_up; /* cool page combining */
int bigger; /* Used to init sizes if sizesin NULL */
char* prefix; /* For text xlate, prepended to each line */
char* eol; /* For text translation, line terminator */
char* bullet; /* What char to use for bullets */
struct URL_Struct_ *url; /* url of doc being translated */
XP_File out; /* Where to send the output */
char *filename; /* output file name, if any */
XL_CompletionRoutine completion; /* Called when translation finished */
void* carg; /* Data saved for completion routine */
int status; /* Status of URL on completion */
/* "other" font is typically East Asian */
char *otherFontName; /* name of "other" PostScript font */
int16 otherFontCharSetID; /* charset ID of "other" font */
int otherFontWidth; /* width of "other" font (square) */
int otherFontAscent; /* Ascent of "other" font (square) */
MWContext *cx; /* original context, if available */
};
#define XL_LOADING_PHASE 1
#define XL_LAYOUT_PHASE 2
#define XL_DRAW_PHASE 3
typedef struct page_breaks {
int32 y_top;
int32 y_break;
} PageBreaks;
/*
** Used to store state needed while translation is in progress
*/
struct PrintInfo_ {
/*
** BEGIN SPECIAL
** If using the table print code, the following fields must
** be properly set up.
*/
int32 page_height; /* Size of printable area on page */
int32 page_width; /* Size of printable area on page */
int32 page_break; /* Current page bottom */
int32 page_topy; /* Current page top */
int phase;
/*
** CONTINUE SPECIAL
** The table print code maintains these
*/
PageBreaks *pages; /* Contains extents of each page */
int pt_size; /* Size of above table */
int n_pages; /* # of valid entries in above table */
/*
** END SPECIAL
*/
/*
** AAAOOOGAH
**
** These are used to cache values from the originating context's
** function table
*/
void (*scnatt)(MWContext*); /* SetCallNetlibAllTheTime */
void (*ccnatt)(MWContext*); /* CLearCallNetlibAllTheTime */
char* doc_title; /* best guess at title */
int32 doc_width; /* Total document width */
int32 doc_height; /* Total document height */
#ifdef LATER
float scale; /* for shrinking pre areas */
int32 pre_start; /* First y of current pre section */
int32 pre_end; /* Last y of current pre section */
XP_List *interesting; /* List of pre's about which I care */
XP_Bool in_pre; /* True when inside a <pre> section */
#endif
/*
** These fields are used only by the text translator
*/
char *line; /* Pointer to data for the current line */
XP_Bool in_table; /* True when caching lines in a table */
XP_Bool first_line_p; /* true when the first line has not yet been
output - this is a kludge for the mail
citation code. */
int table_top, /* Size of the table being cached */
table_bottom;
LineRecord *saved_lines; /* cached lines for tables */
int last_y; /* Used to track blank lines */
};
#endif /* XLATE_H */

43
mozilla/include/xp.h Normal file
View File

@@ -0,0 +1,43 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
xp.h
This file is left around for backwards compatability. Nothing new should
be added to this file. Rather, add it to the client specific section or
the cross-platform specific area depending on what is appropriate.
-------------------------------------------------------------------------*/
#ifndef _XP_H_
#define _XP_H_
#include "xp_mcom.h"
#include "client.h"
#ifdef HEAPAGENT
#define MEM_DEBUG 1
#define DEFINE_NEW_MACRO 1
#include <heapagnt.h>
#endif /* HEAPAGENT */
#endif /* !_XP_H_ */

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