diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-14 05:40:16 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-14 05:40:16 +0100 |
commit | a054db598ae07479bf70c4465434938085f91e03 (patch) | |
tree | 7049e06bf365efae59ac79d3d272d100eef64dc2 /sciteco.h | |
parent | 399cc7a1ab9751fdbbeae3507e8612dbbbc99f5b (diff) | |
download | sciteco-a054db598ae07479bf70c4465434938085f91e03.tar.gz |
error checking and colon modifier support for lots of commands
Diffstat (limited to 'sciteco.h')
-rw-r--r-- | sciteco.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -26,8 +26,11 @@ sptr_t editor_msg(unsigned int iMessage, uptr_t wParam = 0, sptr_t lParam = 0); #define CTL_ECHO(C) ((C) | 0x40) #define CTL_KEY(C) ((C) & ~0x40) +typedef gint64 tecoBool; + #define SUCCESS (-1) #define FAILURE (0) +#define TECO_BOOL(X) ((X) ? SUCCESS : FAILURE) #define IS_SUCCESS(X) ((X) < 0) #define IS_FAILURE(X) (!IS_SUCCESS(X)) @@ -54,4 +57,20 @@ append(gchar *&str, gchar chr) } /* namespace String */ +namespace Validate { + +static inline bool +pos(gint n) +{ + return n >= 0 && n <= editor_msg(SCI_GETLENGTH); +} + +static inline bool +line(gint n) +{ + return n >= 0 && n < editor_msg(SCI_GETLINECOUNT); +} + +} /* namespace Validate */ + #endif |