From d76442512fd4314fcedbdc28a611f676ab70ce2b Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 25 May 2016 13:28:25 +0200 Subject: * project directory structure --- src/BCalcWrapper.cs | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/BCalcWrapper.cs (limited to 'src/BCalcWrapper.cs') diff --git a/src/BCalcWrapper.cs b/src/BCalcWrapper.cs new file mode 100644 index 0000000..d2d0aa2 --- /dev/null +++ b/src/BCalcWrapper.cs @@ -0,0 +1,44 @@ +using System; +using System.Runtime.InteropServices; + +namespace BCDD +{ + /// + /// Wrapper class for libbcalcDDS.ddl. + /// + class BCalcWrapper + { + public static char[] DENOMINATIONS = { 'C', 'D', 'H', 'S', 'N' }; + public static char[] PLAYERS = { 'N', 'E', 'S', 'W' }; + + /// http://bcalc.w8.pl/API_C/bcalcdds_8h.html#a8f522e85482fe383bebd963e873897f5 + [DllImport(@"libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr bcalcDDS_new(IntPtr format, IntPtr hands, Int32 trump, Int32 leader); + + /// http://bcalc.w8.pl/API_C/bcalcdds_8h.html#a369ce661d027bef3f717967e42bf8b33 + [DllImport(@"libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern Int32 bcalcDDS_getTricksToTake(IntPtr solver); + + /// http://bcalc.w8.pl/API_C/bcalcdds_8h.html#a8998a1eb1ca25de2e07448381ce63261 + [DllImport(@"libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr bcalcDDS_getLastError(IntPtr solver); + + /// http://bcalc.w8.pl/API_C/bcalcdds_8h.html#a4a68da83bc7da4663e2257429539912d + [DllImport(@"libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void bcalcDDS_delete(IntPtr solver); + + /// http://bcalc.w8.pl/API_C/bcalcdds_8h.html#a88fba3432e66efa5979bbc9e1f044164 + [DllImport(@"libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void bcalcDDS_setTrumpAndReset(IntPtr solver, Int32 trump); + + /// http://bcalc.w8.pl/API_C/bcalcdds_8h.html#a616031c1e1d856c4aac14390693adb4c + [DllImport(@"libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void bcalcDDS_setPlayerOnLeadAndReset(IntPtr solver, Int32 player); + + /// http://bcalc.w8.pl/API_C/bcalcdds_8h.html#a6977a3b789bdf64eb2da9cbdb8b8fc39 + public static Int32 bcalc_declarerToLeader(Int32 player) + { + return (player + 1) & 3; + } + } +} -- cgit v1.2.3