/* Copyright (C) 2015-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: dk4uc2la.ctr */ #ifndef DK4UC2LA_H_INCLUDED /** Avoid multiple inclusions. */ #define DK4UC2LA_H_INCLUDED 1 #line 10 "dk4uc2la.ctr" /** @file dk4uc2la.h Text to LaTeX conversion. LaTeX sequences to represent a 32 bit character are found in lookup tables in the ${datarootdir}/dktools/charmap directory. The functions in this module read those lookup tables needed, cache the contents and provide LaTeX sequences. After finishing output you can write recommendations (i.e. LaTeX packages to include, font encoding to use) as comments to the file. The functions in this module supported immediate error reporting using the dk4_app_t data type. The functions in the dk4uc2l module support restricted and delayed error reporting using the dk4_er_t module. Functions from the dk4uc2la and dk4uc2l module can be used combined. A typical scenario is to use the dk4uc2l_open_app_ex1() function with la set to 1 to open a conversion structure. This will read all the data files and store all contained LaTeX encodings in memory when opening the structure. Errors - i.e. failed memory allocations or syntax error in data files - are reported immediately. Later the dk4uc2l_find() function can be used. As problematic errors like failed memory allocations are already reported, a NULL return value can only indicate a missing encoding. */ #ifndef DK4CONF_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4conf.h" #else #include #endif #endif #ifndef DK4UC2L_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4uc2l.h" #else #include #endif #endif #ifndef DK4APP_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4app.h" #else #include #endif #endif #ifdef __cplusplus extern "C" { #endif /** Open conversion structure, dynamically allocate memory. Extended version 1. @param dn Directory name containing the data files. @param app Application structure for diagnostics, may be NULL. @param la Flag: Immediately load all data files. @return Pointer to conversion structure on success, NULL on error. Use dk4uc2l_close() to close the conversion structure when done with it. */ dk4_uc2l_t * dk4uc2l_open_app_ex1(const dkChar *dn, dk4_app_t *app, int la); /** Open conversion structure, dynamically allocate memory. @param dn Directory name containing the data files. @param app Application structure for diagnostics, may be NULL. @return Pointer to conversion structure on success, NULL on error. Use dk4uc2l_close() to close the conversion structure when done with it. */ dk4_uc2l_t * dk4uc2l_open_app(const dkChar *dn, dk4_app_t *app); /** Open conversion structure, dynamically allocate memory. Extended version 1. The directory containing the data files is obtained from the application (if not NULL), ${datarootdir}/dktools/charmap is used by default. @param app Application structure for diagnostics, may be NULL. @param la Flag: Immediately load all data files. @return Pointer to conversion structure on success, NULL on error. Use dk4uc2l_close() to close the conversion structure when done with it. */ dk4_uc2l_t * dk4uc2l_open_from_app_ex1(dk4_app_t *app, int la); /** Open conversion structure, dynamically allocate memory. The directory containing the data files is obtained from the application (if not NULL), ${datarootdir}/dktools/charmap is used by default. @param app Application structure for diagnostics, may be NULL. @return Pointer to conversion structure on success, NULL on error. Use dk4uc2l_close() to close the conversion structure when done with it. */ dk4_uc2l_t * dk4uc2l_open_from_app(dk4_app_t *app); /** Find LaTeX encoding for one 32 bit character. Error messages are written using app only for internal errors (like "not enough memory" or syntax errors in data files). No error message is written if no LaTeX encoding was found, writing such error messages is left up to the calling code (as you probably want to restrict the number of such messages). @param ulptr Conversion structure. @param c Character to search encoding for. @param mm Flag: Math mode (1) or text mode (0). @param app Application structure for diagnostics, may be NULL. @return Pointer to encoding string on success, NULL on failure (error or not found). */ const char * dk4uc2l_find_app(dk4_uc2l_t *ulptr, dk4_c32_t c, int mm, dk4_app_t *app); /** Write string of 32 bit characters. @param wstrm Stream to write to. @param ulptr Conversion structure. @param str String to write. @param app Application structure for diagnostics, may be NULL. @return 1 on success, 0 on error. */ int dk4uc2l_string_c32_app( dk4_stream_t *wstrm, dk4_uc2l_t *ulptr, const dk4_c32_t *str, dk4_app_t *app ); /** Write string of 16 bit characters. @param wstrm Stream to write to. @param ulptr Conversion structure. @param str String to write. @param app Application structure for diagnostics, may be NULL. @return 1 on success, 0 on error. */ int dk4uc2l_string_c16_app( dk4_stream_t *wstrm, dk4_uc2l_t *ulptr, const dk4_c16_t *str, dk4_app_t *app ); /** Write UTF-8 encoded string. @param wstrm Stream to write to. @param ulptr Conversion structure. @param str String to write. @param app Application structure for diagnostics, may be NULL. @return 1 on success, 0 on error. */ int dk4uc2l_string_utf8_app( dk4_stream_t *wstrm, dk4_uc2l_t *ulptr, const char *str, dk4_app_t *app ); /** Write ANSI encoded string. @param wstrm Stream to write to. @param ulptr Conversion structure. @param str String to write. @param app Application structure for diagnostics, may be NULL. @return 1 on success, 0 on error. */ int dk4uc2l_string_ansi_app( dk4_stream_t *wstrm, dk4_uc2l_t *ulptr, const char *str, dk4_app_t *app ); /** Write ASCII encoded string. @param wstrm Stream to write to. @param ulptr Conversion structure. @param str String to write. @param app Application structure for diagnostics, may be NULL. @return 1 on success, 0 on error. */ int dk4uc2l_string_ascii_app( dk4_stream_t *wstrm, dk4_uc2l_t *ulptr, const char *str, dk4_app_t *app ); /** Write char string. @param wstrm Stream to write to. @param ulptr Conversion structure. @param str String to write. @param ie Input encoding. @param app Application structure for diagnostics, may be NULL. @return 1 on success, 0 on error. */ int dk4uc2l_string_c8_app( dk4_stream_t *wstrm, dk4_uc2l_t *ulptr, const char *str, int ie, dk4_app_t *app ); /** Write dkChar string. @param wstrm Stream to write to. @param ulptr Conversion structure. @param str String to write. @param ie Input encoding. @param app Application structure for diagnostics, may be NULL. @return 1 on success, 0 on error. */ int dk4uc2l_string_dk_app( dk4_stream_t *wstrm, dk4_uc2l_t *ulptr, const dkChar *str, int ie, dk4_app_t *app ); #ifdef __cplusplus } #endif #endif