ReactOS 0.4.16-dev-340-g0540c21
nls_cp1251.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_cp1251.c:

Go to the source code of this file.

Functions

static int uni2char (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_cp1251 (void)
 
static void __exit exit_nls_cp1251 (void)
 

Variables

static wchar_t charset2uni [256]
 
static unsigned char page00 [256]
 
static unsigned char page04 [256]
 
static unsigned char page20 [256]
 
static unsigned char page21 [256]
 
static unsigned charpage_uni2charset [256]
 
static unsigned char charset2lower [256]
 
static unsigned char charset2upper [256]
 
static struct nls_table table
 

Function Documentation

◆ char2uni()

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

Definition at line 272 of file nls_cp1251.c.

273{
274 *uni = charset2uni[*rawstring];
275 if (*uni == 0x0000)
276 return -EINVAL;
277 return 1;
278}
#define EINVAL
Definition: acclib.h:90
static wchar_t charset2uni[256]
Definition: nls_cp1251.c:16

◆ exit_nls_cp1251()

static void __exit exit_nls_cp1251 ( void  )
static

Definition at line 295 of file nls_cp1251.c.

296{
298}
int unregister_nls(struct nls_table *)
Definition: nls_base.c:185

Referenced by Ext2UnloadAllNls().

◆ init_nls_cp1251()

static int __init init_nls_cp1251 ( void  )
static

Definition at line 290 of file nls_cp1251.c.

291{
292 return register_nls(&table);
293}
int register_nls(struct nls_table *)
Definition: nls_base.c:162

Referenced by Ext2LoadAllNls().

◆ uni2char()

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

Definition at line 255 of file nls_cp1251.c.

256{
257 unsigned char *uni2charset;
258 unsigned char cl = uni & 0x00ff;
259 unsigned char ch = (uni & 0xff00) >> 8;
260
261 if (boundlen <= 0)
262 return -ENAMETOOLONG;
263
264 uni2charset = page_uni2charset[ch];
265 if (uni2charset && uni2charset[cl])
266 out[0] = uni2charset[cl];
267 else
268 return -EINVAL;
269 return 1;
270}
static unsigned char * page_uni2charset[256]
Definition: nls_cp1251.c:177
static FILE * out
Definition: regtests2xml.c:44
#define ENAMETOOLONG
Definition: errno.h:55

Variable Documentation

◆ charset2lower

unsigned char charset2lower[256]
static

Definition at line 185 of file nls_cp1251.c.

◆ charset2uni

wchar_t charset2uni[256]
static

Definition at line 16 of file nls_cp1251.c.

Referenced by char2uni().

◆ charset2upper

unsigned char charset2upper[256]
static

Definition at line 220 of file nls_cp1251.c.

◆ page00

unsigned char page00[256]
static

Definition at line 99 of file nls_cp1251.c.

◆ page04

unsigned char page04[256]
static
Initial value:
= {
0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf,
0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
0x00, 0xb8, 0x90, 0x83, 0xba, 0xbe, 0xb3, 0xbf,
0xbc, 0x9a, 0x9c, 0x9e, 0x9d, 0x00, 0xa2, 0x9f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00,
}

Definition at line 135 of file nls_cp1251.c.

◆ page20

unsigned char page20[256]
static
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00,
0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00,
0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00,
}

Definition at line 158 of file nls_cp1251.c.

◆ page21

unsigned char page21[256]
static
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00,
}

Definition at line 169 of file nls_cp1251.c.

◆ page_uni2charset

unsigned char* page_uni2charset[256]
static
Initial value:
= {
}
#define NULL
Definition: types.h:112
static unsigned char page21[256]
Definition: nls_cp1251.c:169
static unsigned char page04[256]
Definition: nls_cp1251.c:135
static unsigned char page20[256]
Definition: nls_cp1251.c:158
static unsigned char page00[256]
Definition: nls_cp1251.c:99

Definition at line 177 of file nls_cp1251.c.

Referenced by uni2char().

◆ table

Initial value:
= {
"cp1251",
0,
}
#define THIS_MODULE
Definition: module.h:269
static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
Definition: nls_cp1251.c:272
static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
Definition: nls_cp1251.c:255
static unsigned char charset2lower[256]
Definition: nls_cp1251.c:185
static unsigned char charset2upper[256]
Definition: nls_cp1251.c:220

Definition at line 280 of file nls_cp1251.c.