test: Add new multiline display for c auxiliary code
This commit is contained in:
parent
b1d47de7e3
commit
055cf2d5ce
|
@ -54,13 +54,13 @@ File path: `dist/interface.h`
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Attribute doc comment, but very ##" "## "# " escaped
|
* Attribute doc comment, but very ##" "## "# " escaped
|
||||||
*/
|
*/
|
||||||
extern int trinitrix_hi (const char **trixy_output, const char *name);
|
extern int trinitrix_hi (const char **trixy_output, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Attribute doc comment
|
* Attribute doc comment
|
||||||
*/
|
*/
|
||||||
struct trinitrix
|
struct trinitrix
|
||||||
{
|
{
|
||||||
int (*hi) (const char **, const char *);
|
int (*hi) (const char **, const char *);
|
||||||
|
|
|
@ -54,13 +54,13 @@ File path: `dist/interface.h`
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Second doc comment
|
* Second doc comment
|
||||||
*/
|
*/
|
||||||
extern int trinitrix_hi (const char **trixy_output, const char *name);
|
extern int trinitrix_hi (const char **trixy_output, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
First doc comment
|
* First doc comment
|
||||||
*/
|
*/
|
||||||
struct trinitrix
|
struct trinitrix
|
||||||
{
|
{
|
||||||
int (*hi) (const char **, const char *);
|
int (*hi) (const char **, const char *);
|
||||||
|
|
|
@ -34,14 +34,10 @@ File path: `dist/interface.h`
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
an empty doc comment:
|
* an empty doc comment:
|
||||||
*/
|
*
|
||||||
/**
|
* doc comment continued.
|
||||||
|
*/
|
||||||
*/
|
|
||||||
/**
|
|
||||||
doc comment continued.
|
|
||||||
*/
|
|
||||||
struct test
|
struct test
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,14 +50,14 @@ File path: `dist/interface.h`
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call out an outstanding person
|
* Call out an outstanding person
|
||||||
*/
|
*/
|
||||||
extern int
|
extern int
|
||||||
call_me_back_outstanding (const char *(*name) (const char *name)callback);
|
call_me_back_outstanding (const char *(*name) (const char *name)callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call out a person
|
* Call out a person
|
||||||
*/
|
*/
|
||||||
extern int one_call_me_back (void (*name) (uint32_t age) callback);
|
extern int one_call_me_back (void (*name) (uint32_t age) callback);
|
||||||
|
|
||||||
struct one
|
struct one
|
||||||
|
|
|
@ -57,16 +57,16 @@ File path: `dist/interface.h`
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
I \n also \n contain \n them
|
*I \n also \n contain \n them
|
||||||
*/
|
*/
|
||||||
extern int trinitrix_hi (const char **trixy_output, const char *name);
|
extern int trinitrix_hi (const char **trixy_output, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
I
|
*I
|
||||||
contain
|
*contain
|
||||||
multiple
|
* multiple
|
||||||
lines
|
* lines
|
||||||
*/
|
*/
|
||||||
struct trinitrix
|
struct trinitrix
|
||||||
{
|
{
|
||||||
int (*hi) (const char **, const char *);
|
int (*hi) (const char **, const char *);
|
||||||
|
|
|
@ -0,0 +1,472 @@
|
||||||
|
# Host files
|
||||||
|
|
||||||
|
File path: `out/dir/api.rs`
|
||||||
|
|
||||||
|
```rust
|
||||||
|
// Host code
|
||||||
|
/* Rust API */
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Commands {
|
||||||
|
Trinitrix(trinitrix::Trinitrix),
|
||||||
|
}
|
||||||
|
pub mod trinitrix {
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Trinitrix {
|
||||||
|
Std(std::Std),
|
||||||
|
Api(api::Api),
|
||||||
|
}
|
||||||
|
/// Language specific functions, which mirror the `trinitrix.api` namespace.
|
||||||
|
/// That is, if you have to choose between a `std` and a `api` function choose the `std`
|
||||||
|
/// one as it will most likely be more high-level and easier to use (as it isn't abstracted
|
||||||
|
/// over multiple languages). Feel free to drop down to the lower level api, if you feel
|
||||||
|
/// like that more, it should be as stable and user-oriented as the `std` functions
|
||||||
|
pub mod std {
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Std {}
|
||||||
|
}
|
||||||
|
/// General API to change stuff in Trinitrix
|
||||||
|
pub mod api {
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Api {
|
||||||
|
/// Closes the application
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
exit,
|
||||||
|
/// Send a message to the current room
|
||||||
|
/// The send message is interpreted literally.
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
room_message_send { message: String },
|
||||||
|
Ui(ui::Ui),
|
||||||
|
Keymaps(keymaps::Keymaps),
|
||||||
|
Raw(raw::Raw),
|
||||||
|
}
|
||||||
|
/// Function that change the UI, or UI state
|
||||||
|
pub mod ui {
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Mode {
|
||||||
|
/// Default mode (navigation mode)
|
||||||
|
Normal,
|
||||||
|
/// Allows you to insert things
|
||||||
|
Insert,
|
||||||
|
/// actives the command line
|
||||||
|
Command,
|
||||||
|
}
|
||||||
|
impl From<crate::trinitrix_c::api_c::ui_c::Mode_c> for Mode {
|
||||||
|
fn from(value: crate::trinitrix_c::api_c::ui_c::Mode_c) -> Self {
|
||||||
|
match value {
|
||||||
|
Mode_c::Normal => Self::Normal,
|
||||||
|
Mode_c::Insert => Self::Insert,
|
||||||
|
Mode_c::Command => Self::Command,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Ui {
|
||||||
|
/// Change the active mode
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
set_mode { mode: crate::trinitrix::api::ui::Mode },
|
||||||
|
/// Go to the next plane
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
cycle_planes,
|
||||||
|
/// Go to the previous plane
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
cycle_planes_rev,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// Manipulate keymappings, the mode is specified as a String build up of all mode
|
||||||
|
/// the keymapping should be active in. The mapping works as follows:
|
||||||
|
/// n => normal Mode
|
||||||
|
/// c => command Mode
|
||||||
|
/// i => insert Mode
|
||||||
|
///
|
||||||
|
/// The key works in a similar matter, specifying the required keypresses to trigger the
|
||||||
|
/// callback. For example "aba" for require the user to press "a" then "b" then "a" again
|
||||||
|
/// to trigger the mapping. Special characters are encoded as follows:
|
||||||
|
/// "<C-a>ba" => "Ctrl+a" then "b" then "a"
|
||||||
|
/// "<S-a>" => "A" or "Shift+a"
|
||||||
|
/// "A" => "A"
|
||||||
|
/// "<M-a> " => "Alt+a" (<A-a>) or "Meta+a"(<M-a>) (most terminals can't really differentiate between these characters)
|
||||||
|
/// "a<C-b><C-a>" => "a" then "Ctrl+b" then "Ctrl+a" (also works for Shift, Alt and Super)
|
||||||
|
/// "<CSM-b>" => "Ctrl+Shift+Alt+b" (the ordering doesn't matter)
|
||||||
|
/// "a " => "a" then a literal space (" ")
|
||||||
|
/// "å🙂" => "å" then "🙂" (full Unicode support!)
|
||||||
|
/// "<ESC>" => escape key
|
||||||
|
/// "<F3>" => F3 key
|
||||||
|
/// "<BACKSPACE>" => backspace key (and so forth)
|
||||||
|
/// "<DASH>" => a literal "-"
|
||||||
|
/// "<ANGULAR_BRACKET_OPEN>" or "<ABO>" => a literal "<"
|
||||||
|
/// "<ANGULAR_BRACKET_CLOSE>" or "<ABC>" => a literal ">"
|
||||||
|
///
|
||||||
|
/// The callback MUST be registered first by calling
|
||||||
|
/// `trinitrix.api.register_function()` the returned value can than be used to
|
||||||
|
/// set the keymap.
|
||||||
|
pub mod keymaps {
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Keymaps {
|
||||||
|
/// Add a new keymapping
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
add { mode: String, key: String, callback: fn() },
|
||||||
|
/// Remove a keymapping
|
||||||
|
///
|
||||||
|
/// Does nothing, if the keymapping doesn't exists yet
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
remove { mode: String, key: String },
|
||||||
|
/// List declared keymappings
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
get { mode: String },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// Functions only used internally within Trinitrix
|
||||||
|
pub mod raw {
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Raw {
|
||||||
|
/// Send an error to the default error output
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
raise_error { error_message: String },
|
||||||
|
/// Send output to the default output
|
||||||
|
/// This is mainly used to display the final
|
||||||
|
/// output of evaluated lua commands.
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
display_output { output_message: String },
|
||||||
|
/// Input a character without checking for possible keymaps
|
||||||
|
/// If the current state does not expect input, this character is ignored
|
||||||
|
/// The encoding is the same as in the `trinitrix.api.keymaps` commands
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
send_input_unprocessed { input: String },
|
||||||
|
Private(__private::Private),
|
||||||
|
}
|
||||||
|
/// This namespace is used to store some command specific data (like functions, as
|
||||||
|
/// ensuring memory locations stay allocated in garbage collected language is hard)
|
||||||
|
///
|
||||||
|
/// Treat it as an implementation detail
|
||||||
|
pub mod __private {
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Private {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* C API */
|
||||||
|
pub mod trinitrix_c {}
|
||||||
|
pub mod std_c {}
|
||||||
|
pub mod api_c {}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_exit() -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_exit);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_room_message_send(message: String) -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_room_message_send);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
pub mod ui_c {
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Mode_c {
|
||||||
|
/// Default mode (navigation mode)
|
||||||
|
Normal,
|
||||||
|
/// Allows you to insert things
|
||||||
|
Insert,
|
||||||
|
/// actives the command line
|
||||||
|
Command,
|
||||||
|
}
|
||||||
|
impl From<crate::trinitrix::api::ui::Mode> for Mode_c {
|
||||||
|
fn from(value: crate::trinitrix::api::ui::Mode) -> Self {
|
||||||
|
match value {
|
||||||
|
Mode::Normal => Self::Normal,
|
||||||
|
Mode::Insert => Self::Insert,
|
||||||
|
Mode::Command => Self::Command,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_ui_set_mode(
|
||||||
|
mode: crate::trinitrix::api::ui::Mode,
|
||||||
|
) -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_ui_set_mode);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_ui_cycle_planes() -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_ui_cycle_planes);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_ui_cycle_planes_rev() -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_ui_cycle_planes_rev);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
pub mod keymaps_c {}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_keymaps_add(
|
||||||
|
mode: String,
|
||||||
|
key: String,
|
||||||
|
callback: fn(),
|
||||||
|
) -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_keymaps_add);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_keymaps_remove(
|
||||||
|
mode: String,
|
||||||
|
key: String,
|
||||||
|
) -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_keymaps_remove);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_keymaps_get(mode: String) -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_keymaps_get);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
pub mod raw_c {}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_raw_raise_error(
|
||||||
|
error_message: String,
|
||||||
|
) -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_raw_raise_error);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_raw_display_output(
|
||||||
|
output_message: String,
|
||||||
|
) -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_raw_display_output);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn trinitrix_api_raw_send_input_unprocessed(
|
||||||
|
input: String,
|
||||||
|
) -> core::ffi::c_int {
|
||||||
|
callback_function(trinitrix_api_raw_send_input_unprocessed);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
pub mod __private_c {}
|
||||||
|
// vim: filetype=rust
|
||||||
|
```
|
||||||
|
|
||||||
|
# Auxiliary files
|
||||||
|
|
||||||
|
File path: `dist/interface.h`
|
||||||
|
|
||||||
|
```c
|
||||||
|
#if !defined TRIXY_MAIN_HEADER
|
||||||
|
#define TRIXY_MAIN_HEADER
|
||||||
|
|
||||||
|
#include "errno.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "vec.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the application
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_exit ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a message to the current room
|
||||||
|
* The send message is interpreted literally.
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_room_message_send (const char *message);
|
||||||
|
|
||||||
|
enum Mode
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Default mode (navigation mode)
|
||||||
|
*/
|
||||||
|
Normal,
|
||||||
|
/**
|
||||||
|
* Allows you to insert things
|
||||||
|
*/
|
||||||
|
Insert,
|
||||||
|
/**
|
||||||
|
* actives the command line
|
||||||
|
*/
|
||||||
|
Command,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the active mode
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_ui_set_mode (enum Mode mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go to the next plane
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_ui_cycle_planes ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go to the previous plane
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_ui_cycle_planes_rev ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new keymapping
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_keymaps_add (const char *mode, const char *key,
|
||||||
|
void (*name) () callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a keymapping
|
||||||
|
*
|
||||||
|
* Does nothing, if the keymapping doesn't exists yet
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_keymaps_remove (const char *mode, const char *key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List declared keymappings
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_keymaps_get (const char *mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an error to the default error output
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_raw_raise_error (const char *error_message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send output to the default output
|
||||||
|
* This is mainly used to display the final
|
||||||
|
* output of evaluated lua commands.
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_raw_display_output (const char *output_message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Input a character without checking for possible keymaps
|
||||||
|
* If the current state does not expect input, this character is ignored
|
||||||
|
* The encoding is the same as in the `trinitrix.api.keymaps` commands
|
||||||
|
*/
|
||||||
|
extern int trinitrix_api_raw_send_input_unprocessed (const char *input);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Language specific functions, which mirror the `trinitrix.api` namespace.
|
||||||
|
* That is, if you have to choose between a `std` and a `api` function choose
|
||||||
|
* the `std` one as it will most likely be more high-level and easier to use
|
||||||
|
* (as it isn't abstracted over multiple languages). Feel free to drop down to
|
||||||
|
* the lower level api, if you feel like that more, it should be as stable and
|
||||||
|
* user-oriented as the `std` functions
|
||||||
|
*/
|
||||||
|
struct std
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that change the UI, or UI state
|
||||||
|
*/
|
||||||
|
struct ui
|
||||||
|
{
|
||||||
|
int (*set_mode) ();
|
||||||
|
int (*cycle_planes) (void);
|
||||||
|
int (*cycle_planes_rev) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manipulate keymappings, the mode is specified as a String build up of all
|
||||||
|
* mode the keymapping should be active in. The mapping works as follows: n =>
|
||||||
|
* normal Mode c => command Mode i => insert Mode
|
||||||
|
*
|
||||||
|
* The key works in a similar matter, specifying the required keypresses to
|
||||||
|
* trigger the callback. For example "aba" for require the user to press "a"
|
||||||
|
* then "b" then "a" again to trigger the mapping. Special characters are
|
||||||
|
* encoded as follows:
|
||||||
|
* "<C-a>ba" => "Ctrl+a" then "b" then "a"
|
||||||
|
* "<S-a>" => "A" or "Shift+a"
|
||||||
|
* "A" => "A"
|
||||||
|
* "<M-a> " => "Alt+a" (<A-a>) or "Meta+a"(<M-a>) (most terminals can't
|
||||||
|
* really differentiate between these characters) "a<C-b><C-a>" => "a" then
|
||||||
|
* "Ctrl+b" then "Ctrl+a" (also works for Shift, Alt and Super)
|
||||||
|
* "<CSM-b>" => "Ctrl+Shift+Alt+b" (the ordering doesn't matter)
|
||||||
|
* "a " => "a" then a literal space (" ")
|
||||||
|
* "å🙂" => "å" then "🙂" (full Unicode support!)
|
||||||
|
* "<ESC>" => escape key
|
||||||
|
* "<F3>" => F3 key
|
||||||
|
* "<BACKSPACE>" => backspace key (and so forth)
|
||||||
|
* "<DASH>" => a literal "-"
|
||||||
|
* "<ANGULAR_BRACKET_OPEN>" or "<ABO>" => a literal "<"
|
||||||
|
* "<ANGULAR_BRACKET_CLOSE>" or "<ABC>" => a literal ">"
|
||||||
|
*
|
||||||
|
* The callback MUST be registered first by calling
|
||||||
|
* `trinitrix.api.register_function()` the returned value can than be used to
|
||||||
|
* set the keymap.
|
||||||
|
*/
|
||||||
|
struct keymaps
|
||||||
|
{
|
||||||
|
int (*add) ();
|
||||||
|
int (*remove) ();
|
||||||
|
int (*get) ();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This namespace is used to store some command specific data (like functions,
|
||||||
|
* as ensuring memory locations stay allocated in garbage collected language is
|
||||||
|
* hard)
|
||||||
|
*
|
||||||
|
* Treat it as an implementation detail
|
||||||
|
*/
|
||||||
|
struct __private
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Functions only used internally within Trinitrix
|
||||||
|
*/
|
||||||
|
struct raw
|
||||||
|
{
|
||||||
|
int (*raise_error) ();
|
||||||
|
int (*display_output) ();
|
||||||
|
int (*send_input_unprocessed) ();
|
||||||
|
struct __private __private;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General API to change stuff in Trinitrix
|
||||||
|
*/
|
||||||
|
struct api
|
||||||
|
{
|
||||||
|
int (*exit) (void);
|
||||||
|
int (*room_message_send) ();
|
||||||
|
struct ui ui;
|
||||||
|
struct keymaps keymaps;
|
||||||
|
struct raw raw;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct trinitrix
|
||||||
|
{
|
||||||
|
struct std std;
|
||||||
|
struct api api;
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct std std = {};
|
||||||
|
const struct ui ui = {
|
||||||
|
.set_mode = trinitrix_api_ui_set_mode,
|
||||||
|
.cycle_planes = trinitrix_api_ui_cycle_planes,
|
||||||
|
.cycle_planes_rev = trinitrix_api_ui_cycle_planes_rev,
|
||||||
|
};
|
||||||
|
const struct keymaps keymaps = {
|
||||||
|
.add = trinitrix_api_keymaps_add,
|
||||||
|
.remove = trinitrix_api_keymaps_remove,
|
||||||
|
.get = trinitrix_api_keymaps_get,
|
||||||
|
};
|
||||||
|
const struct __private __private = {};
|
||||||
|
const struct raw raw = {
|
||||||
|
.raise_error = trinitrix_api_raw_raise_error,
|
||||||
|
.display_output = trinitrix_api_raw_display_output,
|
||||||
|
.send_input_unprocessed = trinitrix_api_raw_send_input_unprocessed,
|
||||||
|
.__private = __private,
|
||||||
|
};
|
||||||
|
const struct api api = {
|
||||||
|
.exit = trinitrix_api_exit,
|
||||||
|
.room_message_send = trinitrix_api_room_message_send,
|
||||||
|
.ui = ui,
|
||||||
|
.keymaps = keymaps,
|
||||||
|
.raw = raw,
|
||||||
|
};
|
||||||
|
const struct trinitrix trinitrix = {
|
||||||
|
.std = std,
|
||||||
|
.api = api,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // if !defined TRIXY_MAIN_HEADER
|
||||||
|
// vim: filetype=c
|
||||||
|
```
|
|
@ -133,40 +133,39 @@ File path: `dist/interface.h`
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Same thing as above (and a enum doc comment test)
|
* Same thing as above (and a enum doc comment test)
|
||||||
*/
|
*/
|
||||||
enum CallbackPriority
|
enum CallbackPriority
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
Callback **now**
|
* Callback **now**
|
||||||
*/
|
*/
|
||||||
High,
|
High,
|
||||||
/**
|
/**
|
||||||
Maybe do a callback
|
* Maybe do a callback
|
||||||
*/
|
*/
|
||||||
Medium,
|
Medium,
|
||||||
/**
|
/**
|
||||||
Calling back is ..
|
* Calling back is ..
|
||||||
*/
|
* really not important ..
|
||||||
/**
|
* like not even think about doing it
|
||||||
really not important ..
|
*/
|
||||||
*/
|
|
||||||
/**
|
|
||||||
like not even think about doing it
|
|
||||||
*/
|
|
||||||
Low,
|
Low,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This struct will be used later on (and this is also a struct doc comment test)
|
* This struct will be used later on (and this is also a struct doc comment
|
||||||
*/
|
* test)
|
||||||
Callback
|
*/
|
||||||
|
struct Callback
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
Very important field
|
* Very important field
|
||||||
*/ const char *(*name) (const char *name)func; /**
|
*/
|
||||||
Very important field for keeping time constant
|
const char *(*name) (const char *name)func;
|
||||||
*/
|
/**
|
||||||
|
* Very important field for keeping time constant
|
||||||
|
*/
|
||||||
uint32_t timeout;
|
uint32_t timeout;
|
||||||
};
|
};
|
||||||
extern int test_execute_callback (struct Callback callback,
|
extern int test_execute_callback (struct Callback callback,
|
||||||
|
|
|
@ -34,14 +34,10 @@ File path: `dist/interface.h`
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[...]
|
* [...]
|
||||||
*/
|
* "å🙂" => "å" then "🙂" (full Unicode support!)
|
||||||
/**
|
* [...]
|
||||||
"å🙂" => "å" then "🙂" (full Unicode support!)
|
*/
|
||||||
*/
|
|
||||||
/**
|
|
||||||
[...]
|
|
||||||
*/
|
|
||||||
struct trinitrix
|
struct trinitrix
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
Reference in New Issue