Add Haiku support.

This commit is contained in:
Filip Szczepański 2015-09-24 22:36:29 +00:00
parent e601bd5fe8
commit 47e6eed7c9
5 changed files with 27 additions and 2 deletions

View File

@ -28,6 +28,8 @@ os := $(shell uname)
ifeq ($(os),Darwin) ifeq ($(os),Darwin)
LIBS += -lncurses -lboost_regex-mt LIBS += -lncurses -lboost_regex-mt
else ifeq ($(os),Haiku)
LIBS += -lncursesw -lboost_regex -lnetwork -lbe
else ifneq (,$(findstring CYGWIN,$(os))) else ifneq (,$(findstring CYGWIN,$(os)))
LIBS += -lncursesw -lboost_regex -ldbghelp LIBS += -lncursesw -lboost_regex -ldbghelp
else else

View File

@ -20,6 +20,12 @@
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#endif #endif
#if defined(__HAIKU__)
#include <app/Application.h>
#include <app/Roster.h>
#include <storage/Path.h>
#endif
namespace Kakoune namespace Kakoune
{ {
@ -488,6 +494,13 @@ String get_kak_binary_path()
String path = canonical_path; String path = canonical_path;
free(canonical_path); free(canonical_path);
return path; return path;
#elif defined(__HAIKU__)
BApplication app("application/x-vnd.kakoune");
app_info info;
status_t status = app.GetAppInfo(&info);
kak_assert(status == B_OK);
BPath path(&info.ref);
return path.Path();
#else #else
# error "finding executable path is not implemented on this platform" # error "finding executable path is not implemented on this platform"
#endif #endif

View File

@ -21,6 +21,8 @@
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
constexpr char control(char c) { return c & 037; }
namespace Kakoune namespace Kakoune
{ {
@ -506,12 +508,12 @@ Key NCursesUI::get_key()
if (c > 0 and c < 27) if (c > 0 and c < 27)
{ {
if (c == CTRL('l')) if (c == control('l'))
{ {
redrawwin(m_window); redrawwin(m_window);
redraw(); redraw();
} }
if (c == CTRL('z')) if (c == control('z'))
{ {
raise(SIGTSTP); raise(SIGTSTP);
return Key::Invalid; return Key::Invalid;

View File

@ -148,6 +148,13 @@ InplaceString<15> to_string(int val)
return res; return res;
} }
InplaceString<23> to_string(long int val)
{
InplaceString<23> res;
res.m_length = sprintf(res.m_data, "%li", val);
return res;
}
InplaceString<23> to_string(size_t val) InplaceString<23> to_string(size_t val)
{ {
InplaceString<23> res; InplaceString<23> res;

View File

@ -278,6 +278,7 @@ struct Hex { size_t val; };
inline Hex hex(size_t val) { return {val}; } inline Hex hex(size_t val) { return {val}; }
InplaceString<15> to_string(int val); InplaceString<15> to_string(int val);
InplaceString<23> to_string(long int val);
InplaceString<23> to_string(size_t val); InplaceString<23> to_string(size_t val);
InplaceString<23> to_string(Hex val); InplaceString<23> to_string(Hex val);
InplaceString<23> to_string(float val); InplaceString<23> to_string(float val);