Sindbad~EG File Manager

Current Path : /proc/1603417/root/usr/share/gcc-8/python/libstdcxx/v6/__pycache__/
Upload File :
Current File : //proc/1603417/root/usr/share/gcc-8/python/libstdcxx/v6/__pycache__/printers.cpython-36.pyc

3

���g���@s�ddlZddlZddlZddlZddlZddlZejddkrXeZe	Z
eZe
ZejjZn6Gdd�d�Zddlm
Z
mZGdd�dej�Ze�ZdayddlZWnek
r�d	aYnXd	ayddlZeejd
�r�daWnek
r�YnXeed��rejZneZdd
�Zdadd�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&Gdd �d e�Z'Gd!d"�d"e�Z(d#d$�Z)d%d&�Z*d'd(�Z+Gd)d*�d*e�Z,d+d,�Z-d-d.�Z.Gd/d0�d0e�Z/Gd1d2�d2e�Z0Gd3d4�d4e0�Z1Gd5d6�d6e0�Z2Gd7d8�d8e�Z3Gd9d:�d:e�Z4Gd;d<�d<e�Z5Gd=d>�d>e�Z6Gd?d@�d@e�Z7GdAdB�dBe�Z8GdCdD�dDe�Z9GdEdF�dFe�Z:GdGdH�dHe�Z;dIdJ�Z<GdKdL�dLe�Z=GdMdN�dNe�Z>dOdP�Z?GdQdR�dRe�Z@GdSdT�dTe�ZAGdUdV�dVe�ZBGdWdX�dXe�ZCGdYdZ�dZe�ZDGd[d\�d\e�ZEd]d^�ZFGd_d`�d`e�ZGGdadb�dbe�ZHGdcdd�dde�ZIGdedf�dfe�ZJGdgdh�dhe�ZKGdidj�dje�ZLGdkdl�dle�ZMGdmdn�dne�ZNdodp�ZOGdqdr�dreN�ZPGdsdt�dteN�ZQGdudv�dveN�ZRGdwdx�dxeN�ZSGdydz�dze�ZTGd{d|�d|e�ZUGd}d~�d~e�ZVGdd��d�e�ZWGd�d��d�e�ZXGd�d��d�e�ZYGd�d��d�e�ZZGd�d��d�e�Z[Gd�d��d�e�Z\Gd�d��d�e�Z]Gd�d��d�e�Z^Gd�d��d�e�Z_Gd�d��d�e�Z`Gd�d��d�e�Zadd�d�d�d�d�d�d�d�d�d�d�d�g
Zbd�d�d�d�d�d�d�d�gZcGd�d��d�e�ZdGd�d��d�e�ZeGd�d��d�e�ZfGd�d��d�e�ZgGd�d��d�e�ZhGd�d��d�e�ZiGd�d��d�e�ZjGd�d��d�e�ZkGd�d��d�e�ZlGd�d��d�e�ZmdanGd�d��d�e�Zod�d��ZpGd�d��d�e�Zqd�d�dÄZrd�dńZsd�dDŽZtd�dɄZueu�dS)��N�c@seZdZdZdd�ZdS)�Iteratora:Compatibility mixin for iterators

        Instead of writing next() methods for iterators, write
        __next__() methods and use this mixin to make them work in
        Python 2 as well as Python 3.

        Idea stolen from the "six" documentation:
        <http://pythonhosted.org/six/#six.Iterator>
        cCs|j�S)N)�__next__)�self�r�0/usr/share/gcc-8/python/libstdcxx/v6/printers.py�next?sz
Iterator.nextN)�__name__�
__module__�__qualname__�__doc__rrrrrr4s	r)�imap�izipc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�UTCz5Concrete tzinfo class representing the UTC time zone.cCs
tjd�S)Nr)�datetime�	timedelta)r�dtrrr�	utcoffsetIsz
UTC.utcoffsetcCsdS)Nrr)rrrrr�tznameLsz
UTC.tznamecCs
tjd�S)Nr)rr)rrrrr�dstOszUTC.dstN)r	r
rrrrrrrrrrFsrTFZTypePrinter�ValuePrintercCsz|j�}xld|j|f}y
tj|�Stk
r6YnX|j�}t|�r^|djr^|dj}q
t	dt
|�|f��q
WdS)Nz%s::%srzCannot find type %s::%s)�strip_typedefs�tag�gdb�lookup_type�RuntimeError�fields�len�
is_base_class�type�
ValueError�str)Zorig�name�typ�searchrrrr�	find_typens
r%z__8::cGs�dj|djdd�|D���}y
tj|�Stjk
r�}zFt|krv|jddtd�}y
tj|�Stjk
rtYnX|�WYdd}~XnXdS)z8
    Lookup template specialization templ<args...>.
    z{}<{}>z, cSsg|]}t|��qSr)r!)�.0�arrr�
<listcomp>�sz%lookup_templ_spec.<locals>.<listcomp>z::�N)�format�joinrr�error�_versioned_namespace�replace)Ztempl�args�t�errr�lookup_templ_spec�s

r2cCs�d|krd|}yt|d�}Wn|jd�}YnX|j�}y
t||�Stjk
r�t|d�r�t|ddd�r�|jdd	d
�}y
t||�Stjk
r�YnXdSXdS)a�
    Lookup specialization of template nodename corresponding to containertype.

    nodename - The name of a class template, as a String
    containertype - The container, as a gdb.Type

    Return a gdb.Type for the corresponding specialization of nodename,
    or None if the type cannot be found.

    e.g. lookup_node_type('_List_node', gdb.lookup_type('std::list<int>'))
    will return a gdb.Type for the type std::_List_node<int>.
    z::zstd::�
value_typerZstdzstd::__cxx1998zstd::__debugZ__gnu_debugz
::__cxx1998::r)N)r%�template_argumentrr2rr,�is_member_of_namespacer.)�nodenameZ
containertype�valtyperrr�lookup_node_type�s&


r8cGs@t|tj�rt|�}t|�}x|D]}|j|d�r"dSq"WdS)z�
    Test whether a type is a member of one of the specified namespaces.
    The type can be specified as a string or a gdb.Type object.
    z::TF)�
isinstancer�Typer!�strip_versioned_namespace�
startswith)r#Z
namespaces�	namespacerrrr5�s
r5cCs2t|tj�r|j}dt|f}tjd||�dk	S)z�
    Test whether a type is a specialization of the named class template.
    The type can be specified as a string or a gdb.Type object.
    The template should be the name of a class template as a string,
    without any 'std' qualification.
    z(%s)?%sz
^std::%s<.*>$N)r9rr:rr-�re�match)�x�
template_namerrr�is_specialization_of�srBcCs|jtd�S)N�)r.r-)�typenamerrrr;�sr;cCs<d}d}tjddkr&tj|||d�Stj|||dd�SdS)zCRemove "fundamentals_vN" inline namespace from qualified type name.z&^std::experimental::fundamentals_v\d::zstd::experimental::rrr))�countN)�sys�version_infor>�sub)r#�pattern�replrrr�strip_fundts_namespace�s
rKcCsVt|�}|jdd�}d}x d	D]}|j||d|�}qW|d}|j|d|�}|S)
zARemove known inline namespaces from the canonical name of a type.zstd::__cxx11::zstd::zstd::experimental::�fundamentals_v1�fundamentals_v2z::zfilesystem::zv1::)rLrM)r;r.)�type_strZexpt_nsZlfts_nsZfs_nsrrr�strip_inline_namespaces�s
rOc	Cs:d}g}x,y|j|j|��Wn
|S|d7}q
WdS)z-Return a type's template arguments as a list.rr)N)�appendr4)�type_obj�n�
template_argsrrr�get_template_arg_list�srTc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SmartPtrIteratorz@An iterator for smart pointer types with a single 'child' value.cCs
||_dS)N)�_val)r�valrrr�__init__szSmartPtrIterator.__init__cCs|S)Nr)rrrr�__iter__szSmartPtrIterator.__iter__cCs$|jdkrt�d|j|_}d|fS)Nzget())rV�
StopIteration)rrWrrrr
s
zSmartPtrIterator.__next__N)r	r
rrrXrYrrrrrrUsrUc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�SharedPointerPrinterzP
    Print a shared_ptr, weak_ptr, atomic<shared_ptr>, or atomic<weak_ptr>.
    cCst|�|_||_|d|_dS)N�_M_ptr)r;�	_typenamerV�_pointer)rrDrWrrrrXs
zSharedPointerPrinter.__init__cCs
t|j�S)N)rUr^)rrrr�childrenszSharedPointerPrinter.childrencCsR|jdkrD|jddd}||d}t|jdjd�}|j|�S|jddS)Nzstd::atomicZ_M_refcountZ_M_val�_M_ir�pointerZ_M_pi)r]rVr%r�cast)rZptr_valZptr_typerrr�_get_refcountss

z#SharedPointerPrinter._get_refcountscCspd}|j�}|jjjd�}tt|��}|dkr`|d}|d}|dkrPd|}nd||df}d|j||fS)	N�emptyrZ_M_use_countZ
_M_weak_countzexpired, weak count %dzuse count %d, weak count %dr)z%s<%s> (%s))rcrVrr4r;r!r])r�stateZ	refcounts�targZusecountZ	weakcountrrr�	to_string(s
zSharedPointerPrinter.to_stringN)r	r
rrrXr_rcrgrrrrr[s
	r[cCs�|jj�}|djs&tdt|j���|j|dj�}|jj�}t|�dkr^tdt|j���|djdkrt|dS|djr�|j|dj�Stdt|j���dS)zBReturn the tuple element stored in a _Tuple_impl<N, T> base class.r)z-Unsupported implementation for std::tuple: %sr�_M_head_implN���ri)rrrr r!rbrr")rW�basesZ	head_baserrrr�_tuple_impl_get9s



rkcCshtt|j��}||krtd��|j|jj�dj�}x*|dkr^|j|jj�dj�}|d8}q6Wt|�S)z6Return the result of std::get<n>(val) on a std::tuple.z0Out of range index for std::get<N> on std::tuplerr))rrTrr rbrrk)rRrWZ
tuple_size�noderrr�	tuple_getQs
rmcCsd|jj�djj�}t|d�s(t|d�r6|dd}n$t|d�rJ|d}ntdt|���td|�S)z4Return the result of val.get() on a std::unique_ptr.rZ__uniq_ptr_dataZ__uniq_ptr_impl�_M_t�tuplez-Unsupported implementation for unique_ptr: %s)rrrrBr r!rm)rWZ	impl_typeZtuple_memberrrr�unique_ptr_get_s



rpc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�UniquePointerPrinterzPrint a unique_ptr.cCs
||_dS)N)rV)rrDrWrrrrXtszUniquePointerPrinter.__init__cCstt|j��S)N)rUrprV)rrrrr_wszUniquePointerPrinter.childrencCs|jjjd�}djt|��S)Nrzstd::unique_ptr<{}>)rVrr4r*r!)rr0rrrrgzszUniquePointerPrinter.to_stringN)r	r
rrrXr_rgrrrrrqqsrqcCs|djj|j��j�S)z7Return the value held in a __gnu_cxx::__aligned_membuf.�
_M_storage)�addressrbra�dereference)Zbufr7rrr�get_value_from_aligned_membufsruc
CsjyF|jj�dj}|dkr"|dS|dkrD|jjd�}t|d|�SWnYnXtdt|j���dS)z-Return the value held in an _List_node<_Val>.r)�_M_datarrrz!Unsupported implementation for %sN)rrr"r4rur r!)rl�memberr7rrr�get_value_from_list_node�srxc@s8eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
S)�StdListPrinterzPrint a std::list.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdListPrinter._iteratorcCs"||_|d|_|j|_d|_dS)N�_M_nextr)�	_nodetype�_basers�_head�_count)r�nodetype�headrrrrX�s
z!StdListPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz!StdListPrinter._iterator.__iter__cCsR|j|jkrt�|jj|j�j�}|d|_|j}|jd|_t|�}d||fS)Nrzr)z[%d])r|r}rZrbr{rtr~rx)r�eltrErWrrrr�s
z!StdListPrinter._iterator.__next__N)r	r
rrXrYrrrrr�	_iterator�sr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
zStdListPrinter.__init__cCs(td|jj�j�}|j||jdd�S)N�
_List_node�_M_impl�_M_node)r8rVrrar�)rrrrrr_�szStdListPrinter.childrencCs0|jdd}|d|jkr&d|jSd|jS)Nr�r�rzzempty %sz%s)rVrsr])rZheadnoderrrrg�s
zStdListPrinter.to_stringN)	r	r
rrrr�rXr_rgrrrrry�s
ryc@seZdZdd�Zdd�ZdS)�NodeIteratorPrintercCs$||_||_||_t||j�|_dS)N)rVr]�	_contnamer8rr{)rrDrWZcontnamer6rrrrX�szNodeIteratorPrinter.__init__cCs:|jdsd|jS|jdj|jj��j�}tt|��S)Nr�z(non-dereferenceable iterator for std::%s)rVr�rbr{rartr!rx)rrlrrrrg�s



zNodeIteratorPrinter.to_stringN)r	r
rrXrgrrrrr��sr�c@seZdZdZdd�ZdS)�StdListIteratorPrinterzPrint std::list::iterator.cCstj|||dd�dS)N�listr�)r�rX)rrDrWrrrrX�szStdListIteratorPrinter.__init__N)r	r
rrrXrrrrr��sr�c@seZdZdZdd�ZdS)�StdFwdListIteratorPrinterz"Print std::forward_list::iterator.cCstj|||dd�dS)N�forward_list�_Fwd_list_node)r�rX)rrDrWrrrrX�sz"StdFwdListIteratorPrinter.__init__N)r	r
rrrXrrrrr��sr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
S)�StdSlistPrinterzPrint a __gnu_cxx::slist.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSlistPrinter._iteratorcCs||_|dd|_d|_dS)N�_M_headrzr)r{r|r~)rrr�rrrrX�sz"StdSlistPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz"StdSlistPrinter._iterator.__iter__cCsL|jdkrt�|jj|j�j�}|d|_|j}|jd|_d||dfS)Nrrzr)z[%d]rv)r|rZrbr{rtr~)rr�rErrrr�s

z"StdSlistPrinter._iterator.__next__N)r	r
rrXrYrrrrrr��sr�cCs
||_dS)N)rV)rrDrWrrrrX�szStdSlistPrinter.__init__cCs td|jj�}|j|j�|j�S)Nz__gnu_cxx::_Slist_node)r8rVrr�ra)rrrrrr_�szStdSlistPrinter.childrencCs|jdddkrdSdS)Nr�rzrzempty __gnu_cxx::slistz__gnu_cxx::slist)rV)rrrrrg�szStdSlistPrinter.to_stringN)	r	r
rrrr�rXr_rgrrrrr��s
r�c@s eZdZdZdd�Zdd�ZdS)�StdSlistIteratorPrinterz!Print __gnu_cxx::slist::iterator.cCs
||_dS)N)rV)rrDrWrrrrX�sz StdSlistIteratorPrinter.__init__cCs<|jdsdStd|jj�j�}t|jdj|�j�d�S)Nr�z1non-dereferenceable iterator for __gnu_cxx::slistz__gnu_cxx::_Slist_noderv)rVr8rrar!rbrt)rrrrrrgs

z!StdSlistIteratorPrinter.to_stringN)r	r
rrrXrgrrrrr��sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
d�Z	dS)
�StdVectorPrinterzPrint a std::vector.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdVectorPrinter._iteratorcCs^||_|rH|d|_d|_|d|_|d|_|jj�j}d|j|_n||_||_d|_	dS)N�_M_pr�	_M_offset�)
�_bitvec�_item�_so�_finish�_fortr�sizeof�_isizer~)r�start�finishZbitvec�ityperrrrXs


z#StdVectorPrinter._iterator.__init__cCs|S)Nr)rrrrrYsz#StdVectorPrinter._iterator.__iter__cCs�|j}|jd|_|jr�|j|jkr4|j|jkr4t�t|jj�d|j>@�}|jd|_|j|j	krv|jd|_d|_d||fS|j|jkr�t�|jj�}|jd|_d||fSdS)Nr)rz[%d])
r~r�r�r�r�r�rZ�boolrtr�)rrEr�rrrrs 
z#StdVectorPrinter._iterator.__next__N)r	r
rrXrYrrrrrr�sr�cCs*t|�|_||_|jjd�jtjk|_dS)Nr)	r;r]rVrr4�coder�TYPE_CODE_BOOL�_is_bool)rrDrWrrrrX0s
zStdVectorPrinter.__init__cCs$|j|jdd|jdd|j�S)Nr��_M_start�	_M_finish)r�rVr�)rrrrr_6szStdVectorPrinter.childrenc	Cs�|jdd}|jdd}|jdd}|jr�|jddd}|jddd}|jddd}|j�j}d|j}||||}|||}d|jt|�t|�fSd	|jt||�t||�fSdS)
Nr�r�r�Z_M_end_of_storager�r�r�z"%s<bool> of length %d, capacity %dz%s of length %d, capacity %d)rVr�rtrr�r]�int)	rr�r��endZfor�Zbl�lengthZcapacityrrrrg;s

zStdVectorPrinter.to_stringcCsdS)N�arrayr)rrrr�display_hintMszStdVectorPrinter.display_hintN)
r	r
rrrr�rXr_rgr�rrrrr�s%r�c@s eZdZdZdd�Zdd�ZdS)�StdVectorIteratorPrinterzPrint std::vector::iterator.cCs
||_dS)N)rV)rrDrWrrrrXTsz!StdVectorIteratorPrinter.__init__cCs |jdsdSt|jdj��S)NZ
_M_currentz,non-dereferenceable iterator for std::vector)rVr!rt)rrrrrgWs
z"StdVectorIteratorPrinter.to_stringN)r	r
rrrXrgrrrrr�Qsr�c@s eZdZdZdd�Zdd�ZdS)�StdBitIteratorPrinterz@Print std::vector<bool>'s _Bit_iterator and _Bit_const_iterator.cCs
||_dS)N)rV)rrDrWrrrrX`szStdBitIteratorPrinter.__init__cCs.|jdsdSt|jdj�d|jd>@�S)Nr�z2non-dereferenceable iterator for std::vector<bool>r)r�)rVr�rt)rrrrrgcs
zStdBitIteratorPrinter.to_stringN)r	r
rrrXrgrrrrr�]sr�c@s eZdZdZdd�Zdd�ZdS)�StdBitReferencePrinterz#Print std::vector<bool>::reference.cCs
||_dS)N)rV)rrDrWrrrrXmszStdBitReferencePrinter.__init__cCs*|jdsdSt|jdj�|jd@�S)Nr�z$invalid std::vector<bool>::referenceZ_M_mask)rVr�rt)rrrrrgps
z StdBitReferencePrinter.to_stringN)r	r
rrrXrgrrrrr�jsr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
S)�StdTuplePrinterzPrint a std::tuple.c@s0eZdZedd��Zdd�Zdd�Zdd�Zd	S)
zStdTuplePrinter._iteratorcCsNt|�dkr"t|djd�rBdSn t|�dkr2dSt|�dkrBdStd��dS)Nrr)Z__tuple_baseTrFz4Top of tuple tree does not consist of a single node.)rrBrr )�nodesrrr�_is_nonempty_tuplezsz,StdTuplePrinter._iterator._is_nonempty_tuplecCs:||_|jjj�}|j|�r0|jj|dj�|_d|_dS)Nr)r}rrr�rbr~)rr�r�rrrrX�s

z"StdTuplePrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz"StdTuplePrinter._iterator.__iter__cCs�|js
t�|jjj�}t|�dkr&t�t|�dkr:td��t|�dkr`|jj|dj�}d|_n&|jj|dj�}|jj|dj�|_|jd|_|jj�}t|�dks�|djdkr�d|jd|fSd|jd|dfSdS)Nrrz/Cannot parse more than 2 nodes in a tuple tree.r)rhz[%d])	r}rZrrrr rbr~r")rr��implrrrrr�s$	
z"StdTuplePrinter._iterator.__next__N)r	r
r�staticmethodr�rXrYrrrrrr�ysr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
zStdTuplePrinter.__init__cCs|j|j�S)N)r�rV)rrrrr_�szStdTuplePrinter.childrencCs(t|jjj��dkrd|jSd|jS)Nrzempty %sz
%s containing)rrVrrr])rrrrrg�s
zStdTuplePrinter.to_stringN)	r	r
rrrr�rXr_rgrrrrr�vs
Er�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�StdStackOrQueuePrinterz!Print a std::stack or std::queue.cCst|�|_tj|d�|_dS)N�c)r;r]r�default_visualizer�_visualizer)rrDrWrrrrX�s
zStdStackOrQueuePrinter.__init__cCs
|jj�S)N)r�r_)rrrrr_�szStdStackOrQueuePrinter.childrencCsd|j|jj�fS)Nz%s wrapping: %s)r]r�rg)rrrrrg�sz StdStackOrQueuePrinter.to_stringcCst|jd�r|jj�SdS)Nr�)�hasattrr�r�)rrrrr��s
z#StdStackOrQueuePrinter.display_hintN)r	r
rrrXr_rgr�rrrrr��s
r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�RbtreeIteratorzf
    Turn an RB-tree-based container (std::map, std::set etc.) into
    a Python iterable object.
    cCs2|ddd|_|dddd|_d|_dS)Nrnr�Z
_M_node_countZ	_M_header�_M_leftr)�_size�_noder~)rZrbtreerrrrX�szRbtreeIterator.__init__cCs|S)Nr)rrrrrY�szRbtreeIterator.__iter__cCs
t|j�S)N)r�r�)rrrr�__len__�szRbtreeIterator.__len__cCs�|j|jkrt�|j}|jd|_|j|jkr�|j}|j�drl|j�d}xd|j�drh|j�d}qNWnF|j�d}x$||j�dkr�|}|j�d}qzW|j�d|kr�|}||_|S)Nr)Z_M_rightr�Z	_M_parent)r~r�rZr�rt)r�resultrl�parentrrrr�s$zRbtreeIterator.__next__N)r	r
rrrXrYr�rrrrrr��s
r�c
CsjyF|jj�dj}|dkr"|dS|dkrD|jjd�}t|d|�SWnYnXtdt|j���dS)z0Return the value held in an _Rb_tree_node<_Val>.r)Z_M_value_fieldrrrz!Unsupported implementation for %sN)rrr"r4rur r!)rlrwr7rrr�get_value_from_Rb_tree_nodesr�c@s eZdZdZdd�Zdd�ZdS)�StdRbtreeIteratorPrinterz2Print std::map::iterator, std::set::iterator, etc.cCs"||_td|jj�}|j�|_dS)N�
_Rb_tree_node)rVr8rra�
_link_type)rrDrWrrrrrXsz!StdRbtreeIteratorPrinter.__init__cCs0|jdsdS|jdj|j�j�}tt|��S)Nr�z6non-dereferenceable iterator for associative container)rVrbr�rtr!r�)rrlrrrrg#s
z"StdRbtreeIteratorPrinter.to_stringN)r	r
rrrXrgrrrrr�sr�c@s eZdZdZdd�Zdd�ZdS)�StdDebugIteratorPrinterz-Print a debug enabled version of an iterator.cCs
||_dS)N)rV)rrDrWrrrrX-sz StdDebugIteratorPrinter.__init__cCsbtjd�}|jjjd�}|jj|�d}|s<t|jj|��S|jd|dkrRdSt|jj|��S)Nz __gnu_debug::_Safe_iterator_baserZ_M_sequenceZ
_M_versionzinvalid iterator)rrrVrr4rbr!)rZ	base_typer�Zsafe_seqrrrrg2s
z!StdDebugIteratorPrinter.to_stringN)r	r
rrrXrgrrrrr�*sr�cCs|dkrdSd|S)zDReturn either "1 element" or "N elements" depending on the argument.r)z	1 elementz%d elementsr)�numrrr�num_elements=sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
d�Z	dS)
�
StdMapPrinterz"Print a std::map or std::multimap.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdMapPrinter._itercCs||_d|_||_dS)Nr)�_rbiterr~�_type)r�rbiterrrrrrXGszStdMapPrinter._iter.__init__cCs|S)Nr)rrrrrYLszStdMapPrinter._iter.__iter__cCsh|jddkr@t|j�}|j|j�j�}t|�}||_|d}n
|jd}d|j|f}|jd|_|S)Nrr�first�secondz[%d]r))r~rr�rbr�rtr�Z_pair)rrR�itemr�rrrrOs


zStdMapPrinter._iter.__next__N)r	r
rrXrYrrrrr�_iterFsr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX\s
zStdMapPrinter.__init__cCsd|jttt|j���fS)Nz
%s with %s)r]r�rr�rV)rrrrrg`szStdMapPrinter.to_stringcCs$td|jj�j�}|jt|j�|�S)Nr�)r8rVrrar�r�)rrlrrrr_dszStdMapPrinter.childrencCsdS)N�mapr)rrrrr�hszStdMapPrinter.display_hintN)
r	r
rrrr�rXrgr_r�rrrrr�Bsr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
S)�
StdSetPrinterz"Print a std::set or std::multiset.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSetPrinter._itercCs||_d|_||_dS)Nr)r�r~r�)rr�rrrrrXqszStdSetPrinter._iter.__init__cCs|S)Nr)rrrrrYvszStdSetPrinter._iter.__iter__cCs@t|j�}|j|j�j�}t|�}d|j|f}|jd|_|S)Nz[%d]r))rr�rbr�rtr�r~)rr�r�rrrrys
zStdSetPrinter._iter.__next__N)r	r
rrXrYrrrrrr�psr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
zStdSetPrinter.__init__cCsd|jttt|j���fS)Nz
%s with %s)r]r�rr�rV)rrrrrg�szStdSetPrinter.to_stringcCs$td|jj�j�}|jt|j�|�S)Nr�)r8rVrrar�r�)rrlrrrr_�szStdSetPrinter.childrenN)	r	r
rrrr�rXrgr_rrrrr�ls
r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�StdBitsetPrinterzPrint a std::bitset.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
zStdBitsetPrinter.__init__cCs
d|jS)Nz%s)r])rrrrrg�szStdBitsetPrinter.to_stringc	
Cs�y|jd}Wn
gS|j}|jtjkr8|j�j}n|g}|j}|j|}g}d}xh||kr�||}d}xF|dkr�|d@dkr�|jd||d|df�|d}|d?}qnW|d}qXW|S)NZ_M_wrr)z[%d]r�)rVrr�r�TYPE_CODE_ARRAY�targetr�rP)	rZwordsZwtypeZtsizeZnwordsr�Zbyte�w�bitrrrr_�s,


zStdBitsetPrinter.childrenN)r	r
rrrXrgr_rrrrr��sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
d�Z	dS)
�StdDequePrinterzPrint a std::deque.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdDequePrinter._itercCs(||_||_||_||_||_d|_dS)Nr)r��_p�_end�_last�_buffer_sizer~)rrlr�r��last�buffer_sizerrrrX�szStdDequePrinter._iter.__init__cCs|S)Nr)rrrrrY�szStdDequePrinter._iter.__iter__cCsr|j|jkrt�d|j|jj�f}|jd|_|jd|_|j|jkrn|jd|_|jd|_|j|j|_|S)Nz[%d]r)r)r�r�rZr~rtr�r�r�)rr�rrrr�szStdDequePrinter._iter.__next__N)r	r
rrXrYrrrrrr��sr�cCsHt|�|_||_|jjd�|_|jj}|dkr>td|�|_nd|_dS)Nrir))	r;r]rVrr4Z_elttyper�r�r�)rrDrW�sizerrrrX�s
zStdDequePrinter.__init__cCsx|jdd}|jdd}|d|dd}|d|d}|d|d}|j|||}d	|jtt|��fS)
Nr�r�r�r�r)�_M_last�_M_cur�_M_firstz
%s with %s)rVr�r]r��long)rr�r�Zdelta_nZdelta_sZdelta_er�rrrrg�szStdDequePrinter.to_stringcCs@|jdd}|jdd}|j|d|d|d|d|j�S)Nr�r�r�r�r�r�)rVr�r�)rr�r�rrrr_�szStdDequePrinter.childrencCsdS)Nr�r)rrrrr��szStdDequePrinter.display_hintN)
r	r
rrrr�rXrgr_r�rrrrr��s
r�c@s eZdZdZdd�Zdd�ZdS)�StdDequeIteratorPrinterzPrint std::deque::iterator.cCs
||_dS)N)rV)rrDrWrrrrXsz StdDequeIteratorPrinter.__init__cCs |jdsdSt|jdj��S)Nr�z+non-dereferenceable iterator for std::deque)rVr!rt)rrrrrgs
z!StdDequeIteratorPrinter.to_stringN)r	r
rrrXrgrrrrr�sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�StdStringPrinterz'Print a std::basic_string of some kind.cCs||_|jd�dk|_dS)Nz::__cxx11::basic_stringr)ri)rV�find�_new_string)rrDrWrrrrXszStdStringPrinter.__init__cCs�|jj}|jtjkr|j�}|jdd}|jrL|jd}|j|jj��}n<|j	�j�}tj
t|�d�j�}|j|�d}|j
�d}t|d�r�|j|d�S|j|d�S)	NZ_M_dataplusr�Z_M_string_lengthz::_Repr)Z	_M_length�lazy_string)r�)rVrr�r�
TYPE_CODE_REFr�r�rbr�unqualifiedrr!rartr�r��string)rr�ptrr�ZrealtypeZreptype�headerrrrrgs

zStdStringPrinter.to_stringcCsdS)Nr�r)rrrrr�*szStdStringPrinter.display_hintN)r	r
rrrXrgr�rrrrr�sr�cCs"|d}|d}|d}|||fS)z'Access the streambuf put area pointers.Z
_M_out_begZ
_M_out_curZ	_M_in_endr)�	streambuf�pbase�pptr�egptrrrr�access_streambuf_ptrs.sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�StdStringBufPrinterzPrint a std::basic_stringbuf.cCs
||_dS)N)rV)r�_rWrrrrX9szStdStringBufPrinter.__init__cCsLt|j�\}}}|rB|s"||kr2|j||d�S|j||d�S|jdS)N)r�Z	_M_string)r�rVr�)rr�r�r�rrrrg<szStdStringBufPrinter.to_stringcCsdS)Nr�r)rrrrr�Fsz StdStringBufPrinter.display_hintN)r	r
rrrXrgr�rrrrr�6s
r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�StdStringStreamPrinterz Print a std::basic_stringstream.cCsZ||_||_dd�|jj�D�d}tjd|j|�j�tjd�|_	|j	|djk|_
dS)NcSsg|]}|jr|j�qSr)rr)r&�frrrr(Usz3StdStringStreamPrinter.__init__.<locals>.<listcomp>rZ__streamz$__stream->rdbuf()�_M_stringbuf)rVr]rrrZset_convenience_variablerbrs�parse_and_eval�
_streambuf�_was_redirected)rrDrWZbasetyperrrrXMszStdStringStreamPrinter.__init__cCs$|jrd|j|jj�fS|jdS)Nz%s redirected to %sr�)r�r]r�rtrV)rrrrrgZsz StdStringStreamPrinter.to_stringcCs|jr
dSdS)Nr�)r�)rrrrr�`sz#StdStringStreamPrinter.display_hintN)r	r
rrrXrgr�rrrrr�Js
r�c@s$eZdZdd�Zdd�Zdd�ZdS)�Tr1HashtableIteratorcCsj|d|_d|_|d|_t|jd�j�|_d|_x2|j|jkrd|j|j|_|jrVP|jd|_q4WdS)NZ
_M_bucketsrZ_M_bucket_countZ_Noder))�_buckets�_bucket�
_bucket_countr%rra�
_node_typer�)r�	hashtablerrrrXgs

zTr1HashtableIterator.__init__cCs|S)Nr)rrrrrYsszTr1HashtableIterator.__iter__cCs�|jdkrt�|jj|j�}|j�d}|j�d|_|jdkr�|jd|_x2|j|jkr~|j|j|_|jrpP|jd|_qNW|S)NrZ_M_vrzr))r�rZrbr�rtr�r�r�)rrlr�rrrrvs

zTr1HashtableIterator.__next__N)r	r
rrXrYrrrrrr�fsr�c@s$eZdZdd�Zdd�Zdd�ZdS)�StdHashtableIteratorcCsR|dd|_|jjd�}|jjd�jd�}tdt|�|r>dnd�}|j�|_dS)	NZ_M_before_begin�_M_nxtr)�	rzstd::__detail::_Hash_node�trueZfalse)r�rr4r2r!rar�)rr�r7�cachedZ	node_typerrrrX�s
zStdHashtableIterator.__init__cCs|S)Nr)rrrrrY�szStdHashtableIterator.__iter__cCsR|jdkrt�|jj|j�j�}|d|_|dj}|j|jjd�j��}|j�S)Nrr�rr)	r�rZrbr�rtrsrr4ra)rr��valptrrrrr�s


zStdHashtableIterator.__next__N)r	r
rrXrYrrrrrr��sr�c@s<eZdZdZdd�Zdd�Zdd�Zedd	��Zd
d�Z	dS)
�Tr1UnorderedSetPrinterz1Print a std::unordered_set or tr1::unordered_set.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
zTr1UnorderedSetPrinter.__init__cCs|jjd�r|jS|jdS)Nzstd::tr1�_M_h)r]r<rV)rrrr�
_hashtable�sz!Tr1UnorderedSetPrinter._hashtablecCs|j�d}d|jt|�fS)N�_M_element_countz
%s with %s)rr]r�)rrErrrrg�sz Tr1UnorderedSetPrinter.to_stringcCsd|S)Nz[%d]r)�irrr�
_format_count�sz$Tr1UnorderedSetPrinter._format_countcCs@t|jtj��}|jjd�r.t|t|j���St|t	|j���S)Nzstd::tr1)
r
r�	itertoolsrEr]r<rr�rr�)r�counterrrrr_�szTr1UnorderedSetPrinter.childrenN)
r	r
rrrXrrgr�rr_rrrrr�src@s\eZdZdZdd�Zdd�Zdd�Zedd	��Zed
d��Z	edd
��Z
dd�Zdd�ZdS)�Tr1UnorderedMapPrinterz1Print a std::unordered_map or tr1::unordered_map.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
zTr1UnorderedMapPrinter.__init__cCs|jjd�r|jS|jdS)Nzstd::tr1r)r]r<rV)rrrrr�sz!Tr1UnorderedMapPrinter._hashtablecCs|j�d}d|jt|�fS)Nrz
%s with %s)rr]r�)rrErrrrg�sz Tr1UnorderedMapPrinter.to_stringccs&x |D]}x|D]
}|VqWqWdS)Nr)r�r�rrrr�_flatten�s

zTr1UnorderedMapPrinter._flattencCs|d|dfS)Nr�r�r)r�rrr�_format_one�sz"Tr1UnorderedMapPrinter._format_onecCsd|S)Nz[%d]r)rrrrr�sz$Tr1UnorderedMapPrinter._format_countcCsdt|jtj��}|jjd�r@|jt|jt|j	����}t
||�S|jt|jt|j	����}t
||�S)Nzstd::tr1)r
rrrEr]r<rrr�rrr�)rr	�datarrrr_�s
zTr1UnorderedMapPrinter.childrencCsdS)Nr�r)rrrrr��sz#Tr1UnorderedMapPrinter.display_hintN)
r	r
rrrXrrgr�rrrr_r�rrrrr
�s
r
c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
S)�StdForwardListPrinterzPrint a std::forward_list.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdForwardListPrinter._iteratorcCs||_|d|_d|_dS)Nrzr)r{r|r~)rrr�rrrrX�s
z(StdForwardListPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz(StdForwardListPrinter._iterator.__iter__cCsl|jdkrt�|jj|j�j�}|d|_|j}|jd|_|dj}|j|jjd�j	��}d||j�fS)Nrrzr)rrz[%d])
r|rZrbr{rtr~rsrr4ra)rr�rErrrrr�s


z(StdForwardListPrinter._iterator.__next__N)r	r
rrXrYrrrrrr��sr�cCs||_t|�|_dS)N)rVr;r])rrDrWrrrrX�szStdForwardListPrinter.__init__cCs(td|jj�j�}|j||jdd�S)Nr�r�r�)r8rVrrar�)rrrrrr_szStdForwardListPrinter.childrencCs*|jddddkr d|jSd|jS)Nr�r�rzrzempty %sz%s)rVr])rrrrrgs
zStdForwardListPrinter.to_stringN)	r	r
rrrr�rXr_rgrrrrr�s
rc@sBeZdZdZd
dd�Zdd�ZGdd�de�Zd	d
�Zdd�Z	dS)�SingleObjContainerPrinterz8Base class for printers of containers of single objects.NcCs||_||_||_dS)N)�_contained_valuer��_hint)rrWZvizZhintrrrrXsz"SingleObjContainerPrinter.__init__cCs(tst|�Stjjtjj�|�p&t|�S)z5Return type as a string after applying type printers.)�_use_type_printingr!r�types�apply_type_recognizers�get_type_recognizers)rrrrr�
_recognizesz$SingleObjContainerPrinter._recognizec@s$eZdZdd�Zdd�Zdd�ZdS)z$SingleObjContainerPrinter._containedcCs
||_dS)N)rV)rrWrrrrXsz-SingleObjContainerPrinter._contained.__init__cCs|S)Nr)rrrrrYsz-SingleObjContainerPrinter._contained.__iter__cCs"|jdkrt�|j}d|_d|fS)Nz[contained value])rVrZ)rZretvalrrrr"s

z-SingleObjContainerPrinter._contained.__next__N)r	r
rrXrYrrrrr�
_containedsrcCs6|jdkr|jd�St|jd�r*|jj�S|j|j�S)Nr_)rrr�r�r_)rrrrr_)s



z"SingleObjContainerPrinter.childrencCs(t|jd�r"t|jd�r"|jj�S|jS)Nr_r�)r�r�r�r)rrrrr�0s
z&SingleObjContainerPrinter.display_hint)N)
r	r
rrrXrrrr_r�rrrrrs
rc	CsH|j�j}tjddkr"t|�}nt|�}ytj|�jj	SdSdS)z{Find the name of the function referred to by the gdb.Value f,
    which should contain a function pointer from the program.rrN)
rtrsrFrGr�r�rZblock_for_pc�functionr")r�rrr�function_pointer_to_name8s

rcs4eZdZdZ�fdd�Zdd�Zedd��Z�ZS)�StdExpAnyPrinterz+Print a std::any or std::experimental::any.cs�t|�|_t|j�|_||_d|_d}d}|jd}|dk�r�t|�}|sXtd|j��dj|�}tj	||�}|s�td|j��|j
d�}	d|	k�r
g}
xPtj�D]D}y(tj
d||j
d��}|
jtj|��Wq�tjk
r�Yq�Xq�Wt|
�dk�rtd	��|
d}
n
tj|	�}
|
jd�|_d}d
|	k�r@|jddj}n(d
|	k�rZ|jdd}ntd|j��|j|jj��j�}tj|�}tt|�j||�dS)NZ
_M_managerrzInvalid function pointer in %szi({0}::_Manager_\w+<.*>)::_S_manage\((enum )?{0}::_Op, (const {0}|{0} const) ?\*, (union )?{0}::_Arg ?\*\)zUnknown manager function in %sr)zstd::stringzstd::string(?!\w)z;Cannot uniquely determine std::string type used in std::anyz::_Manager_internalrrZ	_M_bufferz::_Manager_externalr\)r;r]rKrV�_contained_typerr r*r>r?�groupr�
_string_typesrHrPrrr,rr4rsrbrartr��superrX)rrDrW�contained_value�
visualizerZmgr�funcZrx�mZmgrnameZmgrtypes�sr@Zmgrtyper)�	__class__rrrXSsX










zStdExpAnyPrinter.__init__cCsT|jdkrd|jSd|j}t|jd�r8||jj�S|j|j�}|tt|��S)Nz%s [no contained value]z%s containing r_)rr]r�r�rgrr;r!)r�descr7rrrrg�s


zStdExpAnyPrinter.to_stringcs@ttjd�j��h}d�dddtg}|�fdd�|D�O}|S)Nzstd::stringzAbasic_string<char, std::char_traits<char>, std::allocator<char> >zstd::zstd::__cxx11::csh|]}|��qSrr)r&�q)r#rr�	<setcomp>�sz1StdExpAnyPrinter._string_types.<locals>.<setcomp>)r!rrrr-)ZstringsZqualsr)r#rr�s
zStdExpAnyPrinter._string_types)	r	r
rrrXrgr�r�
__classcell__rr)r$rrPsD	rcs(eZdZdZ�fdd�Zdd�Z�ZS)�StdExpOptionalPrinterz5Print a std::optional or std::experimental::optional.c	s�t|�|_t|j�|_|d}|jjd�r8|d}|}n*|d}|d}y|d}WnYnXtj|�}|std}tt|�j||�dS)N�
_M_payloadzstd::experimental�
_M_engaged�_M_value)	r;r]rKr<rr�rr)rX)rrDrWZpayloadZengagedrr )r$rrrX�s"


zStdExpOptionalPrinter.__init__cCs:|jdkrd|jSt|jd�r4d|j|jj�fS|jS)Nz%s [no contained value]r_z%s containing %s)rr]r�r�rg)rrrrrg�s

zStdExpOptionalPrinter.to_string)r	r
rrrXrgr(rr)r$rr)�sr)cs(eZdZdZ�fdd�Zdd�Z�ZS)�StdVariantPrinterzPrint a std::variant.cs�t|j�}t|�|_|d|_|jt|�kr<d|_d}d}n@|t|j�|_|dddj}|j	|jj
��j�}tj
|�}tt|�j||d�dS)N�_M_indexZ_M_ur�rrr�)rTrr;r]�_indexrrr�rsrbrartrr�rr-rX)rrDrWZalternativesrr Zaddr)r$rrrX�s




zStdVariantPrinter.__init__cCsH|jdkrd|jSt|jd�r8d|j|j|jj�fSd|j|jfS)Nz%s [no contained value]r_z%s [index %d] containing %sz
%s [index %d])rr]r�r�r/rg)rrrrrg�s


zStdVariantPrinter.to_string)r	r
rrrXrgr(rr)r$rr-�sr-cs(eZdZdZ�fdd�Zdd�Z�ZS)�StdNodeHandlePrinterzPrint a container node handle.cs�|jjd�|_|jjd�jd�}t|jd�|_|jjd�|jk|_|d}|r~|jrbt|j��}nt	|d|j�}t
j|�}nd}d}|d}|dr�|d	nd|_t
t|�j||d
�dS)Nr)rrr�r\rrZ_M_allocr+r*r�)rr4�_value_typerBr"�_is_rb_tree_node�_is_map_noder�rtrurr�Z_allocrr0rX)rrDrWrZnodeptrrr Zoptalloc)r$rrrX�s&zStdNodeHandlePrinter.__init__cCsfd}|js|d7}|jr"|d7}n|d7}|jrZ|d7}t|jd�rVd||jj�fS|Sd|SdS)	Nznode handle for z
unordered r��setz
 with elementr_z%s = %szempty %s)r2r3rr�r�rg)rr%rrrrgs
zStdNodeHandlePrinter.to_string)r	r
rrrXrgr(rr)r$rr0�sr0c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�StdExpStringViewPrinterzP
    Print a std::basic_string_view or std::experimental::basic_string_view
    cCs
||_dS)N)rV)rrDrWrrrrXsz StdExpStringViewPrinter.__init__cCs6|jd}|jd}t|d�r*|j|d�S|j|d�S)NZ_M_str�_M_lenr�)r�)rVr�r�r�)rr�rrrrrg s



z!StdExpStringViewPrinter.to_stringcCsdS)Nr�r)rrrrr�'sz$StdExpStringViewPrinter.display_hintN)r	r
rrrXrgr�rrrrr5sr5c@s@eZdZdZdd�Zdd�Zdd�ZGdd	�d	e�Zd
d�Z	dS)
�StdExpPathPrinterz,Print a std::experimental::filesystem::path.cCsB||_||_|jddd}|jddd}t||�|_dS)N�_M_cmptsr�r�r�)rVr]r��
_num_cmpts)rrDrWr�r�rrrrX.s
zStdExpPathPrinter.__init__cCs:t|jd�}|dd�dkr"dS|d	d�dkr6dSdS)
NZ_M_typer��	_Root_dirzroot-directory�
�
_Root_namez	root-namei����i����)r!rV)rr0rrr�
_path_type5szStdExpPathPrinter._path_typecCs8d|jd}|jdkr0|j�}|r0d||f}d|S)Nz%s�_M_pathnamerz%s [%s]z!experimental::filesystem::path %s)rVr9r=)r�pathr0rrrrg=s
zStdExpPathPrinter.to_stringc@s$eZdZdd�Zdd�Zdd�ZdS)zStdExpPathPrinter._iteratorcCs,||_|dd|_|dd|_d|_dS)Nr�r�r�r)�	_pathtyper�r�r~)rZcmpts�pathtyperrrrXFsz$StdExpPathPrinter._iterator.__init__cCs|S)Nr)rrrrrYLsz$StdExpPathPrinter._iterator.__iter__cCsd|j|jkrt�|jj�}|j}|jd|_|jd|_|d}t|j|�j�}|sX|}d||fS)Nr)r>z[%s])r�r�rZrtr~r7r@r=)rr�rEr?r0rrrrOs
z$StdExpPathPrinter._iterator.__next__N)r	r
rrXrYrrrrrr�Esr�cCs|j|jd|j�S)Nr8)r�rVr])rrrrr_\szStdExpPathPrinter.childrenN)
r	r
rrrXr=rgrr�r_rrrrr7+sr7c@s@eZdZdZdd�Zdd�Zdd�ZGdd	�d	e�Zd
d�Z	dS)
�StdPathPrinterzPrint a std::filesystem::path.cCsP||_||_t|jdd�}|jtjd��d@|_|jdkrF||_nd|_dS)Nr8r�Z	uintptr_t�r)rVr]rprbrrr��_impl)rrDrWr�rrrrXcs
zStdPathPrinter.__init__cCsHt|jjtj|jd���}|dd�dkr0dS|d	d�dkrDdSdS)
Nz::_Typer�r:zroot-directoryr;r<z	root-namei����i����)r!r�rbrrr])rr0rrrr=mszStdPathPrinter._path_typecCs8d|jd}|jdkr0|j�}|r0d||f}d|S)Nz%sr>rz%s [%s]zfilesystem::path %s)rVr�r=)rr?r0rrrrgus
zStdPathPrinter.to_stringc@s$eZdZdd�Zdd�Zdd�ZdS)zStdPathPrinter._iteratorc	Cs�||_|r�tjd�}tj|d�}tjd�}|j|j��}|j�}ttjd�rbtd|j	|j
�}n
d|j	}|j|j��|}|j|j��|_|j||_d|_
nd|_d|_dS)Nr�z::_Cmpt�char�alignofrr)r@rrrbrartr�r:�maxr�rFr�r�r~)	rr�rAZint_typeZ	cmpt_type�	char_typer�Zsizeof_Impl�beginrrrrX~s 


z!StdPathPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz!StdPathPrinter._iterator.__iter__cCsd|j|jkrt�|jj�}|j}|jd|_|jd|_|d}t|j|�j�}|sX|}d||fS)Nr)r>z[%s])r�r�rZrtr~rBr@r=)rr�rEr?r0rrrr�s
z!StdPathPrinter._iterator.__next__N)r	r
rrXrYrrrrrr�}sr�cCs|j|j|j�S)N)r�rDr])rrrrr_�szStdPathPrinter.childrenN)
r	r
rrrXr=rgrr�r_rrrrrB`s
(rBc@s8eZdZdZdd�ZGdd�de�Zdd�Zdd	�Zd
S)�StdPairPrinterz@Print a std::pair object, with 'first' and 'second' as children.cCs
||_dS)N)rV)rrDrWrrrrX�szStdPairPrinter.__init__c@s(eZdZdZdd�Zdd�Zdd�ZdS)	zStdPairPrinter._iterz?An iterator for std::pair types. Returns 'first' then 'second'.cCs||_d|_dS)Nr�)rV�_which)rrWrrrrX�szStdPairPrinter._iter.__init__cCs|S)Nr)rrrrrY�szStdPairPrinter._iter.__iter__cCs8|jdkrt�|j}|dkr$d|_nd|_||j|fS)Nr�r�)rKrZrV)rZwhichrrrr�s
zStdPairPrinter._iter.__next__N)r	r
rrrXrYrrrrrr��sr�cCs|j|j�S)N)r�rV)rrrrr_�szStdPairPrinter.childrencCsdS)Nr)rrrrrg�szStdPairPrinter.to_stringN)	r	r
rrrXrr�r_rgrrrrrJ�s
rJc@s eZdZdZdd�Zdd�ZdS)�StdCmpCatPrinterz#Print a comparison category object.cCs&||jd�dd�|_|d|_dS)N�:r)r,)�rfindr]rV)rrDrWrrrrX�szStdCmpCatPrinter.__init__cCsJ|jdkr|jdkrd}n"dddddddd	i}|t|j�}d
j|j|�S)N�strong_orderingrZequalrZ	unorderedr)ZlessZ
equivalentZgreaterzstd::{}::{}ri)r]rVr�r*)rr"�namesrrrrg�s
zStdCmpCatPrinter.to_stringN)r	r
rrrXrgrrrrrL�srLc@s`eZdZdZdZdd�Zedd��Zedd��Z	ed	d
��Z
edd��Zed
d��Zdd�Z
dS)�StdErrorCodePrinterz0Print a std::error_code or std::error_condition.NcCsL||_t|�|_tjdkrHyddl}dt_Wntk
rFdt_YnXdS)NrTF)rVr;r]rQ�_system_is_posix�posix�ImportError)rrDrWrSrrrrX�s


zStdErrorCodePrinter.__init__cCs&tj|�}|dk	r"|jtjkr"|SdS)N)rrr�ZTYPE_CODE_ENUM)r"r#rrr�_find_errc_enum�s
z#StdErrorCodePrinter._find_errc_enumcCsBx<dtgD]0}ydj||�}|j|�Stk
r8Yq
Xq
WdS)NrCz	std::{}{})r-r*rUr)�clsr"�nsZqnamerrr�_find_standard_errc_enum�s
z,StdErrorCodePrinter._find_standard_errc_enumc	Cs�dddg}x~|D]v}|d}xhdtgD]\}dj|�}tjdj||��d}|dk	r&||j�jkr&d	|}|jd
j||��}||fSq&WqWdS)N�streamZsocketzip::resolverz_category()rCzstd::{}experimental::net::v1z{}::{}::__crznet::z{}::{}_errc)NN)r-r*rZ
lookup_symbol�valuersrU)	rV�catZnet_catsr�r!rWZsymr"�enumrrr�_match_net_ts_category�s


z*StdErrorCodePrinter._match_net_ts_categoryc
Cs�d}d}d}|j|�\}}|dk	r.d|||fS|jj�}|jjd�rLd}d}|jjd�rbd}|j}|jjd�r|d	}|jd
�}|jjd�r�d}|jd
�}|dkr�yWnYnX||j||fS)z(Return details of a std::error_category.NFz::generic_error_category�genericTz::system_error_category�systemz::future_error_categoryZfutureZfuture_errcz::io_error_category�ioZio_errc)r]�dynamic_typer�r�endswithrRrX)rVr[r"r\�is_errnor!r#rrr�_category_info	s2


z"StdErrorCodePrinter._category_infocCs|jd�dS)zX
        Strip any nested-name-specifier from name to give an unqualified name.
        z::r)ri)�split)r"rrr�_unqualified_name4sz%StdErrorCodePrinter._unqualified_namec	
Cs�|jd}|jd}|j|�\}}}}|dkrVddd�}|||j|j�krV|jdSt|�}|r�|dkr�ytjt|�}Wq�Yq�Xn|dk	r�|jt|j|���}|dk	r�d|}n|}d	|j||fS)
Nr,Z_M_catrr_r^)�
error_code�error_conditionz = { }z"%s"z
%s = {%s: %s})	rVrdrfr]r!�errno�	errorcoder�rb)	rrZr[r"Zalt_namer\rcZdefault_catsZstrvalrrrrg;s(



zStdErrorCodePrinter.to_string)r	r
rrrRrXr�rU�classmethodrXr]rdrfrgrrrrrQ�s	+rQc@s eZdZdZdd�Zdd�ZdS)�StdRegexStatePrinterz/Print a state node in the NFA for a std::regex.cCs||_||_dS)N)rVr])rrDrWrrrrXXszStdRegexStatePrinter.__init__cCs�t|jd�}|r|dd�}|jd}dddddddddddddd�
}||}d	j||�}|dk	r�|jd
|dk	r�dj|||jd
|�}d|S)
NZ	_M_opcode�rzZaltZsubexpr�negZ
backref_index)
�repeat�alternativeZ
subexpr_beginZsubexpr_endZline_begin_assertionZline_end_assertionZ
word_boundaryZsubexpr_lookaheadZbackrefr?ZacceptZdummy�unknownzopcode={}, next={}Z_M_z	{}, {}={}z{%s})r!rVr*)rZopcodeZnext_idZvariants�vr#rrrrg\s 

zStdRegexStatePrinter.to_stringN)r	r
rrrXrgrrrrrlUsrlc@s@eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
d�Z	dS)
�StdSpanPrinterzPrint a std::span.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSpanPrinter._iteratorcCsd|_||_||_dS)Nr)r~�_beginr�)rrIr�rrrrXvsz!StdSpanPrinter._iterator.__init__cCs|S)Nr)rrrrrY{sz!StdSpanPrinter._iterator.__iter__cCs8|j|jkrt�|j}|jd|_d||j|j�fS)Nr)z[%d])r~r�rZrtrt)rrErrrr~s
z!StdSpanPrinter._iterator.__next__N)r	r
rrXrYrrrrrr�usr�cCsLt|�|_||_tjd�}|jjd�|kr:|dd|_n|jjd�|_dS)Nzstatic_cast<std::size_t>(-1)r)Z	_M_extentZ_M_extent_value)r;r]rVrr�rr4r�)rrDrWZsize_maxrrrrX�s

zStdSpanPrinter.__init__cCsd|j|jfS)Nz%s of length %d)r]r�)rrrrrg�szStdSpanPrinter.to_stringcCs|j|jd|j�S)Nr\)r�rVr�)rrrrr_�szStdSpanPrinter.childrencCsdS)Nr�r)rrrrr��szStdSpanPrinter.display_hintN)
r	r
rrrr�rXrgr_r�rrrrrsrs	rsc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�StdInitializerListPrinterzPrint a std::initializer_list.cCs||_||_|d|_dS)Nr6)r]rVr�)rrDrWrrrrX�sz"StdInitializerListPrinter.__init__cCsd|j|jfS)Nz%s of length %d)r]r�)rrrrrg�sz#StdInitializerListPrinter.to_stringcCstj|jd|j�S)NZ_M_array)rsr�rVr�)rrrrr_�sz"StdInitializerListPrinter.childrencCsdS)Nr�r)rrrrr��sz&StdInitializerListPrinter.display_hintN)r	r
rrrXrgr_r�rrrrru�s
ruc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�StdAtomicPrinterzPrint a std:atomic.cCsrt|�|_||_d|_|jjjd�|_|jjdk	rnt|jj�}|jd�sR|jd�rn|d}t	||�|_|j
|_dS)Nrzstd::shared_ptr<zstd::weak_ptr<r�)r;r]rV�_shptr_printerrr4r1rr<r[�_shptr_childrenr_)rrDrWr#r�rrrrX�s


zStdAtomicPrinter.__init__cCst|jj�S)N)rUrwr^)rrrrrx�sz StdAtomicPrinter._shptr_childrencCs�|jdk	r|jj�S|jjtjkr.|jd}n`|jjtjkrH|jd}nF|jjtjkrf|jdd}n(|jjtj	kr�|jdd}n
|jd}d|j
t|j�|fS)Nr`Z_M_fpZ_M_br�Z_M_basez%s<%s> = { %s })rwrgr1r�rZ
TYPE_CODE_INTrV�
TYPE_CODE_FLT�
TYPE_CODE_PTRr�r]r!)rrWrrrrg�s


zStdAtomicPrinter.to_stringN)r	r
rrrXrxrgrrrrrv�s
rvc@s eZdZdZdd�Zdd�ZdS)�StdFormatArgsPrinterzPrint a std::basic_format_args.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
zStdFormatArgsPrinter.__init__cCs�t|jj�}t|d�d}|tjd�kr0d}n|tjd�krDd}nd}|jd}|dkrbd	|S|dkrt|jd
}d||fS)Nrr)rEzstd::format_args�wchar_tzstd::wformat_argszstd::basic_format_argsZ_M_packed_sizez%s with 1 argumentZ_M_unpacked_sizez%s with %d arguments)rTrVrrr)rZtargsrHr#r�rrrrg�s

zStdFormatArgsPrinter.to_stringN)r	r
rrrXrgrrrrr{�sr{c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�StdChronoDurationPrinterzPrint a std::chrono::duration.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
z!StdChronoDurationPrinter.__init__cCs*|jjjd�}|jd�}|jd�}||fS)Nr)r)rVrr4)rZperiodr��denrrr�_ratio�s

zStdChronoDurationPrinter._ratiocCs�|j�\}}|dkrF|dkr dS|dkr,dS|dkr8dS|dkr|dSn6|dkr||d	krZd
S|dkrfdS|d
krrdSdj|�Sdj||�S)Nr)r#i�Zmsi@B�usiʚ;rW�<�mini�hi�Q�dz[{}]sz[{}/{}]s)rr*)rr�r~rrr�_suffix�s&
z StdChronoDurationPrinter._suffixcCs4|jd}|jj�jtjkr$d|}dj||j��S)N�__rz%gz"std::chrono::duration = {{ {}{} }})rVrrr�rryr*r�)r�rrrrrg
s
z"StdChronoDurationPrinter.to_stringN)r	r
rrrXrr�rgrrrrr}�s
r}c@s*eZdZdZdd�Zdd�Zd
dd�Zd	S)�StdChronoTimePointPrinterz Print a std::chrono::time_point.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrXs
z"StdChronoTimePointPrinter.__init__cCsv|jjjd�}t|j�}|dks(|dkr,dS|dkr8dS|dkrDdS|d	krPdS|dkr\dS|dkrhdSdj|�dfS)Nrzstd::chrono::_V2::system_clockzstd::chrono::system_clock�std::chrono::sys_timezstd::chrono::utc_clock�std::chrono::utc_timezstd::chrono::gps_clock�std::chrono::gps_timezstd::chrono::tai_clock�std::chrono::tai_timezstd::filesystem::__file_clock�std::chrono::file_time�umzstd::chrono::local_t�std::chrono::local_timez
{} time_point)r�r)r�N)r�N)r�N)r�r�)r�r)rVrr4r;r"r*)r�clockr"rrr�_clocks 
z StdChronoTimePointPrinter._clockFc
Cs�|j�\}}|jd}|d}t|jj|�}|j�}d}|dk	r�|j�\}	}
||	|
|}ytjj|t	�}dj
|�}WnYnXd|||f}
|r�|
Sd||
fS)NZ__dr�rCz [{:%Y-%m-%d %H:%M:%S}]z%d%s%sz%s = { %s })r�rVr}rr"r�rrZ
fromtimestamp�
_utc_timezoner*)rZabbrevr��offsetr�r��printer�suffix�timer�r~Zsecsrr#rrrrg.s$
z#StdChronoTimePointPrinter.to_stringN)F)r	r
rrrXr�rgrrrrr�sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoZonedTimePrinterz Print a std::chrono::zoned_time.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrXFs
z"StdChronoZonedTimePrinter.__init__cCs@|jdj�d}|jd}t|jj|�}|jd�}dj||�S)NZ_M_zone�_M_nameZ_M_tpTz%std::chrono::zoned_time = {{ {} {} }})rVrtr�rr"rgr*)rZzoner�r�rrrrgJs


z#StdChronoZonedTimePrinter.to_stringN)r	r
rrrXrgrrrrr�Csr�ZJanuaryZFebruaryZMarchZAprilZMayZJuneZJulyZAugustZ	SeptemberZOctoberZNovemberZDecemberZSundayZMondayZTuesdayZ	WednesdayZThursdayZFridayZSaturdayc@s eZdZdZdd�Zdd�ZdS)�StdChronoCalendarPrinterzDPrint a std::chrono::day, std::chrono::month, std::chrono::year etc.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX\s
z!StdChronoCalendarPrinter.__init__c	Csv|j}|j}d|kr$|dkr$|d}|jd�r6|d}|dkrPdjt|d��S|d	kr||d
ksl|tt�krtd|St|S|dkr�dj|�S|d
kr�|d}|dks�|tt�kr�d|Sdjt|�S|dkr�dj|dt|d��S|dkr�dj|d�S|dk�rdj||d�S|dk�r,dj|�S|dk�rFdj||d�S|dk�r`dj||d�S|dk�rvdj||�S|dk�r�d j|||d�S|dk�r�dj||d!�S|d"k�r�d j|||d�S|d#k�r�d j|||d�S|jd$��rrd%}|d&dk�r"d'jt|d(d)�t|d&��}t|d*d+�}t|dd+�}t|d,d+�}|d-�rb|}d.j||||�SdS)/N�monthz std::chrono::year_month_day_lastZ_M_mzstd::chrono::yearZ_M_yzstd::chrono::dayz{}Z_M_dzstd::chrono::monthr)z%d is not a valid monthz{}yzstd::chrono::weekdayZ_M_wdrz%d is not a valid weekdayzstd::chrono::weekday_indexedz{}[{}]r.zstd::chrono::weekday_lastz{}[last]zstd::chrono::month_dayz{}/{}zstd::chrono::month_day_lastz{}/lastzstd::chrono::month_weekdayZ_M_wdizstd::chrono::month_weekday_lastZ_M_wdlzstd::chrono::year_monthzstd::chrono::year_month_dayz{}/{}/{}Z_M_mdlzstd::chrono::year_month_weekdayz$std::chrono::year_month_weekday_lastzstd::chrono::hh_mm_ssrCZfractional_widthz.{:0{}d}Z_M_ssZ_M_rrr��_M_sZ	_M_is_negz{:02}:{:02}:{:02}{})rVr]r<r*r�r�months�weekdays)	rrWr#r"�yZwdZfractr�r#rrrrg`sh












z"StdChronoCalendarPrinter.to_stringN)r	r
rrrXrgrrrrr�Ysr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTimeZonePrinterz4Print a chrono::time_zone or chrono::time_zone_link.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
z!StdChronoTimeZonePrinter.__init__cCs6d|j|jdf}|jjd�r2|d|jd7}|S)Nz%s = %sr�Z_linkz -> %sZ	_M_target)r]rVrb)rr!rrrrg�sz"StdChronoTimeZonePrinter.to_stringN)r	r
rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoLeapSecondPrinterzPrint a chrono::leap_second.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
z#StdChronoLeapSecondPrinter.__init__cCs.|jdd}d|dk}d|jt|�|fS)Nr�r�z+-rz
%s %d (%c))rVr]�abs)rZdaternrrrrg�sz$StdChronoLeapSecondPrinter.to_stringN)r	r
rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTzdbPrinterzPrint a chrono::tzdb.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
zStdChronoTzdbPrinter.__init__cCsd|j|jdfS)Nz%s %s�version)r]rV)rrrrrg�szStdChronoTzdbPrinter.to_stringN)r	r
rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTimeZoneRulePrinterzPrint a chrono::time_zone rule.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s
z%StdChronoTimeZoneRulePrinter.__init__c
Cs�|jd}|d}t|d}dddddddd�}|d}d	j||j|d
��}|dkrddj||�}nVt|d
}|dkr�dj||�}n4|dkr�d}	nd}	|d}dj|	d||	d||�}dj|jd|jd|jd|�S)N�on�kindr��stZndZrd)r)rrC����Zday_of_monthz{}{}Zthrz{} {}Zday_of_weekr)z
last {} in {}rr��<=r��>=z{} {} {} {} {}z.time_zone rule {} from {} to {} starting on {}r"�fromZto)r�r�)r�r�)rVr�r*�getr�)
rr�r�r��suffixes�dayZordinal_dayr��weekday�	directionrrrrg�s*
z&StdChronoTimeZoneRulePrinter.to_stringN)r	r
rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdLocalePrinterzPrint a std::locale.cCs||_||_dS)N)rVr])rrDrWrrrrX�szStdLocalePrinter.__init__csx|jdd}d}|ddkr&d}�nFtj|jd�}tj|jd�}|dj�}|dj�}dj||�}||i}d	}	xN|	|kr�||	dkr�||	j�}||	j�}d
j|||�}|||<|	d	}	qxWt|j��}
t|
�d	kr�|}n�t|
�dk�rl|
\}}t	|j��}
d�|
j
|�d	k�r$|}|�n|
j
|�d	k�r<|}|��dk	�rlt�fdd
�|j�D��}dj|��}dj||�S)Nr�Z_M_namesrCr�*z::_S_categoriesz::_S_categories_sizez{}={}r)z{};{}={}rc3s|]\}}|�kr|VqdS)Nr)r&r�rR)�otherrr�	<genexpr>	sz-StdLocalePrinter.to_string.<locals>.<genexpr>z
 with "{}={}"zstd::locale = "{}"{})
rVrr�r]r�r*r4�valuesrr�rEr�items)rrP�modr"ZcatsZncatrRr[Z	cat_namesrZ
uniq_namesZn1Zn2Z	name_listr)r�rrg�sD
zStdLocalePrinter.to_stringN)r	r
rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdIntegralConstantPrinterz*Print a std::true_type or std::false_type.cCs||_||_dS)N)rVr])rrDrWrrrrX	sz#StdIntegralConstantPrinter.__init__cCsL|jjjd�}|jjjd�}|jtjkr4|r0dSdSt|j�}dj|||�S)Nrr)zstd::true_typezstd::false_typez
{}<{}, {}>)	rVrr4r�rr�r;r]r*)rr3rZrDrrrrg	s
z$StdIntegralConstantPrinter.to_stringN)r	r
rrrXrgrrrrr�	sr�c@s eZdZdZdd�Zdd�ZdS)�StdTextEncodingPrinterzPrint a std::text_encoding.cCs||_||_dS)N)rVr])rrDrWrrrrX!	szStdTextEncodingPrinter.__init__cCs<|jdj�}|ddkr$|jdS|ddkr4dS|dS)NZ_M_repZ_M_idr)r�rrq)rVrt)rZreprrrrg%	s
z StdTextEncodingPrinter.to_stringN)r	r
rrrXrgrrrrr�	sr�cs$eZdZ�fdd�Zdd�Z�ZS)�	RxPrintercs$tt|�j�||_||_d|_dS)NT)rr�rXr"�	_function�enabled)rr"r)r$rrrX0	szRxPrinter.__init__cCs:|js
dS|jjtjkr,ttjd�r,|j�}|j|j	|�S)N�referenced_value)
r�rr�rr�r��Valuer�r�r")rrZrrr�invoke6	szRxPrinter.invoke)r	r
rrXr�r(rr)r$rr�/	sr�csHeZdZ�fdd�Zdd�Zdd�Zdd�Zed	d
��Zdd�Z	�Z
S)
�Printercs6tt|�j�||_g|_i|_d|_tjd�|_	dS)NTz^([a-zA-Z0-9_:]+)(<.*>)?$)
rr�rXr"�_subprinters�_lookupr�r>�compile�_compiled_rx)rr")r$rrrXE	szPrinter.__init__cCs<|jj|�std|��t||�}|jj|�||j|<dS)Nz0libstdc++ programming error: "%s" does not match)r�r?r r�r�rPr�)rr"rr�rrr�addM	s

zPrinter.addcCs>|j|||�d|kr:tjddt|�}|j|||�dS)N�__cxx11z^(std|__gnu_cxx)::z\g<0>%s)r�r>rHr-)r�baser"rZvbaserrr�add_versionX	s

zPrinter.add_versioncCs$|j|||�|j|d||�dS)Nz__cxx1998::)r�)rr�r"rrrr�
add_container`	szPrinter.add_containercCs&|jtjkr|j�}|j�j�}|jS)N)r�rr�r�r�rr)rrrr�get_basic_typed	szPrinter.get_basic_typecCsr|j|j�}|sdS|jj|�}|s(dS|jd�}|jjtjkrTttj	d�rT|j
�}||jkrn|j|j|�SdS)Nr)r�)
r�rr�r?rr�rr�r�r�r�r�r�)rrWrDr?�basenamerrr�__call__o	s

zPrinter.__call__)r	r
rrXr�r�r�r�r�r�r(rr)r$rr�D	sr�c@s0eZdZdZdd�ZGdd�de�Zdd�ZdS)	�TemplateTypePrinteral
    A type printer for class templates with default template arguments.

    Recognizes specializations of class templates and prints them without
    any template arguments that use a default template argument.
    Type printers are recursively applied to the template arguments.

    e.g. replace 'std::vector<T, std::allocator<T> >' with 'std::vector<T>'.
    cCs||_||_d|_dS)NT)r"�_defargsr�)rr"�defargsrrrrX�	szTemplateTypePrinter.__init__c@s(eZdZdZdd�Zdd�Zdd�ZdS)	zTemplateTypePrinter._recognizerz-The recognizer class for TemplateTypePrinter.cCs||_||_dS)N)r"r�)rr"r�rrrrX�	sz(TemplateTypePrinter._recognizer.__init__c	Cs�|jdkrdS|jj|j�s dSt|�}g}d}x�tt|��D]�}||}|jj|�}|dk	r�|j|�}y|t	j
|�kr|dSWn$t	jk
r�|j|kr�dSYnXd}q>|r�dS|j|j
|��q>W|jd|jjd��}t|�}|ddj|�dS)a
            If type_obj is a specialization of self.name that uses all the
            default template arguments for the class template, then return
            a string representation of the type without default arguments.
            Otherwise, return None.
            NFTr�<z, �>)rr<r"rT�rangerr�r�r*rrr,rP�_recognize_subtyper�rOr+)	rrQrSZdisplayed_argsZrequire_defaultedrRrfZdefargrArrr�	recognize�	s2



z)TemplateTypePrinter._recognizer.recognizecCs�|jtjkr|j|j��dS|jtjkrj|j|j��}t|j��jd�rR|dSd||j	�ddfS|jtj
kr�|j|j��dSttd�r�|jtjkr�|j|j��dStj
jtj
j�|�}|r�|St|�S)zxConvert a gdb.Type to a string by applying recognizers,
            or if that fails then simply converting to a string.r�z[]z%s[%d]r)�&�TYPE_CODE_RVALUE_REFz&&)r�rrzr�r�r�r!rrbr�r�r�r�rrr)rrQrNrrrr��	s"
z2TemplateTypePrinter._recognizer._recognize_subtypeN)r	r
rrrXr�r�rrrr�_recognizer�	s1r�cCs|j|j|j�S)z1Return a recognizer object for this type printer.)r�r"r�)rrrr�instantiate�	szTemplateTypePrinter.instantiateN)r	r
rrrX�objectr�r�rrrrr��	s	Pr�cs�td||�}tjj||�td||�}tjj||�d|kr�dt�t�fdd�|j�D��}t�||�}tjj||�td||�}tjj||�dS)a�
    Add a type printer for a class template with default template arguments.

    Args:
        name (str): The template-name of the class template.
        defargs (dict int:string) The default template arguments.

    Types in defargs can refer to the Nth template-argument using {N}
    (with zero-based indices).

    e.g. 'unordered_map' has these defargs:
    { 2: 'std::hash<{0}>',
      3: 'std::equal_to<{0}>',
      4: 'std::allocator<std::pair<const {0}, {1}> >' }
    zstd::zstd::__debug::r�c3s"|]\}}||jd��fVqdS)zstd::N)r.)r&rRr�)rWrrr�

sz0add_one_template_type_printer.<locals>.<genexpr>N)r�rr�register_type_printerr-�dictr�)�objr"r�r�r)rWr�add_one_template_type_printer�	sr�c@s2eZdZdZd	dd�ZGdd�de�Zdd�ZdS)
�FilteringTypePrintera�
    A type printer that uses typedef names for common template specializations.

    Args:
        template (str): The class template to recognize.
        name (str): The typedef-name that will be used instead.
        targ1 (str, optional): The first template argument. Defaults to None.

    Checks if a specialization of the class template 'template' is the same type
    as the typedef 'name', and prints it as 'name' instead.

    e.g. if an instantiation of std::basic_istream<C, T> is the same type as
    std::istream then print it as std::istream.

    If targ1 is provided (not None), match only template specializations with
    this type as the first template argument, e.g. if template='basic_string'
    and targ1='char' then only match 'basic_string<char,...>' and not
    'basic_string<wchar_t,...>'. This rejects non-matching specializations
    more quickly, without needing to do GDB type lookups.
    NcCs||_||_||_d|_dS)NT)�	_templater"�_targ1r�)r�templater"�targ1rrrrX*
szFilteringTypePrinter.__init__c@s eZdZdZdd�Zdd�ZdS)z FilteringTypePrinter._recognizerz.The recognizer class for FilteringTypePrinter.cCs||_||_||_d|_dS)N)r�r"r��	_type_obj)rr�r"r�rrrrX3
sz)FilteringTypePrinter._recognizer.__init__c	Cs�|jdkrdS|jdkrz|jdk	rDdj|j|j�}|jj|�sVdSn|jj|j�sVdSytj|j�j	�|_WnYnX|jdkr�dStj
j|j�}tj
j|�}||kr�t|j�S|jj
d�ddkr�|jjjdd�}|jjdd�}||kr�t|j�SdS)	z�
            If type_obj starts with self._template and is the same type as
            self.name then return self.name, otherwise None.
            Nz{}<{}z::r)�basic_stringz	__cxx11::rCri)rr�r�r*r�r<rrr"rrr�rOrer.)rrQr#Zt1Zt2�s1�s2rrrr�9
s4





z*FilteringTypePrinter._recognizer.recognizeN)r	r
rrrXr�rrrrr�0
sr�cCs|j|j|j|j�S)z1Return a recognizer object for this type printer.)r�r�r"r�)rrrrr�c
sz FilteringTypePrinter.instantiate)N)r	r
rrrXr�r�r�rrrrr�
s
3r�cCsXtd|d||�}tjj||�d|krTdt}t|||||�}tjj||�dS)Nzstd::r�)r�rrr�r-)r�r�r"r�r�rWrrr�add_one_type_printerh
sr�c
CsdtsdSxxdgD]p}t|d|dd
|d�t|d|dd
|d�t|dd|dd
|d�t|d|dd|d�qWx�djD]|}x*dkD]"}t|d||d||d�q�WxJdlD]B}t|d||d||d�t|d!||d||d��q�Wq�Wx�dmD]�}x0dpD](}t||d"||dd#|d��qWxNdqD]F}t||d(||d)�x&drD]}t||||||��qlW�qJW�qWt|d-d.�xdsD]}t|d9d:|��q�Wt|d;d<�t|d;d=�t|d>d?�t|d>d@�t|dAdB�t|dAdC�t|dDdE�t|dDdF�t|dGdH�dI}x0dyD](}t||d||dd|d��q<Wt|dJddKi�t|dLddMi�t|dNddMi�t|dOddMi�t|dPddMi�t|dQddMi�t|dRdSdTdU��t|dVdSdTdU��t|dWdSdMdX��t|dYdSdMdX��t|dZd[d\dTd]��t|d^d[d\dTd]��t|d_d[d\dMd`��t|dad[d\dMd`��dS)zNrCrEr�r|�u8�char8_t�u16�char16_t�u32�char32_tr�rr�r)z__cxx11::basic_string�	__cxx11::�basic_string_viewZstring_view�iosr��istream�ostream�iostream�filebuf�ifstream�ofstream�fstream�basic_�	stringbuf�
istringstream�
ostringstream�stringstreamz__cxx11::basic_Zbasic_regexZregexr�r#�wc�wsZ
match_resultsr?�	sub_match�regex_iterator�regex_token_iteratorZfposZ	streampos�nanoseconds�microseconds�milliseconds�seconds�minutes�hours�days�weeks�yearsr�zchrono::durationzchrono::Zlinear_congruential_engineZminstd_rand0Zminstd_randZmersenne_twister_engineZmt19937Z
mt19937_64Zsubtract_with_carry_engineZ
ranlux24_baseZ
ranlux48_baseZdiscard_block_engineZranlux24Zranlux48Zshuffle_order_engineZknuth_bzexperimental::fundamentals_v1::�
unique_ptrzstd::default_delete<{0}>�dequezstd::allocator<{0}>r�r�z
__cxx11::list�vectorr�zstd::less<{0}>z)std::allocator<std::pair<{0} const, {1}>>)rrC�multimapr4)r)r�multiset�
unordered_mapzstd::hash<{0}>zstd::equal_to<{0}>)rrC��unordered_multimap�
unordered_set)r)rrC�unordered_multiset�rCrE�r�r|�r�r��r�r��r�r�)rrrrr�rCrE�r�r|)rr)	r�r�r�r�r�r�r�r�r�)r�r�r�r�)rCr��rCrE�r�r|)rr )r�r#rr)rrr)
rrrrr	r
rrr
r��rCrE�r�r|�r�r��r�r��r�r�)r!r"r#r$r%)rr�r�)r�Zchr@�abiZdurrWrrr�register_type_printersq
s�
"(




*






r'cCs8trtjj|t�n|dkr t}|jjt�t|�dS)z4Register libstdc++ pretty-printers with objfile Obj.N)�_use_gdb_pprZprintingZregister_pretty_printer�libstdcxx_printerZpretty_printersrPr')r�rrr�register_libstdcxx_printers�
sr*cCsXtd�atjddt�tjddt�tjddt�tjddt�tjddt�tjddt�tjddt�tjdd	t�tjdd
t	�tjddt
�tjddt�tjdd
t�tjddt�tjddt	�tjddt�tjddt
�tjddt�tjddt�tjddt�tjddt�ttjd��rJtjddt�tjddt�tjdt�tjdt�tjdt�tjdt�tjdt�tjdt	�tjdt	�tjd t�tjdd!t�tjdd"t�tjdd#t�tjdd$t�tjdd%t�tjdd&t�tjdd't�tjd(d!t�tjd(d"t�tjd(d#t�tjd(d$t�tjd(d%t�tjd(d&t�tjdd)t�tjdd*t�tjdd+t�tjdd+t�x2doD]*}tjdd/|t�tjdd/|t��q�Wtjd0d1t�tjd0d2t �tjd3d4t!�tjd5t�tjd6t�tjd7t�tjd8t�tjd9t�tjd:d;t"�tjd:d<t#�tjd:d=t$�tjd>d?t%�tjd@d?t%�tjdAd?t&�tjdBd?t&�tjdd;t"�tjdd<t#�tjdd=t$�tjddCt'�tjddDt(�tjddEt)�tjddFt)�tjddGt)�tjddHt*�tjddIt+�xdpD]}tjd0|t,��q&Wtjd0dZt-�tjd0d[t-�tjd0d\t.�tjd0d]t/�tjd0d^t0�tjd_d`t1�tjddat2�tjddbt2�tjddct3�tjdddt3�tjddet4�tjddft4�tjd_dgt5�tjddht6�tjddit6�tjddjt7�tjd_dkt8�tjddlt9�tjddmt9�tjdnt:�dS)qNzlibstdc++-v6zstd::r�zstd::__cxx11::Zbitsetrr�r�rrZpairZpriority_queueZqueueror4�stackrrZlocaleZintegral_constantZ
text_encodingrargrhzstd::__debug::bitsetzstd::__debug::dequezstd::__debug::listzstd::__debug::mapzstd::__debug::multimapzstd::__debug::multisetzstd::__debug::setzstd::__debug::vectorZ
shared_ptrZweak_ptrrrrrr�z
std::tr1::Zinitializer_listZatomicZbasic_stringbufr�r�r�r�z
std::chrono::ZdurationZ
time_pointzstd::__detail::Z_Statezstd::__debug::unordered_mapzstd::__debug::unordered_setz std::__debug::unordered_multimapz std::__debug::unordered_multisetzstd::__debug::forward_listz$std::experimental::fundamentals_v1::�anyZoptionalr�z#std::experimental::filesystem::v1::r?z,std::experimental::filesystem::v1::__cxx11::zstd::filesystem::zstd::filesystem::__cxx11::ZvariantZ_Node_handleZpartial_orderingZ
weak_orderingrO�spanZbasic_format_argsr�r��yearr��weekday_indexed�weekday_last�	month_day�month_day_last�
month_weekday�month_weekday_last�
year_month�year_month_day�year_month_day_last�year_month_weekday�year_month_weekday_last�hh_mm_ssZ	time_zoneZtime_zone_linkZ
zoned_timeZleap_secondZtzdbz__gnu_cxx::ZslistZ_List_iteratorZ_List_const_iteratorZ_Rb_tree_iteratorZ_Rb_tree_const_iteratorZ_Deque_iteratorZ_Deque_const_iteratorZ__normal_iteratorZ
_Bit_iteratorZ_Bit_const_iteratorZ_Bit_referenceZ_Slist_iteratorZ_Fwd_list_iteratorZ_Fwd_list_const_iteratorz__gnu_debug::_Safe_iterator)r�r�r�)r�r�r.r�r/r0r1r2r3r4r5r6r7r8r9r:);r�r)r�r�r�r�r�ryr�r�rJr�r�rqr�r�r�r�r�rr�rQr�r[r
rrrurvr�r�r}r�rlrr)r5r7rBr-r0rLrsr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)Zsstreamr�rrr�build_libstdcxx_dictionary�
sL







r;)N)vrrr>rFrirrGr�rr�r
�ziprr�r�ZtimezoneZutcr�Ztzinforr(Zgdb.printingrTrZ	gdb.typesr�rrZprinter_baser%r-r2r8r5rBr;rKrOrTrUr[rkrmrprqrurxryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr
rrrrr)r-r0r5r7rBrJrLrQrlrsrurvr{r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r)r�r�r�r�r'r*r;rrrr�<module>s�

%
(&"I
U(*$/A" /%-^!,5I!{'$*/?
",Ce%T
	oS

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists