X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fi18n.h;h=ee8be2fd631509af50579569549dbb055e5a0ff8;hb=refs%2Fheads%2Fmatrix2;hp=27ccce361e5ccfa8a6bf03c85967e96eaf4174ae;hpb=dff37440177a355bfc0cf9ff56428114e29f5106;p=pspp diff --git a/src/libpspp/i18n.h b/src/libpspp/i18n.h index 27ccce361e..ee8be2fd63 100644 --- a/src/libpspp/i18n.h +++ b/src/libpspp/i18n.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2006, 2010, 2011, 2012 Free Software Foundation, Inc. + Copyright (C) 2006, 2010, 2011, 2012, 2014, 2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,8 @@ #ifndef I18N_H #define I18N_H +#include "libpspp/compiler.h" +#include "libpspp/str.h" #include #include @@ -40,6 +42,9 @@ char *recode_string_pool (const char *to, const char *from, const char *text, int length, struct pool *); struct substring recode_substring_pool (const char *to, const char *from, struct substring text, struct pool *); +int recode_pedantically (const char *to, const char *from, + struct substring text, struct pool *, + struct substring *out); size_t recode_string_len (const char *to, const char *from, const char *text, int len); @@ -67,6 +72,18 @@ void set_default_encoding (const char *enc); bool set_encoding_from_locale (const char *loc); const char *uc_name (ucs4_t uc, char buffer[16]); + +unsigned int utf8_hash_case_bytes (const char *, size_t n, unsigned int basis) WARN_UNUSED_RESULT; +unsigned int utf8_hash_case_string (const char *, unsigned int basis) WARN_UNUSED_RESULT; +unsigned int utf8_hash_case_substring (struct substring, unsigned int basis) + WARN_UNUSED_RESULT; +int utf8_strcasecmp (const char *, const char *); +int utf8_sscasecmp (struct substring, struct substring); +int utf8_strncasecmp (const char *, size_t, const char *, size_t); +int utf8_strverscasecmp (const char *, const char *); +char *utf8_to_upper (const char *); +char *utf8_to_lower (const char *); +char *utf8_to_title (const char *); /* Information about character encodings. */ @@ -79,7 +96,7 @@ const char *uc_name (ucs4_t uc, char buffer[16]); a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 - ! " # % & ' ( ) * + , - . / : + ! " # % & ' () * + , - . / : ; < = > ? [ \ ] ^ _ { | } ~ space \a \b \r \n \t \v \f \0 @@ -134,6 +151,7 @@ struct encoding_info int unit; /* Unit width, in bytes. */ char cr[MAX_UNIT]; /* \r in encoding, 'unit' bytes long. */ char lf[MAX_UNIT]; /* \n in encoding, 'unit' bytes long. */ + char space[MAX_UNIT]; /* ' ' in encoding, 'unit' bytes long. */ }; bool get_encoding_info (struct encoding_info *, const char *name); @@ -141,4 +159,22 @@ bool is_encoding_ascii_compatible (const char *encoding); bool is_encoding_ebcdic_compatible (const char *encoding); bool is_encoding_supported (const char *encoding); +bool is_encoding_utf8 (const char *encoding); + +/* Database of encodings, by language or region. */ + +struct encoding_category + { + const char *category; /* e.g. "Arabic" or "Western European". */ + const char **encodings; /* Encodings within the category. */ + size_t n_encodings; /* Number of encodings in category. */ + }; + +struct encoding_category *get_encoding_categories (void); +size_t get_n_encoding_categories (void); + +/* Return the ISO two letter code for the current LC_MESSAGES + locale category. */ +char *get_language (void); + #endif /* i18n.h */