Cross-platform C SDK logo

Cross-platform C SDK

Sewer

❮ Back
Next ❯
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.

Even the grandest palaces needed sewers. Tom Lehrer


Functions

void(*FPtr_destroy (...))
type*(*FPtr_copy (...))
int(*FPtr_compare (...))
int(*FPtr_compare_ex (...))
void(*FPtr_assert (...))
voidunref (...)

Types and Constants

int8_t
int16_t
int32_t
int64_t
uint8_t
uint16_t
uint32_t
uint64_t
char_t
byte_t
bool_t
real
real32_t
real64_t
bool_tTRUE
bool_tFALSE
void*NULL
int8_tINT8_MIN
int8_tINT8_MAX
int16_tINT16_MIN
int16_tINT16_MAX
int32_tINT32_MIN
int32_tINT32_MAX
int64_tINT64_MIN
int64_tINT64_MAX
uint8_tUINT8_MAX
uint16_tUINT16_MAX
uint32_tUINT32_MAX
uint64_tUINT64_MAX
enumunicode_t

sewer is the most elementary library within the NAppGUI SDK (Figure 1). It declares the basic types, the Unicode fundamental support, assertions and pointers safe manipulation. It is also used as a "sink" to bury the unsightly preprocessor macros necessary to configure the compiler, CPU, platforms, etc. As dependencies only has a few headers of the C standard library:

  • <stdint.h>: For fixed size integers and limits.
  • <stdarg.h>: To support functions with a variable number of parameters.
  • <stddef.h>: For the NULL constant and the offsetof macro.
  • Dependency tree of the sewer library.
    Figure 1: Dependencies of sewer. See SDK reference.

int8_t

8-bit signed integer. It can represent a value between INT8_MIN and INT8_MAX.


int16_t

16-bit signed integer. It can represent a value between INT16_MIN and INT16_MAX.


int32_t

32-bit signed integer. It can represent a value between INT32_MIN and INT32_MAX.


int64_t

64-bit signed integer. It can represent a value between INT64_MIN and INT64_MAX.


uint8_t

8-bit unsigned integer. It can represent a value between 0 and UINT8_MAX.


uint16_t

16-bit unsigned integer. It can represent a value between 0 and UINT16_MAX.


uint32_t

32-bit unsigned integer. It can represent a value between 0 and UINT32_MAX.


uint64_t

64-bit unsigned integer. It can represent a value between 0 and UINT64_MAX.


char_t

8-bit character type (Unicode). A single character may need 1, 2, 3 or 4 elements (bytes), depending on UTF encodings.


byte_t

8-bit type to store generic memory blocks.


bool_t

8-bit boolean. Only two values are allowed TRUE (1) and FALSE (0).


real

32 or 64-bit floating point number.


real32_t

32-bit floating point number. The C float type.


real64_t

64-bit floating point number. The C double type.


TRUE

const bool_t TRUE = 1;

True.


FALSE

const bool_t FALSE = 0;

False.


NULL

const void* NULL = 0;

Null pointer.


INT8_MIN

const int8_t INT8_MIN = 0x80;

-128.


INT8_MAX

const int8_t INT8_MAX = 0x7F;

127.


INT16_MIN

const int16_t INT16_MIN = 0x8000;

-32.768.


INT16_MAX

const int16_t INT16_MAX = 0x7FFF;

32.767.


INT32_MIN

const int32_t INT32_MIN = 0x80000000;

-2.147.483.648.


INT32_MAX

const int32_t INT32_MAX = 0x7FFFFFFF;

2.147.483.647.


INT64_MIN

const int64_t INT64_MIN = 0x8000000000000000;

-9.223.372.036.854.775.808.


INT64_MAX

const int64_t INT64_MAX = 0x7FFFFFFFFFFFFFFF;

9.223.372.036.854.775.807.


UINT8_MAX

const uint8_t UINT8_MAX = 0xFF;

255.


UINT16_MAX

const uint16_t UINT16_MAX = 0xFFFF;

65.535.


UINT32_MAX

const uint32_t UINT32_MAX = 0xFFFFFFFF;

4.294.967.295.


UINT64_MAX

const uint64_t UINT64_MAX = 0xFFFFFFFFFFFFFFFF;

18.446.744.073.709.551.615.


enum unicode_t

Represents the UTF encodings.

enum unicode_t
{
    ekUTF8,
    ekUTF16,
    ekUTF32
};
ekUTF8

UTF8 encoding.

ekUTF16

UTF16 encoding.

ekUTF32

UTF32 encoding.


FPtr_destroy

Destructor function prototype.

void
(*FPtr_destroy)(type **item);
item

Double pointer to the object to destroy. It must be assigned to NULL after the destruction to invalidate its use.


FPtr_copy

Copy constructor function prototype.

type*
(*FPtr_copy)(const type *item);
item

Pointer to the object to be copied.

Return

The new object that is an exact copy of the input.


FPtr_compare

Comparison function prototype.

int
(*FPtr_compare)(const type *item1,
                const type *item2);
item1

First item to compare.

item2

Second item to compare.

Return

Comparison result.


FPtr_compare_ex

Similar to FPtr_compare, but receive an additional parameter that may influence the comparison.

int
(*FPtr_compare_ex)(const type *item1,
                   const type *item2,
                   const dtype *data);
item1

First item to compare.

item2

Second item to compare.

data

Additional parameter.

Return

Comparison result.


FPtr_assert

Callback function prototype called when an assert occurs.

void
(*FPtr_assert)(type *item,
               const uint32_t group,
               const char_t *caption,
               const char_t *detail,
               const char_t *file,
               const uint32_t line);
item

User data passed as the first parameter.

group

0 = Fatal error, 1 = Execution can continue.

caption

Title.

detail

Detailed message.

file

Source file where the assert occurred.

line

Line inside the source file.


unref ()

Mark the parameter as non-referenced, disabling the compiler's warnings.

void
unref(param);
1
2
3
4
5
static void i_OnClick(App *app, Event *e)
{
    unref(e);
    app_click_action(app);
}
param

Parameter.

❮ Back
Next ❯