-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWolframLanguageRuntime.cs
More file actions
147 lines (118 loc) · 5.94 KB
/
Copy pathWolframLanguageRuntime.cs
File metadata and controls
147 lines (118 loc) · 5.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
This file was generated automatically from the SDK C headers by ClangSharpPInvokeGenerator:
dotnet tool install --global ClangSharpPInvokeGenerator --version 20.1.2.1
*/
using System.Runtime.InteropServices;
using System.Diagnostics;
using System;
namespace WolframLanguageRuntime
{
public class WLR
{
public enum wlr_error_type
{
WLR_SUCCESS = 0,
WLR_ALLOCATION_ERROR = 1,
WLR_UNEXPECTED_TYPE = 2,
WLR_ERROR_EXPRESSION = 3,
WLR_MISCELLANEOUS_ERROR = 4,
WLR_OUT_OF_BOUNDS = 5,
WLR_SIGNING_ERROR = 6,
WLR_UNSAFE_EXPRESSION = 7,
WLR_MALFORMED = 8,
WLR_RUNTIME_NOT_STARTED = 9,
}
public enum wlr_license_type
{
WLR_SIGNED_CODE_MODE = 0,
WLR_LICENSE_OR_SIGNED_CODE_MODE = 1,
}
public enum wlr_version_type
{
WLR_VERSION_1 = 0,
}
public enum wlr_application_type
{
WLR_EXECUTABLE = 0,
WLR_DYNAMIC_LIBRARY = 1,
}
public enum wlr_containment_type
{
WLR_CONTAINED = 0,
WLR_UNCONTAINED = 1,
}
public unsafe partial struct wlr_runtime_configuration
{
[NativeTypeName("mint")]
public int argumentCount;
[NativeTypeName("char **")]
public sbyte** arguments;
[NativeTypeName("wlr_containment_t")]
public wlr_containment_type containmentSetting;
}
public static unsafe partial class Methods
{
private const string sdkDynamicLibraryName = "StandaloneApplicationsSDK_Shared.dll";
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("wlr_err_t")]
public static extern wlr_error_type wlr_sdk_StartRuntime([NativeTypeName("wlr_application_t")] wlr_application_type applicationType, [NativeTypeName("wlr_version_t")] wlr_version_type version, [NativeTypeName("wlr_license_t")] wlr_license_type licenseType, [NativeTypeName("const char *")] sbyte* layoutDirectory, [NativeTypeName("const wlr_runtime_conf *")] wlr_runtime_configuration* configuration);
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("wlr_expr")]
public static extern void* wlr_String([NativeTypeName("const char *")] sbyte* @string);
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("wlr_expr")]
public static extern void* wlr_Eval([NativeTypeName("wlr_expr")] void* expression);
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void wlr_ReleaseExpression([NativeTypeName("wlr_expr")] void* detachedExpression);
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("wlr_err_t")]
public static extern wlr_error_type wlr_StringData([NativeTypeName("wlr_expr")] void* expression, [NativeTypeName("char **")] sbyte** resultData, [NativeTypeName("mint *")] int* resultLength);
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("wlr_expr")]
public static extern void* wlr_ParseExpression([NativeTypeName("wlr_expr")] void* inputString);
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("wlr_expr")]
public static extern void* wlr_VariadicE(void* expressionHead, [NativeTypeName("mint")] long childElementNumber, __arglist);
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("wlr_expr")]
public static extern void* wlr_Symbol([NativeTypeName("const char *")] sbyte* symbolName);
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void wlr_CreateExpressionPool();
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void wlr_ReleaseExpressionPool();
[DllImport(sdkDynamicLibraryName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void wlr_Release(void* data);
}
// The following is machinery (unrelated to the standalone applications SDK) generated by ClangSharpPInvokeGenerator ...
/// <summary>Defines the annotation found in a native declaration.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
[Conditional("DEBUG")]
internal sealed partial class NativeAnnotationAttribute : Attribute
{
private readonly string _annotation;
/// <summary>Initializes a new instance of the <see cref="NativeAnnotationAttribute" /> class.</summary>
/// <param name="annotation">The annotation that was used in the native declaration.</param>
public NativeAnnotationAttribute(string annotation)
{
_annotation = annotation;
}
/// <summary>Gets the annotation that was used in the native declaration.</summary>
public string Annotation => _annotation;
}
/// <summary>Defines the type of a member as it was used in the native signature.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)]
[Conditional("DEBUG")]
internal sealed partial class NativeTypeNameAttribute : Attribute
{
private readonly string _name;
/// <summary>Initializes a new instance of the <see cref="NativeTypeNameAttribute" /> class.</summary>
/// <param name="name">The name of the type that was used in the native signature.</param>
public NativeTypeNameAttribute(string name)
{
_name = name;
}
/// <summary>Gets the name of the type that was used in the native signature.</summary>
public string Name => _name;
}
}
}