static void ParseTime(PRTime tm, PRInt32& secs, PRInt32& msecs) { PRTime llsecs, llmsecs, tmp; LL_DIV(llsecs, tm, 1000000); LL_MOD(tmp, tm, 1000000); LL_DIV(llmsecs, tmp, 1000); LL_L2I(secs, llsecs); LL_L2I(msecs, llmsecs); }
static PLDHashNumber HashKey(PLDHashTable *table, const void *key) { // xor the low 32 bits with the high 32 bits. PRTime t = *static_cast<const PRTime *>(key); PRInt64 h64, l64; LL_USHR(h64, t, 32); l64 = LL_INIT(0, 0xffffffff); LL_AND(l64, l64, t); PRInt32 h32, l32; LL_L2I(h32, h64); LL_L2I(l32, l64); return PLDHashNumber(l32 ^ h32); }
static inline PRUint32 PRTimeToSeconds(PRTime t_usec) { PRTime usec_per_sec; PRUint32 t_sec; LL_I2L(usec_per_sec, PR_USEC_PER_SEC); LL_DIV(t_usec, t_usec, usec_per_sec); LL_L2I(t_sec, t_usec); return t_sec; }
PRInt32 _PR_MD_GETOPENFILEINFO(const PRFileDesc *fd, PRFileInfo *info) { PRFileInfo64 info64; int rv = _PR_MD_GETOPENFILEINFO64(fd, &info64); if (0 == rv) { info->type = info64.type; info->modifyTime = info64.modifyTime; info->creationTime = info64.creationTime; LL_L2I(info->size, info64.size); } return rv; }
static void timePRTime32(void) { PRInt32 index = count; PRInt32 rv32; PRTime q; PRTime rv; LL_I2L(q, 1000000); for (;index--;) { rv = PR_Now(); LL_DIV(rv, rv, q); LL_L2I(rv32, rv); } }
static void TestNowOverhead(void) { PRTime timeout, timein; PRInt32 overhead, loops = 1000000; PRInt64 elapsed, per_call, ten23rd, ten26th; LL_I2L(ten23rd, 1000); LL_I2L(ten26th, 1000000); timein = PR_Now(); while (--loops > 0) timeout = PR_Now(); LL_SUB(elapsed, timeout, timein); LL_MUL(elapsed, elapsed, ten23rd); LL_DIV(per_call, elapsed, ten26th); LL_L2I(overhead, per_call); PR_fprintf( output, "Overhead of 'PR_Now()' is %u nsecs\n\n", overhead); } /* TestNowOverhead */
/* ** Convert a 64-bit integer into its printable form */ static int cvt_ll(SprintfState *ss, PRInt64 num, int width, int prec, int radix, int type, int flags, const char *hexp) { char cvtbuf[100]; char *cvt; int digits; PRInt64 rad; /* according to the man page this needs to happen */ if ((prec == 0) && (LL_IS_ZERO(num))) { return 0; } /* ** Converting decimal is a little tricky. In the unsigned case we ** need to stop when we hit 10 digits. In the signed case, we can ** stop when the number is zero. */ LL_I2L(rad, radix); cvt = cvtbuf + sizeof(cvtbuf); digits = 0; while (!LL_IS_ZERO(num)) { PRInt32 digit; PRInt64 quot, rem; LL_UDIVMOD(", &rem, num, rad); LL_L2I(digit, rem); *--cvt = hexp[digit & 0xf]; digits++; num = quot; } if (digits == 0) { *--cvt = '0'; digits++; } /* ** Now that we have the number converted without its sign, deal with ** the sign and zero padding. */ return fill_n(ss, cvt, digits, width, prec, type, flags); }
PRMJ_ToBaseTime(PRInt64 time) { PRInt64 g1970GMTMicroSeconds; PRInt64 g2037GMTMicroSeconds; PRInt64 low; PRInt32 result; LL_UI2L(g1970GMTMicroSeconds,G1970GMTMICROHI); LL_UI2L(low,G1970GMTMICROLOW); #ifndef HAVE_LONG_LONG LL_SHL(g1970GMTMicroSeconds,g1970GMTMicroSeconds,16); LL_SHL(g1970GMTMicroSeconds,g1970GMTMicroSeconds,16); #else LL_SHL(g1970GMTMicroSeconds,g1970GMTMicroSeconds,32); #endif LL_ADD(g1970GMTMicroSeconds,g1970GMTMicroSeconds,low); LL_UI2L(g2037GMTMicroSeconds,G2037GMTMICROHI); LL_UI2L(low,G2037GMTMICROLOW); #ifndef HAVE_LONG_LONG LL_SHL(g2037GMTMicroSeconds,g2037GMTMicroSeconds,16); LL_SHL(g2037GMTMicroSeconds,g2037GMTMicroSeconds,16); #else LL_SHL(g2037GMTMicroSeconds,g2037GMTMicroSeconds,32); #endif LL_ADD(g2037GMTMicroSeconds,g2037GMTMicroSeconds,low); if(LL_CMP(time, <, g1970GMTMicroSeconds) || LL_CMP(time, >, g2037GMTMicroSeconds)){ return -1; } LL_SUB(time,time,g1970GMTMicroSeconds); LL_L2I(result,time); return result; }
/* * get the difference in seconds between this time zone and UTC (GMT) */ PR_IMPLEMENT(time_t) PRMJ_LocalGMTDifference() { #if defined(XP_UNIX) || defined(XP_PC) struct tm ltime; /* get the difference between this time zone and GMT */ memset((char *)<ime,0,sizeof(ltime)); ltime.tm_mday = 2; ltime.tm_year = 70; #ifdef SUNOS4 ltime.tm_zone = 0; ltime.tm_gmtoff = 0; return timelocal(<ime) - (24 * 3600); #else return mktime(<ime) - (24L * 3600L); #endif #endif #if defined(XP_MAC) static time_t zone = -1L; MachineLocation machineLocation; PRUint64 gmtOffsetSeconds; PRUint64 gmtDelta; PRUint64 dlsOffset; PRInt32 offset; /* difference has been set no need to recalculate */ if(zone != -1) return zone; /* Get the information about the local machine, including * its GMT offset and its daylight savings time info. * Convert each into wides that we can add to * startupTimeMicroSeconds. */ MyReadLocation(&machineLocation); /* Mask off top eight bits of gmtDelta, sign extend lower three. */ if ((machineLocation.u.gmtDelta & 0x00800000) != 0) { gmtOffsetSeconds.lo = (machineLocation.u.gmtDelta & 0x00FFFFFF) | 0xFF000000; gmtOffsetSeconds.hi = 0xFFFFFFFF; LL_UI2L(gmtDelta,0); } else { gmtOffsetSeconds.lo = (machineLocation.u.gmtDelta & 0x00FFFFFF); gmtOffsetSeconds.hi = 0; LL_UI2L(gmtDelta,PRMJ_DAY_SECONDS); } /* normalize time to be positive if you are behind GMT. gmtDelta will always * be positive. */ LL_SUB(gmtDelta,gmtDelta,gmtOffsetSeconds); /* Is Daylight Savings On? If so, we need to add an hour to the offset. */ if (machineLocation.u.dlsDelta != 0) { LL_UI2L(dlsOffset, PRMJ_HOUR_SECONDS); } else LL_I2L(dlsOffset, 0); LL_ADD(gmtDelta,gmtDelta, dlsOffset); LL_L2I(offset,gmtDelta); zone = offset; return (time_t)offset; #endif }
nsresult nsHTTPIndex::OnIndexAvailable(nsIRequest* aRequest, nsISupports *aContext, nsIDirIndex* aIndex) { nsCOMPtr<nsIRDFResource> parentRes = do_QueryInterface(aContext); if (!parentRes) { NS_ERROR("Could not obtain parent resource"); return(NS_ERROR_UNEXPECTED); } const char* baseStr; parentRes->GetValueConst(&baseStr); if (! baseStr) { NS_ERROR("Could not reconstruct base uri\n"); return NS_ERROR_UNEXPECTED; } // we found the filename; construct a resource for its entry nsCAutoString entryuriC(baseStr); // gopher resources don't point to an entry in the same directory // like ftp uris. So the entryuriC is just a unique string, while // the URL attribute is the destination of this element // The naming scheme for the attributes is taken from the bookmarks nsXPIDLCString filename; nsresult rv = aIndex->GetLocation(getter_Copies(filename)); if (NS_FAILED(rv)) return rv; entryuriC.Append(filename); // if its a directory, make sure it ends with a trailing slash. // This doesn't matter for gopher, (where directories don't have // to end in a trailing /), because the filename is used for the URL // attribute. PRUint32 type; rv = aIndex->GetType(&type); if (NS_FAILED(rv)) return rv; PRBool isDirType = (type == nsIDirIndex::TYPE_DIRECTORY); if (isDirType && entryuriC.Last() != '/') { entryuriC.Append('/'); } nsCOMPtr<nsIRDFResource> entry; rv = mDirRDF->GetResource(entryuriC, getter_AddRefs(entry)); // At this point, we'll (hopefully) have found the filename and // constructed a resource for it, stored in entry. So now take a // second pass through the values and add as statements to the RDF // datasource. if (entry && NS_SUCCEEDED(rv)) { nsCOMPtr<nsIRDFLiteral> lit; nsString str; // For gopher, the target is the filename. We still have to do all // the above string manipulation though, because we need the entryuric // as the key for the RDF data source if (!strncmp(entryuriC.get(), kGopherProtocol, sizeof(kGopherProtocol)-1)) str.AssignWithConversion(filename); else { str.AssignWithConversion(entryuriC.get()); } rv = mDirRDF->GetLiteral(str.get(), getter_AddRefs(lit)); if (NS_SUCCEEDED(rv)) { rv = Assert(entry, kNC_URL, lit, PR_TRUE); if (NS_FAILED(rv)) return rv; nsXPIDLString xpstr; // description rv = aIndex->GetDescription(getter_Copies(xpstr)); if (NS_FAILED(rv)) return rv; if (xpstr.Last() == '/') xpstr.Truncate(xpstr.Length() - 1); rv = mDirRDF->GetLiteral(xpstr.get(), getter_AddRefs(lit)); if (NS_FAILED(rv)) return rv; rv = Assert(entry, kNC_Description, lit, PR_TRUE); if (NS_FAILED(rv)) return rv; // contentlength PRInt64 size; rv = aIndex->GetSize(&size); if (NS_FAILED(rv)) return rv; PRInt64 minus1 = LL_MAXUINT; if (LL_NE(size, minus1)) { PRInt32 intSize; LL_L2I(intSize, size); // XXX RDF should support 64 bit integers (bug 240160) nsCOMPtr<nsIRDFInt> val; rv = mDirRDF->GetIntLiteral(intSize, getter_AddRefs(val)); if (NS_FAILED(rv)) return rv; rv = Assert(entry, kNC_ContentLength, val, PR_TRUE); if (NS_FAILED(rv)) return rv; } // lastmodified PRTime tm; rv = aIndex->GetLastModified(&tm); if (NS_FAILED(rv)) return rv; if (tm != -1) { nsCOMPtr<nsIRDFDate> val; rv = mDirRDF->GetDateLiteral(tm, getter_AddRefs(val)); if (NS_FAILED(rv)) return rv; rv = Assert(entry, kNC_LastModified, val, PR_TRUE); } // filetype PRUint32 type; rv = aIndex->GetType(&type); switch (type) { case nsIDirIndex::TYPE_UNKNOWN: rv = mDirRDF->GetLiteral(NS_LITERAL_STRING("UNKNOWN").get(), getter_AddRefs(lit)); break; case nsIDirIndex::TYPE_DIRECTORY: rv = mDirRDF->GetLiteral(NS_LITERAL_STRING("DIRECTORY").get(), getter_AddRefs(lit)); break; case nsIDirIndex::TYPE_FILE: rv = mDirRDF->GetLiteral(NS_LITERAL_STRING("FILE").get(), getter_AddRefs(lit)); break; case nsIDirIndex::TYPE_SYMLINK: rv = mDirRDF->GetLiteral(NS_LITERAL_STRING("SYMLINK").get(), getter_AddRefs(lit)); break; } if (NS_FAILED(rv)) return rv; rv = Assert(entry, kNC_FileType, lit, PR_TRUE); if (NS_FAILED(rv)) return rv; } // Since the definition of a directory depends on the protocol, we would have // to do string comparisons all the time. // But we're told if we're a container right here - so save that fact if (isDirType) Assert(entry, kNC_IsContainer, kTrueLiteral, PR_TRUE); else Assert(entry, kNC_IsContainer, kFalseLiteral, PR_TRUE); // instead of // rv = Assert(parentRes, kNC_Child, entry, PR_TRUE); // if (NS_FAILED(rv)) return rv; // defer insertion onto a timer so that the UI isn't starved AddElement(parentRes, kNC_Child, entry); } return rv; }
nsresult nsListBoxBodyFrame::DoInternalPositionChanged(bool aUp, PRInt32 aDelta) { if (aDelta == 0) return NS_OK; nsRefPtr<nsPresContext> presContext(PresContext()); nsBoxLayoutState state(presContext); // begin timing how long it takes to scroll a row PRTime start = PR_Now(); nsWeakFrame weakThis(this); mContent->GetDocument()->FlushPendingNotifications(Flush_Layout); if (!weakThis.IsAlive()) { return NS_OK; } { nsAutoScriptBlocker scriptBlocker; PRInt32 visibleRows = 0; if (mRowHeight) visibleRows = GetAvailableHeight()/mRowHeight; if (aDelta < visibleRows) { PRInt32 loseRows = aDelta; if (aUp) { // scrolling up, destroy rows from the bottom downwards ReverseDestroyRows(loseRows); mRowsToPrepend += aDelta; mLinkupFrame = nsnull; } else { // scrolling down, destroy rows from the top upwards DestroyRows(loseRows); mRowsToPrepend = 0; } } else { // We have scrolled so much that all of our current frames will // go off screen, so blow them all away. Weeee! nsIFrame *currBox = mFrames.FirstChild(); nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor(); fc->BeginUpdate(); while (currBox) { nsIFrame *nextBox = currBox->GetNextSibling(); RemoveChildFrame(state, currBox); currBox = nextBox; } fc->EndUpdate(); } // clear frame markers so that CreateRows will re-create mTopFrame = mBottomFrame = nsnull; mYPosition = mCurrentIndex*mRowHeight; mScrolling = true; presContext->PresShell()-> FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN); } if (!weakThis.IsAlive()) { return NS_OK; } // Flush calls CreateRows // XXXbz there has to be a better way to do this than flushing! presContext->PresShell()->FlushPendingNotifications(Flush_Layout); if (!weakThis.IsAlive()) { return NS_OK; } mScrolling = false; VerticalScroll(mYPosition); PRTime end = PR_Now(); PRTime difTime; LL_SUB(difTime, end, start); PRInt32 newTime; LL_L2I(newTime, difTime); newTime /= aDelta; // average old and new mTimePerRow = (newTime + mTimePerRow)/2; return NS_OK; }
int x_main() { InvokeTestTarget *test = new InvokeTestTarget(); /* here we make the global 'check for alloc failure' checker happy */ if(!test) return 1; PRInt32 out, tmp32 = 0; PRInt64 out64; printf("calling direct:\n"); if(NS_SUCCEEDED(test->AddTwoInts(1,1,&out))) printf("\t1 + 1 = %d\n", out); else printf("\tFAILED"); PRInt64 one, two; LL_I2L(one, 1); LL_I2L(two, 2); if(NS_SUCCEEDED(test->AddTwoLLs(one,one,&out64))) { LL_L2I(tmp32, out64); printf("\t1L + 1L = %d\n", (int)tmp32); } else printf("\tFAILED"); if(NS_SUCCEEDED(test->MultTwoInts(2,2,&out))) printf("\t2 * 2 = %d\n", out); else printf("\tFAILED"); if(NS_SUCCEEDED(test->MultTwoLLs(two,two,&out64))) { LL_L2I(tmp32, out64); printf("\t2L * 2L = %d\n", (int)tmp32); } else printf("\tFAILED"); double outD; float outF; PRInt32 outI; char *outS; if(NS_SUCCEEDED(test->AddManyInts(1,2,3,4,5,6,7,8,9,10,&outI))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", outI); else printf("\tFAILED"); if(NS_SUCCEEDED(test->AddTwoFloats(1,2,&outF))) printf("\t1 + 2 = %ff\n", (double)outF); else printf("\tFAILED"); if(NS_SUCCEEDED(test->AddManyDoubles(1,2,3,4,5,6,7,8,9,10,&outD))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %f\n", outD); else printf("\tFAILED"); if(NS_SUCCEEDED(test->AddManyFloats(1,2,3,4,5,6,7,8,9,10,&outF))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %ff\n", (double)outF); else printf("\tFAILED"); if(NS_SUCCEEDED(test->AddManyManyFloats(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,&outF))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 +1 15 + 16 + 17 + 18 + 19 + 20 = %ff\n", (double)outF); else printf("\tFAILED"); if(NS_SUCCEEDED(test->AddMixedInts(1,2,3,4,5,6,7,8,9,10,&out64))) { LL_L2I(tmp32, out64); printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)tmp32); } else printf("\tFAILED"); if(NS_SUCCEEDED(test->AddMixedInts2(1,2,3,4,5,6,7,8,9,10,&out64))) { LL_L2I(tmp32, out64); printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)tmp32); } else printf("\tFAILED"); if(NS_SUCCEEDED(test->AddMixedFloats(1,2,3,4,5,6,7,8,9,10,11,&outD))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 = %f\n", (double)outD); else printf("\tFAILED"); if (NS_SUCCEEDED(test->PassTwoStrings("", "moo","cow",&outS))) { printf(" = %s\n", outS); nsMemory::Free(outS); } else printf("\tFAILED"); printf("calling via invoke:\n"); nsXPTCVariant var[21]; var[0].val.i32 = 1; var[0].type = nsXPTType::T_I32; var[0].flags = 0; var[1].val.i32 = 1; var[1].type = nsXPTType::T_I32; var[1].flags = 0; var[2].val.i32 = 0; var[2].type = nsXPTType::T_I32; var[2].flags = nsXPTCVariant::PTR_IS_DATA; var[2].ptr = &var[2].val.i32; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 3, 3, var))) printf("\t1 + 1 = %d\n", var[2].val.i32); else printf("\tFAILED"); LL_I2L(var[0].val.i64, 1); var[0].type = nsXPTType::T_I64; var[0].flags = 0; LL_I2L(var[1].val.i64, 1); var[1].type = nsXPTType::T_I64; var[1].flags = 0; LL_I2L(var[2].val.i64, 0); var[2].type = nsXPTType::T_I64; var[2].flags = nsXPTCVariant::PTR_IS_DATA; var[2].ptr = &var[2].val.i64; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 5, 3, var))) printf("\t1L + 1L = %d\n", (int)var[2].val.i64); else printf("\tFAILED"); var[0].val.i32 = 2; var[0].type = nsXPTType::T_I32; var[0].flags = 0; var[1].val.i32 = 2; var[1].type = nsXPTType::T_I32; var[1].flags = 0; var[2].val.i32 = 0; var[2].type = nsXPTType::T_I32; var[2].flags = nsXPTCVariant::PTR_IS_DATA; var[2].ptr = &var[2].val.i32; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 4, 3, var))) printf("\t2 * 2 = %d\n", var[2].val.i32); else printf("\tFAILED"); LL_I2L(var[0].val.i64,2); var[0].type = nsXPTType::T_I64; var[0].flags = 0; LL_I2L(var[1].val.i64,2); var[1].type = nsXPTType::T_I64; var[1].flags = 0; LL_I2L(var[2].val.i64,0); var[2].type = nsXPTType::T_I64; var[2].flags = nsXPTCVariant::PTR_IS_DATA; var[2].ptr = &var[2].val.i64; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 6, 3, var))) printf("\t2L * 2L = %d\n", (int)var[2].val.i64); else printf("\tFAILED"); var[0].val.i32 = 1; var[0].type = nsXPTType::T_I32; var[0].flags = 0; var[1].val.i32 = 2; var[1].type = nsXPTType::T_I32; var[1].flags = 0; var[2].val.i32 = 3; var[2].type = nsXPTType::T_I32; var[2].flags = 0; var[3].val.i32 = 4; var[3].type = nsXPTType::T_I32; var[3].flags = 0; var[4].val.i32 = 5; var[4].type = nsXPTType::T_I32; var[4].flags = 0; var[5].val.i32 = 6; var[5].type = nsXPTType::T_I32; var[5].flags = 0; var[6].val.i32 = 7; var[6].type = nsXPTType::T_I32; var[6].flags = 0; var[7].val.i32 = 8; var[7].type = nsXPTType::T_I32; var[7].flags = 0; var[8].val.i32 = 9; var[8].type = nsXPTType::T_I32; var[8].flags = 0; var[9].val.i32 = 10; var[9].type = nsXPTType::T_I32; var[9].flags = 0; var[10].val.i32 = 0; var[10].type = nsXPTType::T_I32; var[10].flags = nsXPTCVariant::PTR_IS_DATA; var[10].ptr = &var[10].val.i32; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 7, 11, var))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", var[10].val.i32); var[0].val.f = 1.0f; var[0].type = nsXPTType::T_FLOAT; var[0].flags = 0; var[1].val.f = 2.0f; var[1].type = nsXPTType::T_FLOAT; var[1].flags = 0; var[2].val.f = 0.0f; var[2].type = nsXPTType::T_FLOAT; var[2].flags = nsXPTCVariant::PTR_IS_DATA; var[2].ptr = &var[2].val.f; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 8, 3, var))) printf("\t1 + 2 = %ff\n", (double) var[2].val.f); var[0].val.d = 1.0; var[0].type = nsXPTType::T_DOUBLE; var[0].flags = 0; var[1].val.d = 2.0; var[1].type = nsXPTType::T_DOUBLE; var[1].flags = 0; var[2].val.d = 3.0; var[2].type = nsXPTType::T_DOUBLE; var[2].flags = 0; var[3].val.d = 4.0; var[3].type = nsXPTType::T_DOUBLE; var[3].flags = 0; var[4].val.d = 5.0; var[4].type = nsXPTType::T_DOUBLE; var[4].flags = 0; var[5].val.d = 6.0; var[5].type = nsXPTType::T_DOUBLE; var[5].flags = 0; var[6].val.d = 7.0; var[6].type = nsXPTType::T_DOUBLE; var[6].flags = 0; var[7].val.d = 8.0; var[7].type = nsXPTType::T_DOUBLE; var[7].flags = 0; var[8].val.d = 9.0; var[8].type = nsXPTType::T_DOUBLE; var[8].flags = 0; var[9].val.d = 10.0; var[9].type = nsXPTType::T_DOUBLE; var[9].flags = 0; var[10].val.d = 0.0; var[10].type = nsXPTType::T_DOUBLE; var[10].flags = nsXPTCVariant::PTR_IS_DATA; var[10].ptr = &var[10].val.d; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 9, 11, var))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %f\n", var[10].val.d); else printf("\tFAILED"); var[0].val.f = 1.0f; var[0].type = nsXPTType::T_FLOAT; var[0].flags = 0; var[1].val.f = 2.0f; var[1].type = nsXPTType::T_FLOAT; var[1].flags = 0; var[2].val.f = 3.0f; var[2].type = nsXPTType::T_FLOAT; var[2].flags = 0; var[3].val.f = 4.0f; var[3].type = nsXPTType::T_FLOAT; var[3].flags = 0; var[4].val.f = 5.0f; var[4].type = nsXPTType::T_FLOAT; var[4].flags = 0; var[5].val.f = 6.0f; var[5].type = nsXPTType::T_FLOAT; var[5].flags = 0; var[6].val.f = 7.0f; var[6].type = nsXPTType::T_FLOAT; var[6].flags = 0; var[7].val.f = 8.0f; var[7].type = nsXPTType::T_FLOAT; var[7].flags = 0; var[8].val.f = 9.0f; var[8].type = nsXPTType::T_FLOAT; var[8].flags = 0; var[9].val.f = 10.0f; var[9].type = nsXPTType::T_FLOAT; var[9].flags = 0; var[10].val.f = 0.0f; var[10].type = nsXPTType::T_FLOAT; var[10].flags = nsXPTCVariant::PTR_IS_DATA; var[10].ptr = &var[10].val.f; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 10, 11, var))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %ff\n", (double) var[10].val.f); else printf("\tFAILED"); var[0].val.f = 1.0f; var[0].type = nsXPTType::T_FLOAT; var[0].flags = 0; var[1].val.f = 2.0f; var[1].type = nsXPTType::T_FLOAT; var[1].flags = 0; var[2].val.f = 3.0f; var[2].type = nsXPTType::T_FLOAT; var[2].flags = 0; var[3].val.f = 4.0f; var[3].type = nsXPTType::T_FLOAT; var[3].flags = 0; var[4].val.f = 5.0f; var[4].type = nsXPTType::T_FLOAT; var[4].flags = 0; var[5].val.f = 6.0f; var[5].type = nsXPTType::T_FLOAT; var[5].flags = 0; var[6].val.f = 7.0f; var[6].type = nsXPTType::T_FLOAT; var[6].flags = 0; var[7].val.f = 8.0f; var[7].type = nsXPTType::T_FLOAT; var[7].flags = 0; var[8].val.f = 9.0f; var[8].type = nsXPTType::T_FLOAT; var[8].flags = 0; var[9].val.f = 10.0f; var[9].type = nsXPTType::T_FLOAT; var[9].flags = 0; var[10].val.f = 11.0f; var[10].type = nsXPTType::T_FLOAT; var[10].flags = 0; var[11].val.f = 12.0f; var[11].type = nsXPTType::T_FLOAT; var[11].flags = 0; var[12].val.f = 13.0f; var[12].type = nsXPTType::T_FLOAT; var[12].flags = 0; var[13].val.f = 14.0f; var[13].type = nsXPTType::T_FLOAT; var[13].flags = 0; var[14].val.f = 15.0f; var[14].type = nsXPTType::T_FLOAT; var[14].flags = 0; var[15].val.f = 16.0f; var[15].type = nsXPTType::T_FLOAT; var[15].flags = 0; var[16].val.f = 17.0f; var[16].type = nsXPTType::T_FLOAT; var[16].flags = 0; var[17].val.f = 18.0f; var[17].type = nsXPTType::T_FLOAT; var[17].flags = 0; var[18].val.f = 19.0f; var[18].type = nsXPTType::T_FLOAT; var[18].flags = 0; var[19].val.f = 20.0f; var[19].type = nsXPTType::T_FLOAT; var[19].flags = 0; var[20].val.f = 0.0f; var[20].type = nsXPTType::T_FLOAT; var[20].flags = nsXPTCVariant::PTR_IS_DATA; var[20].ptr = &var[20].val.f; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 11, 21, var))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 = %ff\n", (double) var[20].val.f); var[0].val.i64 = 1; var[0].type = nsXPTType::T_I64; var[0].flags = 0; var[1].val.i32 = 2; var[1].type = nsXPTType::T_I32; var[1].flags = 0; var[2].val.i64 = 3; var[2].type = nsXPTType::T_I64; var[2].flags = 0; var[3].val.i32 = 4; var[3].type = nsXPTType::T_I32; var[3].flags = 0; var[4].val.i32 = 5; var[4].type = nsXPTType::T_I32; var[4].flags = 0; var[5].val.i64 = 6; var[5].type = nsXPTType::T_I64; var[5].flags = 0; var[6].val.i32 = 7; var[6].type = nsXPTType::T_I32; var[6].flags = 0; var[7].val.i32 = 8; var[7].type = nsXPTType::T_I32; var[7].flags = 0; var[8].val.i64 = 9; var[8].type = nsXPTType::T_I64; var[8].flags = 0; var[9].val.i32 = 10; var[9].type = nsXPTType::T_I32; var[9].flags = 0; var[10].val.i64 = 0; var[10].type = nsXPTType::T_I64; var[10].flags = nsXPTCVariant::PTR_IS_DATA; var[10].ptr = &var[10].val.i64; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 12, 11, var))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)var[10].val.i64); else printf("\tFAILED"); var[0].val.i32 = 1; var[0].type = nsXPTType::T_I32; var[0].flags = 0; var[1].val.i64 = 2; var[1].type = nsXPTType::T_I64; var[1].flags = 0; var[2].val.i32 = 3; var[2].type = nsXPTType::T_I32; var[2].flags = 0; var[3].val.i64 = 4; var[3].type = nsXPTType::T_I64; var[3].flags = 0; var[4].val.i64 = 5; var[4].type = nsXPTType::T_I64; var[4].flags = 0; var[5].val.i32 = 6; var[5].type = nsXPTType::T_I32; var[5].flags = 0; var[6].val.i64 = 7; var[6].type = nsXPTType::T_I64; var[6].flags = 0; var[7].val.i64 = 8; var[7].type = nsXPTType::T_I64; var[7].flags = 0; var[8].val.i32 = 9; var[8].type = nsXPTType::T_I32; var[8].flags = 0; var[9].val.i64 = 10; var[9].type = nsXPTType::T_I64; var[9].flags = 0; var[10].val.i64 = 0; var[10].type = nsXPTType::T_I64; var[10].flags = nsXPTCVariant::PTR_IS_DATA; var[10].ptr = &var[10].val.i64; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 13, 11, var))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)var[10].val.i64); else printf("\tFAILED"); var[0].val.f = 1.0f; var[0].type = nsXPTType::T_FLOAT; var[0].flags = 0; var[1].val.f = 2.0f; var[1].type = nsXPTType::T_FLOAT; var[1].flags = 0; var[2].val.d = 3.0; var[2].type = nsXPTType::T_DOUBLE; var[2].flags = 0; var[3].val.d = 4.0; var[3].type = nsXPTType::T_DOUBLE; var[3].flags = 0; var[4].val.f = 5.0f; var[4].type = nsXPTType::T_FLOAT; var[4].flags = 0; var[5].val.f = 6.0f; var[5].type = nsXPTType::T_FLOAT; var[5].flags = 0; var[6].val.d = 7.0; var[6].type = nsXPTType::T_DOUBLE; var[6].flags = 0; var[7].val.d = 8.0; var[7].type = nsXPTType::T_DOUBLE; var[7].flags = 0; var[8].val.f = 9.0f; var[8].type = nsXPTType::T_FLOAT; var[8].flags = 0; var[9].val.d = 10.0; var[9].type = nsXPTType::T_DOUBLE; var[9].flags = 0; var[10].val.f = 11.0f; var[10].type = nsXPTType::T_FLOAT; var[10].flags = 0; var[11].val.d = 0.0; var[11].type = nsXPTType::T_DOUBLE; var[11].flags = nsXPTCVariant::PTR_IS_DATA; var[11].ptr = &var[11].val.d; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 14, 12, var))) printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 = %f\n", var[11].val.d); else printf("\tFAILED"); var[0].val.p = (void*)""; var[0].type = nsXPTType::T_CHAR_STR; var[0].flags = 0; var[1].val.p = (void*)"moo"; var[1].type = nsXPTType::T_CHAR_STR; var[1].flags = 0; var[2].val.p = (void*)"cow"; var[2].type = nsXPTType::T_CHAR_STR; var[2].flags = 0; var[3].val.p = 0; var[3].type = nsXPTType::T_CHAR_STR; var[3].flags = nsXPTCVariant::PTR_IS_DATA; var[3].ptr = &var[2].val.p; if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 15, 4, var))) printf(" = %s\n", var[2].val.p); else printf("\tFAILED"); DoMultipleInheritenceTest(); DoMultipleInheritenceTest2(); // Disabled by default - takes too much time on slow machines //DoSpeedTest(); return 0; }