Backed out changeset 2df29cb1ed93

This commit is contained in:
Dão Gottwald 2009-02-07 15:07:36 +01:00
parent 50800d3098
commit ea2cd336bb
12 changed files with 3533 additions and 0 deletions

8
xpcom/doc/README Normal file
View File

@ -0,0 +1,8 @@
<HTML>
<HEAD>
<TITLE>READ ME</TITLE>
</HEAD>
<BODY>
<H4><P>
XPCOM documentation can be found at <a href="http://www.mozilla.org/projects/xpcom>www.mozilla.org/projects/xpcom</a>

View File

@ -0,0 +1,13 @@
<html>
<head>
<title>Document Moved!</title>
</head>
<body bgcolor = "white">
<center>The xptcall porting document has been moved to:
<P>
<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/porting.html">http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/porting.html</a>
<P>
Please update your links.
</center>
</body>
</html>

View File

@ -0,0 +1,13 @@
<html>
<head>
<title>Document Moved!</title>
</head>
<body bgcolor = "white">
<center>The xptcall status document has been moved to:
<P>
<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/status.html">http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/status.html</a>
<P>
Please update your links.
</center>
</body>
</html>

View File

@ -0,0 +1,6 @@
see:
http://www.mozilla.org/scriptable/xptcall-faq.html
and
http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/porting.html

View File

@ -0,0 +1,212 @@
<html>
<head>
<title>xptcall Porting Guide</title>
</head>
<body bgcolor = "white">
<h2><center>xptcall Porting Guide</center></h2>
<h3>Overview</h3>
<blockquote>
<a href="http://www.mozilla.org/scriptable/xptcall-faq.html"> xptcall</a> is a
library that supports both invoking methods on arbitrary xpcom objects and
implementing classes whose objects can impersonate any xpcom interface. It does
this using platform specific assembly language code. This code needs to be
ported to all platforms that want to support xptcall (and thus mozilla).
</blockquote>
<h3>The tree</h3>
<blockquote>
<pre>
<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall">mozilla/xpcom/reflect/xptcall</a>
+--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public">public</a> // exported headers
+--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src">src</a> // core source
| \--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md">md</a> // platform specific parts
| +--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/mac">mac</a> // mac ppc
| +--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> // all unix
| \--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32">win32</a> // win32
| +--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/test">test</a> // simple tests to get started
\--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/tests">tests</a> // full tests via api
</pre>
Porters are free to create subdirectories under the base <code>md</code>
directory for their given platforms and to integrate into the build system as
appropriate for their platform.
</blockquote>
<h3>Theory of operation</h3>
<blockquote>
There are really two pieces of functionality: <i>invoke</i> and <i>stubs</i>...
<p>
The <b><i>invoke</i></b> functionality requires the implementation of the
following on each platform (from <a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/xptcall.h">xptcall/public/xptcall.h</a>):
<pre>
XPTC_PUBLIC_API(nsresult)
NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount, nsXPTCVariant* params);
</pre>
Calling code is expected to supply an array of <code>nsXPTCVariant</code>
structs. These are discriminated unions describing the type and value of each
parameter of the target function. The platform specific code then builds a call
frame and invokes the method indicated by the index <code>methodIndex</code> on
the xpcom interface <code>that</code>.
<p>
Here are examples of this implementation for
<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp">Win32</a>
and
<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp">Linux x86, NetBSD x86, and FreeBSD</a>.
Both of these implementations use the basic strategy of: figure out how much
stack space is needed for the params, make the space in a new frame, copy the
params to that space, invoke the method, cleanup and return. C++ is used where
appropriate, Assembly language is used where necessary. Inline assembly language is used here,
but it is equally valid to use separate assembly language source files. Porters
can decide how best to do this for their platforms.
<p>
The <b><i>stubs</i></b> functionality is more complex. The goal here is a class
whose vtbl can look like the vtbl of any arbitrary xpcom interface. Objects of
this class can then be built to impersonate any xpcom object. The base interface
for this is (from <a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/xptcall.h">xptcall/public/xptcall.h</a>):
<pre>
class nsXPTCStubBase : public nsISupports
{
public:
// Include generated vtbl stub declarations.
// These are virtual and *also* implemented by this class..
#include "xptcstubsdecl.inc"
// The following methods must be provided by inheritor of this class.
// return a refcounted pointer to the InterfaceInfo for this object
// NOTE: on some platforms this MUST not fail or we crash!
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info) = 0;
// call this method and return result
NS_IMETHOD CallMethod(PRUint16 methodIndex,
const nsXPTMethodInfo* info,
nsXPTCMiniVariant* params) = 0;
};
</pre>
Code that wishes to make use of this <i>stubs</i> functionality (such as
<a href="http://www.mozilla.org/scriptable/">XPConnect</a>) implement a class
which inherits from <code>nsXPTCStubBase</code> and implements the
<code>GetInterfaceInfo</code> and <code>CallMethod</code> to let the
platform specific code know how to get interface information and how to dispatch methods
once their parameters have been pulled out of the platform specific calling
frame.
<p>
Porters of this functionality implement the platform specific code for the
<i>stub</i> methods that fill the vtbl for this class. The idea here is that the
class has a vtbl full of a large number of generic stubs. All instances of this
class share that vtbl and the same stubs. The stubs forward calls to a platform
specific method that uses the interface information supplied by
the overridden <code>GetInterfaceInfo</code> to extract the parameters and build
an array of platform independent <code>nsXPTCMiniVariant</code> structs which
are in turn passed on to the overridden <code>CallMethod</code>. The
platform dependent code is responsible for doing any cleanup and returning.
<p>
The stub methods are declared in <a
href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/xptcstubsdecl.inc">xptcall/public/xptcstubsdecl.inc</a>.
These are '#included' into the declaration of <code>nsXPTCStubBase</code>. A
similar include file (<a
href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/xptcstubsdef.inc">xptcall/public/xptcstubsdef.inc</a>)
is expanded using platform specific macros to define the stub functions. These
'.inc' files are checked into cvs. However, they can be regenerated as necessary
(i.e. to change the number of stubs or to change their specific declaration)
using the Perl script <a
href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/genstubs.pl">xptcall/public/genstubs.pl</a>.
<p>
Here are examples of this implementation for <a
href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp">Win32</a>
and <a
href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp">Linux x86, NetBSD x86, and FreeBSD</a>.
Both of these examples use inline assembly language. That is just how I
decided to do it. You can do it as you choose.
<p>
The Win32 version is somewhat tighter because the __declspec(naked) feature
allows for very small stubs. However, the __stdcall requires the callee to clean
up the stack, so it is imperative that the interface information scheme allow
the code to determine the correct stack pointer fixup for return without fail,
else the process will crash.
<p>
I opted to use inline assembler for the gcc Linux x86 port. I ended up with
larger stubs than I would have preferred rather than battle the compiler over
what would happen to the stack before my asm code began running.
<p>
I believe that the non-assembly parts of these files can be copied and reused
with minimal (but not zero) platform specific tweaks. Feel free to copy and
paste as necessary. Please remember that safety and reliability are more
important than speed optimizations. This code is primarily used to connect XPCOM
components with JavaScript; function call overhead is a <b>tiny</b> part of the
time involved.
<p>
I put together
<a
href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/test">xptcall/src/md/test
</a> as a place to evolve the basic functionality as a port is coming together.
Not all of the functionality is exercised, but it is a place to get started.
<a
href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/tests">xptcall/tests
</a> has an api level test for <code>NS_InvokeByIndex</code>, but no tests for
the <i>stubs</i> functionality. Such a test ought to be written, but this has not
yet been done.
<p>
A full 'test' at this point requires building the client and running the
XPConnect test called <i>TestXPC</i> in
<a
href="http://lxr.mozilla.org/mozilla/source/js/src/xpconnect/tests">mozilla/js/src/xpconnect/tests
</a>.
<p>
Getting these ports done is very important. Please let <a
href="mailto:jband@netscape.com">me</a> know if you are interested in doing one.
I'll answer any questions as I get them.
<p>
<a
href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/status.html">
Porting Status
</a>
</blockquote>
<hr>
<b>Author:</b> <a href="mailto:jband@netscape.com">John Bandhauer &lt;jband@netscape.com&gt;</a><br>
<b>Last modified:</b> 31 May 1999
</body>
</html>

View File

@ -0,0 +1,408 @@
<html>
<head>
<title>xptcall Porting Status</title>
</head>
<body bgcolor = "white">
<h2><center>xptcall Porting Status</center></h2>
<h3>What is this?</h3>
This is a status page for the multiplatform porting of xptcall.
xptcall has a
<a href="http://www.mozilla.org/scriptable/xptcall-faq.html">FAQ</a>
and a
<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/porting.html">Porting Guide</a>.
<p>
This is being maintained by <a href="mailto:jband@netscape.com">John Bandhauer &lt;jband@netscape.com&gt;</a>.
Feel free to email me with questions or to volunteer to contribute xptcall code for any platform.
<p>
<a href="mailto:shaver@mozilla.org">Mike Shaver &lt;shaver@mozilla.org&gt;</a>
is the best contact regarding 'nix (Unix, Linux, Finux, etc.) ports of xptcall.
<h3>Status</h3>
<table BORDER="1">
<TR align="left" BGCOLOR="yellow">
<TH>Status</TH>
<TH>Platform</TH>
<TH><img src="http://tinderbox.mozilla.org/star.gif">Contributors and <font color="red"><b>?</b></font> Possible Contributors</TH>
<TH>Notes</TH>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Win32 x86</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:jband@netscape.com">John Bandhauer &lt;jband@netscape.com&gt;</a>
</TD>
<TD>
<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32">win32</a></TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Linux x86</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:jband@netscape.com">John Bandhauer &lt;jband@netscape.com&gt;</a><br>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:drepper@cygnus.com">Ulrich Drepper &lt;drepper@cygnus.com&gt;</a>
</TD>
<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a>
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>FreeBSD and NetBSD x86</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:toshok@hungry.com">Christoph Toshok &lt;toshok@hungry.com&gt;</a>,<BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:jband@netscape.com">John Bandhauer &lt;jband@netscape.com&gt;</a></TD>
<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> (same as Linux 86 code)</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>BSD/OS x86</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:bert_driehuis@nl.compuware.com">Bert Driehuis &lt;bert_driehuis@nl.compuware.com&gt;</a></TD>
<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> (same as Linux 86 code)
Bert contributed patches that *should* do the right thing for all the unixish-x86
versions of this code for GCC 2.7 or 2.8 vs. EGCS 1.1. He notes that the vtbl
scheme is different. He is hoping that others will help test the changes using
these two compilers on the various platforms where this same code is used.
<a href="news://news.mozilla.org/372DD257.4248C821%40nl.compuware.com">Bert's details</a>
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Mac PPC</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:rogerl@netscape.com">Roger Lawrence &lt;rogerl@netscape.com&gt;</a>,<BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:beard@netscape.com">Patrick Beard &lt;beard@netscape.com&gt;</a>
</TD>
<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/mac">mac</a> (passing tests and checked in)</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Solaris Sparc</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:rogerl@netscape.com">Roger Lawrence &lt;rogerl@netscape.com&gt;</a>,<BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:mcafee@netscape.com">Chris McAfee &lt;mcafee@netscape.com&gt;</a>
</TD>
<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> This is checked in and working.</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Solaris Sparc v9 (64bit)</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:pavlov@netscape.com">Stuart Parmenter &lt;pavlov@netscape.com&gt;</a>,<BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:cls@seawood.org">Chris Seawood &lt;cls@seawood.org&gt;</a>
</TD>
<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> This is checked in and (pavlov claims!) working.</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>OS/2</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:mjf35@cam.ac.uk">John Fairhurst &lt;mjf35@cam.ac.uk&gt;</a></TD>
<TD>I never heard exactly who did what. But mozilla has been working on OS/2
for a long time now.
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>OpenVMS Alpha</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:colin@theblakes.com">Colin R. Blake &lt;colin@theblakes.com&gt;</a></TD>
<TD>
Colin says this is passing all the tests on OpenVMS Alpha!
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>NT Alpha</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:bob@guiduck.com">bob meader &lt;bob@guiduck.com&gt;</a></TD>
<TD>
bob writes:<br>
Enclosed is xptcall for alpha/nt target..
<p>
It is a variation of the IRIS port (only targeted for win32).
<p>
Notice the last 2 files (the change to mozilla\xpcom\build\makefile.win and
mozilla\xpcom\build) are needed because I was unable to figure how to do a
"declspecexport" from the assembler ASAXP ... if some knows how to do that then
those last 2 files won't be needed.
<p>
I have had someone look over this code at bridge.com (the entry point to
compaq/gem compiler team) and this code was given the OK. I consider it "done".
<p>
This code lives in the files where the name includes 'alpha' in the <a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32">win32</a> directory.<BR>
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Linux ARM</TD>
<TD><img alt="Started" title="Started" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:sh990154@mail.uni-greifswald.de">Stefan Hanske&lt;sh990154@mail.uni-greifswald.de&gt;</a><BR>
<font color="red"><b>?</b></font>
<a href="mailto:willy@bofh.ai">Matthew Wilcox &lt;willy@bofh.ai&gt;</a></TD>
<TD>
Stefan's code is checked in and he says it is working.
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Linux Sparc</TD>
<TD>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:anton@progsoc.uts.edu.au">Anton Blanchard &lt;anton@progsoc.uts.edu.au&gt;</a>,
<BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:rogerl@netscape.com">Roger Lawrence &lt;rogerl@netscape.com&gt;</a>,
<BR>
<img alt="Maybe" title="Maybe" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:ehle.3@osu.eduehle.3@osu.edu">Brandon Ehle &lt;ehle.3@osu.edu&gt;</a>
</TD>
<TD>
Anton contributed patches to Roger's Sparc code. Anton says it works and passes the tests!<b>
(24-Aug-1999) Brandon writes: I've finished testing XPTCALL Sparc Linux on 12 different Sparc machines and it checks out good.
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Linux PPC</TD>
<TD>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:beard@netscape.com">Patrick Beard &lt;beard@netscape.com&gt;</a><BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:waterson@netscape.com">Chris Waterson &lt;waterson@netscape.com&gt;</a><BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:Franz.Sirl-kernel@lauterbach.com">Franz Sirl &lt;Franz.Sirl-kernel@lauterbach.com&gt;</a><BR>
<font color="red"><b>?</b></font>
<a href="mailto:jsproul@condor.fddi.wesleyan.edu">Jason Y. Sproul &lt;jsproul@condor.fddi.wesleyan.edu&gt;</a><BR>
<font color="red"><b>?</b></font>
<a href="mailto:darkmane@w-link.net">Sean Chitwood &lt;darkmane@w-link.net&gt;</a></TD>
<TD>
waterson said: <b>Mozilla runs on Linux/PPC</b>
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Linux Alpha</TD>
<TD>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:glen.nakamura@usa.net">Glen Nakamura &lt;glen.nakamura@usa.net&gt;</a><BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:morrildl@nycap.rr.com">Dan Morril &lt;morrildl@nycap.rr.com&gt;</a><BR>
</TD>
<TD>
Glen writes:
<p>
I am attaching a patch which contains my Linux Alpha xptcall code.
It passes TestXPTCInvoke and TestXPC on my machine which runs
kernel 2.2.7, glibc 2.1.1, and egcs 1.1.2. I have not tested it
with older GNU compilers such as gcc 2.8.x. From looking at the
Linux x86 code, I gather that the vtable layout is a little different
for those compilers and the code will need minor modifications
in order to work properly.
<p>
I am not sure how much of the code can be used for OpenVMS Alpha
and/or Digital UNIX. Currently the code is dependent on the g++
name mangling convention and a few GNU extensions so I'm not sure
how useful it will be for the other systems. Hopefully the
comments in the code are detailed enough to help people attempting
a port.
<p>
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>SunOS x86</TD>
<TD>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:aljones@lbl.gov">Arthur Jones &lt;aljones@lbl.gov&gt;</a><BR>
<font color="red"><b>?</b></font>
<a href="mailto:ppokorny@mindspring.com">Philip Pokorny &lt;ppokorny@mindspring.com&gt;</a><BR>
</TD>
<TD>
The word I hear is that this is working and done
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>HP-UX</TD>
<TD>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:wang@cup.hp.com">Thomas Wang &lt;wang@cup.hp.com&gt;</a><BR>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:mgleeson1@netscape.com">Mike Gleeson &lt;mgleeson1@netscape.com&gt;</a>
</TD>
<TD>I hear that this code is checked in and working. Though, there is some
doubt - see bug
#<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=17997">17997</a>
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>AIX PPC</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:jdunn@netscape.com">Jim Dunn &lt;jdunn@netscape.com&gt;</a></TD>
<TD>Philip K. Warren writes: <BR>
We have gone through several releases of AIX without any problems.
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Irix</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:jasonh@m7.engr.sgi.com">Jason Heirtzler &lt;jasonh@m7.engr.sgi.com&gt;</a><BR>
</TD>
<TD>Jason has declared this done. Jason is no longer working at SGI and will
not be maintaining this code. There is some doubt as to whether or not this is
working for everyone - see bug
#<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=10061">10061</a>.
<a href="mailto:shaver@mozilla.org">Mike&nbsp;Shaver&nbsp;&lt;shaver@mozilla.org&gt;</a>
is the interim maintainer until someone more suitable can be found.
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>BeOS x86</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:duncan@be.com">Duncan Wilcox &lt;duncan@be.com&gt;</a><BR>
</TD>
<TD>
<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> (yet another reuse of the Linux 86 code!)<BR>
Duncan says this is all working. He did the code for old cfront style 'this' adjustment for others to use too!
</TD>
</TR>
<TR>
<TD bgcolor="red"><font color="white"><b>HELP!</b></font></TD>
<TD>BeOS PPC</TD>
<TD align="center">-</TD>
<TD align="center">-</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Compaq Tru64 UNIX (Digital UNIX)</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:streeter@zk3.dec.com">Steve Streeter &lt;streeter@zk3.dec.com&gt;</a><BR>
</TD>
<TD>Code passes the tests and is checked in.</TD>
</TR>
<TR>
<TD bgcolor="khaki"><font color="black"><b>Working</b></font></TD>
<TD>Neutrio x86</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:Jerry.Kirk@Nexwarecorp.com">Jerry L. Kirk &lt;Jerry.Kirk@Nexwarecorp.com&gt;</a><BR>
</TD>
<TD>
Patches for xptc*_unixish_x86.cpp checked in. Waiting for verification that this is really finished.
</TD>
</TR>
<TR>
<TD bgcolor="khaki"><font color="black"><b>Investigating</b></font></TD>
<TD>SCO UW7 and OSR5</TD>
<TD>
<img alt="Investigating" title="Investigating" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:jkj@sco.com">J. Kean Johnston &lt;jkj@sco.com&gt;</a><BR>
<img alt="Investigating" title="Investigating" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:evanh@sco.com">Evan Hunt &lt;evanh@sco.com&gt;</a><BR>
</TD>
<TD>Recent (Feb-2001) email from jkj@sco.com suggests that work will be occuring soon.</TD>
</TR>
<TR>
<TD bgcolor="khaki"><font color="black"><b>Works</b></font></TD>
<TD>NetBSD/m68k</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:khym@bga.com">Dave Huang &lt;khym@bga.com&gt;</a><BR>
</TD>
<TD>
Dave's changes are in the tree. Waiting for verification that it is really finished.</TD>
</TR>
<TR>
<TD bgcolor="khaki"><font color="black"><b>Partially Working</b></font></TD>
<TD>NetBSD/arm32</TD>
<TD><img alt="Investigating" title="Investigating" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:mpumford@black-star.demon.co.uk">Mike Pumford &lt;mpumford@black-star.demon.co.uk&gt;</a>
</TD>
<TD>Mike writes:<BR>
I have started porting to the platform based on the code for Linux ARM. The
InvokeByIndex code works correctly when used with TestXPTCInvoke. I am
currently working on making TestXPC function correctly.
<P>
I am doing the porting work with egcs-1.1.2 on NetBSD 1.4P (NetBSD-current
snapshot from a couple of days ago).
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>Linux ia64</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
HP<br>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:drepper@redhat.com">Ulrich Drepper &lt;drepper@redhat.com&gt;</a>
</TD>
<TD><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=40950#c15">bug 40950 comment 15</a></TD>
</TR>
<TR>
<TD bgcolor="red"><font color="white"><b>HELP!</b></font></TD>
<TD>All others!</TD>
<TD align="center">-</TD>
<TD align="center">-</TD>
</TR>
</table>
<p>
<b>Note:</b> I've used the symbol (<font color="red"><b>?</b></font>) to
indicate people who have expressed an interest in <i>possibly</i> contributing code.
Just because these people are listed here does not mean that they have commited
themselves to do the work. If <b>you</b> would like to contribute then let me
know. Feel free to email these folks and offer to help or find out what's going
on. We're all in this together.
<p>
<hr>
<b>Author:</b> <a href="mailto:jband@netscape.com">John Bandhauer &lt;jband@netscape.com&gt;</a><br>
<b>Last modified:</b> 3 February 2003
</body>
</html>

View File

@ -0,0 +1,220 @@
<center><b><font size=+2>XPConnect Sample</font></b>
<p>
<a href="mailto:arielb@rice.edu">Ariel Blackenroth &lt;arielb@rice.edu&gt;</a>
<br>
<a href="mailto:mang@subcarrier.org">Michael Ang &lt;mang@subcarrier.org&gt;</a>
<br>
Last modified
<script>
document.write(document.lastModified);
</script>
</center>
<p>In the spirit of "worse is better" this somewhat rough guide is being
released to the world. It will be expanded upon and improved.
<p>XPConnect allows JavaScript
to transparantly access and manipulate XPCOM objects; this communication
between JavaScript and
native code is done by having their interfaces defined in the XPIDL interface
definition language. See the <a href="http://www.mozilla.org/scriptable/roadmap.html">Roadmap
for documentation on XPCOM, XPConnect, XPTCall and XPIDL</a> for more information.
<p><b>Overview</b>
<p>
This sample demonstrates accessing a XPCOM object through XPConnect.
The JavaScript executed when this page loads creates an instance
of the object by
using the <tt>Components</tt> object, then accesses it through
the <a href="http://lxr.mozilla.org/seamonkey/source/xpcom/sample/nsISample.idl">nsISample</a> interface by calling <tt>QueryInterface</tt>:
<br>
<pre>
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var sample = Components.classes["@mozilla.org/sample;1"].createInstance();
sample = sample.QueryInterface(Components.interfaces.nsISample);
</pre>
<p>
The buttons on the form are connected to JavaScript event handlers which
call the methods defined in C++.
<p><b><a href="http://lxr.mozilla.org/mozilla/source/xpcom/sample/nsISample.idl">nsISample.idl</a></b>
<p>This is the interface declaration for the XPCOM object. It defines
two functions, their parameters, and one attribute. It also defines
the interface's id. The idl file is compiled by the xpidl compiler
into a C++ header, nsISample.h and a .xpt file which is a binary representation
of the interface used at runtime.
<br><tt>attribute string value;</tt>
<br><tt>void writeValue(in string aPrefix);</tt>
<br><tt>void poke(in string aValue);</tt><b></b>
<p><b><a href="http://lxr.mozilla.org/mozilla/source/xpcom/sample/nsSample.cpp">nsSample.cpp</a></b>
<p>This contains the implementation of nsISample.idl. SampleImpl
inherits from nsISample.h, the header dynamically created by the xpidl
compiler. The attribute Value has been expanded into a get and set
and the return values have been modified to NS_IMETHOD, a success status
for the method. The macro NS_DECL_ISUPPORTS, defined in <a href="http://lxr.mozilla.org/mozilla/source/xpcom/base/nsISupportsUtils.h">mozilla/xpcom/public/nsISupportsUtils.h</a>
defines the inherited methods from nsISupports.h.
<br><tt>NS_IMPL_ISUPPORTS1(SampleImpl, nsISample)</tt>
<br>In the constructor, the macro NS_INIT_REFCNT is called which sets the
reference count to 0.<p>
Note that the methods in the C++ bindings use InterCaps style, while the IDL
and JavaScript versions should use interCaps naming. The JavaScript binding
matches the case of the IDL, <b>except</b> <a
href="http://bugzilla.mozilla.org/show_bug.cgi?id=14460">QueryInterface</a>.
<p><b><a href="http://lxr.mozilla.org/mozilla/source/xpcom/sample/nsSampleFactory.cpp">nsSampleFactory.cpp</a></b>
<p>This is the class which builds the instance of the nsSample class.
The COM framework uses factories to create instance of implementations
rather than having the implementations instantiate themselves in order to
increase portability of code. This factory inherits from nsFactory,
which is also an XPCOM object. To gain more knowledge of factories
see the <a href="http://www.mozilla.org/projects/xpcom/generic-factory.html">generic
factory document</a> or the <a href="http://www.mozilla.org/docs/modunote.htm#Basics">Modularization techniques document</a>.
<p><b><a href="http://lxr.mozilla.org/mozilla/source/xpcom/sample/nsSample.js">nsSample.js</a></b>
<p>This file implements the nsISample interface, and associated factory glue,
in JavaScript.
<p><b>Compiling the idl</b>
<p>The XPIDL compiler (xpidl on Unix, xpidl.exe on Windows, and a CodeWarrior plugin on Mac)
is compiled at build time (except on Mac) thus
you will have to build mozilla in order to test this out. If you
have already built mozilla then the compiler will be located at <tt>mozilla\dist\WIN32_D.OBJ\bin\xpidl.exe</tt>.
<p>Once you have the XPIDL compiler enter the following command at your
prompt:
<br><tt>D:\mozilla\xpcom\sample>d:\mozilla\dist\WIN32_D.OBJ\bin\xpidl -I
d:\mozilla\dist\idl -m header nsISample.idl</tt>
<p>The <tt>-I d:\mozilla\dist\idl</tt> points the compiler to the folder
containing the other idl files, needed because nsISample.idl inherits from
nsISupports.idl. The <tt>-m header</tt> instruction tells the compiler
to build the C++ header. To build the .xpt file substitute <tt>-m
typelib</tt>.
<p>
For more information on compilation see the <a href="http://www.mozilla.org/scriptable/xpidl/">xpidl
compiler page</a>.
<p><b>Building the Sample</b>
<p>To build the Sample just enter
<br><tt>d:\mozilla\xpcom\sample>nmake /f makefile.win</tt>
<p>In order to do this you need to have your environment variables set
correctly. See the <a href="http://www.mozilla.org/build/">Build</a>
page for more information.
<p><b>Running the sample</b>
<p>Using Mozilla, load
<a href="resource://res/samples/xpconnect-sample.html">resource://res/samples/xpconnect-sample.html</a> (i.e. what
you're reading now). Pay attention
to the console when clicking "write". Notice that the value
printed is calculated in C++ code defined in <a href="http://lxr.mozilla.org/seamonkey/source/xpcom/sample/nsSample.cpp">nsSample.cpp</a>.
<!-- XXX keep in sync with stuff in pre tag below -->
<script>
/* to use nsSample.js version, use "@mozilla.org/jssample;1" */
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var sample = Components.classes["@mozilla.org/sample;1"].createInstance();
sample = sample.QueryInterface(Components.interfaces.nsISample);
dump("sample = " + sample + "\n");
function get()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var field = document.getElementById('Value');
field.value = sample.value;
}
function set()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var field = document.getElementById('Value');
sample.value = field.value;
}
function poke()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var field = document.getElementById('Value');
sample.poke(field.value);
}
function sampleWrite()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
sample.writeValue("here is what I'm writing: ");
}
</script>
<p>
<form name="form">
<input type="button" value="Get" onclick="get();">
<input type="button" value="Set" onclick="set();">
<input type="button" value="Poke" onclick="poke();">
<input type="text" id="Value">
<input type="button" value="Write" onclick="sampleWrite();">
<form>
<hr>
<p>
JavaScript and form source:
<!-- XXX keep in sync with actual script -->
<pre>
&lt;script&gt;
/* to use nsSample.js version, use "@mozilla.org/jssample;1" */
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var sample = Components.classes["@mozilla.org/sample;1"].createInstance();
sample = sample.QueryInterface(Components.interfaces.nsISample);
dump("sample = " + sample + "\n");
function get()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var field = document.getElementById('Value');
field.value = sample.value;
}
function set()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var field = document.getElementById('Value');
sample.value = field.value;
}
function poke()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var field = document.getElementById('Value');
sample.poke(field.value);
}
function sampleWrite()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
sample.writeValue("here is what I'm writing: ");
}
&lt;/script&gt;
&lt;form name=&quot;form&quot;&gt;
&lt;input type=&quot;button&quot; value=&quot;Get&quot; onclick=&quot;get();&quot;&gt;
&lt;input type=&quot;button&quot; value=&quot;Set&quot; onclick=&quot;set();&quot;&gt;
&lt;input type=&quot;button&quot; value=&quot;Poke&quot; onclick=&quot;poke();&quot;&gt;
&lt;input type=&quot;text&quot; id=&quot;Value&quot;&gt;
&lt;input type=&quot;button&quot; value=&quot;Write&quot; onclick=&quot;sampleWrite();&quot;&gt;
&lt;form>
</pre>
<p>
<hr>
<b>Resources:</b>
<ul>
<li><a href="http://lxr.mozilla.org/seamonkey/source/xpcom/sample/">mozilla/xpcom/sample source directory</a>
</ul>
<hr>
<b>Comments to:</b>
<a href="mailto:mang@subcarrier.org?Subject=XPCOM sample documentation">Michael Ang &lt;mang@subcarrier.org&gt;</a>

44
xpcom/string/README.html Normal file
View File

@ -0,0 +1,44 @@
<html>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla.
-
- The Initial Developer of the Original Code is
- Netscape Communications.
- Portions created by the Initial Developer are Copyright (C) 2001
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Scott Collins <scc@mozilla.org> (original author)
-
- Alternatively, the contents of this file may be used under the terms of
- either of the GNU General Public License Version 2 or later (the "GPL"),
- or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the GPL or the LGPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<body>
<h1><span class="LXRSHORTDESC">managing sequences of characters</span></h1>
<p>
<span class="LXRLONGDESC"></span>
</p>
</body>
</html>

View File

@ -0,0 +1,44 @@
<html>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla.
-
- The Initial Developer of the Original Code is
- Netscape Communications.
- Portions created by the Initial Developer are Copyright (C) 2001
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Scott Collins <scc@mozilla.org> (original author)
-
- Alternatively, the contents of this file may be used under the terms of
- either of the GNU General Public License Version 2 or later (the "GPL"),
- or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the GPL or the LGPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<body>
<h1><span class="LXRSHORTDESC">documentation aimed at programmers who are clients of the string library</span></h1>
<p>
<span class="LXRLONGDESC"></span>
</p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
// To Do...
- Decide: do I really want to define |Equals| (i.e., so many extra signatures)
. Make |ns[C]String| rename its converting operations to, e.g., |EqualsWithConversion|,
|AssignWithConversion|, |CompareWithConversion|, |AppendWithConversion|, etc.
. Bring |Equals| and |Compare| into scope
. Implement chunky iterators
. Get "nsAReadableString.h" and "nsAWritableString.h" to added to the MANIFEST, etc.
- Get "nsAReadableString.h" and "nsAWritableString.h" to compile everywhere
- Add test for |Replace|...
- Add tests for Find and RFind
- Implement the Find and RFind signatures
. Fix Truncate / SetLength confusion (make SetLength the real function in |nsString|)
. Chop out conflicting |ns[C]String| operators
. Figure out how if we can make PRUnichar be wchar_t, so we get the cheap constructors,
...and ensure the cheap constructors can be made to work everywhere
x Try the |static const unsigned long kLeftString = 1 - 1; /* because VC++ doesn't like =0 */| hack
. Add tests for |nsShared[C]String|
. Implement |nsShared[C]String|
- Add tests for the shared string smart pointer
. Implement the shared string smart pointer
. Figure out why StdStringWrapper isn't as good as raw std::string
- Implement a smart allocator for StdStringWrapper

View File

@ -0,0 +1,16 @@
Wed Dec 2 14:35:41 EST 1998
xpidl depends on Andrew Veliath and Elliot Lee's libIDL, a part of the
GNOME ORBit C ORB. We currently require libIDL >= 0.6.3, which in turn
requires glib >= 1.2.0.
libIDL builds for Linux and Win32 can be found, along with source
tarballs, at http://www.rpi.edu/~veliaa/libIDL/, and Win32 users will
need glib 1.2 and glib 1.2-dev from
http://user.sgic.fi/~tml/gimp/win32/. Source and Linux RPMs are also
available from ftp://ftp.mozilla.org/pub/mozilla/libraries, and Win32
binaries are included in the wintools.zip file at
ftp://ftp.mozilla.org/pub/mozilla/source/wintools.zip. A Mac project
is in progress, and should be appearing shortly.
glib tarballs and RPMs for Linux can be found through http://www.gtk.org.