From 2ac2b506a8ea6e0656a8bb6f81a8f0c1887256b7 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 30 Mar 2016 15:47:23 +0000 Subject: Begin to rewrite Fl_PostScript.cxx under the driver model. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11474 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Darwin/Fl_Darwin_System_Driver.H | 1 + src/drivers/Darwin/Fl_Darwin_System_Driver.cxx | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'src/drivers/Darwin') diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index bafa422d2..910270653 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -62,6 +62,7 @@ public: virtual int unlink(const char* f) {return ::unlink(f);} virtual int rmdir(const char* f) {return ::rmdir(f);} virtual int rename(const char* f, const char *n) {return ::rename(f, n);} + virtual int clocale_printf(FILE *output, const char *format, va_list args); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx index 590e23d0b..1430be536 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx @@ -22,6 +22,12 @@ #include #include #include +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +#include +#else +#include +#endif +#include int Fl_X::next_marked_length = 0; @@ -90,6 +96,22 @@ int Fl_Darwin_System_Driver::compose(int &del) { return 1; } +int Fl_Darwin_System_Driver::clocale_printf(FILE *output, const char *format, va_list args) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 + if (fl_mac_os_version >= 100400) { + static locale_t postscript_locale = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0); + return vfprintf_l(output, postscript_locale, format, args); + } +#else + char *saved_locale = setlocale(LC_NUMERIC, NULL); + setlocale(LC_NUMERIC, "C"); + int retval = vfprintf(output, format, args); + setlocale(LC_NUMERIC, saved_locale); + return retval; +#endif +} + + // // End of "$Id$". // -- cgit v1.2.3