forked from theos/headers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move libroot.h to libroot/libroot.h, added module support
- Loading branch information
1 parent
ad25190
commit a7226d2
Showing
4 changed files
with
45 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
libroot/libroot.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <sys/syslimits.h> | ||
|
||
const char *libroot_dyn_get_root_prefix(void); | ||
const char *libroot_dyn_get_jbroot_prefix(void); | ||
const char *libroot_dyn_get_boot_uuid(void); | ||
char *libroot_dyn_rootfspath(const char *path, char *resolvedPath); | ||
char *libroot_dyn_jbrootpath(const char *path, char *resolvedPath); | ||
|
||
#ifdef __OBJC__ | ||
|
||
#define __CONVERT_PATH_NSSTRING(converter, path) ({ \ | ||
char tmpBuf[PATH_MAX]; \ | ||
[NSString stringWithUTF8String:converter(path.fileSystemRepresentation, tmpBuf)]; \ | ||
}) | ||
|
||
#define JBROOT_PATH_NSSTRING(path) __CONVERT_PATH_NSSTRING(libroot_dyn_jbrootpath, path) | ||
#define ROOTFS_PATH_NSSTRING(path) __CONVERT_PATH_NSSTRING(libroot_dyn_rootfspath, path) | ||
|
||
#endif /* __OBJC__ */ | ||
|
||
#define __CONVERT_PATH_CSTRING(converter, path) ({ \ | ||
static char outPath[PATH_MAX]; \ | ||
converter(path, outPath); \ | ||
}) | ||
|
||
#define JBROOT_PATH_CSTRING(path) __CONVERT_PATH_CSTRING(libroot_dyn_jbrootpath, path) | ||
#define ROOTFS_PATH_CSTRING(path) __CONVERT_PATH_CSTRING(libroot_dyn_rootfspath, path) | ||
|
||
#define JBRAND libroot_dyn_get_boot_uuid() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module libroot { | ||
umbrella header "libroot.h" | ||
link "root" | ||
|
||
export * | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,14 @@ | ||
// TODO: remove this file | ||
// #include <sys/syslimits.h> | ||
// #include <unistd.h> | ||
#include "libroot.h" | ||
#include <libroot/libroot.h> | ||
|
||
#ifdef XINA_SUPPORT | ||
_Pragma("message(\"'XINA_SUPPORT' is deprecated. libroot will now handle this for you.\")") | ||
#endif | ||
// #define ROOT_PATH(cPath) THEOS_PACKAGE_INSTALL_PREFIX cPath | ||
// #define ROOT_PATH_VAR(path) sizeof(THEOS_PACKAGE_INSTALL_PREFIX) > 1 ? ({ \ | ||
// char outPath[PATH_MAX]; \ | ||
// strlcpy(outPath, THEOS_PACKAGE_INSTALL_PREFIX, PATH_MAX); \ | ||
// strlcat(outPath, path, PATH_MAX); \ | ||
// outPath; \ | ||
// }) : path | ||
#define ROOT_PATH(cPath) _Pragma("message(\"'ROOT_PATH' is deprecated. Please import libroot.h and use 'JBROOT_PATH_CSTRING' instead.\")") JBROOT_PATH_CSTRING(cPath) | ||
#define ROOT_PATH_VAR(path) _Pragma("message(\"'ROOT_PATH_VAR' is deprecated. Please import libroot.h and use 'JBROOT_PATH_CSTRING' instead.\")") JBROOT_PATH_CSTRING(path) | ||
|
||
// #define ROOT_PATH_NS(path) @THEOS_PACKAGE_INSTALL_PREFIX path | ||
// #define ROOT_PATH_NS_VAR(path) [@THEOS_PACKAGE_INSTALL_PREFIX stringByAppendingPathComponent:path] | ||
#define ROOT_PATH_NS(path) _Pragma("message(\"'ROOT_PATH_NS' is deprecated. Please import libroot.h and use 'JBROOT_PATH_NSSTRING' instead.\")") JBROOT_PATH_NSSTRING(path) | ||
#define ROOT_PATH_NS_VAR(path) _Pragma("message(\"'ROOT_PATH_NS_VAR' is deprecated. Please import libroot.h and use 'JBROOT_PATH_NSSTRING' instead.\")") JBROOT_PATH_NSSTRING(path) | ||
// compatibility header | ||
// use libroot/libroot.h directly in the future | ||
|
||
#define ROOT_PATH(cPath) JBROOT_PATH_CSTRING(cPath) | ||
#define ROOT_PATH_VAR(path) JBROOT_PATH_CSTRING(path) | ||
|
||
#define ROOT_PATH_NS(path) JBROOT_PATH_NSSTRING(path) | ||
#define ROOT_PATH_NS_VAR(path) JBROOT_PATH_NSSTRING(path) |