예제 #1
0
    'TLI_HardwareInformation',
    'TPZ_IOSettings',
    'TSG_IOSettings',
]

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

    structs = {}
    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.structs().items():
                if key not in structs:
                    structs[key] = value

    for key, value in structs.items():
        print('class {}(Structure):'.format(key))
        print('    _fields_ = [')
        for field in value:
            print("        ('{}', {}),".format(field[1], field[0]))
        print('    ]\n\n')

    print('STRUCT_LIST = [')
    for item in sorted(structs):
        print("    '{}',".format(item))
    print(']')
예제 #2
0
    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('')

    print('***** Functions *****')
    fcns = header.functions(fcn_regex)
    for key, value in fcns.items():
        print(key, value)