def rearrange_while(prog): prog_length = len(prog) new_prog = [] tag = '' goto_time = 0 for i in range(prog_length): item = prog[i] goto_time += 1 if isinstance(item, str): if item == 'while': tag = u1().hex # tag = '12345678901234567890123456789012' new_prog.append(['tag', tag]) new_prog.append('if') else: new_prog.append(item) elif isinstance(item, list): new_prog.append(rearrange_while(item)) else: new_prog.append(item) if len(tag) == 32 and goto_time == 3: new_prog[-1] = [new_prog[-1], ['goto', tag]] return new_prog
def rearrange_if(prog): prog_length = len(prog) new_prog = [] continue_time = 0 goto_time = 0 for i in range(prog_length): if goto_time: goto_time += 1 if continue_time: continue_time -= 1 continue item = prog[i] if isinstance(item, str): if item == 'if': goto_time += 1 new_prog.append(prog[i + 1]) new_prog.append(item) continue_time += 1 else: new_prog.append(item) elif isinstance(item, list): new_prog.append(rearrange_if(item)) else: new_prog.append(item) if goto_time == 4: tag = u1().hex # tag = '12345678901234567890123456789012' new_prog[-1] = [['tag', tag], new_prog[-1]] return new_prog
def unique_id(): global __area if not __area: __area = config.get_str('AREA') return u3(u1(), __area).hex
def unique_id(): global __area if not __area: __area = 'DEV' return u3(u1(), __area).hex