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, and stamina, and compliment 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
structBuffer
structString
structStream
structArrSt
structArrPt
structSetSt
structSetPt
structRegEx
structEvent
structKeyBuf
structListener
structIListener
structDirEntry
structEvFileDir
structResPack
structResId
structClock

Just as a building needs a strong foundation, any application or library must be based on robust and efficient pillars. It is useless to invest hours and hours in a nice interface if the internal engine is broken. For this purpose, the core library has been developed (Figure 1). Provides structures, utilities and algorithms commonly used in programming, which will facilitate the program development guaranteeing maximum efficiency and portability. Core is the third level within the NAppGUI SDK and still has no knowledge about the operating system graphics capabilities, so it can be used to implement any kind of project.

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

The services provided by core have been divided into several modules.

❮ Back
Next ❯

DeclSt

Given a struct, enable macros for compile-time type checking in Arrays and Binary search trees. Usage: DeclSt(Product) immediately after the struct definition. See Registers or pointers.


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.


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 Stream

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

struct Stream;

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. Arrays (pointers).

struct ArrPt;

struct SetSt

Set of records. The type of object is indicated in parentheses. Binary search trees.

struct SetSt;

struct SetPt

Pointers set. The type of object is indicated in parentheses. Binary search trees (pointers) .

struct SetPt;

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. Registers or pointers.

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

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

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

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 ❯