Modular C
C

The Modular C interface for the standard C library. More...

+ Collaboration diagram for C:

Modules

 Platform features used by module C
 Some features are recovered or pre-computed specifically for the target platform by looking into the C include files:
 
 Specific macros to deal with the structure of module C.
 
 C∷align
 Provide standard features for alignment, obsolete.
 
 C∷assert The standard assert macro.
 
 C∷atomic Atomic types and operations.
 
 C∷attr The interface to attributes.
 
 C∷attribute Use contexts to implement attribute syntax.
 This introduces syntax that is similar to C++ attributes.
 
 C∷bitset A context to use integer types as bitsets.
 This provides more intuitive operators such as set minus and inclusion relations.
 
 C∷bool Features of the @c bool type.
 
 C∷cenv Long jump C environment functions and macros.
 
 C∷char Character handling.
 
 C∷char16 16 bit character handling
 
 C∷char32 32-bit character handling.
 
 C∷combine Combine elements of a list.
 Currently, the length of the list may not exceed 50 elements.
 
 C∷comma Macro logic by counting commas.
 This implements logic operations by interpreting macro argument lists as truth values.
 
 C∷complex Top level module for complex numbers.
 
 C∷COUNT Count argument lists
 This differs from the C∷comma module in that here an empty argument list and a one argument list are distinguished.
 
 C∷def provide some standard definitions as local names.
 If this is imported directly all the names are available as local names to the importer.
 
 C∷DEFARG
 Provide a mechanism for default arguments.
 
 C∷env Access the execution environment.
 
 C∷equal Provide a general framework for equality.
 
 C∷errno C error numbers and tools.
 C only has very rudimentary support for this.
 
 C∷F257 Implement some finite fields.
 
 C∷fenv The floating point environment.
 
 C∷for Macros that iterate over their arguments.
 
 C∷fs C's idea of the file system.
 C only has minimal support for file systems.
 
 C∷impl A toplevel module for implementation specific details.
 
 C∷int Deal with the int type.
 
 C∷integer Features to deal with the fixed or minimum width integer types.
 
 C∷interface
 
 C∷intmax
 
 C∷intptr
 
 C∷io C's Input/Output primitives.
 
 C∷is
 
 C∷iso646
 
 C∷JOIN Join tokens
 
 C∷lib
 
 C∷llong
 
 C∷locale
 
 C∷long
 
 C∷map
 
 C∷math
 
 C∷mbs
 
 C∷mem
 
 C∷mix
 
 C∷mod
 
 C∷noreturn
 
 C∷ptrdiff
 
 C∷real
 
 C∷REVERT Revert a token list.
 
 C∷schar
 
 C∷short
 
 C∷sig
 
 C∷size
 
 C∷sizeptr
 
 C∷snippet
 
 C∷std Backwards compatibility for C standard headers
 A module hierarchy that imports C library features one to one directly into the name space of the importer.
 
 C∷str
 
 C∷string
 
 C∷symbols
 
 C∷thrd
 
 C∷time
 
 C∷tmpl
 
 C∷uchar
 
 C∷uintmax
 
 C∷uintptr
 
 C∷ullong
 
 C∷ulong
 
 C∷unsigned
 
 C∷ushort
 
 C∷va
 
 C∷wchar
 
 C∷wcs
 
 C∷wint
 

Macros

#define C∷own_inline
 
#define C∷imp_inline
 
#define NULL   __NULL
 A typesafe null pointer constant. More...
 
#define C∷DATE   __DATE__
 
#define C∷FILE   __FILE__
 
#define C∷LINE   (__LINE__ ≤ C∷LINE_MAX ? __LINE__ : −C∷LINE_MAX)
 A line number with guaranteed type int. More...
 
#define C∷LINENO   ((__intmax)+__LINE__)
 A line number with guaranteed type intmax. More...
 
#define C∷TIME   __TIME__
 
#define C∷MB_MIGHT_NEQ_WC   0
 
#define C∷ANALYZABLE   0
 
#define C∷LIB_EXT1   000000L
 
#define C∷NO_ATOMICS   0
 
#define C∷NO_VLA   0
 
#define noreturn   _Noreturn
 
#define alignas   _Alignas
 
#define alignof   _Alignof
 
#define bool   _Bool
 
#define false   0
 
#define true   1
 
#define C∷and   ∧
 
#define C∷bitand   &
 
#define C∷bitor   ∪
 
#define C∷compl   ∼
 
#define C∷not   ¬
 
#define C∷or   ∨
 
#define C∷xor   ^
 
#define C∷not_eq   ≠
 
#define C∷or_eq   ∪=
 
#define C∷and_eq   &=
 
#define C∷xor_eq   ^=
 
#define C∷rankof(X)
 Return the integer rank of an expression. More...
 
#define C∷widthof(X)
 
#define C∷signof(X)
 
#define C∷unsignedof(X)
 Return an expression with corresponding unsigned type. More...
 
#define C∷signedof(X)
 Return an expression with corresponding signed type. More...
 
#define C∷STRINGIFY(...)   C∷STRINGIFY0(__VA_ARGS__)
 Stringify the expanded arguments. More...
 
#define C∷STRINGIFY0(...)   #__VA_ARGS__
 Stringify the non-expanded arguments. More...
 
#define C∷FIRST(...)   _Intern∷_ux2pubD1∷C∷FIRST0(__VA_ARGS__, 0)
 Return the first of a list of arguments. More...
 
#define C∷SECOND(...)   _Intern∷_ux2pubD1∷C∷SECOND0(__VA_ARGS__, 0, 0)
 Return the second of a list of arguments. More...
 
#define C∷HAS2(...)   _Intern∷_ux2pubD1∷C∷HAS0(__VA_ARGS__, 1, 0, 0)
 Return 1 if the argument list has two elements. More...
 

Typedefs

typedef __size C∷size
 
typedef __size_signed C∷size_signed
 
typedef __ptrdiff C∷ptrdiff
 
typedef __ptrdiff_unsigned C∷ptrdiff_unsigned
 
typedef __wchar C∷wchar
 
typedef __char16 C∷char16
 
typedef __char32 C∷char32
 
typedef __uintptr C∷uintptr
 
typedef __intptr C∷intptr
 
typedef __uintmax C∷uintmax
 
typedef __intmax C∷intmax
 
typedef __wint C∷wint
 
typedef signed char C∷schar
 
typedef unsigned char C∷uchar
 
typedef unsigned short C∷ushort
 
typedef unsigned long C∷ulong
 
typedef signed long long C∷llong
 
typedef unsigned long long C∷ullong
 
typedef long double C∷ldouble
 
typedef char * C∷charp
 
typedef char const * C∷charconstp
 

Enumerations

enum  C∷_MODULE_tag_ux2pubD1_190 { C∷ascii = __ascii }
 

Detailed Description

The Modular C interface for the standard C library.

This should give a complete interface to the C library as it is described by the C standard. The interface is divided in two parts.

Macro Definition Documentation

◆ alignas

#define alignas   _Alignas

Definition at line 607 of file C.c.

◆ alignof

#define alignof   _Alignof

Definition at line 609 of file C.c.

◆ bool

#define bool   _Bool

Definition at line 612 of file C.c.

◆ C∷ANALYZABLE

#define C∷ANALYZABLE   0

Definition at line 542 of file C.c.

◆ C∷and

#define C∷and   ∧

Definition at line 620 of file C.c.

◆ C∷and_eq

#define C∷and_eq   &=

Definition at line 638 of file C.c.

◆ C∷bitand

#define C∷bitand   &

Definition at line 622 of file C.c.

◆ C∷bitor

#define C∷bitor   ∪

Definition at line 624 of file C.c.

◆ C∷compl

#define C∷compl   ∼

Definition at line 626 of file C.c.

◆ C∷DATE

#define C∷DATE   __DATE__

Definition at line 473 of file C.c.

◆ C∷FILE

#define C∷FILE   __FILE__

Definition at line 475 of file C.c.

◆ C∷FIRST

#define C∷FIRST (   ...)    _Intern∷_ux2pubD1∷C∷FIRST0(__VA_ARGS__, 0)

Return the first of a list of arguments.

If the list is empty, this returns the empty token.

Definition at line 864 of file C.c.

◆ C∷HAS2

#define C∷HAS2 (   ...)    _Intern∷_ux2pubD1∷C∷HAS0(__VA_ARGS__, 1, 0, 0)

Return 1 if the argument list has two elements.

The argument list must have zero, one or two elements.

Definition at line 887 of file C.c.

◆ C∷imp_inline

#define C∷imp_inline
Value:
extern inline __attribute__((__gnu_inline__,\
__visibility__("default")))

Definition at line 371 of file C.c.

◆ C∷LIB_EXT1

#define C∷LIB_EXT1   000000L

Definition at line 560 of file C.c.

◆ C∷LINE

#define C∷LINE   (__LINE__ ≤ C∷LINE_MAX ? __LINE__ : −C∷LINE_MAX)

A line number with guaranteed type int.

This is the line number, but only if it is not greater than ∷LINE_MAX.

Remarks
Prefer this or ∷LINENO over C's LINE. For line numbers that are too big, a negative value is produced to indicate the overflow.

Definition at line 496 of file C.c.

◆ C∷LINENO

#define C∷LINENO   ((__intmax)+__LINE__)

A line number with guaranteed type intmax.

This is the line number, as much as the preprocessor can process it.

Remarks
Prefer this or ∷LINE over C's LINE.

Definition at line 509 of file C.c.

◆ C∷MB_MIGHT_NEQ_WC

#define C∷MB_MIGHT_NEQ_WC   0

Definition at line 524 of file C.c.

◆ C∷NO_ATOMICS

#define C∷NO_ATOMICS   0

Definition at line 566 of file C.c.

◆ C∷NO_VLA

#define C∷NO_VLA   0

Definition at line 584 of file C.c.

◆ C∷not

#define C∷not   ¬

Definition at line 628 of file C.c.

◆ C∷not_eq

#define C∷not_eq   ≠

Definition at line 634 of file C.c.

◆ C∷or

#define C∷or   ∨

Definition at line 630 of file C.c.

◆ C∷or_eq

#define C∷or_eq   ∪=

Definition at line 636 of file C.c.

◆ C∷own_inline

#define C∷own_inline
Value:
inline __attribute__((__gnu_inline__, \
__visibility__("default")))

Definition at line 368 of file C.c.

◆ C∷rankof

#define C∷rankof (   X)
Value:
_Generic((X), \
bool: 0, char: 1, unsigned char: 1, signed char: 1, unsigned short: 2, signed short: 2, unsigned: 3, signed: 3, unsigned long: 4, signed long: 4, unsigned long long: 5, signed long long: 5,\
default: 6)

Return the integer rank of an expression.

Definition at line 698 of file C.c.

◆ C∷SECOND

#define C∷SECOND (   ...)    _Intern∷_ux2pubD1∷C∷SECOND0(__VA_ARGS__, 0, 0)

Return the second of a list of arguments.

If the list is empty, this returns the empty token. If the list only has one element, this returns the token 0.

Definition at line 876 of file C.c.

◆ C∷signedof

#define C∷signedof (   X)
Value:
_Generic((X), \
bool : ‼(X), char : (signed char )(X), unsigned char : (signed char )(X), unsigned short : (signed short )(X), unsigned : (signed )(X), unsigned long : (signed long )(X), unsigned long long: (signed long long)(X),\
\
default: (X))

Return an expression with corresponding signed type.

Unsigned to signed conversion is implementation defined, so this macro can have your program crash if the value is not representable in the signed type.

Remarks
bool is the only unsigned type that has no signed equivalent. We convert it to int, since this is the default promotion, anyhow.

Definition at line 749 of file C.c.

◆ C∷signof

#define C∷signof (   X)
Value:
_Generic((X), \
bool: 0, char: C∷CHAR_SIGN, unsigned char: 0, signed char: 1, unsigned short: 0, signed short: 1, unsigned int: 0, signed int: 1, unsigned long: 0, signed long: 1, unsigned long long: 0, signed long long: 1, /* This should never error out,\
if used in */ /* a dead branch, e.g \
for pointers. */ \
default: 0)
#define C∷CHAR_SIGN
The platform specific value (!!CHAR_MIN).
Returns
the signedness (not the sign!) of an expression, that is if -1 converted to the same type as X is less than 0 or not

Definition at line 720 of file C.c.

◆ C∷STRINGIFY

#define C∷STRINGIFY (   ...)    C∷STRINGIFY0(__VA_ARGS__)

Stringify the expanded arguments.

Definition at line 851 of file C.c.

Referenced by POSIX∷str∷test().

◆ C∷STRINGIFY0

#define C∷STRINGIFY0 (   ...)    #__VA_ARGS__

Stringify the non-expanded arguments.

Definition at line 856 of file C.c.

◆ C∷TIME

#define C∷TIME   __TIME__

Definition at line 511 of file C.c.

◆ C∷unsignedof

#define C∷unsignedof (   X)
Value:
_Generic((X), \
char : (unsigned char )(X), signed char : (unsigned char )(X), signed short : (unsigned short )(X), signed : (unsigned )(X), signed long : (unsigned long )(X), signed long long: (unsigned long long)(X),\
\
default: (X))

Return an expression with corresponding unsigned type.

Definition at line 731 of file C.c.

◆ C∷widthof

#define C∷widthof (   X)
Value:
_Generic((X), \
bool: C∷BOOL_WIDTH, char: C∷CHAR_WIDTH, unsigned char: C∷UCHAR_WIDTH, signed char: C∷SCHAR_WIDTH, unsigned short: C∷USHRT_WIDTH, signed short: C∷SHRT_WIDTH, unsigned: C∷UINT_WIDTH, signed: C∷INT_WIDTH, unsigned long: C∷ULONG_WIDTH, signed long: C∷LONG_WIDTH, unsigned long long: C∷ULLONG_WIDTH, signed long long: C∷LLONG_WIDTH,\
default: sizeof(X)*C∷CHAR_WIDTH)
#define C∷BOOL_WIDTH
The platform specific value (int)((&(volatile union { unsigned char bits[sizeof(bool)]; bool val; }){...
#define C∷INT_WIDTH
The platform specific value (int)(cmod_msb(INT_MAX)+(INT_MAX < UINT_MAX)).
#define C∷ULONG_WIDTH
The platform specific value (int)cmod_msb(ULONG_MAX).
#define C∷UCHAR_WIDTH
The platform specific value (int)cmod_msb(UCHAR_MAX).
#define C∷LONG_WIDTH
The platform specific value (int)(cmod_msb(LONG_MAX)+(LONG_MAX < ULONG_MAX)).
#define C∷LLONG_WIDTH
The platform specific value (int)(cmod_msb(LLONG_MAX)+(LLONG_MAX < ULLONG_MAX)).
#define C∷SCHAR_WIDTH
The platform specific value (int)(cmod_msb(SCHAR_MAX)+(SCHAR_MAX < UCHAR_MAX)).
#define C∷USHRT_WIDTH
The platform specific value (int)cmod_msb(USHRT_MAX).
#define C∷SHRT_WIDTH
The platform specific value (int)(cmod_msb(SHRT_MAX)+(SHRT_MAX < USHRT_MAX)).
#define C∷CHAR_WIDTH
The platform specific value (int)(cmod_msb(CHAR_MAX)+!!CHAR_MIN).
#define C∷UINT_WIDTH
The platform specific value (int)cmod_msb(UINT_MAX).
#define C∷ULLONG_WIDTH
The platform specific value (int)cmod_msb(ULLONG_MAX).
Returns
the width of an expression, that is the number of bits that the underlying type uses effectively, not counting padding bits.

Definition at line 709 of file C.c.

◆ C∷xor

#define C∷xor   ^

Definition at line 632 of file C.c.

◆ C∷xor_eq

#define C∷xor_eq   ^=

Definition at line 640 of file C.c.

◆ false

#define false   0

Definition at line 614 of file C.c.

◆ noreturn

#define noreturn   _Noreturn

Definition at line 604 of file C.c.

◆ NULL

#define NULL   __NULL

A typesafe null pointer constant.

This is a null pointer constant, known to be of pointer type.

Remarks
Prefer this over C's NULL.

Definition at line 458 of file C.c.

◆ true

#define true   1

Definition at line 616 of file C.c.

Typedef Documentation

◆ C∷char16

typedef __char16 C∷char16

Definition at line 429 of file C.c.

◆ C∷char32

typedef __char32 C∷char32

Definition at line 431 of file C.c.

◆ C∷charconstp

typedef char const* C∷charconstp

Definition at line 845 of file C.c.

◆ C∷charp

typedef char* C∷charp

Definition at line 843 of file C.c.

◆ C∷intmax

typedef __intmax C∷intmax

Definition at line 439 of file C.c.

◆ C∷intptr

typedef __intptr C∷intptr

Definition at line 435 of file C.c.

◆ C∷ldouble

typedef long double C∷ldouble

Definition at line 841 of file C.c.

◆ C∷llong

typedef signed long long C∷llong

Definition at line 837 of file C.c.

◆ C∷ptrdiff

typedef __ptrdiff C∷ptrdiff

Definition at line 423 of file C.c.

◆ C∷ptrdiff_unsigned

typedef __ptrdiff_unsigned C∷ptrdiff_unsigned

Definition at line 425 of file C.c.

◆ C∷schar

typedef signed char C∷schar

Definition at line 829 of file C.c.

◆ C∷size

typedef __size C∷size

Definition at line 419 of file C.c.

◆ C∷size_signed

typedef __size_signed C∷size_signed

Definition at line 421 of file C.c.

◆ C∷uchar

typedef unsigned char C∷uchar

Definition at line 831 of file C.c.

◆ C∷uintmax

typedef __uintmax C∷uintmax

Definition at line 437 of file C.c.

◆ C∷uintptr

typedef __uintptr C∷uintptr

Definition at line 433 of file C.c.

◆ C∷ullong

typedef unsigned long long C∷ullong

Definition at line 839 of file C.c.

◆ C∷ulong

typedef unsigned long C∷ulong

Definition at line 835 of file C.c.

◆ C∷ushort

typedef unsigned short C∷ushort

Definition at line 833 of file C.c.

◆ C∷wchar

typedef __wchar C∷wchar

Definition at line 427 of file C.c.

◆ C∷wint

typedef __wint C∷wint

Definition at line 441 of file C.c.

Enumeration Type Documentation

◆ C∷_MODULE_tag_ux2pubD1_190

Enumerator
C∷ascii 

Definition at line 443 of file C.c.

443 { C∷ascii = __ascii, };
Definition: C.c:443