aboutsummaryrefslogtreecommitdiffhomepage
path: root/sciteco.h
diff options
context:
space:
mode:
Diffstat (limited to 'sciteco.h')
-rw-r--r--sciteco.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/sciteco.h b/sciteco.h
index 743edb3..37f1af4 100644
--- a/sciteco.h
+++ b/sciteco.h
@@ -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