bluefile.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:core-framework 作者: RedhawkSDR 项目源码 文件源码
def _unpack_header_adjunct(hdr):
    """
    Unpacks the adjunct from a BLUE file header dictionary.  Expects
    the 'adjunct' field to be a 256 byte raw string, or None (in which
    case it returns with default values).
    """
    # Convert the adjunct (file type specific) part of the header
    file_class = int(hdr['type'] / 1000)
    endian = _rep_tran[hdr['head_rep']]
    hdr.update(_unpack_blue_struct(hdr['adjunct'],
                                   _bluestructs['T%dADJUNCT' % file_class],
                                   endian))
    del hdr['adjunct']
    if file_class == 3:
        hdr['subr'] = _unpack_blue_struct_array(hdr['subr'],
                                                _bluestructs['SUBRECSTRUCT'],
                                                hdr['subrecords'], endian)
    elif file_class == 5:
        hdr['comp'] = _unpack_blue_struct_array(hdr['comp'],
                                                _bluestructs['COMPSTRUCT'],
                                                hdr['components'], endian)
        hdr['quadwords'] = _unpack_blue_struct(hdr['quadwords'],
                                               _bluestructs['T5QUADWORDS'],
                                               endian)
    elif file_class == 6:
        # For Type 6000 files, the hdr['subr'] field gets filled in from
        # information in the extended header, which is not unpacked
        # until after the main header and header adjunct are unpacked.
        # See _open_t6subrecords(), which gets called by readheader().   
        # Just initialize it to an empty list here.
        hdr['subr'] = []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号