theLink 10.0
Loading...
Searching...
No Matches
LibMqMsgque.cs
Go to the documentation of this file.
1
12/* LABEL-NO */
13using System;
14using System.Reflection;
15using System.Runtime.InteropServices;
16using System.Threading;
17using System.Threading.Tasks;
18using System.Runtime.CompilerServices;
19using csmkkernel;
20using csmqmsgque;
22/* LABEL-END */
23
24using System.Collections.Generic;
25
26[assembly:AssemblyTitleAttribute("csmqmsgque")]
27[assembly:AssemblyDescriptionAttribute("Programming-Language-Micro-Kernel for C#")]
28[assembly:AssemblyConfigurationAttribute("")]
29[assembly:AssemblyCompanyAttribute("IPN")]
30[assembly:AssemblyProductAttribute("csmqmsgque")]
31[assembly:AssemblyCopyrightAttribute("Copyright (c) Andreas Otto 2022")]
32[assembly:AssemblyTrademarkAttribute("NHI1")]
33[assembly:AssemblyCultureAttribute("")]
34
35[assembly:AssemblyVersionAttribute("10.0.*")]
36[assembly:ComVisible(false)]
37[assembly:CLSCompliantAttribute(true)]
38
39// MARK_D ################################################################
40// -----------------------------------------------------------------------
41// documentation order
42
51
64
89
98
107
115
124
132
133/*
134 // BEGIN-CLASS - created by 'cs_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
135
136 MqFactoryC.SetupThreadFCT(mkrt);
137 MqContextC.SetupThreadCTX(mkrt);
138 MqDumpC.SetupThreadDMP(mkrt);
139
140 // END-CLASS - created by 'cs_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
141*/
142
143// --------------------------------------------------------------------------------
144
145namespace csmqmsgque {
146
149 public static partial class MqMsgque {
150
153
154//MkObjectC.DbgM($"Init -> {Environment.CurrentManagedThreadId}");
155 static unsafe private void MqSetupTmpl() {
156 Mq.MqSetup();
157 Mq.MqCsInit(MqSysServerThreadCB,null);
158 //Mq.MqCsInit(MqSysServerThreadCB,MkSysExitCB);
159 }
160 static private void MqCleanupTmpl() {
161 }
162
164 } // END-MqMsgque
165
166
167 // BEGIN-MqMsgque - created by 'cs_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
168
169 public partial class MqMsgque {
170
174
175 // doc-key: MqMsgque,MqMsgque-Enum,sco
176
178 public static MqIdentE IdentE_FromInt (int value) {
179 MqIdentE value_out;
180 MkErrorE errVal = Mq.MqIdentE_FromInt(value, out value_out);
181 if (errVal > MkErrorE.CONTINUE) MkErrorC.Check(errVal);
182 return value_out;
183 }
184
186 public static MqSlaveE SlaveE_FromInt (int value) {
187 MqSlaveE value_out;
188 MkErrorE errVal = Mq.MqSlaveE_FromInt(value, out value_out);
189 if (errVal > MkErrorE.CONTINUE) MkErrorC.Check(errVal);
190 return value_out;
191 }
192
194 public static MqStartE StartE_FromInt (int value) {
195 MqStartE value_out;
196 MkErrorE errVal = Mq.MqStartE_FromInt(value, out value_out);
197 if (errVal > MkErrorE.CONTINUE) MkErrorC.Check(errVal);
198 return value_out;
199 }
200
202 public static MqStatusIsEF StatusIsEF_FromInt (int value) {
203 MqStatusIsEF value_out;
204 MkErrorE errVal = Mq.MqStatusIsEF_FromInt(value, out value_out);
205 if (errVal > MkErrorE.CONTINUE) MkErrorC.Check(errVal);
206 return value_out;
207 }
208
210 public static MqWaitOnEventE WaitOnEventE_FromInt (int value) {
211 MqWaitOnEventE value_out;
212 MkErrorE errVal = Mq.MqWaitOnEventE_FromInt(value, out value_out);
213 if (errVal > MkErrorE.CONTINUE) MkErrorC.Check(errVal);
214 return value_out;
215 }
216
217 // doc-key: MqMsgque,MqMsgque-Enum,sm_
218
220 public static int IdentE_ToInt (MqIdentE value) {
221 Int32 __retVal__L = Mq.MqIdentE_ToInt(value);
222 return __retVal__L;
223 }
224
226 public static string IdentE_ToString (MqIdentE value) {
227 IntPtr __retVal__L = Mq.MqIdentE_ToString(value);
228 return Marshal.PtrToStringAnsi(__retVal__L);
229 }
230
232 public static int SlaveE_ToInt (MqSlaveE value) {
233 Int32 __retVal__L = Mq.MqSlaveE_ToInt(value);
234 return __retVal__L;
235 }
236
238 public static string SlaveE_ToString (MqSlaveE value) {
239 IntPtr __retVal__L = Mq.MqSlaveE_ToString(value);
240 return Marshal.PtrToStringAnsi(__retVal__L);
241 }
242
244 public static int StartE_ToInt (MqStartE value) {
245 Int32 __retVal__L = Mq.MqStartE_ToInt(value);
246 return __retVal__L;
247 }
248
250 public static string StartE_ToString (MqStartE value) {
251 IntPtr __retVal__L = Mq.MqStartE_ToString(value);
252 return Marshal.PtrToStringAnsi(__retVal__L);
253 }
254
256 public static int StatusIsEF_ToInt (MqStatusIsEF value) {
257 Int32 __retVal__L = Mq.MqStatusIsEF_ToInt(value);
258 return __retVal__L;
259 }
260
262 public static string StatusIsEF_ToString (MqStatusIsEF value) {
263 IntPtr __retVal__L = Mq.MqStatusIsEF_ToString(value);
264 return Marshal.PtrToStringAnsi(__retVal__L);
265 }
266
268 public static int WaitOnEventE_ToInt (MqWaitOnEventE value) {
269 Int32 __retVal__L = Mq.MqWaitOnEventE_ToInt(value);
270 return __retVal__L;
271 }
272
274 public static string WaitOnEventE_ToString (MqWaitOnEventE value) {
275 IntPtr __retVal__L = Mq.MqWaitOnEventE_ToString(value);
276 return Marshal.PtrToStringAnsi(__retVal__L);
277 }
278
280 // MqMsgque_Enum_CS_API
281 }
282
283 public partial class MqMsgque {
284
288
289 // doc-key: MqMsgque,MqMsgque-Help,sm_
290
292 public static string Help (string tool) {
293 IntPtr tool_cstr = Marshal.StringToHGlobalAnsi(tool);
294 IntPtr __retVal__L = Mq.MqHelp(tool_cstr);
295 Marshal.FreeHGlobal(tool_cstr);
296 return Marshal.PtrToStringAnsi(__retVal__L);
297 }
298
300 public static string HelpMsgque () {
301 IntPtr __retVal__L = Mq.MqHelpMsgque();
302 return Marshal.PtrToStringAnsi(__retVal__L);
303 }
304
306 // MqMsgque_Help_CS_API
307 }
308
309 public partial class MqMsgque {
310
314
315 // doc-key: MqMsgque,MqMsgque-Init,sm_
316
318 public static MkBufferListC InitGetArg0 () {
319 IntPtr __retVal__L = Mq.MqInitGetArg0();
320 return MkBufferListC.MkBufferListC_ObjNew(__retVal__L);
321 }
322
324 public static MkBufferListC InitResetArg0 () {
325 IntPtr __retVal__L = Mq.MqInitResetArg0();
326 return MkBufferListC.MkBufferListC_ObjNew(__retVal__L);
327 }
328
330 public static void InitSetArg0 (MkBufferListC bfl = null) {
331 IntPtr bfl_hdl = MkBufferListC.getOBJ_null_allow(bfl);
332 Mq.MqInitSetArg0(bfl_hdl);
333 }
334
336 public static void InitSetArg0 (params string[] bfl) {
337 // OVERLOAD
338 InitSetArg0 (new MkBufferListC(bfl));
339 }
340
342 // MqMsgque_Init_CS_API
343 }
344
345 public partial class MqMsgque {
346
350
351 // doc-key: MqMsgque,MqMsgque-Setup,sm_
352
354 public static void Cleanup () {
355 MqCleanupTmpl();
356 }
357
359 public static void Setup () {
360 MqSetupTmpl();
361 }
362
364 // MqMsgque_Setup_CS_API
365 }
366
367 // END-MqMsgque - created by 'cs_MqC.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
368
369// OVERLOAD
370
371 public partial class MqMsgque {
372//MkObjectC.DbgM("============================================================================");
373//MkObjectC.DbgM($"Thread MAIN -> mkrt=0x{mkrt}");
374//MkObjectC.DbgM($"Thread START -> mkrt=0x{Mk.MkRuntimeGet()}, tId={System.Environment.CurrentManagedThreadId}");
375//MkObjectC.DbgM($"Thread END -> mkrt=0x{Mk.MkRuntimeGet()}, tId={System.Environment.CurrentManagedThreadId}");
376//MkObjectC.DbgM($"Start Task -> idP={Convert.ToString((long)idP, 16)}, val={(*idP).val}");
377//MkObjectC.DbgM($"Start Wait -> idP={Convert.ToString((long)idP, 16)}, val={(*idP).val}, type={(*idP).type}");
378 private unsafe static MkErrorE MqSysServerThreadCB (
379 IntPtr mkrt, IntPtr ctx, IntPtr argP, String name, int state, MkIdS *idP
380 ) {
381 try {
382 var thread = Task.Factory.StartNew( () => {
383 Mq.MqSysServerThreadMain(argP);
384 });
385
386 (*idP).type = MkIdSE.THREAD;
387 if ((*idP).ioIsPipe) {
388 (*idP).val = (IntPtr)GCHandle.Alloc(thread,GCHandleType.Weak);
389 (*idP).setByExtern = true;
390 } else {
391 (*idP).val = (IntPtr) 0x1;
392 }
393 } catch (Exception ex) {
394 return MkErrorC.DEFAULT().Catch(ex).GetCode();
395 }
396 return MkErrorE.OK;
397 }
398
399//MkObjectC.DbgM($"Start Exit -> isThread={isThread}, num={num}");
400//MkObjectC.DbgM("End Exit");
401
402/*
403replaced by sThreadExit/sProcessExit and "true" return
404
405 private static void MkSysExitCB ( int isThread, int num ) {
406 if (isThread != 0) {
407 // do nothing, end of MqSysServerThreadMain finish thread
408 } else {
409 Environment.Exit(num);
410 }
411 // FINISH
412 }
413*/
414 }
415
416} // END - namespace "csmqmsgque"
static MkBufferListC MkBufferListC_ObjNew(IntPtr hdl)
static void Check(IntPtr ctx, MkErrorE err)
MqMsgque PACKAGE - the package is the toplevel structure of the csmqmsgque …
MkErrorC Catch(Exception exception=null,[CallerMemberName]string callfunc=null)
static MkErrorC DEFAULT()
MkErrorE
static MqSlaveE SlaveE_FromInt(int value)
C#: [static] MqSlaveE SlaveE_FromInt(int value) → C-API return the MqSlaveE from integer …
static string StatusIsEF_ToString(MqStatusIsEF value)
C#: [static] string StatusIsEF_ToString(MqStatusIsEF value) → C-API return the MqStatusIsEF as s...
static int IdentE_ToInt(MqIdentE value)
C#: [static] int IdentE_ToInt(MqIdentE value) → C-API return the MqIdentE as integer …
static int WaitOnEventE_ToInt(MqWaitOnEventE value)
C#: [static] int WaitOnEventE_ToInt(MqWaitOnEventE value) → C-API return the MqWaitOnEventE as i...
static string WaitOnEventE_ToString(MqWaitOnEventE value)
C#: [static] string WaitOnEventE_ToString(MqWaitOnEventE value) → C-API return the MqWaitOnEvent...
static string StartE_ToString(MqStartE value)
C#: [static] string StartE_ToString(MqStartE value) → C-API return the MqStartE as string …
static MqStartE StartE_FromInt(int value)
C#: [static] MqStartE StartE_FromInt(int value) → C-API return the MqStartE from integer …
static string IdentE_ToString(MqIdentE value)
C#: [static] string IdentE_ToString(MqIdentE value) → C-API return the MqIdentE as string …
static MqStatusIsEF StatusIsEF_FromInt(int value)
C#: [static] MqStatusIsEF StatusIsEF_FromInt(int value) → C-API return the MqStatusIsEF from int...
static int SlaveE_ToInt(MqSlaveE value)
C#: [static] int SlaveE_ToInt(MqSlaveE value) → C-API return the MqSlaveE as integer …
static int StatusIsEF_ToInt(MqStatusIsEF value)
C#: [static] int StatusIsEF_ToInt(MqStatusIsEF value) → C-API return the MqStatusIsEF as integer...
static MqWaitOnEventE WaitOnEventE_FromInt(int value)
C#: [static] MqWaitOnEventE WaitOnEventE_FromInt(int value) → C-API return the MqWaitOnEventE fr...
static MqIdentE IdentE_FromInt(int value)
C#: [static] MqIdentE IdentE_FromInt(int value) → C-API return the MqIdentE from integer …
static string SlaveE_ToString(MqSlaveE value)
C#: [static] string SlaveE_ToString(MqSlaveE value) → C-API return the MqSlaveE as string …
static int StartE_ToInt(MqStartE value)
C#: [static] int StartE_ToInt(MqStartE value) → C-API return the MqStartE as integer …
static string Help(string tool)
C#: [static] string Help(string tool) → C-API write csmqmsgque specific user-help to stderr
static string HelpMsgque()
C#: [static] string HelpMsgque() → C-API return a page with the usage of all csmqmsgque specific...
static MkBufferListC InitResetArg0()
C#: [static] MkBufferListC InitResetArg0() → C-API Reset the process-startup-prefix argument to ...
static MkBufferListC InitGetArg0()
C#: [static] MkBufferListC InitGetArg0() → C-API get the process startup-prefix argument
static void InitSetArg0(params string[] bfl)
C#: [static] InitSetArg0(MkBufferListC bfl = null) → C-API set the process startup-prefix argume...
static void InitSetArg0(MkBufferListC bfl=null)
C#: [static] InitSetArg0(MkBufferListC bfl = null) → C-API set the process startup-prefix argume...
static void Cleanup()
C#: [static] Cleanup() → C-API cleanup csmqmsgque internal memory …
static void Setup()
C#: [static] Setup() → C-API setup csmqmsgque internal memory …
MqStartE
→ C-API: MqStartE → C-API: MqStartE
MqStatusIsEF
→ C-API: MqStatusIsEF → C-API: MqStatusIsEF
MqIdentE
→ C-API: MqIdentE → C-API: MqIdentE
MqSlaveE
→ C-API: MqSlaveE → C-API: MqSlaveE
MqWaitOnEventE
→ C-API: MqWaitOnEventE → C-API: MqWaitOnEventE