Пример #1
0
 virtual void start()
 {
     input.set(inputs.item(0));
     startInput(input);
     eos = false;
     dataLinkStart();
 }
    void process()
    {
        helper->clearAggregate(aggy);
        input = inputs.item(0);
        startInput(input);
        processed = THORDATALINK_STARTED;

        try
        {
            while (!abortSoon)
            {
                OwnedConstThorRow row(input->ungroupedNextRow());
                if (!row)
                    break;
                helper->process(aggy, row);     
                processed++;
            }
            ActPrintLog("DISTRIBUTION: processed %"RCPF"d records", processed & THORDATALINK_COUNT_MASK);
        }
        catch(CATCHALL)
        {
            ActPrintLog("DISTRIBUTION: exception");
            throw;
        }
        CMessageBuffer msg;
        helper->serialize(aggy, msg);
        container.queryJob().queryJobComm().send(msg, 0, mpTag);
    }
Пример #3
0
 virtual void start()
 {
     input.set(inputs.item(0));
     startInput(input);
     eos = false;
     dataLinkStart(kindStr.str(), container.queryId());
 }
Пример #4
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities, NULL);
     input = inputs.item(0);
     startInput(input);
     dataLinkStart("ParseSlaveActivity", container.queryId());
 }
Пример #5
0
 void start(const char *act)
 {   
     input = inputs.item(0);
     anyThisGroup = false;
     startInput(input);
     dataLinkStart(act, container.queryId());
 }
Пример #6
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities, NULL);
     input = inputs.item(0);
     startInput(input);
     dataLinkStart();
 }
// IThorDataLink methods
    virtual void start()
    {
        ActivityTimer s(totalCycles, timeActivities);
        input.setown(createDataLinkSmartBuffer(this,inputs.item(0),PULL_SMART_BUFFER_SIZE,true,false,RCUNBOUND,NULL,false,&container.queryJob().queryIDiskUsage()));
        startInput(input);
        dataLinkStart();
    }
int SC_TerminalClient::run(int argc, char** argv)
{
	Options& opt = mOptions;

	if (!parseOptions(argc, argv, opt)) {
		return mReturnCode;
	}

	// finish argv processing
	const char* codeFile = 0;

	if (argc > 0) {
		codeFile = argv[0];
		opt.mDaemon = true;
		argv++; argc--;
	}

	opt.mArgc = argc;
	opt.mArgv = argv;

	// read library configuration file
	if (opt.mLibraryConfigFile) {
		int argLength = strlen(opt.mLibraryConfigFile);
		SC_LanguageConfig::readLibraryConfigYAML(opt.mLibraryConfigFile);
	} else
		SC_LanguageConfig::readDefaultLibraryConfig();

	// initialize runtime
	initRuntime(opt);

	// startup library
	mShouldBeRunning = true;
	compileLibrary();

	// enter main loop
	if (codeFile) executeFile(codeFile);
	if (opt.mCallRun) runMain();

	if (opt.mDaemon) {
		daemonLoop();
	}
	else {
		initInput();
		if( shouldBeRunning() ) startInput();
		if( shouldBeRunning() ) commandLoop();
		endInput();
		cleanupInput();
	}

	if (opt.mCallStop) stopMain();

	// shutdown library
	shutdownLibrary();
	flush();

	shutdownRuntime();

	return mReturnCode;
}
Пример #9
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities);
     input.set(inputs.item(0));
     startInput(input);
     stopped = false;
     dataLinkStart();
 }
Пример #10
0
// IThorDataLink methods
    virtual void start()
    {
        ActivityTimer s(totalCycles, timeActivities, NULL);
        anyThisGroup = false;
        eogNext = false;
        input = inputs.item(0);
        startInput(input);
        dataLinkStart();
    }
 void doStart()
 {
     hadElement = false;
     inputStopped = false;
     input = inputs.item(0);
     startInput(input);
     if (input->isGrouped())
         ActPrintLog("Grouped mismatch");
 }
 virtual void start()
 {
     ActivityTimer s(totalCycles, timeActivities);
     BaseChooseSetsActivity::start();
     ActPrintLog("CHOOSESETS: Is Local");
     input.set(inputs.item(0));
     startInput(input);
     dataLinkStart();
 }
Пример #13
0
    void start()
    {
        ActivityTimer s(totalCycles, timeActivities, NULL);
        input = inputs.item(0);

        startInput(input);
        if(!input->isGrouped()) ActPrintLog("DEGROUP: Degrouping non-grouped input!");
        dataLinkStart("DEGROUP", container.queryId());
    }
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities);
     eof = false;
     input=inputs.item(0);
     startInput(input);
     ungroupedExistsAggregate = (container.getKind() == TAKexistsaggregate) && !input->isGrouped();
     dataLinkStart();
 }
Пример #15
0
 void start()
 { 
     ActivityTimer s(totalCycles, timeActivities, NULL);
     numThisRow = 0;
     curRow = 0;
     anyThisGroup = false;
     input = inputs.item(0);
     startInput(input);
     dataLinkStart("NORMALIZE", container.queryId()); 
 }
Пример #16
0
 void start()
 { 
     ActivityTimer s(totalCycles, timeActivities, NULL);
     numThisRow = 0;
     curRow = 0;
     anyThisGroup = false;
     input = inputs.item(0);
     startInput(input);
     dataLinkStart();
 }
Пример #17
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities, NULL);
     eof = false;
     inputStopped = false;
     dataLinkStart("AGGREGATE", container.queryId());
     input = inputs.item(0);
     startInput(input);
     if (input->isGrouped()) ActPrintLog("AGGREGATE: Grouped mismatch");
 }
Пример #18
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities, NULL);
     dataLinkStart();
     input = inputs.item(0);
     startInput(input);
     IInputSteppingMeta *stepMeta = input->querySteppingMeta();
     if (stepMeta)
         stepCompare = stepMeta->queryCompare();
 }
Пример #19
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities);
     resultSent = container.queryLocal(); // i.e. local, so don't send result to master
     eos = stopped = anyThisGroup = eogNext = false;
     input = inputs.item(0);
     startInput(input);
     rowLimit = (rowcount_t)helper->getRowLimit();
     dataLinkStart();
 }
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities);
     input = inputs.item(0);
     startInput(input);
     eogNext = false;
     anyThisGroup = false;
     numSamples = helper->getProportion();
     whichSample = helper->getSampleNumber();
     numToSkip = whichSample ? whichSample - 1 : 0;
     dataLinkStart();
 }
Пример #21
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities, NULL);
     eogNext = false;
     refill = true;
     input = inputs.item(0);
     startInput(input);
     dataLinkStart();
     icompare = helper->queryCompare();
     index = 0;
     eof = false;
     group.setSizing(true,false);
 }
Пример #22
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities);
     anyThisGroup = false;
     eogNext = false;    
     count = 0;
     input = inputs.item(0);
     startInput(input);
     dataLinkStart();
     RtlDynamicRowBuilder r(queryRowAllocator());
     size32_t sz = helper->createDefault(r);
     defaultLeft.setown(r.finalizeRowClear(sz));
 }
Пример #23
0
static void parseInput(
    const Block   *block,
    const uint8_t *&p,
    const uint8_t *txHash,
    uint64_t      inputIndex
) {
    if(!skip) {
        startInput(p);
    }

        auto upTXHash = p;
        const Chunk *upTX = 0;
        if(gNeedTXHash && !skip) {
            auto isGenTX = (0==memcmp(gNullHash.v, upTXHash, sizeof(gNullHash)));
            if(likely(false==isGenTX)) {
                auto i = gTXOMap.find(upTXHash);
                if(unlikely(gTXOMap.end()==i)) {
                    errFatal("failed to locate upstream transaction");
                }
                upTX = i->second;
            }
        }

        SKIP(uint256_t, dummyUpTXhash, p);
        LOAD(uint32_t, upOutputIndex, p);
        LOAD_VARINT(inputScriptSize, p);

        if(!skip && 0!=upTX) {
            auto inputScript = p;
            auto upTXOutputs = upTX->getData();
                parseOutputs<false, true>(
                    upTXOutputs,
                    upTXHash,
                    upOutputIndex,
                    txHash,
                    inputIndex,
                    inputScript,
                    inputScriptSize
                );
            upTX->releaseData();
        }

        p += inputScriptSize;
        SKIP(uint32_t, sequence, p);

    if(!skip) {
        endInput(p);
    }
}
Пример #24
0
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities, NULL);
     dataLinkStart();
     input = inputs.item(0);
     unsigned spillPriority = container.queryGrouped() ? SPILL_PRIORITY_GROUPSORT : SPILL_PRIORITY_LARGESORT;
     iLoader.setown(createThorRowLoader(*this, queryRowInterfaces(input), iCompare, unstable ? stableSort_none : stableSort_earlyAlloc, rc_mixed, spillPriority));
     startInput(input);
     eoi = false;
     if (container.queryGrouped())
         out.setown(iLoader->loadGroup(input, abortSoon));
     else
         out.setown(iLoader->load(input, abortSoon));
     if (0 == iLoader->numRows())
         eoi = true;
 }
Пример #25
0
static void parseInput(
    const uint8_t *&p,
    const uint8_t *txHash,
    uint64_t      inputIndex
)
{
    if(!skip) startInput(p);

        const uint8_t *upTXHash = p;
        const uint8_t *upTXOutputs = 0;

        if(gNeedTXHash && !skip) {
            bool isGenTX = (0==memcmp(gNullHash.v, upTXHash, sizeof(gNullHash)));
            if(likely(false==isGenTX)) {
                auto i = gTXMap.find(upTXHash);
                if(unlikely(gTXMap.end()==i))
                    errFatal("failed to locate upstream TX");
                upTXOutputs = i->second;
            }
        }

        SKIP(uint256_t, dummyUpTXhash, p);
        LOAD(uint32_t, upOutputIndex, p);
        LOAD_VARINT(inputScriptSize, p);

        if(!skip && 0!=upTXOutputs) {
            const uint8_t *inputScript = p;
            parseOutputs<false, true>(
                upTXOutputs,
                upTXHash,
                upOutputIndex,
                txHash,
                inputIndex,
                inputScript,
                inputScriptSize
            );
        }

        p += inputScriptSize;
        SKIP(uint32_t, sequence, p);

    if(!skip) endInput(p);
}
Пример #26
0
    void process()
    {
        processed = 0;

        input = inputs.item(0);
        startInput(input);

        processed = THORDATALINK_STARTED;

        OwnedConstThorRow row = input->ungroupedNextRow();
        CMessageBuffer mb;
        size32_t lenpos = mb.length(); // its 0 really
        mb.append((size32_t)0);
        if (row) {
            CMemoryRowSerializer msz(mb);
            ::queryRowSerializer(input)->serialize(msz,(const byte *)row.get());
            size32_t sz = mb.length()-lenpos-sizeof(size32_t);
            mb.writeDirect(lenpos,sizeof(size32_t),&sz);
            processed++;
        }
        container.queryJob().queryJobComm().send(mb, 0, masterMpTag);
    }
Пример #27
0
    void start()
    {
        ActivityTimer s(totalCycles, timeActivities, NULL);
        count = 0;
        eof = nextPut = false;
        inrowif.set(::queryRowInterfaces(inputs.item(0)));
        if (global) // only want lookahead if global (hence serial)
            input.setown(createDataLinkSmartBuffer(this, inputs.item(0),ITERATE_SMART_BUFFER_SIZE,isSmartBufferSpillNeeded(this),false,RCUNBOUND,NULL,false,&container.queryJob().queryIDiskUsage())); // only allow spill if input can stall
        else
            input.set(inputs.item(0));
        try
        { 
            startInput(input); 
        }
        catch (IException *e)
        {
            ActPrintLog(e,"ITERATE");
            throw;
        }
        dataLinkStart("ITERATOR", container.queryId());

    }
Пример #28
0
// IThorDataLink
    virtual void start()
    {
        ActivityTimer s(totalCycles, timeActivities, NULL);
        input = inputs.item(0);
        startInput(input);
        dataLinkStart("SELFJOIN", container.queryId());
        bool hintparallelmatch = container.queryXGMML().getPropInt("hint[@name=\"parallel_match\"]")!=0;
        bool hintunsortedoutput = container.queryXGMML().getPropInt("hint[@name=\"unsorted_output\"]")!=0;

        if (helper->getJoinFlags()&JFlimitedprefixjoin) {
            CriticalBlock b(joinHelperCrit);
            // use std join helper (less efficient but implements limited prefix)
            joinhelper.setown(createJoinHelper(helper,"SELFJOIN", container.queryId(), queryRowAllocator(),hintparallelmatch,hintunsortedoutput));
        }
        else {
            CriticalBlock b(joinHelperCrit);
            joinhelper.setown(createSelfJoinHelper(helper,"SELFJOIN", container.queryId(), queryRowAllocator(),hintparallelmatch,hintunsortedoutput));
        }
        strm.setown(isLightweight? doLightweightSelfJoin() : (isLocal ? doLocalSelfJoin() : doGlobalSelfJoin()));
        assertex(strm);

        joinhelper->init(strm, NULL, ::queryRowAllocator(inputs.item(0)), ::queryRowAllocator(inputs.item(0)), ::queryRowMetaData(inputs.item(0)), &abortSoon, this);
    }
Пример #29
0
// IThorDataLink
    virtual void start()
    {
        ActivityTimer s(totalCycles, timeActivities, NULL);
        input = inputs.item(0);
        startInput(input);
        dataLinkStart();
        bool hintunsortedoutput = getOptBool(THOROPT_UNSORTED_OUTPUT, JFreorderable & helper->getJoinFlags());
        bool hintparallelmatch = getOptBool(THOROPT_PARALLEL_MATCH, hintunsortedoutput); // i.e. unsorted, implies use parallel by default, otherwise no point

        if (helper->getJoinFlags()&JFlimitedprefixjoin) {
            CriticalBlock b(joinHelperCrit);
            // use std join helper (less efficient but implements limited prefix)
            joinhelper.setown(createJoinHelper(*this, helper, this, hintparallelmatch, hintunsortedoutput));
        }
        else
        {
            CriticalBlock b(joinHelperCrit);
            joinhelper.setown(createSelfJoinHelper(*this, helper, this, hintparallelmatch, hintunsortedoutput));
        }
        strm.setown(isLightweight? doLightweightSelfJoin() : (isLocal ? doLocalSelfJoin() : doGlobalSelfJoin()));
        assertex(strm);

        joinhelper->init(strm, NULL, ::queryRowAllocator(inputs.item(0)), ::queryRowAllocator(inputs.item(0)), ::queryRowMetaData(inputs.item(0)), &abortSoon);
    }
Пример #30
0
bool zerokernel::TextInput::handleSdlEvent(SDL_Event *event)
{
    switch (event->type)
    {
    case SDL_MOUSEBUTTONDOWN:
    {
        if (isHovered())
        {
            if (is_input_active)
                finishInput(event->button.button == SDL_BUTTON_LEFT);
            else
                startInput();
            return true;
        }
        else
        {
            if (is_input_active)
            {
                finishInput(false);
                return true;
            }
        }
    }
    case SDL_TEXTINPUT:
        if (is_input_active)
        {
            for (auto c : event->text.text)
            {
                if (!c)
                    break;
                if (current_text.length() == max_length)
                    break;
                current_text.push_back(c);
            }
            return true;
        }
    case SDL_KEYDOWN:
        if (is_input_active)
        {
            switch (event->key.keysym.sym)
            {
            case SDLK_BACKSPACE:
                if (!current_text.empty())
                    current_text.pop_back();
                return true;
            case SDLK_RETURN:
                finishInput(true);
                return true;
            case SDLK_ESCAPE:
                finishInput(false);
                return true;
            default:
                break;
            }
        }
    default:
        break;
    }

    return BaseMenuObject::handleSdlEvent(event);
}