39static const char lc_name[] =
"LC_NUMERIC";
42void Def::process_numeric ()
47 int nesting_level = 0;
49 num_def_found_ =
true;
59 if (nesting_level == 0)
66 "wrong section name in END directive\n");
74 "expected string following \"copy\" directive\n");
102 num_st_.decimal_point = convert_string (next.
name);
103 num_st_.wdecimal_point = convert_wstring (next);
108 num_st_.thousands_sep = convert_string (next.
name);
109 num_st_.wthousands_sep = convert_wstring (next);
115 num_st_.grouping.clear();
118 num_st_.grouping += std::atoi(next.
name.c_str());
123 num_st_.truename = convert_string (next.
name);
124 num_st_.wtruename = convert_wstring (next);
129 num_st_.falsename = convert_string (next.
name);
130 num_st_.wfalsename = convert_wstring (next);
142 assert (!dir_name.empty ());
147 if (!num_def_found_) {
149 "%s section not found, skipping\n", lc_name);
157 std::ofstream
out (dir_name.c_str (), std::ios::binary);
158 out.exceptions (std::ios::failbit | std::ios::badbit);
163 num_punct_out_.decimal_point_off [1] = 0;
165 num_punct_out_.thousands_sep_off [1] =
166 unsigned (num_punct_out_.decimal_point_off [1]
167 + (num_st_.wdecimal_point.size () + 1) * sizeof (
wchar_t));
169 num_punct_out_.decimal_point_off [0] =
170 unsigned (num_punct_out_.thousands_sep_off [1]
171 + (num_st_.wthousands_sep.size() + 1) * sizeof (
wchar_t));
173 num_punct_out_.thousands_sep_off [0] =
174 unsigned (num_punct_out_.decimal_point_off [0]
175 + num_st_.decimal_point.size () + 1);
177 num_punct_out_.grouping_off =
178 unsigned (num_punct_out_.thousands_sep_off [0]
179 + num_st_.thousands_sep.size () + 1);
181 num_punct_out_.punct_ext_off =
182 unsigned (num_punct_out_.grouping_off
183 + num_st_.grouping.size () + 1);
186 const std::size_t align =
sizeof num_punct_out_.punct_ext_off;
189 const std::size_t misalign = num_punct_out_.punct_ext_off % align;
192 const std::size_t pad = misalign ? align - misalign : 0;
194 num_punct_out_.punct_ext_off += unsigned (pad);
198 num_out_.truename_off [1] = 0;
200 num_out_.falsename_off [1] =
201 unsigned (num_out_.truename_off [1]
202 + (num_st_.wtruename.size() + 1) * sizeof (
wchar_t));
204 num_out_.truename_off [0] =
205 unsigned (num_out_.falsename_off [1]
206 + (num_st_.wfalsename.size() + 1) * sizeof (
wchar_t));
208 num_out_.falsename_off [0] =
209 unsigned (num_out_.truename_off [0]
210 + num_st_.truename.size() + 1);
212 num_out_.codeset_off =
213 unsigned (num_out_.falsename_off [0]
214 + num_st_.falsename.size() + 1);
216 num_out_.charmap_off =
217 unsigned (num_out_.codeset_off
223 " decimal_point_off[] = { %u, %u }\n"
224 " thousand_sep_off[] = { %u, %u }\n"
225 " grouping_off = %u\n"
227 "}\n__rw_numpunct_t {\n"
228 " falsename_off[] = { %u, %u }\n"
229 " truename_off[] = { %u, %u }\n"
230 " codeset_off = %u\n"
231 " charmap_off = %u\n"
234 num_punct_out_.decimal_point_off [0],
235 num_punct_out_.decimal_point_off [1],
236 num_punct_out_.thousands_sep_off [0],
237 num_punct_out_.thousands_sep_off [1],
238 num_punct_out_.grouping_off,
239 num_punct_out_.punct_ext_off,
240 num_out_.falsename_off [0],
241 num_out_.falsename_off [1],
242 num_out_.truename_off [0],
243 num_out_.truename_off [1],
244 num_out_.codeset_off,
245 num_out_.charmap_off);
248 out.write ((
char*)&num_punct_out_,
sizeof (num_punct_out_));
251 out.write ((
const char*)num_st_.wdecimal_point.c_str (),
252 (num_st_.wdecimal_point.size() + 1) * sizeof (
wchar_t));
253 out.write ((
const char*)num_st_.wthousands_sep.c_str(),
254 (num_st_.wthousands_sep.size() + 1) *
sizeof(
wchar_t));
256 out << num_st_.decimal_point << std::ends
257 << num_st_.thousands_sep << std::ends
258 << num_st_.grouping << std::ends;
261 out.write (
"\0\0\0\0\0\0\0\0", pad);
264 out.write ((
char*)&num_out_,
sizeof (num_out_));
267 out.write ((
const char*)num_st_.wtruename.c_str(),
268 (num_st_.wtruename.size() + 1) * sizeof (
wchar_t));
269 out.write ((
const char*)num_st_.wfalsename.c_str(),
270 (num_st_.wfalsename.size() + 1) * sizeof (
wchar_t));
274 out << num_st_.truename << std::ends
275 << num_st_.falsename << std::ends
const std::string & get_code_set_name() const
std::string get_charmap_name() const
void write_numeric(std::string dir_name)
void open(std::string, char='#', char='\\')
std::string strip_quotes(const std::string &str)
bool issue_diag(int type, bool, const Scanner::token_t *token, const char *fmt,...)
std::string get_pathname(const std::string &fname, const std::string &other)