Пример #1
0
//------------------------------------------------------------------
// 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
0
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
0
/*-------------------------------------------------------------------------*/
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
0
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
0
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
0
//----------------------------------------------------------------------
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
0
node *omalloc(void) {
    if (freelist isnt NULL) {
        return (node *)popFree((stack **)(&freelist));
    }
    setflag("ERROR in omalloc: NULL freelist");
    return NULL;
}
Пример #8
0
namestr *nmalloc(void) {
    if (namefreelist isnt NULL) {
        return (namestr *)popFree((stack **)(&namefreelist));
    }
    setflag("ERROR in nmalloc: NULL namefreelist");
    return NULL;
}
Пример #9
0
//
// Structure allocation
//
string *smalloc(void) {
    if (stringfreelist isnt NULL) {
        return (string *)popFree((stack **)(&stringfreelist));
    }
    setflag("ERROR in smalloc: NULL stringfreelist");
    return NULL;
}
Пример #10
0
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);
}
Пример #11
0
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);
}
Пример #12
0
void cmdSetV(AgiGame *state, uint8 *p) {
	if (getVersion() < 0x2000) {
		_v[p0] = 1;
	} else {
		setflag(_v[p0], true);
	}
}
Пример #13
0
void cmdResetV(AgiGame *state, uint8 *p) {
	if (getVersion() < 0x2000) {
		_v[p0] = 0;
	} else {
		setflag(_v[p0], false);
	}
}
Пример #14
0
void cmdToggleV(AgiGame *state, uint8 *p) {
	if (getVersion() < 0x2000) {
		_v[p0] ^= 1;
	} else {
		setflag(_v[p0], !getflag(_v[p0]));
	}
}
Пример #15
0
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);
}
Пример #16
0
Файл: 035.c Проект: ilyak/euler
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;
}
Пример #17
0
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;
  }
}
Пример #18
0
/**
 * Set up new room.
 * This function is called when ego enters a new room.
 * @param n room number
 */
void AgiEngine::newRoom(int n) {
	VtEntry *v;
	int i;

	// Simulate slowww computer.
	// Many effects rely on it.
	pause(kPauseRoom);

	debugC(4, kDebugLevelMain, "*** room %d ***", n);
	_sound->stopSound();

	i = 0;
	for (v = _game.viewTable; v < &_game.viewTable[MAX_VIEWTABLE]; v++) {
		v->entry = i++;
		v->flags &= ~(ANIMATED | DRAWN);
		v->flags |= UPDATE;
		v->stepTime = 1;
		v->stepTimeCount = 1;
		v->cycleTime = 1;
		v->cycleTimeCount = 1;
		v->stepSize = 1;
	}
	agiUnloadResources();

	_game.playerControl = true;
	_game.block.active = false;
	_game.horizon = 36;
	_game.vars[vPrevRoom] = _game.vars[vCurRoom];
	_game.vars[vCurRoom] = n;
	_game.vars[vBorderTouchObj] = 0;
	_game.vars[vBorderCode] = 0;
	_game.vars[vEgoViewResource] = _game.viewTable[0].currentView;

	agiLoadResource(rLOGIC, n);

	// Reposition ego in the new room
	switch (_game.vars[vBorderTouchEgo]) {
	case 1:
		_game.viewTable[0].yPos = _HEIGHT - 1;
		break;
	case 2:
		_game.viewTable[0].xPos = 0;
		break;
	case 3:
		_game.viewTable[0].yPos = HORIZON + 1;
		break;
	case 4:
		_game.viewTable[0].xPos = _WIDTH - _game.viewTable[0].xSize;
		break;
	}

	_game.vars[vBorderTouchEgo] = 0;
	setflag(fNewRoomExec, true);

	_game.exitAllLogics = true;

	writeStatus();
	writePrompt();
}
Пример #19
0
//
// argument/struture access
//
node *nextarg(node **pargs) {
    if (not consp(*pargs) or nullp(*pargs)) {
        setflag("too few arguments\n");
    }
    node *arg = car(*pargs);
    *pargs = cdr(*pargs);
    return arg;
}
inline bool set_enum_flag(enum_t id, uint32 bit, bool set)
{
  if ( id == BADNODE ) return false;
  netnode n(id);
  uint32 f = uint32(n.altval(ENUM_FLAGS));
  setflag(f, bit, set);
  return n.altset(ENUM_FLAGS, f) != 0;
}
Пример #21
0
void
rf_set_ugid(address_item *addr, ugid_block *ugid)
{
if (ugid->uid_set)
  {
  addr->uid = ugid->uid;
  setflag(addr, af_uid_set);
  }

if (ugid->gid_set)
  {
  addr->gid = ugid->gid;
  setflag(addr, af_gid_set);
  }

if (ugid->initgroups) setflag(addr, af_initgroups);
}
Пример #22
0
/** @brief create a thread result must be unreferenced
  *
  * @note If the manager thread has not yet started this will start the manager thread.
  * @warning @ref THREAD_OPTION_RETURN flag controls the return of this function.
  * @warning Threads should periodically check the result of framework_threadok() and cleanup or use @ref THREAD_OPTION_CANCEL
  * @param func Function to run thread on.
  * @param cleanup Cleanup function to run.
  * @param sig_handler Thread signal handler.
  * @param data Data to pass to callbacks.
  * @param flags Options of @ref thread_option_flags passed
  * @returns a thread structure that must be un referencend OR NULL depending on flags.*/
extern struct thread_pvt *framework_mkthread(threadfunc func, threadcleanup cleanup, threadsighandler sig_handler, void *data, int flags) {
	struct thread_pvt *thread;
	struct threadcontainer *tc = NULL;

	/*Grab a reference for threads in this scope start up if we can*/
	if (!(tc = (objref(threads)) ? threads : NULL)) {
		if (!thread_can_start) {
			return NULL;
		} else if (!startthreads()) {
			return NULL;
		}
		if (!(tc = (objref(threads)) ? threads : NULL)) {
			return NULL;
		}
	}

	objlock(tc);
	/* dont allow threads if no manager or it not started*/
	if ((!tc->manager || !func) && (func != managethread)) {
		/*im shuting down*/
		objunlock(tc);
		objunref(tc);
		return NULL;
	} else if (!(thread = objalloc(sizeof(*thread), free_thread))) {
		/* could not create*/
		objunlock(tc);
		objunref(tc);
		return NULL;
	}

	thread->data = (objref(data)) ? data : NULL;
	thread->flags = flags << 16;
	thread->cleanup = cleanup;
	thread->sighandler = sig_handler;
	thread->func = func;
	objunlock(tc);

	/* start thread and check it*/
	if (pthread_create(&thread->thr, NULL, threadwrap, thread) || pthread_kill(thread->thr, 0)) {
		objunref(thread);
		objunref(tc);
		return NULL;
	}

	/*Activate the thread it needs to be flaged to run or it will die*/
	objlock(tc);
	addtobucket(tc->list, thread);
	setflag(thread, TL_THREAD_RUN);
	objunlock(tc);
	objunref(tc);

	if (testflag(thread, TL_THREAD_RETURN)) {
		return thread;
	} else {
		objunref(thread);
		return NULL;
	}
}
Пример #23
0
/** Expand expression, i.e. multiply it out and return the result as a new
 *  expression. */
ex basic::expand(unsigned options) const
{
    if (nops() == 0)
        return (options == 0) ? setflag(status_flags::expanded) : *this;
    else {
        expand_map_function map_expand(options);
        return ex_to<basic>(map(map_expand)).setflag(options == 0 ? status_flags::expanded : 0);
    }
}
Пример #24
0
/* When player has entered something, it is parsed elsewhere */
static UINT8 test_said (UINT8 nwords, UINT8 *cc)
{
    int c, n = game.num_ego_words;
    int z = 0;

    if (getflag (F_said_accepted_input) || !getflag (F_entered_cli))
        return FALSE;

    /* FR:
     * I think the reason for the code below is to add some speed....
     *
     *	if (nwords != num_ego_words)
     *		return FALSE;
     *
     * In the disco scene in Larry 1 when you type "examine blonde",
     * inside the logic is expected ( said("examine", "blonde", "rol") )
     * where word("rol") = 9999
     *
     * According to the interpreter code 9999 means that whatever the
     * user typed should be correct, but it looks like code 9999 means that
     * if the string is empty at this point, the entry is also correct...
     *
     * With the removal of this code, the behaviour of the scene was
     * corrected
     */

    for (c = 0; nwords && n; c++, nwords--, n--) {
        z = lohi_getword (cc);
        cc += 2;

        switch (z) {
        case 9999:	/* rest of line (empty string counts to...) */
            nwords = 1;
            break;
        case 1:			/* any word */
            break;
        default:
            if (game.ego_words[c].id != z)
                return FALSE;
            break;
        }
    }

    /* The entry string should be entirely parsed, or last word = 9999 */
    if (n && z != 9999)
        return FALSE;

    /* The interpreter string shouldn't be entirely parsed, but next
     * word must be 9999.
     */
    if (nwords != 0 && lohi_getword(cc) != 9999)
        return FALSE;

    setflag (F_said_accepted_input, TRUE);

    return TRUE;
}
Пример #25
0
void trainerschool_test_init(){
    generic_callback1();
    *var_access(TRAINERSCHOOL_CORRECT_ANSWERS) = 0;
    fmem.tst_mem = (trainerschool_test_memory*) malloc_and_clear(sizeof(trainerschool_test_memory));
    fmem.tst_mem->current_question = 0;
    fadescreen_all(1, 0);
    callback1_set(trainerschool_test_init_components);
    setflag(MAP_BGN_AUTO_ALIGN_OFF);
}
Пример #26
0
/**
 * Check if given entry is at destination point.
 * This function is used to updated the flags of an object with move.obj
 * type motion that * has reached its final destination coordinates.
 * @param  v  Pointer to view table entry
 */
void AgiEngine::inDestination(VtEntry *v) {
	if (v->motion == MOTION_MOVE_OBJ) {
		v->stepSize = v->parm3;
		setflag(v->parm4, true);
	}
	v->motion = MOTION_NORMAL;
	if (isEgoView(v))
		_game.playerControl = true;
}
Пример #27
0
static const char *idaapi set_idp_options(const char *keyword,int value_type,const void *value)
{
  if ( keyword == NULL )
  {
    if ( ptype != PIC16) {
      static char form[] =
"HELP\n"
"PIC specific options Ü\n"
" ßßßßßßßßßßßßßßßßßßßßßß\n"
"\n"
" Use macro instructions\n"
"\n"
"       If this option is on, IDA will try to combine several instructions\n"
"       into a macro instruction\n"
"       For example,\n"
"\n"
" 	        comf    x,1\n"
" 	        incf    x,w\n"
"\n"
"       will be replaced by\n"
"\n"
"               negf    x,d\n"
"\n"
"ENDHELP\n"
"PIC specific options\n"
"\n"
" <Use ~m~acro instructions:C>>\n"
"\n"
" <~C~hoose device name:B:0::>\n"
"\n"
"\n";
      AskUsingForm_c(form, &idpflags, choose_device);
    }
    else
    {
      static char form[] =
"PIC specific options\n"
"\n"
" <~C~hoose device name:B:0::>\n"
"\n"
"\n";
      AskUsingForm_c(form, choose_device);
    }
    return IDPOPT_OK;
  }
  else
  {
    if ( value_type != IDPOPT_BIT ) return IDPOPT_BADTYPE;
    if ( strcmp(keyword, "PIC_MACRO") == 0 )
    {
      setflag(idpflags,IDP_MACRO,*(int*)value);
      return IDPOPT_OK;
    }
    return IDPOPT_BADKEY;
  }
}
Пример #28
0
bool_t reinit_parserinfo_mv(parserinfo_mv_t *pinfo) {
  if( pinfo ) {

    insert_rcm(&pinfo->rcm, &pinfo->sav);
    setflag(&pinfo->flags, MV_FLAG_TARGET);	
    
    return TRUE;
  }
  return FALSE;
}
Пример #29
0
void cmdShowPic(AgiGame *state, uint8 *p) {
	debugC(6, kDebugLevelScripts, "=== show pic ===");

	setflag(fOutputMode, false);
	state->_vm->closeWindow();
	state->_vm->_picture->showPic();
	state->pictureShown = 1;

	debugC(6, kDebugLevelScripts, "--- end of show pic ---");
}
Пример #30
0
void uiblock_setflag_children(uiblock_t *block,uint8_t flag) {
	for (uint16_t i=0;i<block->children_count;i++) {
		uiblock_t *child=block->children[i];
		if (child!=NULL) {
			uiblock_lock(child);
			setflag(child->flags,flag);
			uiblock_unlock(child);
		}
	}
}