|
|
commit ed3ec2d036675601f612bb9f45ad9e9b731699f3
Author: Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Mon Aug 30 15:42:06 2021 +0200
Commit: Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Mon Aug 30 23:43:55 2021 +0200
Add experimental FL/fl_casts.H (issue #109)
FL/Fl.H | 3 ++-
FL/fl_casts.H | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git FL/Fl.H FL/Fl.H
index ccecb3a..720899b 100644
--- FL/Fl.H
+++ FL/Fl.H
@@ -22,8 +22,9 @@
# define Fl_H
#include <FL/Fl_Export.H>
-
#include <FL/platform_types.h> // for FL_SOCKET
+#include <FL/fl_casts.H> // experimental
+
#ifdef FLTK_HAVE_CAIRO
# include <FL/Fl_Cairo.H>
#endif
diff --git FL/fl_casts.H FL/fl_casts.H
new file mode 100644
index 0000000..b4968c0
--- /dev/null
+++ FL/fl_casts.H
@@ -0,0 +1,23 @@
+// experimental inline cast functions for the Fast Light Toolkit (FLTK)
+
+#include <FL/platform_types.h>
+
+inline char fl_char(void *v) { return (char)(fl_intptr_t)v; }
+inline int fl_int(void *v) { return (int)(fl_intptr_t)v; }
+inline long fl_long(void *v) { return (long)(fl_intptr_t)v; }
+
+inline unsigned char fl_uchar(void *v) { return (unsigned char)(fl_uintptr_t)v; }
+inline unsigned int fl_uint(void *v) { return (unsigned int)(fl_uintptr_t)v; }
+inline unsigned long fl_ulong(void *v) { return (unsigned long)(fl_uintptr_t)v; }
+
+#if 0 /* not necessary */
+
+inline char fl_char(size_t v) { return (char)v; }
+inline int fl_int(size_t v) { return (int)v; }
+inline long fl_long(size_t v) { return (long)v; }
+
+inline unsigned char fl_uchar(size_t v) { return (unsigned char)v; }
+inline unsigned int fl_uint(size_t v) { return (unsigned int)v; }
+inline unsigned long fl_ulong(size_t v) { return (unsigned long)v; }
+
+#endif /* not necessary */
[ Direct Link to Message ] | |
|
| |