Package pygccxml :: Package msvc :: Package bsc :: Module c_wrapper |

# Source Code for Module pygccxml.msvc.bsc.c_wrapper

      1  import os
      2  import sys
      3  import ctypes
      4  import logging
      5
      6  from ctypes import *
      7  from ctypes.wintypes import ULONG
      8  from ctypes.wintypes import DWORD
      9  from ctypes.wintypes import BOOL
     10  from ctypes.wintypes import BYTE
     11  from ctypes.wintypes import WORD
     12  from ctypes.wintypes import UINT
     13
     14  from .. import config as msvc_cfg
     15  from ... import utils #import utils from pygccxml package
     16
     17  STRING = c_char_p
     18  _libraries = {}
     19  _libraries['msvcr70.dll'] = CDLL(msvc_cfg.msvcr_path, mode=RTLD_GLOBAL)
     20  _libraries['msbsc70.dll'] = CDLL(msvc_cfg.msbsc_path, mode=RTLD_GLOBAL)
     21
     22
     23  qyMac = 9
     24  refreshAllOp = 4
     25  qyDervOf = 7
     26  delOp = 1
     27  qyImpMembers = 8
     28  changeOp = 2
     29  qyRefs = 4
     30  qyCalls = 2
     31  changeIinstOp = 3
     32  qyContains = 1
     33  qyCalledBy = 3
     34  noOp = 5
     35  qyBaseOf = 6
     36  qyNil = 0
     37  addOp = 0
     38  qyDefs = 5
     39  PULONG = POINTER(ULONG)
     40  USHORT = c_ushort
     41  PUSHORT = POINTER(USHORT)
     42  UCHAR = c_ubyte
     43  PUCHAR = POINTER(UCHAR)
     44  PSZ = STRING
     45  FLOAT = c_float
     46  PFLOAT = POINTER(FLOAT)
     47  PBOOL = POINTER(BOOL)
     48  LPBOOL = POINTER(BOOL)
     49  PBYTE = POINTER(BYTE)
     50  LPBYTE = POINTER(BYTE)
     51  PINT = POINTER(c_int)
     52  LPINT = POINTER(c_int)
     53  PWORD = POINTER(WORD)
     54  LPWORD = POINTER(WORD)
     55  LPLONG = POINTER(c_long)
     56  PDWORD = POINTER(DWORD)
     57  LPDWORD = POINTER(DWORD)
     58  LPVOID = c_void_p
     59  LPCVOID = c_void_p
     60  INT = c_int
     61  PUINT = POINTER(c_uint)
     62  ULONG_PTR = POINTER(ULONG)
     63  NI = ULONG
     64  IINST = ULONG
     65  IREF = ULONG
     66  IDEF = ULONG
     67  IMOD = USHORT
     68  LINE = USHORT
     69  TYP = BYTE
     70  ATR = USHORT
     71  ATR32 = ULONG
     72  MBF = ULONG
     73  SZ = STRING
     74  SZ_CONST = STRING
     75
     76 -class Bsc(Structure):
     77      pass
     78
     79  # values for enumeration 'OPERATION'
     80  OPERATION = c_int # enum
     81 -class IinstInfo(Structure):
     82      pass
     83  IinstInfo._fields_ = [
     84      ('m_iinst', IINST),
     85      ('m_szName', SZ_CONST),
     86      ('m_ni', NI),
     87  ]
     88 -class BSC_STAT(Structure):
     89      pass
     90  BSC_STAT._fields_ = [
     91      ('cDef', ULONG),
     92      ('cRef', ULONG),
     93      ('cInst', ULONG),
     94      ('cMod', ULONG),
     95      ('cUseLink', ULONG),
     96      ('cBaseLink', ULONG),
     97  ]
     98 -class NiQ(Structure):
     99      pass
    100  NiQ._fields_ = [
    101      ('m_iinstOld', IINST),
    102      ('m_iInfoNew', IinstInfo),
    103      ('m_op', OPERATION),
    104      ('m_typ', TYP),
    105  ]
    106  pfnNotifyChange = CFUNCTYPE(BOOL, POINTER(NiQ), ULONG, ULONG_PTR)
    107
    108  # values for enumeration '_qy_'
    109  _qy_ = c_int # enum
    110  QY = _qy_
    111  Bsc._fields_ = [
    112  ]
    113  BSCOpen = _libraries['msbsc70.dll'].BSCOpen
    114  BSCOpen.restype = BOOL
    115  BSCOpen.argtypes = [SZ_CONST, POINTER(POINTER(Bsc))]
    116  BSCClose = _libraries['msbsc70.dll'].BSCClose
    117  BSCClose.restype = BOOL
    118  BSCClose.argtypes = [POINTER(Bsc)]
    119  BSCIinstInfo = _libraries['msbsc70.dll'].BSCIinstInfo
    120  BSCIinstInfo.restype = BOOL
    121  BSCIinstInfo.argtypes = [POINTER(Bsc), IINST, POINTER(SZ), POINTER(TYP), POINTER(ATR)]
    122  BSCIrefInfo = _libraries['msbsc70.dll'].BSCIrefInfo
    123  BSCIrefInfo.restype = BOOL
    124  BSCIrefInfo.argtypes = [POINTER(Bsc), IREF, POINTER(SZ), POINTER(LINE)]
    125  BSCIdefInfo = _libraries['msbsc70.dll'].BSCIdefInfo
    126  BSCIdefInfo.restype = BOOL
    127  BSCIdefInfo.argtypes = [POINTER(Bsc), IDEF, POINTER(SZ), POINTER(LINE)]
    128  BSCImodInfo = _libraries['msbsc70.dll'].BSCImodInfo
    129  BSCImodInfo.restype = BOOL
    130  BSCImodInfo.argtypes = [POINTER(Bsc), IMOD, POINTER(SZ)]
    131  BSCSzFrTyp = _libraries['msbsc70.dll'].BSCSzFrTyp
    132  BSCSzFrTyp.restype = SZ
    133  BSCSzFrTyp.argtypes = [POINTER(Bsc), TYP]
    134  BSCSzFrAtr = _libraries['msbsc70.dll'].BSCSzFrAtr
    135  BSCSzFrAtr.restype = SZ
    136  BSCSzFrAtr.argtypes = [POINTER(Bsc), ATR]
    137  BSCGetIinstByvalue = _libraries['msbsc70.dll'].BSCGetIinstByvalue
    138  BSCGetIinstByvalue.restype = BOOL
    139  BSCGetIinstByvalue.argtypes = [POINTER(Bsc), SZ, TYP, ATR, POINTER(IINST)]
    140  BSCGetOverloadArray = _libraries['msbsc70.dll'].BSCGetOverloadArray
    141  BSCGetOverloadArray.restype = BOOL
    142  BSCGetOverloadArray.argtypes = [POINTER(Bsc), SZ, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)]
    143  BSCGetUsedByArray = _libraries['msbsc70.dll'].BSCGetUsedByArray
    144  BSCGetUsedByArray.restype = BOOL
    145  BSCGetUsedByArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)]
    146  BSCGetUsesArray = _libraries['msbsc70.dll'].BSCGetUsesArray
    147  BSCGetUsesArray.restype = BOOL
    148  BSCGetUsesArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)]
    149  BSCGetBaseArray = _libraries['msbsc70.dll'].BSCGetBaseArray
    150  BSCGetBaseArray.restype = BOOL
    151  BSCGetBaseArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IINST)), POINTER(ULONG)]
    152  BSCGetDervArray = _libraries['msbsc70.dll'].BSCGetDervArray
    153  BSCGetDervArray.restype = BOOL
    154  BSCGetDervArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IINST)), POINTER(ULONG)]
    155  BSCGetMembersArray = _libraries['msbsc70.dll'].BSCGetMembersArray
    156  BSCGetMembersArray.restype = BOOL
    157  BSCGetMembersArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)]
    158  BSCGetDefArray = _libraries['msbsc70.dll'].BSCGetDefArray
    159  BSCGetDefArray.restype = BOOL
    160  BSCGetDefArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IREF)), POINTER(ULONG)]
    161  BSCGetRefArray = _libraries['msbsc70.dll'].BSCGetRefArray
    162  BSCGetRefArray.restype = BOOL
    163  BSCGetRefArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IREF)), POINTER(ULONG)]
    164  BSCGetModuleContents = _libraries['msbsc70.dll'].BSCGetModuleContents
    165  BSCGetModuleContents.restype = BOOL
    166  BSCGetModuleContents.argtypes = [POINTER(Bsc), IMOD, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)]
    167  BSCGetModuleByName = _libraries['msbsc70.dll'].BSCGetModuleByName
    168  BSCGetModuleByName.restype = BOOL
    169  BSCGetModuleByName.argtypes = [POINTER(Bsc), SZ, POINTER(IMOD)]
    170  BSCGetAllModulesArray = _libraries['msbsc70.dll'].BSCGetAllModulesArray
    171  BSCGetAllModulesArray.restype = BOOL
    172  BSCGetAllModulesArray.argtypes = [POINTER(Bsc), POINTER(POINTER(IMOD)), POINTER(ULONG)]
    173  BSCDisposeArray = _libraries['msbsc70.dll'].BSCDisposeArray
    174  BSCDisposeArray.restype = None
    175  BSCDisposeArray.argtypes = [POINTER(Bsc), c_void_p]
    176  BSCFormatDname = _libraries['msbsc70.dll'].BSCFormatDname
    177  BSCFormatDname.restype = SZ
    178  BSCFormatDname.argtypes = [POINTER(Bsc), SZ]
    179  BSCFInstFilter = _libraries['msbsc70.dll'].BSCFInstFilter
    180  BSCFInstFilter.restype = BOOL
    181  BSCFInstFilter.argtypes = [POINTER(Bsc), IINST, MBF]
    182  BSCIinstFrIref = _libraries['msbsc70.dll'].BSCIinstFrIref
    183  BSCIinstFrIref.restype = IINST
    184  BSCIinstFrIref.argtypes = [POINTER(Bsc), IREF]
    185  BSCIinstFrIdef = _libraries['msbsc70.dll'].BSCIinstFrIdef
    186  BSCIinstFrIdef.restype = IINST
    187  BSCIinstFrIdef.argtypes = [POINTER(Bsc), IDEF]
    188  BSCIinstContextIref = _libraries['msbsc70.dll'].BSCIinstContextIref
    189  BSCIinstContextIref.restype = IINST
    190  BSCIinstContextIref.argtypes = [POINTER(Bsc), IREF]
    191  BSCGetStatistics = _libraries['msbsc70.dll'].BSCGetStatistics
    192  BSCGetStatistics.restype = BOOL
    193  BSCGetStatistics.argtypes = [POINTER(Bsc), POINTER(BSC_STAT)]
    194  BSCGetModuleStatistics = _libraries['msbsc70.dll'].BSCGetModuleStatistics
    195  BSCGetModuleStatistics.restype = BOOL
    196  BSCGetModuleStatistics.argtypes = [POINTER(Bsc), IMOD, POINTER(BSC_STAT)]
    197  BSCFCaseSensitive = _libraries['msbsc70.dll'].BSCFCaseSensitive
    198  BSCFCaseSensitive.restype = BOOL
    199  BSCFCaseSensitive.argtypes = [POINTER(Bsc)]
    200  BSCSetCaseSensitivity = _libraries['msbsc70.dll'].BSCSetCaseSensitivity
    201  BSCSetCaseSensitivity.restype = BOOL
    202  BSCSetCaseSensitivity.argtypes = [POINTER(Bsc), BOOL]
    203  BSCGetAllGlobalsArray = _libraries['msbsc70.dll'].BSCGetAllGlobalsArray
    204  BSCGetAllGlobalsArray.restype = BOOL
    205  BSCGetAllGlobalsArray.argtypes = [POINTER(Bsc), MBF, POINTER(POINTER(IINST)), POINTER(ULONG)]
    206  BSCSzFrAtr2 = _libraries['msbsc70.dll'].BSCSzFrAtr2
    207  BSCSzFrAtr2.restype = SZ
    208  BSCSzFrAtr2.argtypes = [POINTER(Bsc), ATR32]
    209  BSCIinstInfo2 = _libraries['msbsc70.dll'].BSCIinstInfo2
    210  BSCIinstInfo2.restype = BOOL
    211  BSCIinstInfo2.argtypes = [POINTER(Bsc), IINST, POINTER(SZ), POINTER(TYP), POINTER(ATR32)]
    212  BSCGetIinstByvalue2 = _libraries['msbsc70.dll'].BSCGetIinstByvalue2
    213  BSCGetIinstByvalue2.restype = BOOL
    214  BSCGetIinstByvalue2.argtypes = [POINTER(Bsc), SZ, TYP, ATR32, POINTER(IINST)]
    215  OpenBSCQuery = _libraries['msbsc70.dll'].OpenBSCQuery
    216  OpenBSCQuery.restype = BOOL
    217  OpenBSCQuery.argtypes = [POINTER(Bsc)]
    218  CloseBSCQuery = _libraries['msbsc70.dll'].CloseBSCQuery
    219  CloseBSCQuery.restype = BOOL
    220  CloseBSCQuery.argtypes = []
    221  BOB = ULONG
    222  InitBSCQuery = _libraries['msbsc70.dll'].InitBSCQuery
    223  InitBSCQuery.restype = BOOL
    224  InitBSCQuery.argtypes = [QY, BOB]
    225  BobNext = _libraries['msbsc70.dll'].BobNext
    226  BobNext.restype = BOB
    227  BobNext.argtypes = []
    228  BobFrName = _libraries['msbsc70.dll'].BobFrName
    229  BobFrName.restype = BOB
    230  BobFrName.argtypes = [SZ]
    231  LszNameFrBob = _libraries['msbsc70.dll'].LszNameFrBob
    232  LszNameFrBob.restype = SZ
    233  LszNameFrBob.argtypes = [BOB]
    234  CLS = USHORT
    235
    236 -class enums:
    237 -    class MBF(utils.enum):
    238          NIL       = 0x000
    239          VARS      = 0x001
    240          FUNCS     = 0x002
    241          MACROS    = 0x004
    242          TYPES     = 0x008
    243          CLASS     = 0x010
    244          INCL      = 0x020
    245          MSGMAP    = 0x040
    246          DIALOGID  = 0x080
    247          LIBRARY   = 0x100
    248          IMPORT    = 0x200
    249          TEMPLATE  = 0x400
    250          NAMESPACE = 0x800
    251          ALL       = 0xFFF
    252
    253 -    class TYPES(utils.enum):
    254          FUNCTION  = 0x01
    255          LABEL     = 0x02
    256          PARAMETER = 0x03
    257          VARIABLE  = 0x04
    258          CONSTANT  = 0x05
    259          MACRO     = 0x06
    260          TYPEDEF   = 0x07
    261          STRUCNAM  = 0x08
    262          ENUMNAM   = 0x09
    263          ENUMMEM   = 0x0A
    264          UNIONNAM  = 0x0B
    265          SEGMENT   = 0x0C
    266          GROUP     = 0x0D
    267          PROGRAM   = 0x0E
    268          CLASSNAM  = 0x0F
    269          MEMFUNC   = 0x10
    270          MEMVAR    = 0x11
    271
    272 -    class ATTRIBUTES(utils.enum):
    273          LOCAL     = 0x001
    274          STATIC    = 0x002
    275          SHARED    = 0x004
    276          NEAR      = 0x008
    277          COMMON    = 0x010
    278          DECL_ONLY = 0x020
    279          PUBLIC    = 0x040
    280          NAMED     = 0x080
    281          MODULE    = 0x100
    282          VIRTUAL   = 0x200
    283          PRIVATE   = 0x400
    284          PROTECT   = 0x800
    285