summaryrefslogtreecommitdiff
path: root/support/dktools/dk4strd.ctr
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
committerNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
commit1f457376b478257b88d4a857f5ec1b6155442dd7 (patch)
tree2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/dk4strd.ctr
parentac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff)
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/dk4strd.ctr')
-rw-r--r--support/dktools/dk4strd.ctr75
1 files changed, 74 insertions, 1 deletions
diff --git a/support/dktools/dk4strd.ctr b/support/dktools/dk4strd.ctr
index d9bee9dab5..113c429f2f 100644
--- a/support/dktools/dk4strd.ctr
+++ b/support/dktools/dk4strd.ctr
@@ -2,7 +2,7 @@
copyright owner = Dirk Krause
copyright year = 2015-xxxx
-license = bsd
+SPDX-License-Identifier: BSD-3-Clause
@@ -13,15 +13,27 @@ license = bsd
*/
#ifndef DK4CONF_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4conf.h"
+#else
+#include <dktools-4/dk4conf.h>
+#endif
#endif
#ifndef DK4TYPES_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4types.h"
+#else
+#include <dktools-4/dk4types.h>
+#endif
#endif
#ifndef DK4ERROR_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4error.h"
+#else
+#include <dktools-4/dk4error.h>
+#endif
#endif
#ifdef __cplusplus
@@ -29,6 +41,8 @@ extern "C" {
#endif
/** Copy string, check destination buffer size.
+
+ CRT on Windows: Optional.
@param dst Destination buffer address.
@param sz Destination buffer size.
@param src Source string.
@@ -45,6 +59,8 @@ int
dk4str_cpy_s(dkChar *dst, size_t sz, const dkChar *src, dk4_er_t *erp);
/** Concatenate strings, check destination buffer size.
+
+ CRT on Windows: Optional.
@param dst Destination buffer address.
@param sz Destination buffer size.
@param src Source string.
@@ -69,6 +85,8 @@ dk4str_cat_s(dkChar *dst, size_t sz, const dkChar *src, dk4_er_t *erp);
any error.
For normal string copy operations, use the dk4str_cpy_s()
function instead.
+
+ CRT on Windows: Not used.
@param dst Destination buffer address.
@param src Source string.
*/
@@ -76,6 +94,9 @@ void
dk4str_cpy_to_left(dkChar *dst, const dkChar *src);
/** Find string length.
+
+ CRT on Windows: Optional, disabling CRT reduces functionality
+ to strings with length fitting to int.
@param src Source string.
@return String length.
*/
@@ -83,6 +104,8 @@ size_t
dk4str_len(const dkChar *src);
/** Compare two strings.
+
+ CRT on Windows: Optional.
@param s1 Left string, may be NULL.
@param s2 Right string, may be NULL.
@return 1 if s1>s2, 0 if s1==s2, -1 if s1<s2.
@@ -91,6 +114,8 @@ int
dk4str_cmp(const dkChar *s1, const dkChar *s2);
/** Compare two strings.
+
+ CRT on Windows: Optional.
@param s1 Left string, may be NULL.
@param s2 Right string, may be NULL.
@param n Maximum number of characters to compare.
@@ -100,6 +125,8 @@ int
dk4str_ncmp(const dkChar *s1, const dkChar *s2, size_t n);
/** Compare two strings, case-insensitive comparison.
+
+ CRT on Windows: Optional.
@param s1 Left string, may be NULL.
@param s2 Right string, may be NULL.
@return 1 if s1>s2, 0 if s1==s2, -1 if s1<s2.
@@ -108,6 +135,8 @@ int
dk4str_casecmp(const dkChar *s1, const dkChar *s2);
/** Compare two file path names.
+
+ CRT on Windows: Optional.
@param s1 Left string, may be NULL.
@param s2 Right string, may be NULL.
@return 1 if s1>s2, 0 if s1==s2, -1 if s1<s2.
@@ -116,6 +145,8 @@ int
dk4str_pathcmp(const dkChar *s1, const dkChar *s2);
/** Find first occurance of character c in string s.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param s String to search for c.
@param c Character to find.
@return Pointer to first occurance if found, NULL otherwise.
@@ -124,6 +155,8 @@ dkChar *
dk4str_chr(const dkChar *s, dkChar c);
/** Find last occurance of character c in string s.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param s String to search for c.
@param c Character to find.
@return Pointer to last occurance if found, NULL otherwise.
@@ -132,6 +165,8 @@ dkChar *
dk4str_rchr(const dkChar *s, dkChar c);
/** Retrieve first token from *stringp.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param stringp Adress of string pointer.
@param delim String containing the delimiter set,
my be NULL to use the default delimiter
@@ -143,6 +178,8 @@ dkChar *
dk4str_sep(dkChar **stringp, const dkChar *delim);
/** Find first token in string.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param src String to search for tokens.
@param delim String containing the delimiter characters,
may be NULL to use the default delimiter set.
@@ -152,6 +189,8 @@ dkChar *
dk4str_start(const dkChar *src, const dkChar *delim);
/** Cut string after first token, find start of second token in string.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param src String to search for tokens,
normally the result of dk4str_start() or a
previous dk4str_next() call.
@@ -163,6 +202,8 @@ dkChar *
dk4str_next(dkChar *src, const dkChar *delim);
/** Split a string into tokens.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param dpp Pointer to string pointer array.
@param szdpp Size of destination string pointer array.
@param src Source string to process.
@@ -186,6 +227,8 @@ dk4str_tokenize(
/** Normalize a string (remove leading and trailing delimiters,
replace delimiter sequences by just one delimiter).
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param src Buffer containing the string to normalize.
@param delim String containing delimiter characters,
may be NULL to use the default delimiter set.
@@ -194,6 +237,8 @@ void
dk4str_normalize(dkChar *src, const dkChar *delim);
/** Find index of a string in an array of strings.
+
+ CRT on Windows: Optional.
@param arr Array of strings.
@param str String to find in array.
@param cs Flag: Case-sensitive search (0=no, other=yes).
@@ -203,6 +248,9 @@ int
dk4str_array_index(const dkChar * const *arr, const dkChar *str, int cs);
/** Find index of a string in an array of strings.
+
+ CRT on Windows: Optional, disabling CRT degrades performance
+ for case-insensitive comparisons.
@param arr Array of strings allowing abbreviation.
@param spec Special character indicating start of optional text.
@param str String to find in array.
@@ -218,6 +266,9 @@ dk4str_abbr_index(
);
/** Check whether a text matches a pattern, the text may be abbreviated.
+
+ CRT on windows: Optional, disabling CRT degrades performance
+ for case-insensitive comparisons.
@param str Text to check.
@param pattern Pattern for comparison.
@param spec Special character marking the abbreviation in the
@@ -236,6 +287,8 @@ int
dk4str_is_bool(const dkChar *str);
/** Check whether a string represents the boolean value TRUE.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param str String to check.
@return 1 if str represents the boolean value TRUE, 0 otherwise.
*/
@@ -246,6 +299,9 @@ dk4str_is_on(const dkChar *str);
|| (DK4_HAVE_MALLOC && DK4_HAVE_FREE)
/** Duplicate string in dynamically allocated memory.
+
+ CRT on Windows: Optional, disabling CRT reduces functionality
+ to strings with length fitting to int and overall size in
@param src String to duplicate.
@param erp Error report, may be NULL.
@return Pointer to string in new memory on succes, NULL on error.
@@ -266,6 +322,8 @@ dk4str_dup(const dkChar *src, dk4_er_t *erp);
/* if (defined(_WIN32) ... */
/** Remove trailing white spaces.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param str String to remove white spaces from.
@param whsp White spaces set.
*/
@@ -273,6 +331,8 @@ void
dk4str_rtwh(dkChar *str, const dkChar *whsp);
/** Remove trailing newline from line.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param lptr Line pointer.
*/
void
@@ -280,6 +340,8 @@ dk4str_delnl(dkChar *lptr);
/** Skip the first text words in a line, return pointer to start
of next word.
+
+ CRT on Windows: Optional, disabling CRT degrades performance.
@param line Line to process.
@param skip Number of words to skip.
@return Pointer to next word on success, NULL on error.
@@ -289,6 +351,8 @@ dk4str_skip(const dkChar *line, size_t skip);
/** Sanitize string (overwrite using 0 bytes).
+
+ CRT on Windows: Optional.
@param str Address of string to sanitize.
@return 1 on success, 0 on error.
*/
@@ -296,6 +360,8 @@ int
dk4str_sanitize(dkChar *str);
/** Sanitize string buffer (overwrite using 0 bytes).
+
+ CRT on Windows: Optional.
@param str Address of string buffer.
@param sz Size of string buffer (number of dkChar).
@return 1 on success, 0 on error.
@@ -304,6 +370,8 @@ int
dk4str_buffer_sanitize(dkChar *str, size_t sz);
/** Sanitize dynamically allocated memory and release it.
+
+ CRT on Windows: Optional.
@param str Address of string to sanitize and release.
@return 1 on success, 0 on error.
*/
@@ -317,12 +385,16 @@ dk4str_free_sanitized(dkChar *str);
#if DK4_CHAR_SIZE > 1
/** Sanitize string and release it, set pointer to NULL.
+
+ CRT on Windows: Optional.
@param p Pointer to string to release.
*/
#define dk4str_release_sanitized(p) \
do { if (NULL != p) { (void)dk4strw_free_sanitized(p); } p = NULL; } while (0)
#else
/** Sanitize string and release it, set pointer to NULL.
+
+ CRT on Windows: Optional.
@param p Pointer to string to release.
*/
#define dk4str_release_sanitized(p) \
@@ -332,6 +404,7 @@ do { if (NULL != p) { (void)dk4str8_free_sanitized(p); } p = NULL; } while (0)
%% module
+#include "dk4conf.h"
#include "dk4strd.h"
#if DK4_CHAR_SIZE > 1