Zeno of Elea
Zeno of Elea

Reputation: 185

How are locale files initially read by the C library

I am writing my own Posix C library from scratch and I have hit a stumbling block when it comes to internationalization and ctype's. I see in the POSIX standard several functions for the end user programs to set and access locales in the locale.h header but not how to initially store the locale information from the locale file for the libraries use. Is this just some nonstandard library internal custom to each implimentation?

Upvotes: 1

Views: 153

Answers (1)

R.. GitHub STOP HELPING ICE
R.. GitHub STOP HELPING ICE

Reputation: 215277

POSIX specifies the optional localedef utility and a locale source format it can read and convert to whatever data format your implementation uses internally. If you opt to support localedef, then the source structure for locales is data in the localedef format, but you can design whatever intermediary format you like for easy/efficient/whatever access at runtime.

Otherwise, if you're not supporting localedef, how you implement locale is completely up to you. POSIX specifies how various interfaces behave, but not how you achieve those features, nor what degrees of freedom locales might vary by. It's possible for a conforming implementation to have nothing but the C/POSIX locale.

Upvotes: 1

Related Questions