当前位置: 首页>>代码示例>>C++>>正文


C++ PrintDebug函数代码示例

本文整理汇总了C++中PrintDebug函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintDebug函数的具体用法?C++ PrintDebug怎么用?C++ PrintDebug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PrintDebug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CalculatePositionForCenter

/**
  Calculates the x and y coordinates so that the given image
  would be displayed in screen center at the current resolution.
  Image width and height are given explicitly to allow for arbitrary
  calculations useful for sprites.

  @param[in] ImageWidth   Image width.
  @param[in] ImageHeight  Image height.
  @param[out] PositionX   Screen X coordinate of the top left corner
                          of the centered image.
  @param[out] PositionX   Screen Y coordinate of the top left corner
                          of the centered image.

  @retval EFI_SUCCESS     Screen center values were successfully
                          calculated for the current resolution
						  and specified image.
  @retval other           Either no graphics adapter was found,
                          the image was too big to fit on the
						  screen at current resolution or some
						  other problem was encountered.
  
**/
EFI_STATUS
CalculatePositionForCenter(
	IN	UINTN	ImageWidth,
	IN	UINTN	ImageHeight,
	OUT	UINTN	*PositionX,
	OUT	UINTN	*PositionY)
{
	if (EFI_ERROR(EnsureDisplayAvailable())) {
		PrintDebug(L"No display adapters found, unable to calculate centered position\n");
		return EFI_DEVICE_ERROR;
	}

	if (ImageWidth == 0 || ImageHeight == 0 
		|| ImageWidth > DisplayInfo.HorizontalResolution
		|| ImageHeight > DisplayInfo.VerticalResolution) {
		PrintDebug(L"Wrong image size (%ux%u) for this screen resolution (%ux%u)\n", 
			ImageWidth, ImageHeight, DisplayInfo.HorizontalResolution, DisplayInfo.VerticalResolution);
		return EFI_INVALID_PARAMETER;
	}

	*PositionX = (DisplayInfo.HorizontalResolution / 2) - (ImageWidth / 2);
	*PositionY = (DisplayInfo.VerticalResolution / 2) - (ImageHeight / 2);

	if (*PositionX + ImageWidth > DisplayInfo.HorizontalResolution)
		*PositionX = DisplayInfo.HorizontalResolution - ImageWidth;
	if (*PositionY + ImageHeight > DisplayInfo.VerticalResolution)
		*PositionY = DisplayInfo.VerticalResolution - ImageHeight;

	//PrintDebug(L"Top left corner position for centered image: %u,%u\n", *PositionX, *PositionY);

	return EFI_SUCCESS;
}
开发者ID:vista980622,项目名称:VgaShim,代码行数:54,代码来源:Display.c

示例2: makeReservation

static int makeReservation(MultiTrainDriver* me, int stoppingDistance) {
  if (me->tailMode) {
    PrintDebug(me->ui, "Cannot make reservation in tail mode");
    return RESERVE_SUCESS;
  } else if (!me->reserveTrackMode) {
    PrintDebug(me->ui, "No reservation mode");
    return RESERVE_SUCESS;
  }
  int isStationary = me->stoppedCount == me->numTrainInGroup;
  TrackLandmark sensors[MAX_TRAIN_IN_GROUP * 10];
  int sensorIndex = 0;
  // bad merging code here
  for (int i = 0; i < me->numTrainInGroup; i++) {
    int numSensor = isStationary ? 1 : me->numSensorToReserve[i];
    for (int j = 0; j < numSensor; j++) {
      int isInQueue = 0;
      for (int k = 0; k < sensorIndex; k++) {
        if (sensors[k].type == me->sensorToReserve[i][j].type &&
            sensors[k].num1 == me->sensorToReserve[i][j].num1 &&
            sensors[k].num2 == me->sensorToReserve[i][j].num2) {
          isInQueue = 1;
          break;
        }
      }
      if (!isInQueue) {
        sensors[sensorIndex++] = me->sensorToReserve[i][j];
      }
    }
  }

  ReleaseOldAndReserveNewTrackMsg qMsg;
  qMsg.type = RELEASE_OLD_N_RESERVE_NEW;
  qMsg.trainNum = me->trainNum;
  qMsg.stoppingDistance = isStationary ? 1 : stoppingDistance;
  qMsg.lastSensor = sensors[0];

  //TrainDebug(me, "Reserving track");
  qMsg.numPredSensor = sensorIndex - 1;
  for (int i = 1; i < sensorIndex; i++) {
    qMsg.predSensor[i-1] = sensors[i];
    //printLandmark(me, &qMsg.predSensor[i-1]);
  }

  int previousLandmarkState = me->reserveFailedLandmark.type;
  // reserveFailedlandmark is not really being used right now
  int len = Send(
      me->trackManager,
      (char*)&qMsg, sizeof(ReleaseOldAndReserveNewTrackMsg),
      (char*)&(me->reserveFailedLandmark), sizeof(TrackLandmark));
  if (len > 0) {
    printLandmark(me, &me->reserveFailedLandmark);
    return RESERVE_FAIL;
  } else if (!isStationary &&
      previousLandmarkState != LANDMARK_BAD &&
      me->reserveFailedLandmark.type != LANDMARK_BAD){
    //TrainDebug(me, "Got landmark bad.");
    me->reserveFailedLandmark.type = LANDMARK_BAD;
  }
  return RESERVE_SUCESS;
}
开发者ID:ShaoYuZhang,项目名称:choochoo,代码行数:60,代码来源:MultiTrainDriver.c

示例3: PrintVideoInfo

/**
  Prints important information about the currently running video
  mode. Initializes adapters if they have not yet been detected.

**/
VOID
PrintVideoInfo()
{
	UINT32									MaxMode;
	UINT32									i;
	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION	*ModeInfo;
	UINTN									SizeOfInfo;
	EFI_STATUS								Status;

	if (EFI_ERROR(EnsureDisplayAvailable())) {
		PrintDebug(L"No display adapters found, unable to print display information\n");
		return;
	}

	PrintDebug(L"Current mode:\n");
	PrintDebug(L"  HorizontalResolution = %u\n", DisplayInfo.HorizontalResolution);
	PrintDebug(L"  VerticalResolution = %u\n", DisplayInfo.VerticalResolution);
	PrintDebug(L"  PixelFormat = %u\n", DisplayInfo.PixelFormat);
	PrintDebug(L"  PixelsPerScanLine = %u\n", DisplayInfo.PixelsPerScanLine);
	PrintDebug(L"  FrameBufferBase = %x\n", DisplayInfo.FrameBufferBase);
	PrintDebug(L"  FrameBufferSize = %u\n", DisplayInfo.FrameBufferSize);

	// Query available modes.
	MaxMode = DisplayInfo.GOP->Mode->MaxMode;
	PrintDebug(L"Available modes (MaxMode = %u):\n", MaxMode);
	for (i = 0; i < MaxMode; i++) {
			
		Status = DisplayInfo.GOP->QueryMode(DisplayInfo.GOP, i, &SizeOfInfo, &ModeInfo);
		if (!EFI_ERROR(Status)) {
			PrintDebug(L"  Mode%u: %ux%u\n", i, ModeInfo->HorizontalResolution, ModeInfo->VerticalResolution);
		}
	}
}
开发者ID:vista980622,项目名称:VgaShim,代码行数:38,代码来源:Display.c

示例4: PrintErrorDebug

void PrintErrorDebug(char *msg)
{
	LPVOID lpMsgBuf;
	char *buf;

	/* Get last error message */
	if (!FormatMessage( 
				FORMAT_MESSAGE_ALLOCATE_BUFFER | 
				FORMAT_MESSAGE_FROM_SYSTEM | 
				FORMAT_MESSAGE_IGNORE_INSERTS,
				NULL,
				GetLastError(),
				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
				(LPTSTR) &lpMsgBuf,
				0,
				NULL ))
	{
		/* FormatMessage failed! */
		PrintDebug("FormatMessage() failed. %s ", msg);
		return;
	}

	/* Cut of CR/LFs */
	buf = (char *)lpMsgBuf;
	buf[strlen(buf) - 3] = '\0';

	PrintDebug("%s %s", msg, (LPCTSTR)lpMsgBuf);

}
开发者ID:Danixu,项目名称:OpenVPN-Portable,代码行数:29,代码来源:main.c

示例5: v3_handle_svm_halt

int v3_handle_svm_halt(struct guest_info * info)
{
  if (info->cpl!=0) { 
    v3_raise_exception(info, GPF_EXCEPTION);
  } else {
    
    // What we should do is starting waiting on an OS event that will
    // result in an injection of an interrupt.
    
    // What we will hackishly do instead is resume on any event
    // Plus is this totally GeekOS specific
    
    ullong_t yield_start = 0;
    ullong_t yield_stop = 0;
    uint32_t gap = 0;
    
    PrintDebug("GeekOS Yield\n");
    
    rdtscll(yield_start);
    V3_Yield();
    rdtscll(yield_stop);
    
    
    //v3_update_time(info, yield_stop - yield_start);
    gap = yield_stop - yield_start;
    v3_raise_irq(info, 0);
    
    PrintDebug("GeekOS Yield Done (%d cycles)\n", gap);
    
    info->rip+=1;
  }
    
  return 0;

}
开发者ID:epowers,项目名称:palacios,代码行数:35,代码来源:svm_halt.c

示例6: TerminateOpenVPN

/* force-kill as a last resort */
static BOOL
TerminateOpenVPN (connection_t *c)
{
    DWORD exit_code = 0;
    BOOL retval = TRUE;

    if (!c->hProcess)
        return retval;
    if (!GetExitCodeProcess (c->hProcess, &exit_code))
    {
        PrintDebug (L"In TerminateOpenVPN: failed to get process status: error = %lu", GetLastError());
        return FALSE;
    }
    if (exit_code == STILL_ACTIVE)
    {
        retval = TerminateProcess (c->hProcess, 1);
        if (retval)
            PrintDebug (L"Openvpn Process for config '%s' terminated", c->config_name);
        else
            PrintDebug (L"Failed to terminate openvpn Process for config '%s'", c->config_name);
    }
    else
        PrintDebug(L"In TerminateOpenVPN: Process is not active");

    return retval;
}
开发者ID:selvanair,项目名称:openvpn-gui,代码行数:27,代码来源:openvpn.c

示例7: read_data_port

static int read_data_port(ushort_t port, void * dst, uint_t length, struct vm_device * dev) {
  struct serial_state * state = (struct serial_state *)dev->private_data;
  char * val = (char *)dst;
  PrintDebug("Read from Data Port 0x%x\n", port);

  if (length != 1) {
    PrintDebug("Invalid length(%d) in write to 0x%x\n", length, port);
    return -1;
  }

  switch (port) {
  case COM1_DATA_PORT:
    dequeue_data(&(state->com1.tx_buffer), val);
    break;
  case COM2_DATA_PORT:
    dequeue_data(&(state->com2.tx_buffer), val);
    break;
  case COM3_DATA_PORT:
    dequeue_data(&(state->com3.tx_buffer), val);
    break;
  case COM4_DATA_PORT:
    dequeue_data(&(state->com4.tx_buffer), val);
    break;
  default:
    return -1;
  }
  

  return length;
}
开发者ID:epowers,项目名称:palacios,代码行数:30,代码来源:serial.c

示例8: write_ctrl_port

static int write_ctrl_port(ushort_t port, void * src, uint_t length, struct vm_device * dev) {
  struct serial_state * state = (struct serial_state *)dev->private_data;
  char * val = (char *)src;
  PrintDebug("Write to Control Port (val=%x)\n", *(char *)src);

  if (length != 1) {
    PrintDebug("Invalid Write length to control port %d\n", port);
    return -1;
  }

  switch (port) {
  case COM1_IRQ_ENABLE_PORT:
    if (handle_ier_write(&(state->com1), (struct irq_enable_reg *)val) == -1) {
      return -1;
    }
    break;
  case COM2_IRQ_ENABLE_PORT:
    if (handle_ier_write(&(state->com2), (struct irq_enable_reg *)val) == -1) {
      return -1;
    }
    break;
  case COM3_IRQ_ENABLE_PORT:
    if (handle_ier_write(&(state->com3), (struct irq_enable_reg *)val) == -1) {
      return -1;
    }
    break;
  case COM4_IRQ_ENABLE_PORT:
    if (handle_ier_write(&(state->com4), (struct irq_enable_reg *)val) == -1) {
      return -1;
    }
    break;

  case COM1_FIFO_CTRL_PORT:
  case COM2_FIFO_CTRL_PORT:
  case COM3_FIFO_CTRL_PORT:
  case COM4_FIFO_CTRL_PORT:

  case COM1_LINE_CTRL_PORT:
  case COM2_LINE_CTRL_PORT:
  case COM3_LINE_CTRL_PORT:
  case COM4_LINE_CTRL_PORT:

  case COM1_MODEM_CTRL_PORT:
  case COM2_MODEM_CTRL_PORT:
  case COM3_MODEM_CTRL_PORT:
  case COM4_MODEM_CTRL_PORT:
    


  default:
    return -1;
  }


  return -1;
}
开发者ID:epowers,项目名称:palacios,代码行数:56,代码来源:serial.c

示例9: EvalPartition

//
// EvalPartition
//
// -AJA- Evaluate a partition seg & determine the cost, taking into
//       account the number of splits, difference between left &
//       right, and linedefs that are tagged 'precious'.
//
// Returns the computed cost, or a negative value if the seg should be
// skipped altogether.
//
static int EvalPartition(superblock_t *seg_list, seg_t *part, 
    int best_cost)
{
  eval_info_t info;

  /* initialise info structure */
  info.cost   = 0;
  info.splits = 0;
  info.iffy   = 0;
  info.near_miss  = 0;

  info.real_left  = 0;
  info.real_right = 0;
  info.mini_left  = 0;
  info.mini_right = 0;
  
  if (EvalPartitionWorker(seg_list, part, best_cost, &info))
    return -1;
  
  /* make sure there is at least one real seg on each side */
  if (info.real_left == 0 || info.real_right == 0)
  {
#   if DEBUG_PICKNODE
    PrintDebug("Eval : No real segs on %s%sside\n", 
        info.real_left  ? "" : "left ", 
        info.real_right ? "" : "right ");
#   endif

    return -1;
  }

  /* increase cost by the difference between left & right */
  info.cost += 100 * ABS(info.real_left - info.real_right);

  // -AJA- allow miniseg counts to affect the outcome, but only to a
  //       lesser degree than real segs.
  
  info.cost += 50 * ABS(info.mini_left - info.mini_right);

  // -AJA- Another little twist, here we show a slight preference for
  //       partition lines that lie either purely horizontally or
  //       purely vertically.
  
  if (part->pdx != 0 && part->pdy != 0)
    info.cost += 25;

# if DEBUG_PICKNODE
  PrintDebug("Eval %p: splits=%d iffy=%d near=%d left=%d+%d right=%d+%d "
      "cost=%d.%02d\n", part, info.splits, info.iffy, info.near_miss, 
      info.real_left, info.mini_left, info.real_right, info.mini_right, 
      info.cost / 100, info.cost % 100);
# endif
 
  return info.cost;
}
开发者ID:Crowbar-Sledgehammer,项目名称:glbsp,代码行数:65,代码来源:seg.c

示例10: v3_get_intr_type

intr_type_t v3_get_intr_type(struct guest_info * info) {
  struct v3_intr_state * intr_state = &(info->intr_state);

  if (intr_state->excp_pending) {
    PrintDebug("[get_intr_type] Exception\n");
    return EXCEPTION;
  } else if (intr_state->controller->intr_pending(intr_state->controller_state)) {
    PrintDebug("[get_intr_type] External_irq\n");
    return EXTERNAL_IRQ;
  }
    PrintDebug("[get_intr_type] Invalid_Intr\n");
  return INVALID_INTR;
}
开发者ID:epowers,项目名称:palacios,代码行数:13,代码来源:vmm_intr.c

示例11: InitEndian

//
// InitEndian
//
// Parts inspired by the Yadex endian.cc code.
//
void InitEndian(void)
{
  volatile union
  {
    uint8_g mem[32];
    uint32_g val;
  }
  u;
 
  /* sanity-check type sizes */

  if (sizeof(uint8_g) != 1)
    FatalError("Sanity check failed: sizeof(uint8_g) = %d", 
        (int)sizeof(uint8_g));

  if (sizeof(uint16_g) != 2)
    FatalError("Sanity check failed: sizeof(uint16_g) = %d", 
        (int)sizeof(uint16_g));

  if (sizeof(uint32_g) != 4)
    FatalError("Sanity check failed: sizeof(uint32_g) = %d", 
        (int)sizeof(uint32_g));

  /* check endianness */

  memset((uint32_g *) u.mem, 0, sizeof(u.mem));

  u.mem[0] = 0x70;  u.mem[1] = 0x71;
  u.mem[2] = 0x72;  u.mem[3] = 0x73;

# if DEBUG_ENDIAN
  PrintDebug("Endianness magic value: 0x%08x\n", u.val);
# endif

  if (u.val == 0x70717273)
    cpu_big_endian = 1;
  else if (u.val == 0x73727170)
    cpu_big_endian = 0;
  else
    FatalError("Sanity check failed: weird endianness (0x%08x)", u.val);

# if DEBUG_ENDIAN
  PrintDebug("Endianness = %s\n", cpu_big_endian ? "BIG" : "LITTLE");

  PrintDebug("Endianness check: 0x1234 --> 0x%04x\n", 
      (int) Endian_U16(0x1234));
  
  PrintDebug("Endianness check: 0x11223344 --> 0x%08x\n", 
      Endian_U32(0x11223344));
# endif
}
开发者ID:Crowbar-Sledgehammer,项目名称:glbsp,代码行数:56,代码来源:system.c

示例12: SetDebug

// ==============================================================================
// Enables and disables debug mode
// ==============================================================================
void SetDebug(bool value) {
    if(value == true) {
        Globals.DebugMode = true;
    }
    if(value == true) {
        PrintDebug("SYSTEM: Debug mode: Enabled.");
    }
    else {
        PrintDebug("SYSTEM: Debug mode: Disabled.");
    }
    if(value == false) {
        Globals.DebugMode = false;
    }
}
开发者ID:KIAaze,项目名称:iteam_hacking,代码行数:17,代码来源:core.cpp

示例13: WriteLumpData

//
// WriteLumpData
//
static void WriteLumpData(lump_t *lump)
{
  size_t len;
  int align_size;

  cur_comms->file_pos++;
  DisplaySetBar(1, cur_comms->file_pos);
  DisplayTicker();

# if DEBUG_LUMP
  if (lump->flags & LUMP_COPY_ME)
    PrintDebug("Copying... %s (%d)\n", lump->name, lump->length);
  else
    PrintDebug("Writing... %s (%d)\n", lump->name, lump->length);
# endif
  
  if (ftell(out_file) != lump->new_start)
    PrintWarn("Consistency failure writing %s (%08lX, %08X\n", 
      lump->name, ftell(out_file), lump->new_start);
 
  if (lump->length == 0)
    return;

  if (lump->flags & LUMP_COPY_ME)
  {
    lump->data = UtilCalloc(lump->length);

    fseek(in_file, lump->start, SEEK_SET);

    len = fread(lump->data, lump->length, 1, in_file);

    if (len != 1)
      PrintWarn("Trouble reading lump %s to copy\n", lump->name);
  }

  len = fwrite(lump->data, lump->length, 1, out_file);
   
  if (len != 1)
    PrintWarn("Trouble writing lump %s\n", lump->name);
  
  align_size = ALIGN_LEN(lump->length) - lump->length;

  if (align_size > 0)
    fwrite(align_filler, align_size, 1, out_file);

  UtilFree(lump->data);

  lump->data = NULL;
}
开发者ID:samboy,项目名称:Oblige,代码行数:52,代码来源:wad.c

示例14: CalculateWallTips

void CalculateWallTips(void)
{
  int i;
  float_g x1;
  float_g y1;
  float_g x2;
  float_g y2;

  sector_t *left;
  sector_t *right;

  DisplayTicker();

  for (i=0; i < num_linedefs; i++)
  {
    linedef_t *line = lev_linedefs[i];

    if (line->self_ref && cur_info->skip_self_ref)
      continue;

    x1 = line->start->x;
    y1 = line->start->y;
    x2 = line->end->x;
    y2 = line->end->y;

    left  = (line->left)  ? line->left->sector  : NULL;
    right = (line->right) ? line->right->sector : NULL;
    
    VertexAddWallTip(line->start, x2-x1, y2-y1, left, right);
    VertexAddWallTip(line->end,   x1-x2, y1-y2, right, left);
  }
 
# if DEBUG_WALLTIPS
  for (i=0; i < num_vertices; i++)
  {
    vertex_t *vert = LookupVertex(i);
    wall_tip_t *tip;

    PrintDebug("WallTips for vertex %d:\n", i);

    for (tip=vert->tip_set; tip; tip=tip->next)
    {
      PrintDebug("  Angle=%1.1f left=%d right=%d\n", tip->angle,
        tip->left ? tip->left->index : -1,
        tip->right ? tip->right->index : -1);
    }
  }
# endif
}
开发者ID:alexey-lysiuk,项目名称:doom64ex-osx,代码行数:49,代码来源:analyze.c

示例15: Init

// ==============================================================================
// Initializes everything
// ==============================================================================
int Init() {
    if(SDL_Init(SDL_INIT_EVERYTHING) != 0) {
        PrintDebug("<ERROR> Init() -> Error in SDL_Init(SDL_INIT_EVERYTHING).\nError string:\n\n",SDL_GetError());
    } else {
        PrintDebug("VIDEO: [Good] SDL initialized");
        VideoInfo = SDL_GetVideoInfo();
        if ( !VideoInfo )	{
            PrintDebug("<ERROR> ::Init () -> Video query failed.\nError string:\n\n",SDL_GetError());
            return -1;
        } else {
            return 1;
        }
    }
    return 0;
}
开发者ID:KIAaze,项目名称:iteam_hacking,代码行数:18,代码来源:core.cpp


注:本文中的PrintDebug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。