Back to index

python3.2  3.2.2
Functions | Variables
nm2def Namespace Reference

Functions

def symbols
def export_list
def filter_Python
def main

Variables

string PYTHONLIB = 'libpython'
string PC_PYTHONLIB = 'Python'
string NM = 'nm -p -g %s'
string DEF_TEMPLATE
tuple SPECIALS

Function Documentation

def nm2def.export_list (   symbols)

Definition at line 60 of file nm2def.py.

00060 
00061 def export_list(symbols):
00062 
00063     data = []
00064     code = []
00065     for name,(addr,type) in symbols.items():
00066         if type in ('C','D'):
00067             data.append('\t'+name)
00068         else:
00069             code.append('\t'+name)
00070     data.sort()
00071     data.append('')
00072     code.sort()
00073     return ' DATA\n'.join(data)+'\n'+'\n'.join(code)
00074 
# Definition file template

Here is the caller graph for this function:

def nm2def.filter_Python (   symbols,
  specials = SPECIALS 
)

Definition at line 85 of file nm2def.py.

00085 
00086 def filter_Python(symbols,specials=SPECIALS):
00087 
00088     for name in list(symbols.keys()):
00089         if name[:2] == 'Py' or name[:3] == '_Py':
00090             pass
00091         elif name not in specials:
00092             del symbols[name]

Here is the caller graph for this function:

def nm2def.main ( void  )

Definition at line 93 of file nm2def.py.

00093 
00094 def main():
00095 
00096     s = symbols(PYTHONLIB)
00097     filter_Python(s)
00098     exports = export_list(s)
00099     f = sys.stdout # open('PC/python_nt.def','w')
00100     f.write(DEF_TEMPLATE % (exports))
00101     f.close()

Here is the call graph for this function:

def nm2def.symbols (   lib = PYTHONLIB,
  types = ('T','C',
  D 
)

Definition at line 43 of file nm2def.py.

00043 
00044 def symbols(lib=PYTHONLIB,types=('T','C','D')):
00045 
00046     lines = os.popen(NM % lib).readlines()
00047     lines = [s.strip() for s in lines]
00048     symbols = {}
00049     for line in lines:
00050         if len(line) == 0 or ':' in line:
00051             continue
00052         items = line.split()
00053         if len(items) != 3:
00054             continue
00055         address, type, name = items
00056         if type not in types:
00057             continue
00058         symbols[name] = address,type
00059     return symbols

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Initial value:
00001 """\
00002 EXPORTS
00003 %s
00004 """

Definition at line 75 of file nm2def.py.

string nm2def.NM = 'nm -p -g %s'

Definition at line 41 of file nm2def.py.

Definition at line 40 of file nm2def.py.

string nm2def.PYTHONLIB = 'libpython'

Definition at line 39 of file nm2def.py.

Initial value:
00001 (
00002     )

Definition at line 82 of file nm2def.py.