Doc consistency.
This commit is contained in:
parent
2656225392
commit
d6962f2122
@ -1,19 +1,16 @@
|
|||||||
/*! \file console.h
|
/**
|
||||||
\brief 3ds stdio support.
|
* @file console.h
|
||||||
|
* @brief 3ds stdio support.
|
||||||
<div class="fileHeader">
|
*
|
||||||
Provides stdio integration for printing to the 3DS screen as well as debug print
|
* Provides stdio integration for printing to the 3DS screen as well as debug print
|
||||||
functionality provided by stderr.
|
* functionality provided by stderr.
|
||||||
|
*
|
||||||
General usage is to initialize the console by:
|
* General usage is to initialize the console by:
|
||||||
consoleDemoInit()
|
* consoleDemoInit()
|
||||||
or to customize the console usage by:
|
* or to customize the console usage by:
|
||||||
consoleInit()
|
* consoleInit()
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef CONSOLE_H
|
|
||||||
#define CONSOLE_H
|
|
||||||
|
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/gfx.h>
|
#include <3ds/gfx.h>
|
||||||
@ -22,73 +19,74 @@ consoleInit()
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bool(* ConsolePrint)(void* con, int c);
|
/// A callback for printing a character.
|
||||||
|
typedef bool(*ConsolePrint)(void* con, int c);
|
||||||
|
|
||||||
//! a font struct for the console.
|
/// A font struct for the console.
|
||||||
typedef struct ConsoleFont
|
typedef struct ConsoleFont
|
||||||
{
|
{
|
||||||
u8* gfx; //!< A pointer to the font graphics
|
u8* gfx; ///< A pointer to the font graphics
|
||||||
u16 asciiOffset; //!< Offset to the first valid character in the font table
|
u16 asciiOffset; ///< Offset to the first valid character in the font table
|
||||||
u16 numChars; //!< Number of characters in the font graphics
|
u16 numChars; ///< Number of characters in the font graphics
|
||||||
|
|
||||||
}ConsoleFont;
|
}ConsoleFont;
|
||||||
|
|
||||||
/** \brief console structure used to store the state of a console render context.
|
/**
|
||||||
|
* @brief console structure used to store the state of a console render context.
|
||||||
Default values from consoleGetDefault();
|
*
|
||||||
<div class="fixedFont"><pre>
|
* Default values from consoleGetDefault();
|
||||||
PrintConsole defaultConsole =
|
* <div class="fixedFont"><pre>
|
||||||
{
|
* PrintConsole defaultConsole =
|
||||||
//Font:
|
* {
|
||||||
{
|
* //Font:
|
||||||
(u8*)default_font_bin, //font gfx
|
* {
|
||||||
0, //first ascii character in the set
|
* (u8*)default_font_bin, //font gfx
|
||||||
128, //number of characters in the font set
|
* 0, //first ascii character in the set
|
||||||
},
|
* 128, //number of characters in the font set
|
||||||
0,0, //cursorX cursorY
|
* },
|
||||||
0,0, //prevcursorX prevcursorY
|
* 0,0, //cursorX cursorY
|
||||||
40, //console width
|
* 0,0, //prevcursorX prevcursorY
|
||||||
30, //console height
|
* 40, //console width
|
||||||
0, //window x
|
* 30, //console height
|
||||||
0, //window y
|
* 0, //window x
|
||||||
32, //window width
|
* 0, //window y
|
||||||
24, //window height
|
* 32, //window width
|
||||||
3, //tab size
|
* 24, //window height
|
||||||
0, //font character offset
|
* 3, //tab size
|
||||||
0, //print callback
|
* 0, //font character offset
|
||||||
false //console initialized
|
* 0, //print callback
|
||||||
};
|
* false //console initialized
|
||||||
</pre></div>
|
* };
|
||||||
*/
|
* </pre></div>
|
||||||
|
*/
|
||||||
typedef struct PrintConsole
|
typedef struct PrintConsole
|
||||||
{
|
{
|
||||||
ConsoleFont font; //!< font of the console.
|
ConsoleFont font; ///< Font of the console.
|
||||||
|
|
||||||
u16 *frameBuffer; //!< framebuffer address.
|
u16 *frameBuffer; ///< Framebuffer address.
|
||||||
|
|
||||||
int cursorX; /*!< Current X location of the cursor (as a tile offset by default) */
|
int cursorX; ///< Current X location of the cursor (as a tile offset by default)
|
||||||
int cursorY; /*!< Current Y location of the cursor (as a tile offset by default) */
|
int cursorY; ///< Current Y location of the cursor (as a tile offset by default)
|
||||||
|
|
||||||
int prevCursorX; /*!< Internal state */
|
int prevCursorX; ///< Internal state
|
||||||
int prevCursorY; /*!< Internal state */
|
int prevCursorY; ///< Internal state
|
||||||
|
|
||||||
int consoleWidth; /*!< Width of the console hardware layer in characters */
|
int consoleWidth; ///< Width of the console hardware layer in characters
|
||||||
int consoleHeight; /*!< Height of the console hardware layer in characters */
|
int consoleHeight; ///< Height of the console hardware layer in characters
|
||||||
|
|
||||||
int windowX; /*!< Window X location in characters (not implemented) */
|
int windowX; ///< Window X location in characters (not implemented)
|
||||||
int windowY; /*!< Window Y location in characters (not implemented) */
|
int windowY; ///< Window Y location in characters (not implemented)
|
||||||
int windowWidth; /*!< Window width in characters (not implemented) */
|
int windowWidth; ///< Window width in characters (not implemented)
|
||||||
int windowHeight; /*!< Window height in characters (not implemented) */
|
int windowHeight; ///< Window height in characters (not implemented)
|
||||||
|
|
||||||
int tabSize; /*!< Size of a tab*/
|
int tabSize; ///< Size of a tab
|
||||||
int fg; /*!< foreground color*/
|
int fg; ///< Foreground color
|
||||||
int bg; /*!< background color*/
|
int bg; ///< Background color
|
||||||
int flags; /*!< reverse/bright flags*/
|
int flags; ///< Reverse/bright flags
|
||||||
|
|
||||||
ConsolePrint PrintChar; /*!< callback for printing a character. Should return true if it has handled rendering the graphics
|
ConsolePrint PrintChar; ///< Callback for printing a character. Should return true if it has handled rendering the graphics (else the print engine will attempt to render via tiles).
|
||||||
(else the print engine will attempt to render via tiles) */
|
|
||||||
|
|
||||||
bool consoleInitialised; /*!< True if the console is initialized */
|
bool consoleInitialised; ///< True if the console is initialized
|
||||||
}PrintConsole;
|
}PrintConsole;
|
||||||
|
|
||||||
#define CONSOLE_COLOR_BOLD (1<<0)
|
#define CONSOLE_COLOR_BOLD (1<<0)
|
||||||
@ -101,58 +99,61 @@ typedef struct PrintConsole
|
|||||||
#define CONSOLE_CONCEAL (1<<7)
|
#define CONSOLE_CONCEAL (1<<7)
|
||||||
#define CONSOLE_CROSSED_OUT (1<<8)
|
#define CONSOLE_CROSSED_OUT (1<<8)
|
||||||
|
|
||||||
//! Console debug devices supported by libnds.
|
/// Console debug devices supported by libnds.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
debugDevice_NULL, //!< swallows prints to stderr
|
debugDevice_NULL, ///< swallows prints to stderr
|
||||||
debugDevice_3DMOO, //!< Directs stderr debug statements to 3dmoo
|
debugDevice_3DMOO, ///< Directs stderr debug statements to 3dmoo
|
||||||
debugDevice_CONSOLE, //!< Directs stderr debug statements to 3DS console window
|
debugDevice_CONSOLE, ///< Directs stderr debug statements to 3DS console window
|
||||||
} debugDevice;
|
} debugDevice;
|
||||||
|
|
||||||
/*! \brief Loads the font into the console
|
/**
|
||||||
\param console pointer to the console to update, if NULL it will update the current console
|
* @brief Loads the font into the console.
|
||||||
\param font the font to load
|
* @param console Pointer to the console to update, if NULL it will update the current console.
|
||||||
|
* @param font The font to load.
|
||||||
*/
|
*/
|
||||||
void consoleSetFont(PrintConsole* console, ConsoleFont* font);
|
void consoleSetFont(PrintConsole* console, ConsoleFont* font);
|
||||||
|
|
||||||
/*! \brief Sets the print window
|
/**
|
||||||
\param console console to set, if NULL it will set the current console window
|
* @brief Sets the print window.
|
||||||
\param x x location of the window
|
* @param console Console to set, if NULL it will set the current console window.
|
||||||
\param y y location of the window
|
* @param x X location of the window.
|
||||||
\param width width of the window
|
* @param y Y location of the window.
|
||||||
\param height height of the window
|
* @param width Width of the window.
|
||||||
|
* @param height Height of the window.
|
||||||
*/
|
*/
|
||||||
void consoleSetWindow(PrintConsole* console, int x, int y, int width, int height);
|
void consoleSetWindow(PrintConsole* console, int x, int y, int width, int height);
|
||||||
|
|
||||||
/*! \brief Gets a pointer to the console with the default values
|
/**
|
||||||
this should only be used when using a single console or without changing the console that is returned, other wise use consoleInit()
|
* @brief Gets a pointer to the console with the default values.
|
||||||
\return A pointer to the console with the default values
|
* This should only be used when using a single console or without changing the console that is returned, otherwise use consoleInit().
|
||||||
|
* @return A pointer to the console with the default values.
|
||||||
*/
|
*/
|
||||||
PrintConsole* consoleGetDefault(void);
|
PrintConsole* consoleGetDefault(void);
|
||||||
|
|
||||||
/*! \brief Make the specified console the render target
|
/**
|
||||||
\param console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)
|
* @brief Make the specified console the render target.
|
||||||
\return a pointer to the previous console
|
* @param console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)).
|
||||||
|
* @return A pointer to the previous console.
|
||||||
*/
|
*/
|
||||||
PrintConsole *consoleSelect(PrintConsole* console);
|
PrintConsole *consoleSelect(PrintConsole* console);
|
||||||
|
|
||||||
/*! \brief Initialise the console.
|
/**
|
||||||
\param screen The screen to use for the console
|
* @brief Initialise the console.
|
||||||
\param console A pointer to the console data to initialze (if it's NULL, the default console will be used)
|
* @param screen The screen to use for the console.
|
||||||
\return A pointer to the current console.
|
* @param console A pointer to the console data to initialize (if it's NULL, the default console will be used).
|
||||||
|
* @return A pointer to the current console.
|
||||||
*/
|
*/
|
||||||
PrintConsole* consoleInit(gfxScreen_t screen, PrintConsole* console);
|
PrintConsole* consoleInit(gfxScreen_t screen, PrintConsole* console);
|
||||||
|
|
||||||
/*! \brief Initializes debug console output on stderr to the specified device
|
/**
|
||||||
\param device The debug device (or devices) to output debug print statements to
|
* @brief Initializes debug console output on stderr to the specified device.
|
||||||
|
* @param device The debug device (or devices) to output debug print statements to.
|
||||||
*/
|
*/
|
||||||
void consoleDebugInit(debugDevice device);
|
void consoleDebugInit(debugDevice device);
|
||||||
|
|
||||||
|
/// Clears the screan by using iprintf("\x1b[2J");
|
||||||
//! Clears the screan by using iprintf("\x1b[2J");
|
|
||||||
void consoleClear(void);
|
void consoleClear(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#define RGB565(r,g,b) (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11))
|
#define RGB565(r,g,b) (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11))
|
||||||
#define RGB8_to_565(r,g,b) (((b)>>3)&0x1f)|((((g)>>2)&0x3f)<<5)|((((r)>>3)&0x1f)<<11)
|
#define RGB8_to_565(r,g,b) (((b)>>3)&0x1f)|((((g)>>2)&0x3f)<<5)|((((r)>>3)&0x1f)<<11)
|
||||||
|
|
||||||
//! Available screens.
|
/// Available screens.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GFX_TOP = 0, ///< Top screen
|
GFX_TOP = 0, ///< Top screen
|
||||||
|
@ -32,9 +32,7 @@ typedef enum
|
|||||||
GX_TRANSFER_SCALE_XY = 2, ///< 2x2 anti-aliasing
|
GX_TRANSFER_SCALE_XY = 2, ///< 2x2 anti-aliasing
|
||||||
} GX_TRANSFER_SCALE;
|
} GX_TRANSFER_SCALE;
|
||||||
|
|
||||||
/**
|
/// GX transfer control flags
|
||||||
* @brief GX transfer control flags
|
|
||||||
*/
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GX_FILL_TRIGGER = 0x001, ///< Trigger the PPF event
|
GX_FILL_TRIGGER = 0x001, ///< Trigger the PPF event
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
|
|
||||||
//! IPC buffer access rights.
|
/// IPC buffer access rights.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
IPC_BUFFER_R = BIT(1), ///< Readable
|
IPC_BUFFER_R = BIT(1), ///< Readable
|
||||||
|
@ -13,20 +13,20 @@
|
|||||||
#define GET_VERSION_REVISION(version) (((version)>> 8)&0xFF)
|
#define GET_VERSION_REVISION(version) (((version)>> 8)&0xFF)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an address from virtual (process) memory to physical memory.
|
* @brief Converts an address from virtual (process) memory to physical memory.
|
||||||
* It is sometimes required by services or when using the GPU command buffer.
|
* It is sometimes required by services or when using the GPU command buffer.
|
||||||
*/
|
*/
|
||||||
u32 osConvertVirtToPhys(u32 vaddr);
|
u32 osConvertVirtToPhys(u32 vaddr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts 0x14* vmem to 0x30*.
|
* @brief Converts 0x14* vmem to 0x30*.
|
||||||
* @return The input address when it's already within the new vmem.
|
* @return The input address when it's already within the new vmem.
|
||||||
* @return 0 when outside of either LINEAR mem areas.
|
* @return 0 when outside of either LINEAR mem areas.
|
||||||
*/
|
*/
|
||||||
u32 osConvertOldLINEARMemToNew(u32 addr);
|
u32 osConvertOldLINEARMemToNew(u32 addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Basic information about a service error.
|
* @brief Retreives basic information about a service error.
|
||||||
* @return A string of the summary of an error.
|
* @return A string of the summary of an error.
|
||||||
*
|
*
|
||||||
* This can be used to get some details about an error returned by a service call.
|
* This can be used to get some details about an error returned by a service call.
|
||||||
@ -34,14 +34,16 @@ u32 osConvertOldLINEARMemToNew(u32 addr);
|
|||||||
const char* osStrError(u32 error);
|
const char* osStrError(u32 error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The Firm version
|
* @brief Gets the system's FIRM version.
|
||||||
|
* @return The FIRM version.
|
||||||
*
|
*
|
||||||
* This can be used to compare system versions easily with @ref SYSTEM_VERSION.
|
* This can be used to compare system versions easily with @ref SYSTEM_VERSION.
|
||||||
*/
|
*/
|
||||||
u32 osGetFirmVersion(void);
|
u32 osGetFirmVersion(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The kernel version
|
* @brief Gets the system's kernel version.
|
||||||
|
* @return The kernel version.
|
||||||
*
|
*
|
||||||
* This can be used to compare system versions easily with @ref SYSTEM_VERSION.
|
* This can be used to compare system versions easily with @ref SYSTEM_VERSION.
|
||||||
*
|
*
|
||||||
@ -52,6 +54,7 @@ u32 osGetFirmVersion(void);
|
|||||||
u32 osGetKernelVersion(void);
|
u32 osGetKernelVersion(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @brief Gets the current time.
|
||||||
* @return The number of milliseconds since 1st Jan 1900 00:00.
|
* @return The number of milliseconds since 1st Jan 1900 00:00.
|
||||||
*/
|
*/
|
||||||
u64 osGetTime(void);
|
u64 osGetTime(void);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
|
|
||||||
//! RomFS header.
|
/// RomFS header.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u32 headerSize; ///< Size of the header.
|
u32 headerSize; ///< Size of the header.
|
||||||
@ -21,7 +21,7 @@ typedef struct
|
|||||||
u32 fileDataOff; ///< Offset of the file data.
|
u32 fileDataOff; ///< Offset of the file data.
|
||||||
} romfs_header;
|
} romfs_header;
|
||||||
|
|
||||||
//! RomFS directory.
|
/// RomFS directory.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u32 parent; ///< Offset of the parent directory.
|
u32 parent; ///< Offset of the parent directory.
|
||||||
@ -33,7 +33,7 @@ typedef struct
|
|||||||
u16 name[]; ///< Name. (UTF-16)
|
u16 name[]; ///< Name. (UTF-16)
|
||||||
} romfs_dir;
|
} romfs_dir;
|
||||||
|
|
||||||
//! RomFS file.
|
/// RomFS file.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u32 parent; ///< Offset of the parent directory.
|
u32 parent; ///< Offset of the parent directory.
|
||||||
@ -45,7 +45,7 @@ typedef struct
|
|||||||
u16 name[]; ///< Name. (UTF-16)
|
u16 name[]; ///< Name. (UTF-16)
|
||||||
} romfs_file;
|
} romfs_file;
|
||||||
|
|
||||||
//! Initializes the RomFS driver.
|
/// Initializes the RomFS driver.
|
||||||
Result romfsInit(void);
|
Result romfsInit(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,5 +55,5 @@ Result romfsInit(void);
|
|||||||
*/
|
*/
|
||||||
Result romfsInitFromFile(Handle file, u32 offset);
|
Result romfsInitFromFile(Handle file, u32 offset);
|
||||||
|
|
||||||
//! Exits the RomFS driver.
|
/// Exits the RomFS driver.
|
||||||
Result romfsExit(void);
|
Result romfsExit(void);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
|
|
||||||
//! Initializes the SDMC driver.
|
/// Initializes the SDMC driver.
|
||||||
Result sdmcInit(void);
|
Result sdmcInit(void);
|
||||||
|
|
||||||
//! Exits the SDMC driver.
|
/// Exits the SDMC driver.
|
||||||
Result sdmcExit(void);
|
Result sdmcExit(void);
|
||||||
|
@ -1,72 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* @file FS.h
|
||||||
|
* @brief Filesystem Services
|
||||||
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
|
|
||||||
/*! @file FS.h
|
/**
|
||||||
|
* @defgroup fs_open_flags FS Open Flags
|
||||||
*
|
*
|
||||||
* Filesystem Services
|
* @sa FSUSER_OpenFile
|
||||||
|
* @sa FSUSER_OpenFileDirectly
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! @defgroup fs_open_flags FS Open Flags
|
/// Open file for read.
|
||||||
*
|
|
||||||
* @sa FSUSER_OpenFile
|
|
||||||
* @sa FSUSER_OpenFileDirectly
|
|
||||||
*
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! Open file for read. */
|
|
||||||
#define FS_OPEN_READ (1<<0)
|
#define FS_OPEN_READ (1<<0)
|
||||||
/*! Open file for write. */
|
/// Open file for write.
|
||||||
#define FS_OPEN_WRITE (1<<1)
|
#define FS_OPEN_WRITE (1<<1)
|
||||||
/*! Create file if it doesn't exist. */
|
/// Create file if it doesn't exist.
|
||||||
#define FS_OPEN_CREATE (1<<2)
|
#define FS_OPEN_CREATE (1<<2)
|
||||||
/* @} */
|
/// @}
|
||||||
|
|
||||||
/*! @defgroup fs_create_attributes FS Create Attributes
|
/**
|
||||||
|
* @defgroup fs_create_attributes FS Create Attributes
|
||||||
*
|
*
|
||||||
* @sa FSUSER_OpenFile
|
* @sa FSUSER_OpenFile
|
||||||
* @sa FSUSER_OpenFileDirectly
|
* @sa FSUSER_OpenFileDirectly
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! No attributes. */
|
/// No attributes.
|
||||||
#define FS_ATTRIBUTE_NONE (0x00000000)
|
#define FS_ATTRIBUTE_NONE (0x00000000)
|
||||||
/*! Create with read-only attribute. */
|
/// Create with read-only attribute.
|
||||||
#define FS_ATTRIBUTE_READONLY (0x00000001)
|
#define FS_ATTRIBUTE_READONLY (0x00000001)
|
||||||
/*! Create with archive attribute. */
|
/// Create with archive attribute.
|
||||||
#define FS_ATTRIBUTE_ARCHIVE (0x00000100)
|
#define FS_ATTRIBUTE_ARCHIVE (0x00000100)
|
||||||
/*! Create with hidden attribute. */
|
/// Create with hidden attribute.
|
||||||
#define FS_ATTRIBUTE_HIDDEN (0x00010000)
|
#define FS_ATTRIBUTE_HIDDEN (0x00010000)
|
||||||
/*! Create with directory attribute. */
|
/// Create with directory attribute.
|
||||||
#define FS_ATTRIBUTE_DIRECTORY (0x01000000)
|
#define FS_ATTRIBUTE_DIRECTORY (0x01000000)
|
||||||
/*! @} */
|
/// @}
|
||||||
|
|
||||||
/*! @defgroup fs_write_flush_flags FS Flush Flags
|
/**
|
||||||
|
* @defgroup fs_write_flush_flags FS Flush Flags
|
||||||
*
|
*
|
||||||
* @sa FSFILE_Write
|
* @sa FSFILE_Write
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! Don't flush */
|
/// Don't flush
|
||||||
#define FS_WRITE_NOFLUSH (0x00000000)
|
#define FS_WRITE_NOFLUSH (0x00000000)
|
||||||
/*! Flush */
|
/// Flush
|
||||||
#define FS_WRITE_FLUSH (0x00010001)
|
#define FS_WRITE_FLUSH (0x00010001)
|
||||||
|
|
||||||
/* @} */
|
/// @}
|
||||||
|
|
||||||
/*! FS path type */
|
/// FS path type
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
PATH_INVALID = 0, //!< Specifies an invalid path.
|
PATH_INVALID = 0, ///< Specifies an invalid path.
|
||||||
PATH_EMPTY = 1, //!< Specifies an empty path.
|
PATH_EMPTY = 1, ///< Specifies an empty path.
|
||||||
PATH_BINARY = 2, //!< Specifies a binary path, which is non-text based.
|
PATH_BINARY = 2, ///< Specifies a binary path, which is non-text based.
|
||||||
PATH_CHAR = 3, //!< Specifies a text based path with a 8-bit byte per character.
|
PATH_CHAR = 3, ///< Specifies a text based path with a 8-bit byte per character.
|
||||||
PATH_WCHAR = 4, //!< Specifies a text based path with a 16-bit short per character.
|
PATH_WCHAR = 4, ///< Specifies a text based path with a 16-bit short per character.
|
||||||
} FS_pathType;
|
} FS_pathType;
|
||||||
|
|
||||||
/*! FS archive ids */
|
/// FS archive ids
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
ARCH_ROMFS = 0x3,
|
ARCH_ROMFS = 0x3,
|
||||||
@ -83,48 +86,48 @@ typedef enum
|
|||||||
ARCH_NAND_RO_WRITE_ACCESS = 0x1234567F,
|
ARCH_NAND_RO_WRITE_ACCESS = 0x1234567F,
|
||||||
} FS_archiveIds;
|
} FS_archiveIds;
|
||||||
|
|
||||||
/*! FS path */
|
/// FS path
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
FS_pathType type; //!< FS path type.
|
FS_pathType type; ///< FS path type.
|
||||||
u32 size; //!< FS path size.
|
u32 size; ///< FS path size.
|
||||||
const u8 *data; //!< Pointer to FS path data.
|
const u8 *data; ///< Pointer to FS path data.
|
||||||
} FS_path;
|
} FS_path;
|
||||||
|
|
||||||
/*! FS archive */
|
/// FS archive
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u32 id; //!< Archive ID.
|
u32 id; ///< Archive ID.
|
||||||
FS_path lowPath; //!< FS path.
|
FS_path lowPath; ///< FS path.
|
||||||
Handle handleLow; //!< High word of handle.
|
Handle handleLow; ///< High word of handle.
|
||||||
Handle handleHigh; //!< Low word of handle.
|
Handle handleHigh; ///< Low word of handle.
|
||||||
} FS_archive;
|
} FS_archive;
|
||||||
|
|
||||||
/*! Directory entry */
|
/// Directory entry
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// 0x00
|
// 0x00
|
||||||
u16 name[0x106]; //!< UTF-16 encoded name
|
u16 name[0x106]; ///< UTF-16 encoded name
|
||||||
// 0x20C
|
// 0x20C
|
||||||
u8 shortName[0x09]; //!< 8.3 file name
|
u8 shortName[0x09]; ///< 8.3 file name
|
||||||
// 0x215
|
// 0x215
|
||||||
u8 unknown1; //!< ???
|
u8 unknown1; ///< ???
|
||||||
// 0x216
|
// 0x216
|
||||||
u8 shortExt[0x04]; //!< 8.3 file extension (set to spaces for directories)
|
u8 shortExt[0x04]; ///< 8.3 file extension (set to spaces for directories)
|
||||||
// 0x21A
|
// 0x21A
|
||||||
u8 unknown2; //!< ???
|
u8 unknown2; ///< ???
|
||||||
// 0x21B
|
// 0x21B
|
||||||
u8 unknown3; //!< ???
|
u8 unknown3; ///< ???
|
||||||
// 0x21C
|
// 0x21C
|
||||||
u8 isDirectory; //!< directory bit
|
u8 isDirectory; ///< directory bit
|
||||||
// 0x21D
|
// 0x21D
|
||||||
u8 isHidden; //!< hidden bit
|
u8 isHidden; ///< hidden bit
|
||||||
// 0x21E
|
// 0x21E
|
||||||
u8 isArchive; //!< archive bit
|
u8 isArchive; ///< archive bit
|
||||||
// 0x21F
|
// 0x21F
|
||||||
u8 isReadOnly; //!< read-only bit
|
u8 isReadOnly; ///< read-only bit
|
||||||
// 0x220
|
// 0x220
|
||||||
u64 fileSize; //!< file size
|
u64 fileSize; ///< file size
|
||||||
} FS_dirent;
|
} FS_dirent;
|
||||||
|
|
||||||
Result fsInit(void);
|
Result fsInit(void);
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//! Initializes the service API.
|
/// Initializes the service API.
|
||||||
Result srvInit(void);
|
Result srvInit(void);
|
||||||
|
|
||||||
//! Exits the service API.
|
/// Exits the service API.
|
||||||
Result srvExit(void);
|
Result srvExit(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,7 +16,7 @@ Result srvExit(void);
|
|||||||
*/
|
*/
|
||||||
Handle *srvGetSessionHandle(void);
|
Handle *srvGetSessionHandle(void);
|
||||||
|
|
||||||
//! Registers the current process as a client to the service API.
|
/// Registers the current process as a client to the service API.
|
||||||
Result srvRegisterClient(void);
|
Result srvRegisterClient(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +47,7 @@ Result srvRegisterService(Handle* out, const char* name, int maxSessions);
|
|||||||
*/
|
*/
|
||||||
Result srvUnregisterService(const char* name);
|
Result srvUnregisterService(const char* name);
|
||||||
|
|
||||||
//! Initializes the srv:pm port.
|
/// Initializes the srv:pm port.
|
||||||
Result srvPmInit(void);
|
Result srvPmInit(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ typedef enum {
|
|||||||
MEMOP_ALLOC_LINEAR = MEMOP_LINEAR_FLAG | MEMOP_ALLOC, ///< Allocates linear memory.
|
MEMOP_ALLOC_LINEAR = MEMOP_LINEAR_FLAG | MEMOP_ALLOC, ///< Allocates linear memory.
|
||||||
} MemOp;
|
} MemOp;
|
||||||
|
|
||||||
//! The state of a memory block.
|
/// The state of a memory block.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MEMSTATE_FREE = 0, ///< Free memory
|
MEMSTATE_FREE = 0, ///< Free memory
|
||||||
MEMSTATE_RESERVED = 1, ///< Reserved memory
|
MEMSTATE_RESERVED = 1, ///< Reserved memory
|
||||||
@ -53,7 +53,7 @@ typedef enum {
|
|||||||
MEMSTATE_LOCKED = 11 ///< Locked memory
|
MEMSTATE_LOCKED = 11 ///< Locked memory
|
||||||
} MemState;
|
} MemState;
|
||||||
|
|
||||||
//! Memory permission flags
|
/// Memory permission flags
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MEMPERM_READ = 1, ///< Readable
|
MEMPERM_READ = 1, ///< Readable
|
||||||
MEMPERM_WRITE = 2, ///< Writable
|
MEMPERM_WRITE = 2, ///< Writable
|
||||||
@ -61,7 +61,7 @@ typedef enum {
|
|||||||
MEMPERM_DONTCARE = 0x10000000 ///< Don't care
|
MEMPERM_DONTCARE = 0x10000000 ///< Don't care
|
||||||
} MemPerm;
|
} MemPerm;
|
||||||
|
|
||||||
//! Memory information.
|
/// Memory information.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 base_addr; ///< Base address.
|
u32 base_addr; ///< Base address.
|
||||||
u32 size; ///< Size.
|
u32 size; ///< Size.
|
||||||
@ -69,12 +69,12 @@ typedef struct {
|
|||||||
u32 state; ///< Memory state. See @ref MemState
|
u32 state; ///< Memory state. See @ref MemState
|
||||||
} MemInfo;
|
} MemInfo;
|
||||||
|
|
||||||
//! Memory page information.
|
/// Memory page information.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 flags; ///< Page flags.
|
u32 flags; ///< Page flags.
|
||||||
} PageInfo;
|
} PageInfo;
|
||||||
|
|
||||||
//! Arbitration modes.
|
/// Arbitration modes.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ARBITRATION_SIGNAL = 0, ///< Signal #value threads for wake-up.
|
ARBITRATION_SIGNAL = 0, ///< Signal #value threads for wake-up.
|
||||||
ARBITRATION_WAIT_IF_LESS_THAN = 1, ///< If the memory at the address is strictly lower than #value, then wait for signal.
|
ARBITRATION_WAIT_IF_LESS_THAN = 1, ///< If the memory at the address is strictly lower than #value, then wait for signal.
|
||||||
@ -91,7 +91,7 @@ typedef enum {
|
|||||||
///@name Multithreading
|
///@name Multithreading
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
//! Types of thread info.
|
/// Types of thread info.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
THREADINFO_TYPE_UNKNOWN ///< Unknown.
|
THREADINFO_TYPE_UNKNOWN ///< Unknown.
|
||||||
} ThreadInfoType;
|
} ThreadInfoType;
|
||||||
@ -105,13 +105,13 @@ typedef enum {
|
|||||||
///@name Debugging
|
///@name Debugging
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
//! Reasons for a process event.
|
/// Reasons for a process event.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
REASON_CREATE = 1, ///< Process created.
|
REASON_CREATE = 1, ///< Process created.
|
||||||
REASON_ATTACH = 2 ///< Process attached.
|
REASON_ATTACH = 2 ///< Process attached.
|
||||||
} ProcessEventReason;
|
} ProcessEventReason;
|
||||||
|
|
||||||
//! Event relating to a process.
|
/// Event relating to a process.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 program_id; ///< ID of the program.
|
u64 program_id; ///< ID of the program.
|
||||||
u8 process_name[8]; ///< Name of the process.
|
u8 process_name[8]; ///< Name of the process.
|
||||||
@ -119,26 +119,26 @@ typedef struct {
|
|||||||
u32 reason; ///< Reason for the event. See @ref ProcessEventReason
|
u32 reason; ///< Reason for the event. See @ref ProcessEventReason
|
||||||
} ProcessEvent;
|
} ProcessEvent;
|
||||||
|
|
||||||
//! Reasons for an exit process event.
|
/// Reasons for an exit process event.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EXITPROCESS_EVENT_NONE = 0, ///< No reason.
|
EXITPROCESS_EVENT_NONE = 0, ///< No reason.
|
||||||
EXITPROCESS_EVENT_TERMINATE = 1, ///< Process terminated.
|
EXITPROCESS_EVENT_TERMINATE = 1, ///< Process terminated.
|
||||||
EXITPROCESS_EVENT_UNHANDLED_EXCEPTION = 2 ///< Unhandled exception occurred.
|
EXITPROCESS_EVENT_UNHANDLED_EXCEPTION = 2 ///< Unhandled exception occurred.
|
||||||
} ExitProcessEventReason;
|
} ExitProcessEventReason;
|
||||||
|
|
||||||
//! Event relating to the exiting of a process.
|
/// Event relating to the exiting of a process.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 reason; ///< Reason for exiting. See @ref ExitProcessEventReason
|
u32 reason; ///< Reason for exiting. See @ref ExitProcessEventReason
|
||||||
} ExitProcessEvent;
|
} ExitProcessEvent;
|
||||||
|
|
||||||
//! Event relating to the creation of a thread.
|
/// Event relating to the creation of a thread.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 creator_thread_id; ///< ID of the creating thread.
|
u32 creator_thread_id; ///< ID of the creating thread.
|
||||||
u32 base_addr; ///< Base address.
|
u32 base_addr; ///< Base address.
|
||||||
u32 entry_point; ///< Entry point of the thread.
|
u32 entry_point; ///< Entry point of the thread.
|
||||||
} CreateThreadEvent;
|
} CreateThreadEvent;
|
||||||
|
|
||||||
//! Reasons for an exit thread event.
|
/// Reasons for an exit thread event.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EXITTHREAD_EVENT_NONE = 0, ///< No reason.
|
EXITTHREAD_EVENT_NONE = 0, ///< No reason.
|
||||||
EXITTHREAD_EVENT_TERMINATE = 1, ///< Thread terminated.
|
EXITTHREAD_EVENT_TERMINATE = 1, ///< Thread terminated.
|
||||||
@ -146,19 +146,19 @@ typedef enum {
|
|||||||
EXITTHREAD_EVENT_TERMINATE_PROCESS = 3 ///< Process terminated.
|
EXITTHREAD_EVENT_TERMINATE_PROCESS = 3 ///< Process terminated.
|
||||||
} ExitThreadEventReason;
|
} ExitThreadEventReason;
|
||||||
|
|
||||||
//! Event relating to the exiting of a thread.
|
/// Event relating to the exiting of a thread.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 reason; ///< Reason for exiting. See @ref ExitThreadEventReason
|
u32 reason; ///< Reason for exiting. See @ref ExitThreadEventReason
|
||||||
} ExitThreadEvent;
|
} ExitThreadEvent;
|
||||||
|
|
||||||
//! Reasons for a user break.
|
/// Reasons for a user break.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
USERBREAK_PANIC = 0, ///< Panic.
|
USERBREAK_PANIC = 0, ///< Panic.
|
||||||
USERBREAK_ASSERT = 1, ///< Assertion failed.
|
USERBREAK_ASSERT = 1, ///< Assertion failed.
|
||||||
USERBREAK_USER = 2 ///< User related.
|
USERBREAK_USER = 2 ///< User related.
|
||||||
} UserBreakType;
|
} UserBreakType;
|
||||||
|
|
||||||
//! Reasons for an exception event.
|
/// Reasons for an exception event.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EXC_EVENT_UNDEFINED_INSTRUCTION = 0, ///< Undefined instruction. arg: (None)
|
EXC_EVENT_UNDEFINED_INSTRUCTION = 0, ///< Undefined instruction. arg: (None)
|
||||||
EXC_EVENT_UNKNOWN1 = 1, ///< Unknown. arg: (None)
|
EXC_EVENT_UNKNOWN1 = 1, ///< Unknown. arg: (None)
|
||||||
@ -171,31 +171,31 @@ typedef enum {
|
|||||||
EXC_EVENT_UNDEFINED_SYSCALL = 8 ///< Undefined syscall. arg: attempted syscall
|
EXC_EVENT_UNDEFINED_SYSCALL = 8 ///< Undefined syscall. arg: attempted syscall
|
||||||
} ExceptionEventType;
|
} ExceptionEventType;
|
||||||
|
|
||||||
//! Event relating to exceptions.
|
/// Event relating to exceptions.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 type; ///< Type of event. See @ref ExceptionEventType
|
u32 type; ///< Type of event. See @ref ExceptionEventType
|
||||||
u32 address; ///< Address of the exception.
|
u32 address; ///< Address of the exception.
|
||||||
u32 argument; ///< Event argument. See @ref ExceptionEventType
|
u32 argument; ///< Event argument. See @ref ExceptionEventType
|
||||||
} ExceptionEvent;
|
} ExceptionEvent;
|
||||||
|
|
||||||
//! Event relating to the scheduler.
|
/// Event relating to the scheduler.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 clock_tick; ///< Clock tick that the event occurred.
|
u64 clock_tick; ///< Clock tick that the event occurred.
|
||||||
} SchedulerInOutEvent;
|
} SchedulerInOutEvent;
|
||||||
|
|
||||||
//! Event relating to syscalls.
|
/// Event relating to syscalls.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 clock_tick; ///< Clock tick that the event occurred.
|
u64 clock_tick; ///< Clock tick that the event occurred.
|
||||||
u32 syscall; ///< Syscall sent/received.
|
u32 syscall; ///< Syscall sent/received.
|
||||||
} SyscallInOutEvent;
|
} SyscallInOutEvent;
|
||||||
|
|
||||||
//! Event relating to debug output.
|
/// Event relating to debug output.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 string_addr; ///< Address of the outputted string.
|
u32 string_addr; ///< Address of the outputted string.
|
||||||
u32 string_size; ///< Size of the outputted string.
|
u32 string_size; ///< Size of the outputted string.
|
||||||
} OutputStringEvent;
|
} OutputStringEvent;
|
||||||
|
|
||||||
//! Event relating to the mapping of memory.
|
/// Event relating to the mapping of memory.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 mapped_addr; ///< Mapped address.
|
u32 mapped_addr; ///< Mapped address.
|
||||||
u32 mapped_size; ///< Mapped size.
|
u32 mapped_size; ///< Mapped size.
|
||||||
@ -203,7 +203,7 @@ typedef struct {
|
|||||||
u32 memstate; ///< Memory state. See @ref MemState
|
u32 memstate; ///< Memory state. See @ref MemState
|
||||||
} MapEvent;
|
} MapEvent;
|
||||||
|
|
||||||
//! Debug event type.
|
/// Debug event type.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DBG_EVENT_PROCESS = 0, ///< Process event.
|
DBG_EVENT_PROCESS = 0, ///< Process event.
|
||||||
DBG_EVENT_CREATE_THREAD = 1, ///< Thread creation event.
|
DBG_EVENT_CREATE_THREAD = 1, ///< Thread creation event.
|
||||||
@ -220,7 +220,7 @@ typedef enum {
|
|||||||
DBG_EVENT_MAP = 12 ///< Map event.
|
DBG_EVENT_MAP = 12 ///< Map event.
|
||||||
} DebugEventType;
|
} DebugEventType;
|
||||||
|
|
||||||
//! Information about a debug event.
|
/// Information about a debug event.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 type; ///< Type of event. See @ref DebugEventType
|
u32 type; ///< Type of event. See @ref DebugEventType
|
||||||
u32 thread_id; ///< ID of the thread.
|
u32 thread_id; ///< ID of the thread.
|
||||||
@ -441,7 +441,7 @@ Result svcWriteProcessMemory(Handle debug, const void* buffer, u32 addr, u32 siz
|
|||||||
*/
|
*/
|
||||||
Result svcOpenProcess(Handle* process, u32 processId);
|
Result svcOpenProcess(Handle* process, u32 processId);
|
||||||
|
|
||||||
//! Exits the current process.
|
/// Exits the current process.
|
||||||
void svcExitProcess() __attribute__((noreturn));
|
void svcExitProcess() __attribute__((noreturn));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -535,7 +535,7 @@ void svcExitThread(void) __attribute__((noreturn));
|
|||||||
*/
|
*/
|
||||||
void svcSleepThread(s64 ns);
|
void svcSleepThread(s64 ns);
|
||||||
|
|
||||||
//! Retrieves the priority of a thread.
|
/// Retrieves the priority of a thread.
|
||||||
Result svcGetThreadPriority(s32 *out, Handle handle);
|
Result svcGetThreadPriority(s32 *out, Handle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//! A light lock.
|
/// A light lock.
|
||||||
typedef s32 LightLock;
|
typedef s32 LightLock;
|
||||||
|
|
||||||
//! A recursive lock.
|
/// A recursive lock.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
LightLock lock; ///< Inner light lock.
|
LightLock lock; ///< Inner light lock.
|
||||||
@ -15,7 +15,7 @@ typedef struct
|
|||||||
u32 counter; ///< Lock count.
|
u32 counter; ///< Lock count.
|
||||||
} RecursiveLock;
|
} RecursiveLock;
|
||||||
|
|
||||||
//! Performs a clrex operation.
|
/// Performs a clrex operation.
|
||||||
static inline void __clrex(void)
|
static inline void __clrex(void)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__("clrex");
|
__asm__ __volatile__("clrex");
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
//! The maximum value of a u64.
|
/// The maximum value of a u64.
|
||||||
#define U64_MAX UINT64_MAX
|
#define U64_MAX UINT64_MAX
|
||||||
|
|
||||||
//! Possible media types.
|
/// Possible media types.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
mediatype_NAND, ///< NAND
|
mediatype_NAND, ///< NAND
|
||||||
@ -43,15 +43,15 @@ typedef u32 Handle; ///< Resource handle.
|
|||||||
typedef s32 Result; ///< Function result.
|
typedef s32 Result; ///< Function result.
|
||||||
typedef void (*ThreadFunc)(void *); ///< Thread entrypoint function.
|
typedef void (*ThreadFunc)(void *); ///< Thread entrypoint function.
|
||||||
|
|
||||||
//! Creates a bitmask from a bit number.
|
/// Creates a bitmask from a bit number.
|
||||||
#define BIT(n) (1U<<(n))
|
#define BIT(n) (1U<<(n))
|
||||||
|
|
||||||
//! aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m.
|
/// aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m.
|
||||||
#define ALIGN(m) __attribute__((aligned(m)))
|
#define ALIGN(m) __attribute__((aligned(m)))
|
||||||
//! packs a struct (and other types?) so it won't include padding bytes.
|
/// packs a struct (and other types?) so it won't include padding bytes.
|
||||||
#define PACKED __attribute__((packed))
|
#define PACKED __attribute__((packed))
|
||||||
|
|
||||||
//! flags a function as deprecated.
|
/// flags a function as deprecated.
|
||||||
#ifndef LIBCTRU_NO_DEPRECATION
|
#ifndef LIBCTRU_NO_DEPRECATION
|
||||||
#define DEPRECATED __attribute__ ((deprecated))
|
#define DEPRECATED __attribute__ ((deprecated))
|
||||||
#else
|
#else
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
//! brief Retreives an rbtree item.
|
/// brief Retreives an rbtree item.
|
||||||
#define rbtree_item(ptr, type, member) \
|
#define rbtree_item(ptr, type, member) \
|
||||||
((type*)(((char*)ptr) - offsetof(type, member)))
|
((type*)(((char*)ptr) - offsetof(type, member)))
|
||||||
|
|
||||||
@ -18,14 +18,14 @@ typedef void (*rbtree_node_destructor_t)(rbtree_node_t *Node); ///< rbtree
|
|||||||
typedef int (*rbtree_node_comparator_t)(const rbtree_node_t *lhs,
|
typedef int (*rbtree_node_comparator_t)(const rbtree_node_t *lhs,
|
||||||
const rbtree_node_t *rhs); ///< rbtree node comparator.
|
const rbtree_node_t *rhs); ///< rbtree node comparator.
|
||||||
|
|
||||||
//! An rbtree node.
|
/// An rbtree node.
|
||||||
struct rbtree_node
|
struct rbtree_node
|
||||||
{
|
{
|
||||||
uintptr_t parent_color; ///< Parent color.
|
uintptr_t parent_color; ///< Parent color.
|
||||||
rbtree_node_t *child[2]; ///< Node children.
|
rbtree_node_t *child[2]; ///< Node children.
|
||||||
};
|
};
|
||||||
|
|
||||||
//! An rbtree.
|
/// An rbtree.
|
||||||
struct rbtree
|
struct rbtree
|
||||||
{
|
{
|
||||||
rbtree_node_t *root; ///< Root node.
|
rbtree_node_t *root; ///< Root node.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
/*! Convert a UTF-8 sequence into a UTF-32 codepoint
|
/** Convert a UTF-8 sequence into a UTF-32 codepoint
|
||||||
*
|
*
|
||||||
* @param[out] out Output codepoint
|
* @param[out] out Output codepoint
|
||||||
* @param[in] in Input sequence
|
* @param[in] in Input sequence
|
||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
ssize_t decode_utf8 (uint32_t *out, const uint8_t *in);
|
ssize_t decode_utf8 (uint32_t *out, const uint8_t *in);
|
||||||
|
|
||||||
/*! Convert a UTF-16 sequence into a UTF-32 codepoint
|
/** Convert a UTF-16 sequence into a UTF-32 codepoint
|
||||||
*
|
*
|
||||||
* @param[out] out Output codepoint
|
* @param[out] out Output codepoint
|
||||||
* @param[in] in Input sequence
|
* @param[in] in Input sequence
|
||||||
@ -27,7 +27,7 @@ ssize_t decode_utf8 (uint32_t *out, const uint8_t *in);
|
|||||||
*/
|
*/
|
||||||
ssize_t decode_utf16(uint32_t *out, const uint16_t *in);
|
ssize_t decode_utf16(uint32_t *out, const uint16_t *in);
|
||||||
|
|
||||||
/*! Convert a UTF-32 codepoint into a UTF-8 sequence
|
/** Convert a UTF-32 codepoint into a UTF-8 sequence
|
||||||
*
|
*
|
||||||
* @param[out] out Output sequence
|
* @param[out] out Output sequence
|
||||||
* @param[in] in Input codepoint
|
* @param[in] in Input codepoint
|
||||||
@ -39,7 +39,7 @@ ssize_t decode_utf16(uint32_t *out, const uint16_t *in);
|
|||||||
*/
|
*/
|
||||||
ssize_t encode_utf8 (uint8_t *out, uint32_t in);
|
ssize_t encode_utf8 (uint8_t *out, uint32_t in);
|
||||||
|
|
||||||
/*! Convert a UTF-32 codepoint into a UTF-16 sequence
|
/** Convert a UTF-32 codepoint into a UTF-16 sequence
|
||||||
*
|
*
|
||||||
* @param[out] out Output sequence
|
* @param[out] out Output sequence
|
||||||
* @param[in] in Input codepoint
|
* @param[in] in Input codepoint
|
||||||
@ -51,7 +51,7 @@ ssize_t encode_utf8 (uint8_t *out, uint32_t in);
|
|||||||
*/
|
*/
|
||||||
ssize_t encode_utf16(uint16_t *out, uint32_t in);
|
ssize_t encode_utf16(uint16_t *out, uint32_t in);
|
||||||
|
|
||||||
/*! Convert a UTF-8 sequence into a UTF-16 sequence
|
/** Convert a UTF-8 sequence into a UTF-16 sequence
|
||||||
*
|
*
|
||||||
* @param[out] out Output sequence
|
* @param[out] out Output sequence
|
||||||
* @param[in] in Input sequence
|
* @param[in] in Input sequence
|
||||||
@ -61,7 +61,7 @@ ssize_t encode_utf16(uint16_t *out, uint32_t in);
|
|||||||
*/
|
*/
|
||||||
size_t utf8_to_utf16(uint16_t *out, const uint8_t *in, size_t len);
|
size_t utf8_to_utf16(uint16_t *out, const uint8_t *in, size_t len);
|
||||||
|
|
||||||
/*! Convert a UTF-8 sequence into a UTF-32 sequence
|
/** Convert a UTF-8 sequence into a UTF-32 sequence
|
||||||
*
|
*
|
||||||
* @param[out] out Output sequence
|
* @param[out] out Output sequence
|
||||||
* @param[in] in Input sequence
|
* @param[in] in Input sequence
|
||||||
@ -71,7 +71,7 @@ size_t utf8_to_utf16(uint16_t *out, const uint8_t *in, size_t len);
|
|||||||
*/
|
*/
|
||||||
size_t utf8_to_utf32(uint32_t *out, const uint8_t *in, size_t len);
|
size_t utf8_to_utf32(uint32_t *out, const uint8_t *in, size_t len);
|
||||||
|
|
||||||
/*! Convert a UTF-16 sequence into a UTF-8 sequence
|
/** Convert a UTF-16 sequence into a UTF-8 sequence
|
||||||
*
|
*
|
||||||
* @param[out] out Output sequence
|
* @param[out] out Output sequence
|
||||||
* @param[in] in Input sequence
|
* @param[in] in Input sequence
|
||||||
@ -81,7 +81,7 @@ size_t utf8_to_utf32(uint32_t *out, const uint8_t *in, size_t len);
|
|||||||
*/
|
*/
|
||||||
size_t utf16_to_utf8(uint8_t *out, const uint16_t *in, size_t len);
|
size_t utf16_to_utf8(uint8_t *out, const uint16_t *in, size_t len);
|
||||||
|
|
||||||
/*! Convert a UTF-16 sequence into a UTF-32 sequence
|
/** Convert a UTF-16 sequence into a UTF-32 sequence
|
||||||
*
|
*
|
||||||
* @param[out] out Output sequence
|
* @param[out] out Output sequence
|
||||||
* @param[in] in Input sequence
|
* @param[in] in Input sequence
|
||||||
@ -91,7 +91,7 @@ size_t utf16_to_utf8(uint8_t *out, const uint16_t *in, size_t len);
|
|||||||
*/
|
*/
|
||||||
size_t utf16_to_utf32(uint32_t *out, const uint16_t *in, size_t len);
|
size_t utf16_to_utf32(uint32_t *out, const uint16_t *in, size_t len);
|
||||||
|
|
||||||
/*! Convert a UTF-32 sequence into a UTF-8 sequence
|
/** Convert a UTF-32 sequence into a UTF-8 sequence
|
||||||
*
|
*
|
||||||
* @param[out] out Output sequence
|
* @param[out] out Output sequence
|
||||||
* @param[in] in Input sequence
|
* @param[in] in Input sequence
|
||||||
@ -101,7 +101,7 @@ size_t utf16_to_utf32(uint32_t *out, const uint16_t *in, size_t len);
|
|||||||
*/
|
*/
|
||||||
size_t utf32_to_utf8(uint8_t *out, const uint32_t *in, size_t len);
|
size_t utf32_to_utf8(uint8_t *out, const uint32_t *in, size_t len);
|
||||||
|
|
||||||
/*! Convert a UTF-32 sequence into a UTF-16 sequence
|
/** Convert a UTF-32 sequence into a UTF-16 sequence
|
||||||
*
|
*
|
||||||
* @param[out] out Output sequence
|
* @param[out] out Output sequence
|
||||||
* @param[in] in Input sequence
|
* @param[in] in Input sequence
|
||||||
|
Loading…
Reference in New Issue
Block a user