Ejemplo n.º 1
0
/*
 * find() is the original 4.3bsd code that uses the stdin stream.  It searches
 * for strings through a count of cnt bytes.
 */
static
void
find(
uint32_t cnt,
struct flags *flags)
{
    static char buf[BUFSIZ];
    register char *cp;
    register int c, cc;

	cp = buf, cc = 0;
	for (; cnt != 0; cnt--) {
		c = getc(stdin);
		if (c == '\n' || dirt(c) || cnt == 0) {
			if (cp > buf && cp[-1] == '\n')
				--cp;
			*cp++ = 0;
			if (cp > &buf[flags->minimum_length]) {
				if (flags->print_offsets == TRUE){
					printf(flags->offset_format,
					       ftell(stdin) - cc - 1);
					printf(" ");
				}
				printf("%s\n", buf);
			}
			cp = buf, cc = 0;
		} else {
			if (cp < &buf[sizeof buf - 2])
				*cp++ = c;
			cc++;
		}
		if (ferror(stdin) || feof(stdin))
			break;
	}
}
Ejemplo n.º 2
0
/*
 * ofile_find is used by ofile_processor() to find strings in part of a ofile
 * that is memory at addr for size.  offset is the offset in the file to this
 * data for use when printing offsets.
 */
static
void
ofile_find(
char *addr,
uint32_t size,
uint32_t offset,
struct flags *flags)
{
    uint32_t i, string_length;
    char c, *string;

	string = addr;
	string_length = 0;
	for(i = 0; i < size; i++){
	    c = addr[i];
	    if(c == '\n' || dirt(c) || i == size - 1){
		if(string_length >= flags->minimum_length){
		    if(flags->print_offsets){
			printf(flags->offset_format, offset + (string - addr));
			printf(" ");
		    }
		    if(i == size - 1 && c != '\n')
			printf("%.*s\n", (int)string_length + 1, string);
		    else
			printf("%.*s\n", (int)string_length, string);
		}
		string = addr + i + 1;
		string_length = 0;
	    }
	    else{
		string_length++;
	    }
	}
}
Ejemplo n.º 3
0
void doEventsQQ(const Int_t nevents=999,
              const Char_t **fileList)
{

  // Dynamically link needed shared libs
  gSystem->Load("St_base");
  gSystem->Load("StChain");

  gSystem->Load("libgen_Tables");
  gSystem->Load("libsim_Tables");
  gSystem->Load("libglobal_Tables");

  gSystem->Load("StUtilities");
  gSystem->Load("StIOMaker");
  gSystem->Load("StarClassLibrary");
  gSystem->Load("StarMagField");
  gSystem->Load("StMagF");
  gSystem->Load("StEvent");
  gSystem->Load("StDetectorDbMaker");
  gSystem->Load("StTpcDb");
  gSystem->Load("StEventMaker");
  gSystem->Load("St_geom_Maker");
  gSystem->Load("StEventDisplayMaker");


  // Handling depends on whether file is a ROOT file or XDF file

  chain  = new StChain("StChain");

  StFile *setFiles= new StFile();

  for (int ifil=0; fileList[ifil]; ifil++)
  { setFiles->AddFile(fileList[ifil]);}
  
  St_geom_Maker *geom = new St_geom_Maker; // this maker open its own TFile !!!
  StIOMaker *IOMk     = new StIOMaker("IO","r",setFiles,"bfcTree");
  IOMk->SetDebug();

// 		Maker to read events from file or database into StEvent
  StEventMaker *readerMaker =  new StEventMaker ("events","title");
// 		Sample analysis maker
//  StAnalysisMaker *analysisMaker = new  StAnalysisMaker("analysis");
  disp      = new StEventDisplayMaker;
  disp->SetDebug();
  // Create an user's custom filter for "Tracks" 
  St_TLA_EventFilter *trackFilter = new St_TLA_EventFilter();
  disp->SetFilter(trackFilter,StEventDisplayMaker::kTrack);
  

  // Initialize chain
  Int_t iInit = chain->Init();
  if (iInit) chain->Fatal(iInit,"on init");
  chain->PrintInfo();
//  chain->MakeDoc();

  // Event loop
  int istat;
  for (Int_t i=1; i<=nevents; i++) {
    cout << "============================ Event " << i << " start" << endl;
    chain->Clear();
    istat = chain->Make(i);
    if (istat) {
      cout << "Last event processed. Status = " << istat << endl;
      chain->Clear();
      break;
    }
    St_DataSet *set = chain->DataSet("dst");
    if (set)  {
      St_DataSetIter dirt(set);
      dirt.Du();
    }
    cout << "============================ Event " << i << " finish" << endl;
  }

   gROOT->LoadMacro("PadControlPanel.C");
}
Ejemplo n.º 4
0
void GameDisplay::setLevel(int i)//sets up the grid based on level
{
    QPen grid=QPen(Qt::black);//
    QBrush dirt(QColor(102,51,0));// handles the colors of the grid
    QBrush grass(QColor(0,153,0));//
    QBrush lawnmower(QColor(160,160,160));//
    for(int row=0;row<500;row+=100)
    {
        scene()->addRect(0,row,90,100,grid,lawnmower);

    }
   switch(i)
   {
   case 1://sets 1 row of grass, rest is dirt
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,0,90,100,grid,dirt);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,100,90,100,grid,dirt);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,200,90,100,grid,grass);
       }

       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,300,90,100,grid,dirt);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,400,90,100,grid,dirt);
       }
       l = new Lawnmower(0,200);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       break;
   case 3://sets middle 3 rows of grass, rest is dirt
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,0,90,100,grid,dirt);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,100,90,100,grid,grass);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,200,90,100,grid,grass);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,300,90,100,grid,grass);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,400,90,100,grid,dirt);
       }
       l = new Lawnmower(0,100);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       l = new Lawnmower(0,200);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       l = new Lawnmower(0,300);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       break;
   case 5://sets 5 rows of grass
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,0,90,100,grid,grass);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,100,90,100,grid,grass);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,200,90,100,grid,grass);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,300,90,100,grid,grass);
       }
       for(int column=90;column<900;column+=90)
       {
           scene()->addRect(column,400,90,100,grid,grass);
       }
       l = new Lawnmower(0,0);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       l = new Lawnmower(0,100);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       l = new Lawnmower(0,200);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       l = new Lawnmower(0,300);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       l = new Lawnmower(0,400);
       lawnmowerVector.push_back(l);
       scene()->addItem(l);
       break;
   }
   setGridFromLevel();
}