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
This commit is contained in:
parent
fc7b00dad8
commit
2ac2b506a8
@ -118,7 +118,8 @@ public:
|
||||
virtual int utf8locale();
|
||||
virtual unsigned utf8to_mb(const char* src, unsigned srclen, char* dst, unsigned dstlen);
|
||||
virtual unsigned utf8from_mb(char* dst, unsigned dstlen, const char* src, unsigned srclen);
|
||||
|
||||
// implement to shield fprintf() from locale changes in decimal point
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
};
|
||||
|
||||
#endif // FL_SYSTEM_DRIVER_H
|
||||
|
@ -367,6 +367,10 @@ unsigned Fl_System_Driver::utf8from_mb(char* dst, unsigned dstlen, const char* s
|
||||
return srclen;
|
||||
}
|
||||
|
||||
int Fl_System_Driver::clocale_printf(FILE *output, const char *format, va_list args) {
|
||||
return vfprintf(output, format, args);
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
@ -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
|
||||
|
@ -22,6 +22,12 @@
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <string.h>
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
#include <xlocale.h>
|
||||
#else
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
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$".
|
||||
//
|
||||
|
@ -63,6 +63,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_POSIX_SYSTEM_DRIVER_H
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include "Fl_Posix_System_Driver.H"
|
||||
#include <FL/Fl.H>
|
||||
#include <X11/Xlib.h>
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
#ifdef __APPLE_CC__ // allows Darwin + X11
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
extern XIC fl_xim_ic; // in Fl_x.cxx
|
||||
|
||||
@ -63,6 +68,11 @@ void Fl_Posix_System_Driver::compose_reset()
|
||||
if (fl_xim_ic) XmbResetIC(fl_xim_ic);
|
||||
}
|
||||
|
||||
int Fl_Posix_System_Driver::clocale_printf(FILE *output, const char *format, va_list args) {
|
||||
static locale_t postscript_locale = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0);
|
||||
return vfprintf_l(output, postscript_locale, format, args);
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include <stdio.h>
|
||||
#include <FL/Fl_PostScript.H>
|
||||
#include <FL/Fl_Native_File_Chooser.H>
|
||||
#include <FL/Fl_System_Driver.H>
|
||||
#include <stdarg.h>
|
||||
#include <locale.h>
|
||||
#if defined(USE_X11)
|
||||
#include <src/Fl_Font.H>
|
||||
#if USE_XFT
|
||||
@ -151,23 +151,11 @@ Fl_PostScript_File_Device::~Fl_PostScript_File_Device() {
|
||||
*/
|
||||
int Fl_PostScript_Graphics_Driver::clocale_printf(const char *format, ...)
|
||||
{
|
||||
#ifdef FL_PORTING
|
||||
# pragma message "FL_PORTING: must define LC_NUMERIC"
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int retval = vfprintf(output, format, args);
|
||||
int retval = Fl_System_Driver::driver()->clocale_printf(output, format, args);
|
||||
va_end(args);
|
||||
return retval;
|
||||
#else
|
||||
char *saved_locale = setlocale(LC_NUMERIC, NULL);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int retval = vfprintf(output, format, args);
|
||||
va_end(args);
|
||||
setlocale(LC_NUMERIC, saved_locale);
|
||||
return retval;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef FL_DOXYGEN
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
virtual int utf8locale();
|
||||
virtual unsigned utf8to_mb(const char* src, unsigned srclen, char* dst, unsigned dstlen);
|
||||
virtual unsigned utf8from_mb(char* dst, unsigned dstlen, const char* src, unsigned srclen);
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
};
|
||||
|
||||
#endif // FL_WINAPI_SYSTEM_DRIVER_H
|
||||
|
@ -22,9 +22,11 @@
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/fl_utf8.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
#include <process.h>
|
||||
#include <locale.h>
|
||||
|
||||
#if !defined(FL_DOXYGEN)
|
||||
const char* fl_local_alt = "Alt";
|
||||
@ -430,6 +432,14 @@ unsigned Fl_WinAPI_System_Driver::utf8from_mb(char* dst, unsigned dstlen, const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Fl_WinAPI_System_Driver::clocale_printf(FILE *output, const char *format, va_list args) {
|
||||
char *saved_locale = setlocale(LC_NUMERIC, NULL);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
int retval = vfprintf(output, format, args);
|
||||
setlocale(LC_NUMERIC, saved_locale);
|
||||
return retval;
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user