Revision: 701 Author: john.boyer@xxxxxxxxxxxxxxxxx Date: Wed Jun 20 09:15:13 2012 Log: lou_getTablePaths ready for testing http://code.google.com/p/liblouis/source/detail?r=701 Modified: /trunk/liblouis/compileTranslationTable.c /trunk/liblouis/liblouis.h.in ======================================= --- /trunk/liblouis/compileTranslationTable.c Tue Jun 19 08:55:23 2012 +++ /trunk/liblouis/compileTranslationTable.c Wed Jun 20 09:15:13 2012 @@ -35,6 +35,7 @@ #include <stdarg.h> #include <string.h> #include <ctype.h> +#include <unistd.h> #include "louis.h" #include "config.h" @@ -188,7 +189,7 @@ if (logFile == NULL && initialLogFileName[0] != 0) logFile = fopen (initialLogFileName, "wb"); if (logFile == NULL); - logFile = stderr; + logFile = stderr; va_start (argp, format); vfprintf (logFile, format, argp); fprintf (logFile, "\n"); @@ -5111,6 +5112,40 @@ * This procedure provides a target for cals that serve as breakpoints * for gdb. */ +char *EXPORT_CALL +lou_getTablePaths () +{ + static char paths[MAXSTRING]; + char *pathList; + strcpy (paths, tablePath); + strcat (paths, ","); + pathList = getenv ("LOUIS_TABLEPATH"); + if (pathList) + { + strcat (paths, pathList); + strcat (paths, ","); + } + pathList = getcwd (scratchBuf, MAXSTRING); + if (pathList) + { + strcat (paths, pathList); + strcat (paths, ","); + } + pathList = lou_getDataPath (); + if (pathList) + { + strcat (paths, pathList); + strcat (paths, ","); + } +#ifdef _WIN32 + strcpy (paths, lou_getProgramPath ()); + strcat (paths, "\\share\\liblouss\\tables\\"); +#else + strcpy (paths, TABLESDIR); +#endif + return paths; +} + void debugHook () { ======================================= --- /trunk/liblouis/liblouis.h.in Wed May 30 10:00:22 2012 +++ /trunk/liblouis/liblouis.h.in Wed Jun 20 09:15:13 2012 @@ -34,7 +34,7 @@ #ifdef _WIN32 #define EXPORT_CALL __stdcall -char * EXPORT_CALL lou_getProgramPath (void); +char * EXPORT_CALL lou_getProgramPath (); #else #define EXPORT_CALL #endif @@ -114,7 +114,7 @@ * ASCII8, and return it as an integer. EOF at end of file. Mode = 1 on * first call, any other value thereafter*/ - void EXPORT_CALL lou_logEnd (void); + void EXPORT_CALL lou_logEnd (); /* Closes the log file so it can be read by other functions. */ void * EXPORT_CALL lou_getTable (const char *tableList); @@ -127,8 +127,16 @@ int EXPORT_CALL lou_compileString (const char *tableList, const char *inString); char * EXPORT_CALL lou_setDataPath (char *path); - char * EXPORT_CALL lou_getDataPath (); - void EXPORT_CALL lou_free (void); + /* Set the path used for searching for tables and liblouisutdml files. + * Overrides the installation path. */ + + char * EXPORT_CALL lou_getDataPath (); + /* Get the path set in the previous function. */ + + char EXPORT_CALL * lou_getTablePaths (); + /* Get a list of paths actually used in seraching for tables*/ + + void EXPORT_CALL lou_free (); /* This function should be called at the end of * the application to free all memory allocated by liblouis. */ For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com