12using System.Reflection;
13using System.Runtime.InteropServices;
14using System.Runtime.CompilerServices;
15using System.Collections.Generic;
16using System.Threading;
24 public partial class MkBufferC
26 public partial class MkBufferC : MkObjectC
29 private readonly
static ConstructorInfo ctor =
getCtor(typeof(MkBufferC));
30 private readonly
static ThreadLocal<MkBufferC> MK_NULL =
new ThreadLocal<MkBufferC>(() => {
38 private static MkBufferC MkBufferC_ObjCreate (IntPtr
hdl) {
42 private static IntPtr MkBufferC_SelfCreate (IntPtr
mkrt, IntPtr obj, IntPtr env) {
46 private static void MkBufferC_SelfUnlink (IntPtr
mkrt, IntPtr
self, IntPtr env) {
50 internal static void SetupThreadBUF (IntPtr
mkrt) {
51 Mk.MkCsTypeUpdate(
mkrt, MkCsTypeLookupE.BUF, MkBufferC_SelfCreate, MkBufferC_SelfUnlink);
54 #if !META_STATIC_OVERWRITE
59 SetupThreadBUF(IntPtr.Zero);
65 internal MkBufferC (IntPtr bufP) : base(bufP) {
67 if (bufP != IntPtr.Zero &&
Mk.MkBufferIsLocal(
mkrt,bufP)) GC.SuppressFinalize(
this);
74 public partial class MkBufferC {
84 IntPtr val_cstr = Marshal.StringToHGlobalAnsi(val);
85 IntPtr __retVal__L =
Mk.MkBufferAppendC(
mkrt,
hdl, val_cstr);
86 Marshal.FreeHGlobal(val_cstr);
92 IntPtr val_ref_cstr = Marshal.StringToHGlobalAnsi(val);
94 IntPtr __retVal__L =
Mk.MkBufferAppendStringR(
mkrt,
hdl, val_ref);
95 Marshal.FreeHGlobal(val_ref_cstr);
102 public int Pop (
string val) {
103 IntPtr val_cstr = Marshal.StringToHGlobalAnsi(val);
104 Int32 __retVal__L =
Mk.MkBufferPop(
mkrt,
hdl, val_cstr);
105 Marshal.FreeHGlobal(val_cstr);
111 IntPtr val_cstr = Marshal.StringToHGlobalAnsi(val);
112 Int32 __retVal__L =
Mk.MkBufferPush(
mkrt,
hdl, val_cstr);
113 Marshal.FreeHGlobal(val_cstr);
126 public partial class MkBufferC {
136 IntPtr __retVal__L =
Mk.MkBufferHandleResolve(IntPtr.Zero, netHdl);
148 public partial class MkBufferC {
158 IntPtr __retVal__L =
Mk.MkBufferNext(
hdl);
164 IntPtr __retVal__L =
Mk.MkBufferPrev(
hdl);
172 IntPtr __retVal__L =
Mk.MkBufferInstances(IntPtr.Zero);
180 public partial class MkBufferC {
190 IntPtr __retVal__L =
Mk.MkBufferGetNull();
198 public partial class MkBufferC {
228 Mk.MkBinaryR val_out_ref;
231 byte[] val_out =
new byte[(int)val_out_ref.size];
232 Marshal.Copy(val_out_ref.data,val_out,0,(
int)val_out_ref.size);
289 return (
byte)val_out;
297 return Marshal.PtrToStringAnsi(val_out);
302 Mk.MkStringR val_out_ref;
305 return Marshal.PtrToStringAnsi(val_out_ref.ptr,val_out_ref.len);
312 public partial class MkBufferC {
322 Char __retVal__L =
Mk.MkBufferGetType1(
mkrt,
hdl);
334 IntPtr __retVal__L =
Mk.MkBufferGetType3(
mkrt,
hdl);
335 return Marshal.PtrToStringAnsi(__retVal__L);
340 bool __retVal__L =
Mk.MkBufferIsLocal(
mkrt,
hdl);
347 public void LogS (
string varname =
"buf",
MkObjectC fmtobj =
null, [CallerMemberName]
string callfunc =
null) {
349 IntPtr varname_cstr = Marshal.StringToHGlobalAnsi(varname);
350 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
351 Mk.MkBufferLogS(
mkrt,
hdl, varname_cstr, fmtobj_hdl, callfunc_cstr);
352 Marshal.FreeHGlobal(varname_cstr);
353 Marshal.FreeHGlobal(callfunc_cstr);
360 public partial class MkBufferC {
371 IntPtr __retVal__L =
Mk.MkBufferCopy(
mkrt,
hdl, srce_hdl);
377 IntPtr __retVal__L =
Mk.MkBufferReset(
mkrt,
hdl);
383 IntPtr __retVal__L =
Mk.MkBufferSizeAdd(
mkrt,
hdl, size);
389 IntPtr __retVal__L =
Mk.MkBufferSizeNew(
mkrt,
hdl, size);
395 IntPtr __retVal__L =
Mk.MkBufferTemp(
mkrt,
hdl);
410 Int32 __retVal__L =
Mk.MkBufferCmp(
mkrt,
hdl, buf2_hdl);
425 public partial class MkBufferC {
435 var val_size = Marshal.SizeOf(val[0]) * val.Length;
436 var val_data = Marshal.AllocHGlobal(val_size);
437 Marshal.
Copy(val,0,val_data,val_size);
439 IntPtr __retVal__L =
Mk.MkBufferSetBIN(
mkrt,
hdl, val_ref);
445 IntPtr __retVal__L =
Mk.MkBufferSetBOL(
mkrt,
hdl, (Byte)(val?1:0));
452 IntPtr __retVal__L =
Mk.MkBufferSetBUF(
mkrt,
hdl, val_hdl);
458 var val_size = Marshal.SizeOf(val[0]) * val.Length;
459 var val_data = Marshal.AllocHGlobal(val_size);
460 Marshal.
Copy(val,0,val_data,val_size);
462 IntPtr __retVal__L =
Mk.MkBufferSetBinaryR(
mkrt,
hdl, val_ref);
468 IntPtr __retVal__L =
Mk.MkBufferSetDBL(
mkrt,
hdl, val);
474 IntPtr __retVal__L =
Mk.MkBufferSetFLT(
mkrt,
hdl, val);
480 IntPtr __retVal__L =
Mk.MkBufferSetI16(
mkrt,
hdl, val);
486 IntPtr __retVal__L =
Mk.MkBufferSetI32(
mkrt,
hdl, val);
492 IntPtr __retVal__L =
Mk.MkBufferSetI64(
mkrt,
hdl, val);
498 IntPtr __retVal__L =
Mk.MkBufferSetI8(
mkrt,
hdl, (Byte)(val));
504 IntPtr val_cstr = Marshal.StringToHGlobalAnsi(val);
505 IntPtr __retVal__L =
Mk.MkBufferSetSTR(
mkrt,
hdl, val_cstr);
506 Marshal.FreeHGlobal(val_cstr);
512 IntPtr val_ref_cstr = Marshal.StringToHGlobalAnsi(val);
514 IntPtr __retVal__L =
Mk.MkBufferSetStringR(
mkrt,
hdl, val_ref);
515 Marshal.FreeHGlobal(val_ref_cstr);
523 public partial class MkBufferC {
533 IntPtr __retVal__L =
Mk.MkBufferMerge(
mkrt,
hdl);
534 if (__retVal__L == IntPtr.Zero) {
537 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
544 IntPtr __retVal__L =
Mk.MkBufferDup(
mkrt,
hdl);
545 if (__retVal__L == IntPtr.Zero) {
548 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
554 protected static IntPtr
CTOR (
int size = 0) {
555 IntPtr __retVal__L =
Mk.MkBufferCreate(IntPtr.Zero, IntPtr.Zero, size);
556 if (__retVal__L == IntPtr.Zero) {
559 return (IntPtr)__retVal__L;
567 IntPtr __retVal__L =
Mk.MkBufferCreate(IntPtr.Zero, IntPtr.Zero, size);
568 if (__retVal__L == IntPtr.Zero) {
571 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
576 IntPtr __retVal__L =
Mk.MkBufferCreate1024(IntPtr.Zero, size);
577 if (__retVal__L == IntPtr.Zero) {
580 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
585 IntPtr __retVal__L =
Mk.MkBufferCreate256(IntPtr.Zero, size);
586 if (__retVal__L == IntPtr.Zero) {
589 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
594 IntPtr __retVal__L =
Mk.MkBufferCreate64(IntPtr.Zero, size);
595 if (__retVal__L == IntPtr.Zero) {
598 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
603 var val_size = Marshal.SizeOf(val[0]) * val.Length;
604 var val_data = Marshal.AllocHGlobal(val_size);
605 Marshal.
Copy(val,0,val_data,val_size);
607 IntPtr __retVal__L =
Mk.MkBufferCreateBIN(IntPtr.Zero, val_ref);
608 if (__retVal__L == IntPtr.Zero) {
611 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
616 IntPtr __retVal__L =
Mk.MkBufferCreateBOL(IntPtr.Zero, (Byte)(val?1:0));
617 if (__retVal__L == IntPtr.Zero) {
620 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
626 IntPtr __retVal__L =
Mk.MkBufferCreateBUF(IntPtr.Zero, val_hdl);
627 if (__retVal__L == IntPtr.Zero) {
630 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
635 IntPtr __retVal__L =
Mk.MkBufferCreateDBL(IntPtr.Zero, val);
636 if (__retVal__L == IntPtr.Zero) {
639 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
644 IntPtr __retVal__L =
Mk.MkBufferCreateFLT(IntPtr.Zero, val);
645 if (__retVal__L == IntPtr.Zero) {
648 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
653 IntPtr __retVal__L =
Mk.MkBufferCreateI16(IntPtr.Zero, val);
654 if (__retVal__L == IntPtr.Zero) {
657 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
662 IntPtr __retVal__L =
Mk.MkBufferCreateI32(IntPtr.Zero, val);
663 if (__retVal__L == IntPtr.Zero) {
666 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
671 IntPtr __retVal__L =
Mk.MkBufferCreateI64(IntPtr.Zero, val);
672 if (__retVal__L == IntPtr.Zero) {
675 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
680 IntPtr __retVal__L =
Mk.MkBufferCreateI8(IntPtr.Zero, (Byte)(val));
681 if (__retVal__L == IntPtr.Zero) {
684 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
689 IntPtr val_cstr = Marshal.StringToHGlobalAnsi(val);
690 IntPtr __retVal__L =
Mk.MkBufferCreateSTR(IntPtr.Zero, val_cstr);
691 Marshal.FreeHGlobal(val_cstr);
692 if (__retVal__L == IntPtr.Zero) {
695 return MkBufferC.MkBufferC_ObjCreate(__retVal__L);
702 IntPtr tlsName_cstr = Marshal.StringToHGlobalAnsi(tlsName);
703 IntPtr __retVal__L =
Mk.MkBufferCreateTLS(IntPtr.Zero, tlsName_cstr, resetB);
704 Marshal.FreeHGlobal(tlsName_cstr);
722 case 'O': ret =
GetBOL();
break;
723 case 'Y': ret =
GetI8();
break;
724 case 'S': ret =
GetI16();
break;
725 case 'I': ret =
GetI32();
break;
726 case 'W': ret =
GetI64();
break;
727 case 'F': ret =
GetFLT();
break;
728 case 'D': ret =
GetDBL();
break;
729 case 'C': ret =
GetSTR();
break;
731 case 'B': ret =
GetBIN();
break;
MkBufferC - the abstract class known as buf or buffer is used to create and manage dynamic,...
static MkBufferC MkBufferC_ObjNew(IntPtr hdl)
MkBufferListC - the class known as bfl or buffer-list is used to create and manage a list of MkBuffer...
static MkBufferListC MkBufferListC_ObjNew(IntPtr hdl)
MkErrorC - the class known as err or error is used to create and manage an error message …
static void Check(IntPtr ctx, MkErrorE err)
MkObjectC - class known as obj or object is used as base-class type for a Programming-Language-Micro-...
static object atomObjNew(Type type, ConstructorInfo ctor, IntPtr obj)
static IntPtr getOBJ_null_allow(MkObjectC obj)
static object atomObjCreate(Type type, ConstructorInfo ctor, IntPtr obj)
static void atomSelfUnlink(IntPtr self, IntPtr env)
static object atomSelfNull(ConstructorInfo ctor)
static IntPtr getOBJ(string cls, MkObjectC obj)
static ConstructorInfo getCtor(Type type)
static IntPtr atomSelfCreate(ConstructorInfo ctor, IntPtr obj, IntPtr env)
static Mk.MkBinaryR MkBinaryCreate(long size, IntPtr data)
static Mk.MkStringR MkStringCreate_1(IntPtr str)
MkBufferC AppendC(string val)
C#: MkBufferC buf.AppendC(string val) → C-API append a single string to a MkBufferC object …
MkBufferC AppendStringR(string val)
C#: MkBufferC buf.AppendStringR(string val) → C-API append a single string to a MkBufferC objec...
int Pop(string val)
C#: int buf.Pop(string val) → C-API delete str from the MkBufferC …
int Push(string val)
C#: int buf.Push(string val) → C-API add str to the MkBufferC …
object ToObject()
C#: object buf.ToObject() → C-API return the native language object from a MkBufferC …
new static MkBufferC Instances()
C#: [static] MkBufferC MkBufferC.Instances() → C-API get head-instance from linked-list of MkBuf...
new MkBufferC Next()
C#: MkBufferC buf.Next() → C-API get next instance from linked-list of MkBufferS type
new static MkBufferC HandleResolve(Int32 netHdl)
C#: [static] MkBufferC MkBufferC.HandleResolve(Int32 netHdl) → C-API Handle-Resolve-Slot - retur...
new static MkBufferC GetNull()
C#: [static] MkBufferC MkBufferC.GetNull() → C-API Null-Slot - return a MkBufferC typed NULL ins...
new MkBufferC Prev()
C#: MkBufferC buf.Prev() → C-API get previous instance from linked-list of MkBufferS type
byte[] GetBIN()
C#: doc_mk_cs_BufferGetBIN → C-API get a val_out from a MkBufferC …
MkBufferC GetBUF()
C#: MkBufferC buf.GetBUF() → C-API get a val_out from a MkBufferC …
byte GetI8()
C#: doc_mk_cs_BufferGetI8 → C-API get a val_out from a MkBufferC …
long GetI64()
C#: doc_mk_cs_BufferGetI64 → C-API get a val_out from a MkBufferC …
MkBufferListC GetBFL(MkBufferListC val_inout=null)
C#: MkBufferListC buf.GetBFL(MkBufferListC val_inout = null) → C-API function to read an MkBuff...
bool GetBOL()
C#: doc_mk_cs_BufferGetBOL → C-API get a val_out from a MkBufferC …
string GetSTR()
C#: doc_mk_cs_BufferGetSTR → C-API get a val_out from a MkBufferC …
double GetDBL()
C#: doc_mk_cs_BufferGetDBL → C-API get a val_out from a MkBufferC …
short GetI16()
C#: doc_mk_cs_BufferGetI16 → C-API get a val_out from a MkBufferC …
float GetFLT()
C#: doc_mk_cs_BufferGetFLT → C-API get a val_out from a MkBufferC …
string GetStringR()
C#: string buf.GetStringR() → C-API get a val_out from a MkBufferC …
int GetI32()
C#: doc_mk_cs_BufferGetI32 → C-API get a val_out from a MkBufferC …
char GetType1()
C#: char buf.GetType1() → C-API return the type from a MkBufferC as single character value …
MkTypeE GetType2()
C#: MkTypeE buf.GetType2() → C-API return the MkTypeE from a MkBufferC …
string GetType3()
C#: string buf.GetType3() → C-API return the type from a MkBufferC as single character string …
bool IsLocal()
C#: bool buf.IsLocal() → C-API Check if the MkBufferC is local (temporary), not local mean glob...
void LogS(string varname="buf", MkObjectC fmtobj=null, [CallerMemberName]string callfunc=null)
C#: buf.LogS(string varname = "buf", MkObjectC fmtobj = null, [CallerMemberName]string callfunc = nu...
void CastTo(MkTypeE typ)
C#: buf.CastTo(MkTypeE typ) → C-API change the type of an MkBufferC to type …
void ResetFull()
C#: buf.ResetFull() → C-API reset a MkBufferC to the length zero and free allocated storage…
MkBufferC Reset()
C#: MkBufferC buf.Reset() → C-API reset a MkBufferC to the length zero …
MkBufferC SizeAdd(int size)
C#: MkBufferC buf.SizeAdd(int size) → C-API add size storage to the buf …
int Cmp(MkBufferC buf2)
C#: int buf1.Cmp(MkBufferC buf2) → C-API compare TWO MkBufferC objects like strcmp do it for st...
MkBufferC Temp()
C#: MkBufferC buf.Temp() → C-API create a temporary copy of the MkBufferC buf …
MkBufferC Copy(MkBufferC srce)
C#: MkBufferC buf.Copy(MkBufferC srce) → C-API copy the MkBufferC from srce to dest …
MkBufferC SizeNew(int size)
C#: MkBufferC buf.SizeNew(int size) → C-API alloc min size storage to the buf …
MkBufferC SetI32(int val)
C#: doc_mk_cs_BufferSetI32 → C-API Set the MkBufferC to the val …
MkBufferC SetDBL(double val)
C#: doc_mk_cs_BufferSetDBL → C-API Set the MkBufferC to the val …
MkBufferC SetSTR(string val)
C#: doc_mk_cs_BufferSetSTR → C-API Set the MkBufferC to the val …
MkBufferC SetBinaryR(byte[] val)
C#: MkBufferC buf.SetBinaryR(byte[] val) → C-API Set the MkBufferC to the val …
MkBufferC SetBOL(bool val)
C#: doc_mk_cs_BufferSetBOL → C-API Set the MkBufferC to the val …
MkBufferC SetStringR(string val)
C#: MkBufferC buf.SetStringR(string val) → C-API Set the MkBufferC to the val …
MkBufferC SetI16(short val)
C#: doc_mk_cs_BufferSetI16 → C-API Set the MkBufferC to the val …
MkBufferC SetBUF(MkBufferC val)
C#: MkBufferC buf.SetBUF(MkBufferC val) → C-API Set the MkBufferC to the val …
MkBufferC SetI64(long val)
C#: doc_mk_cs_BufferSetI64 → C-API Set the MkBufferC to the val …
MkBufferC SetBIN(byte[] val)
C#: doc_mk_cs_BufferSetBIN → C-API Set the MkBufferC to the val …
MkBufferC SetI8(byte val)
C#: doc_mk_cs_BufferSetI8 → C-API Set the MkBufferC to the val …
MkBufferC SetFLT(float val)
C#: doc_mk_cs_BufferSetFLT → C-API Set the MkBufferC to the val …
static MkBufferC CreateDBL(double val)
C#: doc_mk_cs_BufferCreateDBL → C-API Constructor - create a new MkBufferC with an PRIMITIVE T...
MkBufferC(int size=0)
CONSTRUCTOR.
static MkBufferC CreateI8(byte val)
C#: doc_mk_cs_BufferCreateI8 → C-API Constructor - create a new MkBufferC with an PRIMITIVE TYPE...
static MkBufferC CreateBUF(MkBufferC val)
C#: [constructor,static] MkBufferC MkBufferC.CreateBUF(MkBufferC val) → C-API Constructor - cr...
static MkBufferC CreateBOL(bool val)
C#: doc_mk_cs_BufferCreateBOL → C-API Constructor - create a new MkBufferC with an PRIMITIVE T...
static IntPtr CTOR(int size=0)
C#: [constructor,static] MkBufferC MkBufferC.Create(int size = 0) → C-API Constructor - create a...
static MkBufferC CreateTLS(string tlsName, bool resetB=true)
C#: [static] MkBufferC MkBufferC.CreateTLS(string tlsName, bool resetB = true) → C-API same as B...
MkBufferC Merge()
C#: [constructor] MkBufferC buf.Merge() → C-API Merge-Constructor - create a new MkBufferC as a ...
MkBufferC Dup()
C#: [constructor] MkBufferC buf.Dup() → C-API Dup-Constructor - create a new MkBufferC instance ...
static MkBufferC CreateI16(short val)
C#: doc_mk_cs_BufferCreateI16 → C-API Constructor - create a new MkBufferC with an PRIMITIVE T...
static MkBufferC Create256(int size=0)
C#: [constructor,static] MkBufferC MkBufferC.Create256(int size = 0) → C-API call the BufferCrea...
static MkBufferC CreateI64(long val)
C#: doc_mk_cs_BufferCreateI64 → C-API Constructor - create a new MkBufferC with an PRIMITIVE T...
static MkBufferC Create1024(int size=0)
C#: [constructor,static] MkBufferC MkBufferC.Create1024(int size = 0) → C-API call the BufferCre...
static MkBufferC CreateFLT(float val)
C#: doc_mk_cs_BufferCreateFLT → C-API Constructor - create a new MkBufferC with an PRIMITIVE T...
static MkBufferC Create64(int size=0)
C#: [constructor,static] MkBufferC MkBufferC.Create64(int size = 0) → C-API call the BufferCreat...
static MkBufferC CreateI32(int val)
C#: doc_mk_cs_BufferCreateI32 → C-API Constructor - create a new MkBufferC with an PRIMITIVE T...
static MkBufferC CreateSTR(string val)
C#: doc_mk_cs_BufferCreateSTR → C-API Constructor - create a new MkBufferC with an PRIMITIVE T...
static MkBufferC Create(int size=0)
C#: [constructor,static] MkBufferC MkBufferC.Create(int size = 0) → C-API Constructor - create a...
static MkBufferC CreateBIN(byte[] val)
C#: doc_mk_cs_BufferCreateBIN → C-API Constructor - create a new MkBufferC with an PRIMITIVE T...
List< object > ToList()
C#: List<object> bfl.ToList() → C-API get a target-language list representation of the bfl …
MkBufferListC Dup()
C#: [constructor] MkBufferListC bfl.Dup() → C-API Dup-Constructor - create a new MkBufferListC i...
void ErrorCheck(MkErrorE err)
void SetC(string message, [CallerMemberName]string callfunc=null, int errnum=-1)
C#: err.SetC(string message, [CallerMemberName]string callfunc = null, int errnum = -1) → C-API ...
static MkErrorC FORMAT(MkObjectC fmtobj=null)
C#: [static] MkErrorC MkErrorC.FORMAT(MkObjectC fmtobj = null) → C-API system-error-format - for...
#define MK_NULL
The Programming-Language-Micro-Kernel (PLMK) NULL value as null in C# …
MkErrorE
→ C-API: MkErrorE → C-API: MkErrorE
MkTypeE
→ C-API: MkTypeE → C-API: MkTypeE