strutil8bit.c 23 KB

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