File: csutil.hxx

package info (click to toggle)
myspell 1:3.0+pre3.1-24.2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,228 kB
  • ctags: 436
  • sloc: cpp: 5,985; sh: 1,250; ansic: 1,176; makefile: 222; perl: 81
file content (70 lines) | stat: -rw-r--r-- 1,807 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef __CSUTILHXX__
#define __CSUTILHXX__


// First some base level utility routines

// remove end of line char(s)
void   mychomp(char * s);

// duplicate string                          
char * mystrdup(const char * s);

// duplicate reverse of string                   
char * myrevstrdup(const char * s);

// parse into tokens with char delimiter                
char * mystrsep(char ** sptr, const char delim);

// is one string a leading subset of another   
int    isSubset(const char * s1, const char * s2);

// is one reverse string a leading subset of the end of another   
int    isRevSubset(const char * s1, const char * end_of_s2, int s2_len);


// character encoding information

struct cs_info {
  unsigned char ccase;
  unsigned char clower;
  unsigned char cupper;
};


struct enc_entry {
  const char * enc_name;
  struct cs_info * cs_table;
};

// language to encoding default map

struct lang_map {
  const char * lang;
  const char * def_enc;
};

struct cs_info * get_current_cs(const char * es);

const char * get_default_enc(const char * lang);

// convert null terminated string to all caps using encoding 
void enmkallcap(char * d, const char * p, const char * encoding);

// convert null terminated string to all little using encoding
void enmkallsmall(char * d, const char * p, const char * encoding);

// convert null terminated string to have intial capital using encoding
void enmkinitcap(char * d, const char * p, const char * encoding);

// convert null terminated string to all caps 
void mkallcap(char * p, const struct cs_info * csconv);

// convert null terminated string to all little
void mkallsmall(char * p, const struct cs_info * csconv);

// convert null terminated string to have intial capital
void mkinitcap(char * p, const struct cs_info * csconv);


#endif