├── .gitignore ├── README.md ├── node-call ├── index.js └── node_modules │ ├── .bin │ ├── node-gyp-build │ ├── node-gyp-build-optional │ └── node-gyp-build-test │ ├── debug │ ├── LICENSE │ ├── README.md │ └── src │ │ ├── browser.js │ │ ├── common.js │ │ ├── index.js │ │ └── node.js │ ├── ffi-napi │ ├── .github │ │ └── workflows │ │ │ └── configure.yml │ ├── .jshintrc │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── appveyor.yml │ ├── binding.gyp │ ├── build │ │ ├── Makefile │ │ ├── Release │ │ │ ├── .deps │ │ │ │ └── Release │ │ │ │ │ ├── ffi_bindings.node.d │ │ │ │ │ ├── libffi.a.d │ │ │ │ │ ├── nothing.a.d │ │ │ │ │ └── obj.target │ │ │ │ │ ├── ffi │ │ │ │ │ └── deps │ │ │ │ │ │ └── libffi │ │ │ │ │ │ └── src │ │ │ │ │ │ ├── aarch64 │ │ │ │ │ │ ├── ffi.o.d │ │ │ │ │ │ └── sysv.o.d │ │ │ │ │ │ ├── closures.o.d │ │ │ │ │ │ ├── java_raw_api.o.d │ │ │ │ │ │ ├── prep_cif.o.d │ │ │ │ │ │ ├── raw_api.o.d │ │ │ │ │ │ └── types.o.d │ │ │ │ │ ├── ffi_bindings │ │ │ │ │ └── src │ │ │ │ │ │ ├── callback_info.o.d │ │ │ │ │ │ ├── ffi.o.d │ │ │ │ │ │ └── threaded_callback_invokation.o.d │ │ │ │ │ └── node-addon-api │ │ │ │ │ └── nothing.o.d │ │ │ ├── ffi_bindings.node │ │ │ ├── libffi.a │ │ │ ├── nothing.a │ │ │ └── obj.target │ │ │ │ ├── ffi │ │ │ │ └── deps │ │ │ │ │ └── libffi │ │ │ │ │ └── src │ │ │ │ │ ├── aarch64 │ │ │ │ │ ├── ffi.o │ │ │ │ │ └── sysv.o │ │ │ │ │ ├── closures.o │ │ │ │ │ ├── java_raw_api.o │ │ │ │ │ ├── prep_cif.o │ │ │ │ │ ├── raw_api.o │ │ │ │ │ └── types.o │ │ │ │ ├── ffi_bindings │ │ │ │ └── src │ │ │ │ │ ├── callback_info.o │ │ │ │ │ ├── ffi.o │ │ │ │ │ └── threaded_callback_invokation.o │ │ │ │ └── node-addon-api │ │ │ │ └── nothing.o │ │ ├── binding.Makefile │ │ ├── config.gypi │ │ ├── deps │ │ │ └── libffi │ │ │ │ ├── closure-test.target.mk │ │ │ │ ├── ffi.target.mk │ │ │ │ ├── libffi.Makefile │ │ │ │ └── test.target.mk │ │ ├── ffi_bindings.target.mk │ │ ├── gyp-mac-tool │ │ └── node_gyp_bins │ │ │ └── python3 │ ├── deps │ │ └── libffi │ │ │ ├── ChangeLog │ │ │ ├── ChangeLog.libffi │ │ │ ├── ChangeLog.libgcj │ │ │ ├── ChangeLog.old │ │ │ ├── ChangeLog.v1 │ │ │ ├── LICENSE │ │ │ ├── LICENSE-BUILDTOOLS │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── README │ │ │ ├── README.md │ │ │ ├── acinclude.m4 │ │ │ ├── aclocal.m4 │ │ │ ├── autogen.sh │ │ │ ├── closure.c │ │ │ ├── compile │ │ │ ├── config.guess │ │ │ ├── config.sub │ │ │ ├── config │ │ │ ├── README │ │ │ ├── freebsd │ │ │ │ ├── ia32 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ └── ffitarget.h │ │ │ │ └── x64 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ └── ffitarget.h │ │ │ ├── linux │ │ │ │ ├── arm │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ ├── ffitarget.h │ │ │ │ │ └── flags.txt │ │ │ │ ├── arm64 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ ├── ffitarget.h │ │ │ │ │ └── flags.txt │ │ │ │ ├── ia32 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ ├── ffitarget.h │ │ │ │ │ └── flags.txt │ │ │ │ └── x64 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ └── ffitarget.h │ │ │ ├── mac │ │ │ │ ├── arm64 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ └── ffitarget.h │ │ │ │ ├── ia32 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ ├── ffitarget.h │ │ │ │ │ └── flags.txt │ │ │ │ └── x64 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ ├── ffitarget.h │ │ │ │ │ └── flags.txt │ │ │ ├── openbsd │ │ │ │ └── x64 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ └── ffitarget.h │ │ │ ├── solaris │ │ │ │ ├── ia32 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ ├── ffitarget.h │ │ │ │ │ └── flags.txt │ │ │ │ └── x64 │ │ │ │ │ ├── ffi.h │ │ │ │ │ ├── fficonfig.h │ │ │ │ │ ├── ffitarget.h │ │ │ │ │ └── flags.txt │ │ │ └── win │ │ │ │ ├── arm64 │ │ │ │ ├── ffi.h │ │ │ │ ├── fficonfig.h │ │ │ │ └── ffitarget.h │ │ │ │ ├── ia32 │ │ │ │ ├── ffi.h │ │ │ │ ├── fficonfig.h │ │ │ │ └── ffitarget.h │ │ │ │ └── x64 │ │ │ │ ├── ffi.h │ │ │ │ ├── fficonfig.h │ │ │ │ └── ffitarget.h │ │ │ ├── configure │ │ │ ├── configure.ac │ │ │ ├── configure.host │ │ │ ├── depcomp │ │ │ ├── doc │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── libffi.info │ │ │ ├── libffi.texi │ │ │ ├── mdate-sh │ │ │ ├── stamp-vti │ │ │ ├── texinfo.tex │ │ │ └── version.texi │ │ │ ├── fficonfig.h.in │ │ │ ├── generate-darwin-source-and-headers.py │ │ │ ├── generate-ios-source-and-headers.py │ │ │ ├── generate-osx-source-and-headers.py │ │ │ ├── include │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── ffi.h.in │ │ │ ├── ffi_cfi.h │ │ │ └── ffi_common.h │ │ │ ├── install-sh │ │ │ ├── libffi.gyp │ │ │ ├── libffi.map.in │ │ │ ├── libffi.pc.in │ │ │ ├── libffi.xcodeproj │ │ │ └── project.pbxproj │ │ │ ├── libtool-ldflags │ │ │ ├── libtool-version │ │ │ ├── ltmain.sh │ │ │ ├── m4 │ │ │ ├── asmcfi.m4 │ │ │ ├── ax_append_flag.m4 │ │ │ ├── ax_cc_maxopt.m4 │ │ │ ├── ax_cflags_warn_all.m4 │ │ │ ├── ax_check_compile_flag.m4 │ │ │ ├── ax_compiler_vendor.m4 │ │ │ ├── ax_configure_args.m4 │ │ │ ├── ax_enable_builddir.m4 │ │ │ ├── ax_gcc_archflag.m4 │ │ │ ├── ax_gcc_x86_cpuid.m4 │ │ │ ├── ax_require_defined.m4 │ │ │ ├── libtool.m4 │ │ │ ├── ltoptions.m4 │ │ │ ├── ltsugar.m4 │ │ │ ├── ltversion.m4 │ │ │ └── lt~obsolete.m4 │ │ │ ├── make_sunver.pl │ │ │ ├── man │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── ffi.3 │ │ │ ├── ffi_call.3 │ │ │ ├── ffi_prep_cif.3 │ │ │ └── ffi_prep_cif_var.3 │ │ │ ├── mdate-sh │ │ │ ├── missing │ │ │ ├── msvc_build │ │ │ └── aarch64 │ │ │ │ ├── Ffi_staticLib.sln │ │ │ │ ├── Ffi_staticLib.vcxproj │ │ │ │ ├── Ffi_staticLib.vcxproj.filters │ │ │ │ ├── Ffi_staticLib.vcxproj.user │ │ │ │ └── aarch64_include │ │ │ │ ├── ffi.h │ │ │ │ └── fficonfig.h │ │ │ ├── msvcc.sh │ │ │ ├── preprocess_asm.cmd │ │ │ ├── src │ │ │ ├── aarch64 │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── internal.h │ │ │ │ ├── sysv.S │ │ │ │ └── win64_armasm.preasm │ │ │ ├── alpha │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── internal.h │ │ │ │ └── osf.S │ │ │ ├── arc │ │ │ │ ├── arcompact.S │ │ │ │ ├── ffi.c │ │ │ │ └── ffitarget.h │ │ │ ├── arm │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── internal.h │ │ │ │ ├── sysv.S │ │ │ │ └── sysv_msvc_arm32.S │ │ │ ├── avr32 │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── bfin │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── closures.c │ │ │ ├── cris │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── debug.c │ │ │ ├── dlmalloc.c │ │ │ ├── frv │ │ │ │ ├── eabi.S │ │ │ │ ├── ffi.c │ │ │ │ └── ffitarget.h │ │ │ ├── ia64 │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── ia64_flags.h │ │ │ │ └── unix.S │ │ │ ├── java_raw_api.c │ │ │ ├── m32r │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── m68k │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── m88k │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── obsd.S │ │ │ ├── metag │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── microblaze │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── mips │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── n32.S │ │ │ │ └── o32.S │ │ │ ├── moxie │ │ │ │ ├── eabi.S │ │ │ │ ├── ffi.c │ │ │ │ └── ffitarget.h │ │ │ ├── nios2 │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── or1k │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── pa │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── hpux32.S │ │ │ │ └── linux.S │ │ │ ├── powerpc │ │ │ │ ├── aix.S │ │ │ │ ├── aix_closure.S │ │ │ │ ├── asm.h │ │ │ │ ├── darwin.S │ │ │ │ ├── darwin_closure.S │ │ │ │ ├── ffi.c │ │ │ │ ├── ffi_darwin.c │ │ │ │ ├── ffi_linux64.c │ │ │ │ ├── ffi_powerpc.h │ │ │ │ ├── ffi_sysv.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── linux64.S │ │ │ │ ├── linux64_closure.S │ │ │ │ ├── ppc_closure.S │ │ │ │ └── sysv.S │ │ │ ├── prep_cif.c │ │ │ ├── raw_api.c │ │ │ ├── riscv │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── s390 │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── internal.h │ │ │ │ └── sysv.S │ │ │ ├── sh │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── sh64 │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── sparc │ │ │ │ ├── ffi.c │ │ │ │ ├── ffi64.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── internal.h │ │ │ │ ├── v8.S │ │ │ │ └── v9.S │ │ │ ├── tile │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── tile.S │ │ │ ├── types.c │ │ │ ├── vax │ │ │ │ ├── elfbsd.S │ │ │ │ ├── ffi.c │ │ │ │ └── ffitarget.h │ │ │ ├── x86 │ │ │ │ ├── asmnames.h │ │ │ │ ├── ffi.c │ │ │ │ ├── ffi64.c │ │ │ │ ├── ffitarget.h │ │ │ │ ├── ffiw64.c │ │ │ │ ├── internal.h │ │ │ │ ├── internal64.h │ │ │ │ ├── sysv.S │ │ │ │ ├── sysv_intel.preasm │ │ │ │ ├── unix64.S │ │ │ │ ├── win64.S │ │ │ │ └── win64_intel.preasm │ │ │ └── xtensa │ │ │ │ ├── ffi.c │ │ │ │ ├── ffitarget.h │ │ │ │ └── sysv.S │ │ │ ├── stamp-h.in │ │ │ ├── test.c │ │ │ ├── testsuite │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── config │ │ │ │ └── default.exp │ │ │ ├── lib │ │ │ │ ├── libffi.exp │ │ │ │ ├── target-libpath.exp │ │ │ │ └── wrapper.exp │ │ │ ├── libffi.bhaible │ │ │ │ ├── README │ │ │ │ ├── alignof.h │ │ │ │ ├── bhaible.exp │ │ │ │ ├── test-call.c │ │ │ │ ├── test-callback.c │ │ │ │ └── testcases.c │ │ │ ├── libffi.call │ │ │ │ ├── align_mixed.c │ │ │ │ ├── align_stdcall.c │ │ │ │ ├── call.exp │ │ │ │ ├── closure_fn0.c │ │ │ │ ├── closure_fn1.c │ │ │ │ ├── closure_fn2.c │ │ │ │ ├── closure_fn3.c │ │ │ │ ├── closure_fn4.c │ │ │ │ ├── closure_fn5.c │ │ │ │ ├── closure_fn6.c │ │ │ │ ├── closure_loc_fn0.c │ │ │ │ ├── closure_stdcall.c │ │ │ │ ├── closure_thiscall.c │ │ │ │ ├── cls_12byte.c │ │ │ │ ├── cls_16byte.c │ │ │ │ ├── cls_18byte.c │ │ │ │ ├── cls_19byte.c │ │ │ │ ├── cls_1_1byte.c │ │ │ │ ├── cls_20byte.c │ │ │ │ ├── cls_20byte1.c │ │ │ │ ├── cls_24byte.c │ │ │ │ ├── cls_2byte.c │ │ │ │ ├── cls_3_1byte.c │ │ │ │ ├── cls_3byte1.c │ │ │ │ ├── cls_3byte2.c │ │ │ │ ├── cls_4_1byte.c │ │ │ │ ├── cls_4byte.c │ │ │ │ ├── cls_5_1_byte.c │ │ │ │ ├── cls_5byte.c │ │ │ │ ├── cls_64byte.c │ │ │ │ ├── cls_6_1_byte.c │ │ │ │ ├── cls_6byte.c │ │ │ │ ├── cls_7_1_byte.c │ │ │ │ ├── cls_7byte.c │ │ │ │ ├── cls_8byte.c │ │ │ │ ├── cls_9byte1.c │ │ │ │ ├── cls_9byte2.c │ │ │ │ ├── cls_align_double.c │ │ │ │ ├── cls_align_float.c │ │ │ │ ├── cls_align_longdouble.c │ │ │ │ ├── cls_align_longdouble_split.c │ │ │ │ ├── cls_align_longdouble_split2.c │ │ │ │ ├── cls_align_pointer.c │ │ │ │ ├── cls_align_sint16.c │ │ │ │ ├── cls_align_sint32.c │ │ │ │ ├── cls_align_sint64.c │ │ │ │ ├── cls_align_uint16.c │ │ │ │ ├── cls_align_uint32.c │ │ │ │ ├── cls_align_uint64.c │ │ │ │ ├── cls_dbls_struct.c │ │ │ │ ├── cls_double.c │ │ │ │ ├── cls_double_va.c │ │ │ │ ├── cls_float.c │ │ │ │ ├── cls_longdouble.c │ │ │ │ ├── cls_longdouble_va.c │ │ │ │ ├── cls_multi_schar.c │ │ │ │ ├── cls_multi_sshort.c │ │ │ │ ├── cls_multi_sshortchar.c │ │ │ │ ├── cls_multi_uchar.c │ │ │ │ ├── cls_multi_ushort.c │ │ │ │ ├── cls_multi_ushortchar.c │ │ │ │ ├── cls_pointer.c │ │ │ │ ├── cls_pointer_stack.c │ │ │ │ ├── cls_schar.c │ │ │ │ ├── cls_sint.c │ │ │ │ ├── cls_sshort.c │ │ │ │ ├── cls_uchar.c │ │ │ │ ├── cls_uint.c │ │ │ │ ├── cls_ulonglong.c │ │ │ │ ├── cls_ushort.c │ │ │ │ ├── err_bad_abi.c │ │ │ │ ├── err_bad_typedef.c │ │ │ │ ├── fastthis1_win32.c │ │ │ │ ├── fastthis2_win32.c │ │ │ │ ├── fastthis3_win32.c │ │ │ │ ├── ffitest.h │ │ │ │ ├── float.c │ │ │ │ ├── float1.c │ │ │ │ ├── float2.c │ │ │ │ ├── float3.c │ │ │ │ ├── float4.c │ │ │ │ ├── float_va.c │ │ │ │ ├── huge_struct.c │ │ │ │ ├── many.c │ │ │ │ ├── many2.c │ │ │ │ ├── many2_win32.c │ │ │ │ ├── many_double.c │ │ │ │ ├── many_mixed.c │ │ │ │ ├── many_win32.c │ │ │ │ ├── negint.c │ │ │ │ ├── nested_struct.c │ │ │ │ ├── nested_struct1.c │ │ │ │ ├── nested_struct10.c │ │ │ │ ├── nested_struct2.c │ │ │ │ ├── nested_struct3.c │ │ │ │ ├── nested_struct4.c │ │ │ │ ├── nested_struct5.c │ │ │ │ ├── nested_struct6.c │ │ │ │ ├── nested_struct7.c │ │ │ │ ├── nested_struct8.c │ │ │ │ ├── nested_struct9.c │ │ │ │ ├── offsets.c │ │ │ │ ├── pr1172638.c │ │ │ │ ├── problem1.c │ │ │ │ ├── promotion.c │ │ │ │ ├── pyobjc-tc.c │ │ │ │ ├── return_dbl.c │ │ │ │ ├── return_dbl1.c │ │ │ │ ├── return_dbl2.c │ │ │ │ ├── return_fl.c │ │ │ │ ├── return_fl1.c │ │ │ │ ├── return_fl2.c │ │ │ │ ├── return_fl3.c │ │ │ │ ├── return_ldl.c │ │ │ │ ├── return_ll.c │ │ │ │ ├── return_ll1.c │ │ │ │ ├── return_sc.c │ │ │ │ ├── return_sl.c │ │ │ │ ├── return_uc.c │ │ │ │ ├── return_ul.c │ │ │ │ ├── stret_large.c │ │ │ │ ├── stret_large2.c │ │ │ │ ├── stret_medium.c │ │ │ │ ├── stret_medium2.c │ │ │ │ ├── strlen.c │ │ │ │ ├── strlen2.c │ │ │ │ ├── strlen2_win32.c │ │ │ │ ├── strlen3.c │ │ │ │ ├── strlen4.c │ │ │ │ ├── strlen_win32.c │ │ │ │ ├── struct1.c │ │ │ │ ├── struct10.c │ │ │ │ ├── struct1_win32.c │ │ │ │ ├── struct2.c │ │ │ │ ├── struct2_win32.c │ │ │ │ ├── struct3.c │ │ │ │ ├── struct4.c │ │ │ │ ├── struct5.c │ │ │ │ ├── struct6.c │ │ │ │ ├── struct7.c │ │ │ │ ├── struct8.c │ │ │ │ ├── struct9.c │ │ │ │ ├── testclosure.c │ │ │ │ ├── uninitialized.c │ │ │ │ ├── va_1.c │ │ │ │ ├── va_struct1.c │ │ │ │ ├── va_struct2.c │ │ │ │ └── va_struct3.c │ │ │ ├── libffi.closures │ │ │ │ ├── closure.exp │ │ │ │ ├── closure_fn0.c │ │ │ │ ├── closure_fn1.c │ │ │ │ ├── closure_fn2.c │ │ │ │ ├── closure_fn3.c │ │ │ │ ├── closure_fn4.c │ │ │ │ ├── closure_fn5.c │ │ │ │ ├── closure_fn6.c │ │ │ │ ├── closure_loc_fn0.c │ │ │ │ ├── closure_simple.c │ │ │ │ ├── cls_12byte.c │ │ │ │ ├── cls_16byte.c │ │ │ │ ├── cls_18byte.c │ │ │ │ ├── cls_19byte.c │ │ │ │ ├── cls_1_1byte.c │ │ │ │ ├── cls_20byte.c │ │ │ │ ├── cls_20byte1.c │ │ │ │ ├── cls_24byte.c │ │ │ │ ├── cls_2byte.c │ │ │ │ ├── cls_3_1byte.c │ │ │ │ ├── cls_3byte1.c │ │ │ │ ├── cls_3byte2.c │ │ │ │ ├── cls_3float.c │ │ │ │ ├── cls_4_1byte.c │ │ │ │ ├── cls_4byte.c │ │ │ │ ├── cls_5_1_byte.c │ │ │ │ ├── cls_5byte.c │ │ │ │ ├── cls_64byte.c │ │ │ │ ├── cls_6_1_byte.c │ │ │ │ ├── cls_6byte.c │ │ │ │ ├── cls_7_1_byte.c │ │ │ │ ├── cls_7byte.c │ │ │ │ ├── cls_8byte.c │ │ │ │ ├── cls_9byte1.c │ │ │ │ ├── cls_9byte2.c │ │ │ │ ├── cls_align_double.c │ │ │ │ ├── cls_align_float.c │ │ │ │ ├── cls_align_longdouble.c │ │ │ │ ├── cls_align_longdouble_split.c │ │ │ │ ├── cls_align_longdouble_split2.c │ │ │ │ ├── cls_align_pointer.c │ │ │ │ ├── cls_align_sint16.c │ │ │ │ ├── cls_align_sint32.c │ │ │ │ ├── cls_align_sint64.c │ │ │ │ ├── cls_align_uint16.c │ │ │ │ ├── cls_align_uint32.c │ │ │ │ ├── cls_align_uint64.c │ │ │ │ ├── cls_dbls_struct.c │ │ │ │ ├── cls_double.c │ │ │ │ ├── cls_double_va.c │ │ │ │ ├── cls_float.c │ │ │ │ ├── cls_longdouble.c │ │ │ │ ├── cls_longdouble_va.c │ │ │ │ ├── cls_many_mixed_args.c │ │ │ │ ├── cls_many_mixed_float_double.c │ │ │ │ ├── cls_multi_schar.c │ │ │ │ ├── cls_multi_sshort.c │ │ │ │ ├── cls_multi_sshortchar.c │ │ │ │ ├── cls_multi_uchar.c │ │ │ │ ├── cls_multi_ushort.c │ │ │ │ ├── cls_multi_ushortchar.c │ │ │ │ ├── cls_pointer.c │ │ │ │ ├── cls_pointer_stack.c │ │ │ │ ├── cls_schar.c │ │ │ │ ├── cls_sint.c │ │ │ │ ├── cls_sshort.c │ │ │ │ ├── cls_struct_va1.c │ │ │ │ ├── cls_uchar.c │ │ │ │ ├── cls_uchar_va.c │ │ │ │ ├── cls_uint.c │ │ │ │ ├── cls_uint_va.c │ │ │ │ ├── cls_ulong_va.c │ │ │ │ ├── cls_ulonglong.c │ │ │ │ ├── cls_ushort.c │ │ │ │ ├── cls_ushort_va.c │ │ │ │ ├── err_bad_abi.c │ │ │ │ ├── ffitest.h │ │ │ │ ├── huge_struct.c │ │ │ │ ├── nested_struct.c │ │ │ │ ├── nested_struct1.c │ │ │ │ ├── nested_struct10.c │ │ │ │ ├── nested_struct11.c │ │ │ │ ├── nested_struct2.c │ │ │ │ ├── nested_struct3.c │ │ │ │ ├── nested_struct4.c │ │ │ │ ├── nested_struct5.c │ │ │ │ ├── nested_struct6.c │ │ │ │ ├── nested_struct7.c │ │ │ │ ├── nested_struct8.c │ │ │ │ ├── nested_struct9.c │ │ │ │ ├── problem1.c │ │ │ │ ├── stret_large.c │ │ │ │ ├── stret_large2.c │ │ │ │ ├── stret_medium.c │ │ │ │ ├── stret_medium2.c │ │ │ │ ├── testclosure.c │ │ │ │ ├── unwindtest.cc │ │ │ │ └── unwindtest_ffi_call.cc │ │ │ ├── libffi.complex │ │ │ │ ├── cls_align_complex.inc │ │ │ │ ├── cls_align_complex_double.c │ │ │ │ ├── cls_align_complex_float.c │ │ │ │ ├── cls_align_complex_longdouble.c │ │ │ │ ├── cls_complex.inc │ │ │ │ ├── cls_complex_double.c │ │ │ │ ├── cls_complex_float.c │ │ │ │ ├── cls_complex_longdouble.c │ │ │ │ ├── cls_complex_struct.inc │ │ │ │ ├── cls_complex_struct_double.c │ │ │ │ ├── cls_complex_struct_float.c │ │ │ │ ├── cls_complex_struct_longdouble.c │ │ │ │ ├── cls_complex_va.inc │ │ │ │ ├── cls_complex_va_double.c │ │ │ │ ├── cls_complex_va_float.c │ │ │ │ ├── cls_complex_va_longdouble.c │ │ │ │ ├── complex.exp │ │ │ │ ├── complex.inc │ │ │ │ ├── complex_defs_double.inc │ │ │ │ ├── complex_defs_float.inc │ │ │ │ ├── complex_defs_longdouble.inc │ │ │ │ ├── complex_double.c │ │ │ │ ├── complex_float.c │ │ │ │ ├── complex_int.c │ │ │ │ ├── complex_longdouble.c │ │ │ │ ├── ffitest.h │ │ │ │ ├── many_complex.inc │ │ │ │ ├── many_complex_double.c │ │ │ │ ├── many_complex_float.c │ │ │ │ ├── many_complex_longdouble.c │ │ │ │ ├── return_complex.inc │ │ │ │ ├── return_complex1.inc │ │ │ │ ├── return_complex1_double.c │ │ │ │ ├── return_complex1_float.c │ │ │ │ ├── return_complex1_longdouble.c │ │ │ │ ├── return_complex2.inc │ │ │ │ ├── return_complex2_double.c │ │ │ │ ├── return_complex2_float.c │ │ │ │ ├── return_complex2_longdouble.c │ │ │ │ ├── return_complex_double.c │ │ │ │ ├── return_complex_float.c │ │ │ │ └── return_complex_longdouble.c │ │ │ ├── libffi.go │ │ │ │ ├── aa-direct.c │ │ │ │ ├── closure1.c │ │ │ │ ├── ffitest.h │ │ │ │ ├── go.exp │ │ │ │ └── static-chain.h │ │ │ └── libffi.special │ │ │ │ ├── ffitestcxx.h │ │ │ │ ├── special.exp │ │ │ │ ├── unwindtest.cc │ │ │ │ └── unwindtest_ffi_call.cc │ │ │ └── texinfo.tex │ ├── example │ │ ├── abs.js │ │ ├── factorial │ │ │ ├── README.md │ │ │ ├── factorial.c │ │ │ └── factorial.js │ │ └── sqlite.js │ ├── lib │ │ ├── _foreign_function.js │ │ ├── bindings.js │ │ ├── callback.js │ │ ├── cif.js │ │ ├── cif_var.js │ │ ├── dynamic_library.js │ │ ├── errno.js │ │ ├── ffi.js │ │ ├── foreign_function.js │ │ ├── foreign_function_var.js │ │ ├── function.js │ │ ├── library.js │ │ └── type.js │ ├── node-addon-api │ │ ├── node_api.Makefile │ │ └── nothing.target.mk │ ├── prebuilds │ │ ├── darwin-x64 │ │ │ └── node.napi.uv1.node │ │ ├── linux-arm64 │ │ │ └── node.napi.uv1.armv8.node │ │ ├── linux-x64 │ │ │ └── node.napi.uv1.node │ │ ├── win32-ia32 │ │ │ └── node.napi.uv1.node │ │ └── win32-x64 │ │ │ └── node.napi.uv1.node │ ├── src │ │ ├── callback_info.cc │ │ ├── ffi.cc │ │ ├── ffi.h │ │ ├── threaded_callback_invokation.cc │ │ ├── win32-dlfcn.cc │ │ └── win32-dlfcn.h │ └── test │ │ ├── binding.gyp │ │ ├── callback.js │ │ ├── cif.js │ │ ├── dynamic_library.js │ │ ├── errno.js │ │ ├── ffi_tests.cc │ │ ├── foreign_function.js │ │ ├── function.js │ │ ├── library.js │ │ ├── types.js │ │ └── variadic.js │ ├── get-symbol-from-current-process-h │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── appveyor.yml │ ├── code-of-conduct.md │ ├── get-paths.js │ └── include │ │ └── get-symbol-from-current-process.h │ ├── get-uv-event-loop-napi-h │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── appveyor.yml │ ├── code-of-conduct.md │ ├── get-paths.js │ └── include │ │ └── get-uv-event-loop-napi.h │ ├── ms │ ├── index.js │ ├── license.md │ └── readme.md │ ├── node-addon-api │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── common.gypi │ ├── except.gypi │ ├── index.js │ ├── napi-inl.deprecated.h │ ├── napi-inl.h │ ├── napi.h │ ├── node_api.gyp │ ├── noexcept.gypi │ ├── nothing.c │ └── tools │ │ ├── README.md │ │ ├── check-napi.js │ │ ├── clang-format.js │ │ └── conversion.js │ ├── node-gyp-build │ ├── LICENSE │ ├── README.md │ ├── bin.js │ ├── build-test.js │ ├── index.js │ ├── node-gyp-build.js │ └── optional.js │ ├── ref-napi │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── appveyor.yml │ ├── binding.gyp │ ├── build │ │ ├── Makefile │ │ ├── Release │ │ │ ├── .deps │ │ │ │ └── Release │ │ │ │ │ ├── binding.node.d │ │ │ │ │ ├── nothing.a.d │ │ │ │ │ └── obj.target │ │ │ │ │ ├── binding │ │ │ │ │ └── src │ │ │ │ │ │ └── binding.o.d │ │ │ │ │ └── node-addon-api │ │ │ │ │ └── nothing.o.d │ │ │ ├── binding.node │ │ │ ├── nothing.a │ │ │ └── obj.target │ │ │ │ ├── binding │ │ │ │ └── src │ │ │ │ │ └── binding.o │ │ │ │ └── node-addon-api │ │ │ │ └── nothing.o │ │ ├── binding.Makefile │ │ ├── binding.target.mk │ │ ├── config.gypi │ │ ├── gyp-mac-tool │ │ └── node_gyp_bins │ │ │ └── python3 │ ├── code-of-conduct.md │ ├── docs │ │ ├── compile.js │ │ ├── gh-pages.sh │ │ ├── images │ │ │ ├── apple-touch-icon-114x114.png │ │ │ ├── apple-touch-icon-72x72.png │ │ │ ├── apple-touch-icon.png │ │ │ ├── favicon.ico │ │ │ └── ref.pxm │ │ ├── index.jade │ │ ├── scripts │ │ │ ├── jquery-3.5.1.min.js │ │ │ └── main.js │ │ └── stylesheets │ │ │ ├── base.css │ │ │ ├── layout.css │ │ │ └── skeleton.css │ ├── include │ │ └── ref-napi.h │ ├── lib │ │ ├── get-paths.js │ │ └── ref.js │ ├── node-addon-api │ │ ├── node_api.Makefile │ │ └── nothing.target.mk │ ├── prebuilds │ │ ├── darwin-x64 │ │ │ ├── electron.napi.node │ │ │ └── node.napi.node │ │ ├── linux-arm64 │ │ │ ├── electron.napi.armv8.node │ │ │ └── node.napi.armv8.node │ │ ├── linux-x64 │ │ │ ├── electron.napi.node │ │ │ └── node.napi.node │ │ ├── win32-ia32 │ │ │ ├── electron.napi.node │ │ │ └── node.napi.node │ │ └── win32-x64 │ │ │ ├── electron.napi.node │ │ │ └── node.napi.node │ ├── src │ │ └── binding.cc │ └── test │ │ ├── address.js │ │ ├── alloc.js │ │ ├── bool.js │ │ ├── char.js │ │ ├── coerce.js │ │ ├── int64.js │ │ ├── iojs3issue.js │ │ ├── isNull.js │ │ ├── object.js │ │ ├── pointer.js │ │ ├── ref-deref.js │ │ ├── reinterpret.js │ │ ├── reinterpretUntilZeros.js │ │ ├── string.js │ │ ├── types.js │ │ ├── uint64.js │ │ └── utf16le.bin │ └── ref-struct-di │ ├── .jshintrc │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── appveyor.yml │ ├── code-of-conduct.md │ ├── lib │ └── struct.js │ └── node_modules │ └── debug │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── node.js │ └── src │ ├── browser.js │ ├── common.js │ ├── index.js │ └── node.js └── program ├── Cargo.lock ├── Cargo.toml ├── Xargo.toml └── src ├── entrypoint.rs ├── error.rs ├── instruction.rs ├── invokers.rs ├── lib.rs ├── log.rs ├── main.rs ├── math.rs ├── processor.rs └── state.rs /.gitignore: -------------------------------------------------------------------------------- 1 | program/target 2 | .idea* 3 | *.json 4 | *~ 5 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaScript Raydium AMM V4 Log Decoder 2 | ## Overview 3 | JavaScript (nodejs) wrapper around Raydium AMM V4 Rust SDK for decoding Solana transaction logs containing a ray_log.

4 | ## Ability to decode: 5 | * Raydium swap logs: swap amount in, swap amount out, swap direction. 6 | * Raydium liquidity add logs: SOL amount in, coin amount in, token decimals. 7 | ## How to use: 8 | * Run ```npm install``` inside ```/node_call```. 9 | * Run ```cargo build``` inside ```/program```. 10 | * ```node_call/index.js``` contains JavaScript functions for decoding Raydium logs. 11 | * ```program/src/main.rs``` calls the respective decode functions natively. 12 | * Example usage: ```decode_ray_log_swap_amount_in('');```, more examples provided in index.js. 13 | * Ability to export log decoding functions to outside JS files, use absolute path for this, instructions in index.js. 14 | 15 | ## Additional Notes: 16 | * The wrapper does not have error checking, functions with "swap" must have a Raydium "swap" log as input and functions with "init" must have a Raydium "init"/"lp add" log as input. -------------------------------------------------------------------------------- /node-call/node_modules/.bin/node-gyp-build: -------------------------------------------------------------------------------- 1 | ../node-gyp-build/bin.js -------------------------------------------------------------------------------- /node-call/node_modules/.bin/node-gyp-build-optional: -------------------------------------------------------------------------------- 1 | ../node-gyp-build/optional.js -------------------------------------------------------------------------------- /node-call/node_modules/.bin/node-gyp-build-test: -------------------------------------------------------------------------------- 1 | ../node-gyp-build/build-test.js -------------------------------------------------------------------------------- /node-call/node_modules/debug/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2017 TJ Holowaychuk 4 | Copyright (c) 2018-2021 Josh Junon 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 7 | and associated documentation files (the 'Software'), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial 13 | portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 16 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 19 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /node-call/node_modules/debug/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Detect Electron renderer / nwjs process, which is node, but we should 3 | * treat as a browser. 4 | */ 5 | 6 | if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { 7 | module.exports = require('./browser.js'); 8 | } else { 9 | module.exports = require('./node.js'); 10 | } 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/.github/workflows/configure.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build_and_test: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | matrix: 10 | os: [windows-latest, ubuntu-latest, macos-latest] 11 | steps: 12 | - name: Checkout repository 13 | uses: actions/checkout@v2 14 | - name: Set up Python 15 | uses: actions/setup-python@v2 16 | with: 17 | python-version: 3.9 18 | - uses: actions/setup-node@v2 19 | with: 20 | node-version: '14' 21 | - name: install dependencies and test 22 | shell: bash 23 | run: | 24 | npm install 25 | npm test 26 | - name: build with node-gyp 27 | shell: bash 28 | run: | 29 | npm install -g node-gyp 30 | node-gyp configure 31 | node-gyp rebuild 32 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": true, 3 | "laxcomma": true, 4 | "laxbreak": true, 5 | "node": true, 6 | "strict": false, 7 | "es5": true 8 | } 9 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | env: 4 | - CXX=g++-4.9 5 | - CXX=clang++ 6 | 7 | addons: 8 | apt: 9 | sources: 10 | - ubuntu-toolchain-r-test 11 | packages: 12 | - g++-4.9 13 | 14 | language: node_js 15 | 16 | os: 17 | - linux 18 | - osx 19 | 20 | osx_image: xcode10 21 | 22 | node_js: 23 | - "10" 24 | - "12" 25 | - "14" 26 | 27 | jobs: 28 | include: 29 | - os: linux 30 | arch: arm64 31 | node_js: 12 32 | env: CXX=g++-4.9 33 | exclude: 34 | - os: osx 35 | env: CXX=g++-4.9 36 | - os: linux 37 | env: CXX=clang++ 38 | 39 | install: 40 | - npm install --build-from-source 41 | 42 | after_success: 43 | - npm install coveralls 44 | - nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls 45 | 46 | before_deploy: 47 | - ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$TRAVIS_OS_NAME-`uname -m`.tar" 48 | - npm run prebuild --v8_enable_pointer_compression=false --v8_enable_31bit_smis_on_64bit_arch=false 49 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ARCH=ia32 npm run prebuild --v8_enable_pointer_compression=false --v8_enable_31bit_smis_on_64bit_arch=false; fi 50 | - tar --create --verbose --file="$ARCHIVE_NAME" --directory "$TRAVIS_BUILD_DIR/prebuilds" . 51 | 52 | deploy: 53 | provider: releases 54 | draft: false 55 | prerelease: true 56 | file: "$ARCHIVE_NAME" 57 | skip_cleanup: true 58 | on: 59 | tags: true 60 | node: 12 61 | api_key: $PREBUILD_GITHUB_TOKEN 62 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2011 Richard "Rick" W. Branson 2 | Copyright (c) 2012-2014 Nathan Rajlich, Richard "Rick" W. Branson 3 | Copyright (c) 2015 Nathan Rajlich, Richard "Rick" W. Branson, Gabor Mezo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to 7 | deal in the Software without restriction, including without limitation the 8 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9 | sell copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 | IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/appveyor.yml: -------------------------------------------------------------------------------- 1 | # http://www.appveyor.com/docs/appveyor-yml 2 | 3 | # Test against these versions of Node.js. 4 | environment: 5 | # Test against these versions of Node.js and io.js 6 | matrix: 7 | # node.js 8 | - nodejs_version: "10" 9 | - nodejs_version: "12" 10 | - nodejs_version: "14" 11 | 12 | platform: 13 | - x86 14 | - x64 15 | 16 | # Install scripts. (runs after repo cloning) 17 | install: 18 | - python -V 19 | - set PYTHON=python 20 | - ps: Install-Product node $env:nodejs_version $env:platform 21 | - node -p process.arch 22 | - node -p process.version 23 | - npm install --build-from-source 24 | 25 | # Post-install test scripts. 26 | test_script: 27 | # Output useful info for debugging. 28 | - node --version 29 | - npm --version 30 | # run tests 31 | - npm test 32 | 33 | after_test: 34 | - ps: If ($env:nodejs_version -eq "12") { npm run prebuild --v8_enable_pointer_compression=false --v8_enable_31bit_smis_on_64bit_arch=false } 35 | 36 | # Don't actually build. 37 | build: off 38 | 39 | # Set build version format here instead of in the admin panel. 40 | version: "{build}" 41 | 42 | artifacts: 43 | - path: prebuilds 44 | name: $(APPVEYOR_REPO_TAG_NAME)-win-$(PLATFORM) 45 | type: zip 46 | 47 | deploy: 48 | - provider: GitHub 49 | artifact: /.*\.zip/ 50 | draft: false 51 | prerelease: true 52 | auth_token: $(PREBUILD_GITHUB_TOKEN) 53 | on: 54 | appveyor_repo_tag: true 55 | nodejs_version: "12" 56 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'targets': [{ 3 | 'target_name': 'ffi_bindings', 4 | 'sources': [ 5 | 'src/ffi.cc', 6 | 'src/callback_info.cc', 7 | 'src/threaded_callback_invokation.cc' 8 | ], 9 | 'include_dirs': [ 10 | " 2 | 3 | * configure.in: Add in AC_PREREQ(2.13) 4 | 5 | 2003-02-20 Alexandre Oliva 6 | 7 | * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to 8 | config.status. 9 | * configure: Rebuilt. 10 | 11 | 2002-01-27 Alexandre Oliva 12 | 13 | * configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST. 14 | Remove USE_LIBDIR conditional. 15 | * Makefile.am (toolexecdir, toolexeclibdir): Don't override. 16 | * Makefile.in, configure: Rebuilt. 17 | 18 | Mon Aug 9 18:33:38 1999 Rainer Orth 19 | 20 | * include/Makefile.in: Rebuilt. 21 | * Makefile.in: Rebuilt 22 | * Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native 23 | builds. 24 | Use USE_LIBDIR. 25 | 26 | * configure: Rebuilt. 27 | * configure.in (USE_LIBDIR): Define for native builds. 28 | Use lowercase in configure --help explanations. 29 | 30 | 1999-08-08 Anthony Green 31 | 32 | * include/ffi.h.in (FFI_FN): Remove `...'. 33 | 34 | 1999-08-08 Anthony Green 35 | 36 | * Makefile.in: Rebuilt. 37 | * Makefile.am (AM_CFLAGS): Compile with -fexceptions. 38 | 39 | * src/x86/sysv.S: Add exception handling metadata. 40 | 41 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/LICENSE: -------------------------------------------------------------------------------- 1 | libffi - Copyright (c) 1996-2019 Anthony Green, Red Hat, Inc and others. 2 | See source files for details. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | ``Software''), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec autoreconf -v -i 3 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/closure.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Acts like puts with the file given at time of enclosure. */ 5 | void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], 6 | FILE *stream) 7 | { 8 | *ret = fputs(*(char **)args[0], stream); 9 | } 10 | 11 | int main() 12 | { 13 | ffi_cif cif; 14 | ffi_type *args[1]; 15 | ffi_closure *closure; 16 | 17 | int (*bound_puts)(char *); 18 | int rc; 19 | 20 | /* Allocate closure and bound_puts */ 21 | closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); 22 | 23 | if (closure) 24 | { 25 | /* Initialize the argument info vectors */ 26 | args[0] = &ffi_type_pointer; 27 | 28 | /* Initialize the cif */ 29 | if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 30 | &ffi_type_uint, args) == FFI_OK) 31 | { 32 | /* Initialize the closure, setting stream to stdout */ 33 | if (ffi_prep_closure_loc(closure, &cif, puts_binding, 34 | stdout, bound_puts) == FFI_OK) 35 | { 36 | rc = bound_puts("Hello World!"); 37 | /* rc now holds the result of the call to fputs */ 38 | } 39 | } 40 | } 41 | 42 | /* Deallocate both closure, and bound_puts */ 43 | ffi_closure_free(closure); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/config/README: -------------------------------------------------------------------------------- 1 | 2 | to generate config *.h files for a given platform+arch, run the command: 3 | 4 | $ ./configure --enable-static --disable-shared --disable-builddir --with-pic 5 | 6 | then copy over these files into "config/<(platform)/<(arch)": 7 | 8 | - fficonfig.h 9 | - include/ffi.h 10 | - include/ffitarget.h 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/config/linux/arm/flags.txt: -------------------------------------------------------------------------------- 1 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUILDING -g -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -Wall -fexceptions -MT src/prep_cif.lo -MD -MP -MF src/.deps/prep_cif.Tpo -c src/prep_cif.c -fPIC -DPIC -o src/prep_cif.o 2 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUILDING -g -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -Wall -fexceptions -MT src/types.lo -MD -MP -MF src/.deps/types.Tpo -c src/types.c -fPIC -DPIC -o src/types.o 3 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUILDING -g -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -Wall -fexceptions -MT src/raw_api.lo -MD -MP -MF src/.deps/raw_api.Tpo -c src/raw_api.c -fPIC -DPIC -o src/raw_api.o 4 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUILDING -g -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -Wall -fexceptions -MT src/java_raw_api.lo -MD -MP -MF src/.deps/java_raw_api.Tpo -c src/java_raw_api.c -fPIC -DPIC -o src/java_raw_api.o 5 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUIL -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/config/linux/arm64/flags.txt: -------------------------------------------------------------------------------- 1 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUILDING -g -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -Wall -fexceptions -MT src/prep_cif.lo -MD -MP -MF src/.deps/prep_cif.Tpo -c src/prep_cif.c -fPIC -DPIC -o src/prep_cif.o 2 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUILDING -g -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -Wall -fexceptions -MT src/types.lo -MD -MP -MF src/.deps/types.Tpo -c src/types.c -fPIC -DPIC -o src/types.o 3 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUILDING -g -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -Wall -fexceptions -MT src/raw_api.lo -MD -MP -MF src/.deps/raw_api.Tpo -c src/raw_api.c -fPIC -DPIC -o src/raw_api.o 4 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUILDING -g -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -Wall -fexceptions -MT src/java_raw_api.lo -MD -MP -MF src/.deps/java_raw_api.Tpo -c src/java_raw_api.c -fPIC -DPIC -o src/java_raw_api.o 5 | libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -DFFI_BUIL -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/doc/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this with automake to create Makefile.in 2 | 3 | info_TEXINFOS = libffi.texi 4 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/doc/stamp-vti: -------------------------------------------------------------------------------- 1 | @set UPDATED 5 February 2021 2 | @set UPDATED-MONTH February 2021 3 | @set EDITION 3.3 4 | @set VERSION 3.3 5 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/doc/version.texi: -------------------------------------------------------------------------------- 1 | @set UPDATED 5 February 2021 2 | @set UPDATED-MONTH February 2021 3 | @set EDITION 3.3 4 | @set VERSION 3.3 5 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/include/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this with automake to create Makefile.in 2 | 3 | AUTOMAKE_OPTIONS=foreign 4 | 5 | DISTCLEANFILES=ffitarget.h 6 | noinst_HEADERS=ffi_common.h ffi_cfi.h 7 | EXTRA_DIST=ffi.h.in 8 | 9 | nodist_include_HEADERS = ffi.h ffitarget.h 10 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/libffi.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | toolexeclibdir=@toolexeclibdir@ 5 | includedir=@includedir@ 6 | 7 | Name: @PACKAGE_NAME@ 8 | Description: Library supporting Foreign Function Interfaces 9 | Version: @PACKAGE_VERSION@ 10 | Libs: -L${toolexeclibdir} -lffi 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/libtool-version: -------------------------------------------------------------------------------- 1 | # This file is used to maintain libtool version info for libffi. See 2 | # the libtool manual to understand the meaning of the fields. This is 3 | # a separate file so that version updates don't involve re-running 4 | # automake. 5 | # 6 | # Here are a set of rules to help you update your library version 7 | # information: 8 | # 9 | # 1. Start with version information of `0:0:0' for each libtool library. 10 | # 11 | # 2. Update the version information only immediately before a public 12 | # release of your software. More frequent updates are unnecessary, 13 | # and only guarantee that the current interface number gets larger 14 | # faster. 15 | # 16 | # 3. If the library source code has changed at all since the last 17 | # update, then increment revision (`c:r:a' becomes `c:r+1:a'). 18 | # 19 | # 4. If any interfaces have been added, removed, or changed since the 20 | # last update, increment current, and set revision to 0. 21 | # 22 | # 5. If any interfaces have been added since the last public release, 23 | # then increment age. 24 | # 25 | # 6. If any interfaces have been removed since the last public 26 | # release, then set age to 0. 27 | # 28 | # CURRENT:REVISION:AGE 29 | 8:0:1 30 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/m4/asmcfi.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([GCC_AS_CFI_PSEUDO_OP], 2 | [AC_CACHE_CHECK([assembler .cfi pseudo-op support], 3 | gcc_cv_as_cfi_pseudo_op, [ 4 | gcc_cv_as_cfi_pseudo_op=unknown 5 | AC_TRY_COMPILE([asm (".cfi_sections\n\t.cfi_startproc\n\t.cfi_endproc");],, 6 | [gcc_cv_as_cfi_pseudo_op=yes], 7 | [gcc_cv_as_cfi_pseudo_op=no]) 8 | ]) 9 | if test "x$gcc_cv_as_cfi_pseudo_op" = xyes; then 10 | AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1, 11 | [Define if your assembler supports .cfi_* directives.]) 12 | fi 13 | ]) 14 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/m4/ax_require_defined.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_require_defined.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_REQUIRE_DEFINED(MACRO) 8 | # 9 | # DESCRIPTION 10 | # 11 | # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have 12 | # been defined and thus are available for use. This avoids random issues 13 | # where a macro isn't expanded. Instead the configure script emits a 14 | # non-fatal: 15 | # 16 | # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found 17 | # 18 | # It's like AC_REQUIRE except it doesn't expand the required macro. 19 | # 20 | # Here's an example: 21 | # 22 | # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) 23 | # 24 | # LICENSE 25 | # 26 | # Copyright (c) 2014 Mike Frysinger 27 | # 28 | # Copying and distribution of this file, with or without modification, are 29 | # permitted in any medium without royalty provided the copyright notice 30 | # and this notice are preserved. This file is offered as-is, without any 31 | # warranty. 32 | 33 | #serial 2 34 | 35 | AC_DEFUN([AX_REQUIRE_DEFINED], [dnl 36 | m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) 37 | ])dnl AX_REQUIRE_DEFINED 38 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 4179 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.6]) 16 | m4_define([LT_PACKAGE_REVISION], [2.4.6]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.6' 20 | macro_revision='2.4.6' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/man/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this with automake to create Makefile.in 2 | 3 | AUTOMAKE_OPTIONS=foreign 4 | 5 | EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 6 | 7 | man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 8 | 9 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/man/ffi.3: -------------------------------------------------------------------------------- 1 | .Dd February 15, 2008 2 | .Dt FFI 3 3 | .Sh NAME 4 | .Nm FFI 5 | .Nd Foreign Function Interface 6 | .Sh LIBRARY 7 | libffi, -lffi 8 | .Sh SYNOPSIS 9 | .In ffi.h 10 | .Ft ffi_status 11 | .Fo ffi_prep_cif 12 | .Fa "ffi_cif *cif" 13 | .Fa "ffi_abi abi" 14 | .Fa "unsigned int nargs" 15 | .Fa "ffi_type *rtype" 16 | .Fa "ffi_type **atypes" 17 | .Fc 18 | .Ft void 19 | .Fo ffi_prep_cif_var 20 | .Fa "ffi_cif *cif" 21 | .Fa "ffi_abi abi" 22 | .Fa "unsigned int nfixedargs" 23 | .Fa "unsigned int ntotalargs" 24 | .Fa "ffi_type *rtype" 25 | .Fa "ffi_type **atypes" 26 | .Fc 27 | .Ft void 28 | .Fo ffi_call 29 | .Fa "ffi_cif *cif" 30 | .Fa "void (*fn)(void)" 31 | .Fa "void *rvalue" 32 | .Fa "void **avalue" 33 | .Fc 34 | .Sh DESCRIPTION 35 | The foreign function interface provides a mechanism by which a function can 36 | generate a call to another function at runtime without requiring knowledge of 37 | the called function's interface at compile time. 38 | .Sh SEE ALSO 39 | .Xr ffi_prep_cif 3 , 40 | .Xr ffi_prep_cif_var 3 , 41 | .Xr ffi_call 3 42 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/man/ffi_prep_cif.3: -------------------------------------------------------------------------------- 1 | .Dd February 15, 2008 2 | .Dt ffi_prep_cif 3 3 | .Sh NAME 4 | .Nm ffi_prep_cif 5 | .Nd Prepare a 6 | .Nm ffi_cif 7 | structure for use with 8 | .Nm ffi_call 9 | . 10 | .Sh SYNOPSIS 11 | .In ffi.h 12 | .Ft ffi_status 13 | .Fo ffi_prep_cif 14 | .Fa "ffi_cif *cif" 15 | .Fa "ffi_abi abi" 16 | .Fa "unsigned int nargs" 17 | .Fa "ffi_type *rtype" 18 | .Fa "ffi_type **atypes" 19 | .Fc 20 | .Sh DESCRIPTION 21 | The 22 | .Nm ffi_prep_cif 23 | function prepares a 24 | .Nm ffi_cif 25 | structure for use with 26 | .Nm ffi_call 27 | . 28 | .Fa abi 29 | specifies a set of calling conventions to use. 30 | .Fa atypes 31 | is an array of 32 | .Fa nargs 33 | pointers to 34 | .Nm ffi_type 35 | structs that describe the data type, size and alignment of each argument. 36 | .Fa rtype 37 | points to an 38 | .Nm ffi_type 39 | that describes the data type, size and alignment of the 40 | return value. Note that to call a variadic function 41 | .Nm ffi_prep_cif_var 42 | must be used instead. 43 | .Sh RETURN VALUES 44 | Upon successful completion, 45 | .Nm ffi_prep_cif 46 | returns 47 | .Nm FFI_OK . 48 | It will return 49 | .Nm FFI_BAD_TYPEDEF 50 | if 51 | .Fa cif 52 | is 53 | .Nm NULL 54 | or 55 | .Fa atypes 56 | or 57 | .Fa rtype 58 | is malformed. If 59 | .Fa abi 60 | does not refer to a valid ABI, 61 | .Nm FFI_BAD_ABI 62 | will be returned. Available ABIs are 63 | defined in 64 | .Nm . 65 | .Sh SEE ALSO 66 | .Xr ffi 3 , 67 | .Xr ffi_call 3 , 68 | .Xr ffi_prep_cif_var 3 69 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/preprocess_asm.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cl /nologo /EP /I%1 /I%2 /DPIC /DFFI_BUILDING /DHAVECONFIG_H %3 > %4 4 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/src/alpha/internal.h: -------------------------------------------------------------------------------- 1 | #define ALPHA_ST_VOID 0 2 | #define ALPHA_ST_INT 1 3 | #define ALPHA_ST_FLOAT 2 4 | #define ALPHA_ST_DOUBLE 3 5 | #define ALPHA_ST_CPLXF 4 6 | #define ALPHA_ST_CPLXD 5 7 | 8 | #define ALPHA_LD_VOID 0 9 | #define ALPHA_LD_INT64 1 10 | #define ALPHA_LD_INT32 2 11 | #define ALPHA_LD_UINT16 3 12 | #define ALPHA_LD_SINT16 4 13 | #define ALPHA_LD_UINT8 5 14 | #define ALPHA_LD_SINT8 6 15 | #define ALPHA_LD_FLOAT 7 16 | #define ALPHA_LD_DOUBLE 8 17 | #define ALPHA_LD_CPLXF 9 18 | #define ALPHA_LD_CPLXD 10 19 | 20 | #define ALPHA_ST_SHIFT 0 21 | #define ALPHA_LD_SHIFT 8 22 | #define ALPHA_RET_IN_MEM 0x10000 23 | #define ALPHA_FLAGS(S, L) (((L) << ALPHA_LD_SHIFT) | (S)) 24 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/src/arm/internal.h: -------------------------------------------------------------------------------- 1 | #define ARM_TYPE_VFP_S 0 2 | #define ARM_TYPE_VFP_D 1 3 | #define ARM_TYPE_VFP_N 2 4 | #define ARM_TYPE_INT64 3 5 | #define ARM_TYPE_INT 4 6 | #define ARM_TYPE_VOID 5 7 | #define ARM_TYPE_STRUCT 6 8 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/src/s390/internal.h: -------------------------------------------------------------------------------- 1 | /* If these values change, sysv.S must be adapted! */ 2 | #define FFI390_RET_DOUBLE 0 3 | #define FFI390_RET_FLOAT 1 4 | #define FFI390_RET_INT64 2 5 | #define FFI390_RET_INT32 3 6 | #define FFI390_RET_VOID 4 7 | 8 | #define FFI360_RET_MASK 7 9 | #define FFI390_RET_IN_MEM 8 10 | 11 | #define FFI390_RET_STRUCT (FFI390_RET_VOID | FFI390_RET_IN_MEM) 12 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/src/sparc/internal.h: -------------------------------------------------------------------------------- 1 | #define SPARC_RET_VOID 0 2 | #define SPARC_RET_STRUCT 1 3 | #define SPARC_RET_UINT8 2 4 | #define SPARC_RET_SINT8 3 5 | #define SPARC_RET_UINT16 4 6 | #define SPARC_RET_SINT16 5 7 | #define SPARC_RET_UINT32 6 8 | #define SP_V9_RET_SINT32 7 /* v9 only */ 9 | #define SP_V8_RET_CPLX16 7 /* v8 only */ 10 | #define SPARC_RET_INT64 8 11 | #define SPARC_RET_INT128 9 12 | 13 | /* Note that F_7 is missing, and is handled by SPARC_RET_STRUCT. */ 14 | #define SPARC_RET_F_8 10 15 | #define SPARC_RET_F_6 11 16 | #define SPARC_RET_F_4 12 17 | #define SPARC_RET_F_2 13 18 | #define SP_V9_RET_F_3 14 /* v9 only */ 19 | #define SP_V8_RET_CPLX8 14 /* v8 only */ 20 | #define SPARC_RET_F_1 15 21 | 22 | #define SPARC_FLAG_RET_MASK 15 23 | #define SPARC_FLAG_RET_IN_MEM 32 24 | #define SPARC_FLAG_FP_ARGS 64 25 | 26 | #define SPARC_SIZEMASK_SHIFT 8 27 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/src/x86/asmnames.h: -------------------------------------------------------------------------------- 1 | #ifndef ASMNAMES_H 2 | #define ASMNAMES_H 3 | 4 | #define C2(X, Y) X ## Y 5 | #define C1(X, Y) C2(X, Y) 6 | #ifdef __USER_LABEL_PREFIX__ 7 | # define C(X) C1(__USER_LABEL_PREFIX__, X) 8 | #else 9 | # define C(X) X 10 | #endif 11 | 12 | #ifdef __APPLE__ 13 | # define L(X) C1(L, X) 14 | #else 15 | # define L(X) C1(.L, X) 16 | #endif 17 | 18 | #if defined(__ELF__) && defined(__PIC__) 19 | # define PLT(X) X@PLT 20 | #else 21 | # define PLT(X) X 22 | #endif 23 | 24 | #ifdef __ELF__ 25 | # define ENDF(X) .type X,@function; .size X, . - X 26 | #else 27 | # define ENDF(X) 28 | #endif 29 | 30 | #endif /* ASMNAMES_H */ 31 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/src/x86/internal.h: -------------------------------------------------------------------------------- 1 | #define X86_RET_FLOAT 0 2 | #define X86_RET_DOUBLE 1 3 | #define X86_RET_LDOUBLE 2 4 | #define X86_RET_SINT8 3 5 | #define X86_RET_SINT16 4 6 | #define X86_RET_UINT8 5 7 | #define X86_RET_UINT16 6 8 | #define X86_RET_INT64 7 9 | #define X86_RET_INT32 8 10 | #define X86_RET_VOID 9 11 | #define X86_RET_STRUCTPOP 10 12 | #define X86_RET_STRUCTARG 11 13 | #define X86_RET_STRUCT_1B 12 14 | #define X86_RET_STRUCT_2B 13 15 | #define X86_RET_UNUSED14 14 16 | #define X86_RET_UNUSED15 15 17 | 18 | #define X86_RET_TYPE_MASK 15 19 | #define X86_RET_POP_SHIFT 4 20 | 21 | #define R_EAX 0 22 | #define R_EDX 1 23 | #define R_ECX 2 24 | 25 | #ifdef __PCC__ 26 | # define HAVE_FASTCALL 0 27 | #else 28 | # define HAVE_FASTCALL 1 29 | #endif 30 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/src/x86/internal64.h: -------------------------------------------------------------------------------- 1 | #define UNIX64_RET_VOID 0 2 | #define UNIX64_RET_UINT8 1 3 | #define UNIX64_RET_UINT16 2 4 | #define UNIX64_RET_UINT32 3 5 | #define UNIX64_RET_SINT8 4 6 | #define UNIX64_RET_SINT16 5 7 | #define UNIX64_RET_SINT32 6 8 | #define UNIX64_RET_INT64 7 9 | #define UNIX64_RET_XMM32 8 10 | #define UNIX64_RET_XMM64 9 11 | #define UNIX64_RET_X87 10 12 | #define UNIX64_RET_X87_2 11 13 | #define UNIX64_RET_ST_XMM0_RAX 12 14 | #define UNIX64_RET_ST_RAX_XMM0 13 15 | #define UNIX64_RET_ST_XMM0_XMM1 14 16 | #define UNIX64_RET_ST_RAX_RDX 15 17 | 18 | #define UNIX64_RET_LAST 15 19 | 20 | #define UNIX64_FLAG_RET_IN_MEM (1 << 10) 21 | #define UNIX64_FLAG_XMM_ARGS (1 << 11) 22 | #define UNIX64_SIZE_SHIFT 12 23 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/stamp-h.in: -------------------------------------------------------------------------------- 1 | timestamp 2 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | ffi_cif cif; 7 | ffi_type *args[1]; 8 | void *values[1]; 9 | char *s; 10 | int rc; 11 | 12 | /* Initialize the argument info vectors */ 13 | args[0] = &ffi_type_pointer; 14 | values[0] = &s; 15 | 16 | /* Initialize the cif */ 17 | if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 18 | &ffi_type_uint, args) == FFI_OK) 19 | { 20 | s = "Hello World!"; 21 | ffi_call(&cif, puts, &rc, values); 22 | /* rc now holds the result of the call to puts */ 23 | 24 | /* values holds a pointer to the function's arg, so to 25 | call puts() again all we need to do is change the 26 | value of s */ 27 | s = "This is cool!"; 28 | ffi_call(&cif, puts, &rc, values); 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/config/default.exp: -------------------------------------------------------------------------------- 1 | load_lib "standard.exp" 2 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/align_mixed.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check for proper argument alignment. 3 | Limitations: none. 4 | PR: none. 5 | Originator: (from many_win32.c) */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static float ABI_ATTR align_arguments(int i1, 12 | double f2, 13 | int i3, 14 | double f4) 15 | { 16 | return i1+f2+i3+f4; 17 | } 18 | 19 | int main(void) 20 | { 21 | ffi_cif cif; 22 | ffi_type *args[4] = { 23 | &ffi_type_sint, 24 | &ffi_type_double, 25 | &ffi_type_sint, 26 | &ffi_type_double 27 | }; 28 | double fa[2] = {1,2}; 29 | int ia[2] = {1,2}; 30 | void *values[4] = {&ia[0], &fa[0], &ia[1], &fa[1]}; 31 | float f, ff; 32 | 33 | /* Initialize the cif */ 34 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 4, 35 | &ffi_type_float, args) == FFI_OK); 36 | 37 | ff = align_arguments(ia[0], fa[0], ia[1], fa[1]); 38 | 39 | ffi_call(&cif, FFI_FN(align_arguments), &f, values); 40 | 41 | if (f == ff) 42 | printf("align arguments tests ok!\n"); 43 | else 44 | CHECK(0); 45 | exit(0); 46 | } 47 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/align_stdcall.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check for proper argument alignment. 3 | Limitations: none. 4 | PR: none. 5 | Originator: (from many_win32.c) */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static float ABI_ATTR align_arguments(int i1, 12 | double f2, 13 | int i3, 14 | double f4) 15 | { 16 | return i1+f2+i3+f4; 17 | } 18 | 19 | int main(void) 20 | { 21 | ffi_cif cif; 22 | ffi_type *args[4] = { 23 | &ffi_type_sint, 24 | &ffi_type_double, 25 | &ffi_type_sint, 26 | &ffi_type_double 27 | }; 28 | double fa[2] = {1,2}; 29 | int ia[2] = {1,2}; 30 | void *values[4] = {&ia[0], &fa[0], &ia[1], &fa[1]}; 31 | float f, ff; 32 | 33 | /* Initialize the cif */ 34 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 4, 35 | &ffi_type_float, args) == FFI_OK); 36 | 37 | ff = align_arguments(ia[0], fa[0], ia[1], fa[1]);; 38 | 39 | ffi_call(&cif, FFI_FN(align_arguments), &f, values); 40 | 41 | if (f == ff) 42 | printf("align arguments tests ok!\n"); 43 | else 44 | CHECK(0); 45 | exit(0); 46 | } 47 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/cls_double.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value double. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(double *)resp = *(double *)args[0]; 14 | 15 | printf("%f: %f\n",*(double *)args[0], 16 | *(double *)resp); 17 | } 18 | typedef double (*cls_ret_double)(double); 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | void *code; 24 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 25 | ffi_type * cl_arg_types[2]; 26 | double res; 27 | 28 | cl_arg_types[0] = &ffi_type_double; 29 | cl_arg_types[1] = NULL; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 33 | &ffi_type_double, cl_arg_types) == FFI_OK); 34 | 35 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); 36 | 37 | res = (*((cls_ret_double)code))(21474.789); 38 | /* { dg-output "21474.789000: 21474.789000" } */ 39 | printf("res: %.6f\n", res); 40 | /* { dg-output "\nres: 21474.789000" } */ 41 | 42 | exit(0); 43 | } 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/cls_float.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value float. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_float_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(float *)resp = *(float *)args[0]; 14 | 15 | printf("%g: %g\n",*(float *)args[0], 16 | *(float *)resp); 17 | } 18 | 19 | typedef float (*cls_ret_float)(float); 20 | 21 | int main (void) 22 | { 23 | ffi_cif cif; 24 | void *code; 25 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 26 | ffi_type * cl_arg_types[2]; 27 | float res; 28 | 29 | cl_arg_types[0] = &ffi_type_float; 30 | cl_arg_types[1] = NULL; 31 | 32 | /* Initialize the cif */ 33 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 34 | &ffi_type_float, cl_arg_types) == FFI_OK); 35 | 36 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code) == FFI_OK); 37 | res = ((((cls_ret_float)code)(-2122.12))); 38 | /* { dg-output "\\-2122.12: \\-2122.12" } */ 39 | printf("res: %.6f\n", res); 40 | /* { dg-output "\nres: \-2122.120117" } */ 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/cls_schar.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value schar. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20031108 */ 6 | 7 | 8 | 9 | /* { dg-do run } */ 10 | #include "ffitest.h" 11 | 12 | static void cls_ret_schar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 13 | void* userdata __UNUSED__) 14 | { 15 | *(ffi_arg*)resp = *(signed char *)args[0]; 16 | printf("%d: %d\n",*(signed char *)args[0], 17 | (int)*(ffi_arg *)(resp)); 18 | } 19 | typedef signed char (*cls_ret_schar)(signed char); 20 | 21 | int main (void) 22 | { 23 | ffi_cif cif; 24 | void *code; 25 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 26 | ffi_type * cl_arg_types[2]; 27 | signed char res; 28 | 29 | cl_arg_types[0] = &ffi_type_schar; 30 | cl_arg_types[1] = NULL; 31 | 32 | /* Initialize the cif */ 33 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 34 | &ffi_type_schar, cl_arg_types) == FFI_OK); 35 | 36 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code) == FFI_OK); 37 | 38 | res = (*((cls_ret_schar)code))(127); 39 | /* { dg-output "127: 127" } */ 40 | printf("res: %d\n", res); 41 | /* { dg-output "\nres: 127" } */ 42 | 43 | exit(0); 44 | } 45 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/cls_sint.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value sint32. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20031108 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_sint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg*)resp = *(signed int *)args[0]; 14 | printf("%d: %d\n",*(signed int *)args[0], 15 | (int)*(ffi_arg *)(resp)); 16 | } 17 | typedef signed int (*cls_ret_sint)(signed int); 18 | 19 | int main (void) 20 | { 21 | ffi_cif cif; 22 | void *code; 23 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 24 | ffi_type * cl_arg_types[2]; 25 | signed int res; 26 | 27 | cl_arg_types[0] = &ffi_type_sint; 28 | cl_arg_types[1] = NULL; 29 | 30 | /* Initialize the cif */ 31 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 32 | &ffi_type_sint, cl_arg_types) == FFI_OK); 33 | 34 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code) == FFI_OK); 35 | 36 | res = (*((cls_ret_sint)code))(65534); 37 | /* { dg-output "65534: 65534" } */ 38 | printf("res: %d\n",res); 39 | /* { dg-output "\nres: 65534" } */ 40 | 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/cls_sshort.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value sshort. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20031108 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_sshort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg*)resp = *(signed short *)args[0]; 14 | printf("%d: %d\n",*(signed short *)args[0], 15 | (int)*(ffi_arg *)(resp)); 16 | } 17 | typedef signed short (*cls_ret_sshort)(signed short); 18 | 19 | int main (void) 20 | { 21 | ffi_cif cif; 22 | void *code; 23 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 24 | ffi_type * cl_arg_types[2]; 25 | signed short res; 26 | 27 | cl_arg_types[0] = &ffi_type_sshort; 28 | cl_arg_types[1] = NULL; 29 | 30 | /* Initialize the cif */ 31 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 32 | &ffi_type_sshort, cl_arg_types) == FFI_OK); 33 | 34 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code) == FFI_OK); 35 | 36 | res = (*((cls_ret_sshort)code))(255); 37 | /* { dg-output "255: 255" } */ 38 | printf("res: %d\n",res); 39 | /* { dg-output "\nres: 255" } */ 40 | 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/cls_uchar.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value uchar. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_uchar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg*)resp = *(unsigned char *)args[0]; 14 | printf("%d: %d\n",*(unsigned char *)args[0], 15 | (int)*(ffi_arg *)(resp)); 16 | } 17 | typedef unsigned char (*cls_ret_uchar)(unsigned char); 18 | 19 | int main (void) 20 | { 21 | ffi_cif cif; 22 | void *code; 23 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 24 | ffi_type * cl_arg_types[2]; 25 | unsigned char res; 26 | 27 | cl_arg_types[0] = &ffi_type_uchar; 28 | cl_arg_types[1] = NULL; 29 | 30 | /* Initialize the cif */ 31 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 32 | &ffi_type_uchar, cl_arg_types) == FFI_OK); 33 | 34 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code) == FFI_OK); 35 | 36 | res = (*((cls_ret_uchar)code))(127); 37 | /* { dg-output "127: 127" } */ 38 | printf("res: %d\n",res); 39 | /* { dg-output "\nres: 127" } */ 40 | 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/cls_uint.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value uint. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_uint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg *)resp = *(unsigned int *)args[0]; 14 | 15 | printf("%d: %d\n",*(unsigned int *)args[0], 16 | (int)*(ffi_arg *)(resp)); 17 | } 18 | typedef unsigned int (*cls_ret_uint)(unsigned int); 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | void *code; 24 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 25 | ffi_type * cl_arg_types[2]; 26 | unsigned int res; 27 | 28 | cl_arg_types[0] = &ffi_type_uint; 29 | cl_arg_types[1] = NULL; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 33 | &ffi_type_uint, cl_arg_types) == FFI_OK); 34 | 35 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code) == FFI_OK); 36 | 37 | res = (*((cls_ret_uint)code))(2147483647); 38 | /* { dg-output "2147483647: 2147483647" } */ 39 | printf("res: %d\n",res); 40 | /* { dg-output "\nres: 2147483647" } */ 41 | 42 | exit(0); 43 | } 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/cls_ushort.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value ushort. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_ushort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg*)resp = *(unsigned short *)args[0]; 14 | 15 | printf("%d: %d\n",*(unsigned short *)args[0], 16 | (int)*(ffi_arg *)(resp)); 17 | } 18 | typedef unsigned short (*cls_ret_ushort)(unsigned short); 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | void *code; 24 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 25 | ffi_type * cl_arg_types[2]; 26 | unsigned short res; 27 | 28 | cl_arg_types[0] = &ffi_type_ushort; 29 | cl_arg_types[1] = NULL; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 33 | &ffi_type_ushort, cl_arg_types) == FFI_OK); 34 | 35 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code) == FFI_OK); 36 | 37 | res = (*((cls_ret_ushort)code))(65535); 38 | /* { dg-output "65535: 65535" } */ 39 | printf("res: %d\n",res); 40 | /* { dg-output "\nres: 65535" } */ 41 | 42 | exit(0); 43 | } 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/err_bad_abi.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_prep_cif, ffi_prep_closure 2 | Purpose: Test error return for bad ABIs. 3 | Limitations: none. 4 | PR: none. 5 | Originator: Blake Chaffin 6/6/2007 */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static void 12 | dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, 13 | void** args __UNUSED__, void* userdata __UNUSED__) 14 | {} 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | void *code; 20 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 21 | ffi_type* arg_types[1]; 22 | 23 | arg_types[0] = NULL; 24 | 25 | CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, 26 | arg_types) == FFI_BAD_ABI); 27 | 28 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, 29 | arg_types) == FFI_OK); 30 | 31 | cif.abi= 255; 32 | 33 | CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI); 34 | 35 | exit(0); 36 | } 37 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/err_bad_typedef.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_prep_cif 2 | Purpose: Test error return for bad typedefs. 3 | Limitations: none. 4 | PR: none. 5 | Originator: Blake Chaffin 6/6/2007 */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | int main (void) 12 | { 13 | ffi_cif cif; 14 | ffi_type* arg_types[1]; 15 | 16 | ffi_type badType = ffi_type_void; 17 | 18 | arg_types[0] = NULL; 19 | 20 | badType.size = 0; 21 | 22 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, 23 | arg_types) == FFI_BAD_TYPEDEF); 24 | 25 | exit(0); 26 | } 27 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/fastthis1_win32.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check fastcall fct call on X86_WIN32 systems. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static size_t __FASTCALL__ my_fastcall_f(char *s, float a) 12 | { 13 | return (size_t) ((int) strlen(s) + (int) a); 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | char *s; 23 | float v2; 24 | args[0] = &ffi_type_pointer; 25 | args[1] = &ffi_type_float; 26 | values[0] = (void*) &s; 27 | values[1] = (void*) &v2; 28 | 29 | /* Initialize the cif */ 30 | CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, 31 | &ffi_type_sint, args) == FFI_OK); 32 | 33 | s = "a"; 34 | v2 = 0.0; 35 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 36 | CHECK(rint == 1); 37 | 38 | s = "1234567"; 39 | v2 = -1.0; 40 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 41 | CHECK(rint == 6); 42 | 43 | s = "1234567890123456789012345"; 44 | v2 = 1.0; 45 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 46 | CHECK(rint == 26); 47 | 48 | printf("fastcall fct1 tests passed\n"); 49 | exit(0); 50 | } 51 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/fastthis2_win32.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check fastcall fct call on X86_WIN32 systems. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static size_t __FASTCALL__ my_fastcall_f(float a, char *s) 12 | { 13 | return (size_t) ((int) strlen(s) + (int) a); 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | char *s; 23 | float v2; 24 | args[1] = &ffi_type_pointer; 25 | args[0] = &ffi_type_float; 26 | values[1] = (void*) &s; 27 | values[0] = (void*) &v2; 28 | 29 | /* Initialize the cif */ 30 | CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, 31 | &ffi_type_sint, args) == FFI_OK); 32 | 33 | s = "a"; 34 | v2 = 0.0; 35 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 36 | CHECK(rint == 1); 37 | 38 | s = "1234567"; 39 | v2 = -1.0; 40 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 41 | CHECK(rint == 6); 42 | 43 | s = "1234567890123456789012345"; 44 | v2 = 1.0; 45 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 46 | CHECK(rint == 26); 47 | 48 | printf("fastcall fct2 tests passed\n"); 49 | exit(0); 50 | } 51 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/fastthis3_win32.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check fastcall f call on X86_WIN32 systems. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static size_t __FASTCALL__ my_fastcall_f(float a, char *s, int i) 12 | { 13 | return (size_t) ((int) strlen(s) + (int) a + i); 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | char *s; 23 | int v1; 24 | float v2; 25 | args[2] = &ffi_type_sint; 26 | args[1] = &ffi_type_pointer; 27 | args[0] = &ffi_type_float; 28 | values[2] = (void*) &v1; 29 | values[1] = (void*) &s; 30 | values[0] = (void*) &v2; 31 | 32 | /* Initialize the cif */ 33 | CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 3, 34 | &ffi_type_sint, args) == FFI_OK); 35 | 36 | s = "a"; 37 | v1 = 1; 38 | v2 = 0.0; 39 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 40 | CHECK(rint == 2); 41 | 42 | s = "1234567"; 43 | v2 = -1.0; 44 | v1 = -2; 45 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 46 | CHECK(rint == 4); 47 | 48 | s = "1234567890123456789012345"; 49 | v2 = 1.0; 50 | v1 = 2; 51 | ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); 52 | CHECK(rint == 28); 53 | 54 | printf("fastcall fct3 tests passed\n"); 55 | exit(0); 56 | } 57 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value float. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static int floating(int a, float b, double c, long double d) 12 | { 13 | int i; 14 | 15 | i = (int) ((float)a/b + ((float)c/(float)d)); 16 | 17 | return i; 18 | } 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | ffi_type *args[MAX_ARGS]; 24 | void *values[MAX_ARGS]; 25 | ffi_arg rint; 26 | 27 | float f; 28 | signed int si1; 29 | double d; 30 | long double ld; 31 | 32 | args[0] = &ffi_type_sint; 33 | values[0] = &si1; 34 | args[1] = &ffi_type_float; 35 | values[1] = &f; 36 | args[2] = &ffi_type_double; 37 | values[2] = &d; 38 | args[3] = &ffi_type_longdouble; 39 | values[3] = &ld; 40 | 41 | /* Initialize the cif */ 42 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 43 | &ffi_type_sint, args) == FFI_OK); 44 | 45 | si1 = 6; 46 | f = 3.14159; 47 | d = (double)1.0/(double)3.0; 48 | ld = 2.71828182846L; 49 | 50 | floating (si1, f, d, ld); 51 | 52 | ffi_call(&cif, FFI_FN(floating), &rint, values); 53 | 54 | printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld)); 55 | 56 | CHECK((int)rint == floating(si1, f, d, ld)); 57 | 58 | exit (0); 59 | } 60 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/float1.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value double. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | #include "float.h" 10 | 11 | #include 12 | 13 | typedef union 14 | { 15 | double d; 16 | unsigned char c[sizeof (double)]; 17 | } value_type; 18 | 19 | #define CANARY 0xba 20 | 21 | static double dblit(float f) 22 | { 23 | return f/3.0; 24 | } 25 | 26 | int main (void) 27 | { 28 | ffi_cif cif; 29 | ffi_type *args[MAX_ARGS]; 30 | void *values[MAX_ARGS]; 31 | float f; 32 | value_type result[2]; 33 | unsigned int i; 34 | 35 | args[0] = &ffi_type_float; 36 | values[0] = &f; 37 | 38 | /* Initialize the cif */ 39 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 40 | &ffi_type_double, args) == FFI_OK); 41 | 42 | f = 3.14159; 43 | 44 | /* Put a canary in the return array. This is a regression test for 45 | a buffer overrun. */ 46 | memset(result[1].c, CANARY, sizeof (double)); 47 | 48 | ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); 49 | 50 | /* These are not always the same!! Check for a reasonable delta */ 51 | 52 | CHECK(fabs(result[0].d - dblit(f)) < DBL_EPSILON); 53 | 54 | /* Check the canary. */ 55 | for (i = 0; i < sizeof (double); ++i) 56 | CHECK(result[1].c[i] == CANARY); 57 | 58 | exit(0); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/float4.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check denorm double value. 3 | Limitations: none. 4 | PR: PR26483. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | /* { dg-options "-mieee" { target alpha*-*-* } } */ 9 | 10 | #include "ffitest.h" 11 | #include "float.h" 12 | 13 | typedef union 14 | { 15 | double d; 16 | unsigned char c[sizeof (double)]; 17 | } value_type; 18 | 19 | #define CANARY 0xba 20 | 21 | static double dblit(double d) 22 | { 23 | return d; 24 | } 25 | 26 | int main (void) 27 | { 28 | ffi_cif cif; 29 | ffi_type *args[MAX_ARGS]; 30 | void *values[MAX_ARGS]; 31 | double d; 32 | value_type result[2]; 33 | unsigned int i; 34 | 35 | args[0] = &ffi_type_double; 36 | values[0] = &d; 37 | 38 | /* Initialize the cif */ 39 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 40 | &ffi_type_double, args) == FFI_OK); 41 | 42 | d = DBL_MIN / 2; 43 | 44 | /* Put a canary in the return array. This is a regression test for 45 | a buffer overrun. */ 46 | memset(result[1].c, CANARY, sizeof (double)); 47 | 48 | ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); 49 | 50 | /* The standard delta check doesn't work for denorms. Since we didn't do 51 | any arithmetic, we should get the original result back, and hence an 52 | exact check should be OK here. */ 53 | 54 | CHECK(result[0].d == dblit(d)); 55 | 56 | /* Check the canary. */ 57 | for (i = 0; i < sizeof (double); ++i) 58 | CHECK(result[1].c[i] == CANARY); 59 | 60 | exit(0); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/many.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value float, with many arguments 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | static float ABI_ATTR many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) 15 | { 16 | #if 0 17 | printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", 18 | (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, 19 | (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, 20 | (double) f11, (double) f12, (double) f13); 21 | #endif 22 | 23 | return f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13; 24 | } 25 | 26 | int main (void) 27 | { 28 | ffi_cif cif; 29 | ffi_type *args[13]; 30 | void *values[13]; 31 | float fa[13]; 32 | float f, ff; 33 | int i; 34 | 35 | for (i = 0; i < 13; i++) 36 | { 37 | args[i] = &ffi_type_float; 38 | values[i] = &fa[i]; 39 | fa[i] = (float) i; 40 | } 41 | 42 | /* Initialize the cif */ 43 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 13, 44 | &ffi_type_float, args) == FFI_OK); 45 | 46 | ffi_call(&cif, FFI_FN(many), &f, values); 47 | 48 | ff = many(fa[0], fa[1], 49 | fa[2], fa[3], 50 | fa[4], fa[5], 51 | fa[6], fa[7], 52 | fa[8], fa[9], 53 | fa[10],fa[11],fa[12]); 54 | 55 | if (fabs(f - ff) < FLT_EPSILON) 56 | exit(0); 57 | else 58 | abort(); 59 | } 60 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/many2.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check uint8_t arguments. 3 | Limitations: none. 4 | PR: PR45677. 5 | Originator: Dan Witte 20100916 */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | #define NARGS 7 12 | 13 | typedef unsigned char u8; 14 | 15 | #ifdef __GNUC__ 16 | __attribute__((noinline)) 17 | #endif 18 | uint8_t 19 | foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d, 20 | uint8_t e, uint8_t f, uint8_t g) 21 | { 22 | return a + b + c + d + e + f + g; 23 | } 24 | 25 | uint8_t ABI_ATTR 26 | bar (uint8_t a, uint8_t b, uint8_t c, uint8_t d, 27 | uint8_t e, uint8_t f, uint8_t g) 28 | { 29 | return foo (a, b, c, d, e, f, g); 30 | } 31 | 32 | int 33 | main (void) 34 | { 35 | ffi_type *ffitypes[NARGS]; 36 | int i; 37 | ffi_cif cif; 38 | ffi_arg result = 0; 39 | uint8_t args[NARGS]; 40 | void *argptrs[NARGS]; 41 | 42 | for (i = 0; i < NARGS; ++i) 43 | ffitypes[i] = &ffi_type_uint8; 44 | 45 | CHECK (ffi_prep_cif (&cif, ABI_NUM, NARGS, 46 | &ffi_type_uint8, ffitypes) == FFI_OK); 47 | 48 | for (i = 0; i < NARGS; ++i) 49 | { 50 | args[i] = i; 51 | argptrs[i] = &args[i]; 52 | } 53 | ffi_call (&cif, FFI_FN (bar), &result, argptrs); 54 | 55 | CHECK (result == 21); 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/many2_win32.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check stdcall many call on X86_WIN32 systems. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ 8 | 9 | #include "ffitest.h" 10 | #include 11 | 12 | static float __attribute__((fastcall)) fastcall_many(float f1, 13 | float f2, 14 | float f3, 15 | float f4, 16 | float f5, 17 | float f6, 18 | float f7, 19 | float f8, 20 | float f9, 21 | float f10, 22 | float f11, 23 | float f12, 24 | float f13) 25 | { 26 | return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); 27 | } 28 | 29 | int main (void) 30 | { 31 | ffi_cif cif; 32 | ffi_type *args[13]; 33 | void *values[13]; 34 | float fa[13]; 35 | float f, ff; 36 | unsigned long ul; 37 | 38 | for (ul = 0; ul < 13; ul++) 39 | { 40 | args[ul] = &ffi_type_float; 41 | values[ul] = &fa[ul]; 42 | fa[ul] = (float) ul; 43 | } 44 | 45 | /* Initialize the cif */ 46 | CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 13, 47 | &ffi_type_float, args) == FFI_OK); 48 | 49 | ff = fastcall_many(fa[0], fa[1], 50 | fa[2], fa[3], 51 | fa[4], fa[5], 52 | fa[6], fa[7], 53 | fa[8], fa[9], 54 | fa[10], fa[11], fa[12]); 55 | 56 | ffi_call(&cif, FFI_FN(fastcall_many), &f, values); 57 | 58 | if (f - ff < FLT_EPSILON) 59 | printf("fastcall many arg tests ok!\n"); 60 | else 61 | CHECK(0); 62 | exit(0); 63 | } 64 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/many_win32.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check stdcall many call on X86_WIN32 systems. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ 8 | 9 | #include "ffitest.h" 10 | #include 11 | 12 | static float __attribute__((stdcall)) stdcall_many(float f1, 13 | float f2, 14 | float f3, 15 | float f4, 16 | float f5, 17 | float f6, 18 | float f7, 19 | float f8, 20 | float f9, 21 | float f10, 22 | float f11, 23 | float f12, 24 | float f13) 25 | { 26 | return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); 27 | } 28 | 29 | int main (void) 30 | { 31 | ffi_cif cif; 32 | ffi_type *args[13]; 33 | void *values[13]; 34 | float fa[13]; 35 | float f, ff; 36 | unsigned long ul; 37 | 38 | for (ul = 0; ul < 13; ul++) 39 | { 40 | args[ul] = &ffi_type_float; 41 | values[ul] = &fa[ul]; 42 | fa[ul] = (float) ul; 43 | } 44 | 45 | /* Initialize the cif */ 46 | CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 13, 47 | &ffi_type_float, args) == FFI_OK); 48 | 49 | ff = stdcall_many(fa[0], fa[1], 50 | fa[2], fa[3], 51 | fa[4], fa[5], 52 | fa[6], fa[7], 53 | fa[8], fa[9], 54 | fa[10], fa[11], fa[12]); 55 | 56 | ffi_call(&cif, FFI_FN(stdcall_many), &f, values); 57 | 58 | if (f - ff < FLT_EPSILON) 59 | printf("stdcall many arg tests ok!\n"); 60 | else 61 | CHECK(0); 62 | exit(0); 63 | } 64 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/negint.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check that negative integers are passed correctly. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static int checking(int a, short b, signed char c) 12 | { 13 | 14 | return (a < 0 && b < 0 && c < 0); 15 | } 16 | 17 | int main (void) 18 | { 19 | ffi_cif cif; 20 | ffi_type *args[MAX_ARGS]; 21 | void *values[MAX_ARGS]; 22 | ffi_arg rint; 23 | 24 | signed int si; 25 | signed short ss; 26 | signed char sc; 27 | 28 | args[0] = &ffi_type_sint; 29 | values[0] = &si; 30 | args[1] = &ffi_type_sshort; 31 | values[1] = &ss; 32 | args[2] = &ffi_type_schar; 33 | values[2] = ≻ 34 | 35 | /* Initialize the cif */ 36 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, 37 | &ffi_type_sint, args) == FFI_OK); 38 | 39 | si = -6; 40 | ss = -12; 41 | sc = -1; 42 | 43 | checking (si, ss, sc); 44 | 45 | ffi_call(&cif, FFI_FN(checking), &rint, values); 46 | 47 | printf ("%d vs %d\n", (int)rint, checking (si, ss, sc)); 48 | 49 | CHECK(rint != 0); 50 | 51 | exit (0); 52 | } 53 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/offsets.c: -------------------------------------------------------------------------------- 1 | /* Area: Struct layout 2 | Purpose: Test ffi_get_struct_offsets 3 | Limitations: none. 4 | PR: none. 5 | Originator: Tom Tromey. */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | #include 10 | 11 | struct test_1 12 | { 13 | char c; 14 | float f; 15 | char c2; 16 | int i; 17 | }; 18 | 19 | int 20 | main (void) 21 | { 22 | ffi_type test_1_type; 23 | ffi_type *test_1_elements[5]; 24 | size_t test_1_offsets[4]; 25 | 26 | test_1_elements[0] = &ffi_type_schar; 27 | test_1_elements[1] = &ffi_type_float; 28 | test_1_elements[2] = &ffi_type_schar; 29 | test_1_elements[3] = &ffi_type_sint; 30 | test_1_elements[4] = NULL; 31 | 32 | test_1_type.size = 0; 33 | test_1_type.alignment = 0; 34 | test_1_type.type = FFI_TYPE_STRUCT; 35 | test_1_type.elements = test_1_elements; 36 | 37 | CHECK (ffi_get_struct_offsets (FFI_DEFAULT_ABI, &test_1_type, test_1_offsets) 38 | == FFI_OK); 39 | CHECK (test_1_type.size == sizeof (struct test_1)); 40 | CHECK (offsetof (struct test_1, c) == test_1_offsets[0]); 41 | CHECK (offsetof (struct test_1, f) == test_1_offsets[1]); 42 | CHECK (offsetof (struct test_1, c2) == test_1_offsets[2]); 43 | CHECK (offsetof (struct test_1, i) == test_1_offsets[3]); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/promotion.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Promotion test. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | static int promotion(signed char sc, signed short ss, 10 | unsigned char uc, unsigned short us) 11 | { 12 | int r = (int) sc + (int) ss + (int) uc + (int) us; 13 | 14 | return r; 15 | } 16 | 17 | int main (void) 18 | { 19 | ffi_cif cif; 20 | ffi_type *args[MAX_ARGS]; 21 | void *values[MAX_ARGS]; 22 | ffi_arg rint; 23 | signed char sc; 24 | unsigned char uc; 25 | signed short ss; 26 | unsigned short us; 27 | unsigned long ul; 28 | 29 | args[0] = &ffi_type_schar; 30 | args[1] = &ffi_type_sshort; 31 | args[2] = &ffi_type_uchar; 32 | args[3] = &ffi_type_ushort; 33 | values[0] = ≻ 34 | values[1] = &ss; 35 | values[2] = &uc; 36 | values[3] = &us; 37 | 38 | /* Initialize the cif */ 39 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 40 | &ffi_type_sint, args) == FFI_OK); 41 | 42 | us = 0; 43 | ul = 0; 44 | 45 | for (sc = (signed char) -127; 46 | sc <= (signed char) 120; sc += 1) 47 | for (ss = -30000; ss <= 30000; ss += 10000) 48 | for (uc = (unsigned char) 0; 49 | uc <= (unsigned char) 200; uc += 20) 50 | for (us = 0; us <= 60000; us += 10000) 51 | { 52 | ul++; 53 | ffi_call(&cif, FFI_FN(promotion), &rint, values); 54 | CHECK((int)rint == (signed char) sc + (signed short) ss + 55 | (unsigned char) uc + (unsigned short) us); 56 | } 57 | printf("%lu promotion tests run\n", ul); 58 | exit(0); 59 | } 60 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_dbl.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value double. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20050212 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static double return_dbl(double dbl) 11 | { 12 | printf ("%f\n", dbl); 13 | return 2 * dbl; 14 | } 15 | int main (void) 16 | { 17 | ffi_cif cif; 18 | ffi_type *args[MAX_ARGS]; 19 | void *values[MAX_ARGS]; 20 | double dbl, rdbl; 21 | 22 | args[0] = &ffi_type_double; 23 | values[0] = &dbl; 24 | 25 | /* Initialize the cif */ 26 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 27 | &ffi_type_double, args) == FFI_OK); 28 | 29 | for (dbl = -127.3; dbl < 127; dbl++) 30 | { 31 | ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); 32 | printf ("%f vs %f\n", rdbl, return_dbl(dbl)); 33 | CHECK(rdbl == 2 * dbl); 34 | } 35 | exit(0); 36 | } 37 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_dbl1.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value double. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20050212 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static double return_dbl(double dbl1, float fl2, unsigned int in3, double dbl4) 11 | { 12 | return dbl1 + fl2 + in3 + dbl4; 13 | } 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | double dbl1, dbl4, rdbl; 20 | float fl2; 21 | unsigned int in3; 22 | args[0] = &ffi_type_double; 23 | args[1] = &ffi_type_float; 24 | args[2] = &ffi_type_uint; 25 | args[3] = &ffi_type_double; 26 | values[0] = &dbl1; 27 | values[1] = &fl2; 28 | values[2] = &in3; 29 | values[3] = &dbl4; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 33 | &ffi_type_double, args) == FFI_OK); 34 | dbl1 = 127.0; 35 | fl2 = 128.0; 36 | in3 = 255; 37 | dbl4 = 512.7; 38 | 39 | ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); 40 | printf ("%f vs %f\n", rdbl, return_dbl(dbl1, fl2, in3, dbl4)); 41 | CHECK(rdbl == dbl1 + fl2 + in3 + dbl4); 42 | exit(0); 43 | } 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_dbl2.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value double. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20050212 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static double return_dbl(double dbl1, double dbl2, unsigned int in3, double dbl4) 11 | { 12 | return dbl1 + dbl2 + in3 + dbl4; 13 | } 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | double dbl1, dbl2, dbl4, rdbl; 20 | unsigned int in3; 21 | args[0] = &ffi_type_double; 22 | args[1] = &ffi_type_double; 23 | args[2] = &ffi_type_uint; 24 | args[3] = &ffi_type_double; 25 | values[0] = &dbl1; 26 | values[1] = &dbl2; 27 | values[2] = &in3; 28 | values[3] = &dbl4; 29 | 30 | /* Initialize the cif */ 31 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 32 | &ffi_type_double, args) == FFI_OK); 33 | dbl1 = 127.0; 34 | dbl2 = 128.0; 35 | in3 = 255; 36 | dbl4 = 512.7; 37 | 38 | ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); 39 | printf ("%f vs %f\n", rdbl, return_dbl(dbl1, dbl2, in3, dbl4)); 40 | CHECK(rdbl == dbl1 + dbl2 + in3 + dbl4); 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_fl.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value float. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20050212 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static float return_fl(float fl) 11 | { 12 | return 2 * fl; 13 | } 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | float fl, rfl; 20 | 21 | args[0] = &ffi_type_float; 22 | values[0] = &fl; 23 | 24 | /* Initialize the cif */ 25 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 26 | &ffi_type_float, args) == FFI_OK); 27 | 28 | for (fl = -127.0; fl < 127; fl++) 29 | { 30 | ffi_call(&cif, FFI_FN(return_fl), &rfl, values); 31 | printf ("%f vs %f\n", rfl, return_fl(fl)); 32 | CHECK(rfl == 2 * fl); 33 | } 34 | exit(0); 35 | } 36 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_fl1.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value float. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20050212 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static float return_fl(float fl1, float fl2) 11 | { 12 | return fl1 + fl2; 13 | } 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | float fl1, fl2, rfl; 20 | 21 | args[0] = &ffi_type_float; 22 | args[1] = &ffi_type_float; 23 | values[0] = &fl1; 24 | values[1] = &fl2; 25 | 26 | /* Initialize the cif */ 27 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, 28 | &ffi_type_float, args) == FFI_OK); 29 | fl1 = 127.0; 30 | fl2 = 128.0; 31 | 32 | ffi_call(&cif, FFI_FN(return_fl), &rfl, values); 33 | printf ("%f vs %f\n", rfl, return_fl(fl1, fl2)); 34 | CHECK(rfl == fl1 + fl2); 35 | exit(0); 36 | } 37 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_fl2.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value float. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20050212 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | /* Use volatile float to avoid false negative on ix86. See PR target/323. */ 11 | static float return_fl(float fl1, float fl2, float fl3, float fl4) 12 | { 13 | volatile float sum; 14 | 15 | sum = fl1 + fl2 + fl3 + fl4; 16 | return sum; 17 | } 18 | int main (void) 19 | { 20 | ffi_cif cif; 21 | ffi_type *args[MAX_ARGS]; 22 | void *values[MAX_ARGS]; 23 | float fl1, fl2, fl3, fl4, rfl; 24 | volatile float sum; 25 | 26 | args[0] = &ffi_type_float; 27 | args[1] = &ffi_type_float; 28 | args[2] = &ffi_type_float; 29 | args[3] = &ffi_type_float; 30 | values[0] = &fl1; 31 | values[1] = &fl2; 32 | values[2] = &fl3; 33 | values[3] = &fl4; 34 | 35 | /* Initialize the cif */ 36 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 37 | &ffi_type_float, args) == FFI_OK); 38 | fl1 = 127.0; 39 | fl2 = 128.0; 40 | fl3 = 255.1; 41 | fl4 = 512.7; 42 | 43 | ffi_call(&cif, FFI_FN(return_fl), &rfl, values); 44 | printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, fl3, fl4)); 45 | 46 | sum = fl1 + fl2 + fl3 + fl4; 47 | CHECK(rfl == sum); 48 | exit(0); 49 | } 50 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_fl3.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value float. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20050212 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static float return_fl(float fl1, float fl2, unsigned int in3, float fl4) 11 | { 12 | return fl1 + fl2 + in3 + fl4; 13 | } 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | float fl1, fl2, fl4, rfl; 20 | unsigned int in3; 21 | args[0] = &ffi_type_float; 22 | args[1] = &ffi_type_float; 23 | args[2] = &ffi_type_uint; 24 | args[3] = &ffi_type_float; 25 | values[0] = &fl1; 26 | values[1] = &fl2; 27 | values[2] = &in3; 28 | values[3] = &fl4; 29 | 30 | /* Initialize the cif */ 31 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 32 | &ffi_type_float, args) == FFI_OK); 33 | fl1 = 127.0; 34 | fl2 = 128.0; 35 | in3 = 255; 36 | fl4 = 512.7; 37 | 38 | ffi_call(&cif, FFI_FN(return_fl), &rfl, values); 39 | printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, in3, fl4)); 40 | CHECK(rfl == fl1 + fl2 + in3 + fl4); 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_ldl.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value long double. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20071113 */ 6 | /* { dg-do run } */ 7 | 8 | #include "ffitest.h" 9 | 10 | static long double return_ldl(long double ldl) 11 | { 12 | return 2*ldl; 13 | } 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | long double ldl, rldl; 20 | 21 | args[0] = &ffi_type_longdouble; 22 | values[0] = &ldl; 23 | 24 | /* Initialize the cif */ 25 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 26 | &ffi_type_longdouble, args) == FFI_OK); 27 | 28 | for (ldl = -127.0; ldl < 127.0; ldl++) 29 | { 30 | ffi_call(&cif, FFI_FN(return_ldl), &rldl, values); 31 | CHECK(rldl == 2 * ldl); 32 | } 33 | exit(0); 34 | } 35 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_ll.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value long long. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | static long long return_ll(long long ll) 10 | { 11 | return ll; 12 | } 13 | 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | long long rlonglong; 20 | long long ll; 21 | 22 | args[0] = &ffi_type_sint64; 23 | values[0] = ≪ 24 | 25 | /* Initialize the cif */ 26 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 27 | &ffi_type_sint64, args) == FFI_OK); 28 | 29 | for (ll = 0LL; ll < 100LL; ll++) 30 | { 31 | ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); 32 | CHECK(rlonglong == ll); 33 | } 34 | 35 | for (ll = 55555555555000LL; ll < 55555555555100LL; ll++) 36 | { 37 | ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); 38 | CHECK(rlonglong == ll); 39 | } 40 | exit(0); 41 | } 42 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_ll1.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check if long long are passed in the corresponding regs on ppc. 3 | Limitations: none. 4 | PR: 20104. 5 | Originator: 20050222 */ 6 | 7 | /* { dg-do run } */ 8 | /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ 9 | #include "ffitest.h" 10 | static long long return_ll(int ll0, long long ll1, int ll2) 11 | { 12 | return ll0 + ll1 + ll2; 13 | } 14 | 15 | int main (void) 16 | { 17 | ffi_cif cif; 18 | ffi_type *args[MAX_ARGS]; 19 | void *values[MAX_ARGS]; 20 | long long rlonglong; 21 | long long ll1; 22 | unsigned ll0, ll2; 23 | 24 | args[0] = &ffi_type_sint; 25 | args[1] = &ffi_type_sint64; 26 | args[2] = &ffi_type_sint; 27 | values[0] = &ll0; 28 | values[1] = &ll1; 29 | values[2] = &ll2; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, 33 | &ffi_type_sint64, args) == FFI_OK); 34 | 35 | ll0 = 11111111; 36 | ll1 = 11111111111000LL; 37 | ll2 = 11111111; 38 | 39 | ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); 40 | printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2); 41 | /* { dg-output "res: 11111133333222, 11111133333222" } */ 42 | exit(0); 43 | } 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_sc.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value signed char. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static signed char return_sc(signed char sc) 11 | { 12 | return sc; 13 | } 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | ffi_arg rint; 20 | signed char sc; 21 | 22 | args[0] = &ffi_type_schar; 23 | values[0] = ≻ 24 | 25 | /* Initialize the cif */ 26 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 27 | &ffi_type_schar, args) == FFI_OK); 28 | 29 | for (sc = (signed char) -127; 30 | sc < (signed char) 127; sc++) 31 | { 32 | ffi_call(&cif, FFI_FN(return_sc), &rint, values); 33 | CHECK((signed char)rint == sc); 34 | } 35 | exit(0); 36 | } 37 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_sl.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check if long as return type is handled correctly. 3 | Limitations: none. 4 | PR: none. 5 | */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | static long return_sl(long l1, long l2) 10 | { 11 | return l1 - l2; 12 | } 13 | 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | ffi_arg res; 20 | unsigned long l1, l2; 21 | 22 | args[0] = &ffi_type_slong; 23 | args[1] = &ffi_type_slong; 24 | values[0] = &l1; 25 | values[1] = &l2; 26 | 27 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, 28 | &ffi_type_slong, args) == FFI_OK); 29 | 30 | l1 = 1073741823L; 31 | l2 = 1073741824L; 32 | 33 | ffi_call(&cif, FFI_FN(return_sl), &res, values); 34 | printf("res: %ld, %ld\n", (long)res, l1 - l2); 35 | /* { dg-output "res: -1, -1" } */ 36 | 37 | exit(0); 38 | } 39 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_uc.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value unsigned char. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static unsigned char return_uc(unsigned char uc) 11 | { 12 | return uc; 13 | } 14 | 15 | int main (void) 16 | { 17 | ffi_cif cif; 18 | ffi_type *args[MAX_ARGS]; 19 | void *values[MAX_ARGS]; 20 | ffi_arg rint; 21 | 22 | unsigned char uc; 23 | 24 | args[0] = &ffi_type_uchar; 25 | values[0] = &uc; 26 | 27 | /* Initialize the cif */ 28 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 29 | &ffi_type_uchar, args) == FFI_OK); 30 | 31 | for (uc = (unsigned char) '\x00'; 32 | uc < (unsigned char) '\xff'; uc++) 33 | { 34 | ffi_call(&cif, FFI_FN(return_uc), &rint, values); 35 | CHECK((unsigned char)rint == uc); 36 | } 37 | exit(0); 38 | } 39 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/return_ul.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check if unsigned long as return type is handled correctly. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20060724 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | static unsigned long return_ul(unsigned long ul1, unsigned long ul2) 10 | { 11 | return ul1 + ul2; 12 | } 13 | 14 | int main (void) 15 | { 16 | ffi_cif cif; 17 | ffi_type *args[MAX_ARGS]; 18 | void *values[MAX_ARGS]; 19 | ffi_arg res; 20 | unsigned long ul1, ul2; 21 | 22 | args[0] = &ffi_type_ulong; 23 | args[1] = &ffi_type_ulong; 24 | values[0] = &ul1; 25 | values[1] = &ul2; 26 | 27 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, 28 | &ffi_type_ulong, args) == FFI_OK); 29 | 30 | ul1 = 1073741823L; 31 | ul2 = 1073741824L; 32 | 33 | ffi_call(&cif, FFI_FN(return_ul), &res, values); 34 | printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2); 35 | /* { dg-output "res: 2147483647, 2147483647" } */ 36 | 37 | exit(0); 38 | } 39 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/strlen.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check strlen function call. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static size_t ABI_ATTR my_strlen(char *s) 11 | { 12 | return (strlen(s)); 13 | } 14 | 15 | int main (void) 16 | { 17 | ffi_cif cif; 18 | ffi_type *args[MAX_ARGS]; 19 | void *values[MAX_ARGS]; 20 | ffi_arg rint; 21 | char *s; 22 | 23 | args[0] = &ffi_type_pointer; 24 | values[0] = (void*) &s; 25 | 26 | /* Initialize the cif */ 27 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, 28 | &ffi_type_sint, args) == FFI_OK); 29 | 30 | s = "a"; 31 | ffi_call(&cif, FFI_FN(my_strlen), &rint, values); 32 | CHECK(rint == 1); 33 | 34 | s = "1234567"; 35 | ffi_call(&cif, FFI_FN(my_strlen), &rint, values); 36 | CHECK(rint == 7); 37 | 38 | s = "1234567890123456789012345"; 39 | ffi_call(&cif, FFI_FN(my_strlen), &rint, values); 40 | CHECK(rint == 25); 41 | 42 | exit (0); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/strlen2.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check strlen function call with additional arguments. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static size_t ABI_ATTR my_f(char *s, float a) 12 | { 13 | return (size_t) ((int) strlen(s) + (int) a); 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | char *s; 23 | float v2; 24 | args[0] = &ffi_type_pointer; 25 | args[1] = &ffi_type_float; 26 | values[0] = (void*) &s; 27 | values[1] = (void*) &v2; 28 | 29 | /* Initialize the cif */ 30 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, 31 | &ffi_type_sint, args) == FFI_OK); 32 | 33 | s = "a"; 34 | v2 = 0.0; 35 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 36 | CHECK(rint == 1); 37 | 38 | s = "1234567"; 39 | v2 = -1.0; 40 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 41 | CHECK(rint == 6); 42 | 43 | s = "1234567890123456789012345"; 44 | v2 = 1.0; 45 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 46 | CHECK(rint == 26); 47 | 48 | exit(0); 49 | } 50 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/strlen2_win32.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check fastcall strlen call on X86_WIN32 systems. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static size_t __FASTCALL__ my_fastcall_strlen(char *s) 12 | { 13 | return (strlen(s)); 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | char *s; 23 | args[0] = &ffi_type_pointer; 24 | values[0] = (void*) &s; 25 | 26 | /* Initialize the cif */ 27 | CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, 28 | &ffi_type_sint, args) == FFI_OK); 29 | 30 | s = "a"; 31 | ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); 32 | CHECK(rint == 1); 33 | 34 | s = "1234567"; 35 | ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); 36 | CHECK(rint == 7); 37 | 38 | s = "1234567890123456789012345"; 39 | ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); 40 | CHECK(rint == 25); 41 | 42 | printf("fastcall strlen tests passed\n"); 43 | exit(0); 44 | } 45 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/strlen3.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check strlen function call with additional arguments. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static size_t ABI_ATTR my_f(float a, char *s) 12 | { 13 | return (size_t) ((int) strlen(s) + (int) a); 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | char *s; 23 | float v2; 24 | args[1] = &ffi_type_pointer; 25 | args[0] = &ffi_type_float; 26 | values[1] = (void*) &s; 27 | values[0] = (void*) &v2; 28 | 29 | /* Initialize the cif */ 30 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, 31 | &ffi_type_sint, args) == FFI_OK); 32 | 33 | s = "a"; 34 | v2 = 0.0; 35 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 36 | CHECK(rint == 1); 37 | 38 | s = "1234567"; 39 | v2 = -1.0; 40 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 41 | CHECK(rint == 6); 42 | 43 | s = "1234567890123456789012345"; 44 | v2 = 1.0; 45 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 46 | CHECK(rint == 26); 47 | 48 | exit(0); 49 | } 50 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/strlen4.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check strlen function call with additional arguments. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static size_t ABI_ATTR my_f(float a, char *s, int i) 12 | { 13 | return (size_t) ((int) strlen(s) + (int) a + i); 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | char *s; 23 | int v1; 24 | float v2; 25 | args[2] = &ffi_type_sint; 26 | args[1] = &ffi_type_pointer; 27 | args[0] = &ffi_type_float; 28 | values[2] = (void*) &v1; 29 | values[1] = (void*) &s; 30 | values[0] = (void*) &v2; 31 | 32 | /* Initialize the cif */ 33 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 3, 34 | &ffi_type_sint, args) == FFI_OK); 35 | 36 | s = "a"; 37 | v1 = 1; 38 | v2 = 0.0; 39 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 40 | CHECK(rint == 2); 41 | 42 | s = "1234567"; 43 | v2 = -1.0; 44 | v1 = -2; 45 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 46 | CHECK(rint == 4); 47 | 48 | s = "1234567890123456789012345"; 49 | v2 = 1.0; 50 | v1 = 2; 51 | ffi_call(&cif, FFI_FN(my_f), &rint, values); 52 | CHECK(rint == 28); 53 | 54 | exit(0); 55 | } 56 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/strlen_win32.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check stdcall strlen call on X86_WIN32 systems. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static size_t __attribute__((stdcall)) my_stdcall_strlen(char *s) 12 | { 13 | return (strlen(s)); 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | char *s; 23 | args[0] = &ffi_type_pointer; 24 | values[0] = (void*) &s; 25 | 26 | /* Initialize the cif */ 27 | CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 1, 28 | &ffi_type_sint, args) == FFI_OK); 29 | 30 | s = "a"; 31 | ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); 32 | CHECK(rint == 1); 33 | 34 | s = "1234567"; 35 | ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); 36 | CHECK(rint == 7); 37 | 38 | s = "1234567890123456789012345"; 39 | ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); 40 | CHECK(rint == 25); 41 | 42 | printf("stdcall strlen tests passed\n"); 43 | exit(0); 44 | } 45 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/struct10.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check structures. 3 | Limitations: none. 4 | PR: none. 5 | Originator: Sergei Trofimovich 6 | 7 | The test originally discovered in ruby's bindings 8 | for ffi in https://bugs.gentoo.org/634190 */ 9 | 10 | /* { dg-do run } */ 11 | #include "ffitest.h" 12 | 13 | struct s { 14 | int s32; 15 | float f32; 16 | signed char s8; 17 | }; 18 | 19 | struct s make_s(void) { 20 | struct s r; 21 | r.s32 = 0x1234; 22 | r.f32 = 7.0; 23 | r.s8 = 0x78; 24 | return r; 25 | } 26 | 27 | int main() { 28 | ffi_cif cif; 29 | struct s r; 30 | ffi_type rtype; 31 | ffi_type* s_fields[] = { 32 | &ffi_type_sint, 33 | &ffi_type_float, 34 | &ffi_type_schar, 35 | NULL, 36 | }; 37 | 38 | rtype.size = 0; 39 | rtype.alignment = 0, 40 | rtype.type = FFI_TYPE_STRUCT, 41 | rtype.elements = s_fields, 42 | 43 | r.s32 = 0xbad; 44 | r.f32 = 999.999; 45 | r.s8 = 0x51; 46 | 47 | // Here we emulate the following call: 48 | //r = make_s(); 49 | 50 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &rtype, NULL) == FFI_OK); 51 | ffi_call(&cif, FFI_FN(make_s), &r, NULL); 52 | 53 | CHECK(r.s32 == 0x1234); 54 | CHECK(r.f32 == 7.0); 55 | CHECK(r.s8 == 0x78); 56 | exit(0); 57 | } 58 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/struct3.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check structures. 3 | Limitations: none. 4 | PR: none. 5 | Originator: From the original ffitest.c */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | typedef struct 11 | { 12 | int si; 13 | } test_structure_3; 14 | 15 | static test_structure_3 ABI_ATTR struct3(test_structure_3 ts) 16 | { 17 | ts.si = -(ts.si*2); 18 | 19 | return ts; 20 | } 21 | 22 | int main (void) 23 | { 24 | ffi_cif cif; 25 | ffi_type *args[MAX_ARGS]; 26 | void *values[MAX_ARGS]; 27 | int compare_value; 28 | ffi_type ts3_type; 29 | ffi_type *ts3_type_elements[2]; 30 | 31 | test_structure_3 ts3_arg; 32 | test_structure_3 *ts3_result = 33 | (test_structure_3 *) malloc (sizeof(test_structure_3)); 34 | 35 | ts3_type.size = 0; 36 | ts3_type.alignment = 0; 37 | ts3_type.type = FFI_TYPE_STRUCT; 38 | ts3_type.elements = ts3_type_elements; 39 | ts3_type_elements[0] = &ffi_type_sint; 40 | ts3_type_elements[1] = NULL; 41 | 42 | args[0] = &ts3_type; 43 | values[0] = &ts3_arg; 44 | 45 | /* Initialize the cif */ 46 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, 47 | &ts3_type, args) == FFI_OK); 48 | 49 | ts3_arg.si = -123; 50 | compare_value = ts3_arg.si; 51 | 52 | ffi_call(&cif, FFI_FN(struct3), ts3_result, values); 53 | 54 | printf ("%d %d\n", ts3_result->si, -(compare_value*2)); 55 | 56 | CHECK(ts3_result->si == -(compare_value*2)); 57 | 58 | free (ts3_result); 59 | exit(0); 60 | } 61 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.call/uninitialized.c: -------------------------------------------------------------------------------- 1 | /* { dg-do run } */ 2 | #include "ffitest.h" 3 | 4 | typedef struct 5 | { 6 | unsigned char uc; 7 | double d; 8 | unsigned int ui; 9 | } test_structure_1; 10 | 11 | static test_structure_1 struct1(test_structure_1 ts) 12 | { 13 | ts.uc++; 14 | ts.d--; 15 | ts.ui++; 16 | 17 | return ts; 18 | } 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | ffi_type *args[MAX_ARGS]; 24 | void *values[MAX_ARGS]; 25 | ffi_type ts1_type; 26 | ffi_type *ts1_type_elements[4]; 27 | 28 | memset(&cif, 1, sizeof(cif)); 29 | ts1_type.size = 0; 30 | ts1_type.alignment = 0; 31 | ts1_type.type = FFI_TYPE_STRUCT; 32 | ts1_type.elements = ts1_type_elements; 33 | ts1_type_elements[0] = &ffi_type_uchar; 34 | ts1_type_elements[1] = &ffi_type_double; 35 | ts1_type_elements[2] = &ffi_type_uint; 36 | ts1_type_elements[3] = NULL; 37 | 38 | test_structure_1 ts1_arg; 39 | /* This is a hack to get a properly aligned result buffer */ 40 | test_structure_1 *ts1_result = 41 | (test_structure_1 *) malloc (sizeof(test_structure_1)); 42 | 43 | args[0] = &ts1_type; 44 | values[0] = &ts1_arg; 45 | 46 | /* Initialize the cif */ 47 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 48 | &ts1_type, args) == FFI_OK); 49 | 50 | ts1_arg.uc = '\x01'; 51 | ts1_arg.d = 3.14159; 52 | ts1_arg.ui = 555; 53 | 54 | ffi_call(&cif, FFI_FN(struct1), ts1_result, values); 55 | 56 | CHECK(ts1_result->ui == 556); 57 | CHECK(ts1_result->d == 3.14159 - 1); 58 | 59 | free (ts1_result); 60 | exit(0); 61 | } 62 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_double.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value double. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(double *)resp = *(double *)args[0]; 14 | 15 | printf("%f: %f\n",*(double *)args[0], 16 | *(double *)resp); 17 | } 18 | typedef double (*cls_ret_double)(double); 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | void *code; 24 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 25 | ffi_type * cl_arg_types[2]; 26 | double res; 27 | 28 | cl_arg_types[0] = &ffi_type_double; 29 | cl_arg_types[1] = NULL; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 33 | &ffi_type_double, cl_arg_types) == FFI_OK); 34 | 35 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); 36 | 37 | res = (*((cls_ret_double)code))(21474.789); 38 | /* { dg-output "21474.789000: 21474.789000" } */ 39 | printf("res: %.6f\n", res); 40 | /* { dg-output "\nres: 21474.789000" } */ 41 | 42 | exit(0); 43 | } 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_float.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value float. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_float_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(float *)resp = *(float *)args[0]; 14 | 15 | printf("%g: %g\n",*(float *)args[0], 16 | *(float *)resp); 17 | } 18 | 19 | typedef float (*cls_ret_float)(float); 20 | 21 | int main (void) 22 | { 23 | ffi_cif cif; 24 | void *code; 25 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 26 | ffi_type * cl_arg_types[2]; 27 | float res; 28 | 29 | cl_arg_types[0] = &ffi_type_float; 30 | cl_arg_types[1] = NULL; 31 | 32 | /* Initialize the cif */ 33 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 34 | &ffi_type_float, cl_arg_types) == FFI_OK); 35 | 36 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code) == FFI_OK); 37 | res = ((((cls_ret_float)code)(-2122.12))); 38 | /* { dg-output "\\-2122.12: \\-2122.12" } */ 39 | printf("res: %.6f\n", res); 40 | /* { dg-output "\nres: \-2122.120117" } */ 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_schar.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value schar. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20031108 */ 6 | 7 | 8 | 9 | /* { dg-do run } */ 10 | #include "ffitest.h" 11 | 12 | static void cls_ret_schar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 13 | void* userdata __UNUSED__) 14 | { 15 | *(ffi_arg*)resp = *(signed char *)args[0]; 16 | printf("%d: %d\n",*(signed char *)args[0], 17 | (int)*(ffi_arg *)(resp)); 18 | } 19 | typedef signed char (*cls_ret_schar)(signed char); 20 | 21 | int main (void) 22 | { 23 | ffi_cif cif; 24 | void *code; 25 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 26 | ffi_type * cl_arg_types[2]; 27 | signed char res; 28 | 29 | cl_arg_types[0] = &ffi_type_schar; 30 | cl_arg_types[1] = NULL; 31 | 32 | /* Initialize the cif */ 33 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 34 | &ffi_type_schar, cl_arg_types) == FFI_OK); 35 | 36 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code) == FFI_OK); 37 | 38 | res = (*((cls_ret_schar)code))(127); 39 | /* { dg-output "127: 127" } */ 40 | printf("res: %d\n", res); 41 | /* { dg-output "\nres: 127" } */ 42 | 43 | exit(0); 44 | } 45 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_sint.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value sint32. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20031108 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_sint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg*)resp = *(signed int *)args[0]; 14 | printf("%d: %d\n",*(signed int *)args[0], 15 | (int)*(ffi_arg *)(resp)); 16 | } 17 | typedef signed int (*cls_ret_sint)(signed int); 18 | 19 | int main (void) 20 | { 21 | ffi_cif cif; 22 | void *code; 23 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 24 | ffi_type * cl_arg_types[2]; 25 | signed int res; 26 | 27 | cl_arg_types[0] = &ffi_type_sint; 28 | cl_arg_types[1] = NULL; 29 | 30 | /* Initialize the cif */ 31 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 32 | &ffi_type_sint, cl_arg_types) == FFI_OK); 33 | 34 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code) == FFI_OK); 35 | 36 | res = (*((cls_ret_sint)code))(65534); 37 | /* { dg-output "65534: 65534" } */ 38 | printf("res: %d\n",res); 39 | /* { dg-output "\nres: 65534" } */ 40 | 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_sshort.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value sshort. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20031108 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_sshort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg*)resp = *(signed short *)args[0]; 14 | printf("%d: %d\n",*(signed short *)args[0], 15 | (int)*(ffi_arg *)(resp)); 16 | } 17 | typedef signed short (*cls_ret_sshort)(signed short); 18 | 19 | int main (void) 20 | { 21 | ffi_cif cif; 22 | void *code; 23 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 24 | ffi_type * cl_arg_types[2]; 25 | signed short res; 26 | 27 | cl_arg_types[0] = &ffi_type_sshort; 28 | cl_arg_types[1] = NULL; 29 | 30 | /* Initialize the cif */ 31 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 32 | &ffi_type_sshort, cl_arg_types) == FFI_OK); 33 | 34 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code) == FFI_OK); 35 | 36 | res = (*((cls_ret_sshort)code))(255); 37 | /* { dg-output "255: 255" } */ 38 | printf("res: %d\n",res); 39 | /* { dg-output "\nres: 255" } */ 40 | 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_uchar.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value uchar. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_uchar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg*)resp = *(unsigned char *)args[0]; 14 | printf("%d: %d\n",*(unsigned char *)args[0], 15 | (int)*(ffi_arg *)(resp)); 16 | } 17 | typedef unsigned char (*cls_ret_uchar)(unsigned char); 18 | 19 | int main (void) 20 | { 21 | ffi_cif cif; 22 | void *code; 23 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 24 | ffi_type * cl_arg_types[2]; 25 | unsigned char res; 26 | 27 | cl_arg_types[0] = &ffi_type_uchar; 28 | cl_arg_types[1] = NULL; 29 | 30 | /* Initialize the cif */ 31 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 32 | &ffi_type_uchar, cl_arg_types) == FFI_OK); 33 | 34 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code) == FFI_OK); 35 | 36 | res = (*((cls_ret_uchar)code))(127); 37 | /* { dg-output "127: 127" } */ 38 | printf("res: %d\n",res); 39 | /* { dg-output "\nres: 127" } */ 40 | 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_uchar_va.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Test anonymous unsigned char argument. 3 | Limitations: none. 4 | PR: none. 5 | Originator: ARM Ltd. */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | typedef unsigned char T; 11 | 12 | static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 13 | void* userdata __UNUSED__) 14 | { 15 | *(ffi_arg *)resp = *(T *)args[0]; 16 | 17 | printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); 18 | } 19 | 20 | typedef T (*cls_ret_T)(T, ...); 21 | 22 | int main (void) 23 | { 24 | ffi_cif cif; 25 | void *code; 26 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 27 | ffi_type * cl_arg_types[3]; 28 | T res; 29 | 30 | cl_arg_types[0] = &ffi_type_uchar; 31 | cl_arg_types[1] = &ffi_type_uchar; 32 | cl_arg_types[2] = NULL; 33 | 34 | /* Initialize the cif */ 35 | CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, 36 | &ffi_type_uchar, cl_arg_types) == FFI_OK); 37 | 38 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); 39 | res = ((((cls_ret_T)code)(67, 4))); 40 | /* { dg-output "67: 67 4" } */ 41 | printf("res: %d\n", res); 42 | /* { dg-output "\nres: 67" } */ 43 | exit(0); 44 | } 45 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_uint.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value uint. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_uint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg *)resp = *(unsigned int *)args[0]; 14 | 15 | printf("%d: %d\n",*(unsigned int *)args[0], 16 | (int)*(ffi_arg *)(resp)); 17 | } 18 | typedef unsigned int (*cls_ret_uint)(unsigned int); 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | void *code; 24 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 25 | ffi_type * cl_arg_types[2]; 26 | unsigned int res; 27 | 28 | cl_arg_types[0] = &ffi_type_uint; 29 | cl_arg_types[1] = NULL; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 33 | &ffi_type_uint, cl_arg_types) == FFI_OK); 34 | 35 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code) == FFI_OK); 36 | 37 | res = (*((cls_ret_uint)code))(2147483647); 38 | /* { dg-output "2147483647: 2147483647" } */ 39 | printf("res: %d\n",res); 40 | /* { dg-output "\nres: 2147483647" } */ 41 | 42 | exit(0); 43 | } 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_uint_va.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Test anonymous unsigned int argument. 3 | Limitations: none. 4 | PR: none. 5 | Originator: ARM Ltd. */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | typedef unsigned int T; 12 | 13 | static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 14 | void* userdata __UNUSED__) 15 | { 16 | *(ffi_arg *)resp = *(T *)args[0]; 17 | 18 | printf("%d: %d %d\n", (int)*(ffi_arg *)resp, *(T *)args[0], *(T *)args[1]); 19 | } 20 | 21 | typedef T (*cls_ret_T)(T, ...); 22 | 23 | int main (void) 24 | { 25 | ffi_cif cif; 26 | void *code; 27 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 28 | ffi_type * cl_arg_types[3]; 29 | T res; 30 | 31 | cl_arg_types[0] = &ffi_type_uint; 32 | cl_arg_types[1] = &ffi_type_uint; 33 | cl_arg_types[2] = NULL; 34 | 35 | /* Initialize the cif */ 36 | CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, 37 | &ffi_type_uint, cl_arg_types) == FFI_OK); 38 | 39 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); 40 | res = ((((cls_ret_T)code)(67, 4))); 41 | /* { dg-output "67: 67 4" } */ 42 | printf("res: %d\n", res); 43 | /* { dg-output "\nres: 67" } */ 44 | exit(0); 45 | } 46 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_ulong_va.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Test anonymous unsigned long argument. 3 | Limitations: none. 4 | PR: none. 5 | Originator: ARM Ltd. */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | typedef unsigned long T; 12 | 13 | static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 14 | void* userdata __UNUSED__) 15 | { 16 | *(T *)resp = *(T *)args[0]; 17 | 18 | printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]); 19 | } 20 | 21 | typedef T (*cls_ret_T)(T, ...); 22 | 23 | int main (void) 24 | { 25 | ffi_cif cif; 26 | void *code; 27 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 28 | ffi_type * cl_arg_types[3]; 29 | T res; 30 | 31 | cl_arg_types[0] = &ffi_type_ulong; 32 | cl_arg_types[1] = &ffi_type_ulong; 33 | cl_arg_types[2] = NULL; 34 | 35 | /* Initialize the cif */ 36 | CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, 37 | &ffi_type_ulong, cl_arg_types) == FFI_OK); 38 | 39 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); 40 | res = ((((cls_ret_T)code)(67, 4))); 41 | /* { dg-output "67: 67 4" } */ 42 | printf("res: %ld\n", res); 43 | /* { dg-output "\nres: 67" } */ 44 | exit(0); 45 | } 46 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_ushort.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value ushort. 3 | Limitations: none. 4 | PR: none. 5 | Originator: 20030828 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | static void cls_ret_ushort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 11 | void* userdata __UNUSED__) 12 | { 13 | *(ffi_arg*)resp = *(unsigned short *)args[0]; 14 | 15 | printf("%d: %d\n",*(unsigned short *)args[0], 16 | (int)*(ffi_arg *)(resp)); 17 | } 18 | typedef unsigned short (*cls_ret_ushort)(unsigned short); 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | void *code; 24 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 25 | ffi_type * cl_arg_types[2]; 26 | unsigned short res; 27 | 28 | cl_arg_types[0] = &ffi_type_ushort; 29 | cl_arg_types[1] = NULL; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 33 | &ffi_type_ushort, cl_arg_types) == FFI_OK); 34 | 35 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code) == FFI_OK); 36 | 37 | res = (*((cls_ret_ushort)code))(65535); 38 | /* { dg-output "65535: 65535" } */ 39 | printf("res: %d\n",res); 40 | /* { dg-output "\nres: 65535" } */ 41 | 42 | exit(0); 43 | } 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/cls_ushort_va.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Test anonymous unsigned short argument. 3 | Limitations: none. 4 | PR: none. 5 | Originator: ARM Ltd. */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitest.h" 9 | 10 | typedef unsigned short T; 11 | 12 | static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 13 | void* userdata __UNUSED__) 14 | { 15 | *(ffi_arg *)resp = *(T *)args[0]; 16 | 17 | printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); 18 | } 19 | 20 | typedef T (*cls_ret_T)(T, ...); 21 | 22 | int main (void) 23 | { 24 | ffi_cif cif; 25 | void *code; 26 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 27 | ffi_type * cl_arg_types[3]; 28 | T res; 29 | 30 | cl_arg_types[0] = &ffi_type_ushort; 31 | cl_arg_types[1] = &ffi_type_ushort; 32 | cl_arg_types[2] = NULL; 33 | 34 | /* Initialize the cif */ 35 | CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, 36 | &ffi_type_ushort, cl_arg_types) == FFI_OK); 37 | 38 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); 39 | res = ((((cls_ret_T)code)(67, 4))); 40 | /* { dg-output "67: 67 4" } */ 41 | printf("res: %d\n", res); 42 | /* { dg-output "\nres: 67" } */ 43 | exit(0); 44 | } 45 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/err_bad_abi.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_prep_cif, ffi_prep_closure 2 | Purpose: Test error return for bad ABIs. 3 | Limitations: none. 4 | PR: none. 5 | Originator: Blake Chaffin 6/6/2007 */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static void 12 | dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, 13 | void** args __UNUSED__, void* userdata __UNUSED__) 14 | {} 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | void *code; 20 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 21 | ffi_type* arg_types[1]; 22 | 23 | arg_types[0] = NULL; 24 | 25 | CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, 26 | arg_types) == FFI_BAD_ABI); 27 | 28 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, 29 | arg_types) == FFI_OK); 30 | 31 | cif.abi= 255; 32 | 33 | CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI); 34 | 35 | exit(0); 36 | } 37 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, unwind info 2 | Purpose: Check if the unwind information is passed correctly. 3 | Limitations: none. 4 | PR: none. 5 | Originator: Andreas Tobler 20061213 */ 6 | 7 | /* { dg-do run { xfail moxie*-*-* } } */ 8 | 9 | #include "ffitest.h" 10 | 11 | static int checking(int a __UNUSED__, short b __UNUSED__, 12 | signed char c __UNUSED__) 13 | { 14 | throw 9; 15 | } 16 | 17 | int main (void) 18 | { 19 | ffi_cif cif; 20 | ffi_type *args[MAX_ARGS]; 21 | void *values[MAX_ARGS]; 22 | ffi_arg rint; 23 | 24 | signed int si; 25 | signed short ss; 26 | signed char sc; 27 | 28 | args[0] = &ffi_type_sint; 29 | values[0] = &si; 30 | args[1] = &ffi_type_sshort; 31 | values[1] = &ss; 32 | args[2] = &ffi_type_schar; 33 | values[2] = ≻ 34 | 35 | /* Initialize the cif */ 36 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, 37 | &ffi_type_sint, args) == FFI_OK); 38 | 39 | si = -6; 40 | ss = -12; 41 | sc = -1; 42 | { 43 | try 44 | { 45 | ffi_call(&cif, FFI_FN(checking), &rint, values); 46 | } catch (int exception_code) 47 | { 48 | CHECK(exception_code == 9); 49 | } 50 | printf("part one OK\n"); 51 | /* { dg-output "part one OK" } */ 52 | } 53 | exit(0); 54 | } 55 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_align_complex_double.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Check structure alignment of complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "cls_align_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_align_complex_float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Check structure alignment of complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_float.inc" 10 | #include "cls_align_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Check structure alignment of complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "cls_align_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex.inc: -------------------------------------------------------------------------------- 1 | /* -*-c-*- */ 2 | #include "ffitest.h" 3 | #include 4 | 5 | static void cls_ret_complex_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, 6 | void* userdata __UNUSED__) 7 | { 8 | _Complex T_C_TYPE *pa; 9 | _Complex T_C_TYPE *pr; 10 | pa = (_Complex T_C_TYPE *)args[0]; 11 | pr = (_Complex T_C_TYPE *)resp; 12 | *pr = *pa; 13 | 14 | printf("%.6f,%.6fi: %.6f,%.6fi\n", 15 | T_CONV creal (*pa), T_CONV cimag (*pa), 16 | T_CONV creal (*pr), T_CONV cimag (*pr)); 17 | } 18 | typedef _Complex T_C_TYPE (*cls_ret_complex)(_Complex T_C_TYPE); 19 | 20 | int main (void) 21 | { 22 | ffi_cif cif; 23 | void *code; 24 | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); 25 | ffi_type * cl_arg_types[2]; 26 | _Complex T_C_TYPE res; 27 | 28 | cl_arg_types[0] = &T_FFI_TYPE; 29 | cl_arg_types[1] = NULL; 30 | 31 | /* Initialize the cif */ 32 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 33 | &T_FFI_TYPE, cl_arg_types) == FFI_OK); 34 | 35 | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_complex_fn, NULL, code) == FFI_OK); 36 | 37 | res = (*((cls_ret_complex)code))(0.125 + 128.0 * I); 38 | printf("res: %.6f,%.6fi\n", T_CONV creal (res), T_CONV cimag (res)); 39 | CHECK (res == (0.125 + 128.0 * I)); 40 | 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_double.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "cls_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_float.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_float.inc" 10 | #include "cls_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: closure_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "cls_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_struct_double.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Check complex arguments in structs. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "cls_complex_struct.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_struct_float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Check complex arguments in structs. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_float.inc" 10 | #include "cls_complex_struct.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Check complex arguments in structs. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "cls_complex_struct.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_va_double.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Test complex' passed in variable argument lists. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "cls_complex_va.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_va_float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Test complex' passed in variable argument lists. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | /* Alpha splits _Complex into two arguments. It's illegal to pass 10 | float through varargs, so _Complex float goes badly. In sort of 11 | gets passed as _Complex double, but the compiler doesn't agree 12 | with itself on this issue. */ 13 | /* { dg-do run { xfail alpha*-*-* } } */ 14 | 15 | #include "complex_defs_float.inc" 16 | #include "cls_complex_va.inc" 17 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, closure_call 2 | Purpose: Test complex' passed in variable argument lists. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "cls_complex_va.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/complex.exp: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2003, 2006, 2009, 2010, 2014 Free Software Foundation, Inc. 2 | 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; see the file COPYING3. If not see 15 | # . 16 | 17 | dg-init 18 | libffi-init 19 | 20 | global srcdir subdir 21 | 22 | set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] 23 | 24 | if { [libffi_feature_test "#ifdef FFI_TARGET_HAS_COMPLEX_TYPE"] } { 25 | run-many-tests $tlist "" 26 | } else { 27 | foreach test $tlist { 28 | unsupported "$test" 29 | } 30 | } 31 | 32 | dg-finish 33 | 34 | # Local Variables: 35 | # tcl-indent-level:4 36 | # End: 37 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/complex.inc: -------------------------------------------------------------------------------- 1 | /* -*-c-*-*/ 2 | #include "ffitest.h" 3 | #include 4 | 5 | static _Complex T_C_TYPE f_complex(_Complex T_C_TYPE c, int x, int *py) 6 | { 7 | c = -(2 * creal (c)) + (cimag (c) + 1)* I; 8 | *py += x; 9 | 10 | return c; 11 | } 12 | 13 | int main (void) 14 | { 15 | ffi_cif cif; 16 | ffi_type *args[MAX_ARGS]; 17 | void *values[MAX_ARGS]; 18 | 19 | _Complex T_C_TYPE tc_arg; 20 | _Complex T_C_TYPE tc_result; 21 | int tc_int_arg_x; 22 | int tc_y; 23 | int *tc_ptr_arg_y = &tc_y; 24 | 25 | args[0] = &T_FFI_TYPE; 26 | args[1] = &ffi_type_sint; 27 | args[2] = &ffi_type_pointer; 28 | values[0] = &tc_arg; 29 | values[1] = &tc_int_arg_x; 30 | values[2] = &tc_ptr_arg_y; 31 | 32 | /* Initialize the cif */ 33 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, 34 | &T_FFI_TYPE, args) == FFI_OK); 35 | 36 | tc_arg = 1 + 7 * I; 37 | tc_int_arg_x = 1234; 38 | tc_y = 9876; 39 | ffi_call(&cif, FFI_FN(f_complex), &tc_result, values); 40 | 41 | printf ("%f,%fi %f,%fi, x %d 1234, y %d 11110\n", 42 | T_CONV creal (tc_result), T_CONV cimag (tc_result), 43 | T_CONV creal (2.0), T_CONV creal (8.0), tc_int_arg_x, tc_y); 44 | 45 | CHECK (creal (tc_result) == -2); 46 | CHECK (cimag (tc_result) == 8); 47 | CHECK (tc_int_arg_x == 1234); 48 | CHECK (*tc_ptr_arg_y == 11110); 49 | 50 | exit(0); 51 | } 52 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/complex_defs_double.inc: -------------------------------------------------------------------------------- 1 | /* -*-c-*- */ 2 | /* Complex base type. */ 3 | #define T_FFI_TYPE ffi_type_complex_double 4 | /* C type corresponding to the base type. */ 5 | #define T_C_TYPE double 6 | /* C cast for a value of type T_C_TYPE that is passed to printf. */ 7 | #define T_CONV 8 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/complex_defs_float.inc: -------------------------------------------------------------------------------- 1 | /* -*-c-*- */ 2 | /* Complex base type. */ 3 | #define T_FFI_TYPE ffi_type_complex_float 4 | /* C type corresponding to the base type. */ 5 | #define T_C_TYPE float 6 | /* C cast for a value of type T_C_TYPE that is passed to printf. */ 7 | #define T_CONV (double) 8 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc: -------------------------------------------------------------------------------- 1 | /* -*-c-*- */ 2 | /* Complex base type. */ 3 | #define T_FFI_TYPE ffi_type_complex_longdouble 4 | /* C type corresponding to the base type. */ 5 | #define T_C_TYPE long double 6 | /* C cast for a value of type T_C_TYPE that is passed to printf. */ 7 | #define T_CONV 8 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/complex_double.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check complex types. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/complex_float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check complex types. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_float.inc" 10 | #include "complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/complex_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check complex types. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/ffitest.h: -------------------------------------------------------------------------------- 1 | #include "../libffi.call/ffitest.h" 2 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/many_complex_double.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex, with many arguments 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "many_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/many_complex_float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex, with many arguments 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_float.inc" 10 | #include "many_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/many_complex_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex, with many arguments 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "many_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex.inc: -------------------------------------------------------------------------------- 1 | /* -*-c-*- */ 2 | #include "ffitest.h" 3 | #include 4 | 5 | static _Complex T_C_TYPE return_c(_Complex T_C_TYPE c) 6 | { 7 | printf ("%f,%fi\n", T_CONV creal (c), T_CONV cimag (c)); 8 | return 2 * c; 9 | } 10 | int main (void) 11 | { 12 | ffi_cif cif; 13 | ffi_type *args[MAX_ARGS]; 14 | void *values[MAX_ARGS]; 15 | _Complex T_C_TYPE c, rc, rc2; 16 | T_C_TYPE cr, ci; 17 | 18 | args[0] = &T_FFI_TYPE; 19 | values[0] = &c; 20 | 21 | /* Initialize the cif */ 22 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 23 | &T_FFI_TYPE, args) == FFI_OK); 24 | 25 | for (cr = -127.0; cr < 127; cr++) 26 | { 27 | ci = 1000.0 - cr; 28 | c = cr + ci * I; 29 | ffi_call(&cif, FFI_FN(return_c), &rc, values); 30 | rc2 = return_c(c); 31 | printf ("%f,%fi vs %f,%fi\n", 32 | T_CONV creal (rc), T_CONV cimag (rc), 33 | T_CONV creal (rc2), T_CONV cimag (rc2)); 34 | CHECK(rc == 2 * c); 35 | } 36 | exit(0); 37 | } 38 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex1.inc: -------------------------------------------------------------------------------- 1 | /* -*-c-*- */ 2 | #include "ffitest.h" 3 | #include 4 | 5 | static _Complex T_C_TYPE return_c(_Complex T_C_TYPE c1, float fl2, unsigned int in3, _Complex T_C_TYPE c4) 6 | { 7 | return c1 + fl2 + in3 + c4; 8 | } 9 | int main (void) 10 | { 11 | ffi_cif cif; 12 | ffi_type *args[MAX_ARGS]; 13 | void *values[MAX_ARGS]; 14 | _Complex T_C_TYPE c1, c4, rc, rc2; 15 | float fl2; 16 | unsigned int in3; 17 | args[0] = &T_FFI_TYPE; 18 | args[1] = &ffi_type_float; 19 | args[2] = &ffi_type_uint; 20 | args[3] = &T_FFI_TYPE; 21 | values[0] = &c1; 22 | values[1] = &fl2; 23 | values[2] = &in3; 24 | values[3] = &c4; 25 | 26 | /* Initialize the cif */ 27 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 28 | &T_FFI_TYPE, args) == FFI_OK); 29 | c1 = 127.0 + 255.0 * I; 30 | fl2 = 128.0; 31 | in3 = 255; 32 | c4 = 512.7 + 1024.1 * I; 33 | 34 | ffi_call(&cif, FFI_FN(return_c), &rc, values); 35 | rc2 = return_c(c1, fl2, in3, c4); 36 | printf ("%f,%fi vs %f,%fi\n", 37 | T_CONV creal (rc), T_CONV cimag (rc), 38 | T_CONV creal (rc2), T_CONV cimag (rc2)); 39 | CHECK(rc == rc2); 40 | exit(0); 41 | } 42 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex1_double.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "return_complex1.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex1_float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_float.inc" 10 | #include "return_complex1.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex1_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "return_complex1.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex2.inc: -------------------------------------------------------------------------------- 1 | /* -*-c-*- */ 2 | #include "ffitest.h" 3 | #include 4 | 5 | _Complex T_C_TYPE 6 | return_c(_Complex T_C_TYPE c1, _Complex T_C_TYPE c2, 7 | unsigned int in3, _Complex T_C_TYPE c4) 8 | { 9 | volatile _Complex T_C_TYPE r = c1 + c2 + in3 + c4; 10 | return r; 11 | } 12 | 13 | int main (void) 14 | { 15 | ffi_cif cif; 16 | ffi_type *args[MAX_ARGS]; 17 | void *values[MAX_ARGS]; 18 | _Complex T_C_TYPE c1, c2, c4, rc, rc2; 19 | unsigned int in3; 20 | args[0] = &T_FFI_TYPE; 21 | args[1] = &T_FFI_TYPE; 22 | args[2] = &ffi_type_uint; 23 | args[3] = &T_FFI_TYPE; 24 | values[0] = &c1; 25 | values[1] = &c2; 26 | values[2] = &in3; 27 | values[3] = &c4; 28 | 29 | /* Initialize the cif */ 30 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 31 | &T_FFI_TYPE, args) == FFI_OK); 32 | c1 = 127.0 + 255.0 * I; 33 | c2 = 128.0 + 256.0; 34 | in3 = 255; 35 | c4 = 512.7 + 1024.1 * I; 36 | 37 | ffi_call(&cif, FFI_FN(return_c), &rc, values); 38 | rc2 = return_c(c1, c2, in3, c4); 39 | printf ("%f,%fi vs %f,%fi\n", 40 | T_CONV creal (rc), T_CONV cimag (rc), 41 | T_CONV creal (rc2), T_CONV cimag (rc2)); 42 | CHECK(rc == rc2); 43 | exit(0); 44 | } 45 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex2_double.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "return_complex2.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex2_float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_float.inc" 10 | #include "return_complex2.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex2_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "return_complex2.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex_double.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_double.inc" 10 | #include "return_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex_float.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_float.inc" 10 | #include "return_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.complex/return_complex_longdouble.c: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call 2 | Purpose: Check return value complex. 3 | Limitations: none. 4 | PR: none. 5 | Originator: . */ 6 | 7 | /* { dg-do run } */ 8 | 9 | #include "complex_defs_longdouble.inc" 10 | #include "return_complex.inc" 11 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.go/aa-direct.c: -------------------------------------------------------------------------------- 1 | /* { dg-do run } */ 2 | 3 | #include "static-chain.h" 4 | 5 | #if defined(__GNUC__) && !defined(__clang__) && defined(STATIC_CHAIN_REG) 6 | 7 | #include "ffitest.h" 8 | 9 | /* Blatent assumption here that the prologue doesn't clobber the 10 | static chain for trivial functions. If this is not true, don't 11 | define STATIC_CHAIN_REG, and we'll test what we can via other tests. */ 12 | void *doit(void) 13 | { 14 | register void *chain __asm__(STATIC_CHAIN_REG); 15 | return chain; 16 | } 17 | 18 | int main() 19 | { 20 | ffi_cif cif; 21 | void *result; 22 | 23 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK); 24 | 25 | ffi_call_go(&cif, FFI_FN(doit), &result, NULL, &result); 26 | 27 | CHECK(result == &result); 28 | 29 | return 0; 30 | } 31 | 32 | #else /* UNSUPPORTED */ 33 | int main() { return 0; } 34 | #endif 35 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.go/closure1.c: -------------------------------------------------------------------------------- 1 | /* { dg-do run } */ 2 | 3 | #include "ffitest.h" 4 | 5 | void doit(ffi_cif *cif, void *rvalue, void **avalue, void *closure) 6 | { 7 | (void)cif; 8 | (void)avalue; 9 | *(void **)rvalue = closure; 10 | } 11 | 12 | typedef void * (*FN)(void); 13 | 14 | int main() 15 | { 16 | ffi_cif cif; 17 | ffi_go_closure cl; 18 | void *result; 19 | 20 | CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK); 21 | CHECK(ffi_prep_go_closure(&cl, &cif, doit) == FFI_OK); 22 | 23 | ffi_call_go(&cif, FFI_FN(*(FN *)&cl), &result, NULL, &cl); 24 | 25 | CHECK(result == &cl); 26 | 27 | exit(0); 28 | } 29 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.go/ffitest.h: -------------------------------------------------------------------------------- 1 | #include "../libffi.call/ffitest.h" 2 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.go/go.exp: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2003, 2006, 2009, 2010, 2014 Free Software Foundation, Inc. 2 | 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; see the file COPYING3. If not see 15 | # . 16 | 17 | dg-init 18 | libffi-init 19 | 20 | global srcdir subdir 21 | 22 | set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] 23 | 24 | if { [libffi_feature_test "#ifdef FFI_GO_CLOSURES"] } { 25 | run-many-tests $tlist "" 26 | } else { 27 | foreach test $tlist { 28 | unsupported "$test" 29 | } 30 | } 31 | 32 | dg-finish 33 | 34 | # Local Variables: 35 | # tcl-indent-level:4 36 | # End: 37 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.go/static-chain.h: -------------------------------------------------------------------------------- 1 | #ifdef __aarch64__ 2 | # define STATIC_CHAIN_REG "x18" 3 | #elif defined(__alpha__) 4 | # define STATIC_CHAIN_REG "$1" 5 | #elif defined(__arm__) 6 | # define STATIC_CHAIN_REG "ip" 7 | #elif defined(__sparc__) 8 | # if defined(__arch64__) || defined(__sparcv9) 9 | # define STATIC_CHAIN_REG "g5" 10 | # else 11 | # define STATIC_CHAIN_REG "g2" 12 | # endif 13 | #elif defined(__x86_64__) 14 | # define STATIC_CHAIN_REG "r10" 15 | #elif defined(__i386__) 16 | # ifndef ABI_NUM 17 | # define STATIC_CHAIN_REG "ecx" /* FFI_DEFAULT_ABI only */ 18 | # endif 19 | #endif 20 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.special/special.exp: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2003, 2006, 2009, 2010 Free Software Foundation, Inc. 2 | 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; see the file COPYING3. If not see 15 | # . 16 | 17 | dg-init 18 | libffi-init 19 | 20 | global srcdir subdir 21 | 22 | global cxx_options 23 | 24 | set cxx_options " -shared-libgcc -lstdc++" 25 | 26 | dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" 27 | dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" 28 | dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" 29 | dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" 30 | 31 | dg-finish 32 | 33 | # Local Variables: 34 | # tcl-indent-level:4 35 | # End: 36 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/deps/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc: -------------------------------------------------------------------------------- 1 | /* Area: ffi_call, unwind info 2 | Purpose: Check if the unwind information is passed correctly. 3 | Limitations: none. 4 | PR: none. 5 | Originator: Andreas Tobler 20061213 */ 6 | 7 | /* { dg-do run } */ 8 | #include "ffitestcxx.h" 9 | 10 | static int checking(int a __UNUSED__, short b __UNUSED__, 11 | signed char c __UNUSED__) 12 | { 13 | throw 9; 14 | } 15 | 16 | int main (void) 17 | { 18 | ffi_cif cif; 19 | ffi_type *args[MAX_ARGS]; 20 | void *values[MAX_ARGS]; 21 | ffi_arg rint; 22 | 23 | signed int si; 24 | signed short ss; 25 | signed char sc; 26 | 27 | args[0] = &ffi_type_sint; 28 | values[0] = &si; 29 | args[1] = &ffi_type_sshort; 30 | values[1] = &ss; 31 | args[2] = &ffi_type_schar; 32 | values[2] = ≻ 33 | 34 | /* Initialize the cif */ 35 | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, 36 | &ffi_type_sint, args) == FFI_OK); 37 | 38 | si = -6; 39 | ss = -12; 40 | sc = -1; 41 | { 42 | try 43 | { 44 | ffi_call(&cif, FFI_FN(checking), &rint, values); 45 | } catch (int exception_code) 46 | { 47 | CHECK(exception_code == 9); 48 | } 49 | printf("part one OK\n"); 50 | /* { dg-output "part one OK" } */ 51 | } 52 | exit(0); 53 | } 54 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/example/abs.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This example creates an ffi.Callback from the "Math.abs()" JavaScript function 4 | * then creates a ffi.ForeignFunction from that callback function pointer. 5 | * 6 | * The result is basically the same as calling "Math.abs()" directly, haha! 7 | * 8 | * This example should basically just run forever, in an endless loop. 9 | * This file is a "pummel test" of sorts for: 10 | * https://github.com/rbranson/node-ffi/issues/74 11 | * 12 | * We should run this file periodically for a period of ~10 minutes to make sure 13 | * it doesn't crash ever. 14 | */ 15 | 16 | var ref = require('ref') 17 | , ffi = require('../') 18 | , assert = require('assert') 19 | 20 | var funcPtr = ffi.Callback('int', [ 'int' ], Math.abs) 21 | var func = ffi.ForeignFunction(funcPtr, 'int', [ 'int' ]) 22 | 23 | function loop () { 24 | for (var i = 0; i < 100; i++) { 25 | assert.equal(Math.abs(-i), func(-i)) 26 | } 27 | (typeof setImmediate != 'undefined' ? setImmediate : process.nextTick)(loop) 28 | } 29 | loop() 30 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/example/factorial/README.md: -------------------------------------------------------------------------------- 1 | To compile `libfactorial.dylib` on OS X: 2 | 3 | ``` bash 4 | $ gcc -dynamiclib -undefined suppress -flat_namespace factorial.c -o libfactorial.dylib 5 | ``` 6 | 7 | To compile `libfactorial.so` on Linux/Solaris/etc.: 8 | 9 | ``` bash 10 | $ gcc -shared -fpic factorial.c -o libfactorial.so 11 | ``` 12 | 13 | To compile `libfactorial.dll` on Windows (http://stackoverflow.com/a/2220213): 14 | 15 | ``` bash 16 | $ cl.exe /D_USRDLL /D_WINDLL factorial.c /link /DLL /OUT:libfactorial.dll 17 | ``` 18 | 19 | To run the example: 20 | 21 | ``` bash 22 | $ node factorial.js 35 23 | Your output: 6399018521010896896 24 | ``` 25 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/example/factorial/factorial.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if defined(WIN32) || defined(_WIN32) 4 | #define EXPORT __declspec(dllexport) 5 | #else 6 | #define EXPORT 7 | #endif 8 | 9 | EXPORT uint64_t factorial(int max) { 10 | int i = max; 11 | uint64_t result = 1; 12 | 13 | while (i >= 2) { 14 | result *= i--; 15 | } 16 | 17 | return result; 18 | } 19 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/example/factorial/factorial.js: -------------------------------------------------------------------------------- 1 | var ffi = require('../../') 2 | 3 | var libfactorial = ffi.Library('./libfactorial', { 4 | 'factorial': [ 'uint64', [ 'int' ] ] 5 | }) 6 | 7 | if (process.argv.length < 3) { 8 | console.log('Arguments: ' + process.argv[0] + ' ' + process.argv[1] + ' ') 9 | process.exit() 10 | } 11 | 12 | var output = libfactorial.factorial(parseInt(process.argv[2])) 13 | 14 | console.log('Your output: ' + output) 15 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/lib/bindings.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const path = require('path'); 3 | const ref = require('ref-napi'); 4 | const assert = require('assert'); 5 | 6 | assert(ref.instance); 7 | 8 | const bindings = require('node-gyp-build')(path.join(__dirname, '..')); 9 | module.exports = bindings.initializeBindings(ref.instance); 10 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/lib/errno.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const DynamicLibrary = require('./dynamic_library'); 3 | const ForeignFunction = require('./foreign_function'); 4 | const bindings = require('./bindings'); 5 | const funcs = bindings.StaticFunctions; 6 | const ref = require('ref-napi'); 7 | const int = ref.types.int; 8 | const intPtr = ref.refType(int); 9 | let errno = null; 10 | 11 | if (process.platform == 'win32') { 12 | const _errno = DynamicLibrary('msvcrt.dll').get('_errno'); 13 | const errnoPtr = ForeignFunction(_errno, intPtr, []); 14 | errno = function() { 15 | return errnoPtr().deref(); 16 | }; 17 | } else { 18 | errno = ForeignFunction(funcs._errno, 'int', []); 19 | } 20 | 21 | module.exports = errno; 22 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/lib/foreign_function.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | const CIF = require('./cif'); 7 | const _ForeignFunction = require('./_foreign_function'); 8 | const debug = require('debug')('ffi:ForeignFunction'); 9 | const assert = require('assert'); 10 | const ref = require('ref-napi'); 11 | 12 | /** 13 | * Represents a foreign function in another library. Manages all of the aspects 14 | * of function execution, including marshalling the data parameters for the 15 | * function into native types and also unmarshalling the return from function 16 | * execution. 17 | */ 18 | 19 | function ForeignFunction (funcPtr, returnType, argTypes, abi) { 20 | debug('creating new ForeignFunction', funcPtr); 21 | 22 | // check args 23 | assert(Buffer.isBuffer(funcPtr), 'expected Buffer as first argument'); 24 | assert(!!returnType, 'expected a return "type" object as the second argument'); 25 | assert(Array.isArray(argTypes), 'expected Array of arg "type" objects as the third argument'); 26 | 27 | // normalize the "types" (they could be strings, 28 | // so turn into real type instances) 29 | returnType = ref.coerceType(returnType); 30 | argTypes = argTypes.map(ref.coerceType); 31 | 32 | // create the `ffi_cif *` instance 33 | const cif = CIF(returnType, argTypes, abi); 34 | 35 | // create and return the JS proxy function 36 | return _ForeignFunction(cif, funcPtr, returnType, argTypes); 37 | } 38 | 39 | module.exports = ForeignFunction; 40 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/node-addon-api/node_api.Makefile: -------------------------------------------------------------------------------- 1 | # This file is generated by gyp; do not edit. 2 | 3 | export builddir_name ?= ./build/../node-addon-api/. 4 | .PHONY: all 5 | all: 6 | $(MAKE) -C ../build nothing 7 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/prebuilds/darwin-x64/node.napi.uv1.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ffi-napi/prebuilds/darwin-x64/node.napi.uv1.node -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/prebuilds/linux-arm64/node.napi.uv1.armv8.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ffi-napi/prebuilds/linux-arm64/node.napi.uv1.armv8.node -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/prebuilds/linux-x64/node.napi.uv1.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ffi-napi/prebuilds/linux-x64/node.napi.uv1.node -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/prebuilds/win32-ia32/node.napi.uv1.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ffi-napi/prebuilds/win32-ia32/node.napi.uv1.node -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/prebuilds/win32-x64/node.napi.uv1.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ffi-napi/prebuilds/win32-x64/node.napi.uv1.node -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/src/threaded_callback_invokation.cc: -------------------------------------------------------------------------------- 1 | #include "ffi.h" 2 | 3 | namespace FFI { 4 | 5 | ThreadedCallbackInvokation::ThreadedCallbackInvokation(callback_info* cbinfo, void* retval, void** parameters) { 6 | m_cbinfo = cbinfo; 7 | m_retval = retval; 8 | m_parameters = parameters; 9 | 10 | uv_mutex_init(&m_mutex); 11 | uv_mutex_lock(&m_mutex); 12 | uv_cond_init(&m_cond); 13 | } 14 | 15 | ThreadedCallbackInvokation::~ThreadedCallbackInvokation() { 16 | uv_mutex_unlock(&m_mutex); 17 | uv_cond_destroy(&m_cond); 18 | uv_mutex_destroy(&m_mutex); 19 | } 20 | 21 | void ThreadedCallbackInvokation::SignalDoneExecuting() { 22 | uv_mutex_lock(&m_mutex); 23 | uv_cond_signal(&m_cond); 24 | uv_mutex_unlock(&m_mutex); 25 | } 26 | 27 | void ThreadedCallbackInvokation::WaitForExecution() { 28 | uv_cond_wait(&m_cond, &m_mutex); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/src/win32-dlfcn.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Minimal emulation of POSIX dlopen/dlsym/dlclose on Windows. 3 | * @license Public domain. 4 | * 5 | * This code works fine for the common scenario of loading a 6 | * specific DLL and calling one (or more) functions within it. 7 | * No attempt is made to emulate POSIX symbol table semantics. 8 | */ 9 | 10 | #ifndef _INCLUDE_DLFCN_H_ 11 | #define _INCLUDE_DLFCN_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #define RTLD_LAZY 0 18 | #define RTLD_NOW 0 19 | #define RTLD_GLOBAL 0 20 | #define RTLD_LOCAL 0 21 | 22 | #define RTLD_DEFAULT ((void*) NULL) 23 | #define RTLD_NEXT ((void*) NULL) 24 | 25 | /** 26 | * Open DLL, returning a handle. 27 | */ 28 | 29 | void* 30 | dlopen( 31 | const char *file, /** DLL filename. */ 32 | int mode /** mode flags (ignored). */ 33 | ); 34 | 35 | /** 36 | * Close DLL. 37 | */ 38 | 39 | int 40 | dlclose( 41 | void* handle /** Handle from dlopen(). */ 42 | ); 43 | 44 | /** 45 | * Look up symbol exported by DLL. 46 | */ 47 | 48 | void* 49 | dlsym( 50 | void* handle, /** Handle from dlopen(). */ 51 | const char* name /** Name of exported symbol. */ 52 | ); 53 | 54 | /** 55 | * Return message describing last error. 56 | */ 57 | 58 | char* 59 | dlerror(void); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/test/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'targets': [{ 3 | 'target_name': 'ffi_tests', 4 | 'sources': [ 5 | 'ffi_tests.cc' 6 | ], 7 | 'include_dirs': [ 8 | " { 9 | it('should match a valid `ffi_type` for "' + name + '"', () =>{ 10 | const type = ref.types[name]; 11 | const ffi_type = ffi.ffiType(type); 12 | assert(Buffer.isBuffer(ffi_type)); 13 | }); 14 | }); 15 | 16 | it('should match a valid `ffi_type` for "ref" type without a cached value', function () { 17 | // simulate a ref type without a "ffi_type" property set 18 | const type = Object.create(ref.types.void); 19 | type.ffi_type = undefined; 20 | 21 | const ffi_type = ffi.ffiType(type); 22 | assert(Buffer.isBuffer(ffi_type)); 23 | }); 24 | 25 | it('should match a valid `ffi_type` for `CString` without a cached value', function () { 26 | // simulate a ref type without a "ffi_type" property set 27 | const type = Object.create(ref.types.CString); 28 | type.ffi_type = undefined; 29 | 30 | const ffi_type = ffi.ffiType(type); 31 | assert(Buffer.isBuffer(ffi_type)); 32 | }); 33 | 34 | it('should match a valid `ffi_type` for `ulong` without a cached value', function () { 35 | // simulate a ref type without a "ffi_type" property set 36 | const type = Object.create(ref.types.ulong); 37 | type.ffi_type = undefined; 38 | 39 | const ffi_type = ffi.ffiType(type); 40 | assert(Buffer.isBuffer(ffi_type)); 41 | }); 42 | }); 43 | }); 44 | -------------------------------------------------------------------------------- /node-call/node_modules/ffi-napi/test/variadic.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const assert = require('assert'); 3 | const ref = require('ref-napi'); 4 | const ffi = require('../'); 5 | const bindings = require('node-gyp-build')(__dirname); 6 | const sprintfPtr = bindings.sprintf; 7 | 8 | describe('variadic arguments', function () { 9 | afterEach(global.gc); 10 | 11 | it('should work with vararg C functions', function () { 12 | const buf = new Buffer(100); 13 | const sprintfGen = ffi.VariadicForeignFunction(sprintfPtr, 'int', [ 'pointer', 'string' ]); 14 | 15 | sprintfGen()(buf, 'hello world!'); 16 | assert.strictEqual(buf.readCString(), 'hello world!'); 17 | 18 | sprintfGen('int')(buf, '%d', 42); 19 | assert.strictEqual(buf.readCString(), '42'); 20 | 21 | sprintfGen('double')(buf, '%10.2f', 3.14); 22 | assert.strictEqual(buf.readCString(), ' 3.14'); 23 | 24 | sprintfGen('string')(buf, ' %s ', 'test'); 25 | assert.strictEqual(buf.readCString(), ' test '); 26 | }); 27 | 28 | it('should return the same Function instance when the same arguments are used', function () { 29 | var sprintfGen = ffi.VariadicForeignFunction(sprintfPtr, 'int', [ 'pointer', 'string' ]); 30 | 31 | var one = sprintfGen('int'); 32 | var two = sprintfGen(ref.types.int); 33 | 34 | assert.strictEqual(one, two); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /node-call/node_modules/get-symbol-from-current-process-h/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | env: 4 | - CXX=g++-4.9 5 | addons: 6 | apt: 7 | sources: 8 | - ubuntu-toolchain-r-test 9 | packages: 10 | - g++-4.9 11 | 12 | language: node_js 13 | 14 | node_js: 15 | - "6" 16 | - "8" 17 | - "9" 18 | -------------------------------------------------------------------------------- /node-call/node_modules/get-symbol-from-current-process-h/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, Anna Henningsen 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /node-call/node_modules/get-symbol-from-current-process-h/appveyor.yml: -------------------------------------------------------------------------------- 1 | # http://www.appveyor.com/docs/appveyor-yml 2 | 3 | # Test against these versions of Node.js. 4 | environment: 5 | # Test against these versions of Node.js and io.js 6 | matrix: 7 | # node.js 8 | - nodejs_version: "6" 9 | - nodejs_version: "8" 10 | - nodejs_version: "9" 11 | 12 | platform: 13 | - x86 14 | - x64 15 | 16 | # Install scripts. (runs after repo cloning) 17 | install: 18 | - python -V 19 | - set PYTHON=python 20 | - ps: Install-Product node $env:nodejs_version $env:platform 21 | - node -p process.arch 22 | - node -p process.version 23 | - npm install 24 | 25 | # Post-install test scripts. 26 | test_script: 27 | # Output useful info for debugging. 28 | - node --version 29 | - npm --version 30 | # run tests 31 | - npm test 32 | 33 | # Don't actually build. 34 | build: off 35 | 36 | # Set build version format here instead of in the admin panel. 37 | version: "{build}" 38 | -------------------------------------------------------------------------------- /node-call/node_modules/get-symbol-from-current-process-h/get-paths.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const path = require('path'); 3 | exports.includeRaw = [path.resolve(__dirname, 'include')]; 4 | exports.include = exports.includeRaw.map(x => `"${x}"`.replace(/\\/g, '\\\\')).join(' '); 5 | exports.gyp = ''; 6 | -------------------------------------------------------------------------------- /node-call/node_modules/get-symbol-from-current-process-h/include/get-symbol-from-current-process.h: -------------------------------------------------------------------------------- 1 | #ifndef _GET_SYMBOL_FROM_CURRENT_PROCESS_H 2 | #define _GET_SYMBOL_FROM_CURRENT_PROCESS_H 3 | 4 | #include 5 | #ifdef _WIN32 6 | #include 7 | #else 8 | #include 9 | #endif 10 | 11 | inline 12 | void* get_symbol_from_current_process(const char* name) { 13 | #ifdef _WIN32 14 | HMODULE handle = GetModuleHandle(NULL); 15 | assert(handle != NULL); 16 | return (void*) GetProcAddress(handle, name); 17 | #else 18 | void* handle = dlopen(NULL, RTLD_LAZY); 19 | assert(handle != NULL); 20 | void* sym = dlsym(handle, name); 21 | dlclose(handle); 22 | dlerror(); // Clear any possible errors. 23 | return sym; 24 | #endif 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /node-call/node_modules/get-uv-event-loop-napi-h/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | env: 4 | - CXX=g++-4.9 5 | addons: 6 | apt: 7 | sources: 8 | - ubuntu-toolchain-r-test 9 | packages: 10 | - g++-4.9 11 | 12 | language: node_js 13 | 14 | node_js: 15 | - "6" 16 | - "8" 17 | - "9" 18 | -------------------------------------------------------------------------------- /node-call/node_modules/get-uv-event-loop-napi-h/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, Anna Henningsen 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /node-call/node_modules/get-uv-event-loop-napi-h/appveyor.yml: -------------------------------------------------------------------------------- 1 | # http://www.appveyor.com/docs/appveyor-yml 2 | 3 | # Test against these versions of Node.js. 4 | environment: 5 | # Test against these versions of Node.js and io.js 6 | matrix: 7 | # node.js 8 | - nodejs_version: "6" 9 | - nodejs_version: "8" 10 | - nodejs_version: "9" 11 | 12 | platform: 13 | - x86 14 | - x64 15 | 16 | # Install scripts. (runs after repo cloning) 17 | install: 18 | - python -V 19 | - set PYTHON=python 20 | - ps: Install-Product node $env:nodejs_version $env:platform 21 | - node -p process.arch 22 | - node -p process.version 23 | - npm install 24 | 25 | # Post-install test scripts. 26 | test_script: 27 | # Output useful info for debugging. 28 | - node --version 29 | - npm --version 30 | # run tests 31 | - npm test 32 | 33 | # Don't actually build. 34 | build: off 35 | 36 | # Set build version format here instead of in the admin panel. 37 | version: "{build}" 38 | -------------------------------------------------------------------------------- /node-call/node_modules/get-uv-event-loop-napi-h/get-paths.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const symbol = require('get-symbol-from-current-process-h'); 3 | const path = require('path'); 4 | exports.includeRaw = [path.resolve(__dirname, 'include')].concat(symbol.includeRaw); 5 | exports.include = exports.includeRaw.map(x => `"${x}"`.replace(/\\/g, '\\\\')).join(' '); 6 | exports.gyp = symbol.gyp; 7 | -------------------------------------------------------------------------------- /node-call/node_modules/get-uv-event-loop-napi-h/include/get-uv-event-loop-napi.h: -------------------------------------------------------------------------------- 1 | #ifndef _GET_UV_EVENT_LOOP_NAPI_H 2 | #define _GET_UV_EVENT_LOOP_NAPI_H 3 | 4 | #include 5 | #include 6 | 7 | #if !defined(NAPI_VERSION) || NAPI_VERSION < 2 8 | #include 9 | #endif 10 | 11 | inline 12 | uv_loop_t* get_uv_event_loop(napi_env env) { 13 | typedef napi_status (*get_uv_event_loop_fn)(napi_env env, uv_loop_t** loop); 14 | get_uv_event_loop_fn napi_get_uv_event_loop__ = NULL; 15 | uint32_t napi_version = 0; 16 | napi_status status; 17 | status = napi_get_version(env, &napi_version); 18 | assert(status == napi_ok); 19 | if (napi_version < 2) 20 | return uv_default_loop(); 21 | 22 | #if !defined(NAPI_VERSION) || NAPI_VERSION < 2 23 | napi_get_uv_event_loop__ = (get_uv_event_loop_fn) 24 | get_symbol_from_current_process("napi_get_uv_event_loop"); 25 | #else 26 | napi_get_uv_event_loop__ = &napi_get_uv_event_loop; 27 | #endif 28 | 29 | uv_loop_t* ret; 30 | status = napi_get_uv_event_loop__(env, &ret); 31 | assert(status == napi_ok); 32 | return ret; 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /node-call/node_modules/ms/license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Zeit, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node-call/node_modules/node-addon-api/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright (c) 2017 Node.js API collaborators 5 | ----------------------------------- 6 | 7 | *Node.js API collaborators listed at * 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /node-call/node_modules/node-addon-api/common.gypi: -------------------------------------------------------------------------------- 1 | { 2 | 'variables': { 3 | 'NAPI_VERSION%': " 4 | Copyright (c) 2017 Anna Henningsen (N-API port) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/appveyor.yml: -------------------------------------------------------------------------------- 1 | # http://www.appveyor.com/docs/appveyor-yml 2 | 3 | # Test against these versions of Node.js. 4 | environment: 5 | # Test against these versions of Node.js and io.js 6 | matrix: 7 | # node.js 8 | - nodejs_version: "10" 9 | - nodejs_version: "12" 10 | - nodejs_version: "14" 11 | 12 | platform: 13 | - x86 14 | - x64 15 | 16 | # Install scripts. (runs after repo cloning) 17 | install: 18 | - python -V 19 | - set PYTHON=python 20 | - ps: Install-Product node $env:nodejs_version $env:platform 21 | - node -p process.arch 22 | - node -p process.version 23 | - npm install --build-from-source 24 | 25 | # Post-install test scripts. 26 | test_script: 27 | # Output useful info for debugging. 28 | - node --version 29 | - npm --version 30 | # run tests 31 | - npm test 32 | 33 | after_test: 34 | - ps: If ($env:nodejs_version -eq "12") { npm run prebuild --v8_enable_pointer_compression=false --v8_enable_31bit_smis_on_64bit_arch=false } 35 | 36 | # Don't actually build. 37 | build: off 38 | 39 | # Set build version format here instead of in the admin panel. 40 | version: "{build}" 41 | 42 | artifacts: 43 | - path: prebuilds 44 | name: $(APPVEYOR_REPO_TAG_NAME)-win-$(PLATFORM) 45 | type: zip 46 | 47 | deploy: 48 | - provider: GitHub 49 | artifact: /.*\.zip/ 50 | draft: false 51 | prerelease: true 52 | auth_token: $(PREBUILD_GITHUB_TOKEN) 53 | on: 54 | appveyor_repo_tag: true 55 | nodejs_version: "12" 56 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'targets': [{ 3 | 'target_name': 'binding', 4 | 'sources': [ 'src/binding.cc' ], 5 | 'include_dirs': [ 6 | " 6 | #endif 7 | #include "napi.h" 8 | 9 | // The definitions in this file are intended to be used by node-ffi-napi. 10 | 11 | namespace RefNapi { 12 | 13 | class Instance { 14 | public: 15 | virtual napi_value WrapPointer(char* ptr, size_t length) = 0; 16 | virtual char* GetBufferData(napi_value val) = 0; 17 | virtual void RegisterArrayBuffer(napi_value val) = 0; 18 | }; 19 | 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/lib/get-paths.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const symbol = require('get-symbol-from-current-process-h'); 3 | exports.includeRaw = [path.resolve(__dirname, '..', 'include')].concat(symbol.includeRaw); 4 | exports.include = exports.includeRaw.map(x => `"${x}"`.replace(/\\/g, '\\\\')).join(' '); 5 | exports.gyp = ''; 6 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/node-addon-api/node_api.Makefile: -------------------------------------------------------------------------------- 1 | # This file is generated by gyp; do not edit. 2 | 3 | export builddir_name ?= ./build/../node-addon-api/. 4 | .PHONY: all 5 | all: 6 | $(MAKE) -C ../build nothing 7 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/darwin-x64/electron.napi.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/darwin-x64/electron.napi.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/linux-arm64/electron.napi.armv8.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/linux-arm64/electron.napi.armv8.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/linux-arm64/node.napi.armv8.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/linux-arm64/node.napi.armv8.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/linux-x64/electron.napi.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/linux-x64/electron.napi.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/linux-x64/node.napi.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/linux-x64/node.napi.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/win32-ia32/electron.napi.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/win32-ia32/electron.napi.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/win32-ia32/node.napi.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/win32-ia32/node.napi.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/win32-x64/electron.napi.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/win32-x64/electron.napi.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/prebuilds/win32-x64/node.napi.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/prebuilds/win32-x64/node.napi.node -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/test/alloc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const assert = require('assert'); 3 | const ref = require('../'); 4 | 5 | describe('alloc()', function() { 6 | it('should return a new Buffer of "bool" size', function() { 7 | const buf = ref.alloc(ref.types.bool); 8 | assert.strictEqual(ref.sizeof.bool, buf.length); 9 | }); 10 | 11 | it('should coerce string type names', function() { 12 | const buf = ref.alloc('bool'); 13 | assert.strictEqual(ref.types.bool, buf.type); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/test/bool.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const assert = require('assert'); 3 | const ref = require('../'); 4 | 5 | describe('bool', function() { 6 | const buf = ref.alloc('bool'); 7 | 8 | it('should return JS "false" for a value of 0', function() { 9 | buf[0] = 0; 10 | assert.strictEqual(false, ref.get(buf)); 11 | }); 12 | 13 | it('should return JS "true" for a value of 1', function() { 14 | buf[0] = 1; 15 | assert.strictEqual(true, ref.get(buf)); 16 | }); 17 | 18 | it('should write a JS "false" value as 0', function() { 19 | ref.set(buf, 0, false); 20 | assert.strictEqual(0, buf[0]); 21 | }); 22 | 23 | it('should write a JS "true" value as 1', function() { 24 | ref.set(buf, 0, true); 25 | assert.strictEqual(1, buf[0]); 26 | }); 27 | 28 | it('should allow uint8 number values to be written to it', function() { 29 | const val = 255; 30 | ref.set(buf, 0, val); 31 | assert.strictEqual(true, ref.get(buf)); 32 | assert.strictEqual(val, buf[0]); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/test/char.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const assert = require('assert'); 3 | const ref = require('../'); 4 | 5 | describe('char', function() { 6 | it('should accept a JS String, and write the first char\'s code', function() { 7 | const val = 'a'; 8 | 9 | let buf = ref.alloc('char', val); 10 | assert.strictEqual(val.charCodeAt(0), buf.deref()); 11 | 12 | buf = ref.alloc('uchar', val); 13 | assert.strictEqual(val.charCodeAt(0), buf.deref()); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/test/iojs3issue.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const assert = require('assert'); 3 | const ref = require('../'); 4 | 5 | // This will check if the new Buffer implementation behaves like the pre io.js 3.0 one did: 6 | describe('iojs3issue', function() { 7 | it('should not crash', function() { 8 | for (let i = 0; i < 10; i++) { 9 | gc(); 10 | const buf = Buffer.alloc(8); 11 | const buf2 = ref.ref(buf); 12 | const buf3 = ref.deref(buf2); 13 | } 14 | }); 15 | 16 | it('should not crash too', function() { 17 | for (let i = 0; i < 10; i++) { 18 | gc(); 19 | const buf = Buffer.alloc(7); 20 | const buf2 = ref.ref(buf); 21 | const buf3 = ref.deref(buf2); 22 | } 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/test/isNull.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const assert = require('assert'); 3 | const ref = require('../'); 4 | 5 | describe('isNull', function() { 6 | it('should return "true" for the NULL pointer', function() { 7 | assert.strictEqual(true, ref.isNull(ref.NULL)); 8 | }); 9 | 10 | it('should return "false" for a valid Buffer', function() { 11 | const buf = Buffer.from('hello'); 12 | assert.strictEqual(false, ref.isNull(buf)); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-napi/test/utf16le.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danbayk/raydium-log-decoder-js/4668e0b9d988dc904beaf3b193b9d9872332d99b/node-call/node_modules/ref-napi/test/utf16le.bin -------------------------------------------------------------------------------- /node-call/node_modules/ref-struct-di/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": true, 3 | "laxcomma": true, 4 | "node": true, 5 | "strict": false 6 | } 7 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-struct-di/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | env: 4 | - CXX=g++-4.9 5 | addons: 6 | apt: 7 | sources: 8 | - ubuntu-toolchain-r-test 9 | packages: 10 | - g++-4.9 11 | 12 | language: node_js 13 | 14 | node_js: 15 | - "6" 16 | - "8" 17 | - "9" 18 | 19 | after_success: 20 | - npm install coveralls 21 | - nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls 22 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-struct-di/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | 'Software'), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-struct-di/appveyor.yml: -------------------------------------------------------------------------------- 1 | # http://www.appveyor.com/docs/appveyor-yml 2 | 3 | # Test against these versions of Node.js. 4 | environment: 5 | # Test against these versions of Node.js and io.js 6 | matrix: 7 | # node.js 8 | - nodejs_version: "6" 9 | - nodejs_version: "8" 10 | - nodejs_version: "9" 11 | 12 | platform: 13 | - x86 14 | - x64 15 | 16 | # Install scripts. (runs after repo cloning) 17 | install: 18 | - python -V 19 | - set PYTHON=python 20 | - ps: Install-Product node $env:nodejs_version $env:platform 21 | - node -p process.arch 22 | - node -p process.version 23 | - npm install 24 | 25 | # Post-install test scripts. 26 | test_script: 27 | # Output useful info for debugging. 28 | - node --version 29 | - npm --version 30 | # run tests 31 | - npm test 32 | 33 | # Don't actually build. 34 | build: off 35 | 36 | # Set build version format here instead of in the admin panel. 37 | version: "{build}" 38 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-struct-di/node_modules/debug/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 TJ Holowaychuk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 6 | and associated documentation files (the 'Software'), to deal in the Software without restriction, 7 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial 12 | portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 15 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 18 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-struct-di/node_modules/debug/node.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./src/node'); 2 | -------------------------------------------------------------------------------- /node-call/node_modules/ref-struct-di/node_modules/debug/src/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * Detect Electron renderer / nwjs process, which is node, but we should 5 | * treat as a browser. 6 | */ 7 | if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { 8 | module.exports = require('./browser.js'); 9 | } else { 10 | module.exports = require('./node.js'); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /program/Xargo.toml: -------------------------------------------------------------------------------- 1 | [target.bpfel-unknown-unknown.dependencies.std] 2 | features = [] -------------------------------------------------------------------------------- /program/src/entrypoint.rs: -------------------------------------------------------------------------------- 1 | //! Program entrypoint definitions 2 | 3 | #![cfg(all(target_arch = "bpf", not(feature = "no-entrypoint")))] 4 | 5 | use crate::{error::AmmError, processor::Processor}; 6 | use solana_program::{ 7 | account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, 8 | program_error::PrintProgramError, pubkey::Pubkey, 9 | }; 10 | 11 | entrypoint!(process_instruction); 12 | fn process_instruction<'a>( 13 | program_id: &Pubkey, 14 | accounts: &'a [AccountInfo<'a>], 15 | instruction_data: &[u8], 16 | ) -> ProgramResult { 17 | if let Err(error) = Processor::process(program_id, accounts, instruction_data) { 18 | // catch the error so we can print it 19 | error.print::(); 20 | return Err(error); 21 | } 22 | Ok(()) 23 | } 24 | -------------------------------------------------------------------------------- /program/src/main.rs: -------------------------------------------------------------------------------- 1 | mod log; 2 | use raydium_amm::decode_ray_log_swap_amount_in_lib; 3 | use raydium_amm::decode_ray_log_swap_amount_out_lib; 4 | use raydium_amm::decode_ray_log_swap_direction_lib; 5 | use raydium_amm::decode_ray_log_init_pc_amount_lib; 6 | use raydium_amm::decode_ray_log_init_coin_amount_lib; 7 | use raydium_amm::decode_ray_log_init_coin_decimals_lib; 8 | use std::ffi::CString; 9 | 10 | fn main(){ 11 | // [example for calling functions via Rust] 12 | 13 | // let log = "AwBnBHYAAAAAAAAAAAAAAAABAAAAAAAAALCQd3AFAAAAzB5uHMAYAwCRBjGwCwAAAE1QazYCHgAA"; 14 | // log::decode_ray_log(log); 15 | // let log = "AwBnBHYAAAAAAAAAAAAAAAABAAAAAAAAALCQd3AFAAAAzB5uHMAYAwCRBjGwCwAAAE1QazYCHgAA"; 16 | // let c_string = CString::new(log).expect("CString::new failed"); 17 | // let ptr = c_string.as_ptr(); 18 | // println!("{}", decode_ray_log_swap_amount_in_lib(ptr)); 19 | // println!("{}", decode_ray_log_swap_amount_out_lib(ptr)); 20 | // println!("{}", decode_ray_log_swap_direction_lib(ptr)); 21 | // println!("{}", decode_ray_log_init_pc_amount_lib(ptr)); 22 | // println!("{}", decode_ray_log_init_coin_amount_lib(ptr)); 23 | // println!("{}", decode_ray_log_init_coin_decimals_lib(ptr)); 24 | } --------------------------------------------------------------------------------