예제 #1
0
XyzWidget::XyzWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::XyzWidget)
{
        ui->setupUi(this);

        //rpy = readInput("/Users/utilisateur/Documents/Navia/GUI/XYZ/rpy.txt");
        //xyz = readInput("/Users/utilisateur/Documents/Navia/GUI/XYZ/log_out.txt");

        QString namerpy = QFileDialog::getOpenFileName(this, tr("Open RPY"),
        "",
        tr("Text files (*.txt)"));
        QString namexyz = QFileDialog::getOpenFileName(this, tr("Open LOGOUT"),
        "",
        tr("Text files (*.txt)"));

        rpy=readInput(namerpy);
        xyz=readInput(namexyz);

        //fenêtre XYZ
        setupRealtimeData1(ui->customPlot1);

        //fenêtre Vx Vy Vz
        setupRealtimeData2(ui->customPlot2);

        //febêtre ax ay az
        setupRealtimeData3(ui->customPlot3);

        //fenêtre R P Y
        setupRealtimeData4(ui->customPlot4);

        connect(&datatimer, SIGNAL(timeout()), this, SLOT(readResponseXYZ()));
        datatimer.start(0); // Interval 0 means to refresh as fast as possible

    }
예제 #2
0
파일: evalExp.c 프로젝트: DanielsWrath/ADNC
void evaluateExpressions() {
    int degree = 1;
    char *varName;
  char *ar;
  List tl, tl1; 
  double w;
  printf("give an expression: ");
  ar = readInput();
  while (ar[0] != '!') {
    tl = tokenList(ar); 
    printf("\nthe token list is ");
    printList(tl);
    tl1 = tl;
    if ( valueExpression(&tl1,&w) && tl1==NULL ) {
               /* there may be no tokens left */ 
      printf("this is a numerical expression with value %g\n",w); 
    } else {
      tl1 = tl;
      if ( acceptExpression(&tl1, varName, &degree) && tl1 == NULL ) {
        printf("this is an arithmetical expression\n"); 
      } else {
        printf("this is not an expression\n"); 
      }
    }
    free(ar);
    freeTokenList(tl);
    printf("\ngive an expression: ");
    ar = readInput();
  }
  free(ar);
  printf("good bye\n");
}
예제 #3
0
파일: mysh.c 프로젝트: smihir/homework
int process_file(char *batch_file)
{
	FILE * batch_stream;
	char *cmdLine;
	READ_STATUS s;

	batch_stream = fopen(batch_file, "r");

	if (batch_stream == NULL) {
		printError();
		return 1;
	}

	for (s = readInput(batch_stream, &cmdLine);
		 (s != INPUT_READ_EOF) && (s != INPUT_READ_ERROR);
		 s = readInput(batch_stream, &cmdLine)) {

		if (s == INPUT_READ_OVERFLOW) {
			display_full_command(cmdLine);
			free(cmdLine);
			continue;
		}
		run_cmd(cmdLine, BATCH_MODE);
	}
	fclose(batch_stream);
	return 0;
}
예제 #4
0
int main(int argc, char** argv)
{
    int grid_rows = 0, grid_cols = 0, iterations = 0;
    float *MatrixTemp = NULL, *MatrixPower = NULL;
    char tfile[] = "temp.dat";
    char pfile[] = "power.dat";
    char ofile[] = "output.dat";

    if (argc >= 3) {
        grid_rows = atoi(argv[1]);
        grid_cols = atoi(argv[1]);
        iterations = atoi(argv[2]);
        if (argc >= 4)  setenv("BLOCKSIZE", argv[3], 1);
        if (argc >= 5) {
          setenv("HEIGHT", argv[4], 1);
          pyramid_height = atoi(argv[4]);
        }
    } else {
        printf("Usage: hotspot grid_rows_and_cols iterations [blocksize]\n");
        return 0;
    }

    // Read the power grid, which is read-only.
    int num_elements = grid_rows * grid_cols;
    MatrixPower = new float[num_elements];
    readInput(MatrixPower, grid_rows, grid_cols, pfile);

    // Read the temperature grid, which will change over time.
    MatrixTemp = new float[num_elements];
    readInput(MatrixTemp, grid_rows, grid_cols, tfile);

    float grid_width = chip_width / grid_cols;
    float grid_height = chip_height / grid_rows;
    float Cap = FACTOR_CHIP * SPEC_HEAT_SI * t_chip * grid_width * grid_height;
    // TODO: Invert Rx, Ry, Rz?
    float Rx = grid_width / (2.0 * K_SI * t_chip * grid_height);
    float Ry = grid_height / (2.0 * K_SI * t_chip * grid_width);
    float Rz = t_chip / (K_SI * grid_height * grid_width);
    float max_slope = MAX_PD / (FACTOR_CHIP * t_chip * SPEC_HEAT_SI);
    float step = PRECISION / max_slope;
    float step_div_Cap = step / Cap;

    struct timeval starttime, endtime;
    long usec;
    runOMPHotspotSetData(MatrixPower, num_elements);
    gettimeofday(&starttime, NULL);
    runOMPHotspot(MatrixTemp, grid_cols, grid_rows, iterations, pyramid_height,
            step_div_Cap, Rx, Ry, Rz);
    gettimeofday(&endtime, NULL);
    usec = ((endtime.tv_sec - starttime.tv_sec) * 1000000 +
            (endtime.tv_usec - starttime.tv_usec));
    printf("Total time=%ld\n", usec);
    writeOutput(MatrixTemp, grid_rows, grid_cols, ofile);

    delete [] MatrixTemp;
    delete [] MatrixPower;
    return 0;
}
예제 #5
0
int main(){
    char * num1 ;
    char * num2 ;
    num1 = readInput(1);
    num2 = readInput(2);

    printf("\nConverted to int:%d",convert_to_int(num1));
    printf("\nConverted to char:%s",convert_to_char(convert_to_int(num1)));
    printf("\nMax:%d",max(num1,num2,10));
    printf("\nSplit at 0-3:%s",split_at(num1,0,3));
    printf("\nSplit at 3-5:%s",split_at(num1,3,strlen(num1)));
    printf("\nKaratsuba:%d",karatSuba(num1,num2));

    return 0 ;
}
예제 #6
0
// Initialization. Models, textures, program input and graphics definitions
void init (void)
{
	glClearColor (0.0f, 0.0f, 0.0f, 0.0f);

    // Model loading based on each scale
	model1 = readModel (model1Path, model1Scale);
	model1 -> size = model1Size;
	model2 = readModel (model2Path, model2Scale);
	model2 -> size = model2Size;
    
    // Textures configuration in general
	configTextMode();

    // Read the program input (not user input) to determinw hoe many rooms
    //  and theirs objects will be drawn
	readInput();

	// Light. The light switch is made in the input.cpp.
    // Switch it pressing the key L. Do it!
    if (light)
    {
        GLfloat light_position[] = {1.0, 1.0, 1.0, 0.0};
        GLfloat light_diffuse[] = {0.9, 0.9, 0.9, 0.0};
        GLfloat light_ambient[] = {1.4, 1.4, 1.4, 0.0};
        glLightfv(GL_LIGHT0, GL_POSITION, light_position);
        glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
        glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
    }

	glEnable(GL_DEPTH_TEST);

	glShadeModel(GL_SMOOTH);
}
예제 #7
0
void Ghdb::prompt ( void ) {
	int ret = GHDB_OK ;
	ret = readInput ( "ghdb", 0 ) ;
	
	if ( ret ) {
		return ;
	}
	
	//Input string
	std::string textInput = _cmdBuffer ;
	//Split the inputing sentence.
	std::vector<std::string> textVec ;
	split ( textInput, SPACE, textVec ) ;
	int count = 0 ;
	std::string cmd = "" ;
	std::vector<std::string> optionVec ;
	
	std::vector<std::string>::iterator iter = textVec.begin() ;
	//handle different command here.
	ICommand* pCmd = NULL ;
	for ( ; iter != textVec.end(); ++iter ) {
		std::string str = *iter ;
		if ( 0 == count ) {
			cmd = str ;
			count ++ ;
		} else {
			optionVec.push_back(str) ;
		}
	}
	pCmd = _cmdFactory.getCommandProcessor ( cmd.c_str() ) ;
	if ( NULL != pCmd ) {
		pCmd -> execute ( _sock, optionVec ) ;
	}
}
예제 #8
0
void Init_Problem_1 ( )
//======================================================================
// XZones = 2, YZones = 1, ZZones = 2, ALL hexahedra
{
  FILE *inputDeck;
  char fileName[100];

  strcpy(fileName,"problem1.cmg");

/*   printf("using input deck:  %s\n",fileName); */
  
  /*Open the file to parse */
  inputDeck = fopen(fileName, "r");

  /*print the prompt*/
  CMGDPRINT("CMG > ");
  
  readInput(inputDeck);
 
  int success = fclose(inputDeck);

  bcastinp( );
   
  cgenmesh();

/*   printf("CMG initialization completed for ==========> PROBLEM # 1\n"); */
}
예제 #9
0
void Init_CMG_Problem_From_File  (const char* meshFile)
//======================================================================
{
  FILE *inputDeck;
  char fileName[100];

  strcpy(fileName,meshFile);

/*   printf("using input deck:  %s\n",fileName); */
  
  /*Open the file to parse */
  inputDeck = fopen(fileName, "r");

  /*print the prompt*/
  CMGDPRINT("CMG > ");
  
  readInput(inputDeck);
 
  int success = fclose(inputDeck);

  bcastinp( );
   
  cgenmesh();

/*   printf("CMG initialization completed for ==========> PROBLEM # 1\n"); */

}
예제 #10
0
//stores the input image, resizes with seam carving, and generates the output image
int main(int argc, char *argv[]) {
    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    if (!readInput(argv[1])) {
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    //get the output width and height
    target_width = atoi(argv[3]);
    target_height = atoi(argv[4]);

    //exit if the output dimensions are larger than the input image dimensions
    if (initial_width < target_width || initial_height < target_height) {
        printf("Error: Desired output image dimensions larger than input image dimensions.\n");
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    image_energy = (double *) malloc(initial_width * initial_height * sizeof(double));
    path_costs = (double *) malloc(initial_width * initial_height * sizeof(double));
    previous_x = (int *) malloc(initial_width * initial_height * sizeof(int));
    previous_y = (int *) malloc(initial_width * initial_height * sizeof(int));
    n = initial_width * initial_height;

    if (image_energy == NULL || path_costs == NULL || previous_x == NULL || previous_y == NULL) {
        printf("problem");
    }

    assignPixels();

    //remove vertical seams until reaching the target width
    while (current_width > target_width) {
        //calculate the energy of the image
        computeImageEnergy();
        //remove the seam
        removeVerticalSeam();
    }

    //remove horizontal seams until reaching the target height
    while (current_height > target_height) {
        //calculate the energy of the image
        computeImageEnergy();
        //remove the seam
        removeHorizontalSeam();
    }

    if (rank == 0) {
        outputCarved(argv[2]);
    }

    free(image_energy);
    free(path_costs);
    free(previous_x);
    free(previous_y);

    MPI_Finalize();

    return 0;
}
예제 #11
0
파일: Run2D.cpp 프로젝트: Oscarlight/leno
Device2D Run2D::createDevice2D(int argc, char** argv) {
	std::map<std::string, Material> matLib = readInput(argc, argv);
	std::vector<Device1D> dev1DList;
	Device2D dev2D;
	int accu = 0; // accumalated layer num

	// construct all device1D
	for (int i = 0; i < io2D.blockNum; i++) { // for each block
		dev1DList.push_back(createDevice1D(io2D, matLib, accu, i));
		accu = accu + io2D.layerNumList[i]; // update accu
	}

	std::cout << " **** dev1DList is completed with size = " << dev1DList.size() << std::endl;

	// construct device2D
	dev2D.startWith_2D(dev1DList[0], io2D.blockLength[0], io2D.blockPoint[0], io2D.leftBT);

	for (int i = 1; i < io2D.blockNum -1; i++) {
		dev2D.add_2D(dev1DList[i], io2D.blockLength[i], io2D.blockPoint[i]);
	}
	dev2D.endWith_2D(dev1DList[io2D.blockNum - 1], io2D.blockLength[io2D.blockNum - 1],
			io2D.blockPoint[io2D.blockNum - 1], io2D.rightBT);
	dev2D.matrixDiff_2D();

	std::cout << " **** Device2D is completed." << std::endl;
	return ( dev2D );
}
예제 #12
0
파일: bf.c 프로젝트: frp-2718/bf
int main(int argc, char *argv[]) {
    FILE* input = NULL;
    Queue *source = initq();
    int option;
    while ((option = getopt(argc, argv, "hv")) != EOF) {
        switch (option) {
        case 'h':
            usage();
            break;
        case 'v':
            printf("bf version %s\nCopyright (c) %s, %s\nX11 license\n", VERSION, YEAR, AUTHOR);
            exit(0);
            break;
        default:
            usage();
            break;
        }
    }
    if (argv[optind] == NULL)
        usage();
    else if ((input = fopen(argv[1], "r")) == NULL) {
        error(NO_FILE, "main");
    } else {
        readInput(input, source);
        fclose(input);
        execute(source);
        delq(source);
    }
    return 0;
}
예제 #13
0
void simulate()
{
	printf("Blood bank inventory management simulation.\n");
	if ((infile = fopen("bloodbank.in", "r")) == NULL) {
		printf("Can't find the file: bloodbank.in\n");
		exit(1);
	}
	if ((outfile = fopen("bloodbank.out", "w")) == NULL) {
		printf("Can't create the file: bloodbank.out\n");
		exit(1);
	}
	readInput();

	init_simlib();

	// Schedule first event

	event_schedule(sim_time + 0, EVENT_BLOOD_ARRIVAL); //first arrival from camp at beginning
	event_schedule(sim_time + 0, EVENT_BLOOD_DONATION); //first donation at beginning
	event_schedule(sim_time + 1, EVENT_BLOOD_DEMAND); //first demand next day


	event_schedule(max_sim_time, EVENT_END_SIMULATION);

	eventLoop();
	report();

	fclose(infile);
	fclose(outfile);
}
예제 #14
0
파일: q3_2.c 프로젝트: jpotecki/COMP101P
int main(void){
  int arr[2];
  readInput(arr);
  printf(" loop x^y : %d \n", powerLoop(arr[0],arr[1]));
  printf(" recursive: %d \n", powerRecursive(arr[0],arr[1]));
  return 0;
}
예제 #15
0
//////////////////////////////////////////////////////////////////////////////
///
///	Read the input stream
///
//////////////////////////////////////////////////////////////////////////////
void controller::readInputStream(unsigned char* ptr) {
 int position;
 sanitize(ptr, &position);
 bool isOverflow = false;

 // Validate input stream
 while (!isValidCommand(ptr) || isDividedByZeroDetected(ptr)) {
  // Prevent to have a string with no operation or with invalid operands
  if (isLFDetected(ptr)
    && (!isOperationDetected(ptr) || !isOperand1Detected(ptr)
      || !isOperand2Detected(ptr))) {
   sanitize(ptr, &position);
   displayMessage((char*) "Invalid input string\n");
   isOverflow = false;
  }

  if (isDividedByZeroDetected(ptr)) {
   sanitize(ptr, &position);
   displayMessage((char*) "Division by zero detected\n");
   isOverflow = false;
  }

  ptr[position++] = (unsigned char) readInput();

  // Loop in array
  if (position == 20) {
   sanitize(ptr, &position);
   if (!isOverflow)
    displayMessage((char*) "String too long, try again\n");
   isOverflow = true;
  }
 }
}
예제 #16
0
long SoundSourceFFmpeg::seek(long filepos)
{
    int ret = 0;
    int hours, mins, secs;
    long fspos, diff;
    AVRational time_base = pFormatCtx->streams[audioStream]->time_base;

    lock();

    fspos = mixxx2ffmpeg(filepos, time_base);
    //  qDebug() << "ffmpeg: seek0.5 " << packet.pos << "ld -- " << packet.duration << " -- " << pFormatCtx->streams[audioStream]->cur_dts << "ld";
    qDebug() << "ffmpeg: seek (ffpos " << fspos << "d) (mixxxpos " << filepos << "d)";

    ret = av_seek_frame(pFormatCtx, audioStream, fspos, AVSEEK_FLAG_BACKWARD /*AVSEEK_FLAG_ANY*/);

    if (ret){
        qDebug() << "ffmpeg: Seek ERROR ret(" << ret << ") filepos(" << filepos << "d) at file"
                 << m_qFilename;
        unlock();
        return 0;
    }

    readInput();
    diff = ffmpeg2mixxx(fspos - pFormatCtx->streams[audioStream]->cur_dts, time_base);
    qDebug() << "ffmpeg: seeked (dts " << pFormatCtx->streams[audioStream]->cur_dts << ") (diff " << diff << ") (diff " << fspos - pFormatCtx->streams[audioStream]->cur_dts << ")";

    bufferOffset = 0; //diff;
    if (bufferOffset > bufferSize) {
        qDebug() << "ffmpeg: ERROR BAD OFFFFFFSET, buffsize: " << bufferSize << " offset: " << bufferOffset;
        bufferOffset = 0;
    }
    unlock();
    return filepos;
}
예제 #17
0
파일: ProblemSet1_2.c 프로젝트: dw6/NUS
int main() {
	readInput();
	if ( tokenize() ) {
		printSymbolTable();
	}
	
}
예제 #18
0
파일: testApp.cpp 프로젝트: alx-s/ABCDerres
//--------------------------------------------------------------
void testApp::update()
{
	// Nécessaire pour le moteur de sons d'Openframeworks
	ofSoundUpdate();

	// Nécessaire pour la mise à jour du GPIO
	updateInputOutput();

	//
	if (!listSounds[0].getIsPlaying()){
		playSound(0);
	}

	// Exemple de lecture depuis une entrée
	// Puis écriture sur la sortir "/output0"
	int value = readInput(5);
	if (value>0)
	{
		soundVolumeTarget = 0.0f;
		soundVolume += (soundVolumeTarget-soundVolume)*0.2;
	}
	else
	{
		ofLogNotice() << "touch detected";
		soundVolumeTarget = 1.0f;
		soundVolume += (soundVolumeTarget-soundVolume)*0.7;
	}

	listSounds[0].setVolume(soundVolume);
}
예제 #19
0
rCode AtWrapper::CatchResponse(bool debug = false) {

	char in[RESPONSE_BUFFER] = {0};
	int bytesReaded = 0;
	bytesReaded = readInput((char*) in, RESPONSE_BUFFER);

	String input(in);

	if(bytesReaded > 0){

		//Debug received command from device
		if(debug){
			Serial.print("Input was: ");
			Serial.print(input);
			Serial.println("");
		}

		//Parse received command
		if(input.substring(0,3) == "ROK"){
			return EBU_RESETOK;
		} else if (input.substring(0,2) == "OK") {
			return EBU_SETTEDOK;
		} else if (input.substring(0,5) == "+RCOI") {
			this->client = input.substring(6,19);
			return EBU_INPUTCONNREQUEST;
		} else if (input.substring(0,3) == "ERR") {
			return EBU_ERROR;
		}

		return EBU_UNDEFINED;
	}
	return EBU_NORESPONSE;
}
예제 #20
0
파일: MyMD.cpp 프로젝트: Rhouli/ljmd-c
 MyMD::MyMD() {

 /* Obtain the number of threads. */
 #if defined(_OPENMP)
 #pragma omp parallel
     {
	 if(0 == omp_get_thread_num()) {
	     nthreads=omp_get_num_threads();
	     printf("Running OpenMP version using %d threads\n", nthreads);
	 }
     }
 #else
     nthreads=1;
 #endif

   /* Read input and allocate classes memory. */
  allocateMemory();
  readInput();

  /* Load initial position and velocity. */ 
  readRestart();

  /* Open energy and trajectory output files. */
  erg=fopen(ergfile,"w");
  traj=fopen(trajfile,"w");

  /* Initializes forces and energies. */
  nfi = 0;
  integrator->UpdateCells();
  force->ComputeForce(atoms);
  integrator->CalcKinEnergy();
}
예제 #21
0
// ********************************************************************************************** //
//                                                                                                //
// ********************************************************************************************** //
int inputLib::waitScapeTime(int wait_period) {
	int now_time = 0;

	waitTime(50);
	now_time = timer.getTimer();
	wait_period = now_time + wait_period;

	while (now_time < wait_period) {
		readInput();
		if (p1_input[BTN_START] == 1 || p2_input[BTN_START] == 1) {
			return 1;
        } else if (p1_input[BTN_QUIT] == 1 || p2_input[BTN_QUIT] == 1) {
#if !defined(PLAYSTATION2) && !defined(PSP) && !defined(WII) && !defined(DREAMCAST)
            std::cout << "LEAVE #2" << std::endl;
            std::fflush(stdout);
            gameControl.leave_game();
#endif
		}
		now_time = timer.getTimer();
		#ifdef PLAYSTATION
			RotateThreadReadyQueue(_MIXER_THREAD_PRIORITY);
		#endif
        SDL_Delay(5);
	}
	return 0;
}
예제 #22
0
static void getChars(void *user)
{
    Uns8 c;

    while(1) {
        double d = DEFAULT_RX_DELAY;

        //
        // keep getting chars till we fill the fifo
        //
        bhmWaitDelay(d);
        while (!Rx.full) {
            Int32 bytes = readInput(&c, 1);
            if (bytes > 0) {
                //
                // We have got a char, so insert to buffer
                //
                fifoPush(&Rx, c);
                eval_interrupts();
            }
            bhmWaitDelay(d);
        }
        if (!Rx.empty) {
            eval_interrupts();
        }
    }
}
예제 #23
0
int Input::updateInput() {

	int oldMode = _inputMode;

	int event = kEvNone;
	readInput();

	switch (_inputMode) {
	case kInputModeGame:
		event = updateGameInput();
		break;

	case kInputModeInventory:
		updateInventoryInput();
		break;
	}

	// when mode changes, then consider any input consumed
	// for the current frame
	if (oldMode != _inputMode) {
		_mouseButtons = kEvNone;
		_hasKeyPressEvent = false;
	}

	return event;
}
예제 #24
0
int main(int argc, char *argv[])
{
  register int n;

  int     Nlambda, result;
  double *lambda;
  FILE   *fp;


  /* --- Read input data and initialize --             -------------- */

  setOptions(argc, argv);
  SetFPEtraps();

  readInput();
  MULTIatmos(&atmos, &geometry);
  readAtomicModels();
  readMolecularModels();

  if ((fp = fopen(CONTR_INPUT_FILE, "r")) == NULL) {
    sprintf(messageStr, "Unable to open inputfile %s", CONTR_INPUT_FILE);
    Error(ERROR_LEVEL_2, argv[0], messageStr);
  }

  result = fscanf(fp, "%d", &Nlambda);
  lambda = (double *) malloc(Nlambda * sizeof(double));
  for (n = 0;  n < Nlambda;  n++)
    result = fscanf(fp, "%lf", &lambda[n]);
  fclose(fp);

  backgrOpac(Nlambda, lambda);

  free(lambda);
}
예제 #25
0
파일: message.c 프로젝트: deanproxy/eMail
/**
 * this is the function that takes over from main().  
 * It will call all functions nessicary to finish off the 
 * rest of the program and then return properly. 
**/
void
createMail(void)
{
	dstrbuf *msg=NULL, *full_msg=NULL;
	char subject[MAXBUF]={0};

	/**
	 * first let's check if someone has tried to send stuff in from STDIN 
	 * if they have, let's call a read to stdin
	 */
	if (isatty(STDIN_FILENO) == 0) {
		msg = readInput();
		if (!msg) {
			fatal("Problem reading from STDIN redirect\n");
			properExit(ERROR);
		}
	} else {
		/* If they aren't sending a blank email */
		if (!Mopts.blank) {
			/* let's check if they want to add a subject or not */
			if (Mopts.subject == NULL) {
				fprintf(stderr, "Subject: ");
				fgets(subject, sizeof(subject)-1, stdin);
				chomp(subject);
				Mopts.subject = subject;
			}

			/* Now we need to let them create a file */
			msg = editEmail();
			if (!msg) {
				properExit(ERROR);
			}
		} else {
			/* Create a blank message */
			msg = DSB_NEW;
		}
	}

	/* Create a message according to the type */
	if (Mopts.gpg_opts) {
		full_msg = createGpgEmail(msg, Mopts.gpg_opts);
	} else {
		full_msg = createPlainEmail(msg);
	}

	if (!full_msg) {
        deadLetter(msg);
        dsbDestroy(msg);
		properExit(ERROR);
    }

    dsbDestroy(msg);

    int retsend = sendmail(full_msg);
    dsbDestroy(full_msg);
    if (retsend == ERROR) {
      properExit(ERROR);
    }
}
예제 #26
0
int main()
{
	std::string molecule;
	Reps replacements = readInput(molecule);
	std::cout << "Part one: " << partOne(replacements, molecule) << std::endl;
	std::cout << "Part two: " << partTwo(replacements, molecule) << std::endl;
	std::cin.get();
}
예제 #27
0
파일: q3_3.c 프로젝트: jpotecki/COMP101P
int main(void){
  long int a;
  a = readInput();
  printf("is");
  if ( a != reverse(a)) printf(" not");
  printf(" a palindrome\n" );
  return 0;
}
예제 #28
0
파일: lexan.cpp 프로젝트: evandar/PJP-mila2
int initLexan ( char *fileName )
{
    if ( ! initInput ( fileName ) )
        return 0;

    readInput ( );
    return 1;
}
예제 #29
0
void XDebugServer::doCommandLoop() {
  while (m_status == Status::BREAK ||
         m_status == Status::STARTING ||
         m_status == Status::STOPPING) {
    // TODO(#4489053) Respond & Implement
    readInput();
    m_status = Status::RUNNING;
  }
}
예제 #30
0
bool XDebugServer::doCommandLoop() {
  log("Entered command loop");

  bool should_continue = false;

  // Pause the polling thread if it isn't already. (It might have paused itself
  // if it read a "break" command)
  m_pausePollingThread.store(true);

  // Unpause the polling thread when we leave the command loop.
  SCOPE_EXIT {
    m_pausePollingThread.store(false);
  };

  std::lock_guard<std::mutex> lock(m_pollingMtx);

  do {
    // If we are detached, short circuit
    if (m_status == Status::Detached) {
      return true;
    }

    // If we have no input buffered, read from socket, store into m_buffer.
    // On failure, return.
    if (m_bufferAvail == 0 && !readInput()) {
      return false;
    }

    // Initialize the response
    auto response = xdebug_xml_node_init("response");
    addXmlns(*response);

    try {
      // Parse the command and store it as the last command
      auto cmd = parseCommand();
      if (m_lastCommand != nullptr) {
        delete m_lastCommand;
      }
      m_lastCommand = cmd;

      // Try to handle the command. Possibly send a response.
      should_continue = cmd->handle(*response);
      if (cmd->shouldRespond()) {
        sendMessage(*response);
      }
    } catch (const XDebugExn& exn) {
      addError(*response, exn.error);
      sendMessage(*response);
    }

    // Free the response node.
    xdebug_xml_node_dtor(response);
  } while (!should_continue);

  return true;
}