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Le?e|Z}ddpZ~ejd{krE dqZdrZnddslmZmZeIZeFZxke;e?e=eDgD]WZe1edkr eZqz e1edtkr eZqz e1edkrz eZqz qz Wxke<e@e>eEgD]WZe1edkr eZq e1edtkr$ eZq e1edkr eZq q W[eRdS(|s,create and manipulate C data types in PythoniNs1.1.0(tUniont StructuretArray(t_Pointer(tCFuncPtr(t __version__(t RTLD_LOCALt RTLD_GLOBAL(t ArgumentError(tcalcsizesVersion number mismatchtnttce(t FormatErrortposixtdarwinit.ii(tFUNCFLAG_CDECLtFUNCFLAG_PYTHONAPItFUNCFLAG_USE_ERRNOtFUNCFLAG_USE_LASTERRORcCst|ttfrT|dkr4t|d}nt|}|}||_|St|ttfrt|}|}|St |dS(screate_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%/sys/lib/python2.7/ctypes/__init__.pytcreate_string_buffer4s      cCs t||S(N(R"(RR((s%/sys/lib/python2.7/ctypes/__init__.pytc_bufferFscst|jdtr%tOn|jdtrDtOn|rctd|jnytfSWnGtk rdt ffdY}|tf<|SXdS(sCFUNCTYPE(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 CFunctionTypecseZZZZRS((t__name__t __module__t _argtypes_t _restype_t_flags_((targtypestflagstrestype(s%/sys/lib/python2.7/ctypes/__init__.pyR&hsN( t_FUNCFLAG_CDECLtpoptFalset_FUNCFLAG_USE_ERRNOt_FUNCFLAG_USE_LASTERRORt ValueErrortkeyst_c_functype_cachetKeyErrort _CFuncPtr(R.R,tkwR&((R,R-R.s%/sys/lib/python2.7/ctypes/__init__.pyt CFUNCTYPENs   "(t LoadLibrary(tFUNCFLAG_STDCALLcst|jdtr%tOn|jdtrDtOn|rctd|jnytfSWnGtk rdt ffdY}|tf<|SXdS(NR$R%s!unexpected keyword argument(s) %stWinFunctionTypecseZZZZRS((R'R(R)R*R+((R,R-R.(s%/sys/lib/python2.7/ctypes/__init__.pyR=s( t_FUNCFLAG_STDCALLR0R1R2R3R4R5t_win_functype_cacheR7R8(R.R,R9R=((R,R-R.s%/sys/lib/python2.7/ctypes/__init__.pyt WINFUNCTYPEws   "R:R@(tdlopen(tsizeoftbyreft addressoft alignmenttresize(t get_errnot set_errno(t _SimpleCDatacCsmddlm}|dkr(|j}nt|||}}||kritd|||fndS(Ni(R s"sizeof(%s) wrong: %d instead of %d(tstructR Rt_type_RBt SystemError(ttypttypecodeR tactualtrequired((s%/sys/lib/python2.7/ctypes/__init__.pyt _check_sizes   t py_objectcBseZdZdZRS(tOcCs=ytt|jSWntk r8dt|jSXdS(Ns %s()(tsuperRRt__repr__R4ttypeR'(tself((s%/sys/lib/python2.7/ctypes/__init__.pyRUs (R'R(RKRU(((s%/sys/lib/python2.7/ctypes/__init__.pyRRstPtc_shortcBseZdZRS(th(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRYstc_ushortcBseZdZRS(tH(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyR[stc_longcBseZdZRS(tl(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyR]stc_ulongcBseZdZRS(tL(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyR_stiR^tc_intcBseZdZRS(Ra(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRbstc_uintcBseZdZRS(tI(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRcstc_floatcBseZdZRS(tf(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRestc_doublecBseZdZRS(td(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRgst c_longdoublecBseZdZRS(tg(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRistqt c_longlongcBseZdZRS(Rk(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRlst c_ulonglongcBseZdZRS(tQ(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRmstc_ubytecBseZdZRS(tB(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRostc_bytecBseZdZRS(tb(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRqsRcBseZdZRS(tc(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyRstc_char_pcBs2eZdZejdkr'dZn dZRS(tzR cCsLtjj|ds,d|jj|jfSd|jjt|tjfS(Nis%s(%r)s%s(%s)(twindlltkernel32tIsBadStringPtrAt __class__R'Rtcasttc_void_p(RW((s%/sys/lib/python2.7/ctypes/__init__.pyRUscCs d|jjt|tjfS(Ns%s(%s)(RyR'RzR{R(RW((s%/sys/lib/python2.7/ctypes/__init__.pyRUs(R'R(RKt_ostnameRU(((s%/sys/lib/python2.7/ctypes/__init__.pyRts R{cBseZdZRS(RX(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyR{stc_boolcBseZdZRS(t?(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyR~s(tPOINTERtpointert_pointer_type_cachecCsutjtjtjdkr0tjntjtt _t jtt _t tds(sntR (RtclearR6R|R}R?t c_wchar_pt from_paramRtc_wcharRtRR{RR:Rb(((s%/sys/lib/python2.7/ctypes/__init__.pyt _reset_cache s    (tset_conversion_modetmbcstignoretasciitstrictRcBseZdZRS(tZ(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyR#sRcBseZdZRS(tu(R'R(RK(((s%/sys/lib/python2.7/ctypes/__init__.pyR&scCst|ttfrT|dkr4t|d}nt|}|}||_|St|ttfrt|}|}|St |dS(screate_unicode_buffer(aString) -> character array create_unicode_buffer(anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array iN( RRRRRRRRRR(RRR R!((s%/sys/lib/python2.7/ctypes/__init__.pytcreate_unicode_buffer)s      cCsptj|ddk r'tdnt|tkrHtdn|j||t|.qsort -> callable object ['qsort'] -> callable object Calling the functions releases the Python GIL during the call and reacquires it afterwards. cs|_j|r%tOn|r8tOndtffdY}|_|dkrtj|_n |_dS(Nt_FuncPtrcseZZjZRS((R'R(R+t_func_restype_R*((R-RW(s%/sys/lib/python2.7/ctypes/__init__.pyRgs( t_namet _func_flags_R2R3R8RRt_dlopent_handle(RWR}tmodethandleR$R%R((R-RWs%/sys/lib/python2.7/ctypes/__init__.pyt__init__]s      cCsDd|jj|j|jtjdd@t|tjdd@fS(Ns<%s '%s', handle %x at %x>ii(RyR'RRt_systmaxintR(RW((s%/sys/lib/python2.7/ctypes/__init__.pyRUqscCsP|jdr-|jdr-t|n|j|}t||||S(Nt__(t startswithtendswithtAttributeErrort __getitem__tsetattr(RWR}tfunc((s%/sys/lib/python2.7/ctypes/__init__.pyt __getattr__ws cCs:|j||f}t|ttfs6||_n|S(N(RRRRR'(RWtname_or_ordinalR((s%/sys/lib/python2.7/ctypes/__init__.pyR~s N(R'R(t__doc__R/RRbRt DEFAULT_MODERR1RRURR(((s%/sys/lib/python2.7/ctypes/__init__.pyRLs    tPyDLLcBseZdZeeBZRS(sThis class represents the Python library itself. It allows to access Python API functions. The GIL is not released, and Python exceptions are handled correctly. (R'R(RR/t_FUNCFLAG_PYTHONAPIR(((s%/sys/lib/python2.7/ctypes/__init__.pyRstWinDLLcBseZdZeZRS(snThis class represents a dll exporting functions using the Windows stdcall calling convention. (R'R(RR>R(((s%/sys/lib/python2.7/ctypes/__init__.pyRs(t_check_HRESULTRItHRESULTcBseZdZeZRS(R^(R'R(RKRt_check_retval_(((s%/sys/lib/python2.7/ctypes/__init__.pyRs tOleDLLcBseZdZeZeZRS(sThis 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(RR>RRR(((s%/sys/lib/python2.7/ctypes/__init__.pyRst LibraryLoadercBs,eZdZdZdZdZRS(cCs ||_dS(N(t_dlltype(RWtdlltype((s%/sys/lib/python2.7/ctypes/__init__.pyRscCsB|ddkrt|n|j|}t||||S(Nit_(RRR(RWR}tdll((s%/sys/lib/python2.7/ctypes/__init__.pyRs cCs t||S(N(tgetattr(RWR}((s%/sys/lib/python2.7/ctypes/__init__.pyRscCs |j|S(N(R(RWR}((s%/sys/lib/python2.7/ctypes/__init__.pyR;s(R'R(RRRR;(((s%/sys/lib/python2.7/ctypes/__init__.pyRs   s python dlltcygwinslibpython%d.%d.dll(tget_last_errortset_last_errorcCsF|dkrt}n|dkr9t|j}nt||S(N(Rt GetLastErrorR tstript WindowsError(tcodetdescr((s%/sys/lib/python2.7/ctypes/__init__.pytWinErrors    (t _memmove_addrt _memset_addrt_string_at_addrt _cast_addrcs#dtffdY}|S(NR&cseZZZeeBZRS((R'R(R)R*R/RR+((R,R.(s%/sys/lib/python2.7/ctypes/__init__.pyR&s(R8(R.R,R&((R,R.s%/sys/lib/python2.7/ctypes/__init__.pyt PYFUNCTYPEscCst|||S(N(t_cast(tobjRM((s%/sys/lib/python2.7/ctypes/__init__.pyRzscCs t||S(sAstring_at(addr[, size]) -> string Return the string at addr.(t _string_at(tptrR((s%/sys/lib/python2.7/ctypes/__init__.pyt string_ats(t_wstring_at_addrcCs t||S(sFwstring_at(addr[, size]) -> string Return the string at addr.(t _wstring_at(RR((s%/sys/lib/python2.7/ctypes/__init__.pyt wstring_atscCsNy"tdttdg}Wntk r6dSX|j|||SdS(Nscomtypes.server.inprocservert*i(t __import__tglobalstlocalst ImportErrortDllGetClassObject(trclsidtriidtppvtccom((s%/sys/lib/python2.7/ctypes/__init__.pyR s " cCsAy"tdttdg}Wntk r6dSX|jS(Nscomtypes.server.inprocserverRi(RRRRtDllCanUnloadNow(R((s%/sys/lib/python2.7/ctypes/__init__.pyRs " (tBigEndianStructuretLittleEndianStructurei(sntsce(sntsce(sntsce(sntsce(sntsce(sntsce(sntsce(RtosR|tsysRRt_ctypesRRRRRR8t_ctypes_versionRRRRJR t _calcsizet ExceptionR}R RtplatformRtunametsplitRR/RRRR2RR3RR"R#R6R:R;RR<R>R?R@treplaceRARBRCRDRERFRGRHRIRQRRRYR[R]R_RbRcReRgRiRlRmRot __ctype_le__t __ctype_be__RqRRtR{tc_voidpR~RRRRRRRRRRRtobjectRRRRRRRtcdlltpydllt dllhandlet pythonapit version_infoRvtoledllRwRtcoredllRRRtc_size_tt c_ssize_tRRRRtmemmovetmemsetRRRzRRRRRRRtctypes._endianRRtc_int8tc_uint8tkindtc_int16tc_int32tc_int64tc_uint16tc_uint32tc_uint64(((s%/sys/lib/python2.7/ctypes/__init__.pytsJ ) "   !   (                         8           "