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
This commit is contained in:
Matthias Melcher 2005-07-24 18:41:30 +00:00
parent 65c23f81ff
commit 458d1dc75d
11 changed files with 72 additions and 1 deletions

View File

@ -85,6 +85,7 @@ CHECK_INCLUDE_FILE_CONCAT("OpenGL/glu.h" HAVE_OPENGL_GLU_H)
CHECK_INCLUDE_FILE_CONCAT("dirent.h" HAVE_DIRENT_H)
CHECK_INCLUDE_FILE_CONCAT("stdio.h" HAVE_STDIO_H)
CHECK_INCLUDE_FILE_CONCAT("strings.h" HAVE_STRINGS_H)
CHECK_INCLUDE_FILE_CONCAT("locale.h" HAVE_LOCALE_H)
CHECK_INCLUDE_FILE_CONCAT("sys/dir.h" HAVE_SYS_DIR_H)
CHECK_INCLUDE_FILE_CONCAT("sys/ndir.h" HAVE_SYS_NDIR_H)
CHECK_INCLUDE_FILE_CONCAT("sys/select.h" HAVE_SYS_SELECT_H)
@ -105,6 +106,7 @@ CHECK_SYMBOL_EXISTS(strlcpy "${PROJECT_INCLUDES}" HAVE_STRLCPY)
CHECK_SYMBOL_EXISTS(vsnprintf "${PROJECT_INCLUDES}" HAVE_VSNPRINTF)
CHECK_SYMBOL_EXISTS(snprintf "${PROJECT_INCLUDES}" HAVE_SNPRINTF)
CHECK_SYMBOL_EXISTS(scandir "${PROJECT_INCLUDES}" HAVE_SCANDIR)
CHECK_SYMBOL_EXISTS(localeconv "${PROJECT_INCLUDES}" HAVE_LOCALECONV)
INCLUDE(CheckTypeSize)

View File

@ -162,6 +162,13 @@
/* #undef HAVE_STRLCAT */
/* #undef HAVE_STRLCPY */
/*
* Do we have POSIX locale support?
*/
#define HAVE_LOCALE_H 1
#define HAVE_LOCALECONV 1
/*
* HAVE_SYS_SELECT_H:
*

View File

@ -189,6 +189,13 @@
#cmakedefine HAVE_STRLCAT @HAVE_STRLCAT@
#cmakedefine HAVE_STRLCPY @HAVE_STRLCPY@
/*
* 'locale' functions
*/
#cmakedefine HAVE_LOCALE_H @HAVE_LOCALE_H@
#cmakedefine HAVE_LOCALECONV @HAVE_LOCALECONV@
/*
* HAVE_SYS_SELECT_H:
*

View File

@ -189,6 +189,13 @@
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
/*
* Do we have POSIX locale support?
*/
#undef HAVE_LOCALE_H
#undef HAVE_LOCALECONV
/*
* HAVE_SYS_SELECT_H:
*

View File

@ -369,6 +369,9 @@ AC_CHECK_FUNC(snprintf,[
AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
AC_CHECK_FUNCS(localeconv)
dnl FLTK library uses math library functions...
AC_SEARCH_LIBS(pow, m)

View File

@ -168,6 +168,13 @@
/* #undef HAVE_STRLCAT */
/* #undef HAVE_STRLCPY */
/*
* Do we have POSIX locale support?
*/
#define HAVE_LOCALE_H 1
#define HAVE_LOCALECONV 1
/*
* HAVE_SYS_SELECT_H:
*

View File

@ -165,6 +165,13 @@
/* #undef HAVE_STRLCAT*/
/* #undef HAVE_STRLCPY*/
/*
* Do we have POSIX locale support?
*/
#define HAVE_LOCALE_H 1
#define HAVE_LOCALECONV 1
/*
* HAVE_SYS_SELECT_H:
*

View File

@ -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 == '-') ||

View File

@ -152,6 +152,13 @@
/*#undef HAVE_STRLCAT*/
/*#undef HAVE_STRLCPY*/
/*
* Do we have POSIX locale support?
*/
#define HAVE_LOCALE_H 1
#define HAVE_LOCALECONV 1
/*
* HAVE_POLL:
*

View File

@ -152,6 +152,13 @@
/*#undef HAVE_STRLCAT*/
/*#undef HAVE_STRLCPY*/
/*
* Do we have POSIX locale support?
*/
#define HAVE_LOCALE_H 1
#define HAVE_LOCALECONV 1
/*
* HAVE_POLL:
*

View File

@ -162,6 +162,13 @@
/* #undef HAVE_STRLCAT */
/* #undef HAVE_STRLCPY */
/*
* Do we have POSIX locale support?
*/
#define HAVE_LOCALE_H 1
#define HAVE_LOCALECONV 1
/*
* HAVE_SYS_SELECT_H:
*