dkle(3) - Linux man page

Name

dkle - Encoding change from 32-bit unsigned char to LaTeX

Synopsis

#include <dkle.h>

dk_le_t *dkle_open(char *dirname);
void          dkle_close(dk_le_t *le);
int           dkle_load(dk_le_t *le, dk_udword uc32);
char         *dkle_get_encoding(dk_le_t *le, dk_udword uc32, int mm);
int           dkle_get_error_code(dk_le_t *le, int res);
unsigned long dkle_get_error_lineno(dk_le_t *le);
char         *dkle_get_filename(dk_le_t *le);

Description

The module converts 32-bit unsigned characters into their LaTeX representation. The LaTeX representation is obtained from data files residing in a directory structure below the directory specified as argument to dkle_open(). To find the encoding for 0x00000004 the file 00/00/00.dat in this directory is inspected. This file contains LaTeX encodings for the characters 0x00000000\ldots 0x000000FF. Data files are saved in a cache in memory, a dk_le_t structure is used for caching.

• dk_le_t *dkle_open(char *dirname);
creates a new dk_le_t structure and prepares it to read data files from the specified directory.
• void dkle_close(dk_le_t *le);
destroys a dk_le_t structure and releases the memory assigned to it.
• int dkle_load(dk_le_t *le, dk_udword uc32);
tries to load a data file containing the encoding for the specified character.
• char *dkle_get_encoding(dk_le_t *le, dk_udword uc32, int mm);
returns the encoding for the specified character. If mm==1 an encoding for mathematics mode is returned, if mm==0 an encoding for text mode is returned.
• int dkle_get_error_code(dk_le_t *le, int res);
returns the error code for the last error occured. If res==1 the internal error code is cleared.
• char *dkle_get_filename(dk_le_t *le);
returns the file name in which the last error occured.
• unsigned long dkle_get_error_lineno(dk_le_t *le);
returns the line number in which the last error occured.

Return Value

Functions returning pointers return a valid pointer on success. A NULL pointer is returned to indicate that no matching character or substring was found.

Functions returning int values return non-0 numbers on success, 0 on errors.

Files

The data files are stored below a directory specified in dkle_open().

Each file may contain encodings for 255 characters.

Each line consists of encoding scope ("m" for mathematical mode, "t" for text mode, "*" for both modes), the hexadecimal representation of the last 8 bits in the character (the first 24 bits are in the directory and file name) and the LaTeX encoding. Here an excerpt from 00/00/00.dat:

# Dollar sign (0x00000024)
* 0x24 \$
t 0x24 \textdollar{}

# Asterisk
t 0x2A \textasteriskcentered{}
m 0x2A *

Author

Dirk Krause

Copyright And License

Copyright © 2001-2008, Dirk Krause All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the
  following disclaimer.

* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the following
  disclaimer in the documentation and/or other materials
  provided with the distribution.

* Neither the name of the Dirk Krause nor the names of
  contributors may be used to endorse or promote products
  derived from this software without specific prior written
  permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .