Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

hi_ui_iis_unicode_map.c File Reference

Functions for parsing the unicode map file. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "hi_ui_config.h"
#include "hi_ui_iis_unicode_map.h"
#include "hi_util_xmalloc.h"
#include "hi_return_codes.h"

Go to the source code of this file.

Defines

#define MAX_BUFFER   50000
#define CODEPAGE_SEPARATORS   " \t\n\r"
#define CODEPOINT_SEPARATORS   ": \n\r"

Functions

static int FindCodePage (FILE *fFile, int iCodePage)
static int MapCodePoints (FILE *fFile, int *iis_unicode_map)
int hi_ui_parse_iis_unicode_map (int **iis_unicode_map, char *filename, int iCodePage)


Detailed Description

Functions for parsing the unicode map file.

Author:
Daniel Roelker <droelker@atlas.cs.cuc.edu>
This file contains the routines for parsing generated IIS unicode maps. We read in the map, find where the codepage is located in the map, and convert the codepoint maps, and store in the supplied array.

NOTES

Definition in file hi_ui_iis_unicode_map.c.


Define Documentation

#define CODEPAGE_SEPARATORS   " \t\n\r"
 

Definition at line 32 of file hi_ui_iis_unicode_map.c.

Referenced by FindCodePage(), and MapCodePoints().

#define CODEPOINT_SEPARATORS   ": \n\r"
 

Definition at line 33 of file hi_ui_iis_unicode_map.c.

Referenced by MapCodePoints().

#define MAX_BUFFER   50000
 

Definition at line 31 of file hi_ui_iis_unicode_map.c.

Referenced by FindCodePage().


Function Documentation

static int FindCodePage FILE *  fFile,
int  iCodePage
[static]
 

Locate the codepage mapping the IIS Unicode Map file.

We iterate through the file lines until we get to the codepage reference. We then return that it was found successfully, and the FILE pointer is located on the codepoint mapping line.

Parameters:
fFile the codemap file pointer
iCodePage the codepage number
Returns:
int
Return values:
HI_FATAL_ERR Did not find the codepage listing.
HI_SUCCESS function successful

Definition at line 54 of file hi_ui_iis_unicode_map.c.

References buffer, CODEPAGE_SEPARATORS, HI_FATAL_ERR, HI_SUCCESS, MAX_BUFFER, strtok_r, and strtol().

Referenced by hi_ui_parse_iis_unicode_map().

int hi_ui_parse_iis_unicode_map int **  iis_unicode_map,
char *  filename,
int  iCodePage
 

Parses an IIS Unicode Map file and store in the supplied array.

This routine allocates the necessary memory to store the array values in, and parses the supplied filename.

Parameters:
iis_unicode_map double pointer so we can allocate the memory
filename the name of the file to open and parse
iCodePage the codpage number to read the mappings from
Returns:
integer
Return values:
HI_INVALID ARG invalid argument
HI_MEM_ALLOC_FAIL memory allocation failed
HI_INVALID_FILE Could not open the supplied filename
HI_SUCCESS function was successful

Definition at line 201 of file hi_ui_iis_unicode_map.c.

References FindCodePage(), HI_INVALID_ARG, HI_INVALID_FILE, HI_MEM_ALLOC_FAIL, HI_SUCCESS, HI_UI_NON_ASCII_CODEPOINT, MapCodePoints(), memset, NULL, and xmalloc().

Referenced by ProcessIISUnicodeMap().

static int MapCodePoints FILE *  fFile,
int *  iis_unicode_map
[static]
 

Read the codepoint mapping and covert to codepoint and ASCII.

This is where the bulk of the work is done. We read in 9 bytes at a time because the mappings are in chunks of 8 (+1 for the NULL at the end). The chunks are as follows:

xxxx:xx (the first set of 4 is the codepoint, the second set is the ASCII representation)

We then convert and check these values before storing them in the supplied array.

Parameters:
fFile the unicode map file pointer
iis_unicode_map the array to store the mappings in
Returns:
integer
Return values:
HI_FATAL_ERR there was an error while parsing the file
HI_SUCCESS function was successful

Definition at line 116 of file hi_ui_iis_unicode_map.c.

References buffer, CODEPAGE_SEPARATORS, CODEPOINT_SEPARATORS, HI_FATAL_ERR, HI_SUCCESS, NULL, strtok_r, and strtol().

Referenced by hi_ui_parse_iis_unicode_map().


Generated on Sun May 14 14:51:25 2006 by  doxygen 1.4.2