blob: c51305f7adb842a6fe56e47519ad75775c651d96 [file] [log] [blame]
Christian Eglibbf00fd2009-11-12 10:02:23 +00001/* liblouis Braille Translation and Back-Translation Library
Eitan Isaacson80be8fd2008-01-16 01:14:49 +00002
Bert Frees312affd2017-09-30 19:49:15 +02003 Based on the Linux screenreader BRLTTY, copyright (C) 1999-2006 by The
4 BRLTTY Team
Eitan Isaacson80be8fd2008-01-16 01:14:49 +00005
Bert Frees312affd2017-09-30 19:49:15 +02006 Copyright (C) 2004, 2005, 2006 ViewPlus Technologies, Inc. www.viewplus.com
7 Copyright (C) 2004, 2005, 2006 JJB Software, Inc. www.jjb-software.com
8 Copyright (C) 2016 Mike Gray, American Printing House for the Blind
9 Copyright (C) 2016 Davy Kager, Dedicon
Eitan Isaacson80be8fd2008-01-16 01:14:49 +000010
Bert Frees312affd2017-09-30 19:49:15 +020011 This file is part of liblouis.
Eitan Isaacson80be8fd2008-01-16 01:14:49 +000012
Bert Frees312affd2017-09-30 19:49:15 +020013 liblouis is free software: you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published
15 by the Free Software Foundation, either version 2.1 of the License, or
16 (at your option) any later version.
Eitan Isaacson80be8fd2008-01-16 01:14:49 +000017
Bert Frees312affd2017-09-30 19:49:15 +020018 liblouis is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
Eitan Isaacson80be8fd2008-01-16 01:14:49 +000022
Bert Frees312affd2017-09-30 19:49:15 +020023 You should have received a copy of the GNU Lesser General Public
24 License along with liblouis. If not, see <http://www.gnu.org/licenses/>.
Christian Eglif6ec6a52016-06-20 10:33:37 +020025*/
Eitan Isaacson80be8fd2008-01-16 01:14:49 +000026
Christian Eglie190f582016-06-30 15:37:29 +020027/**
28 * @file
29 * @brief Public API of liblouis
30 */
31
Eitan Isaacson80be8fd2008-01-16 01:14:49 +000032#ifndef __LIBLOUIS_H_
33#define __LIBLOUIS_H_
34#ifdef __cplusplus
Christian Eglie190f582016-06-30 15:37:29 +020035extern "C" {
36#endif /* __cplusplus */
Eitan Isaacson80be8fd2008-01-16 01:14:49 +000037
Bert Freescde0fec2017-09-30 19:28:51 +020038// clang-format interacts badly with @foo@
39// clang-format off
Mike Gray509cee02015-08-12 19:52:06 -040040typedef @WIDECHAR_TYPE@ widechar;
Bert Freescde0fec2017-09-30 19:28:51 +020041// clang-format on
Mike Gray509cee02015-08-12 19:52:06 -040042typedef unsigned short formtype;
Eitan Isaacson84fd16c2008-05-29 17:38:24 +000043
Davy Kager0eaa2bf2017-04-21 14:59:06 +020044#ifdef _MSC_VER
Bert Frees92a80352017-09-30 23:01:02 +020045#ifdef _EXPORTING
46#define LIBLOUIS_API __declspec(dllexport)
Davy Kager0eaa2bf2017-04-21 14:59:06 +020047#else
Bert Frees92a80352017-09-30 23:01:02 +020048#define LIBLOUIS_API __declspec(dllimport)
49#endif
50#else
51#define LIBLOUIS_API
Davy Kager0eaa2bf2017-04-21 14:59:06 +020052#endif
Reiner Dolpe8afe3c2017-04-21 09:51:05 +010053
54#ifdef __EMSCRIPTEN__
55#include "emscripten.h"
56#define EXPORT_CALL EMSCRIPTEN_KEEPALIVE
57#elif defined(_WIN32)
James Teh115fb832009-02-14 00:47:32 +000058#define EXPORT_CALL __stdcall
Davy Kager0eaa2bf2017-04-21 14:59:06 +020059LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +020060char *EXPORT_CALL
61lou_getProgramPath(void);
James Teh115fb832009-02-14 00:47:32 +000062#else
63#define EXPORT_CALL
64#endif
65
Christian Eglie190f582016-06-30 15:37:29 +020066typedef enum {
Bert Frees92a80352017-09-30 23:01:02 +020067 plain_text = 0x0000,
68 emph_1 = 0x0001,
69 emph_2 = 0x0002,
70 emph_3 = 0x0004,
71 emph_4 = 0x0008,
72 emph_5 = 0x0010,
73 emph_6 = 0x0020,
74 emph_7 = 0x0040,
75 emph_8 = 0x0080,
76 emph_9 = 0x0100,
77 emph_10 = 0x0200,
78 computer_braille = 0x0400,
79 no_translate = 0x0800,
80 no_contract = 0x1000,
81 // SYLLABLE_MARKER_1 0x2000,
82 // SYLLABLE_MARKER_1 0x4000
83 // CAPSEMPH 0x4000
Christian Eglie190f582016-06-30 15:37:29 +020084} typeforms;
Dave Mielkebdb0f5b2017-02-21 13:48:06 -050085
Bert Frees92a80352017-09-30 23:01:02 +020086#define italic emph_1
Dave Mielkebdb0f5b2017-02-21 13:48:06 -050087#define underline emph_2
Bert Frees92a80352017-09-30 23:01:02 +020088#define bold emph_3
Dave Mielkebdb0f5b2017-02-21 13:48:06 -050089
90#define comp_emph_1 emph_1
91#define comp_emph_2 emph_2
92#define comp_emph_3 emph_3
93
94#define EMPH_NAME_BOLD "bold"
95#define EMPH_NAME_ITALIC "italic"
96#define EMPH_NAME_UNDERLINE "underline"
Eitan Isaacson80be8fd2008-01-16 01:14:49 +000097
Christian Eglie190f582016-06-30 15:37:29 +020098typedef enum {
Bert Frees92a80352017-09-30 23:01:02 +020099 noContractions = 1,
100 compbrlAtCursor = 2,
101 dotsIO = 4,
Christian Egli08084a62018-11-22 13:48:43 +0100102 // for historic reasons 8 and 16 are free
Bert Frees92a80352017-09-30 23:01:02 +0200103 compbrlLeftCursor = 32,
104 ucBrl = 64,
Dave Mielked227b782019-07-24 11:02:39 -0400105 noUndefined = 128,
Bert Frees92a80352017-09-30 23:01:02 +0200106 partialTrans = 256
Christian Eglie190f582016-06-30 15:37:29 +0200107} translationModes;
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000108
Dave Mielke4edf6622019-07-24 15:48:48 -0400109#define noUndefinedDots noUndefined
110
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200111LIBLOUIS_API
Dave Mielke1362d522019-08-04 12:51:12 -0400112const char *EXPORT_CALL
Bert Frees92a80352017-09-30 23:01:02 +0200113lou_version(void);
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000114
Christian Eglie190f582016-06-30 15:37:29 +0200115/**
116 * Return the size of widechar
117 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200118LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200119int EXPORT_CALL
120lou_charSize(void);
John Boyer04521882010-07-05 13:29:41 +0000121
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200122LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200123int EXPORT_CALL
124lou_translateString(const char *tableList, const widechar *inbuf, int *inlen,
125 widechar *outbuf, int *outlen, formtype *typeform, char *spacing, int mode);
John Boyer04521882010-07-05 13:29:41 +0000126
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200127LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200128int EXPORT_CALL
129lou_translate(const char *tableList, const widechar *inbuf, int *inlen, widechar *outbuf,
130 int *outlen, formtype *typeform, char *spacing, int *outputPos, int *inputPos,
131 int *cursorPos, int mode);
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000132
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200133LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200134int EXPORT_CALL
135lou_translatePrehyphenated(const char *tableList, const widechar *inbuf, int *inlen,
136 widechar *outbuf, int *outlen, formtype *typeform, char *spacing, int *outputPos,
137 int *inputPos, int *cursorPos, char *inputHyphens, char *outputHyphens, int mode);
Bert Freesb8e51e12012-10-22 12:34:30 +0000138
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200139LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200140int EXPORT_CALL
141lou_hyphenate(
142 const char *tableList, const widechar *inbuf, int inlen, char *hyphens, int mode);
Christian Egli64f63362018-05-25 16:02:26 +0200143
144/**
145 * Convert a string of dot patterns to a string of chars
146 *
147 * @param[in] tableList comma separated list of braille tables
148 * @param[in] inbuf widechar string of dot patterns, either in liblouis format or Unicode
149 * braille
150 * @param[out] outbuf widechar string corresponding to the dot patterns in `inbuf`
151 * @param[in,out] length of both `inbuf` and `outbuf`
152 * @param[in] mode (deprecated)
153 *
154 * @return 1 on success and 0 on failure.
155 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200156LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200157int EXPORT_CALL
158lou_dotsToChar(
159 const char *tableList, widechar *inbuf, widechar *outbuf, int length, int mode);
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200160LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200161int EXPORT_CALL
162lou_charToDots(const char *tableList, const widechar *inbuf, widechar *outbuf, int length,
163 int mode);
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200164LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200165int EXPORT_CALL
166lou_backTranslateString(const char *tableList, const widechar *inbuf, int *inlen,
167 widechar *outbuf, int *outlen, formtype *typeform, char *spacing, int mode);
Bert Freesb8e51e12012-10-22 12:34:30 +0000168
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200169LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200170int EXPORT_CALL
171lou_backTranslate(const char *tableList, const widechar *inbuf, int *inlen,
172 widechar *outbuf, int *outlen, formtype *typeform, char *spacing, int *outputPos,
173 int *inputPos, int *cursorPos, int mode);
Christian Eglie190f582016-06-30 15:37:29 +0200174/**
175 * Print error messages to a file
176 *
177 * @deprecated As of 2.6.0, applications using liblouis should
178 * implement their own logging system.
179 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200180LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200181void EXPORT_CALL
182lou_logPrint(const char *format, ...);
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000183
Christian Eglie190f582016-06-30 15:37:29 +0200184/**
185 * Specify the name of the file to be used by lou_logPrint.
186 *
187 * If it is not used, this file is stderr
Reiner Dolp555590e2017-03-09 20:31:09 +0000188 *
189 * @deprecated As of 2.6.0, applications using liblouis should
190 * implement their own logging system.
Christian Eglie190f582016-06-30 15:37:29 +0200191 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200192LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200193void EXPORT_CALL
194lou_logFile(const char *filename);
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000195
Christian Eglie190f582016-06-30 15:37:29 +0200196/**
Leonard de Ruijter7ba97d92018-09-07 17:04:56 +0200197 * Read a character from a file, whether big-endian, little-endian or ASCII8
Christian Eglie190f582016-06-30 15:37:29 +0200198 *
199 * and return it as an integer. EOF at end of file. Mode = 1 on first
200 * call, any other value thereafter
201 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200202LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200203int EXPORT_CALL
204lou_readCharFromFile(const char *fileName, int *mode);
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000205
Christian Eglie190f582016-06-30 15:37:29 +0200206/**
207 * Close the log file so it can be read by other functions.
Reiner Dolp555590e2017-03-09 20:31:09 +0000208 *
209 * @deprecated As of 2.6.0, applications using liblouis should
210 * implement their own logging system.
Christian Eglie190f582016-06-30 15:37:29 +0200211 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200212LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200213void EXPORT_CALL
214lou_logEnd(void);
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000215
Christian Eglie190f582016-06-30 15:37:29 +0200216/**
217 * Load and compile a translation table
218 *
219 * Check the table for errors. If none are found load the table into
220 * memory and return a pointer to it. If errors are found return a
221 * null pointer. It is called by lou_translateString() and
222 * lou_backTranslateString() and also by functions in liblouisutdml
223 * and by the tools.
224 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200225LIBLOUIS_API
Bert Frees47e69112019-08-22 13:09:36 +0200226const void *EXPORT_CALL
Bert Frees92a80352017-09-30 23:01:02 +0200227lou_getTable(const char *tableList);
John Boyer868abc52010-11-06 07:46:55 +0000228
Christian Eglie190f582016-06-30 15:37:29 +0200229/**
230 * Check a translation table for errors.
231 *
232 * If no errors are found it load the table into memory and returns a
233 * non-zero value. Else the return value is 0.
234 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200235LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200236int EXPORT_CALL
237lou_checkTable(const char *tableList);
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000238
Christian Eglie190f582016-06-30 15:37:29 +0200239/**
240 * Register a new table resolver. Overrides the default resolver. */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200241LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200242void EXPORT_CALL
Christian Eglidd7b2fe2018-09-03 09:35:09 +0200243lou_registerTableResolver(
244 char **(EXPORT_CALL *resolver)(const char *table, const char *base));
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000245
Christian Eglie190f582016-06-30 15:37:29 +0200246/**
247 * Compile a table entry on the fly at run-time
248 *
249 * This function enables you to compile a table entry on the fly at
250 * run-time. The new entry is added to tableList and remains in
251 * force until lou_free() is called. If tableList has not
252 * previously been loaded it is loaded and compiled.
253 *
254 * @param inString contains the table entry to be added. It may be
255 * anything valid. Error messages will be produced if it is invalid.
256 *
257 * @return 1 on success and 0 on failure.
258 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200259LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200260int EXPORT_CALL
261lou_compileString(const char *tableList, const char *inString);
Bert Freesdc97ef72014-02-10 14:26:09 +0000262
Christian Eglie190f582016-06-30 15:37:29 +0200263/**
Davy Kager511d91e2016-07-11 14:15:44 +0200264 * Get the typeform bit for the named emphasis class.
265 *
266 * If the table defines the specified emphasis class the corresponding
267 * typeform is returned. Else the return value is 0.
268 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200269LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200270formtype EXPORT_CALL
271lou_getTypeformForEmphClass(const char *tableList, const char *emphClass);
Davy Kager511d91e2016-07-11 14:15:44 +0200272
273/**
Dave Mielke15e99e02017-02-21 16:41:37 -0500274 * Return the emphasis class names declared in tableList as a
Dave Mielke412b5e02017-02-22 04:32:50 -0500275 * NULL-terminated array of strings. The array is acquired with malloc()
276 * and should be released with free(). The strings must not be released,
277 * and are no longer valid after lou_free() has been called.
Dave Mielke15e99e02017-02-21 16:41:37 -0500278 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200279LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200280char const **EXPORT_CALL
281lou_getEmphClasses(const char *tableList);
Dave Mielke15e99e02017-02-21 16:41:37 -0500282
283/**
Christian Eglie190f582016-06-30 15:37:29 +0200284 * Set the path used for searching for tables and liblouisutdml files.
285 *
Christian Eglif432de32023-02-08 11:18:27 +0100286 * Overrides the installation path. Returns NULL if `path` is NULL or
287 * if the length of `path` is equal or longer than `MAXSTRING`. */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200288LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200289char *EXPORT_CALL
290lou_setDataPath(const char *path);
John Boyer4382c412012-06-20 16:15:13 +0000291
Christian Eglie190f582016-06-30 15:37:29 +0200292/**
293 * Get the path set in the previous function. */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200294LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200295char *EXPORT_CALL
296lou_getDataPath(void);
John Boyer4382c412012-06-20 16:15:13 +0000297
Christian Eglie190f582016-06-30 15:37:29 +0200298typedef enum {
Christian Egli547815d2019-03-04 09:46:51 +0100299 LOU_LOG_ALL = 0,
300 LOU_LOG_DEBUG = 10000,
301 LOU_LOG_INFO = 20000,
302 LOU_LOG_WARN = 30000,
303 LOU_LOG_ERROR = 40000,
304 LOU_LOG_FATAL = 50000,
305 LOU_LOG_OFF = 60000
Christian Eglie190f582016-06-30 15:37:29 +0200306} logLevels;
307
Christian Egliae253552019-11-18 13:11:53 +0100308typedef void(EXPORT_CALL *logcallback)(logLevels level, const char *message);
Christian Egli46ac7242016-07-14 11:48:07 +0200309
310/**
311 * Register logging callbacks
312 * Set to NULL for default callback.
313 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200314LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200315void EXPORT_CALL
316lou_registerLogCallback(logcallback callback);
Christian Egli46ac7242016-07-14 11:48:07 +0200317
Christian Eglie190f582016-06-30 15:37:29 +0200318/**
319 * Set the level for logging callback to be called at
320 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200321LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200322void EXPORT_CALL
323lou_setLogLevel(logLevels level);
Bert Frees111e7022015-02-10 12:57:05 +0100324
Bert Frees6abe33d2019-08-07 22:52:47 +0200325typedef enum { LOU_ROW_BRAILLE = 0X2800 } LOU_UnicodeConstants;
Dave Mielkefca82cb2019-08-04 19:07:20 -0400326
Christian Egli70921972019-06-04 16:33:10 +0200327/* ========================= Sort-of private API ========================= */
328
329/**
330 * Definitions of braille dots
331 */
332typedef enum BrailleDots {
Christian Eglif04d3dc2022-01-13 10:57:30 +0100333 LOU_DOT_1 = 0X01, /** dot 1 */
334 LOU_DOT_2 = 0X02, /** dot 2 */
335 LOU_DOT_3 = 0X04, /** dot 3 */
336 LOU_DOT_4 = 0X08, /** dot 4 */
337 LOU_DOT_5 = 0X10, /** dot 5 */
338 LOU_DOT_6 = 0X20, /** dot 6 */
339 LOU_DOT_7 = 0X40, /** dot 7 */
340 LOU_DOT_8 = 0X80, /** dot 8 */
341 LOU_DOT_9 = 0X100, /** virtual dot 9 */
342 LOU_DOT_10 = 0X200, /** virtual dot A */
343 LOU_DOT_11 = 0X400, /** virtual dot B */
344 LOU_DOT_12 = 0X800, /** virtual dot C */
Christian Egli25a72e42019-06-04 16:53:16 +0200345 LOU_DOT_13 = 0X1000, /** virtual dot D */
346 LOU_DOT_14 = 0X2000, /** virtual dot E */
347 LOU_DOT_15 = 0X4000, /** virtual dot F */
Christian Eglif04d3dc2022-01-13 10:57:30 +0100348 LOU_DOTS = 0X8000 /** if this bit is true, the widechar represents a dot pattern */
Christian Egli70921972019-06-04 16:33:10 +0200349} BrailleDots;
350
Christian Egli25a72e42019-06-04 16:53:16 +0200351/**
Christian Egli56e879e2019-06-12 11:35:34 +0200352 * A sentinel, used in liblouisutdml
Christian Egli25a72e42019-06-04 16:53:16 +0200353 */
Christian Egli70921972019-06-04 16:33:10 +0200354#define LOU_ENDSEGMENT 0xffff
355
Christian Eglie190f582016-06-30 15:37:29 +0200356/**
357 * Parse, analyze and index tables.
358 *
Bert Frees0350ec02017-07-01 14:46:51 +0200359 * This function must be called prior to lou_findTable() and
360 * lou_listTables(). Table names must be provided as a NULL-terminated
361 * array of strings. Each table should resolve to exactly one file. An
362 * error message is given when a table contains invalid or duplicate
Christian Eglie190f582016-06-30 15:37:29 +0200363 * metadata fields.
Bert Frees111e7022015-02-10 12:57:05 +0100364 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200365LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200366void EXPORT_CALL
367lou_indexTables(const char **tables);
Christian Eglie190f582016-06-30 15:37:29 +0200368
369/**
370 * Find the best match for a query.
371 *
Bert Frees0350ec02017-07-01 14:46:51 +0200372 * Returns the name of the table, or NULL when no match can be
373 * found. If lou_indexTables() has not been previously called, the
374 * table search path specified with LOUIS_TABLEPATH will be indexed
375 * first. An error message is given when the query is invalid. Freeing
376 * the memory of the returned string is the responsibility of the
377 * caller.
Bert Frees111e7022015-02-10 12:57:05 +0100378 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200379LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200380char *EXPORT_CALL
381lou_findTable(const char *query);
Bert Frees111e7022015-02-10 12:57:05 +0100382
Bert Frees0350ec02017-07-01 14:46:51 +0200383/**
Bert Frees84f9dbf2017-11-12 22:38:01 +0100384 * Find all matches for a query, best match first.
385 *
386 * Returns the names of the matched table as a NULL-terminated array
387 * of string. If lou_indexTables() has not been previously called, the
388 * table search path specified with LOUIS_TABLEPATH will be indexed
389 * first. An error message is given when the query is invalid. Freeing
390 * the memory of the returned array and strings is the responsibility
391 * of the caller.
392 */
393LIBLOUIS_API
394char **EXPORT_CALL
395lou_findTables(const char *query);
396
397/**
Bert Frees0350ec02017-07-01 14:46:51 +0200398 * Read metadata from a file.
399 *
Bert Freesed315262022-01-13 14:53:05 +0100400 * Returns the value of the first occuring metadata field specified by
401 * `key' in `table', or NULL when the field does not exist. Freeing
402 * the memory of the returned string is the responsibility of the
403 * caller.
Bert Frees0350ec02017-07-01 14:46:51 +0200404 */
405LIBLOUIS_API
Dave Mielke94cd3132019-08-03 21:54:45 -0400406char *EXPORT_CALL
Bert Frees92a80352017-09-30 23:01:02 +0200407lou_getTableInfo(const char *table, const char *key);
Bert Frees0350ec02017-07-01 14:46:51 +0200408
409/**
410 * List available tables.
411 *
412 * Returns the names of available tables as a NULL-terminated array of
413 * strings. Only tables that are discoverable, i.e. the have active
414 * metadata, are listed. If lou_indexTables() has not been previously
415 * called, the table search path specified with LOUIS_TABLEPATH will
416 * be indexed first. Freeing the memory of the returned array and
417 * strings is the responsibility of the caller.
418 */
419LIBLOUIS_API
Dave Mielke94cd3132019-08-03 21:54:45 -0400420char **EXPORT_CALL
Christian Eglie9462e72018-05-08 11:50:02 +0200421lou_listTables(void);
Bert Frees0350ec02017-07-01 14:46:51 +0200422
Christian Eglie190f582016-06-30 15:37:29 +0200423/**
424 * Free all memory allocated by liblouis.
425 *
426 * This function should be called at the end of the application to
427 * free all memory allocated by liblouis.
428 */
Davy Kager0eaa2bf2017-04-21 14:59:06 +0200429LIBLOUIS_API
Bert Frees92a80352017-09-30 23:01:02 +0200430void EXPORT_CALL
431lou_free(void);
Eitan Isaacson80be8fd2008-01-16 01:14:49 +0000432
433#ifdef __cplusplus
434}
Christian Eglie190f582016-06-30 15:37:29 +0200435#endif /* __cplusplus */
436#endif /* __LIBLOUIS_H_ */