Home | History | Annotate | Download | only in hyphenation
      1 #ifndef __CSUTILHXX__
      2 #define __CSUTILHXX__
      3 
      4 
      5 /* First some base level utility routines */
      6 
      7 /* remove end of line char(s) */
      8 void   mychomp(char * s);
      9 
     10 /* duplicate string  */
     11 char * mystrdup(const char * s);
     12 
     13 /* parse into tokens with char delimiter */
     14 char * mystrsep(char ** sptr, const char delim);
     15 
     16 
     17 /* character encoding information */
     18 
     19 struct cs_info {
     20   unsigned char ccase;
     21   unsigned char clower;
     22   unsigned char cupper;
     23 };
     24 
     25 
     26 struct enc_entry {
     27   const char * enc_name;
     28   struct cs_info * cs_table;
     29 };
     30 
     31 /* language to encoding default map */
     32 
     33 struct lang_map {
     34   const char * lang;
     35   const char * def_enc;
     36 };
     37 
     38 struct cs_info * get_current_cs(const char * es);
     39 
     40 const char * get_default_enc(const char * lang);
     41 
     42 /* convert null terminated string to all caps using encoding  */
     43 void enmkallcap(char * d, const char * p, const char * encoding);
     44 
     45 /* convert null terminated string to all little using encoding */
     46 void enmkallsmall(char * d, const char * p, const char * encoding);
     47 
     48 /* convert null terminated string to have intial capital using encoding */
     49 void enmkinitcap(char * d, const char * p, const char * encoding);
     50 
     51 /* convert null terminated string to all caps  */
     52 void mkallcap(char * p, const struct cs_info * csconv);
     53 
     54 /* convert null terminated string to all little */
     55 void mkallsmall(char * p, const struct cs_info * csconv);
     56 
     57 /* convert null terminated string to have intial capital */
     58 void mkinitcap(char * p, const struct cs_info * csconv);
     59 
     60 
     61 #endif
     62