Your IP : 216.73.216.213
�
��f� c @ s� d Z d d l Z d d l Z d e j d d � d Z d e j d e j d d Z d Z e d d
d � Z d d � Z d Z f Z
e
d d � Z d d � Z e
d k r� e � n d S( uE nm2def.py
Helpers to extract symbols from Unix libs and auto-generate
Windows definition files from them. Depends on nm(1). Tested
on Linux and Solaris only (-p option to nm is for Solaris only).
By Marc-Andre Lemburg, Aug 1998.
Additional notes: the output of nm is supposed to look like this:
acceler.o:
000001fd T PyGrammar_AddAccelerators
U PyGrammar_FindDFA
00000237 T PyGrammar_RemoveAccelerators
U _IO_stderr_
U exit
U fprintf
U free
U malloc
U printf
grammar1.o:
00000000 T PyGrammar_FindDFA
00000034 T PyGrammar_LabelRepr
U _PyParser_TokenNames
U abort
U printf
U sprintf
...
Even if this isn't the default output of your nm, there is generally an
option to produce this format (since it is the original v7 Unix format).
i Nu libpythoni u .au Pythoni u .dllu nm -p -g %su Tu Cu Dc C s� t j t | � j � } d d � | D� } i } x� | D] } t | � d k s9 d | k rc q9 n | j � } t | � d k r� q9 n | \ } } } | | k r� q9 n | | f | | <q9 W| S( Nc S s g | ] } | j � � q S( ( u strip( u .0u s( ( u9 /opt/alt/python33/lib64/python3.3/Tools/scripts/nm2def.pyu
<listcomp>. s u symbols.<locals>.<listcomp>i u :i ( u osu popenu NMu readlinesu lenu split( u libu typesu linesu symbolsu lineu itemsu addressu typeu name( ( u9 /opt/alt/python33/lib64/python3.3/Tools/scripts/nm2def.pyu symbols+ s
u symbolsc C s� g } g } xQ | j � D]C \ } \ } } | d k rK | j d | � q | j d | � q W| j � | j d � | j � d j | � d d j | � S( Nu Cu Du u u DATA
u
( u Cu D( u itemsu appendu sortu join( u symbolsu datau codeu nameu addru type( ( u9 /opt/alt/python33/lib64/python3.3/Tools/scripts/nm2def.pyu export_list<