| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086 |
- // ignore_for_file: always_specify_types
- // ignore_for_file: camel_case_types
- // ignore_for_file: non_constant_identifier_names
- // AUTO GENERATED FILE, DO NOT EDIT.
- //
- // Generated by `package:ffigen`.
- // ignore_for_file: type=lint
- import 'dart:ffi' as ffi;
- /// Bindings for `src/pocketpy.h`.
- ///
- /// Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
- ///
- class PocketpyBindings {
- /// Holds the symbol lookup function.
- final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
- _lookup;
- /// The symbols are looked up in [dynamicLibrary].
- PocketpyBindings(ffi.DynamicLibrary dynamicLibrary)
- : _lookup = dynamicLibrary.lookup;
- /// The symbols are looked up with [lookup].
- PocketpyBindings.fromLookup(
- ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
- lookup)
- : _lookup = lookup;
- /// Initialize pocketpy and the default VM.
- void py_initialize() {
- return _py_initialize();
- }
- late final _py_initializePtr =
- _lookup<ffi.NativeFunction<ffi.Void Function()>>('py_initialize');
- late final _py_initialize = _py_initializePtr.asFunction<void Function()>();
- /// Finalize pocketpy and free all VMs.
- void py_finalize() {
- return _py_finalize();
- }
- late final _py_finalizePtr =
- _lookup<ffi.NativeFunction<ffi.Void Function()>>('py_finalize');
- late final _py_finalize = _py_finalizePtr.asFunction<void Function()>();
- /// Get the current VM index.
- int py_currentvm() {
- return _py_currentvm();
- }
- late final _py_currentvmPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function()>>('py_currentvm');
- late final _py_currentvm = _py_currentvmPtr.asFunction<int Function()>();
- /// Switch to a VM.
- /// @param index index of the VM ranging from 0 to 16 (exclusive). `0` is the default VM.
- void py_switchvm(
- int index,
- ) {
- return _py_switchvm(
- index,
- );
- }
- late final _py_switchvmPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int)>>('py_switchvm');
- late final _py_switchvm = _py_switchvmPtr.asFunction<void Function(int)>();
- /// Reset the current VM.
- void py_resetvm() {
- return _py_resetvm();
- }
- late final _py_resetvmPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function()>>('py_resetvm');
- late final _py_resetvm = _py_resetvmPtr.asFunction<void Function()>();
- /// Get the current VM context. This is used for user-defined data.
- ffi.Pointer<ffi.Void> py_getvmctx() {
- return _py_getvmctx();
- }
- late final _py_getvmctxPtr =
- _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Void> Function()>>(
- 'py_getvmctx');
- late final _py_getvmctx =
- _py_getvmctxPtr.asFunction<ffi.Pointer<ffi.Void> Function()>();
- /// Set the current VM context. This is used for user-defined data.
- void py_setvmctx(
- ffi.Pointer<ffi.Void> ctx,
- ) {
- return _py_setvmctx(
- ctx,
- );
- }
- late final _py_setvmctxPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
- 'py_setvmctx');
- late final _py_setvmctx =
- _py_setvmctxPtr.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
- /// Set `sys.argv`. Used for storing command-line arguments.
- void py_sys_setargv(
- int argc,
- ffi.Pointer<ffi.Pointer<ffi.Char>> argv,
- ) {
- return _py_sys_setargv(
- argc,
- argv,
- );
- }
- late final _py_sys_setargvPtr = _lookup<
- ffi.NativeFunction<
- ffi.Void Function(
- ffi.Int, ffi.Pointer<ffi.Pointer<ffi.Char>>)>>('py_sys_setargv');
- late final _py_sys_setargv = _py_sys_setargvPtr
- .asFunction<void Function(int, ffi.Pointer<ffi.Pointer<ffi.Char>>)>();
- /// Setup the callbacks for the current VM.
- ffi.Pointer<py_Callbacks> py_callbacks() {
- return _py_callbacks();
- }
- late final _py_callbacksPtr =
- _lookup<ffi.NativeFunction<ffi.Pointer<py_Callbacks> Function()>>(
- 'py_callbacks');
- late final _py_callbacks =
- _py_callbacksPtr.asFunction<ffi.Pointer<py_Callbacks> Function()>();
- /// Run a source string.
- /// @param source source string.
- /// @param filename filename (for error messages).
- /// @param mode compile mode. Use `EXEC_MODE` for statements `EVAL_MODE` for expressions.
- /// @param module target module. Use NULL for the main module.
- /// @return `true` if the execution is successful or `false` if an exception is raised.
- bool py_exec(
- ffi.Pointer<ffi.Char> source,
- ffi.Pointer<ffi.Char> filename,
- int mode,
- py_Ref module,
- ) {
- return _py_exec(
- source,
- filename,
- mode,
- module,
- );
- }
- late final _py_execPtr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>,
- ffi.Int32, py_Ref)>>('py_exec');
- late final _py_exec = _py_execPtr.asFunction<
- bool Function(
- ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int, py_Ref)>();
- /// Evaluate a source string. Equivalent to `py_exec(source, "<string>", EVAL_MODE, module)`.
- bool py_eval(
- ffi.Pointer<ffi.Char> source,
- py_Ref module,
- ) {
- return _py_eval(
- source,
- module,
- );
- }
- late final _py_evalPtr = _lookup<
- ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Char>, py_Ref)>>(
- 'py_eval');
- late final _py_eval =
- _py_evalPtr.asFunction<bool Function(ffi.Pointer<ffi.Char>, py_Ref)>();
- /// Run a source string with smart interpretation.
- /// Example:
- /// `py_newstr(py_r0(), "abc");`
- /// `py_newint(py_r1(), 123);`
- /// `py_smartexec("print(_0, _1)", NULL, py_r0(), py_r1());`
- /// `// "abc 123" will be printed`.
- bool py_smartexec(
- ffi.Pointer<ffi.Char> source,
- py_Ref module,
- ) {
- return _py_smartexec(
- source,
- module,
- );
- }
- late final _py_smartexecPtr = _lookup<
- ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Char>, py_Ref)>>(
- 'py_smartexec');
- late final _py_smartexec = _py_smartexecPtr
- .asFunction<bool Function(ffi.Pointer<ffi.Char>, py_Ref)>();
- /// Evaluate a source string with smart interpretation.
- /// Example:
- /// `py_newstr(py_r0(), "abc");`
- /// `py_smarteval("len(_)", NULL, py_r0());`
- /// `int res = py_toint(py_retval());`
- /// `// res will be 3`.
- bool py_smarteval(
- ffi.Pointer<ffi.Char> source,
- py_Ref module,
- ) {
- return _py_smarteval(
- source,
- module,
- );
- }
- late final _py_smartevalPtr = _lookup<
- ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Char>, py_Ref)>>(
- 'py_smarteval');
- late final _py_smarteval = _py_smartevalPtr
- .asFunction<bool Function(ffi.Pointer<ffi.Char>, py_Ref)>();
- /// Compile a source string into a code object.
- /// Use python's `exec()` or `eval()` to execute it.
- bool py_compile(
- ffi.Pointer<ffi.Char> source,
- ffi.Pointer<ffi.Char> filename,
- int mode,
- bool is_dynamic,
- ) {
- return _py_compile(
- source,
- filename,
- mode,
- is_dynamic,
- );
- }
- late final _py_compilePtr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>,
- ffi.Int32, ffi.Bool)>>('py_compile');
- late final _py_compile = _py_compilePtr.asFunction<
- bool Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int, bool)>();
- /// Python equivalent to `globals()`.
- void py_newglobals(
- py_OutRef arg0,
- ) {
- return _py_newglobals(
- arg0,
- );
- }
- late final _py_newglobalsPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>(
- 'py_newglobals');
- late final _py_newglobals =
- _py_newglobalsPtr.asFunction<void Function(py_OutRef)>();
- /// Python equivalent to `locals()`.
- /// @return a temporary object, which expires on the associated function return.
- void py_newlocals(
- py_OutRef arg0,
- ) {
- return _py_newlocals(
- arg0,
- );
- }
- late final _py_newlocalsPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>('py_newlocals');
- late final _py_newlocals =
- _py_newlocalsPtr.asFunction<void Function(py_OutRef)>();
- /// A shorthand for `True`.
- py_GlobalRef py_True() {
- return _py_True();
- }
- late final _py_TruePtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function()>>('py_True');
- late final _py_True = _py_TruePtr.asFunction<py_GlobalRef Function()>();
- /// A shorthand for `False`.
- py_GlobalRef py_False() {
- return _py_False();
- }
- late final _py_FalsePtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function()>>('py_False');
- late final _py_False = _py_FalsePtr.asFunction<py_GlobalRef Function()>();
- /// A shorthand for `None`.
- py_GlobalRef py_None() {
- return _py_None();
- }
- late final _py_NonePtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function()>>('py_None');
- late final _py_None = _py_NonePtr.asFunction<py_GlobalRef Function()>();
- /// A shorthand for `nil`. `nil` is not a valid python object.
- py_GlobalRef py_NIL() {
- return _py_NIL();
- }
- late final _py_NILPtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function()>>('py_NIL');
- late final _py_NIL = _py_NILPtr.asFunction<py_GlobalRef Function()>();
- /// Create an `int` object.
- void py_newint(
- py_OutRef arg0,
- int arg1,
- ) {
- return _py_newint(
- arg0,
- arg1,
- );
- }
- late final _py_newintPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, py_i64)>>(
- 'py_newint');
- late final _py_newint =
- _py_newintPtr.asFunction<void Function(py_OutRef, int)>();
- /// Create a `float` object.
- void py_newfloat(
- py_OutRef arg0,
- double arg1,
- ) {
- return _py_newfloat(
- arg0,
- arg1,
- );
- }
- late final _py_newfloatPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, py_f64)>>(
- 'py_newfloat');
- late final _py_newfloat =
- _py_newfloatPtr.asFunction<void Function(py_OutRef, double)>();
- /// Create a `bool` object.
- void py_newbool(
- py_OutRef arg0,
- bool arg1,
- ) {
- return _py_newbool(
- arg0,
- arg1,
- );
- }
- late final _py_newboolPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, ffi.Bool)>>(
- 'py_newbool');
- late final _py_newbool =
- _py_newboolPtr.asFunction<void Function(py_OutRef, bool)>();
- /// Create a `str` object from a null-terminated string (utf-8).
- void py_newstr(
- py_OutRef arg0,
- ffi.Pointer<ffi.Char> arg1,
- ) {
- return _py_newstr(
- arg0,
- arg1,
- );
- }
- late final _py_newstrPtr = _lookup<
- ffi.NativeFunction<
- ffi.Void Function(py_OutRef, ffi.Pointer<ffi.Char>)>>('py_newstr');
- late final _py_newstr = _py_newstrPtr
- .asFunction<void Function(py_OutRef, ffi.Pointer<ffi.Char>)>();
- /// Create a `str` object with `n` UNINITIALIZED bytes plus `'\0'`.
- ffi.Pointer<ffi.Char> py_newstrn(
- py_OutRef arg0,
- int arg1,
- ) {
- return _py_newstrn(
- arg0,
- arg1,
- );
- }
- late final _py_newstrnPtr = _lookup<
- ffi.NativeFunction<
- ffi.Pointer<ffi.Char> Function(py_OutRef, ffi.Int)>>('py_newstrn');
- late final _py_newstrn = _py_newstrnPtr
- .asFunction<ffi.Pointer<ffi.Char> Function(py_OutRef, int)>();
- /// Create a `str` object from a `c11_sv`.
- void py_newstrv(
- py_OutRef arg0,
- c11_sv arg1,
- ) {
- return _py_newstrv(
- arg0,
- arg1,
- );
- }
- late final _py_newstrvPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, c11_sv)>>(
- 'py_newstrv');
- late final _py_newstrv =
- _py_newstrvPtr.asFunction<void Function(py_OutRef, c11_sv)>();
- /// Create a `bytes` object with `n` UNINITIALIZED bytes.
- ffi.Pointer<ffi.UnsignedChar> py_newbytes(
- py_OutRef arg0,
- int n,
- ) {
- return _py_newbytes(
- arg0,
- n,
- );
- }
- late final _py_newbytesPtr = _lookup<
- ffi.NativeFunction<
- ffi.Pointer<ffi.UnsignedChar> Function(
- py_OutRef, ffi.Int)>>('py_newbytes');
- late final _py_newbytes = _py_newbytesPtr
- .asFunction<ffi.Pointer<ffi.UnsignedChar> Function(py_OutRef, int)>();
- /// Create a `None` object.
- void py_newnone(
- py_OutRef arg0,
- ) {
- return _py_newnone(
- arg0,
- );
- }
- late final _py_newnonePtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>('py_newnone');
- late final _py_newnone =
- _py_newnonePtr.asFunction<void Function(py_OutRef)>();
- /// Create a `NotImplemented` object.
- void py_newnotimplemented(
- py_OutRef arg0,
- ) {
- return _py_newnotimplemented(
- arg0,
- );
- }
- late final _py_newnotimplementedPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>(
- 'py_newnotimplemented');
- late final _py_newnotimplemented =
- _py_newnotimplementedPtr.asFunction<void Function(py_OutRef)>();
- /// Create a `...` object.
- void py_newellipsis(
- py_OutRef arg0,
- ) {
- return _py_newellipsis(
- arg0,
- );
- }
- late final _py_newellipsisPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>(
- 'py_newellipsis');
- late final _py_newellipsis =
- _py_newellipsisPtr.asFunction<void Function(py_OutRef)>();
- /// Create a `nil` object. `nil` is an invalid representation of an object.
- /// Don't use it unless you know what you are doing.
- void py_newnil(
- py_OutRef arg0,
- ) {
- return _py_newnil(
- arg0,
- );
- }
- late final _py_newnilPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>('py_newnil');
- late final _py_newnil = _py_newnilPtr.asFunction<void Function(py_OutRef)>();
- /// Create a `tuple` with `n` UNINITIALIZED elements.
- /// You should initialize all elements before using it.
- void py_newtuple(
- py_OutRef arg0,
- int n,
- ) {
- return _py_newtuple(
- arg0,
- n,
- );
- }
- late final _py_newtuplePtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, ffi.Int)>>(
- 'py_newtuple');
- late final _py_newtuple =
- _py_newtuplePtr.asFunction<void Function(py_OutRef, int)>();
- /// Create an empty `list`.
- void py_newlist(
- py_OutRef arg0,
- ) {
- return _py_newlist(
- arg0,
- );
- }
- late final _py_newlistPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>('py_newlist');
- late final _py_newlist =
- _py_newlistPtr.asFunction<void Function(py_OutRef)>();
- /// Create a `list` with `n` UNINITIALIZED elements.
- /// You should initialize all elements before using it.
- void py_newlistn(
- py_OutRef arg0,
- int n,
- ) {
- return _py_newlistn(
- arg0,
- n,
- );
- }
- late final _py_newlistnPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, ffi.Int)>>(
- 'py_newlistn');
- late final _py_newlistn =
- _py_newlistnPtr.asFunction<void Function(py_OutRef, int)>();
- /// Create an empty `dict`.
- void py_newdict(
- py_OutRef arg0,
- ) {
- return _py_newdict(
- arg0,
- );
- }
- late final _py_newdictPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>('py_newdict');
- late final _py_newdict =
- _py_newdictPtr.asFunction<void Function(py_OutRef)>();
- /// Create an UNINITIALIZED `slice` object.
- /// You should use `py_setslot()` to set `start`, `stop`, and `step`.
- void py_newslice(
- py_OutRef arg0,
- ) {
- return _py_newslice(
- arg0,
- );
- }
- late final _py_newslicePtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef)>>('py_newslice');
- late final _py_newslice =
- _py_newslicePtr.asFunction<void Function(py_OutRef)>();
- /// Create a `nativefunc` object.
- void py_newnativefunc(
- py_OutRef arg0,
- py_CFunction arg1,
- ) {
- return _py_newnativefunc(
- arg0,
- arg1,
- );
- }
- late final _py_newnativefuncPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, py_CFunction)>>(
- 'py_newnativefunc');
- late final _py_newnativefunc =
- _py_newnativefuncPtr.asFunction<void Function(py_OutRef, py_CFunction)>();
- /// Create a `function` object.
- int py_newfunction(
- py_OutRef out,
- ffi.Pointer<ffi.Char> sig,
- py_CFunction f,
- ffi.Pointer<ffi.Char> docstring,
- int slots,
- ) {
- return _py_newfunction(
- out,
- sig,
- f,
- docstring,
- slots,
- );
- }
- late final _py_newfunctionPtr = _lookup<
- ffi.NativeFunction<
- py_Name Function(py_OutRef, ffi.Pointer<ffi.Char>, py_CFunction,
- ffi.Pointer<ffi.Char>, ffi.Int)>>('py_newfunction');
- late final _py_newfunction = _py_newfunctionPtr.asFunction<
- int Function(py_OutRef, ffi.Pointer<ffi.Char>, py_CFunction,
- ffi.Pointer<ffi.Char>, int)>();
- /// Create a `boundmethod` object.
- void py_newboundmethod(
- py_OutRef out,
- py_Ref self,
- py_Ref func,
- ) {
- return _py_newboundmethod(
- out,
- self,
- func,
- );
- }
- late final _py_newboundmethodPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, py_Ref, py_Ref)>>(
- 'py_newboundmethod');
- late final _py_newboundmethod = _py_newboundmethodPtr
- .asFunction<void Function(py_OutRef, py_Ref, py_Ref)>();
- /// Convert a null-terminated string to a name.
- int py_name(
- ffi.Pointer<ffi.Char> arg0,
- ) {
- return _py_name(
- arg0,
- );
- }
- late final _py_namePtr =
- _lookup<ffi.NativeFunction<py_Name Function(ffi.Pointer<ffi.Char>)>>(
- 'py_name');
- late final _py_name =
- _py_namePtr.asFunction<int Function(ffi.Pointer<ffi.Char>)>();
- /// Convert a name to a null-terminated string.
- ffi.Pointer<ffi.Char> py_name2str(
- int arg0,
- ) {
- return _py_name2str(
- arg0,
- );
- }
- late final _py_name2strPtr =
- _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(py_Name)>>(
- 'py_name2str');
- late final _py_name2str =
- _py_name2strPtr.asFunction<ffi.Pointer<ffi.Char> Function(int)>();
- /// Convert a `c11_sv` to a name.
- int py_namev(
- c11_sv arg0,
- ) {
- return _py_namev(
- arg0,
- );
- }
- late final _py_namevPtr =
- _lookup<ffi.NativeFunction<py_Name Function(c11_sv)>>('py_namev');
- late final _py_namev = _py_namevPtr.asFunction<int Function(c11_sv)>();
- /// Convert a name to a `c11_sv`.
- c11_sv py_name2sv(
- int arg0,
- ) {
- return _py_name2sv(
- arg0,
- );
- }
- late final _py_name2svPtr =
- _lookup<ffi.NativeFunction<c11_sv Function(py_Name)>>('py_name2sv');
- late final _py_name2sv = _py_name2svPtr.asFunction<c11_sv Function(int)>();
- /// Create a new type.
- /// @param name name of the type.
- /// @param base base type.
- /// @param module module where the type is defined. Use `NULL` for built-in types.
- /// @param dtor destructor function. Use `NULL` if not needed.
- int py_newtype(
- ffi.Pointer<ffi.Char> name,
- int base,
- py_GlobalRef module,
- py_Dtor dtor,
- ) {
- return _py_newtype(
- name,
- base,
- module,
- dtor,
- );
- }
- late final _py_newtypePtr = _lookup<
- ffi.NativeFunction<
- py_Type Function(ffi.Pointer<ffi.Char>, py_Type, py_GlobalRef,
- py_Dtor)>>('py_newtype');
- late final _py_newtype = _py_newtypePtr.asFunction<
- int Function(ffi.Pointer<ffi.Char>, int, py_GlobalRef, py_Dtor)>();
- /// Create a new object.
- /// @param out output reference.
- /// @param type type of the object.
- /// @param slots number of slots. Use `-1` to create a `__dict__`.
- /// @param udsize size of your userdata.
- /// @return pointer to the userdata.
- ffi.Pointer<ffi.Void> py_newobject(
- py_OutRef out,
- int type,
- int slots,
- int udsize,
- ) {
- return _py_newobject(
- out,
- type,
- slots,
- udsize,
- );
- }
- late final _py_newobjectPtr = _lookup<
- ffi.NativeFunction<
- ffi.Pointer<ffi.Void> Function(
- py_OutRef, py_Type, ffi.Int, ffi.Int)>>('py_newobject');
- late final _py_newobject = _py_newobjectPtr
- .asFunction<ffi.Pointer<ffi.Void> Function(py_OutRef, int, int, int)>();
- /// Convert an `int` object in python to `int64_t`.
- int py_toint(
- py_Ref arg0,
- ) {
- return _py_toint(
- arg0,
- );
- }
- late final _py_tointPtr =
- _lookup<ffi.NativeFunction<py_i64 Function(py_Ref)>>('py_toint');
- late final _py_toint = _py_tointPtr.asFunction<int Function(py_Ref)>();
- /// Convert a `float` object in python to `double`.
- double py_tofloat(
- py_Ref arg0,
- ) {
- return _py_tofloat(
- arg0,
- );
- }
- late final _py_tofloatPtr =
- _lookup<ffi.NativeFunction<py_f64 Function(py_Ref)>>('py_tofloat');
- late final _py_tofloat = _py_tofloatPtr.asFunction<double Function(py_Ref)>();
- /// Cast a `int` or `float` object in python to `double`.
- /// If successful, return true and set the value to `out`.
- /// Otherwise, return false and raise `TypeError`.
- bool py_castfloat(
- py_Ref arg0,
- ffi.Pointer<py_f64> out,
- ) {
- return _py_castfloat(
- arg0,
- out,
- );
- }
- late final _py_castfloatPtr = _lookup<
- ffi.NativeFunction<ffi.Bool Function(py_Ref, ffi.Pointer<py_f64>)>>(
- 'py_castfloat');
- late final _py_castfloat =
- _py_castfloatPtr.asFunction<bool Function(py_Ref, ffi.Pointer<py_f64>)>();
- /// 32-bit version of `py_castfloat`.
- bool py_castfloat32(
- py_Ref arg0,
- ffi.Pointer<ffi.Float> out,
- ) {
- return _py_castfloat32(
- arg0,
- out,
- );
- }
- late final _py_castfloat32Ptr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(py_Ref, ffi.Pointer<ffi.Float>)>>('py_castfloat32');
- late final _py_castfloat32 = _py_castfloat32Ptr
- .asFunction<bool Function(py_Ref, ffi.Pointer<ffi.Float>)>();
- /// Cast a `int` object in python to `int64_t`.
- bool py_castint(
- py_Ref arg0,
- ffi.Pointer<py_i64> out,
- ) {
- return _py_castint(
- arg0,
- out,
- );
- }
- late final _py_castintPtr = _lookup<
- ffi.NativeFunction<ffi.Bool Function(py_Ref, ffi.Pointer<py_i64>)>>(
- 'py_castint');
- late final _py_castint =
- _py_castintPtr.asFunction<bool Function(py_Ref, ffi.Pointer<py_i64>)>();
- /// Convert a `bool` object in python to `bool`.
- bool py_tobool(
- py_Ref arg0,
- ) {
- return _py_tobool(
- arg0,
- );
- }
- late final _py_toboolPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('py_tobool');
- late final _py_tobool = _py_toboolPtr.asFunction<bool Function(py_Ref)>();
- /// Convert a `type` object in python to `py_Type`.
- int py_totype(
- py_Ref arg0,
- ) {
- return _py_totype(
- arg0,
- );
- }
- late final _py_totypePtr =
- _lookup<ffi.NativeFunction<py_Type Function(py_Ref)>>('py_totype');
- late final _py_totype = _py_totypePtr.asFunction<int Function(py_Ref)>();
- /// Convert a `str` object in python to null-terminated string.
- ffi.Pointer<ffi.Char> py_tostr(
- py_Ref arg0,
- ) {
- return _py_tostr(
- arg0,
- );
- }
- late final _py_tostrPtr =
- _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(py_Ref)>>(
- 'py_tostr');
- late final _py_tostr =
- _py_tostrPtr.asFunction<ffi.Pointer<ffi.Char> Function(py_Ref)>();
- /// Convert a `str` object in python to char array.
- ffi.Pointer<ffi.Char> py_tostrn(
- py_Ref arg0,
- ffi.Pointer<ffi.Int> size,
- ) {
- return _py_tostrn(
- arg0,
- size,
- );
- }
- late final _py_tostrnPtr = _lookup<
- ffi.NativeFunction<
- ffi.Pointer<ffi.Char> Function(
- py_Ref, ffi.Pointer<ffi.Int>)>>('py_tostrn');
- late final _py_tostrn = _py_tostrnPtr.asFunction<
- ffi.Pointer<ffi.Char> Function(py_Ref, ffi.Pointer<ffi.Int>)>();
- /// Convert a `str` object in python to `c11_sv`.
- c11_sv py_tosv(
- py_Ref arg0,
- ) {
- return _py_tosv(
- arg0,
- );
- }
- late final _py_tosvPtr =
- _lookup<ffi.NativeFunction<c11_sv Function(py_Ref)>>('py_tosv');
- late final _py_tosv = _py_tosvPtr.asFunction<c11_sv Function(py_Ref)>();
- /// Convert a `bytes` object in python to char array.
- ffi.Pointer<ffi.UnsignedChar> py_tobytes(
- py_Ref arg0,
- ffi.Pointer<ffi.Int> size,
- ) {
- return _py_tobytes(
- arg0,
- size,
- );
- }
- late final _py_tobytesPtr = _lookup<
- ffi.NativeFunction<
- ffi.Pointer<ffi.UnsignedChar> Function(
- py_Ref, ffi.Pointer<ffi.Int>)>>('py_tobytes');
- late final _py_tobytes = _py_tobytesPtr.asFunction<
- ffi.Pointer<ffi.UnsignedChar> Function(py_Ref, ffi.Pointer<ffi.Int>)>();
- /// Convert a user-defined object to its userdata.
- ffi.Pointer<ffi.Void> py_touserdata(
- py_Ref arg0,
- ) {
- return _py_touserdata(
- arg0,
- );
- }
- late final _py_touserdataPtr =
- _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Void> Function(py_Ref)>>(
- 'py_touserdata');
- late final _py_touserdata =
- _py_touserdataPtr.asFunction<ffi.Pointer<ffi.Void> Function(py_Ref)>();
- /// Get the type of the object.
- int py_typeof(
- py_Ref self,
- ) {
- return _py_typeof(
- self,
- );
- }
- late final _py_typeofPtr =
- _lookup<ffi.NativeFunction<py_Type Function(py_Ref)>>('py_typeof');
- late final _py_typeof = _py_typeofPtr.asFunction<int Function(py_Ref)>();
- /// Get type by module and name. e.g. `py_gettype("time", py_name("struct_time"))`.
- /// Return `0` if not found.
- int py_gettype(
- ffi.Pointer<ffi.Char> module,
- int name,
- ) {
- return _py_gettype(
- module,
- name,
- );
- }
- late final _py_gettypePtr = _lookup<
- ffi.NativeFunction<py_Type Function(ffi.Pointer<ffi.Char>, py_Name)>>(
- 'py_gettype');
- late final _py_gettype =
- _py_gettypePtr.asFunction<int Function(ffi.Pointer<ffi.Char>, int)>();
- /// Check if the object is exactly the given type.
- bool py_istype(
- py_Ref arg0,
- int arg1,
- ) {
- return _py_istype(
- arg0,
- arg1,
- );
- }
- late final _py_istypePtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Type)>>(
- 'py_istype');
- late final _py_istype =
- _py_istypePtr.asFunction<bool Function(py_Ref, int)>();
- /// Check if the object is an instance of the given type.
- bool py_isinstance(
- py_Ref obj,
- int type,
- ) {
- return _py_isinstance(
- obj,
- type,
- );
- }
- late final _py_isinstancePtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Type)>>(
- 'py_isinstance');
- late final _py_isinstance =
- _py_isinstancePtr.asFunction<bool Function(py_Ref, int)>();
- /// Check if the derived type is a subclass of the base type.
- bool py_issubclass(
- int derived,
- int base,
- ) {
- return _py_issubclass(
- derived,
- base,
- );
- }
- late final _py_issubclassPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Type, py_Type)>>(
- 'py_issubclass');
- late final _py_issubclass =
- _py_issubclassPtr.asFunction<bool Function(int, int)>();
- /// Get the magic method from the given type only.
- /// The returned reference is always valid. However, its value may be `nil`.
- py_GlobalRef py_tpgetmagic(
- int type,
- int name,
- ) {
- return _py_tpgetmagic(
- type,
- name,
- );
- }
- late final _py_tpgetmagicPtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function(py_Type, py_Name)>>(
- 'py_tpgetmagic');
- late final _py_tpgetmagic =
- _py_tpgetmagicPtr.asFunction<py_GlobalRef Function(int, int)>();
- /// Search the magic method from the given type to the base type.
- /// Return `NULL` if not found.
- py_GlobalRef py_tpfindmagic(
- int arg0,
- int name,
- ) {
- return _py_tpfindmagic(
- arg0,
- name,
- );
- }
- late final _py_tpfindmagicPtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function(py_Type, py_Name)>>(
- 'py_tpfindmagic');
- late final _py_tpfindmagic =
- _py_tpfindmagicPtr.asFunction<py_GlobalRef Function(int, int)>();
- /// Search the name from the given type to the base type.
- /// Return `NULL` if not found.
- py_ItemRef py_tpfindname(
- int arg0,
- int name,
- ) {
- return _py_tpfindname(
- arg0,
- name,
- );
- }
- late final _py_tpfindnamePtr =
- _lookup<ffi.NativeFunction<py_ItemRef Function(py_Type, py_Name)>>(
- 'py_tpfindname');
- late final _py_tpfindname =
- _py_tpfindnamePtr.asFunction<py_ItemRef Function(int, int)>();
- /// Get the type object of the given type.
- py_GlobalRef py_tpobject(
- int type,
- ) {
- return _py_tpobject(
- type,
- );
- }
- late final _py_tpobjectPtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function(py_Type)>>(
- 'py_tpobject');
- late final _py_tpobject =
- _py_tpobjectPtr.asFunction<py_GlobalRef Function(int)>();
- /// Get the type name.
- ffi.Pointer<ffi.Char> py_tpname(
- int type,
- ) {
- return _py_tpname(
- type,
- );
- }
- late final _py_tpnamePtr =
- _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(py_Type)>>(
- 'py_tpname');
- late final _py_tpname =
- _py_tpnamePtr.asFunction<ffi.Pointer<ffi.Char> Function(int)>();
- /// Call a type to create a new instance.
- bool py_tpcall(
- int type,
- int argc,
- py_Ref argv,
- ) {
- return _py_tpcall(
- type,
- argc,
- argv,
- );
- }
- late final _py_tpcallPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Type, ffi.Int, py_Ref)>>(
- 'py_tpcall');
- late final _py_tpcall =
- _py_tpcallPtr.asFunction<bool Function(int, int, py_Ref)>();
- /// Check if the object is an instance of the given type.
- /// Raise `TypeError` if the check fails.
- bool py_checktype(
- py_Ref self,
- int type,
- ) {
- return _py_checktype(
- self,
- type,
- );
- }
- late final _py_checktypePtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Type)>>(
- 'py_checktype');
- late final _py_checktype =
- _py_checktypePtr.asFunction<bool Function(py_Ref, int)>();
- /// Get the i-th register.
- /// All registers are located in a contiguous memory.
- py_GlobalRef py_getreg(
- int i,
- ) {
- return _py_getreg(
- i,
- );
- }
- late final _py_getregPtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function(ffi.Int)>>('py_getreg');
- late final _py_getreg =
- _py_getregPtr.asFunction<py_GlobalRef Function(int)>();
- /// Set the i-th register.
- void py_setreg(
- int i,
- py_Ref val,
- ) {
- return _py_setreg(
- i,
- val,
- );
- }
- late final _py_setregPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int, py_Ref)>>(
- 'py_setreg');
- late final _py_setreg =
- _py_setregPtr.asFunction<void Function(int, py_Ref)>();
- /// Get variable in the `__main__` module.
- py_ItemRef py_getglobal(
- int name,
- ) {
- return _py_getglobal(
- name,
- );
- }
- late final _py_getglobalPtr =
- _lookup<ffi.NativeFunction<py_ItemRef Function(py_Name)>>('py_getglobal');
- late final _py_getglobal =
- _py_getglobalPtr.asFunction<py_ItemRef Function(int)>();
- /// Set variable in the `__main__` module.
- void py_setglobal(
- int name,
- py_Ref val,
- ) {
- return _py_setglobal(
- name,
- val,
- );
- }
- late final _py_setglobalPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Name, py_Ref)>>(
- 'py_setglobal');
- late final _py_setglobal =
- _py_setglobalPtr.asFunction<void Function(int, py_Ref)>();
- /// Get variable in the `builtins` module.
- py_ItemRef py_getbuiltin(
- int name,
- ) {
- return _py_getbuiltin(
- name,
- );
- }
- late final _py_getbuiltinPtr =
- _lookup<ffi.NativeFunction<py_ItemRef Function(py_Name)>>(
- 'py_getbuiltin');
- late final _py_getbuiltin =
- _py_getbuiltinPtr.asFunction<py_ItemRef Function(int)>();
- /// Equivalent to `*dst = *src`.
- void py_assign(
- py_Ref dst,
- py_Ref src,
- ) {
- return _py_assign(
- dst,
- src,
- );
- }
- late final _py_assignPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, py_Ref)>>(
- 'py_assign');
- late final _py_assign =
- _py_assignPtr.asFunction<void Function(py_Ref, py_Ref)>();
- /// Get the last return value.
- py_GlobalRef py_retval() {
- return _py_retval();
- }
- late final _py_retvalPtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function()>>('py_retval');
- late final _py_retval = _py_retvalPtr.asFunction<py_GlobalRef Function()>();
- /// Get an item from the object's `__dict__`.
- /// Return `NULL` if not found.
- py_ItemRef py_getdict(
- py_Ref self,
- int name,
- ) {
- return _py_getdict(
- self,
- name,
- );
- }
- late final _py_getdictPtr =
- _lookup<ffi.NativeFunction<py_ItemRef Function(py_Ref, py_Name)>>(
- 'py_getdict');
- late final _py_getdict =
- _py_getdictPtr.asFunction<py_ItemRef Function(py_Ref, int)>();
- /// Set an item to the object's `__dict__`.
- void py_setdict(
- py_Ref self,
- int name,
- py_Ref val,
- ) {
- return _py_setdict(
- self,
- name,
- val,
- );
- }
- late final _py_setdictPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, py_Name, py_Ref)>>(
- 'py_setdict');
- late final _py_setdict =
- _py_setdictPtr.asFunction<void Function(py_Ref, int, py_Ref)>();
- /// Delete an item from the object's `__dict__`.
- /// Return `true` if the deletion is successful.
- bool py_deldict(
- py_Ref self,
- int name,
- ) {
- return _py_deldict(
- self,
- name,
- );
- }
- late final _py_deldictPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Name)>>(
- 'py_deldict');
- late final _py_deldict =
- _py_deldictPtr.asFunction<bool Function(py_Ref, int)>();
- /// Prepare an insertion to the object's `__dict__`.
- py_ItemRef py_emplacedict(
- py_Ref self,
- int name,
- ) {
- return _py_emplacedict(
- self,
- name,
- );
- }
- late final _py_emplacedictPtr =
- _lookup<ffi.NativeFunction<py_ItemRef Function(py_Ref, py_Name)>>(
- 'py_emplacedict');
- late final _py_emplacedict =
- _py_emplacedictPtr.asFunction<py_ItemRef Function(py_Ref, int)>();
- /// Apply a function to all items in the object's `__dict__`.
- /// Return `true` if the function is successful for all items.
- /// NOTE: Be careful if `f` modifies the object's `__dict__`.
- bool py_applydict(
- py_Ref self,
- ffi.Pointer<
- ffi.NativeFunction<
- ffi.Bool Function(
- py_Name name, py_Ref val, ffi.Pointer<ffi.Void> ctx)>>
- f,
- ffi.Pointer<ffi.Void> ctx,
- ) {
- return _py_applydict(
- self,
- f,
- ctx,
- );
- }
- late final _py_applydictPtr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(
- py_Ref,
- ffi.Pointer<
- ffi.NativeFunction<
- ffi.Bool Function(py_Name name, py_Ref val,
- ffi.Pointer<ffi.Void> ctx)>>,
- ffi.Pointer<ffi.Void>)>>('py_applydict');
- late final _py_applydict = _py_applydictPtr.asFunction<
- bool Function(
- py_Ref,
- ffi.Pointer<
- ffi.NativeFunction<
- ffi.Bool Function(
- py_Name name, py_Ref val, ffi.Pointer<ffi.Void> ctx)>>,
- ffi.Pointer<ffi.Void>)>();
- /// Get the i-th slot of the object.
- /// The object must have slots and `i` must be in valid range.
- py_ObjectRef py_getslot(
- py_Ref self,
- int i,
- ) {
- return _py_getslot(
- self,
- i,
- );
- }
- late final _py_getslotPtr =
- _lookup<ffi.NativeFunction<py_ObjectRef Function(py_Ref, ffi.Int)>>(
- 'py_getslot');
- late final _py_getslot =
- _py_getslotPtr.asFunction<py_ObjectRef Function(py_Ref, int)>();
- /// Set the i-th slot of the object.
- void py_setslot(
- py_Ref self,
- int i,
- py_Ref val,
- ) {
- return _py_setslot(
- self,
- i,
- val,
- );
- }
- late final _py_setslotPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, ffi.Int, py_Ref)>>(
- 'py_setslot');
- late final _py_setslot =
- _py_setslotPtr.asFunction<void Function(py_Ref, int, py_Ref)>();
- /// Get the current `function` object on the stack.
- /// Return `NULL` if not available.
- /// NOTE: This function should be placed at the beginning of your decl-based bindings.
- py_StackRef py_inspect_currentfunction() {
- return _py_inspect_currentfunction();
- }
- late final _py_inspect_currentfunctionPtr =
- _lookup<ffi.NativeFunction<py_StackRef Function()>>(
- 'py_inspect_currentfunction');
- late final _py_inspect_currentfunction =
- _py_inspect_currentfunctionPtr.asFunction<py_StackRef Function()>();
- /// Get the current `module` object where the code is executed.
- /// Return `NULL` if not available.
- py_GlobalRef py_inspect_currentmodule() {
- return _py_inspect_currentmodule();
- }
- late final _py_inspect_currentmodulePtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function()>>(
- 'py_inspect_currentmodule');
- late final _py_inspect_currentmodule =
- _py_inspect_currentmodulePtr.asFunction<py_GlobalRef Function()>();
- /// Bind a function to the object via "decl-based" style.
- /// @param obj the target object.
- /// @param sig signature of the function. e.g. `add(x, y)`.
- /// @param f function to bind.
- void py_bind(
- py_Ref obj,
- ffi.Pointer<ffi.Char> sig,
- py_CFunction f,
- ) {
- return _py_bind(
- obj,
- sig,
- f,
- );
- }
- late final _py_bindPtr = _lookup<
- ffi.NativeFunction<
- ffi.Void Function(
- py_Ref, ffi.Pointer<ffi.Char>, py_CFunction)>>('py_bind');
- late final _py_bind = _py_bindPtr
- .asFunction<void Function(py_Ref, ffi.Pointer<ffi.Char>, py_CFunction)>();
- /// Bind a method to type via "argc-based" style.
- /// @param type the target type.
- /// @param name name of the method.
- /// @param f function to bind.
- void py_bindmethod(
- int type,
- ffi.Pointer<ffi.Char> name,
- py_CFunction f,
- ) {
- return _py_bindmethod(
- type,
- name,
- f,
- );
- }
- late final _py_bindmethodPtr = _lookup<
- ffi.NativeFunction<
- ffi.Void Function(
- py_Type, ffi.Pointer<ffi.Char>, py_CFunction)>>('py_bindmethod');
- late final _py_bindmethod = _py_bindmethodPtr
- .asFunction<void Function(int, ffi.Pointer<ffi.Char>, py_CFunction)>();
- /// Bind a function to the object via "argc-based" style.
- /// @param obj the target object.
- /// @param name name of the function.
- /// @param f function to bind.
- void py_bindfunc(
- py_Ref obj,
- ffi.Pointer<ffi.Char> name,
- py_CFunction f,
- ) {
- return _py_bindfunc(
- obj,
- name,
- f,
- );
- }
- late final _py_bindfuncPtr = _lookup<
- ffi.NativeFunction<
- ffi.Void Function(
- py_Ref, ffi.Pointer<ffi.Char>, py_CFunction)>>('py_bindfunc');
- late final _py_bindfunc = _py_bindfuncPtr
- .asFunction<void Function(py_Ref, ffi.Pointer<ffi.Char>, py_CFunction)>();
- /// Bind a property to type.
- /// @param type the target type.
- /// @param name name of the property.
- /// @param getter getter function.
- /// @param setter setter function. Use `NULL` if not needed.
- void py_bindproperty(
- int type,
- ffi.Pointer<ffi.Char> name,
- py_CFunction getter,
- py_CFunction setter,
- ) {
- return _py_bindproperty(
- type,
- name,
- getter,
- setter,
- );
- }
- late final _py_bindpropertyPtr = _lookup<
- ffi.NativeFunction<
- ffi.Void Function(py_Type, ffi.Pointer<ffi.Char>, py_CFunction,
- py_CFunction)>>('py_bindproperty');
- late final _py_bindproperty = _py_bindpropertyPtr.asFunction<
- void Function(int, ffi.Pointer<ffi.Char>, py_CFunction, py_CFunction)>();
- /// Python equivalent to `getattr(self, name)`.
- bool py_getattr(
- py_Ref self,
- int name,
- ) {
- return _py_getattr(
- self,
- name,
- );
- }
- late final _py_getattrPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Name)>>(
- 'py_getattr');
- late final _py_getattr =
- _py_getattrPtr.asFunction<bool Function(py_Ref, int)>();
- /// Python equivalent to `setattr(self, name, val)`.
- bool py_setattr(
- py_Ref self,
- int name,
- py_Ref val,
- ) {
- return _py_setattr(
- self,
- name,
- val,
- );
- }
- late final _py_setattrPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Name, py_Ref)>>(
- 'py_setattr');
- late final _py_setattr =
- _py_setattrPtr.asFunction<bool Function(py_Ref, int, py_Ref)>();
- /// Python equivalent to `delattr(self, name)`.
- bool py_delattr(
- py_Ref self,
- int name,
- ) {
- return _py_delattr(
- self,
- name,
- );
- }
- late final _py_delattrPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Name)>>(
- 'py_delattr');
- late final _py_delattr =
- _py_delattrPtr.asFunction<bool Function(py_Ref, int)>();
- /// Python equivalent to `self[key]`.
- bool py_getitem(
- py_Ref self,
- py_Ref key,
- ) {
- return _py_getitem(
- self,
- key,
- );
- }
- late final _py_getitemPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Ref)>>(
- 'py_getitem');
- late final _py_getitem =
- _py_getitemPtr.asFunction<bool Function(py_Ref, py_Ref)>();
- /// Python equivalent to `self[key] = val`.
- bool py_setitem(
- py_Ref self,
- py_Ref key,
- py_Ref val,
- ) {
- return _py_setitem(
- self,
- key,
- val,
- );
- }
- late final _py_setitemPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Ref, py_Ref)>>(
- 'py_setitem');
- late final _py_setitem =
- _py_setitemPtr.asFunction<bool Function(py_Ref, py_Ref, py_Ref)>();
- /// Python equivalent to `del self[key]`.
- bool py_delitem(
- py_Ref self,
- py_Ref key,
- ) {
- return _py_delitem(
- self,
- key,
- );
- }
- late final _py_delitemPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Ref)>>(
- 'py_delitem');
- late final _py_delitem =
- _py_delitemPtr.asFunction<bool Function(py_Ref, py_Ref)>();
- /// Perform a binary operation.
- /// The result will be set to `py_retval()`.
- /// The stack remains unchanged after the operation.
- bool py_binaryop(
- py_Ref lhs,
- py_Ref rhs,
- int op,
- int rop,
- ) {
- return _py_binaryop(
- lhs,
- rhs,
- op,
- rop,
- );
- }
- late final _py_binaryopPtr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(py_Ref, py_Ref, py_Name, py_Name)>>('py_binaryop');
- late final _py_binaryop =
- _py_binaryopPtr.asFunction<bool Function(py_Ref, py_Ref, int, int)>();
- /// Get the i-th object from the top of the stack.
- /// `i` should be negative, e.g. (-1) means TOS.
- py_StackRef py_peek(
- int i,
- ) {
- return _py_peek(
- i,
- );
- }
- late final _py_peekPtr =
- _lookup<ffi.NativeFunction<py_StackRef Function(ffi.Int)>>('py_peek');
- late final _py_peek = _py_peekPtr.asFunction<py_StackRef Function(int)>();
- /// Push the object to the stack.
- void py_push(
- py_Ref src,
- ) {
- return _py_push(
- src,
- );
- }
- late final _py_pushPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref)>>('py_push');
- late final _py_push = _py_pushPtr.asFunction<void Function(py_Ref)>();
- /// Push a `nil` object to the stack.
- void py_pushnil() {
- return _py_pushnil();
- }
- late final _py_pushnilPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function()>>('py_pushnil');
- late final _py_pushnil = _py_pushnilPtr.asFunction<void Function()>();
- /// Push a `None` object to the stack.
- void py_pushnone() {
- return _py_pushnone();
- }
- late final _py_pushnonePtr =
- _lookup<ffi.NativeFunction<ffi.Void Function()>>('py_pushnone');
- late final _py_pushnone = _py_pushnonePtr.asFunction<void Function()>();
- /// Push a `py_Name` to the stack. This is used for keyword arguments.
- void py_pushname(
- int name,
- ) {
- return _py_pushname(
- name,
- );
- }
- late final _py_pushnamePtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Name)>>('py_pushname');
- late final _py_pushname = _py_pushnamePtr.asFunction<void Function(int)>();
- /// Pop an object from the stack.
- void py_pop() {
- return _py_pop();
- }
- late final _py_popPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function()>>('py_pop');
- late final _py_pop = _py_popPtr.asFunction<void Function()>();
- /// Shrink the stack by n.
- void py_shrink(
- int n,
- ) {
- return _py_shrink(
- n,
- );
- }
- late final _py_shrinkPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int)>>('py_shrink');
- late final _py_shrink = _py_shrinkPtr.asFunction<void Function(int)>();
- /// Get a temporary variable from the stack.
- py_StackRef py_pushtmp() {
- return _py_pushtmp();
- }
- late final _py_pushtmpPtr =
- _lookup<ffi.NativeFunction<py_StackRef Function()>>('py_pushtmp');
- late final _py_pushtmp = _py_pushtmpPtr.asFunction<py_StackRef Function()>();
- /// Get the unbound method of the object.
- /// Assume the object is located at the top of the stack.
- /// If return true: `[self] -> [unbound, self]`.
- /// If return false: `[self] -> [self]` (no change).
- bool py_pushmethod(
- int name,
- ) {
- return _py_pushmethod(
- name,
- );
- }
- late final _py_pushmethodPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Name)>>('py_pushmethod');
- late final _py_pushmethod =
- _py_pushmethodPtr.asFunction<bool Function(int)>();
- /// Call a callable object via pocketpy's calling convention.
- /// You need to prepare the stack using this form: `callable, self/nil, arg1, arg2, ..., k1, v1, k2, v2, ...`
- /// `argc` is the number of positional arguments excluding `self`.
- /// `kwargc` is the number of keyword arguments, i.e. the number of key-value pairs.
- /// The result will be set to `py_retval()`.
- /// The stack size will be reduced by `argc + kwargc`.
- bool py_vectorcall(
- int argc,
- int kwargc,
- ) {
- return _py_vectorcall(
- argc,
- kwargc,
- );
- }
- late final _py_vectorcallPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Uint16, ffi.Uint16)>>(
- 'py_vectorcall');
- late final _py_vectorcall =
- _py_vectorcallPtr.asFunction<bool Function(int, int)>();
- /// Evaluate an expression and push the result to the stack.
- /// This function is used for testing.
- bool py_pusheval(
- ffi.Pointer<ffi.Char> expr,
- py_GlobalRef module,
- ) {
- return _py_pusheval(
- expr,
- module,
- );
- }
- late final _py_pushevalPtr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(
- ffi.Pointer<ffi.Char>, py_GlobalRef)>>('py_pusheval');
- late final _py_pusheval = _py_pushevalPtr
- .asFunction<bool Function(ffi.Pointer<ffi.Char>, py_GlobalRef)>();
- /// Create a new module.
- py_GlobalRef py_newmodule(
- ffi.Pointer<ffi.Char> path,
- ) {
- return _py_newmodule(
- path,
- );
- }
- late final _py_newmodulePtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function(ffi.Pointer<ffi.Char>)>>(
- 'py_newmodule');
- late final _py_newmodule = _py_newmodulePtr
- .asFunction<py_GlobalRef Function(ffi.Pointer<ffi.Char>)>();
- /// Get a module by path.
- py_GlobalRef py_getmodule(
- ffi.Pointer<ffi.Char> path,
- ) {
- return _py_getmodule(
- path,
- );
- }
- late final _py_getmodulePtr =
- _lookup<ffi.NativeFunction<py_GlobalRef Function(ffi.Pointer<ffi.Char>)>>(
- 'py_getmodule');
- late final _py_getmodule = _py_getmodulePtr
- .asFunction<py_GlobalRef Function(ffi.Pointer<ffi.Char>)>();
- /// Import a module.
- /// The result will be set to `py_retval()`.
- /// -1: error, 0: not found, 1: success
- int py_import(
- ffi.Pointer<ffi.Char> path,
- ) {
- return _py_import(
- path,
- );
- }
- late final _py_importPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Char>)>>(
- 'py_import');
- late final _py_import =
- _py_importPtr.asFunction<int Function(ffi.Pointer<ffi.Char>)>();
- /// Raise an exception by type and message. Always return false.
- bool py_exception(
- int type,
- ffi.Pointer<ffi.Char> fmt,
- ) {
- return _py_exception(
- type,
- fmt,
- );
- }
- late final _py_exceptionPtr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(py_Type, ffi.Pointer<ffi.Char>)>>('py_exception');
- late final _py_exception =
- _py_exceptionPtr.asFunction<bool Function(int, ffi.Pointer<ffi.Char>)>();
- /// Raise an expection object. Always return false.
- bool py_raise(
- py_Ref arg0,
- ) {
- return _py_raise(
- arg0,
- );
- }
- late final _py_raisePtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('py_raise');
- late final _py_raise = _py_raisePtr.asFunction<bool Function(py_Ref)>();
- /// Print the current exception.
- /// The exception will be set as handled.
- void py_printexc() {
- return _py_printexc();
- }
- late final _py_printexcPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function()>>('py_printexc');
- late final _py_printexc = _py_printexcPtr.asFunction<void Function()>();
- /// Format the current exception and return a null-terminated string.
- /// The result should be freed by the caller.
- /// The exception will be set as handled.
- ffi.Pointer<ffi.Char> py_formatexc() {
- return _py_formatexc();
- }
- late final _py_formatexcPtr =
- _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
- 'py_formatexc');
- late final _py_formatexc =
- _py_formatexcPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
- /// Check if an exception is raised.
- bool py_checkexc(
- bool ignore_handled,
- ) {
- return _py_checkexc(
- ignore_handled,
- );
- }
- late final _py_checkexcPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Bool)>>('py_checkexc');
- late final _py_checkexc = _py_checkexcPtr.asFunction<bool Function(bool)>();
- /// Check if the exception is an instance of the given type.
- /// This function is roughly equivalent to python's `except <T> as e:` block.
- /// If match, the exception will be stored in `py_retval()` as handled.
- bool py_matchexc(
- int type,
- ) {
- return _py_matchexc(
- type,
- );
- }
- late final _py_matchexcPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Type)>>('py_matchexc');
- late final _py_matchexc = _py_matchexcPtr.asFunction<bool Function(int)>();
- /// Clear the current exception.
- /// @param p0 the unwinding point. Use `NULL` if not needed.
- void py_clearexc(
- py_StackRef p0,
- ) {
- return _py_clearexc(
- p0,
- );
- }
- late final _py_clearexcPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_StackRef)>>(
- 'py_clearexc');
- late final _py_clearexc =
- _py_clearexcPtr.asFunction<void Function(py_StackRef)>();
- bool StopIteration() {
- return _StopIteration();
- }
- late final _StopIterationPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function()>>('StopIteration');
- late final _StopIteration = _StopIterationPtr.asFunction<bool Function()>();
- bool KeyError(
- py_Ref key,
- ) {
- return _KeyError(
- key,
- );
- }
- late final _KeyErrorPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('KeyError');
- late final _KeyError = _KeyErrorPtr.asFunction<bool Function(py_Ref)>();
- /// Python equivalent to `bool(val)`.
- /// 1: true, 0: false, -1: error
- int py_bool(
- py_Ref val,
- ) {
- return _py_bool(
- val,
- );
- }
- late final _py_boolPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref)>>('py_bool');
- late final _py_bool = _py_boolPtr.asFunction<int Function(py_Ref)>();
- /// Compare two objects.
- /// 1: lhs == rhs, 0: lhs != rhs, -1: error
- int py_equal(
- py_Ref lhs,
- py_Ref rhs,
- ) {
- return _py_equal(
- lhs,
- rhs,
- );
- }
- late final _py_equalPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref, py_Ref)>>('py_equal');
- late final _py_equal =
- _py_equalPtr.asFunction<int Function(py_Ref, py_Ref)>();
- /// Compare two objects.
- /// 1: lhs < rhs, 0: lhs >= rhs, -1: error
- int py_less(
- py_Ref lhs,
- py_Ref rhs,
- ) {
- return _py_less(
- lhs,
- rhs,
- );
- }
- late final _py_lessPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref, py_Ref)>>('py_less');
- late final _py_less = _py_lessPtr.asFunction<int Function(py_Ref, py_Ref)>();
- /// Python equivalent to `callable(val)`.
- bool py_callable(
- py_Ref val,
- ) {
- return _py_callable(
- val,
- );
- }
- late final _py_callablePtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('py_callable');
- late final _py_callable = _py_callablePtr.asFunction<bool Function(py_Ref)>();
- /// Get the hash value of the object.
- bool py_hash(
- py_Ref arg0,
- ffi.Pointer<py_i64> out,
- ) {
- return _py_hash(
- arg0,
- out,
- );
- }
- late final _py_hashPtr = _lookup<
- ffi.NativeFunction<ffi.Bool Function(py_Ref, ffi.Pointer<py_i64>)>>(
- 'py_hash');
- late final _py_hash =
- _py_hashPtr.asFunction<bool Function(py_Ref, ffi.Pointer<py_i64>)>();
- /// Get the iterator of the object.
- bool py_iter(
- py_Ref arg0,
- ) {
- return _py_iter(
- arg0,
- );
- }
- late final _py_iterPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('py_iter');
- late final _py_iter = _py_iterPtr.asFunction<bool Function(py_Ref)>();
- /// Get the next element from the iterator.
- /// 1: success, 0: StopIteration, -1: error
- int py_next(
- py_Ref arg0,
- ) {
- return _py_next(
- arg0,
- );
- }
- late final _py_nextPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref)>>('py_next');
- late final _py_next = _py_nextPtr.asFunction<int Function(py_Ref)>();
- /// Python equivalent to `lhs is rhs`.
- bool py_isidentical(
- py_Ref arg0,
- py_Ref arg1,
- ) {
- return _py_isidentical(
- arg0,
- arg1,
- );
- }
- late final _py_isidenticalPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Ref)>>(
- 'py_isidentical');
- late final _py_isidentical =
- _py_isidenticalPtr.asFunction<bool Function(py_Ref, py_Ref)>();
- /// Call a function.
- /// It prepares the stack and then performs a `vectorcall(argc, 0, false)`.
- /// The result will be set to `py_retval()`.
- /// The stack remains unchanged after the operation.
- bool py_call(
- py_Ref f,
- int argc,
- py_Ref argv,
- ) {
- return _py_call(
- f,
- argc,
- argv,
- );
- }
- late final _py_callPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, ffi.Int, py_Ref)>>(
- 'py_call');
- late final _py_call =
- _py_callPtr.asFunction<bool Function(py_Ref, int, py_Ref)>();
- /// Call a `py_CFunction` in a safe way.
- /// This function does extra checks to help you debug `py_CFunction`.
- bool py_callcfunc(
- py_CFunction f,
- int argc,
- py_Ref argv,
- ) {
- return _py_callcfunc(
- f,
- argc,
- argv,
- );
- }
- late final _py_callcfuncPtr = _lookup<
- ffi.NativeFunction<ffi.Bool Function(py_CFunction, ffi.Int, py_Ref)>>(
- 'py_callcfunc');
- late final _py_callcfunc =
- _py_callcfuncPtr.asFunction<bool Function(py_CFunction, int, py_Ref)>();
- /// Python equivalent to `str(val)`.
- bool py_str(
- py_Ref val,
- ) {
- return _py_str(
- val,
- );
- }
- late final _py_strPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('py_str');
- late final _py_str = _py_strPtr.asFunction<bool Function(py_Ref)>();
- /// Python equivalent to `repr(val)`.
- bool py_repr(
- py_Ref val,
- ) {
- return _py_repr(
- val,
- );
- }
- late final _py_reprPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('py_repr');
- late final _py_repr = _py_reprPtr.asFunction<bool Function(py_Ref)>();
- /// Python equivalent to `len(val)`.
- bool py_len(
- py_Ref val,
- ) {
- return _py_len(
- val,
- );
- }
- late final _py_lenPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('py_len');
- late final _py_len = _py_lenPtr.asFunction<bool Function(py_Ref)>();
- /// Python equivalent to `json.dumps(val)`.
- bool py_json_dumps(
- py_Ref val,
- ) {
- return _py_json_dumps(
- val,
- );
- }
- late final _py_json_dumpsPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref)>>('py_json_dumps');
- late final _py_json_dumps =
- _py_json_dumpsPtr.asFunction<bool Function(py_Ref)>();
- /// Python equivalent to `json.loads(val)`.
- bool py_json_loads(
- ffi.Pointer<ffi.Char> source,
- ) {
- return _py_json_loads(
- source,
- );
- }
- late final _py_json_loadsPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Char>)>>(
- 'py_json_loads');
- late final _py_json_loads =
- _py_json_loadsPtr.asFunction<bool Function(ffi.Pointer<ffi.Char>)>();
- /// Unchecked Functions
- py_ObjectRef py_tuple_data(
- py_Ref self,
- ) {
- return _py_tuple_data(
- self,
- );
- }
- late final _py_tuple_dataPtr =
- _lookup<ffi.NativeFunction<py_ObjectRef Function(py_Ref)>>(
- 'py_tuple_data');
- late final _py_tuple_data =
- _py_tuple_dataPtr.asFunction<py_ObjectRef Function(py_Ref)>();
- py_ObjectRef py_tuple_getitem(
- py_Ref self,
- int i,
- ) {
- return _py_tuple_getitem(
- self,
- i,
- );
- }
- late final _py_tuple_getitemPtr =
- _lookup<ffi.NativeFunction<py_ObjectRef Function(py_Ref, ffi.Int)>>(
- 'py_tuple_getitem');
- late final _py_tuple_getitem =
- _py_tuple_getitemPtr.asFunction<py_ObjectRef Function(py_Ref, int)>();
- void py_tuple_setitem(
- py_Ref self,
- int i,
- py_Ref val,
- ) {
- return _py_tuple_setitem(
- self,
- i,
- val,
- );
- }
- late final _py_tuple_setitemPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, ffi.Int, py_Ref)>>(
- 'py_tuple_setitem');
- late final _py_tuple_setitem =
- _py_tuple_setitemPtr.asFunction<void Function(py_Ref, int, py_Ref)>();
- int py_tuple_len(
- py_Ref self,
- ) {
- return _py_tuple_len(
- self,
- );
- }
- late final _py_tuple_lenPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref)>>('py_tuple_len');
- late final _py_tuple_len =
- _py_tuple_lenPtr.asFunction<int Function(py_Ref)>();
- py_ItemRef py_list_data(
- py_Ref self,
- ) {
- return _py_list_data(
- self,
- );
- }
- late final _py_list_dataPtr =
- _lookup<ffi.NativeFunction<py_ItemRef Function(py_Ref)>>('py_list_data');
- late final _py_list_data =
- _py_list_dataPtr.asFunction<py_ItemRef Function(py_Ref)>();
- py_ItemRef py_list_getitem(
- py_Ref self,
- int i,
- ) {
- return _py_list_getitem(
- self,
- i,
- );
- }
- late final _py_list_getitemPtr =
- _lookup<ffi.NativeFunction<py_ItemRef Function(py_Ref, ffi.Int)>>(
- 'py_list_getitem');
- late final _py_list_getitem =
- _py_list_getitemPtr.asFunction<py_ItemRef Function(py_Ref, int)>();
- void py_list_setitem(
- py_Ref self,
- int i,
- py_Ref val,
- ) {
- return _py_list_setitem(
- self,
- i,
- val,
- );
- }
- late final _py_list_setitemPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, ffi.Int, py_Ref)>>(
- 'py_list_setitem');
- late final _py_list_setitem =
- _py_list_setitemPtr.asFunction<void Function(py_Ref, int, py_Ref)>();
- void py_list_delitem(
- py_Ref self,
- int i,
- ) {
- return _py_list_delitem(
- self,
- i,
- );
- }
- late final _py_list_delitemPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, ffi.Int)>>(
- 'py_list_delitem');
- late final _py_list_delitem =
- _py_list_delitemPtr.asFunction<void Function(py_Ref, int)>();
- int py_list_len(
- py_Ref self,
- ) {
- return _py_list_len(
- self,
- );
- }
- late final _py_list_lenPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref)>>('py_list_len');
- late final _py_list_len = _py_list_lenPtr.asFunction<int Function(py_Ref)>();
- void py_list_swap(
- py_Ref self,
- int i,
- int j,
- ) {
- return _py_list_swap(
- self,
- i,
- j,
- );
- }
- late final _py_list_swapPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, ffi.Int, ffi.Int)>>(
- 'py_list_swap');
- late final _py_list_swap =
- _py_list_swapPtr.asFunction<void Function(py_Ref, int, int)>();
- void py_list_append(
- py_Ref self,
- py_Ref val,
- ) {
- return _py_list_append(
- self,
- val,
- );
- }
- late final _py_list_appendPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, py_Ref)>>(
- 'py_list_append');
- late final _py_list_append =
- _py_list_appendPtr.asFunction<void Function(py_Ref, py_Ref)>();
- py_ItemRef py_list_emplace(
- py_Ref self,
- ) {
- return _py_list_emplace(
- self,
- );
- }
- late final _py_list_emplacePtr =
- _lookup<ffi.NativeFunction<py_ItemRef Function(py_Ref)>>(
- 'py_list_emplace');
- late final _py_list_emplace =
- _py_list_emplacePtr.asFunction<py_ItemRef Function(py_Ref)>();
- void py_list_clear(
- py_Ref self,
- ) {
- return _py_list_clear(
- self,
- );
- }
- late final _py_list_clearPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref)>>('py_list_clear');
- late final _py_list_clear =
- _py_list_clearPtr.asFunction<void Function(py_Ref)>();
- void py_list_insert(
- py_Ref self,
- int i,
- py_Ref val,
- ) {
- return _py_list_insert(
- self,
- i,
- val,
- );
- }
- late final _py_list_insertPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_Ref, ffi.Int, py_Ref)>>(
- 'py_list_insert');
- late final _py_list_insert =
- _py_list_insertPtr.asFunction<void Function(py_Ref, int, py_Ref)>();
- /// -1: error, 0: not found, 1: found
- int py_dict_getitem(
- py_Ref self,
- py_Ref key,
- ) {
- return _py_dict_getitem(
- self,
- key,
- );
- }
- late final _py_dict_getitemPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref, py_Ref)>>(
- 'py_dict_getitem');
- late final _py_dict_getitem =
- _py_dict_getitemPtr.asFunction<int Function(py_Ref, py_Ref)>();
- /// true: success, false: error
- bool py_dict_setitem(
- py_Ref self,
- py_Ref key,
- py_Ref val,
- ) {
- return _py_dict_setitem(
- self,
- key,
- val,
- );
- }
- late final _py_dict_setitemPtr =
- _lookup<ffi.NativeFunction<ffi.Bool Function(py_Ref, py_Ref, py_Ref)>>(
- 'py_dict_setitem');
- late final _py_dict_setitem =
- _py_dict_setitemPtr.asFunction<bool Function(py_Ref, py_Ref, py_Ref)>();
- /// -1: error, 0: not found, 1: found (and deleted)
- int py_dict_delitem(
- py_Ref self,
- py_Ref key,
- ) {
- return _py_dict_delitem(
- self,
- key,
- );
- }
- late final _py_dict_delitemPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref, py_Ref)>>(
- 'py_dict_delitem');
- late final _py_dict_delitem =
- _py_dict_delitemPtr.asFunction<int Function(py_Ref, py_Ref)>();
- /// -1: error, 0: not found, 1: found
- int py_dict_getitem_by_str(
- py_Ref self,
- ffi.Pointer<ffi.Char> key,
- ) {
- return _py_dict_getitem_by_str(
- self,
- key,
- );
- }
- late final _py_dict_getitem_by_strPtr = _lookup<
- ffi.NativeFunction<ffi.Int Function(py_Ref, ffi.Pointer<ffi.Char>)>>(
- 'py_dict_getitem_by_str');
- late final _py_dict_getitem_by_str = _py_dict_getitem_by_strPtr
- .asFunction<int Function(py_Ref, ffi.Pointer<ffi.Char>)>();
- /// true: success, false: error
- bool py_dict_setitem_by_str(
- py_Ref self,
- ffi.Pointer<ffi.Char> key,
- py_Ref val,
- ) {
- return _py_dict_setitem_by_str(
- self,
- key,
- val,
- );
- }
- late final _py_dict_setitem_by_strPtr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(py_Ref, ffi.Pointer<ffi.Char>,
- py_Ref)>>('py_dict_setitem_by_str');
- late final _py_dict_setitem_by_str = _py_dict_setitem_by_strPtr
- .asFunction<bool Function(py_Ref, ffi.Pointer<ffi.Char>, py_Ref)>();
- /// -1: error, 0: not found, 1: found (and deleted)
- int py_dict_delitem_by_str(
- py_Ref self,
- ffi.Pointer<ffi.Char> key,
- ) {
- return _py_dict_delitem_by_str(
- self,
- key,
- );
- }
- late final _py_dict_delitem_by_strPtr = _lookup<
- ffi.NativeFunction<ffi.Int Function(py_Ref, ffi.Pointer<ffi.Char>)>>(
- 'py_dict_delitem_by_str');
- late final _py_dict_delitem_by_str = _py_dict_delitem_by_strPtr
- .asFunction<int Function(py_Ref, ffi.Pointer<ffi.Char>)>();
- /// true: success, false: error
- bool py_dict_apply(
- py_Ref self,
- ffi.Pointer<
- ffi.NativeFunction<
- ffi.Bool Function(
- py_Ref key, py_Ref val, ffi.Pointer<ffi.Void> ctx)>>
- f,
- ffi.Pointer<ffi.Void> ctx,
- ) {
- return _py_dict_apply(
- self,
- f,
- ctx,
- );
- }
- late final _py_dict_applyPtr = _lookup<
- ffi.NativeFunction<
- ffi.Bool Function(
- py_Ref,
- ffi.Pointer<
- ffi.NativeFunction<
- ffi.Bool Function(
- py_Ref key, py_Ref val, ffi.Pointer<ffi.Void> ctx)>>,
- ffi.Pointer<ffi.Void>)>>('py_dict_apply');
- late final _py_dict_apply = _py_dict_applyPtr.asFunction<
- bool Function(
- py_Ref,
- ffi.Pointer<
- ffi.NativeFunction<
- ffi.Bool Function(
- py_Ref key, py_Ref val, ffi.Pointer<ffi.Void> ctx)>>,
- ffi.Pointer<ffi.Void>)>();
- /// noexcept
- int py_dict_len(
- py_Ref self,
- ) {
- return _py_dict_len(
- self,
- );
- }
- late final _py_dict_lenPtr =
- _lookup<ffi.NativeFunction<ffi.Int Function(py_Ref)>>('py_dict_len');
- late final _py_dict_len = _py_dict_lenPtr.asFunction<int Function(py_Ref)>();
- /// linalg module
- void py_newvec2(
- py_OutRef out,
- c11_vec2 arg1,
- ) {
- return _py_newvec2(
- out,
- arg1,
- );
- }
- late final _py_newvec2Ptr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, c11_vec2)>>(
- 'py_newvec2');
- late final _py_newvec2 =
- _py_newvec2Ptr.asFunction<void Function(py_OutRef, c11_vec2)>();
- void py_newvec3(
- py_OutRef out,
- c11_vec3 arg1,
- ) {
- return _py_newvec3(
- out,
- arg1,
- );
- }
- late final _py_newvec3Ptr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, c11_vec3)>>(
- 'py_newvec3');
- late final _py_newvec3 =
- _py_newvec3Ptr.asFunction<void Function(py_OutRef, c11_vec3)>();
- void py_newvec2i(
- py_OutRef out,
- c11_vec2i arg1,
- ) {
- return _py_newvec2i(
- out,
- arg1,
- );
- }
- late final _py_newvec2iPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, c11_vec2i)>>(
- 'py_newvec2i');
- late final _py_newvec2i =
- _py_newvec2iPtr.asFunction<void Function(py_OutRef, c11_vec2i)>();
- void py_newvec3i(
- py_OutRef out,
- c11_vec3i arg1,
- ) {
- return _py_newvec3i(
- out,
- arg1,
- );
- }
- late final _py_newvec3iPtr =
- _lookup<ffi.NativeFunction<ffi.Void Function(py_OutRef, c11_vec3i)>>(
- 'py_newvec3i');
- late final _py_newvec3i =
- _py_newvec3iPtr.asFunction<void Function(py_OutRef, c11_vec3i)>();
- ffi.Pointer<c11_mat3x3> py_newmat3x3(
- py_OutRef out,
- ) {
- return _py_newmat3x3(
- out,
- );
- }
- late final _py_newmat3x3Ptr =
- _lookup<ffi.NativeFunction<ffi.Pointer<c11_mat3x3> Function(py_OutRef)>>(
- 'py_newmat3x3');
- late final _py_newmat3x3 = _py_newmat3x3Ptr
- .asFunction<ffi.Pointer<c11_mat3x3> Function(py_OutRef)>();
- c11_vec2 py_tovec2(
- py_Ref self,
- ) {
- return _py_tovec2(
- self,
- );
- }
- late final _py_tovec2Ptr =
- _lookup<ffi.NativeFunction<c11_vec2 Function(py_Ref)>>('py_tovec2');
- late final _py_tovec2 = _py_tovec2Ptr.asFunction<c11_vec2 Function(py_Ref)>();
- c11_vec3 py_tovec3(
- py_Ref self,
- ) {
- return _py_tovec3(
- self,
- );
- }
- late final _py_tovec3Ptr =
- _lookup<ffi.NativeFunction<c11_vec3 Function(py_Ref)>>('py_tovec3');
- late final _py_tovec3 = _py_tovec3Ptr.asFunction<c11_vec3 Function(py_Ref)>();
- c11_vec2i py_tovec2i(
- py_Ref self,
- ) {
- return _py_tovec2i(
- self,
- );
- }
- late final _py_tovec2iPtr =
- _lookup<ffi.NativeFunction<c11_vec2i Function(py_Ref)>>('py_tovec2i');
- late final _py_tovec2i =
- _py_tovec2iPtr.asFunction<c11_vec2i Function(py_Ref)>();
- c11_vec3i py_tovec3i(
- py_Ref self,
- ) {
- return _py_tovec3i(
- self,
- );
- }
- late final _py_tovec3iPtr =
- _lookup<ffi.NativeFunction<c11_vec3i Function(py_Ref)>>('py_tovec3i');
- late final _py_tovec3i =
- _py_tovec3iPtr.asFunction<c11_vec3i Function(py_Ref)>();
- ffi.Pointer<c11_mat3x3> py_tomat3x3(
- py_Ref self,
- ) {
- return _py_tomat3x3(
- self,
- );
- }
- late final _py_tomat3x3Ptr =
- _lookup<ffi.NativeFunction<ffi.Pointer<c11_mat3x3> Function(py_Ref)>>(
- 'py_tomat3x3');
- late final _py_tomat3x3 =
- _py_tomat3x3Ptr.asFunction<ffi.Pointer<c11_mat3x3> Function(py_Ref)>();
- /// An utility function to read a line from stdin for REPL.
- int py_replinput(
- ffi.Pointer<ffi.Char> buf,
- int max_size,
- ) {
- return _py_replinput(
- buf,
- max_size,
- );
- }
- late final _py_replinputPtr = _lookup<
- ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Char>, ffi.Int)>>(
- 'py_replinput');
- late final _py_replinput =
- _py_replinputPtr.asFunction<int Function(ffi.Pointer<ffi.Char>, int)>();
- }
- final class c11_vec2i extends ffi.Union {
- external UnnamedStruct1 unnamed;
- @ffi.Array.multi([2])
- external ffi.Array<ffi.Int> data;
- }
- final class UnnamedStruct1 extends ffi.Struct {
- @ffi.Int()
- external int x;
- @ffi.Int()
- external int y;
- }
- final class c11_vec3i extends ffi.Union {
- external UnnamedStruct2 unnamed;
- @ffi.Array.multi([3])
- external ffi.Array<ffi.Int> data;
- }
- final class UnnamedStruct2 extends ffi.Struct {
- @ffi.Int()
- external int x;
- @ffi.Int()
- external int y;
- @ffi.Int()
- external int z;
- }
- final class c11_vec2 extends ffi.Union {
- external UnnamedStruct3 unnamed;
- @ffi.Array.multi([2])
- external ffi.Array<ffi.Float> data;
- }
- final class UnnamedStruct3 extends ffi.Struct {
- @ffi.Float()
- external double x;
- @ffi.Float()
- external double y;
- }
- final class c11_vec3 extends ffi.Union {
- external UnnamedStruct4 unnamed;
- @ffi.Array.multi([3])
- external ffi.Array<ffi.Float> data;
- }
- final class UnnamedStruct4 extends ffi.Struct {
- @ffi.Float()
- external double x;
- @ffi.Float()
- external double y;
- @ffi.Float()
- external double z;
- }
- final class c11_mat3x3 extends ffi.Union {
- external UnnamedStruct5 unnamed;
- @ffi.Array.multi([3, 3])
- external ffi.Array<ffi.Array<ffi.Float>> m;
- @ffi.Array.multi([9])
- external ffi.Array<ffi.Float> data;
- }
- final class UnnamedStruct5 extends ffi.Struct {
- @ffi.Float()
- external double _11;
- @ffi.Float()
- external double _12;
- @ffi.Float()
- external double _13;
- @ffi.Float()
- external double _21;
- @ffi.Float()
- external double _22;
- @ffi.Float()
- external double _23;
- @ffi.Float()
- external double _31;
- @ffi.Float()
- external double _32;
- @ffi.Float()
- external double _33;
- }
- final class py_TValue extends ffi.Opaque {}
- /// A string view type. It is helpful for passing strings which are not null-terminated.
- final class c11_sv extends ffi.Struct {
- external ffi.Pointer<ffi.Char> data;
- @ffi.Int()
- external int size;
- }
- /// A struct contains the callbacks of the VM.
- final class py_Callbacks extends ffi.Struct {
- /// Used by `__import__` to load source code of a module.
- external ffi.Pointer<
- ffi.NativeFunction<
- ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>> importfile;
- /// Used by `print` to output a string.
- external ffi
- .Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Char>)>>
- print;
- }
- /// Python compiler modes.
- /// + `EXEC_MODE`: for statements.
- /// + `EVAL_MODE`: for expressions.
- /// + `SINGLE_MODE`: for REPL or jupyter notebook execution.
- abstract class py_CompileMode {
- static const int EXEC_MODE = 0;
- static const int EVAL_MODE = 1;
- static const int SINGLE_MODE = 2;
- }
- /// A generic reference to a python object.
- typedef py_Ref = ffi.Pointer<py_TValue>;
- /// An output reference for returning a value.
- typedef py_OutRef = ffi.Pointer<py_TValue>;
- /// A global reference which has the same lifespan as the VM.
- typedef py_GlobalRef = ffi.Pointer<py_TValue>;
- /// A 64-bit integer type. Corresponds to `int` in python.
- typedef py_i64 = ffi.Int64;
- /// A 64-bit floating-point type. Corresponds to `float` in python.
- typedef py_f64 = ffi.Double;
- /// Native function signature.
- /// @param argc number of arguments.
- /// @param argv array of arguments. Use `py_arg(i)` macro to get the i-th argument.
- /// @return `true` if the function is successful or `false` if an exception is raised.
- typedef py_CFunction = ffi.Pointer<
- ffi.NativeFunction<ffi.Bool Function(ffi.Int argc, py_StackRef argv)>>;
- /// A specific location in the value stack of the VM.
- typedef py_StackRef = ffi.Pointer<py_TValue>;
- /// An integer that represents a python identifier. This is to achieve string pooling and fast name
- /// resolution.
- typedef py_Name = ffi.Uint16;
- /// An integer that represents a python type. `0` is invalid.
- typedef py_Type = ffi.Int16;
- /// A generic destructor function.
- typedef py_Dtor
- = ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>;
- /// An item reference to a container object. It invalidates when the container is modified.
- typedef py_ItemRef = ffi.Pointer<py_TValue>;
- /// A reference which has the same lifespan as the python object.
- typedef py_ObjectRef = ffi.Pointer<py_TValue>;
- /// Python favored string formatting.
- /// %d: int
- /// %i: py_i64 (int64_t)
- /// %f: py_f64 (double)
- /// %s: const char*
- /// %q: c11_sv
- /// %v: c11_sv
- /// %c: char
- /// %p: void*
- /// %t: py_Type
- /// %n: py_Name
- abstract class py_MagicNames {
- /// 0 is reserved
- static const int py_MagicNames__NULL = 0;
- /// unary operators
- static const int __repr__ = 1;
- static const int __str__ = 2;
- static const int __hash__ = 3;
- static const int __len__ = 4;
- static const int __iter__ = 5;
- static const int __next__ = 6;
- static const int __neg__ = 7;
- static const int __invert__ = 8;
- static const int __bool__ = 9;
- /// logical operators
- static const int __contains__ = 10;
- /// //////////////////////////
- static const int __eq__ = 11;
- static const int __ne__ = 12;
- static const int __lt__ = 13;
- static const int __le__ = 14;
- static const int __gt__ = 15;
- static const int __ge__ = 16;
- /// binary operators
- static const int __add__ = 17;
- static const int __radd__ = 18;
- static const int __sub__ = 19;
- static const int __rsub__ = 20;
- static const int __mul__ = 21;
- static const int __rmul__ = 22;
- static const int __truediv__ = 23;
- static const int __rtruediv__ = 24;
- static const int __floordiv__ = 25;
- static const int __rfloordiv__ = 26;
- static const int __mod__ = 27;
- static const int __rmod__ = 28;
- static const int __pow__ = 29;
- static const int __rpow__ = 30;
- static const int __matmul__ = 31;
- static const int __lshift__ = 32;
- static const int __rshift__ = 33;
- static const int __and__ = 34;
- static const int __or__ = 35;
- static const int __xor__ = 36;
- /// //////////////////////////
- /// indexer
- static const int __getitem__ = 37;
- static const int __setitem__ = 38;
- static const int __delitem__ = 39;
- /// specials
- static const int __new__ = 40;
- static const int __init__ = 41;
- static const int __call__ = 42;
- static const int __divmod__ = 43;
- static const int __enter__ = 44;
- static const int __exit__ = 45;
- static const int __name__ = 46;
- static const int __all__ = 47;
- static const int __package__ = 48;
- static const int __path__ = 49;
- static const int __class__ = 50;
- static const int __abs__ = 51;
- static const int __getattr__ = 52;
- static const int __missing__ = 53;
- }
- abstract class py_PredefinedTypes {
- static const int tp_nil = 0;
- static const int tp_object = 1;
- /// py_Type
- static const int tp_type = 2;
- static const int tp_int = 3;
- static const int tp_float = 4;
- static const int tp_bool = 5;
- static const int tp_str = 6;
- static const int tp_str_iterator = 7;
- /// c11_vector
- static const int tp_list = 8;
- /// N slots
- static const int tp_tuple = 9;
- static const int tp_array_iterator = 10;
- /// 3 slots (start, stop, step)
- static const int tp_slice = 11;
- static const int tp_range = 12;
- static const int tp_range_iterator = 13;
- static const int tp_module = 14;
- static const int tp_function = 15;
- static const int tp_nativefunc = 16;
- static const int tp_boundmethod = 17;
- /// 1 slot + py_Type
- static const int tp_super = 18;
- /// 2 slots (arg + inner_exc)
- static const int tp_BaseException = 19;
- static const int tp_Exception = 20;
- static const int tp_bytes = 21;
- static const int tp_namedict = 22;
- static const int tp_locals = 23;
- static const int tp_code = 24;
- static const int tp_dict = 25;
- /// 1 slot
- static const int tp_dict_items = 26;
- /// 2 slots (getter + setter)
- static const int tp_property = 27;
- /// 1 slot + int level
- static const int tp_star_wrapper = 28;
- /// 1 slot
- static const int tp_staticmethod = 29;
- /// 1 slot
- static const int tp_classmethod = 30;
- static const int tp_NoneType = 31;
- static const int tp_NotImplementedType = 32;
- static const int tp_ellipsis = 33;
- static const int tp_generator = 34;
- /// builtin exceptions
- static const int tp_SystemExit = 35;
- static const int tp_KeyboardInterrupt = 36;
- static const int tp_StopIteration = 37;
- static const int tp_SyntaxError = 38;
- static const int tp_StackOverflowError = 39;
- static const int tp_IOError = 40;
- static const int tp_OSError = 41;
- static const int tp_NotImplementedError = 42;
- static const int tp_TypeError = 43;
- static const int tp_IndexError = 44;
- static const int tp_ValueError = 45;
- static const int tp_RuntimeError = 46;
- static const int tp_ZeroDivisionError = 47;
- static const int tp_NameError = 48;
- static const int tp_UnboundLocalError = 49;
- static const int tp_AttributeError = 50;
- static const int tp_ImportError = 51;
- static const int tp_AssertionError = 52;
- static const int tp_KeyError = 53;
- /// linalg
- static const int tp_vec2 = 54;
- static const int tp_vec3 = 55;
- static const int tp_vec2i = 56;
- static const int tp_vec3i = 57;
- static const int tp_mat3x3 = 58;
- /// array2d
- static const int tp_array2d = 59;
- static const int tp_array2d_iterator = 60;
- }
- const String PK_VERSION = '2.0.0';
- const int PK_VERSION_MAJOR = 2;
- const int PK_VERSION_MINOR = 0;
- const int PK_VERSION_PATCH = 0;
- const int PK_ENABLE_OS = 1;
- const int PK_GC_MIN_THRESHOLD = 16384;
- const int PK_DEBUG_CEVAL_STEP = 0;
- const int PK_DEBUG_MEMORY_POOL = 0;
- const int PK_DEBUG_NO_AUTO_GC = 0;
- const int PK_DEBUG_GC_STATS = 0;
- const int PK_DEBUG_COMPILER = 0;
- const int PK_VM_STACK_SIZE = 16384;
- const int PK_MAX_CO_VARNAMES = 64;
- const int PK_PLATFORM_SEP = 47;
- const int PY_SYS_PLATFORM = 3;
- const String PY_SYS_PLATFORM_STRING = 'darwin';
- const int PK_IS_DESKTOP_PLATFORM = 1;
|