aboutsummaryrefslogtreecommitdiff
path: root/src/c_fl_error.cpp
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-01-21 21:04:54 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-01-21 21:04:54 +1300
commitb4438b2fbe895694be98e6e8426103deefc51448 (patch)
tree760d86cd7c06420a91dad102cc9546aee73146fc /src/c_fl_error.cpp
parenta4703a65b015140cd4a7a985db66264875ade734 (diff)
Split public API and private implementation files into different directories
Diffstat (limited to 'src/c_fl_error.cpp')
-rw-r--r--src/c_fl_error.cpp98
1 files changed, 0 insertions, 98 deletions
diff --git a/src/c_fl_error.cpp b/src/c_fl_error.cpp
deleted file mode 100644
index e38481a..0000000
--- a/src/c_fl_error.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-// Programmed by Jedidiah Barber
-// Released into the public domain
-
-
-#include <FL/Fl.H>
-#include <errno.h>
-#include <stdarg.h>
-#include <string.h>
-#include "c_fl_error.h"
-
-
-
-
-// Obtaining general error messages from errno
-
-char * get_error_message() {
- return strerror(errno);
-}
-
-
-
-
-// Exports from Ada
-
-extern "C" void error_warning_hook(const char * m);
-extern "C" void error_error_hook(const char * m);
-extern "C" void error_fatal_hook(const char * m);
-
-
-// This is the size used internally in FLTK anyway
-const int error_bsize = 1024;
-
-
-// Some prep needed to convert vargs to a single char*
-
-void warning_hook_prep(const char * m, ...) {
- va_list args;
- char buf[error_bsize];
- va_start(args, m);
- vsnprintf(buf, error_bsize, m, args);
- va_end(args);
- error_warning_hook(buf);
-}
-
-void error_hook_prep(const char * m, ...) {
- va_list args;
- char buf[error_bsize];
- va_start(args, m);
- vsnprintf(buf, error_bsize, m, args);
- va_end(args);
- error_error_hook(buf);
-}
-
-void fatal_hook_prep(const char * m, ...) {
- va_list args;
- char buf[error_bsize];
- va_start(args, m);
- vsnprintf(buf, error_bsize, m, args);
- va_end(args);
- error_fatal_hook(buf);
-}
-
-
-
-
-// Original function pointers
-
-void (*original_warning)(const char *, ...) = Fl::warning;
-void (*original_error)(const char *, ...) = Fl::error;
-void (*original_fatal)(const char *, ...) = Fl::fatal;
-
-
-void fl_error_default_warning(const char * m) {
- (*original_warning)(m);
-}
-
-void fl_error_default_error(const char * m) {
- (*original_error)(m);
-}
-
-void fl_error_default_fatal(const char * m) {
- (*original_fatal)(m);
-}
-
-
-
-
-// Tying it all together
-
-void fl_error_set_hooks() {
- Fl::warning = &warning_hook_prep;
- Fl::error = &error_hook_prep;
- Fl::fatal = &fatal_hook_prep;
-}
-
-