int RuntimeEnvironment::AddAnonymousSub() { rstring name; name.Format("__anon_sub_%d", _subs.size()); return AddSub(name); }
Sink& BufferSink::Start(Term& term) { AddSub(term); terms.push_back(&term); subIndex.push_back(0); binderIndex.push_back(0); return *this; }
arithmtype And(void) { arithmtype Res = AddSub(); while(1) { if ( ErrorDesc ) break; if (*Expr=='&') { Expr++; Res = Res & AddSub(); } else { break; } } return Res; }
void RuntimeEnvironment::RegisterNativeFunction(const rstring &name, int argumentCount, NativeFunction nf) { if (FindSub(name) != -1) return; int idx = AddSub(name); Sub *sub = GetSub(idx); sub->SetArgumentsCount(argumentCount); sub->SetNativeFunction(nf); }
Sink& BufferSink::Double(double literal) { AddSub(newDoubleTerm(GetContext(), literal)); return *this; }
Sink& BufferSink::Literal(const std::string& literal) { AddSub(newStringTerm(GetContext(), literal)); return *this; }
Sink& BufferSink::Use(Variable& variable) { Term& use = variable.GUse(GetContext()); AddSub(use); return *this; }
Sink& BufferSink::Copy(Term& term) { AddSub(term); return *this; }
void CBasicMathsFB::PerformAction(TRequestStatus& aStatus) { __UHEAP_MARK; TRequestStatus* status = &aStatus; iResult = ETrue; //min max values for NewRandomLC call RInteger min = RInteger::NewL(10); CleanupStack::PushL(min); RInteger max = RInteger::NewL(100); CleanupStack::PushL(max); //Generate iIterations*7 byte random sequences we are using 7 as it's a generator //mod 8. Thus we'll cycle through every value (0-7) every 8 iterations. //This gives us a better feeling that certain byte lengths (and thus bit //lengths as the byte is chosen randomly) don't have errors. for(TUint i=1; i<iIterations; i++) { HBufC8* buf = HBufC8::NewMaxLC(i*7); TPtr8 ptr = buf->Des(); TRandom::RandomL(ptr); //This is this iteration's random number RInteger initial = RInteger::NewL(ptr); CleanupStack::PushL(initial); //get a number x | 10 < x < 100 RInteger crange = RInteger::NewRandomL(min, max); CleanupStack::PushL(crange); TUint range = crange.ConvertToLongL(); CleanupStack::PopAndDestroy(); //crange AddSub(initial, range); MulDiv(initial, range); //GCD CleanupStack::PopAndDestroy(); //initial CleanupStack::PopAndDestroy();//buf iConsole.Printf(_L(".")); } //Test a single iteration where the initial random number is less than a //word so the division and modulo routines that take words rather than //TIntegers can run. //do { //This is this iteration's random number RInteger initial = RInteger::NewRandomL(31); CleanupStack::PushL(initial); //get a number x | 10 < x < 100 RInteger crange = RInteger::NewRandomL(min, max); CleanupStack::PushL(crange); TUint range = crange.ConvertToLongL(); CleanupStack::PopAndDestroy(&crange); //crange AddSub(initial, range); MulDiv(initial, range); CleanupStack::PopAndDestroy(&initial); //initial iConsole.Printf(_L(".")); } //while (0); CleanupStack::PopAndDestroy();//max CleanupStack::PopAndDestroy(); //min MiscDivL(); User::RequestComplete(status, KErrNone); iActionState = CTestAction::EPostrequisite; __UHEAP_MARK; }