eĿlipsis
a language independent preprocessor
 
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Loading...
Searching...
No Matches
ellipsis-predefined.dirs File Reference

Predefined macros for all languages. More...

Macros

#define ¤¤¤¤¤
 
#define ¤¤¤¤
 
#define ¤¤¤
 
#define ¤¤
 shortcut for __PARENT_UNIT__
 
#define ¤
 shortcut for __UNIT__
 
#define    __UNIT__∷
 obsolete macros
 
#define    __PARENT_UNIT__∷
 obsolete macros
 
#define __COMPACT__(X, …)   __MAP__(__EVALUATE__, X)
 Expand all arguments and remove whitespace surrounding them.
 
#define __CONCAT__(…)
 evaluate and then concatenate up to 10 arguments
 
#define __EXPAND__(…)   __VA_ARGS__
 expand the arguments
 
#define __EXPAND_BIN__(…)   __EVALUATE_BIN__(__VA_ARGS__)
 expand all the arguments, evaluate the resulting integer expression and produce a binary literal
 
#define __EXPAND_BIN_U__(…)   __CONCAT__(__EXPAND_BIN__(__VA_ARGS__), ⸤U⸥)
 expand all the arguments, evaluate the resulting integer expression and produce a binary literal
 
#define __EXPAND_COMMAS__(…)   __EXPAND_DEC__(__COMMAS__(__VA_ARGS__))
 expand all the arguments and count the number of toplevel commas in the resulting list
 
#define __EXPAND_DEC__(…)   __EVALUATE_DEC__(__VA_ARGS__)
 expand all the arguments, evaluate the resulting integer expression and produce a decimal literal
 
#define __EXPAND_DEC_U__(…)   __CONCAT__(__EXPAND_DEC__(__VA_ARGS__), ⸤U⸥)
 expand all the arguments, evaluate the resulting integer expression and produce a decimal literal
 
#define __EXPAND_EMPTY__(…)   __EMPTY__(__VA_ARGS__)
 expand all the arguments and see if the result is empty
 
#define __EXPAND_ERROR__(...)   __ERROR__(__VA_ARGS__)
 Evaluate the __VA_ARGS__, use them as an error message and abord compilation.
 
#define __EXPAND_HEX__(…)   __EVALUATE_HEX__(__VA_ARGS__)
 expand all the arguments, evaluate the resulting integer expression and produce a hexadecimal literal
 
#define __EXPAND_HEX_U__(…)   __CONCAT__(__EXPAND_HEX__(__VA_ARGS__), ⸤U⸥)
 expand all the arguments, evaluate the resulting integer expression and produce a hexadecimal literal
 
#define __EXPAND_OCT__(…)   __EVALUATE_OCT__(__VA_ARGS__)
 expand all the arguments, evaluate the resulting integer expression and produce a octal literal
 
#define __EXPAND_OCT_U__(…)   __CONCAT__(__EXPAND_OCT__(__VA_ARGS__), ⸤U⸥)
 expand all the arguments, evaluate the resulting integer expression and produce a octal literal
 
#define __EXPAND_STRINGIFY__(…)   __STRINGIFY__(__VA_ARGS__)
 expand all the arguments and put the result into one string
 
#define __IMPLEMENT(NAME, …)   @ref ¤⸤::⸥¤∷⸤NAME⸥__VA_OPT__(, )__VA_TAIL__()
 
#define __IMPLEMENT_(NAME, …)   typeof(¤∷⸤NAME⸥) ¤∷⸤NAME⸥__VA_OPT__(;/*^*/)__VA_TAIL__()
 
#define __IMPLEMENT__(NAME, …)
 Implement the listed names as functions for the current translation unit.
 
#define __MAP__(F, …)   ⸤F⸥(__VA_ARGS__)⸤__VA_OPT__⸥(, )⸤__VA_TAIL__⸥()
 Construct the body of a macro mapping F over all variadic arguments.
 
#define __MULTI_(...)
 
#define __MULTI__(...)   __MULTI_(__VA_ARGS__)
 
#define __NARGS__(…)   __EXPAND_DEC__(__COMMAS__(__VA_ARGS__) + ¬__EMPTY__(__VA_ARGS__))
 expand all the arguments and count the number of items in the resulting list
 
#define __ONE__   __EXPAND_DEC__(1)
 A predefined and pre-evaluated 1
 
#define __PARENT_UNIT__
 A pseudo-macro that resolves to the name of the current parent unit, generally abbreviated as ¤¤.
 
#define __STDC_EMBED_EMPTY__   __EXPAND_DEC__(2)
 A predefined and pre-evaluated value as required by the C standard.
 
#define __STDC_EMBED_FOUND__   __EXPAND_DEC__(1)
 A predefined and pre-evaluated value as required by the C standard.
 
#define __STDC_EMBED_NOT_FOUND__   __EXPAND_DEC__(0)
 A predefined and pre-evaluated value as required by the C standard.
 
#define __STRINGIFY__(…)   ⌗__VA_ARGS__
 
#define __STRINGS__(X, …)   __MAP__(__STRINGIFY__, X)
 create a list of strings formed from all the arguments after they are expanded
 
#define __UGLIFY__(X)   __ ⨝ X ⨝ __
 add two leading and trailing underscores to the identifier X
 
#define __UNIT__
 A pseudo-macro that resolves to the name associated with the current translation unit, generally abbreviated with ¤.
 
#define __UNLIST__(X, …)   X __VA_TAIL__()
 Expand all arguments and remove commas between them.
 
#define __VA_OPT__   __VA_OPT__
 A pseudo macro that cannot be redefined.
 
#define __VA_TAIL__   __VA_TAIL__
 A pseudo macro that cannot be redefined.
 
#define __ZERO__   __EXPAND_DEC__(0)
 A predefined and pre-evaluated 0
 
#define ELLIPSIS_LOOP_MAX   __EXPAND_DEC__((__ONE__ ◀ (ELLIPSIS_LOOP_WIDTH × ELLIPSIS_LOOP_DEPTH)) - __ONE__)
 The maximum number of iterations of the loop feature.
 
#define ELLIPSIS_LOOP_WIDTH   4
 The log₂ of the number of the per-level includes for the loop feature.
 

Detailed Description

Predefined macros for all languages.

Provide some convenient short cuts that tend otherwise to be redefined over and over again in user code.

Remarks
Because doxygen doesn't have it, yet, the documentation of these macros often uses #define where the macro is actually coded with #xdefine.
Warning
The macros in this group may not be undefined or redefined

Macro Definition Documentation

◆ ¤¤¤¤¤

#define ¤¤¤¤¤
See also
Preprocessor state and identifier composition
Punctuators that are mandatory for all languages
Warning
This macro may not be undefined or changed otherwise

◆ ¤¤¤¤

#define ¤¤¤¤
See also
Preprocessor state and identifier composition
Punctuators that are mandatory for all languages
Warning
This macro may not be undefined or changed otherwise

◆ ¤¤¤

#define ¤¤¤
See also
Preprocessor state and identifier composition
Punctuators that are mandatory for all languages
Warning
This macro may not be undefined or changed otherwise

◆ ¤¤

#define ¤¤

shortcut for __PARENT_UNIT__

See also
Preprocessor state and identifier composition
Punctuators that are mandatory for all languages
Warning
This macro may not be undefined or changed otherwise

◆ ¤

#define ¤

shortcut for __UNIT__

See also
Preprocessor state and identifier composition
Punctuators that are mandatory for all languages
Warning
This macro may not be undefined or changed otherwise

◆ [1/2]

#define ∷   __UNIT__∷

obsolete macros

◆ [2/2]

#define ∷   __PARENT_UNIT__∷

obsolete macros

◆ __COMPACT__

#define __COMPACT__ (   X,
  … 
)    __MAP__(__EVALUATE__, X)

Expand all arguments and remove whitespace surrounding them.

Warning
This macro may not be undefined or changed otherwise

◆ __CONCAT__

#define __CONCAT__ (   )

evaluate and then concatenate up to 10 arguments

Warning
If any argument consists of several tokens, its first token of is concatenated with the previous argument and its last token is concatenated with the next argument, if any. Using of this property is deprecated; use only with arguments that are single tokens.
This macro may not be undefined or changed otherwise

◆ __EXPAND__

#define __EXPAND__ (   )    __VA_ARGS__

expand the arguments

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_BIN__

#define __EXPAND_BIN__ (   )    __EVALUATE_BIN__(__VA_ARGS__)

expand all the arguments, evaluate the resulting integer expression and produce a binary literal

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_BIN_U__

#define __EXPAND_BIN_U__ (   )    __CONCAT__(__EXPAND_BIN__(__VA_ARGS__), ⸤U⸥)

expand all the arguments, evaluate the resulting integer expression and produce a binary literal

The result is a binary integer literal with a U suffix such that it alwas is interpreted as unsigned number.

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_COMMAS__

#define __EXPAND_COMMAS__ (   )    __EXPAND_DEC__(__COMMAS__(__VA_ARGS__))

expand all the arguments and count the number of toplevel commas in the resulting list

If there are no arguments, their expansion leads to nothing, or there are any but no toplevel comma, the result is 0.

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_DEC__

#define __EXPAND_DEC__ (   )    __EVALUATE_DEC__(__VA_ARGS__)

expand all the arguments, evaluate the resulting integer expression and produce a decimal literal

The type of the constant is signed if it fits, otherwise unsigned.

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_DEC_U__

#define __EXPAND_DEC_U__ (   )    __CONCAT__(__EXPAND_DEC__(__VA_ARGS__), ⸤U⸥)

expand all the arguments, evaluate the resulting integer expression and produce a decimal literal

The result is a decimal integer literal with a U suffix such that it alwas is interpreted as unsigned number.

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_EMPTY__

#define __EXPAND_EMPTY__ (   )    __EMPTY__(__VA_ARGS__)

expand all the arguments and see if the result is empty

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_ERROR__

#define __EXPAND_ERROR__ (   ...)    __ERROR__(__VA_ARGS__)

Evaluate the __VA_ARGS__, use them as an error message and abord compilation.

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_HEX__

#define __EXPAND_HEX__ (   )    __EVALUATE_HEX__(__VA_ARGS__)

expand all the arguments, evaluate the resulting integer expression and produce a hexadecimal literal

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_HEX_U__

#define __EXPAND_HEX_U__ (   )    __CONCAT__(__EXPAND_HEX__(__VA_ARGS__), ⸤U⸥)

expand all the arguments, evaluate the resulting integer expression and produce a hexadecimal literal

The result is a hexadecimal integer literal with a U suffix such that it alwas is interpreted as unsigned number.

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_OCT__

#define __EXPAND_OCT__ (   )    __EVALUATE_OCT__(__VA_ARGS__)

expand all the arguments, evaluate the resulting integer expression and produce a octal literal

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_OCT_U__

#define __EXPAND_OCT_U__ (   )    __CONCAT__(__EXPAND_OCT__(__VA_ARGS__), ⸤U⸥)

expand all the arguments, evaluate the resulting integer expression and produce a octal literal

The result is a octal integer literal with a U suffix such that it alwas is interpreted as unsigned number.

Warning
This macro may not be undefined or changed otherwise

◆ __EXPAND_STRINGIFY__

#define __EXPAND_STRINGIFY__ (   )    __STRINGIFY__(__VA_ARGS__)

expand all the arguments and put the result into one string

Warning
This macro may not be undefined or changed otherwise

◆ __IMPLEMENT

#define __IMPLEMENT (   NAME,
  … 
)    @ref ¤⸤::⸥¤∷⸤NAME⸥__VA_OPT__(, )__VA_TAIL__()

◆ __IMPLEMENT_

#define __IMPLEMENT_ (   NAME,
  … 
)    typeof(¤∷⸤NAME⸥) ¤∷⸤NAME⸥__VA_OPT__(;/*^*/)__VA_TAIL__()

◆ __IMPLEMENT__

#define __IMPLEMENT__ (   NAME,
  … 
)

Implement the listed names as functions for the current translation unit.

This receives a list of identifiers and emits code that ensures that they are implemented in the current translation unit. For example

__IMPLEMENT__(cpy, destroy);
#define __IMPLEMENT__(NAME, …)
Implement the listed names as functions for the current translation unit.
Definition ellipsis-predefined.dirs:120

ensures that the symbols ¤∷cpy and ¤∷destroy are implemented.

This can be used for functions, in particular inline functions, and variables with external linkage that do not need an initializer. For non-inline functions this serves just as a consistency check; for inline functions this ensures that the function is always emitted, regardless of the optimization options for the compilation.

Remarks
The corresponding symbols must have previously been declared, usually in the corresponding header file.
See also
unit
__UNIT__

◆ __MAP__

#define __MAP__ (   F,
  … 
)    ⸤F⸥(__VA_ARGS__)⸤__VA_OPT__⸥(, )⸤__VA_TAIL__⸥()

Construct the body of a macro mapping F over all variadic arguments.

This can be used in combination with #xdefine to declare a functional macro that maps F over all its other arguments, as in

#xdefine __STRINGS__(X, ...) __MAP__(__STRINGIFY__, X)

If the macro F receives more than one argument list them all in the call to __MAP__.

#xdefine TWO_STRINGS(X, Y, ...) __MAP__(__STRINGIFY__, X, Y)
Warning
This macro may not be undefined or changed otherwise

◆ __MULTI_

#define __MULTI_ (   ...)
Value:
(FIRST, ...) \
FIRST __BIND_OPT__(, ⸤_⸥,) __BIND_TAIL__() \
) \
(__VA_ARGS__)))
#define __BIND__(...)
Generate an anonymous macro with a definition as if given by the argument list.
Definition ellipsis-builtins.dirs:52
#define __CONCAT__(…)
evaluate and then concatenate up to 10 arguments
Definition ellipsis-predefined.dirs:17
#define __EXPAND__(…)
expand the arguments
Definition ellipsis-predefined.dirs:18

◆ __MULTI__

#define __MULTI__ (   ...)    __MULTI_(__VA_ARGS__)

◆ __NARGS__

#define __NARGS__ (   )    __EXPAND_DEC__(__COMMAS__(__VA_ARGS__) + ¬__EMPTY__(__VA_ARGS__))

expand all the arguments and count the number of items in the resulting list

If there are no arguments or their expansion leads to nothing, the result is 0. Otherwise the result is the number of toplevel commas in the expansion plus one.

Warning
This macro may not be undefined or changed otherwise

◆ __ONE__

#define __ONE__   __EXPAND_DEC__(1)

A predefined and pre-evaluated 1

Warning
This macro may not be undefined or changed otherwise

◆ __PARENT_UNIT__

#define __PARENT_UNIT__

A pseudo-macro that resolves to the name of the current parent unit, generally abbreviated as ¤¤.

For a top-level C file the parent would be the project name, if that is set from __PROJECT__, for files that are deeper in the include hierarchy, other subunit names may already have been added to that.

See also
Preprocessor state and identifier composition
__UNIT__
__PROJECT__
Warning
This macro may not be undefined or changed otherwise

◆ __STDC_EMBED_EMPTY__

#define __STDC_EMBED_EMPTY__   __EXPAND_DEC__(2)

A predefined and pre-evaluated value as required by the C standard.

Warning
This macro may not be undefined or changed otherwise

◆ __STDC_EMBED_FOUND__

#define __STDC_EMBED_FOUND__   __EXPAND_DEC__(1)

A predefined and pre-evaluated value as required by the C standard.

Warning
This macro may not be undefined or changed otherwise

◆ __STDC_EMBED_NOT_FOUND__

#define __STDC_EMBED_NOT_FOUND__   __EXPAND_DEC__(0)

A predefined and pre-evaluated value as required by the C standard.

Warning
This macro may not be undefined or changed otherwise

◆ __STRINGIFY__

#define __STRINGIFY__ (   )    ⌗__VA_ARGS__

◆ __STRINGS__

#define __STRINGS__ (   X,
  … 
)    __MAP__(__STRINGIFY__, X)

create a list of strings formed from all the arguments after they are expanded

Warning
This macro may not be undefined or changed otherwise

◆ __UGLIFY__

#define __UGLIFY__ (   X)    __ ⨝ X ⨝ __

add two leading and trailing underscores to the identifier X

Warning
This macro may not be undefined or changed otherwise

◆ __UNIT__

#define __UNIT__

A pseudo-macro that resolves to the name associated with the current translation unit, generally abbreviated with ¤.

This is not set automatically, so if you want to use this feature you'd have to set this manually. Usually this would be done at the start of the translation unit. For a .c file this would typically look like

#unit hurli∷purtz

for an absolute (unrelated) name or

#unit ¤¤∷macros

for a name that is prefixed with either the name of the unit that included this source file or with the project name provided through __PROJECT__.

In all cases the translation unit may then be abbreviated with ¤∷ or __UNIT__∷ as in

void ¤∷hello(void);
void __UNIT__∷hallo(void);

Note that the definition of the unit name is restricted to the current source file; when returning from an include directive, the name is reset to the name there.

In a header file, that is generally included into completely unrelated code, you should prefer the first form, such that the contents of the header expands to the same, regardless of the context.

When ellipsis is used as a first phase preprocessor such names are all expanded into long forms that are usually separated by a character (UNDERTIE, U203F). For example if the project is magn∷ificient with the above subunit __UNIT__ would expand to magn‿ificient‿macros and the function name would be magn‿ificient‿macros‿hello.

See also
Preprocessor state and identifier composition
__PARENT_UNIT__
__PROJECT__
Warning
This macro may not be undefined or changed otherwise

◆ __UNLIST__

#define __UNLIST__ (   X,
  … 
)    X __VA_TAIL__()

Expand all arguments and remove commas between them.

Warning
This macro may not be undefined or changed otherwise

◆ __VA_OPT__

#define __VA_OPT__   __VA_OPT__

A pseudo macro that cannot be redefined.

The __VA_OPT__ construct is only active in the replacement list of a variadic macro and must be present at the point of definition. Any other occurence triggers this macro here and passes the token through.

Warning
This macro may not be undefined or changed otherwise

◆ __VA_TAIL__

#define __VA_TAIL__   __VA_TAIL__

A pseudo macro that cannot be redefined.

The __VA_TAIL__ construct is only active in the replacement list of a variadic macro at the very end of expansion. Any other occurence triggers this macro here and passes the token through.

See also
Tail recursion
Warning
This macro may not be undefined or changed otherwise

◆ __ZERO__

#define __ZERO__   __EXPAND_DEC__(0)

A predefined and pre-evaluated 0

Warning
This macro may not be undefined or changed otherwise

◆ ELLIPSIS_LOOP_MAX

The maximum number of iterations of the loop feature.

See also
ellipsis-loop.dirs
Warning
This macro may not be undefined or changed otherwise

◆ ELLIPSIS_LOOP_WIDTH

#define ELLIPSIS_LOOP_WIDTH   4

The log₂ of the number of the per-level includes for the loop feature.

See also
ellipsis-loop.dirs
Warning
This macro may not be undefined or changed otherwise