void RMtx4Scaling( RMtx4* out, rmReal sx, rmReal sy, rmReal sz ) { RMtx4Identity( out ); SET_ELEMENT( out, 0, 0, sx ); SET_ELEMENT( out, 1, 1, sy ); SET_ELEMENT( out, 2, 2, sz ); }
void RMtx4SetColumn( RMtx4* out, const RVec4* in, int col ) { SET_ELEMENT( out, 0, col, RVec4GetElement( in, 0 ) ); SET_ELEMENT( out, 1, col, RVec4GetElement( in, 1 ) ); SET_ELEMENT( out, 2, col, RVec4GetElement( in, 2 ) ); SET_ELEMENT( out, 3, col, RVec4GetElement( in, 3 ) ); }
void RMtx4Translation( RMtx4* out, rmReal tx, rmReal ty, rmReal tz ) { RMtx4Identity( out ); SET_ELEMENT( out, 0, 3, tx ); SET_ELEMENT( out, 1, 3, ty ); SET_ELEMENT( out, 2, 3, tz ); }
void RMtx4SetRow( RMtx4* out, const RVec4* in, int row ) { SET_ELEMENT( out, row, 0, RVec4GetElement( in, 0 ) ); SET_ELEMENT( out, row, 1, RVec4GetElement( in, 1 ) ); SET_ELEMENT( out, row, 2, RVec4GetElement( in, 2 ) ); SET_ELEMENT( out, row, 3, RVec4GetElement( in, 3 ) ); }
static SEXP make_fasta_index_data_frame(const IntAE *recno_buf, const IntAE *fileno_buf, const LLongAE *offset_buf, const CharAEAE *desc_buf, const IntAE *seqlength_buf) { SEXP df, colnames, tmp; int i; PROTECT(df = NEW_LIST(5)); PROTECT(colnames = NEW_CHARACTER(5)); PROTECT(tmp = mkChar("recno")); SET_STRING_ELT(colnames, 0, tmp); UNPROTECT(1); PROTECT(tmp = mkChar("fileno")); SET_STRING_ELT(colnames, 1, tmp); UNPROTECT(1); PROTECT(tmp = mkChar("offset")); SET_STRING_ELT(colnames, 2, tmp); UNPROTECT(1); PROTECT(tmp = mkChar("desc")); SET_STRING_ELT(colnames, 3, tmp); UNPROTECT(1); PROTECT(tmp = mkChar("seqlength")); SET_STRING_ELT(colnames, 4, tmp); UNPROTECT(1); SET_NAMES(df, colnames); UNPROTECT(1); PROTECT(tmp = new_INTEGER_from_IntAE(recno_buf)); SET_ELEMENT(df, 0, tmp); UNPROTECT(1); PROTECT(tmp = new_INTEGER_from_IntAE(fileno_buf)); SET_ELEMENT(df, 1, tmp); UNPROTECT(1); PROTECT(tmp = NEW_NUMERIC(LLongAE_get_nelt(offset_buf))); for (i = 0; i < LENGTH(tmp); i++) REAL(tmp)[i] = (double) offset_buf->elts[i]; SET_ELEMENT(df, 2, tmp); UNPROTECT(1); PROTECT(tmp = new_CHARACTER_from_CharAEAE(desc_buf)); SET_ELEMENT(df, 3, tmp); UNPROTECT(1); PROTECT(tmp = new_INTEGER_from_IntAE(seqlength_buf)); SET_ELEMENT(df, 4, tmp); UNPROTECT(1); /* list_as_data_frame() performs IN-PLACE coercion */ list_as_data_frame(df, IntAE_get_nelt(recno_buf)); UNPROTECT(1); return df; }
/* From Quaternion to Matrix and Back http://www.intel.com/cd/ids/developer/asmo-na/eng/293748.htm */ void RMtx4RotationQuaternion( RMtx4* out, const struct RQuat* q ) { rmReal x = RQuatGetX( q ); rmReal y = RQuatGetY( q ); rmReal z = RQuatGetZ( q ); rmReal w = RQuatGetW( q ); rmReal x2 = 2.0f * x; rmReal y2 = 2.0f * y; rmReal z2 = 2.0f * z; rmReal xx2 = x * x2; rmReal yy2 = y * y2; rmReal zz2 = z * z2; rmReal yz2 = y * z2; rmReal wx2 = w * x2; rmReal xy2 = x * y2; rmReal wz2 = w * z2; rmReal xz2 = x * z2; rmReal wy2 = w * y2; RMtx4Identity( out ); SET_ELEMENT( out, 0, 0, 1.0f - yy2 - zz2 ); SET_ELEMENT( out, 1, 0, xy2 + wz2 ); SET_ELEMENT( out, 2, 0, xz2 - wy2 ); SET_ELEMENT( out, 0, 1, xy2 - wz2 ); SET_ELEMENT( out, 1, 1, 1.0f - xx2 - zz2 ); SET_ELEMENT( out, 2, 1, yz2 + wx2 ); SET_ELEMENT( out, 0, 2, xz2 + wy2 ); SET_ELEMENT( out, 1, 2, yz2 - wx2 ); SET_ELEMENT( out, 2, 2, 1.0f - xx2 - yy2 ); }
/* http://en.wikipedia.org/wiki/Rotation_representation_%28mathematics%29 http://en.wikipedia.org/wiki/Rotation_matrix */ void RMtx4RotationZ( RMtx4* out, rmReal radian ) { rmReal s = rmSin( radian ); rmReal c = rmCos( radian ); RMtx4Identity( out ); SET_ELEMENT( out, 0, 0, c ); SET_ELEMENT( out, 0, 1, -s ); SET_ELEMENT( out, 1, 0, s ); SET_ELEMENT( out, 1, 1, c ); }
// used with glm_*.c void SetModel1(SEXP Rfit, SEXP Rmodel_m, SEXP beta, SEXP se, SEXP modelspace, SEXP deviance, SEXP R2, SEXP Q, SEXP Rintercept, int m) { SET_ELEMENT(beta, m, getListElement(getListElement(Rfit, "fit"),"coefficients")); SET_ELEMENT(se, m, getListElement(getListElement(Rfit, "fit"),"se")); SET_ELEMENT(modelspace, m, Rmodel_m); REAL(R2)[m] = NA_REAL; REAL(deviance)[m] = REAL(getListElement(getListElement(Rfit, "fit"),"deviance"))[0]; REAL(Q)[m] = REAL(getListElement(getListElement(Rfit, "lpy"),"Q"))[0]; REAL(Rintercept)[m] = REAL(getListElement(getListElement(Rfit, "lpy"),"intercept"))[0]; };
nsresult Dashboard::GetDNSCacheEntries() { jsval val; JSContext* cx = nsContentUtils::GetSafeJSContext(); JSAutoRequest request(cx); JSObject* finalObject = JS_NewObject(cx, nullptr, nullptr, nullptr); if (!finalObject) return NS_ERROR_OUT_OF_MEMORY; CREATE_ARRAY_OBJECT(nameJs); CREATE_ARRAY_OBJECT(addrJs); CREATE_ARRAY_OBJECT(familyJs); CREATE_ARRAY_OBJECT(expiresJs); for (uint32_t i = 0; i < mDns.data.Length(); i++) { JSString* hostnameString = JS_NewStringCopyZ(cx, mDns.data[i].hostname.get()); SET_ELEMENT(nameJs, STRING_TO_JSVAL, hostnameString, i); JSObject* addrObject = JS_NewObject(cx, nullptr, nullptr, nullptr); if (!addrObject) return NS_ERROR_OUT_OF_MEMORY; for (uint32_t j = 0; j < mDns.data[i].hostaddr.Length(); j++) { JSString* addrString = JS_NewStringCopyZ(cx, mDns.data[i].hostaddr[j].get()); SET_ELEMENT(addrObject, STRING_TO_JSVAL, addrString, j); } SET_ELEMENT(addrJs, OBJECT_TO_JSVAL, addrObject, i); JSString* familyString; if (mDns.data[i].family == PR_AF_INET6) familyString = JS_NewStringCopyZ(cx, "ipv6"); else familyString = JS_NewStringCopyZ(cx, "ipv4"); SET_ELEMENT(familyJs, STRING_TO_JSVAL, familyString, i); SET_ELEMENT(expiresJs, DOUBLE_TO_JSVAL, (double) mDns.data[i].expiration, i); } SET_PROPERTY(finalObject, nameJs, hostname); SET_PROPERTY(finalObject, addrJs, hostaddr); SET_PROPERTY(finalObject, familyJs, family); SET_PROPERTY(finalObject, expiresJs, expiration); val = OBJECT_TO_JSVAL(finalObject); mDns.cb->OnDashboardDataAvailable(val); mDns.cb = nullptr; return NS_OK; }
SEXP RS_DBI_createNamedList(char **names, SEXPTYPE *types, int *lengths, int n) { SEXP output, output_names, obj = R_NilValue; int num_elem; int j; PROTECT(output = NEW_LIST(n)); PROTECT(output_names = NEW_CHARACTER(n)); for(j = 0; j < n; j++){ num_elem = lengths[j]; switch((int)types[j]){ case LGLSXP: PROTECT(obj = NEW_LOGICAL(num_elem)); break; case INTSXP: PROTECT(obj = NEW_INTEGER(num_elem)); break; case REALSXP: PROTECT(obj = NEW_NUMERIC(num_elem)); break; case STRSXP: PROTECT(obj = NEW_CHARACTER(num_elem)); break; case VECSXP: PROTECT(obj = NEW_LIST(num_elem)); break; default: error("unsupported data type"); } SET_ELEMENT(output, (int)j, obj); SET_CHR_EL(output_names, j, mkChar(names[j])); } SET_NAMES(output, output_names); UNPROTECT(n+2); return(output); }
static SEXP vwhich_PDict3Parts_XStringSet(SEXP pptb, HeadTail *headtail, SEXP subject, SEXP max_mismatch, SEXP min_mismatch, SEXP fixed, MatchPDictBuf *matchpdict_buf) { int S_length, j; XStringSet_holder S; SEXP ans, ans_elt; Chars_holder S_elt; S = _hold_XStringSet(subject); S_length = _get_length_from_XStringSet_holder(&S); PROTECT(ans = NEW_LIST(S_length)); for (j = 0; j < S_length; j++) { S_elt = _get_elt_from_XStringSet_holder(&S, j); match_pdict(pptb, headtail, &S_elt, max_mismatch, min_mismatch, fixed, matchpdict_buf); PROTECT(ans_elt = _MatchBuf_which_asINTEGER( &(matchpdict_buf->matches))); SET_ELEMENT(ans, j, ans_elt); UNPROTECT(1); _MatchPDictBuf_flush(matchpdict_buf); } UNPROTECT(1); return ans; }
////////////////////////////////////////// // addCharVector SEXP addCharVector(SEXP data, SEXP dataNames, unsigned int j, int n, const char* name) { SET_ELEMENT(data, j, NEW_STRING(n)); SET_STRING_ELT(dataNames, j, mkChar(name)); return VECTOR_ELT(data, j); }
SEXP RS_MySQL_resultSetInfo(SEXP rsHandle) { RS_DBI_resultSet *result; SEXP output, flds; int n = 6; char *rsDesc[] = {"statement", "isSelect", "rowsAffected", "rowCount", "completed", "fieldDescription"}; SEXPTYPE rsType[] = {STRSXP, INTSXP, INTSXP, INTSXP, INTSXP, VECSXP}; int rsLen[] = {1, 1, 1, 1, 1, 1}; result = RS_DBI_getResultSet(rsHandle); flds = R_NilValue; output = RS_DBI_createNamedList(rsDesc, rsType, rsLen, n); SET_LST_CHR_EL(output,0,0,mkChar(result->statement)); LST_INT_EL(output,1,0) = result->isSelect; LST_INT_EL(output,2,0) = result->rowsAffected; LST_INT_EL(output,3,0) = result->rowCount; LST_INT_EL(output,4,0) = result->completed; if(flds != R_NilValue) SET_ELEMENT(LST_EL(output, 5), (int) 0, flds); return output; }
void RMtx4SetUpper3x3( RMtx4* out, const RMtx3* in ) { SET_ELEMENT( out, 0, 0, RMtx3GetElement( in, 0, 0 ) ); SET_ELEMENT( out, 0, 1, RMtx3GetElement( in, 0, 1 ) ); SET_ELEMENT( out, 0, 2, RMtx3GetElement( in, 0, 2 ) ); SET_ELEMENT( out, 1, 0, RMtx3GetElement( in, 1, 0 ) ); SET_ELEMENT( out, 1, 1, RMtx3GetElement( in, 1, 1 ) ); SET_ELEMENT( out, 1, 2, RMtx3GetElement( in, 1, 2 ) ); SET_ELEMENT( out, 2, 0, RMtx3GetElement( in, 2, 0 ) ); SET_ELEMENT( out, 2, 1, RMtx3GetElement( in, 2, 1 ) ); SET_ELEMENT( out, 2, 2, RMtx3GetElement( in, 2, 2 ) ); }
void RMtx4Identity( RMtx4* out ) { int row, col; for ( row = 0; row < 4; ++row ) for ( col = 0; col < 4; ++col ) SET_ELEMENT( out, row, col, (row==col) ? 1.0f : 0.0f ); }
void RMtx4Zero( RMtx4* out ) { int row, col; for ( row = 0; row < 4; ++row ) for ( col = 0; col < 4; ++col ) SET_ELEMENT( out, row, col, 0.0f ); }
static R_INLINE void setrownames (SEXP x, SEXP names, int n) { int nprotect = 0; SEXP dimnms, nm; PROTECT(nm = AS_CHARACTER(names)); nprotect++; PROTECT(dimnms = allocVector(VECSXP,n)); nprotect++; SET_ELEMENT(dimnms,0,nm); // set row names SET_DIMNAMES(x,dimnms); UNPROTECT(nprotect); }
void RMtx4Scale( RMtx4* out, const RMtx4* m, rmReal f ) { int row, col; for ( row = 0; row < 4; ++row ) for ( col = 0; col < 4; ++col ) SET_ELEMENT( out, row, col, GET_ELEMENT( m, row, col ) * f ); }
void RMtx4Sub( RMtx4* out, const RMtx4* m1, const RMtx4* m2 ) { int row, col; for ( row = 0; row < 4; ++row ) for ( col = 0; col < 4; ++col ) SET_ELEMENT( out, row, col, GET_ELEMENT( m1, row, col ) - GET_ELEMENT( m2, row, col ) ); }
void RMtx4Transpose( RMtx4* out, const RMtx4* in ) { int row, col; RMtx4 tmp; for ( row = 0; row < 4; ++row ) for ( col = 0; col < 4; ++col ) SET_ELEMENT( &tmp, row, col, GET_ELEMENT( in, col, row ) ); RMtx4Copy( out, &tmp ); }
void RMtx4Add( RMtx4* out, const RMtx4* m1, const RMtx4* m2 ) { int row, col; RMtx4 tmp; for ( row = 0; row < 4; ++row ) for ( col = 0; col < 4; ++col ) SET_ELEMENT( &tmp, row, col, GET_ELEMENT( m1, row, col ) + GET_ELEMENT( m2, row, col ) ); RMtx4Copy( out, &tmp ); }
/* http://en.wikipedia.org/wiki/Rotation_matrix */ void RMtx4RotationAxis( RMtx4* out, const RVec3* axis, rmReal radian ) { rmReal s = rmSin( radian ); rmReal c = rmCos( radian ); rmReal C = 1.0f - c; rmReal x = RVec3GetX( axis ); rmReal y = RVec3GetY( axis ); rmReal z = RVec3GetZ( axis ); RMtx4Identity( out ); SET_ELEMENT( out, 0, 0, x*x*C + c ); SET_ELEMENT( out, 0, 1, x*y*C - z*s ); SET_ELEMENT( out, 0, 2, z*x*C + y*s ); SET_ELEMENT( out, 1, 0, x*y*C + z*s ); SET_ELEMENT( out, 1, 1, y*y*C + c ); SET_ELEMENT( out, 1, 2, y*z*C - x*s ); SET_ELEMENT( out, 2, 0, z*x*C - y*s ); SET_ELEMENT( out, 2, 1, y*z*C + x*s ); SET_ELEMENT( out, 2, 2, z*z*C + c ); }
/* http://pyopengl.sourceforge.net/documentation/manual/glFrustum.3G.html */ void RMtx4PerspectiveOffCenterRH( RMtx4* out, rmReal left, rmReal right, rmReal bottom, rmReal top, rmReal znear, rmReal zfar ) { rmReal A = (right+left) / (right-left); rmReal B = (top+bottom) / (top-bottom); rmReal C = -(zfar+znear) / (zfar-znear); rmReal D = -(2*znear*zfar) / (zfar-znear); RMtx4Identity( out ); SET_ELEMENT( out, 0, 0, 2*znear/(right-left) ); SET_ELEMENT( out, 0, 2, A ); SET_ELEMENT( out, 1, 1, 2*znear/(top-bottom) ); SET_ELEMENT( out, 1, 2, B ); SET_ELEMENT( out, 2, 2, C ); SET_ELEMENT( out, 2, 3, D ); SET_ELEMENT( out, 3, 2, -1.0f ); SET_ELEMENT( out, 3, 3, 0.0f ); }
void RS_DBI_allocOutput(SEXP output, RMySQLFields* flds, int num_rec, int expand) { SEXP names, s_tmp; int j; int num_fields; SEXPTYPE *fld_Sclass; PROTECT(output); num_fields = flds->num_fields; if(expand){ for(j = 0; j < (int) num_fields; j++){ /* Note that in R-1.2.3 (at least) we need to protect SET_LENGTH */ s_tmp = LST_EL(output,j); PROTECT(SET_LENGTH(s_tmp, num_rec)); SET_ELEMENT(output, j, s_tmp); UNPROTECT(1); } UNPROTECT(1); return; } fld_Sclass = flds->Sclass; for(j = 0; j < (int) num_fields; j++){ switch((int)fld_Sclass[j]){ case LGLSXP: SET_ELEMENT(output, j, NEW_LOGICAL(num_rec)); break; case STRSXP: SET_ELEMENT(output, j, NEW_CHARACTER(num_rec)); break; case INTSXP: SET_ELEMENT(output, j, NEW_INTEGER(num_rec)); break; case REALSXP: SET_ELEMENT(output, j, NEW_NUMERIC(num_rec)); break; case VECSXP: SET_ELEMENT(output, j, NEW_LIST(num_rec)); break; default: error("unsupported data type"); } } PROTECT(names = NEW_CHARACTER((int) num_fields)); for(j = 0; j< (int) num_fields; j++){ SET_CHR_EL(names,j, mkChar(flds->name[j])); } SET_NAMES(output, names); UNPROTECT(2); return; }
/* http://pyopengl.sourceforge.net/documentation/manual/gluPerspective.3G.html */ void RMtx4PerspectiveFovRH( RMtx4* out, rmReal fovy_radian, rmReal aspect, rmReal znear, rmReal zfar ) { rmReal f = rmTan( fovy_radian / 2.0f ); f = 1.0f / f; RMtx4Identity( out ); SET_ELEMENT( out, 0, 0, f / aspect ); SET_ELEMENT( out, 1, 1, f ); SET_ELEMENT( out, 2, 2, (zfar+znear)/(znear-zfar) ); SET_ELEMENT( out, 2, 3, 2*zfar*znear/(znear-zfar) ); SET_ELEMENT( out, 3, 2, -1.0f ); SET_ELEMENT( out, 3, 3, 0.0f ); }
//////////////////////////////////////////////////////////// // names -- get the names of the branches and their details SEXP RootChainManager::names() const { // Advance to the first entry //m_chain->GetEntry(0); // Above commented out 20090616 - for TMBTrees this crashed root // on an unresolved symbol for allocator<char>. // Get the branches TObjArray* branches = m_chain->GetListOfBranches(); // How many? unsigned int nBranches = branches->GetEntriesFast(); // Make the R list for returning the list of branch and detail names SEXP rBranchList, rBranchListNames; PROTECT(rBranchList = NEW_LIST(nBranches)); PROTECT(rBranchListNames = NEW_CHARACTER(nBranches)); // Loop over the branches in the tree for ( unsigned int branchIter = 0; branchIter < nBranches; ++branchIter ) { // Get the branch TBranch* branch = (TBranch*) branches->UncheckedAt(branchIter); // Save away the name of this branch for use as an attribute SET_STRING_ELT(rBranchListNames, branchIter, mkChar(branch->GetName())); SEXP details = NEW_CHARACTER(1); SET_ELEMENT(rBranchList, branchIter, details); SET_STRING_ELT(details, 0, mkChar( branch->GetTitle() ) ); } // for over branches // Set the names attribute SET_NAMES(rBranchList, rBranchListNames); // Release rBranchList and rBranchListNames UNPROTECT(2); return rBranchList; }
//Convert Julia Type To R,Real interface SEXP Julia_R(jl_value_t *Var) { SEXP ans = R_NilValue; if (jl_is_nothing(Var) || jl_is_null(Var)) return ans; //Array To Vector JL_GC_PUSH1(&Var); if (jl_is_array(Var)) { ans = Julia_R_MD(Var); } else if (jl_is_DataArrayFrame(Var)) { //try to load DataArrays DataFrames package if (!LoadDF()) { JL_GC_POP(); return R_NilValue; } if (jl_is_NAtype(Var)) ans = Julia_R_Scalar_NA(Var); else if (jl_is_DataFrame(Var)) ans = Julia_R_MD_NA_DataFrame(Var); else if (jl_is_DataArray(Var)) ans = Julia_R_MD_NA(Var); else if (jl_is_PooledDataArray(Var)) ans = Julia_R_MD_NA_Factor(Var); } else if (jl_is_tuple(Var)) { PROTECT(ans = allocVector(VECSXP, jl_tuple_len(Var))); for (int i = 0; i < jl_tuple_len(Var); i++) SET_ELEMENT(ans, i, Julia_R(jl_tupleref(Var, i))); UNPROTECT(1); } else ans = Julia_R_Scalar(Var); JL_GC_POP(); return ans; }
/* http://pyopengl.sourceforge.net/documentation/manual/glOrtho.3G.html */ void RMtx4OrthoOffCenterRH( RMtx4* out, rmReal left, rmReal right, rmReal bottom, rmReal top, rmReal znear, rmReal zfar ) { rmReal tx = (right+left) / (right-left); rmReal ty = (top+bottom) / (top-bottom); rmReal tz = (zfar+znear) / (zfar-znear); RMtx4Identity( out ); SET_ELEMENT( out, 0, 0, 2.0f/(right-left) ); SET_ELEMENT( out, 0, 3, tx ); SET_ELEMENT( out, 1, 1, 2.0f/(top-bottom) ); SET_ELEMENT( out, 1, 3, ty ); SET_ELEMENT( out, 2, 2, -2.0f/(zfar-znear) ); SET_ELEMENT( out, 2, 3, tz ); }
void RMtx4Mul( RMtx4* out, const RMtx4* m1, const RMtx4* m2 ) { int row, col; RMtx4 tmp; for ( row = 0; row < 4; ++row ) { for ( col = 0; col < 4; ++col ) { int i; rmReal sum = 0.0f; for ( i = 0; i < 4; ++i ) { sum += GET_ELEMENT( m1, row, i ) * GET_ELEMENT( m2, i, col ); } SET_ELEMENT( &tmp, row, col, sum ); } } RMtx4Copy( out, &tmp ); }
nsresult Dashboard::GetWebSocketConnections() { jsval val; JSString* jsstring; JSContext* cx = nsContentUtils::GetSafeJSContext(); JSAutoRequest request(cx); JSObject* finalObject = JS_NewObject(cx, nullptr, nullptr, nullptr); if (!finalObject) return NS_ERROR_OUT_OF_MEMORY; CREATE_ARRAY_OBJECT(hostJs); CREATE_ARRAY_OBJECT(msgSentJs); CREATE_ARRAY_OBJECT(msgRecvJs); CREATE_ARRAY_OBJECT(sizeSentJs); CREATE_ARRAY_OBJECT(sizeRecvJs); CREATE_ARRAY_OBJECT(encryptJs); mozilla::MutexAutoLock lock(mWs.lock); for (uint32_t i = 0; i < mWs.data.Length(); i++) { jsstring = JS_NewStringCopyN(cx, mWs.data[i].mHost.get(), mWs.data[i].mHost.Length()); SET_ELEMENT(hostJs, STRING_TO_JSVAL, jsstring, i); SET_ELEMENT(msgSentJs, INT_TO_JSVAL, mWs.data[i].mMsgSent, i); SET_ELEMENT(msgRecvJs, INT_TO_JSVAL, mWs.data[i].mMsgReceived, i); SET_ELEMENT(sizeSentJs, DOUBLE_TO_JSVAL, (double) mWs.data[i].mSizeSent, i); SET_ELEMENT(sizeRecvJs, DOUBLE_TO_JSVAL, (double) mWs.data[i].mSizeReceived, i); SET_ELEMENT(encryptJs, BOOLEAN_TO_JSVAL, mWs.data[i].mEncrypted, i); } SET_PROPERTY(finalObject, hostJs, hostport); SET_PROPERTY(finalObject, msgSentJs, msgsent); SET_PROPERTY(finalObject, msgRecvJs, msgreceived); SET_PROPERTY(finalObject, sizeSentJs, sentsize); SET_PROPERTY(finalObject, sizeRecvJs, receivedsize); SET_PROPERTY(finalObject, encryptJs, encrypted); val = OBJECT_TO_JSVAL(finalObject); mWs.cb->OnDashboardDataAvailable(val); mWs.cb = nullptr; return NS_OK; }