view release on metacpan or search on metacpan
dyncall/Makefile.embedded view on Meta::CPAN
AS="${CC} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
CC="${CC} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
CXX="${CXX} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
LD="${LD} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
ASFLAGS="-isysroot ${IOS_SDKROOT}"\
CFLAGS="-isysroot ${IOS_SDKROOT}"\
CXXFLAGS="-isysroot ${IOS_SDKROOT}"\
LDFLAGS="-Wl,-syslibroot ${IOS_SDKROOT}"\
${MAKE_CMD} all
ios:
IOS_SDKROOT="`xcode-select -print-path`/Platforms/iPhone${IOS_PLATFORM}.platform/Developer/SDKs/iPhone${IOS_PLATFORM}${IOS_SDK}.sdk" ${MAKE_CMD} ios-sdkroot
ios-sim:
IOS_PLATFORM="Simulator" ${MAKE_CMD} ios
ios-os:
IOS_PLATFORM="OS" ${MAKE_CMD} ios
# NOTE iOS 6.1 does not support armv6 (has no libs)
ios61-os:
IOS_SDK="6.1" IOS_ARCH="-arch armv7" ${MAKE_CMD} ios-os
ios61-os-no-thumb:
IOS_SDK="6.1" IOS_ARCH="-arch armv7 -mno-thumb" ${MAKE_CMD} ios-os
ios61-sim:
dyncall/buildsys/cmake/Modules/UseLATEX.cmake view on Meta::CPAN
IF (DVIPS_CONVERTER)
ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.ps
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${DVIPS_CONVERTER} ${DVIPS_CONVERTER_FLAGS} -o ${LATEX_TARGET}.ps ${LATEX_TARGET}.dvi
DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
ADD_CUSTOM_TARGET(${ps_target}
DEPENDS ${output_dir}/${LATEX_TARGET}.ps)
IF (PS2PDF_CONVERTER)
# Since both the pdf and safepdf targets have the same output, we
# cannot properly do the dependencies for both. When selecting safepdf,
# simply force a recompile every time.
ADD_CUSTOM_TARGET(${safepdf_target}
${CMAKE_COMMAND} -E chdir ${output_dir}
${PS2PDF_CONVERTER} ${PS2PDF_CONVERTER_FLAGS} ${LATEX_TARGET}.ps ${LATEX_TARGET}.pdf
)
ADD_DEPENDENCIES(${safepdf_target} ${ps_target})
ENDIF (PS2PDF_CONVERTER)
ENDIF (DVIPS_CONVERTER)
IF (LATEX2HTML_CONVERTER)
dyncall/buildsys/scripts/setenv-sdk-ios.sh view on Meta::CPAN
#!/bin/sh
#export PATH=`xcode-select -print-path`/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:${PATH}
DEVELOPER=`xcode-select -print-path`
# WORKS: P="${DEVELOPER}/Platforms/iPhoneOS.platform/Developer"
P="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain"
export MANPATH="$P/usr/share/man:${MANPATH}"
export PATH="$P/usr/bin:${PATH}"
#if [ -z "${DEVELOPER}" ]; then
#DEVELOPER=/Developer
#fi
#export PATH="${DEVELOPER}/Platforms/iPhoneOS.platform/Developer/usr/bin:${PATH}"
# export CPATH="$P/usr/include:${CPATH}"
dyncall/configure view on Meta::CPAN
;;
10.1?.*|10.1?) # >= mojave (10.14.*)
ARCHS="-arch x86_64" # mojave is final os to run x86 code, but removed build support for it
;;
esac
printf "ASFLAGS=${ARCHS}\n" >>$C
printf "CFLAGS=${ARCHS}\n" >>$C
printf "CXXFLAGS=${ARCHS}\n" >>$C
else
if [ -z ${SDKROOT} ]; then
SDKROOT="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SDK}.sdk"
fi
printf "CFLAGS=-isysroot ${SDKROOT}\n" >>$C
printf "CXXFLAGS=-isysroot ${SDKROOT}\n" >>$C
fi
;;
iPhoneOS|iOS)
if [ -z ${SDKROOT} ]; then
SDKROOT="`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDK}.sdk"
fi
if [ -z "${ARCHS}" ]; then
case "${SDK}" in
[45].*)
ARCHS="-arch armv6"
;;
[67].*)
ARCHS="-arch armv7"
;;
[89].*|1[0-9].*)
dyncall/configure view on Meta::CPAN
esac
fi
printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives
printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C
;;
iPhoneSimulator)
if [ -z ${SDKROOT} ]; then
SDKROOT="`xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK}.sdk"
fi
ARCHS="-arch i386"
printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C
;;
SunOS)
# open distributions often don't come with default cc and CC, check for common alternatives.
printf "CC=` (which cc gcc clang ) | grep -v '^no ' | head -1`\n" >>$C
dyncall/doc/manual/callconvs/callconv_ppc32.tex view on Meta::CPAN
\item Linux PPC 32-bit ABI is specified in "LSB for PPC"\cite{ppc32LSB} which is based on "System V ABI". It uses Big Endian (MSB)
\item PowerPC EABI is defined in the "PowerPC Embedded Application Binary Interface 32-Bit Implementation"\cite{ppceabi}
\item There is also the "PowerOpen ABI"\cite{poabi}, a nearly identical version of it is used in AIX % more info: http://www.ingallegri.com/public/ppc.html
\end{itemize}
\paragraph{\product{dyncall} support}
\product{Dyncall} and \product{dyncallback} are supported for PowerPC (32bit)
Big Endian (MSB), for Darwin's and System V's calling convention.\\
\product{Dyncall} can also be used to issue syscalls by using the syscall
number as target parameter and selecting the correct mode.
\subsubsection{Mac OS X/Darwin}
\paragraph{Registers and register usage}
\begin{table}[h]
\begin{tabular*}{0.95\textwidth}{3 B}
Name & Brief description\\
\hline
dyncall/doc/manual/callconvs/callconv_ppc64.tex view on Meta::CPAN
\item Apple Mac OS X/Darwin PPC is specified in "Mac OS X ABI Function Call Guide"\cite{ppcMacOSX}. It uses Big Endian (MSB).
\item Linux PPC 64-bit ABI is specified in "64-bit PowerPC ELF Application Binary Interface Supplement"\cite{ppcelf64abi} which is based on "System V ABI".
\end{itemize}
\paragraph{\product{dyncall} support}
\product{Dyncall} and \product{dyncallback} are supported for PowerPC (64bit)
Big Endian and Little Endian ELF ABIs on System V systems. Mac OS X is not
supported.\\
\product{Dyncall} can also be used to issue syscalls by using the syscall
number as target parameter and selecting the correct mode.
\subsubsection{PPC64 ELF ABI}
\paragraph{Registers and register usage}
\begin{table}[h]
\begin{tabular*}{0.95\textwidth}{3 B}
Name & Brief description\\
\hline
dyncall/doc/manual/callconvs/callconv_x64.tex view on Meta::CPAN
Compared to the x86 architecture, the 64 bit versions of the registers are
called rax, rbx, etc.. Furthermore, there are eight new general purpose
registers r8-r15.\\
\paragraph{\product{dyncall} support}
Currently, the MS Windows and System V calling conventions are supported.\\
\product{Dyncall} can also be used to issue syscalls on System V platforms by
using the syscall number as target parameter and selecting the correct mode.
\subsubsection{MS Windows}
\paragraph{Registers and register usage}
\begin{table}[h]
\begin{tabular*}{0.95\textwidth}{3 B}
Name & Brief description\\
\hline
{\bf rax} & scratch, return value\\
dyncall/doc/manual/callconvs/callconv_x86.tex view on Meta::CPAN
\end{tabular*}
\caption{short x86 calling convention comparison}
\end{table}
\paragraph{\product{dyncall} support}
Currently cdecl, stdcall, fastcall (MS and GNU), thiscall (MS and GNU) and
plan9call are supported.\\
\product{Dyncall} can also be used to issue syscalls on Linux and *BSD by using
the syscall number as target parameter and selecting the correct mode.
\pagebreak
\subsubsection{cdecl}
\paragraph{Registers and register usage}
\begin{table}[h]
dyncall/dyncall/README-Developer.txt view on Meta::CPAN
Usage:
gcc -c dyncall_call.S -o dyncall_call.o
Advantages:
- works fine with universal binary builds (fat binaries), e.g.:
gcc -arch i386 -arch ppc -arch x86_64 -c dyncall_call.S -o dyncall_call.o
Details:
Simplified assembly file compilation via using a gigantic C Preprocessor switch include.
source file "dyncall_call.S" selects the appropriate GAS/Apple assembly file
"dyncall_call_<arch>_<asmtool>.[sS]".
archs so far:
arm32_thumb .s
arm32_arm .s
mips .s
ppc32 .s
x64 .s
x86 .S [ uses C macros ]
dyncall/dyncall/dyncall.3 view on Meta::CPAN
and
.Fn dcVCallF
can be used to bind arguments in a printf-style call, using a signature
string encoding the argument and return types. The former 2 only bind
the arguments to the
.Ar vm
object (and ignore return types specified in the
signature), whereas the latter two issue a call to the given function pointer,
afterwards. The return value will be stored in
.Ar result .
The signature string also features calling convention mode selection.
For information about the signature format, refer to dyncall_signature.h or the
.Nm
manual.
.Pp
For passing aggregates using
.Fn dc*F
functions, pass two varargs for each aggregate, first a pointer to DCaggr, then
a pointer to the aggregate in question. For returning aggregates using those
functions, pass
.Em "two final extra"
dyncall/dyncall/dyncall_call.S view on Meta::CPAN
/*
Package: dyncall
Library: dyncall
File: dyncall/dyncall_call.S
Description: assembly call kernel, auto-selected by gcc / Plan9 build system
License:
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dyncall/dyncall/dyncall_callvm.c view on Meta::CPAN
/*
Package: dyncall
Library: dyncall
File: dyncall/dyncall_callvm.c
Description: auto-select default callvm (includes other C sources).
License:
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dyncall/dyncallback/dyncall_alloc_wx.c view on Meta::CPAN
/*
Package: dyncall
Library: dyncallback
File: dyncallback/dyncall_alloc_wx.c
Description: Allocate write/executable memory - Implementation back-end selector (mmap or win32)
License:
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dyncall/dyncallback/dyncall_args.c view on Meta::CPAN
/*
Package: dyncall
Library: dyncallback
File: dyncallback/dyncall_args.c
Description: Callback's Arguments VM - Implementation back-end selector
License:
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dyncall/dyncallback/dyncall_callback.c view on Meta::CPAN
/*
Package: dyncall
Library: dyncallback
File: dyncallback/dyncall_callback.c
Description: Callback - Implementation back-end selector
License:
Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dyncall/dyncallback/dyncall_callback_arch.S view on Meta::CPAN
/*
Package: dyncall
Library: dyncallback
File: dyncallback/dyncall_callback_arch.S
Description: Callback Thunk - Implementation Back-end selector
License:
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dyncall/dyncallback/dyncall_callback_x64.S view on Meta::CPAN
/* stack space for DCValue or DCRetRegs_SysV (passed to handler as DCValue*) and padding */
SUB(LIT(4*8),RSP) /* 4 qwords for DCRetRegs_SysV */
/* call handler(*ctx, *args, *value, *userdata) - stack must be 16b aligned, here */
MOV(RAX,RDI) /* arg 0 RDI : DCCallback* (RAX) */
MOV(QWORD(RDI,CTX_userdata),RCX) /* arg 3 RCX : userdata* */
MOV(RSP,RDX) /* arg 2 RDX : DCValue* */
CALL_REG(QWORD(RAX,CTX_handler))
/* get info about return type, use to select how to store reg-based retval */
CMPL(LIT(-2/*see C*/), DWORD(RSP, 48)) /* rsp+48 = where r8 (aggr_return_register) was pushed */
/* if retval is small aggregate via regs */
JE(CSYM(scalar_retval))
MOV(QWORD(RSP,0),RAX)
MOV(QWORD(RSP,8),RDX)
MOVSD(QWORD(RSP,16),XMM0) /* @@@AGGR needed to be put in xmm in this case? @@@ also not what doc/appendix says, actually */
MOVSD(QWORD(RSP,24),XMM1) /* @@@AGGR needed to be put in xmm in this case? @@@ also not what doc/appendix says, actually */
dyncall/dyncallback/dyncall_thunk.c view on Meta::CPAN
/*
Package: dyncall
Library: dyncallback
File: dyncallback/dyncall_thunk.c
Description: Thunk - Implementation Back-end selection
License:
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dyncall/test/Makefile.embedded view on Meta::CPAN
\
CC="${CC} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
CXX="${CXX} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
LD="${LD} ${IOS_ARCH} -miphoneos-version-min=${IOS_SDK}"\
ASFLAGS="-isysroot ${IOS_SDKROOT}"\
CFLAGS="-isysroot ${IOS_SDKROOT}"\
CXXFLAGS="-isysroot ${IOS_SDKROOT}"\
LDFLAGS="-Wl,-syslibroot ${IOS_SDKROOT}"\
${MAKE_CMD} all
ios:
IOS_SDKROOT="`xcode-select -print-path`/Platforms/iPhone${IOS_PLATFORM}.platform/Developer/SDKs/iPhone${IOS_PLATFORM}${IOS_SDK}.sdk" ${MAKE_CMD} ios-sdkroot
ios-sim:
IOS_PLATFORM="Simulator" ${MAKE_CMD} ios
ios-os:
IOS_PLATFORM="OS" ${MAKE_CMD} ios
ios61-os:
IOS_SDK="6.1" IOS_ARCH="-arch armv7" ${MAKE_CMD} ios-os
ios61-os-no-thumb:
IOS_SDK="6.1" IOS_ARCH="-arch armv7 -mno-thumb" ${MAKE_CMD} ios-os
ios61-sim:
IOS_SDK="6.1" IOS_ARCH="-arch i386" ${MAKE_CMD} ios-sim
dyncall/test/ellipsis/main.cc view on Meta::CPAN
int getId();
DCpointer getFunc(int x);
DCValue* getArg(int pos);
static DCint valueInt [NARGS];
static DClonglong valueLongLong[NARGS];
static DCdouble valueDouble [NARGS];
static DCpointer valuePointer [NARGS];
bool equals(int select, int pos, void* data)
{
switch(select)
{
case 0: return ( getArg(pos)->i == valueInt [pos] ); break;
case 1: return ( getArg(pos)->l == valueLongLong[pos] ); break;
case 2: return ( getArg(pos)->d == valueDouble [pos] ); break;
case 3: return ( getArg(pos)->p == valuePointer [pos] ); break;
}
return false;
}
void clearValues();
dyncall/test/ellipsis/main.cc view on Meta::CPAN
{
for (int i = 0 ; i < NARGS ; ++i )
{
valueInt [i] = DCint (i);
valueLongLong[i] = DClonglong(i);
valueDouble [i] = DCdouble (i);
valuePointer [i] = DCpointer (i);
}
}
void arg(DCCallVM* pCall, int select, int pos)
{
switch(select)
{
case 0: dcArgInt ( pCall, valueInt [pos] ); break;
case 1: dcArgLongLong( pCall, valueLongLong[pos] ); break;
case 2: dcArgDouble ( pCall, valueDouble [pos] ); break;
case 3: dcArgPointer ( pCall, valuePointer [pos] ); break;
}
}
#define test(x) if (!(x)) return false
dyncall/test/ellipsis/main.cc view on Meta::CPAN
DCCallVM* pCall = dcNewCallVM(4096);
test( dcGetError(pCall) == DC_ERROR_NONE );
dcMode(pCall, DC_CALL_C_ELLIPSIS);
dcReset(pCall);
test( dcGetError(pCall) == DC_ERROR_NONE );
int y = x;
int selects[NARGS] = { 0 };
int pos = 0;
if (y > 0)
{
int select = (y-1) % NTYPES;
selects[pos] = select;
arg(pCall,select,pos);
y = (y-1) / NTYPES;
++pos;
}
dcMode(pCall, DC_CALL_C_ELLIPSIS_VARARGS);
for(; y>0; ++pos)
{
int select = (y-1) % NTYPES;
selects[pos] = select;
arg(pCall,select,pos);
y = (y-1) / NTYPES;
}
dcCallVoid(pCall,getFunc(x));
test( getId() == x );
for(int i=0; i<pos; ++i) {
test( equals( selects[i], i, getArg(i) ) );
}
dcFree(pCall);
return true;
}
int powerfact(int x, int n)
{
if (n==0) return 0;
return static_cast<int>( pow((double)x,n)+powerfact(x,n-1) );
dyncall/test/suite/main.c view on Meta::CPAN
enum {
ID_DOUBLE = 0,
ID_LONGLONG,
ID_INT,
ID_POINTER,
ID_BOOL,
ID_FLOAT
};
DCbool equals(int select, int pos, void* data)
{
switch(select)
{
case ID_BOOL: return ( getArg(pos)->B == valueBool [pos] ); break;
case ID_INT: return ( getArg(pos)->i == valueInt [pos] ); break;
case ID_LONGLONG: return ( getArg(pos)->l == valueLongLong[pos] ); break;
case ID_DOUBLE: return ( getArg(pos)->d == valueDouble [pos] ); break;
case ID_POINTER: return ( getArg(pos)->p == valuePointer [pos] ); break;
case ID_FLOAT: return ( getArg(pos)->f == valueFloat [pos] ); break;
}
return DC_FALSE;
}
dyncall/test/suite/main.c view on Meta::CPAN
valueBool[i] = (DCbool)((i % 1) ? DC_TRUE : DC_FALSE);
valueInt[i] = (DCint) (i);
valueLongLong[i] = (DClonglong)(i);
valueDouble[i] = (DCdouble) (i);
valuePointer[i] = (DCpointer) (ptrdiff_t) (i);
valueFloat[i] = (DCfloat) (i);
}
}
void push(DCCallVM* pCall, int select, int pos)
{
switch(select)
{
case ID_BOOL: dcArgBool ( pCall, valueBool [pos] ); break;
case ID_INT: dcArgInt ( pCall, valueInt [pos] ); break;
case ID_LONGLONG: dcArgLongLong( pCall, valueLongLong[pos] ); break;
case ID_DOUBLE: dcArgDouble ( pCall, valueDouble [pos] ); break;
case ID_POINTER: dcArgPointer ( pCall, valuePointer [pos] ); break;
case ID_FLOAT: dcArgFloat ( pCall, valueFloat [pos] ); break;
}
}
#define test(x) if (!(x)) return DC_FALSE
DCbool test_case(int x)
{
int y = x;
int selects[NARGS] = { 0, };
int pos, i;
DCCallVM* pCall = dcNewCallVM(4096);
dcReset(pCall);
clearValues();
for(pos = 0; y>0; ++pos)
{
int select = (y-1) % NTYPES;
selects[pos] = select;
push(pCall,select,pos);
y = (y-1) / NTYPES;
}
dcCallVoid(pCall,getFunc(x));
test( getId() == x );
for(i = 0;i<pos;++i) {
test( equals( selects[i], i, getArg(i) ) );
}
dcFree(pCall);
return DC_TRUE;
}
int powerfact(int x, int n)
{
if(n==0) return 0;
dyncall/test/suite3/main.cc view on Meta::CPAN
DCpointer getFunc(int x);
DCValue* getArg(int pos);
static DCint valueInt [NARGS];
static DClonglong valueLongLong[NARGS];
static DCdouble valueDouble [NARGS];
static DCfloat valueFloat [NARGS];
bool equals(int select, int pos, void* data)
{
switch(select)
{
case 0: return ( getArg(pos)->i == valueInt [pos] ); break;
case 1: return ( getArg(pos)->l == valueLongLong[pos] ); break;
case 2: return ( getArg(pos)->d == valueDouble [pos] ); break;
case 3: return ( getArg(pos)->f == valueFloat [pos] ); break;
}
return false;
}
dyncall/test/suite3/main.cc view on Meta::CPAN
for (int i = 0 ; i < NARGS ; ++i ) {
valueInt[i] = DCint(i);
valueLongLong[i] = DClonglong(i);
valueDouble[i] = DCdouble(i);
valueFloat[i] = DCfloat(i);
}
}
void push(DCCallVM* pCall, int select, int pos)
{
switch(select)
{
case 0: dcArgInt ( pCall, valueInt [pos] ); break;
case 1: dcArgLongLong( pCall, valueLongLong[pos] ); break;
case 2: dcArgDouble ( pCall, valueDouble [pos] ); break;
case 3: dcArgFloat ( pCall, valueFloat [pos] ); break;
}
}
#define test(x) if (!(x)) return false
bool test_case(int x)
{
clearValues();
DCCallVM* pCall = dcNewCallVM(4096);
dcReset(pCall);
int y = x;
int selects[NARGS] = { 0, };
int pos = 0;
for(pos = 0;y>0;++pos)
{
int select = (y-1) % NTYPES;
selects[pos] = select;
push(pCall,select,pos);
y = (y-1) / NTYPES;
}
dcCallVoid(pCall,getFunc(x));
test( getId() == x );
for(int i = 0;i<pos;++i) {
test( equals( selects[i], i, getArg(i) ) );
}
dcFree(pCall);
return true;
}
int powerfact(int x, int n)
{
if (n==0) return 0;
dyncall/test/suite_floats/main.cc view on Meta::CPAN
int getId();
DCpointer getFunc(int x);
DCValue* getArg(int pos);
static DCdouble valueDouble [NARGS];
static DCfloat valueFloat [NARGS];
bool equals(int select, int pos, void* data)
{
switch(select)
{
case 0: return ( getArg(pos)->d == valueDouble [pos] ); break;
case 1: return ( getArg(pos)->f == valueFloat [pos] ); break;
}
return false;
}
void clearValues();
void init()
{
for (int i = 0 ; i < NARGS ; ++i ) {
valueDouble[i] = DCdouble(i);
valueFloat[i] = DCfloat(i);
}
}
void push(DCCallVM* pCall, int select, int pos)
{
switch(select)
{
case 0: dcArgDouble ( pCall, valueDouble [pos] ); break;
case 1: dcArgFloat ( pCall, valueFloat [pos] ); break;
}
}
#define test(x) if (!(x)) return false
bool test_case(int x)
{
clearValues();
DCCallVM* pCall = dcNewCallVM(4096);
dcReset(pCall);
int y = x;
int selects[NARGS] = { 0, };
int pos = 0;
for(pos = 0;y>0;++pos)
{
int select = (y-1) % NTYPES;
selects[pos] = select;
push(pCall,select,pos);
y = (y-1) / NTYPES;
}
dcCallVoid(pCall,getFunc(x));
test( getId() == x );
for(int i = 0;i<pos;++i) {
test( equals( selects[i], i, getArg(i) ) );
}
dcFree(pCall);
return true;
}
int powerfact(int x, int n)
{
if (n==0) return 0;
dyncall/test/suite_x86win32fast/main.cc view on Meta::CPAN
static DCbool valueBool [NARGS];
static DCshort valueShort [NARGS];
static DCchar valueChar [NARGS];
static DCint valueInt [NARGS];
static DClonglong valueLongLong[NARGS];
static DCdouble valueDouble [NARGS];
static DCpointer valuePointer [NARGS];
static DCfloat valueFloat [NARGS];
bool equals(int select, int pos, void* data)
{
switch(select)
{
case 0: return ( getArg(pos)->B == valueBool[pos] ); break;
case 1: return ( getArg(pos)->i == valueInt[pos] ); break;
case 2: return ( getArg(pos)->l == valueLongLong[pos] ); break;
case 3: return ( getArg(pos)->d == valueDouble[pos] ); break;
case 4: return ( getArg(pos)->p == valuePointer[pos] ); break;
case 5: return ( getArg(pos)->f == valueFloat[pos] ); break;
}
return false;
}
dyncall/test/suite_x86win32fast/main.cc view on Meta::CPAN
valueBool[i] = DCbool( (i % 1) ? DC_TRUE : DC_FALSE );
valueInt[i] = DCint(i);
valueLongLong[i] = DClonglong(i);
valueDouble[i] = DCdouble(i);
valuePointer[i] = DCpointer(i);
valueFloat[i] = DCfloat(i);
}
}
void push(DCCallVM* pCall, int select, int pos)
{
switch(select)
{
case 0: dcArgBool( pCall, valueBool[pos] ); break;
case 1: dcArgInt( pCall, valueInt[pos] ); break;
case 2: dcArgLongLong( pCall, valueLongLong[pos] ); break;
case 3: dcArgDouble( pCall, valueDouble[pos] ); break;
case 4: dcArgPointer( pCall, valuePointer[pos] ); break;
case 5: dcArgFloat( pCall, valueFloat[pos] ); break;
}
}
dyncall/test/suite_x86win32fast/main.cc view on Meta::CPAN
DCCallVM* pCall = dcNewCallVM(4096);
#ifdef DC__C_GNU
dcMode(pCall, DC_CALL_C_X86_WIN32_FAST_GNU);
#else
dcMode(pCall, DC_CALL_C_X86_WIN32_FAST_MS);
#endif
dcReset(pCall);
int y = x;
int selects[NARGS] = { 0, };
int pos = 0;
for(pos = 0;y>0;++pos)
{
int select = (y-1) % NTYPES;
selects[pos] = select;
push(pCall,select,pos);
y = (y-1) / NTYPES;
}
dcCallVoid(pCall,getFunc(x));
test( getId() == x );
for(int i = 0;i<pos;++i) {
test( equals( selects[i], i, getArg(i) ) );
}
dcFree(pCall);
return true;
}
int powerfact(int x, int n)
{
if (n==0) return 0;
dyncall/test/suite_x86win32std/main.cc view on Meta::CPAN
static DCbool valueBool [NARGS];
static DCshort valueShort [NARGS];
static DCchar valueChar [NARGS];
static DCint valueInt [NARGS];
static DClonglong valueLongLong[NARGS];
static DCdouble valueDouble [NARGS];
static DCpointer valuePointer [NARGS];
static DCfloat valueFloat [NARGS];
bool equals(int select, int pos, void* data)
{
switch(select)
{
case 0: return ( getArg(pos)->B == valueBool[pos] ); break;
case 1: return ( getArg(pos)->i == valueInt[pos] ); break;
case 2: return ( getArg(pos)->L == valueLongLong[pos] ); break;
case 3: return ( getArg(pos)->d == valueDouble[pos] ); break;
case 4: return ( getArg(pos)->p == valuePointer[pos] ); break;
case 5: return ( getArg(pos)->f == valueFloat[pos] ); break;
}
return false;
}
dyncall/test/suite_x86win32std/main.cc view on Meta::CPAN
valueBool[i] = DCbool( (i % 1) ? DC_TRUE : DC_FALSE );
valueInt[i] = DCint(i);
valueLongLong[i] = DClonglong(i);
valueDouble[i] = DCdouble(i);
valuePointer[i] = DCpointer(i);
valueFloat[i] = DCfloat(i);
}
}
void push(DCCallVM* pCall, int select, int pos)
{
switch(select)
{
case 0: dcArgBool( pCall, valueBool[pos] ); break;
case 1: dcArgInt( pCall, valueInt[pos] ); break;
case 2: dcArgLongLong( pCall, valueLongLong[pos] ); break;
case 3: dcArgDouble( pCall, valueDouble[pos] ); break;
case 4: dcArgPointer( pCall, valuePointer[pos] ); break;
case 5: dcArgFloat( pCall, valueFloat[pos] ); break;
}
}
dyncall/test/suite_x86win32std/main.cc view on Meta::CPAN
bool test_case(int x)
{
clearValues();
DCCallVM* pCall = dcNewCallVM(4096);
dcMode(pCall, DC_CALL_C_X86_WIN32_STD);
dcReset(pCall);
int y = x;
int selects[NARGS] = { 0, };
int pos = 0;
for(pos = 0;y>0;++pos)
{
int select = (y-1) % NTYPES;
selects[pos] = select;
push(pCall,select,pos);
y = (y-1) / NTYPES;
}
dcCallVoid(pCall,getFunc(x));
test( getId() == x );
for(int i = 0;i<pos;++i) {
test( equals( selects[i], i, getArg(i) ) );
}
dcFree(pCall);
return true;
}
int powerfact(int x, int n)
{
if (n==0) return 0;