Your IP : 3.129.216.248


Current Path : /lib64/python2.7/ctypes/
Upload File :
Current File : //lib64/python2.7/ctypes/__init__.pyo

�
{fc@sQ
dZddlZddlZdZddlmZmZm	Z	ddlm
Z
ddlmZddlmZ
ddlmZmZdd	lmZdd
lmZee
kr�edee
��nejdukr�ddlmZneZejdkrBejdkrBeej�djd�d�dkrBeZqBnddlmZmZm Z!m"Z#dd�Z%dd�Z&iZ'd�Z(ejdvkrddlm)Z*ddlm+Z,ejd
kr�eZ,niZ-d�Z.e.jr*e(jj/dd�e._q*n"ejdkr*ddlm0Z*nddlm1Z1m2Z2m3Z3m4Z4m5Z5dd lm6Z6m7Z7dd!lm8Z8dd"�Z9d#e8fd$��YZ:e9e:d%�d&e8fd'��YZ;e9e;�d(e8fd)��YZ<e9e<�d*e8fd+��YZ=e9e=�d,e8fd-��YZ>e9e>�ed.�ed/�krNe=Z?e>Z@n@d0e8fd1��YZ?e9e?�d2e8fd3��YZ@e9e@�d4e8fd5��YZAe9eA�d6e8fd7��YZBe9eB�d8e8fd9��YZCe1eC�e1eB�kreBZCned/�ed:�kr,e=ZDe>ZEn@d;e8fd<��YZDe9eD�d=e8fd>��YZEe9eE�d?e8fd@��YZFeFeF_GeF_He9eF�dAe8fdB��YZIeIeI_GeI_He9eI�dCe8fdD��YZJeJeJ_GeJ_He9eJ�dEe8fdF��YZKe9eKd%�dGe8fdH��YZLeLZMe9eL�dIe8fdJ��YZNddKlmOZOmPZPmQZQdL�ZRyddMlmSZSWneTk
r�neXejdwkr�eSdNdO�n
eSdPdQ�dRe8fdS��YZUdTe8fdU��YZVddV�ZWdW�ZXdX�ZYdYeZfdZ��YZ[d[e[fd\��YZ\ejdxkr�d]e[fd^��YZ]dd_lm^Z^m8Z8d`e8fda��YZ_dbe[fdc��YZ`nddeZfde��YZaeae[�Zbeae\�Zcejdykr	e\dfdejd�Zen5ejdgkr2e\dhejfd �Zene\d�Zeejdzkr�eae]�Zgeae`�Zhejdkr�egjijjZjnegjkjjZjddilmlZlmmZmdddj�Znne1e@�e1eL�kr�e@Zoe?ZpnNe1e>�e1eL�kre>Zoe=Zpn'e1eE�e1eL�kr,eEZoeDZpnddklmqZqmrZrmsZsmtZte(eLeLeLeo�eq�Zue(eLeLe?eo�er�Zvdl�Zwewe:eLe:e:�et�Zxdm�Zyewe:eLe?�es�Zzddn�Z{yddolm|Z|WneTk
r�n%Xewe:eLe?�e|�Z}ddp�Z~ejd{krE	dq�Zdr�Z�nddsl�m�Z�m�Z�eIZ�eFZ�xke;e?e=eDgD]WZ�e1e��dkr�	e�Z�qz	e1e��dtkr�	e�Z�qz	e1e��dkrz	e�Z�qz	qz	Wxke<e@e>eEgD]WZ�e1e��dkr	
e�Z�q�	e1e��dtkr$
e�Z�q�	e1e��dkr�	e�Z�q�	q�	W[�eR�dS(|s,create and manipulate C data types in Pythoni����Ns1.1.0(tUniont	StructuretArray(t_Pointer(tCFuncPtr(t__version__(t
RTLD_LOCALtRTLD_GLOBAL(t
ArgumentError(tcalcsizesVersion number mismatchtnttce(tFormatErrortposixtdarwinit.ii(tFUNCFLAG_CDECLtFUNCFLAG_PYTHONAPItFUNCFLAG_USE_ERRNOtFUNCFLAG_USE_LASTERRORcCs�t|ttf�rT|dkr4t|�d}nt|}|�}||_|St|ttf�r�t|}|�}|St	|��dS(s�create_string_buffer(aString) -> character array
    create_string_buffer(anInteger) -> character array
    create_string_buffer(aString, anInteger) -> character array
    iN(
t
isinstancetstrtunicodetNonetlentc_chartvaluetinttlongt	TypeError(tinittsizetbuftypetbuf((s'/usr/lib64/python2.7/ctypes/__init__.pytcreate_string_buffer1s
		
	cCs
t||�S(N(R"(RR((s'/usr/lib64/python2.7/ctypes/__init__.pytc_bufferCscs�t�|jdt�r%�tO�n|jdt�rD�tO�n|rctd|j���nyt���fSWnGtk
r�dt	f���fd��Y}|t���f<|SXdS(s�CFUNCTYPE(restype, *argtypes,
                 use_errno=False, use_last_error=False) -> function prototype.

    restype: the result type
    argtypes: a sequence specifying the argument types

    The function prototype can be called in different ways to create a
    callable object:

    prototype(integer address) -> foreign function
    prototype(callable) -> create and return a C callable function from callable
    prototype(integer index, method name[, paramflags]) -> foreign function calling a COM method
    prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal
    prototype((function name, dll object)[, paramflags]) -> foreign function exported by name
    t	use_errnotuse_last_errors!unexpected keyword argument(s) %st
CFunctionTypecseZ�Z�Z�ZRS((t__name__t
__module__t
_argtypes_t	_restype_t_flags_((targtypestflagstrestype(s'/usr/lib64/python2.7/ctypes/__init__.pyR&esN(
t_FUNCFLAG_CDECLtpoptFalset_FUNCFLAG_USE_ERRNOt_FUNCFLAG_USE_LASTERRORt
ValueErrortkeyst_c_functype_cachetKeyErrort	_CFuncPtr(R.R,tkwR&((R,R-R.s'/usr/lib64/python2.7/ctypes/__init__.pyt	CFUNCTYPEKs


"(tLoadLibrary(tFUNCFLAG_STDCALLcs�t�|jdt�r%�tO�n|jdt�rD�tO�n|rctd|j���nyt���fSWnGtk
r�dt	f���fd��Y}|t���f<|SXdS(NR$R%s!unexpected keyword argument(s) %stWinFunctionTypecseZ�Z�Z�ZRS((R'R(R)R*R+((R,R-R.(s'/usr/lib64/python2.7/ctypes/__init__.pyR=�s(
t_FUNCFLAG_STDCALLR0R1R2R3R4R5t_win_functype_cacheR7R8(R.R,R9R=((R,R-R.s'/usr/lib64/python2.7/ctypes/__init__.pytWINFUNCTYPEts


"R:R@(tdlopen(tsizeoftbyreft	addressoft	alignmenttresize(t	get_errnot	set_errno(t_SimpleCDatacCsmddlm}|dkr(|j}nt|�||�}}||kritd|||f��ndS(Ni����(R	s"sizeof(%s) wrong: %d instead of %d(tstructR	Rt_type_RBtSystemError(ttypttypecodeR	tactualtrequired((s'/usr/lib64/python2.7/ctypes/__init__.pyt_check_size�st	py_objectcBseZdZd�ZRS(tOcCs=ytt|�j�SWntk
r8dt|�jSXdS(Ns
%s(<NULL>)(tsuperRRt__repr__R4ttypeR'(tself((s'/usr/lib64/python2.7/ctypes/__init__.pyRU�s
(R'R(RKRU(((s'/usr/lib64/python2.7/ctypes/__init__.pyRR�stPtc_shortcBseZdZRS(th(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRY�stc_ushortcBseZdZRS(tH(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyR[�stc_longcBseZdZRS(tl(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyR]�stc_ulongcBseZdZRS(tL(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyR_�stiR^tc_intcBseZdZRS(Ra(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRb�stc_uintcBseZdZRS(tI(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRc�stc_floatcBseZdZRS(tf(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRe�stc_doublecBseZdZRS(td(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRg�stc_longdoublecBseZdZRS(tg(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRi�stqt
c_longlongcBseZdZRS(Rk(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRl�stc_ulonglongcBseZdZRS(tQ(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRm�stc_ubytecBseZdZRS(tB(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRo�stc_bytecBseZdZRS(tb(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyRq�sRcBseZdZRS(tc(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyR�stc_char_pcBs2eZdZejdkr'd�Zn	d�ZRS(tzR
cCsLtjj|d�s,d|jj|jfSd|jjt|t�jfS(Ni����s%s(%r)s%s(%s)(twindlltkernel32tIsBadStringPtrAt	__class__R'Rtcasttc_void_p(RW((s'/usr/lib64/python2.7/ctypes/__init__.pyRU�scCs d|jjt|t�jfS(Ns%s(%s)(RyR'RzR{R(RW((s'/usr/lib64/python2.7/ctypes/__init__.pyRU�s(R'R(RKt_ostnameRU(((s'/usr/lib64/python2.7/ctypes/__init__.pyRt�sR{cBseZdZRS(RX(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyR{�stc_boolcBseZdZRS(t?(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyR~s(tPOINTERtpointert_pointer_type_cachecCsbtj�tj�tjdkr0tj�ntjtt	�_t
jtt�_ttd<dS(NR
R(R
R(R�tclearR6R|R}R?t	c_wchar_pt
from_paramR�tc_wcharRtRR{R(((s'/usr/lib64/python2.7/ctypes/__init__.pyt_reset_caches


(tset_conversion_modetmbcstignoretasciitstrictR�cBseZdZRS(tZ(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyR�sR�cBseZdZRS(tu(R'R(RK(((s'/usr/lib64/python2.7/ctypes/__init__.pyR�scCs�t|ttf�rT|dkr4t|�d}nt|}|�}||_|St|ttf�r�t|}|�}|St	|��dS(s�create_unicode_buffer(aString) -> character array
        create_unicode_buffer(anInteger) -> character array
        create_unicode_buffer(aString, anInteger) -> character array
        iN(
RRRRRR�RRRR(RRR R!((s'/usr/lib64/python2.7/ctypes/__init__.pytcreate_unicode_buffer!s
		
	cCsptj|d�dk	r'td��nt|�tkrHtd��n|j|�|t|<tt|�=dS(Ns%This type already exists in the cachesWhat's this???(R�tgetRtRuntimeErrortidtset_type(R�tcls((s'/usr/lib64/python2.7/ctypes/__init__.pytSetPointerType4s

cCs||S(N((RMR((s'/usr/lib64/python2.7/ctypes/__init__.pytARRAY>stCDLLcBs\eZdZeZeZdZdZdZ
edeed�Z
d�Zd�Zd�ZRS(s�An instance of this class represents a loaded dll/shared
    library, exporting functions using the standard C calling
    convention (named 'cdecl' on Windows).

    The exported functions can be accessed as attributes, or by
    indexing with the function name.  Examples:

    <obj>.qsort -> callable object
    <obj>['qsort'] -> callable object

    Calling the functions releases the Python GIL during the call and
    reacquires it afterwards.
    s<uninitialized>ics�|�_�j�|r%�tO�n|r8�tO�ndtf��fd��Y}|�_|dkr�t�j|��_n	|�_dS(Nt_FuncPtrcseZ�Z�jZRS((R'R(R+t_func_restype_R*((R-RW(s'/usr/lib64/python2.7/ctypes/__init__.pyR�cs(	t_namet_func_flags_R2R3R8R�Rt_dlopent_handle(RWR}tmodethandleR$R%R�((R-RWs'/usr/lib64/python2.7/ctypes/__init__.pyt__init__Ys		

	cCsDd|jj|j|jtjdd@t|�tjdd@fS(Ns<%s '%s', handle %x at %x>ii(RyR'R�R�t_systmaxintR�(RW((s'/usr/lib64/python2.7/ctypes/__init__.pyRUmscCsP|jd�r-|jd�r-t|��n|j|�}t|||�|S(Nt__(t
startswithtendswithtAttributeErrort__getitem__tsetattr(RWR}tfunc((s'/usr/lib64/python2.7/ctypes/__init__.pyt__getattr__ss
cCs:|j||f�}t|ttf�s6||_n|S(N(R�RRRR'(RWtname_or_ordinalR�((s'/usr/lib64/python2.7/ctypes/__init__.pyR�zsN(R'R(t__doc__R/R�RbR�R�R�RR�tDEFAULT_MODER1R�RUR�R�(((s'/usr/lib64/python2.7/ctypes/__init__.pyR�Ds
		tPyDLLcBseZdZeeBZRS(s�This class represents the Python library itself.  It allows
    accessing Python API functions.  The GIL is not released, and
    Python exceptions are handled correctly.
    (R'R(R�R/t_FUNCFLAG_PYTHONAPIR�(((s'/usr/lib64/python2.7/ctypes/__init__.pyR��stWinDLLcBseZdZeZRS(snThis class represents a dll exporting functions using the
        Windows stdcall calling convention.
        (R'R(R�R>R�(((s'/usr/lib64/python2.7/ctypes/__init__.pyR��s(t_check_HRESULTRItHRESULTcBseZdZeZRS(R^(R'R(RKR�t_check_retval_(((s'/usr/lib64/python2.7/ctypes/__init__.pyR��s
tOleDLLcBseZdZeZeZRS(s�This class represents a dll exporting functions using the
        Windows stdcall calling convention, and returning HRESULT.
        HRESULT error values are automatically raised as WindowsError
        exceptions.
        (R'R(R�R>R�R�R�(((s'/usr/lib64/python2.7/ctypes/__init__.pyR��st
LibraryLoadercBs,eZd�Zd�Zd�Zd�ZRS(cCs
||_dS(N(t_dlltype(RWtdlltype((s'/usr/lib64/python2.7/ctypes/__init__.pyR��scCsB|ddkrt|��n|j|�}t|||�|S(Nit_(R�R�R�(RWR}tdll((s'/usr/lib64/python2.7/ctypes/__init__.pyR��s
cCs
t||�S(N(tgetattr(RWR}((s'/usr/lib64/python2.7/ctypes/__init__.pyR��scCs
|j|�S(N(R�(RWR}((s'/usr/lib64/python2.7/ctypes/__init__.pyR;�s(R'R(R�R�R�R;(((s'/usr/lib64/python2.7/ctypes/__init__.pyR��s			s
python dlltcygwinslibpython%d.%d.dll(tget_last_errortset_last_errorcCsF|dkrt�}n|dkr9t|�j�}nt||�S(N(RtGetLastErrorRtstriptWindowsError(tcodetdescr((s'/usr/lib64/python2.7/ctypes/__init__.pytWinError�s
(t
_memmove_addrt_memset_addrt_string_at_addrt
_cast_addrcs#dtf��fd��Y}|S(NR&cseZ�Z�ZeeBZRS((R'R(R)R*R/R�R+((R,R.(s'/usr/lib64/python2.7/ctypes/__init__.pyR&�s(R8(R.R,R&((R,R.s'/usr/lib64/python2.7/ctypes/__init__.pyt
PYFUNCTYPE�scCst|||�S(N(t_cast(tobjRM((s'/usr/lib64/python2.7/ctypes/__init__.pyRz�scCs
t||�S(sAstring_at(addr[, size]) -> string

    Return the string at addr.(t
_string_at(tptrR((s'/usr/lib64/python2.7/ctypes/__init__.pyt	string_at�s(t_wstring_at_addrcCs
t||�S(sFwstring_at(addr[, size]) -> string

        Return the string at addr.(t_wstring_at(R�R((s'/usr/lib64/python2.7/ctypes/__init__.pyt
wstring_atscCsNy"tdt�t�dg�}Wntk
r6dSX|j|||�SdS(Nscomtypes.server.inprocservert*i�(t
__import__tglobalstlocalstImportErrortDllGetClassObject(trclsidtriidtppvtccom((s'/usr/lib64/python2.7/ctypes/__init__.pyR�	s
"
cCsAy"tdt�t�dg�}Wntk
r6dSX|j�S(Nscomtypes.server.inprocserverR�i(R�R�R�R�tDllCanUnloadNow(R�((s'/usr/lib64/python2.7/ctypes/__init__.pyR�s
"
(tBigEndianStructuretLittleEndianStructurei(R
R(R
R(R
R(R
R(R
R(R
R(R
R(�R�tosR|tsysR�Rt_ctypesRRRRRR8t_ctypes_versionRRRRJR	t	_calcsizet	ExceptionR}RR�tplatformRtunametsplitRR/RR�RR2RR3RR"R#R6R:R;R�R<R>R?R@treplaceRARBRCRDRERFRGRHRIRQRRRYR[R]R_RbRcReRgRiRlRmRot__ctype_le__t__ctype_be__RqRRtR{tc_voidpR~R�R�R�R�R�R�R�R�R�R�R�tobjectR�R�R�R�R�R�R�tcdlltpydllt	dllhandlet	pythonapitversion_infoRvtoledllRwR�tcoredllR�R�R�tc_size_tt	c_ssize_tR�R�R�R�tmemmovetmemsetR�R�RzR�R�R�R�R�R�R�tctypes._endianR�R�tc_int8tc_uint8tkindtc_int16tc_int32tc_int64tc_uint16tc_uint32tc_uint64(((s'/usr/lib64/python2.7/ctypes/__init__.pyt<module>sJ)"	!			(




	



		







	

	
	<
				"		
			
		


?>