Console C API

Defnes C API to log/print text messages.

Functions

Functions Documentation

function prints

void prints(
    const char * cstr
)

Prints string

Parameters:

  • cstr - a null terminated string

Example:

prints("Hello World!"); // Output: Hello World!

function prints_l

void prints_l(
    const char * cstr,
    uint32_t len
)

Prints string up to given length

Parameters:

  • cstr - pointer to string
  • len - len of string to be printed

Example:

prints_l("Hello World!", 5); // Output: Hello

function printi

void printi(
    int64_t value
)

Prints value as a 64 bit signed integer.

Prints value as a 64 bit signed integer

Parameters:

  • value of 64 bit signed integer to be printed

Example:

printi(-1e+18); // Output: -1000000000000000000

function printui

void printui(
    uint64_t value
)

Prints value as a 64 bit unsigned integer

Parameters:

  • value of 64 bit unsigned integer to be printed

Example:

printui(1e+18); // Output: 1000000000000000000

function printi128

void printi128(
    const int128_t * value
)

Prints value as a 128 bit signed integer

Parameters:

  • value is a pointer to the 128 bit signed integer to be printed

Example:

int128_t large_int(-87654323456);
printi128(&large_int); // Output: -87654323456

function printui128

void printui128(
    const uint128_t * value
)

Prints value as a 128 bit unsigned integer

Parameters:

  • value is a pointer to the 128 bit unsigned integer to be printed

Example:

uint128_t large_int(87654323456);
printui128(&large_int); // Output: 87654323456

function printsf

void printsf(
    float value
)

Prints value as single-precision floating point number

Parameters:

  • value of float to be printed

Example:

float value = 5.0 / 10.0;
printsf(value); // Output: 0.5

function printdf

void printdf(
    double value
)

Prints value as double-precision floating point number

Parameters:

  • value of double to be printed

Example:

double value = 5.0 / 10.0;
printdf(value); // Output: 0.5

function printqf

void printqf(
    const long double * value
)

Prints value as quadruple-precision floating point number

Parameters:

  • value is a pointer to the long double to be printed

Example:

long double value = 5.0 / 10.0;
printqf(value); // Output: 0.5

function printn

void printn(
    uint64_t name
)

Prints a 64 bit names as base32 encoded string

Parameters:

  • name - 64 bit name to be printed

Example:

printn("abcde"_n); // Output: abcde

function printhex

void printhex(
    const void * data,
    uint32_t datalen
)

Prints hexidecimal data of length datalen.

Prints hexidecimal data of length datalen

Parameters:

  • data to be printed
  • datalen length of the data to be printed

Example

unsigned char rawData[9] = {0x49 0x20 0x6C 0x6F 0x76 0x65 0x20 0x62 0x6D};
printhex(&rawData, 9);

Prints a block of bytes in hexadecimal

Parameters:

  • ptr - pointer to bytes of interest
  • size - number of bytes to print