summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-20 20:53:41 +0000
committermidipix <writeonce@midipix.org>2016-12-27 04:40:56 -0500
commit26e14f4143ec690a120e197a3adf547145e4ce59 (patch)
treee9e8b522de5abb14230c5f8e0825452f0c7ccb4b /include
parent70c49fc4ed3b2c3db68537f828c286241eeeee98 (diff)
downloadntux-26e14f4143ec690a120e197a3adf547145e4ce59.tar.bz2
ntux-26e14f4143ec690a120e197a3adf547145e4ce59.tar.xz
create free-standing, libpsxscl-based project skeleton.
Diffstat (limited to 'include')
-rw-r--r--include/ntux/ntux.h84
-rw-r--r--include/ntux/ntux_api.h33
2 files changed, 117 insertions, 0 deletions
diff --git a/include/ntux/ntux.h b/include/ntux/ntux.h
new file mode 100644
index 0000000..896f301
--- /dev/null
+++ b/include/ntux/ntux.h
@@ -0,0 +1,84 @@
+#ifndef NTUX_H
+#define NTUX_H
+
+#include <stdint.h>
+
+#include "ntux_api.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* pre-alpha */
+#ifndef NTUX_APP
+#ifndef NTUX_PRE_ALPHA
+#error libntux: pre-alpha: ABI is not final!
+#error to use the library, please pass -DNTUX_PRE_ALPHA to the compiler.
+#endif
+#endif
+
+/* status codes */
+#define NTUX_OK 0x00
+#define NTUX_USAGE 0x01
+#define NTUX_ERROR 0x02
+
+/* driver flags */
+#define NTUX_DRIVER_VERBOSITY_NONE 0x0000
+#define NTUX_DRIVER_VERBOSITY_ERRORS 0x0001
+#define NTUX_DRIVER_VERBOSITY_STATUS 0x0002
+#define NTUX_DRIVER_VERBOSITY_USAGE 0x0004
+#define NTUX_DRIVER_CLONE_VECTOR 0x0008
+
+#define NTUX_DRIVER_VERSION 0x0010
+#define NTUX_DRIVER_DRY_RUN 0x0020
+
+struct ntux_source_version {
+ int major;
+ int minor;
+ int revision;
+ const char * commit;
+};
+
+struct ntux_error_info {
+ const struct ntux_driver_ctx * edctx;
+ const struct ntux_unit_ctx * euctx;
+ const char * eunit;
+ int esyscode;
+ int elibcode;
+ const char * efunction;
+ int eline;
+ unsigned eflags;
+ void * eany;
+};
+
+struct ntux_common_ctx {
+ uint64_t drvflags;
+ uint64_t actflags;
+ uint64_t fmtflags;
+};
+
+struct ntux_driver_ctx {
+ const char ** units;
+ const char * program;
+ const char * module;
+ const struct ntux_common_ctx * cctx;
+ struct ntux_error_info ** errv;
+ void * any;
+};
+
+/* package info */
+ntux_api const struct ntux_source_version * ntux_source_version(void);
+
+/* driver api */
+ntux_api int ntux_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, struct ntux_driver_ctx **);
+ntux_api int ntux_create_driver_ctx (const struct ntux_common_ctx *, struct ntux_driver_ctx **);
+ntux_api void ntux_free_driver_ctx (struct ntux_driver_ctx *);
+
+/* utility api */
+ntux_api int ntux_main (int, char **, char **);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/ntux/ntux_api.h b/include/ntux/ntux_api.h
new file mode 100644
index 0000000..5a5767f
--- /dev/null
+++ b/include/ntux/ntux_api.h
@@ -0,0 +1,33 @@
+#ifndef NTUX_API_H
+#define NTUX_API_H
+
+/* ntux_export */
+#if defined(__dllexport)
+#define ntux_export __dllexport
+#else
+#define ntux_export
+#endif
+
+/* ntux_import */
+#if defined(__dllimport)
+#define ntux_import __dllimport
+#else
+#define ntux_import
+#endif
+
+/* ntux_api */
+#ifndef NTUX_APP
+#if defined (NTUX_EXPORT)
+#define ntux_api ntux_export
+#elif defined (NTUX_IMPORT)
+#define ntux_api ntux_import
+#elif defined (NTUX_STATIC)
+#define ntux_api
+#else
+#define ntux_api
+#endif
+#else
+#define ntux_api
+#endif
+
+#endif