Merge pull request #13 from nventive/dev/djo/ios-device-2

iOS - build on device
This commit is contained in:
David Oliver 2019-05-21 13:04:35 -04:00 committed by GitHub
commit 2a50a24875
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 2 deletions

View file

@ -102,17 +102,28 @@ namespace CalculationManager
[DllImport(DllPath)] [DllImport(DllPath)]
public static extern CommandType IExpressionCommand_GetCommandType(IntPtr pExpressionCommand); public static extern CommandType IExpressionCommand_GetCommandType(IntPtr pExpressionCommand);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate IntPtr GetCEngineStringFunc(IntPtr state, IntPtr id); public delegate IntPtr GetCEngineStringFunc(IntPtr state, IntPtr id);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void BinaryOperatorReceivedFunc(IntPtr state); public delegate void BinaryOperatorReceivedFunc(IntPtr state);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SetPrimaryDisplayCallbackFunc(IntPtr state, IntPtr pDisplayStringValue, bool isError); public delegate void SetPrimaryDisplayCallbackFunc(IntPtr state, IntPtr pDisplayStringValue, bool isError);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SetIsInErrorCallbackFunc(IntPtr state, bool isError); public delegate void SetIsInErrorCallbackFunc(IntPtr state, bool isError);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SetParenthesisNumberCallbackFunc(IntPtr state, int parenthesisCount); public delegate void SetParenthesisNumberCallbackFunc(IntPtr state, int parenthesisCount);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void MaxDigitsReachedCallbackFunc(IntPtr state); public delegate void MaxDigitsReachedCallbackFunc(IntPtr state);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void MemoryItemChangedCallbackFunc(IntPtr state, int indexOfMemory); public delegate void MemoryItemChangedCallbackFunc(IntPtr state, int indexOfMemory);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void OnHistoryItemAddedCallbackFunc(IntPtr state, int addedItemIndex); public delegate void OnHistoryItemAddedCallbackFunc(IntPtr state, int addedItemIndex);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void OnNoRightParenAddedCallbackFunc(IntPtr state); public delegate void OnNoRightParenAddedCallbackFunc(IntPtr state);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SetExpressionDisplayCallbackFunc(IntPtr state, IntPtr data); public delegate void SetExpressionDisplayCallbackFunc(IntPtr state, IntPtr data);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SetMemorizedNumbersCallbackFunc(IntPtr state, int count, IntPtr newMemorizedNumbers); public delegate void SetMemorizedNumbersCallbackFunc(IntPtr state, int count, IntPtr newMemorizedNumbers);
public static GetCEngineStringFunc _getCEngineStringCallback = GetCEngineStringCallback; public static GetCEngineStringFunc _getCEngineStringCallback = GetCEngineStringCallback;
@ -128,6 +139,9 @@ namespace CalculationManager
public static SetExpressionDisplayCallbackFunc _setExpressionDisplayCallback = SetExpressionDisplayCallback; public static SetExpressionDisplayCallbackFunc _setExpressionDisplayCallback = SetExpressionDisplayCallback;
public static SetMemorizedNumbersCallbackFunc _setMemorizedNumbersCallback = SetMemorizedNumbersCallback; public static SetMemorizedNumbersCallbackFunc _setMemorizedNumbersCallback = SetMemorizedNumbersCallback;
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(MaxDigitsReachedCallbackFunc))]
#endif
public static void MaxDigitsReachedCallback(IntPtr state) public static void MaxDigitsReachedCallback(IntPtr state)
{ {
var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay; var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay;
@ -136,6 +150,9 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.MaxDigitsReachedCallback"); DebugTrace($"CalculatorManager.MaxDigitsReachedCallback");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(MemoryItemChangedCallbackFunc))]
#endif
public static void MemoryItemChangedCallback(IntPtr state, int indexOfMemory) public static void MemoryItemChangedCallback(IntPtr state, int indexOfMemory)
{ {
var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay; var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay;
@ -144,6 +161,9 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.MemoryItemChangedCallback({indexOfMemory})"); DebugTrace($"CalculatorManager.MemoryItemChangedCallback({indexOfMemory})");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(OnHistoryItemAddedCallbackFunc))]
#endif
public static void OnHistoryItemAddedCallback(IntPtr state, int addedItemIndex) public static void OnHistoryItemAddedCallback(IntPtr state, int addedItemIndex)
{ {
var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay; var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay;
@ -152,6 +172,9 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.OnHistoryItemAddedCallback({addedItemIndex})"); DebugTrace($"CalculatorManager.OnHistoryItemAddedCallback({addedItemIndex})");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(OnNoRightParenAddedCallbackFunc))]
#endif
public static void OnNoRightParenAddedCallback(IntPtr state) public static void OnNoRightParenAddedCallback(IntPtr state)
{ {
var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay; var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay;
@ -160,6 +183,9 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.OnNoRightParenAddedCallback"); DebugTrace($"CalculatorManager.OnNoRightParenAddedCallback");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetExpressionDisplayCallbackFunc))]
#endif
public static void SetExpressionDisplayCallback(IntPtr state, IntPtr historyItem) public static void SetExpressionDisplayCallback(IntPtr state, IntPtr historyItem)
{ {
DebugTrace($"CalculatorManager.SetExpressionDisplayCallback({state}, {historyItem})"); DebugTrace($"CalculatorManager.SetExpressionDisplayCallback({state}, {historyItem})");
@ -177,6 +203,9 @@ namespace CalculationManager
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetMemorizedNumbersCallbackFunc))]
#endif
public static void SetMemorizedNumbersCallback(IntPtr state, int count, IntPtr newMemorizedNumbers) public static void SetMemorizedNumbersCallback(IntPtr state, int count, IntPtr newMemorizedNumbers)
{ {
var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay; var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay;
@ -193,6 +222,9 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.SetMemorizedNumbersCallback({string.Join(";", numbers)})"); DebugTrace($"CalculatorManager.SetMemorizedNumbersCallback({string.Join(";", numbers)})");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetParenthesisNumberCallbackFunc))]
#endif
public static void SetParenthesisNumberCallback(IntPtr state, int parenthesisCount) public static void SetParenthesisNumberCallback(IntPtr state, int parenthesisCount)
{ {
var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay; var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay;
@ -201,6 +233,10 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.SetParenthesisNumberCallback({parenthesisCount})"); DebugTrace($"CalculatorManager.SetParenthesisNumberCallback({parenthesisCount})");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(BinaryOperatorReceivedFunc))]
#endif
public static void BinaryOperatorReceivedCallback(IntPtr state) public static void BinaryOperatorReceivedCallback(IntPtr state)
{ {
var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay; var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay;
@ -209,6 +245,9 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.BinaryOperatorReceivedCallback"); DebugTrace($"CalculatorManager.BinaryOperatorReceivedCallback");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetPrimaryDisplayCallbackFunc))]
#endif
public static void SetPrimaryDisplayCallback(IntPtr state, IntPtr pDisplayStringValue, bool isError) public static void SetPrimaryDisplayCallback(IntPtr state, IntPtr pDisplayStringValue, bool isError)
{ {
var displayStringValue = PtrToString(pDisplayStringValue); var displayStringValue = PtrToString(pDisplayStringValue);
@ -219,6 +258,9 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.SetPrimaryDisplayCallback({displayStringValue}, {isError})"); DebugTrace($"CalculatorManager.SetPrimaryDisplayCallback({displayStringValue}, {isError})");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetIsInErrorCallbackFunc))]
#endif
public static void SetIsInErrorCallback(IntPtr state, bool isError) public static void SetIsInErrorCallback(IntPtr state, bool isError)
{ {
var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay; var manager = GCHandle.FromIntPtr((IntPtr)state).Target as CalculatorDisplay;
@ -227,6 +269,9 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.SetIsInErrorCallback({isError})"); DebugTrace($"CalculatorManager.SetIsInErrorCallback({isError})");
} }
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(GetCEngineStringFunc))]
#endif
public static IntPtr GetCEngineStringCallback(IntPtr state, IntPtr pResourceId) public static IntPtr GetCEngineStringCallback(IntPtr state, IntPtr pResourceId)
{ {
var provider = GCHandle.FromIntPtr(state).Target as EngineResourceProvider; var provider = GCHandle.FromIntPtr(state).Target as EngineResourceProvider;

View file

@ -13,7 +13,7 @@
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string></string> <string>9.0</string>
<key>UIDeviceFamily</key> <key>UIDeviceFamily</key>
<array> <array>
<integer>1</integer> <integer>1</integer>