예제 #1
0
}


if __name__ == '__main__':
    # The following was used to automatically generate the above...
    import os
    from msl.equipment.resources.utils import CHeader

    enums = {}  # dict of all enums
    enum_ctypes = {'UnitType': 'c_short'}  # dict of enum data types

    root = r'C:\Program Files\Thorlabs\Kinesis'
    for f in os.listdir(root):
        if f.endswith('.h'):
            header = CHeader(os.path.join(root, f))
            for key, value in header.enums().items():
                if key in enums:
                    continue
                enum_ctypes[key] = value[1]
                enums[key] = value[2]

    for class_name in enums:
        print('class {}(IntEnum):'.format(class_name))
        for name, value in enums[class_name].items():
            print('    {} = {}'.format(name, value))
        print('\n')

    print('class UnitType(IntEnum):')
    print('    DISTANCE = 0')
    print('    VELOCITY = 1')
    print('    ACCELERATION = 2')
예제 #2
0
    from msl.equipment.resources.utils import CHeader

    path = r'C:\Program Files\Pico Technology\SDK\inc\ps5000aApi.h'
    fcn_regex = r'PREF0\s+PREF1\s+(\w+)\s+PREF2\s+PREF3\s+\((\w+)\)'

    header = CHeader(path)

    print('***** Constants *****')
    constants = header.constants()
    for key, value in constants.items():
        print(key, value)
    print('')

    print('***** Enums *****')
    enums = header.enums()
    for key, value in enums.items():
        print(key, value)
    print('')

    print('***** Structs *****')
    structs = header.structs()
    for key, value in structs.items():
        print(key, value)
    print('')

    print('***** Callbacks *****')
    callbacks = header.callbacks()
    for key, value in callbacks.items():
        print(key, value)
    print('')