Example #1
0
File: c.py Project: hiveeyes/kotori
    def setup(self):

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

        # register header- and library paths
        # https://pyclibrary.readthedocs.org/en/latest/get_started/configuration.html#specifying-headers-and-libraries-locations
        # TODO: this probably acts on a global basis; think about it
        if self.include_path:
            add_header_locations([self.include_path])
        if self.library_path:
            add_library_locations([self.library_path])

        # define extra types suitable for embedded use
        types = {
            'uint8_t': c_uint8,
            'uint16_t': c_uint16,
            'uint32_t': c_uint32,
            'int8_t': c_int8,
            'int16_t': c_int16,
            'int32_t': c_int32,
            }

        # TODO: this probably acts on a global basis; think about it
        if not (CParser._init or CLibrary._init):
            auto_init(extra_types=types)
Example #2
0
    def setup(self):

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

        # register header- and library paths
        # https://pyclibrary.readthedocs.org/en/latest/get_started/configuration.html#specifying-headers-and-libraries-locations
        # TODO: this probably acts on a global basis; think about it
        if self.include_path:
            add_header_locations([self.include_path])
        if self.library_path:
            add_library_locations([self.library_path])

        # define extra types suitable for embedded use
        types = {
            'uint8_t': c_uint8,
            'uint16_t': c_uint16,
            'uint32_t': c_uint32,
            'int8_t': c_int8,
            'int16_t': c_int16,
            'int32_t': c_int32,
        }

        # TODO: this probably acts on a global basis; think about it
        if not (CParser._init or CLibrary._init):
            auto_init(extra_types=types)
Example #3
0
# -*- coding: utf-8 -*-

import os
from pyclibrary.utils import (add_header_locations)

add_header_locations([os.path.join(os.path.dirname(__file__), 'headers')])
Example #4
0
def setup_module():
    global BACKUPS
    BACKUPS = HEADER_DIRS[:]
    add_header_locations(
        [os.path.join(os.path.dirname(__file__), '..', 'headers')])
Example #5
0
def setup_module():
    global BACKUPS
    BACKUPS = HEADER_DIRS[:]
    add_header_locations([os.path.join(os.path.dirname(__file__),
                                       '..', 'headers')])
Example #6
0
#
# Distributed under the terms of the MIT/X11 license.
#
# The full license is in the file LICENCE, distributed with this software.
# -----------------------------------------------------------------------------
"""
Windows headers are not included in this distribution due to possible
copyright issues. Thus there is the cache file 'WinDefs.cache' here
which encapsulate definitions pulled from several headers included
in Visual Studio

This script updates the WinDefs.cache file.
It has to be run on one of the following conditions:
* another Visual C/C++ compiler version is used
* the object model of the parser was updated.
"""
from __future__ import (division, unicode_literals, print_function,
                        absolute_import)
from pyclibrary.c_parser import win_defs
from pyclibrary.utils import add_header_locations

SDK_DIR = r'c:\program files\microsoft sdks\windows\v6.0a\include'

if __name__ == '__main__':
    print('parsing windows definitions (may take some while)')
    add_header_locations([SDK_DIR])
    parser = win_defs()
    print('parsed:')
    for objcls in ['variables', 'functions', 'types', 'macros', 'fnmacros']:
        print('   ', len(parser.defs[objcls]), objcls)