ReactOS 0.4.15-dev-8207-gd73a838
nls_koi8-ru.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/nls.h>
#include <linux/errno.h>
Include dependency graph for nls_koi8-ru.c:

Go to the source code of this file.

Functions

static int uni2char (const wchar_t uni, unsigned char *out, int boundlen)
 
static int char2uni (const unsigned char *rawstring, int boundlen, wchar_t *uni)
 
static int __init init_nls_koi8_ru (void)
 
static void __exit exit_nls_koi8_ru (void)
 

Variables

static struct nls_tablep_nls
 
static struct nls_table table
 

Function Documentation

◆ char2uni()

static int char2uni ( const unsigned char rawstring,
int  boundlen,
wchar_t uni 
)
static

Definition at line 39 of file nls_koi8-ru.c.

41{
42 int n;
43
44 if ((*rawstring & 0xef) != 0xae) {
45 /* koi8-ru and koi8-u differ only on two characters */
46 *uni = (*rawstring & 0x10) ? 0x040e : 0x045e;
47 return 1;
48 }
49
50 n = p_nls->char2uni(rawstring, boundlen, uni);
51 return n;
52}
GLdouble n
Definition: glext.h:7729
static struct nls_table * p_nls
Definition: nls_koi8-ru.c:14

◆ exit_nls_koi8_ru()

static void __exit exit_nls_koi8_ru ( void  )
static

Definition at line 76 of file nls_koi8-ru.c.

77{
80}
void unload_nls(struct nls_table *)
Definition: nls_base.c:240
int unregister_nls(struct nls_table *)
Definition: nls_base.c:185

Referenced by Ext2UnloadAllNls().

◆ init_nls_koi8_ru()

static int __init init_nls_koi8_ru ( void  )
static

Definition at line 63 of file nls_koi8-ru.c.

64{
65 p_nls = load_nls("koi8-u");
66
67 if (p_nls) {
68 table.charset2upper = p_nls->charset2upper;
69 table.charset2lower = p_nls->charset2lower;
70 return register_nls(&table);
71 }
72
73 return -EINVAL;
74}
#define EINVAL
Definition: acclib.h:90
int register_nls(struct nls_table *)
Definition: nls_base.c:162
struct nls_table * load_nls(char *)
Definition: nls_base.c:218

Referenced by Ext2LoadAllNls().

◆ uni2char()

static int uni2char ( const wchar_t  uni,
unsigned char out,
int  boundlen 
)
static

Definition at line 16 of file nls_koi8-ru.c.

18{
19 if (boundlen <= 0)
20 return -ENAMETOOLONG;
21
22 if ((uni & 0xffaf) == 0x040e || (uni & 0xffce) == 0x254c) {
23 /* koi8-ru and koi8-u differ only on two characters */
24 if (uni == 0x040e)
25 out[0] = 0xbe;
26 else if (uni == 0x045e)
27 out[0] = 0xae;
28 else if (uni == 0x255d || uni == 0x256c)
29 return 0;
30 else
31 return p_nls->uni2char(uni, out, boundlen);
32 return 1;
33 }
34 else
35 /* fast path */
36 return p_nls->uni2char(uni, out, boundlen);
37}
static FILE * out
Definition: regtests2xml.c:44
#define ENAMETOOLONG
Definition: errno.h:55

Variable Documentation

◆ p_nls

struct nls_table* p_nls
static

Definition at line 14 of file nls_koi8-ru.c.

Referenced by char2uni(), exit_nls_koi8_ru(), init_nls_koi8_ru(), and uni2char().

◆ table

Initial value:
= {
"koi8-ru",
0,
0, 0,
}
#define THIS_MODULE
Definition: module.h:269
static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
Definition: nls_koi8-ru.c:39
static int uni2char(const wchar_t uni, unsigned char *out, int boundlen)
Definition: nls_koi8-ru.c:16

Definition at line 54 of file nls_koi8-ru.c.