FLAMCLE/P-API
Command Line Executor/Parser Application Programming Interface
CLP Argument Table

The structure and corresponding macros are used to define a entry for argument table. More...

Data Structures

struct  ClpArgument
 Table structure for arguments. More...
 

Macros

#define CLPCONTAB_OPN(name)   TsClpArgument name[]
 Starts a table with constant definitions. More...
 
#define CLPCONTAB_NUMBER(kyw, dat, man, hlp)   {CLPTYP_NUMBER,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON ,NULL,NULL,(man),(hlp),(dat), 0.0 ,NULL ,NULL},
 Defines a number literal with the command line keyword kyw and the value dat. More...
 
#define CLPCONTAB_FLOATN(kyw, dat, man, hlp)   {CLPTYP_FLOATN,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON ,NULL,NULL,(man),(hlp), 0 ,(dat),NULL ,NULL},
 Defines a floating point literal with the command line keyword kyw and the value dat. More...
 
#define CLPCONTAB_STRING(kyw, dat, man, hlp)   {CLPTYP_STRING,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON ,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},
 Defines a default string literal with the command line keyword kyw and the value dat. More...
 
#define CLPCONTAB_HEXSTR(kyw, dat, man, hlp)   {CLPTYP_STRING,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON|CLPFLG_HEX,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},
 Defines a hexadecimal string literal with the command line keyword kyw and the value dat. More...
 
#define CLPCONTAB_ASCSTR(kyw, dat, man, hlp)   {CLPTYP_STRING,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON|CLPFLG_ASC,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},
 Defines a ASCII string literal with the command line keyword kyw and the value dat. More...
 
#define CLPCONTAB_EBCSTR(kyw, dat, man, hlp)   {CLPTYP_STRING,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON|CLPFLG_EBC,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},
 Defines a EBCDIC string literal with the command line keyword kyw and the value dat. More...
 
#define CLPCONTAB_BINARY(kyw, dat, siz, man, hlp)   {CLPTYP_STRING,(kyw),NULL,0,0,(siz),0,0,CLPFLG_CON|CLPFLG_BIN,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},
 Defines a binary literal with the command line keyword kyw and the value dat. More...
 
#define CLPCONTAB_CLS   {CLPTYP_NON , NULL,NULL,0,0, 0 ,0,0,CLPFLG_NON ,NULL,NULL, NULL, NULL, 0 , 0.0 ,NULL ,NULL}
 
#define CLPARGTAB_SKALAR(kyw, nam, typ, min, max, atyp, flg, oid, tab, dft, man, hlp)   { atyp ,(kyw), NULL,(min), 1 ,sizeof(typ), offsetof(STRUCT_NAME,nam),(oid),(flg) ,(tab),(dft),(man),(hlp),0,0.0,NULL,#typ},
 Defines a scalar (single value) with the command line keyword kyw and the member name nam. More...
 
#define CLPARGTAB_STRING(kyw, nam, siz, min, max, atyp, flg, oid, tab, dft, man, hlp)   { CLPTYP_STRING,(kyw), NULL,(min),(max), (siz), offsetof(STRUCT_NAME,nam),(oid),(flg) ,(tab),(dft),(man),(hlp),0,0.0,NULL,NULL},
 Defines a string with the command line keyword kyw and the member name nam. More...
 
#define CLPARGTAB_DYNSTR(kyw, nam, siz, min, max, atyp, flg, oid, tab, dft, man, hlp)   { CLPTYP_STRING,(kyw), NULL,(min),(max), (siz), offsetof(STRUCT_NAME,nam),(oid),((flg)|CLPFLG_DYN),(tab),(dft),(man),(hlp),0,0.0,NULL,NULL},
 Defines a dynamic string with the command line keyword kyw and the member name nam (pointer to alloced memory, must be freed by the using application). More...
 
#define CLPARGTAB_ARRAY(kyw, nam, typ, min, max, atyp, flg, oid, tab, dft, man, hlp)   { atyp ,(kyw), NULL,(min),(max),sizeof(typ), offsetof(STRUCT_NAME,nam),(oid),(flg) ,(tab),(dft),(man),(hlp),0,0.0,NULL,#typ},
 Defines an array with the command line keyword kyw and the member name nam. More...
 
#define CLPARGTAB_DYNARY(kyw, nam, typ, min, max, atyp, flg, oid, tab, dft, man, hlp)   { atyp ,(kyw), NULL,(min),(max),sizeof(typ), offsetof(STRUCT_NAME,nam),(oid),((flg)|CLPFLG_DYN),(tab),(dft),(man),(hlp),0,0.0,NULL,#typ},
 Defines an dynamic array with the command line keyword kyw and the member name nam (pointer to alloced memory, must be freed by the using application). More...
 
#define CLPARGTAB_ALIAS(kyw, ali)   { CLPTYP_XALIAS,(kyw),(ali), 0 , 0 , 0 , 0 , 0 , CLPFLG_ALI, NULL, NULL, NULL, NULL,0,0.0,NULL,NULL},
 Defines an alias name for another argument. More...
 
#define CLPARGTAB_CLS   { CLPTYP_NON , NULL, NULL, 0 , 0 , 0 , 0 , 0 , 0 , NULL, NULL, NULL, NULL,0,0.0,NULL,NULL}
 Will mark the end of an argument table. More...
 

Typedefs

typedef struct ClpArgument TsClpArgument
 Table structure for arguments. More...
 

Detailed Description

The structure and corresponding macros are used to define a entry for argument table.

Macro Definition Documentation

◆ CLPCONTAB_OPN

#define CLPCONTAB_OPN (   name)    TsClpArgument name[]

Starts a table with constant definitions.

Parameters
[in]nameName of this table

◆ CLPCONTAB_NUMBER

#define CLPCONTAB_NUMBER (   kyw,
  dat,
  man,
  hlp 
)    {CLPTYP_NUMBER,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON ,NULL,NULL,(man),(hlp),(dat), 0.0 ,NULL ,NULL},

Defines a number literal with the command line keyword kyw and the value dat.

Parameters
[in]kywPointer to command line keyword kyw.
[in]datPointer to target definition in case of reading.
[in]manPointer to a null-terminated string for a detailed description of this constant (in ASCIIDOC format, content behind .DESCRIPTION, mainly simply some paragraphs) Can be a NULL pointer or empty string to produce a bullet list. It is recommended to use a header file with a define for this long string.
[in]hlpPointer to a null-terminated string for context sensitive help for this constant (also used as head line or in bullet list in documentation generation).

◆ CLPCONTAB_FLOATN

#define CLPCONTAB_FLOATN (   kyw,
  dat,
  man,
  hlp 
)    {CLPTYP_FLOATN,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON ,NULL,NULL,(man),(hlp), 0 ,(dat),NULL ,NULL},

Defines a floating point literal with the command line keyword kyw and the value dat.

Parameters
[in]kywPointer to command line keyword kyw.
[in]datPointer to target definition in case of reading.
[in]manPointer to a null-terminated string for a detailed description of this constant (in ASCIIDOC format, content behind .DESCRIPTION, mainly simply some paragraphs) Can be a NULL pointer or empty string to produce a bullet list. It is recommended to use a header file with a define for this long string.
[in]hlpPointer to a null-terminated string for context sensitive help for this constant (also used as head line or in bullet list in documentation generation).

◆ CLPCONTAB_STRING

#define CLPCONTAB_STRING (   kyw,
  dat,
  man,
  hlp 
)    {CLPTYP_STRING,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON ,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},

Defines a default string literal with the command line keyword kyw and the value dat.

Parameters
[in]kywPointer to command line keyword kyw.
[in]datPointer to target definition in case of reading.
[in]manPointer to a null-terminated string for a detailed description of this constant (in ASCIIDOC format, content behind .DESCRIPTION, mainly simply some paragraphs) Can be a NULL pointer or empty string to produce a bullet list. It is recommended to use a header file with a define for this long string.
[in]hlpPointer to a null-terminated string for context sensitive help for this constant (also used as head line or in bullet list in documentation generation).

◆ CLPCONTAB_HEXSTR

#define CLPCONTAB_HEXSTR (   kyw,
  dat,
  man,
  hlp 
)    {CLPTYP_STRING,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON|CLPFLG_HEX,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},

Defines a hexadecimal string literal with the command line keyword kyw and the value dat.

Parameters
[in]kywPointer to command line keyword kyw.
[in]datPointer to target definition in case of reading.
[in]manPointer to a null-terminated string for a detailed description of this constant (in ASCIIDOC format, content behind .DESCRIPTION, mainly simply some paragraphs) Can be a NULL pointer or empty string to produce a bullet list. It is recommended to use a header file with a define for this long string.
[in]hlpPointer to a null-terminated string for context sensitive help for this constant (also used as head line or in bullet list in documentation generation).

◆ CLPCONTAB_ASCSTR

#define CLPCONTAB_ASCSTR (   kyw,
  dat,
  man,
  hlp 
)    {CLPTYP_STRING,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON|CLPFLG_ASC,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},

Defines a ASCII string literal with the command line keyword kyw and the value dat.

Parameters
[in]kywPointer to command line keyword kyw.
[in]datPointer to target definition in case of reading.
[in]manPointer to a null-terminated string for a detailed description of this constant (in ASCIIDOC format, content behind .DESCRIPTION, mainly simply some paragraphs) Can be a NULL pointer or empty string to produce a bullet list. It is recommended to use a header file with a define for this long string.
[in]hlpPointer to a null-terminated string for context sensitive help for this constant (also used as head line or in bullet list in documentation generation).

◆ CLPCONTAB_EBCSTR

#define CLPCONTAB_EBCSTR (   kyw,
  dat,
  man,
  hlp 
)    {CLPTYP_STRING,(kyw),NULL,0,0, 0 ,0,0,CLPFLG_CON|CLPFLG_EBC,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},

Defines a EBCDIC string literal with the command line keyword kyw and the value dat.

Parameters
[in]kywPointer to command line keyword kyw.
[in]datPointer to target definition in case of reading.
[in]manPointer to a null-terminated string for a detailed description of this constant (in ASCIIDOC format, content behind .DESCRIPTION, mainly simply some paragraphs) Can be a NULL pointer or empty string to produce a bullet list. It is recommended to use a header file with a define for this long string.
[in]hlpPointer to a null-terminated string for context sensitive help for this constant (also used as head line or in bullet list in documentation generation).

◆ CLPCONTAB_BINARY

#define CLPCONTAB_BINARY (   kyw,
  dat,
  siz,
  man,
  hlp 
)    {CLPTYP_STRING,(kyw),NULL,0,0,(siz),0,0,CLPFLG_CON|CLPFLG_BIN,NULL,NULL,(man),(hlp), 0 , 0.0 ,(U08*)(dat),NULL},

Defines a binary literal with the command line keyword kyw and the value dat.

Parameters
[in]kywPointer to command line keyword kyw.
[in]datPointer to target definition in case of reading.
[in]sizSize of the binary value.
[in]manPointer to a null-terminated string for a detailed description of this constant (in ASCIIDOC format, content behind .DESCRIPTION, mainly simply some paragraphs) Can be a NULL pointer or empty string to produce a bullet list. It is recommended to use a header file with a define for this long string.
[in]hlpPointer to a null-terminated string for context sensitive help for this constant (also used as head line or in bullet list in documentation generation).

◆ CLPCONTAB_CLS

#define CLPCONTAB_CLS   {CLPTYP_NON , NULL,NULL,0,0, 0 ,0,0,CLPFLG_NON ,NULL,NULL, NULL, NULL, 0 , 0.0 ,NULL ,NULL}

Ends a table with constant definitions

◆ CLPARGTAB_SKALAR

#define CLPARGTAB_SKALAR (   kyw,
  nam,
  typ,
  min,
  max,
  atyp,
  flg,
  oid,
  tab,
  dft,
  man,
  hlp 
)    { atyp ,(kyw), NULL,(min), 1 ,sizeof(typ), offsetof(STRUCT_NAME,nam),(oid),(flg) ,(tab),(dft),(man),(hlp),0,0.0,NULL,#typ},

Defines a scalar (single value) with the command line keyword kyw and the member name nam.

Parameters
[in]kywPointer to command line keyword kyw.
[in]namPointer to target definition in case of reading.
[in]typis the C type of the member.
[in]mincan be 0 or 1 for a scalar and determines if this argument is optional(0) or required(1).
[in]maxis unused for scalar values.
[in]atypis one of the CLPTYP_* macros.
[in]flgis an OR-ed list of the flag macros CLPFLG_* which define various parsing options.
[in]oidis a unique id value used for this argument.
[in]tabis NULL or a pointer to another argument table describing the object, overlay or selection.
[in]dftis the hard coded default value of the argument if no input is given on the command line.
[in]manis a pointer to the long description of the argument.
[in]hlpis a pointer to the short description of the argument.

◆ CLPARGTAB_STRING

#define CLPARGTAB_STRING (   kyw,
  nam,
  siz,
  min,
  max,
  atyp,
  flg,
  oid,
  tab,
  dft,
  man,
  hlp 
)    { CLPTYP_STRING,(kyw), NULL,(min),(max), (siz), offsetof(STRUCT_NAME,nam),(oid),(flg) ,(tab),(dft),(man),(hlp),0,0.0,NULL,NULL},

Defines a string with the command line keyword kyw and the member name nam.

Parameters
[in]kywPointer to command line keyword kyw.
[in]namPointer to target definition in case of reading.
[in]sizis the total available length of the string(s).
[in]mincan be between 0 and max for a string and determines if this argument is optional(0) or required(min>=1).
[in]maxdefines the maximum number of strings accepted on the command line.
[in]atypis unused and fixed to CLPTYP_STRING.
[in]flgis an OR-ed list of the flag macros CLPFLG_* which define various parsing options.
[in]oidis a unique id value used for this argument.
[in]tabis NULL or a pointer to another argument table describing a selection.
[in]dftis the hard coded default value of the argument if no input is given on the command line.
[in]manis a pointer to the long description of the argument.
[in]hlpis a pointer to the short description of the argument.

◆ CLPARGTAB_DYNSTR

#define CLPARGTAB_DYNSTR (   kyw,
  nam,
  siz,
  min,
  max,
  atyp,
  flg,
  oid,
  tab,
  dft,
  man,
  hlp 
)    { CLPTYP_STRING,(kyw), NULL,(min),(max), (siz), offsetof(STRUCT_NAME,nam),(oid),((flg)|CLPFLG_DYN),(tab),(dft),(man),(hlp),0,0.0,NULL,NULL},

Defines a dynamic string with the command line keyword kyw and the member name nam (pointer to alloced memory, must be freed by the using application).

Parameters
[in]kywPointer to command line keyword kyw.
[in]namPointer to target definition in case of reading.
[in]sizis the total available length of the string(s).
[in]atypis unused and fixed to CLPTYP_STRING.
[in]mincan be between 0 and max for a string and determines if this argument is optional(0) or required(min>=1).
[in]maxdefines the maximum number of strings accepted on the command line.
[in]flgis an OR-ed list of the flag macros CLPFLG_* which define various parsing options.
[in]oidis a unique id value used for this argument.
[in]tabis NULL or a pointer to another argument table describing a selection.
[in]dftis the hard coded default value of the argument if no input is given on the command line.
[in]manis a pointer to the long description of the argument.
[in]hlpis a pointer to the short description of the argument.

◆ CLPARGTAB_ARRAY

#define CLPARGTAB_ARRAY (   kyw,
  nam,
  typ,
  min,
  max,
  atyp,
  flg,
  oid,
  tab,
  dft,
  man,
  hlp 
)    { atyp ,(kyw), NULL,(min),(max),sizeof(typ), offsetof(STRUCT_NAME,nam),(oid),(flg) ,(tab),(dft),(man),(hlp),0,0.0,NULL,#typ},

Defines an array with the command line keyword kyw and the member name nam.

Parameters
[in]kywPointer to command line keyword kyw.
[in]namPointer to target definition in case of reading.
[in]typis the C type of the member.
[in]mincan be between 0 or max and determines if this argument is optional(0) or required(min>=1).
[in]maxdefines the size of the array.
[in]atypis one of the CLPTYP_* macros.
[in]flgis an OR-ed list of the flag macros CLPFLG_* which define various parsing options.
[in]oidis a unique id value used for this argument.
[in]tabis NULL or a pointer to another argument table describing the object, overlay or selection.
[in]dftis the hard coded default value of the argument if no input is given on the command line.
[in]manis a pointer to the long description of the argument.
[in]hlpis a pointer to the short description of the argument.

◆ CLPARGTAB_DYNARY

#define CLPARGTAB_DYNARY (   kyw,
  nam,
  typ,
  min,
  max,
  atyp,
  flg,
  oid,
  tab,
  dft,
  man,
  hlp 
)    { atyp ,(kyw), NULL,(min),(max),sizeof(typ), offsetof(STRUCT_NAME,nam),(oid),((flg)|CLPFLG_DYN),(tab),(dft),(man),(hlp),0,0.0,NULL,#typ},

Defines an dynamic array with the command line keyword kyw and the member name nam (pointer to alloced memory, must be freed by the using application).

Parameters
[in]kywPointer to command line keyword kyw.
[in]namPointer to target definition in case of reading.
[in]typis the C type of the member.
[in]mincan be between 0 or max and determines if this argument is optional(0) or required(min>=1).
[in]maxdefines the size of the array.
[in]atypis one of the CLPTYP_* macros.
[in]flgis an OR-ed list of the flag macros CLPFLG_* which define various parsing options.
[in]oidis a unique id value used for this argument.
[in]tabis NULL or a pointer to another argument table describing the object, overlay or selection.
[in]dftis the hard coded default value of the argument if no input is given on the command line.
[in]manis a pointer to the long description of the argument.
[in]hlpis a pointer to the short description of the argument.

◆ CLPARGTAB_ALIAS

#define CLPARGTAB_ALIAS (   kyw,
  ali 
)    { CLPTYP_XALIAS,(kyw),(ali), 0 , 0 , 0 , 0 , 0 , CLPFLG_ALI, NULL, NULL, NULL, NULL,0,0.0,NULL,NULL},

Defines an alias name for another argument.

Parameters
[in]kywis the keyword accepted on the command line in place of the keyword given in ali.
[in]aliis the alternative keyword accepted on the command line in place of the keyword given in kyw.

◆ CLPARGTAB_CLS

#define CLPARGTAB_CLS   { CLPTYP_NON , NULL, NULL, 0 , 0 , 0 , 0 , 0 , 0 , NULL, NULL, NULL, NULL,0,0.0,NULL,NULL}

Will mark the end of an argument table.

Typedef Documentation

◆ TsClpArgument

typedef struct ClpArgument TsClpArgument

Table structure for arguments.

To simplify the definition of the corresponding data structures and argument tables it is recommended to use the CLPARGTAB macros defined in CLPMAC.h or for constant definitions the CLPCONTAB macros below. With the CLPMAC.h you can generate the tables or the corresponding data structures, depending if DEFINE_STRUCT defined or not.

Example:

First you must define the table:

#define CLPINTFMTRED_TABLE\
CLPARGTAB_SKALAR("BIN" , stBin , TsClpIntRedBin , 0, 1, CLPTYP_OBJECT, CLPFLG_NON, INTCNV_FORMAT_BIN , asClpIntRedBin , NULL, MAN_INTRED_BIN, "Integer in binary format (two's complement)")\
CLPARGTAB_SKALAR("BCD" , stBcd , TsClpIntRedBcd , 0, 1, CLPTYP_OBJECT, CLPFLG_NON, INTCNV_FORMAT_BCD , asClpIntRedBcd , NULL, MAN_INTRED_BCD, "Binary coded decimal (BCD) number")\
CLPARGTAB_SKALAR("STR" , stStr , TsClpIntRedStr , 0, 1, CLPTYP_OBJECT, CLPFLG_NON, INTCNV_FORMAT_STR , asClpIntRedStr , NULL, MAN_INTRED_STR, "String representation of an integer")\
CLPARGTAB_SKALAR("ENUM" , stEnum, TsClpIntRedSel , 0, 1, CLPTYP_OBJECT, CLPFLG_NON, INTCNV_FORMAT_ENUM, asClpIntRedEnum, NULL, MAN_INTRED_ENUM,"Maps enumeration to an integer")\
CLPARGTAB_CLS

Then you can use this table to define your structure or union, in our case we create a union:

#define DEFINE_STRUCT
#include "CLPMAC.h"
typedef union ClpIntFmtRed{
CLPINTFMTRED_TABLE
}TuClpIntFmtRed;

And you use the same define to allocate the corresponding CLP table:

#undef DEFINE_STRUCT
#include "CLPMAC.h"
#undef STRUCT_NAME
#define STRUCT_NAME TuClpIntFmtRed
TsClpArgument asClpIntFmtRed[] = {
CLPINTFMTRED_TABLE
};
CLPMAC.h
Macros for single definition of C struct and argument table for Command Line Parsing.
ClpArgument
Table structure for arguments.
Definition: CLPDEF.h:271