Skip to content

Create a minimal locale implementation - #929

Merged
keith-packard merged 8 commits into
mainfrom
tiny-locale
Jan 29, 2025
Merged

Create a minimal locale implementation#929
keith-packard merged 8 commits into
mainfrom
tiny-locale

Conversation

@keith-packard

Copy link
Copy Markdown
Collaborator

This should provide most of the same functionality as the original locale code as available in embedded systems where there aren't any locale data files available. It is missing is the ability to construct an LC_ALL locale string which specifies multiple locale categories, but as the only useful category is LC_CTYPE, that doesn't seem terrible useful (and is not required by C).

@keith-packard
keith-packard force-pushed the tiny-locale branch 2 times, most recently from 317121b to bcbaa0a Compare January 28, 2025 17:59
Using CMAKE_TOOLCHAIN_FILE elicits a cmake warning.

Signed-off-by: Keith Packard <keithp@keithp.com>
These shouldn't be in RAM.

Signed-off-by: Keith Packard <keithp@keithp.com>
@keith-packard
keith-packard force-pushed the tiny-locale branch 2 times, most recently from 3f3f709 to d17e5fc Compare January 28, 2025 21:12
Comment thread newlib/libc/CMakeLists.txt
@keith-packard
keith-packard force-pushed the tiny-locale branch 4 times, most recently from dd3ad06 to f7e0fbf Compare January 29, 2025 03:43
Make sure we use the correct type for the variable field width
arguments in calls to snprintf.

Signed-off-by: Keith Packard <keithp@keithp.com>
The iconv code uses SHIFT-JIS, so match that.

Signed-off-by: Keith Packard <keithp@keithp.com>
Replace explicit references to __locale_t internals with macros and
inlines. Add libc/locale as an include directory so we can include
setlocale.h without directly referencing the directory name

Signed-off-by: Keith Packard <keithp@keithp.com>
This should provide most of the same functionality as the original
locale code as available in embedded systems where there aren't any
locale data files available. It is missing is the ability to construct
an LC_ALL locale string which specifies multiple locale categories,
but as the only useful category is LC_CTYPE, that doesn't seem
terrible useful (and is not required by C).

Signed-off-by: Keith Packard <keithp@keithp.com>
Make sure strftime does something reasonable

Signed-off-by: Keith Packard <keithp@keithp.com>
These fail when time_t is only 4 byte (as on i386 native targets)

Signed-off-by: Keith Packard <keithp@keithp.com>
@keith-packard
keith-packard merged commit d0183e6 into main Jan 29, 2025
@keith-packard
keith-packard deleted the tiny-locale branch January 29, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants