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


C++ VPRINTF函数代码示例

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


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

示例1: read_pnm_header

/*-----------------------------------------------------------------------------
 *                                        Read the pnm image file header.
 */
static void
read_pnm_header()
{
    pnm_readpnminit(fp, &width, &height, &maxval, &format);
    switch (format) {
    case PBM_FORMAT:
        VPRINTF(stderr, "Image type: plain pbm format\n");
        break;
    case RPBM_FORMAT:
        VPRINTF(stderr, "Image type: raw pbm format\n");
        break;
    case PGM_FORMAT:
        VPRINTF(stderr, "Image type: plain pgm format\n");
        break;
    case RPGM_FORMAT:
        VPRINTF(stderr, "Image type: raw pgm format\n");
        break;
    case PPM_FORMAT:
        VPRINTF(stderr, "Image type: plain ppm format\n");
        break;
    case RPPM_FORMAT:
        VPRINTF(stderr, "Image type: raw ppm format\n");
        break;
    }
    VPRINTF(stderr, "Full image: %dx%d\n", width, height);
    VPRINTF(stderr, "Maxval:     %d\n", maxval);
    if (do_alpha)
        VPRINTF(stderr, "Computing alpha channel...\n");
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:32,代码来源:pnmtorle.c

示例2: sound_init

void sound_init(running_machine *machine)
{
	attotime update_frequency = SOUND_UPDATE_FREQUENCY;
	const char *filename;

	/* handle -nosound */
	nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND);
	if (nosound_mode)
		Machine->sample_rate = 11025;

	/* count the speakers */
	for (totalspeakers = 0; Machine->drv->speaker[totalspeakers].tag; totalspeakers++) ;
	VPRINTF(("total speakers = %d\n", totalspeakers));

	/* allocate memory for mix buffers */
	leftmix = auto_malloc(Machine->sample_rate * sizeof(*leftmix));
	rightmix = auto_malloc(Machine->sample_rate * sizeof(*rightmix));
	finalmix = auto_malloc(Machine->sample_rate * sizeof(*finalmix));

	/* allocate a global timer for sound timing */
	sound_update_timer = timer_alloc(sound_update, NULL);
	timer_adjust(sound_update_timer, update_frequency, 0, update_frequency);

	/* initialize the streams engine */
	VPRINTF(("streams_init\n"));
	streams_init(machine, update_frequency.attoseconds);

	/* now start up the sound chips and tag their streams */
	VPRINTF(("start_sound_chips\n"));
	start_sound_chips();

	/* then create all the speakers */
	VPRINTF(("start_speakers\n"));
	start_speakers();

	/* finally, do all the routing */
	VPRINTF(("route_sound\n"));
	route_sound();

	/* open the output WAV file if specified */
	filename = options_get_string(mame_options(), OPTION_WAVWRITE);
	if (filename[0] != 0)
		wavfile = wav_open(filename, machine->sample_rate, 2);

	/* enable sound by default */
	global_sound_enabled = TRUE;
	sound_muted = FALSE;
	sound_set_attenuation(options_get_int(mame_options(), OPTION_VOLUME));

	/* register callbacks */
	config_register("mixer", sound_load, sound_save);
	add_pause_callback(machine, sound_pause);
	add_reset_callback(machine, sound_reset);
	add_exit_callback(machine, sound_exit);
}
开发者ID:broftkd,项目名称:historic-mame,代码行数:55,代码来源:sound.c

示例3: idct_process

int idct_process (Channel * c[2]) {
#ifdef DEADLOCK
  printf("Thread compute 0x%.8x has been created\n", (unsigned int)pthread_self());
#endif

	uint8_t * Idct_YCbCr;
	int32_t * block_YCbCr;
	uint32_t flit_size = 0;

	channelRead (c[0], (uint8_t *) & flit_size, sizeof (uint32_t));
	VPRINTF("Flit size = %lu\r\n", flit_size);

	Idct_YCbCr = (uint8_t *) malloc (flit_size * 64 * sizeof (uint8_t));
	if (Idct_YCbCr == NULL) printf ("%s,%d: malloc failed\n", __FILE__, __LINE__);

	block_YCbCr = (int32_t *) malloc (flit_size * 64 * sizeof (int32_t));
	if (block_YCbCr == NULL) printf ("%s,%d: malloc failed\n", __FILE__, __LINE__);

	while (1) {
		channelRead (c[0], (unsigned char *) block_YCbCr, flit_size * 64 * sizeof (int32_t));

		for (uint32_t i = 0; i < flit_size; i++) IDCT(& block_YCbCr[i * 64], & Idct_YCbCr[i * 64]);

		channelWrite (c[1], (unsigned char *) Idct_YCbCr, flit_size * 64 * sizeof (uint8_t));
	}

	return 0;
}
开发者ID:claf,项目名称:MJPEG,代码行数:28,代码来源:compute.c

示例4: key_set

static void
key_set(symbol_p s, int code, voice_p voice)
{
    if (code == KEY_RESET) {
        if (voice->key_current != KEY_RESET) {
            voice->key_previous_current = voice->key_current;
            voice->key_current = KEY_RESET;
        }
        return;
    }

    if (code < 0) {
        assert(voice->key_current > -code);
        assert(voice->key_current < 8 || -code >= 8);
        assert(voice->key_current >= 8 || -code < 8);
        voice->key_current += code;
    } else {
        voice->key_current = code;
    }

    if (voice->key_current != voice->key_previous_current) {
        if (voice->key_previous_current == KEY_RESET) {
            voice->key_previous_current = voice->key_current;
        }
        last_dumped_symbol = s;
        fprintf(lily_out, " \\key %s \\major",
                key_sign_name(voice->key_current));
        newline();
    }

    VPRINTF("Dump this key; key_current := %d\n", voice->key_current);
}
开发者ID:rfhh,项目名称:lily-contribs,代码行数:32,代码来源:xly_dump.c

示例5: cbLogicalPlacement

static RIFFIOSuccess
cbLogicalPlacement(NIFFIOTagContext *pctxTag, niffLogicalPlacement *p)
{
	extern void debugMeAt(mpq_t t);
	debugMeAt(t_current);

    if (cbTagStart(pctxTag, p, cbLogicalPlacement)) {
        assert(pctxTag != 0);
        assert(pctxTag->pnf != 0);
        assert(pctxTag->pchunkParent != 0);

        if (symbol_current != NULL && symbol_current->type == SYM_STEM &&
            p->vertical != 0) {
            symbol_current->symbol.stem.flags |= FLAG_STEM_EXPLICIT;
            if (p->vertical == 1) {
                symbol_current->symbol.stem.flags |= FLAG_STEM_UP;
            }
        } else {
            VPRINTF(" = (%d,%d) (proximity %d)", p->horizontal, p->vertical, p->proximity);
        }
    }
    cbTagEnd(pctxTag);

    return RIFFIO_OK;
}
开发者ID:rfhh,项目名称:lily-contribs,代码行数:25,代码来源:LogicalPlacement.c

示例6: period

void z80ctc_device::ctc_channel::trigger(UINT8 data)
{
	// normalize data
	data = data ? 1 : 0;

	// see if the trigger value has changed
	if (data != m_extclk)
	{
		m_extclk = data;

		// see if this is the active edge of the trigger
		if (((m_mode & EDGE) == EDGE_RISING && data) || ((m_mode & EDGE) == EDGE_FALLING && !data))
		{
			// if we're waiting for a trigger, start the timer
			if ((m_mode & WAITING_FOR_TRIG) && (m_mode & MODE) == MODE_TIMER)
			{
				attotime curperiod = period();
				VPRINTF(("CTC period %s\n", curperiod.as_string()));
				m_timer->adjust(curperiod, m_index, curperiod);
			}

			// we're no longer waiting
			m_mode &= ~WAITING_FOR_TRIG;

			// if we're clocking externally, decrement the count
			if ((m_mode & MODE) == MODE_COUNTER)
			{
				// if we hit zero, do the same thing as for a timer interrupt
				if (--m_down == 0)
					timer_callback();
			}
		}
	}
}
开发者ID:CJBass,项目名称:mame2013-libretro,代码行数:34,代码来源:z80ctc.c

示例7: str_echo

void
str_echo(int sockfd)
{
  int n;
  int  len;
  char *buf;
  
  while (1) {
    //COMPLETED THE MISSING AND IMPORTANT LINE HERE
      n = net_readn(sockfd, &len, sizeof(int));
    if (n != sizeof(int)) {
      fprintf(stderr, "%s: ERROR failed to read len: %d!=%d"
	      " ... closing connection\n", __func__, n, (int)sizeof(int));
      break;
    } 
    //WHAT DOES THE NEXT LINE DO?
    len = ntohl(len);
    if (len) {
      buf = (char *)malloc(len);
      n = net_readn(sockfd, buf, len);
      if ( n != len ) {
	fprintf(stderr, "%s: ERROR failed to read msg: %d!=%d"
		" .. closing connection\n" , __func__, n, len);
	break;
      }
      VPRINTF("got: %d '%s'\n", len, buf);
      net_writen(sockfd, buf, len);
      free(buf);
    }
  }
  close(sockfd);
  return;
}
开发者ID:irays,项目名称:test_repository,代码行数:33,代码来源:server.c

示例8: threshtree_find_blobs

void threshtree_find_blobs( Blobtree *blob,
		const unsigned char *data,
		const unsigned int w, const unsigned int h,
		const BlobtreeRect roi,
		const unsigned char thresh,
		ThreshtreeWorkspace *workspace )
{
	// Avoid hard crash for null data.
	if( data == NULL ){
		VPRINTF("Runtime error: Input data is NULL! threshtree_filter_blobs aborts.\n");
	}
	//clear old tree
	if( blob->tree != NULL){
		tree_destroy(&blob->tree);
		blob->tree = NULL;
	}
	if( blob->tree_data != NULL){
		free(blob->tree_data);
		blob->tree_data = NULL;
	}
	//get new blob tree structure.
#ifdef BLOB_SUBGRID_CHECK
	blob->tree = find_connection_components_subcheck(
			data, w, h, roi, thresh,
			blob->grid.width,
			&blob->tree_data,
			workspace );
#else
	blob->tree = find_connection_components_coarse(
			data, w, h, roi, thresh,
			blob->grid.width, blob->grid.height,
			&blob->tree_data,
			workspace );
#endif
}
开发者ID:YggdrasiI,项目名称:KinectGrid,代码行数:35,代码来源:threshtree.c

示例9: threshtree_realloc_workspace

bool threshtree_realloc_workspace(
		const unsigned int max_comp,
		ThreshtreeWorkspace **pworkspace
		){

	ThreshtreeWorkspace *r = *pworkspace;
	r->max_comp = max_comp;
	if(
			( r->comp_same = (unsigned int*) realloc(r->comp_same, max_comp*sizeof(unsigned int) ) ) == NULL ||
			( r->prob_parent = (unsigned int*) realloc(r->prob_parent, max_comp*sizeof(unsigned int) ) ) == NULL ||
#ifdef BLOB_COUNT_PIXEL
			( r->comp_size = (unsigned int*) realloc(r->comp_size, max_comp*sizeof(unsigned int) ) ) == NULL ||
#endif
#ifdef BLOB_DIMENSION
			( r->top_index = (unsigned int*) realloc(r->top_index, max_comp*sizeof(unsigned int) ) ) == NULL ||
			( r->left_index = (unsigned int*) realloc(r->left_index, max_comp*sizeof(unsigned int) ) ) == NULL ||
			( r->right_index = (unsigned int*) realloc(r->right_index, max_comp*sizeof(unsigned int) ) ) == NULL ||
			( r->bottom_index = (unsigned int*) realloc(r->bottom_index, max_comp*sizeof(unsigned int) ) ) == NULL ||
#endif
#ifdef BLOB_BARYCENTER_TYPE
			( r->pixel_sum_X = (BLOB_BARYCENTER_TYPE*) realloc(r->pixel_sum_X, max_comp*sizeof(BLOB_BARYCENTER_TYPE) ) ) == NULL ||
			( r->pixel_sum_Y = (BLOB_BARYCENTER_TYPE*) realloc(r->pixel_sum_Y, max_comp*sizeof(BLOB_BARYCENTER_TYPE) ) ) == NULL ||
#endif
			0 ){
		// realloc failed
		VPRINTF("Critical error: Reallocation of workspace failed!\n");
		threshtree_destroy_workspace( pworkspace );
		return false;
	}

	free(r->blob_id_filtered);//omit unnessecary reallocation and omit wrong/low size
	r->blob_id_filtered = NULL;//should be allocated later if needed.

	return true;
}
开发者ID:YggdrasiI,项目名称:KinectGrid,代码行数:35,代码来源:threshtree.c

示例10: main

int
main(int argc, char **argv)
{
  int listenfd, port=0;
  long connfd;
  pthread_t tid;

  bzero(&globals, sizeof(globals));

  if (net_setup_listen_socket(&listenfd,&port)!=1) {
    fprintf(stderr, "net_setup_listen_socket FAILED!\n");
    exit(-1);
  }

  printf("listening on port=%d\n", port);

  if (net_listen(listenfd) < 0) {
    fprintf(stderr, "Error: server listen failed (%d)\n", errno);
    exit(-1);
  }

  for (;;) {
    connfd = net_accept(listenfd);
    if (connfd < 0) {
      fprintf(stderr, "Error: server accept failed (%d)\n", errno);
    } else {
      //EXPLAIN WHAT IS HAPPENING HERE IN YOUR LOG
      pthread_create(&tid, NULL, &doit, (void *)connfd);
    }
  }

  VPRINTF("Exiting\n");
}
开发者ID:irays,项目名称:test_repository,代码行数:33,代码来源:server.c

示例11: dump_notes

static void
dump_notes(int do_beams)
{
    int         f;
    int         p;
    int         v;

    fprintf(stderr, "Now write parts...\n");
    for (p = 0; p < n_part; p++) {
        if (ONLY != -1 && p != ONLY) {
            fprintf(stderr, "Skip staff %d, do only staff %d\n", p, ONLY);
            continue;
        }
        fprintf(stderr, "      ........ part %d, ", p);
        for (f = 0; f < part[p].n_staff; f++) {
            fprintf(stderr, "staff %d, ", f);
            for (v = 0; v < part[p].staff[f].n_voice; v++) {
                fprintf(stderr, "voice %d ", v);
                VPRINTF("Now dump part %d staff %d voice %d", p, f, v);
                voice_reset();
                fprintf(lily_out, "%s = {", part_name(p, f, v));
                indup();
                dumpVoice(&part[p].staff[f].voice[v], do_beams);
                indown();
                fprintf(lily_out, "}");
                newline();
                newline();
            }
        }
        fprintf(stderr, "\n");
    }
}
开发者ID:rfhh,项目名称:lily-contribs,代码行数:32,代码来源:xly_dump.c

示例12: depthtree_find_blobs

void depthtree_find_blobs(Blobtree *blob, const unsigned char *data, const unsigned int w, const unsigned int h, const BlobtreeRect roi, const unsigned char *depth_map, DepthtreeWorkspace *workspace ){
	// Avoid hard crash for null data.
	if( data == NULL ){
		VPRINTF("Runtime error: Input data is NULL! threshtree_filter_blobs aborts.\n");
	}
	//clear old tree
	if( blob->tree != NULL){
		tree_destroy(&blob->tree);
		blob->tree = NULL;
	}
	if( blob->tree_data != NULL){
		free(blob->tree_data);
		blob->tree_data = NULL;
	}
	//get new blob tree structure.
	/*
		 if( blob->grid.height == 11 ){
		 blob->tree = find_depthtree11(data, w, h, roi, depth_map, 
		 workspace, &blob->tree_data);
		 }else{
		 blob->tree = find_depthtree(data, w, h, roi, depth_map, 
		 blob->grid.width,
		 workspace, &blob->tree_data);
		 }*/

	if( blob->grid.width == 1 ){
		blob->tree = find_depthtree(data, w, h, roi, depth_map, 1, workspace, &blob->tree_data);
	}else if( blob->grid.width == 2 ){
		blob->tree = find_depthtree(data, w, h, roi, depth_map, 2, workspace, &blob->tree_data);
	}else if( blob->grid.width == 3 ){
		blob->tree = find_depthtree(data, w, h, roi, depth_map, 3, workspace, &blob->tree_data);
	}else if( blob->grid.width == 4 ){
		blob->tree = find_depthtree(data, w, h, roi, depth_map, 4, workspace, &blob->tree_data);
		/*
			 }else if( blob->grid.width == 5 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 5, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 6 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 6, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 7 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 7, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 8 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 8, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 9 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 9, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 10 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 10, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 11 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 11, workspace, &blob->tree_data);
			 */
	}else{
		blob->tree = find_depthtree(data, w, h, roi, depth_map, blob->grid.width, workspace, &blob->tree_data);
	}







}
开发者ID:YggdrasiI,项目名称:KinectGrid,代码行数:60,代码来源:depthtree.c

示例13: auto_alloc_clear

sound_stream *stream_create(device_t *device, int inputs, int outputs, int sample_rate, void *param, stream_update_func callback)
{
	running_machine *machine = device->machine;
	streams_private *strdata = machine->streams_data;
	int inputnum, outputnum;
	sound_stream *stream;
	char statetag[30];

	/* allocate memory */
	stream = auto_alloc_clear(device->machine, sound_stream);

	VPRINTF(("stream_create(%d, %d, %d) => %p\n", inputs, outputs, sample_rate, stream));

	/* fill in the data */
	stream->device = device;
	stream->index = strdata->stream_index++;
	stream->sample_rate = sample_rate;
	stream->inputs = inputs;
	stream->outputs = outputs;
	stream->callback = callback;
	stream->param = param;

	/* create a unique tag for saving */
	sprintf(statetag, "%d", stream->index);
	state_save_register_item(machine, "stream", statetag, 0, stream->sample_rate);

	/* allocate space for the inputs */
	if (inputs > 0)
	{
		stream->input = auto_alloc_array_clear(device->machine, stream_input, inputs);
		stream->input_array = auto_alloc_array_clear(device->machine, stream_sample_t *, inputs);
	}
开发者ID:DarrenBranford,项目名称:MAME4iOS,代码行数:32,代码来源:streams.c

示例14: parseUrl

/* This function identifies the type of url requested, http://filename
   or /filename
*/
int parseUrl(httprequest *request, char *line) {
    int returnValue;
    if (!strncmp(line, "http", 4)) {

        VPRINTF("Full URL %s\n", line);
        if ((returnValue = parseFullUrl(request,line)) <0)
            return (-1);
    }
    if (!strncmp(line, "/", 1)) {

        VPRINTF("Simple URL %s\n", line);
        if ((returnValue = parseSimpleUrl(request,line)) <0)
            return (-1);
    }
    return 0;
}
开发者ID:diogomonica,项目名称:ralemTTPD,代码行数:19,代码来源:Http.c

示例15: mq200_init_backlight

void
mq200_init_backlight(struct mq200_softc *sc, int inattach)
{
	int val = -1;

	if (sc->sc_lcd_inited&BACKLIGHT_INITED)
		return;

	if (config_hook_call(CONFIG_HOOK_GET,
	    CONFIG_HOOK_POWER_LCDLIGHT, &val) != -1) {
		/* we can get real light state */
		VPRINTF("init_backlight: real backlight=%d\n", val);
		if (val == 0)
			sc->sc_powerstate &= ~PWRSTAT_BACKLIGHT;
		else
			sc->sc_powerstate |= PWRSTAT_BACKLIGHT;
		sc->sc_lcd_inited |= BACKLIGHT_INITED;
	} else if (inattach) {
		/*
		   we cannot get real light state in attach time
		   because light device not yet attached.
		   we will retry in !inattach.
		   temporary assume light is on.
		*/
		sc->sc_powerstate |= PWRSTAT_BACKLIGHT;
	} else {
		/* we cannot get real light state, so work by myself state */
		sc->sc_lcd_inited |= BACKLIGHT_INITED;
	}
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:30,代码来源:mq200.c


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