merge remote tracking changes default tip

Tue, 27 May 2025 22:31:06 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 27 May 2025 22:31:06 +0200
changeset 1333
2fc1c25441f1
parent 1332
02946dc73e6a (diff)
parent 1330
dd5d2402d161 (current diff)

merge remote tracking changes

--- a/CHANGELOG	Sat May 24 00:04:11 2025 +0200
+++ b/CHANGELOG	Tue May 27 22:31:06 2025 +0200
@@ -15,6 +15,7 @@
  * adds cx_strcpy() and cx_strcpy_a()
  * adds cxStdlibAllocator and allows changes of cxDefaultAllocator
  * improves performance of the CxList array list implementation
+ * changes cx_strcast() to also accept C-strings as input
  * changes grow strategy for the mempory pool to reduce reallocations
  * changes grow strategy for CxBuffer, which does now take the page size into account
  * changes the implementation of cx_strreplacen() for improved efficiency
--- a/configure	Sat May 24 00:04:11 2025 +0200
+++ b/configure	Tue May 27 22:31:06 2025 +0200
@@ -565,12 +565,12 @@
 
 # build type
 if [ "$BUILD_TYPE" = "debug" ]; then
-    TEMP_CFLAGS="\${DEBUG_CFLAGS}$TEMP_CFLAGS"
-    TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS}$TEMP_CXXFLAGS"
+    TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS"
+    TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS"
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    TEMP_CFLAGS="\${RELEASE_CFLAGS}$TEMP_CFLAGS"
-    TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS}$TEMP_CXXFLAGS"
+    TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS"
+    TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS"
 fi
 
 # add general dependency flags to flags.mk
--- a/docs/Writerside/topics/about.md	Sat May 24 00:04:11 2025 +0200
+++ b/docs/Writerside/topics/about.md	Tue May 27 22:31:06 2025 +0200
@@ -42,6 +42,7 @@
 * adds cx_strcpy() and cx_strcpy_a()
 * adds cxStdlibAllocator and allows changes of cxDefaultAllocator
 * improves performance of the CxList array list implementation
+* changes cx_strcast() to also accept C-strings as input
 * changes grow strategy for the memory pool to reduce reallocations
 * changes grow strategy for CxBuffer, which does now take the page size into account
 * changes the implementation of cx_strreplacen() for improved efficiency
--- a/docs/Writerside/topics/string.h.md	Sat May 24 00:04:11 2025 +0200
+++ b/docs/Writerside/topics/string.h.md	Tue May 27 22:31:06 2025 +0200
@@ -9,7 +9,7 @@
 
 ## Basics
 
-> To make documentation simpler, we introduce the pseudo-type `AnyStr` with the meaning that
+> To simplify documentation, we introduce the pseudo-type `AnyStr` with the meaning that
 > both `cxstring` and `cxmutstr` are accepted for that argument.
 > The implementation is actually hidden behind a macro which uses `cx_strcast()` to guarantee compatibility.
 {style="note"}
@@ -33,8 +33,6 @@
 
 cxmutstr cx_mutstrn(char *cstring, size_t length);
 
-cxstring cx_strcast(AnyStr str);
-
 cxmutstr cx_strdup(AnyStr string);
 
 cxmutstr cx_strdup_a(const CxAllocator *allocator, AnyStr string);
@@ -51,6 +49,7 @@
 
 #define CX_SFMT(s)   (int) (s).length, (s).ptr
 #define CX_PRIstr    ".*s"
+#define cx_strcast(s)  // converts any string to cxstring
 ```
 
 The functions `cx_str()` and `cx_mutstr()` create a UCX string from a `const char*` or a `char*`
--- a/make/configure.vm	Sat May 24 00:04:11 2025 +0200
+++ b/make/configure.vm	Tue May 27 22:31:06 2025 +0200
@@ -503,12 +503,12 @@
 
 # build type
 if [ "$BUILD_TYPE" = "debug" ]; then
-    TEMP_CFLAGS="\${DEBUG_CFLAGS}$TEMP_CFLAGS"
-    TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS}$TEMP_CXXFLAGS"
+    TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS"
+    TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS"
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    TEMP_CFLAGS="\${RELEASE_CFLAGS}$TEMP_CFLAGS"
-    TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS}$TEMP_CXXFLAGS"
+    TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS"
+    TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS"
 fi
 
 # add general dependency flags to flags.mk
--- a/make/toolchain.sh	Sat May 24 00:04:11 2025 +0200
+++ b/make/toolchain.sh	Tue May 27 22:31:06 2025 +0200
@@ -68,7 +68,7 @@
 #else
   std::cout << "toolchain:unknown" << std::endl;
 #endif
-  std:cout << "wsize:" << sizeof(void*)*8 << std::endl;
+  std::cout << "wsize:" << sizeof(void*)*8 << std::endl;
   return 0;
 }
 __EOF__
@@ -126,6 +126,14 @@
   fi
 }
 
+parse_toolchain_properties()
+{
+  info_file="$1"
+  TOOLCHAIN=`grep '^toolchain:' "$info_file" | tail -c +11`
+  TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+  TOOLCHAIN_WSIZE=`grep '^wsize:' "$info_file" | tail -c +7`
+}
+
 detect_c_compiler()
 {
   if [ -n "$TOOLCHAIN_CC" ]; then
@@ -136,9 +144,7 @@
     if check_c_compiler "$CC"; then
       TOOLCHAIN_CC=$CC
       "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
-      TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11`
-      TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
-      TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7`
+      parse_toolchain_properties "$TEMP_DIR/checkcc_out"
       TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13`
       echo "$CC"
       return 0
@@ -152,9 +158,7 @@
       if check_c_compiler "$COMP"; then
         TOOLCHAIN_CC=$COMP
         "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
-        TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11`
-        TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
-        TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7`
+        parse_toolchain_properties "$TEMP_DIR/checkcc_out"
         TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13`
         echo "$COMP"
         return 0
@@ -176,8 +180,7 @@
     if check_cpp_compiler "$CXX"; then
       TOOLCHAIN_CXX=$CXX
       "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
-      TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11`
-      TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+      parse_toolchain_properties "$TEMP_DIR/checkcc_out"
       echo "$CXX"
       return 0
     else
@@ -190,8 +193,7 @@
       if check_cpp_compiler "$COMP"; then
         TOOLCHAIN_CXX=$COMP
         "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
-        TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11`
-        TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+        parse_toolchain_properties "$TEMP_DIR/checkcc_out"
         echo "$COMP"
         return 0
       fi
--- a/src/cx/string.h	Sat May 24 00:04:11 2025 +0200
+++ b/src/cx/string.h	Tue May 27 22:31:06 2025 +0200
@@ -263,6 +263,10 @@
 static inline cxstring cx_strcast(cxstring str) {
     return str;
 }
+cx_attr_nodiscard
+static inline cxstring cx_strcast(const char *str) {
+    return cx_str(str);
+}
 extern "C" {
 #else
 /**
@@ -287,6 +291,17 @@
 }
 
 /**
+ * Internal function, do not use.
+ * @param str
+ * @return
+ * @see cx_strcast()
+ */
+cx_attr_nodiscard
+static inline cxstring cx_strcast_z(const char *str) {
+    return cx_str(str);
+}
+
+/**
 * Casts a mutable string to an immutable string.
 *
 * Does nothing for already immutable strings.
@@ -300,8 +315,9 @@
 */
 #define cx_strcast(str) _Generic((str), \
         cxmutstr: cx_strcast_m, \
-        cxstring: cx_strcast_c) \
-        (str)
+        cxstring: cx_strcast_c, \
+        const char*: cx_strcast_z, \
+        char *: cx_strcast_z) (str)
 #endif
 
 /**

mercurial