Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement uformattable.h #142

Merged
merged 2 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"rust_icu_udat",
"rust_icu_udata",
"rust_icu_uenum",
"rust_icu_uformattable",
"rust_icu_ulistformatter",
"rust_icu_uloc",
"rust_icu_umsg",
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ publish:
$(call publish,rust_icu_umsg)
$(call publish,rust_icu_ulistformatter)
$(call publish,rust_icu_upluralrules)
$(call publish,rust_icu_uformattable)
$(call publish,rust_icu)

# A helper to up-rev the cargo crate versions.
Expand Down Expand Up @@ -164,6 +165,7 @@ uprev:
$(call uprev,rust_icu_upluralrules)
$(call uprev,rust_icu_ustring)
$(call uprev,rust_icu_utext)
$(call uprev,rust_icu_uformattable)

cov:
./build/showprogress.sh
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ coverage in the headers.
| [rust_icu_udat](https://crates.io/crates/rust_icu_udat)| ICU date and time. Implements [`udat.h`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/udat_8h.html) C API header from the ICU library. |
| [rust_icu_udata](https://crates.io/crates/rust_icu_udata)| ICU binary data. Implements [`udata.h`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/udata_8h.html) C API header from the ICU library. |
| [rust_icu_uenum](https://crates.io/crates/rust_icu_uenum)| ICU enumerations. Implements [`uenum.h`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/uenum_8h.html) C API header from the ICU library. Mainly `UEnumeration` and friends. |
| [rust_icu_uformattable](https://crates.io/crates/rust_icu_uformattable)| Locale-sensitive list formatting support. Implements [`uformattable.h`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/uformattable_8h.html) C API header from the ICU library. Since 0.3.1. |
| [rust_icu_ulistformatter](https://crates.io/crates/rust_icu_ulistformatter)| Locale-sensitive list formatting support. Implements [`ulistformatter.h`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/ulistformatter_8h.html) C API header from the ICU library. |
| [rust_icu_uloc](https://crates.io/crates/rust_icu_uloc)| Locale support. Implements [`uloc.h`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/uloc_8h.html) C API header from the ICU library. |
| [rust_icu_umsg](https://crates.io/crates/rust_icu_umsg)| MessageFormat support. Implements [`umsg.h`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/umsg_8h.html) C API header from the ICU library. |
Expand Down
4 changes: 3 additions & 1 deletion build/showprogress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ C_API_HEADER_NAMES=(
"udat"
"udata"
"uenum"
"uformattable"
"ulistformatter"
"uloc"
"upluralrules"
"umsg"
"ustring"
"ustring"
"utext"
)

Expand Down
121 changes: 51 additions & 70 deletions coverage/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

| Header | Implemented |
| ------ | ----------- |
| `ucal.h` | 15 / 45 |
| `ucal.h` | 15 / 46 |
| `ucol.h` | 2 / 50 |
| `udat.h` | 6 / 38 |
| `udata.h` | 2 / 8 |
| `uenum.h` | 8 / 8 |
| `uloc.h` | 19 / 41 |
| `uformattable.h` | 7 / 13 |
| `ulistformatter.h` | 2 / 8 |
| `uloc.h` | 19 / 42 |
| `upluralrules.h` | 3 / 7 |
| `umsg.h` | 6 / 20 |
| `ustring.h` | 3 / 61 |
| `ustring.h` | 3 / 61 |
| `utext.h` | 3 / 28 |
# Unimplemented functions per header

Expand Down Expand Up @@ -47,6 +49,7 @@
| `ucal_getDSTSavings` | |
| `ucal_getFieldDifference` | |
| `ucal_getGregorianChange` | |
| `ucal_getHostTimeZone` | |
| `ucal_getKeywordValuesForLocale` | |
| `ucal_getLimit` | |
| `ucal_getLocaleByType` | |
Expand Down Expand Up @@ -196,6 +199,38 @@
| `uenum_reset` | |
| `uenum_unext` | |

# Header: `uformattable.h`

| Unimplemented | Implemented |
| ------------- | ----------- |
| | `$impl_function_name` |
| | `ufmt_close` |
| | `ufmt_getArrayItemByIndex` |
| | `ufmt_getDecNumChars` |
| | `ufmt_getUChars` |
| | `ufmt_isNumeric` |
| | `ufmt_open` |
| `ufmt_getArrayLength` | |
| `ufmt_getDate` | |
| `ufmt_getDouble` | |
| `ufmt_getInt64` | |
| `ufmt_getLong` | |
| `ufmt_getObject` | |
| `ufmt_getType` | |

# Header: `ulistformatter.h`

| Unimplemented | Implemented |
| ------------- | ----------- |
| | `ulistfmt_format` |
| | `ulistfmt_openForType` |
| `ulistfmt_close` | |
| `ulistfmt_closeResult` | |
| `ulistfmt_formatStringsToResult` | |
| `ulistfmt_open` | |
| `ulistfmt_openResult` | |
| `ulistfmt_resultAsValue` | |

# Header: `uloc.h`

| Unimplemented | Implemented |
Expand Down Expand Up @@ -242,10 +277,23 @@
| `uloc_getName` | |
| `uloc_getParent` | |
| `uloc_isRightToLeft` | |
| `uloc_openAvailableByType` | |
| `uloc_openKeywords` | |
| `uloc_setKeywordValue` | |
| `uloc_toLegacyType` | |

# Header: `upluralrules.h`

| Unimplemented | Implemented |
| ------------- | ----------- |
| | `uplrules_getKeywords` |
| | `uplrules_openForType` |
| | `uplrules_select` |
| `uplrules_close` | |
| `uplrules_open` | |
| `uplrules_selectFormatted` | |
| `uplrules_selectWithFormat` | |

# Header: `umsg.h`

| Unimplemented | Implemented |
Expand Down Expand Up @@ -339,73 +387,6 @@
| `u_unescape` | |
| `u_unescapeAt` | |

# Header: `ustring.h`

| Unimplemented | Implemented |
| ------------- | ----------- |
| | `UChar*` |
| | `u_strFromUTF8` |
| | `u_strToUTF8` |
| `u_austrcpy` | |
| `u_austrncpy` | |
| `u_countChar32` | |
| `u_memcasecmp` | |
| `u_memchr` | |
| `u_memchr32` | |
| `u_memcmp` | |
| `u_memcmpCodePointOrder` | |
| `u_memcpy` | |
| `u_memmove` | |
| `u_memrchr` | |
| `u_memrchr32` | |
| `u_memset` | |
| `u_strcasecmp` | |
| `u_strCaseCompare` | |
| `u_strcat` | |
| `u_strchr` | |
| `u_strchr32` | |
| `u_strcmp` | |
| `u_strcmpCodePointOrder` | |
| `u_strCompare` | |
| `u_strCompareIter` | |
| `u_strcpy` | |
| `u_strcspn` | |
| `u_strFindFirst` | |
| `u_strFindLast` | |
| `u_strFoldCase` | |
| `u_strFromJavaModifiedUTF8WithSub` | |
| `u_strFromUTF32` | |
| `u_strFromUTF32WithSub` | |
| `u_strFromUTF8Lenient` | |
| `u_strFromUTF8WithSub` | |
| `u_strFromWCS` | |
| `u_strHasMoreChar32Than` | |
| `u_strlen` | |
| `u_strncasecmp` | |
| `u_strncat` | |
| `u_strncmp` | |
| `u_strncmpCodePointOrder` | |
| `u_strncpy` | |
| `u_strpbrk` | |
| `u_strrchr` | |
| `u_strrchr32` | |
| `u_strrstr` | |
| `u_strspn` | |
| `u_strstr` | |
| `u_strToJavaModifiedUTF8` | |
| `u_strtok_r` | |
| `u_strToLower` | |
| `u_strToTitle` | |
| `u_strToUpper` | |
| `u_strToUTF32` | |
| `u_strToUTF32WithSub` | |
| `u_strToUTF8WithSub` | |
| `u_strToWCS` | |
| `u_uastrcpy` | |
| `u_uastrncpy` | |
| `u_unescape` | |
| `u_unescapeAt` | |

# Header: `utext.h`

| Unimplemented | Implemented |
Expand Down
1 change: 1 addition & 0 deletions coverage/ucal_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ucal_getDefaultTimeZone
ucal_getDSTSavings
ucal_getFieldDifference
ucal_getGregorianChange
ucal_getHostTimeZone
ucal_getKeywordValuesForLocale
ucal_getLimit
ucal_getLocaleByType
Expand Down
Empty file added coverage/ufmt_all.txt
Empty file.
13 changes: 13 additions & 0 deletions coverage/uformattable_all.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ufmt_close
ufmt_getArrayItemByIndex
ufmt_getArrayLength
ufmt_getDate
ufmt_getDecNumChars
ufmt_getDouble
ufmt_getInt64
ufmt_getLong
ufmt_getObject
ufmt_getType
ufmt_getUChars
ufmt_isNumeric
ufmt_open
7 changes: 7 additions & 0 deletions coverage/uformattable_implemented.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$impl_function_name
ufmt_close
ufmt_getArrayItemByIndex
ufmt_getDecNumChars
ufmt_getUChars
ufmt_isNumeric
ufmt_open
8 changes: 8 additions & 0 deletions coverage/ulistformatter_all.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ulistfmt_close
ulistfmt_closeResult
ulistfmt_format
ulistfmt_formatStringsToResult
ulistfmt_open
ulistfmt_openForType
ulistfmt_openResult
ulistfmt_resultAsValue
2 changes: 2 additions & 0 deletions coverage/ulistformatter_implemented.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ulistfmt_format
ulistfmt_openForType
1 change: 1 addition & 0 deletions coverage/uloc_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ uloc_getScript
uloc_getVariant
uloc_isRightToLeft
uloc_minimizeSubtags
uloc_openAvailableByType
uloc_openKeywords
uloc_setDefault
uloc_setKeywordValue
Expand Down
7 changes: 7 additions & 0 deletions coverage/upluralrules_all.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
uplrules_close
uplrules_getKeywords
uplrules_open
uplrules_openForType
uplrules_select
uplrules_selectFormatted
uplrules_selectWithFormat
3 changes: 3 additions & 0 deletions coverage/upluralrules_implemented.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
uplrules_getKeywords
uplrules_openForType
uplrules_select
2 changes: 1 addition & 1 deletion rust_icu_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl Into<std::fmt::Error> for Error {
/// BUFFER_CAPACITY,
/// [before_arg_a: before_type_a, before_arg_b: before_type_b,],
/// [after_arg_a: after_type_a, after_arg_b: after_type_b,]
/// );
/// );
/// ```
///
/// the generated method has a signature of the form
Expand Down
67 changes: 67 additions & 0 deletions rust_icu_sys/bindgen/lib_63.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2272,6 +2272,73 @@ fn bindgen_test_layout_UFieldPosition() {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd)]
pub enum UFormattableType {
UFMT_DATE = 0,
UFMT_DOUBLE = 1,
UFMT_LONG = 2,
UFMT_STRING = 3,
UFMT_ARRAY = 4,
UFMT_INT64 = 5,
UFMT_OBJECT = 6,
UFMT_COUNT = 7,
}
pub type UFormattable = *mut ::std::os::raw::c_void;
extern "C" {
pub fn ufmt_open_63(status: *mut UErrorCode) -> *mut UFormattable;
}
extern "C" {
pub fn ufmt_close_63(fmt: *mut UFormattable);
}
extern "C" {
pub fn ufmt_getType_63(fmt: *const UFormattable, status: *mut UErrorCode) -> UFormattableType;
}
extern "C" {
pub fn ufmt_isNumeric_63(fmt: *const UFormattable) -> UBool;
}
extern "C" {
pub fn ufmt_getDate_63(fmt: *const UFormattable, status: *mut UErrorCode) -> UDate;
}
extern "C" {
pub fn ufmt_getDouble_63(fmt: *mut UFormattable, status: *mut UErrorCode) -> f64;
}
extern "C" {
pub fn ufmt_getLong_63(fmt: *mut UFormattable, status: *mut UErrorCode) -> i32;
}
extern "C" {
pub fn ufmt_getInt64_63(fmt: *mut UFormattable, status: *mut UErrorCode) -> i64;
}
extern "C" {
pub fn ufmt_getObject_63(
fmt: *const UFormattable,
status: *mut UErrorCode,
) -> *const ::std::os::raw::c_void;
}
extern "C" {
pub fn ufmt_getUChars_63(
fmt: *mut UFormattable,
len: *mut i32,
status: *mut UErrorCode,
) -> *const UChar;
}
extern "C" {
pub fn ufmt_getArrayLength_63(fmt: *const UFormattable, status: *mut UErrorCode) -> i32;
}
extern "C" {
pub fn ufmt_getArrayItemByIndex_63(
fmt: *mut UFormattable,
n: i32,
status: *mut UErrorCode,
) -> *mut UFormattable;
}
extern "C" {
pub fn ufmt_getDecNumChars_63(
fmt: *mut UFormattable,
len: *mut i32,
status: *mut UErrorCode,
) -> *const ::std::os::raw::c_char;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd)]
pub enum UDisplayContextType {
UDISPCTX_TYPE_DIALECT_HANDLING = 0,
UDISPCTX_TYPE_CAPITALIZATION = 1,
Expand Down
Loading