# Path: coolamqp/framing/base.py
# BASIC_TYPES = {u'bit': (None, None, "0", None),  # special case
#                u'octet': (1, 'B', "b'\\x00'", 1),
#                u'short': (2, 'H', "b'\\x00\\x00'", 2),
#                u'long': (4, 'I', "b'\\x00\\x00\\x00\\x00'", 4),
#                u'longlong': (
#                    8, 'Q', "b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'", 8),
#                u'timestamp': (
#                    8, 'Q', "b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'", 8),
#                u'table': (None, None, "b'\\x00\\x00\\x00\\x00'", 4),
#                # special case
#                u'longstr': (None, None, "b'\\x00\\x00\\x00\\x00'", 4),
#                # special case
#                u'shortstr': (None, None, "b'\\x00'", 1),  # special case
#                }
# 
# Path: coolamqp/framing/compilation/utilities.py
# @as_unicode
# def format_field_name(field):
#     if field in (u'global', u'type'):
#         field = field + '_'
#     return field.replace('-', '_')


import math
from coolamqp.framing.base import BASIC_TYPES
from coolamqp.framing.compilation.utilities import format_field_name
    * local variables denoted with a list of Field (namedtuple) with optional prefix exist
    * function header was already emitted
    * indent_level is in multiple of fours
    * following imports exists:
        * import struct
        * from coolamqp.framing.field_table import enframe_table, deframe_table, frame_table_size
    * local variables buf and offset exist
    * local variable start_offset can be created

"""
from __future__ import absolute_import, division, print_function




def get_counter(fields, prefix=u'', indent_level=2):
    """
    Emit code that counts how long this struct is.

    :param fields: list of Field instances
    :param prefix: pass "self." is inside a class
    :param indent_level: amount of tabs
    :return: block of code that does that
    """

    parts = []
    accumulator = 0
    bits = 0
    for field in fields:
        bt = field.basic_type

# Path: coolamqp/framing/base.py
# BASIC_TYPES = {u'bit': (None, None, "0", None),  # special case
#                u'octet': (1, 'B', "b'\\x00'", 1),
#                u'short': (2, 'H', "b'\\x00\\x00'", 2),
#                u'long': (4, 'I', "b'\\x00\\x00\\x00\\x00'", 4),
#                u'longlong': (
#                    8, 'Q', "b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'", 8),
#                u'timestamp': (
#                    8, 'Q', "b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'", 8),
#                u'table': (None, None, "b'\\x00\\x00\\x00\\x00'", 4),
#                # special case
#                u'longstr': (None, None, "b'\\x00\\x00\\x00\\x00'", 4),
#                # special case
#                u'shortstr': (None, None, "b'\\x00'", 1),  # special case
#                }
# 
# Path: coolamqp/framing/compilation/utilities.py
# @as_unicode
# def format_field_name(field):
#     if field in (u'global', u'type'):
#         field = field + '_'
#     return field.replace('-', '_')


# Path: coolamqp/framing/compilation/textcode_fields.py
import math
from coolamqp.framing.base import BASIC_TYPES
from coolamqp.framing.compilation.utilities import format_field_name

    * local variables denoted with a list of Field (namedtuple) with optional prefix exist
    * function header was already emitted
    * indent_level is in multiple of fours
    * following imports exists:
        * import struct
        * from coolamqp.framing.field_table import enframe_table, deframe_table, frame_table_size
    * local variables buf and offset exist
    * local variable start_offset can be created

"""
from __future__ import absolute_import, division, print_function




def get_counter(fields, prefix=u'', indent_level=2):
    """
    Emit code that counts how long this struct is.

    :param fields: list of Field instances
    :param prefix: pass "self." is inside a class
    :param indent_level: amount of tabs
    :return: block of code that does that
    """

    parts = []
    accumulator = 0
    bits = 0
    for field in fields:
        bt = field.basic_type

        nam = prefix + format_field_name(field.name)