Ejemplo n.º 1
0
int
main(int argc, char *argv[])
{
    FILE *f;
    unsigned int currentLine = 0;
    unsigned int nextLine = 0;
    unsigned int i;
    char line[10000];

    Inputs settings = {NULL, NULL, 1, 0};

    /* could use the options library getopt  */
    processCmdArgs(argc, argv, &settings);

    f = settings.inputFile;

    if(settings.hasHeader) {
	fgets(line, sizeof(line)/sizeof(line[0]), f);
	currentLine++;
    }

    while( (nextLine = getNextRow(&settings) ) ) {
	unsigned int jump = nextLine - currentLine;
	for(i = 0; i < jump; i++, currentLine++)
	    fgets(line, sizeof(line)/sizeof(line[0]), f);
	printf("%s", line);
    }
//    fprintf(stderr, "ending at line %d\n", currentLine);
    return(0);
}
Ejemplo n.º 2
0
void CSVSettings::Frame::addWidget (QWidget *widget, int row, int column,
                                    int rowSpan, int columnSpan)
{
    if (row == -1)
        row = getNextRow();

    if (column == -1)
        column = getNextColumn();

    mLayout->addWidget (widget, row, column, rowSpan, columnSpan);
    //, Qt::AlignLeft | Qt::AlignTop);

    widget->setSizePolicy (QSizePolicy::Ignored, QSizePolicy::Ignored);
}
Ejemplo n.º 3
0
int nullify(
	double	*X,
	double	*V,
	int		augment,
	int		*rows,
	bool    *designFlag,
	int		N,
	int		k
	)
{
	int i;
	int newRow;
	int sizeT=N*k*sizeof(double);
	double scale;
	double tolerance=nullTol;

	memcpy((void*)V,(void*)X,sizeT);

	if (augment) {
		orthogAug(V,rows,augment,designFlag,N,k);
	}

	for (i=0;i<k-augment;i++) { 
		scale=getNextRow(V,N,k,designFlag,&newRow);
		if (scale<tolerance || newRow==-1)
			return(0); /* singular design. */
		if (i==0)
			tolerance=scale*nullTol;

		rows[i+augment]=newRow;
		designFlag[newRow]=true;

		if (i!=(k-1)) {
			orthog(V,V+newRow*k,designFlag,scale,N,k);
		}
	}

	return(1);
}
Ejemplo n.º 4
0
void RowBlock::getNextStoredOffset(__int64 & row, offset_t & offset)
{
    row = getNextRow();
    offset = startOffset + buffer.length();
}
void TimeSeries::processData(UDRInvocationInfo &info,
                             UDRPlanInfo &plan)
{
  InternalColumns internalCols(info);
  bool haveMoreRows = false;
  bool haveRowFromPreviousLoop = true; // will read one below

  // this will exit right away if there are no rows,
  // doing this make the logic below a bit simpler
  haveMoreRows = getNextRow(info);

  while (haveMoreRows)
    {
      bool inSamePartition = true;

      // read all rows of one partition,
      // plus the next row or end of data
      while (inSamePartition)
        {
          if (!haveRowFromPreviousLoop)
            {
              // try to read a new row
              if (getNextRow(info))
                {
                  // is this row still from the same partition?
                  if ((inSamePartition = internalCols.isSamePartition()) == false)
                    haveRowFromPreviousLoop = true;
                }
              else
                {
                  // we reached end-of-data, exit this loop
                  // and emit the last partition
                  haveMoreRows = false;
                  inSamePartition = false;
                }
            }
          else
            {
              // consume the row we read in the last iteration
              // or in the initialization code, this indicates
              // the start of a new partition

              // prepare for the next partition
              internalCols.initializePartition();
              haveRowFromPreviousLoop = false;
            }

          if (inSamePartition)
            {
              // remember all the columns of this row for
              // the computed time slice number
              internalCols.readInputCols();
            }
        } // read rows of one partition...

      // we read all rows from one partition (plus one more, maybe),
      // now emit the rows

      // prepare to emit all time slices for this partition
      internalCols.finalizePartition();

      int numTimeSlices = internalCols.getNumTimeSlices();

      // loop over time slices and emit rows
      for (int s=0; s<numTimeSlices; s++)
        {
          // generate an output record for one time slice of
          // one partition
          internalCols.setOutputCols(s);

          // emit a row for one time slice
          emitRow(info);
        }
    } // emitPartition
}