summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-07-24 18:41:30 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-07-24 18:41:30 +0000
commit458d1dc75d75af2535bc533dba21f61f0b9ae8fe (patch)
treea627455f287b8f2308b42fac80542324c39f112b /src
parent65c23f81ff08937150a9622eab358da318ec5c1e (diff)
Attempt to make 'localeconv()' part of the configuration process. VC6 works, but I'll need feedback for all other platforms... . Trying OS X in a few minutes.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4454 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Input.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx
index 93f278bbb..4bf5ee2b5 100644
--- a/src/Fl_Input.cxx
+++ b/src/Fl_Input.cxx
@@ -33,13 +33,17 @@
#include <stdio.h>
#include <stdlib.h>
-#include <locale.h>
#include <FL/Fl.H>
#include <FL/Fl_Input.H>
#include <FL/fl_draw.H>
#include <FL/fl_ask.H>
#include "flstring.h"
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+
void Fl_Input::draw() {
if (input_type() == FL_HIDDEN_INPUT) return;
Fl_Boxtype b = box();
@@ -69,8 +73,12 @@ int Fl_Input::shift_up_down_position(int p) {
// into account (for example, continental Europe uses a comma instead
// of a decimal point). For back compatibility reasons, we always
// allow the decimal point.
+#ifdef HAVE_LOCALECONV
static char *standard_fp_chars = ".eE+-";
static char *legal_fp_chars = 0L;
+#else
+static char *legal_fp_chars = ".eE+-";
+#endif
int Fl_Input::handle_key() {
@@ -86,6 +94,7 @@ int Fl_Input::handle_key() {
Fl::compose_reset(); // ignore any foreign letters...
// initialize the list of legal characters inside a floating point number
+#ifdef HAVE_LOCALECONV
if (!legal_fp_chars) {
int len = strlen(standard_fp_chars);
struct lconv *lc = localeconv();
@@ -106,6 +115,7 @@ int Fl_Input::handle_key() {
if (lc->negative_sign) strcat(legal_fp_chars, lc->negative_sign);
}
}
+#endif
// This is complex to allow "0xff12" hex to be typed:
if (!position() && (ascii == '+' || ascii == '-') ||