本文整理汇总了C++中setflag函数的典型用法代码示例。如果您正苦于以下问题:C++ setflag函数的具体用法?C++ setflag怎么用?C++ setflag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setflag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display_infotype_dialog
//------------------------------------------------------------------
// Display a dialog form with the information types
// Let the user to clear some checkboxes if he wants so
// Returns: true - the user clicked OK
bool display_infotype_dialog(int *respect_info, const char *cfgname)
{
ushort r = *respect_info;
if ( r == 0 ) return false;
static const char form[] =
"Loaded information type\n"
"\n"
"Please specify what information should be loaded from\n"
"the configuration file %s to the database.\n"
"\n"
"If the input file does not contain parts corresponding to\n"
"the segmentation defined in the config file, you might want\n"
"to clear the 'memory layout' checkbox or even cancel this\n"
"dialog box.\n";
char buf[MAXSTR];
char *ptr = buf + qsnprintf(buf, sizeof(buf), form, cfgname);
char *const end = buf + sizeof(buf);
int B = 1;
ushort b = 0;
if ( r & IORESP_PORT ) { b|=B; B<<=1; APPEND(ptr, end, "\n<#Rename port and I/O registers#I/O ports:C>"); }
if ( r & IORESP_AREA ) { b|=B; B<<=1; APPEND(ptr, end, "\n<#Adjust the program segmentation#Memory layout:C>"); }
if ( r & IORESP_INT ) { b|=B; APPEND(ptr, end, "\n<#Create interrupt vectors and/or entry points#Interrupts:C>"); }
APPEND(ptr, end, ">\n\n");
if ( !AskUsingForm_c(buf, &b) )
return false;
B = 1;
if ( r & IORESP_PORT ) { setflag(r, IORESP_PORT, B & b); B <<= 1; }
if ( r & IORESP_AREA ) { setflag(r, IORESP_AREA, B & b); B <<= 1; }
if ( r & IORESP_INT ) { setflag(r, IORESP_INT , B & b); }
*respect_info = r;
return true;
}
示例2: cmdParse
void cmdParse(AgiGame *state, uint8 *p) {
_v[vWordNotFound] = 0;
setflag(fEnteredCli, false);
setflag(fSaidAcceptedInput, false);
state->_vm->dictionaryWords(state->_vm->agiSprintf(state->strings[p0]));
}
示例3: DrawDisplay
/*-------------------------------------------------------------------------*/
static void
DrawDisplay(void)
{
if (strlen(dispstr) >= MAXDISP) { /* strip out some decimal digits */
char *estr = index(dispstr,'e'); /* search for exponent part */
if (!estr) dispstr[12]='\0'; /* no exp, just trunc. */
else {
char tmp[32];
if (strlen(estr) <= 4) /* leftmost 8 chars plus exponent */
snprintf(tmp, sizeof(tmp), "%.8s%s", dispstr, estr);
else /* leftmost 7 chars plus exponent */
snprintf(tmp, sizeof(tmp), "%.7s%s", dispstr, estr);
strlcpy(dispstr, tmp, sizeof(dispstr));
}
}
draw(dispstr);
setflag(XCalc_MEMORY, (flagM));
setflag(XCalc_INVERSE, (flagINV));
setflag(XCalc_DEGREE, (drgmode==DEG));
setflag(XCalc_RADIAN, (drgmode==RAD));
setflag(XCalc_GRADAM, (drgmode==GRAD));
setflag(XCalc_PAREN, (flagPAREN));
setflag(XCalc_HEX, (numbase==16));
setflag(XCalc_DEC, (numbase==10));
setflag(XCalc_OCT, (numbase==8));
}
示例4: start_file_fun
bool_t start_file_fun(void *user, const char_t *file, const char_t **xpaths) {
parserinfo_mv_t *pinfo = (parserinfo_mv_t *)user;
if( pinfo ) {
if( checkflag(pinfo->flags,MV_FLAG_TARGET) ) {
if( (strcmp(file, "stdin") == 0) &&
checkflag(pinfo->rcm.flags, RCM_WRITE_FILES) ) {
errormsg(E_WARNING, "cannot write to stdin, ignoring this file.\n");
return FALSE;
}
cp_start_target_rcm(&pinfo->rcm, file);
} else {
if( strcmp(file, "stdout") == 0 ) {
if( checkflag(pinfo->flags, MV_FLAG_SEEN_STDOUT) ) {
if( false_and_setflag(&pinfo->flags, MV_FLAG_WARN_STDOUT) ) {
errormsg(E_WARNING,
"only one stdout target allowed, ignoring remaining.\n");
}
}
setflag(&pinfo->flags, MV_FLAG_SEEN_STDOUT);
}
if( checkflag(pinfo->rcm.flags, RCM_WRITE_FILES) ) {
if( strcmp(file, "stdin") == 0 ) {
errormsg(E_WARNING, "cannot write to stdin, ignoring this file.\n");
return FALSE;
}
} else {
/* this only occurs the first time the target is seen */
if( (strcmp(file, pinfo->target) == 0) &&
pinfo->tempfile && (pinfo->tempfd != -1) ) {
open_redirect_stdout(pinfo->tempfd);
setflag(&pinfo->rcm.flags, RCM_RM_OUTPUT);
}
}
rm_start_file_rcm(&pinfo->rcm, file);
}
return TRUE;
}
return FALSE;
}
示例5: switch
void AgiEngine::updateView(VtEntry *v) {
int cel, lastCel;
if (v->flags & DONTUPDATE) {
v->flags &= ~DONTUPDATE;
return;
}
cel = v->currentCel;
lastCel = v->numCels - 1;
switch (v->cycle) {
case CYCLE_NORMAL:
if (++cel > lastCel)
cel = 0;
break;
case CYCLE_END_OF_LOOP:
if (cel < lastCel) {
debugC(5, kDebugLevelResources, "cel %d (last = %d)", cel + 1, lastCel);
if (++cel != lastCel)
break;
}
setflag(v->parm1, true);
v->flags &= ~CYCLING;
v->direction = 0;
v->cycle = CYCLE_NORMAL;
break;
case CYCLE_REV_LOOP:
if (cel) {
if (--cel)
break;
}
setflag(v->parm1, true);
v->flags &= ~CYCLING;
v->direction = 0;
v->cycle = CYCLE_NORMAL;
break;
case CYCLE_REVERSE:
if (cel == 0) {
cel = lastCel;
} else {
cel--;
}
break;
}
setCel(v, cel);
}
示例6: create_func_frame
//----------------------------------------------------------------------
bool idaapi create_func_frame(func_t *pfn)
{
if ( pfn != NULL )
{
if ( pfn->frame == BADNODE )
{
ea_t ea = pfn->startEA;
if ( ea + 12 < pfn->endEA) // minimum 4 + 4 + 2 + 2 bytes needed
{
insn_t insn[4];
for (int i=0; i<4; i++)
{
decode_insn(ea);
insn[i] = cmd;
ea += cmd.size;
}
if ( insn[0].itype == PIC_movff2 // movff FSR2L,POSTINC1
&& insn[0].Op1.addr == PIC16_FSR2L && insn[0].Op2.addr == PIC16_POSTINC1
&& insn[1].itype == PIC_movff2 // movff FSR1L,FSR2L
&& insn[1].Op1.addr == PIC16_FSR1L && insn[1].Op2.addr == PIC16_FSR2L
&& insn[2].itype == PIC_movlw // movlw <size>
&& insn[3].itype == PIC_addwf3 // addwf FSR1L,f
&& insn[3].Op1.addr == PIC16_FSR1L && insn[3].Op2.reg == F)
{
setflag((uint32 &)pfn->flags,FUNC_FRAME,1);
return add_frame(pfn, insn[2].Op1.value, 0, 0);
}
}
}
}
return 0;
}
示例7: return
node *omalloc(void) {
if (freelist isnt NULL) {
return (node *)popFree((stack **)(&freelist));
}
setflag("ERROR in omalloc: NULL freelist");
return NULL;
}
示例8: cmdEndOfLoop
void cmdEndOfLoop(AgiGame *state, uint8 *p) {
debugC(4, kDebugLevelScripts, "o%d, f%d", p0, p1);
vt.cycle = kCycleEndOfLoop;
vt.flags |= (fDontupdate | fUpdate | fCycling);
vt.parm1 = p1;
setflag(p1, false);
}
示例9: cmdMoveObj
void cmdMoveObj(AgiGame *state, uint8 *p) {
// _D (_D_WARN "o=%d, x=%d, y=%d, s=%d, f=%d", p0, p1, p2, p3, p4);
vt.motion = kMotionMoveObj;
vt.parm1 = p1;
vt.parm2 = p2;
vt.parm3 = vt.stepSize;
vt.parm4 = p4;
if (p3 != 0)
vt.stepSize = p3;
if (getVersion() < 0x2000) {
_v[p4] = 0;
vt.flags |= fUpdate | fAnimated;
} else {
setflag(p4, false);
vt.flags |= fUpdate;
}
if (p0 == 0)
state->playerControl = false;
// AGI 2.272 (ddp, xmas) doesn't call move_obj!
if (getVersion() > 0x2272)
state->_vm->moveObj(&vt);
}
示例10: cmdSetV
void cmdSetV(AgiGame *state, uint8 *p) {
if (getVersion() < 0x2000) {
_v[p0] = 1;
} else {
setflag(_v[p0], true);
}
}
示例11: cmdResetV
void cmdResetV(AgiGame *state, uint8 *p) {
if (getVersion() < 0x2000) {
_v[p0] = 0;
} else {
setflag(_v[p0], false);
}
}
示例12: cmdToggleV
void cmdToggleV(AgiGame *state, uint8 *p) {
if (getVersion() < 0x2000) {
_v[p0] ^= 1;
} else {
setflag(_v[p0], !getflag(_v[p0]));
}
}
示例13: cmdDrawPic
void cmdDrawPic(AgiGame *state, uint8 *p) {
debugC(6, kDebugLevelScripts, "=== draw pic %d ===", _v[p0]);
state->_vm->_sprites->eraseBoth();
state->_vm->_picture->decodePicture(_v[p0], true);
state->_vm->_sprites->blitBoth();
state->_vm->_sprites->commitBoth();
state->pictureShown = 0;
debugC(6, kDebugLevelScripts, "--- end of draw pic %d ---", _v[p0]);
// WORKAROUND for a script bug which exists in SQ1, logic scripts
// 20 and 110. Flag 103 is not reset correctly, which leads to erroneous
// behavior from view 46 (the spider droid). View 46 is supposed to
// follow ego and explode when it comes in contact with him. However, as
// flag 103 is not reset correctly, when the player goes down the path
// and back up, the spider is always at the base of the path (since it
// can't go up) and kills the player when he goes down at ground level
// (although the spider droid sprite itself seems to be correctly positioned).
// With this workaround, when the player goes back to picture 20 (1 screen
// above the ground), flag 103 is reset, thereby fixing this issue. Note
// that this is a script bug and occurs in the original interpreter as well.
// Fixes bug #1658514: AGI: SQ1 (2.2 DOS ENG) bizzare exploding roger
if (getGameID() == GID_SQ1 && _v[p0] == 20)
setflag(103, false);
// Simulate slowww computer. Many effects rely on this
state->_vm->pause(kPausePicture);
}
示例14: main
int
main()
{
uint32_t primes[PRIMES_SIZE] = { 0 };
for (unsigned i = 2; i <= 1000; i++) {
for (unsigned j = 2 * i; j < 1000000; j += i) {
setflag(j, primes, PRIMES_SIZE);
}
}
unsigned sum = 0;
for (unsigned i = 2; i < 1000000; i++) {
bool iscirc = true;
unsigned len = 1;
unsigned num = i;
while (num /= 10)
len++;
num = i;
for (unsigned j = 0; j < len; j++) {
if (checked(num, primes, PRIMES_SIZE)) {
iscirc = false;
break;
}
num = rotate(num, len);
}
if (iscirc)
sum++;
}
printf("%u\n", sum);
return 0;
}
示例15: set_idp_options
static const char *idaapi set_idp_options(const char *keyword,int value_type,const void *value)
{
if ( keyword == NULL )
{
static const char form[] =
"HELP\n"
"TMS320C55 specific options Ü\n"
" ßßßßßßßßßßßßßßßßßßßßßß\n"
"\n"
" Use I/O definitions \n"
"\n"
" If this option is on, IDA will use I/O definitions\n"
" from the configuration file into a macro instruction.\n"
"\n"
" Detect memory mapped registers \n"
"\n"
" If this option is on, IDA will replace addresses\n"
" by an equivalent memory mapped register.\n"
"\n"
"ENDHELP\n"
"TMS320C54 specific options\n"
"\n"
" <Use ~I~/O definitions:C>\n"
" <Detect memory mapped ~r~egisters:C>>\n"
"\n"
" <~C~hoose device name:B:0::>\n"
"\n"
"\n";
AskUsingForm_c(form, &idpflags, choose_device);
return IDPOPT_OK;
}
else
{
if ( value_type != IDPOPT_BIT ) return IDPOPT_BADTYPE;
if ( strcmp(keyword, "TMS320C55_IO") == 0 )
{
setflag(idpflags,TMS320C55_IO,*(int*)value);
return IDPOPT_OK;
}
else if ( strcmp(keyword, "TMS320C55_MMR") == 0 )
{
setflag(idpflags,TMS320C55_MMR,*(int*)value);
return IDPOPT_OK;
}
return IDPOPT_BADKEY;
}
}