strutil8bit.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  1. /*
  2. 8bit strings utilities
  3. Copyright (C) 2007-2021
  4. Free Software Foundation, Inc.
  5. Written by:
  6. Rostislav Benes, 2007
  7. This file is part of the Midnight Commander.
  8. The Midnight Commander is free software: you can redistribute it
  9. and/or modify it under the terms of the GNU General Public License as
  10. published by the Free Software Foundation, either version 3 of the License,
  11. or (at your option) any later version.
  12. The Midnight Commander is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <config.h>
  20. #include <ctype.h>
  21. #include <stdlib.h>
  22. #include "lib/global.h"
  23. #include "lib/strutil.h"
  24. /* Functions for singlebyte encodings, all characters have width 1
  25. * using standard system functions.
  26. * There are only small differences between functions in strutil8bit.c
  27. * and strutilascii.c.
  28. */
  29. /*** global variables ****************************************************************************/
  30. /*** file scope macro definitions ****************************************************************/
  31. /*
  32. * Inlines to equalize 'char' signedness for single 'char' encodings.
  33. * Instead of writing
  34. * isspace ((unsigned char) c);
  35. * you can write
  36. * char_isspace (c);
  37. */
  38. #define DECLARE_CTYPE_WRAPPER(func_name) \
  39. static inline int char_##func_name(char c) \
  40. { \
  41. return func_name((int)(unsigned char)c); \
  42. }
  43. /*** file scope type declarations ****************************************************************/
  44. /*** file scope variables ************************************************************************/
  45. static const char replch = '?';
  46. /* --------------------------------------------------------------------------------------------- */
  47. /*** file scope functions ************************************************************************/
  48. /* --------------------------------------------------------------------------------------------- */
  49. /* *INDENT-OFF* */
  50. DECLARE_CTYPE_WRAPPER (isalnum)
  51. DECLARE_CTYPE_WRAPPER (isdigit)
  52. DECLARE_CTYPE_WRAPPER (isprint)
  53. DECLARE_CTYPE_WRAPPER (ispunct)
  54. DECLARE_CTYPE_WRAPPER (isspace)
  55. DECLARE_CTYPE_WRAPPER (toupper)
  56. DECLARE_CTYPE_WRAPPER (tolower)
  57. /* *INDENT-ON* */
  58. /* --------------------------------------------------------------------------------------------- */
  59. static void
  60. str_8bit_insert_replace_char (GString * buffer)
  61. {
  62. g_string_append_c (buffer, replch);
  63. }
  64. /* --------------------------------------------------------------------------------------------- */
  65. static gboolean
  66. str_8bit_is_valid_string (const char *text)
  67. {
  68. (void) text;
  69. return TRUE;
  70. }
  71. /* --------------------------------------------------------------------------------------------- */
  72. static int
  73. str_8bit_is_valid_char (const char *ch, size_t size)
  74. {
  75. (void) ch;
  76. (void) size;
  77. return 1;
  78. }
  79. /* --------------------------------------------------------------------------------------------- */
  80. static void
  81. str_8bit_cnext_char (const char **text)
  82. {
  83. (*text)++;
  84. }
  85. /* --------------------------------------------------------------------------------------------- */
  86. static void
  87. str_8bit_cprev_char (const char **text)
  88. {
  89. (*text)--;
  90. }
  91. /* --------------------------------------------------------------------------------------------- */
  92. static int
  93. str_8bit_cnext_noncomb_char (const char **text)
  94. {
  95. if (*text[0] == '\0')
  96. return 0;
  97. (*text)++;
  98. return 1;
  99. }
  100. /* --------------------------------------------------------------------------------------------- */
  101. static int
  102. str_8bit_cprev_noncomb_char (const char **text, const char *begin)
  103. {
  104. if ((*text) == begin)
  105. return 0;
  106. (*text)--;
  107. return 1;
  108. }
  109. /* --------------------------------------------------------------------------------------------- */
  110. static gboolean
  111. str_8bit_isspace (const char *text)
  112. {
  113. return char_isspace (text[0]) != 0;
  114. }
  115. /* --------------------------------------------------------------------------------------------- */
  116. static gboolean
  117. str_8bit_ispunct (const char *text)
  118. {
  119. return char_ispunct (text[0]) != 0;
  120. }
  121. /* --------------------------------------------------------------------------------------------- */
  122. static gboolean
  123. str_8bit_isalnum (const char *text)
  124. {
  125. return char_isalnum (text[0]) != 0;
  126. }
  127. /* --------------------------------------------------------------------------------------------- */
  128. static gboolean
  129. str_8bit_isdigit (const char *text)
  130. {
  131. return char_isdigit (text[0]) != 0;
  132. }
  133. /* --------------------------------------------------------------------------------------------- */
  134. static gboolean
  135. str_8bit_isprint (const char *text)
  136. {
  137. return char_isprint (text[0]) != 0;
  138. }
  139. /* --------------------------------------------------------------------------------------------- */
  140. static gboolean
  141. str_8bit_iscombiningmark (const char *text)
  142. {
  143. (void) text;
  144. return FALSE;
  145. }
  146. /* --------------------------------------------------------------------------------------------- */
  147. static int
  148. str_8bit_toupper (const char *text, char **out, size_t * remain)
  149. {
  150. if (*remain <= 1)
  151. return FALSE;
  152. (*out)[0] = char_toupper (text[0]);
  153. (*out)++;
  154. (*remain)--;
  155. return TRUE;
  156. }
  157. /* --------------------------------------------------------------------------------------------- */
  158. static gboolean
  159. str_8bit_tolower (const char *text, char **out, size_t * remain)
  160. {
  161. if (*remain <= 1)
  162. return FALSE;
  163. (*out)[0] = char_tolower (text[0]);
  164. (*out)++;
  165. (*remain)--;
  166. return TRUE;
  167. }
  168. /* --------------------------------------------------------------------------------------------- */
  169. static int
  170. str_8bit_length (const char *text)
  171. {
  172. return strlen (text);
  173. }
  174. /* --------------------------------------------------------------------------------------------- */
  175. static int
  176. str_8bit_length2 (const char *text, int size)
  177. {
  178. return (size >= 0) ? MIN (strlen (text), (gsize) size) : strlen (text);
  179. }
  180. /* --------------------------------------------------------------------------------------------- */
  181. static gchar *
  182. str_8bit_conv_gerror_message (GError * mcerror, const char *def_msg)
  183. {
  184. GIConv conv;
  185. gchar *ret;
  186. /* glib messages are in UTF-8 charset */
  187. conv = str_crt_conv_from ("UTF-8");
  188. if (conv == INVALID_CONV)
  189. ret = g_strdup (def_msg != NULL ? def_msg : "");
  190. else
  191. {
  192. GString *buf;
  193. buf = g_string_new ("");
  194. if (str_convert (conv, mcerror->message, buf) != ESTR_FAILURE)
  195. ret = g_string_free (buf, FALSE);
  196. else
  197. {
  198. ret = g_strdup (def_msg != NULL ? def_msg : "");
  199. g_string_free (buf, TRUE);
  200. }
  201. str_close_conv (conv);
  202. }
  203. return ret;
  204. }
  205. /* --------------------------------------------------------------------------------------------- */
  206. static estr_t
  207. str_8bit_vfs_convert_to (GIConv coder, const char *string, int size, GString * buffer)
  208. {
  209. estr_t result = ESTR_SUCCESS;
  210. if (coder == str_cnv_not_convert)
  211. g_string_append_len (buffer, string, size);
  212. else
  213. result = str_nconvert (coder, string, size, buffer);
  214. return result;
  215. }
  216. /* --------------------------------------------------------------------------------------------- */
  217. static const char *
  218. str_8bit_term_form (const char *text)
  219. {
  220. static char result[BUF_MEDIUM];
  221. char *actual;
  222. size_t remain;
  223. size_t length;
  224. size_t pos = 0;
  225. actual = result;
  226. remain = sizeof (result);
  227. length = strlen (text);
  228. for (; pos < length && remain > 1; pos++, actual++, remain--)
  229. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  230. actual[0] = '\0';
  231. return result;
  232. }
  233. /* --------------------------------------------------------------------------------------------- */
  234. static const char *
  235. str_8bit_fit_to_term (const char *text, int width, align_crt_t just_mode)
  236. {
  237. static char result[BUF_MEDIUM];
  238. char *actual;
  239. size_t remain;
  240. int ident = 0;
  241. size_t length;
  242. size_t pos = 0;
  243. length = strlen (text);
  244. actual = result;
  245. remain = sizeof (result);
  246. if ((int) length <= width)
  247. {
  248. switch (HIDE_FIT (just_mode))
  249. {
  250. case J_CENTER_LEFT:
  251. case J_CENTER:
  252. ident = (width - length) / 2;
  253. break;
  254. case J_RIGHT:
  255. ident = width - length;
  256. break;
  257. default:
  258. break;
  259. }
  260. if ((int) remain <= ident)
  261. goto finally;
  262. memset (actual, ' ', ident);
  263. actual += ident;
  264. remain -= ident;
  265. for (; pos < length && remain > 1; pos++, actual++, remain--)
  266. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  267. if (width - length - ident > 0)
  268. {
  269. if (remain <= width - length - ident)
  270. goto finally;
  271. memset (actual, ' ', width - length - ident);
  272. actual += width - length - ident;
  273. }
  274. }
  275. else if (IS_FIT (just_mode))
  276. {
  277. for (; pos + 1 <= (gsize) width / 2 && remain > 1; actual++, pos++, remain--)
  278. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  279. if (remain <= 1)
  280. goto finally;
  281. actual[0] = '~';
  282. actual++;
  283. remain--;
  284. pos += length - width + 1;
  285. for (; pos < length && remain > 1; pos++, actual++, remain--)
  286. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  287. }
  288. else
  289. {
  290. switch (HIDE_FIT (just_mode))
  291. {
  292. case J_CENTER:
  293. ident = (length - width) / 2;
  294. break;
  295. case J_RIGHT:
  296. ident = length - width;
  297. break;
  298. default:
  299. break;
  300. }
  301. pos += ident;
  302. for (; pos < (gsize) (ident + width) && remain > 1; pos++, actual++, remain--)
  303. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  304. }
  305. finally:
  306. if (actual >= result + sizeof (result))
  307. actual = result + sizeof (result) - 1;
  308. actual[0] = '\0';
  309. return result;
  310. }
  311. /* --------------------------------------------------------------------------------------------- */
  312. static const char *
  313. str_8bit_term_trim (const char *text, int width)
  314. {
  315. static char result[BUF_MEDIUM];
  316. size_t remain;
  317. char *actual;
  318. size_t length;
  319. length = strlen (text);
  320. actual = result;
  321. remain = sizeof (result);
  322. if (width > 0)
  323. {
  324. size_t pos;
  325. if (width >= (int) length)
  326. {
  327. for (pos = 0; pos < length && remain > 1; pos++, actual++, remain--)
  328. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  329. }
  330. else if (width <= 3)
  331. {
  332. memset (actual, '.', width);
  333. actual += width;
  334. }
  335. else
  336. {
  337. memset (actual, '.', 3);
  338. actual += 3;
  339. remain -= 3;
  340. for (pos = length - width + 3; pos < length && remain > 1; pos++, actual++, remain--)
  341. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  342. }
  343. }
  344. actual[0] = '\0';
  345. return result;
  346. }
  347. /* --------------------------------------------------------------------------------------------- */
  348. static int
  349. str_8bit_term_width2 (const char *text, size_t length)
  350. {
  351. return (length != (size_t) (-1)) ? MIN (strlen (text), length) : strlen (text);
  352. }
  353. /* --------------------------------------------------------------------------------------------- */
  354. static int
  355. str_8bit_term_width1 (const char *text)
  356. {
  357. return str_8bit_term_width2 (text, (size_t) (-1));
  358. }
  359. /* --------------------------------------------------------------------------------------------- */
  360. static int
  361. str_8bit_term_char_width (const char *text)
  362. {
  363. (void) text;
  364. return 1;
  365. }
  366. /* --------------------------------------------------------------------------------------------- */
  367. static const char *
  368. str_8bit_term_substring (const char *text, int start, int width)
  369. {
  370. static char result[BUF_MEDIUM];
  371. size_t remain;
  372. char *actual;
  373. size_t length;
  374. actual = result;
  375. remain = sizeof (result);
  376. length = strlen (text);
  377. if (start < (int) length)
  378. {
  379. size_t pos;
  380. for (pos = start; pos < length && width > 0 && remain > 1;
  381. pos++, width--, actual++, remain--)
  382. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  383. }
  384. for (; width > 0 && remain > 1; actual++, remain--, width--)
  385. actual[0] = ' ';
  386. actual[0] = '\0';
  387. return result;
  388. }
  389. /* --------------------------------------------------------------------------------------------- */
  390. static const char *
  391. str_8bit_trunc (const char *text, int width)
  392. {
  393. static char result[MC_MAXPATHLEN];
  394. int remain;
  395. char *actual;
  396. size_t pos = 0;
  397. size_t length;
  398. actual = result;
  399. remain = sizeof (result);
  400. length = strlen (text);
  401. if ((int) length > width)
  402. {
  403. for (; pos + 1 <= (gsize) width / 2 && remain > 1; actual++, pos++, remain--)
  404. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  405. if (remain <= 1)
  406. goto finally;
  407. actual[0] = '~';
  408. actual++;
  409. remain--;
  410. pos += length - width + 1;
  411. for (; pos < length && remain > 1; pos++, actual++, remain--)
  412. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  413. }
  414. else
  415. {
  416. for (; pos < length && remain > 1; pos++, actual++, remain--)
  417. actual[0] = char_isprint (text[pos]) ? text[pos] : '.';
  418. }
  419. finally:
  420. actual[0] = '\0';
  421. return result;
  422. }
  423. /* --------------------------------------------------------------------------------------------- */
  424. static int
  425. str_8bit_offset_to_pos (const char *text, size_t length)
  426. {
  427. (void) text;
  428. return (int) length;
  429. }
  430. /* --------------------------------------------------------------------------------------------- */
  431. static int
  432. str_8bit_column_to_pos (const char *text, size_t pos)
  433. {
  434. (void) text;
  435. return (int) pos;
  436. }
  437. /* --------------------------------------------------------------------------------------------- */
  438. static char *
  439. str_8bit_create_search_needle (const char *needle, gboolean case_sen)
  440. {
  441. (void) case_sen;
  442. return (char *) needle;
  443. }
  444. /* --------------------------------------------------------------------------------------------- */
  445. static void
  446. str_8bit_release_search_needle (char *needle, gboolean case_sen)
  447. {
  448. (void) case_sen;
  449. (void) needle;
  450. }
  451. /* --------------------------------------------------------------------------------------------- */
  452. static char *
  453. str_8bit_strdown (const char *str)
  454. {
  455. char *rets, *p;
  456. if (str == NULL)
  457. return NULL;
  458. rets = g_strdup (str);
  459. for (p = rets; *p != '\0'; p++)
  460. *p = char_tolower (*p);
  461. return rets;
  462. }
  463. /* --------------------------------------------------------------------------------------------- */
  464. static const char *
  465. str_8bit_search_first (const char *text, const char *search, gboolean case_sen)
  466. {
  467. char *fold_text;
  468. char *fold_search;
  469. const char *match;
  470. fold_text = case_sen ? (char *) text : str_8bit_strdown (text);
  471. fold_search = case_sen ? (char *) search : str_8bit_strdown (search);
  472. match = g_strstr_len (fold_text, -1, fold_search);
  473. if (match != NULL)
  474. {
  475. size_t offset;
  476. offset = match - fold_text;
  477. match = text + offset;
  478. }
  479. if (!case_sen)
  480. {
  481. g_free (fold_text);
  482. g_free (fold_search);
  483. }
  484. return match;
  485. }
  486. /* --------------------------------------------------------------------------------------------- */
  487. static const char *
  488. str_8bit_search_last (const char *text, const char *search, gboolean case_sen)
  489. {
  490. char *fold_text;
  491. char *fold_search;
  492. const char *match;
  493. fold_text = case_sen ? (char *) text : str_8bit_strdown (text);
  494. fold_search = case_sen ? (char *) search : str_8bit_strdown (search);
  495. match = g_strrstr_len (fold_text, -1, fold_search);
  496. if (match != NULL)
  497. {
  498. size_t offset;
  499. offset = match - fold_text;
  500. match = text + offset;
  501. }
  502. if (!case_sen)
  503. {
  504. g_free (fold_text);
  505. g_free (fold_search);
  506. }
  507. return match;
  508. }
  509. /* --------------------------------------------------------------------------------------------- */
  510. static int
  511. str_8bit_compare (const char *t1, const char *t2)
  512. {
  513. return strcmp (t1, t2);
  514. }
  515. /* --------------------------------------------------------------------------------------------- */
  516. static int
  517. str_8bit_ncompare (const char *t1, const char *t2)
  518. {
  519. return strncmp (t1, t2, MIN (strlen (t1), strlen (t2)));
  520. }
  521. /* --------------------------------------------------------------------------------------------- */
  522. static int
  523. str_8bit_casecmp (const char *s1, const char *s2)
  524. {
  525. /* code from GLib */
  526. #ifdef HAVE_STRCASECMP
  527. g_return_val_if_fail (s1 != NULL, 0);
  528. g_return_val_if_fail (s2 != NULL, 0);
  529. return strcasecmp (s1, s2);
  530. #else
  531. gint c1, c2;
  532. g_return_val_if_fail (s1 != NULL, 0);
  533. g_return_val_if_fail (s2 != NULL, 0);
  534. while (*s1 != '\0' && *s2 != '\0')
  535. {
  536. /* According to A. Cox, some platforms have islower's that
  537. * don't work right on non-uppercase
  538. */
  539. c1 = isupper ((guchar) * s1) ? tolower ((guchar) * s1) : *s1;
  540. c2 = isupper ((guchar) * s2) ? tolower ((guchar) * s2) : *s2;
  541. if (c1 != c2)
  542. return (c1 - c2);
  543. s1++;
  544. s2++;
  545. }
  546. return (((gint) (guchar) * s1) - ((gint) (guchar) * s2));
  547. #endif
  548. }
  549. /* --------------------------------------------------------------------------------------------- */
  550. static int
  551. str_8bit_ncasecmp (const char *s1, const char *s2)
  552. {
  553. size_t n;
  554. g_return_val_if_fail (s1 != NULL, 0);
  555. g_return_val_if_fail (s2 != NULL, 0);
  556. n = MIN (strlen (s1), strlen (s2));
  557. /* code from GLib */
  558. #ifdef HAVE_STRNCASECMP
  559. return strncasecmp (s1, s2, n);
  560. #else
  561. gint c1, c2;
  562. while (n != 0 && *s1 != '\0' && *s2 != '\0')
  563. {
  564. n -= 1;
  565. /* According to A. Cox, some platforms have islower's that
  566. * don't work right on non-uppercase
  567. */
  568. c1 = isupper ((guchar) * s1) ? tolower ((guchar) * s1) : *s1;
  569. c2 = isupper ((guchar) * s2) ? tolower ((guchar) * s2) : *s2;
  570. if (c1 != c2)
  571. return (c1 - c2);
  572. s1++;
  573. s2++;
  574. }
  575. if (n == 0)
  576. return 0;
  577. return (((gint) (guchar) * s1) - ((gint) (guchar) * s2));
  578. #endif
  579. }
  580. /* --------------------------------------------------------------------------------------------- */
  581. static int
  582. str_8bit_prefix (const char *text, const char *prefix)
  583. {
  584. int result;
  585. for (result = 0; text[result] != '\0' && prefix[result] != '\0'
  586. && text[result] == prefix[result]; result++);
  587. return result;
  588. }
  589. /* --------------------------------------------------------------------------------------------- */
  590. static int
  591. str_8bit_caseprefix (const char *text, const char *prefix)
  592. {
  593. int result;
  594. for (result = 0; text[result] != '\0' && prefix[result] != '\0'
  595. && char_toupper (text[result]) == char_toupper (prefix[result]); result++);
  596. return result;
  597. }
  598. /* --------------------------------------------------------------------------------------------- */
  599. static void
  600. str_8bit_fix_string (char *text)
  601. {
  602. (void) text;
  603. }
  604. /* --------------------------------------------------------------------------------------------- */
  605. static char *
  606. str_8bit_create_key (const char *text, gboolean case_sen)
  607. {
  608. return case_sen ? (char *) text : str_8bit_strdown (text);
  609. }
  610. /* --------------------------------------------------------------------------------------------- */
  611. static int
  612. str_8bit_key_collate (const char *t1, const char *t2, gboolean case_sen)
  613. {
  614. return case_sen ? strcmp (t1, t2) : strcoll (t1, t2);
  615. }
  616. /* --------------------------------------------------------------------------------------------- */
  617. static void
  618. str_8bit_release_key (char *key, gboolean case_sen)
  619. {
  620. if (!case_sen)
  621. g_free (key);
  622. }
  623. /* --------------------------------------------------------------------------------------------- */
  624. /*** public functions ****************************************************************************/
  625. /* --------------------------------------------------------------------------------------------- */
  626. struct str_class
  627. str_8bit_init (void)
  628. {
  629. struct str_class result;
  630. result.conv_gerror_message = str_8bit_conv_gerror_message;
  631. result.vfs_convert_to = str_8bit_vfs_convert_to;
  632. result.insert_replace_char = str_8bit_insert_replace_char;
  633. result.is_valid_string = str_8bit_is_valid_string;
  634. result.is_valid_char = str_8bit_is_valid_char;
  635. result.cnext_char = str_8bit_cnext_char;
  636. result.cprev_char = str_8bit_cprev_char;
  637. result.cnext_char_safe = str_8bit_cnext_char;
  638. result.cprev_char_safe = str_8bit_cprev_char;
  639. result.cnext_noncomb_char = str_8bit_cnext_noncomb_char;
  640. result.cprev_noncomb_char = str_8bit_cprev_noncomb_char;
  641. result.char_isspace = str_8bit_isspace;
  642. result.char_ispunct = str_8bit_ispunct;
  643. result.char_isalnum = str_8bit_isalnum;
  644. result.char_isdigit = str_8bit_isdigit;
  645. result.char_isprint = str_8bit_isprint;
  646. result.char_iscombiningmark = str_8bit_iscombiningmark;
  647. result.char_toupper = str_8bit_toupper;
  648. result.char_tolower = str_8bit_tolower;
  649. result.length = str_8bit_length;
  650. result.length2 = str_8bit_length2;
  651. result.length_noncomb = str_8bit_length;
  652. result.fix_string = str_8bit_fix_string;
  653. result.term_form = str_8bit_term_form;
  654. result.fit_to_term = str_8bit_fit_to_term;
  655. result.term_trim = str_8bit_term_trim;
  656. result.term_width2 = str_8bit_term_width2;
  657. result.term_width1 = str_8bit_term_width1;
  658. result.term_char_width = str_8bit_term_char_width;
  659. result.term_substring = str_8bit_term_substring;
  660. result.trunc = str_8bit_trunc;
  661. result.offset_to_pos = str_8bit_offset_to_pos;
  662. result.column_to_pos = str_8bit_column_to_pos;
  663. result.create_search_needle = str_8bit_create_search_needle;
  664. result.release_search_needle = str_8bit_release_search_needle;
  665. result.search_first = str_8bit_search_first;
  666. result.search_last = str_8bit_search_last;
  667. result.compare = str_8bit_compare;
  668. result.ncompare = str_8bit_ncompare;
  669. result.casecmp = str_8bit_casecmp;
  670. result.ncasecmp = str_8bit_ncasecmp;
  671. result.prefix = str_8bit_prefix;
  672. result.caseprefix = str_8bit_caseprefix;
  673. result.create_key = str_8bit_create_key;
  674. result.create_key_for_filename = str_8bit_create_key;
  675. result.key_collate = str_8bit_key_collate;
  676. result.release_key = str_8bit_release_key;
  677. return result;
  678. }
  679. /* --------------------------------------------------------------------------------------------- */