NOT PART OF SEAMONKEY - factored out data conversion routines, need to now make them handle datatypes not yet handled

This commit is contained in:
jband%netscape.com 1999-01-14 04:25:31 +00:00
Родитель e0b5f19159
Коммит 52e7143833
5 изменённых файлов: 248 добавлений и 382 удалений

Просмотреть файл

@ -31,6 +31,7 @@ REQUIRES=xpcom js
DEFINES=-DWIN32_LEAN_AND_MEAN -DEXPORT_XPC_API
OBJS= \
.\$(OBJDIR)\xpcconvert.obj \
.\$(OBJDIR)\xpcnsid.obj \
.\$(OBJDIR)\xpcstubs.obj \
.\$(OBJDIR)\xpcmaps.obj \

Просмотреть файл

@ -0,0 +1,221 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* Data conversion between native and JavaScript types. */
#include "xpcprivate.h"
// XXX these conversion functions need to be finished.
// XXX conversion functions may still need paramInfo to handle the additional
// types
#define JAM_DOUBLE(v,d) (d = (jsdouble)v, DOUBLE_TO_JSVAL(&d))
#define FIT_32(i,d) (INT_FITS_IN_JSVAL(i) ? INT_TO_JSVAL(i) : JAM_DOUBLE(i,d))
// Win32 can't handle uint64 to double conversion
#define JAM_DOUBLE_U64(v,d) JAM_DOUBLE(((int64)v),d)
JSBool
xpc_ConvertNativeData2JS(jsval* d, const void* s, const nsXPCType& type)
{
NS_PRECONDITION(s, "bad param");
NS_PRECONDITION(d, "bad param");
if(type == nsXPCType::T_INTERFACE)
{
// XXX implement INTERFACE
// make sure 'src' is an object
// get the nsIInterfaceInfo* from the param and
// build a wrapper and then hand over the wrapper.
// XXX remember to release the wrapper in cleanup below
NS_ASSERTION(0,"interface params not supported");
return JS_FALSE;
}
else if(type == nsXPCType::T_INTERFACE_IS)
{
// XXX implement INTERFACE_IS
NS_ASSERTION(0,"interface_is params not supported");
return JS_FALSE;
}
else if(type == nsXPCType::T_STRING)
{
// XXX implement STRING
NS_ASSERTION(0,"string params not supported");
return JS_FALSE;
}
else if(type == nsXPCType::T_P_IID)
{
// XXX implement IID
NS_ASSERTION(0,"iid params not supported");
return JS_FALSE;
}
else if(type == nsXPCType::T_P_VOID)
{
// XXX implement void*
NS_ASSERTION(0,"void* params not supported");
return JS_FALSE;
}
else {
jsdouble dbl;
switch(type & nsXPCType::TYPE_MASK)
{
case nsXPCType::T_I8 : *d = INT_TO_JSVAL((int32)*((int8*)s)); break;
case nsXPCType::T_I16 : *d = INT_TO_JSVAL((int32)*((int16*)s)); break;
case nsXPCType::T_I32 : *d = FIT_32(*((int32*)s),dbl); break;
case nsXPCType::T_I64 : *d = JAM_DOUBLE(*((int64*)s),dbl); break;
case nsXPCType::T_U8 : *d = INT_TO_JSVAL((int32)*((uint8*)s)); break;
case nsXPCType::T_U16 : *d = INT_TO_JSVAL((int32)*((uint16*)s)); break;
case nsXPCType::T_U32 : *d = FIT_32(*((uint32*)s),dbl); break;
case nsXPCType::T_U64 : *d = JAM_DOUBLE_U64(*((uint64*)s),dbl); break;
case nsXPCType::T_FLOAT : *d = JAM_DOUBLE(*((float*)s),dbl); break;
case nsXPCType::T_DOUBLE: *d = DOUBLE_TO_JSVAL(*((double*)s)); break;
case nsXPCType::T_BOOL : *d = *((PRBool*)s)?JSVAL_TRUE:JSVAL_FALSE; break;
// XXX need to special case char* and wchar_t*
case nsXPCType::T_CHAR : *d = INT_TO_JSVAL((int32)*((char*)s)); break;
case nsXPCType::T_WCHAR : *d = INT_TO_JSVAL((int32)*((wchar_t*)s)); break;
default:
NS_ASSERTION(0, "bad type");
return JS_FALSE;
}
}
return JS_TRUE;
}
JSBool
xpc_ConvertJSData2Native(JSContext* cx, void* d, const jsval* s,
const nsXPCType& type)
{
NS_PRECONDITION(s, "bad param");
NS_PRECONDITION(d, "bad param");
if(type == nsXPCType::T_INTERFACE)
{
// XXX implement INTERFACE
// make sure 'src' is an object
// get the nsIInterfaceInfo* from the param and
// build a wrapper and then hand over the wrapper.
// XXX remember to release the wrapper in cleanup below
NS_ASSERTION(0,"interface params not supported");
return JS_FALSE;
}
else if(type == nsXPCType::T_INTERFACE_IS)
{
// XXX implement INTERFACE_IS
NS_ASSERTION(0,"interface_is params not supported");
return JS_FALSE;
}
else if(type == nsXPCType::T_STRING)
{
// XXX implement STRING
NS_ASSERTION(0,"string params not supported");
return JS_FALSE;
}
else if(type == nsXPCType::T_P_IID)
{
// XXX implement IID
NS_ASSERTION(0,"iid params not supported");
return JS_FALSE;
}
else if(type == nsXPCType::T_P_VOID)
{
// XXX implement void*
NS_ASSERTION(0,"void* params not supported");
return JS_FALSE;
}
else {
int32 ti;
uint32 tu;
jsdouble td;
JSBool r;
switch(type & nsXPCType::TYPE_MASK)
{
case nsXPCType::T_I8 :
r = JS_ValueToECMAInt32(cx, *s, &ti);
*((int8*)d) = (int8) ti;
break;
case nsXPCType::T_I16 :
r = JS_ValueToECMAInt32(cx, *s, &ti);
*((int16*)d) = (int16) ti;
break;
case nsXPCType::T_I32 :
r = JS_ValueToECMAInt32(cx, *s, (int32*)d);
break;
case nsXPCType::T_I64 :
if(JSVAL_IS_INT(*s))
{
r = JS_ValueToECMAInt32(cx, *s, &ti);
*((int64*)d) = (int64) ti;
}
else
{
r = JS_ValueToNumber(cx, *s, &td);
if(r) *((int64*)d) = (int64) td;
}
break;
case nsXPCType::T_U8 :
r = JS_ValueToECMAUint32(cx, *s, &tu);
*((uint8*)d) = (uint8) tu;
break;
case nsXPCType::T_U16 :
r = JS_ValueToECMAUint32(cx, *s, &tu);
*((uint16*)d) = (uint16) tu;
break;
case nsXPCType::T_U32 :
r = JS_ValueToECMAUint32(cx, *s, (uint32*)d);
break;
case nsXPCType::T_U64 :
if(JSVAL_IS_INT(*s))
{
r = JS_ValueToECMAUint32(cx, *s, &tu);
*((uint64*)d) = (uint64) tu;
}
else
{
r = JS_ValueToNumber(cx, *s, &td);
// XXX Win32 can't handle double to uint64 directly
if(r) *((uint64*)d) = (uint64)((int64) td);
}
break;
case nsXPCType::T_FLOAT :
r = JS_ValueToNumber(cx, *s, &td);
if(r) *((float*)d) = (float) td;
break;
case nsXPCType::T_DOUBLE :
r = JS_ValueToNumber(cx, *s, (double*)d);
break;
case nsXPCType::T_BOOL :
r = JS_ValueToBoolean(cx, *s, (PRBool*)d);
break;
// XXX should we special case char* and wchar_t* to be strings?
case nsXPCType::T_CHAR :
case nsXPCType::T_WCHAR :
default:
NS_ASSERTION(0, "bad type");
return JS_FALSE;
}
}
return JS_TRUE;
}

Просмотреть файл

@ -361,7 +361,7 @@ private:
};
/***************************************************************************/
// utility functions
// nsID JavaScript class functions
JSBool
xpc_InitIDClass(XPCContext* xpcc);
@ -369,6 +369,17 @@ xpc_InitIDClass(XPCContext* xpcc);
JSObject*
xpc_NewIDObject(JSContext *cx, const nsID& aID);
/***************************************************************************/
// data convertion
JSBool
xpc_ConvertNativeData2JS(jsval* d, const void* s,
const nsXPCType& type);
JSBool
xpc_ConvertJSData2Native(JSContext* cx, void* d, const jsval* s,
const nsXPCType& type);
/***************************************************************************/
// platform specific method invoker

Просмотреть файл

@ -224,11 +224,6 @@ nsXPCWrappedJSClass::GetRootJSObject(JSObject* aJSObj)
return result ? result : aJSObj;
}
#define JAM_DOUBLE(v,d) (d = (jsdouble)v, DOUBLE_TO_JSVAL(&d))
#define FIT_32(i,d) (INT_FITS_IN_JSVAL(i) ? INT_TO_JSVAL(i) : JAM_DOUBLE(i,d))
// Win32 can't handle uint64 to double conversion
#define JAM_DOUBLE_U64(v,d) JAM_DOUBLE(((int64)v),d)
nsresult
nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper,
const nsXPCMethodInfo* info,
@ -285,69 +280,10 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper,
if(type & nsXPCType::IS_POINTER)
pv = (nsXPCMiniVarient*) pv->val.p;
// do the actual conversion...
// handle special cases first
if(type == nsXPCType::T_INTERFACE)
if(!xpc_ConvertNativeData2JS(&val, &pv->val, type))
{
// XXX implement INTERFACE
// make sure 'src' is an object
// get the nsIInterfaceInfo* from the param and
// build a wrapper and then hand over the wrapper.
// XXX remember to release the wrapper in cleanup below
NS_ASSERTION(0,"interface params not supported");
continue;
}
else if(type == nsXPCType::T_INTERFACE_IS)
{
// XXX implement INTERFACE_IS
NS_ASSERTION(0,"interface_is params not supported");
continue;
}
else if(type == nsXPCType::T_STRING)
{
// XXX implement STRING
NS_ASSERTION(0,"string params not supported");
continue;
}
else if(type == nsXPCType::T_P_IID)
{
// XXX implement IID
NS_ASSERTION(0,"iid params not supported");
continue;
}
else if(type == nsXPCType::T_P_VOID)
{
// XXX implement void*
NS_ASSERTION(0,"void* params not supported");
continue;
}
else {
jsdouble d;
switch(type & nsXPCType::TYPE_MASK)
{
case nsXPCType::T_I8 : val = INT_TO_JSVAL((int32)pv->val.i8); break;
case nsXPCType::T_I16 : val = INT_TO_JSVAL((int32)pv->val.i16); break;
case nsXPCType::T_I32 : val = FIT_32(pv->val.i32,d); break;
case nsXPCType::T_I64 : val = JAM_DOUBLE(pv->val.i64,d); break;
case nsXPCType::T_U8 : val = INT_TO_JSVAL((int32)pv->val.u8); break;
case nsXPCType::T_U16 : val = INT_TO_JSVAL((int32)pv->val.u16); break;
case nsXPCType::T_U32 : val = FIT_32(pv->val.u32,d); break;
case nsXPCType::T_U64 : val = JAM_DOUBLE_U64(pv->val.u64,d); break;
case nsXPCType::T_FLOAT : val = JAM_DOUBLE(pv->val.f,d); break;
case nsXPCType::T_DOUBLE : val = DOUBLE_TO_JSVAL(&pv->val.d); break;
case nsXPCType::T_BOOL : val = pv->val.b?JSVAL_TRUE:JSVAL_FALSE; break;
// XXX need to special case cahr* and wchar_t*
case nsXPCType::T_CHAR : val = INT_TO_JSVAL((int32)pv->val.c); break;
case nsXPCType::T_WCHAR : val = INT_TO_JSVAL((int32)pv->val.wc); break;
default:
NS_ASSERTION(0, "bad type");
continue;
}
retval = NS_ERROR_FAILURE;
goto done;
}
}
@ -399,120 +335,10 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper,
if(type & nsXPCType::IS_POINTER)
pv = (nsXPCMiniVarient*) pv->val.p;
// do the actual conversion...
// handle special cases first
if(type == nsXPCType::T_INTERFACE)
if(!xpc_ConvertJSData2Native(cx, &pv->val, &val, type))
{
// XXX implement INTERFACE
// make sure 'src' is an object
// get the nsIInterfaceInfo* from the param and
// build a wrapper and then hand over the wrapper.
// XXX remember to release the wrapper in cleanup below
NS_ASSERTION(0,"interface params not supported");
continue;
}
else if(type == nsXPCType::T_INTERFACE_IS)
{
// XXX implement INTERFACE_IS
NS_ASSERTION(0,"interface_is params not supported");
continue;
}
else if(type == nsXPCType::T_STRING)
{
// XXX implement STRING
NS_ASSERTION(0,"string params not supported");
continue;
}
else if(type == nsXPCType::T_P_IID)
{
// XXX implement IID
NS_ASSERTION(0,"iid params not supported");
continue;
}
else if(type == nsXPCType::T_P_VOID)
{
// XXX implement void*
NS_ASSERTION(0,"void* params not supported");
continue;
}
else {
int32 ti;
uint32 tu;
jsdouble td;
JSBool r;
switch(type & nsXPCType::TYPE_MASK)
{
case nsXPCType::T_I8 :
r = JS_ValueToECMAInt32(cx,val,&ti);
pv->val.i8 = (int8) ti;
break;
case nsXPCType::T_I16 :
r = JS_ValueToECMAInt32(cx,val,&ti);
pv->val.i16 = (int16) ti;
break;
case nsXPCType::T_I32 :
r = JS_ValueToECMAInt32(cx,val,&pv->val.i32);
break;
case nsXPCType::T_I64 :
if(JSVAL_IS_INT(val))
{
r = JS_ValueToECMAInt32(cx,val,&ti);
pv->val.i64 = (int64) ti;
}
else
{
r = JS_ValueToNumber(cx, val, &td);
if(r) pv->val.i64 = (int64) td;
}
break;
case nsXPCType::T_U8 :
r = JS_ValueToECMAUint32(cx,val,&tu);
pv->val.u8 = (uint8) tu;
break;
case nsXPCType::T_U16 :
r = JS_ValueToECMAUint32(cx,val,&tu);
pv->val.u16 = (uint16) tu;
break;
case nsXPCType::T_U32 :
r = JS_ValueToECMAUint32(cx,val,&pv->val.u32);
break;
case nsXPCType::T_U64 :
if(JSVAL_IS_INT(val))
{
r = JS_ValueToECMAUint32(cx,val,&tu);
pv->val.i64 = (int64) tu;
}
else
{
r = JS_ValueToNumber(cx, val, &td);
// XXX Win32 can't handle double to uint64 directly
if(r) pv->val.u64 = (uint64)((int64) td);
}
break;
case nsXPCType::T_FLOAT :
r = JS_ValueToNumber(cx, val, &td);
if(r) pv->val.f = (float) td;
break;
case nsXPCType::T_DOUBLE :
r = JS_ValueToNumber(cx, val, &pv->val.d);
break;
case nsXPCType::T_BOOL :
r = JS_ValueToBoolean(cx, val, &pv->val.b);
break;
// XXX should we special case char* and wchar_t* to be strings?
case nsXPCType::T_CHAR :
case nsXPCType::T_WCHAR :
default:
NS_ASSERTION(0, "bad type");
goto done;
}
continue;
NS_ASSERTION(0, "bad type");
goto done;
}
}
}

Просмотреть файл

@ -299,11 +299,6 @@ nsXPCWrappedNativeClass::GetInterfaceName() const
return name;
}
#define JAM_DOUBLE(v,d) (d = (jsdouble)v, DOUBLE_TO_JSVAL(&d))
#define FIT_32(i,d) (INT_FITS_IN_JSVAL(i) ? INT_TO_JSVAL(i) : JAM_DOUBLE(i,d))
// Win32 can't handle uint64 to double conversion
#define JAM_DOUBLE_U64(v,d) JAM_DOUBLE(((int64)v),d)
JSBool
nsXPCWrappedNativeClass::GetConstantAsJSVal(nsXPCWrappedNative* wrapper,
const XPCNativeMemberDescriptor* desc,
@ -318,30 +313,9 @@ nsXPCWrappedNativeClass::GetConstantAsJSVal(nsXPCWrappedNative* wrapper,
*vp = JSVAL_NULL;
return JS_TRUE;
}
jsdouble d;
const nsXPCVarient& var = constant->GetValue();
switch(var.type)
{
case nsXPCType::T_I8 : *vp = INT_TO_JSVAL((int32)var.val.i8); break;
case nsXPCType::T_I16 : *vp = INT_TO_JSVAL((int32)var.val.i16); break;
case nsXPCType::T_I32 : *vp = FIT_32(var.val.i32,d); break;
case nsXPCType::T_I64 : *vp = JAM_DOUBLE(var.val.i64,d); break;
case nsXPCType::T_U8 : *vp = INT_TO_JSVAL((int32)var.val.u8); break;
case nsXPCType::T_U16 : *vp = INT_TO_JSVAL((int32)var.val.u16); break;
case nsXPCType::T_U32 : *vp = FIT_32(var.val.u32,d); break;
case nsXPCType::T_U64 : *vp = JAM_DOUBLE_U64(var.val.u64,d); break;
case nsXPCType::T_FLOAT : *vp = JAM_DOUBLE(var.val.f,d); break;
case nsXPCType::T_DOUBLE : *vp = DOUBLE_TO_JSVAL(&var.val.d); break;
case nsXPCType::T_BOOL : *vp = var.val.b?JSVAL_TRUE:JSVAL_FALSE; break;
case nsXPCType::T_CHAR : *vp = INT_TO_JSVAL((int32)var.val.c); break;
case nsXPCType::T_WCHAR : *vp = INT_TO_JSVAL((int32)var.val.wc); break;
default:
// XXX need to support string constants
NS_ASSERTION(0, "bad type");
ReportError(desc, "invalid constant type");
}
return JS_TRUE;
return xpc_ConvertNativeData2JS(vp, &var.val, var.type);
}
void
@ -474,121 +448,10 @@ nsXPCWrappedNativeClass::CallWrappedMethod(nsXPCWrappedNative* wrapper,
src = argv[i];
}
// do the actual conversion...
// handle special cases first
if(type == nsXPCType::T_INTERFACE)
if(!xpc_ConvertJSData2Native(cx, &dp->val, &src, type))
{
// XXX implement INTERFACE
// make sure 'src' is an object
// get the nsIInterfaceInfo* from the param and
// build a wrapper and then hand over the wrapper.
// XXX remember to release the wrapper in cleanup below
NS_ASSERTION(0,"interface params not supported");
continue;
}
else if(type == nsXPCType::T_INTERFACE_IS)
{
// XXX implement INTERFACE_IS
NS_ASSERTION(0,"interface_is params not supported");
continue;
}
else if(type == nsXPCType::T_STRING)
{
// XXX implement STRING
NS_ASSERTION(0,"string params not supported");
continue;
}
else if(type == nsXPCType::T_P_IID)
{
// XXX implement IID
NS_ASSERTION(0,"iid params not supported");
continue;
}
else if(type == nsXPCType::T_P_VOID)
{
// XXX implement void*
NS_ASSERTION(0,"void* params not supported");
continue;
}
else {
int32 ti;
uint32 tu;
jsdouble td;
JSBool r;
switch(type & nsXPCType::TYPE_MASK)
{
case nsXPCType::T_I8 :
r = JS_ValueToECMAInt32(cx,src,&ti);
dp->val.i8 = (int8) ti;
break;
case nsXPCType::T_I16 :
r = JS_ValueToECMAInt32(cx,src,&ti);
dp->val.i16 = (int16) ti;
break;
case nsXPCType::T_I32 :
r = JS_ValueToECMAInt32(cx,src,&dp->val.i32);
break;
case nsXPCType::T_I64 :
if(JSVAL_IS_INT(src))
{
r = JS_ValueToECMAInt32(cx,src,&ti);
dp->val.i64 = (int64) ti;
}
else
{
r = JS_ValueToNumber(cx, src, &td);
if(r) dp->val.i64 = (int64) td;
}
break;
case nsXPCType::T_U8 :
r = JS_ValueToECMAUint32(cx,src,&tu);
dp->val.u8 = (uint8) tu;
break;
case nsXPCType::T_U16 :
r = JS_ValueToECMAUint32(cx,src,&tu);
dp->val.u16 = (uint16) tu;
break;
case nsXPCType::T_U32 :
r = JS_ValueToECMAUint32(cx,src,&dp->val.u32);
break;
case nsXPCType::T_U64 :
if(JSVAL_IS_INT(src))
{
r = JS_ValueToECMAUint32(cx,src,&tu);
dp->val.i64 = (int64) tu;
}
else
{
r = JS_ValueToNumber(cx, src, &td);
// XXX Win32 can't handle double to uint64 directly
if(r) dp->val.u64 = (uint64)((int64) td);
}
break;
case nsXPCType::T_FLOAT :
r = JS_ValueToNumber(cx, src, &td);
if(r) dp->val.f = (float) td;
break;
case nsXPCType::T_DOUBLE :
r = JS_ValueToNumber(cx, src, &dp->val.d);
break;
case nsXPCType::T_BOOL :
r = JS_ValueToBoolean(cx, src, &dp->val.b);
break;
// XXX should we special case char* and wchar_t* to be strings?
case nsXPCType::T_CHAR :
case nsXPCType::T_WCHAR :
default:
NS_ASSERTION(0, "bad type");
ReportError(desc, "could not convert argument");
goto done;
}
continue;
NS_ASSERTION(0, "bad type");
goto done;
}
}
@ -613,69 +476,13 @@ nsXPCWrappedNativeClass::CallWrappedMethod(nsXPCWrappedNative* wrapper,
if(param.IsOut())
{
jsval v;
if(type == nsXPCType::T_INTERFACE)
if(!xpc_ConvertNativeData2JS(&v, &dp->val, type))
{
// XXX implement INTERFACE
// make sure 'src' is an object
// get the nsIInterfaceInfo* from the param and
// build a wrapper and then hand over the wrapper.
// XXX remember to release the wrapper in cleanup below
NS_ASSERTION(0,"interface params not supported");
retval = NS_ERROR_FAILURE;
goto done;
continue;
}
else if(type == nsXPCType::T_INTERFACE_IS)
{
// XXX implement INTERFACE_IS
NS_ASSERTION(0,"interface_is params not supported");
continue;
}
else if(type == nsXPCType::T_STRING)
{
// XXX implement STRING
NS_ASSERTION(0,"string params not supported");
continue;
}
else if(type == nsXPCType::T_P_IID)
{
// XXX implement IID
NS_ASSERTION(0,"iid params not supported");
continue;
}
else if(type == nsXPCType::T_P_VOID)
{
// XXX implement void*
NS_ASSERTION(0,"void* params not supported");
continue;
}
else
{
jsdouble d;
switch(type & nsXPCType::TYPE_MASK)
{
case nsXPCType::T_I8 :v = INT_TO_JSVAL((int32)dp->val.i8); break;
case nsXPCType::T_I16 :v = INT_TO_JSVAL((int32)dp->val.i16); break;
case nsXPCType::T_I32 :v = FIT_32(dp->val.i32,d); break;
case nsXPCType::T_I64 :v = JAM_DOUBLE(dp->val.i64,d); break;
case nsXPCType::T_U8 :v = INT_TO_JSVAL((int32)dp->val.u8); break;
case nsXPCType::T_U16 :v = INT_TO_JSVAL((int32)dp->val.u16); break;
case nsXPCType::T_U32 :v = FIT_32(dp->val.u32,d); break;
case nsXPCType::T_U64 :v = JAM_DOUBLE_U64(dp->val.u64,d); break;
case nsXPCType::T_FLOAT :v = JAM_DOUBLE(dp->val.f,d); break;
case nsXPCType::T_DOUBLE:v = DOUBLE_TO_JSVAL(&dp->val.d); break;
case nsXPCType::T_BOOL :v = dp->val.b?JSVAL_TRUE:JSVAL_FALSE; break;
// XXX should we special case char* and wchar_t* to be strings?
case nsXPCType::T_CHAR :/*v = INT_TO_JSVAL((int32)dp->val.c); */ break;
case nsXPCType::T_WCHAR :/*v = INT_TO_JSVAL((int32)dp->val.wc);*/ break;
default:
// XXX need to support string constants
NS_ASSERTION(0, "bad type");
ReportError(desc, "invalid out type");
goto done;
}
}
if(param.IsRetval())
*vp = v;
else