• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IF_DEBUG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: stats_mean_fitness_outcross_progeny_n

/*///////////////////////////////////////////////////////////////*/
KScalar     stats_mean_fitness_outcross_progeny_n (KConfig_n KN)
/*
** Compute mean fitness of outcross progeny
*/
{
    const char* thisfunction = "stats_mean_fitness_outcross_progeny_n";
    KScalar wmean;
    IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction);
    if (KN->O == 0.0) {
        IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s: O==0.0, outcross wmean=0.0\n", 
                                      thisfunction);
        wmean = 0.0;
    } else {
        //void* a = alloc_KArray_n();
        //void* vm = alloc_KVector_n();
        //void* vf = alloc_KVector_n();
        KVector_n vm;
        KVector_n vf;
        apply_gametes_n(KN, vm, vf, KN->x1);
        {
            KArray_n a;
            apply_zygotes_n(KN, a, vm, vf);
            wmean = mean_fitness_n(KN, a);
        }
        //free_KVector_n(vf);
        //free_KVector_n(vm);
        //free_KArray_n(a);
    }
    return wmean;
}
开发者ID:douglasgscofield,项目名称:K,代码行数:31,代码来源:K_stats_n.cpp


示例2: push_scanned_block

void
push_scanned_block (bdescr *bd, gen_workspace *ws)
{
    ASSERT(bd != NULL);
    ASSERT(bd->link == NULL);
    ASSERT(bd->gen == ws->gen);
    ASSERT(bd->u.scan == bd->free);

    if (bd->start + bd->blocks * BLOCK_SIZE_W - bd->free > WORK_UNIT_WORDS)
    {
        // a partially full block: put it on the part_list list.
        bd->link = ws->part_list;
        ws->part_list = bd;
        ws->n_part_blocks += bd->blocks;
        IF_DEBUG(sanity,
                 ASSERT(countBlocks(ws->part_list) == ws->n_part_blocks));
    }
    else
    {
        // put the scan block on the ws->scavd_list.
        bd->link = ws->scavd_list;
        ws->scavd_list = bd;
        ws->n_scavd_blocks += bd->blocks;
        IF_DEBUG(sanity,
                 ASSERT(countBlocks(ws->scavd_list) == ws->n_scavd_blocks));
    }
}
开发者ID:Chobbes,项目名称:ghc,代码行数:27,代码来源:GCUtils.c


示例3: stats_mean_fitness_self_progeny_n

/*///////////////////////////////////////////////////////////////*/
KScalar     stats_mean_fitness_self_progeny_n (KConfig_n KN)
/*
** Compute mean fitness of self progeny.  To do this with the
** KN->x1,x2 type of data structures, we have to generate
** self progeny to a temporary KArray_n, then examine the
** genotypes in that array for fitness.
**
** If there were no selfed progeny produced, then we of course
** have zero mean fitness due to selfed progeny.
*/
{
    const char* thisfunction = "stats_mean_fitness_self_progeny_n";
    KScalar wmean;
    IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction);
    if (KN->S == 0.0) {
        IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s: S==0.0, self wmean=0.0\n", 
                                      thisfunction);
        wmean = 0.0;
    } else {
        //void* a = alloc_KArray_n();
        KArray_n a;
        apply_self_progeny_n(KN, a, KN->x1);
        wmean = mean_fitness_n(KN, a);
        //free_KArray_n(a);
    }
    return wmean;
}
开发者ID:douglasgscofield,项目名称:K,代码行数:28,代码来源:K_stats_n.cpp


示例4: initiate_model_state_n

/*///////////////////////////////////////////////////////////////*/
void        initiate_model_state_n  (KConfig_n KN)
{
    const char* thisfunction = "initiate_model_state_n";
    initiate_mut_term_n(KN);
    initiate_fitness_precomputed_n(KN);
    KN->generation = 0;
    if (!KN->option_nolethal) {
        if (KN->fit_s[0] == 1.0) {
            IF_DEBUG(DEBUG_LETHALS)
                fprintf(stderr, "%s: mutation class 0 is lethal, so KN->is_lethal[0]=1\n",
                       thisfunction);
            KN->is_lethal[0] = 1;
            KN->createlethal[0] = 0;
        }
        if (KN->fit_s[1] == 1.0) {
            IF_DEBUG(DEBUG_LETHALS)
                fprintf(stderr, "%s: mutation class 1 is lethal, so KN->is_lethal[1]=1\n",
                       thisfunction);
            KN->is_lethal[1] = 1;
            KN->createlethal[1] = 0;
        }
        IF_DEBUG(DEBUG_LETHALS)
            fprintf(stderr, "%s: KN->is_lethal[0]=%d\n", thisfunction, KN->is_lethal[0]);
        IF_DEBUG(DEBUG_LETHALS)
            fprintf(stderr, "%s: KN->is_lethal[1]=%d\n", thisfunction, KN->is_lethal[1]);
        IF_DEBUG(DEBUG_LETHALS)
            fprintf(stderr, "%s: if either of these are non-zero, expect normalization problems\n",
                   thisfunction);
    }
}
开发者ID:douglasgscofield,项目名称:K,代码行数:31,代码来源:K_initiate_n.cpp


示例5: main

int main (int argc, char *argv[])
{
    int i, j, b;

    bdescr *a[ARRSIZE];

    srand(SEED);

    hs_init(&argc, &argv);

   // repeatedly sweep though the array, allocating new random-sized
   // objects and deallocating the old ones.
   for (i=0; i < LOOPS; i++)
   {
       for (j=0; j < ARRSIZE; j++)
       {
           if (i > 0)
           {
               IF_DEBUG(block_alloc, debugBelch("A%d: freeing %p, %d blocks @ %p\n", j, a[j], a[j]->blocks, a[j]->start));
               freeGroup_lock(a[j]);
               DEBUG_ONLY(checkFreeListSanity());
           }
           b = (rand() % MAXALLOC) + 1;
           a[j] = allocGroup_lock(b);
           IF_DEBUG(block_alloc, debugBelch("A%d: allocated %p, %d blocks @ %p\n", j, a[j], b, a[j]->start));
           // allocating zero blocks isn't allowed
           DEBUG_ONLY(checkFreeListSanity());
       }
   }

   for (j=0; j < ARRSIZE; j++)
   {
       freeGroup_lock(a[j]);
   }
    
    // this time, sweep forwards allocating new blocks, and then
    // backwards deallocating them.
    for (i=0; i < LOOPS; i++)
    {
        for (j=0; j < ARRSIZE; j++)
        {
            b = (rand() % MAXALLOC) + 1;
            a[j] = allocGroup_lock(b);
            IF_DEBUG(block_alloc, debugBelch("B%d,%d: allocated %p, %d blocks @ %p\n", i, j, a[j], b, a[j]->start));
            DEBUG_ONLY(checkFreeListSanity());
        }
        for (j=ARRSIZE-1; j >= 0; j--)
        {
            IF_DEBUG(block_alloc, debugBelch("B%d,%d: freeing %p, %d blocks @ %p\n", i, j, a[j], a[j]->blocks, a[j]->start));
            freeGroup_lock(a[j]);
            DEBUG_ONLY(checkFreeListSanity());
        }
    }
    
    DEBUG_ONLY(checkFreeListSanity());

    hs_exit(); // will do a memory leak test

    exit(0);
}
开发者ID:altaic,项目名称:testsuite,代码行数:60,代码来源:testblockalloc.c


示例6: assert

isl_set *nfm_constraint_from_set(isl_ctx *ctx,
		nfm_constraint *constraints)
{
	isl_printer *p;

	assert(ctx);
	assert(constraints);

	IF_DEBUG(fprintf(stdout, "  Transforming a constraint into ISL set.\n"));

	p = isl_printer_to_str(ctx);

	p = isl_printer_print_pw_qpolynomial(p, constraints->constraint);
	char *str = isl_printer_get_str(p);
	IF_DEBUG(fprintf(stdout, "  The input Qpolynomianl constraint: %s\n", str));

	assert(str);

	/* Translate the qpolynomial into a map.  */
	char *set_str = (char *) malloc((strlen(str)+10)*sizeof(char));
	strcpy(set_str, str);
	IF_DEBUG2(fprintf(stdout, "  set_str=%s\n", set_str));
	size_t pos_arrow = strcspn(str, ">");
	set_str[pos_arrow-1] = ' ';
	set_str[pos_arrow] = ':';
	IF_DEBUG2(fprintf(stdout, "  set_str=%s\n", set_str));
	size_t pos_colon = strcspn(&(str[pos_arrow+1]), ":");
	if (strchr(&(str[pos_arrow+1]), ':') != NULL)
	{
		set_str[pos_arrow+1+pos_colon] = ' ';
		IF_DEBUG2(fprintf(stdout, "  set_str=%s\n", set_str));

		if (constraints->eq == 1)
			strcpy(&(set_str[pos_arrow+1+pos_colon]), "  = 0 and ");
		else
			strcpy(&(set_str[pos_arrow+1+pos_colon]), " >= 0 and ");

		IF_DEBUG2(fprintf(stdout, "  set_str=%s\n", set_str));
		strncpy(&(set_str[pos_arrow+pos_colon+10]), &(str[pos_arrow+1+pos_colon+1]), strlen(str) - pos_arrow - pos_colon);
		IF_DEBUG2(fprintf(stdout, "  set_str=%s\n", set_str));
	}
	else
	{
		size_t pos_bracket = strcspn(str, "}");
		set_str[pos_bracket] = ' ';
		if (constraints->eq == 1)
			strcat(&(set_str[pos_bracket]), " = 0 }");
		else
			strcat(&(set_str[pos_bracket]), " >= 0 }");
	}

	IF_DEBUG(fprintf(stdout, "  The Qpolynomial translated into a set is: %s\n", set_str));
	isl_set *set = isl_set_read_from_str(ctx, set_str);

	isl_printer_free(p);

	return set;
}
开发者ID:rbaghdadi,项目名称:non-linear-FM,代码行数:58,代码来源:nfm_isl_interface.c


示例7: spl_to_playlist_t

void spl_to_playlist_t(LIBMTP_mtpdevice_t* device, PTPObjectInfo *oi,
                       const uint32_t id, LIBMTP_playlist_t * const pl)
{
  // Fill in playlist metadata
  // Use the Filename as the playlist name, dropping the ".spl" extension
  pl->name = malloc(sizeof(char)*(strlen(oi->Filename) -4 +1));
  memcpy(pl->name, oi->Filename, strlen(oi->Filename) -4);
  // Set terminating character
  pl->name[strlen(oi->Filename) - 4] = 0;
  pl->playlist_id = id;
  pl->parent_id = oi->ParentObject;
  pl->storage_id = oi->StorageID;
  pl->tracks = NULL;
  pl->no_tracks = 0;

  IF_DEBUG() printf("pl->name='%s'\n",pl->name);

  // open a temporary file
  char tmpname[] = "/tmp/mtp-spl2pl-XXXXXX";
  int fd = mkstemp(tmpname);
  if(fd < 0) {
    printf("failed to make temp file for %s.spl -> %s, errno=%s\n", pl->name, tmpname, strerror(errno));
    return;
  }
  // make sure the file will be deleted afterwards
  if(unlink(tmpname) < 0)
    printf("failed to delete temp file for %s.spl -> %s, errno=%s\n", pl->name, tmpname, strerror(errno));
  int ret = LIBMTP_Get_File_To_File_Descriptor(device, pl->playlist_id, fd, NULL, NULL);
  if( ret < 0 ) {
    // FIXME     add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Playlist: Could not get .spl playlist file.");
    close(fd);
    printf("FIXME closed\n");
  }

  text_t* p = read_into_spl_text_t(device, fd);
  close(fd);

  // FIXME cache these somewhere else so we don't keep calling this!
  LIBMTP_folder_t *folders;
  LIBMTP_file_t *files;
  folders = LIBMTP_Get_Folder_List(device);
  files = LIBMTP_Get_Filelisting_With_Callback(device, NULL, NULL);

  // convert the playlist listing to track ids
  pl->no_tracks = trackno_spl_text_t(p);
  IF_DEBUG() printf("%u track%s found\n", pl->no_tracks, pl->no_tracks==1?"":"s");
  pl->tracks = malloc(sizeof(uint32_t)*(pl->no_tracks));
  tracks_from_spl_text_t(p, pl->tracks, folders, files);

  free_spl_text_t(p);

  // debug: add a break since this is the top level function call
  IF_DEBUG() printf("------------\n\n");
}
开发者ID:Abocer,项目名称:android-4.2_r1,代码行数:54,代码来源:playlist-spl.c


示例8: update_reg_vif

/*
 * Update the register vif in the multicast routing daemon and the
 * kernel because the interface used initially to get its local address
 * is DOWN. register_vifi is the index to the Register vif which needs
 * to be updated. As a result the Register vif has a new uv_lcl_addr and
 * is UP (virtually :))
 */
int
update_reg_vif( mifi_t register_vifi )
{
    register struct uvif *v;
    register mifi_t vifi;

    /* Find the first useable vif with solid physical background */
    for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
	if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN | MIFF_REGISTER))
	    continue;
        /* Found. Stop the bogus Register vif first */
	stop_vif(register_vifi);
	add_phaddr(v, &uvifs[vifi].uv_linklocal->pa_addr,
		   &uvifs[vifi].uv_linklocal->pa_subnetmask,
		   &uvifs[vifi].uv_linklocal->pa_prefix); 
	start_vif(register_vifi);
	IF_DEBUG(DEBUG_PIM_REGISTER | DEBUG_IF)
	    log_msg(LOG_NOTICE, 0, "%s has come up; vif #%u now in service",
		uvifs[register_vifi].uv_name, register_vifi);
	return 0;
    }
    vifs_down = TRUE;
    log_msg(LOG_WARNING, 0, "Cannot start Register vif: %s",
	uvifs[vifi].uv_name);
    return(-1);
}
开发者ID:Balaji-Parasuram,项目名称:mcast-tools,代码行数:33,代码来源:vif.c


示例9: start_all_vifs

void start_all_vifs()
{
	mifi_t vifi;
	struct uvif *v;
	u_int action;


	/* Start first the NON-REGISTER vifs */
	for (action = 0; ; action = MIFF_REGISTER) {
		for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
			/*
			 * If starting non-registers but the vif is a register
			 * or if starting registers, but the interface is not
			 * a register, then just continue.
			 */
			if ((v->uv_flags & MIFF_REGISTER) ^ action)
				continue;

			if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN)) {
				IF_DEBUG(DEBUG_IF)
					log_msg(LOG_DEBUG, 0,
					    "%s is %s; vif #%u out of service",
					    v->uv_name,
					    v->uv_flags & VIFF_DISABLED ? "DISABLED" : "DOWN",
					    vifi); 
				continue;
			}
			start_vif(vifi);
		}
		if (action == MIFF_REGISTER)
			break;
	}
}
开发者ID:Balaji-Parasuram,项目名称:mcast-tools,代码行数:33,代码来源:vif.c


示例10: stgMallocBytes

void *
stgMallocBytes (size_t n, char *msg)
{
    void *space;

    if ((space = malloc(n)) == NULL) {
      /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99):
       *
       *   "Upon successful completion with size not equal to 0, malloc() shall
       *   return a pointer to the allocated space. If size is 0, either a null
       *   pointer or a unique pointer that can be successfully passed to free()
       *   shall be returned. Otherwise, it shall return a null pointer and set
       *   errno to indicate the error."
       *
       * Consequently, a NULL pointer being returned by `malloc()` for a 0-size
       * allocation is *not* to be considered an error.
       */
      if (n == 0) return NULL;

      /* don't fflush(stdout); WORKAROUND bug in Linux glibc */
      rtsConfig.mallocFailHook((W_) n, msg);
      stg_exit(EXIT_INTERNAL_ERROR);
    }
    IF_DEBUG(sanity, memset(space, 0xbb, n));
    return space;
}
开发者ID:bgamari,项目名称:ghc,代码行数:26,代码来源:RtsUtils.c


示例11: P3

void c_foreach P3(int, flags, int, idx1, int, idx2) {
    IF_DEBUG(stack_in_use_as_temporary++);
    
    if (flags & 4) {
	CHECK_TYPES(sp, T_MAPPING, 2, F_FOREACH);
	
	push_refed_array(mapping_indices(sp->u.map));
	(++sp)->type = T_NUMBER;
	sp->u.lvalue = (sp-1)->u.arr->item;
	sp->subtype = (sp-1)->u.arr->size;
		    
	(++sp)->type = T_LVALUE;
	if (flags & 2)
	    sp->u.lvalue = &current_object->variables[idx1 + variable_index_offset];
	else
	    sp->u.lvalue = fp + idx1;
    } else 
    if (sp->type == T_STRING) {
	(++sp)->type = T_NUMBER;
	sp->u.lvalue_byte = (unsigned char *)((sp-1)->u.string);
	sp->subtype = SVALUE_STRLEN(sp - 1);
    } else {
	CHECK_TYPES(sp, T_ARRAY, 2, F_FOREACH);

	(++sp)->type = T_NUMBER;
	sp->u.lvalue = (sp-1)->u.arr->item;
	sp->subtype = (sp-1)->u.arr->size;
    }

    (++sp)->type = T_LVALUE;
    if (flags & 1)
	sp->u.lvalue = &current_object->variables[idx2 + variable_index_offset];
    else
	sp->u.lvalue = fp + idx2;
}
开发者ID:Junho2009,项目名称:propose_srv_linux,代码行数:35,代码来源:cfuns.c


示例12: beam_catches_init

void beam_catches_init(void)
{
    int i;

    bccix[0].tabsize   = DEFAULT_TABSIZE;
    bccix[0].free_list = -1;
    bccix[0].high_mark = 0;
    bccix[0].beam_catches = erts_alloc(ERTS_ALC_T_CODE,
				     sizeof(beam_catch_t)*DEFAULT_TABSIZE);
    IF_DEBUG(bccix[0].is_staging = 0);
    for (i=1; i<ERTS_NUM_CODE_IX; i++) {
	bccix[i] = bccix[i-1];
    }
     /* For initial load: */
    IF_DEBUG(bccix[erts_staging_code_ix()].is_staging = 1);
}
开发者ID:3112517927,项目名称:otp,代码行数:16,代码来源:beam_catches.c


示例13: DECL_NEW_REG

/**
 * \file profile.hpp
 * \author Benjamin Segovia <[email protected]>
 */
#include "ir/profile.hpp"
#include "ir/function.hpp"
#include "sys/platform.hpp"

namespace gbe {
namespace ir {

  namespace ocl
  {
    const char *specialRegMean[] = {
        "local_id_0", "local_id_1", "local_id_2",
        "group_id_0", "group_id_1", "group_id_2",
        "num_groups_0", "num_groups_1", "num_groups_2",
        "local_size_0", "local_size_1", "local_size_2",
        "global_size_0", "global_size_1", "global_size_2",
        "global_offset_0", "global_offset_1", "global_offset_2",
        "stack_pointer",
        "block_ip",
        "barrier_id", "thread_number",
        "work_dimension", "sampler_info",
        "emask", "notemask", "barriermask", "retVal"
    };

#if GBE_DEBUG
#define DECL_NEW_REG(FAMILY, REG) \
   r = fn.newRegister(FAMILY_DWORD); \
   GBE_ASSERT(r == REG);
#else
#define DECL_NEW_REG(FAMILY, REG) \
   fn.newRegister(FAMILY_DWORD);
#endif /* GBE_DEBUG */
    static void init(Function &fn) {
      IF_DEBUG(Register r);
      DECL_NEW_REG(FAMILY_DWORD, lid0);
      DECL_NEW_REG(FAMILY_DWORD, lid1);
      DECL_NEW_REG(FAMILY_DWORD, lid2);
      DECL_NEW_REG(FAMILY_DWORD, groupid0);
      DECL_NEW_REG(FAMILY_DWORD, groupid1);
      DECL_NEW_REG(FAMILY_DWORD, groupid2);
      DECL_NEW_REG(FAMILY_DWORD, numgroup0);
      DECL_NEW_REG(FAMILY_DWORD, numgroup1);
      DECL_NEW_REG(FAMILY_DWORD, numgroup2);
      DECL_NEW_REG(FAMILY_DWORD, lsize0);
      DECL_NEW_REG(FAMILY_DWORD, lsize1);
      DECL_NEW_REG(FAMILY_DWORD, lsize2);
      DECL_NEW_REG(FAMILY_DWORD, gsize0);
      DECL_NEW_REG(FAMILY_DWORD, gsize1);
      DECL_NEW_REG(FAMILY_DWORD, gsize2);
      DECL_NEW_REG(FAMILY_DWORD, goffset0);
      DECL_NEW_REG(FAMILY_DWORD, goffset1);
      DECL_NEW_REG(FAMILY_DWORD, goffset2);
      DECL_NEW_REG(FAMILY_DWORD, stackptr);
      DECL_NEW_REG(FAMILY_WORD, blockip);
      DECL_NEW_REG(FAMILY_DWORD, barrierid);
      DECL_NEW_REG(FAMILY_DWORD, threadn);
      DECL_NEW_REG(FAMILY_DWORD, workdim);
      DECL_NEW_REG(FAMILY_WORD, samplerinfo);
      DECL_NEW_REG(FAMILY_WORD, emask);
      DECL_NEW_REG(FAMILY_WORD, notemask);
      DECL_NEW_REG(FAMILY_WORD, barriermask);
      DECL_NEW_REG(FAMILY_WORD, retVal);
    }
开发者ID:ignatenkobrain,项目名称:beignet,代码行数:66,代码来源:profile.cpp


示例14: Types_RegisterTypedef

int Types_RegisterTypedef(const char *Name, size_t NameLen, const tType *Type)
{
	DEBUG_NL("(Name=%.*s, Type=", (int)NameLen, Name);
	IF_DEBUG( Types_Print(stdout, Type) );
	DEBUG_S(")\n");
	tTypedef **pnp = &gpTypedefs;
	for( tTypedef *td = gpTypedefs; td; pnp = &td->Next, td = td->Next )
	{
		int cmp = strncmp(td->Name, Name, NameLen);
		if( cmp > 0 )
			break;
		if( cmp == 0 && strlen(td->Name) == NameLen )
		{
			if( Types_Compare(td->Base, Type) != 0 ) {
				// Error! Incompatible redefinition
				return -1;
			}
			// Compatible redefinition
			return 1;
		}
	}
	
	tTypedef *td = malloc( sizeof(tTypedef) + NameLen + 1 );
	td->Name = (char*)(td + 1);
	memcpy(td+1, Name, NameLen);
	((char*)(td+1))[NameLen] = 0;
	td->Base = Type;
	
	td->Next = *pnp;
	*pnp = td;
	
	return 0;
}
开发者ID:thepowersgang,项目名称:ccompiler,代码行数:33,代码来源:types.c


示例15: timer_age_queue

/*
 * elapsed_time seconds have passed; perform all the events that should
 * happen.
 */
void timer_age_queue(int elapsed_time)
{
    struct timeout_q *ptr;

#ifdef CALLOUT_DEBUG
    IF_DEBUG(DEBUG_TIMEOUT)
	logit(LOG_DEBUG, 0, "aging queue (elapsed time %d):", elapsed_time);
    print_Q();
#endif
    
    for (ptr = Q; Q; ptr = Q) {
	if (ptr->time  > elapsed_time) {
	    ptr->time -= elapsed_time;
	    break;
	}

	/* ptr has expired, push Q */
	Q             = ptr->next;
	elapsed_time -= ptr->time;

	if (ptr->func)
	    ptr->func(ptr->data);
	free(ptr);
    }
}
开发者ID:troglobit,项目名称:pimd,代码行数:29,代码来源:callout.c


示例16: PHP_METHOD

/**
 * Normal constructor for EventLoop instance.
 */
PHP_METHOD(EventLoop, __construct)
{
	int backend = EVFLAG_AUTO;
	event_loop_object *obj = (event_loop_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
	
	assert( ! obj->loop);
	
	if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &backend) != SUCCESS) {
		return;
	}
	
	/* Check parameter */
	if(EVFLAG_AUTO       != backend &&
	   EVBACKEND_SELECT  != backend &&
	   EVBACKEND_POLL    != backend &&
	   EVBACKEND_EPOLL   != backend &&
	   EVBACKEND_KQUEUE  != backend &&
	   EVBACKEND_DEVPOLL != backend &&
	   EVBACKEND_PORT    != backend &&
	   EVBACKEND_ALL     != backend) {
		/* TODO: libev-specific exception class here */
		zend_throw_exception(NULL, "libev\\EventLoop: backend parameter must be "
			"one of the EventLoop::BACKEND_* constants.", 1 TSRMLS_DC);
		
		return;
	}
	
	obj->loop = ev_loop_new(backend);
	
	IF_DEBUG(ev_verify(obj->loop));
}
开发者ID:WordpressDev,项目名称:php-libev,代码行数:34,代码来源:EventLoop.c


示例17: scavenge_loop

void
scavenge_loop(void)
{
    rtsBool work_to_do;

loop:
    work_to_do = rtsFalse;

    // scavenge static objects 
    if (major_gc && gct->static_objects != END_OF_STATIC_LIST) {
	IF_DEBUG(sanity, checkStaticObjects(gct->static_objects));
	scavenge_static();
    }
    
    // scavenge objects in compacted generation
    if (mark_stack_bd != NULL && !mark_stack_empty()) {
	scavenge_mark_stack();
	work_to_do = rtsTrue;
    }
    
    // Order is important here: we want to deal in full blocks as
    // much as possible, so go for global work in preference to
    // local work.  Only if all the global work has been exhausted
    // do we start scavenging the fragments of blocks in the local
    // workspaces.
    if (scavenge_find_work()) goto loop;
    
    if (work_to_do) goto loop;
}
开发者ID:bogiebro,项目名称:ghc,代码行数:29,代码来源:Scav.c


示例18: spl_text_t_from_tracks

/**
 * Find the track names (including path) for this playlist's track ids.
 * (ie: 12345 -> \Music\song.mp3)
 *
 * @param p the text to search
 * @param tracks list of track id's to look up
 * @param folders the folders list for the device
 * @param fiels the files list for the device
 * @see playlist_t_to_spl()
 */
static void spl_text_t_from_tracks(text_t** p,
                                   uint32_t* tracks,
                                   const uint32_t trackno,
                                   const uint32_t ver_major,
                                   const uint32_t ver_minor,
                                   char* dnse,
                                   LIBMTP_folder_t* folders,
                                   LIBMTP_file_t* files)
{

  // HEADER
  text_t* c = NULL;
  append_text_t(&c, "SPL PLAYLIST");
  *p = c; // save the top of the list!

  char vs[14]; // "VERSION 2.00\0"
  sprintf(vs,"VERSION %d.%02d",ver_major,ver_minor);

  append_text_t(&c, vs);
  append_text_t(&c, "");

  // TRACKS
  int i;
  char* f;
  for(i=0;i<trackno;i++) {
    discover_filepath_from_id(&f, tracks[i], folders, files);

    if(f != NULL) {
      append_text_t(&c, f);
      IF_DEBUG()
        printf("track %d = %s (%u)\n", i+1, f, tracks[i]);
    }
    else
      printf("failed to find filepath for track=%d\n", tracks[i]);
  }

  // FOOTER
  append_text_t(&c, "");
  append_text_t(&c, "END PLAYLIST");
  if(ver_major == 2) {
    append_text_t(&c, "");
    append_text_t(&c, "myDNSe DATA");
    if(dnse != NULL) {
      append_text_t(&c, dnse);
    }
    else {
      append_text_t(&c, "");
      append_text_t(&c, "");
    }
    append_text_t(&c, "END myDNSe");
  }

  c->next = NULL;

  // debug
  IF_DEBUG() {
    printf(".spl playlist:\n");
    print_spl_text_t(*p);
  }
}
开发者ID:Abocer,项目名称:android-4.2_r1,代码行数:70,代码来源:playlist-spl.c


示例19: DEBUG

tType *Types_Register(const tType *Type)
{
	DEBUG("(Type=%p)", Type);
	DEBUG_NL("Type=");
	IF_DEBUG( Types_Print(stdout, Type) );
	DEBUG_S("\n");
	tType **retp = bsearch(&Type, gpTypeCache, giTypeCacheSize, sizeof(void*), Types_Compare_I);
	if(retp) {
		assert(*retp);
		DEBUG("RETURN %p (cached)", *retp);
		return *retp;
	}
	
	gpTypeCache = realloc(gpTypeCache, (giTypeCacheSize+1)*sizeof(void*));
	assert(gpTypeCache);
	tType *ret = malloc( sizeof(tType) );
	*ret = *Type;
	gpTypeCache[giTypeCacheSize] = ret;
	giTypeCacheSize ++;

	qsort(gpTypeCache, giTypeCacheSize, sizeof(void*), Types_Compare_I);

	DEBUG("RETURN %p (new)", ret);
	return ret;
}
开发者ID:thepowersgang,项目名称:ccompiler,代码行数:25,代码来源:types.c


示例20: free_mega_group

static void
free_mega_group (bdescr *mg)
{
    bdescr *bd, *prev;

    // Find the right place in the free list.  free_mblock_list is
    // sorted by *address*, not by size as the free_list is.
    prev = NULL;
    bd = free_mblock_list;
    while (bd && bd->start < mg->start) {
        prev = bd;
        bd = bd->link;
    }

    // coalesce backwards
    if (prev)
    {
        mg->link = prev->link;
        prev->link = mg;
        mg = coalesce_mblocks(prev);
    }
    else
    {
        mg->link = free_mblock_list;
        free_mblock_list = mg;
    }
    // coalesce forwards
    coalesce_mblocks(mg);

    IF_DEBUG(sanity, checkFreeListSanity());
}    
开发者ID:GuySteele,项目名称:ghc,代码行数:31,代码来源:BlockAlloc.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IF_DEQUEUE函数代码示例发布时间:2022-05-30
下一篇:
C++ IFQ_SET_READY函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap