michael@0: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* Platform specific code to invoke XPCOM methods on native objects */ michael@0: michael@0: #include "xptcprivate.h" michael@0: michael@0: extern "C" { michael@0: michael@0: // Remember that these 'words' are 32bit DWORDS michael@0: michael@0: uint32_t michael@0: invoke_count_words(uint32_t paramCount, nsXPTCVariant* s) michael@0: { michael@0: uint32_t result = 0; michael@0: for(uint32_t i = 0; i < paramCount; i++, s++) michael@0: { michael@0: if(s->IsPtrData()) michael@0: { michael@0: result++; michael@0: continue; michael@0: } michael@0: result++; michael@0: switch(s->type) michael@0: { michael@0: case nsXPTType::T_I64 : michael@0: case nsXPTType::T_U64 : michael@0: case nsXPTType::T_DOUBLE : michael@0: result++; michael@0: break; michael@0: } michael@0: } michael@0: return result; michael@0: } michael@0: michael@0: void michael@0: invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* d) michael@0: { michael@0: for(uint32_t i = 0; i < paramCount; i++, d++, s++) michael@0: { michael@0: if(s->IsPtrData()) michael@0: { michael@0: *((void**)d) = s->ptr; michael@0: continue; michael@0: } michael@0: michael@0: /* XXX: the following line is here (rather than as the default clause in michael@0: * the following switch statement) so that the Sun native compiler michael@0: * will generate the correct assembly code on the Solaris Intel michael@0: * platform. See the comments in bug #28817 for more details. michael@0: */ michael@0: michael@0: *((void**)d) = s->val.p; michael@0: michael@0: switch(s->type) michael@0: { michael@0: case nsXPTType::T_I64 : *((int64_t*) d) = s->val.i64; d++; break; michael@0: case nsXPTType::T_U64 : *((uint64_t*)d) = s->val.u64; d++; break; michael@0: case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; michael@0: } michael@0: } michael@0: } michael@0: michael@0: }