theKernel 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - jv - cc
Loading...
Searching...
No Matches
MkKernel_Parser_Global_C_API

global : define the __parser__ attribute related to __parser__global__(...)More...

+ Collaboration diagram for MkKernel_Parser_Global_C_API:

Macros

#define __parser__global__return_type_default   return-type-default:NAMESPACE=OLD-RETURN@NEW-RETURN
 Replace an already defined old-return-type with a new-return-type
 
#define __parser__global   global=ATTRIBUTE
 Add the global keyword to the PLMK (Programming-Language-Micro-Kernel)-Compiler
 
#define __parser__global__pattern2prefix   pattern2prefix:PATTERN=PREFIX
 Add PREFIX attribute to all functions found by regexp '^PATTERN[A-Z]' …
 
#define __parser__global__prefix2attribute   prefix2attribute@LIST=PREFIX@ATTRIBUTE?=VALUE?
 Add ATTRIBUTE to all functions starting with PREFIX* ……
 
#define __parser__global__prefix2title   prefix2title:PREFIX=TITLE
 Migrate a function name with PREFIX to a new Title prefix …
 
#define __parser__global__prefix2doc   prefix2doc:PREFIX=DOC?@DOC-INDEX?
 Set the doc-group / doc-index attribute for all functions found by ^PREFIX(:?[A-Z].*)?$
 
#define __parser__global__prefix2class   prefix2class:PREFIX=CLASS
 Set the defgroup attribute for all functions starting with prefix
 
#define __parser__global__formatter   formatter=VARIABLE
 Set the formatter attribute to all arguments with name VARIABLE
 
#define __parser__global__error_check   error-check=ERROR_RETURN_ENUM
 Verify the enum-return-value of a function using the enum-error-check-code
 
#define __parser__global__default_cast   default-cast:ORIG-TYP=FROM-SYSTEM-TYP?@ TO-SYSTEM-TYP?
 Add a default-cast to native-type
 

Detailed Description

global : define the __parser__ attribute related to __parser__global__(...)

See also
__parser__global__(...)

Macro Definition Documentation

◆ __parser__global

#define __parser__global   global=ATTRIBUTE

Add the global keyword to the PLMK (Programming-Language-Micro-Kernel)-Compiler

The global keyword is used to define a PLMK (Programming-Language-Micro-Kernel)-Compiler feature on toplevel. This is an compiler internal feature and not related to a function.

With the global feature additional features are useable like:

  • prefix2doc pattern2prefix pattern2attribute prefix2class
  • doc-force hide native2class
Definition
scopetoplevel
usage__parser__global__(ATTRIBUTE);
Example
// GLOBAL: all "fmtobj" arguments become attribute "formatter"
__parser__global__(fmtobj|formatter:__empty__);
// GLOBAL: all "macros" become hide
__parser__global__(hide-rx=^Mk\w+_T$);
#define __parser__global__(...)
parser: apply an attribute to a dunction in global scope …

Definition at line 1557 of file parser_mk.h.

◆ __parser__global__default_cast

#define __parser__global__default_cast   default-cast:ORIG-TYP=FROM-SYSTEM-TYP?@ TO-SYSTEM-TYP?

Add a default-cast to native-type

Sometimes a type cannot be recognized correctly by the All-Language-Compiler (ALC),

  • for example this occurs with native code such as the type sqlite3_int64 in theSq3Lite.

To avoid complications, a hard-assignment to a known-type can be created using default-cast, where the FROM-SYSTEM-TYP is required and the TO-SYSTEM-TYP is optional.

  • The FROM-SYSTEM-TYP must be compatible with the native-type.
  • If the TO-SYSTEM-TYP is also specified, then an additional hard-cast from FROM-SYSTEM-TYP to TO-SYSTEM-TYP is performed.
Definition
scopeglobal
usage__parser__global__(default-cast:ORIG-TYP=FROM-SYSTEM-TYP?@ TO-SYSTEM-TYP?)
Example
__parser__global__(default-cast:sqlite3_int64=MK_I64);
signed long long MK_I64
8 byte wide integer data-type
__parser__global__(default-cast:sqlite3_uint64=MK_U64@MK_I64);
unsigned long long MK_U64

Definition at line 1719 of file parser_mk.h.

◆ __parser__global__error_check

#define __parser__global__error_check   error-check=ERROR_RETURN_ENUM

Verify the enum-return-value of a function using the enum-error-check-code

The goal is to reuse an already availalable declaration from an external header-file and add the error-check feature from the Programming-Language-Micro-Kernel (PLMK).

The return-value for error-check is an enum and the macro ENUM_Check like LcErrorE_Check is added to verify the enum and jump to the error: label on error.

Definition
scopeglobal
usage__parser__global__(error-check=ERROR_RETURN_ENUM);
see also__parser__(error-check)
Example
Add error-check code on all functions return enum LcErrorE

parser__global(error-check=LcErrorE); native function after error-check was added

mk_inline enum MkErrorE LcConfigReadFile (LC_CFG config, MK_STRN filename) {
LcErrorE_Check(config, (enum LcErrorE)config_read_file (config->nat, filename));
return MK_OK;
error:
return MkErrorStack_1X(config);
}
#define MkErrorStack_1X(...)
#define mk_inline
MkErrorE
collection for the different error-codes …
@ MK_OK
(persistent) everything is OK.
const MK_STRB * MK_STRN
constant string pointer data-type

Definition at line 1696 of file parser_mk.h.

◆ __parser__global__formatter

#define __parser__global__formatter   formatter=VARIABLE

Set the formatter attribute to all arguments with name VARIABLE

By default the FIRST argument of an instance-method is used as formatter, this attibute change the default to an other global defined argument.

Definition
usage__parser__global__(formatter=VARIABLE);
example__parser__global__(formatter=fmtobj);

Definition at line 1664 of file parser_mk.h.

◆ __parser__global__pattern2prefix

#define __parser__global__pattern2prefix   pattern2prefix:PATTERN=PREFIX

Add PREFIX attribute to all functions found by regexp '^PATTERN[A-Z]' …

The prefix is used to split the name into prefix and postfix :

Name == Prefix + Postfix

The prefix usually include the namespace and the root :

Prefix == Ns + Root

By default the prefix is related to the class:

name == ns class attribute
MkBufferCreate == Mk + Buffer + Create
#define MkBufferCreate(...)
Note
The processing-order is from longest-prefix to shortest-prefix.
Definition
usage__parser__global__(pattern2prefix:PATTERN=PREFIX);
example__parser__global__(pattern2prefix:MkSelf=MkObj);
see also__parser__(prefix)

Definition at line 1582 of file parser_mk.h.

◆ __parser__global__prefix2attribute

#define __parser__global__prefix2attribute   prefix2attribute@LIST=PREFIX@ATTRIBUTE?=VALUE?

Add ATTRIBUTE to all functions starting with PREFIX* ……

There are some ways to add an ATTRIBUTE to a bunch of functions:

  1. add to function
__parser__(ATTRIBUTE) … function(…)
#define __parser__(...)
parser: apply an attribute to an object in local scope …
  1. add to block of functions:
__parser__push__(ATTRIBUTE);
... function(…) ...
__parser__pop__;
#define __parser__push__(...)
parser: start apply a list of local attributes to a block of code …
  1. using a PREFIX if available:
__parser__global__(prefix2attribute=PREFIX@ATTRIBUTE);
Attention
To attach multiple ATTRIBUTE use "," lo link
__parser__global__(prefix2attribute=PREFIX@ATTR1,ATTR2,ATTR3);
Definition
usage__parser__global__(prefix2attribute=PREFIX@ATTRIBUTE);
example__parser__global__(prefix2attribute=MkType@class=MkTypeC);
see also__parser__push__ __parser__pop__

Definition at line 1618 of file parser_mk.h.

◆ __parser__global__prefix2class

#define __parser__global__prefix2class   prefix2class:PREFIX=CLASS

Set the defgroup attribute for all functions starting with prefix

Note
The processing-order is from longest-prefix to shortest-prefix.
Definition
usage__parser__global__(prefix2class:PREFIX=CLASS);
example__parser__global__(prefix2class:MkSys=MkKernel);
see also__parser__(prefix); __parser__(class)

Definition at line 1653 of file parser_mk.h.

◆ __parser__global__prefix2doc

#define __parser__global__prefix2doc   prefix2doc:PREFIX=DOC?@DOC-INDEX?

Set the doc-group / doc-index attribute for all functions found by ^PREFIX(:?[A-Z].*)?$

Definition
usage__parser__global__(prefix2doc:PREFIX=DOC?@DOC-INDEX?);
example__parser__global__(prefix2doc:LcConfigLookup=Lookup);
see also__parser__(prefix); __parser__(doc-group); __parser__(doc-index)

Definition at line 1642 of file parser_mk.h.

◆ __parser__global__prefix2title

#define __parser__global__prefix2title   prefix2title:PREFIX=TITLE

Migrate a function name with PREFIX to a new Title prefix …

example: The __parser__global__(prefix2title:Sq3Str=Sq3Str) migrate all functions start with Sq3Str like Sq3Strglob to Sq3StrGlob by changing the first character after the PREFIX to upper-char.

The PREFIX and TITLE have to be a string follow the NsTitle syntax.

Definition
usage__parser__global__(prefix2title:PREFIX=TITLE);
example__parser__global__(prefix2title:Sq3Str=Sq3Str);
see also__parser__(prefix); __parser__global__(pattern2prefix)

Definition at line 1633 of file parser_mk.h.

◆ __parser__global__return_type_default

#define __parser__global__return_type_default   return-type-default:NAMESPACE=OLD-RETURN@NEW-RETURN

Replace an already defined old-return-type with a new-return-type

This is the same as #__parser__(return-type) but ONLY of the global level.

This is usefull is a native-api return an integer as erro-indicator BUT the meta-api is using an enum for this purpose.

Attention
Use return-type-default-no to ignore the return-type-default.
Definition
scopeglobal
usage__parser__global__(return-type-default:NAMESPACE=OLD-RETURN@NEW-RETURN);
see also__parser__(return-type); __parser__(return-type-default-no)
Example from Sq3Lite
// LibSq3Lite_sq3.h : define the \e enum-Sq3ErrorE
enum Sq3ErrorE {
SQLITE_OK = 0 ,
...
}
// sqlite3_sq3.h: all api-functions which return "MK_I32" should be mapped to return "Sq3ErrorE"
__parser__global__(return-type-default:Sq3=MK_I32@Sq3ErrorE);
// all functions who return 'Sq3ErrorE' should be mapped to the DEFAULT-error-return 'MkErrorE'
__parser__global__(error-check=Sq3ErrorE);
signed int MK_I32
4 byte integer data-type

Definition at line 1294 of file parser_mk.h.