Cross-platform C SDK logo

Cross-platform C SDK

Core

❮ 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.

A strong core will improve your technique, strength, endurance and will complement everything you do. Susan Trainor


Functions

void(*FPtr_remove (...))
void(*FPtr_event_handler (...))
type*(*FPtr_read (...))
void(*FPtr_read_init (...))
void(*FPtr_write (...))
voidcore_start (void)
voidcore_finish (void)

Types and Constants

DeclSt
DeclPt
enumcore_event_t
enumsstate_t
enumvkey_t
enummkey_t
enumtoken_t
enumdbindst_t
structBuffer
structString
structArrSt
structArrPt
structSetSt
structSetPt
structStream
structRegEx
structEvent
structKeyBuf
structListener
structIListener
structDirEntry
structEvFileDir
structResPack
structResId
structClock

Just as a building needs a strong foundation, any software project must be supported by robust and efficient pillars. For this purpose, the core library has been developed (Figure 1), which provides commonly used non-graphical utilities. In addition to being the basis of NAppGUI-SDK, it will also facilitate the development of our own programs and libraries, guaranteeing maximum efficiency and portability. core has no external dependencies, except Osbs, which will provide the elementary calls to the operating system.

Core library dependency tree.
Figure 1: core dependencies. See NAppGUI API.

The power of core lies in the efficient and safe management of memory, together with the automation of operations on objects and the management of collections based on arrays and binary search trees (Figure 2). All this would be incomplete without a robust serialization system, which allows us to export/import data from/to memory, using different communication channels.

  • Heap. Paged memory manager with leaks auditor.
  • Buffers. Generic dynamic memory block.
  • Strings. Text strings in dynamic memory.
  • Arrays. Collection of elements in contiguous memory locations.
  • Sets. Container that optimizes the search, insertion and deletion of elements.
  • Data binding. Automation of operations on objects.
  • Streams. Input and output channels. Incorporates a text parser to read tokens.
  • Chart showing the relationship between memory pages, data structures, and I/O channels.
    Figure 2: Relationship between memory management, data structures and streams.

Additionally, core provides these utilities:

❮ Back
Next ❯

DeclSt

Enables macros for compile-time type checking in Arrays and Sets. Usage: DeclSt(Type) immediately after the definition of the struct Type.


DeclPt

Same as DeclSt for pointer containers.


enum core_event_t

Event types in core library.

enum core_event_t
{
    ekEASSERT,
    ekEFILE,
    ekEENTRY,
    ekEEXIT
};
ekEASSERT

Redirection of Asserts.

ekEFILE

A file detected while browsing a directory. hfile_dir_loop.

ekEENTRY

Entry in a sub-directory while we go through a directory. hfile_dir_loop.

ekEEXIT

Exit of a sub-directory.


enum sstate_t

Streams state.

enum sstate_t
{
    ekSTOK,
    ekSTEND,
    ekSTCORRUPT,
    ekSTBROKEN
};
ekSTOK

All ok, no errors.

ekSTEND

No more data on the channel.

ekSTCORRUPT

The data in the channel is invalid or has not been read correctly.

ekSTBROKEN

Error in the communication channel.


enum vkey_t

Keyboard codes. See Using the keyboard.

enum vkey_t
{
    ekKEY_UNDEF,
    ekKEY_A,
    ekKEY_S,
    ekKEY_D,
    ekKEY_F,
    ekKEY_H,
    ekKEY_G,
    ekKEY_Z,
    ekKEY_X,
    ekKEY_C,
    ekKEY_V,
    ekKEY_BSLASH,
    ekKEY_B,
    ekKEY_Q,
    ekKEY_W,
    ekKEY_E,
    ekKEY_R,
    ekKEY_Y,
    ekKEY_T,
    ekKEY_1,
    ekKEY_2,
    ekKEY_3,
    ekKEY_4,
    ekKEY_6,
    ekKEY_5,
    ekKEY_9,
    ekKEY_7,
    ekKEY_8,
    ekKEY_0,
    ekKEY_RCURLY,
    ekKEY_O,
    ekKEY_U,
    ekKEY_LCURLY,
    ekKEY_I,
    ekKEY_P,
    ekKEY_RETURN,
    ekKEY_L,
    ekKEY_J,
    ekKEY_SEMICOLON,
    ekKEY_K,
    ekKEY_QUEST,
    ekKEY_COMMA,
    ekKEY_MINUS,
    ekKEY_N,
    ekKEY_M,
    ekKEY_PERIOD,
    ekKEY_TAB,
    ekKEY_SPACE,
    ekKEY_GTLT,
    ekKEY_BACK,
    ekKEY_ESCAPE,
    ekKEY_F17,
    ekKEY_NUMDECIMAL,
    ekKEY_NUMMULT,
    ekKEY_NUMADD,
    ekKEY_NUMLOCK,
    ekKEY_NUMDIV,
    ekKEY_NUMRET,
    ekKEY_NUMMINUS,
    ekKEY_F18,
    ekKEY_F19,
    ekKEY_NUMEQUAL,
    ekKEY_NUM0,
    ekKEY_NUM1,
    ekKEY_NUM2,
    ekKEY_NUM3,
    ekKEY_NUM4,
    ekKEY_NUM5,
    ekKEY_NUM6,
    ekKEY_NUM7,
    ekKEY_NUM8,
    ekKEY_NUM9,
    ekKEY_F5,
    ekKEY_F6,
    ekKEY_F7,
    ekKEY_F3,
    ekKEY_F8,
    ekKEY_F9,
    ekKEY_F11,
    ekKEY_F13,
    ekKEY_F16,
    ekKEY_F14,
    ekKEY_F10,
    ekKEY_F12,
    ekKEY_F15,
    ekKEY_PAGEUP,
    ekKEY_HOME,
    ekKEY_SUPR,
    ekKEY_F4,
    ekKEY_PAGEDOWN,
    ekKEY_F2,
    ekKEY_END,
    ekKEY_F1,
    ekKEY_LEFT,
    ekKEY_RIGHT,
    ekKEY_DOWN,
    ekKEY_UP,
    ekKEY_LSHIFT,
    ekKEY_RSHIFT,
    ekKEY_LCTRL,
    ekKEY_RCTRL,
    ekKEY_LALT,
    ekKEY_RALT,
    ekKEY_INSERT,
    ekKEY_EXCLAM,
    ekKEY_MENU,
    ekKEY_LWIN,
    ekKEY_RWIN,
    ekKEY_CAPS,
    ekKEY_TILDE,
    ekKEY_GRAVE,
    ekKEY_PLUS
};

enum mkey_t

Modifier keys.

enum mkey_t
{
    ekMKEY_NONE,
    ekMKEY_SHIFT,
    ekMKEY_CONTROL,
    ekMKEY_ALT,
    ekMKEY_COMMAND
};

enum token_t

Token types on stm_read_token.

enum token_t
{
    ekTSLCOM,
    ekTMLCOM,
    ekTSPACE,
    ekTEOL,
    ekTLESS,
    ekTGREAT,
    ekTCOMMA,
    ekTPERIOD,
    ekTSCOLON,
    ekTCOLON,
    ekTOPENPAR,
    ekTCLOSPAR,
    ekTOPENBRAC,
    ekTCLOSBRAC,
    ekTOPENCURL,
    ekTCLOSCURL,
    ekTPLUS,
    ekTMINUS,
    ekTASTERK,
    ekTEQUALS,
    ekTDOLLAR,
    ekTPERCEN,
    ekTPOUND,
    ekTAMPER,
    ekTAPOST,
    ekTQUOTE,
    ekTCIRCUM,
    ekTTILDE,
    ekTEXCLA,
    ekTQUEST,
    ekTVLINE,
    ekTSLASH,
    ekTBSLASH,
    ekTAT,
    ekTINTEGER,
    ekTOCTAL,
    ekTHEX,
    ekTREAL,
    ekTSTRING,
    ekTIDENT,
    ekTUNDEF,
    ekTCORRUP,
    ekTEOF,
    ekTRESERVED
};
ekTSLCOM

One-line comment, which begins with //.

ekTMLCOM

Multi-line commentary, enclosed between /* and */.

ekTSPACE

Represents a series of blanks (' ', '\t', '\v', '\f', '\r').

ekTEOL

Represents the new line character ('\n').

ekTLESS

Less than sign '<'.

ekTGREAT

Greater than sign '>'.

ekTCOMMA

Comma sign ','.

ekTPERIOD

Point sign '.'.

ekTSCOLON

Semicolon sign ';'.

ekTCOLON

Colon sign ':'.

ekTOPENPAR

Opening parenthesis '('.

ekTCLOSPAR

Closing parenthesis ')'.

ekTOPENBRAC

Opening bracket '['.

ekTCLOSBRAC

Closing bracket ']'.

ekTOPENCURL

Opening curly bracket '{'.

ekTCLOSCURL

Closing curly bracket '}'.

ekTPLUS

Plus sign '+'.

ekTMINUS

Minus sign '-'.

ekTASTERK

Asterisk sign '*'.

ekTEQUALS

Equal sign '='.

ekTDOLLAR

Dollar sign.

ekTPERCEN

Percentage sign '%'.

ekTPOUND

Pound sign '#'.

ekTAMPER

Ampersand sign '&'.

ekTAPOST

Apostrophe sign '''.

ekTQUOTE

Quotation sign '"'.

ekTCIRCUM

Circumflex accent sign '^'.

ekTTILDE

Tilde sign '~'.

ekTEXCLA

Exclamation sign '!'.

ekTQUEST

Question mark '?'.

ekTVLINE

Vertical bar sign '|'.

ekTSLASH

Slash bar sign '/'.

ekTBSLASH

Backslash sign '\'.

ekTAT

At sign '@'.

ekTINTEGER

Integer number. Numbers.

ekTOCTAL

Octal number. Numbers.

ekTHEX

Hexadecimal number. Numbers.

ekTREAL

Real number. Numbers.

ekTSTRING

Unicode character string, enclosed in quotation marks. Strings.

ekTIDENT

Identifier. Identifiers.

ekTUNDEF

Unknown token.

ekTCORRUP

Error in the input Streams or data.

ekTEOF

End of the Streams or data. No more tokens.

ekTRESERVED

Keywords. Being of general purpose, the analyzer does not label any identifier as a reserved word. It must be done in phases after the analysis.


enum dbindst_t

Return values in dbind.

enum dbindst_t
{
    ekDBIND_OK,
    ekDBIND_MEMBER_EXISTS,
    ekDBIND_TYPE_EXISTS,
    ekDBIND_TYPE_USED,
    ekDBIND_ALIAS_SIZE
};
ekDBIND_OK

Successful operation.

ekDBIND_MEMBER_EXISTS

The member of a structure is already registered in DBind.

ekDBIND_TYPE_EXISTS

The data type is already registered in DBind.

ekDBIND_TYPE_USED

The data type to be deleted is in use.

ekDBIND_ALIAS_SIZE

The size of an alias type does not match that of the original type.


struct Buffer

Block of memory of general purpose, reserved dynamically. Once created, you can no longer resize. Buffers.

struct Buffer;

struct String

UTF8 character string reserved dynamically. They are "partially mutable" objects. The reserved memory can not grow, but characters can be substituted as long as the buffer's initial capacity does not overflow. Strings.

struct String;

struct ArrSt

Array of records. The type of object is indicated in parentheses. Arrays.

struct ArrSt;

struct ArrPt

Pointers array. The type of object is indicated in parentheses. Pointer arrays.

struct ArrPt;

struct SetSt

Set of records. The type of object is indicated in parentheses. Sets.

struct SetSt;

struct SetPt

Pointers set. The type of object is indicated in parentheses. Pointer sets.

struct SetPt;

struct Stream

Generic input/output channel, where it is possible to read and write formatted data. Streams.

struct Stream;

struct RegEx

Regular expresion. Regular expressions.

struct RegEx;

struct Event

Contains information regarding an event. Events.

struct Event;

struct KeyBuf

Keyboard buffer with the state of each key (pressed/released). Keyboard buffer.

struct KeyBuf;

struct Listener

Link to the generator and receiver of an event through a callback function Events.

struct Listener;

struct IListener

C++ interface for use class members as event handlers. Use of C++.

struct IListener;

struct DirEntry

Directory element, obtained by hfile_dir_list.

struct DirEntry
{
    String* name;
    file_type_t type;
    uint64_t size;
    Date date;
};
name

File or subdirectory name, without path.

type

Item type.

size

Size in bytes.

date

Date of last modification.


struct EvFileDir

Parameters of the event ekEFILE and ekEENTRY during automatic directory browsing. hfile_dir_loop.

struct EvFileDir
{
    const char_t* pathname;
    uint32_t level;
};
pathname

The partial path from the parameter pathname of hfile_dir_loop.

level

The depth of the directory from pathname.


struct ResPack

Package of resources that will be loaded together. Use ResId to access a specific resource. Resources.

struct ResPack;

struct ResId

Identifier of a resource. They are generated automatically by nrc NAppGUI Resource Compiler. Resources.

struct ResId;

struct Clock

It measures the time elapsed between two instants within the application, with micro-seconds precision. It is also useful for launching events at regular intervals of time.

struct Clock;

FPtr_remove

Releases the memory of an object's fields, but not the object itself.

void
(*FPtr_remove)(type *obj);
obj

Pointer to the object whose fields must be released.


FPtr_event_handler

Event handler. They are callback functions that will be called by the generator of an event when it happens. Events.

void
(*FPtr_event_handler)(type *obj,
                      Event *event);
obj

General data passed as the first parameter of the function.

event

The event.


FPtr_read

Create an object from data read from a Streams.

type*
(*FPtr_read)(Stream *stream);
stream

The I/O channel where the object is serialized.

Return

The created object, deserializing the stream data.


FPtr_read_init

Similar to FPtr_read where the memory of the object has already been reserved, but not initialized.

void
(*FPtr_read_init)(Stream *stream,
                  type *obj);
stream

The I/O channel where the object is serialized.

obj

The object whose fields must be deserialized.


FPtr_write

Write an object in a Streams.

void
(*FPtr_write)(Stream *stream,
              const type *obj);
stream

The I/O channel where serialize the object.

obj

The object to write.


core_start ()

Start the core library, reserving space for the global internal structures. Internally calls osbs_start.

void
core_start(void);

core_finish ()

Ends the core library, freeing the space of the global internal structures. Internally calls osbs_finish.

void
core_finish(void);
❮ Back
Next ❯