# Path: kotori/daq/intercom/pyclibrary_ext/backend_ctypes.py
# def monkeypatch_pyclibrary_ctypes_struct():
#     pyclibrary.backends.ctypes.CTypesCLibrary._get_struct = _get_struct
# 
# Path: kotori/util/common.py
# def slm(message):
#     """sanitize log message"""
#     return str(message).replace('{', '{{').replace('}', '}}')


import os
import re
from collections import OrderedDict
from cornice.util import to_list
from pprint import pprint
from binascii import hexlify
from tabulate import tabulate
from appdirs import user_cache_dir
from ctypes import c_uint8, c_uint16, c_uint32, c_int8, c_int16, c_int32
from pyclibrary.c_parser import CParser
from pyclibrary import CLibrary, auto_init
from pyclibrary.utils import add_header_locations, add_library_locations
from sympy.core.sympify import sympify
from twisted.logger import Logger
from kotori.daq.intercom.pyclibrary_ext.c_parser import CParserEnhanced
from kotori.daq.intercom.pyclibrary_ext.backend_ctypes import monkeypatch_pyclibrary_ctypes_struct
from kotori.util.common import slm
        self.include_path = include_path or os.curdir
        self.library_path = library_path or os.curdir
        self.cache_path = cache_path or './var'

        self.include_path = os.path.abspath(self.include_path)
        self.library_path = os.path.abspath(self.library_path)

        cache_key = \
            self.include_path.replace('/', '_') + \
            u'-' + \
            u'_'.join(self.header_files) + \
            u'.pyclibrary'
        self.cache_file = os.path.join(self.cache_path, cache_key)

        logger.info('Setting up library "{}" with headers "{}", cache file is "{}"'.format(
            self.library_file, ', '.join(self.header_files), self.cache_file))

        # holding the library essentials
        self.parser = None
        self.clib = None
        self.annotations = None

        self.setup()
        self.parse()
        self.parse_annotations()
        self.load()

    def setup(self):

        # counter "ValueError: number of bits invalid for bit field"

# Path: kotori/daq/intercom/pyclibrary_ext/backend_ctypes.py
# def monkeypatch_pyclibrary_ctypes_struct():
#     pyclibrary.backends.ctypes.CTypesCLibrary._get_struct = _get_struct
# 
# Path: kotori/util/common.py
# def slm(message):
#     """sanitize log message"""
#     return str(message).replace('{', '{{').replace('}', '}}')


# Path: kotori/daq/intercom/c.py
import os
import re
from collections import OrderedDict
from cornice.util import to_list
from pprint import pprint
from binascii import hexlify
from tabulate import tabulate
from appdirs import user_cache_dir
from ctypes import c_uint8, c_uint16, c_uint32, c_int8, c_int16, c_int32
from pyclibrary.c_parser import CParser
from pyclibrary import CLibrary, auto_init
from pyclibrary.utils import add_header_locations, add_library_locations
from sympy.core.sympify import sympify
from twisted.logger import Logger
from kotori.daq.intercom.pyclibrary_ext.c_parser import CParserEnhanced
from kotori.daq.intercom.pyclibrary_ext.backend_ctypes import monkeypatch_pyclibrary_ctypes_struct
from kotori.util.common import slm

        self.include_path = include_path or os.curdir
        self.library_path = library_path or os.curdir
        self.cache_path = cache_path or './var'

        self.include_path = os.path.abspath(self.include_path)
        self.library_path = os.path.abspath(self.library_path)

        cache_key = \
            self.include_path.replace('/', '_') + \
            u'-' + \
            u'_'.join(self.header_files) + \
            u'.pyclibrary'
        self.cache_file = os.path.join(self.cache_path, cache_key)

        logger.info('Setting up library "{}" with headers "{}", cache file is "{}"'.format(
            self.library_file, ', '.join(self.header_files), self.cache_file))

        # holding the library essentials
        self.parser = None
        self.clib = None
        self.annotations = None

        self.setup()
        self.parse()
        self.parse_annotations()
        self.load()

    def setup(self):

        # counter "ValueError: number of bits invalid for bit field"

        monkeypatch_pyclibrary_ctypes_struct()