feat: (macOS) Add Support for plattform on native wrappers

This commit is contained in:
Andres Pineda 2020-05-06 14:39:48 -04:00 коммит произвёл Jerome Laban
Родитель dd874072db
Коммит 5c67d7e1b3
1 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -156,7 +156,7 @@ namespace CalculationManager
public static SetExpressionDisplayCallbackFunc _setExpressionDisplayCallback = SetExpressionDisplayCallback;
public static SetMemorizedNumbersCallbackFunc _setMemorizedNumbersCallback = SetMemorizedNumbersCallback;
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(MaxDigitsReachedCallbackFunc))]
#endif
public static void MaxDigitsReachedCallback(IntPtr state)
@ -167,7 +167,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.MaxDigitsReachedCallback");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(MemoryItemChangedCallbackFunc))]
#endif
public static void MemoryItemChangedCallback(IntPtr state, int indexOfMemory)
@ -178,7 +178,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.MemoryItemChangedCallback({indexOfMemory})");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(OnHistoryItemAddedCallbackFunc))]
#endif
public static void OnHistoryItemAddedCallback(IntPtr state, int addedItemIndex)
@ -189,7 +189,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.OnHistoryItemAddedCallback({addedItemIndex})");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(OnNoRightParenAddedCallbackFunc))]
#endif
public static void OnNoRightParenAddedCallback(IntPtr state)
@ -200,7 +200,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.OnNoRightParenAddedCallback");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetExpressionDisplayCallbackFunc))]
#endif
public static void SetExpressionDisplayCallback(IntPtr state, IntPtr historyItem)
@ -220,7 +220,7 @@ namespace CalculationManager
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetMemorizedNumbersCallbackFunc))]
#endif
public static void SetMemorizedNumbersCallback(IntPtr state, int count, IntPtr newMemorizedNumbers)
@ -239,7 +239,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.SetMemorizedNumbersCallback({string.Join(";", numbers)})");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetParenthesisNumberCallbackFunc))]
#endif
public static void SetParenthesisNumberCallback(IntPtr state, int parenthesisCount)
@ -250,7 +250,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.SetParenthesisNumberCallback({parenthesisCount})");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(BinaryOperatorReceivedFunc))]
#endif
@ -262,7 +262,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.BinaryOperatorReceivedCallback");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetPrimaryDisplayCallbackFunc))]
#endif
public static void SetPrimaryDisplayCallback(IntPtr state, IntPtr pDisplayStringValue, bool isError)
@ -275,7 +275,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.SetPrimaryDisplayCallback({displayStringValue}, {isError})");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(SetIsInErrorCallbackFunc))]
#endif
public static void SetIsInErrorCallback(IntPtr state, bool isError)
@ -286,7 +286,7 @@ namespace CalculationManager
DebugTrace($"CalculatorManager.SetIsInErrorCallback({isError})");
}
#if __IOS__
#if __IOS__ || __MACOS__
[ObjCRuntime.MonoPInvokeCallback(typeof(GetCEngineStringFunc))]
#endif
public static IntPtr GetCEngineStringCallback(IntPtr state, IntPtr pResourceId)
@ -306,7 +306,7 @@ namespace CalculationManager
internal static IntPtr StringToHGlobal(string resourceValue)
{
#if __WASM__ || __IOS__ || __ANDROID__
#if __WASM__ || __IOS__ || __ANDROID__ || __MACOS__
// wchar_t is 32bits
return StringToHGlobalUTF32(resourceValue);
#else
@ -316,7 +316,7 @@ namespace CalculationManager
internal static string PtrToString(IntPtr pResourceId)
{
#if __WASM__ || __IOS__ || __ANDROID__
#if __WASM__ || __IOS__ || __ANDROID__ || __MACOS__
return PtrToStringUTF32(pResourceId);
#else
return Marshal.PtrToStringUni(pResourceId);