summaryrefslogtreecommitdiff
path: root/support/dktools/dk3wxs.cpt
diff options
context:
space:
mode:
Diffstat (limited to 'support/dktools/dk3wxs.cpt')
-rw-r--r--support/dktools/dk3wxs.cpt1240
1 files changed, 0 insertions, 1240 deletions
diff --git a/support/dktools/dk3wxs.cpt b/support/dktools/dk3wxs.cpt
deleted file mode 100644
index 975901e62b..0000000000
--- a/support/dktools/dk3wxs.cpt
+++ /dev/null
@@ -1,1240 +0,0 @@
-%% options
-
-copyright owner = Dirk Krause
-copyright year = 2011-xxxx
-SPDX-License-Identifier: BSD-3-Clause
-
-
-%% header
-
-#ifdef DK3_USE_WX
-#undef DK3_USE_WX
-#endif
-/** Use wxWidgets libraries to build GUI programs.
-*/
-#define DK3_USE_WX 1
-
-
-#if 0
-#include <dk3all.h>
-#else
-#include <dk3conf.h>
-#include <dk3types.h>
-#include <dk3const.h>
-#endif
-
-
-#ifndef WX_WXPREC_H_INCLUDED
-#include <wx/wxprec.h>
-#define WX_WXPREC_H_INCLUDED 1
-#endif
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-#ifndef WX_PRECOMP
-#if DK4_HAVE_WX_CHARTYPE_H
-#if DK4_HAVE_WX_DEFS_H
-#ifndef WX_DEFS_H_INCLUDED
-#include <wx/defs.h>
-#define WX_DEFS_H_INCLUDED
-#endif
-#endif
-#ifndef WX_CHARTYPE_H_INCLUDED
-#include <wx/chartype.h>
-#define WX_CHARTYPE_H_INCLUDED 1
-#endif
-#else
-#if DK4_HAVE_WX_WXCHAR_H
-#if DK4_HAVE_WX_DEFS_H
-#ifndef WX_DEFS_H_INCLUDED
-#include <wx/defs.h>
-#define WX_DEFS_H_INCLUDED
-#endif
-#endif
-#ifndef WX_WXCHAR_H_INCLUDED
-#include <wx/wxchar.h>
-#define WX_WXCHAR_H_INCLUDED 1
-#endif
-#else
-#ifndef WX_WX_H_INCLUDED
-#include <wx/wx.h>
-#define WX_WX_H_INCLUDED
-#endif
-#endif
-#endif
-#endif
-
-
-/** Pointer to wxChar string.
-*/
-typedef wxChar *DK3_PWXCHAR;
-
-/** Pointer to constant wxChar string.
-*/
-typedef wxChar const *DK3_PCWXCHAR;
-
-
-#if DK3_ON_WINDOWS || DK3_HAVE_BACKSLASH
-/** File name separator.
-*/
-#define DK3_WX_CHAR_SEP wxT('\\')
-#else
-/** File name separator.
-*/
-#define DK3_WX_CHAR_SEP wxT('/')
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Copy string.
- * @param d Destination pointer.
- * @param s Source pointer.
- */
-void
-dk3wxs_cpy(wxChar *d, wxChar const *s);
-
-/** Copy string, cut to buffer size if necessary.
- * @param d Destination pointer.
- * @param s Source pointer.
- * @param n Size of \a d (number of characters).
- */
-void
-dk3wxs_ncpy(wxChar *d, wxChar const *s, size_t n);
-
-/** Concatenate two strings.
- * @param d Destination pointer.
- * @param s Source pointer.
- */
-void
-dk3wxs_cat(wxChar *d, wxChar const *s);
-
-/** Convert to lower-case character.
- * @param c Character to convert.
- * @return Conversion result.
- */
-wxChar
-dk3wxs_tolower(wxChar c);
-
-/** Convert to upper-case character.
- * @param c Character to convert.
- * @return Conversion result.
- */
-wxChar
-dk3wxs_toupper(wxChar c);
-
-/** Find left-most orrucance of character in string.
- * @param s String probably containing the character.
- * @param c Character to search for.
- * @return Pointer to character position on success, NULL on error.
- */
-wxChar *
-dk3wxs_chr(wxChar const *s, wxChar c);
-
-/** Find right-most orrucance of character in string.
- * @param s String probably containing the character.
- * @param c Character to search for.
- * @return Pointer to character position on success, NULL on error.
- */
-wxChar *
-dk3wxs_rchr(wxChar const *s, wxChar c);
-
-/** Calculate string length.
- * @param s String to process.
- * @return String length (number of characters).
- */
-size_t
-dk3wxs_len(wxChar const *s);
-
-/** Duplicate string into dynamically allocated memory.
- * Use dk3_delete() to release the memory when done.
- * @param s String to duplicate.
- * @return Pointer to new string on success, NULL on error.
- */
-wxChar *
-dk3wxs_dup(wxChar const *s);
-
-/** Duplicate string into dynamically allocated memory.
- * Use dk3_delete() to release the memory when done.
- * @param s String to duplicate.
- * @param app Application structure for diagnostics, may be NULL.
- * @return Pointer to new string on success, NULL on error.
- */
-wxChar *
-dk3wxs_dup_app(wxChar const *s, dk3_app_t *app);
-
-/** Compare two strings, use only the first \a n characters.
- * @param l Left side string.
- * @param r Right side string.
- * @param n Number of characters to use in comparison.
- * @return 1 for l>r, 0 for l=r, -1 for l<r.
- */
-int
-dk3wxs_ncmp(wxChar const *l, wxChar const *r, size_t n);
-
-/** Compare two strings.
- * @param l Left side string.
- * @param r Right side string.
- * @return 1 for l>r, 0 for l=r, -1 for l<r.
- */
-int
-dk3wxs_cmp(wxChar const *l, wxChar const *r);
-
-/** Case-insensitve string comparison.
- * @param l Left side string.
- * @param r Right side string.
- * @return 1 for l>r, 0 for l=r, -1 for l<r.
- */
-int
-dk3wxs_casecmp(wxChar const *l, wxChar const *r);
-
-/** Find index of a string in an array of patterns.
- * @param a Patterns array.
- * @param s String to find.
- * @param c Flag: Case-sensitive (1) or not (0).
- * @return Index of \a s in \a a on success, -1 on error (not found).
- */
-int
-dk3wxs_array_index(wxChar const * const *a, wxChar const *s, int c);
-
-/** Find file name suffix.
- @param s File name.
- @return Pointer to suffix (pointer to the dot) or NULL.
-*/
-wxChar *
-dk3wxs_get_suffix(wxChar const *s);
-
-/** Find start of string (first non-whitespace).
- * @param s String to process.
- * @param whsp Whitespaces set (use NULL for default whitespace set).
- * @return Pointer to first non-whitespace on success, NULL on error.
- */
-wxChar *
-dk3wxs_start(wxChar *s, wxChar const *whsp);
-
-/** Find start of second text
- * @param s String to process.
- * @param whsp Whitespaces set (use NULL for default whitespace set).
- * @return Pointer to second non-whitespace sequence on success, or NULL.
- */
-wxChar *
-dk3wxs_next(wxChar *s, wxChar const *whsp);
-
-/** Check whether the text represents a boolean value.
- * @param s Text to process.
- * @return 1 on success, 0 on error.
- */
-int
-dk3wxs_is_bool(wxChar const *s);
-
-/** Check whether the text represents the boolean value "true".
- * @param s Text to process.
- * @return 1 on success, 0 on error.
- */
-int
-dk3wxs_is_on(wxChar const *s);
-
-/** Explode a string (split string into array of text words).
- @param array Destination pointers array.
- @param sz Size of \a array (number of elements).
- @param s String to process.
- @param whsp Whitespaces set (may be NULL).
- @return Number of elements set in \a array, 0 on error.
-*/
-size_t
-dk3wxs_explode(wxChar **array, size_t sz, wxChar *s, wxChar const *whsp);
-
-/** Normalize text line.
- @param l Text line to modify.
- @param w Whitespaces set (may be NULL).
- @param c Separator character.
-*/
-void
-dk3wxs_normalize(wxChar *l, wxChar const *w, wxChar c);
-
-/** Check whether a file/directory name is an absolute path.
- * @param n Name to check.
- * @return 1 for absolute path, 0 otherwise.
- */
-int
-dk3wxs_is_abs_path(wxChar const *n);
-
-/** Append path to a given directory.
- * @param d In: directory, out: modified path.
- * @param sz Destination buffer size (number of characters).
- * @param n Path name to append.
- * @return 1 on success, 0 on errors.
- */
-int
-dk3wxs_append_path(wxChar *d, size_t sz, wxChar const *n);
-
-/** Correct file name.
- * @param n File name to correct.
- */
-void
-dk3wxs_correct_filename(wxChar *n);
-
-/** Convert UTF-8 string to wxChar string.
- * @param d Destination buffer.
- * @param sz Size of \a d (number of wxChar).
- * @param s Source string.
- * @return 1 on success, 0 on error.
- */
-int
-dk3wxs_from_utf8(wxChar *d, size_t sz, char const *s);
-
-/** Convert ASCII string to wxChar string.
- * @param d Destination buffer.
- * @param sz Size of \a d (number of wxChar).
- * @param s Source string.
- * @return 1 on success, 0 on error.
- */
-int
-dk3wxs_from_plain(wxChar *d, size_t sz, char const *s);
-
-/** Convert UTF-16 string to wxChar string.
- * @param d Destination buffer.
- * @param sz Size of \a d (number of wxChar).
- * @param s Source string.
- * @return 1 on success, 0 on error.
- */
-int
-dk3wxs_from_utf16(wxChar *d, size_t sz, dk3_c16_t const *s);
-
-/** Convert dkChar string to wxChar string.
- * @param dp Destination buffer pointer.
- * @param sz Size of \a dp (number of wxChar).
- * @param wxe Encoding for wxChar string (for 8-bit wxChar only).
- * @param src Source string.
- * @param dke Encoding for dkChar string (for 8-bit dkChar only).
- * @return 1 on success, 0 on error.
- */
-int
-dk3wxs_from_dkstr(wxChar *dp, size_t sz, int wxe, dkChar const *src, int dke);
-
-/** Convert wxChar string to dkChar string.
- * @param dp Destination buffer pointer.
- * @param sz Size of \a dp (number of dkChar).
- * @param dke Encoding for dkChar string (used for 8-bit dkChar only).
- * @param src Source string.
- * @param wxe Encoding for wxChar string (used for 8-bit wxChar only).
- * @return 1 on success, 0 on error.
- */
-int
-dk3wxs_to_dkstr(dkChar *dp, size_t sz, int dke, wxChar const *src, int wxe);
-
-/** Convert wxChar string to 8-bit char string.
- * @param dp Destination buffer pointer.
- * @param sz Size of \a dp.
- * @param c8e Encoding for char string.
- * @param src Source string.
- * @param wxe Encoding for wxChar string (used for 8-bit wxChar only).
- * @return 1 on success, 0 on error.
- */
-int
-dk3wxs_to_c8(char *dp, size_t sz, int c8e, wxChar const *src, int wxe);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-%% module
-
-#ifdef DK3_USE_WX
-#undef DK3_USE_WX
-#endif
-/** Use wxWidgets libraries to build GUI programs.
-*/
-#define DK3_USE_WX 1
-
-#include <dk3all.h>
-#include "dk3wxs.h"
-#include "dk3wxcs.h"
-
-
-
-$!trace-include
-
-
-void
-dk3wxs_cpy(wxChar *d, wxChar const *s)
-{
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- dk3str_c32_cpy((dk3_c32_t *)d, (const dk3_c32_t *)s);
-#else
- dk3str_c16_cpy((dk3_c16_t *)d, (const dk3_c16_t *)s);
-#endif
-#else
- dk3str_c8_cpy((char *)d, (const char *)s);
-#endif
-}
-
-wxChar *
-dk3wxs_get_suffix(wxChar const *s)
-{
- wxChar *back = NULL;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = (wxChar *)dk3str_c32_get_suffix((const dk3_c32_t *)s);
-#else
- back = (wxChar *)dk3str_c16_get_suffix((const dk3_c16_t *)s);
-#endif
-#else
- back = (wxChar *)dk3str_c8_get_suffix((const char *)s);
-#endif
- return back;
-}
-
-void
-dk3wxs_ncpy(wxChar *d, wxChar const *s, size_t n)
-{
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- dk3str_c32_ncpy((dk3_c32_t *)d, (const dk3_c32_t *)s, n);
-#else
- dk3str_c16_ncpy((dk3_c16_t *)d, (const dk3_c16_t *)s, n);
-#endif
-#else
- dk3str_c8_ncpy((char *)d, (const char *)s, n);
-#endif
-}
-
-void
-dk3wxs_cat(wxChar *d, wxChar const *s)
-{
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- dk3str_c32_cat((dk3_c32_t *)d, (const dk3_c32_t *)s);
-#else
- dk3str_c16_cat((dk3_c16_t *)d, (const dk3_c16_t *)s);
-#endif
-#else
- dk3str_c8_cat((char *)d, (const char *)s);
-#endif
-}
-
-wxChar
-dk3wxs_tolower(wxChar c)
-{
- wxChar back;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_tolower((dk3_c32_t)c);
-#else
- back = dk3str_c16_tolower((dk3_c16_t)c);
-#endif
-#else
- back = dk3str_c8_tolower((char)c);
-#endif
- return back;
-}
-
-wxChar
-dk3wxs_toupper(wxChar c)
-{
- wxChar back;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_toupper((dk3_c32_t)c);
-#else
- back = dk3str_c16_toupper((dk3_c16_t)c);
-#endif
-#else
- back = dk3str_c8_toupper((char)c);
-#endif
- return back;
-}
-
-wxChar *
-dk3wxs_chr(wxChar const *s, wxChar c)
-{
- wxChar *back = NULL;
- if(s) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = (wxChar *)dk3str_c32_chr((const dk3_c32_t *)s, (dk3_c32_t)c);
-#else
- back = (wxChar *)dk3str_c16_chr((const dk3_c16_t *)s, (dk3_c16_t)c);
-#endif
-#else
- back = (wxChar *)dk3str_c8_chr((const char *)s, (char)c);
-#endif
- }
- return back;
-}
-
-wxChar *
-dk3wxs_rchr(wxChar const *s, wxChar c)
-{
- wxChar *back = NULL;
- if(s) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = (wxChar *)dk3str_c32_rchr((const dk3_c32_t *)s, (dk3_c32_t)c);
-#else
- back = (wxChar *)dk3str_c16_rchr((const dk3_c16_t *)s, (dk3_c16_t)c);
-#endif
-#else
- back = (wxChar *)dk3str_c8_rchr((const char *)s, (char)c);
-#endif
- }
- return back;
-}
-
-size_t
-dk3wxs_len(wxChar const *s)
-{
- size_t back = 0;
- if(s) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_len((const dk3_c32_t *)s);
-#else
- back = dk3str_c16_len((const dk3_c16_t *)s);
-#endif
-#else
- back = dk3str_c8_len((const char *)s);
-#endif
- }
- return back;
-}
-
-wxChar *
-dk3wxs_dup_app(wxChar const *s, dk3_app_t *app)
-{
- wxChar *back = NULL;
- if(s) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = (wxChar *)dk3str_c32_dup_app((const dk3_c32_t *)s, app);
-#else
- back = (wxChar *)dk3str_c16_dup_app((const dk3_c16_t *)s, app);
-#endif
-#else
- back = (wxChar *)dk3str_c8_dup_app((const char *)s, app);
-#endif
- }
- return back;
-}
-
-wxChar *
-dk3wxs_dup(wxChar const *s)
-{
- wxChar *back = NULL;
- if(s) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = (wxChar *)dk3str_c32_dup_app((const dk3_c32_t *)s, NULL);
-#else
- back = (wxChar *)dk3str_c16_dup_app((const dk3_c16_t *)s, NULL);
-#endif
-#else
- back = (wxChar *)dk3str_c8_dup_app((const char *)s, NULL);
-#endif
- }
- return back;
-}
-
-int
-dk3wxs_ncmp(wxChar const *l, wxChar const *r, size_t n)
-{
- int back = 0;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_ncmp((const dk3_c32_t *)l, (const dk3_c32_t *)r, n);
-#else
- back = dk3str_c16_ncmp((const dk3_c16_t *)l, (const dk3_c16_t *)r, n);
-#endif
-#else
- back = dk3str_c8_ncmp((const char *)l, (const char *)r, n);
-#endif
- return back;
-}
-
-int
-dk3wxs_cmp(wxChar const *l, wxChar const *r)
-{
- int back = 0;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_cmp((const dk3_c32_t *)l, (const dk3_c32_t *)r);
-#else
- back = dk3str_c16_cmp((const dk3_c16_t *)l, (const dk3_c16_t *)r);
-#endif
-#else
- back = dk3str_c8_cmp((const char *)l, (const char *)r);
-#endif
- return back;
-}
-
-int
-dk3wxs_casecmp(wxChar const *l, wxChar const *r)
-{
- int back = 0;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_casecmp((const dk3_c32_t *)l, (const dk3_c32_t *)r);
-#else
- back = dk3str_c16_casecmp((const dk3_c16_t *)l, (const dk3_c16_t *)r);
-#endif
-#else
- back = dk3str_c8_casecmp((const char *)l, (const char *)r);
-#endif
- return back;
-}
-
-int
-dk3wxs_array_index(wxChar const * const *a, wxChar const *s, int c)
-{
- int back = -1;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_array_index(
- (const dk3_c32_t * const *)a, (const dk3_c32_t *)s, c
- );
-#else
- back = dk3str_c16_array_index(
- (const dk3_c16_t * const *)a, (const dk3_c16_t *)s, c
- );
-#endif
-#else
- back = dk3str_c8_array_index((const char * const *)a, (const char *)s, c);
-#endif
- return back;
-}
-
-wxChar *
-dk3wxs_start(wxChar *s, wxChar const *whsp)
-{
- wxChar *back = NULL;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = (wxChar *)dk3str_c32_start((dk3_c32_t *)s, (const dk3_c32_t *)whsp);
-#else
- back = (wxChar *)dk3str_c16_start((dk3_c16_t *)s, (const dk3_c16_t *)whsp);
-#endif
-#else
- back = (wxChar *)dk3str_c8_start((char *)s, (const char *)whsp);
-#endif
- return back;
-}
-
-wxChar *
-dk3wxs_next(wxChar *s, wxChar const *whsp)
-{
- wxChar *back = NULL;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = (wxChar *)dk3str_c32_next((dk3_c32_t *)s, (const dk3_c32_t *)whsp);
-#else
- back = (wxChar *)dk3str_c16_next((dk3_c16_t *)s, (const dk3_c16_t *)whsp);
-#endif
-#else
- back = (wxChar *)dk3str_c8_next((char *)s, (const char *)whsp);
-#endif
- return back;
-}
-
-int
-dk3wxs_is_bool(wxChar const *s)
-{
- int back = 0;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_is_bool((const dk3_c32_t *)s);
-#else
- back = dk3str_c16_is_bool((const dk3_c16_t *)s);
-#endif
-#else
- back = dk3str_c8_is_bool((const char *)s);
-#endif
- return back;
-}
-
-int
-dk3wxs_is_on(wxChar const *s)
-{
- int back = 0;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_is_on((const dk3_c32_t *)s);
-#else
- back = dk3str_c16_is_on((const dk3_c16_t *)s);
-#endif
-#else
- back = dk3str_c8_is_on((const char *)s);
-#endif
- return back;
-}
-
-size_t
-dk3wxs_explode(wxChar **array, size_t sz, wxChar *s, wxChar const *whsp)
-{
- size_t back;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_explode(
- (dk3_c32_t **)array, sz, (dk3_c32_t *)s, (const dk3_c32_t *)whsp
- );
-#else
- back = dk3str_c16_explode(
- (dk3_c16_t **)array, sz, (dk3_c16_t *)s, (const dk3_c16_t *)whsp
- );
-#endif
-#else
- back = dk3str_c8_explode(
- (char **)array, sz, (char *)s, (const char *)whsp
- );
-#endif
- return back;
-}
-
-void
-dk3wxs_normalize(wxChar *l, wxChar const *w, wxChar c)
-{
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- dk3str_c32_normalize((dk3_c32_t *)l, (const dk3_c32_t *)w, (dk3_c32_t)c);
-#else
- dk3str_c16_normalize((dk3_c16_t *)l, (const dk3_c16_t *)w, (dk3_c16_t)c);
-#endif
-#else
- dk3str_c8_normalize((char *)l, (const char *)w, (char)c);
-#endif
-}
-
-
-int
-dk3wxs_is_abs_path(wxChar const *n)
-{
- int back = 0;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_is_abs_path((const dk3_c32_t *)n);
-#else
- back = dk3str_c16_is_abs_path((const dk3_c16_t *)n);
-#endif
-#else
- back = dk3str_c8_is_abs_path((const char *)n);
-#endif
- return back;
-}
-
-int
-dk3wxs_append_path(wxChar *d, size_t sz, wxChar const *n)
-{
- int back = 0;
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- back = dk3str_c32_append_path_app(
- (dk3_c32_t *)d, sz, (const dk3_c32_t *)n, NULL
- );
-#else
- back = dk3str_c16_append_path_app(
- (dk3_c16_t *)d, sz, (const dk3_c16_t *)n, NULL
- );
-#endif
-#else
- back = dk3str_c8_append_path_app((char *)d, sz, (const char *)n, NULL);
-#endif
- return back;
-}
-
-void
-dk3wxs_correct_filename(wxChar *n)
-{
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- dk3str_c32_correct_filename((dk3_c32_t *)n);
-#else
- dk3str_c16_correct_filename((dk3_c16_t *)n);
-#endif
-#else
- dk3str_c8_correct_filename((char *)n);
-#endif
-}
-
-
-int
-dk3wxs_from_utf8(wxChar *d, size_t sz, char const *s)
-{
- int back = 0;
- $? "+ dk3wxs_from_utf8 %u \"%!8s\"", (unsigned)sz, s
- if((d) && (sz) && (s)) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- $? ". 32 bit"
- if(sz >= dk3str_cnvsz_c8u_to_c32_app(s, NULL)) {
- $? ". size ok"
- back = dk3str_cnv_c8u_to_c32_app( (dk3_c32_t *)d, sz, s, NULL);
- }
-#else
- $? ". 16 bit"
- if(sz >= dk3str_cnvsz_c8u_to_c16_app(s, NULL)) {
- $? ". size ok"
- back = dk3str_cnv_c8u_to_c16_app( (dk3_c16_t *)d, sz, s, NULL);
- }
-#endif
-#else
- $? ". 8 bit"
- if(sz >= dk3str_cnvsz_c8u_to_c8p_app(s, NULL)) {
- $? ". size ok"
- back = dk3str_cnv_c8u_to_c8p_app((char *)d, sz, s, NULL);
- }
-#endif
- } $? "- dk3wxs_from_utf8 %d", back
- return back;
-}
-
-
-int
-dk3wxs_from_plain(wxChar *d, size_t sz, char const *s)
-{
- int back = 0;
- if((d) && (sz) && (s)) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- if(sz >= dk3str_cnvsz_c8p_to_c32_app(s, NULL)) {
- back = dk3str_cnv_c8p_to_c32_app((dk3_c32_t *)d, sz, s, NULL);
- }
-#else
- if(sz >= dk3str_cnvsz_c8p_to_c16_app(s, NULL)) {
- back = dk3str_cnv_c8p_to_c16_app((dk3_c16_t *)d, sz, s, NULL);
- }
-#endif
-#else
- if(sz >= dk3str_c8_len(s)) {
- dk3str_c8_cpy((char *)d, s);
- back = 1;
- }
-#endif
- }
- return back;
-}
-
-
-
-
-int
-dk3wxs_from_utf16(wxChar *d, size_t sz, dk3_c16_t const *s)
-{
- int back = 0;
- if((d) && (sz) && (s)) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- if(sz >= dk3str_cnvsz_c16_to_c32_app(s, NULL)) {
- back = dk3str_cnv_c16_to_c32_app((dk3_c32_t *)d, sz, s, NULL);
- }
-#else
- if(sz >= dk3str_c16_len(s)) {
- dk3str_c16_cpy((dk3_c16_t *)d, s);
- back = 1;
- }
-#endif
-#else
- if(sz >= dk3str_cnvsz_c16_to_c8p_app(s, NULL)) {
- back = dk3str_cnv_c16_to_c8p_app((char *)d, sz, s, NULL);
- }
-#endif
- }
- return back;
-}
-
-
-
-int
-dk3wxs_from_dkstr(
- wxChar *dp,
- size_t sz,
-#if DK3_SIZEOF_WXCHAR == 1
- int wxe,
-#else
- int WXUNUSED(wxe),
-#endif
- dkChar const *src,
-#if DK3_CHAR_SIZE == 1
- int dke
-#else
- int WXUNUSED(dke)
-#endif
-)
-{
- int back = 0;
- if((dp) && (sz) && (src)) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- /* + wxChar 4 */
-#if DK3_CHAR_SIZE > 1
-#if DK3_CHAR_SIZE > 2
- /* + dkChar 4 */
- if(dk3str_c32_len((const dk3_c32_t *)src) < sz) {
- dk3str_c32_cpy((dk3_c32_t *)dp, (const dk3_c32_t *)src);
- back = 1;
- }
- /* - dkChar 4 */
-#else
- /* + dkChar 2 */
- if(sz >= dk3str_cnvsz_c16_to_c32_app((const dk3_c16_t *)src, NULL)) {
- back = dk3str_cnv_c16_to_c32_app(
- (dk3_c32_t *)dp, sz, (const dk3_c16_t *)src, NULL
- );
- }
- /* - dkChar 2 */
-#endif
-#else
- /* + dkChar 1 */
- if(dke == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c8p_to_c32_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8p_to_c32_app(
- (dk3_c32_t *)dp, sz, (const char *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c8u_to_c32_app(src, NULL)) {
- back = dk3str_cnv_c8u_to_c32_app(dp, sz, src, NULL);
- }
- }
- /* - dkChar 1 */
-#endif
- /* - wxChar 4 */
-#else
- /* + wxChar 2 */
-#if DK3_CHAR_SIZE > 1
-#if DK3_CHAR_SIZE > 2
- /* + dkChar 4 */
- if(sz >= dk3str_cnvsz_c32_to_c16_app((const dk3_c32_t *)src, NULL)) {
- back = dk3str_cnv_c32_to_c16_app(
- (dk3_c16_t *)dp, sz, (const dk3_c32_t *)src, NULL
- );
- }
- /* - dkChar 4 */
-#else
- /* + dkChar 2 */
- if(dk3str_c16_len((const dk3_c16_t *)src) < sz) {
- dk3str_c16_cpy((dk3_c16_t *)dp, (const dk3_c16_t *)src);
- back = 1;
- }
- /* - dkChar 2 */
-#endif
-#else
- /* + dkChar 1 */
- if(dke == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c8p_to_c16_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8p_to_c16_app(
- (dk3_c16_t *)dp, sz, (const char *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c8u_to_c16_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8u_to_c16_app(
- (dk3_c16_t *)dp, sz, (const char *)src, NULL
- );
- }
- }
- /* - dkChar 1 */
-#endif
- /* - wxChar 2 */
-#endif
-#else
- /* + wxChar 1 */
-#if DK3_CHAR_SIZE > 1
-#if DK3_CHAR_SIZE > 2
- /* + dkChar 4 */
- if(wxe == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c8p_to_c32_app((const dk3_c32_t *)src, NULL)) {
- back = dk3str_cnv_c8p_to_c32_app(
- (char *)dp, sz, (const dk3_c32_t *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c8u_to_c32_app((const dk3_c32_t *)src, NULL)) {
- back = dk3str_cnv_c8u_to_c32_app(
- (char *)dp, sz, (const dk3_c32_t *)src, NULL
- );
- }
- }
- /* - dkChar 4 */
-#else
- /* + dkChar 2 */
- if(wxe == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c8p_to_c16_app((const dk3_c16_t *)src, NULL)) {
- back =dk3str_cnv_c8p_to_c16_app(
- (char *)dp, sz, (const dk3_c16_t *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c8u_to_c16_app((const dk3_c16_t *)src, NULL)) {
- back =dk3str_cnv_c8u_to_c16_app(
- (char *)dp, sz, (const dk3_c16_t *)src, NULL
- );
- }
- }
- /* - dkChar 2 */
-#endif
-#else
- /* + dkChar 1 */
- if(wxe == dke) {
- if(dk3str_c8_len((const char *)src) < sz) {
- dk3str_c8_cpy((char *)dp, (const char *)src);
- back = 1;
- }
- } else {
- if(wxe == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c8u_to_c8p_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8u_to_c8p_app(
- (char *)dp, sz, (const char *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c8p_to_c8u_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8p_to_c8u_app(
- (char *)dp, sz, (const char *)src, NULL
- );
- }
- }
- }
- /* - dkChar 1 */
-#endif
- /* - wxChar 1 */
-#endif
- }
- return back;
-}
-
-
-
-int
-dk3wxs_to_dkstr(
- dkChar *dp,
- size_t sz,
-#if DK3_CHAR_SIZE == 1
- int dke,
-#else
- int WXUNUSED(dke),
-#endif
- wxChar const *src,
-#if DK3_SIZEOF_WXCHAR == 1
- int wxe
-#else
- int WXUNUSED(wxe)
-#endif
-)
-{
- int back = 0;
- if((dp) && (sz) && (src)) {
-#if DK3_CHAR_SIZE > 1
-#if DK3_CHAR_SIZE > 2
- /* + dkChar 4 */
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- /* + wxChar 4 */
- if(dk3str_c32_len((const dk3_c32_t *)src) < sz) {
- dk3str_c32_cpy((dk3_c32_t *)dp, (const dk3_c32_t *)src);
- back = 1;
- }
- /* - wxChar 4 */
-#else
- /* + wxChar 2 */
- if(sz >= dk3str_cnvsz_c16_to_c32_app((const dk3_c16_t *)src, NULL)) {
- back = dk3str_cnv_c16_to_c32_app(
- (dk3_c32_t *)dp, sz, (const dk3_c16_t *)src, NULL
- );
- }
- /* - wxChar 2 */
-#endif
-#else
- /* + wxChar 1 */
- if(wxe == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c8p_to_c32_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8p_to_c32_app(
- (dk3_c32_t *)dp, sz, (const char *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c8u_to_c32_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8u_to_c32_app(
- (dk3_c32_t *)dp, sz, (const char *)src, NULL
- );
- }
- }
- /* - wxChar 1 */
-#endif
- /* - dkChar 4 */
-#else
- /* + dkChar 2 */
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- /* + wxChar 4 */
- if(sz >= dk3str_cnvsz_c32_to_c16_app((const dk3_c32_t *)src, NULL)) {
- back = dk3str_cnv_c32_to_c16_app(
- (dk3_c16_t *)dp, sz, (const dk3_c32_t *)src, NULL
- );
- }
- /* - wxChar 4 */
-#else
- /* + wxChar 2 */
- if(sz > dk3str_c16_len((const dk3_c16_t *)src)) {
- dk3str_c16_cpy((dk3_c16_t *)dp, (const dk3_c16_t *)src);
- back = 1;
- }
- /* - wxChar 2 */
-#endif
-#else
- /* + wxChar 1 */
- if(wxe == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c8p_to_c16_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8p_to_c16_app(
- (dk3_c16_t *)dp, sz, (const char *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c8u_to_c16_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8u_to_c16_app(
- (dk3_c16_t *)dp, sz, (const char *)src, NULL
- );
- }
- }
- /* - wxChar 1 */
-#endif
- /* - dkChar 2 */
-#endif
-#else
- /* + dkChar 1 */
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- /* + wxChar 4 */
- if(dke == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c32_to_c8p_app((const dk3_c32_t *)src, NULL)) {
- back = dk3str_cnv_c32_to_c8p_app(
- (char *)dp, sz, (const dk3_c32_t *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c32_to_c8u_app((const dk3_c32_t *)src, NULL)) {
- back = dk3str_cnv_c32_to_c8u_app(
- (char *)dp, sz, (const dk3_c32_t *)src, NULL
- );
- }
- }
- /* - wxChar 4 */
-#else
- /* + wxChar 2 */
- if(dke == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c16_to_c8p_app((const dk3_c16_t *)src, NULL)) {
- back = dk3str_cnv_c16_to_c8p_app(
- (char *)dp, sz, (const dk3_c16_t *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c16_to_c8u_app((const dk3_c16_t *)src, NULL)) {
- back = dk3str_cnv_c16_to_c8u_app(
- (char *)dp, sz, (const dk3_c16_t *)src, NULL
- );
- }
- }
- /* - wxChar 2 */
-#endif
-#else
- /* + wxChar 1 */
- if(dke == wxe) {
- if(sz > dk3str_c8_len((const char *)src)) {
- dk3str_c8_cpy((char *)dp, (const char *)src);
- back = 1;
- }
- } else {
- if(dke == DK3_ENCODING_PLAIN) {
- if(sz >= dk3str_cnvsz_c8u_to_c8p_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8u_to_c8p_app(
- (char *)dp, sz, (const char *)src, NULL
- );
- }
- } else {
- if(sz >= dk3str_cnvsz_c8p_to_c8u_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8p_to_c8u_app(
- (char *)dp, sz, (const char *)src, NULL
- );
- }
- }
- }
- /* - wxChar 1 */
-#endif
- /* - dkChar 1 */
-#endif
- }
- return back;
-}
-
-
-int
-dk3wxs_to_c8(
- char *dp,
- size_t sz,
- int c8e,
- wxChar const *src,
-#if DK3_SIZEOF_WXCHAR == 1
- int wxe
-#else
- int WXUNUSED(wxe)
-#endif
-)
-{
- int back = 0;
- $? "+ dk3wxs_to_c8str"
- if((dp) && (sz) && (src)) {
-#if DK3_SIZEOF_WXCHAR > 1
-#if DK3_SIZEOF_WXCHAR > 2
- if(DK3_ENCODING_UTF8 == c8e) { $? ". 32 bit to UTF-8"
- if(sz >= dk3str_cnvsz_c32_to_c8u_app((const dk3_c32_t *)src, NULL)) {
- back = dk3str_cnv_c32_to_c8u_app(
- dp, sz, (const dk3_c32_t *)src, NULL
- );
- }
- } else { $? ". 32 bit to plain"
- if(sz >= dk3str_cnvsz_c32_to_c8p_app((const dk3_c32_t *)src, NULL)) {
- back = dk3str_cnv_c32_to_c8p_app(
- dp, sz, (const dk3_c32_t *)src, NULL
- );
- }
- }
-#else
- if(DK3_ENCODING_UTF8 == c8e) { $? ". 16 bit to UTF-8"
- if(sz >= dk3str_cnvsz_c16_to_c8u_app((const dk3_c16_t *)src, NULL)) {
- back = dk3str_cnv_c16_to_c8u_app(
- dp, sz, (const dk3_c16_t *)src, NULL
- );
- }
- } else { $? ". 16 bit to plain"
- if(sz >= dk3str_cnvsz_c16_to_c8p_app((const dk3_c16_t *)src, NULL)) {
- back = dk3str_cnv_c16_to_c8p_app(
- dp, sz, (const dk3_c16_t *)src, NULL
- );
- }
- }
-#endif
-#else
- if(c8e == wxe) { $? ". 8 bit copy"
- if(sz > strlen((const char *)src)) {
- strcpy(dp, (const char *)src);
- }
- } else {
- if(DK3_ENCODING_UTF8 == c8e) { $? ". 8 bit to UTF-8"
- if(sz >= dk3str_cnvsz_c8p_to_c8u_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8p_to_c8u_app(dp, sz, (const char *)src, NULL);
- }
- } else { $? ". 8 bit to plain"
- if(sz >= dk3str_cnvsz_c8u_to_c8p_app((const char *)src, NULL)) {
- back = dk3str_cnv_c8u_to_c8p_app(dp, sz, (const char *)src, NULL);
- }
- }
- }
-#endif
- } $? "- dk3wxs_to_c8str %d", back
- return back;
-}
-
-
-