diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-06-21 21:42:12 +0200 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-06-21 22:05:37 +0200 |
| commit | 13f5fd77bbc528862f295f9e7196f3ff709d185a (patch) | |
| tree | 9f9ce051bc8adf61e5ae2b4e94ccb1331bfdbfa5 /regalone.h | |
| parent | 10b47c9226b6267e5a4be4e79fe79314bf969025 (diff) | |
| download | terex-13f5fd77bbc528862f295f9e7196f3ff709d185a.tar.gz | |
Unicode builds now expect UTF-8 strings
* They are built with `-DREGEX_UTF8` instead of `-DREGEX_WCHAR`.
Functions are called reg_ucomp() and reg_uexec() instead for consistency.
The library is now called libhsurex.so instead of libhswrex.so.
* The `chr` type is now always `unsigned char`.
As a result many other uses of the `chr` type had to be changed to pchr
(which is always large enough to hold a byte or wide character).
Generally we try to keep code changes as small as possible since
we may have to backport changes from the Tcl codebase or contribute
patches to the Tcl project.
Diffstat (limited to 'regalone.h')
| -rw-r--r-- | regalone.h | 36 |
1 files changed, 12 insertions, 24 deletions
@@ -2,22 +2,18 @@ #include <stddef.h> #include <stdio.h> #include <stdlib.h> +#include <stdint.h> #include <string.h> #ifndef REGEX_STANDALONE # define REGEX_STANDALONE #endif -#ifdef REGEX_WCHAR -# include <wctype.h> -# include <wchar.h> - typedef wchar_t chr; - typedef chr Tcl_UniChar; -#else -# include <ctype.h> - typedef unsigned char chr; - typedef wchar_t Tcl_UniChar; -#endif +#include <wctype.h> +#include <ctype.h> +// FIXME: Should better be a signed char? +typedef unsigned char chr; +//typedef wchar_t Tcl_UniChar; /* * In The standalone version we are more concerned with performance, @@ -34,7 +30,12 @@ #define ckrealloc(p,n) realloc(p,n) #define ckfree(p) free(p) -#ifdef REGEX_WCHAR +// FIXME: Perhaps get rid of these references completely. +#define Tcl_DStringInit(ds) do (void)(ds); while (0) +#define Tcl_UniCharToUtfDString(s,l,ds) ((char *)(s)) +#define Tcl_DStringFree(ds) do (void)(ds); while (0) + +#ifdef REGEX_UTF8 # define Tcl_UniCharToLower(c) towlower(c) # define Tcl_UniCharToUpper(c) towupper(c) # define Tcl_UniCharToTitle(c) towupper(c) @@ -43,9 +44,6 @@ # define Tcl_UniCharIsDigit(c) iswdigit(c) # define Tcl_UniCharIsSpace(c) iswspace(c) #else -# define Tcl_DStringInit(ds) -# define Tcl_UniCharToUtfDString(s,l,ds) (s) -# define Tcl_DStringFree(ds) # define Tcl_UniCharToLower(c) tolower(c) # define Tcl_UniCharToUpper(c) toupper(c) # define Tcl_UniCharToTitle(c) toupper(c) @@ -238,13 +236,3 @@ typedef struct Tcl_DString { #else # define EXTERN extern TCL_STORAGE_CLASS #endif - - -#ifdef REGEX_WCHAR -EXTERN void Tcl_DStringFree (Tcl_DString * dsPtr); -EXTERN void Tcl_DStringInit (Tcl_DString * dsPtr); -EXTERN char * Tcl_UniCharToUtfDString (CONST Tcl_UniChar * uniStr, - int uniLength, Tcl_DString * dsPtr); -EXTERN void Tcl_DStringSetLength (Tcl_DString * dsPtr, - int length); -#endif /* REGEX_WCHAR */ |
