ó
™^c           @   s=   d  d l  m Z d e f d „  ƒ  YZ d d d „  ƒ  YZ d S(   iÿÿÿÿ(   t   IntEnumt   MachineTypec           B   s8   e  Z d  Z d Z d Z d Z d Z d Z d Z d Z	 RS(   i    iL  id†  i   iÀ  iÄ  idª  i¼  (
   t   __name__t
   __module__t   unknownt   x86t   x86_64t   ia64t   armt   armntt   arm64t   efi_bytecode(    (    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pyR      s   t   Imagec           B   s5   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z RS(   i   c         C   sA   d d l  m } | |  _ t ƒ  |  _ t ƒ  |  _ | ƒ  |  _ d  S(   Niÿÿÿÿ(   t   StringTable(   t   peachpy.formats.mscoff.sectionR   t   abit   listt   sectionst   symbolst   string_table(   t   selfR   t   sourceR   (    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pyt   __init__   s
    	c         C   s9   d d l  m } t | | ƒ s% t ‚ |  j j | ƒ d  S(   Niÿÿÿÿ(   t   Section(   R   R   t
   isinstancet   AssertionErrorR   t   append(   R   t   sectionR   (    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pyt   add_section$   s    c         C   s9   d d l  m } t | | ƒ s% t ‚ |  j j | ƒ d  S(   Niÿÿÿÿ(   t   Symbol(   t   peachpy.formats.mscoff.symbolR   R   R   R   R   (   R   t   symbolR   (    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pyt
   add_symbol*   s    c         C   sR  d d l  m } | |  j j ƒ } d d  l } xH |  j D]= } t | j | j d ƒ ƒ d k r8 |  j	 j
 | j ƒ q8 q8 WxH |  j D]= } t | j | j d ƒ ƒ d k rƒ |  j	 j
 | j ƒ qƒ qƒ Wd d l m } t ƒ  } t j t |  j ƒ | j } | |  j	 j }	 x |  j D] } |	 | j 7}	 qWx( |  j D] } |	 | | <|	 | j 7}	 q5Wd d l m }
 t ƒ  } xA |  j D]6 } | j ry|	 | | <|	 |
 j t | j ƒ 7}	 qyqyWd „  t |  j ƒ Dƒ } d „  t |  j ƒ Dƒ } d	 } d	 } | j |  j j ƒ | j t |  j ƒ ƒ | j | ƒ | j | ƒ | j t |  j ƒ ƒ | j d	 ƒ | j | ƒ } x@ |  j D]5 } | | j | |  j	 j | | | j | ƒ ƒ 7} qpWx0 |  j D]% } | | j | |  j	 j | ƒ 7} q³W| |  j	 j ƒ  7} x |  j D] } | | j  7} qùWx; |  j D]0 } x' | j D] } | | j | | ƒ 7} q*WqW| S(
   Niÿÿÿÿ(   t   Encodert   utf8i   (   R   (   t
   Relocationc         S   s#   i  |  ] \ } } | d  | “ q S(   i   (    (   t   .0t   indexR   (    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pys
   <dictcomp>R   s   	 c         S   s   i  |  ] \ } } | | “ q S(    (    (   R$   R%   R   (    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pys
   <dictcomp>S   s   	 i    (!   t   peachpy.encoderR!   R   t
   endiannesst   codecsR   t   lent   encodet   nameR   t   addR   R   R   t   dictR   t   file_header_sizet   header_sizet   sizet
   entry_sizet   content_sizeR   R#   t   relocationst	   enumeratet   uint16t   mscoff_machine_typet   uint32t   encode_headert   _stringst   gett   encode_entryt   content(   R   R!   t   encoderR(   R   R   R   t   section_offset_mapt   symbol_table_offsett   data_offsetR#   t   section_relocations_mapt   section_index_mapt   symbol_index_mapt	   timestampt
   file_flagst   datat
   relocation(    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pyR*   0   sV    !!	
		
!e#N(   R   R   R.   t   NoneR   R   R    R*   (    (    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pyR      s
   		N(    (   t   enumR    R   R   (    (    (    sI   /torch/pytorch/third_party/python-peachpy/peachpy/formats/mscoff/image.pyt   <module>   s   