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


C++ set_flag函数代码示例

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


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

示例1: bitmap_set

static void bitmap_set(FS *fs, LOCATION location, int allocated)
{
    unsigned long int bitmap_num = location / fs->bitmap_size;
    unsigned long int bitmap_offset = location % fs->bitmap_size;
    unsigned long int bitmap_byte = bitmap_offset / 8;
    unsigned long int bitmap_bit = bitmap_offset % 8;
    BLOCK *bitmap;
    unsigned char *byte;
    int prev;

    if (fs->bitmaps[bitmap_num] == 0)
    {
        bitmap = allocate_block(fs, B_BITMAP, 0);
        fs->bitmaps[bitmap_num] = bitmap->location;
        bitmap_set(fs, bitmap->location, 1);
        set_flag(fs->superblock, F_DIRTY);
    }
    else
        bitmap = get_block(fs, fs->bitmaps[bitmap_num], 1);
    
    byte = (unsigned char *) bitmap->buffer + sizeof(struct bitmap_block_header) + bitmap_byte;
    prev = (*byte & (1 << bitmap_bit)) != 0;
    if (allocated)
        *byte = *byte | (1 << bitmap_bit);
    else
        *byte = *byte & ~(1 << bitmap_bit);
    set_flag(bitmap, F_DIRTY);
    
    if (prev == allocated)
        error("Not toggling bit!\n");
    
    //printf("Set bit %ld to %d from %d\n", location, allocated, prev);
}
开发者ID:ejrh,项目名称:ejrh,代码行数:33,代码来源:block.c

示例2: g1_building_class

g1_factory_class::g1_factory_class(g1_object_type g1_ot_id, g1_loader_class * g1_lc_fp)
	: g1_building_class(g1_ot_id,g1_lc_fp) //, death(this) // JJ modification not to issue MSVC warning
{
	//death.SetG1_Object_Class(this); // JJ modification not to issue MSVC warning
	char * n=name();
	char lod_n[256];

	sprintf(lod_n, "%s_lod", n);
	draw_params.setup(n,0,lod_n);

	set_flag(BLOCKING      |
			 CAN_DRIVE_ON  |
			 TARGETABLE    |
			 GROUND
			 ,1);
	if (!strcmp(n, "garage"))
	{
		radar_image=&garage_radar_im;
		set_flag(CAN_DRIVE_ON,0);
	}
	else if (!strcmp(n, "airbase"))
	{
		radar_image=&airbase_radar_im;
		set_flag(CAN_DRIVE_ON,0); //this must not be true, otherwise planes might crash into it when starting
	}
	else if (!strcmp(n, "mainbasepad"))
	{
		radar_image=&mainbasepad_radar_im;
	}

	radar_type=G1_RADAR_BUILDING;

}
开发者ID:pgrawehr,项目名称:golgotha,代码行数:33,代码来源:objs__bases.cpp

示例3: set_flag

BLOCK *clone_block(FS *fs, BLOCK *block)
{
    BLOCK *clone;
    
    if (block->pins == 0 && !(block->flags & F_DIRTY))
    {
        set_flag(block, F_CLONE);
        remove_block_from_hash(fs, block);
        return block;
    }
    
    clone = find_free_slot(fs);
    memcpy(clone->buffer, block->buffer, fs->block_size);
    set_flag(clone, F_CACHED);
    set_flag(clone, F_CLONE);
    clone->type = block->type;
    clone->location = block->location;
    if (block->type != B_DATA)
    {
        if (!parse_block(fs, clone))
        {
            printf("Error parsing cloned block %ld\n", block->location);
            return NULL;
        }
    }
    
    return clone;
}
开发者ID:ejrh,项目名称:ejrh,代码行数:28,代码来源:block.c

示例4: parse_flags_option

static int parse_flags_option(struct isl_arg *decl, char **arg,
	struct isl_prefixes *prefixes, void *opt)
{
	int has_argument;
	const char *flags;
	const char *comma;
	unsigned val;

	flags = skip_name(decl, arg[0], prefixes, 0, &has_argument);
	if (!flags)
		return 0;

	if (!has_argument && !arg[1])
		return 0;

	if (!has_argument)
		flags = arg[1];

	val = 0;

	while ((comma = strchr(flags, ',')) != NULL) {
		if (!set_flag(decl, &val, flags, comma - flags))
			return 0;
		flags = comma + 1;
	}
	if (!set_flag(decl, &val, flags, strlen(flags)))
		return 0;

	*(unsigned *)(((char *)opt) + decl->offset) = val;

	return has_argument ? 1 : 2;
}
开发者ID:VanirLLVM,项目名称:toolchain_isl,代码行数:32,代码来源:isl_arg.c

示例5: set_flag

UnshadedMaterial::UnshadedMaterial() :Material(VisualServer::get_singleton()->fixed_material_create()){

	set_flag(FLAG_UNSHADED,true);
	set_use_alpha(true);
	set_flag(FLAG_COLOR_ARRAY_SRGB,true);

}
开发者ID:3miu,项目名称:godot,代码行数:7,代码来源:material.cpp

示例6: set_flag

//set flags based on comparison between a and b
void CPU::compare(byte a, byte b) {
    char sa = a;
    char sb = b;
    set_flag(N, (sa-sb) & (1 << 7));
    set_flag(Z, sa == sb);
    set_flag(C, a >= b);
}
开发者ID:zoibot,项目名称:knes,代码行数:8,代码来源:cpu.cpp

示例7: ERR_FAIL_INDEX

void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value) {
	ERR_FAIL_INDEX(p_axis, 3);
	switch (p_param) {
		case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
			limits_lower[0][p_axis] = p_value;
			set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
			break;
		case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
			limits_upper[0][p_axis] = p_value;
			set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
			break;
		case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
			sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION:
			sixDOFConstraint->getTranslationalLimitMotor()->m_restitution = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
			sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
			sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
			sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis] = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
			limits_lower[1][p_axis] = p_value;
			set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
			limits_upper[1][p_axis] = p_value;
			set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
			sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING:
			sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION:
			sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT:
			sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP:
			sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY:
			sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity = p_value;
			break;
		case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
			sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value;
			break;
		default:
			WARN_PRINT("This parameter is not supported");
	}
}
开发者ID:RandomShaper,项目名称:godot,代码行数:59,代码来源:generic_6dof_joint_bullet.cpp

示例8: set_flag

ParticleSystemMaterial::ParticleSystemMaterial() :Material(VisualServer::get_singleton()->fixed_material_create()){

	set_flag(FLAG_DOUBLE_SIDED,true);
	set_flag(FLAG_UNSHADED,true);
	set_depth_draw_mode(DEPTH_DRAW_NEVER);
	VisualServer::get_singleton()->fixed_material_set_flag(material,VS::FIXED_MATERIAL_FLAG_USE_ALPHA,true);
	VisualServer::get_singleton()->fixed_material_set_flag(material,VS::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);
}
开发者ID:ErosOlmi,项目名称:godot,代码行数:8,代码来源:material.cpp

示例9: hitachi_lcd_service

void hitachi_lcd_service(void){   
   if(NewCustomSymbolFlags){
      set_flag(CGRAMUsed);
      static uint8_t DataByteNumber = 0, CustomSymbolNumber = 0;
      if(get_flag(CGRAMAddrSet)){
         hitachi_lcd_write_data(*(CustomSymbol[CustomSymbolNumber] + DataByteNumber));
         if(++DataByteNumber > 7){
            bit_clr(NewCustomSymbolFlags, CustomSymbolNumber);
            clr_flag(CGRAMAddrSet);
            DataByteNumber = 0;
            CustomSymbolNumber = 0;
         }
      } else {
         while(!(NewCustomSymbolFlags & (1<<CustomSymbolNumber)))
            CustomSymbolNumber++;
         hitachi_lcd_set_address(CGRAM_ADDR(CustomSymbolNumber*8));
         set_flag(CGRAMAddrSet);
      }
   } else {
      if(get_flag(CGRAMUsed)){
         clr_flag(CGRAMUsed);
         clr_flag(DRAMAddrSet);
         CharNumber = 0;
         hitachi_lcd_set_address(DRAM_ADDR(0x00));
      } else {
         switch(CharNumber){
           case CHAR_IN_ROW:
            if(get_flag(DRAMAddrSet)){
               clr_flag(DRAMAddrSet);
               hitachi_lcd_write_data(pLcdBuffer[CharNumber]);
               CharNumber++;
            } else {
               set_flag(DRAMAddrSet);
               hitachi_lcd_set_address(DRAM_ADDR(0x40));
            }
            break;
            
           case CHAR_ON_LCD:
            if(get_flag(DRAMAddrSet)){
               clr_flag(DRAMAddrSet);
               CharNumber = 0;
               hitachi_lcd_write_data(pLcdBuffer[CharNumber]);
               CharNumber++;
            } else {
               set_flag(DRAMAddrSet);
               hitachi_lcd_set_address(DRAM_ADDR(0x00));
            }
            break;
            
           default:
            hitachi_lcd_write_data(pLcdBuffer[CharNumber]);
            CharNumber++;
            break;
         }
      }
   }
}
开发者ID:TotallyYoursCode,项目名称:garageThermo,代码行数:57,代码来源:hitachi_lcd_lib.c

示例10: check_seekable

void pofilestream::vseek(const pos_type n)
{
	check_seekable();
	if (fseek((FILE *) m_file, SEEK_SET, n) < 0)
		set_flag(FLAG_ERROR);
	else
	{
		m_pos = n;
		if (ferror((FILE *) m_file))
			set_flag(FLAG_ERROR);
	}
}
开发者ID:gvsurenderreddy,项目名称:mame,代码行数:12,代码来源:pstream.cpp

示例11: fread

unsigned pifilestream::vread(void *buf, const unsigned n)
{
	std::size_t r = fread(buf, 1, n, (FILE *) m_file);
	if (r < n)
	{
		if (feof((FILE *) m_file))
			set_flag(FLAG_EOF);
		if (ferror((FILE *) m_file))
			set_flag(FLAG_ERROR);
	}
	m_pos += r;
	return r;
}
开发者ID:gvsurenderreddy,项目名称:mame,代码行数:13,代码来源:pstream.cpp

示例12: l2tpvpn_listen

/* -----------------------------------------------------------------------------
    l2tpvpn_listen - called by vpnd to setup listening socket
----------------------------------------------------------------------------- */
int l2tpvpn_listen(void)
{
        
    if (listen_sockfd <= 0)
        return -1;
    
    if (!opt_noipsec) {
        vpnlog(LOG_INFO, "VPND L2TP plugin:  start racoon...\n");
        /* start racoon */
        if (start_racoon(0 /*pppbundle*/, 0 /*"racoon.l2tp"*/) < 0) {
            vpnlog(LOG_ERR, "VPND L2TP plugin: cannot start racoon...\n");
            return -1;
        }
        /* XXX if we started racoon, we will need to stop it */
        /* racoon should probably provide a control API */
        need_stop_racoon = 1;
    }

    set_flag(listen_sockfd, debug, L2TP_FLAG_DEBUG);
    set_flag(listen_sockfd, 1, L2TP_FLAG_CONTROL);

    /* unknown src and dst addresses */
    any_address.sin_len = sizeof(any_address);
    any_address.sin_family = AF_INET;
    any_address.sin_port = 0;
    any_address.sin_addr.s_addr = INADDR_ANY;
    
    /* bind the socket in the kernel with L2TP port */
    listen_address.sin_len = sizeof(listen_address);
    listen_address.sin_family = AF_INET;
    listen_address.sin_port = L2TP_UDP_PORT;
    listen_address.sin_addr.s_addr = INADDR_ANY;
    l2tp_set_ouraddress(listen_sockfd, (struct sockaddr *)&listen_address);
    our_address = listen_address;

    /* add security policies */
    if (!opt_noipsec) { 
        if (configure_racoon(&our_address, &any_address, 0, IPPROTO_UDP, opt_ipsecsharedsecret, opt_ipsecsharedsecrettype)
            || require_secure_transport((struct sockaddr *)&any_address, (struct sockaddr *)&listen_address, IPPROTO_UDP, "in"))  {
            vpnlog(LOG_ERR, "VPND L2TP plugin: cannot configure secure transport...\n");
            return -1;
        }
        /* set IPSec Key management to prefer most recent key */
        if (set_key_preference(&key_preference, 0))
            vpnlog(LOG_ERR, "VPND L2TP plugin: cannot set IPSec Key management preference (error %d)\n", errno);

        secure_transport = 1;
    }

    return listen_sockfd;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:54,代码来源:main.c

示例13: check_seekable

void pifilestream::vseek(pos_type n)
{
	check_seekable();
	if (fseek((FILE *) m_file, SEEK_SET, n) < 0)
		set_flag(FLAG_ERROR);
	else
		m_pos = n;
	if (feof((FILE *) m_file))
		set_flag(FLAG_EOF);
	else
		clear_flag(FLAG_EOF);
	if (ferror((FILE *) m_file))
		set_flag(FLAG_ERROR);
}
开发者ID:kkklatu,项目名称:mame,代码行数:14,代码来源:pstream.c

示例14: pfm_to_gsf_flags

void pfm_to_gsf_flags (NV_U_INT32 pfm_flags, NV_U_BYTE *gsf_flags)
{
  *gsf_flags = 0;


  if ((pfm_flags & PFM_MANUALLY_INVAL) || (pfm_flags & PFM_FILTER_INVAL))
    {
      if (pfm_flags & PFM_MANUALLY_INVAL)
        {
          set_flag (gsf_flags, HMPS_IGNORE_MANUALLY_EDITED);
        }
      else
        {
          set_flag (gsf_flags, HMPS_IGNORE_FILTER_EDITED);
        }
    }
  else
    {
      if (pfm_flags & PFM_SELECTED_SOUNDING) set_flag (gsf_flags, HMPS_SELECTED_LEAST);

      if (pfm_flags & PFM_SUSPECT) set_flag (gsf_flags, HMPS_SELECTED_SPARE_1);

      if (pfm_flags & PFM_SELECTED_FEATURE) set_flag (gsf_flags, HMPS_SELECTED_CONTACT);
    }

  if (pfm_flags & PFM_USER_02) set_flag (gsf_flags, HMPS_INFO_NOT_1X_IHO);

  if (pfm_flags & PFM_USER_03) set_flag (gsf_flags, HMPS_IGNORE_NOT_2X_IHO);

  if (pfm_flags & PFM_USER_04) set_flag (gsf_flags, HMPS_IGNORE_FOOTPRINT_TOO_BIG);
}
开发者ID:dmagiccys,项目名称:pfmabe,代码行数:31,代码来源:gsf_flags.cpp

示例15: main

int main(void)
{
	flag_init();
	set_flag(UP);
	_delay_ms(1000);
	while (1)
	{
		set_flag(RIGHT);
		_delay_ms(2000);
		set_flag(LEFT);
		_delay_ms(2000);
	}
	return (0);
}
开发者ID:vlitan,项目名称:Anvil,代码行数:14,代码来源:flag_test.c


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