# aardvark_py.py -- Python API # aardvark.bas -- Visual Basic 6 API # aardvark.cs -- C# .NET source # aardvark_net.dll -- Compiled .NET binding #========================================================================== #========================================================================== # VERSION #========================================================================== AA_API_VERSION = 0x050a # v5.10 AA_REQ_SW_VERSION = 0x050a # v5.10 import aardvark as api AA_SW_VERSION = api.py_version() & 0xffff AA_REQ_API_VERSION = (api.py_version() >> 16) & 0xffff AA_LIBRARY_LOADED = \ ((AA_SW_VERSION >= AA_REQ_SW_VERSION) and \ (AA_API_VERSION >= AA_REQ_API_VERSION)) from array import array, ArrayType import struct #========================================================================== # HELPER FUNCTIONS #========================================================================== def array_u08 (n): return array('B', '\0'*n) def array_u16 (n): return array('H', '\0\0'*n) def array_u32 (n): return array('I', '\0\0\0\0'*n)
import os import sys try: import aardvark as api except ImportError, ex1: import imp, platform ext = platform.system() == 'Windows' and '.dll' or '.so' try: api = imp.load_dynamic('aardvark', 'aardvark' + ext) except ImportError, ex2: msg = 'Error importing aardvark%s\n' % ext msg += ' Architecture of aardvark%s may be wrong\n' % ext msg += '%s\n%s' % (ex1, ex2) raise ImportError(msg) AA_SW_VERSION = api.py_version() & 0xffff AA_REQ_API_VERSION = (api.py_version() >> 16) & 0xffff AA_LIBRARY_LOADED = \ ((AA_SW_VERSION >= AA_REQ_SW_VERSION) and \ (AA_API_VERSION >= AA_REQ_API_VERSION)) from array import array, ArrayType import struct #========================================================================== # HELPER FUNCTIONS #========================================================================== def array_u08 (n): return array('B', '\0'*n) def array_u16 (n): return array('H', '\0\0'*n) def array_u32 (n): return array('I', '\0\0\0\0'*n)