static void skit_peg_macros_test() { SKIT_USE_FEATURE_EMULATION; skit_peg_parser *parser = skit_peg_parser_mock_new(sSLICE("a")); SKIT_PEG_PARSING_INITIAL_VARS(parser); RULE(success); sASSERT_EQ(match.successful, 1); sASSERT_EQ(match.begin, 0); sASSERT_EQ(match.end, 0); RULE(failure); sASSERT_EQ(match.successful, 0); sASSERT_EQ(match.begin, 0); sASSERT_EQ(cursor, 0); sASSERT_EQ(new_cursor, 0); SEQ( RULE(success), RULE(success) ); sASSERT_EQ(match.successful, 1); SEQ( RULE(success), RULE(failure) ); sASSERT_EQ(match.successful, 0); SEQ( RULE(failure), RULE(success) ); sASSERT_EQ(match.successful, 0); SEQ( RULE(failure), RULE(failure) ); sASSERT_EQ(match.successful, 0); skit_peg_parser_mock_free(parser); printf(" skit_peg_macros_test passed.\n"); }
SEQSEQ(ANY) SAL_CALL CalcAddins_impl::qlRangeAccrualFloatersCouponSetPricer( const ANY &ObjectId, const ANY &RangeAccrualPricer, const ANY &Trigger) throw(RuntimeException) { try { // convert input datatypes to C++ datatypes std::string ObjectIdCpp; calcToScalar(ObjectIdCpp, ObjectId); std::string RangeAccrualPricerCpp; calcToScalar(RangeAccrualPricerCpp, RangeAccrualPricer); // convert object IDs into library objects OH_GET_REFERENCE(ObjectIdLibObjPtr, ObjectIdCpp, QuantLibAddin::RangeAccrualFloatersCoupon, QuantLib::RangeAccrualFloatersCoupon) OH_GET_REFERENCE(RangeAccrualPricerLibObjPtr, RangeAccrualPricerCpp, QuantLibAddin::RangeAccrualPricer, QuantLib::RangeAccrualPricer) // invoke the member function static bool returnValue = true; ObjectIdLibObjPtr->setPricer( RangeAccrualPricerLibObjPtr); // convert and return the return value SEQSEQ(ANY) retAnyArray; retAnyArray.realloc(1); SEQ(ANY) retAnyVector(1); STRING s = STRFROMASCII( std::string("VOID").c_str() ); retAnyVector[0] = CSS::uno::makeAny( s ); retAnyArray[0] = retAnyVector; return retAnyArray; } catch (const std::exception &e) { do { std::ostringstream errorMsg; errorMsg << "ERROR: qlRangeAccrualFloatersCouponSetPricer: " << e.what(); OH_LOG_MESSAGE(errorMsg.str()); SEQSEQ(ANY) retAnyArray; retAnyArray.realloc(1); SEQ(ANY) retAnyVector(1); STRING s = STRFROMASCII( errorMsg.str().c_str() ); retAnyVector[0] = CSS::uno::makeAny( s ); retAnyArray[0] = retAnyVector; return retAnyArray; } while (false); } }
SEQSEQ(ANY) SAL_CALL CalcAddins_impl::qlSwapLegNPV( const ANY &ObjectId, const ANY &LegNumber, const ANY &Trigger) throw(RuntimeException) { try { // convert input datatypes to C++ datatypes std::string ObjectIdCpp; calcToScalar(ObjectIdCpp, ObjectId); long LegNumberCpp; calcToScalar(LegNumberCpp, LegNumber); // convert object IDs into library objects OH_GET_REFERENCE(ObjectIdLibObjPtr, ObjectIdCpp, QuantLibAddin::Swap, QuantLib::Swap) // invoke the member function static double returnValue; returnValue = ObjectIdLibObjPtr->legNPV( LegNumberCpp); // convert and return the return value ANY returnValueCalc; scalarToCalc(returnValueCalc, returnValue); SEQSEQ(ANY) retAnyArray; retAnyArray.realloc(1); SEQ(ANY) retAnyVector(1); retAnyVector[0] = returnValueCalc; retAnyArray[0] = retAnyVector; return retAnyArray; } catch (const std::exception &e) { do { std::ostringstream errorMsg; errorMsg << "ERROR: qlSwapLegNPV: " << e.what(); OH_LOG_MESSAGE(errorMsg.str()); SEQSEQ(ANY) retAnyArray; retAnyArray.realloc(1); SEQ(ANY) retAnyVector(1); STRING s = STRFROMASCII( errorMsg.str().c_str() ); retAnyVector[0] = CSS::uno::makeAny( s ); retAnyArray[0] = retAnyVector; return retAnyArray; } while (false); } }
int seq_cmp2(seq_t *seq1, seq_t *seq2, unsigned int offset1, unsigned int offset2, unsigned int len) { int i; for ( i = 0; i < len; i++ ) { if ( SEQ(seq1, offset1 + i) != SEQ(seq2, offset2 + i) ) return -1; } return 0; }
SEQSEQ(ANY) SAL_CALL CalcAddins_impl::qlInstrumentSetPricingEngine( const ANY &ObjectId, const ANY &PricingEngine, const ANY &Trigger) throw(RuntimeException) { try { // convert input datatypes to C++ datatypes std::string ObjectIdCpp; calcToScalar(ObjectIdCpp, ObjectId); std::string PricingEngineCpp; calcToScalar(PricingEngineCpp, PricingEngine); // convert object IDs into library objects OH_GET_OBJECT(ObjectIdObjPtr, ObjectIdCpp, QuantLibAddin::Instrument) OH_GET_OBJECT(PricingEngineObjPtr, PricingEngineCpp, QuantLibAddin::PricingEngine) // invoke the member function static bool returnValue = true; ObjectIdObjPtr->setPricingEngine( PricingEngineObjPtr); // convert and return the return value SEQSEQ(ANY) retAnyArray; retAnyArray.realloc(1); SEQ(ANY) retAnyVector(1); STRING s = STRFROMASCII( std::string("VOID").c_str() ); retAnyVector[0] = CSS::uno::makeAny( s ); retAnyArray[0] = retAnyVector; return retAnyArray; } catch (const std::exception &e) { do { std::ostringstream errorMsg; errorMsg << "ERROR: qlInstrumentSetPricingEngine: " << e.what(); OH_LOG_MESSAGE(errorMsg.str()); SEQSEQ(ANY) retAnyArray; retAnyArray.realloc(1); SEQ(ANY) retAnyVector(1); STRING s = STRFROMASCII( errorMsg.str().c_str() ); retAnyVector[0] = CSS::uno::makeAny( s ); retAnyArray[0] = retAnyVector; return retAnyArray; } while (false); } }
SEQSEQ(ANY) SAL_CALL CalcAddins_impl::qlTermStructureSettlementDays( const ANY &ObjectId, const ANY &Trigger) throw(RuntimeException) { try { // convert input datatypes to C++ datatypes std::string ObjectIdCpp; calcToScalar(ObjectIdCpp, ObjectId); // convert object IDs into library objects OH_GET_OBJECT(ObjectIdTemp, ObjectIdCpp, ObjectHandler::Object) boost::shared_ptr<QuantLib::TermStructure> ObjectIdLibObjPtr = QuantLibAddin::CoerceTermStructure< QuantLibAddin::TermStructure, QuantLib::TermStructure>()( ObjectIdTemp); // invoke the member function QuantLib::Natural returnValue = ObjectIdLibObjPtr->settlementDays(); // convert and return the return value ANY returnValueCalc; scalarToCalc(returnValueCalc, returnValue); SEQSEQ(ANY) retAnyArray; retAnyArray.realloc(1); SEQ(ANY) retAnyVector(1); retAnyVector[0] = returnValueCalc; retAnyArray[0] = retAnyVector; return retAnyArray; } catch (const std::exception &e) { do { std::ostringstream errorMsg; errorMsg << "ERROR: qlTermStructureSettlementDays: " << e.what(); OH_LOG_MESSAGE(errorMsg.str()); SEQSEQ(ANY) retAnyArray; retAnyArray.realloc(1); SEQ(ANY) retAnyVector(1); STRING s = STRFROMASCII( errorMsg.str().c_str() ); retAnyVector[0] = CSS::uno::makeAny( s ); retAnyArray[0] = retAnyVector; return retAnyArray; } while (false); } }
int seq_cmp(seq_t *seq1, seq_t *seq2, unsigned int offset, unsigned int len) { int i; if ( seq1->n != len ) return -1; for ( i = 0; i < len; i++ ) { if ( SEQ(seq1, i) != SEQ(seq2, (offset + i)%seq2->n) ) return -1; } return 0; }
void fn0C00_0100(uint16 bx, uint16 bp, byte ah) { bios_video_set_mode(0x13); int16 ax_23 = DPB(ax, 0x13, 0, 8); do { int16 ax_24 = ax_23 *s 0x0003; if (ax_24 >= 0xC000) { if (ax_24 <= 0x4000) { if (ax_24 <= 0x0000) bx = bx - 0x00C8; bp = bp + 0x0140; } bx = bx + 0x00C8; } bp = bp >>u 0x0001; bx = bx >>u 0x0001; SEQ(0xA000, bp)[bx * 0x0140] = 0x0A; ax_23 = ax_24; } while (DPB(ax_24, __inb(0x60), 0, 8) != 0x0001); bios_video_set_mode(0x03); return; }
static PRInt32 decompose_char(PRUint32 c, const PRUint32 **seqp) { /* Look up decomposition table. */ PRInt32 seqidx = LOOKUPTBL(decompose, DECOMP, c); *seqp = SEQ(decompose) + (seqidx & ~DECOMP_COMPAT); return (seqidx); }
static int compose_sym(decompose_, VERSION) (unsigned long c, const unsigned long **seqp) { /* Look up decomposition table. */ int seqidx = LOOKUPTBL(decompose, DECOMP, c); *seqp = SEQ(decompose) + (seqidx & ~DECOMP_COMPAT); return (seqidx); }
void seq_init_with_seq(seq_t *seq1, seq_t *seq2, unsigned int n, unsigned int offset) { int i; seq1->n = n; for ( i = 0; i < n; i++ ) setSEQ(seq1, i, SEQ(seq2, offset + i)); }
static PRInt32 compose_char(PRUint32 c, const struct composition **compp) { /* Look up composition table. */ PRInt32 seqidx = LOOKUPTBL(compose, CANON_COMPOSE, c); *compp = SEQ(compose) + (seqidx & 0xffff); return (seqidx >> 16); }
static int compose_sym(compose_, VERSION) (unsigned long c, const struct composition **compp) { /* Look up composition table. */ int seqidx = LOOKUPTBL(compose, CANON_COMPOSE, c); *compp = SEQ(compose) + (seqidx & 0xffff); return (seqidx >> 16); }
static unsigned int dec(seq_t *seq, unsigned int offset, unsigned int L) { unsigned int i, ret; for ( i = 0, ret = 0; i < L; i++ ) ret |= SEQ(seq, offset + L - i - 1 ) << i; return ret; }
static int _SnapEwinFindMatchCmd(const void *data, const void *match) { const Snapshot *sn = (Snapshot *) data; const EWin *ewin = (EWin *) match; return sn->used || !(sn->startup_id && SEQ(sn->cmd, ewin->icccm.wm_command) && _SnapEwinMatch(sn, ewin)); }
void *root_thread(void *cookie) { TEST_START(0); TEST_CHECK_SEQUENCE(SEQ("root", 1), END_SEQ); TEST_FINISH(); return NULL; }
static SCM expand_sequence (const SCM forms, const SCM env) { ASSERT_SYNTAX (scm_ilength (forms) >= 1, s_bad_expression, scm_cons (scm_sym_begin, forms)); if (scm_is_null (CDR (forms))) return expand (CAR (forms), env); else return SEQ (scm_source_properties (forms), expand (CAR (forms), env), expand_sequence (CDR (forms), env)); }
/* Функция, возвращающая итератор, ссылающийся на элемент с указанным индексом */ LSQ_IteratorT LSQ_GetElementByIndex(LSQ_HandleT handle, LSQ_IntegerIndexT index){ TypeIterator *iterator = NULL; if(handle == NULL) return(LSQ_HandleInvalid); iterator = (TypeIterator*)malloc(sizeof(TypeIterator)); iterator->list = SEQ(handle); LSQ_SetPosition(iterator, index); return(iterator); }
int ranex_test(seq_t *seq, double *pvalue, void *param) { unsigned int i, J; unsigned int V[6] = { 0, 0, 0, 0, 0, 0 }; int S, N, etat = 4; double pi[6] = {.8750000000,.01562500000,.01367187500,.01196289063,.01046752930,.0732727051}; double X; if ( seq->n < RANEX_TEST_LENGTH ) { fprintf(stderr, "Error[RanEx Test]: Sequence length too short\n"); *pvalue = 0.0; return -1; } for ( i = 0, J = 0, S = 0, N = 0; i < seq->n; i++ ) { S += 2*SEQ(seq, i) - 1; if ( S == 0 ) { if ( N >= 5 ) V[5]++; else V[N]++; N = 0; J++; } else if ( S == etat ) N++; } if ( S != 0 ) { J++; if ( N >= 5 ) V[5]++; else V[N]++; } if ( J < 500 ) { fprintf(stderr, "Error[RanEx Test]: J=%d<500 Not enough excursions to compute test statistic\n", J); return -3; } for ( i = 0, X = 0.0; i < 6; i++ ) X += pow(((double)V[i]) - ((double)J)*pi[i], 2.0)/(((double)J)*pi[i]); *pvalue = gsl_cdf_chisq_Q(X, 5); return 0; }
/* Функция, уничтожающая контейнер с заданным дескриптором. Освобождает принадлежащую ему память */ void LSQ_DestroySequence(LSQ_HandleT handle){ TypeListNode *node = NULL; if(handle == NULL) return; node = SEQ(handle)->BeforFirst; while(node->next != NULL){ node = node->next; free(node->prev); } free(node); free(handle); }
static int _SnapEwinMatch(const Snapshot * sn, const EWin * ewin) { char buf[256], *s; /* Don't allow matching anything */ if (!sn->match_flags) return 0; if (ewin->state.identified) return sn->win == EwinGetClientXwin(ewin); if (sn->startup_id && !sn->cmd) return 0; if (sn->match_flags & SNAP_MATCH_TITLE && !SEQ(sn->win_title, EwinGetIcccmName(ewin))) return 0; if (sn->match_flags & SNAP_MATCH_NAME && !SEQ(sn->win_name, EwinGetIcccmCName(ewin))) return 0; if (sn->match_flags & SNAP_MATCH_CLASS && !SEQ(sn->win_class, EwinGetIcccmClass(ewin))) return 0; if (sn->match_flags & SNAP_MATCH_ROLE) { s = _ParseRole(ewin->icccm.wm_role, buf, sizeof(buf)); if (!SEQ(sn->win_role, s)) return 0; } /* Match! */ return 1; }
template<class TYPE> typename TAO_Notify_Seq_Worker_T<TYPE>::SEQ* TAO_Notify_Seq_Worker_T<TYPE>::create (CONTAINER &container) { SEQ* tmp; ACE_NEW_THROW_EX (tmp, //this->seq_, SEQ (), CORBA::INTERNAL ()); this->seq_ = tmp; container.collection ()->for_each (this); return this->seq_._retn (); }
void * rwOp(void* arg) { struct data_t *data; data = (struct data_t *) arg; char* b1 = initializeBlock(true,data -> blockSize); char* b2 = initializeBlock(true, data -> blockSize); char* tm = initializeBlock(false, data -> blockSize); char* b1_2 = b1; char* b2_2 = b2; char* tm2 = tm; SEQ(b1, b1_2, b2, b2_2, tm, tm2, data); RAND(b1, b1_2, b2, b2_2, tm, tm2, data); pthread_exit(NULL); }
void seq_add_iter(seq_t *seq, unsigned int niter, double iter, int k, int l) { unsigned int i, j, offset_seq, offset_tmp; seq_t tmp = { (unsigned char *)&iter, 64, 8}; offset_seq = niter*l; offset_tmp = (int)(k/8); for ( i = 0, j = 7 - (k%8); i < l; i++, j-- ) { setSEQ(seq, offset_seq + i, SEQ(&tmp, (offset_tmp*8 + j))); if ( j == 0 ) { j = 8; offset_tmp++; } } }
void seq_print(seq_t *seq, unsigned int npl) { int i, j; for ( i = 0, j = 0; i < seq->n; i++) { fprintf(stdout, "%d ", SEQ(seq, i)); j++; if ( npl != 0 && j == npl ) { fprintf(stdout, "\n"); j = 0; } } if ( j > 0 ) fprintf(stdout, "\n"); }
int main(void) { volatile int x, y, z; const int n = 20; List * pTriples = SEQ( T(x, y, z), ( (x, R(1, n)), (y, R(x, n)), (z, R(y, n)) ), (x*x + y*y == z*z) ); volatile Triple t; FOR_EACH(t, Triple, pTriples, printf("%d, %d, %d\n", t._1, t._2, t._3) ); return 0; }
word32 fn1310E000(Eq_89 * dwArg04, word32 dwArg08, word32 dwArg0C, word32 dwArg10, word32 dwArg14, word32 dwArg18) { *dwArg10 = dwArg0C; word16 wLoc10_104 = (word16) (SEQ(0x00000000, dwArg14) % 0x00000005); Eq_15 * dwArg08_28 = dwArg08 + dwArg14; dwArg0C = dwArg0C - 0x00000001; while (dwArg0C != 0x00000000) { dwArg04->b0000 = (byte) ((int32) dwArg08_28->b0000 ^ (word32) ((int32) wLoc10_104)[dwArg18]); word16 cx_83 = wLoc10_104 + 0x0001; wLoc10_104 = cx_83; if ((int32) cx_83 == 0x00000005) wLoc10_104 = 0x0000; dwArg04 = dwArg04 + 1; dwArg08_28 = dwArg08_28 + 1; dwArg0C = dwArg0C - 0x00000001; } return dwArg0C; }
void fn0C00_0100(byte ch, byte bh) { bios_video_set_mode(0x13); byte bl_118 = 0x03; word16 bx_119 = DPB(bx, 0x03, 0, 8); do { cx = DPB(cx, 0xC8, 0, 8); byte Eq_25::*di_35 = &Eq_25::b0000; do { uint32 dx_ax_47 = cx *u cx; uint16 ax_110 = (word16) dx_ax_47; uint16 dx_112 = SLICE(dx_ax_47, word16, 16); word16 si_53 = 0x0280; do { uint16 dx_61 = SEQ(dx_112, ax_110 + 0x0281 - si_53) % bx_119; 0xA000->*di_35 = (byte) dx_61 & 0x0F; word16 si_77 = si_53 - 0x0001; di_35 = di_35 + 1; ax_110 = dx_61; dx_112 = 0x0000; si_53 = si_77 - 0x0001; } while (si_77 != 0x0001); cx = cx - 0x0001; } while (cx != 0x0000); do { word16 ax_90 = DPB(ax_110, __inb(0x60), 0, 8); if (ax_90 == 0x0001) goto l0C00_013F; uint16 ax_108 = DPB(ax_90 - 0x0001, 0x0000->b046C & 0x0F, 0, 8); ax_110 = dx_122; dx_112 = ax_108; uint16 dx_122 = dx_112; } while ((byte) dx_122 - (byte) ax_108 <=u 0x00); bl_118 = bl_118 + 0x01; bx_119 = DPB(bx_119, bl_118, 0, 8); } while (bl_118 != 0x00); return; }
int Species2int(char Species[YOUSO10]) { static int i,po; i = 0; po = 0; while (i<SpeciesNum && po==0){ if (SEQ(Species,SpeName[i])==1){ po = 1; } if (po==0) i++; }; if (po==1) return i; else { printf("%s is an invalid species name in Atoms.SpeciesAndCoordinates\n", Species); printf("Please check your input file\n"); MPI_Finalize(); exit(1); } }
/* Функция, возвращающая текущее количество элементов в контейнере */ LSQ_IntegerIndexT LSQ_GetSize(LSQ_HandleT handle){ if(handle == NULL) return(0); return(SEQ(handle)->size); }