示例#1
0
void ExternalOutput::enable(int status){

    if (status==2){

        //QString program = "vlc";
        QString program = QString(ui->commandEdit->toPlainText()).arg(buffer->width).arg(buffer->height);
        //arguments << "-style" << "fusion";
        input = (char*)buffer->Open(ui->inputBox->value());

        myProcess = new QProcess();

        QThread* workThread = new QThread(this);
        //myProcess->moveToThread(workThread);
        workThread->start();

        connect(myProcess,SIGNAL(readyRead()),this,SLOT(printOutput()));
        connect(myProcess,SIGNAL(readyReadStandardOutput()),this,SLOT(printOutput()));
        connect(myProcess,SIGNAL(readyReadStandardError()),this,SLOT(printOutput()));
        connect(myProcess,SIGNAL(finished(int)),this,SLOT(processExit()));

        qDebug() << program;

        myProcess->start(program);
        qDebug()<<"vykonalsom";

        connect(buffer->clock,SIGNAL(timeout()),this,SLOT(newFrame()));
    } else {
void QueryWindow::onNickMessage(Event *pEvent)
{
    Message msg = DCAST(MessageEvent, pEvent)->getMessage();

    // Will print a nick change message to the PM window
    // if we get a NICK message, which will only be if we're in
    // a channel with the person (or if the nick being changed is ours).
    QString oldNick = parseMsgPrefix(msg.m_prefix, MsgPrefixName);
    QString textToPrint = GET_STRING("message.nick")
                          .arg(oldNick)
                          .arg(msg.m_params[0]);
    if(m_pSession->isMyNick(oldNick))
    {
        printOutput(textToPrint, MESSAGE_IRC_NICK);
    }
    else
    {
        // If the target nick has changed and there isn't another query with that name
        // already open, then we can safely change the target's nick.
        bool queryWindowExists = DCAST(StatusWindow, m_pManager->getParentWindow(this))->childIrcWindowExists(msg.m_params[0]);
        if(isTargetNick(oldNick) && !queryWindowExists)
        {
            setTargetNick(msg.m_params[0]);
            printOutput(textToPrint, MESSAGE_IRC_NICK);
        }
    }
}
示例#3
0
INT wmain(INT argc, WCHAR **argv) 
{
	po::variables_map vm;
	printInfoStruct printInfo = { };

	INT r = parseArguments(argc, argv, vm, printInfo);

	if (r != -1)
		return r;

	if(!printInfo.user.empty())
		return printOutput(countProcs(printInfo.user), printInfo);

	return printOutput(countProcs(), printInfo);
}
int main(void) {
	char path[BUFSIZ + 1];
	char html[80000];
	int numberOfImages;
	long totalPixels;
	int done = 0;

	printf("BBaileyHTMLImageEditor v0.1\n");

	do {
		//initialize variables
		html[0] = '\0';
		numberOfImages = 0;
		totalPixels = 0;

		//if valid path is given, calculate # of images and pixel area
		if (textFileToString(html, path)) {
			totalPixels = estimateImageContent(html, &numberOfImages);
			printOutput(path, numberOfImages, totalPixels);
			//if blank path is given end the program
		} else if (path[0] = '\0')
			done++;
		//if path is not blank or valid prompt for re-entry
		else
			printf("Invalid path.");
	} while (!done);
	return EXIT_SUCCESS;
}
示例#5
0
文件: io.c 项目: Daven005/ESP8266
void ICACHE_FLASH_ATTR overrideSetOutput(uint8 op, uint8 set) {
	if (op < OUTPUTS) {
		outputOverrides[op] = set ? OR_ON : OR_OFF;
		easygpio_outputSet(PUMP, !set);
		printOutput(op);
	}
}
示例#6
0
int main(int argc, char* argv[]) {
	HumdrumFileSet infiles;

	// process the command-line options
	checkOptions(options, argc, argv);

	// figure out the number of input files to process
	int numinputs = options.getArgCount();

	if (numinputs < 1) {
		infiles.read(cin);
	} else {
		for (int i=0; i<numinputs; i++) {
			infiles.readAppend(options.getArg(i+1));
		}
	}

	for (int i=0; i<infiles.getCount(); i++) {
		if (rhythmQ) {
			printKernOutput(infiles[i]);
		} else {
			printOutput(infiles[i]);
		}
	}

	return 0;
}
示例#7
0
void CodeGenerator::printStatement(const Node *statementNode)
{
	Node *son = statementNode->son;
	Node *grandSon = son->son;
	while(son)
	{
		switch(son->kind)
		{
		case VAR_DEC_LIST:
			while(grandSon)
			{
				printVarDec(grandSon);
				grandSon = grandSon->bro;
			}
			break;

		case OUTPUT:
			printOutput(son);
			break;

		///아직 여러가지 남음
		case STMT:
			symbolTable.openNewScope();
			printStatement(son);
			symbolTable.closeLastScope();
			break;
		}
		son = son->bro;
		if(son)
			grandSon = son->son;
	}
}
void Test(void)
{
	int i, j, * intOutput;
	float *output;

	/* allocate output */
	output = (float *)calloc(neuronsPerLayer, sizeof(float));
	intOutput = (int *)calloc(neuronsPerLayer, sizeof(int));

	for(i = 0; i < numTestSamples; i++)
	{
		ForwardPropagation(testSamples[i], output);

		/* convert float output to integer, threshold = 0.5 since using round */
		for(j = 0; j < numOutputNodes; j++)
		{
			if(roundf(output[j]) < 0.1)
			{
				intOutput[j] = 0;
			}
			else
			{
				intOutput[j] = 1;
			}
		}

		printOutput(intOutput, numOutputNodes, 5);
	}

	return;
}
示例#9
0
ConsoleWindow::ConsoleWindow(QWidget *parent)
    : QWidget(parent), area(new ConsoleArea(this)), edit(new ConsoleInput(this)), prompt(new QLabel(">>>")),
        diffParen(0), diffSqParen(0), scope(0), console(new PyMT::PyConsole())
{
    connect(console, SIGNAL(updated(QString)), this, SLOT(printOutput(QString)));
    connect(edit, SIGNAL(returnPressed()), this, SLOT(enter()));
    connect(this, SIGNAL(execCmd(QString)), console, SLOT(command(QString)));
    QVBoxLayout *lay = new QVBoxLayout();
    setLayout(lay);
    edit->setTextMargins(0, 0, 0, 0);
    edit->setFrame(false);
    lay->addWidget(area);
    QHBoxLayout *hlay = new QHBoxLayout;
    lay->addLayout(hlay);
    hlay->addWidget(prompt);
    hlay->addWidget(edit);
    lay->setMargin(0);
    lay->setSpacing(0);
    hlay->setMargin(0);
    hlay->setSpacing(0);
    edit->setStyleSheet("background-color: black;"
                        "color: white;"
                        "border-image: none;");
    prompt->setStyleSheet("background-color: black;"
                        "color: white;"
                        "border-image: none;");
    area->setStyleSheet("background-color: black;"
                        "color: white;"
                        "border-image: none;");
    prompt->setFont(QFont("Courier New"));
}
示例#10
0
/* Main checks that the number of arguments is correct, then calls the to
 * 	the other functions to parse the hexadecimal values to integers
 * 	then print them out to stdout. It will quit on incorrect input with
 * 	an appro
 * 
 * Parameters:
 *   argc: the number of arguments (including the original program)
 *   argv: an array of the arguments (including the original program name)
 * 
 * Exit codes:
 *   0: Completed successfully
 *   1: More than 6 values to convert. Failed.
 *   2: Bad input in one of the hex numbers. Failed.
 */
int main (int argc, char *argv[]){
  if (argc == 1) {
    /* no arguements, do nothing */
    return 0;
  }
  if (argc > 7) {
    printf("Maximum of 6 values accepted.  Quitting.\n");
    return 1;
  } 
  int intarray[argc];
  int i;
  for ( i = 1; i < argc; i++ ) {
    int decimal; /*contains the decimal value of the hex input*/
    decimal = parseHex(argv[i]);
    if (decimal == -1) {
      printf("Bad input encountered.  Quitting.\n");
      return 2;
    }
    else {
      intarray[i - 1] = decimal;
    }
  }
  
  printOutput(intarray, argv ,argc);
  return 0;
}
示例#11
0
文件: io.c 项目: Daven005/ESP8266
void ICACHE_FLASH_ATTR overrideClearOutput(uint8 op) {
	if (op < OUTPUTS) {
		outputOverrides[op] = OR_NOT_SET;
		easygpio_outputSet(PUMP, !currentOutputs[op]);
		printOutput(op);
	}
}
示例#12
0
int main (int argc, char *argv[])
{
    printf("**************************** HYBRID 2D ****************************\n");
    readAndCheckInput();
    initialConditions();
    printOutput();
    printf("Running...");
    fflush(stdout);
    
    //visualization setup for GLUT
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
    glutInitWindowSize(winx, winy);
    glutCreateWindow("HYBRID2D");
    glutDisplayFunc(myDisplay);
    glutIdleFunc(myDisplay);
    glutReshapeFunc(myReshape);
    glutKeyboardFunc(myKeyboard);
    glutSpecialFunc(mySpecialKey);
    glMatrixMode(GL_MODELVIEW);
    glClearColor(0.0f,0.0f,0.0f,1.0f);
    glEnable(GL_DEPTH_TEST);
    glutMainLoop();  //run simulation
    
    return 0;
}
示例#13
0
int main(int argc, char *argv[]) {

    if (argc == 1) {
        cout << "Usage: " << argv[0] << " fileName1 fileName2 ..." << endl;
        cout << "Please give at least one input file" << endl;
        return 0;
    }

    // open log file
    if (!openOutput(logFile, logFileName)) {
        cout << "Log file open error! Exit program" << endl;
        return 0;
    }

    // allocate memory for event db
    Event *eventDB = new Event[argc - 1];
    
    for (int i = 0; i < argc - 1; i++) {
        eventDB[i].setInputFile(argv[i+1]);
    }

    printOutput(logFile, "Finish all!\n");

    // close logFile
    logFile.close();

    return 0;

}
// Handles the printing/sending of the PRIVMSG message.
void QueryWindow::handleSay(const QString &text)
{
    QString textToPrint = GET_STRING("message.say")
                            .arg(m_pSession->getNick())
                            .arg(text);
    printOutput(textToPrint, MESSAGE_IRC_SAY_SELF);
    m_pSession->sendPrivmsg(getWindowName(), text);
}
// Handles the printing/sending of the PRIVMSG ACTION message.
void QueryWindow::handleAction(const QString &text)
{
    QString textToPrint = GET_STRING("message.action")
                            .arg(m_pSession->getNick())
                            .arg(text);
    printOutput(textToPrint, MESSAGE_IRC_ACTION_SELF);
    m_pSession->sendAction(getWindowName(), text);
}
示例#16
0
int main(int argc, char** argv) {
   // process the command-line options
   checkOptions(options, argc, argv);

   HumdrumFile hfile(options.getArg(1).data());
   hfile.analyzeRhythm("4");
   printOutput(hfile);
   return 0;
}
void Test(void)
{
	int i, j, * intOutput;
	float *output;
	float probabilities[NUM_CHARS];
	float accuracy = 0;
	char pred = 0;

	/* allocate output */
	output = (float *)calloc(neuronsPerLayer, sizeof(float));
	intOutput = (int *)calloc(neuronsPerLayer, sizeof(int));

	for(i = 0; i < numTestSamples; i++)
	{

		ForwardPropagation(&testSamples[i*numInputNodes], output);

		/* convert float output to integer, threshold = 0.5 since using round */
		/* convert float output to integer, threshold = 0.5 since using round */
		for(j = 0; j < numOutputNodes; j++)
		{
			if(roundf(output[j]) < 0.1)
			{
				intOutput[j] = 0;
			}
			else
			{
				intOutput[j] = 1;
			}
		}


		calcProbabilities(probabilities, intOutput);
		pred = predict(probabilities);

		printf("Predicted Character: %c\n", pred+65);

		/* assumes inputs are in abc order for easy calculation */
		if(pred == i)
		{
			accuracy++;
		}

		if(verbose)
		{
			printOutput(intOutput, numOutputNodes, 5);
		}
	}

	accuracy /= numTestSamples;
	printf("Prediction Accuracy: %f\n", accuracy);

	free(intOutput);
	free(output);

	return;
}
示例#18
0
int main(void) {

	setvbuf(stdout, NULL, _IONBF, 0);

	FILE *input_file1 = fopen("in1.bmp", "rb");
	FILE *input_file2 = fopen("in2.bmp", "rb");
	FILE *blend = fopen("blend.bmp", "wb");
	FILE *checker = fopen("checker.bmp", "wb");

	char headerA_1[2], headerA_2[12], headerA_3[8], headerA_4[16];
	char headerB_1[2], headerB_2[12], headerB_3[8], headerB_4[16];

	int width1 = 0, height1 = 0, width2 = 0, height2 = 0;
	int file_size1 = 0, file_size2 = 0, image_size1 = 0, image_size2 = 0;

	readInputFile(input_file1, headerA_1, headerA_2, headerA_3, headerA_4,
			&file_size1, &image_size1, &width1, &height1);
	readInputFile(input_file2, headerB_1, headerB_2, headerB_3, headerB_4,
			&file_size2, &image_size2, &width2, &height2);

	unsigned char pixels1[height1][width1 * 3], pixels2[height2][width2 * 3];

	unsigned char checkerData[height1][width1 * 3];
	unsigned char blendData[height1][width1 * 3];

	readPixels(input_file1, &width1, &height1, pixels1);
	readPixels(input_file2, &width2, &height2, pixels2);

	blender(&width1, &height1, pixels1, pixels2, blendData);

	transformCheckerBoard(&width1, &height1, pixels1, pixels2, checkerData);

	printOutput(blend, headerA_1, headerA_2, headerA_3, headerA_4,
			&file_size1, &image_size1, &width1, &height1, blendData);

	printOutput(checker, headerB_1, headerB_2, headerB_3, headerB_4,
			&file_size2, &image_size2, &width2, &height2, checkerData);

	fclose(blend);
	fclose(checker);
	return 0;
}
示例#19
0
void execRow(){
    cnt=0;mxCnt=0;
    puts("------- ROW Method -------");
    gettimeofday(&curTime1,NULL);
    startRowMethod();
    gettimeofday(&curTime2,NULL);
    printTime();
    printOutput(resMatRowMethod,outputFile);
    //printOutput(resMatRowMethod,stdout);
    printf("number of threads is: %d\n",N);
}
示例#20
0
void printOutput(char* fact, int i)
{
	if (fact[i]=='\0')
		return;
	else
	{
		printOutput(fact,i+1);
		printf("%c", fact[i]);
	}
	return;
}
示例#21
0
void execCell(){
    cnt=0;mxCnt=0;
    puts("------- Cell Method -------");
    gettimeofday(&curTime1,NULL);
    startCellMethod();
    gettimeofday(&curTime2,NULL);
    printTime();
    printOutput(resCellMethod,outputFile);
    //printOutput(resCellMethod,stdout);
    printf("number of threads is: %d\n",N*M);
}
示例#22
0
INT wmain(INT argc, WCHAR **argv)
{
	po::variables_map vm;
	printInfoStruct printInfo = { };
	INT ret = parseArguments(argc, argv, vm, printInfo);
	
	if (ret != -1)
		return ret;

	getUptime(printInfo);

	return printOutput(printInfo);
}
示例#23
0
int main(int argc, char** argv) {
   // process the command-line options
   checkOptions(options, argc, argv);
   HumdrumStream streamer(options);
   HumdrumFile hfile;
   if (!streamer.read(hfile)) {
      // no data could be read
      exit(1);
   }
   hfile.analyzeRhythm("4");
   printOutput(hfile);
   return 0;
}
示例#24
0
文件: unittests.cpp 项目: DaniM/lyngo
	void run ()
	{
		Result result;
		std::chrono::time_point<std::chrono::system_clock> start, end;
		start = std::chrono::system_clock::now ();
		for (auto& it : UnitTestRegistry::instance ())
		{
			result += runTestCase (std::move (it));
		}
		end = std::chrono::system_clock::now ();
		print ("\nDone running %d tests in %lldms. [%d Failed]\n", result.succeded+result.failed, std::chrono::duration_cast<std::chrono::milliseconds> (end-start).count (), result.failed);
		printOutput ();
	}
示例#25
0
void do_output(OTTCP *x) {
	// This is called by the Max clock.  It's guaranteed not to be called
	// at notifier level, although if we're in Overdrive this will be called
	// at interrupt level.
	Atom arguments[2];
	short oldLockout;

	x->o_nextRequest = NO_REQUEST;

#ifdef DEBUG
	printOutput(x);
#endif

	SETLONG(&arguments[0], x->o_bytesRead);
	SETLONG(&arguments[1], (long) x->o_currentReadBuf);
	if (x->o_whatToOutput == GET_NBYTES) {
		outlet_anything(x->o_outlet, ps_OTTCP_nbytes, 2, arguments);
	} else if (x->o_whatToOutput == GET_DELIM) {
		outlet_anything(x->o_outlet, ps_OTTCP_delim, 2, arguments);
	} else {
		post("е OTUDP: error: o_whatToOutput is %ld in do_output", x->o_whatToOutput);
	}
	
	// Now that we finished outputting the buffer, we can reset all our state to be
	// ready for the next one
	oldLockout = AcquireLock(x);
	
	// Swap the double buffers
	if (x->o_currentReadBuf == x->o_ReadBufA) {
		x->o_currentReadBuf = x->o_ReadBufB;
		x->o_nextReadBuf = x->o_ReadBufA;
	} else {
		x->o_currentReadBuf = x->o_ReadBufA;
		x->o_nextReadBuf = x->o_ReadBufB;
	}
	
	x->o_bytesRead = x->o_bytesReadForNextTime;
	x->o_bytesReadForNextTime = 0;
	ChangeState(x, x->o_nextRequest);
	
	ReleaseLock(x,oldLockout);

	if (x->o_state == GET_NBYTES || x->o_state == GET_DELIM) {
		if (SeeIfWeCanAlreadyOutput(x)) return;
	}
	
	if (x->o_datawaiting) {
		// We know there's something in the TCP buffer that we haven't looked at yet.  Now's the time.
		ottcp_handleIncomingData(x);
	}
}
示例#26
0
文件: unittests.cpp 项目: DaniM/lyngo
	bool runTest (const std::string& testName, const TestFunction& f)
	{
		std::chrono::time_point<std::chrono::system_clock> start, end;
		printIntend ();
		printf ("%s", testName.c_str());
		intend++;
		start = std::chrono::system_clock::now ();
		bool result = f (this);
		end = std::chrono::system_clock::now ();
		intend--;
		printf (" [%s] -> %lldµs\n", result ? "OK" : "Failed", std::chrono::duration_cast<std::chrono::microseconds> (end-start).count ());
		printOutput ();
		return result;
	}
示例#27
0
INT wmain(INT argc, WCHAR **argv) 
{
	printInfoStruct printInfo = { };
	po::variables_map vm;

	INT ret = parseArguments(argc, argv, vm, printInfo);
	if (ret != -1)
		return ret;

	ret = check_users(printInfo);
	if (ret != -1)
		return ret;

	return printOutput(printInfo);
}
示例#28
0
int wmain(int argc, WCHAR **argv)
{
	printInfoStruct printInfo;
	po::variables_map vm;

	int ret = parseArguments(argc, argv, vm, printInfo);
	if (ret != -1)
		return ret;

	ret = check_load(printInfo);
	if (ret != -1)
		return ret;

	return printOutput(printInfo);
}
示例#29
0
INT wmain(INT argc, WCHAR **argv)
{
	po::variables_map vm;
	printInfoStruct printInfo = { false, 0, L"" };

	INT ret = parseArguments(argc, argv, vm, printInfo);
	if (ret != -1)
		return ret;

	printInfo.ServiceState = ServiceStatus(printInfo);
	if (printInfo.ServiceState == -1)
		return 3;

	return printOutput(printInfo);
}
void QueryWindow::onPrivmsgMessage(Event *pEvent)
{
    Message msg = DCAST(MessageEvent, pEvent)->getMessage();
    if(m_pSession->isMyNick(msg.m_params[0]))
    {
        QString fromNick = parseMsgPrefix(msg.m_prefix, MsgPrefixName);
        if(isTargetNick(fromNick))
        {
            QString textToPrint;
            bool shouldHighlight = false;
            OutputMessageType msgType = MESSAGE_CUSTOM;

            CtcpRequestType requestType = getCtcpRequestType(msg);
            if(requestType != RequestTypeInvalid)
            {
                // ACTION is /me, so handle according to that.
                if(requestType == RequestTypeAction)
                {
                    QString action = msg.m_params[1];

                    // Action is in the format of "\1ACTION <action>\1", so
                    // the first 8 and last 1 characters will be excluded.
                    msgType = MESSAGE_IRC_ACTION;
                    QString msgText = action.mid(8, action.size()-9);
                    shouldHighlight = containsNick(msgText);
                    textToPrint = GET_STRING("message.action")
                                  .arg(fromNick)
                                  .arg(msgText);
                }
            }
            else
            {
                msgType = MESSAGE_IRC_SAY;
                shouldHighlight = containsNick(msg.m_params[1]);
                textToPrint = GET_STRING("message.say")
                              .arg(fromNick)
                              .arg(msg.m_params[1]);
            }

            if(!hasFocus())
            {
                QApplication::alert(this);
            }

            printOutput(textToPrint, msgType, shouldHighlight ? COLOR_HIGHLIGHT : COLOR_NONE);
        }
    }
}