/* 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: dk4strx.cpt */ /** @file dk4strx.cpp The dk4strx module. */ #line 573 "dk4strx.cpt" #include "dk4conf.h" #ifndef DK4_SIZEOF_WXCHAR #ifndef DK4WXCS_H_INCLUDED #include "dk4wxcs.h" #endif #endif #include "dk4strx.h" #include "dk4mem.h" #include "dk4mpl.h" #if DK4_SIZEOF_WXCHAR > 1 #include "dk4strw.h" #include "dk4pathw.h" #else #include "dk4str8.h" #include "dk4path8.h" #endif #line 597 "dk4strx.cpt" int dk4strx_cpy_s(wxChar *dst, size_t sz, const wxChar *src, dk4_er_t *erp) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_cpy_s(dst, sz, src, erp)); #else return (dk4str8_cpy_s(dst, sz, src, erp)); #endif } int dk4strx_cat_s(wxChar *dst, size_t sz, const wxChar *src, dk4_er_t *erp) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_cat_s(dst, sz, src, erp)); #else return (dk4str8_cat_s(dst, sz, src, erp)); #endif } void dk4strx_cpy_to_left(wxChar *dst, const wxChar *src) { #if DK4_SIZEOF_WXCHAR > 1 dk4strw_cpy_to_left(dst, src); #else dk4str8_cpy_to_left(dst, src); #endif } size_t dk4strx_len(const wxChar *src) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_len(src)); #else return (dk4str8_len(src)); #endif } int dk4strx_cmp(const wxChar *s1, const wxChar *s2) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_cmp(s1, s2)); #else return (dk4str8_cmp(s1, s2)); #endif } int dk4strx_casecmp(const wxChar *s1, const wxChar *s2) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_casecmp(s1, s2)); #else return (dk4str8_casecmp(s1, s2)); #endif } int dk4strx_pathcmp(const wxChar *s1, const wxChar *s2) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_pathcmp(s1, s2)); #else return (dk4str8_pathcmp(s1, s2)); #endif } wxChar * dk4strx_chr(const wxChar *s, wxChar c) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_chr(s, c)); #else return (dk4str8_chr(s, c)); #endif } wxChar * dk4strx_rchr(const wxChar *s, wxChar c) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_rchr(s, c)); #else return (dk4str8_rchr(s, c)); #endif } wxChar * dk4strx_sep(wxChar **stringp, const wxChar *delim) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_sep(stringp, delim)); #else return (dk4str8_sep(stringp, delim)); #endif } wxChar * dk4strx_start(const wxChar *src, const wxChar *delim) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_start(src, delim)); #else return (dk4str8_start(src, delim)); #endif } wxChar * dk4strx_next(wxChar *src, const wxChar *delim) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_next(src, delim)); #else return (dk4str8_next(src, delim)); #endif } size_t dk4strx_tokenize( wxChar **dpp, size_t szdpp, wxChar *src, const wxChar *delim, dk4_er_t *erp ) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_tokenize(dpp, szdpp, src, delim, erp)); #else return (dk4str8_tokenize(dpp, szdpp, src, delim, erp)); #endif } void dk4strx_normalize(wxChar *src, const wxChar *delim) { #if DK4_SIZEOF_WXCHAR > 1 dk4strw_normalize(src, delim); #else dk4str8_normalize(src, delim); #endif } int dk4strx_array_index(const wxChar * const *arr, const wxChar *str, int cs) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_array_index(arr, str, cs)); #else return (dk4str8_array_index(arr, str, cs)); #endif } int dk4strx_abbr_index( const wxChar * const *arr, wxChar spec, const wxChar *str, int cs ) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_abbr_index(arr, spec, str, cs)); #else return (dk4str8_abbr_index(arr, spec, str, cs)); #endif } int dk4strx_is_abbr(const wxChar *str, const wxChar *pattern, wxChar spec, int cs) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_is_abbr(str, pattern, spec, cs)); #else return (dk4str8_is_abbr(str, pattern, spec, cs)); #endif } int dk4strx_is_bool(const wxChar *str) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_is_bool(str)); #else return (dk4str8_is_bool(str)); #endif } int dk4strx_is_on(const wxChar *str) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_is_on(str)); #else return (dk4str8_is_on(str)); #endif } #if (defined(_WIN32) && DK4_USE_WINDOWS_LOCAL_ALLOC) \ || (DK4_HAVE_MALLOC && DK4_HAVE_FREE) wxChar * dk4strx_dup(const wxChar *src, dk4_er_t *erp) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4strw_dup(src, erp)); #else return (dk4str8_dup(src, erp)); #endif } #endif /* if (defined(_WIN32) ... */ void dk4strx_rtwh(wxChar *str, const wxChar *whsp) { #if DK4_SIZEOF_WXCHAR > 1 dk4strw_rtwh(str, whsp); #else dk4str8_rtwh(str, whsp); #endif } void dk4strx_delnl(wxChar *lptr) { #if DK4_SIZEOF_WXCHAR > 1 dk4strw_delnl(lptr); #else dk4str8_delnl(lptr); #endif } wxChar const * dk4strx_get_path_suffix(wxChar const *filename, dk4_er_t *erp) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_get_suffix(filename, erp)); #else return (dk4path8_get_suffix(filename, erp)); #endif } int dk4strx_path_is_absolute(const wxChar *path) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_is_absolute(path)); #else return (dk4path8_is_absolute(path)); #endif } int dk4strx_path_is_relative(const wxChar *path) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_is_relative(path)); #else return (dk4path8_is_relative(path)); #endif } int dk4strx_path_append( wxChar *buffer, size_t sz, const wxChar *filename, dk4_er_t *erp ) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_append(buffer, sz, filename, erp)); #else return (dk4path8_append(buffer, sz, filename, erp)); #endif } wxChar * dk4strx_path_get_suffix(const wxChar *filename, dk4_er_t *erp) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_get_suffix(filename, erp)); #else return (dk4path8_get_suffix(filename, erp)); #endif } void dk4strx_path_correct_sep(wxChar *filename) { #if DK4_SIZEOF_WXCHAR > 1 dk4pathw_correct_sep(filename); #else dk4path8_correct_sep(filename); #endif } int dk4strx_path_must_expand(const wxChar *filename) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_must_expand(filename)); #else return (dk4path8_must_expand(filename)); #endif } int dk4strx_path_set_suffix( wxChar *pdst, size_t szdst, wxChar const *srcname, wxChar const *newsu, dk4_er_t *erp ) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_set_suffix(pdst, szdst, srcname, newsu, erp)); #else return (dk4path8_set_suffix(pdst, szdst, srcname, newsu, erp)); #endif } wxChar * dk4strx_path_dup_change_suffix( wxChar const *srcname, wxChar const *newsu, dk4_er_t *erp ) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_dup_change_suffix(srcname, newsu, erp)); #else return (dk4path8_dup_change_suffix(srcname, newsu, erp)); #endif } size_t dk4strx_path_concatenate_size( wxChar const *dirname, wxChar const *filename, dk4_er_t *erp ) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_concatenate_size(dirname, filename, erp)); #else return (dk4path8_concatenate_size(dirname, filename, erp)); #endif } int dk4strx_path_concatenate_buffer( wxChar *buffer, size_t szbuf, wxChar const *dirn, wxChar const *filen, dk4_er_t *erp ) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_concatenate_buffer(buffer, szbuf, dirn, filen, erp)); #else return (dk4path8_concatenate_buffer(buffer, szbuf, dirn, filen, erp)); #endif } wxChar * dk4strx_path_concatenate_new( wxChar const *dirn, wxChar const *filen, dk4_er_t *erp ) { #if DK4_SIZEOF_WXCHAR > 1 return (dk4pathw_concatenate_new(dirn, filen, erp)); #else return (dk4path8_concatenate_new(dirn, filen, erp)); #endif } int dk4strx_path_is_in_subdir( const wxChar *filename,const wxChar *parent,dk4_er_t *erp ) { wxChar buf[DK4_MAX_PATH]; size_t szf; size_t szp; int back = 0; #line 1055 "dk4strx.cpt" if ((NULL != filename) && (NULL != parent)) { if (0 != dk4strx_cpy_s(buf, DK4_SIZEOF(buf,wxChar), filename, erp)) { szf = dk4strx_len(buf); szp = dk4strx_len(parent); if (szf > szp) { #line 1060 "dk4strx.cpt" #if DK4_ON_WINDOWS || DK4_HAVE_BACKSLASH_AS_SEP if (buf[szp] == wxT('\\')) #else if (buf[szp] == wxT('/')) #endif { #line 1066 "dk4strx.cpt" buf[szp] = wxT('\0'); if (0 == dk4strx_pathcmp(buf, parent)) { back = 1; #line 1069 "dk4strx.cpt" } #if DK4_ON_WINDOWS || DK4_HAVE_BACKSLASH_AS_SEP buf[szp] = wxT('\\'); #else buf[szp] = wxT('/'); #endif } } else { if (szf == szp) { #line 1078 "dk4strx.cpt" if (0 == dk4strx_pathcmp(buf, parent)) { back = 1; #line 1080 "dk4strx.cpt" } } } } } else { dk4error_set_simple_error_code(erp, DK4_E_INVALID_ARGUMENTS); } #line 1087 "dk4strx.cpt" return back; } /* vim: set ai sw=4 ts=4 : */