Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xpidl.exe and capitalization

2 views
Skip to first unread message

Igor

unread,
Jul 7, 2006, 8:27:22 AM7/7/06
to
Hello!

Say I have inteface like this:
interface IHello : nsISupports
{
void hello(in long p1);

};

xpidl.exe generates C++ header file with invalid (imho) member name for
IHello interface:

...
/* void hello (in long p1); */
NS_IMETHOD Hello(PRInt32 p1) = 0;
};

So, how do I force it to generate correct one: hello() not Hello()?

--
With best regard, Igor.

Rajendra Prasad Murakonda

unread,
Jul 7, 2006, 9:27:17 AM7/7/06
to dev-tec...@lists.mozilla.org


The xpidl compiler capitalizes method names when generating C++ headers to
support existing C++ convention in Mozilla. But, it's better to use
interCaps style in your idl, so that you follow JavaScript convention(as you
will be calling those methods from JavaScript).

- Rajendra Prasad Murakonda,
http://prodizy.livejournal.com/

Igor

unread,
Jul 7, 2006, 10:41:20 AM7/7/06
to
Rajendra Prasad Murakonda wrote:

> > /* void hello (in long p1); */
> > NS_IMETHOD Hello(PRInt32 p1) = 0;
> > So, how do I force it to generate correct one: hello() not Hello()?
> The xpidl compiler capitalizes method names when generating C++ headers to
> support existing C++ convention in Mozilla. But, it's better to use
> interCaps style in your idl, so that you follow JavaScript convention(as you
> will be calling those methods from JavaScript).

I'm using (planning to) xpcom in my own C++ appication and there is
already defined naming convention. Is there any way to disable this
"feature"?

--
With best regards, Igor.

Oliveiros Cristina

unread,
Jul 7, 2006, 11:34:00 AM7/7/06
to dev-tec...@lists.mozilla.org
Hello, All,

I have an extension that needs to receive information from the underlying component, namely a string

On XPIDL , I defined a function like this

void ObtainUser(out string str_user_name);

And the xpidl compiler generates a member prototype like this

NS_IMETHODIMP CObserver::ObtainUser(char **str_user_name);

Now my question is how I call this function to get the string in javascript

I've tried to call the function with one arguments, but I get an exception like this :

Erro: uncaught exception: [Exception... "'Out' argument must be an object arg 0 [nsIFoxPanel.ObtainUser]" nsresult: "0x80570002 (NS_ERROR_XPC_NEED_OUT_OBJECT)" location: "JS frame :: chrome://extensao/content/foxpanel.js :: <TOP_LEVEL> :: line 34" data: no]

I've tried to call it with no arguments, but I get an exception as well

Any help deeply appreciated

Cheers,

Oliveiros

Christian Biesinger

unread,
Jul 7, 2006, 1:30:40 PM7/7/06
to dev-tec...@lists.mozilla.org
Oliveiros Cristina wrote:
> void ObtainUser(out string str_user_name);

If you instead defined it as:
string Obtainuser();
Then it'd be a function with no arguments in JS that just returns the
string.

> I've tried to call the function with one arguments, but I get an exception like this :
>
> Erro: uncaught exception: [Exception... "'Out' argument must be an object arg 0 [nsIFoxPanel.ObtainUser]" nsresult: "0x80570002 (NS_ERROR_XPC_NEED_OUT_OBJECT)" location: "JS frame :: chrome://extensao/content/foxpanel.js :: <TOP_LEVEL> :: line 34" data: no]

I don't know what your argument was but out params works like this:

var outval = {};
panel.ObtainUser(outval);
// Now use outval.value

But I'd suggest you use the IDL syntax I suggested above and do:
var yourstring = panel.ObtainUser();

--
All the world's a stage,
And all the men and women merely players:
They have their exits and their entrances;
And one man in his time plays many parts, [...] --W. Shakespeare

Oliveiros Cristina

unread,
Jul 7, 2006, 2:18:53 PM7/7/06
to Christian Biesinger, dev-tec...@lists.mozilla.org
Thank you for your e-mail, Christian.

I've already fixed it using the [retval] attribute and I was able to retrieve the string from my xpcom component

But another problem surfaces.

I can explain what I need.
I need to affect the value of a <label> overlay element on my extension with a string obtained from component.

I've tried to do it with this in js

label = document.getElementById("user_name_label");

label.value = data;

But the problem is when should I call this statements. they work but only when the browser is already displayed.

If I use these instructions before nothing changes on label.

Is there any event I can trap to place this instructions on?

I guess label doesnt have events

Thanks in advance

Cheers,

Oliveiros

> _______________________________________________
> dev-tech-xpcom mailing list
> dev-tec...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xpcom

Oliveiros Cristina

unread,
Jul 10, 2006, 6:00:28 AM7/10/06
to Christian Biesinger, dev-tec...@lists.mozilla.org
Can anyone advise me in this question, please?

Many thanks in advance

Nickolay Ponomarev

unread,
Jul 10, 2006, 6:51:26 AM7/10/06
to Oliveiros Cristina, Christian Biesinger, dev-tec...@lists.mozilla.org
On 7/7/06, Oliveiros Cristina <oliveiros...@marktest.pt> wrote:
> I need to affect the value of a <label> overlay element on my extension with a string obtained from component.
>
> I've tried to do it with this in js
>
> label = document.getElementById("user_name_label");
>
> label.value = data;
>
> But the problem is when should I call this statements. they work but only when the browser is already displayed.
>
Are you looking for a more sophisticated answer than "in the load listener"?

http://developer.mozilla.org/en/docs/Extension_FAQ#Why_doesn.27t_my_script_run_properly.3F

Nickolay

Oliveiros Cristina

unread,
Jul 10, 2006, 9:57:03 AM7/10/06
to Nickolay Ponomarev, dev-tec...@lists.mozilla.org
Thanks for help. Nicolay-

I'll take this chance to ask if there is an automatic way to install an
extension on Mozilla browser, because the '-install-global-extension' switch
doesn't exist in this "very old" browser.

Is there some file I can programmatically change? I really need a way to
install an extension on Mozilla automatically

Thanks in advance

Cheers,
Oliveiros

----- Original Message -----
From: "Nickolay Ponomarev" <asqu...@gmail.com>
To: "Oliveiros Cristina" <oliveiros...@marktest.pt>
Cc: "Christian Biesinger" <cbies...@web.de>;
<dev-tec...@lists.mozilla.org>
Sent: Monday, July 10, 2006 11:51 AM
Subject: Re: How to pass values in XPCOM back to JS

Nickolay Ponomarev

unread,
Jul 10, 2006, 10:19:10 AM7/10/06
to Oliveiros Cristina, dev-tec...@lists.mozilla.org
Please don't ask additional questions in the same thread. Incorrect
thread titles make searching harder, and people who might be able to
help you may not be interested in this thread anymore.

Anyways, possible ways to install an extension (most of those are
supported on 1.5 or later) are listed here:

http://developer.mozilla.org/en/docs/Extension_Packaging#Install_Extension_Files_Directly

Nickolay

John Bandhauer

unread,
Jul 10, 2006, 1:00:16 PM7/10/06
to

No, there is not.

John.

0 new messages