ReactOS  0.4.14-dev-98-gb0d4763
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 38 of file nls_koi8-ru.c.

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

◆ exit_nls_koi8_ru()

static void __exit exit_nls_koi8_ru ( void  )
static

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

76 {
79 }
int unregister_nls(struct nls_table *)
Definition: nls_base.c:185
static struct nls_table * p_nls
Definition: nls_koi8-ru.c:14
void unload_nls(struct nls_table *)
Definition: nls_base.c:240

◆ init_nls_koi8_ru()

static int __init init_nls_koi8_ru ( void  )
static

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

63 {
64  p_nls = load_nls("koi8-u");
65 
66  if (p_nls) {
67  table.charset2upper = p_nls->charset2upper;
68  table.charset2lower = p_nls->charset2lower;
69  return register_nls(&table);
70  }
71 
72  return -EINVAL;
73 }
static struct nls_table * p_nls
Definition: nls_koi8-ru.c:14
Definition: arc.h:39
int register_nls(struct nls_table *)
Definition: nls_base.c:162
struct nls_table * load_nls(char *)
Definition: nls_base.c:218

◆ 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  return 0xbe;
26  else if (uni == 0x045e)
27  return 0xae;
28  else if (uni == 0x255d || uni == 0x256c)
29  return 0;
30  else
31  return p_nls->uni2char(uni, out, boundlen);
32  }
33  else
34  /* fast path */
35  return p_nls->uni2char(uni, out, boundlen);
36 }
static struct nls_table * p_nls
Definition: nls_koi8-ru.c:14
static FILE * out
Definition: regtests2xml.c:44

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",
}
#define THIS_MODULE
Definition: module.h:267
smooth NULL
Definition: ftsmooth.c:416
static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
Definition: nls_koi8-ru.c:38
static int uni2char(const wchar_t uni, unsigned char *out, int boundlen)
Definition: nls_koi8-ru.c:16

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