# dklibs 1.26.0

- Overview
- Download
- Download / Installation
- Installation from source on Windows systems
- Usage
- FAQ
- Change log
- Other projects
- Tutorial
- Developer docu
- stc
- tracecc and trana
- tracecc GUI
- tracecc PDF man.
- API: sort and search
- API: Generic I/O
- Preferences
- File search
- Font configuration
- LaTeX encodings
- Security

- Current version
- Change log

## Current version

The current version number is 1.25.2

## Change log

- 1.26.0
  - Range checks in dkbif_get_...().
    The x and y parameters are checked against the image width and height, 0 is returned for coordinates out of the image.
  - New function dkbif_get_predictor() returning the suggested predictor to use for an image (same as used in the image file).
    At this time this function returns the predictor for TIFF images only.
    For the libpng library I did not (yet) find a way to retrieve the filters used in the image.
- 1.25.2
  - Files Makefile.PL.in in the perlxs projects are converted to Makefile.PL.
    The configure script defines the @includedir@ and @libdir@ macros in the Makefile. These are converted into -DINCLUDEDIR=\"$(includedor)\" compiler options used in the compilation of all programs. One of the programs - rwperlmk - is used by the rwperlmk.sh script which is run from ``make all''.
  - Search for both

        #include <pnm.h>
        #include <netpbm/pnm.h>

    to find the NetPBM header file.
  - If the ``LANG'' environment variable is not set the dkapp module now checks the registry entry ``sLanguage'' in the ``HKCU\Control Panel\International'' registry on Windows systems. The first two characters of the three-letter value are converted to lower case to find the language name.
  - The ``jhelp'' program issues a ``user.language language'' line, to make the users preferred language setting available to Java programs using the PlatformInformation class.
  - Bugfix in the StringTool.java file: Syntax error due to a missing semicolon. Fixed.
- 1.25.1
  Two new classes ``dirk_krause.jtools.application.Printing'' and ``dirk_krause.jtools.webstart.Printing'' having both the method processPrintable(Printable pr); to send a printable object to the print system.
  To switch between normal application code and web-start application code you only have to change the ``application'' or ``webstart'' in the import instruction.
  The processPrintable(Printable pr); method prints on A4 paper, use the processPrintable(Printable pr, double pw, double ph, double x, double y, double w, double h); method instead to specify paper width and height and imageable area.
- 1.25.0
  - New configuration entries ``pfb name'', ``pfb base'', ``ttf name'' and ``ttf base'' for font configuration files to specify names and directories for *.pfb and *.ttf files for a font.
    The functions dkfont_rep_get_pfb_source_name(), dkfont_rep_get_pfb_location(), dkfont_rep_get_ttf_source_name() and dkfont_rep_get_ttf_location() can be used to retrieve this information.
- 1.24.0
  - New library dkfigw added to create Fig files (graphics files as created by XFig and jFig).
    This library can be used from C, a Per XS extension is available too.
- 1.23.2
  - New entry for opening and closing brackets ``['' and ``]'' in the character to LaTeX encoding tables.
- 1.23.1
  - Bugfix: The log file name can use macros, one of them is ``$(temp.dir)''. So we have to wait until the last corrections of the temporary directory name before we can set the log file name.
    In previous versions the log file name was set before the last correction was applied to the temporary directory name. This is fixed now.
- 1.23.0
  - New functions in the dkenc module to convert binary data to ASCII and vice versa. ASCII-Hex, ASCII-85 and reverse ASCII-85 encoding can be used.
  - A new program dkpref was added to retrieve and set preferences.
  - In previous versions the tracecc GUI did not show an error message or a warning if it failed to run the tracecc program. No an error message is shown in the log window.
- 1.22.1
  - Changes in the Makefiles. Directories are only created if they do not yet exist. Files are deleted only if they exist.
    In previous version the exit status of mkdir and rm was simply ignored but some users were irritated by the error messages.
- 1.22.0
  - New functions dkma_fputs_double_no_exp(FILE *f, double d), dkma_fputs_double_str_no_exp(FILE *f, char *s), dkstream_puts_double_no_exp(dk_stream_t *s, double d) and dkstream_puts_double_str_no_exp(dk_stream_t *s, char *t) were added to print double values without exponent notation.
- 1.21.1
  - Typo in dkapp.h corrected, leading to prototype mismatch in compilation.
  - Several changes in the code to avoid compiler warnings (unused variables...).
- 1.21.0
  - Order of appearance of components was changed for some data types while adding doxygene comments.
  - New functions were added to the dkma module to
    - handle unsigned long long values and
    - to calculate greatest common divisor and least common multiple.
  - Dktok module removed, this module was never used by any project. Tests failed.
  - Header files prepared for doxygen to generate documentation.
- 1.20.9
  - New feature in TraceccGUI: The first command line argument can be used to specify a directory name.
  - Program dkwftreg.exe added for Windows to create/remove context menu entries.
- 1.20.8
  - The code for the Tracecc GUI application was reorganized. The classes from dklibsj.jar are inserted into the tracegui.jar file too, so there is only one jar file to handle. A splash screen is shown while the application starts.
- 1.20.7
  - The TraceccGUI application was rewritten, it can handle *.jl files too (the jlayout program is run on these files if available).
- 1.20.6
  - New class PlatformInformation.java to retrieve platform specific information (i.e. file names case-sensitive or case-insensitive).
    An executable program jhelp was added to provide this information.
  - The ApplicationFrame.java class is now an abstract class requiring users to overwrite `void cleanup(boolean isLast)`.
  - Changes in LogContentsForCommand.java: A method `void setDirectory(String d);` was added to choose the directory in which to run the command. The ProcessBuilder class is used to run a command now.
  - Changes in StringTool.java: A methods `int getStartArrayIndex(String[] a, String s);` was added to check whether s starts with one of the strings from a.
  - New feature in the dkbif library: If an input image contains a resolution chunk the dkbif library attempts to guess whether or not the resolution in dpi is 72 (bmeps does not need to do scale operations to process this).
    Some input file formats use dots per centimeter or dots per meter for resolution and save the resolution in integer values. Doing conversions to dots per inch or vice versa and rounding to integers produces small deviations. When reading an input file the resolution is converted to dpi if necessary. If the result is within a reasonable range around 72.0, the result is set to -1.0 to indicate "No resolution specified in the file. Use default value 72.0".
- 1.20.5
  - The text printed by the configure script was updated.
- 1.20.4
  - Bugfix: In the makefiles to build shared library versions there was an hen-and-egg problem: To build the software before installing it we need to run stc. Stc requires libdkc.so and libdkport.so to be installed...
    The build process now uses a special statically linked binary stc-static to build the string tables.
- 1.20.3
  - Bugfix: The makefile templates Makefile.in, Makefile-shared-linux.in and Makefile-shared-solaris-workshop.in were changed to run `./stc` instead of `stc`.
  - Bugfix: The DK_P4() macro in dkproto.h was corrected for compilers not having prototypes.
  - Bugfix: The attempts to install the bmeps-gui script were moved into the makefiles of bmeps. Of course they belong into these.
  - Thanks to Ph. Loewen for the bug reports.
- 1.20.2
  - If tracecc is run on a directory the program attempts to do a chdir() into that directory before processing.
    When running tracecc on a directory, provide the absoulte path name unless the directory is ".".
  - FilenameDropTransferHandler.java changed:
    Different file managers provide different data flavors for drag-and-drop operations. The FilenameDropTransferHandler class now attempts to use flavors having "java.lang.String" assigned as representation class.
  - ColorShowArea.java changed:
    When disabled no actions are taken for mouse clicks, mouse enter and mouse exit.
  - ComponentPositioner.java changed:
    New method correctPosition() to correct a windows position after resizing it.
  - New option "Always show log output" in the TraceccGUI.
    By default the log output is shown on errors/problems only. The new option allows to view log output on success too.
- 1.20.1
  - Trailing slashes/backslashes are removed from directory names when tracecc processes a directory.
    This should allow integration into development IDEs passing the project directory name including a trailing slash/backslash.
  - Changes in the dklibsj Java library:
    The GuiController functionality was reduced to provide two main choices:
    - Use the system look-and-feel (default) or
    - use no specific look-and-feel (the Java-internal look-and-feel).
    As minor choices a user can scale font sizes (recommended only when using the Java-internal look-and-feel) or replace fonts.
  - Cleanup in the dklibsj Java library:
    The classes GbcMaker, CustomizableMetalTheme, PropertyTool and ComponentSizer were removed. (GbcMaker was moved into the TraceGUI project as this is the last project still using this class.)
- 1.20.0
  - Bugfix: The dksf_set_binary() function must use the _setmode() function on Windows systems, not setmode().
  - New function: dksf_fdesk_binary() returns an indicator whether or not the file descriptor was in binary mode before setting binary mode explicitly.
  - Functions removed: dksf_set_binary(), dksf_set_fdesk_binary() and dksf_set_file_binary().
- 1.19.0
  - New library dkappr containing the functions dkapp_rand_begin(), dkapp_rand_bytes(), dkapp_rand_bytes_non_crypto() and dkapp_rand_end().
    This library provides an easy-to-use API for applications to deal with pseudo random number generation. The library does not contain random number generators itself, it accesses PRNGs provided by the system or by other libraries (i.e. OpenSSL). The library checks for available PRNGs and seed sources and chooses the most unpredictable PRNG which is available and can be seeded.
  - Bugfix in the perlxs module DKrause::Application.
    In previous versions the getLogStream() method returned a dk_stream_t directly instead of a dk_stream_wrapper_t. This is fixed now.
- 1.18.0
  - Functions added: dkapp_stdout(), dkapp_stderr() and dkapp_fputs() to print strings to file using codepages.
  - Function added: dkapp_prlen() to find the number of chracters a string uses on screen or in print.
  - Bugfix: Due to an incorrect logical combination of error/no-error conditions the dkenc_utf82bits8() function did never succeed. This is fixed now.
  - Bugfix: Previous versions of stc did not complain if they failed to open the input file for read access. This is fixed now.
  - API change: The dkenc_str_utf82bits8() function has an additional parameter int *ecp; now. This parameter can be either NULL or a pointer to a variable to store an error code.
- 1.17.0 (dklibs-win32-1.2.0)
  - The preferences storage on Windows systems was changed to provide more flexibility and shorter registry entry names (see prefs.html).
  - Documentation improvements.
  - New function dkbif_lic_get() to report the libraries used by the dkbif library.
  - Semantics change in dkapp_open_ext1(): The last parameter specifies, which logging targets to ignore:
    - 0
      Normal logging.
    - DK_APP_LOG_NO_STDOUT
      No logging to stdout.
    - DK_APP_LOG_NO_STDERR
      No logging to stderr.
    - DK_APP_LOG_NO_STDIO ( = DK_APP_LOG_NO_STDOUT | DK_APP_LOG_NO_STDERR)
      No logging to stdout and stderr.
- 1.16.0
  - New feature: function dkof_set_max_line_length() added to set the maximum number of characters in a text line for ASCIIHEX or ASCII85 output.
- 1.15.0
  - If logging to file, stderr or stdout is enabled and logging is configured to print timestamps in separated lines, each time stamp is printed only once. In previous versions a timestamp line was written for each log line. Now only one timestamp line is written for all log lines in the same second.
  - Two new functions were added: dkapp_llmax_get() and dkapp_llmax_set() to retrieve and set the priority of the highest priorized log messages occured.
    This can be used to exclude code sections from error tracking.
- 1.14.3
  - Documentation enhancement: The install.html page now gives examples how to build and install shared libraries and how to build and install the Perl-XS modules.
  - Bugfix: In previous versions the dkl2l module did not contain a replacement string for the tabulator character (0x09).
    This is fixed now, tabulators are passed-through unchanged now.
  - Bugfix: In previous versions the dkl2l module converted simple spaces to non-breaking spaces.
    This is fixed now, spaces are passed-through unchanged now.
- 1.14.2
  - Bugfix: In previous versions the dkbif library only recognized the *.png, *.jpg... as acceptable input file type suffixex, but not *.PNG, *.JPG...
    Programs like bmeps using the dkbif library failed to handle *.PNG, *.JPG... files.
    This is fixed now.
- 1.14.1
  - Bugfix: In previous versions there was a problem in the configure script. If the NetPBM library was found, a variable LIBPNM was set (as the script checks for the pnm.h header file). In a later section a variable LIBNETPBM was checked which was not set during the tests.
    This is fixed now.
- 1.14.0
  - New data types and functions for Perl extensions.
  - Perl extensions in the perlxs directory.
- 1.13.3
  - Bug fix: Some character encodings were wrong in the man pages.
    This is fixed now.
- 1.13.2
  - Bug fix: While developing dksdbi and dksdndbm I temporarily added

        #define DK_HAVE_NDBM_H 1

    to dksdbi.h, I intended to remove the line after adding a test to the configure script. Unfortunately I forgot to remove the line, so the configure script test result was ignored.
    This is fixed now.
- 1.13.1
  - Bug fix: There was a typo in dkbf.h, a prototype for a function dkbif_matrix_get() instead of dkbf_matrix_get().
    This is fixed now.
  - New feature: A class ComponentPositioner was added to dklibsj.jar. The SelfPositioningDialog class now uses ComponentPositioner to place the dialog instead of finding a good place itself.
- 1.13.0
  - New functions for bit matrix handling were added to the dkbf module.
    For square matrices there is a function dkbf_matrix_expand() to find indirect predecessor successor relationships for graph nodes.
- 1.12.1
  - Bug fix: Code for handling JPEG images in dkbifjpg.c is now compiled only if the JPEG library and the header files are found.
- 1.12.0
  - A new library libdkbif was added to read bitmap images files.
- 1.11.2
  - Some Java classes used by the Tracecc GUI are separated into a dklibsj.jar file for later re-use in other projects.
  - The GUI is configurable, the user can choose between different look-and-feels now.
  - The Tracecc GUI was rewritten completely after deciding to use a dklibsj.jar file.
- 1.11.1
  - The Tracecc GUI is a graphical user interface to the tracecc program written in Java. It provides easy access to choose a directory to run tracecc on, to set options and to run tracecc.
- 1.11.0
  - New functions in the dkfont module.
    In former versions only a static mapping of PostScript fonts to GhostScript fonts was possible.
    Now we can use font configuration files for flexible mappings.
- 1.10.0
  - New functions dksf_echo_save(), dksf_echo_restore(), dksf_echo_off(), dksf_echo_test_tty() and dksf_echo_is_tty() added.
- 1.9.2
  - Bug fix: In previous versions tracecc crashed when processing an empty `$!trace-code` line. This is fixed now.
  - The configure script now checks for getsockname() and getpeername().
- 1.9.1
  - Bug fix in the tracecc program.
    Previous versions of tracecc did not handle C++- or Java-style "//" comments properly. This is fixed now.
    The reason was a missing "break" at the end of a "case" instruction list.
- 1.9.0
  - The Makefile to build shared library versions was changed to not run stc for "make all".
    The package is now shipped with pre-build string tables.
    Previous versions did run stc when invoking "make all". When building a shared library version this required to change the shared library search path which in turn required root privileges to build the software. This is no longer necessary.
  - The dkapp module writes preference files only if changes were applied to preferences.
- 1.8.0
  - Automatic encoding completion in stc.
    If string table source files contain only non-UTF-8 encoded strings, the UTF-8 encoded strings are created on the fly for that languages supporting both UTF-8 and non-UTF-8 encoding. If only UTF-8 encoded string values are specified, the non-UTF-8 encoded strings are created on the fly as good as possible (a dot is used for characters for which no backward conversion is possible). See section "Encoding" in the stc overview for details.
  - Bug fix in dkenc.ctr
    There was an error in a bitmask comparison when attempting to convert UTF-8 encoded strings to ISO-LATIN-1. This is fixed now.
  - Bug fix in stc.ctr
    If the same key appeared multiple times in the source files it was added to the container multiple times. This is fixed now.
  - API changes:
    - Argument types changed for dkenc_utf82uc() and dkenc_uc2utf8(), the new prototypes are

          int
          dkenc_utf82uc(dk_udword *ucp, dk_ubyte *u8p, size_t u8l, size_t *u8u);
          size_t  dkenc_uc2utf8(dk_udword c, dk_ubyte *u8p, size_t u8l);

      As we want to count bytes or numbers of doubleword the size_t type is a better choice than int.
    - Two new functions were added to convert strings from 8-bit ASCII to UTF-8 and vice versa:

          char *dkenc_str_utf82bits8(char *s);
          char *dkenc_str_bits82utf8(char *s);

      The functions return pointers to dynamically allocated memory, use dk_delete() to free the memory if the strings are not longer needed.
    - The search order for file search in the dkapp module was changed.
      Using texts (i.e. from string tables) in the wrong encoding may result in problems. So the priorities in file search were changed from language/region/encoding to encoding/language/region.
- 1.7.5
  The configure script checks for the snprintf() function.
- 1.7.4
  - License change: This project uses a BSD-style license now.
  - The settings made during processing a file (i.e. by $(trace-off) are reset at the end of the file.
- 1.7.3
  - The configure script was changed again because it did not find the ranlib program on Mac OS systems.
- 1.7.2
  - Short summary:
    - Bug fix in tracecc: When run on a directory the tracecc program returned an exit code indicating a failure when finding files already up to date. This is fixed now.
  - Details:
    - When running on a directory in make mode the tracecc program compares the modification time stamp of source and destination file and runs a conversion if the destination file is not up to date.
      If the destination file is up to date there is no action necessary, the program can simply indicate success. Previous versions did not set the return code to indicate success. This is fixed now.
- 1.7.1
  - Short summary:
    - Problems with missing invokation of `ranlib` fixed.
    - Configure script searches for the DOS/Windows-specific version of `setmode()`.
  - Details:
    - The ranlib program.
      I was notified that on some systems a simple

          ar <library> <object(s)>

      is not sufficient to build a library, an additional

          ranlib <library>

      is necessary.
      The ranlib commands were added to the Makefile(s).
    - The setmode() function.
      On DOS/Windows systems there is a function

          int setmode(int, int);
          int _setmode(int, int);

      which can be used to force binary mode for a filedeskriptor.
      BSD systems have a function

          void *setmode(const char *);

      which has something to do with converting a file permission string to mode_t settings.
      Simply checking for the presence of a setmode() function in the configure script is not sufficient, a new preprocessor definition HAVE_DOSWIN_SETMODE was added. The configure script tries to compile test code. When building DOS/Windows versions without the configure script the definition is taken from dkconfd.h, it is activated if either __BORLANDC__ is defined or _MSC_VER> 1100. When using other compilers without running the configure script you should set the definition manually.
- 1.7.0
  I was asked to install string tables, documentation and all other platform-independent read-only files to ${prefix}/share instead of ${prefix}/lib.
- 1.6.3
  The configure script checks for setjmp.h and sets DK_HAVE_SETJMP_H.
- 1.6.2
  - Bug fix for Win32 in the dkstream module. On some systems the fputs() function returns the number of bytes written. On other systems this function returns "a nonnegative number" (which might be zero) to indicate success. So we can not use the result of fputs() to keep track of the number of bytes written to the stream.
  - Some new preprocessor definitions indicating the presence of the isatty() and tcgetattr() functions.
- 1.6.1
  - Modifications in the Makefiles to run the stc program silently (No warnings printed).
    When installing the dklibs software for the first time the stc program produced warnings that some string tables can not be found - because we are just building these tables.
    The sequence of progress message "Application starting", warning "String table not found" and progress message "Application finished" was easily misinterpreted as a failure.
    So I changed the Makefile to run stc without producing progress messages and warnings.
- 1.6.0
  Bug-fix, update strongly recommended.
  - Bug fixed in dkstr.ctr.
    The default whitespace set contained the tabulator twice, the carriage return was missing (\t\t instead of \t\r).
    This typo is corrected now.
  - Two new components were added to dk_font_t:
    - gs_alias
      the alias name for the font and
    - gs_actual
      the actual file name used for the font.
    The components can be used to refer to aliases and files in the Ghostscript font distribution.
    The functions

        char * dkfont_get_gs_alias_name(size_t number);
        char * dkfont_get_gs_file_name(size_t number);

    were added to retrieve the components.
- 1.5.0
  Two new functions were added

      char *dkapp_get_source_filename(dk_app_t *a);
      unsigned long dkapp_get_source_lineno(dk_app_t *a);

  to retrieve file name and line number currently used for error reporting.
- 1.4.4
  - A new "Makefile-shared-solaris-workshop" is created by "configure" to build shared libraries on Solaris using the Workshop compiler.
    This makefile is intended only for experienced users, developers and people creating binary installation packages for Linux or LaTeX distributions. The wide majority of users should use the normal "Makefile" as usual.
  - The configure script also checks for stdarg.h and varargs.h. These include files are not needed by dklibs directly but by other packages using the dklibs libraries.
- 1.4.3
  - A new makefile "Makefile-shared-linux" is created by the "configure" script.
    This makefile is intended only for experienced users, developers and people creating binary installation packages for Linux or LaTeX distributions. The wide majority of users should use the normal "Makefile" as usual.
  - A module dkfont was added listing the LaTeX and PS names of the 35 well-known PS fonts in the order as enumerated in the Fig file format specification.
- 1.4.2
  A new filter for PostScript run-length encoding was added to the dkof module.
- 1.4.1
  - Function parameter fileno renamed in the dksf module to suppress warnings about shadowing the function name.
  - Byte-counting for dynamically allocated memory, the functions dkmem_alloc_tracked(size_t nelem, size_t elsize) and dkmem_alloc_get_track(int usehb) were added.
    If there is no DKMEM_NO_TRACK defined, the dk_new() macro uses dkmem_alloc_tracked(). The amount of bytes allocated dynamically can be estimated by

        2^32 * dkmem_alloc_get_track(1) + dkmem_alloc_get_track(0);

    The values must be converted to double as the product might exceed the range of unsigned long numbers.
  - Makefile "makefile.msc" added for VC++.
  - Changes to the all-stt.mak and all-dll.mak files (makefiles for use with VC++ on Win32).
    The /NODEFAULTLIB option was removed from the LINK commands, so the linker also finds functions like read(), not only _read().
    Note: The used libraries (zlib, libbz2...) must be compiled using the "/MT" option (for static versions) or "/MD /GD" (for DLL versions). Otherwise the linker reports conflicts.
- 1.4.0
  A new library dklatsup was introduced containing the dkle module to obtain LaTeX encodings for 32-bit unsigned characters. The code for this module is finished, the conversion data tables still need to be completed.
- 1.3.9 (no public release)
  - The functions
    - char **dkapp_find_key_value(dk_app_t *a, dk_key_value_t *k, size_t s, char *n);
    - void dkapp_init_key_value(dk_app_t *a, dk_key_value_t *k, size_t s, char *n, char **b);
    - int dkapp_get_bool_pref(dk_app_t *a, char *key);
    - unsigned long dkapp_get_ul_pref(dk_app_t *a, char *key);
    - char *dkapp_get_str_pref(dk_app_t *a, char *key);
    - char *dkapp_find_file_dup(ck_app_t *a, char *name);
    - char *dkapp_find_cfg_dup(ck_app_t *a, char *name);
    were added. The dkapp_find_key_value() and dkapp_init_key_value() functions allow easier usage of string tables, dkapp_get_bool_pref(), dkapp_get_bool_pref() and dkapp_get_str_pref() are for easier preference usage.
    The dkapp_find_file_dup() and dkapp_find_cfg_dup() functions search for files and return a pointer to a copy of the full pathname.
  - An example file /etc/appdefaults.sample is installed by "make install". If there is no /etc/appdefaults file yet, the file is installed as /etc/appdefaults too.
  - A preference "/dir/tmp/keep" can be used whether or not to keep the temporary directory when finishing the program. The default is to delete the directory, the preference can be set as boolean or using a message priority. Setting "/dir/tmp/keep"="error" means the temporary directory is removed when exiting unless there was an error message issued using dkapp_log_msg(...,DK_LOG_LEVEL_ERROR,...); or a higher message priority.
- 1.3.8
  In dksf_msfo(), dksf_fopen and dkapp_fopen() we check whether the file to open is a directory.
- 2003/11/19
  Project moved to SourceForge.net.
- ... several changes not recorded in detail
- 1992
  - Project during studies, dealing with sorted storage in AVL trees. Implementation in C++. Decision to avoid this language whenever possible.
  - First version of a trace preprocessor, named xc. After moving from PC to UNIX I was really missing the Turbo-C debugger.
- 1991
  - Project during studies to translate a software from german to english. First thoughts of loading strings from file instead of using compiled-in strings.
  - Some functions to exchange "/" and "\" and vice versa in file names.