[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: seg-faults on the road
From: |
Marcus G. Daniels |
Subject: |
Re: seg-faults on the road |
Date: |
19 Dec 2001 11:08:09 -0700 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.7 |
>>>>> "DK" == daniel kottow <address@hidden> writes:
DK> what xpcshell is about, but that fails for me because of an
DK> unresolved symbol.
xpcshell is the JavaScript command shell. Mozilla and xpcshell use
the SpiderMonkey JavaScript engine (written in C) which is integrated
with XPCOM, via complex software called XPConnect. I don't know about
Rhino & XPCOM, but I suspect it won't work as the Java support in
Mozilla isn't integrated in this kind of tight way, and the XPCOM/Java
support that exists never seemed to work very well (last time I tried
Java/XPCOM stuff was in June or so).
DK> maybe you could provide an explicit "hello swarm" snippet which i
DK> can try from rhino ?
In the attached code, note the output of "Hello World" is done using
Swarm's verboseMessage method on SwarmEnvironment, which only prints
when in verbose mode. Verbose mode is set in this case by setting the
"-v" option (which would typically by on a command line). The
preceding "2" says that the array that follows is two items long.
env.guiFlag will print as false (by default true), because the "-b"
option is passed.
DK> what i still dont understand is how to call swarm's create method
DK> on such an object. create is part of the swarmISelector
DK> interface, but this interface doesnt seem supported by the swarm
DK> components like the cls from the example above.
Continuing in the code, following `verboseMessage' is an example. The
thing with COM is that you have to remember that +create: is typically
an inherited method. To get it, here I query for the swarmICreate
interface. Then I call the create method. However, the Create
protocol just has the basic creation methods. To send other messages
means first requesting the right interface. In this case, I ask for
the GetName interface and then send it the getName method. (See what
happens if you comment out the QueryInterface line.)
I believe there are some new `flattening' support code and conventions
for creating interfaces & implementations & modules for XPCOM such
that it isn't necessary to ask for the (very) specific interface that
has the method you want. The new system, as I understand it, acts
like Objective C protocols or Java interfaces. I haven't investigated
that yet. I remember discussion about a similar system in the Python
front end, as well. `Flattened' interfaces would certainly be easier
to use, but meanwhile QueryInterface is doable once you get used to it.
env = Components.classes["urn:swarm:SwarmEnvironmentImpl"].
createInstance (Components.interfaces.swarmISwarmEnvironment);
env.initSwarm_version_bugAddress_argCount_args ("hello world", "0.0",
"address@hidden",
2, ["-v", "-b"]);
env.verboseMessage ("Hello World " + env.guiFlag);
obj = Components.classes["urn:swarm:objectbase.SwarmObjectImpl"].createInstance
(Components.interfaces.swarmICreate);
obj.create (env.globalZone);
env.xprint (obj);
obj = obj.QueryInterface (Components.interfaces.swarmIGetName);
env.verboseMessage (obj.getName ());
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- Re: scripting support for swarm ?, (continued)
- Re: scripting support for swarm ?, Marcus G. Daniels, 2001/12/12
- Re: scripting support for swarm ?, Marcus G. Daniels, 2001/12/12
- starting to try out XPCOM, daniel kottow, 2001/12/17
- Re: starting to try out XPCOM, Marcus G. Daniels, 2001/12/17
- compiled and registered swarm XPCOM - could i have a crash course ?, daniel kottow, 2001/12/18
- Re: compiled and registered swarm XPCOM - could i have a crash course ?, Marcus G. Daniels, 2001/12/18
- now *only* missing a symbol, daniel kottow, 2001/12/18
- Re: now *only* missing a symbol, Marcus G. Daniels, 2001/12/18
- Re: now *only* missing a symbol, Marcus G. Daniels, 2001/12/18
- seg-faults on the road, daniel kottow, 2001/12/19
- Re: seg-faults on the road,
Marcus G. Daniels <=
- Re: seg-faults on the road, daniel kottow, 2001/12/19
- Re: seg-faults on the road, Marcus G. Daniels, 2001/12/19
- its getting better, daniel kottow, 2001/12/19
- Re: its getting better, Marcus G. Daniels, 2001/12/19
- limits, daniel kottow, 2001/12/19
- ld stuff, daniel kottow, 2001/12/19
- found the COM example, sorry, daniel kottow, 2001/12/19
- Re: found the COM example, sorry, Marcus G. Daniels, 2001/12/19
- Re: compiled and registered swarm XPCOM - could i have a crash course ?, Marcus G. Daniels, 2001/12/18