Back to index

lightning-sunbird  0.9+nobinonly
xptcinvoke_x86_64.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is 
00018  * Makoto Kato <m_kato@ga2.so-net.ne.jp>.
00019  * Portions created by the Initial Developer are Copyright (C) 2004
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 /* Platform specific code to invoke XPCOM methods on native objects */
00039 
00040 #include "xptcprivate.h"
00041 
00042 extern "C" void
00043 invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s)
00044 {
00045    for(; paramCount > 0; paramCount--, d++, s++)
00046     {
00047         if(s->IsPtrData())
00048         {
00049             *((void**)d) = s->ptr;
00050             continue;
00051         }
00052 
00053         /*
00054          * AMD64 platform uses 8 bytes align.
00055          */
00056 
00057         switch(s->type)
00058         {
00059         case nsXPTType::T_I8     : *((PRInt8*)  d) = s->val.i8;          break;
00060         case nsXPTType::T_I16    : *((PRInt16*) d) = s->val.i16;         break;
00061         case nsXPTType::T_I32    : *((PRInt32*) d) = s->val.i32;         break;
00062         case nsXPTType::T_I64    : *((PRInt64*) d) = s->val.i64;         break;
00063         case nsXPTType::T_U8     : *((PRUint8*) d) = s->val.u8;          break;
00064         case nsXPTType::T_U16    : *((PRUint16*)d) = s->val.u16;         break;
00065         case nsXPTType::T_U32    : *((PRUint32*)d) = s->val.u32;         break;
00066         case nsXPTType::T_U64    : *((PRUint64*)d) = s->val.u64;         break;
00067         case nsXPTType::T_FLOAT  : *((float*)   d) = s->val.f;           break;
00068         case nsXPTType::T_DOUBLE : *((double*)  d) = s->val.d;           break;
00069         case nsXPTType::T_BOOL   : *((PRBool*)  d) = s->val.b;           break;
00070         case nsXPTType::T_CHAR   : *((char*)    d) = s->val.c;           break;
00071         case nsXPTType::T_WCHAR  : *((wchar_t*) d) = s->val.wc;          break;
00072         default:
00073             // all the others are plain pointer types
00074             *((void**)d) = s->val.p;
00075             break;
00076         }
00077     }
00078 }
00079 
00080 extern "C" nsresult
00081 XPTC__InvokebyIndex(nsISupports* that, PRUint32 methodIndex,
00082                     PRUint32 paramCount, nsXPTCVariant* params);
00083 
00084 extern "C"
00085 XPTC_PUBLIC_API(nsresult)
00086 XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
00087                    PRUint32 paramCount, nsXPTCVariant* params)
00088 {
00089     return XPTC__InvokebyIndex(that, methodIndex, paramCount, params);
00090 }
00091