Exemple #1
0
//------------------------------------------------------------
// output()
//------------------------------------------------------------
int output(int	data, int size)
{
    if (listFlag)
        listObj(data, size);
    if (objFlag)
        outputObj(loc, data, size);
    return NORMAL;
}
Exemple #2
0
void
dcb(int size, char *label, char *op, int *errorPtr)
{
	int blockSize, blockVal, i;
	char *eval();
	char backRef;

	if (size == SHORT) {
		NEWERROR(*errorPtr, INV_SIZE_CODE);
		size = WORD;
	} else if (!size)
		size = WORD;
	/* Move location counter to a word boundary and fix the listing if doing
	   DCB.W or DCB.L (but not if doing DCB.B, so DCB.B's can be contiguous) */
	if ((size & (WORD | LONG)) && (loc & 1)) {
		loc++;
		listLoc();
	}
	/* Define the label attached to this directive, if any */
	if (*label)
		define(label, loc, pass2, errorPtr);
	/* Evaluate the size of the block (in bytes, words, or longwords) */
	op = eval(op, &blockSize, &backRef, errorPtr);
	if (*errorPtr < SEVERE && !backRef) {
		NEWERROR(*errorPtr, INV_FORWARD_REF);
		return;
	}
	if (*errorPtr > SEVERE)
		return;
	if (*op != ',') {
		NEWERROR(*errorPtr, SYNTAX);
		return;
	}
	if (blockSize < 0) {
		NEWERROR(*errorPtr, INV_LENGTH);
		return;
	}
	/* Evaluate the data to put in block */
	op = eval(++op, &blockVal, &backRef, errorPtr);
	if (*errorPtr < SEVERE) {
		if (!isspace(*op) && *op) {
			NEWERROR(*errorPtr, SYNTAX);
			return;
		}
		/* On pass 2, output the block of values directly
		   to the object file (without putting them in the listing) */
		if (pass2)
			for (i = 0; i < blockSize; i++) {
				outputObj(loc, blockVal, size);
				loc += size;
		} else
			loc += blockSize * size;
	}
}
Exemple #3
0
ICPWidget::ICPWidget(QWidget *parent) :
    QFrame(parent),
    ui(new Ui::ICPWidget)
{
    ui->setupUi(this);

    v.initCameraParameters();
    v.setBackgroundColor(1.0,1.0,1.0);
    v.addCoordinateSystem(0.3);
    v.registerPointPickingCallback<ICPWidget>(&ICPWidget::pick,*this,NULL);
    v.registerKeyboardCallback<ICPWidget>(&ICPWidget::key,*this,NULL);

    widget.SetRenderWindow(v.getRenderWindow());

    ui->frameView->layout()->addWidget(&widget);
    ui->tools->setCurrentIndex(0);

    QString dataInfo;
    Pipe::loadData(_FrameKeyList,dataInfo,Pipe::_FrameListKey);
    Pipe::loadData(_IdMapKeyList,dataInfo,Pipe::_IdMapListKey);
    frameCloud = FullPointCloud::Ptr(new FullPointCloud);
    segCloud = FullPointCloud::Ptr(new FullPointCloud);
    currentFrame = 0;
    currentState = PICK_FRAME;
    currentObjIndex = -1;

    connect(ui->nextFrame,SIGNAL(clicked()),this,SLOT(nextFrame()));
    connect(ui->lastFrame,SIGNAL(clicked()),this,SLOT(lastFrame()));
    connect(ui->loadFrame,SIGNAL(clicked()),this,SLOT(reLoadFrameWithView()));
    connect(ui->addObj,SIGNAL(clicked()),this,SLOT(addObj()));
    connect(ui->delObj,SIGNAL(clicked()),this,SLOT(delObj()));
    connect(ui->icpObj,SIGNAL(clicked()),this,SLOT(icpObj()));

    connect(ui->tools,SIGNAL(currentChanged(int)),this,SLOT(changeState(int)));
    connect(ui->outObj,SIGNAL(clicked()),this,SLOT(outputObj()));
    connect(ui->outFrame,SIGNAL(clicked()),this,SLOT(outputFrame()));
}
Exemple #4
0
int incbin(int size, char *label, char *fileName, int *errorPtr)
{
  char capLine[256];
  char *src, *dst;
  FILE *incFile;
  unsigned char dataByte;

  if (size) {                                   // if .size code specified
    NEWERROR(*errorPtr, INV_SIZE_CODE);         // error, invalid size code
    return NORMAL;
  }

  if (!*fileName) {
    NEWERROR(*errorPtr, FILE_ERROR);         // error, invalid syntax
    return NORMAL;
  }

  // Define the label attached to this include directive, if any
  if (*label)
    define(label, loc, pass2, true, errorPtr);

  strcap(capLine, fileName);

  // strip quotes from filename
  src = capLine;
  dst = capLine;
  while (*src) {
    if (*src != '\'' && *src != '\"')
      *dst++ = *src;
    src++;
  }

  // strip whitespace from end of filename
  dst--;
  while (dst > capLine && isspace(*dst))
    dst--;
  dst++;
  *dst = '\0';

  if (pass2 && listFlag) {   // if incbin directive should be listed
    listLine(line);
  }

  try {
    incFile = fopen(capLine, "rb");    // attempt to open incbin binary file
    if (!incFile) {                    // if ERROR opening file
      NEWERROR(*errorPtr, FILE_ERROR);     // error, invalid syntax
      return SEVERE;
    }

    // loop through every byte of incbin file
//    while(!feof(incFile)) {
//      fread(&dataByte, 1, 1, incFile);   // read 1 byte of data from file
    while(fread(&dataByte, 1, 1, incFile) && !feof(incFile)) {
      // On pass 2, output the block of values directly
      // to the object and binary files (without putting them in the listing)
      if (pass2) {
        if (objFlag)
          outputObj(loc, dataByte, BYTE_SIZE);
      }
      loc++;            // increment location counter once for each byte in file
    }
    fclose(incFile);

    if (pass2 && listFlag) {
      skipList = true;      // don't list INCBIN statement again
    }

  }
  catch( ... ) {
    sprintf(buffer, "ERROR: An exception occurred in routine 'incbin'. \n");
    printError(NULL, EXCEPTION, 0);
    return NULL;
  }
  return NORMAL;
}