コード例 #1
0
ファイル: gdmlwriter.cpp プロジェクト: RandyJH/step-gdml
void GdmlWriter::writeExtro()
{
    writeWorldBox();
    writeStructures();
    writeSetup();
    _("</gdml>\n");
}
コード例 #2
0
ファイル: serialui.c プロジェクト: BackupTheBerlios/osifc-svn
void serialUI(void) {


	if (commandRetrived == 1) {

		if (commandType == 0) {
			checkCmd();
			commandRetrived = 0;
		}

		if (commandType == 1) {
			if (setCmd == 0) {								//this is to send in data. the data is not yet flashed
				led_switch(2);								//data can be send in at any time also at flight time
															//it will be used with the next cycle
				print_uart0("FCm0;storing setting  %d;00#",setupCache.settingNum);
				setToInSettings();							//fill the runtime struct with the settings
				setTempToInSetting(setupCache.settingNum);	//save settings to ram cache
				commandRetrived = 0;
			}

			if (setCmd == 1) {
				print_uart0("FCm0;flashing settings;00#");	//here we write all the settings from ram to flash
				enginesOff(); 								//this is to save some of the flashing cycles.
				led_switch(3);								//we could flash with any retrieved setting but that
				engineStatus = 0;							//just helps abusing the flash cycles so its a manual
															//step to really save to flash
				writeSetup();
				ADCStandstillValues();						//also we reset the ADCOffset
				commandRetrived = 0;
				initFCRuntime();
				ledTest();
			}
		}

		if (commandType == 2) {
			updateAcdRate();
			commandRetrived = 0;
		}
		if (commandType == 3) {
			retriveSetting();
			printSettings();
			commandRetrived = 0;
		}

		if (commandType == 4) {
			if (I2CcmdType == I2CMODE_WRITEADDRESS){
				if (updateYGE == 0) {
					I2C0Mode = I2CMODE_WRITEADDRESS;
					I2C0State = 0;
					updateYGE = 1;
					I2C0Start();
				}
			}

			if (I2CcmdType == I2CMODE_STARTUP_TARGET){
				if (updateYGE == 0) {
					I2C0Stop();
					I2C0Mode = I2CMODE_WRITEADDRESS;
					I2C0State = 0;
					updateYGE = 1;
					I2C0Start();
				}
			}
			commandRetrived = 0;
		}

	}









}
コード例 #3
0
FrameWrite::FrameWrite( QMap<int,VIFrame> li , const QString File_APNG_Format ) 
  : file(File_APNG_Format),opening(true),MainFrameCache(false)
{
    FILE* newImage;
    bool globalsSet = false;
    png_structp png_ptr_read;
    png_infop info_ptr_read;
    png_structp png_ptr_write;
    png_infop info_ptr_write;
    png_bytep* row_pointers;
    png_uint_32 bytesPerRow;
    int framenr = -1;
    
    if (li.size() > 0) {
    newImage = fopen(QFile::encodeName(file), "wb"); 
    writeSetup(&newImage, &png_ptr_write, &info_ptr_write);
    if(setjmp(png_ptr_write->jmpbuf))
        fatalError("something didn't work while writing");
    
        QMapIterator<int,VIFrame> i(li);
         while (i.hasNext()) {
                i.next();
                framenr++;
                APNGwrittelStream myqtchunk(this);
                VIFrame record = i.value();
                QImage imageios = record.exportpic();
                imageios.save(myqtchunk.device(),"PNG",1); // writes image into ba in PNG format
                myqtchunk.start();  /* block to begin pointer */
                qDebug() << "### writing frame from " << framenr << " from " << li.size();
                qDebug() << "### rect " << record.maxframe;
                qDebug() << "### rect "  << imageios.width() << "x" << imageios.height();
             
                PrepareStruct( &png_ptr_read, &info_ptr_read);
                png_set_read_fn(png_ptr_read,&myqtchunk,EncoderReaderCallback);
             
                  if(setjmp(png_ptr_read->jmpbuf))
                     fatalError("something didn't work while reading");
             
                png_read_info(png_ptr_read, info_ptr_read);
                  
                     const uint height = imageios.height();
                  
                     png_bytep *row_pointers = new png_bytep[height];
                        for (uint i = 0; i < height; ++i)  {
                          row_pointers[i] = (png_bytep)imageios.scanLine(i);
                        }
                  
                  
                      
             
               if(!globalsSet)
                {
                    qDebug() << "### first frame header ";
                    writeSetup2(png_ptr_write, info_ptr_write, png_ptr_read, info_ptr_read);
                    png_set_acTL(png_ptr_write, info_ptr_write, li.size(), 0);
                    png_write_info(png_ptr_write, info_ptr_write);
                    
                      
                    
                    globalsSet = true;
                }
                
                png_read_image(png_ptr_read,row_pointers);
                /* all other frame ..... */
                
                 png_write_frame_head(png_ptr_write, info_ptr_write, row_pointers, 
                                 imageios.width(),  /* width */
                                 imageios.height(), /* height */
                                 0,       /* x offset */
                                 0,       /* y offset */
                                 record.play, 1000,    /* delay numerator and denominator */
                                 PNG_DISPOSE_OP_NONE, /* dispose */
                                 0    /* blend */
                                );
             
             
                png_write_image(png_ptr_write, row_pointers);
                png_write_frame_tail(png_ptr_write, info_ptr_write);
                png_destroy_read_struct(&png_ptr_read, &info_ptr_read, NULL);
                myqtchunk.~APNGwrittelStream();
         }
    
       
           
         
    png_write_end(png_ptr_write, NULL);
    png_destroy_write_struct(&png_ptr_write, &info_ptr_write);
    fclose(newImage);
    printf("all done\n");
        
    }
}
コード例 #4
0
ファイル: geant.C プロジェクト: krafczyk/AMS
void gams::UGINIT(int argc,  char * argv[]){
  float zero=0;
  timest_(zero);
  cout.sync_with_stdio();   
  GINIT();
  new AMSJob();
  AMSJob::gethead()->data();
  GCTLIT.ITCKOV=1;
  GCPHYS.IRAYL=1;
  integer mone=-1;
  GFFGO();
   AMSJob::gethead()->udata();
 
#ifdef __CORBA__
  AMSJob::gethead()->add( new AMSProducer(argc,argv,PRODFFKEY.Debug));
  AMSProducer::gethead()->sendid();
  AMSJob::gethead()->setjobtype(AMSJob::Production);  
#endif


  // Geant initialization

  GZINIT();
  GPART();
  GPIONS(4);
  int itrt=4;
  gstran_(itrt,CCFFKEY.StrCharge,CCFFKEY.StrMass);

#ifdef __DB__
   initDB();
   lms = &dbout;
   readSetup();
   if ((AMSFFKEY.Read%2) == 1) lms -> CheckConstants();
#else
   AMSgmat::amsmat();
   AMSgtmed::amstmed();
   AMSgvolume::amsgeom();
   
// GRFILE(1,"geomstr.dat","Q");
// GROUT("VOLU",1," ");
// GREND(1);
 
#endif
 //GRFILE(1,"geomstr.dat","N");
 //GROUT("VOLU",1," ");
 //GREND(1);

  AMSJob::map();

  AMSJob::gethead()->init();
#ifdef __CORBA__
    AMSTimeID * phead=AMSJob::gethead()->gettimestructure();
    AMSTimeID * down=(AMSTimeID *)phead->down();
    int nb=down->GetNbytes();
   AMSProducer::gethead()->getRunEventInfo();
#endif
  if(!AMSJob::gethead()->isProduction())AMSJob::gethead()->uhinit();
//  AMSJob::gethead()->urinit();
#ifndef __BATCH__
#ifdef __G4AMS__
if(MISCFFKEY.G3On)
#endif
GDINIT();
#endif

#ifdef __DB__
  if ((AMSFFKEY.Read%2) == 1) dbout.CheckCommons();
  writeSetup();
  //  int n = AMSJob::gethead()->FillTDVTable();
  //  ooStatus rstatus = dbout.FillTDV(n);
  //  if (rstatus != oocSuccess) cerr<<"uginit_ -W- FillTDV"<<endl;
  AMSJob::gethead() -> seteventRtype(eventR);
#endif
#ifdef __G4AMS__
if(MISCFFKEY.G4On)g4ams::G4INIT();
#endif
GPHYSI();
AMSJob::map(1);
}
コード例 #5
0
ファイル: pbmtoescp2.c プロジェクト: gguillotte/netpbm-code
int
main(int argc, const char * argv[]) {

    FILE * ifP;
    int rows, cols;
    int format;
    unsigned int row;
    unsigned int idx;
    unsigned int outColByteCt;
    unsigned int stripeByteCt;
    unsigned int hres, vres;
    unsigned char * inBuff;
    unsigned char * bitrow[256];
    unsigned char * compressedData;
    struct CmdlineInfo cmdline;
    
    pm_proginit(&argc, argv);

    parseCommandLine(argc, argv, &cmdline);

    ifP = pm_openr(cmdline.inputFileName);

    pbm_readpbminit(ifP, &cols, &rows, &format);

    if (cols / 256 > 127)  /* Limit in official Epson manual */
        pm_error("Image width is too large");

    outColByteCt = pbm_packed_bytes(cols);
    stripeByteCt = cmdline.stripeHeight * outColByteCt;

    MALLOCARRAY(inBuff, stripeByteCt);
    if (inBuff == NULL)
      pm_error("Out of memory trying to create input buffer of %u bytes",
               stripeByteCt);

    if (cmdline.compress != 0)
        pm_rlenc_allocoutbuf(&compressedData, stripeByteCt, PM_RLE_PACKBITS);
    else
        compressedData = NULL;

    for (idx = 0; idx <= cmdline.stripeHeight; ++idx)
        bitrow[idx]= &inBuff[idx * outColByteCt];

    hres = vres = 3600 / cmdline.resolution;
        /* Possible values for hres, vres: 20, 10, 5 */

    if (!cmdline.raw)
        writeSetup(hres);

    /* Write out raster stripes */

    for (row = 0; row < rows; row += cmdline.stripeHeight ) {
        unsigned int const rowsThisStripe =
            MIN(rows - row, cmdline.stripeHeight);
        unsigned int const outCols = outColByteCt * 8;

        if (rowsThisStripe > 0) {
            unsigned int idx;

            printf("%c%c%c%c%c%c%c%c", esc, '.', cmdline.compress, vres, hres,
                   cmdline.stripeHeight, outCols % 256, outCols / 256);

            /* Read pbm rows, each padded to full byte */

            for (idx = 0; idx < rowsThisStripe; ++idx) {
                pbm_readpbmrow_packed (ifP, bitrow[idx], cols, format);
                pbm_cleanrowend_packed(bitrow[idx], cols);
            }

            /* If at bottom pad with empty rows up to stripe height */
            if (rowsThisStripe < cmdline.stripeHeight )
                memset(bitrow[rowsThisStripe], 0,
                       (cmdline.stripeHeight - rowsThisStripe) * outColByteCt);

            /* Write raster data */
            if (cmdline.compress != 0) {  /* compressed */
                size_t compressedDataCt;

                pm_rlenc_compressbyte(inBuff, compressedData, PM_RLE_PACKBITS,
                                      stripeByteCt, &compressedDataCt);
                fwrite(compressedData, compressedDataCt, 1, stdout);
            } else                        /* uncompressed */
                fwrite(inBuff, stripeByteCt, 1, stdout);

            /* Emit newline to print the stripe */
            putchar('\n');
        }
    }

    free(inBuff); 
    free(compressedData);
    pm_close(ifP);

    /* Form feed */
    if (cmdline.formfeed)
        putchar('\f');

    if (!cmdline.raw) {
        /* Reset printer. a*/
        printf("%c%c", esc, '@');
    }

    return 0;
}