Ejemplo n.º 1
0
int main( int argc, char const ** argv )
{

    whio_stream * wout = whio_stream_for_filename( "/dev/stdout", "w+" );
    assert( wout );

    std::ostringstream sout;
    whio::ostreambuf_whio os( sout, wout, true );
    sout << "Hi, world!\n";
    wout->api->flush(wout);

    whio_stream * win = whio_stream_for_filename( "/dev/stdin", "r" );
    assert( win );
    {
        std::istringstream din;
        whio::istreambuf_whio os( din, win, true );
        MARKER("Enter an INTEGER and tap ENTER, then CTRL-D: ");
        fflush(stdout);
        int x = -1;
        din >> x;
        MARKER("read int=%d\n",x);
    }

    return 0;
}
Ejemplo n.º 2
0
/*
This function must only be called after startNewRigidBody has been called.
*/
bool vrpn_Tracker_PhaseSpace::addRigidMarker(int sensor, int led_id, float x, float y, float z)
{
#ifdef DEBUG
  printf("%s %d %d %f %f %f\n", __PRETTY_FUNCTION__, sensor, led_id, x, y, z);
#endif

  if(!owlRunning) return false;
  if(slave) return false;

  if(numRigids == 0) {
    fprintf(stderr, "Error: Attempting to add rigid body marker with no rigid body defined.");
    return false;
  }
  if(numMarkers >= VRPN_PHASESPACE_MAXMARKERS) {
    fprintf(stderr, "Error: Maximum markers (%d) exceeded.\n", VRPN_PHASESPACE_MAXMARKERS);
    return false;
  }

  float xyz[3];
  xyz[0] = x;
  xyz[1] = y;
  xyz[2] = z;

  owlMarkeri(MARKER(numRigids,sensor),OWL_SET_LED,led_id);
  owlMarkerfv(MARKER(numRigids,sensor),OWL_SET_POSITION,&xyz[0]);

  if(!owlGetStatus())
    return false;

  numMarkers++;
  return true;
}
Ejemplo n.º 3
0
int ociw_res_finalize(db_wrap_result * self)
{
	RES_DECL(DB_WRAP_E_BAD_ARG);
	/*
	  MARKER("Freeing result handle @%p/%p/@%p\n",(void const *)self, (void const *)wres, (void const *)wres->result);
	*/
	if (wres->st)
	{
		OCI_StatementFree(wres->st);
		wres->st = NULL;
		/*
		  NONE of the OCI demo code shows us how to free an
		  OCI_Resultset object (in fact, the demo code mostly doesn't
		  clean up at all), but the docs state that cleaning up the
		  statement also cleans the result set.
		 */
		wres->result = NULL;
	}
	else if (wres->result)
	{
		MARKER("POSSIBLE ERROR??? Result object but not Statement?");
	}
	free(self->impl.data);
	*self = ociw_res_empty;
	free(self);
	return 0;
}
Ejemplo n.º 4
0
static Bool
I810_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode)
{
   int index = pScrn->pScreen->myNum;
   I810Ptr pI810 = I810PTR(pScrn);

   MARKER();

   if (!pMode) {			/* restore the original mode */
      DPRINTF(PFX, "Restoring original mode (from DGA mode)\n");
      if (pI810->DGAactive) {
	 pScrn->currentMode = I810SavedDGAModes[index];
	 pScrn->SwitchMode(index, pScrn->currentMode, 0);
	 pScrn->AdjustFrame(index, 0, 0, 0);
	 pI810->DGAactive = FALSE;
      }
   } else {
      if (!pI810->DGAactive) {
	 DPRINTF(PFX, "Setting DGA mode\n");
	 I810SavedDGAModes[index] = pScrn->currentMode;
	 pI810->DGAactive = TRUE;
      }

      pScrn->SwitchMode(index, pMode->mode, 0);
   }

   return TRUE;
}
Ejemplo n.º 5
0
static int
I810_GetViewport(ScrnInfoPtr pScrn)
{
   I810Ptr pI810 = I810PTR(pScrn);

   MARKER();

   return pI810->DGAViewportStatus;
}
Ejemplo n.º 6
0
static void
I810_BlitTransRect(ScrnInfoPtr pScrn,
		   int srcx, int srcy,
		   int w, int h, int dstx, int dsty, unsigned long color)
{

   MARKER();

   /* this one should be separate since the XAA function would
    * prohibit usage of ~0 as the key */
}
Ejemplo n.º 7
0
static void
I810_Sync(ScrnInfoPtr pScrn)
{
   I810Ptr pI810 = I810PTR(pScrn);

   MARKER();

   if (pI810->AccelInfoRec) {
      (*pI810->AccelInfoRec->Sync) (pScrn);
   }
}
Ejemplo n.º 8
0
static void
I810_FillRect(ScrnInfoPtr pScrn,
	      int x, int y, int w, int h, unsigned long color)
{
   I810Ptr pI810 = I810PTR(pScrn);

   MARKER();

   if (pI810->AccelInfoRec) {
      (*pI810->AccelInfoRec->SetupForSolidFill) (pScrn, color, GXcopy, ~0);
      (*pI810->AccelInfoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
      SET_SYNC_FLAG(pI810->AccelInfoRec);
   }
}
Ejemplo n.º 9
0
static void
I810_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags)
{
   I810Ptr pI810 = I810PTR(pScrn);
   vgaHWPtr hwp = VGAHWPTR(pScrn);

   MARKER();

   pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags);

   /* wait for retrace */
   while ((hwp->readST01(hwp) & 0x08)) ;
   while (!(hwp->readST01(hwp) & 0x08)) ;

   pI810->DGAViewportStatus = 0;
}
Ejemplo n.º 10
0
static void
I810_BlitRect(ScrnInfoPtr pScrn,
	      int srcx, int srcy, int w, int h, int dstx, int dsty)
{
   I810Ptr pI810 = I810PTR(pScrn);

   MARKER();

   if (pI810->AccelInfoRec) {
      int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
      int ydir = (srcy < dsty) ? -1 : 1;

      (*pI810->AccelInfoRec->SetupForScreenToScreenCopy) (pScrn, xdir, ydir,
							  GXcopy, ~0, -1);
      (*pI810->AccelInfoRec->SubsequentScreenToScreenCopy) (pScrn, srcx, srcy,
							    dstx, dsty, w, h);
      SET_SYNC_FLAG(pI810->AccelInfoRec);
   }
}
Ejemplo n.º 11
0
static Bool
I810_OpenFramebuffer(ScrnInfoPtr pScrn,
		     char **name,
		     unsigned char **mem, int *size, int *offset, int *flags)
{
   I810Ptr pI810 = I810PTR(pScrn);

   MARKER();

   *name = NULL;			/* no special device */
   *mem = (unsigned char *)pI810->LinearAddr;
   *size = pI810->FbMapSize;
   *offset = 0;
   *flags = DGA_NEED_ROOT;

   DPRINTF(PFX,
	   " mem == 0x%.8x (pI810->LinearAddr)\n"
	   "size == %lu (pI810->FbMapSize)\n", *mem, *size);

   return TRUE;
}
Ejemplo n.º 12
0
bool vrpn_Tracker_PhaseSpace::addMarker(int sensor,int led_id)
{
#ifdef DEBUG
  printf("%s %d %d\n", __PRETTY_FUNCTION__, sensor, led_id);
#endif

  if(!owlRunning) return false;
  if(slave) return false;

  if(numMarkers >= VRPN_PHASESPACE_MAXMARKERS) {
    fprintf(stderr, "Error: Maximum markers (%d) exceeded.\n", VRPN_PHASESPACE_MAXMARKERS);
    return false;
  }

  owlMarkeri(MARKER(0,sensor),OWL_SET_LED,led_id);

  if(!owlGetStatus())
    return false;

  numMarkers++;
  return true;
}
void PhasespaceCore::initializeCommunication() {
  ROS_INFO_STREAM("[PhaseSpace] Initalizing the PhaseSpace...");

  // opens a socket and configures the communication channels to pass data between the OWL server and client; this
  // function will block until there is a connection or an error; returns the passed flags if OK
  if (owlInit(server_ip_.c_str(), init_flags_) < 0) {
    ROS_FATAL_STREAM("[PhaseSpace] Can't initialize the communication with OWL server: " << owlGetError());
    throw excp_;
  }

  // initializes a point tracker:
  //  - OWL_CREATE: tells the system to create a tracker
  //  - OWL_POINT_TRACKER: specifies the creation of a point tracker
  owlTrackeri(tracker_, OWL_CREATE, OWL_POINT_TRACKER);

  // creates the marker structures, each with the proper id:
  //  - MARKER Macro: builds a marker id out of a tracker id and marker index
  //  - OWL_SET_LED: the following 'i' is an integer representing the LED ID of the marker
  for (int i=0; i<init_marker_count_; i++) {
    owlMarkeri(MARKER(tracker_, i), OWL_SET_LED, i);
  }

  // enables the tracker (it has to be disabled when the markers have to be added)
  owlTracker(tracker_, OWL_ENABLE);

  // checking the status will block until all commands are processed and any errors are sent to the client
  if (!owlGetStatus()) {
    ROS_FATAL_STREAM("[PhaseSpace] Initialization generic error: " << owlGetError());
    throw excp_;
  }

  // sets frequency with default maximum value (OWL_MAX_FREQUENCY = 480 Hz):
  //  - OWL_FREQUENCY: specifies the rate at which the server streams data
  owlSetFloat(OWL_FREQUENCY, OWL_MAX_FREQUENCY);
  // enables the streaming of data
  owlSetInteger(OWL_STREAMING, OWL_ENABLE);
}
Ejemplo n.º 14
0
CGridControl::CGridControl()
{
	MARKER("CGridControl::CGridControl()");
}
Ejemplo n.º 15
0
CDialog::~CDialog()
{
	MARKER("CDialog::~CDialog()");
}
Ejemplo n.º 16
0
void CDialog::OnLifetimeEvent(EDialogLifetimeEvent event)
{
	MARKER("CDialog::OnLifetimeEvent()");
	return;
}
Ejemplo n.º 17
0
CDialog::CDialog(): m_bChildrenInited(false)
{
	MARKER("CDialog::CDialog()");
}
Ejemplo n.º 18
0
Bool
I810DGAInit(ScreenPtr pScreen)
{
   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
   I810Ptr pI810 = I810PTR(pScrn);
   DGAModePtr modes = NULL, newmodes = NULL, currentMode;
   DisplayModePtr pMode, firstMode;
   int Bpp = pScrn->bitsPerPixel >> 3;
   int num = 0;

   MARKER();

   pMode = firstMode = pScrn->modes;

   while (pMode) {

      newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec));

      if (!newmodes) {
	 xfree(modes);
	 return FALSE;
      }
      modes = newmodes;

      currentMode = modes + num;
      num++;

      currentMode->mode = pMode;
      currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
      if (!pI810->noAccel)
	 currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
      if (pMode->Flags & V_DBLSCAN)
	 currentMode->flags |= DGA_DOUBLESCAN;
      if (pMode->Flags & V_INTERLACE)
	 currentMode->flags |= DGA_INTERLACED;
      currentMode->byteOrder = pScrn->imageByteOrder;
      currentMode->depth = pScrn->depth;
      currentMode->bitsPerPixel = pScrn->bitsPerPixel;
      currentMode->red_mask = pScrn->mask.red;
      currentMode->green_mask = pScrn->mask.green;
      currentMode->blue_mask = pScrn->mask.blue;
      currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor;
      currentMode->viewportWidth = pMode->HDisplay;
      currentMode->viewportHeight = pMode->VDisplay;
      currentMode->xViewportStep = (Bpp == 3) ? 2 : 1;
      currentMode->yViewportStep = 1;
      currentMode->viewportFlags = DGA_FLIP_RETRACE;
      currentMode->offset = 0;
      currentMode->address = pI810->FbBase;

      currentMode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 3) & ~3L;
      currentMode->imageWidth = pI810->FbMemBox.x2;
      currentMode->imageHeight = pI810->FbMemBox.y2;
      currentMode->pixmapWidth = currentMode->imageWidth;
      currentMode->pixmapHeight = currentMode->imageHeight;
      currentMode->maxViewportX = currentMode->imageWidth -
	    currentMode->viewportWidth;
      /* this might need to get clamped to some maximum */
      currentMode->maxViewportY = currentMode->imageHeight -
	    currentMode->viewportHeight;

      pMode = pMode->next;
      if (pMode == firstMode)
	 break;
   }

   pI810->numDGAModes = num;
   pI810->DGAModes = modes;

   return DGAInit(pScreen, &I810DGAFuncs, modes, num);
}