lf>>>>rc|D]_}||z}| tj}|D]G}tj||}tj|r|ccSH`dSr )syspathosjoinisfile)r module_namer so_suffixes so_suffixbasenamedirnamefilenames r find_modulezVGenericEngine.find_modules$ $ $I"Y.H|x $ $7<<::7>>(++$#OOOOO$ $  $ $rcdSr )rs r collect_typeszVGenericEngine.collect_types% rc@|j|dzdS)N )_fwrite)rwhats r_prntzVGenericEngine._prnt(s   dTk"""""rc*|j}|t||jj|dt jdkrAt jdkrd}nd}|j}|d||ddSdS)Ndeclwin32PyInit_initzvoid z (void) { } ) r/cffimod_headerr preamble _generaterplatform version_infoget_module_name)rprntprefixmodnames rwrite_source_to_fz VGenericEngine.write_source_to_f+sz ^ T] #$$$ v <7 " "4''"m3355G DDFFGGG< = = = = = # "rrcbjj}tjtjjj}||| dGfddtj d} d||S)Nloadingc0eZdZZjZgZfdZdS)/VGenericEngine.load_library..FFILibrarycjSr ) _cffi_dir)r FFILibrarys r__dir__z7VGenericEngine.load_library..FFILibrary.__dir__Ts !++rN)__name__ __module__ __qualname___cffi_generic_moduler _cffi_ffirFrH)rGmodulersrrGrDPs@#) II , , , , , , ,rrGr)loaded)library) r _backendrrrcurdirr modulefilename load_library_loadtypes ModuleType)rflagsbackendr#rPrGrNs` @@rrTzVGenericEngine.load_libraryAs(#7<< 4=+GHH%%h66 69%%%  , , , , , , , , ,) , , , *R.. 68W 555rcd|jjjD}||S)Nc"g|] \}\}}||f Sr&r&).0keytpquals r z4VGenericEngine._get_declarations..^s7HHH.c:BRyHHHr)r _parser _declarationsitemssort)rlsts r_get_declarationsz VGenericEngine._get_declarations]sKHH $ 0 > D D F FHHH   rcF|D]\}}|dd\}} t|d|d|}n #t$rt d|zwxYw |||d#t $r}t j||d}~wwxYwdS)N r_generate_gen__znot implemented in verify(): %r)rfsplitgetattrAttributeErrorr Exceptionrattach_exception_info)r step_namenamer^kindrealnamemethodes rr9zVGenericEngine._generatecs..00  HD"!ZZQ//ND( > @I (KLL! > > >'5<>>> > r8$$$$   +At444   s#A  A(, A99 BBBc |D]h\}}|dd\}}t|d|d|} ||||fi|A#t$r} t j| |d} ~ wwxYwdS)Nrhrrj_gen_)rfrkrlrnrro) rrNrprrqr^rrrsrtrus rrUzVGenericEngine._loadrs..00  HD"!ZZQ//ND(TT999dd#CDDF r8V44t4444   +At444    s A A; A66A;cdSr r&rr^rqs r_generate_nothingz VGenericEngine._generate_nothing|r(rc dSr r&rr^rqrNrs r _loaded_noopzVGenericEngine._loaded_noopr(rc dt|tjsJ|jr|d||dS|j}t |j}g}t|jD]=\}}d}t|tj rd}| d||fz>d|zfdt|j|D} |j } t| tj r6| d| dtj} d | pd } d |z} |j | |jr |jd z} nd} d | | d | d} d|z|| | |dt|j tj rd}n$t|j tjsd}nd}|d||d d |d|d|dS)NFr)*z%sx%dzargument of %scHg|]\}}|d|zS)z %s) get_c_name)r\typeargcontexts rr`z>VGenericEngine._generate_gen_function_decl..s?<<< tS??53;88<<z6VGenericEngine._loaded_gen_function..s/LLSJsE$788LLLLLLr'z'' is used as result type, but is opaquerrr)rrrr_load_constantanyrrrr PointerTyperfldtypes TypeError _get_c_namerrtupler _get_cached_btype load_function_make_struct_wrappersetattrrrF)rr^rqrNrP newfunction indirectionsbase_tp indirect_argsrrindirect_resultBFuncrs r_loaded_gen_functionz#VGenericEngine._loaded_gen_functionsa"e344444 ; A--eRvFFKKLGLLBGLLLLL I!")U-@AA I " '00..FAs!#u':;;6#/44$++QH555!((----"$)ou/BCC6&/7'i,;,G,G,I,I,I,I)LMMM',&7&H&HO!((O<<< ''Ho+FGGG&+oO*5+?+?+:BKIIH..r22E&-K ..ukBBK& A A3"77 Q8?AA {+++ W &&t,,,,,rc|jj|j|dkr|jfd}nfd}||_|S)NrcP}|g|R|dSNr)new)rresBTyper oldfuncs rnewfuncz4VGenericEngine._make_struct_wrapper..newfuncs3ggenn#d####1v rcz|d|fz|dzdz}|S)Nr)newp)rrrYrrs rrz4VGenericEngine._make_struct_wrapper..newfuncsGBQBx7<<tAw#?#?"AAD1JNw~%r)r rQr_cffi_base_type) rrrr^rrrrYr s `` @@@rrz#VGenericEngine._make_struct_wrappers(#**2.. ==(C          & & & & & & & &#*rcN||jksJ||d|dSNstructrq_generate_struct_or_union_declrys r_generate_gen_struct_declz(VGenericEngine._generate_gen_struct_decls/rw ++B$?????rc6||d||dSr_loading_struct_or_unionrr^rqrNs r_loading_gen_structz"VGenericEngine._loading_gen_structs" %%b(D&AAAAArc 0||dSr _loaded_struct_or_unionr|s r_loaded_gen_structz!VGenericEngine._loaded_gen_struct $$R(((((rcN||jksJ||d|dSNunionrrys r_generate_gen_union_declz'VGenericEngine._generate_gen_union_decls/rw ++B>>>>>rc6||d||dSrrrs r_loading_gen_unionz!VGenericEngine._loading_gen_unions" %%b'4@@@@@rc 0||dSr rr|s r_loaded_gen_unionz VGenericEngine._loaded_gen_unionrrc |jdSd|d|}d|d|}|d|}|j}|d|d|d|d|d |d |D]\}} } } t | t jr| s| d kr|d |zJ |d | dd|z| d|dw#t$r%} |dt| zYd} ~ d} ~ wwxYw|d|j ||d|d|d|d|z|d|d|z|d|D]t\}} } } | d kr|d|d|dt | t j r(| j!|d| zb|d|d |du|d!|d"|d#|d$|d%|d&|d|dS)'N _cffi_check_rj _cffi_layout_rhz static void rz *p)rz8 /* only to generate compile-time warnings or errors */z (void)p;rz (void)((p->%s) << 1);z { z*tmpzfield %r)qualsz = &p->z; (void)tmp; }z /* %s */rz intptr_t z (intptr_t i)z, struct _cffi_aligncheck { char x; %s y; };z static intptr_t nums[] = {z sizeof(%s),z) offsetof(struct _cffi_aligncheck, y),z offsetof(rz),z 0, /* %s */z sizeof(((z *)0)->z -1z };z return nums[i];z3 /* the next line is not executed, but compiled */rz(0);)fldnamesstripr/ enumfieldsrr PrimitiveTypeis_integer_typerrstrrr ArrayTypelengthr) rr^r>rq checkfuncnamelayoutfuncnamecnamer=fnameftypefbitsizefqualrus rrz-VGenericEngine._generate_struct_or_union_declsd ;  F /5vvtt< 17>"FFDD)0022z  uuu =>>> S   GHHH \-/]]__ 0 0 )E5(E5%"566 0))++ 008A .677770DD((E1A(OOOO    )000DA.////////0 S  "">222 ... :;;; S   ;e CDDD  +,,,   &'''  8999-/]]__ D D )E5(E1}} DDEEE5559 : : :%11 Del6J'%*;*;*=*==>>>>UUUEEEBCCCC X V   !!!  BCCC === *+++ S  s +C88 D'D""D'c|jdSd|d|}|jdd}|||}g}d} || } | dkrn|| | dz } -t |t jr|jr|d} |d} |ddd} |ddd}| t| t|cxkrt|jksnJ| || | f|_ dS|d | }||f|j |<dS) Nrrjzintptr_t(*)(intptr_t)rTrr4rh)rr _typeof_lockedrrrrrpartial force_flattenr fixedlayoutrr)rr^r>rqrNrrfunctionlayoutnumx totalsizetotalalignmentfieldofs fieldsizers rrz'VGenericEngine._loading_struct_or_union7s ;  F 17>''(?@@C''~>>  A1uue MM!    1HC   b%- . . B2: Bq I#AYNadd|Hqt!t I      x==C NNFFFFc"+6F6FFFFFFF%y)^KBNNN &-4466E4:EMD -b 1 1 1rc|jdS|j|||jvrAd}|j}||}|j|\}}||d||d||d||dd}|D]\}} } } | dkr||||||d|||dzdkrA|| } |||dz|| d||dz }|t|ksJdSdS) Nc<||krtd|||fzdS)Nz'%s (we have %d, but C compiler says %d)r) realvalue expectedvaluemsgs rcheckz5VGenericEngine._loaded_struct_or_union..checkZs9 --+A y9:;;;.-rrzwrong total sizerzwrong total alignmentrzwrong offset for field zwrong size for field ) rr rrpopsizeofalignofroffsetofr) rr^rr BStructrrrrrrrBFields rrz&VGenericEngine._loaded_struct_or_unionSs ;  F ""2&&& 2 2 2 ; ; ; (C++B//G =AA"EEMFE E&)SZZ002D E E E E&)S[[113J K K KA13  -uhq==fQigu!=!=!=5:U<>>>!A#;!## 22599FE&1+szz&'9'9'97@@@QF ####/ 3 2.$#rct|tjr|||ddS||d|dSNr))rrEnumType_generate_gen_enum_declrrys r_generate_gen_anonymous_declz+VGenericEngine._generate_gen_anonymous_declusR b%. ) ) >  ( (T2 6 6 6 6 6  / /B = = = = =rct|tjr||||ddS||d||dSr)rrr_loading_gen_enumrrs r_loading_gen_anonymousz%VGenericEngine._loading_gen_anonymous{sW b%. ) ) @  " "2tVR 8 8 8 8 8  ) )"b$ ? ? ? ? ?rc t|tjr|j|||fi|dS||dSr )rrr_loaded_gen_enumrr|s r_loaded_gen_anonymousz$VGenericEngine._loaded_gen_anonymoussU b%. ) ) - !D !"dF ; ;d ; ; ; ; ;  ( ( , , , , ,rNconstc|j}d|d|}|j||R|sJ|dksJ|d|z|d||||d|dn|rK|dksJ|d|z|d|d |d |d |d |dn|J|J|d krd}nd}d} |dkrt |t jrd} d}||d| |d||d|d ||d |d|dS)N_cffi_rjrint %s(char *out_error)r return 0;rzint %s(long long *out_value)z *out_value = (long long)(rz return (z) <= 0;var&r)zconst *rhz(void))r/rr_check_int_constant_valuerrrr) ris_intrqr^category check_valuer=funcname ampersandextras rrz"VGenericEngine._generate_gen_constsz$,HHdd3 ""8,,,  "MM6w&&&& D*X5 6 6 6 DIII  * *4 = = = D    DIIII  w&&&& D/(: ; ; ; DIII DDddd< = = = DD$$$0 1 1 1 DIIII>>>&&&5    E7""z"e6I'J'J"! Dxxx@$GG H H H DIII DDyy$$$7 8 8 8 DIII rct|tjo|}||||dSr )rrrrr)rr^rqr!s r_generate_gen_constant_declz*VGenericEngine._generate_gen_constant_declsCB 344M9K9K9M9M   r22222rcBd|z}||sJ||||}ny|r|jdd}|jdd} || |} |j|} | | } t | d}|dkrE| sC|jdd} |dd|j| zzz }n|Jd}t|tj rd |z}|j| ||d} || |} | }t|tj r|d}|S) Nz_cffi_const_%sz long long*rzint(*)(long long*)z long longrz (*)(void)r) _load_known_int_constantr rrrintr rrrr)rr!r^rqrNr#r$valuerrrpnegative BLongLong fntypeextras rrzVGenericEngine._load_constants#d*  "MM6  ) )&( ; ; ;EE  !H++L99!&&&%K"e122 0!K/ H++BMM+t,L,LMMaPE++E8< 0 || (long)(%s) != %dL) {z1 if ((%s) <= 0 || (unsigned long)(%s) != %dUL) {z char buf[64];z if ((%s) <= 0)z) sprintf(buf, "%%ld", (long)(%s));z elsez2 sprintf(buf, "%%lu", (unsigned long)(%s));z: sprintf(out_error, "%s has the real value %s, not %s",z "%s", buf, "%d");dz return -1;z })r/)rrqr-r=s rr z(VGenericEngine._check_int_constant_values,z A:: D9dE=## $ $ $ $ DDdEH## $ $ $  !!!  !D ()))  84 ?@@@ Z  A      IJJJ  ,TcT E/B BCCC   U rc|jdd}|jdd}|||}|j|d}||dkrI|j|}t jdkrt|d}t|dS)Nzchar[]rz int(*)(char*)r3zutf-8) r rrrstringrr;rr)rrNr$rrrr.errors rr+z'VGenericEngine._load_known_int_constants''11!4''88;''x88 HLL $ $ 8A;;??HOOA&&E4''E7++#E** * ?rc>|dd}d|d|S)N$___D__cffi_e_rj)replace)rr>rqs r_enum_funcnamezVGenericEngine._enum_funcnames(||C))"(&&$$//renumc|jr"|jD]}|d|dS|||}|j||j}|d|z|dt|j|jD]\}}| |||d|d|dS)NTrrrr) r enumeratorsrr?rrr/r enumvaluesr )rr^rqr> enumeratorr$r= enumvalues rrz&VGenericEngine._generate_gen_enum_decls :  n ; ; ((z:::: F&&vt44 ""8,,,z  & 1222 S %(%G%G B B !J  * *:y A A A A ] S  rcjr2fdjD}t|_d_dS||}|dS)Nc@g|]}d|S)T)r)r\rDrNrr^s rr`z4VGenericEngine._loading_gen_enum..s=<<<(--dB FKK<<rCr$s`` ` rrz VGenericEngine._loading_gen_enums : <<<<<<<,.N<<dSr )rrBrCrrrFr)rr^rqrNrPrDrEs rrzVGenericEngine._loaded_gen_enums`%(%G%G 7 7 !J GZ 3 3 3 MM # * *: 6 6 6 6 7 7rcL|dkrd}n|}|d||dSNz...T)r#)r)rr^rqr#s r_generate_gen_macro_declz'VGenericEngine._generate_gen_macro_decl s8 ;;KKK   t EEEEErc|dkrd}n|}|d||||}t|||t|j|dSrK)rrrrFr)rr^rqrNrPr#r-s r_loaded_gen_macroz VGenericEngine._loaded_gen_macro)sq ;;KKK##D"dF0;$==u%%% W &&t,,,,,rct|tjr|rY|j}d|}|j||d|z|d|d|d|dtj|j}| d||dStj|}| d||d dS) N _cffi_sizeof_zsize_t %s(void)rz return sizeof(rrFr)r") rrrlength_is_unknownr/rrritemr)rr^rqr=r$tp_ptrs r_generate_gen_variable_declz*VGenericEngine._generate_gen_variable_decl6s b%/ * * J##%% z046#**8444&1222S ttt5666S &rw//F  $ $UD& 9 9 9 9 9&r**F  $ $UD&5 $ I I I I Irct|tjr|rd|}|jdd}|||}|}|j|j} t||j | \} } | dkrtd|d|j| | }tj |j} |d| ||} |j5|j|}|j|| } t#||| t%|j|dSd|z}|j|d|d}|||}|fd }fd }t#t%||t-||t%|j|dS) NrPzsize_t(*)(void)rz bad size: z! does not seem to be an array of Fz _cffi_var_%sz *(*)(void)cdSrr&)rPptrs rgetterz3VGenericEngine._loaded_gen_variable..gettergs q6Mrc|d<dSrr&)rPr-rWs rsetterz3VGenericEngine._loaded_gen_variable..setterisCFFFr)rrrrQr rrrrRdivmodr rresolve_lengthrrrcastrrrFrrproperty)rr^rqrNrPr$rrsize BItemTyperrestrSr-BArrayrXrZrWs @r_loaded_gen_variablez#VGenericEngine._loaded_gen_variableHsP b%/ * * ##%% / /046//0ABB1E!//x@@xzz H66rw?? %dDHOOI,F,FGG 199++rww()))&&v..&rw//F''vtVDDEy$33B77 fe44 GT5 ) ) ) MM # * *4 0 0 0 F"D('' lD(I(IJJ1M''x88hjj          W tXff%=%=>>> W &&t,,,,,r)r))r)NrNr )r@)5rIrJrK _class_key_gen_python_modulerrr$r'r/r@rTrfr9rUrzr}_generate_gen_typedef_decl_loading_gen_typedef_loaded_gen_typedefr_loading_gen_functionrrrrrrrrrrrrrrrr(_loading_gen_constantrr3r r+r?rrrrL_loading_gen_macrorNrT_loading_gen_variablercr&rrrr sJ/// ??? $$$   ####>>>,8         $5#/#/ +++Z)"-"-"-H&@@@BBB)))???AAA)))///bBBB8$$$D>>> @@@ ---CJ(,####J333)8---& + + +000 "<<<<777FFF&---JJJ )$-$-$-$-$-rrad #include #include #include #include #include /* XXX for ssize_t on some platforms */ /* this block of #ifs should be kept exactly identical between c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py and cffi/_cffi_include.h */ #if defined(_MSC_VER) # include /* for alloca() */ # if _MSC_VER < 1600 /* MSVC < 2010 */ typedef __int8 int8_t; typedef __int16 int16_t; typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; typedef __int8 int_least8_t; typedef __int16 int_least16_t; typedef __int32 int_least32_t; typedef __int64 int_least64_t; typedef unsigned __int8 uint_least8_t; typedef unsigned __int16 uint_least16_t; typedef unsigned __int32 uint_least32_t; typedef unsigned __int64 uint_least64_t; typedef __int8 int_fast8_t; typedef __int16 int_fast16_t; typedef __int32 int_fast32_t; typedef __int64 int_fast64_t; typedef unsigned __int8 uint_fast8_t; typedef unsigned __int16 uint_fast16_t; typedef unsigned __int32 uint_fast32_t; typedef unsigned __int64 uint_fast64_t; typedef __int64 intmax_t; typedef unsigned __int64 uintmax_t; # else # include # endif # if _MSC_VER < 1800 /* MSVC < 2013 */ # ifndef __cplusplus typedef unsigned char _Bool; # endif # endif #else # include # if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux) # include # endif #endif ) rrrVr)rr9robjectrr7r&rrrns $$$$$$a -a -a -a -a -Va -a -a -F5r