コード例 #1
0
ファイル: table_man.cpp プロジェクト: llersch/zapps
char const* db_pretty_print(table_desc_t const* ptdesc, int /* i=0 */, char const* /* s=0 */)
{
    static char data[1024];
    std::stringstream inout(data, stringstream::in | stringstream::out);
    //std::strstream inout(data, sizeof(data));
    ((table_desc_t*)ptdesc)->print_desc(inout);
    inout << std::ends;
    return data;
}
コード例 #2
0
ファイル: mbx_send_if.c プロジェクト: ArcEye/RTAI
void rtai_mbx_send_if(scicos_block *block,int flag)
{
  if (flag==1){          /* get input */
    inout(block);
  }
  else if (flag==5){     /* termination */ 
    end(block);
  }
  else if (flag ==4){    /* initialisation */
    init(block);
  }
}
コード例 #3
0
ファイル: rtai_led.c プロジェクト: ArcEye/3.4.55-rtai
void rtled(scicos_block *block,int flag)
{
  if (flag==1){          /* set output */
    inout(block);
  }
  else if (flag==5){     /* termination */
    end(block);
  }
  else if (flag ==4){    /* initialisation */
    init(block);
  }
}
コード例 #4
0
ファイル: Test_all.cpp プロジェクト: eriser/CSL
//Take stereo input from soundcard and send it to the output (only send left channel to both channel outs)
//Note: will need to modify PAIO setting to take input
void test_InOut() {
	logMsg("playing InOut...");
	InOutFlags f = kLtoM;
	InOut inout(f);
	gIO->set_root(inout);
	gIO->open();
	gIO->start();
	csl::sleep_usec(10000000);	//sleep_usec 10 secs
	gIO->stop();
	gIO->close();
	logMsg("InOut done.");
}
コード例 #5
0
ファイル: cmd.c プロジェクト: 8l/FUZIX
static IOPTR inout(IOPTR lastio)
{
	register int iof;
	register IOPTR iop;
	register CHAR c;

	iof = wdnum;

	switch (wdval) {

	case DOCSYM:
		iof |= IODOC;
		break;

	case APPSYM:
	case '>':
		if (wdnum == 0)
			iof |= 1;
		iof |= IOPUT;
		if (wdval == APPSYM) {
			iof |= IOAPP;
			break;
		}

	case '<':
		if ((c = nextc(0)) == '&')
			iof |= IOMOV;
		else if (c == '>')
			iof |= IORDW;
		else
			peekc = c | MARK;
		break;

	default:
		return (lastio);
	}

	chkword();
	iop = (IOPTR) getstak(IOTYPE);
	iop->ioname = wdarg->argval;
	iop->iofile = iof;
	if (iof & IODOC) {
		iop->iolst = iopend;
		iopend = iop;
	}
	word();
	iop->ionxt = inout(lastio);
	return (iop);
}
コード例 #6
0
ファイル: test_sq_inout.c プロジェクト: thinker8581/PCM
   int
main (void)
{
   int i = 0;
   int error = 0;

   error = inout();

   if ( error )  goto TERMINATE;

TERMINATE:

   PCMcheckerror (error);
   return 0;
}
コード例 #7
0
ファイル: layout.cpp プロジェクト: zyzzyva8421/monitor
CLayoutModule::CLayoutModule(QWidget *parent)
{
    pMainForm = parent;
    m_layout_cfg = new CLayoutCfg;
    f_layout_set_def_config();

    QFile file((LAYOUT_CFG_DOC));
    if(file.open(QIODevice::ReadOnly))
    {
        CLayoutCfg tempCfg;
        QDataStream inout(&file);
        int magic;
        inout >> magic;
        if(magic == 0x12345678)
        {
            inout.readRawData((char *)&tempCfg,sizeof(CLayoutCfg));
        }
        memcpy(m_layout_cfg,&tempCfg,sizeof(CLayoutCfg));
        file.close();
    }
コード例 #8
0
/* This is the (sci|x)cos computational function being called */
void rt_tempfunc(scicos_block *block,int flag)
{
  if (flag==0){    
    state(block);     /* update stats */
  }
  else if (flag==1){    
    inout(block);     /* update output */
  }
  else if (flag==2){    
    in(block);     /* ??? */
  }
  else if (flag==3){    
    eventout(block);     /* update event output */
  }
  else if (flag==5){     /* termination */ 
    end(block);
  }
  else if (flag==4){     /* initialisation */
    init(block);
  }
}
コード例 #9
0
ファイル: target_syntax.cpp プロジェクト: DropD/FooCL
int main (int argc, char const* argv[])
{
    fcl::Environment env;

    fcl::KernelFunc kernel(env);

    kernel
        << "__kernel void("                           << std::endl 
        << "    __global float4* in,"                 << std::endl 
        << "    __global float4* out,"                << std::endl 
        << "    __global float inout,"                << std::endl 
        << "    __const float param)"                 << std::endl 
        << "{"                                        << std::endl 
        << "    int tid = get_global_id(0);"          << std::endl
        << "    out[tid].x = inout[tid] * in[tid].x;" << std::endl
        << "    out[tid].y = inout[tid] * in[tid].y;" << std::endl
        << "    out[tid].z = inout[tid] * in[tid].z;" << std::endl
        << "    out[tid].w = inout[tid] * in[tid].w;" << std::endl
        << ""                                         << std::endl 
        << "    inout[tid] += param;"                 << std::endl 
        << "}"                                        << std::endl; 

    fcl::vector<float> in(1024, 1.0);
    fcl::vector<float> out(1024);
    fcl::vector<float> inout(256);

    for(int i=0; i<100; ++i)
    {
        kernel(in, out, inout, 0.1);
    }

    out.pull(); //oder out.read_back();

    std::cout << out[0] << " == " << 9.9 << " ?" << std::endl;
        
    return 0;
}
コード例 #10
0
ファイル: modu_eeg.cpp プロジェクト: zyzzyva8421/monitor
CEegModule::CEegModule(QWidget *parent)
{
    pMainForm = parent;
    m_eeg_cfg = new CEegModuleCfg;
    m_port = new Posix_QextSerialPort(EEG_MODULE_DATA_PORT_NAME,QextSerialBase::Polling);
    m_port->open(QIODevice::ReadWrite);
    m_port->setBaudRate((BaudRateType)115200);
    m_port->setDataBits(DATA_8);
    m_port->setParity(PAR_NONE);
    m_port->setStopBits(STOP_1);
    m_port->setFlowControl(FLOW_OFF);
    m_port->setTimeout(10);
    m_port->flush();
    m_eeg_wave_cnt = 0;
    iParseState = EEG_PARSE_STATE_IDDLE;
    iEegWavCnt=0;
    uiFrameCnt = 0;
    f_setDefaultCfg();

    //get ecg file config
    {
        QFile file((EEG_MODULE_CFG_DOC));
        if(file.open(QIODevice::ReadOnly))
        {
            CEegModuleCfg tempCfg;
            QDataStream inout(&file);
            int magic;
            inout >> magic;
            if(magic == 0x12345678)
            {
                inout.readRawData((char *)&tempCfg,sizeof(CEegModuleCfg));
            }
            memcpy(m_eeg_cfg,&tempCfg,sizeof(CEegModuleCfg));
            file.close();
        }
        else
        {
コード例 #11
0
ファイル: client.c プロジェクト: harshabandaru/HttpProxy
/* main() - a program is better when it's modular. The main function 
 * here only error checks the input and calls a function to send the
 * request and another other to print out the results
 */
int main(int argc, char **argv){

	int port, sockfd;
	char *host, *ptr;

        if ( argc != 3) {
                fprintf(stderr, "usage: hostname port\n");
                exit(0);
        }

    port = atoi(argv[2]);
	host = argv[1];

	// checks if the 'http://' (or 'https://') protocol is specified
	// if one of them is specified it is ignored them and makes the URL points to 'www.'
	// this was done because getaddrinfo() returns an error when 'http://' is passed to it
	if ( (ptr = strstr(host, "http://")) != NULL || (ptr = strstr(host, "https://")) != NULL ) {
		host = host + 7; //ignoring 'http://'
	}

	// the maximum number of ports should not exceed 655536 
        if ( port > 65536 || port < 0 ){ 
                fprintf(stderr, "Invalid port number\n");
                exit(0);
        }

	// making the socket and sending the GET request
        sockfd = send_request(host, argv[2]);		//argv[2] is port

	// print out the results
        while(inout(sockfd, 1) > 0);

	close(sockfd);

	return 0;
}
コード例 #12
0
static void test_getConstantColorComponents(skiatest::Reporter* reporter, GrContext* grContext) {
    struct GetConstantComponentTestCase {
        // "Shape drawn with"
        uint32_t inputComponents; // "rgb of", "red of", "alpha of", ...
        GrColor inputColor;       // "[color]"

        SkColor filterColor;      // "with filter color [color]"
        SkXfermode::Mode filterMode; // "in mode [mode]"

        // "produces"
        uint32_t outputComponents; // "rgb of", "red of", "alpha of", ...
        GrColor outputColor;       // "[color]"
    };

    // Shorthands.
    enum {
        kR = kR_GrColorComponentFlag,
        kG = kG_GrColorComponentFlag,
        kB = kB_GrColorComponentFlag,
        kA = kA_GrColorComponentFlag,
        kRGB = kRGB_GrColorComponentFlags,
        kRGBA = kRGBA_GrColorComponentFlags
    };

    // Note: below, SkColors are non-premultiplied, where as GrColors are premultiplied.

    const SkColor c1 = SkColorSetARGB(200, 200, 200, 200);
    const SkColor c2 = SkColorSetARGB(60, 60, 60, 60);
    const GrColor gr_c1 = SkColor2GrColor(c1);
    const GrColor gr_c2 = SkColor2GrColor(c2);

    const GrColor gr_black = GrColorPackA4(0);
    const GrColor gr_white = GrColorPackA4(255);
    const GrColor gr_whiteTrans = GrColorPackA4(128);

    GetConstantComponentTestCase filterTests[] = {
        // A color filtered with Clear produces black.
        { kRGBA, gr_white, SK_ColorBLACK, SkXfermode::kClear_Mode, kRGBA, gr_black },
        { kRGBA, gr_c1,    SK_ColorWHITE, SkXfermode::kClear_Mode, kRGBA, gr_black },
        { kR,    gr_white, c1,            SkXfermode::kClear_Mode, kRGBA, gr_black },

        // A color filtered with a color in mode Src, produces the filter color.
        { kRGBA, gr_c2, c1, SkXfermode::kSrc_Mode, kRGBA, gr_c1 },
        { kA,    gr_c1, c1, SkXfermode::kSrc_Mode, kRGBA, gr_c1 },

        // A color filtered with SrcOver produces a color.
        { kRGBA, gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::kSrcOver_Mode, kRGBA, GrColorPackRGBA(164, 164, 164, 192)},
        // An unknown color with known alpha filtered with SrcOver produces an unknown color with known alpha.
        { kA   , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::kSrcOver_Mode, kA   , GrColorPackRGBA(0, 0, 0, 192)},
        // A color with unknown alpha filtered with SrcOver produces a color with unknown alpha.
        { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::kSrcOver_Mode, kRGB, GrColorPackRGBA(164, 164, 164, 0)},

        // A color filtered with DstOver produces a color.
        { kRGBA, gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::kDstOver_Mode, kRGBA, GrColorPackRGBA(178, 178, 178, 192)},
        // An unknown color with known alpha filtered with DstOver produces an unknown color with known alpha.
        { kA   , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::kDstOver_Mode, kA   , GrColorPackRGBA(0, 0, 0, 192)},
        // A color with unknown alpha filtered with DstOver produces an unknown color.
        { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::kDstOver_Mode, 0    , gr_black},

        // An unknown color with known alpha and red component filtered with Multiply produces an unknown color with known red and alpha.
        { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) }
    };

    GrPaint paint;
    for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) {
        const GetConstantComponentTestCase& test = filterTests[i];
        SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(test.filterColor, test.filterMode));
        SkTDArray<const GrFragmentProcessor*> array;
        bool hasFrag = cf->asFragmentProcessors(grContext, paint.getProcessorDataManager(), &array);
        REPORTER_ASSERT(reporter, hasFrag);
        REPORTER_ASSERT(reporter, 1 == array.count());
        GrInvariantOutput inout(test.inputColor,
                                static_cast<GrColorComponentFlags>(test.inputComponents),
                                false);
        array[0]->computeInvariantOutput(&inout);

        REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags()) == test.outputColor);
        REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags());
        array[0]->unref();
    }
}
コード例 #13
0
ファイル: spdrcliparser.cpp プロジェクト: sierdzio/spdr
bool SpdrCliParser::parse()
{
    QCommandLineParser parser;
    parser.setApplicationDescription(tr("Synchronize even the largest directory structures easily"));
    parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsCompactedShortOptions);
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument("input", tr("Input folder, usually containing updated data"));
    parser.addPositionalArgument("output", tr("Output folder, usually containing old data. When Import operation is performed, the path can contain QDateTime-style time and date tags enclosed in < and >, as well as star * wildcard matching. See the documentation for more information"));

    QCommandLineOption importOption(QStringList() << "i" << "import",
                                       tr("Spdr will perform import operation: it will copy all files from input according to formatting tags specified in output directory path. See the documentation for more information"));
    parser.addOption(importOption);

    QCommandLineOption synchronizeOption(QStringList() << "s" << "synchronize",
                                       tr("(default) Spdr will perform file synchronization. See the documentation for more information"));
    parser.addOption(synchronizeOption);

    QCommandLineOption logFileOption(QStringList() << "l" << "log",
                                     tr("Log file location. If empty/ not specified, Spdr will print to stdout"),
                                     tr("path"));
    parser.addOption(logFileOption);

    QCommandLineOption logLevelOption("log-level",
                                      tr("Specifies how many log messages will be shown. Accepted values are 0 (no logging) to 6 (log everything, including debug output). See the documentation for more information."),
                                      tr("number"), "3");
    parser.addOption(logLevelOption);

    QCommandLineOption moveOption(QStringList() << "m" << "move",
                                  tr("Files will be moved from input to output (input will change!). By default, Spdr copies the files (leavign input intact)"));
    parser.addOption(moveOption);

    QCommandLineOption simulateOption("simulate",
                                  tr("Spdr will simulate all the actions, without actually doing any changes to the file system"));
    parser.addOption(simulateOption);

    QCommandLineOption caseSensitiveOption(QStringList() << "c" << "case-insensitive",
                                  tr("make file suffix comparison case insensitive"));
    parser.addOption(caseSensitiveOption);

    parser.process(QCoreApplication::instance()->arguments());

    // Read the results and assign them
    QStringList inout(parser.positionalArguments());

    if (inout.count() < 2) {
        parser.showHelp(1);
        return false;
    }

    options.inputPath = inout.at(0);
    options.outputPath = inout.at(1);

    if (parser.isSet(logLevelOption)) {
        bool isOk = true;
        int result = parser.value(logLevelOption).toInt(&isOk);

        if (!isOk) {
            parser.showHelp(1);
            return false;
        }

        options.logLevel = (Spdr::LogLevel) result;
    }

    if (parser.isSet(logFileOption)) {
        options.logFile = parser.value(logFileOption);
    }

    options.isImport = parser.isSet(importOption);
    options.isSimulation = parser.isSet(simulateOption);
    options.isFileSuffixCaseSensitive = !parser.isSet(caseSensitiveOption);

    if (parser.isSet(moveOption)) {
        options.copyMode = SpdrImport::Move;
    }

    //updateMode;
    //synchronizationOptions;

    return true;
}
コード例 #14
0
ファイル: cmd.c プロジェクト: 8l/FUZIX
static TREPTR item(BOOL flag)
{
	register TREPTR t;
	register IOPTR io;

	if (flag)
		io = inout((IOPTR) 0);
	else
		io = 0;

	switch (wdval) {
	case CASYM:
	{
		t = (TREPTR) getstak(SWTYPE);
		chkword();
		((SWPTR) t)->swarg = wdarg->argval;
		skipnl();
		chksym(INSYM | BRSYM);
		((SWPTR) t)->swlst = syncase(wdval == INSYM ? ESSYM : KTSYM);
		((SWPTR) t)->swtyp = TSW;
		break;
	}
	case IFSYM:
	{
		register int w;
		t = (TREPTR) getstak(IFTYPE);
		((IFPTR) t)->iftyp = TIF;
		((IFPTR) t)->iftre = cmd(THSYM, NLFLG);
		((IFPTR) t)->thtre = cmd(ELSYM | FISYM | EFSYM, NLFLG);
		((IFPTR) t)->eltre = ((w = wdval) == ELSYM ?
				cmd(FISYM, NLFLG) :
				(w == EFSYM ? (wdval = IFSYM, item(0)) : 0));
		if (w == EFSYM)
			return (t);
		break;
	}

	case FORSYM:
	{
		t = (TREPTR) getstak(FORTYPE);
		((FORPTR) t)->fortyp = TFOR;
		((FORPTR) t)->forlst = 0;
		chkword();
		((FORPTR) t)->fornam = wdarg->argval;
		if (skipnl() == INSYM) {
			chkword();
			((FORPTR) t)->forlst = (COMPTR) item(0);
			if (wdval != NL && wdval != ';')
				synbad();
			chkpr(wdval);
			skipnl();
		}
		chksym(DOSYM | BRSYM);
		((FORPTR) t)->fortre =
			    cmd(wdval == DOSYM ? ODSYM : KTSYM, NLFLG);
		break;
	}

	case WHSYM:
	case UNSYM:
	{
		t = (TREPTR) getstak(WHTYPE);
		((WHPTR) t)->whtyp = (wdval == WHSYM ? TWH : TUN);
		((WHPTR) t)->whtre = cmd(DOSYM, NLFLG);
		((WHPTR) t)->dotre = cmd(ODSYM, NLFLG);
		break;
	}

	case BRSYM:
		t = cmd(KTSYM, NLFLG);
		break;

	case '(':
	{
		register PARPTR p;
		p = (PARPTR) getstak(PARTYPE);
		p->partre = cmd(')', NLFLG);
		p->partyp = TPAR;
		t = makefork(0, /*FIXME*/(void *)p);
		break;
	}

	default:
		if (io == 0)
			return (0);

	case 0:
	{
		register ARGPTR argp;
		register ARGPTR *argtail;
		register ARGPTR *argset = 0;
		int keywd = 1;
		t = (TREPTR) getstak(COMTYPE);
		((COMPTR) t)->comio = io;	/*initial io chain */
		argtail = &(((COMPTR) t)->comarg);
		while (wdval == 0) {
			argp = wdarg;
			if (wdset && keywd) {
				argp->argnxt = (ARGPTR) argset;
				argset = (ARGPTR *) argp;
			} else {
				*argtail = argp;
				argtail = &(argp->argnxt);
				keywd = flags & keyflg;
			}
			word();
			if (flag)
				((COMPTR) t)->comio = inout(((COMPTR) t)->comio);
		}

		((COMPTR) t)->comtyp = TCOM;
		((COMPTR) t)->comset = (ARGPTR) argset;
		*argtail = 0;
		return (t);
	}

	}
	reserv++;
	word();
	if (io = inout(io)) {
		t = makefork(0, t);
		t->treio = io;
	}
	return t;
}