generates exactly 1 instruction.
484236
private void primitive(int typeCode, Object obj) {
        switch (typeCode) {
        case T_BOOLEAN:
            dest.emit(LDC, ((Boolean) obj).booleanValue()? 1 : 0);
            break;
        case T_CHAR:
            dest.emit(LDC, ((Character) obj).charValue());
            break;
        case T_BYTE:
        case T_SHORT:
            dest.emit(LDC, ((Number) obj).intValue());
            break;
        case T_INT:
        case T_FLOAT:
        case T_LONG:
        case T_DOUBLE:
            dest.emitGeneric(LDC, new Object[] { obj });
            break;
        default:
            throw new IllegalArgumentException("not supported: " + typeCode);
        }
    }
717388
def generate_nonce(length=8):
    """"""
    return ''.join([str(random.SystemRandom().randint(0, 9)) for i in range(length)])
429758
def generate_i
      return (begin
        bytes = (time_low << 96) + (time_mid << 80) +
          (time_hi_and_version << 64) + (clock_seq_hi_and_reserved << 56) +
          (clock_seq_low << 48)
        for i in 0..5
          bytes += (nodes[i] << (40 - (i * 8)))
        end
        bytes
      end)
    end
206891
def emit(mem):
    

    def output_join(output, new_chunk):
        """ Extends output instruction list
        performing a little peep-hole optimization
        """
        changed = True and OPTIONS.optimization.value > 0  # Only enter here if -O0 was not set

        while changed and new_chunk:
            if output:
                a1 = output[-1]  # Last output instruction
                i1 = inst(a1)
                o1 = oper(a1)
            else:
                a1 = i1 = o1 = None

            if len(output) > 1:
                a0 = output[-2]
                i0 = inst(a0)
                o0 = oper(a0)
            else:
                a0 = i0 = o0 = None

            a2 = new_chunk[0]  # Fist new output instruction
            i2 = inst(a2)
            o2 = oper(a2)

            if OPT00 and i2[-1] == ':':
                # Ok, a2 is a label
                # check if the above starts with jr / jp
                if i1 in ('jp', 'jr') and o1[0] == i2[:-1]:
                    # Ok remove the above instruction
                    output.pop()
                    changed = True
                    continue

            if OPT01 and i1 == 'push' and i2 == 'pop' and o1[0] == o2[0]:
                # Ok, we have a push/pop sequence which refers to
                # the same register pairs
                # Ok, remove these instructions (both)
                output.pop()
                new_chunk = new_chunk[1:]
                changed = True
                continue

            if (
                OPT03 and
                (i1 == 'sbc' and
                 o1[0] == o1[1] == 'a' and
                 i2 == 'or' and
                 o2[0] == 'a' and
                 len(new_chunk) > 1)
            ):
                a3 = new_chunk[1]
                i3 = inst(a3)
                o3 = oper(a3)
                c = condition(a3)
                if i3 in ('jp', 'jr') and c in ('z', 'nz'):
                    c = 'nc' if c == 'z' else 'c'
                    changed = True
                    output.pop()
                    new_chunk.pop(0)
                    new_chunk[0] = '%s %s, %s' % (i3, c, o3[0])
                    continue

            if OPT04 and i1 == 'push' and i2 == 'pop':
                if 'af' in (o1[0], o2[0]):
                    output.pop()
                    new_chunk[0] = 'ld %s, %s' % (o2[0][0], o1[0][0])
                    changed = True
                    continue

                if o1[0] in ('hl', 'de') and o2[0] in ('hl', 'de'):
                    # push hl; push de; pop hl; pop de || push de; push hl; pop de; pop hl => ex de, hl
                    if len(new_chunk) > 1 and len(output) > 1 and oper(new_chunk[1])[0] == o1[0] and \
                            o2[0] == oper(output[-2])[0] and \
                            inst(output[-2]) == 'push' and inst(new_chunk[1]) == 'pop':
                        output.pop()
                        new_chunk.pop(0)
                        new_chunk.pop(0)
                        output[-1] = 'ex de, hl'
                        changed = True
                        continue

                    # push hl; pop de || push de ; pop hl
                    if len(new_chunk) > 1 and inst(new_chunk[1]) in ('pop', 'ld') and oper(new_chunk[1])[0] == o1[0]:
                        output.pop()
                        new_chunk[0] = 'ex de, hl'
                        changed = True
                        continue

                if o1[0] not in ('ix', 'iy') and o2[0] not in ('ix', 'iy'):
                    # Change push XX, pop YY sequence with ld Yh, Xl; ld Yl, Xl
                    output.pop()
                    new_chunk = ['ld %s, %s' % (o2[0][0], o1[0][0])] + new_chunk
                    new_chunk[1] = 'ld %s, %s' % (o2[0][1], o1[0][1])
                    changed = True
                    continue

            # ex af, af'; ex af, af' => <nothing>
            # ex de, hl ; ex de, hl  => <nothing>
            if OPT16 and i1 == i2 == 'ex' and o1 == o2:
                output.pop()
                new_chunk.pop(0)
                changed = True
                continue

            # Tries to optimize:
            # jp <condition>, LABEL
            # jp OTHER
            # LABEL:
            # into
            # JP !<condition>, OTHER
            # LABEL:
            if OPT17 and len(output) > 1:
                if i0 == i1 == 'jp' \
                        and i2[-1] == ':' \
                        and condition(a0) in {'c', 'nc', 'z', 'nz'} \
                        and condition(a1) is None \
                        and a2[:-1] in o0:
                    output.pop()
                    output.pop()
                    new_chunk = ['jp %s, %s' % ({'c': 'nc',
                                                 'z': 'nz',
                                                 'nc': 'c',
                                                 'nz': 'z'}[condition(a0)], o1[0])] + new_chunk
                    changed = True
                    continue

            # Tries to optimize a == b for U/Integers
            # call __EQ16
            # or a
            # jp nz, ...
            # into:
            # or a
            # sbc hl, de
            # jp z, ...
            if OPT18 and i1 == 'call' and o1[0] == '__EQ16' \
                    and i2 in {'or', 'and'} and o2[0] == 'a' \
                    and len(new_chunk) > 1:
                a3 = new_chunk[1]
                i3 = inst(a3)
                c3 = condition(a3)
                if i3 == 'jp' and c3 in {'z', 'nz'}:
                    cond = 'z' if c3 == 'nz' else 'nz'
                    new_chunk[1] = 'jp %s, %s' % (cond, oper(a3)[0])
                    output.pop()
                    new_chunk.insert(1, 'sbc hl, de')
                    changed = True
                    continue

            # Tries to optimize a == b for U/Bytes
            # sub N
            # sub 1
            # jp nc, __LABEL
            # into:
            # sub N
            # or a
            # jp nz, __LABEL
            if OPT19 and i1 == 'sub' and '1' in o1 and i2 == 'jp' and len(output) > 1:
                c2 = condition(new_chunk[0])
                if c2 in {'c', 'nc'}:
                    cond = 'z' if c2 == 'c' else 'nz'
                    new_chunk[0] = 'jp %s, %s' % (cond, o2[0])
                    if i0 in ('sub', 'dec'):
                        output.pop()
                    else:
                        output[-1] = 'or a'
                    changed = True
                    continue

            # Removes useless or a from sequence:
            # sub X
            # or a
            # jp z/nz ...
            if OPT21 and i1 == 'sub' and i2 in {'or', 'and'} and o2[0] == 'a':
                new_chunk.pop(0)
                changed = True
                continue

            # Converts:
            # ld a, (ix +/- n)
            # ld r, a
            # pop af
            # Into:
            # pop af
            # ld r, (ix +/- n)
            if OPT22 and len(output) > 1 and i1 == 'ld' and o1[0] in 'bcdehl' and o1[1] == 'a' and \
                    (i2, o2) == ('pop', ['af', 'sp']):
                if (i0, o0[:1]) == ('ld', ['a']) and RE_IX_IDX.match(o0[1]):
                    output.pop()  # Removes ld r, a
                    output.pop()  # Removes ld a, (ix + n)
                    new_chunk.insert(1, 'ld %s, %s' % (o1[0], o0[1]))  # Inserts 'ld r, (ix + n)' after 'pop af'
                    changed = True
                    continue

            # Converts:
            # ld hl, (NN) | ld hl, NN | pop hl
            # ld b, h
            # ld c, l
            # in a, (c)
            # Into:
            # ld bc, (NN) | ld bc, NN | pop bc
            # in a, (c)
            if OPT23 and len(new_chunk) > 3 and inst(new_chunk[3]) == 'in':
                ia = inst(new_chunk[1])
                oa = oper(new_chunk[1])
                ib = inst(new_chunk[2])
                ob = oper(new_chunk[2])
                if (ia, oa[0], oa[1], ib, ob[0], ob[1]) == ('ld', 'b', 'h', 'ld', 'c', 'l'):
                    ii = inst(new_chunk[0])
                    oi = oper(new_chunk[0])
                    if ii in ('pop', 'ld') and oi[0] == 'hl':
                        new_chunk[0] = ii + ' ' + 'bc' + (', %s' % oi[1] if ii == 'ld' else '')
                        new_chunk.pop(1)
                        new_chunk.pop(1)
                        changed = True
                        continue

            # Converts:
            # ld hl, (NN) | ld hl, NN | pop hl
            # ld b, h
            # ld c, l
            # out (c), a
            # Into:
            # ld bc, (NN) | ld bc, NN | pop bc
            # out (c), a
            if OPT23 and len(new_chunk) > 3 and inst(new_chunk[-1]) == 'out':
                ia = inst(new_chunk[-3])
                oa = oper(new_chunk[-3])
                ib = inst(new_chunk[-2])
                ob = oper(new_chunk[-2])
                if (ia, oa[0], oa[1], ib, ob[0], ob[1]) == ('ld', 'b', 'h', 'ld', 'c', 'l'):
                    ii = inst(new_chunk[-4])
                    oi = oper(new_chunk[-4])
                    if ii in ('pop', 'ld') and oi[0] == 'hl':
                        new_chunk[-4] = ii + ' ' + 'bc' + (', %s' % oi[1] if ii == 'ld' else '')
                        new_chunk.pop(-2)
                        new_chunk.pop(-2)
                        changed = True
                        continue

            # Converts:
            # or X | and X
            # or a | and a
            # Into:
            # or X | and X
            if OPT24 and i1 in ('and', 'or') and new_chunk[0] in ('or a', 'and a'):
                new_chunk.pop(0)
                changed = True
                continue

            # Converts:
            # ld h, X  (X != A)
            # ld a, Y
            # or/and/cp/add/sub h
            # Into:
            # ld a, Y
            # or/and/cp X
            if OPT25 and \
                    (i1 in ('cp', 'or', 'and') and o1[0] == 'h' or
                     i1 in ('sub', 'add', 'sbc', 'adc') and o1[1] == 'h') \
                    and i0 == 'ld' and o0[0] == 'a' and len(output) > 2:
                ii = inst(output[-3])
                oo = oper(output[-3])
                if i1 in ('add', 'adc', 'sbc'):
                    i1 = i1 + ' a,'
                if ii == 'ld' and oo[0] == 'h' and oo[1] != 'a':
                    output[-1] = '{0} {1}'.format(i1, oo[1])
                    output.pop(-3)
                    changed = True
                    continue

            # Converts:
            # ld a, (nn) | ld a, (ix+N)
            # inc/dec a
            # ld (nn), a | ld (ix+N), a
            # Into:
            # ld hl, _n    | <removed>
            # inc/dec (hl) | inc/dec (ix+N)
            if OPT26 and i1 in ('inc', 'dec') and o1[0] == 'a' and i0 == i2 == 'ld' and \
                    (o0[0], o0[1]) == (o2[1], o2[0]) and o0[1][0] == '(':
                new_chunk.pop(0)
                if RE_IX_IDX.match(o0[1]):
                    output[-1] = '{0} {1}'.format(i1, o0[1])
                    output.pop(-2)
                else:
                    output[-1] = '{0} (hl)'.format(i1)
                    output[-2] = 'ld hl, {0}'.format(o0[1][1:-1])
                changed = True
                continue

            # Converts:
            # ld X, Y
            # ld Y, X
            # Into:
            # ld X, Y
            if OPT02 and i1 == i2 == 'ld' and o1[0] == o2[1] and o2[0] == o1[1]:
                # This and previous instruction are LD X, Y
                # Ok, previous instruction is LD A, B and current is LD B, A. Remove this one.
                new_chunk = new_chunk[1:]
                changed = True
                continue

            # Converts:
            # ld h, X
            # or/and h
            # Into:
            # or/and X
            if OPT27 and i1 == 'ld' and o1[0] == 'h' and i2 in ('and', 'or') and o2[0] == 'h':
                output.pop()
                new_chunk[0] = '{0} {1}'.format(i2, o1[1])
                changed = True
                continue

            # Converts
            # ld a, r|(ix+/-N)|(hl)
            # ld h, a
            # ld a, XXX | pop af
            # Into:
            # ld h, r|(ix+/-N)|(hl)
            # ld a, XXX | pop af
            if OPT28 and i1 == i0 == 'ld' and o0[0] == 'a' and \
                    (o0[1] in ('a', 'b', 'c', 'd', 'e', 'h', 'l', '(hl)') or RE_IX_IDX.match(o0[1])) and \
                    (o1[0], o1[1]) == ('h', 'a') and new_chunk and (new_chunk[0] == 'pop af' or
                                                                    i2 == 'ld' and o2[0] == 'a'):

                output.pop()
                output[-1] = 'ld h, {0}'.format(o0[1])
                changed = True
                continue

            # Converts:
            # cp 0
            # Into:
            # or a
            if OPT29 and i1 == 'cp' and o1[0] == '0':
                output[-1] = 'or a'
                changed = True
                continue

            # Converts:
            # or/and X
            # jp c/nc XXX
            # Into:
            # <nothing>/jp XXX
            if OPT30 and i1 in ('and', 'or') and i2 == 'jp':
                c = condition(new_chunk[0])
                if c in ('c', 'nc'):
                    output.pop()
                    if c == 'nc':
                        new_chunk[0] = 'jp {0}'.format(o2[0])
                    else:
                        new_chunk.pop(0)
                    changed = True
                    continue

            # Converts
            # jp XXX
            # <any inst>
            # Into:
            # jp XXX
            if OPT31 and i1 == 'jp' and not condition(output[-1]) and i2 is not None and \
                    i2[-1] != ':' and new_chunk[0] not in ASMS:
                new_chunk.pop(0)
                changed = True
                continue

            # Converts:
            # call __LOADSTR
            # ld a, 1
            # call __PRINSTR
            # Into:
            # xor a
            # call __PRINTSTR
            if OPT32 and i0 == 'call' and o0[0] == '__LOADSTR' and i1 == 'ld' and tuple(o1) == ('a', '1') and \
                    i2 == 'call' and o2[0] == '__PRINTSTR':
                output.pop(-2)
                output[-1] = 'xor a'
                changed = True
                continue

            changed, new_chunk = optiblock(new_chunk)

        output.extend(new_chunk)

    output = []
    for i in mem:
        output_join(output, QUADS[i.quad[0]][1](i))
        if RE_BOOL.match(i.quad[0]):  # If it is a boolean operation convert it to 0/1 if the STRICT_BOOL flag is True
            output_join(output, convertToBool())

    changed = OPTIONS.optimization.value > 1
    while changed:
        to_remove = []

        for i, ins in enumerate(output):
            ins = ins[:-1]
            if ins not in TMP_LABELS:
                continue

            for j, ins2 in enumerate(output):
                if j == i:
                    continue
                if ins in oper(ins2):
                    break
            else:
                to_remove.append(i)

        changed = len(to_remove) > 0
        to_remove.reverse()
        for i in to_remove:
            output.pop(i)

        tmp = output
        output = []
        for i in tmp:
            output_join(output, [i])

    for i in sorted(REQUIRES):
        output.append('#include once <%s>' % i)

    return output
458549
def _generate_vdev(self, base, offset):
        
        vdev = hex(int(base, 16) + offset)[2:]
        return vdev.rjust(4, '0')
982723
def one(script, value=None, vars={}, url=None, opener=default_opener, library_paths=[]):
    
    return compile(script, vars, library_paths).one(_get_value(value, url, opener))
298734
def generateSteps(self, minStep):
        """"""
        self.checkFinite(minStep)

        if self.binary:
            base = 2.0
            mantissas = [1.0]
            exponent = math.floor(math.log(minStep, 2) - EPSILON)
        else:
            base = 10.0
            mantissas = [1.0, 2.0, 5.0]
            exponent = math.floor(math.log10(minStep) - EPSILON)

        while True:
            multiplier = base ** exponent
            for mantissa in mantissas:
                value = mantissa * multiplier
                if value >= minStep * (1.0 - EPSILON):
                    yield value
            exponent += 1
666384
def __generate(self):
        """"""
        base = []
        texted = []
        for pat in ALL_PATTERNS:
            data = pat.copy()
            data['pattern'] = data['pattern']
            data['right'] = True
            data['basekey'] = data['key']
            base.append(data)

            data = pat.copy()
            data['basekey'] = data['key']
            data['key'] += ':time_1'
            data['right'] = True
            data['pattern'] = data['pattern'] + Optional(Literal(",")).suppress() + BASE_TIME_PATTERNS['pat:time:minutes']
            data['time_format'] = '%H:%M'
            data['length'] = {'min' : data['length']['min'] + 5, 'max' : data['length']['max'] + 8}
            base.append(data)

            data = pat.copy()
            data['basekey'] = data['key']
            data['right'] = True
            data['key'] += ':time_2'
            data['pattern'] = data['pattern'] + Optional(oneOf([',', '|'])).suppress() + BASE_TIME_PATTERNS['pat:time:full']
            data['time_format'] = '%H:%M:%S'
            data['length'] = {'min' : data['length']['min'] + 9, 'max' : data['length']['max'] + 9}
            base.append(data)

        for pat in base:
            # Right
            data = pat.copy()
            data['key'] += ':t_right'
            data['pattern'] = lineStart + data['pattern'] +  Optional(oneOf([',', '|', ':', ')'])).suppress() + restOfLine.suppress()
            data['length'] = {'min' : data['length']['min'] + 1, 'max' : data['length']['max'] + 90}
            texted.append(data)

        base.extend(texted)
        self.patterns = base
1133736
@Override
    public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) {

        int flags = 0;
        if (ins instanceof InvokeInstruction) {
            flags = ValueNumber.RETURN_VALUE;
        } else if (ins instanceof ArrayInstruction) {
            flags = ValueNumber.ARRAY_VALUE;
        } else if (ins instanceof ConstantPushInstruction) {
            flags = ValueNumber.CONSTANT_VALUE;
        }

        // Get the input operands to this instruction.
        ValueNumber[] inputValueList = popInputValues(numWordsConsumed);

        // See if we have the output operands in the cache.
        // If not, push default (fresh) values for the output,
        // and add them to the cache.
        ValueNumber[] outputValueList = getOutputValues(inputValueList, numWordsProduced, flags);

        if (VERIFY_INTEGRITY) {
            checkConsumedAndProducedValues(ins, inputValueList, outputValueList);
        }

        // Push output operands on stack.
        pushOutputValues(outputValueList);
    }
1302600
def make_1r():
    """"""
    J, p = multidict({       # jobs, processing times
        1 : 1,
        2 : 3,
        3 : 2,
        4 : 2,
        })
    P = [(1,2), (1,3), (2,4)]
    R = [1]
    T = 6
    c = {}
    for j in J:
        for t in range(1,T-p[j]+2):
            c[j,t] = 1*(t-1+p[j])
    a = {
        (1,1,0):2,
        (2,1,0):2, (2,1,1):1, (2,1,2):1,
        (3,1,0):1, (3,1,1):1,
        (4,1,0):1, (4,1,1):2,
        }
    RUB = {(1,1):2, (1,2):2, (1,3):1, (1,4):2, (1,5):2, (1,6):2}
    return (J,P,R,T,p,c,a,RUB)
543444
def each
      index = 0
      while index < i_keys.get_length
        key = i_keys.get(index)
        value = i_values.get(index)
        yield key , value
        index = index + 1
      end
      self
    end
877531
def generate_one(basename, xml):
    ''''''
    
    directory = os.path.join(basename, xml.basename)
    
    print("Generating Java implementation in directory %s" % directory)
    mavparse.mkdir_p(directory)
    
    if xml.little_endian:
        xml.mavlink_endian = "MAVLINK_LITTLE_ENDIAN"
    else:
        xml.mavlink_endian = "MAVLINK_BIG_ENDIAN"
    
    if xml.crc_extra:
        xml.crc_extra_define = "1"
    else:
        xml.crc_extra_define = "0"
    
    if xml.sort_fields:
        xml.aligned_fields_define = "1"
    else:
        xml.aligned_fields_define = "0"
    
    # work out the included headers
    xml.include_list = []
    for i in xml.include:
        base = i[:-4]
        xml.include_list.append(mav_include(base))
    
    # form message lengths array
    xml.message_lengths_array = ''
    for mlen in xml.message_lengths:
        xml.message_lengths_array += '%u, ' % mlen
    xml.message_lengths_array = xml.message_lengths_array[:-2]
    
    
    
    # form message info array
    xml.message_info_array = ''
    for name in xml.message_names:
        if name is not None:
            xml.message_info_array += 'MAVLINK_MESSAGE_INFO_%s, ' % name
        else:
            # Several C compilers don't accept {NULL} for
            # multi-dimensional arrays and structs
            # feed the compiler a "filled" empty message
            xml.message_info_array += '{"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, '
    xml.message_info_array = xml.message_info_array[:-2]
    
    # add some extra field attributes for convenience with arrays
    for m in xml.message:
        m.msg_name = m.name
        if xml.crc_extra:
            m.crc_extra_arg = ", %s" % m.crc_extra
        else:
            m.crc_extra_arg = ""
        for f in m.fields:
            if f.print_format is None:
                f.c_print_format = 'NULL'
            else:
                f.c_print_format = '"%s"' % f.print_format
            f.getText = ''
            if f.array_length != 0:
                f.array_suffix = '[] = new %s[%u]' % (mavfmt(f),f.array_length)
                f.array_prefix = '*'
                f.array_tag = '_array'
                f.array_arg = ', %u' % f.array_length
                f.array_return_arg = '%s, %u, ' % (f.name, f.array_length)
                f.array_const = 'const '
                f.decode_left = ''
                f.decode_right = 'm.%s' % (f.name)
                
                f.unpackField = ''' 
        for (int i = 0; i < this.%s.length; i++) {
            this.%s[i] = payload.get%s();
        }
                ''' % (f.name, f.name, mavfmt(f, True) )
                f.packField = '''
        for (int i = 0; i < %s.length; i++) {
            packet.payload.put%s(%s[i]);
        }
                    ''' % (f.name, mavfmt(f, True),f.name)
                f.return_type = 'uint16_t'
                f.get_arg = ', %s *%s' % (f.type, f.name)
                if f.type == 'char':
                    f.c_test_value = '"%s"' % f.test_value
                    f.getText = '''
    /**
    * Sets the buffer of this message with a string, adds the necessary padding
    */
    public void set%s(String str) {
        int len = Math.min(str.length(), %d);
        for (int i=0; i<len; i++) {
            %s[i] = (byte) str.charAt(i);
        }

        for (int i=len; i<%d; i++) {            // padding for the rest of the buffer
            %s[i] = 0;
        }
    }

    /**
    * Gets the message, formated as a string
    */
    public String get%s() {
        String result = "";
        for (int i = 0; i < %d; i++) {
            if (%s[i] != 0)
                result = result + (char) %s[i];
            else
                break;
        }
        return result;

    }
                        ''' % (f.name.title(),f.array_length,f.name,f.array_length,f.name,f.name.title(),f.array_length,f.name,f.name)
                else:
                    test_strings = []
                    for v in f.test_value:
                        test_strings.append(str(v))
                    f.c_test_value = '{ %s }' % ', '.join(test_strings)
            else:
                f.array_suffix = ''
                f.array_prefix = ''
                f.array_tag = ''
                f.array_arg = ''
                f.array_return_arg = ''
                f.array_const = ''
                f.decode_left =  '%s' % (f.name)
                f.decode_right = ''
                f.unpackField = 'this.%s = payload.get%s();' % (f.name, mavfmt(f, True))
                f.packField = 'packet.payload.put%s(%s);' % (mavfmt(f, True),f.name)                   
                
                
                f.get_arg = ''
                f.return_type = f.type
                if f.type == 'char':
                    f.c_test_value = "'%s'" % f.test_value
                elif f.type == 'uint64_t':
                    f.c_test_value = "%sULL" % f.test_value                    
                elif f.type == 'int64_t':
                    f.c_test_value = "%sLL" % f.test_value                    
                else:
                    f.c_test_value = f.test_value
    
    # cope with uint8_t_mavlink_version
    for m in xml.message:
        m.arg_fields = []
        m.array_fields = []
        m.scalar_fields = []
        for f in m.ordered_fields:
            if f.array_length != 0:
                m.array_fields.append(f)
            else:
                m.scalar_fields.append(f)
        for f in m.fields:
            if not f.omit_arg:
                m.arg_fields.append(f)
                f.putname = f.name
            else:
                f.putname = f.const_value
    
    # fix types to java
    for m in xml.message:
        for f in m.ordered_fields:
            f.type = mavfmt(f)
    
    generate_CRC(directory, xml)
    
    for m in xml.message:
        generate_message_h(directory, m)
986921
public function generateNonce()
    {
        $data = function_exists('random_bytes') ? random_bytes(16) : openssl_random_pseudo_bytes(16);
        $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
        $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10

        return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
    }
647072
def instruction_EXG(self, opcode, m):
        
        high, low = divmod(m, 0x10)
        reg1 = self._get_register_obj(high)
        reg2 = self._get_register_obj(low)

        new_reg1_value = convert_differend_width(reg2, reg1)
        new_reg2_value = convert_differend_width(reg1, reg2)

        reg1.set(new_reg1_value)
        reg2.set(new_reg2_value)
1075060
def step(self):
        """"""
        op = self.code[self.instruction_pointer]
        self.instruction_pointer += 1
        op(self)
200980
public static long generate(long crc, byte []buffer, int offset, int len)
  {
    final long []crcTable = CRC_TABLE;
    
    for (int i = 0; i < len; i++) {
      final int index = ((int) crc ^ buffer[offset + i]) & 0xff;
      
      crc = (crc >>> 8) ^ crcTable[index];
    }

    return crc;
  }
216076
def op_gen(mcode):
    """"""
    gen = op_tbl[mcode[0]]
    ret = gen[0]	# opcode
    nargs = len(gen)
    i = 1
    while i < nargs:
        if i < len(mcode):	# or assume they are same len
            ret |= (mcode[i]&gen[i][0]) << gen[i][1]
        i += 1
    return ret