1use allegro_util::c_bool;
6use libc::*;
7
8pub type ALLEGRO_USTR = __al_tagbstring;
9pub type ALLEGRO_USTR_INFO = __al_tagbstring;
10
11#[repr(C)]
12#[derive(Copy, Clone)]
13pub struct __al_tagbstring
14{
15 pub mlen: c_int,
16 pub slen: c_int,
17 pub data: *mut c_uchar,
18}
19
20unsafe extern "C" {
21 pub fn al_ustr_new(s: *const c_char) -> *mut ALLEGRO_USTR;
22 pub fn al_ustr_new_from_buffer(s: *const c_char, size: size_t) -> *mut ALLEGRO_USTR;
23 pub fn al_ustr_free(us: *mut ALLEGRO_USTR);
24 pub fn al_cstr(us: *const ALLEGRO_USTR) -> *const c_char;
25 pub fn al_ustr_to_buffer(us: *const ALLEGRO_USTR, buffer: *mut c_char, size: c_int);
26 pub fn al_cstr_dup(us: *const ALLEGRO_USTR) -> *mut c_char;
27 pub fn al_ustr_dup(us: *const ALLEGRO_USTR) -> *mut ALLEGRO_USTR;
28 pub fn al_ustr_dup_substr(
29 us: *const ALLEGRO_USTR, start_pos: c_int, end_pos: c_int,
30 ) -> *mut ALLEGRO_USTR;
31 pub fn al_ustr_empty_string() -> *const ALLEGRO_USTR;
32 pub fn al_ref_cstr(info: *mut ALLEGRO_USTR_INFO, s: *const c_char) -> *const ALLEGRO_USTR;
33 pub fn al_ref_buffer(
34 info: *mut ALLEGRO_USTR_INFO, s: *const c_char, size: size_t,
35 ) -> *const ALLEGRO_USTR;
36 pub fn al_ref_ustr(
37 info: *mut ALLEGRO_USTR_INFO, us: *const ALLEGRO_USTR, start_pos: c_int, end_pos: c_int,
38 ) -> *const ALLEGRO_USTR;
39 pub fn al_ustr_size(us: *const ALLEGRO_USTR) -> size_t;
40 pub fn al_ustr_length(us: *const ALLEGRO_USTR) -> size_t;
41 pub fn al_ustr_offset(us: *const ALLEGRO_USTR, index: c_int) -> c_int;
42 pub fn al_ustr_next(us: *const ALLEGRO_USTR, pos: *mut c_int) -> c_bool;
43 pub fn al_ustr_prev(us: *const ALLEGRO_USTR, pos: *mut c_int) -> c_bool;
44 pub fn al_ustr_get(us: *const ALLEGRO_USTR, pos: c_int) -> i32;
45 pub fn al_ustr_get_next(us: *const ALLEGRO_USTR, pos: *mut c_int) -> i32;
46 pub fn al_ustr_prev_get(us: *const ALLEGRO_USTR, pos: *mut c_int) -> i32;
47 pub fn al_ustr_insert(us1: *mut ALLEGRO_USTR, pos: c_int, us2: *const ALLEGRO_USTR) -> c_bool;
48 pub fn al_ustr_insert_cstr(us: *mut ALLEGRO_USTR, pos: c_int, us2: *const c_char) -> c_bool;
49 pub fn al_ustr_insert_chr(us: *mut ALLEGRO_USTR, pos: c_int, c: i32) -> size_t;
50 pub fn al_ustr_append(us1: *mut ALLEGRO_USTR, us2: *const ALLEGRO_USTR) -> c_bool;
51 pub fn al_ustr_append_cstr(us: *mut ALLEGRO_USTR, s: *const c_char) -> c_bool;
52 pub fn al_ustr_append_chr(us: *mut ALLEGRO_USTR, c: i32) -> size_t;
53 pub fn al_ustr_remove_chr(us: *mut ALLEGRO_USTR, pos: c_int) -> c_bool;
54 pub fn al_ustr_remove_range(us: *mut ALLEGRO_USTR, start_pos: c_int, end_pos: c_int) -> c_bool;
55 pub fn al_ustr_truncate(us: *mut ALLEGRO_USTR, start_pos: c_int) -> c_bool;
56 pub fn al_ustr_ltrim_ws(us: *mut ALLEGRO_USTR) -> c_bool;
57 pub fn al_ustr_rtrim_ws(us: *mut ALLEGRO_USTR) -> c_bool;
58 pub fn al_ustr_trim_ws(us: *mut ALLEGRO_USTR) -> c_bool;
59 pub fn al_ustr_assign(us1: *mut ALLEGRO_USTR, us2: *const ALLEGRO_USTR) -> c_bool;
60 pub fn al_ustr_assign_substr(
61 us1: *mut ALLEGRO_USTR, us2: *const ALLEGRO_USTR, start_pos: c_int, end_pos: c_int,
62 ) -> c_bool;
63 pub fn al_ustr_assign_cstr(us1: *mut ALLEGRO_USTR, s: *const c_char) -> c_bool;
64 pub fn al_ustr_set_chr(us: *mut ALLEGRO_USTR, pos: c_int, c: i32) -> size_t;
65 pub fn al_ustr_replace_range(
66 us1: *mut ALLEGRO_USTR, start_pos1: c_int, end_pos1: c_int, us2: *const ALLEGRO_USTR,
67 ) -> c_bool;
68 pub fn al_ustr_find_chr(us: *const ALLEGRO_USTR, start_pos: c_int, c: i32) -> c_int;
69 pub fn al_ustr_rfind_chr(us: *const ALLEGRO_USTR, start_pos: c_int, c: i32) -> c_int;
70 pub fn al_ustr_find_set(
71 us: *const ALLEGRO_USTR, start_pos: c_int, accept: *const ALLEGRO_USTR,
72 ) -> c_int;
73 pub fn al_ustr_find_set_cstr(
74 us: *const ALLEGRO_USTR, start_pos: c_int, accept: *const c_char,
75 ) -> c_int;
76 pub fn al_ustr_find_cset(
77 us: *const ALLEGRO_USTR, start_pos: c_int, reject: *const ALLEGRO_USTR,
78 ) -> c_int;
79 pub fn al_ustr_find_cset_cstr(
80 us: *const ALLEGRO_USTR, start_pos: c_int, reject: *const c_char,
81 ) -> c_int;
82 pub fn al_ustr_find_str(
83 haystack: *const ALLEGRO_USTR, start_pos: c_int, needle: *const ALLEGRO_USTR,
84 ) -> c_int;
85 pub fn al_ustr_find_cstr(
86 haystack: *const ALLEGRO_USTR, start_pos: c_int, needle: *const c_char,
87 ) -> c_int;
88 pub fn al_ustr_rfind_str(
89 haystack: *const ALLEGRO_USTR, start_pos: c_int, needle: *const ALLEGRO_USTR,
90 ) -> c_int;
91 pub fn al_ustr_rfind_cstr(
92 haystack: *const ALLEGRO_USTR, start_pos: c_int, needle: *const c_char,
93 ) -> c_int;
94 pub fn al_ustr_find_replace(
95 us: *mut ALLEGRO_USTR, start_pos: c_int, find: *const ALLEGRO_USTR,
96 replace: *const ALLEGRO_USTR,
97 ) -> c_bool;
98 pub fn al_ustr_find_replace_cstr(
99 us: *mut ALLEGRO_USTR, start_pos: c_int, find: *const c_char, replace: *const c_char,
100 ) -> c_bool;
101 pub fn al_ustr_equal(us1: *const ALLEGRO_USTR, us2: *const ALLEGRO_USTR) -> c_bool;
102 pub fn al_ustr_compare(u: *const ALLEGRO_USTR, v: *const ALLEGRO_USTR) -> c_int;
103 pub fn al_ustr_ncompare(us1: *const ALLEGRO_USTR, us2: *const ALLEGRO_USTR, n: c_int) -> c_int;
104 pub fn al_ustr_has_prefix(u: *const ALLEGRO_USTR, v: *const ALLEGRO_USTR) -> c_bool;
105 pub fn al_ustr_has_prefix_cstr(u: *const ALLEGRO_USTR, s: *const c_char) -> c_bool;
106 pub fn al_ustr_has_suffix(u: *const ALLEGRO_USTR, v: *const ALLEGRO_USTR) -> c_bool;
107 pub fn al_ustr_has_suffix_cstr(us1: *const ALLEGRO_USTR, s: *const c_char) -> c_bool;
108 pub fn al_utf8_width(c: i32) -> size_t;
109 pub fn al_utf8_encode(s: c_void, c: i32) -> size_t;
110 pub fn al_ustr_new_from_utf16(s: *const u16) -> *mut ALLEGRO_USTR;
111 pub fn al_ustr_size_utf16(us: *const ALLEGRO_USTR) -> size_t;
112 pub fn al_ustr_encode_utf16(us: *const ALLEGRO_USTR, s: *mut u16, n: size_t) -> size_t;
113 pub fn al_utf16_width(c: c_int) -> size_t;
114 pub fn al_utf16_encode(s: c_void, c: i32) -> size_t;
115}