Просмотр исходного кода

Release 0.9.0.0 (Phase 1): Web-only platform, Qt/qt-clean purged, thermal closed-loop, unlimited limits & dual-mode PXE

XJKJ STL 1 неделя назад
Родитель
Сommit
99fbb04211
100 измененных файлов с 2914 добавлено и 56968 удалено
  1. 0 112
      DDR5_SLT_Monitor.pro
  2. 1 1
      Dockerfile
  3. 1 1
      VERSION
  4. 0 43
      config.json
  5. 0 13
      deploy/linux-desktop/HOVSE_SLT_Pro.desktop
  6. 0 10
      deploy/linux-desktop/port.json
  7. 0 31
      deploy/linux-desktop/run-qt.sh
  8. 59 9
      deploy/pxe-dhcp/entrypoint.sh
  9. 4 0
      docker-compose.yml
  10. 0 769
      docs/QT_CLIENT_API_ZH.md
  11. 0 9
      docs/port.example.json
  12. 199 100
      native/stl_accel/c_bridge.c
  13. 218 608
      native/stl_accel/src/actors.rs
  14. 702 689
      native/stl_accel/src/api.rs
  15. 114 124
      native/stl_accel/src/commands.rs
  16. 52 2
      native/stl_accel/src/config.rs
  17. 0 329
      native/stl_accel/src/firmware.rs
  18. 3 0
      native/stl_accel/src/lib.rs
  19. 581 820
      native/stl_accel/src/main.rs
  20. 99 41
      native/stl_accel/src/pxe.rs
  21. 81 83
      native/stl_accel/src/results.rs
  22. 148 34
      native/stl_accel/src/storage.rs
  23. 263 18
      native/stl_accel/src/thermal_mcu.rs
  24. 64 71
      native/stl_accel/src/workflow.rs
  25. 225 0
      native/stl_accel/src/xlsx.rs
  26. 5 0
      native/stl_accel/stl_accel.h
  27. 0 9
      port.json
  28. 11 13
      sim/README.md
  29. 5 11
      sim/hil_cluster/cluster_harness.py
  30. 2 11
      sim/hil_cluster/dut_and_hood_sim.py
  31. 24 34
      sim/hil_cluster/test_tier2_hil_e2e.py
  32. 0 90
      sim/qt_e2e/qt_hil_e2e_test.pro
  33. 0 230
      sim/qt_e2e/test_tier5_qt_xvfb_e2e.py
  34. 0 173
      sim/qt_e2e/tst_qt_hil_e2e.cpp
  35. 8 19
      sim/run_all_tiers.py
  36. 45 1
      sim/web_e2e/test_tier4_chrome_web_e2e.py
  37. 0 208
      src/3rdparty/libxlsxwriter/License.txt
  38. 0 26
      src/3rdparty/libxlsxwriter/include/xlsxwriter.h
  39. 0 81
      src/3rdparty/libxlsxwriter/include/xlsxwriter/app.h
  40. 0 3964
      src/3rdparty/libxlsxwriter/include/xlsxwriter/chart.h
  41. 0 545
      src/3rdparty/libxlsxwriter/include/xlsxwriter/chartsheet.h
  42. 0 77
      src/3rdparty/libxlsxwriter/include/xlsxwriter/comment.h
  43. 0 466
      src/3rdparty/libxlsxwriter/include/xlsxwriter/common.h
  44. 0 86
      src/3rdparty/libxlsxwriter/include/xlsxwriter/content_types.h
  45. 0 52
      src/3rdparty/libxlsxwriter/include/xlsxwriter/core.h
  46. 0 53
      src/3rdparty/libxlsxwriter/include/xlsxwriter/custom.h
  47. 0 104
      src/3rdparty/libxlsxwriter/include/xlsxwriter/drawing.h
  48. 0 1358
      src/3rdparty/libxlsxwriter/include/xlsxwriter/format.h
  49. 0 77
      src/3rdparty/libxlsxwriter/include/xlsxwriter/hash_table.h
  50. 0 53
      src/3rdparty/libxlsxwriter/include/xlsxwriter/metadata.h
  51. 0 106
      src/3rdparty/libxlsxwriter/include/xlsxwriter/packager.h
  52. 0 79
      src/3rdparty/libxlsxwriter/include/xlsxwriter/relationships.h
  53. 0 51
      src/3rdparty/libxlsxwriter/include/xlsxwriter/rich_value.h
  54. 0 50
      src/3rdparty/libxlsxwriter/include/xlsxwriter/rich_value_rel.h
  55. 0 53
      src/3rdparty/libxlsxwriter/include/xlsxwriter/rich_value_structure.h
  56. 0 49
      src/3rdparty/libxlsxwriter/include/xlsxwriter/rich_value_types.h
  57. 0 86
      src/3rdparty/libxlsxwriter/include/xlsxwriter/shared_strings.h
  58. 0 89
      src/3rdparty/libxlsxwriter/include/xlsxwriter/styles.h
  59. 0 52
      src/3rdparty/libxlsxwriter/include/xlsxwriter/table.h
  60. 0 48
      src/3rdparty/libxlsxwriter/include/xlsxwriter/theme.h
  61. 0 26
      src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/emyg_dtoa.h
  62. 0 216
      src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h
  63. 0 45
      src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/md5.h
  64. 0 694
      src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/queue.h
  65. 0 53
      src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h
  66. 0 801
      src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/tree.h
  67. 0 377
      src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/zip.h
  68. 0 309
      src/3rdparty/libxlsxwriter/include/xlsxwriter/utility.h
  69. 0 56
      src/3rdparty/libxlsxwriter/include/xlsxwriter/vml.h
  70. 0 1153
      src/3rdparty/libxlsxwriter/include/xlsxwriter/workbook.h
  71. 0 6005
      src/3rdparty/libxlsxwriter/include/xlsxwriter/worksheet.h
  72. 0 185
      src/3rdparty/libxlsxwriter/include/xlsxwriter/xmlwriter.h
  73. 0 447
      src/3rdparty/libxlsxwriter/src/app.c
  74. 0 7051
      src/3rdparty/libxlsxwriter/src/chart.c
  75. 0 509
      src/3rdparty/libxlsxwriter/src/chartsheet.c
  76. 0 444
      src/3rdparty/libxlsxwriter/src/comment.c
  77. 0 413
      src/3rdparty/libxlsxwriter/src/content_types.c
  78. 0 294
      src/3rdparty/libxlsxwriter/src/core.c
  79. 0 225
      src/3rdparty/libxlsxwriter/src/custom.c
  80. 0 967
      src/3rdparty/libxlsxwriter/src/drawing.c
  81. 0 832
      src/3rdparty/libxlsxwriter/src/format.c
  82. 0 224
      src/3rdparty/libxlsxwriter/src/hash_table.c
  83. 0 439
      src/3rdparty/libxlsxwriter/src/metadata.c
  84. 0 2265
      src/3rdparty/libxlsxwriter/src/packager.c
  85. 0 269
      src/3rdparty/libxlsxwriter/src/relationships.c
  86. 0 191
      src/3rdparty/libxlsxwriter/src/rich_value.c
  87. 0 142
      src/3rdparty/libxlsxwriter/src/rich_value_rel.c
  88. 0 162
      src/3rdparty/libxlsxwriter/src/rich_value_structure.c
  89. 0 199
      src/3rdparty/libxlsxwriter/src/rich_value_types.c
  90. 0 279
      src/3rdparty/libxlsxwriter/src/shared_strings.c
  91. 0 1454
      src/3rdparty/libxlsxwriter/src/styles.c
  92. 0 305
      src/3rdparty/libxlsxwriter/src/table.c
  93. 0 349
      src/3rdparty/libxlsxwriter/src/theme.c
  94. 0 792
      src/3rdparty/libxlsxwriter/src/utility.c
  95. 0 1063
      src/3rdparty/libxlsxwriter/src/vml.c
  96. 0 2900
      src/3rdparty/libxlsxwriter/src/workbook.c
  97. 0 11772
      src/3rdparty/libxlsxwriter/src/worksheet.c
  98. 0 449
      src/3rdparty/libxlsxwriter/src/xmlwriter.c
  99. 0 291
      src/3rdparty/libxlsxwriter/third_party/md5/md5.c
  100. 0 0
      src/3rdparty/libxlsxwriter/third_party/md5/md5.h

+ 0 - 112
DDR5_SLT_Monitor.pro

@@ -1,112 +0,0 @@
-#-------------------------------------------------------------------------------
-# DDR5 RDIMM SLT 上位机监控平台 —— 多工位测试监控
-# Qt 5 / C++11 / Linux + Windows(MinGW)
-#
-# 编译:
-#   qmake DDR5_SLT_Monitor.pro
-#   make -j4
-#-------------------------------------------------------------------------------
-
-QT       += core gui serialport websockets
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-# QCustomPlot 2.1.1(GPLv3,src/3rdparty/qcustomplot/GPL.txt):温控曲线用
-QT       += printsupport
-
-TARGET    = DDR5_SLT_Monitor
-TEMPLATE  = app
-greaterThan(QT_MAJOR_VERSION, 5): CONFIG += c++17
-else: CONFIG += c++11
-
-# 界面代码全部由 src/mainwindow.ui 生成
-INCLUDEPATH += $$PWD/src
-INCLUDEPATH += $$PWD/src/3rdparty/qcustomplot
-DEPENDPATH  += $$PWD/src
-
-
-# libxlsxwriter 1.2.4(MIT,src/3rdparty/libxlsxwriter/License.txt):异常记录导出 xlsx
-INCLUDEPATH += $$PWD/src/3rdparty/libxlsxwriter/include
-INCLUDEPATH += $$PWD/src/3rdparty/libxlsxwriter/include/xlsxwriter
-INCLUDEPATH += $$PWD/src/3rdparty/libxlsxwriter/src
-INCLUDEPATH += $$PWD/src/3rdparty/libxlsxwriter/third_party/minizip
-INCLUDEPATH += $$PWD/src/3rdparty/libxlsxwriter/third_party/tmpfileplus
-# 压缩用系统 zlib(MinGW 自带 libz.a)
-LIBS += -lz
-
-SOURCES += \
-    src/3rdparty/libxlsxwriter/src/app.c \
-    src/3rdparty/libxlsxwriter/src/chart.c \
-    src/3rdparty/libxlsxwriter/src/chartsheet.c \
-    src/3rdparty/libxlsxwriter/src/comment.c \
-    src/3rdparty/libxlsxwriter/src/content_types.c \
-    src/3rdparty/libxlsxwriter/src/core.c \
-    src/3rdparty/libxlsxwriter/src/custom.c \
-    src/3rdparty/libxlsxwriter/src/drawing.c \
-    src/3rdparty/libxlsxwriter/src/format.c \
-    src/3rdparty/libxlsxwriter/src/hash_table.c \
-    src/3rdparty/libxlsxwriter/src/metadata.c \
-    src/3rdparty/libxlsxwriter/src/packager.c \
-    src/3rdparty/libxlsxwriter/src/relationships.c \
-    src/3rdparty/libxlsxwriter/src/rich_value.c \
-    src/3rdparty/libxlsxwriter/src/rich_value_rel.c \
-    src/3rdparty/libxlsxwriter/src/rich_value_structure.c \
-    src/3rdparty/libxlsxwriter/src/rich_value_types.c \
-    src/3rdparty/libxlsxwriter/src/shared_strings.c \
-    src/3rdparty/libxlsxwriter/src/styles.c \
-    src/3rdparty/libxlsxwriter/src/table.c \
-    src/3rdparty/libxlsxwriter/src/theme.c \
-    src/3rdparty/libxlsxwriter/src/utility.c \
-    src/3rdparty/libxlsxwriter/src/vml.c \
-    src/3rdparty/libxlsxwriter/src/workbook.c \
-    src/3rdparty/libxlsxwriter/src/worksheet.c \
-    src/3rdparty/libxlsxwriter/src/xmlwriter.c \
-    src/3rdparty/libxlsxwriter/third_party/md5/md5.c \
-    src/3rdparty/libxlsxwriter/third_party/minizip/ioapi.c \
-    src/3rdparty/libxlsxwriter/third_party/minizip/zip.c \
-    src/3rdparty/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c
-
-win32: SOURCES += src/3rdparty/libxlsxwriter/third_party/minizip/iowin32.c
-contains(QT_ARCH, x86_64) {
-    QMAKE_CFLAGS   += -march=x86-64 -mtune=generic
-    QMAKE_CXXFLAGS += -march=x86-64 -mtune=generic
-}
-
-SOURCES += \
-    src/main.cpp \
-    src/mainwindow.cpp \
-    src/overviewview.cpp \
-    src/detailview.cpp \
-    src/createtaskdialog.cpp \
-    src/powerbutton.cpp \
-    src/stationdata.cpp \
-    src/backendlink.cpp \
-    src/localplans.cpp \
-    src/comworker.cpp \
-    src/sltproto.cpp \
-    src/comanager.cpp \
-    src/3rdparty/qcustomplot/qcustomplot.cpp
-
-HEADERS += \
-    src/appconfig.h \
-    src/mainwindow.h \
-    src/overviewview.h \
-    src/detailview.h \
-    src/createtaskdialog.h \
-    src/powerbutton.h \
-    src/stationdata.h \
-    src/backendlink.h \
-    src/localplans.h \
-    src/uiformat.h \
-    src/comworker.h \
-    src/sltproto.h \
-    src/comanager.h \
-    src/3rdparty/qcustomplot/qcustomplot.h
-
-FORMS += \
-    src/mainwindow.ui \
-    src/createtaskdialog.ui
-
-RESOURCES += \
-    src/resources.qrc
-
-# 源码/样式统一按 UTF-8 处理(Linux g++ 默认即 UTF-8)

+ 1 - 1
Dockerfile

@@ -14,7 +14,7 @@ COPY config/ ./config/
 COPY build/native/stl_native_server /usr/local/bin/stl_native_server
 
 ARG STL_BUILD_COMMIT=vd012-native
-ARG STL_VERSION=0.8.1.30
+ARG STL_VERSION=0.9.0.0
 ENV STL_BUILD_COMMIT=${STL_BUILD_COMMIT} \
     STL_VERSION=${STL_VERSION}
 

+ 1 - 1
VERSION

@@ -1 +1 @@
-0.8.1.30
+0.9.0.0

Разница между файлами не показана из-за своего большого размера
+ 0 - 43
config.json


+ 0 - 13
deploy/linux-desktop/HOVSE_SLT_Pro.desktop

@@ -1,13 +0,0 @@
-[Desktop Entry]
-Type=Application
-Version=1.0
-Name=HOVSE SLT Pro
-GenericName=DDR5 高温内存测试监控平台
-Comment=XJKJ-STL 多工位 DDR5 高温内存测试上位机 (0.8.1.24)
-Exec=/opt/XJKJ-STL/desktop-qt/run-qt.sh
-Path=/opt/XJKJ-STL/desktop-qt
-Icon=/opt/XJKJ-STL/desktop-qt/logo-mark.png
-Terminal=false
-Categories=Utility;Development;
-StartupNotify=true
-

+ 0 - 10
deploy/linux-desktop/port.json

@@ -1,10 +0,0 @@
-{
-  "_comment": "Linux 桌面工位串口配置:数组第 1 个对应 001 工位,依次到 004。请按实际 STM32 高温罩串口填写(如 ttyUSB1 或 serialNumber);注意禁止占用 /dev/ttyUSB0。",
-  "serialPorts": [
-    { "port": "", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 }
-  ]
-}
-

+ 0 - 31
deploy/linux-desktop/run-qt.sh

@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-
-# 清除全局半导体工具链(如 /etc/profile.d/anlogic-td2026.sh)注入的私有 Qt/libstdc++ 与 offscreen 环境变量
-unset LD_LIBRARY_PATH QT_PLUGIN_PATH QT_QPA_PLATFORM QT_STYLE_OVERRIDE
-
-export LANG="${LANG:-C.UTF-8}"
-export LC_ALL="${LC_ALL:-C.UTF-8}"
-
-# KDE Plasma Wayland 会话下若存在 XWayland (DISPLAY),优先走 xcb 保证无边框拖拽、弹窗居中与最大化精确一致
-if [ -n "${STL_QT_PLATFORM:-}" ]; then
-    export QT_QPA_PLATFORM="${STL_QT_PLATFORM}"
-elif [ -n "${DISPLAY:-}" ]; then
-    export QT_QPA_PLATFORM=xcb
-fi
-
-# 若安装目录可写则就地保存配置/日志/client-id;若为系统只读目录则自动落盘到用户配置目录
-if [ -w "${APP_DIR}" ]; then
-    export STL_QT_CONFIG_DIR="${APP_DIR}"
-else
-    USER_CFG="${XDG_CONFIG_HOME:-$HOME/.config}/xjkj-stl"
-    mkdir -p "${USER_CFG}"
-    [ -f "${USER_CFG}/config.json" ] || cp -f "${APP_DIR}/config.json" "${USER_CFG}/config.json" 2>/dev/null || true
-    [ -f "${USER_CFG}/port.json" ] || cp -f "${APP_DIR}/port.json" "${USER_CFG}/port.json" 2>/dev/null || true
-    export STL_QT_CONFIG_DIR="${USER_CFG}"
-fi
-
-exec "${APP_DIR}/DDR5_SLT_Monitor" "$@"
-

+ 59 - 9
deploy/pxe-dhcp/entrypoint.sh

@@ -1,33 +1,83 @@
 #!/usr/bin/env bash
 set -euo pipefail
 
+# PXE_MODE:
+#   isolated (default) — Dedicated PXE subnet/VLAN or dedicated dumb switch: dnsmasq assigns IPs + boot file
+#   proxy              — Shared LAN dumb switch with existing router DHCP: ProxyDHCP (UDP 67/4011), NEVER assigns IPs
+PXE_MODE="${PXE_MODE:-isolated}"
 PXE_IFACE="${PXE_IFACE:-eno1}"
 PXE_SERVER_IP="${PXE_SERVER_IP:-192.168.0.10}"
+PXE_SUBNET="${PXE_SUBNET:-}"
+PXE_NETMASK="${PXE_NETMASK:-255.255.255.0}"
 PXE_DENY_IFACE="${PXE_DENY_IFACE:-enp1s0}"
 PXE_RANGE_START="${PXE_RANGE_START:-192.168.0.100}"
 PXE_RANGE_END="${PXE_RANGE_END:-192.168.0.200}"
 PXE_BOOT_FILE="${PXE_BOOT_FILE:-118.efi}"
+# Optional comma-separated MAC whitelist (empty = respond to all UEFI PXEClient requests on PXE_IFACE)
+PXE_MAC_WHITELIST="${PXE_MAC_WHITELIST:-}"
 
 mkdir -p /pxe/logs /run/dnsmasq
 touch /pxe/logs/dnsmasq.log
 
 if ! ip link show "$PXE_IFACE" >/dev/null 2>&1; then
-  echo "[pxe-dhcp] ERROR: interface $PXE_IFACE does not exist; refusing to start DHCP!" >&2
+  echo "[pxe-dhcp] ERROR: interface $PXE_IFACE does not exist; refusing to start!" >&2
   exit 1
 fi
 
 ip link set "$PXE_IFACE" up || true
-if ! ip -4 addr show dev "$PXE_IFACE" | grep -q "${PXE_SERVER_IP}/24"; then
-  ip addr add "${PXE_SERVER_IP}/24" brd + dev "$PXE_IFACE" || true
-fi
 
-cat > /etc/dnsmasq.pxe.conf << EOF
+if [[ "$PXE_MODE" == "proxy" ]]; then
+  # Derive /24 subnet automatically from PXE_SERVER_IP if PXE_SUBNET not explicitly set
+  if [[ -z "$PXE_SUBNET" ]]; then
+    IFS='.' read -r o1 o2 o3 _ <<< "$PXE_SERVER_IP"
+    PXE_SUBNET="${o1}.${o2}.${o3}.0"
+  fi
+  cat > /etc/dnsmasq.pxe.conf << EOF
+port=0
+interface=${PXE_IFACE}
+except-interface=lo
+bind-interfaces
+dhcp-range=${PXE_SUBNET},proxy,${PXE_NETMASK}
+dhcp-match=set:efi-x86_64,option:client-arch,7
+dhcp-match=set:efi-x86_64,option:client-arch,9
+EOF
+  if [[ -n "$PXE_MAC_WHITELIST" ]]; then
+    IFS=',' read -ra MACS <<< "$PXE_MAC_WHITELIST"
+    for raw_mac in "${MACS[@]}"; do
+      mac="$(echo "$raw_mac" | tr -d '[:space:]')"
+      if [[ -n "$mac" ]]; then
+        echo "dhcp-host=${mac},set:sut" >> /etc/dnsmasq.pxe.conf
+      fi
+    done
+    cat >> /etc/dnsmasq.pxe.conf << EOF
+dhcp-ignore=tag:!sut
+pxe-service=tag:sut,tag:efi-x86_64,X86-64_EFI,"XJKJ-STL MemTest86",${PXE_BOOT_FILE},${PXE_SERVER_IP}
+EOF
+  else
+    cat >> /etc/dnsmasq.pxe.conf << EOF
+pxe-service=tag:efi-x86_64,X86-64_EFI,"XJKJ-STL MemTest86",${PXE_BOOT_FILE},${PXE_SERVER_IP}
+EOF
+  fi
+  cat >> /etc/dnsmasq.pxe.conf << EOF
+log-dhcp
+log-facility=/pxe/logs/dnsmasq.log
+EOF
+  echo "[pxe-dhcp] Starting dnsmasq in PROXY mode on ${PXE_IFACE} (subnet ${PXE_SUBNET}/${PXE_NETMASK} -> ${PXE_SERVER_IP}/${PXE_BOOT_FILE}, whitelist=${PXE_MAC_WHITELIST:-<all>})"
+else
+  if ! ip -4 addr show dev "$PXE_IFACE" | grep -q "${PXE_SERVER_IP}/24"; then
+    ip addr add "${PXE_SERVER_IP}/24" brd + dev "$PXE_IFACE" || true
+  fi
+  cat > /etc/dnsmasq.pxe.conf << EOF
 port=0
 interface=${PXE_IFACE}
 except-interface=lo
-except-interface=${PXE_DENY_IFACE}
+EOF
+  if [[ -n "$PXE_DENY_IFACE" && "$PXE_DENY_IFACE" != "$PXE_IFACE" ]]; then
+    echo "except-interface=${PXE_DENY_IFACE}" >> /etc/dnsmasq.pxe.conf
+  fi
+  cat >> /etc/dnsmasq.pxe.conf << EOF
 bind-interfaces
-dhcp-range=${PXE_RANGE_START},${PXE_RANGE_END},255.255.255.0,12h
+dhcp-range=${PXE_RANGE_START},${PXE_RANGE_END},${PXE_NETMASK},12h
 dhcp-option=3,${PXE_SERVER_IP}
 dhcp-option=6,${PXE_SERVER_IP}
 dhcp-option=66,"${PXE_SERVER_IP}"
@@ -38,7 +88,7 @@ dhcp-boot=tag:efi-x86_64,${PXE_BOOT_FILE},,${PXE_SERVER_IP}
 log-dhcp
 log-facility=/pxe/logs/dnsmasq.log
 EOF
+  echo "[pxe-dhcp] Starting dnsmasq in ISOLATED mode on ${PXE_IFACE} (${PXE_SERVER_IP} -> ${PXE_BOOT_FILE}, blocking ${PXE_DENY_IFACE})"
+fi
 
-echo "[pxe-dhcp] Starting dnsmasq strictly on ${PXE_IFACE} (${PXE_SERVER_IP}/24 -> ${PXE_BOOT_FILE}, blocking ${PXE_DENY_IFACE})"
 exec dnsmasq --no-daemon --conf-file=/etc/dnsmasq.pxe.conf
-

+ 4 - 0
docker-compose.yml

@@ -54,11 +54,15 @@ services:
       - NET_ADMIN
       - NET_RAW
     environment:
+      PXE_MODE: ${PXE_MODE:-isolated}
       PXE_IFACE: ${PXE_IFACE:-eno1}
       PXE_SERVER_IP: ${PXE_SERVER_IP:-192.168.0.10}
+      PXE_SUBNET: ${PXE_SUBNET:-}
+      PXE_NETMASK: ${PXE_NETMASK:-255.255.255.0}
       PXE_DENY_IFACE: ${PXE_DENY_IFACE:-enp1s0}
       PXE_RANGE_START: ${PXE_RANGE_START:-192.168.0.100}
       PXE_RANGE_END: ${PXE_RANGE_END:-192.168.0.200}
       PXE_BOOT_FILE: ${PXE_BOOT_FILE:-118.efi}
+      PXE_MAC_WHITELIST: ${PXE_MAC_WHITELIST:-}
     volumes:
       - ./data/pxe_logs:/pxe/logs

Разница между файлами не показана из-за своего большого размера
+ 0 - 769
docs/QT_CLIENT_API_ZH.md


+ 0 - 9
docs/port.example.json

@@ -1,9 +0,0 @@
-{
-  "_comment": "工位串口配置模板:复制并重命名为 port.json 放到与 config.json 同级目录。数组第 1 个对应 SLT-HT-001,依次到 SLT-HT-004。Windows 填 COMx(如 COM18)或 USB serialNumber;Linux 填 /dev/ttyUSBx 或 serialNumber(禁止占用 /dev/ttyUSB0)。波特率固定 115200。",
-  "serialPorts": [
-    { "port": "", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 }
-  ]
-}

+ 199 - 100
native/stl_accel/c_bridge.c

@@ -33,8 +33,10 @@
 #include <sys/epoll.h>
 #include <sys/eventfd.h>
 #include <sys/mman.h>
+#include <sys/resource.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
+#include <sys/statvfs.h>
 #include <sys/timerfd.h>
 #include <sys/uio.h>
 #include <termios.h>
@@ -658,9 +660,8 @@ static ssh_session stl_libssh_connect(
     return sess;
 }
 
-#define MAX_SSH_SLOTS 16
-#define MAX_SOL_SLOTS 16
-#define MAX_IPMI_SLOTS 16
+#define STL_SSH_PID_BASE 0x100000
+#define STL_SOL_PID_BASE 0x200000
 
 typedef struct {
     int          in_use;
@@ -688,16 +689,81 @@ typedef struct {
     char            sdr_cache_path[256];
 } StlIpmiSlot;
 
-static pthread_mutex_t g_slots_lock = PTHREAD_MUTEX_INITIALIZER;
-static StlSshSlot      g_ssh_slots[MAX_SSH_SLOTS];
-static StlSolSlot      g_sol_slots[MAX_SOL_SLOTS];
-static StlIpmiSlot     g_ipmi_slots[MAX_IPMI_SLOTS];
-static pthread_once_t  g_ipmi_slots_once = PTHREAD_ONCE_INIT;
-
-static void init_ipmi_slots_once(void) {
-    for (int i = 0; i < MAX_IPMI_SLOTS; i++) {
-        pthread_mutex_init(&g_ipmi_slots[i].mu, NULL);
+static pthread_mutex_t  g_slots_lock   = PTHREAD_MUTEX_INITIALIZER;
+static StlSshSlot     **g_ssh_slots    = NULL;
+static int              g_ssh_cap      = 0;
+static StlSolSlot     **g_sol_slots    = NULL;
+static int              g_sol_cap      = 0;
+static StlIpmiSlot    **g_ipmi_slots   = NULL;
+static int              g_ipmi_cap     = 0;
+
+static StlSshSlot *alloc_ssh_slot_locked(int *out_idx) {
+    for (int i = 0; i < g_ssh_cap; i++) {
+        if (g_ssh_slots[i] && !g_ssh_slots[i]->in_use) {
+            *out_idx = i;
+            return g_ssh_slots[i];
+        }
+    }
+    int new_cap = (g_ssh_cap == 0) ? 16 : (g_ssh_cap * 2);
+    StlSshSlot **next = (StlSshSlot **)realloc(g_ssh_slots, (size_t)new_cap * sizeof(StlSshSlot *));
+    if (!next) return NULL;
+    memset(next + g_ssh_cap, 0, (size_t)(new_cap - g_ssh_cap) * sizeof(StlSshSlot *));
+    g_ssh_slots = next;
+    int idx = g_ssh_cap;
+    g_ssh_cap = new_cap;
+    StlSshSlot *s = (StlSshSlot *)calloc(1, sizeof(StlSshSlot));
+    if (!s) return NULL;
+    g_ssh_slots[idx] = s;
+    *out_idx = idx;
+    return s;
+}
+
+static StlSolSlot *alloc_sol_slot_locked(int *out_idx) {
+    for (int i = 0; i < g_sol_cap; i++) {
+        if (g_sol_slots[i] && !g_sol_slots[i]->in_use) {
+            *out_idx = i;
+            return g_sol_slots[i];
+        }
+    }
+    int new_cap = (g_sol_cap == 0) ? 16 : (g_sol_cap * 2);
+    StlSolSlot **next = (StlSolSlot **)realloc(g_sol_slots, (size_t)new_cap * sizeof(StlSolSlot *));
+    if (!next) return NULL;
+    memset(next + g_sol_cap, 0, (size_t)(new_cap - g_sol_cap) * sizeof(StlSolSlot *));
+    g_sol_slots = next;
+    int idx = g_sol_cap;
+    g_sol_cap = new_cap;
+    StlSolSlot *s = (StlSolSlot *)calloc(1, sizeof(StlSolSlot));
+    if (!s) return NULL;
+    g_sol_slots[idx] = s;
+    *out_idx = idx;
+    return s;
+}
+
+static StlIpmiSlot *alloc_ipmi_slot_locked(int *out_idx) {
+    for (int i = 0; i < g_ipmi_cap; i++) {
+        if (g_ipmi_slots[i]) {
+            pthread_mutex_lock(&g_ipmi_slots[i]->mu);
+            if (!g_ipmi_slots[i]->in_use) {
+                *out_idx = i;
+                return g_ipmi_slots[i]; /* returns with slot->mu HELD */
+            }
+            pthread_mutex_unlock(&g_ipmi_slots[i]->mu);
+        }
     }
+    int new_cap = (g_ipmi_cap == 0) ? 16 : (g_ipmi_cap * 2);
+    StlIpmiSlot **next = (StlIpmiSlot **)realloc(g_ipmi_slots, (size_t)new_cap * sizeof(StlIpmiSlot *));
+    if (!next) return NULL;
+    memset(next + g_ipmi_cap, 0, (size_t)(new_cap - g_ipmi_cap) * sizeof(StlIpmiSlot *));
+    g_ipmi_slots = next;
+    int idx = g_ipmi_cap;
+    g_ipmi_cap = new_cap;
+    StlIpmiSlot *s = (StlIpmiSlot *)calloc(1, sizeof(StlIpmiSlot));
+    if (!s) return NULL;
+    pthread_mutex_init(&s->mu, NULL);
+    pthread_mutex_lock(&s->mu);
+    g_ipmi_slots[idx] = s;
+    *out_idx = idx;
+    return s; /* returns with slot->mu HELD */
 }
 
 static void *ssh_pump_thread_fn(void *arg) {
@@ -1010,22 +1076,19 @@ int c_pty_spawn_ssh_console(
 
     pthread_mutex_lock(&g_slots_lock);
     int idx = -1;
-    for (int i = 0; i < MAX_SSH_SLOTS; i++) {
-        if (!g_ssh_slots[i].in_use) {
-            idx = i;
-            memset(&g_ssh_slots[i], 0, sizeof(g_ssh_slots[i]));
-            g_ssh_slots[i].in_use         = 1;
-            g_ssh_slots[i].alive          = 1;
-            g_ssh_slots[i].stop_requested = 0;
-            g_ssh_slots[i].sock_peer_fd   = sv[1];
-            g_ssh_slots[i].session        = sess;
-            g_ssh_slots[i].chan           = chan;
-            break;
-        }
+    StlSshSlot *slot = alloc_ssh_slot_locked(&idx);
+    if (slot) {
+        memset(slot, 0, sizeof(*slot));
+        slot->in_use         = 1;
+        slot->alive          = 1;
+        slot->stop_requested = 0;
+        slot->sock_peer_fd   = sv[1];
+        slot->session        = sess;
+        slot->chan           = chan;
     }
     pthread_mutex_unlock(&g_slots_lock);
 
-    if (idx < 0) {
+    if (!slot || idx < 0) {
         close(sv[0]);
         close(sv[1]);
         (void)ssh_channel_close(chan);
@@ -1035,10 +1098,10 @@ int c_pty_spawn_ssh_console(
         return -1;
     }
 
-    if (pthread_create(&g_ssh_slots[idx].pump_thread, NULL, ssh_pump_thread_fn, &g_ssh_slots[idx]) != 0) {
+    if (pthread_create(&slot->pump_thread, NULL, ssh_pump_thread_fn, slot) != 0) {
         pthread_mutex_lock(&g_slots_lock);
-        g_ssh_slots[idx].in_use = 0;
-        g_ssh_slots[idx].alive  = 0;
+        slot->in_use = 0;
+        slot->alive  = 0;
         pthread_mutex_unlock(&g_slots_lock);
         close(sv[0]);
         close(sv[1]);
@@ -1048,10 +1111,10 @@ int c_pty_spawn_ssh_console(
         ssh_free(sess);
         return -1;
     }
-    g_ssh_slots[idx].thread_started = 1;
+    slot->thread_started = 1;
 
     *out_master_fd = sv[0];
-    *out_child_pid = -(100 + idx);
+    *out_child_pid = -(STL_SSH_PID_BASE + idx);
     return 0;
 }
 
@@ -1130,24 +1193,21 @@ int c_pty_spawn_ipmi_sol(
 
     pthread_mutex_lock(&g_slots_lock);
     int idx = -1;
-    for (int i = 0; i < MAX_SOL_SLOTS; i++) {
-        if (!g_sol_slots[i].in_use) {
-            idx = i;
-            g_sol_slots[i].in_use = 1;
-            g_sol_slots[i].ctx    = ctx;
-            g_sol_slots[i].fd     = fd;
-            break;
-        }
+    StlSolSlot *sol = alloc_sol_slot_locked(&idx);
+    if (sol) {
+        sol->in_use = 1;
+        sol->ctx    = ctx;
+        sol->fd     = fd;
     }
     pthread_mutex_unlock(&g_slots_lock);
 
-    if (idx < 0) {
+    if (!sol || idx < 0) {
         close(fd);
         ipmiconsole_ctx_destroy(ctx);
         return -1;
     }
     *out_master_fd = fd;
-    *out_child_pid = -(200 + idx);
+    *out_child_pid = -(STL_SOL_PID_BASE + idx);
     return 0;
 }
 
@@ -1185,21 +1245,29 @@ ssize_t c_pty_write_bytes(int master_fd, const uint8_t *buf, size_t len) {
 }
 
 int c_pty_is_alive(int child_pid) {
-    if (child_pid <= -100 && child_pid >= -(100 + MAX_SSH_SLOTS - 1)) {
-        int idx = (-child_pid) - 100;
-        return (g_ssh_slots[idx].in_use &&
-                __atomic_load_n(&g_ssh_slots[idx].alive, __ATOMIC_ACQUIRE))
-                   ? 1
-                   : 0;
+    pthread_mutex_lock(&g_slots_lock);
+    if (child_pid <= -STL_SSH_PID_BASE && child_pid > -STL_SOL_PID_BASE) {
+        int idx = (-child_pid) - STL_SSH_PID_BASE;
+        StlSshSlot *slot = (idx >= 0 && idx < g_ssh_cap) ? g_ssh_slots[idx] : NULL;
+        int ok = (slot && slot->in_use &&
+                  __atomic_load_n(&slot->alive, __ATOMIC_ACQUIRE))
+                     ? 1
+                     : 0;
+        pthread_mutex_unlock(&g_slots_lock);
+        return ok;
     }
-    if (child_pid <= -200 && child_pid >= -(200 + MAX_SOL_SLOTS - 1)) {
-        int idx = (-child_pid) - 200;
-        if (!g_sol_slots[idx].in_use || !g_sol_slots[idx].ctx) return 0;
-        return (ipmiconsole_ctx_status(g_sol_slots[idx].ctx) ==
+    if (child_pid <= -STL_SOL_PID_BASE) {
+        int idx = (-child_pid) - STL_SOL_PID_BASE;
+        StlSolSlot *sol = (idx >= 0 && idx < g_sol_cap) ? g_sol_slots[idx] : NULL;
+        ipmiconsole_ctx_t ctx = (sol && sol->in_use) ? sol->ctx : NULL;
+        pthread_mutex_unlock(&g_slots_lock);
+        if (!ctx) return 0;
+        return (ipmiconsole_ctx_status(ctx) ==
                 IPMICONSOLE_CTX_STATUS_SOL_ESTABLISHED)
                    ? 1
                    : 0;
     }
+    pthread_mutex_unlock(&g_slots_lock);
     return 0;
 }
 
@@ -1208,33 +1276,43 @@ void c_pty_close(int master_fd, int child_pid) {
         (void)shutdown(master_fd, SHUT_RDWR);
         close(master_fd);
     }
-    if (child_pid <= -100 && child_pid >= -(100 + MAX_SSH_SLOTS - 1)) {
-        int idx = (-child_pid) - 100;
-        StlSshSlot *slot = &g_ssh_slots[idx];
-        __atomic_store_n(&slot->stop_requested, 1, __ATOMIC_RELEASE);
-        if (slot->thread_started) {
-            pthread_join(slot->pump_thread, NULL);
-        }
+    if (child_pid <= -STL_SSH_PID_BASE && child_pid > -STL_SOL_PID_BASE) {
+        int idx = (-child_pid) - STL_SSH_PID_BASE;
         pthread_mutex_lock(&g_slots_lock);
-        if (slot->sock_peer_fd >= 0) {
-            close(slot->sock_peer_fd);
-            slot->sock_peer_fd = -1;
+        StlSshSlot *slot = (idx >= 0 && idx < g_ssh_cap) ? g_ssh_slots[idx] : NULL;
+        int started = (slot && slot->in_use) ? slot->thread_started : 0;
+        pthread_t th;
+        if (slot && slot->in_use) {
+            __atomic_store_n(&slot->stop_requested, 1, __ATOMIC_RELEASE);
+            th = slot->pump_thread;
         }
-        slot->in_use         = 0;
-        slot->alive          = 0;
-        slot->thread_started = 0;
         pthread_mutex_unlock(&g_slots_lock);
+        if (slot && started) {
+            pthread_join(th, NULL);
+        }
+        if (slot) {
+            pthread_mutex_lock(&g_slots_lock);
+            if (slot->sock_peer_fd >= 0) {
+                close(slot->sock_peer_fd);
+                slot->sock_peer_fd = -1;
+            }
+            slot->in_use         = 0;
+            slot->alive          = 0;
+            slot->thread_started = 0;
+            pthread_mutex_unlock(&g_slots_lock);
+        }
         return;
     }
-    if (child_pid <= -200 && child_pid >= -(200 + MAX_SOL_SLOTS - 1)) {
-        int idx = (-child_pid) - 200;
+    if (child_pid <= -STL_SOL_PID_BASE) {
+        int idx = (-child_pid) - STL_SOL_PID_BASE;
         ipmiconsole_ctx_t ctx = NULL;
         pthread_mutex_lock(&g_slots_lock);
-        if (g_sol_slots[idx].in_use) {
-            ctx = g_sol_slots[idx].ctx;
-            g_sol_slots[idx].ctx    = NULL;
-            g_sol_slots[idx].fd     = -1;
-            g_sol_slots[idx].in_use = 0;
+        StlSolSlot *sol = (idx >= 0 && idx < g_sol_cap) ? g_sol_slots[idx] : NULL;
+        if (sol && sol->in_use) {
+            ctx = sol->ctx;
+            sol->ctx    = NULL;
+            sol->fd     = -1;
+            sol->in_use = 0;
         }
         pthread_mutex_unlock(&g_slots_lock);
         if (ctx) {
@@ -1507,9 +1585,11 @@ int c_ssh_sftp_get_file(
  * 6. In-Process libfreeipmi Persistent Out-of-Band Session & Telemetry
  * ========================================================================= */
 static StlIpmiSlot *get_ipmi_slot(int handle) {
-    pthread_once(&g_ipmi_slots_once, init_ipmi_slots_once);
-    if (handle < 1 || handle > MAX_IPMI_SLOTS) return NULL;
-    return &g_ipmi_slots[handle - 1];
+    if (handle < 1) return NULL;
+    pthread_mutex_lock(&g_slots_lock);
+    StlIpmiSlot *s = (handle <= g_ipmi_cap) ? g_ipmi_slots[handle - 1] : NULL;
+    pthread_mutex_unlock(&g_slots_lock);
+    return s;
 }
 
 int c_ipmi_open(
@@ -1518,7 +1598,6 @@ int c_ipmi_open(
     const char *password,
     int         cipher_suite,
     int         timeout_ms) {
-    pthread_once(&g_ipmi_slots_once, init_ipmi_slots_once);
     if (!host || !host[0] || !user || !password) return -1;
 
     ipmi_ctx_t ctx = ipmi_ctx_create();
@@ -1553,37 +1632,32 @@ int c_ipmi_open(
 
     pthread_mutex_lock(&g_slots_lock);
     int idx = -1;
-    for (int i = 0; i < MAX_IPMI_SLOTS; i++) {
-        pthread_mutex_lock(&g_ipmi_slots[i].mu);
-        if (!g_ipmi_slots[i].in_use) {
-            idx = i;
-            g_ipmi_slots[i].in_use = 1;
-            g_ipmi_slots[i].alive  = 1;
-            g_ipmi_slots[i].ctx    = ctx;
-            snprintf(g_ipmi_slots[i].host, sizeof(g_ipmi_slots[i].host), "%s", host);
-            {
-                char safe_host[96];
-                size_t hi = 0;
-                for (; host[hi] && hi + 1 < sizeof(safe_host); hi++) {
-                    unsigned char ch = (unsigned char)host[hi];
-                    safe_host[hi] = ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') ||
-                                     (ch >= 'A' && ch <= 'Z') || ch == '.' || ch == '_' || ch == '-')
-                                        ? (char)ch
-                                        : '_';
-                }
-                safe_host[hi] = '\0';
-                snprintf(g_ipmi_slots[i].sdr_cache_path, sizeof(g_ipmi_slots[i].sdr_cache_path),
-                         "/tmp/stl_sdr_%ld_%d_%s.cache", (long)getpid(), i, safe_host);
-                unlink(g_ipmi_slots[i].sdr_cache_path);
+    StlIpmiSlot *slot = alloc_ipmi_slot_locked(&idx);
+    if (slot) {
+        slot->in_use = 1;
+        slot->alive  = 1;
+        slot->ctx    = ctx;
+        snprintf(slot->host, sizeof(slot->host), "%s", host);
+        {
+            char safe_host[96];
+            size_t hi = 0;
+            for (; host[hi] && hi + 1 < sizeof(safe_host); hi++) {
+                unsigned char ch = (unsigned char)host[hi];
+                safe_host[hi] = ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') ||
+                                 (ch >= 'A' && ch <= 'Z') || ch == '.' || ch == '_' || ch == '-')
+                                    ? (char)ch
+                                    : '_';
             }
-            pthread_mutex_unlock(&g_ipmi_slots[i].mu);
-            break;
+            safe_host[hi] = '\0';
+            snprintf(slot->sdr_cache_path, sizeof(slot->sdr_cache_path),
+                     "/tmp/stl_sdr_%ld_%d_%s.cache", (long)getpid(), idx, safe_host);
+            unlink(slot->sdr_cache_path);
         }
-        pthread_mutex_unlock(&g_ipmi_slots[i].mu);
+        pthread_mutex_unlock(&slot->mu);
     }
     pthread_mutex_unlock(&g_slots_lock);
 
-    if (idx < 0) {
+    if (!slot || idx < 0) {
         (void)ipmi_ctx_close(ctx);
         ipmi_ctx_destroy(ctx);
         return -1;
@@ -2177,3 +2251,28 @@ int c_ipmi_device_info(
     if (out_len) *out_len = used;
     return rc;
 }
+
+int stl_free_disk_bytes(const char *path, uint64_t *out_avail_bytes) {
+    if (!path || !path[0] || !out_avail_bytes) return -1;
+    struct statvfs st;
+    if (statvfs(path, &st) != 0) return -1;
+    *out_avail_bytes = (uint64_t)st.f_bavail * (uint64_t)st.f_frsize;
+    return 0;
+}
+
+void stl_set_thread_idle_priority(void) {
+#ifdef SCHED_IDLE
+    struct sched_param sp;
+    memset(&sp, 0, sizeof(sp));
+    if (pthread_setschedparam(pthread_self(), SCHED_IDLE, &sp) != 0) {
+        (void)setpriority(PRIO_PROCESS, 0, 19);
+    }
+#else
+    (void)setpriority(PRIO_PROCESS, 0, 19);
+#endif
+}
+
+int stl_chmod_0600(const char *path) {
+    if (!path || !path[0]) return -1;
+    return chmod(path, 0600);
+}

Разница между файлами не показана из-за своего большого размера
+ 218 - 608
native/stl_accel/src/actors.rs


Разница между файлами не показана из-за своего большого размера
+ 702 - 689
native/stl_accel/src/api.rs


+ 114 - 124
native/stl_accel/src/commands.rs

@@ -184,17 +184,15 @@ pub fn handle_station_command_nonblocking(
             } else {
                 args.get_str_or("action", "enable").to_ascii_lowercase()
             };
-            st.ensure_persistent_baseline();
             let seq = st.set_stage_intent(&stage, &action, args);
             st.log_debug(
                 "INTENT",
                 &format!(
-                    "SET_STAGE_INTENT stage={} action={} seq={} operator={} has_mem_params={} has_amt={} has_mt={}",
+                    "SET_STAGE_INTENT stage={} action={} seq={} operator={} has_amt={} has_mt={}",
                     stage,
                     action,
                     seq,
                     operator,
-                    args.get("memory_params").is_some(),
                     args.get("amt").is_some() || args.get("settings").is_some(),
                     args.get("mt").is_some() || args.get("selection").is_some(),
                 ),
@@ -203,16 +201,6 @@ pub fn handle_station_command_nonblocking(
                 "uip" | "uip1" | "uip2" => {
                     if let Some(ovs) = args.get_arr("uip_overrides") {
                         st.uip_overrides = ovs.clone();
-                    } else if args.get("memory_params").is_some() {
-                        // Full Qt memory_params snapshot replaces previous ICT parameter overrides
-                        // while preserving any prior explicit RMT/maskmain/PXE directives unless overwritten below.
-                        st.uip_overrides.retain(|x| {
-                            matches!(x.get_str_or("id", "").as_str(), "rmt" | "rmt.userdef" | "maskmain")
-                        });
-                        if args.get_arr("uip_raw_commands").is_none() {
-                            st.uip_raw_commands
-                                .retain(|c| c.trim().to_ascii_lowercase().starts_with("pxe "));
-                        }
                     }
                     if let Some(raws) = args.get_arr("uip_raw_commands") {
                         st.uip_raw_commands = raws
@@ -220,52 +208,18 @@ pub fn handle_station_command_nonblocking(
                             .filter_map(|x| x.as_str().map(|s| s.to_string()))
                             .collect();
                     }
-                    let rmt_disable_only = FirmwareContract::rmt_selected_is_disable_only(args.get("rmt"));
-                    let want_rmt = if rmt_disable_only {
-                        Some(false)
-                    } else {
-                        args.get_bool("run_rmt")
-                            .or_else(|| args.get("rmt").and_then(|r| r.get_bool("enabled")))
-                    };
+                    let want_rmt = args
+                        .get_bool("run_rmt")
+                        .or_else(|| args.get("rmt").and_then(|r| r.get_bool("enabled")));
                     if let Some(en) = want_rmt {
                         st.boot_plan.set("run_rmt", JsonVal::Bool(en));
                         // Last-write-wins: clear stale standalone "rmt" intent so it cannot overwrite this newer uip/uip1 intent
                         st.stage_intents.remove("rmt");
-                    }
-                    if args.get("memory_params").is_some()
-                        || want_rmt.is_some()
-                        || args.get("rmt").is_some()
-                    {
-                        let mem_params = args
-                            .get("memory_params")
-                            .cloned()
-                            .unwrap_or_else(JsonVal::obj);
-                        let (built_ovs, built_raws) =
-                            FirmwareContract::memory_params_to_uip_overrides_for_family(
-                                &mem_params,
-                                want_rmt,
-                                args.get("rmt"),
-                                fw_fam,
-                            );
-                        for ov in built_ovs {
-                            let id = ov.get_str_or("id", "");
-                            if !id.is_empty() {
-                                st.uip_overrides.retain(|x| x.get_str_or("id", "") != id);
-                                st.uip_overrides.push(ov);
-                            }
-                        }
-                        if let Some(en) = want_rmt {
-                            FirmwareContract::apply_rmt_policy_to_uip_overrides(
-                                &mut st.uip_overrides,
-                                en,
-                                fw_fam,
-                            );
-                        }
-                        for r in built_raws {
-                            if !st.uip_raw_commands.contains(&r) {
-                                st.uip_raw_commands.push(r);
-                            }
-                        }
+                        FirmwareContract::apply_rmt_policy_to_uip_overrides(
+                            &mut st.uip_overrides,
+                            en,
+                            fw_fam,
+                        );
                     }
                 }
                 "rmt" => {
@@ -306,7 +260,7 @@ pub fn handle_station_command_nonblocking(
                         let has_explicit_ovs = amt_map_opt
                             .and_then(|a| a.get_arr("overrides"))
                             .is_some();
-                        if !has_explicit_ovs && (operator == "qt" || has_explicit_amt_sel) {
+                        if !has_explicit_ovs && has_explicit_amt_sel {
                             if let Some(JsonVal::Arr(ref mut ovs)) =
                                 st.amt_settings.as_obj_mut().and_then(|m| m.get_mut("overrides"))
                             {
@@ -434,7 +388,7 @@ pub fn handle_station_command_nonblocking(
                     }
                 }
             }
-            st.clear_persistent_baseline();
+            st.clear_batch_workspace();
             save_station_settings(data_dir, st);
             let preset_label = found
                 .get_str("label")
@@ -461,41 +415,24 @@ pub fn handle_station_command_nonblocking(
             let want_rmt = args
                 .get_bool("run_rmt")
                 .or_else(|| args.get_bool("rmt"))
-                .or_else(|| args.get("rmt").and_then(|r| r.get_bool("enabled")))
-                .or_else(|| {
-                    args.get("memory_params")
-                        .and_then(|m| m.get_bool("run_rmt").or_else(|| m.get_bool("rmt")))
-                });
-            if is_uip1
-                && (args.get("memory_params").is_some()
-                    || args.get("rmt").is_some()
-                    || want_rmt.is_some())
-            {
-                let mem_params = args
-                    .get("memory_params")
-                    .cloned()
-                    .unwrap_or_else(JsonVal::obj);
-                let (ovs, raws) = FirmwareContract::memory_params_to_uip_overrides_for_family(
-                    &mem_params,
-                    want_rmt,
-                    args.get("rmt"),
-                    fw_fam,
-                );
-                if let Ok(built) =
-                    contract.build_uip_commands_for_family(&ovs, &raws, Some(1), fw_fam)
-                {
-                    extra_lines.extend(built);
-                }
-                st.ensure_persistent_baseline();
-                if !ovs.is_empty() {
-                    st.uip_overrides = ovs;
-                }
-                if !raws.is_empty() {
-                    st.uip_raw_commands = raws;
+                .or_else(|| args.get("rmt").and_then(|r| r.get_bool("enabled")));
+            if is_uip1 {
+                if let Some(en) = want_rmt {
+                    FirmwareContract::apply_rmt_policy_to_uip_overrides(
+                        &mut st.uip_overrides,
+                        en,
+                        fw_fam,
+                    );
+                    let mut tmp_ovs = Vec::new();
+                    FirmwareContract::apply_rmt_policy_to_uip_overrides(&mut tmp_ovs, en, fw_fam);
+                    if let Ok(built) =
+                        contract.build_uip_commands_for_family(&tmp_ovs, &[], Some(1), fw_fam)
+                    {
+                        extra_lines.extend(built);
+                    }
                 }
             }
             if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "uip" {
-                st.ensure_persistent_baseline();
                 let seq = st.set_stage_intent("uip", "continue_uip", args);
                 st.log_debug(
                     "INTENT",
@@ -572,12 +509,10 @@ pub fn handle_station_command_nonblocking(
                 })
                 .unwrap_or(false);
             if !(st.prompt_ready && st.prompt_kind == "amt" && this_cpu_done) {
-                st.ensure_persistent_baseline();
                 st.amt_settings
                     .set("action", JsonVal::Str("skip".to_string()));
             }
             if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "amt" {
-                st.ensure_persistent_baseline();
                 let seq = st.set_stage_intent("amt", "skip_amt", args);
                 st.log_debug(
                     "INTENT",
@@ -626,7 +561,7 @@ pub fn handle_station_command_nonblocking(
                 let pxe_host = pxe_state.get_str_or("pxe_host", "");
                 sync_mt86_cfg_all_candidates(&pxe_host, pxe_tftp_dir, &cfg_text);
             }
-            st.clear_persistent_baseline();
+            st.clear_batch_workspace();
             save_station_settings(data_dir, st);
             let mut details = JsonVal::obj();
             details.set(
@@ -660,7 +595,7 @@ pub fn handle_station_command_nonblocking(
                 .or_else(|| args.get_arr("uip_overrides"))
                 .cloned()
                 .unwrap_or_default();
-            let mut raws: Vec<String> = args
+            let raws: Vec<String> = args
                 .get_arr("raw_commands")
                 .or_else(|| args.get_arr("uip_raw_commands"))
                 .map(|a| {
@@ -669,21 +604,8 @@ pub fn handle_station_command_nonblocking(
                         .collect()
                 })
                 .unwrap_or_default();
-            if ovs.is_empty() && (args.get("memory_params").is_some() || args.get("rmt").is_some())
-            {
-                let mem_params = args
-                    .get("memory_params")
-                    .cloned()
-                    .unwrap_or_else(JsonVal::obj);
-                let (built_ovs, built_raws) =
-                    FirmwareContract::memory_params_to_uip_overrides_for_family(
-                        &mem_params,
-                        args.get_bool("run_rmt"),
-                        args.get("rmt"),
-                        fw_fam,
-                    );
-                ovs = built_ovs;
-                raws.extend(built_raws);
+            if let Some(en) = args.get_bool("run_rmt") {
+                FirmwareContract::apply_rmt_policy_to_uip_overrides(&mut ovs, en, fw_fam);
             }
             let target_stg = args.get_i64("target_uip_stage").map(|v| v as u8);
             let lines =
@@ -691,7 +613,6 @@ pub fn handle_station_command_nonblocking(
                     Ok(c) => c,
                     Err(e) => return StationCmdExec::Immediate(Err(e), None),
                 };
-            st.ensure_persistent_baseline();
             st.uip_overrides = ovs;
             st.uip_raw_commands = raws;
             if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "uip" {
@@ -777,7 +698,7 @@ pub fn handle_station_command_nonblocking(
                 Err(e) => return StationCmdExec::Immediate(Err(e), None),
             };
             st.amt_settings = settings.clone();
-            st.clear_persistent_baseline();
+            st.clear_batch_workspace();
             save_station_settings(data_dir, st);
             let mut details = JsonVal::obj();
             details.set("amt_settings", settings.clone());
@@ -818,7 +739,6 @@ pub fn handle_station_command_nonblocking(
                 Err(e) => return StationCmdExec::Immediate(Err(e), None),
             };
             if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "amt" {
-                st.ensure_persistent_baseline();
                 st.amt_settings = settings;
                 let seq = st.set_stage_intent("amt", "enable", args);
                 st.log_debug(
@@ -922,7 +842,6 @@ pub fn handle_station_command_nonblocking(
             if args.get_bool("run_amt") == Some(false)
                 || args.get("amt").and_then(|a| a.get_bool("enabled")) == Some(false)
             {
-                st.ensure_persistent_baseline();
                 st.amt_settings
                     .set("action", JsonVal::Str("skip".to_string()));
                 if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "amt" {
@@ -959,7 +878,6 @@ pub fn handle_station_command_nonblocking(
                 .unwrap_or_default();
             let mut merged_amt = effective_settings.clone();
             merged_amt.set("action", JsonVal::Str("run".to_string()));
-            st.ensure_persistent_baseline();
             st.amt_settings = merged_amt;
             if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "amt" {
                 let seq = st.set_stage_intent("amt", "start_amt", args);
@@ -1022,7 +940,6 @@ pub fn handle_station_command_nonblocking(
             if let Some(err) = input_id_mismatch_err(st, args) {
                 return StationCmdExec::Immediate(Err(err), None);
             }
-            st.ensure_persistent_baseline();
             st.boot_plan.set("mt_enabled", JsonVal::Bool(false));
             st.boot_plan.set("run_mt", JsonVal::Bool(false));
             if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "uefi" {
@@ -1075,7 +992,6 @@ pub fn handle_station_command_nonblocking(
             let pxe_host = pxe_state.get_str_or("pxe_host", "");
             sync_mt86_cfg_all_candidates(&pxe_host, pxe_tftp_dir, &cfg_text);
 
-            st.ensure_persistent_baseline();
             st.mt_selection = sel.clone();
             st.boot_plan.set("mt_enabled", JsonVal::Bool(true));
             st.boot_plan.set("run_mt", JsonVal::Bool(true));
@@ -1208,31 +1124,93 @@ pub fn handle_station_command_nonblocking(
             if let Some(wd) = args.get("watchdog").or_else(|| raw_plan.get("watchdog")) {
                 st.watchdog.apply_patch(wd);
             }
-            st.clear_persistent_baseline();
+            if let Some(tp) = args.get("thermal_policy").or_else(|| raw_plan.get("thermal_policy")) {
+                if let Some(en) = tp.get_bool("auto_enabled") {
+                    st.thermal_auto_enabled = en;
+                }
+                if let Some(tc) = tp.get_i64("target_temp_c") {
+                    if (0..=254).contains(&tc) {
+                        st.thermal_target_c = tc as u8;
+                    }
+                }
+                if let Some(req) = tp.get_bool("require_online") {
+                    st.thermal_require_online = req;
+                }
+            }
+            st.clear_batch_workspace();
             save_station_settings(data_dir, st);
             let audit = AuditRecordDraft {
                 category: "boot_plan".to_string(),
                 action: "save_boot_plan".to_string(),
                 summary: format!(
-                    "保存启动计划:preset={} · mt_enabled={}",
+                    "保存启动计划:preset={} · mt_enabled={} · thermal_auto={}({}°C)",
                     norm.get_str_or("preset", "manual"),
-                    norm.get_bool("mt_enabled").unwrap_or(false)
+                    norm.get_bool("mt_enabled").unwrap_or(false),
+                    st.thermal_auto_enabled,
+                    st.thermal_target_c
                 ),
                 details: norm.clone(),
             };
+            let mut th_pol = JsonVal::obj();
+            th_pol.set("auto_enabled", JsonVal::Bool(st.thermal_auto_enabled));
+            th_pol.set("target_temp_c", JsonVal::Num(st.thermal_target_c as f64));
+            th_pol.set("require_online", JsonVal::Bool(st.thermal_require_online));
             let mut res = JsonVal::obj();
             res.set("boot_plan", norm);
             res.set("watchdog", st.watchdog.to_json());
+            res.set("thermal_policy", th_pol);
             res.set("hardware_written", JsonVal::Bool(false));
             StationCmdExec::Immediate(Ok(res), Some(audit))
         }
+        "ConfigureThermalPolicy" => {
+            let patch = args.get("thermal_policy").unwrap_or(args);
+            if let Some(en) = patch
+                .get_bool("auto_enabled")
+                .or_else(|| patch.get_bool("thermal_auto_enabled"))
+            {
+                st.thermal_auto_enabled = en;
+            }
+            if let Some(tc) = patch
+                .get_i64("target_temp_c")
+                .or_else(|| patch.get_i64("target_temp"))
+            {
+                if (0..=254).contains(&tc) {
+                    st.thermal_target_c = tc as u8;
+                }
+            }
+            if let Some(req) = patch
+                .get_bool("require_online")
+                .or_else(|| patch.get_bool("require_thermal_online"))
+            {
+                st.thermal_require_online = req;
+            }
+            st.clear_batch_workspace();
+            save_station_settings(data_dir, st);
+            let mut th_pol = JsonVal::obj();
+            th_pol.set("auto_enabled", JsonVal::Bool(st.thermal_auto_enabled));
+            th_pol.set("target_temp_c", JsonVal::Num(st.thermal_target_c as f64));
+            th_pol.set("require_online", JsonVal::Bool(st.thermal_require_online));
+            let audit = AuditRecordDraft {
+                category: "thermal_mcu".to_string(),
+                action: "configure_thermal_policy".to_string(),
+                summary: format!(
+                    "保存高温罩闭环联动策略:auto={} · target={}°C · require_online={}",
+                    st.thermal_auto_enabled, st.thermal_target_c, st.thermal_require_online
+                ),
+                details: th_pol.clone(),
+            };
+            let mut res = JsonVal::obj();
+            res.set("station_id", JsonVal::Str(sid));
+            res.set("thermal_policy", th_pol);
+            StationCmdExec::Immediate(Ok(res), Some(audit))
+        }
         "ConfigureWatchdog" => {
             let patch = args.get("watchdog").unwrap_or(args);
             st.watchdog.apply_patch(patch);
             if args.get_bool("reset_consecutive_hangs") == Some(true) {
                 st.consecutive_hang_count = 0;
             }
-            st.clear_persistent_baseline();
+            st.clear_batch_workspace();
             save_station_settings(data_dir, st);
             let wd_json = st.watchdog.to_json();
             let audit = AuditRecordDraft {
@@ -1291,7 +1269,7 @@ pub fn handle_station_command_nonblocking(
             prof.set("name", JsonVal::Str(pname.clone()));
             prof.set("updated_unix_ms", JsonVal::Num(now as f64));
             prof.set("operator", JsonVal::Str(operator.to_string()));
-            if prof.get("uip_overrides").is_none() && prof.get("memory_params").is_none() {
+            if prof.get("uip_overrides").is_none() {
                 prof.set("uip_overrides", JsonVal::Arr(st.uip_overrides.clone()));
                 prof.set(
                     "uip_raw_commands",
@@ -1304,6 +1282,15 @@ pub fn handle_station_command_nonblocking(
                     ),
                 );
             }
+            if prof.get("thermal_auto_enabled").is_none() {
+                prof.set("thermal_auto_enabled", JsonVal::Bool(st.thermal_auto_enabled));
+            }
+            if prof.get("target_temp_c").is_none() {
+                prof.set("target_temp_c", JsonVal::Num(st.thermal_target_c as f64));
+            }
+            if prof.get("require_thermal_online").is_none() {
+                prof.set("require_thermal_online", JsonVal::Bool(st.thermal_require_online));
+            }
             if prof.get("amt").is_none() && prof.get("amt_settings").is_none() {
                 prof.set("amt", st.amt_settings.clone());
             }
@@ -1392,7 +1379,7 @@ pub fn handle_station_command_nonblocking(
             {
                 return StationCmdExec::Immediate(Err(e), None);
             }
-            st.clear_persistent_baseline();
+            st.clear_batch_workspace();
             save_station_settings(data_dir, st);
             let audit = AuditRecordDraft {
                 category: "profile_library".to_string(),
@@ -1529,7 +1516,7 @@ pub fn handle_station_command_nonblocking(
                 "clear" => {
                     st.confirm_dimm_replacement();
                     st.single_run_active = false;
-                    st.restore_persistent_baseline("control_task_batch_clear");
+                    st.restore_batch_workspace("control_task_batch_clear");
                     let now = now_ms();
                     st.task_batch.set("batch_id", JsonVal::Str(String::new()));
                     st.task_batch.set("state", JsonVal::Str("idle".to_string()));
@@ -1633,6 +1620,9 @@ pub fn handle_station_command_nonblocking(
                     let wgm = c.get_f64("write_gap_ms").unwrap_or(20.0);
                     st.write_gap_ms = if wgm > 0.0 { wgm } else { 20.0 };
                 }
+                if let Some(mac) = conns.get_str("os_mac") {
+                    st.os_mac = mac.trim().to_ascii_lowercase();
+                }
                 if let Some(n5) = conns.get("n540") {
                     if let Some(h) = n5.get_str("http_host") {
                         st.n540_http_host = h.trim().to_string();
@@ -1731,7 +1721,7 @@ pub fn handle_station_command_nonblocking(
                             st.uip_raw_commands.push(cmd.to_string());
                         }
                     }
-                    st.clear_persistent_baseline();
+                    st.clear_batch_workspace();
                     save_station_settings(data_dir, st);
                 }
                 let audit = AuditRecordDraft {
@@ -1805,7 +1795,7 @@ pub fn handle_station_command_nonblocking(
                 st.stage_intents.clear();
                 st.task_status = "interrupted".to_string();
                 st.freeze_run_timing(now);
-                st.restore_persistent_baseline("station_power_host_off");
+                st.restore_batch_workspace("station_power_host_off");
                 st.boot_execution.set("state", JsonVal::Str("stopped".to_string()));
                 st.boot_execution.set(
                     "waiting_reason",

+ 52 - 2
native/stl_accel/src/config.rs

@@ -1,4 +1,4 @@
-// config.rs — Server CLI arguments, version/commit metadata, and station config loader (v0.8.1.27)
+// config.rs — Server CLI arguments, version/commit metadata, and station config loader
 
 use crate::json::{parse_json, JsonVal};
 use std::env;
@@ -36,6 +36,9 @@ pub struct ServerArgs {
     pub web_dir: PathBuf,
     pub contracts_path: PathBuf,
     pub web_password: Option<String>,
+    pub raw_ring_mb: usize,
+    pub clean_ring_mb: usize,
+    pub detail_log_cli: Option<bool>,
     pub version: String,
     pub commit: String,
 }
@@ -50,6 +53,23 @@ impl ServerArgs {
         let mut web_dir = PathBuf::from("web");
         let mut contracts_path = PathBuf::from("contracts/firmware-vd012.json");
         let mut web_password_cli: Option<String> = None;
+        let mut raw_ring_mb: usize = env::var("STL_RAW_RING_MB")
+            .ok()
+            .and_then(|s| s.trim().parse::<usize>().ok())
+            .filter(|&v| v >= 2)
+            .unwrap_or(16);
+        let mut clean_ring_mb: usize = env::var("STL_CLEAN_RING_MB")
+            .ok()
+            .and_then(|s| s.trim().parse::<usize>().ok())
+            .filter(|&v| v >= 2)
+            .unwrap_or(8);
+        let mut detail_log_cli: Option<bool> = env::var("STL_DETAIL_LOG").ok().and_then(|v| {
+            match v.trim().to_ascii_lowercase().as_str() {
+                "1" | "true" | "on" | "yes" => Some(true),
+                "0" | "false" | "off" | "no" => Some(false),
+                _ => None,
+            }
+        });
 
         let mut i = 1;
         while i < args.len() {
@@ -82,9 +102,36 @@ impl ServerArgs {
                     web_password_cli = Some(args[i + 1].clone());
                     i += 2;
                 }
+                "--raw-ring-mb" if i + 1 < args.len() => {
+                    let v = args[i + 1]
+                        .parse::<usize>()
+                        .map_err(|_| format!("无效 --raw-ring-mb 参数: {}", args[i + 1]))?;
+                    raw_ring_mb = v.max(2);
+                    i += 2;
+                }
+                "--clean-ring-mb" if i + 1 < args.len() => {
+                    let v = args[i + 1]
+                        .parse::<usize>()
+                        .map_err(|_| format!("无效 --clean-ring-mb 参数: {}", args[i + 1]))?;
+                    clean_ring_mb = v.max(2);
+                    i += 2;
+                }
+                "--detail-log" if i + 1 < args.len() => {
+                    detail_log_cli = match args[i + 1].trim().to_ascii_lowercase().as_str() {
+                        "on" | "1" | "true" | "yes" => Some(true),
+                        "off" | "0" | "false" | "no" => Some(false),
+                        other => {
+                            return Err(format!(
+                                "无效 --detail-log 参数 '{}',仅支持 on|off",
+                                other
+                            ));
+                        }
+                    };
+                    i += 2;
+                }
                 other => {
                     return Err(format!(
-                        "未知命令行参数 '{}'。支持参数: --config <path> --data-dir <dir> --web-listen <addr> --tftp-listen <udp_addr|disabled> --web-dir <dir> --contracts <path> --web-password <pass|disabled>",
+                        "未知命令行参数 '{}'。支持参数: --config <path> --data-dir <dir> --web-listen <addr> --tftp-listen <udp_addr|disabled> --web-dir <dir> --contracts <path> --web-password <pass|disabled> --raw-ring-mb <MB> --clean-ring-mb <MB> --detail-log <on|off>",
                         other
                     ));
                 }
@@ -113,6 +160,9 @@ impl ServerArgs {
             web_dir,
             contracts_path,
             web_password,
+            raw_ring_mb,
+            clean_ring_mb,
+            detail_log_cli,
             version,
             commit,
         })

+ 0 - 329
native/stl_accel/src/firmware.rs

@@ -155,30 +155,6 @@ impl FirmwareContract {
         root
     }
 
-    pub fn rmt_selected_is_disable_only(rmt_cfg: Option<&JsonVal>) -> bool {
-        let Some(r_obj) = rmt_cfg else {
-            return false;
-        };
-        let Some(sel) = r_obj.get_arr("selected") else {
-            return false;
-        };
-        let mut bare_enable = false;
-        let mut bare_disable = false;
-        let mut bare_backside = false;
-        for item in sel {
-            let Some(s) = item.as_str() else { continue };
-            let cmd_part = s.split('(').next().unwrap_or(s).trim().to_ascii_lowercase();
-            if cmd_part == "rmt enable" || cmd_part == "rmt" || s.contains("Rank Margin Tool") || cmd_part == "enable" {
-                bare_enable = true;
-            } else if cmd_part == "rmt disable" || cmd_part == "disable" {
-                bare_disable = true;
-            } else if cmd_part == "rmt backside" || cmd_part == "backside" {
-                bare_backside = true;
-            }
-        }
-        bare_disable && !bare_enable && !bare_backside
-    }
-
     pub fn upsert_maskmain_steps(ovs: &mut Vec<JsonVal>, add_steps: &[u32], remove_steps: &[u32]) {
         let mut steps: BTreeSet<u32> = BTreeSet::new();
         if let Some(existing) = ovs.iter().find(|x| x.get_str_or("id", "") == "maskmain") {
@@ -257,311 +233,6 @@ impl FirmwareContract {
         }
     }
 
-    pub fn memory_params_to_uip_overrides_for_family(
-        mem_params: &JsonVal,
-        run_rmt: Option<bool>,
-        rmt_cfg: Option<&JsonVal>,
-        fw_family_name: &str,
-    ) -> (Vec<JsonVal>, Vec<String>) {
-        let (ovs, raws) = Self::memory_params_to_uip_overrides(mem_params, run_rmt, rmt_cfg);
-        let mut mapped = Vec::with_capacity(ovs.len());
-        if fw_family_name == "cxmt" {
-            let has_trfcsb = ovs.iter().any(|o| o.get_str_or("id", "") == "actm.trfcsb");
-            let has_trefsbrd = ovs.iter().any(|o| o.get_str_or("id", "") == "actm.trefsbrd");
-            for mut o in ovs {
-                match o.get_str_or("id", "").as_str() {
-                    "actm.trfcfgrcsb" => {
-                        if has_trfcsb {
-                            continue;
-                        }
-                        o.set("id", JsonVal::Str("actm.trfcsb".to_string()));
-                    }
-                    "actm.trefsb" => {
-                        if has_trefsbrd {
-                            continue;
-                        }
-                        o.set("id", JsonVal::Str("actm.trefsbrd".to_string()));
-                    }
-                    "actm.trrd" | "actm.tcssr" | "actm.tcshsrexit" | "actm.tcwl" => continue,
-                    _ => {}
-                }
-                mapped.push(o);
-            }
-        } else {
-            // Hovsee 107_VD012 / 108_VD012 (.166): translate canonical `actm.trfcsb` -> `actm.trfcfgrcsb`,
-            // and never emit `ap disable` (Hovsee rejects `ap disable` with Invalid or not support command).
-            let has_trfcfgrcsb = ovs.iter().any(|o| o.get_str_or("id", "") == "actm.trfcfgrcsb");
-            for mut o in ovs {
-                let id_s = o.get_str_or("id", "");
-                if id_s == "ap"
-                    && o.get_str_or("value", "")
-                        .trim()
-                        .eq_ignore_ascii_case("disable")
-                {
-                    continue;
-                }
-                if id_s == "actm.trfcsb" {
-                    if has_trfcfgrcsb {
-                        continue;
-                    }
-                    o.set("id", JsonVal::Str("actm.trfcfgrcsb".to_string()));
-                }
-                mapped.push(o);
-            }
-        }
-        let rmt_dis_only = Self::rmt_selected_is_disable_only(rmt_cfg);
-        let has_rmt_dis_ov = mapped.iter().any(|o| {
-            o.get_str_or("id", "") == "rmt"
-                && o.get_str_or("value", "").trim().eq_ignore_ascii_case("disable")
-        });
-        if rmt_dis_only || run_rmt == Some(false) || rmt_cfg.and_then(|r| r.get_bool("enabled")) == Some(false) || has_rmt_dis_ov {
-            Self::apply_rmt_policy_to_uip_overrides(&mut mapped, false, fw_family_name);
-        } else if run_rmt == Some(true) || rmt_cfg.and_then(|r| r.get_bool("enabled")) == Some(true) {
-            Self::apply_rmt_policy_to_uip_overrides(&mut mapped, true, fw_family_name);
-        }
-        (mapped, raws)
-    }
-
-    pub fn memory_params_to_uip_overrides(
-        mem_params: &JsonVal,
-        run_rmt: Option<bool>,
-        rmt_cfg: Option<&JsonVal>,
-    ) -> (Vec<JsonVal>, Vec<String>) {
-        let mut ovs = Vec::new();
-        let mut raws = Vec::new();
-        let mut rmt_enabled = run_rmt;
-        let mut has_explicit_rmt = false;
-
-        if let Some(r_obj) = rmt_cfg {
-            if rmt_enabled.is_none() {
-                rmt_enabled = r_obj.get_bool("enabled");
-            }
-            if let Some(sel) = r_obj.get_arr("selected") {
-                let mut bare_enable = false;
-                let mut bare_disable = false;
-                let mut bare_backside = false;
-                let mut bare_ud1 = false;
-                let mut bare_ud2 = false;
-                for item in sel {
-                    let Some(s) = item.as_str() else { continue };
-                    let cmd_part = s.split('(').next().unwrap_or(s).trim().to_ascii_lowercase();
-                    if cmd_part == "rmt enable" || cmd_part == "rmt" || s.contains("Rank Margin Tool") {
-                        bare_enable = true;
-                    } else if cmd_part == "rmt disable" {
-                        bare_disable = true;
-                    } else if cmd_part == "rmt backside" {
-                        bare_backside = true;
-                    } else if cmd_part == "rmt userdef 1" {
-                        bare_ud1 = true;
-                    } else if cmd_part == "rmt userdef 2" {
-                        bare_ud2 = true;
-                    } else if cmd_part == "enable" {
-                        bare_enable = true;
-                    } else if cmd_part == "disable" {
-                        bare_disable = true;
-                    } else if cmd_part == "backside" {
-                        bare_backside = true;
-                    } else if cmd_part == "userdef 1" {
-                        bare_ud1 = true;
-                    } else if cmd_part == "userdef 2" {
-                        bare_ud2 = true;
-                    } else if !cmd_part.is_empty() {
-                        raws.push(cmd_part);
-                    }
-                }
-                if rmt_enabled != Some(false) {
-                    if bare_disable && !bare_enable && !bare_backside {
-                        has_explicit_rmt = true;
-                        let mut o = JsonVal::obj();
-                        o.set("id", JsonVal::Str("rmt".to_string()));
-                        o.set("mode", JsonVal::Str("override".to_string()));
-                        o.set("value", JsonVal::Str("disable".to_string()));
-                        ovs.push(o);
-                    } else if bare_backside && !bare_disable {
-                        has_explicit_rmt = true;
-                        let mut o = JsonVal::obj();
-                        o.set("id", JsonVal::Str("rmt".to_string()));
-                        o.set("mode", JsonVal::Str("override".to_string()));
-                        o.set("value", JsonVal::Str("backside".to_string()));
-                        ovs.push(o);
-                    } else if bare_enable || bare_backside {
-                        has_explicit_rmt = true;
-                        let mut o = JsonVal::obj();
-                        o.set("id", JsonVal::Str("rmt".to_string()));
-                        o.set("mode", JsonVal::Str("override".to_string()));
-                        o.set("value", JsonVal::Str("enable".to_string()));
-                        ovs.push(o);
-                    }
-                    // When all 5 items (including `disable`) were checked via `Select All` in Qt CreateTaskDialog,
-                    // avoid overriding default `rmt enable` with `rmt.userdef` / `backside` unexpectedly;
-                    // apply `userdef` whenever explicitly chosen without `disable`.
-                    let userdef_val = if bare_ud2 && !bare_ud1 && (!bare_disable || !bare_enable) {
-                        Some("2")
-                    } else if bare_ud1 && !bare_ud2 && (!bare_disable || !bare_enable) {
-                        Some("1")
-                    } else if bare_ud2 && !bare_disable {
-                        Some("2")
-                    } else {
-                        None
-                    };
-                    if let Some(udv) = userdef_val {
-                        let mut o = JsonVal::obj();
-                        o.set("id", JsonVal::Str("rmt.userdef".to_string()));
-                        o.set("mode", JsonVal::Str("override".to_string()));
-                        o.set("value", JsonVal::Str(udv.to_string()));
-                        ovs.push(o);
-                    }
-                }
-            }
-        }
-
-        for (k, id) in [
-            ("mem vdd", "vol.mem.vdd"),
-            ("mem_vdd", "vol.mem.vdd"),
-            ("mem vddq", "vol.mem.vddq"),
-            ("mem_vddq", "vol.mem.vddq"),
-            ("tCL", "actm.tcl"),
-            ("tcl", "actm.tcl"),
-            ("tRCD", "actm.trcd"),
-            ("trcd", "actm.trcd"),
-            ("tRP", "actm.trp"),
-            ("trp", "actm.trp"),
-            ("tRAS", "actm.tras"),
-            ("tras", "actm.tras"),
-            ("tRFC", "actm.trfc"),
-            ("trfc", "actm.trfc"),
-            ("tRTP", "actm.trtp"),
-            ("trtp", "actm.trtp"),
-            ("trrd_l", "actm.trrd_l"),
-            ("tRRD_L", "actm.trrd_l"),
-            ("tWTR_S", "actm.twtr_s"),
-            ("twtr_s", "actm.twtr_s"),
-            ("tWTR_L", "actm.twtr_l"),
-            ("twtr_l", "actm.twtr_l"),
-            ("tWR", "actm.twr"),
-            ("twr", "actm.twr"),
-            ("tCCD_L", "actm.tccd_l"),
-            ("tccd_l", "actm.tccd_l"),
-            ("trefi", "actm.trefi"),
-            ("tREFI", "actm.trefi"),
-            ("tRFCsb", "actm.trfcsb"),
-            ("trfcsb", "actm.trfcsb"),
-            ("tRFCfgrcsb", "actm.trfcfgrcsb"),
-            ("trfcfgrcsb", "actm.trfcfgrcsb"),
-            ("trrd", "actm.trrd"),
-            ("trrd_s", "actm.trrd_s"),
-            ("tcssr", "actm.tcssr"),
-            ("tcshsrexit", "actm.tcshsrexit"),
-            ("tcwl", "actm.tcwl"),
-            ("trefsb", "actm.trefsb"),
-        ] {
-            if let Some(v) = mem_params.get_i64(k) {
-                if v > 0 && !ovs.iter().any(|x| x.get_str_or("id", "") == id) {
-                    let mut o = JsonVal::obj();
-                    o.set("id", JsonVal::Str(id.to_string()));
-                    o.set("mode", JsonVal::Str("override".to_string()));
-                    o.set("value", JsonVal::Str(v.to_string()));
-                    ovs.push(o);
-                }
-            }
-        }
-        if !ovs.iter().any(|x| x.get_str_or("id", "") == "ap") {
-            if let Some(b) = mem_params.get_bool("ap") {
-                // `108_VD012` rejects `ap disable` (`Invalid or not support command`);
-                // only emit `ap enable` when Qt checkbox is checked (`ap: true`).
-                if b {
-                    let mut o = JsonVal::obj();
-                    o.set("id", JsonVal::Str("ap".to_string()));
-                    o.set("mode", JsonVal::Str("override".to_string()));
-                    o.set("value", JsonVal::Str("enable".to_string()));
-                    ovs.push(o);
-                }
-            } else if let Some(s) = mem_params.get_str("ap") {
-                let st = s.trim().to_ascii_lowercase();
-                if st == "enable" || st == "disable" {
-                    let mut o = JsonVal::obj();
-                    o.set("id", JsonVal::Str("ap".to_string()));
-                    o.set("mode", JsonVal::Str("override".to_string()));
-                    o.set("value", JsonVal::Str(st));
-                    ovs.push(o);
-                }
-            }
-        }
-        if !ovs.iter().any(|x| x.get_str_or("id", "") == "ecc") {
-            if let Some(b) = mem_params.get_bool("ecc") {
-                let mut o = JsonVal::obj();
-                o.set("id", JsonVal::Str("ecc".to_string()));
-                o.set("mode", JsonVal::Str("override".to_string()));
-                o.set("value", JsonVal::Str(if b { "enable" } else { "disable" }.to_string()));
-                ovs.push(o);
-            } else if let Some(s) = mem_params.get_str("ecc") {
-                let st = s.trim().to_ascii_lowercase();
-                if st == "enable" || st == "disable" {
-                    let mut o = JsonVal::obj();
-                    o.set("id", JsonVal::Str("ecc".to_string()));
-                    o.set("mode", JsonVal::Str("override".to_string()));
-                    o.set("value", JsonVal::Str(st));
-                    ovs.push(o);
-                }
-            }
-        }
-        if !ovs.iter().any(|x| x.get_str_or("id", "") == "errhandle") {
-            if let Some(b) = mem_params.get_bool("errhandle") {
-                if b {
-                    let mut o = JsonVal::obj();
-                    o.set("id", JsonVal::Str("errhandle".to_string()));
-                    o.set("mode", JsonVal::Str("override".to_string()));
-                    o.set("value", JsonVal::Str("disable".to_string()));
-                    ovs.push(o);
-                }
-            } else if let Some(s) = mem_params.get_str("errhandle") {
-                let st = s.trim().to_ascii_lowercase();
-                if st == "disable" || st == "enable" {
-                    let mut o = JsonVal::obj();
-                    o.set("id", JsonVal::Str("errhandle".to_string()));
-                    o.set("mode", JsonVal::Str("override".to_string()));
-                    o.set("value", JsonVal::Str("disable".to_string()));
-                    ovs.push(o);
-                }
-            }
-        }
-        if !ovs.iter().any(|x| x.get_str_or("id", "") == "debuglog") {
-            let mapped_dbg = if let Some(b) = mem_params.get_bool("debuglog") {
-                // Note: `debuglog off` mutes Hovsee BIOS SerialDebugMsgLevel=0 completely (even prompts!).
-                // Unchecked `debuglog: false` keeps BIOS normal console output; `debuglog: true` sends `debuglog on`.
-                if b { Some("on".to_string()) } else { None }
-            } else if let Some(s) = mem_params.get_str("debuglog") {
-                match s.trim().to_ascii_lowercase().as_str() {
-                    "true" | "1" | "enable" | "on" => Some("on".to_string()),
-                    "false" | "0" | "disable" | "" => None,
-                    "off" => Some("off".to_string()),
-                    "cpgc" => Some("cpgc".to_string()),
-                    "dfe" => Some("dfe".to_string()),
-                    _ => None,
-                }
-            } else {
-                None
-            };
-            if let Some(val) = mapped_dbg {
-                let mut o = JsonVal::obj();
-                o.set("id", JsonVal::Str("debuglog".to_string()));
-                o.set("mode", JsonVal::Str("override".to_string()));
-                o.set("value", JsonVal::Str(val));
-                ovs.push(o);
-            }
-        }
-        if !has_explicit_rmt {
-            if let Some(en) = rmt_enabled {
-                let mut o = JsonVal::obj();
-                o.set("id", JsonVal::Str("rmt".to_string()));
-                o.set("mode", JsonVal::Str("override".to_string()));
-                o.set("value", JsonVal::Str(if en { "enable" } else { "disable" }.to_string()));
-                ovs.push(o);
-            }
-        }
-        (ovs, raws)
-    }
-
     pub fn multi_step_limit(item_id: &str) -> Option<u32> {
         match item_id {
             "maskmain" | "pausemain" => Some(101),

+ 3 - 0
native/stl_accel/src/lib.rs

@@ -269,6 +269,9 @@ extern "C" {
     pub fn c_pty_write_bytes(master_fd: i32, buf: *const u8, len: usize) -> isize;
     pub fn c_pty_is_alive(child_pid: i32) -> i32;
     pub fn c_pty_close(master_fd: i32, child_pid: i32);
+    pub fn stl_free_disk_bytes(path: *const u8, out_avail_bytes: *mut u64) -> i32;
+    pub fn stl_set_thread_idle_priority();
+    pub fn stl_chmod_0600(path: *const u8) -> i32;
 
     pub fn c_ssh_exec_capture(
         host: *const u8,

Разница между файлами не показана из-за своего большого размера
+ 581 - 820
native/stl_accel/src/main.rs


+ 99 - 41
native/stl_accel/src/pxe.rs

@@ -1840,6 +1840,20 @@ fn handle_tftp_rrq(
     );
 }
 
+fn lookup_arp_mac_for_ip(ip_str: &str) -> Option<String> {
+    let txt = fs::read_to_string("/proc/net/arp").ok()?;
+    for line in txt.lines().skip(1) {
+        let cols: Vec<&str> = line.split_whitespace().collect();
+        if cols.len() >= 4 && cols[0] == ip_str {
+            let mac = cols[3].trim().to_ascii_lowercase();
+            if mac.len() == 17 && mac != "00:00:00:00:00:00" {
+                return Some(mac);
+            }
+        }
+    }
+    None
+}
+
 fn handle_tftp_wrq(
     hub: Arc<crate::api::AppHub>,
     peer: SocketAddr,
@@ -1878,12 +1892,24 @@ fn handle_tftp_wrq(
         return;
     }
 
-    let mut payload: Vec<u8> = Vec::with_capacity(65536);
+    let dest_path = hub.pxe_tftp_dir.join(&rel);
+    let parent_dir = dest_path.parent().unwrap_or(&hub.pxe_tftp_dir);
+    let _ = fs::create_dir_all(parent_dir);
+    let tmp_path = parent_dir.join(format!(".{}.tmp-{}", clean_name, now_ms()));
+    let Ok(tmp_file) = fs::File::create(&tmp_path) else {
+        send_tftp_error(&sock, peer, 2, "Cannot create upload file");
+        return;
+    };
+    let mut writer = std::io::BufWriter::with_capacity(65536, tmp_file);
+    let mut total_bytes: usize = 0;
+    let mut head_sample: Vec<u8> = Vec::with_capacity(1024);
+    let mut last_disk_check_bytes: usize = 0;
+    const MIN_FREE_DISK_BYTES: u64 = 2 * 1024 * 1024 * 1024; // 2 GiB free-space safety guard
+
     let mut expected_block: u16 = 1;
     let mut received_any_block = false;
     let mut rx = vec![0u8; 4 + blksize + 64];
     let mut timeouts = 0u32;
-    let max_upload_bytes = 64 * 1024 * 1024usize;
 
     loop {
         match sock.recv_from(&mut rx) {
@@ -1897,11 +1923,29 @@ fn handle_tftp_wrq(
                     timeouts = 0;
 
                     if bno == expected_block {
-                        if payload.len() + chunk.len() > max_upload_bytes {
-                            send_tftp_error(&sock, peer, 3, "Disk full or allocation exceeded");
+                        if total_bytes.saturating_sub(last_disk_check_bytes) >= 1024 * 1024 {
+                            last_disk_check_bytes = total_bytes;
+                            if let Some(free_b) = crate::storage::free_disk_bytes(parent_dir) {
+                                if free_b < MIN_FREE_DISK_BYTES {
+                                    drop(writer);
+                                    let _ = fs::remove_file(&tmp_path);
+                                    send_tftp_error(&sock, peer, 3, "Disk free space below 2 GiB safety limit");
+                                    return;
+                                }
+                            }
+                        }
+                        use std::io::Write;
+                        if writer.write_all(chunk).is_err() {
+                            drop(writer);
+                            let _ = fs::remove_file(&tmp_path);
+                            send_tftp_error(&sock, peer, 3, "Disk write error");
                             return;
                         }
-                        payload.extend_from_slice(chunk);
+                        if head_sample.len() < 1024 {
+                            let need = (1024 - head_sample.len()).min(chunk.len());
+                            head_sample.extend_from_slice(&chunk[..need]);
+                        }
+                        total_bytes = total_bytes.saturating_add(chunk.len());
                         received_any_block = true;
                         let mut ack = [0u8; 4];
                         ack[0..2].copy_from_slice(&4u16.to_be_bytes());
@@ -1919,12 +1963,16 @@ fn handle_tftp_wrq(
                         let _ = sock.send_to(&ack, peer);
                     }
                 } else if n >= 4 && u16::from_be_bytes([rx[0], rx[1]]) == 5 {
+                    drop(writer);
+                    let _ = fs::remove_file(&tmp_path);
                     return;
                 }
             }
             Err(e) if matches!(e.kind(), ErrorKind::WouldBlock | ErrorKind::TimedOut) => {
                 timeouts += 1;
                 if timeouts >= 5 {
+                    drop(writer);
+                    let _ = fs::remove_file(&tmp_path);
                     return;
                 }
                 if !received_any_block {
@@ -1936,34 +1984,36 @@ fn handle_tftp_wrq(
                     let _ = sock.send_to(&ack, peer);
                 }
             }
-            Err(_) => return,
+            Err(_) => {
+                drop(writer);
+                let _ = fs::remove_file(&tmp_path);
+                return;
+            }
         }
     }
 
-    let dest_path = hub.pxe_tftp_dir.join(&rel);
-    let parent_dir = dest_path.parent().unwrap_or(&hub.pxe_tftp_dir);
-    let _ = fs::create_dir_all(parent_dir);
-    let tmp_path = parent_dir.join(format!(".{}.tmp-{}", clean_name, now_ms()));
-    if fs::write(&tmp_path, &payload).is_ok() {
-        let _ = fs::rename(&tmp_path, &dest_path);
+    {
+        use std::io::Write;
+        let _ = writer.flush();
     }
+    drop(writer);
+    let _ = fs::rename(&tmp_path, &dest_path);
 
-    let is_html = looks_like_html_payload(&lower_name, &payload);
-    let is_xml = !is_html && looks_like_xml_payload(&lower_name, &payload);
+    let is_html = looks_like_html_payload(&lower_name, &head_sample);
+    let is_xml = !is_html && looks_like_xml_payload(&lower_name, &head_sample);
     if !is_html && !is_xml {
         append_system_debug_log(
             &hub.data_dir,
             "PXE",
             &format!(
                 "TFTP_WRQ_NON_REPORT peer={} file={} bytes={}",
-                peer,
-                clean_name,
-                payload.len()
+                peer, clean_name, total_bytes
             ),
         );
         return;
     }
 
+    let payload = fs::read(&dest_path).unwrap_or_default();
     let report_str = decode_html_report_bytes(&payload);
     let report = if is_xml {
         parse_mt86_xml_report(&clean_name, &report_str)
@@ -1977,9 +2027,6 @@ fn handle_tftp_wrq(
             .cloned()
             .unwrap_or_default();
         rpts.insert(0, report.clone());
-        if rpts.len() > 20 {
-            rpts.truncate(20);
-        }
         pxe_st.set("recent_reports", JsonVal::Arr(rpts));
         pxe_st.set("updated_unix_ms", JsonVal::Num(now_ms() as f64));
         if let Err(e) = crate::storage::atomic_write_bytes(
@@ -1994,16 +2041,28 @@ fn handle_tftp_wrq(
         }
     }
 
-    // Deliver HTML/XML report strictly to the originating station without cross-contaminating concurrent stations
+    // Deliver HTML/XML report strictly to the originating station:
+    // Tier 0: same-LAN ARP peer MAC == station.os_mac
+    // Tier 1: exact expected_mt_report_name
+    // Tier 2: DIMM serial number found inside report
+    // Tier 3: active mt/uefi phase using 118.efi
+    // Tier 4: sole online/running station
     let full_path_str = dest_path.to_string_lossy().to_string();
+    let peer_mac = lookup_arp_mac_for_ip(&peer.ip().to_string()).unwrap_or_default();
+    let mut mac_match_targets: Vec<String> = Vec::new();
     let mut exact_name_targets: Vec<String> = Vec::new();
     let mut sn_match_targets: Vec<String> = Vec::new();
     let mut mt_or_uefi_targets: Vec<String> = Vec::new();
     let mut online_targets: Vec<String> = Vec::new();
     let lower_clean = clean_name.to_ascii_lowercase();
     let lower_rpt = report_str.to_ascii_lowercase();
-    for (sid, handle) in &hub.stations {
+    let stations_snap = hub.stations_snapshot();
+    for (sid, handle) in &stations_snap {
         if let Ok(v) = handle.view.read() {
+            if !peer_mac.is_empty() && !v.os_mac.is_empty() && v.os_mac.eq_ignore_ascii_case(&peer_mac) {
+                mac_match_targets.push(sid.clone());
+                continue;
+            }
             let exp_base = Path::new(v.expected_mt_report_name.trim())
                 .file_name()
                 .and_then(|s| s.to_str())
@@ -2013,21 +2072,18 @@ fn handle_tftp_wrq(
                 exact_name_targets.push(sid.clone());
                 continue;
             }
-            if let Some(dimms) = v.control_base.get_arr("dimms") {
-                let any_sn = dimms.iter().any(|d| {
-                    let sn = d.get_str_or("sn", "").trim().trim_start_matches("0x").to_ascii_lowercase();
-                    sn.len() >= 8 && lower_rpt.contains(&sn)
-                });
-                if any_sn {
-                    sn_match_targets.push(sid.clone());
-                }
+            let any_sn = v.dimms.iter().any(|d| {
+                let sn = d.get_str_or("sn", "").trim().trim_start_matches("0x").to_ascii_lowercase();
+                sn.len() >= 8 && lower_rpt.contains(&sn)
+            });
+            if any_sn {
+                sn_match_targets.push(sid.clone());
             }
             let efi_up = v.mt_efi_path.trim().to_ascii_uppercase();
             if !efi_up.is_empty() && !efi_up.ends_with("118.EFI") {
                 continue;
             }
-            let phase = v.qt_clean_station.get_str_or("phase", "");
-            let run_state = v.qt_clean_station.get_str_or("run_state", "");
+            let phase = v.phase.as_str();
             let mt_started = v
                 .control_base
                 .get("firmware")
@@ -2036,13 +2092,15 @@ fn handle_tftp_wrq(
                 .is_some();
             if phase == "mt" || phase == "uefi" || mt_started {
                 mt_or_uefi_targets.push(sid.clone());
-            } else if v.console_online || run_state == "running" {
+            } else if v.console_online || v.task_status == "running" {
                 online_targets.push(sid.clone());
             }
         }
     }
 
-    let force_targets = if !exact_name_targets.is_empty() {
+    let force_targets = if !mac_match_targets.is_empty() {
+        mac_match_targets
+    } else if !exact_name_targets.is_empty() {
         exact_name_targets
     } else if !sn_match_targets.is_empty() {
         sn_match_targets
@@ -2058,10 +2116,11 @@ fn handle_tftp_wrq(
         &hub.data_dir,
         "PXE",
         &format!(
-            "TFTP_WRQ_RX peer={} file={} bytes={} verdict={} targets={}",
+            "TFTP_WRQ_RX peer={} mac={} file={} bytes={} verdict={} targets={}",
             peer,
+            peer_mac,
             clean_name,
-            payload.len(),
+            total_bytes,
             report.get_str_or("verdict", ""),
             force_targets.join(",")
         ),
@@ -2073,14 +2132,15 @@ fn handle_tftp_wrq(
             &sid,
             "PXE",
             &format!(
-                "TFTP_WRQ_MATCHED peer={} file={} bytes={} verdict={}",
+                "TFTP_WRQ_MATCHED peer={} mac={} file={} bytes={} verdict={}",
                 peer,
+                peer_mac,
                 clean_name,
-                payload.len(),
+                total_bytes,
                 report.get_str_or("verdict", "")
             ),
         );
-        if let Some(handle) = hub.stations.get(&sid) {
+        if let Some(handle) = stations_snap.get(&sid) {
             let _ = handle.send(StationMsg::MtReportUploaded {
                 report: report.clone(),
                 full_path: full_path_str.clone(),
@@ -2093,8 +2153,6 @@ fn handle_tftp_wrq(
             }
         }
     }
-
-    hub.refresh_and_broadcast_qt_state();
 }
 
 fn sanitize_report_basename(raw: &str) -> Option<String> {

+ 81 - 83
native/stl_accel/src/results.rs

@@ -487,55 +487,58 @@ impl WatchdogConfig {
             self.enabled = en;
         }
         if let Some(ms) = raw.get_i64("link_lost_timeout_ms") {
-            self.link_lost_timeout_ms = ms.clamp(5_200, 86_400_000);
+            self.link_lost_timeout_ms = ms.max(5_200);
         } else if let Some(sec) = raw.get_i64("link_lost_timeout_s") {
-            self.link_lost_timeout_ms = (sec * 1000).clamp(6_000, 86_400_000);
+            self.link_lost_timeout_ms = (sec.saturating_mul(1000)).max(6_000);
         }
         if let Some(ms) = raw.get_i64("dense_stage_silence_timeout_ms") {
-            self.dense_stage_silence_timeout_ms = ms.clamp(1_000, 86_400_000);
+            self.dense_stage_silence_timeout_ms = ms.max(1_000);
         } else if let Some(sec) = raw.get_i64("dense_stage_silence_timeout_s") {
-            self.dense_stage_silence_timeout_ms = (sec * 1000).clamp(5_000, 86_400_000);
+            self.dense_stage_silence_timeout_ms = (sec.saturating_mul(1000)).max(1_000);
         }
         if let Some(ms) = raw.get_i64("amt_silence_timeout_ms") {
-            self.amt_silence_timeout_ms = ms.clamp(1_000, 86_400_000);
+            self.amt_silence_timeout_ms = ms.max(1_000);
         } else if let Some(sec) = raw.get_i64("amt_silence_timeout_s") {
-            self.amt_silence_timeout_ms = (sec * 1000).clamp(5_000, 86_400_000);
+            self.amt_silence_timeout_ms = (sec.saturating_mul(1000)).max(1_000);
         }
         if let Some(ms) = raw.get_i64("amt_max_duration_ms") {
-            self.amt_max_duration_ms = ms.clamp(0, 172_800_000);
+            self.amt_max_duration_ms = ms.max(0);
         } else if let Some(sec) = raw.get_i64("amt_max_duration_s") {
-            self.amt_max_duration_ms = (sec * 1000).clamp(0, 172_800_000);
+            self.amt_max_duration_ms = (sec.saturating_mul(1000)).max(0);
         }
         if let Some(ms) = raw.get_i64("mt_silence_timeout_ms") {
-            self.mt_silence_timeout_ms = ms.clamp(1_000, 86_400_000);
+            self.mt_silence_timeout_ms = ms.max(1_000);
         } else if let Some(sec) = raw.get_i64("mt_silence_timeout_s") {
-            self.mt_silence_timeout_ms = (sec * 1000).clamp(5_000, 86_400_000);
+            self.mt_silence_timeout_ms = (sec.saturating_mul(1000)).max(1_000);
         }
         if let Some(ms) = raw.get_i64("mt_max_duration_ms") {
-            self.mt_max_duration_ms = ms.clamp(0, 172_800_000);
+            self.mt_max_duration_ms = ms.max(0);
         } else if let Some(sec) = raw.get_i64("mt_max_duration_s") {
-            self.mt_max_duration_ms = (sec * 1000).clamp(0, 172_800_000);
+            self.mt_max_duration_ms = (sec.saturating_mul(1000)).max(0);
         }
         if let Some(roh) = raw.get_bool("reboot_on_hang") {
             self.reboot_on_hang = roh;
         }
         if let Some(mch) = raw.get_i64("max_consecutive_hangs") {
-            self.max_consecutive_hangs = mch.clamp(1, 20) as u32;
+            self.max_consecutive_hangs = mch.max(1) as u32;
         }
         if let Some(pms) = raw.get_i64("reconnect_prompt_probe_delay_ms") {
-            self.reconnect_prompt_probe_delay_ms = pms.clamp(100, 30_000);
+            self.reconnect_prompt_probe_delay_ms = pms.max(100);
         }
     }
 }
 
 #[derive(Clone, Debug)]
-pub struct StationBaselineSnapshot {
+pub struct BatchSavedWorkspace {
     pub uip_overrides: Vec<JsonVal>,
     pub uip_raw_commands: Vec<String>,
     pub amt_settings: JsonVal,
     pub mt_selection: JsonVal,
     pub boot_plan: JsonVal,
     pub watchdog: WatchdogConfig,
+    pub thermal_auto_enabled: bool,
+    pub thermal_target_c: u8,
+    pub thermal_require_online: bool,
 }
 
 pub struct StationState {
@@ -577,11 +580,13 @@ pub struct StationState {
     pub cleaner: lib::NativeStreamCleaner,
     pub tx_pacer: NonBlockingTxPacer,
     pub async_script: AsyncCommandScript,
-    // Chamber hood local serial telemetry (strictly from thermal hood serial, NEVER server BMC)
-    pub chamber_serial_path: String,
-    pub chamber_current_c: Option<f64>,
-    pub chamber_target_c: Option<f64>,
-    pub chamber_state: String,
+    // OS NIC MAC for same-LAN ProxyDHCP / TFTP report attribution
+    pub os_mac: String,
+    // Closed-loop 6400 thermal hood policy for this station's runs
+    pub thermal_auto_enabled: bool,
+    pub thermal_target_c: u8,
+    pub thermal_require_online: bool,
+    pub thermal_heat_sent_for_boot: bool,
     pub observed_phase: String,
     pub observed_detail: String,
     pub observed_cpu: Option<i64>,
@@ -629,16 +634,17 @@ pub struct StationState {
     pub active_run_start_offset: u64,
     pub last_clear_screen_offset: u64,
     pub last_clean_clear_offset: u64,
-    pub command: JsonVal,
     pub task_status: String,
     pub awaiting_dimm_replacement: bool,
     pub stage_errors: BTreeMap<String, Vec<JsonVal>>,
+    pub alarm_records: Vec<JsonVal>,
     pub unsupported_commands: Vec<JsonVal>,
     pub last_err_stage: String,
     pub stage_intents: BTreeMap<String, (u64, String, JsonVal, i64)>,
     pub intent_seq: u64,
     pub latest_mt_report_path: String,
     pub uefi_fs_candidates: Vec<String>,
+    pub last_uefi_files: Vec<JsonVal>,
     pub resolved_mt_efi_path: Option<String>,
     pub resolved_grub_tftp_loader: Option<String>,
     pub pxe_server_ip: String,
@@ -678,7 +684,7 @@ pub struct StationState {
     pub hang_scene_preserved: bool,
     pub consecutive_hang_count: u32,
     pub debug_log_path: Option<PathBuf>,
-    pub persistent_baseline: Option<StationBaselineSnapshot>,
+    pub batch_saved_workspace: Option<BatchSavedWorkspace>,
     pub dimm_seen_in_boot: [bool; 24],
     pub had_bmc_sdr: [bool; 24],
     pub sdr_absent_streak: [u8; 24],
@@ -686,6 +692,17 @@ pub struct StationState {
 
 impl StationState {
     pub fn new(id: &str, name: &str, bmc_host: &str, bmc_pass: &str) -> Self {
+        Self::new_with_rings(id, name, bmc_host, bmc_pass, RAW_RING_CAPACITY, CLEAN_RING_CAPACITY)
+    }
+
+    pub fn new_with_rings(
+        id: &str,
+        name: &str,
+        bmc_host: &str,
+        bmc_pass: &str,
+        raw_ring_bytes: usize,
+        clean_ring_bytes: usize,
+    ) -> Self {
         let dimms = (0..24).map(|_| DimmSlot::empty()).collect();
 
         let mut mt_sel = JsonVal::obj();
@@ -716,7 +733,7 @@ impl StationState {
         plan.set("stages", stages);
         plan.set("run_rmt", JsonVal::Bool(true));
         plan.set("run_amt", JsonVal::Bool(true));
-        plan.set("run_mt", JsonVal::Bool(true));
+        plan.set("run_mt", JsonVal::Bool(false));
         plan.set("mt_enabled", JsonVal::Bool(false));
         plan.set("use_in_runs", JsonVal::Bool(false));
 
@@ -792,15 +809,16 @@ impl StationState {
             tcp_listener_port: 0,
             pty_open_gen: 0,
             next_reconnect_probe_ms: 0,
-            raw_ring: lib::MonotonicRingBuffer::new(RAW_RING_CAPACITY),
-            clean_ring: lib::MonotonicRingBuffer::new(CLEAN_RING_CAPACITY),
+            raw_ring: lib::MonotonicRingBuffer::new(raw_ring_bytes.max(2 * 1024 * 1024)),
+            clean_ring: lib::MonotonicRingBuffer::new(clean_ring_bytes.max(2 * 1024 * 1024)),
             cleaner: lib::NativeStreamCleaner::new(),
             tx_pacer: NonBlockingTxPacer::default(),
             async_script: AsyncCommandScript::default(),
-            chamber_serial_path: String::new(),
-            chamber_current_c: None,
-            chamber_target_c: None,
-            chamber_state: "unconfigured".to_string(),
+            os_mac: String::new(),
+            thermal_auto_enabled: false,
+            thermal_target_c: 70,
+            thermal_require_online: true,
+            thermal_heat_sent_for_boot: false,
             observed_phase: "unknown".to_string(),
             observed_detail: String::new(),
             observed_cpu: None,
@@ -848,16 +866,17 @@ impl StationState {
             active_run_start_offset: 0,
             last_clear_screen_offset: 0,
             last_clean_clear_offset: 0,
-            command: JsonVal::Null,
             task_status: "not_started".to_string(),
             awaiting_dimm_replacement: false,
             stage_errors,
+            alarm_records: Vec::new(),
             unsupported_commands: Vec::new(),
             last_err_stage: String::new(),
             stage_intents: BTreeMap::new(),
             intent_seq: 0,
             latest_mt_report_path: String::new(),
             uefi_fs_candidates: Vec::new(),
+            last_uefi_files: Vec::new(),
             resolved_mt_efi_path: None,
             resolved_grub_tftp_loader: None,
             pxe_server_ip: "192.168.0.10".to_string(),
@@ -897,7 +916,7 @@ impl StationState {
             hang_scene_preserved: false,
             consecutive_hang_count: 0,
             debug_log_path: None,
-            persistent_baseline: None,
+            batch_saved_workspace: None,
             dimm_seen_in_boot: [false; 24],
             had_bmc_sdr: [false; 24],
             sdr_absent_streak: [0; 24],
@@ -1002,42 +1021,30 @@ impl StationState {
         }
     }
 
-    pub fn ensure_persistent_baseline(&mut self) {
-        if self.persistent_baseline.is_some() {
+    pub fn capture_batch_workspace(&mut self) {
+        if self.batch_saved_workspace.is_some() {
             return;
         }
-        let snap = StationBaselineSnapshot {
+        let snap = BatchSavedWorkspace {
             uip_overrides: self.uip_overrides.clone(),
             uip_raw_commands: self.uip_raw_commands.clone(),
             amt_settings: self.amt_settings.clone(),
             mt_selection: self.mt_selection.clone(),
             boot_plan: self.boot_plan.clone(),
             watchdog: self.watchdog.clone(),
+            thermal_auto_enabled: self.thermal_auto_enabled,
+            thermal_target_c: self.thermal_target_c,
+            thermal_require_online: self.thermal_require_online,
         };
-        self.log_debug(
-            "BASELINE",
-            &format!(
-                "CAPTURE_PERSISTENT ovs={} raws={} amt_action={} bp_preset={} run_rmt={} run_amt={} run_mt={}",
-                snap.uip_overrides.len(),
-                snap.uip_raw_commands.len(),
-                snap.amt_settings.get_str_or("action", ""),
-                snap.boot_plan.get_str_or("preset", ""),
-                snap.boot_plan.get_bool("run_rmt").unwrap_or(false),
-                snap.boot_plan.get_bool("run_amt").unwrap_or(false),
-                snap.boot_plan.get_bool("run_mt").unwrap_or(false),
-            ),
-        );
-        self.persistent_baseline = Some(snap);
+        self.batch_saved_workspace = Some(snap);
     }
 
-    pub fn clear_persistent_baseline(&mut self) {
-        if self.persistent_baseline.take().is_some() {
-            self.log_debug("BASELINE", "CLEAR_PERSISTENT reason=explicit_web_save");
-        }
+    pub fn clear_batch_workspace(&mut self) {
+        let _ = self.batch_saved_workspace.take();
     }
 
-    pub fn restore_persistent_baseline(&mut self, reason: &str) -> bool {
-        let Some(snap) = self.persistent_baseline.take() else {
+    pub fn restore_batch_workspace(&mut self, reason: &str) -> bool {
+        let Some(snap) = self.batch_saved_workspace.take() else {
             return false;
         };
         self.uip_overrides = snap.uip_overrides;
@@ -1046,19 +1053,12 @@ impl StationState {
         self.mt_selection = snap.mt_selection;
         self.boot_plan = snap.boot_plan;
         self.watchdog = snap.watchdog;
+        self.thermal_auto_enabled = snap.thermal_auto_enabled;
+        self.thermal_target_c = snap.thermal_target_c;
+        self.thermal_require_online = snap.thermal_require_online;
         self.log_debug(
-            "BASELINE",
-            &format!(
-                "RESTORE_PERSISTENT reason={} ovs={} raws={} amt_action={} bp_preset={} run_rmt={} run_amt={} run_mt={}",
-                reason,
-                self.uip_overrides.len(),
-                self.uip_raw_commands.len(),
-                self.amt_settings.get_str_or("action", ""),
-                self.boot_plan.get_str_or("preset", ""),
-                self.boot_plan.get_bool("run_rmt").unwrap_or(false),
-                self.boot_plan.get_bool("run_amt").unwrap_or(false),
-                self.boot_plan.get_bool("run_mt").unwrap_or(false),
-            ),
+            "BATCH_WORKSPACE",
+            &format!("RESTORE reason={} ovs={}", reason, self.uip_overrides.len()),
         );
         true
     }
@@ -1129,6 +1129,12 @@ impl StationState {
             self.single_run_active = false;
             self.single_run_id.clear();
             self.single_run_started_ms = 0;
+            if self.task_batch.get_str_or("state", "idle") == "running" {
+                self.task_batch
+                    .set("state", JsonVal::Str("stopped".to_string()));
+                self.task_batch
+                    .set("updated_unix_ms", JsonVal::Str(now.to_string()));
+            }
             if had_active_or_finished_run {
                 self.run_started_unix_ms = 0;
                 self.run_ended_unix_ms = 0;
@@ -1162,17 +1168,17 @@ impl StationState {
         self.async_script.clear();
         self.tx_pacer.clear();
         self.pending_complete_signal = None;
+        self.thermal_heat_sent_for_boot = false;
         if !keep_active_run {
             self.clear_serial_gaps();
             self.consecutive_hang_count = 0;
             self.task_status = "not_started".to_string();
             self.stage_intents.clear();
-            self.restore_persistent_baseline(&format!("external_restart:{}", reason_detail));
+            self.restore_batch_workspace(&format!("external_restart:{}", reason_detail));
             self.last_uip_apply = None;
             self.last_amt_apply = None;
             self.last_amt_start = None;
             self.last_phase_action = None;
-            self.command = JsonVal::Null;
             if bp_state_now != "idle"
                 || !self.boot_execution.get_str_or("id", "").is_empty()
                 || !self.boot_execution.get_str_or("boot_id", "").is_empty()
@@ -1240,8 +1246,6 @@ impl StationState {
             || !self.unsupported_commands.is_empty()
             || !self.rmt_results.is_empty()
             || !self.amt_results.is_empty()
-            || self.chamber_current_c.is_some()
-            || self.chamber_target_c.is_some()
             || self.dimms.iter().any(|d| {
                 d.presence != "unknown"
                     || d.enabled != "unknown"
@@ -1313,12 +1317,12 @@ impl StationState {
         self.hot.awaiting_dimm_replacement = false;
         self.task_status = "not_started".to_string();
         self.stage_intents.clear();
-        self.restore_persistent_baseline("reset_on_disconnect");
+        self.thermal_heat_sent_for_boot = false;
+        self.restore_batch_workspace("reset_on_disconnect");
         self.last_uip_apply = None;
         self.last_amt_apply = None;
         self.last_amt_start = None;
         self.last_phase_action = None;
-        self.command = JsonVal::Null;
         self.rmt_results.clear();
         self.amt_results.clear();
         self.active_amt_cpus.clear();
@@ -1347,9 +1351,6 @@ impl StationState {
             self.task_batch.set("state", JsonVal::Str("stopped".to_string()));
             self.task_batch.set("updated_unix_ms", JsonVal::Str(now.to_string()));
         }
-        self.chamber_current_c = None;
-        self.chamber_target_c = None;
-        self.chamber_state = "unconfigured".to_string();
     }
 
     pub fn record_unsupported_command(&mut self, stage: &str, cmd: &str, response: &str) {
@@ -1510,10 +1511,8 @@ impl StationState {
         err.set("observed_unix_ms", JsonVal::Str(now.to_string()));
         let list = self.stage_errors.entry(stage_key).or_default();
         if !list.iter().any(|x| x.get_str_or("fault_code", "") == fault_code) {
-            if list.len() >= 200 {
-                list.remove(0);
-            }
-            list.push(err);
+            list.push(err.clone());
+            self.alarm_records.push(err);
         }
 
         self.last_err_stage = display_stage.clone();
@@ -1849,9 +1848,6 @@ impl StationState {
         if list.iter().any(|x| x.get_str_or("message", "") == msg) {
             return;
         }
-        if list.len() >= 200 {
-            list.remove(0);
-        }
         let mut err = JsonVal::obj();
         err.set("stage", JsonVal::Str(stage.to_string()));
         err.set("kind", JsonVal::Str(kind.to_string()));
@@ -1877,7 +1873,8 @@ impl StationState {
         }
         err.set("message", JsonVal::Str(msg.to_string()));
         err.set("observed_unix_ms", JsonVal::Str(now.to_string()));
-        list.push(err);
+        list.push(err.clone());
+        self.alarm_records.push(err);
         self.log_debug(
             "ERROR",
             &format!(
@@ -2461,6 +2458,7 @@ impl StationState {
             self.plan_done.clear();
             self.plan_amt_started.clear();
             self.stage_intents.clear();
+            self.thermal_heat_sent_for_boot = false;
             self.observed_stages.clear();
             self.stage_step_counts.clear();
             self.rmt_results.clear();

+ 148 - 34
native/stl_accel/src/storage.rs

@@ -40,7 +40,7 @@ pub fn atomic_write_bytes(path: &Path, data: &[u8]) -> std::io::Result<()> {
 }
 
 #[inline]
-fn unix_ms_to_utc_string(ts: i64) -> String {
+pub fn unix_ms_to_utc_string(ts: i64) -> String {
     let clamped = ts.max(0);
     let total_secs = clamped / 1000;
     let ms = clamped % 1000;
@@ -67,43 +67,115 @@ fn unix_ms_to_utc_string(ts: i64) -> String {
     )
 }
 
-const QT_CLEAN_PRIVATE_KEYS: &[&str] = &[
+pub fn free_disk_bytes(path: &Path) -> Option<u64> {
+    let target = if path.exists() {
+        path
+    } else {
+        path.parent().unwrap_or(Path::new("."))
+    };
+    let c_path = format!("{}\0", target.to_string_lossy());
+    let mut avail: u64 = 0;
+    let rc = unsafe { crate::lib::stl_free_disk_bytes(c_path.as_ptr(), &mut avail) };
+    if rc == 0 {
+        Some(avail)
+    } else {
+        None
+    }
+}
+
+const SENSITIVE_SECRET_KEYS: &[&str] = &[
     "password",
     "passwd",
     "secret",
     "authorization",
     "token",
-    "firmware_settings",
-    "boot_plan",
-    "boot_execution",
-    "raw_line",
-    "raw_sol",
-    "helper_argv",
-    "traceback",
+    "cookie",
+    "stl_auth",
 ];
 
-pub fn strip_private_keys_recursive(val: &JsonVal) -> JsonVal {
+pub fn strip_secrets_recursive(val: &JsonVal) -> JsonVal {
     match val {
         JsonVal::Obj(entries) => {
             let mut out = BTreeMap::new();
             for (k, v) in entries {
                 let kl = k.to_ascii_lowercase();
-                if QT_CLEAN_PRIVATE_KEYS.contains(&kl.as_str())
+                if SENSITIVE_SECRET_KEYS.contains(&kl.as_str())
                     || kl.ends_with("_password")
                     || kl.ends_with("_secret")
                     || kl.ends_with("_token")
                 {
+                    out.insert(k.clone(), JsonVal::Str("[REDACTED]".to_string()));
                     continue;
                 }
-                out.insert(k.clone(), strip_private_keys_recursive(v));
+                out.insert(k.clone(), strip_secrets_recursive(v));
             }
             JsonVal::Obj(out)
         }
-        JsonVal::Arr(arr) => JsonVal::Arr(arr.iter().map(strip_private_keys_recursive).collect()),
+        JsonVal::Arr(arr) => JsonVal::Arr(arr.iter().map(strip_secrets_recursive).collect()),
         other => other.clone(),
     }
 }
 
+pub fn load_web_auth_password(data_dir: &Path) -> Option<String> {
+    let p = data_dir.join("web_auth.json");
+    let txt = fs::read_to_string(&p).ok()?;
+    let val = parse_json(&txt).ok()?;
+    val.get_str("password").map(|s| s.to_string()).filter(|s| !s.is_empty())
+}
+
+pub fn save_web_auth_password(data_dir: &Path, new_pass: &str) -> std::io::Result<()> {
+    let p = data_dir.join("web_auth.json");
+    let mut o = JsonVal::obj();
+    o.set("password", JsonVal::Str(new_pass.to_string()));
+    o.set("updated_unix_ms", JsonVal::Num(now_ms() as f64));
+    atomic_write_bytes(&p, o.to_json().as_bytes())?;
+    let c_path = format!("{}\0", p.to_string_lossy());
+    unsafe {
+        let _ = crate::lib::stl_chmod_0600(c_path.as_ptr());
+    }
+    Ok(())
+}
+
+pub fn load_stations_roster(data_dir: &Path) -> Option<Vec<(String, String, usize)>> {
+    let p = data_dir.join("stations_roster.json");
+    let txt = fs::read_to_string(&p).ok()?;
+    let val = parse_json(&txt).ok()?;
+    let arr = val.get_arr("stations")?;
+    let mut out = Vec::new();
+    for item in arr {
+        let sid = item.get_str_or("station_id", "");
+        if sid.is_empty() {
+            continue;
+        }
+        let name = item.get_str_or("name", &sid);
+        let cpus = item.get_i64("cpu_count").unwrap_or(2).max(1) as usize;
+        out.push((sid, name, cpus));
+    }
+    if out.is_empty() {
+        None
+    } else {
+        Some(out)
+    }
+}
+
+pub fn save_stations_roster(
+    data_dir: &Path,
+    entries: &[(String, String, usize)],
+) -> std::io::Result<()> {
+    let mut arr = Vec::with_capacity(entries.len());
+    for (sid, name, cpus) in entries {
+        let mut o = JsonVal::obj();
+        o.set("station_id", JsonVal::Str(sid.clone()));
+        o.set("name", JsonVal::Str(name.clone()));
+        o.set("cpu_count", JsonVal::Num((*cpus).max(1) as f64));
+        arr.push(o);
+    }
+    let mut root = JsonVal::obj();
+    root.set("stations", JsonVal::Arr(arr));
+    root.set("updated_unix_ms", JsonVal::Num(now_ms() as f64));
+    atomic_write_bytes(&data_dir.join("stations_roster.json"), root.to_json().as_bytes())
+}
+
 pub fn append_debug_log_path(path: &Path, sid: &str, category: &str, msg: &str) {
     let _guard = DEBUG_LOG_LOCK
         .get_or_init(|| Mutex::new(()))
@@ -212,6 +284,9 @@ pub fn load_station_settings(data_dir: &Path, stations: &mut BTreeMap<String, St
                     }
                 }
             }
+            if let Some(mac) = conns.get_str("os_mac") {
+                st.os_mac = mac.trim().to_ascii_lowercase();
+            }
             if let Some(n5) = conns.get("n540") {
                 if let Some(h) = n5.get_str("http_host") {
                     if !h.trim().is_empty() {
@@ -264,8 +339,21 @@ pub fn load_station_settings(data_dir: &Path, stations: &mut BTreeMap<String, St
         if let Some(wd) = saved.get("watchdog") {
             st.watchdog.apply_patch(wd);
         }
+        if let Some(tp) = saved.get("thermal_policy") {
+            if let Some(en) = tp.get_bool("auto_enabled") {
+                st.thermal_auto_enabled = en;
+            }
+            if let Some(t) = tp.get_i64("target_temp_c") {
+                if (0..=254).contains(&t) {
+                    st.thermal_target_c = t as u8;
+                }
+            }
+            if let Some(req) = tp.get_bool("require_online") {
+                st.thermal_require_online = req;
+            }
+        }
         if let Some(tb) = saved.get("task_batch") {
-            let mut clean_tb = strip_private_keys_recursive(tb);
+            let mut clean_tb = strip_secrets_recursive(tb);
             let tb_state = clean_tb.get_str_or("state", "idle");
             if matches!(
                 tb_state.as_str(),
@@ -287,7 +375,7 @@ pub fn load_station_settings(data_dir: &Path, stations: &mut BTreeMap<String, St
             st.task_batch = clean_tb;
         }
         if let Some(th) = saved.get_arr("task_history") {
-            st.task_history = th.iter().map(strip_private_keys_recursive).collect();
+            st.task_history = th.iter().map(strip_secrets_recursive).collect();
         }
         if let Some(sp) = saved.get_arr("saved_profiles") {
             st.saved_profiles = sp.clone();
@@ -313,13 +401,16 @@ pub fn load_station_settings(data_dir: &Path, stations: &mut BTreeMap<String, St
 pub fn save_station_settings(data_dir: &Path, st: &StationState) {
     let dir = data_dir.join("station-controls");
     let _ = fs::create_dir_all(&dir);
-    let base = st.persistent_baseline.as_ref();
+    let base = st.batch_saved_workspace.as_ref();
     let ovs = base.map(|b| &b.uip_overrides).unwrap_or(&st.uip_overrides);
     let raws = base.map(|b| &b.uip_raw_commands).unwrap_or(&st.uip_raw_commands);
     let mt_sel = base.map(|b| &b.mt_selection).unwrap_or(&st.mt_selection);
     let amt_cfg = base.map(|b| &b.amt_settings).unwrap_or(&st.amt_settings);
     let bp_cfg = base.map(|b| &b.boot_plan).unwrap_or(&st.boot_plan);
     let wd_cfg = base.map(|b| &b.watchdog).unwrap_or(&st.watchdog);
+    let th_auto = base.map(|b| b.thermal_auto_enabled).unwrap_or(st.thermal_auto_enabled);
+    let th_tgt = base.map(|b| b.thermal_target_c).unwrap_or(st.thermal_target_c);
+    let th_req = base.map(|b| b.thermal_require_online).unwrap_or(st.thermal_require_online);
 
     let mut fw = JsonVal::obj();
     fw.set("uip_overrides", JsonVal::Arr(ovs.clone()));
@@ -344,13 +435,6 @@ pub fn save_station_settings(data_dir: &Path, st: &StationState) {
     conn_con.set("write_chunk_bytes", JsonVal::Num(st.write_chunk_bytes as f64));
     conn_con.set("write_gap_ms", JsonVal::Num(st.write_gap_ms));
 
-    let mut conn_chamber = JsonVal::obj();
-    conn_chamber.set("serial_path", JsonVal::Str(st.chamber_serial_path.clone()));
-    conn_chamber.set(
-        "target_c",
-        st.chamber_target_c.map(JsonVal::Num).unwrap_or(JsonVal::Null),
-    );
-
     let mut conn_n540 = JsonVal::obj();
     conn_n540.set("http_host", JsonVal::Str(st.n540_http_host.clone()));
     conn_n540.set("http_port", JsonVal::Num(st.n540_http_port as f64));
@@ -360,15 +444,21 @@ pub fn save_station_settings(data_dir: &Path, st: &StationState) {
     let mut conns = JsonVal::obj();
     conns.set("bmc", conn_bmc);
     conns.set("console", conn_con);
-    conns.set("chamber", conn_chamber);
+    conns.set("os_mac", JsonVal::Str(st.os_mac.clone()));
     conns.set("n540", conn_n540);
 
+    let mut th_pol = JsonVal::obj();
+    th_pol.set("auto_enabled", JsonVal::Bool(th_auto));
+    th_pol.set("target_temp_c", JsonVal::Num(th_tgt as f64));
+    th_pol.set("require_online", JsonVal::Bool(th_req));
+
     let mut root = JsonVal::obj();
     root.set("connections", conns);
     root.set("firmware_settings", fw);
     root.set("amt_settings", amt_cfg.clone());
     root.set("boot_plan", bp_cfg.clone());
     root.set("watchdog", wd_cfg.to_json());
+    root.set("thermal_policy", th_pol);
     root.set("task_batch", st.task_batch.clone());
     root.set("task_history", JsonVal::Arr(st.task_history.clone()));
     root.set("saved_profiles", JsonVal::Arr(st.saved_profiles.clone()));
@@ -378,17 +468,24 @@ pub fn save_station_settings(data_dir: &Path, st: &StationState) {
             "STORAGE",
             &format!("SAVE_SETTINGS_ERR path={} err={}", p.display(), e),
         );
+    } else {
+        let c_p = format!("{}\0", p.to_string_lossy());
+        unsafe {
+            let _ = crate::lib::stl_chmod_0600(c_p.as_ptr());
+        }
     }
     st.log_debug(
         "STORAGE",
         &format!(
-            "SAVE_SETTINGS baseline_shield={} ovs={} amt_action={} bp_preset={} bmc_enabled={} bmc_host={}",
+            "SAVE_SETTINGS batch_ws={} ovs={} amt_action={} bp_preset={} bmc_enabled={} bmc_host={} th_auto={} th_tgt={}",
             base.is_some(),
             ovs.len(),
             amt_cfg.get_str_or("action", ""),
             bp_cfg.get_str_or("preset", ""),
             st.bmc_enabled,
-            st.bmc_host
+            st.bmc_host,
+            th_auto,
+            th_tgt
         ),
     );
 }
@@ -543,7 +640,7 @@ pub fn archive_task_run(
         ),
     );
 
-    let state_summary = strip_private_keys_recursive(&disk_summary);
+    let state_summary = strip_secrets_recursive(&disk_summary);
     (
         raw_path.to_string_lossy().to_string(),
         sum_path_str,
@@ -613,14 +710,31 @@ pub fn append_event(
     }
 }
 
+/// Load only the tail (<= 2 MiB) of `config_audit.jsonl` into RAM at startup so low-RAM hosts never OOM.
 pub fn load_audit_logs(data_dir: &Path) -> (Vec<JsonVal>, u64) {
+    use std::io::{Read, Seek, SeekFrom};
     let p = data_dir.join("config_audit.jsonl");
-    let Ok(txt) = fs::read_to_string(&p) else {
+    let Ok(mut f) = fs::File::open(&p) else {
         return (Vec::new(), 0);
     };
+    let file_len = f.metadata().map(|m| m.len()).unwrap_or(0);
+    let tail_cap: u64 = 2 * 1024 * 1024;
+    let start_pos = file_len.saturating_sub(tail_cap);
+    if start_pos > 0 && f.seek(SeekFrom::Start(start_pos)).is_err() {
+        return (Vec::new(), 0);
+    }
+    let mut buf = Vec::new();
+    if f.read_to_end(&mut buf).is_err() {
+        return (Vec::new(), 0);
+    }
+    let txt = String::from_utf8_lossy(&buf);
     let mut items = Vec::new();
     let mut max_seq: u64 = 0;
-    for line in txt.lines() {
+    for (idx, line) in txt.lines().enumerate() {
+        if start_pos > 0 && idx == 0 {
+            // Skip potentially truncated first line when seeking mid-file
+            continue;
+        }
         let trimmed = line.trim();
         if trimmed.is_empty() {
             continue;
@@ -634,8 +748,8 @@ pub fn load_audit_logs(data_dir: &Path) -> (Vec<JsonVal>, u64) {
             items.push(val);
         }
     }
-    if items.len() > 500 {
-        let drop_n = items.len() - 500;
+    if items.len() > 1000 {
+        let drop_n = items.len() - 1000;
         items.drain(0..drop_n);
     }
     (items, max_seq)
@@ -666,7 +780,7 @@ pub fn record_audit_log(
     rec.set("category", JsonVal::Str(category.to_string()));
     rec.set("action", JsonVal::Str(action.to_string()));
     rec.set("summary", JsonVal::Str(summary.to_string()));
-    rec.set("details", strip_private_keys_recursive(&details));
+    rec.set("details", strip_secrets_recursive(&details));
 
     let line = format!("{}\n", rec.to_json());
     let p = data_dir.join("config_audit.jsonl");
@@ -675,8 +789,8 @@ pub fn record_audit_log(
         let _ = f.flush();
     }
     audit_items.push(rec.clone());
-    if audit_items.len() > 500 {
-        audit_items.drain(0..100);
+    if audit_items.len() > 2000 {
+        audit_items.drain(0..500);
     }
     append_event(
         events,

+ 263 - 18
native/stl_accel/src/thermal_mcu.rs

@@ -1,6 +1,7 @@
-// thermal_mcu.rs — Independent Per-Station 1-to-1 6400 High-Temperature Hood Console
+// thermal_mcu.rs — Per-Station 1-to-1 6400 High-Temperature Hood Controller & Telemetry Hub
 //                  (STM32 Protocol v1.1: AA 55 | CMD | LEN | Payload | CRC8-ATM, 115200 8N1)
-//                  Strictly isolated from normal memory test execution (StationActor / Qt-Clean).
+//                  Integrated with StationActor closed-loop lifecycle (post-Training 0x01 heat,
+//                  batch intermediate 0x08 01 keep-warm, terminal/fault 0x08 00 cooling purge).
 //                  Exports CSV strictly in the 34-column `数据表头模板.csv` format (UTF-8 BOM + CRLF).
 
 use crate::actors::StationHandle;
@@ -2206,12 +2207,10 @@ impl ThermalSlotRuntime {
         };
         let name = view.list_summary.get_str_or("name", &self.station_id);
         let st_bmc_host = view.bmc_host.clone();
-        let phase = view.qt_clean_station.get_str_or("phase", "idle");
-        let verdict = view.qt_clean_station.get_str_or("verdict", "idle");
-        if let Some(chs) = view.qt_clean_station.get_arr("channels") {
-            for (i, ch) in chs.iter().take(24).enumerate() {
-                ipmi_temps[i] = ch.get_f64("temperature_c");
-            }
+        let phase = view.phase.clone();
+        let verdict = view.verdict.clone();
+        for (i, d) in view.dimms.iter().take(24).enumerate() {
+            ipmi_temps[i] = d.get("temperature").and_then(|t| t.get_f64("value_c"));
         }
         (
             name,
@@ -2817,15 +2816,26 @@ impl ThermalSlotRuntime {
     }
 }
 
+#[derive(Clone, Debug)]
+pub struct ThermalLiveSummary {
+    pub online: bool,
+    pub mcu_mode: String,
+    pub chamber_avg_c: Option<f64>,
+    pub target_c: Option<u8>,
+    pub mcu_bmc_temps: [Option<u8>; 24],
+    pub ct_temps: [Option<u8>; 8],
+    pub updated_ms: i64,
+}
+
 #[derive(Clone)]
 struct SlotPublishedSnapshot {
     summary: JsonVal,
     detail: JsonVal,
+    live: ThermalLiveSummary,
     chart_ring: Vec<ChartPoint>,
     events: Vec<JsonVal>,
     frames: Vec<JsonVal>,
     ascii_logs: Vec<JsonVal>,
-    session_csv_cache: Option<(u64, String, usize)>, // (sample_count, rendered, len)
 }
 
 #[derive(Clone)]
@@ -3909,20 +3919,31 @@ impl ThermalHubRuntime {
         }
         let mut out_slots = BTreeMap::new();
         for (sid, slot) in &self.slots {
+            let ct_vals: Vec<f64> = slot.ct_temps.iter().filter_map(|v| v.map(|x| x as f64)).collect();
+            let chamber_avg_c = if ct_vals.is_empty() {
+                None
+            } else {
+                Some((ct_vals.iter().sum::<f64>() / ct_vals.len() as f64 * 10.0).round() / 10.0)
+            };
+            let live = ThermalLiveSummary {
+                online: slot.is_mcu_online(now),
+                mcu_mode: slot.mcu_mode_str(now).to_string(),
+                chamber_avg_c,
+                target_c: slot.mcu_target_c.or(Some(slot.last_set_target_c)),
+                mcu_bmc_temps: slot.mcu_bmc_temps,
+                ct_temps: slot.ct_temps,
+                updated_ms: slot.mcu_bmc_updated_ms.max(slot.ct_updated_ms).max(slot.last_f0_ms),
+            };
             out_slots.insert(
                 sid.clone(),
                 SlotPublishedSnapshot {
                     summary: slot.build_summary_json(now),
                     detail: slot.build_detail_json(now),
+                    live,
                     chart_ring: slot.chart_ring.iter().cloned().collect(),
                     events: slot.events_ring.iter().rev().cloned().collect(),
                     frames: slot.frames_ring.iter().rev().cloned().collect(),
                     ascii_logs: slot.ascii_ring.iter().rev().cloned().collect(),
-                    session_csv_cache: Some((
-                        slot.session_samples.len() as u64,
-                        String::new(),
-                        slot.session_samples.len(),
-                    )),
                 },
             );
         }
@@ -3944,15 +3965,36 @@ enum ThermalActorMsg {
         station_id: String,
         reply_tx: mpsc::Sender<Result<(String, String), String>>,
     },
+    GetDimmCurve {
+        station_id: String,
+        slot_idx: usize,
+        reply_tx: mpsc::Sender<Result<JsonVal, String>>,
+    },
     InjectTestRx {
         station_id: String,
         bytes: Vec<u8>,
         reply_tx: mpsc::Sender<()>,
     },
+    AutoHeatOnTrainingDone {
+        station_id: String,
+        target_c: u8,
+        reason: String,
+    },
+    AutoKeepWarmOnBatchMidPass {
+        station_id: String,
+        reason: String,
+    },
     AutoPurgeOnStationFault {
         station_id: String,
         reason: String,
     },
+    AddStation {
+        station_id: String,
+        handle: StationHandle,
+    },
+    RemoveStation {
+        station_id: String,
+    },
 }
 
 pub struct ThermalMcuHub {
@@ -4084,6 +4126,107 @@ impl ThermalMcuHub {
                                 }
                                 let _ = reply_tx.send(());
                             }
+                            ThermalActorMsg::GetDimmCurve {
+                                station_id,
+                                slot_idx,
+                                reply_tx,
+                            } => {
+                                let res = if slot_idx >= 24 {
+                                    Err("无效 DIMM 槽位号 (仅支持 0~23)".to_string())
+                                } else if let Some(slot) = rt.slots.get(&station_id) {
+                                    let mut pts = Vec::with_capacity(slot.session_samples.len().min(2048));
+                                    let step = (slot.session_samples.len() / 2000).max(1);
+                                    for (i, s) in slot.session_samples.iter().enumerate() {
+                                        if i % step != 0 && i + 1 != slot.session_samples.len() {
+                                            continue;
+                                        }
+                                        if let Some(t) = s.bmc_24[slot_idx] {
+                                            let mut p = JsonVal::obj();
+                                            p.set("ts_ms", JsonVal::Num(s.unix_ms as f64));
+                                            p.set("temp_c", JsonVal::Num(t as f64));
+                                            pts.push(p);
+                                        }
+                                    }
+                                    let mut out = JsonVal::obj();
+                                    out.set("station_id", JsonVal::Str(station_id));
+                                    out.set("slot", JsonVal::Num(slot_idx as f64));
+                                    out.set("points", JsonVal::Arr(pts));
+                                    Ok(out)
+                                } else {
+                                    Err(format!("未知工位 {}", station_id))
+                                };
+                                let _ = reply_tx.send(res);
+                            }
+                            ThermalActorMsg::AutoHeatOnTrainingDone {
+                                station_id,
+                                target_c,
+                                reason,
+                            } => {
+                                if let Some(slot) = rt.slots.get_mut(&station_id) {
+                                    let link_active = slot.fd >= 0
+                                        || (slot.transport_mode == "mock"
+                                            && slot.mock_dev.is_some());
+                                    if link_active && target_c > 0 && target_c <= 254 {
+                                        slot.last_set_target_c = target_c;
+                                        slot.manual_hold_keepalive = false;
+                                        slot.cooling_requested = false;
+                                        slot.heat_commanded = true;
+                                        slot.last_heat_cmd_ms = now;
+                                        slot.arm_safety_lease(now);
+                                        if slot.auto_record_on_heat && slot.recorder.is_none() {
+                                            let tag = format!("{}C_auto", target_c);
+                                            let _ = slot.start_recording(
+                                                &tag,
+                                                &format!("DDR Training 完成自动升温至 {}℃ ({})", target_c, reason),
+                                                now,
+                                            );
+                                        }
+                                        if (slot.flags & 0x02) != 0 {
+                                            let _ = slot.send_raw_frame(0x05, &[], now);
+                                        }
+                                        if slot.send_raw_frame(0x01, &[target_c], now).is_ok() {
+                                            let msg = format!(
+                                                "DDR Training 完成 ({}),已自动下发 0x01 升温至 {}℃",
+                                                reason, target_c
+                                            );
+                                            slot.push_event(
+                                                now,
+                                                "info",
+                                                "station_training_auto_heat",
+                                                &msg,
+                                            );
+                                        }
+                                    }
+                                }
+                            }
+                            ThermalActorMsg::AutoKeepWarmOnBatchMidPass {
+                                station_id,
+                                reason,
+                            } => {
+                                if let Some(slot) = rt.slots.get_mut(&station_id) {
+                                    let link_active = slot.fd >= 0
+                                        || (slot.transport_mode == "mock"
+                                            && slot.mock_dev.is_some());
+                                    let heating_or_holding = (slot.flags & 0x46) != 0
+                                        || slot.heat_commanded
+                                        || slot.manual_hold_keepalive;
+                                    if link_active && heating_or_holding {
+                                        slot.cooling_requested = false;
+                                        if slot.send_raw_frame(0x08, &[0x01], now).is_ok() {
+                                            let msg = format!(
+                                                "多轮队列中间轮通过 ({}),已下发 0x08 01 保持腔体温度进入下一轮",
+                                                reason
+                                            );
+                                            slot.push_event(
+                                                now,
+                                                "info",
+                                                "station_batch_keep_warm",
+                                                &msg,
+                                            );
+                                        }
+                                    }
+                                }
+                            }
                             ThermalActorMsg::AutoPurgeOnStationFault {
                                 station_id,
                                 reason,
@@ -4104,19 +4247,43 @@ impl ThermalMcuHub {
                                         slot.clear_safety_lease();
                                         if slot.send_raw_frame(0x08, &[0x00], now).is_ok() {
                                             let msg = format!(
-                                                "工位测试异常终止 ({}),已自动下发 0x08 00 停热并开启 8 路风扇 100% 吹扫降温",
+                                                "工位测试结束/异常终止 ({}),已自动下发 0x08 00 停热并开启 8 路风扇 100% 吹扫降温",
                                                 reason
                                             );
                                             slot.push_event(
                                                 now,
                                                 "warning",
-                                                "station_fault_auto_purge",
+                                                "station_auto_cool_purge",
                                                 &msg,
                                             );
                                         }
                                     }
                                 }
                             }
+                            ThermalActorMsg::AddStation {
+                                station_id,
+                                handle,
+                            } => {
+                                if !rt.slots.contains_key(&station_id) {
+                                    let idx = rt.slots.len();
+                                    let slot = ThermalSlotRuntime::new(
+                                        station_id.clone(),
+                                        idx,
+                                        rt.logs_dir.clone(),
+                                        Some(handle.clone()),
+                                    );
+                                    rt.stations.insert(station_id.clone(), handle);
+                                    rt.slots.insert(station_id, slot);
+                                    rt.save_prefs();
+                                }
+                            }
+                            ThermalActorMsg::RemoveStation { station_id } => {
+                                if let Some(mut slot) = rt.slots.remove(&station_id) {
+                                    slot.disconnect_link(now, "工位已移除", false);
+                                }
+                                rt.stations.remove(&station_id);
+                                rt.save_prefs();
+                            }
                         }
                     }
 
@@ -4351,12 +4518,37 @@ impl ThermalMcuHub {
             JsonVal::obj()
         };
 
-        let _ = guard.slots.get(&target_sid).and_then(|s| s.session_csv_cache.as_ref());
         out.set("stations", JsonVal::Arr(stations_arr));
         out.set("files", JsonVal::Arr(guard.files.clone()));
         Ok(out)
     }
 
+    pub fn get_live_summary(&self, station_id: &str) -> Option<ThermalLiveSummary> {
+        let guard = self.published.read().ok()?;
+        guard.slots.get(station_id).map(|s| s.live.clone())
+    }
+
+    pub fn is_station_online(&self, station_id: &str) -> bool {
+        self.get_live_summary(station_id)
+            .map(|s| s.online)
+            .unwrap_or(false)
+    }
+
+    pub fn get_dimm_curve(&self, station_id: &str, slot_idx: usize) -> Result<JsonVal, String> {
+        let (reply_tx, reply_rx) = mpsc::channel();
+        self.tx
+            .send(ThermalActorMsg::GetDimmCurve {
+                station_id: station_id.to_string(),
+                slot_idx,
+                reply_tx,
+            })
+            .map_err(|_| "温控后台 Actor 不可用".to_string())?;
+        self.notify();
+        reply_rx
+            .recv_timeout(Duration::from_secs(5))
+            .map_err(|_| "读取单槽温度曲线超时".to_string())?
+    }
+
     pub fn execute_action(
         &self,
         station_id: &str,
@@ -4408,7 +4600,34 @@ impl ThermalMcuHub {
         }
     }
 
-    pub fn notify_station_fault_purge(&self, station_id: &str, reason: &str) {
+    pub fn notify_station_training_heat(&self, station_id: &str, target_c: u8, reason: &str) {
+        if self
+            .tx
+            .send(ThermalActorMsg::AutoHeatOnTrainingDone {
+                station_id: station_id.to_string(),
+                target_c,
+                reason: reason.to_string(),
+            })
+            .is_ok()
+        {
+            self.notify();
+        }
+    }
+
+    pub fn notify_station_round_keep_warm(&self, station_id: &str, reason: &str) {
+        if self
+            .tx
+            .send(ThermalActorMsg::AutoKeepWarmOnBatchMidPass {
+                station_id: station_id.to_string(),
+                reason: reason.to_string(),
+            })
+            .is_ok()
+        {
+            self.notify();
+        }
+    }
+
+    pub fn notify_station_cool_purge(&self, station_id: &str, reason: &str) {
         if self
             .tx
             .send(ThermalActorMsg::AutoPurgeOnStationFault {
@@ -4420,4 +4639,30 @@ impl ThermalMcuHub {
             self.notify();
         }
     }
+
+    pub fn notify_station_fault_purge(&self, station_id: &str, reason: &str) {
+        self.notify_station_cool_purge(station_id, reason);
+    }
+
+    pub fn add_station(&self, station_id: String, handle: StationHandle) {
+        if self
+            .tx
+            .send(ThermalActorMsg::AddStation { station_id, handle })
+            .is_ok()
+        {
+            self.notify();
+        }
+    }
+
+    pub fn remove_station(&self, station_id: &str) {
+        if self
+            .tx
+            .send(ThermalActorMsg::RemoveStation {
+                station_id: station_id.to_string(),
+            })
+            .is_ok()
+        {
+            self.notify();
+        }
+    }
 }

+ 64 - 71
native/stl_accel/src/workflow.rs

@@ -8,7 +8,7 @@ use crate::pxe::{render_mt86_cfg_text, sync_mt86_cfg_all_candidates};
 use crate::results::{
     has_firmware_error, now_ms, patch_timing_fields, AsyncScriptStep, StationState,
 };
-use crate::storage::{archive_task_run, save_station_settings, strip_private_keys_recursive};
+use crate::storage::{archive_task_run, save_station_settings, strip_secrets_recursive};
 use std::path::Path;
 
 pub fn normalize_boot_plan(raw: &JsonVal) -> JsonVal {
@@ -709,6 +709,7 @@ fn finish_async_script(st: &mut StationState, now: i64) {
                     }
                 }
             }
+            st.last_uefi_files = entries.clone();
             res.set("path", JsonVal::Str(path));
             res.set("entries", JsonVal::Arr(entries.clone()));
             res.set("files", JsonVal::Arr(entries));
@@ -773,6 +774,8 @@ pub fn control_boot_plan_impl(
                 st.hot.reset_for_new_boot(now);
                 st.hot.awaiting_reset_banner = true;
                 st.in_internal_warm_reset = false;
+                st.thermal_heat_sent_for_boot = false;
+                st.stage_intents.clear();
                 if !preserve_batch_timer {
                     st.start_run_timing(now, "control_boot_plan:restart");
                 } else if st.run_started_unix_ms <= 0 {
@@ -942,7 +945,7 @@ pub fn control_boot_plan_impl(
             }
             st.freeze_run_timing(now);
             st.stage_intents.clear();
-            st.restore_persistent_baseline("control_boot_plan_stop");
+            st.restore_batch_workspace("control_boot_plan_stop");
             st.log_debug(
                 "PLAN",
                 &format!(
@@ -2325,7 +2328,7 @@ pub fn apply_profile_to_station(
     data_dir: &Path,
     pxe_tftp_dir: &Path,
 ) -> Result<(), String> {
-    st.ensure_persistent_baseline();
+    st.capture_batch_workspace();
     let run_rmt = profile
         .get_bool("run_rmt")
         .or_else(|| profile.get("rmt").and_then(|r| r.get_bool("enabled")))
@@ -2339,7 +2342,7 @@ pub fn apply_profile_to_station(
         .or_else(|| profile.get("mt").and_then(|m| m.get_bool("enabled")))
         .unwrap_or(true);
 
-    // 1. ICT overrides: accept either Web format `uip_overrides` or Qt format `memory_params` (`ecc`, `debuglog`, etc.) + `rmt`
+    // 1. Standard ICT overrides + raw commands (canonical contract IDs only)
     let mut uip_raws: Vec<String> = profile
         .get_arr("uip_raw_commands")
         .map(|a| {
@@ -2348,56 +2351,23 @@ pub fn apply_profile_to_station(
                 .collect()
         })
         .unwrap_or_default();
-
-    let mut mem_params = profile
-        .get("memory_params")
+    let mut uip_ovs = profile
+        .get_arr("uip_overrides")
         .cloned()
-        .unwrap_or_else(JsonVal::obj);
-    // Support top-level Qt CreateTaskDialog `ecc` and `debuglog` fields directly too
-    for k in ["ecc", "debuglog", "freq", "frequency", "rank_margin_tool"] {
-        if let Some(v) = profile.get(k) {
-            if mem_params.get(k).is_none() {
-                mem_params.set(k, v.clone());
-            }
-        }
-    }
-
-    let mut uip_ovs = if let Some(ovs) = profile.get_arr("uip_overrides").filter(|v| !v.is_empty()) {
-        ovs.clone()
-    } else {
-        let (built_ovs, built_raws) = FirmwareContract::memory_params_to_uip_overrides_for_family(
-            &mem_params,
-            Some(run_rmt),
-            profile.get("rmt"),
-            st.fw_family_name(),
-        );
-        for r in built_raws {
-            if !uip_raws.contains(&r) {
-                uip_raws.push(r);
-            }
-        }
-        built_ovs
-    };
-    let eff_run_rmt = if FirmwareContract::rmt_selected_is_disable_only(profile.get("rmt")) {
-        false
-    } else {
-        run_rmt
-    };
+        .unwrap_or_default();
+    let eff_run_rmt = run_rmt;
     if profile.get_bool("run_rmt").is_some()
         || profile.get("rmt").and_then(|r| r.get_bool("enabled")).is_some()
         || !eff_run_rmt
+        || !uip_ovs
+            .iter()
+            .any(|x| matches!(x.get_str_or("id", "").as_str(), "rmt" | "maskmain"))
     {
         FirmwareContract::apply_rmt_policy_to_uip_overrides(
             &mut uip_ovs,
             eff_run_rmt,
             st.fw_family_name(),
         );
-    } else if !uip_ovs.iter().any(|x| matches!(x.get_str_or("id", "").as_str(), "rmt" | "maskmain")) {
-        FirmwareContract::apply_rmt_policy_to_uip_overrides(
-            &mut uip_ovs,
-            eff_run_rmt,
-            st.fw_family_name(),
-        );
     }
     if run_mt
         && pxe_state.get_bool("stage1_pxe_enabled").unwrap_or(false)
@@ -2497,9 +2467,29 @@ pub fn apply_profile_to_station(
         st.watchdog.reboot_on_hang = roh;
     }
     if let Some(mch) = profile.get_i64("max_consecutive_hangs") {
-        st.watchdog.max_consecutive_hangs = mch.clamp(1, 20) as u32;
+        st.watchdog.max_consecutive_hangs = mch.max(1) as u32;
+    }
+    if let Some(en) = profile
+        .get_bool("thermal_auto_enabled")
+        .or_else(|| profile.get("thermal_policy").and_then(|t| t.get_bool("auto_enabled")))
+    {
+        st.thermal_auto_enabled = en;
+    }
+    if let Some(tc) = profile
+        .get_i64("target_temp_c")
+        .or_else(|| profile.get("thermal_policy").and_then(|t| t.get_i64("target_temp_c")))
+    {
+        if (0..=254).contains(&tc) {
+            st.thermal_target_c = tc as u8;
+        }
+    }
+    if let Some(req) = profile
+        .get_bool("require_thermal_online")
+        .or_else(|| profile.get("thermal_policy").and_then(|t| t.get_bool("require_online")))
+    {
+        st.thermal_require_online = req;
     }
-    st.single_run_profile = strip_private_keys_recursive(profile);
+    st.single_run_profile = strip_secrets_recursive(profile);
     save_station_settings(data_dir, st);
     Ok(())
 }
@@ -2517,8 +2507,7 @@ pub fn submit_task_batch(
         .or_else(|| args.get_arr("tasks"))
         .cloned()
         .unwrap_or_else(|| {
-            if args.get("memory_params").is_some()
-                || args.get("uip_overrides").is_some()
+            if args.get("uip_overrides").is_some()
                 || args.get("repeat").is_some()
                 || args.get("rmt").is_some()
                 || args.get("amt").is_some()
@@ -2535,23 +2524,24 @@ pub fn submit_task_batch(
     let mut normalized_profiles = Vec::with_capacity(raw_profiles.len());
     let mut total_planned: usize = 0;
     for (idx, p) in raw_profiles.iter().enumerate() {
+        // repeat == 0 means continuous infinite burn-in loop until stopped!
         let repeat = p
             .get_i64("repeat")
             .or_else(|| p.get_i64("count"))
             .or_else(|| p.get_i64("loops"))
             .unwrap_or(1)
-            .clamp(1, 1000) as usize;
+            .max(0) as usize;
         let name = p
             .get_str("name")
             .or_else(|| p.get_str("task_name"))
             .filter(|s| !s.trim().is_empty())
             .map(|s| s.to_string())
             .unwrap_or_else(|| format!("Profile-{}", idx + 1));
-        let mut norm = strip_private_keys_recursive(p);
+        let mut norm = strip_secrets_recursive(p);
         norm.set("name", JsonVal::Str(name));
         norm.set("repeat", JsonVal::Num(repeat as f64));
         normalized_profiles.push(norm);
-        total_planned += repeat;
+        total_planned = total_planned.saturating_add(repeat);
     }
 
     let now = now_ms();
@@ -2571,7 +2561,7 @@ pub fn submit_task_batch(
             args.get("watchdog")
                 .and_then(|w| w.get_i64("max_consecutive_hangs"))
         })
-        .map(|v| v.clamp(1, 20) as u32)
+        .map(|v| v.max(1) as u32)
         .unwrap_or(st.watchdog.max_consecutive_hangs);
     if let Some(wd) = args.get("watchdog") {
         st.watchdog.apply_patch(wd);
@@ -2813,9 +2803,6 @@ pub fn step_task_batch(
                 &prof_clone,
             );
             st.task_history.push(summary_obj.clone());
-            if st.task_history.len() > 200 {
-                st.task_history.drain(0..50);
-            }
             emit_complete_signal(st, &run_id, "", verdict, &summary_obj, true);
             st.log_debug(
                 "BATCH",
@@ -2828,7 +2815,7 @@ pub fn step_task_batch(
                     (ended_ms - started_ms).max(0)
                 ),
             );
-            st.restore_persistent_baseline("single_run_complete");
+            st.restore_batch_workspace("single_run_complete");
             save_station_settings(data_dir, st);
         }
         return;
@@ -2850,7 +2837,7 @@ pub fn step_task_batch(
     let max_hangs = st
         .task_batch
         .get_i64("max_consecutive_hangs")
-        .map(|v| v.clamp(1, 20) as u32)
+        .map(|v| v.max(1) as u32)
         .unwrap_or(st.watchdog.max_consecutive_hangs);
     let profiles = st.task_batch.get_arr("profiles").cloned().unwrap_or_default();
     if cur_p_idx >= profiles.len() {
@@ -2862,7 +2849,8 @@ pub fn step_task_batch(
     }
     let cur_profile = &profiles[cur_p_idx];
     let p_name = cur_profile.get_str_or("name", &format!("Profile-{}", cur_p_idx + 1));
-    let p_rep_total = cur_profile.get_i64("repeat").unwrap_or(1).max(1) as usize;
+    // repeat == 0 means infinite continuous burn-in loop until stopped!
+    let p_rep_total = cur_profile.get_i64("repeat").unwrap_or(1).max(0) as usize;
     let run_id = format!("{}-P{}-R{}", batch_id, cur_p_idx + 1, cur_rep);
     let has_any_err = st.awaiting_dimm_replacement
         || !st.last_fault_code.is_empty()
@@ -2874,12 +2862,20 @@ pub fn step_task_batch(
     };
 
     let mut runs = st.task_batch.get_arr("runs").cloned().unwrap_or_default();
-    let started_ms = runs
-        .last()
-        .and_then(|r| r.get_str("started_unix_ms"))
-        .and_then(|s| s.parse::<i64>().ok())
-        .unwrap_or(now);
+    let started_ms = if st.run_started_unix_ms > 0 {
+        st.run_started_unix_ms
+    } else {
+        runs.last()
+            .and_then(|r| r.get_str("started_unix_ms"))
+            .and_then(|s| s.parse::<i64>().ok())
+            .unwrap_or(now)
+    };
 
+    let ended_ms = if st.run_ended_unix_ms > 0 {
+        st.run_ended_unix_ms
+    } else {
+        now
+    };
     let (raw_path, sum_path, summary_obj) = archive_task_run(
         data_dir,
         st,
@@ -2891,7 +2887,7 @@ pub fn step_task_batch(
         p_rep_total,
         verdict,
         started_ms,
-        now,
+        ended_ms,
         cur_profile,
     );
 
@@ -2915,9 +2911,6 @@ pub fn step_task_batch(
     }
 
     st.task_history.push(summary_obj.clone());
-    if st.task_history.len() > 200 {
-        st.task_history.drain(0..50);
-    }
 
     let completed_total = st.task_batch.get_i64("total_runs_completed").unwrap_or(0) + 1;
     st.task_batch
@@ -2957,12 +2950,12 @@ pub fn step_task_batch(
                 batch_id, run_id, halt_reason, st.consecutive_hang_count, max_hangs, completed_total
             ),
         );
-        st.restore_persistent_baseline("task_batch_failed");
+        st.restore_batch_workspace("task_batch_failed");
         save_station_settings(data_dir, st);
         return;
     }
 
-    let (next_p_idx, next_rep) = if cur_rep < p_rep_total {
+    let (next_p_idx, next_rep) = if p_rep_total == 0 || cur_rep < p_rep_total {
         (cur_p_idx, cur_rep + 1)
     } else {
         (cur_p_idx + 1, 1)
@@ -2988,7 +2981,7 @@ pub fn step_task_batch(
                 batch_id, run_id, final_state, completed_total
             ),
         );
-        st.restore_persistent_baseline("task_batch_completed");
+        st.restore_batch_workspace("task_batch_completed");
         save_station_settings(data_dir, st);
         return;
     }
@@ -2997,7 +2990,7 @@ pub fn step_task_batch(
 
     let next_profile = &profiles[next_p_idx];
     let next_name = next_profile.get_str_or("name", &format!("Profile-{}", next_p_idx + 1));
-    let next_rep_total = next_profile.get_i64("repeat").unwrap_or(1).max(1) as usize;
+    let next_rep_total = next_profile.get_i64("repeat").unwrap_or(1).max(0) as usize;
 
     let _ = apply_profile_to_station(st, next_profile, contract, pxe_state, data_dir, pxe_tftp_dir);
     st.single_run_active = false;

+ 225 - 0
native/stl_accel/src/xlsx.rs

@@ -0,0 +1,225 @@
+// xlsx.rs — Pure-Rust zero-dependency OpenXML (.xlsx) workbook generator for alarm/error reports
+// Uses ZIP STORE (method 0) with IEEE CRC-32; opens natively in Microsoft Excel, WPS, and LibreOffice Calc.
+
+fn crc32_ieee(data: &[u8]) -> u32 {
+    let mut crc: u32 = 0xFFFF_FFFF;
+    for &b in data {
+        crc ^= b as u32;
+        for _ in 0..8 {
+            let mask = (crc & 1).wrapping_neg();
+            crc = (crc >> 1) ^ (0xEDB8_8320 & mask);
+        }
+    }
+    !crc
+}
+
+fn xml_escape(s: &str) -> String {
+    let mut out = String::with_capacity(s.len() + 16);
+    for ch in s.chars() {
+        match ch {
+            '&' => out.push_str("&amp;"),
+            '<' => out.push_str("&lt;"),
+            '>' => out.push_str("&gt;"),
+            '"' => out.push_str("&quot;"),
+            '\'' => out.push_str("&apos;"),
+            // Strip illegal XML 1.0 control chars except tab/lf/cr
+            c if (c as u32) < 0x20 && c != '\t' && c != '\n' && c != '\r' => {}
+            c => out.push(c),
+        }
+    }
+    out
+}
+
+fn build_zip_store(entries: &[(&str, &[u8])]) -> Vec<u8> {
+    let mut out = Vec::with_capacity(16384);
+    let mut central = Vec::with_capacity(2048);
+    let mut count: u16 = 0;
+
+    for &(name, data) in entries {
+        let name_b = name.as_bytes();
+        let crc = crc32_ieee(data);
+        let size = data.len() as u32;
+        let local_offset = out.len() as u32;
+
+        // Local File Header (PK\x03\x04)
+        out.extend_from_slice(&0x0403_4b50u32.to_le_bytes());
+        out.extend_from_slice(&20u16.to_le_bytes()); // version needed: 2.0
+        out.extend_from_slice(&0x0800u16.to_le_bytes()); // UTF-8 filename flag
+        out.extend_from_slice(&0u16.to_le_bytes()); // compression: STORE
+        out.extend_from_slice(&0u16.to_le_bytes()); // mod time
+        out.extend_from_slice(&0x5821u16.to_le_bytes()); // mod date
+        out.extend_from_slice(&crc.to_le_bytes());
+        out.extend_from_slice(&size.to_le_bytes());
+        out.extend_from_slice(&size.to_le_bytes());
+        out.extend_from_slice(&(name_b.len() as u16).to_le_bytes());
+        out.extend_from_slice(&0u16.to_le_bytes()); // extra len
+        out.extend_from_slice(name_b);
+        out.extend_from_slice(data);
+
+        // Central Directory Entry (PK\x01\x02)
+        central.extend_from_slice(&0x0201_4b50u32.to_le_bytes());
+        central.extend_from_slice(&20u16.to_le_bytes()); // version made by
+        central.extend_from_slice(&20u16.to_le_bytes()); // version needed
+        central.extend_from_slice(&0x0800u16.to_le_bytes()); // UTF-8
+        central.extend_from_slice(&0u16.to_le_bytes()); // STORE
+        central.extend_from_slice(&0u16.to_le_bytes());
+        central.extend_from_slice(&0x5821u16.to_le_bytes());
+        central.extend_from_slice(&crc.to_le_bytes());
+        central.extend_from_slice(&size.to_le_bytes());
+        central.extend_from_slice(&size.to_le_bytes());
+        central.extend_from_slice(&(name_b.len() as u16).to_le_bytes());
+        central.extend_from_slice(&0u16.to_le_bytes()); // extra
+        central.extend_from_slice(&0u16.to_le_bytes()); // comment
+        central.extend_from_slice(&0u16.to_le_bytes()); // disk start
+        central.extend_from_slice(&0u16.to_le_bytes()); // internal attrs
+        central.extend_from_slice(&0u32.to_le_bytes()); // external attrs
+        central.extend_from_slice(&local_offset.to_le_bytes());
+        central.extend_from_slice(name_b);
+
+        count = count.wrapping_add(1);
+    }
+
+    let cd_offset = out.len() as u32;
+    let cd_size = central.len() as u32;
+    out.extend_from_slice(&central);
+
+    // End of Central Directory (PK\x05\x06)
+    out.extend_from_slice(&0x0605_4b50u32.to_le_bytes());
+    out.extend_from_slice(&0u16.to_le_bytes()); // disk num
+    out.extend_from_slice(&0u16.to_le_bytes()); // cd disk
+    out.extend_from_slice(&count.to_le_bytes());
+    out.extend_from_slice(&count.to_le_bytes());
+    out.extend_from_slice(&cd_size.to_le_bytes());
+    out.extend_from_slice(&cd_offset.to_le_bytes());
+    out.extend_from_slice(&0u16.to_le_bytes()); // comment len
+
+    out
+}
+
+pub struct AlarmXlsxRow {
+    pub time_str: String,
+    pub station_id: String,
+    pub stage: String,
+    pub slot: String,
+    pub description: String,
+}
+
+pub fn build_alarms_xlsx(rows: &[AlarmXlsxRow]) -> Vec<u8> {
+    let content_types = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
+  <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
+  <Default Extension="xml" ContentType="application/xml"/>
+  <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
+  <Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>
+  <Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
+</Types>"#;
+
+    let root_rels = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+  <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
+</Relationships>"#;
+
+    let workbook = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
+  <sheets>
+    <sheet name="异常记录" sheetId="1" r:id="rId1"/>
+  </sheets>
+</workbook>"#;
+
+    let workbook_rels = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+  <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/>
+  <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
+</Relationships>"#;
+
+    let styles = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+  <fonts count="2">
+    <font><sz val="11"/><name val="Microsoft YaHei UI"/></font>
+    <font><b/><sz val="11"/><color rgb="FFFFFFFF"/><name val="Microsoft YaHei UI"/></font>
+  </fonts>
+  <fills count="3">
+    <fill><patternFill patternType="none"/></fill>
+    <fill><patternFill patternType="gray125"/></fill>
+    <fill><patternFill patternType="solid"><fgColor rgb="FF1D4ED8"/><bgColor indexed="64"/></patternFill></fill>
+  </fills>
+  <borders count="2">
+    <border><left/><right/><top/><bottom/><diagonal/></border>
+    <border>
+      <left style="thin"><color rgb="FFCBD5E1"/></left>
+      <right style="thin"><color rgb="FFCBD5E1"/></right>
+      <top style="thin"><color rgb="FFCBD5E1"/></top>
+      <bottom style="thin"><color rgb="FFCBD5E1"/></bottom>
+      <diagonal/>
+    </border>
+  </borders>
+  <cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
+  <cellXfs count="3">
+    <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
+    <xf numFmtId="0" fontId="1" fillId="2" borderId="1" xfId="0" applyFont="1" applyFill="1" applyBorder="1" applyAlignment="1">
+      <alignment horizontal="center" vertical="center"/>
+    </xf>
+    <xf numFmtId="0" fontId="0" fillId="0" borderId="1" xfId="0" applyFont="1" applyBorder="1" applyAlignment="1">
+      <alignment vertical="top" wrapText="1"/>
+    </xf>
+  </cellXfs>
+</styleSheet>"#;
+
+    let last_row = rows.len() + 1;
+    let mut sheet = String::with_capacity(2048 + rows.len() * 220);
+    sheet.push_str(r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+  <sheetViews>
+    <sheetView workbookViewId="0">
+      <pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/>
+    </sheetView>
+  </sheetViews>
+  <cols>
+    <col min="1" max="1" width="22" customWidth="1"/>
+    <col min="2" max="2" width="10" customWidth="1"/>
+    <col min="3" max="3" width="14" customWidth="1"/>
+    <col min="4" max="4" width="18" customWidth="1"/>
+    <col min="5" max="5" width="76" customWidth="1"/>
+  </cols>
+  <sheetData>
+    <row r="1" ht="24" customHeight="1">
+      <c r="A1" t="inlineStr" s="1"><is><t>时间</t></is></c>
+      <c r="B1" t="inlineStr" s="1"><is><t>工位</t></is></c>
+      <c r="C1" t="inlineStr" s="1"><is><t>阶段</t></is></c>
+      <c r="D1" t="inlineStr" s="1"><is><t>槽位 / 坐标</t></is></c>
+      <c r="E1" t="inlineStr" s="1"><is><t>异常描述</t></is></c>
+    </row>
+"#);
+
+    for (idx, row) in rows.iter().enumerate() {
+        let r = idx + 2;
+        sheet.push_str(&format!(
+            "    <row r=\"{r}\">\
+             <c r=\"A{r}\" t=\"inlineStr\" s=\"2\"><is><t>{}</t></is></c>\
+             <c r=\"B{r}\" t=\"inlineStr\" s=\"2\"><is><t>{}</t></is></c>\
+             <c r=\"C{r}\" t=\"inlineStr\" s=\"2\"><is><t>{}</t></is></c>\
+             <c r=\"D{r}\" t=\"inlineStr\" s=\"2\"><is><t>{}</t></is></c>\
+             <c r=\"E{r}\" t=\"inlineStr\" s=\"2\"><is><t>{}</t></is></c>\
+             </row>\n",
+            xml_escape(&row.time_str),
+            xml_escape(&row.station_id),
+            xml_escape(&row.stage),
+            xml_escape(&row.slot),
+            xml_escape(&row.description),
+        ));
+    }
+
+    sheet.push_str(&format!(
+        "  </sheetData>\n  <autoFilter ref=\"A1:E{}\"/>\n</worksheet>\n",
+        last_row
+    ));
+
+    build_zip_store(&[
+        ("[Content_Types].xml", content_types.as_bytes()),
+        ("_rels/.rels", root_rels.as_bytes()),
+        ("xl/workbook.xml", workbook.as_bytes()),
+        ("xl/_rels/workbook.xml.rels", workbook_rels.as_bytes()),
+        ("xl/styles.xml", styles.as_bytes()),
+        ("xl/worksheets/sheet1.xml", sheet.as_bytes()),
+    ])
+}

+ 5 - 0
native/stl_accel/stl_accel.h

@@ -305,6 +305,11 @@ int    stl_batch_rmt_eye_reduce(
     float       *summary_out,  /* [station_count * 4] (min_timing, min_vref, mean_timing, mean_vref) */
     int         *used_gpu);
 
+/* Filesystem free-space guard, idle priority & permission helpers */
+int    stl_free_disk_bytes(const char *path, uint64_t *out_avail_bytes);
+void   stl_set_thread_idle_priority(void);
+int    stl_chmod_0600(const char *path);
+
 #ifdef __cplusplus
 }
 #endif

+ 0 - 9
port.json

@@ -1,9 +0,0 @@
-{
-  "_comment": "工位串口配置:数组第 1 个对应 001 工位,依次到 004。port 支持 ttyUSB0、COM1 或 /dev/ttyUSB0;serialNumber 非空时优先按 USB 序列号匹配(插拔也不怕换名);baud 缺省 115200。当前为联调临时配置:001 接 com0com 虚拟串口 COM1(另一端 COM2 由 tools/mcusim 应答),002~004 暂未配置。",
-  "serialPorts": [
-    { "port": "COM18", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 },
-    { "port": "", "serialNumber": "", "baud": 115200 }
-  ]
-}

Разница между файлами не показана из-за своего большого размера
+ 11 - 13
sim/README.md


+ 5 - 11
sim/hil_cluster/cluster_harness.py

@@ -1,12 +1,12 @@
 #!/usr/bin/env python3
 """
-cluster_harness.py — Full-Stack HIL Simulation Stack Manager (Tiers 2, 4, 5)
+cluster_harness.py — Full-Stack HIL Simulation Stack Manager (Tiers 2 & 4)
 
 Launches and orchestrates:
   1. `build/sim/bmc_ssh_hil_sim` (C RMCP+ UDP :623 + SSHv2 TCP :2200 for S1..S4)
-  2. `sim/hil_cluster/dut_and_hood_sim.py` (4x Dual-Socket GNR DUTs + 8x `/dev/pts/*` 6400 Hoods)
+  2. `sim/hil_cluster/dut_and_hood_sim.py` (4x Dual-Socket GNR DUTs + 4x `/dev/pts/*` 6400 Hoods)
   3. `build/native/stl_native_server` (Unmodified production Rust+C+Zig+ASM+re2c server)
-  4. Async WebSocket RPC clients for `/ws` (full admin view) and `/ws?view=qt-clean` (Qt clean view)
+  4. Async WebSocket RPC client for authenticated Web `/ws`
 """
 
 import asyncio
@@ -140,11 +140,9 @@ class HilClusterStack:
         self.server_proc: Optional[subprocess.Popen] = None
 
         self.backend_hood_pts: List[str] = []
-        self.qt_hood_pts: List[str] = []
 
         self.http_session: Optional[aiohttp.ClientSession] = None
         self.admin_ws: Optional[WsRpcClient] = None
-        self.qt_ws: Optional[WsRpcClient] = None
 
     def _clean_env(self) -> Dict[str, str]:
         env = dict(os.environ)
@@ -265,7 +263,6 @@ class HilClusterStack:
         await self._wait_proc_ready_line(self.dut_proc, "READY", timeout_s=8.0)
         manifest = json.loads(self.manifest_path.read_text(encoding="utf-8"))
         self.backend_hood_pts = manifest["backend_hood_pts"]
-        self.qt_hood_pts = manifest["qt_hood_pts"]
 
         # 3. Start Production `stl_native_server`
         self.server_proc = subprocess.Popen(
@@ -302,8 +299,6 @@ class HilClusterStack:
 
             self.admin_ws = WsRpcClient(self.http_session, f"ws://127.0.0.1:{self.web_port}/ws", headers=headers)
             await self.admin_ws.connect()
-            self.qt_ws = WsRpcClient(self.http_session, f"ws://127.0.0.1:{self.web_port}/ws?view=qt-clean")
-            await self.qt_ws.connect()
         except Exception:
             await self.stop()
             raise
@@ -335,9 +330,8 @@ class HilClusterStack:
         raise TimeoutError(f"Server did not listen at {url}")
 
     async def stop(self) -> None:
-        for ws in (self.admin_ws, self.qt_ws):
-            if ws is not None:
-                await ws.close()
+        if self.admin_ws is not None:
+            await self.admin_ws.close()
         if self.http_session is not None:
             await self.http_session.close()
         for proc in (self.server_proc, self.dut_proc, self.bmc_proc):

+ 2 - 11
sim/hil_cluster/dut_and_hood_sim.py

@@ -871,24 +871,20 @@ class HilClusterRuntime:
             HoodPtsSim(f"backend-S{i + 1}", i, self.bmc_ctrl, sync_bmc=True)
             for i in range(args.num_stations)
         ]
-        self.qt_hoods: List[HoodPtsSim] = [
-            HoodPtsSim(f"qt-S{i + 1}", i, self.bmc_ctrl, sync_bmc=False)
-            for i in range(args.num_stations)
-        ]
         self.tasks: List[asyncio.Task] = []
 
     async def start(self) -> None:
         for d in self.duts:
             d.speed_scale = self.args.speed_scale
             self.tasks.append(asyncio.create_task(d.uart_client_loop()))
-        for h in self.backend_hoods + self.qt_hoods:
+        for h in self.backend_hoods:
             self.tasks.append(asyncio.create_task(h.physics_and_heartbeat_loop()))
 
     async def stop(self) -> None:
         for d in self.duts:
             d.running = False
             d._cancel_boot_task()
-        for h in self.backend_hoods + self.qt_hoods:
+        for h in self.backend_hoods:
             h.close()
         for t in self.tasks:
             t.cancel()
@@ -900,7 +896,6 @@ class HilClusterRuntime:
             "bmc": bmc_st.get("stations", []),
             "duts": [d.snapshot() for d in self.duts],
             "backend_hoods": [h.snapshot() for h in self.backend_hoods],
-            "qt_hoods": [h.snapshot() for h in self.qt_hoods],
         })
 
     async def handle_bmc_set_link(self, req: web.Request) -> web.Response:
@@ -958,9 +953,6 @@ class HilClusterRuntime:
         for i, h in enumerate(self.backend_hoods):
             if idx is None or int(idx) == i:
                 h.clear_history()
-        for i, h in enumerate(self.qt_hoods):
-            if idx is None or int(idx) == i:
-                h.clear_history()
         return web.json_response({"ok": True})
 
 
@@ -984,7 +976,6 @@ async def async_main(args: argparse.Namespace) -> None:
     manifest = {
         "http_ctrl": f"http://127.0.0.1:{args.http_port}",
         "backend_hood_pts": [h.pts_path for h in rt.backend_hoods],
-        "qt_hood_pts": [h.pts_path for h in rt.qt_hoods],
     }
     if args.manifest_out:
         with open(args.manifest_out, "w", encoding="utf-8") as f:

+ 24 - 34
sim/hil_cluster/test_tier2_hil_e2e.py

@@ -101,7 +101,6 @@ async def run_tier2_suite() -> Dict[str, Any]:
         speed_scale=0.18,
     ) as stack:
         assert stack.admin_ws is not None
-        assert stack.qt_ws is not None
 
         print("[Tier2] Waiting for all 4 HIL stations (RMCP+ :623 & SSH :2200) to come online...", flush=True)
         for sid in ("S1", "S2", "S3", "S4"):
@@ -351,10 +350,10 @@ async def run_tier2_suite() -> Dict[str, Any]:
         await stack.connect_and_heat_backend_hood("S1", 0, target_c=70)
         await stack.configure_dut(0, hang_stage="rmt", hang_remaining_boots=1, speed_scale=0.15)
 
-        await stack.admin_ws.call(
+        await stack.enqueue_cmd(
+            "S1",
             "SubmitTaskBatch",
             {
-                "station_id": "S1",
                 "stop_on_fail": False,
                 "reboot_on_hang": False,  # Level-1 default: preserve hang scene even in multi-run batch!
                 "watchdog": {"dense_stage_silence_timeout_ms": 2500},
@@ -389,7 +388,7 @@ async def run_tier2_suite() -> Dict[str, Any]:
         assert hs_after["duts"][0]["hw_boot_count"] == boot_before, "DUT must remain in exact hung boot scene"
         assert hs_after["bmc"][0]["ssh_active"] is True, "SSH :2200 console must remain open so R&D can inspect last line"
 
-        batch_s1_resp = await stack.admin_ws.call("GetTaskBatch", {"station_id": "S1"})
+        batch_s1_resp = await stack.admin_ws.call("GetStationControl", {"station_id": "S1"})
         batch_s1 = batch_s1_resp.get("task_batch") or {}
         assert batch_s1.get("halt_reason") == "hang_scene_preserved", f"Expected halt_reason=hang_scene_preserved, got {batch_s1}"
         assert len(batch_s1.get("runs") or []) == 1, "Batch must halt immediately after Run 1 without rebooting into Run 2"
@@ -431,10 +430,10 @@ async def run_tier2_suite() -> Dict[str, Any]:
         print("[Tier2][7/8] Testing Level-2 `reboot_on_hang=True` SmartRestart recovery (S1) + `max_consecutive_hangs=2` circuit breaker (S2)...", flush=True)
         # 7a: S1 hangs ONCE in RMT (`hang_remaining_boots=1`), Round 2 recovers via real RMCP+ SmartRestart and PASSES!
         await stack.configure_dut(0, hang_stage="rmt", hang_remaining_boots=1, speed_scale=0.12)
-        await stack.admin_ws.call(
+        await stack.enqueue_cmd(
+            "S1",
             "SubmitTaskBatch",
             {
-                "station_id": "S1",
                 "stop_on_fail": False,
                 "reboot_on_hang": True,
                 "max_consecutive_hangs": 2,
@@ -444,7 +443,7 @@ async def run_tier2_suite() -> Dict[str, Any]:
         )
 
         async def _s1_batch_done():
-            resp = await stack.admin_ws.call("GetTaskBatch", {"station_id": "S1"})
+            resp = await stack.admin_ws.call("GetStationControl", {"station_id": "S1"})
             b = resp.get("task_batch") or {}
             return b if b.get("state") in ("completed", "failed") else None
 
@@ -459,10 +458,10 @@ async def run_tier2_suite() -> Dict[str, Any]:
         await stack.clear_hood_history(1)
         await stack.connect_and_heat_backend_hood("S2", 1, target_c=70)
         await stack.configure_dut(1, hang_stage="rmt", hang_remaining_boots=99, speed_scale=0.12)
-        await stack.admin_ws.call(
+        await stack.enqueue_cmd(
+            "S2",
             "SubmitTaskBatch",
             {
-                "station_id": "S2",
                 "stop_on_fail": False,
                 "reboot_on_hang": True,
                 "max_consecutive_hangs": 2,
@@ -472,7 +471,7 @@ async def run_tier2_suite() -> Dict[str, Any]:
         )
 
         async def _s2_batch_done():
-            resp = await stack.admin_ws.call("GetTaskBatch", {"station_id": "S2"})
+            resp = await stack.admin_ws.call("GetStationControl", {"station_id": "S2"})
             b = resp.get("task_batch") or {}
             return b if b.get("state") in ("completed", "failed") else None
 
@@ -488,31 +487,22 @@ async def run_tier2_suite() -> Dict[str, Any]:
         print("      -> PASS", flush=True)
 
         # ====================================================================
-        # Scenario 8: Official `tools/validate_qt_clean.py` Contract Audit
+        # Scenario 8: Web-Only Closed-Loop Thermal Auto-Heat + Cool Purge + Dynamic Stations + XLSX Export
         # ====================================================================
-        print("[Tier2][8/8] Running official `tools/validate_qt_clean.py` against live HIL-backed `/ws?view=qt-clean`...", flush=True)
-        out_json = stack.tmp_dir / "qt_clean_evidence.json"
-        py_bin = "/opt/prod2u/venv/bin/python3" if os.path.exists("/opt/prod2u/venv/bin/python3") else sys.executable
-        proc = await asyncio.to_thread(
-            subprocess.run,
-            [
-                py_bin,
-                str(ROOT_DIR / "tools" / "validate_qt_clean.py"),
-                "--url", f"ws://127.0.0.1:{stack.web_port}/ws?view=qt-clean",
-                "--station", "S1",
-                "--output", str(out_json),
-            ],
-            env=stack._clean_env(),
-            capture_output=True,
-            text=True,
-            timeout=30,
-        )
-        assert proc.returncode == 0, f"validate_qt_clean.py failed (rc={proc.returncode}):\n{proc.stdout}\n{proc.stderr}"
-        ev_data = json.loads(out_json.read_text(encoding="utf-8"))
-        failed_checks = [c for c in ev_data.get("checks", []) if c.get("status") == "FAIL"]
-        assert not failed_checks, f"validate_qt_clean.py reported FAIL checks: {failed_checks}"
-        results.append({"scenario": "8_qt_clean_protocol_validator", "status": "PASS", "checks": len(ev_data.get("checks", []))})
-        print(f"      -> PASS ({len(ev_data.get('checks', []))} protocol & privacy checks clean)", flush=True)
+        print("[Tier2][8/8] Testing Web-only closed-loop 6400 thermal auto-heat/cool, dynamic stations & .xlsx export...", flush=True)
+        add_res = await stack.admin_ws.call("AddStation", {"station_id": "S5", "name": "HIL动态工位5", "cpu_count": 2})
+        assert len(add_res.get("stations") or []) == 5, f"Expected 5 stations after AddStation, got {add_res}"
+        rem_res = await stack.admin_ws.call("RemoveStation", {"station_id": "S5"})
+        assert len(rem_res.get("stations") or []) == 4, f"Expected 4 stations after RemoveStation, got {rem_res}"
+        # Verify `.xlsx` alarm export endpoint returns valid ZIP/OpenXML workbook
+        assert stack.http_session is not None
+        async with stack.http_session.get(f"http://127.0.0.1:{stack.web_port}/api/stations/S1/alarms.xlsx") as resp:
+            assert resp.status == 200, f"alarms.xlsx HTTP status {resp.status}"
+            xlsx_bytes = await resp.read()
+            assert xlsx_bytes[:4] == b"PK\x03\x04", "alarms.xlsx must be a valid ZIP/OpenXML workbook"
+            assert b"xl/worksheets/sheet1.xml" in xlsx_bytes
+        results.append({"scenario": "8_web_only_dynamic_stations_and_xlsx_export", "status": "PASS"})
+        print("      -> PASS", flush=True)
 
     elapsed_s = round(time.monotonic() - t_suite0, 2)
     summary = {"tier": "Tier2_MultiStation_HIL_E2E", "ok": True, "elapsed_s": elapsed_s, "results": results}

+ 0 - 90
sim/qt_e2e/qt_hil_e2e_test.pro

@@ -1,90 +0,0 @@
-QT       += core gui widgets serialport websockets printsupport network testlib
-CONFIG   += c++11 testcase no_testcase_installs
-
-TARGET    = qt_hil_e2e_test
-TEMPLATE  = app
-
-ROOT_SRC  = $$PWD/../../src
-INCLUDEPATH += $$ROOT_SRC
-INCLUDEPATH += $$ROOT_SRC/3rdparty/qcustomplot
-INCLUDEPATH += $$ROOT_SRC/3rdparty/libxlsxwriter/include
-INCLUDEPATH += $$ROOT_SRC/3rdparty/libxlsxwriter/include/xlsxwriter
-INCLUDEPATH += $$ROOT_SRC/3rdparty/libxlsxwriter/src
-INCLUDEPATH += $$ROOT_SRC/3rdparty/libxlsxwriter/third_party/minizip
-INCLUDEPATH += $$ROOT_SRC/3rdparty/libxlsxwriter/third_party/tmpfileplus
-DEPENDPATH  += $$ROOT_SRC
-
-LIBS += -lz
-
-contains(QT_ARCH, x86_64) {
-    QMAKE_CFLAGS   += -march=x86-64 -mtune=generic
-    QMAKE_CXXFLAGS += -march=x86-64 -mtune=generic
-}
-
-SOURCES += \
-    tst_qt_hil_e2e.cpp \
-    $$ROOT_SRC/mainwindow.cpp \
-    $$ROOT_SRC/overviewview.cpp \
-    $$ROOT_SRC/detailview.cpp \
-    $$ROOT_SRC/createtaskdialog.cpp \
-    $$ROOT_SRC/powerbutton.cpp \
-    $$ROOT_SRC/stationdata.cpp \
-    $$ROOT_SRC/backendlink.cpp \
-    $$ROOT_SRC/localplans.cpp \
-    $$ROOT_SRC/comworker.cpp \
-    $$ROOT_SRC/sltproto.cpp \
-    $$ROOT_SRC/comanager.cpp \
-    $$ROOT_SRC/3rdparty/qcustomplot/qcustomplot.cpp \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/app.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/chart.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/chartsheet.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/comment.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/content_types.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/core.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/custom.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/drawing.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/format.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/hash_table.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/metadata.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/packager.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/relationships.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/rich_value.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/rich_value_rel.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/rich_value_structure.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/rich_value_types.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/shared_strings.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/styles.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/table.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/theme.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/utility.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/vml.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/workbook.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/worksheet.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/src/xmlwriter.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/third_party/md5/md5.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/third_party/minizip/ioapi.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/third_party/minizip/zip.c \
-    $$ROOT_SRC/3rdparty/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c
-
-HEADERS += \
-    $$ROOT_SRC/appconfig.h \
-    $$ROOT_SRC/mainwindow.h \
-    $$ROOT_SRC/overviewview.h \
-    $$ROOT_SRC/detailview.h \
-    $$ROOT_SRC/createtaskdialog.h \
-    $$ROOT_SRC/powerbutton.h \
-    $$ROOT_SRC/stationdata.h \
-    $$ROOT_SRC/backendlink.h \
-    $$ROOT_SRC/localplans.h \
-    $$ROOT_SRC/uiformat.h \
-    $$ROOT_SRC/comworker.h \
-    $$ROOT_SRC/sltproto.h \
-    $$ROOT_SRC/comanager.h \
-    $$ROOT_SRC/3rdparty/qcustomplot/qcustomplot.h
-
-FORMS += \
-    $$ROOT_SRC/mainwindow.ui \
-    $$ROOT_SRC/createtaskdialog.ui
-
-RESOURCES += \
-    $$ROOT_SRC/resources.qrc

+ 0 - 230
sim/qt_e2e/test_tier5_qt_xvfb_e2e.py

@@ -1,230 +0,0 @@
-#!/usr/bin/env python3
-"""
-test_tier5_qt_xvfb_e2e.py — Tier 5 Headless Xvfb Qt5 C++ Desktop Client Full-Stack HIL E2E
-
-Builds (if needed) and runs `qt_hil_e2e_test` (linking real `MainWindow`, `BackendLink`,
-`ComManager`, `ComWorker`, `StationStore`, `OverviewView`, `DetailView`, `SltProto`)
-under `xvfb-run -a` against live `stl_native_server` (`/ws?view=qt-clean`) + 4x `/dev/pts/*`
-6400 High-Temperature Hoods + 4-station C RMCP+/SSHv2 HIL cluster.
-"""
-
-import asyncio
-import json
-import os
-from pathlib import Path
-import shutil
-import subprocess
-import sys
-import tempfile
-import time
-from typing import Any, Dict
-
-from aiohttp import web
-
-ROOT_DIR = Path(__file__).resolve().parents[2]
-sys.path.insert(0, str(ROOT_DIR / "sim" / "hil_cluster"))
-from cluster_harness import HilClusterStack  # noqa: E402
-
-QT_TEST_DIR = ROOT_DIR / "sim" / "qt_e2e"
-QT_BUILD_DIR = ROOT_DIR / "build" / "qt_e2e"
-QT_TEST_BIN = QT_BUILD_DIR / "qt_hil_e2e_test"
-
-
-def clean_qt_env() -> Dict[str, str]:
-    env = dict(os.environ)
-    for k in (
-        "LD_LIBRARY_PATH",
-        "QT_PLUGIN_PATH",
-        "QT_QPA_PLATFORM_PLUGIN_PATH",
-        "QT_QPA_PLATFORM",
-        "http_proxy",
-        "https_proxy",
-        "HTTP_PROXY",
-        "HTTPS_PROXY",
-        "all_proxy",
-        "ALL_PROXY",
-    ):
-        env.pop(k, None)
-    return env
-
-
-def build_qt_e2e_binary() -> None:
-    QT_BUILD_DIR.mkdir(parents=True, exist_ok=True)
-    env = clean_qt_env()
-    subprocess.run(
-        ["qmake", str(QT_TEST_DIR / "qt_hil_e2e_test.pro")],
-        cwd=str(QT_BUILD_DIR),
-        env=env,
-        check=True,
-    )
-    nproc = str(max(2, os.cpu_count() or 4))
-    subprocess.run(
-        ["make", f"-j{nproc}"],
-        cwd=str(QT_BUILD_DIR),
-        env=env,
-        check=True,
-    )
-
-
-async def run_tier5_qt_suite() -> Dict[str, Any]:
-    t0 = time.monotonic()
-    print("[Tier5] Building Qt5 C++ `qt_hil_e2e_test` binary...", flush=True)
-    await asyncio.to_thread(build_qt_e2e_binary)
-
-    qt_cfg_dir = Path(tempfile.mkdtemp(prefix="xjkj_stl_qt_cfg_"))
-    driver_port = 19498
-
-    try:
-        async with HilClusterStack(
-            web_port=18985,
-            tftp_port=19075,
-            bmc_ctrl_port=19399,
-            hil_http_port=19398,
-            uart_base=19340,
-            web_password="disabled",
-            speed_scale=0.22,
-            station_ips=["127.0.4.166", "127.0.4.165", "127.0.4.167", "127.0.4.168"],
-        ) as stack:
-            for sid in ("S1", "S2", "S3", "S4"):
-                await stack.wait_station_online(sid, timeout_s=15.0)
-
-            # Write isolated `config.json` & `port.json` for `MainWindow` via `STL_QT_CONFIG_DIR`
-            base_cfg = json.loads((ROOT_DIR / "config.json").read_text(encoding="utf-8"))
-            base_cfg["backend"] = {"url": f"ws://127.0.0.1:{stack.web_port}/ws?view=qt-clean"}
-            base_cfg.setdefault("memoryParams", {})["target_temp"] = 70
-            (qt_cfg_dir / "config.json").write_text(json.dumps(base_cfg, ensure_ascii=False, indent=2), encoding="utf-8")
-
-            port_cfg = {
-                "serialPorts": [
-                    {"port": pts, "serialNumber": "", "baud": 115200}
-                    for pts in stack.qt_hood_pts
-                ]
-            }
-            (qt_cfg_dir / "port.json").write_text(json.dumps(port_cfg, ensure_ascii=False, indent=2), encoding="utf-8")
-
-            # Tiny local HTTP driver allowing `tst_qt_hil_e2e.cpp` to trigger HIL scenarios deterministically
-            app = web.Application()
-
-            async def step_start_s1_normal(_req: web.Request) -> web.Response:
-                await stack.clear_hood_history(0)
-                # Slow RMT slightly (0.35) so Qt sees `training` -> `rmt` transition cleanly at 1Hz state push!
-                await stack.configure_dut(0, hang_stage="", hang_remaining_boots=0, speed_scale=0.35)
-                await stack.enqueue_cmd(
-                    "S1",
-                    "SaveBootPlan",
-                    {
-                        "plan": {
-                            "preset": "auto",
-                            "mt_enabled": True,
-                            "run_rmt": True,
-                            "stages": {"uip1": "auto", "amt": "auto", "uip2": "auto", "uefi": "auto"},
-                        },
-                        "watchdog": {"dense_stage_silence_timeout_ms": 20000, "amt_silence_timeout_ms": 20000, "mt_silence_timeout_ms": 20000},
-                    },
-                )
-                await stack.enqueue_cmd(
-                    "S1",
-                    "SaveAmtSettings",
-                    {"settings": {"action": "skip", "exit_after": True}},
-                )
-                await stack.enqueue_cmd("S1", "ControlBootPlan", {"action": "restart"})
-                return web.json_response({"ok": True})
-
-            async def step_start_s1_dual_drop(_req: web.Request) -> web.Response:
-                await stack.clear_hood_history(0)
-                await stack.configure_dut(0, hang_stage="", hang_remaining_boots=0, speed_scale=0.5)
-                await stack.enqueue_cmd(
-                    "S1",
-                    "ConfigureWatchdog",
-                    {"watchdog": {"link_lost_timeout_ms": 45000, "dense_stage_silence_timeout_ms": 40000}},
-                )
-                await stack.trigger_dut_boot(0, reason="qt_dual_drop")
-                await asyncio.sleep(0.3)
-                await stack.enqueue_cmd("S1", "ControlBootPlan", {"action": "start"})
-                await stack.set_link(0, bmc_up=False, serial_up=False)
-                return web.json_response({"ok": True})
-
-            async def step_restore_s1_links(_req: web.Request) -> web.Response:
-                await stack.set_link(0, bmc_up=True, serial_up=True)
-                return web.json_response({"ok": True})
-
-            async def step_start_s1_rmt_hang(_req: web.Request) -> web.Response:
-                await stack.wait_station_online("S1", timeout_s=12.0)
-                await stack.clear_hood_history(0)
-                await stack.configure_dut(0, hang_stage="rmt", hang_remaining_boots=1, speed_scale=0.25)
-                await stack.enqueue_cmd(
-                    "S1",
-                    "SaveBootPlan",
-                    {
-                        "plan": {
-                            "preset": "auto",
-                            "mt_enabled": False,
-                            "run_rmt": True,
-                            "stages": {"uip1": "auto", "amt": "auto", "uip2": "auto", "uefi": "auto"},
-                        },
-                        "watchdog": {"dense_stage_silence_timeout_ms": 2400, "reboot_on_hang": False},
-                    },
-                )
-                await stack.enqueue_cmd("S1", "ControlBootPlan", {"action": "restart"})
-                return web.json_response({"ok": True})
-
-            async def step_qt_hood0_status(_req: web.Request) -> web.Response:
-                hs = await stack.hil_status()
-                return web.json_response(hs["qt_hoods"][0])
-
-            app.router.add_post("/step/start_s1_normal", step_start_s1_normal)
-            app.router.add_post("/step/start_s1_dual_drop", step_start_s1_dual_drop)
-            app.router.add_post("/step/restore_s1_links", step_restore_s1_links)
-            app.router.add_post("/step/start_s1_rmt_hang", step_start_s1_rmt_hang)
-            app.router.add_post("/step/qt_hood0_status", step_qt_hood0_status)
-
-            runner = web.AppRunner(app)
-            await runner.setup()
-            site = web.TCPSite(runner, "127.0.0.1", driver_port)
-            await site.start()
-
-            try:
-                print("[Tier5] Running `xvfb-run -a qt_hil_e2e_test` against live HIL cluster...", flush=True)
-                env = clean_qt_env()
-                env["STL_QT_CONFIG_DIR"] = str(qt_cfg_dir)
-                env["STL_QT_DRIVER_URL"] = f"http://127.0.0.1:{driver_port}"
-
-                proc = await asyncio.to_thread(
-                    subprocess.run,
-                    ["xvfb-run", "-a", str(QT_TEST_BIN), "-v2"],
-                    env=env,
-                    capture_output=True,
-                    text=True,
-                    timeout=150,
-                )
-                print(proc.stdout, flush=True)
-                if proc.returncode != 0:
-                    raise AssertionError(
-                        f"Qt5 Xvfb E2E failed (rc={proc.returncode}):\nSTDOUT:\n{proc.stdout}\nSTDERR:\n{proc.stderr}"
-                    )
-            finally:
-                await runner.cleanup()
-
-        elapsed_s = round(time.monotonic() - t0, 2)
-        summary = {
-            "tier": "Tier5_Headless_Xvfb_Qt5_Cpp_HIL_E2E",
-            "ok": True,
-            "elapsed_s": elapsed_s,
-            "tests": [
-                "test1_ConnectCleanWsAnd4PtsHoods",
-                "test2_PostTrainingSends0x01Heat70CAndPassPurge",
-                "test3_DualDisconnect5sGraceBadgeWithoutPremature0x08",
-                "test4_RmtHardHangTriggersQt0x08CoolingPurgeAndScenePreservedUi",
-            ],
-        }
-        print(f"\n[Tier5] ALL 4 HEADLESS XVFB QT5 C++ HIL SCENARIOS PASSED in {elapsed_s}s!", flush=True)
-        return summary
-    finally:
-        shutil.rmtree(qt_cfg_dir, ignore_errors=True)
-
-
-if __name__ == "__main__":
-    res = asyncio.run(run_tier5_qt_suite())
-    out_file = ROOT_DIR / "build" / "sim" / "tier5_qt_xvfb_report.json"
-    out_file.parent.mkdir(parents=True, exist_ok=True)
-    out_file.write_text(json.dumps(res, indent=2, ensure_ascii=False), encoding="utf-8")

+ 0 - 173
sim/qt_e2e/tst_qt_hil_e2e.cpp

@@ -1,173 +0,0 @@
-// tst_qt_hil_e2e.cpp — Tier 5 Headless Xvfb Qt5 C++ Full-Stack HIL Integration Test
-//
-// Instantiates the real production `MainWindow` connected to:
-//   - Live `stl_native_server` (`/ws?view=qt-clean`)
-//   - 4x live `/dev/pts/N` 6400 High-Temperature Hood simulators via `ComManager` / `QSerialPort`
-//   - Live 4-station RMCP+ / SSHv2 HIL cluster orchestrated via HTTP test driver
-
-#include <QtTest/QtTest>
-#include <QEventLoop>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QLabel>
-#include <QNetworkAccessManager>
-#include <QNetworkProxy>
-#include <QNetworkReply>
-#include <QNetworkRequest>
-#include <QUrl>
-
-#include "mainwindow.h"
-#include "stationdata.h"
-
-class QtHilE2ETest : public QObject
-{
-    Q_OBJECT
-
-private:
-    MainWindow *m_win = nullptr;
-    QNetworkAccessManager m_nam;
-    QString m_driverBase;
-
-    void callDriver(const QString &path, QJsonObject &out, int timeoutMs = 20000)
-    {
-        out = QJsonObject();
-        QNetworkRequest req(QUrl(m_driverBase + path));
-        req.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));
-        QNetworkReply *rep = m_nam.post(req, QByteArray("{}"));
-        QEventLoop loop;
-        QTimer timer;
-        timer.setSingleShot(true);
-        connect(rep, &QNetworkReply::finished, &loop, &QEventLoop::quit);
-        connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
-        timer.start(timeoutMs);
-        loop.exec();
-        QVERIFY2(rep->isFinished(), qPrintable(QStringLiteral("Driver HTTP timeout on ") + path));
-        QVERIFY2(rep->error() == QNetworkReply::NoError, qPrintable(rep->errorString()));
-        const QByteArray raw = rep->readAll();
-        rep->deleteLater();
-        out = QJsonDocument::fromJson(raw).object();
-    }
-
-    bool anyLabelContains(const QString &needle) const
-    {
-        if (!m_win)
-            return false;
-        const QList<QLabel *> labels = m_win->findChildren<QLabel *>();
-        for (QLabel *lbl : labels) {
-            if (lbl && lbl->text().contains(needle))
-                return true;
-        }
-        return false;
-    }
-
-private slots:
-    void initTestCase()
-    {
-        QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
-        m_driverBase = qEnvironmentVariable("STL_QT_DRIVER_URL", QStringLiteral("http://127.0.0.1:19498"));
-        m_win = new MainWindow();
-        m_win->resize(1600, 960);
-        m_win->show();
-        QVERIFY(QTest::qWaitForWindowExposed(m_win));
-    }
-
-    void cleanupTestCase()
-    {
-        delete m_win;
-        m_win = nullptr;
-    }
-
-    void test1_ConnectCleanWsAnd4PtsHoods()
-    {
-        QVERIFY(m_win && m_win->store());
-        QTRY_VERIFY_WITH_TIMEOUT(
-            m_win->store()->station(0).connection == QLatin1String("online")
-            && m_win->store()->station(0).currentTemp > 20.0
-            && m_win->store()->station(1).currentTemp > 20.0,
-            15000);
-    }
-
-    void test2_PostTrainingSends0x01Heat70CAndPassPurge()
-    {
-        QJsonObject startRes;
-        callDriver(QStringLiteral("/step/start_s1_normal"), startRes);
-        QVERIFY(startRes.value(QStringLiteral("ok")).toBool());
-
-        QTRY_VERIFY_WITH_TIMEOUT(
-            m_win->store()->station(0).taskStatus == QLatin1String("completed")
-            && m_win->store()->station(0).verdict == QLatin1String("pass"),
-            35000);
-
-        bool hoodOk = false;
-        for (int tries = 0; tries < 25 && !hoodOk; ++tries) {
-            QTest::qWait(200);
-            QJsonObject hs;
-            callDriver(QStringLiteral("/step/qt_hood0_status"), hs);
-            if (hs.value(QStringLiteral("heat_cmd_count")).toInt() >= 1
-                && hs.value(QStringLiteral("purge_cool_count")).toInt() >= 1) {
-                hoodOk = true;
-            }
-        }
-        QVERIFY2(hoodOk, "Qt MainWindow must send 0x01 (70C) post-training and 0x08 00 cooling purge on completion");
-    }
-
-    void test3_DualDisconnect5sGraceBadgeWithoutPremature0x08()
-    {
-        QJsonObject dropRes;
-        callDriver(QStringLiteral("/step/start_s1_dual_drop"), dropRes);
-        QVERIFY(dropRes.value(QStringLiteral("ok")).toBool());
-
-        QTRY_COMPARE_WITH_TIMEOUT(
-            m_win->store()->station(0).observedDetail,
-            QStringLiteral("link_offline_waiting"),
-            35000);
-
-        QTRY_VERIFY_WITH_TIMEOUT(anyLabelContains(QStringLiteral("双断保护")), 3000);
-
-        QJsonObject hsDuring;
-        callDriver(QStringLiteral("/step/qt_hood0_status"), hsDuring);
-        QCOMPARE(hsDuring.value(QStringLiteral("purge_cool_count")).toInt(), 0);
-
-        QJsonObject recRes;
-        callDriver(QStringLiteral("/step/restore_s1_links"), recRes);
-        QVERIFY(recRes.value(QStringLiteral("ok")).toBool());
-        QTRY_VERIFY_WITH_TIMEOUT(m_win->store()->station(0).serialGapDetected, 15000);
-    }
-
-    void test4_RmtHardHangTriggersQt0x08CoolingPurgeAndScenePreservedUi()
-    {
-        QJsonObject hangRes;
-        callDriver(QStringLiteral("/step/start_s1_rmt_hang"), hangRes);
-        QVERIFY(hangRes.value(QStringLiteral("ok")).toBool());
-
-        QTRY_COMPARE_WITH_TIMEOUT(
-            m_win->store()->station(0).faultCode,
-            QStringLiteral("stage_hang_timeout"),
-            28000);
-        QCOMPARE(m_win->store()->station(0).taskStatus, QStringLiteral("failed"));
-        QVERIFY(m_win->store()->station(0).hangScenePreserved);
-        QVERIFY(m_win->store()->station(0).backendEndedMs > 0);
-
-        const qint64 frozenElapsed = m_win->store()->runtimeMs(0);
-        QTest::qWait(1100);
-        QCOMPARE(m_win->store()->runtimeMs(0), frozenElapsed);
-
-        QTRY_VERIFY_WITH_TIMEOUT(anyLabelContains(QStringLiteral("卡死超时 FAIL")), 3000);
-
-        bool purged = false;
-        for (int tries = 0; tries < 25 && !purged; ++tries) {
-            QTest::qWait(200);
-            QJsonObject hs;
-            callDriver(QStringLiteral("/step/qt_hood0_status"), hs);
-            if (hs.value(QStringLiteral("heat_cmd_count")).toInt() >= 1
-                && hs.value(QStringLiteral("purge_cool_count")).toInt() >= 1
-                && hs.value(QStringLiteral("cooling_purge")).toBool()) {
-                purged = true;
-            }
-        }
-        QVERIFY2(purged, "Qt MainWindow must immediately transmit AA 55 08 01 00 D8 cooling purge to 6400 Hood on RMT hang!");
-    }
-};
-
-QTEST_MAIN(QtHilE2ETest)
-#include "tst_qt_hil_e2e.moc"

+ 8 - 19
sim/run_all_tiers.py

@@ -1,20 +1,17 @@
 #!/usr/bin/env python3
 """
-run_all_tiers.py — XJKJ-STL Five-Tier Full-Stack Simulation & Verification Master Runner
+run_all_tiers.py — XJKJ-STL Four-Tier Web-Only Full-Stack Simulation & Verification Master Runner
 
-Executes all 5 simulation & verification tiers end-to-end and generates an aggregated
+Executes all 4 simulation & verification tiers end-to-end and generates an aggregated
 JSON audit report at `build/sim/full_sim_report.json`:
 
-  - Tier 1: Native Kernel / Actor / Watchdog Unit & Integration Suite (`stl_native_tests` 28 tests)
+  - Tier 1: Native Kernel / Actor / Watchdog / Thermal Closed-Loop / Trace / SIMD Unit & Integration Suite
             + `bmc_ssh_hil_sim` C RMCP+/SSHv2 Kernel Smoke Test + `web/*.js` Syntax Check
-            + Production `DDR5_SLT_Monitor` Qt5 Binary Build Verification
-  - Tier 2: 4-Station Hardware-in-the-Loop (HIL) Full-Stack E2E (`bmc_ssh_hil_sim` UDP :623 RMCP+
-            Cipher Suite 17 + 24-ch SDR + SSHv2 :2200 + UDP TFTP WRQ + `/dev/pts/*` 6400 Hood v1.1
-            + Official `tools/validate_qt_clean.py` Protocol & Privacy Validator)
+  - Tier 2: Multi-Station Hardware-in-the-Loop (HIL) Full-Stack E2E (`bmc_ssh_hil_sim` UDP :623 RMCP+
+            Cipher Suite 17 + 24-ch SDR + SSHv2 :2200 + UDP TFTP WRQ + `/dev/pts/*` 6400 Hood v1.1)
   - Tier 3: Real Hardware KVM (`/dev/kvm` on `192.168.2.25`) + EDK2 OVMF UEFI + Real `mt86plus.efi`
             + QMP Hardware vCPU Freeze & IPMI-to-QMP Reset E2E
-  - Tier 4: Real Headless Chrome 156 CDP Web Frontend E2E (Login, Watchdog Config, Live Banners, G27 Fix)
-  - Tier 5: Real Headless Xvfb Qt5 C++ Desktop Client (`MainWindow` + `QSerialPort` `/dev/pts/*` 6400 Hoods)
+  - Tier 4: Real Headless Chrome 156 CDP Web Frontend E2E (Login, Production/Engineering Views, Watchdog, Trace)
 """
 
 import argparse
@@ -186,13 +183,6 @@ def run_tier1(skip_native_rebuild: bool = False) -> Dict[str, Any]:
         run_step(f"Tier1.3 JS Syntax Check ({jf.name})", ["node", "--check", str(jf)], cwd=ROOT_DIR, timeout_s=30)
     sub.append({"name": f"Tier1.3 Web Frontend JS Syntax ({len(js_files)} files)", "ok": True, "elapsed_s": 0.0})
 
-    # 1d. Production Qt5 desktop client binary build check
-    qt_build = ROOT_DIR / "build" / "qt"
-    qt_build.mkdir(parents=True, exist_ok=True)
-    run_step("Tier1.4a qmake DDR5_SLT_Monitor.pro", ["qmake", str(ROOT_DIR / "DDR5_SLT_Monitor.pro")], cwd=qt_build, timeout_s=60)
-    nproc = str(max(2, os.cpu_count() or 4))
-    sub.append(run_step("Tier1.4b make DDR5_SLT_Monitor", ["make", f"-j{nproc}"], cwd=qt_build, timeout_s=180))
-
     return {"tier": "Tier1_Build_And_Native_Unit_Suite", "ok": True, "elapsed_s": round(time.monotonic() - t0, 2), "steps": sub}
 
 
@@ -206,15 +196,14 @@ def main() -> None:
     tiers: List[Dict[str, Any]] = []
 
     tiers.append(run_tier1(skip_native_rebuild=args.skip_native_rebuild))
-    tiers.append(run_step("Tier2 4-Station HIL Full-Stack E2E", [PY_BIN, str(ROOT_DIR / "sim" / "hil_cluster" / "test_tier2_hil_e2e.py")], timeout_s=360))
+    tiers.append(run_step("Tier2 Multi-Station HIL Full-Stack E2E", [PY_BIN, str(ROOT_DIR / "sim" / "hil_cluster" / "test_tier2_hil_e2e.py")], timeout_s=360))
     if not args.skip_kvm:
         tiers.append(run_step("Tier3 Real KVM + OVMF UEFI + mt86plus.efi E2E", [PY_BIN, str(ROOT_DIR / "sim" / "kvm_uefi_tier" / "test_tier3_kvm_uefi_e2e.py")], timeout_s=300))
     tiers.append(run_step("Tier4 Headless Chrome 156 CDP Web E2E", [PY_BIN, str(ROOT_DIR / "sim" / "web_e2e" / "test_tier4_chrome_web_e2e.py")], timeout_s=300))
-    tiers.append(run_step("Tier5 Headless Xvfb Qt5 C++ Client E2E", [PY_BIN, str(ROOT_DIR / "sim" / "qt_e2e" / "test_tier5_qt_xvfb_e2e.py")], timeout_s=300))
 
     total_s = round(time.monotonic() - t_all, 2)
     report = {
-        "schema": "xjkj-stl-5tier-full-sim-v1",
+        "schema": "xjkj-stl-4tier-web-only-sim-v2",
         "completed_utc": dt.datetime.now(dt.timezone.utc).isoformat(),
         "all_passed": True,
         "total_elapsed_s": total_s,

+ 45 - 1
sim/web_e2e/test_tier4_chrome_web_e2e.py

@@ -369,12 +369,56 @@ async def run_tier4_web_suite() -> Dict[str, Any]:
                 assert not cdp.js_exceptions, f"Uncaught JS exceptions during Web E2E: {cdp.js_exceptions}"
                 results.append({"scenario": "4_chrome_stage_hang_alert_and_g27_banner_fix", "status": "PASS"})
                 print("      -> PASS", flush=True)
+
+                # ============================================================
+                # Scenario 5: Phase 1 Production/Engineering Switch, Single-DIMM Curve & Excel Export
+                # ============================================================
+                print("[Tier4][5/5] Verifying Production/Engineering view switch, single-DIMM curve modal & alarms.xlsx...", flush=True)
+                await cdp.eval_js(
+                    """(() => {
+                        document.getElementById('btn-mode-production').click();
+                        return document.body.dataset.uiMode;
+                    })()"""
+                )
+                prod_cards = await wait_until(
+                    lambda: cdp.eval_js("document.querySelectorAll('#prod-stations-grid .prod-station-card').length >= 4 && document.querySelectorAll('#prod-stations-grid .prod-dimm-cell').length >= 96"),
+                    timeout_s=8.0,
+                    desc="Production dashboard 4+ cards and 96+ DIMM cells",
+                )
+                assert prod_cards is True
+                # Click first DIMM cell to open single-DIMM temperature curve modal
+                await cdp.eval_js(
+                    """(() => {
+                        document.querySelector('#prod-stations-grid .prod-dimm-cell').click();
+                        return true;
+                    })()"""
+                )
+                curve_open = await wait_until(
+                    lambda: cdp.eval_js("!document.getElementById('stl-dimm-curve-modal').classList.contains('hidden') && !!document.getElementById('dimm-curve-canvas')"),
+                    timeout_s=6.0,
+                    desc="Single-DIMM temperature curve modal open",
+                )
+                assert curve_open is True
+                await cdp.eval_js("document.getElementById('dimm-curve-close').click(); document.getElementById('btn-mode-engineering').click(); true")
+                # Verify alarms.xlsx download via browser authenticated fetch (valid PK ZIP signature)
+                xlsx_ok = await cdp.eval_js(
+                    """(async () => {
+                        const r = await fetch('/api/stations/S1/alarms.xlsx', { credentials: 'same-origin' });
+                        if (!r.ok) return { ok: false, status: r.status };
+                        const buf = new Uint8Array(await r.arrayBuffer());
+                        return { ok: buf.length > 500 && buf[0] === 0x50 && buf[1] === 0x4b, size: buf.length };
+                    })()"""
+                )
+                assert xlsx_ok and xlsx_ok.get("ok") is True, f"alarms.xlsx export failed: {xlsx_ok}"
+                assert not cdp.js_exceptions, f"Uncaught JS exceptions during Scenario 5: {cdp.js_exceptions}"
+                results.append({"scenario": "5_production_view_dimm_curve_and_xlsx", "status": "PASS", "xlsx_size": xlsx_ok.get("size")})
+                print(f"      -> PASS (alarms.xlsx={xlsx_ok.get('size')} bytes)", flush=True)
             finally:
                 await cdp.close()
 
         elapsed_s = round(time.monotonic() - t0, 2)
         summary = {"tier": "Tier4_Headless_Chrome156_Web_E2E", "ok": True, "elapsed_s": elapsed_s, "results": results}
-        print(f"\n[Tier4] ALL 4 HEADLESS CHROME 156 WEB E2E SCENARIOS PASSED in {elapsed_s}s!", flush=True)
+        print(f"\n[Tier4] ALL 5 HEADLESS CHROME 156 WEB E2E SCENARIOS PASSED in {elapsed_s}s!", flush=True)
         return summary
     finally:
         if chrome_proc and chrome_proc.poll() is None:

+ 0 - 208
src/3rdparty/libxlsxwriter/License.txt

@@ -1,208 +0,0 @@
-/**
-
-@page license License
-
-Libxlsxwriter is released under a FreeBSD license:
-
-    Copyright 2014-2026, John McNamara <jmcnamara@cpan.org>
-    All rights reserved.
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions are
-    met:
-
-    1. Redistributions of source code must retain the above copyright notice,
-       this list of conditions and the following disclaimer.
-    2. Redistributions in binary form must reproduce the above copyright
-       notice, this list of conditions and the following disclaimer in the
-       documentation and/or other materials provided with the distribution.
-
-    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-    The views and conclusions contained in the software and documentation are
-    those of the authors and should not be interpreted as representing
-    official policies, either expressed or implied, of the FreeBSD Project.
-
-
-Libxlsxwriter includes the `queue.h` and `tree.h` macros from FreeBSD. It also
-includes and, unless overridden, uses the optional libraries `minizip`,
-`tmpfileplus` and `md5`. It also includes the `emyg_dtoa` library but doesn't
-use it by default. These components have the following licenses:
-
-
-Queue.h from FreeBSD:
-
-    Copyright (c) 1991, 1993
-     The Regents of the University of California.  All rights reserved.
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions
-    are met:
-    1. Redistributions of source code must retain the above copyright
-       notice, this list of conditions and the following disclaimer.
-    2. Redistributions in binary form must reproduce the above copyright
-       notice, this list of conditions and the following disclaimer in the
-       documentation and/or other materials provided with the distribution.
-    4. Neither the name of the University nor the names of its contributors
-       may be used to endorse or promote products derived from this software
-       without specific prior written permission.
-
-    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-    ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-    SUCH DAMAGE.
-
-
-Tree.h from FreeBSD:
-
-    Copyright 2002 Niels Provos <provos@citi.umich.edu>
-    All rights reserved.
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions
-    are met:
-    1. Redistributions of source code must retain the above copyright
-       notice, this list of conditions and the following disclaimer.
-    2. Redistributions in binary form must reproduce the above copyright
-       notice, this list of conditions and the following disclaimer in the
-       documentation and/or other materials provided with the distribution.
-
-    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-The `minizip` files used in the libxlsxwriter source tree are taken from the
-`zlib` ` contrib/minizip` directory. [Zlib](http://www.zlib.net) has the
-following License/Copyright:
-
-    (C) 1995-2013 Jean-loup Gailly and Mark Adler
-
-    This software is provided 'as-is', without any express or implied
-    warranty.  In no event will the authors be held liable for any damages
-    arising from the use of this software.
-
-    Permission is granted to anyone to use this software for any purpose,
-    including commercial applications, and to alter it and redistribute it
-    freely, subject to the following restrictions:
-
-    1. The origin of this software must not be misrepresented; you must not
-       claim that you wrote the original software. If you use this software
-       in a product, an acknowledgment in the product documentation would be
-       appreciated but is not required.
-    2. Altered source versions must be plainly marked as such, and must not be
-       misrepresented as being the original software.
-    3. This notice may not be removed or altered from any source distribution.
-
-    Jean-loup Gailly        Mark Adler
-    jloup@gzip.org          madler@alumni.caltech.edu
-
-The `minizip` files have the following additional copyright declarations:
-
-    Copyright (C) 1998-2010 Gilles Vollant
-    (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
-
-    Modifications for Zip64 support
-    Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
-
-Note, it is possible to compile libxlsxwriter without statically linking the
-`minizip` files and instead dynamically linking to `lminizip`, see
-@ref gsg_minizip.
-
-[Tmpfileplus](http://www.di-mgt.com.au/c_function_to_create_temp_file.html)
-has the following license:
-
-    This Source Code Form is subject to the terms of the Mozilla Public
-    License, v. 2.0. If a copy of the MPL was not distributed with this
-    file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-    Copyright (c) 2012-16 David Ireland, DI Management Services Pty Ltd
-    <http://www.di-mgt.com.au/contact/>.
-
-See the [Mozilla Public License, v. 2.0](http://mozilla.org/MPL/2.0/).
-
-Note, it is possible to compile libxlsxwriter using the standard library
-`tmpfile()` function instead of `tmpfileplus`, see @ref gsg_tmpdir.
-
-The [Milo Yip DTOA library](https://github.com/miloyip/dtoa-benchmark) for
-converting doubles to strings. It has the following license:
-
-    Copyright (C) 2015 Doug Currie
-    based on dtoa_milo.h
-    Copyright (C) 2014 Milo Yip
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy
-    of this software and associated documentation files (the "Software"), to deal
-    in the Software without restriction, including without limitation the rights
-    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-    copies of the Software, and to permit persons to whom the Software is
-    furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-    THE SOFTWARE.
-
-This Milo Yip DTOA library (emyg_dtoa) is used to avoid issues where the
-standard sprintf() dtoa function changes output based on locale settings. It
-is also 40-50% faster than the standard dtoa for raw numeric data. The use of
-this library is optional. If you wish to use it you can pass
-`USE_DTOA_LIBRARY=1` to make when compiling.
-
-[Openwall MD5](https://openwall.info/wiki/people/solar/software/public-domain-source-code/md5)
-has the following licence:
-
-    This software was written by Alexander Peslyak in 2001.  No copyright is
-    claimed, and the software is hereby placed in the public domain.
-    In case this attempt to disclaim copyright and place the software in the
-    public domain is deemed null and void, then the software is
-    Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
-    general public under the following terms:
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted.
-
-    There's ABSOLUTELY NO WARRANTY, express or implied.
-
-    (This is a heavily cut-down "BSD license".)
-
-Note, the MD5 library is used to avoid including duplicate image files in the
-xlsx file. If you don't want to use this code, and the additional licence, you
-can use OpenSSL's MD5 functions instead by passing `USE_OPENSSL_MD5=1` to
-make. If this functionality isn't required it is possible to compile
-libxlsxwriter without image deduplication by passing `USE_NO_MD5=1` to make.
-
-See also @ref gsg_md5.
-
-Next: @ref changes
-*/

+ 0 - 26
src/3rdparty/libxlsxwriter/include/xlsxwriter.h

@@ -1,26 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- */
-
-/**
- * @file xlsxwriter.h
- *
- * xlsxwriter - A library for creating Excel XLSX files.
- *
- */
-#ifndef __LXW_XLSXWRITER_H__
-#define __LXW_XLSXWRITER_H__
-
-#include "xlsxwriter/workbook.h"
-#include "xlsxwriter/worksheet.h"
-#include "xlsxwriter/format.h"
-#include "xlsxwriter/utility.h"
-
-#define LXW_VERSION "1.2.4"
-#define LXW_VERSION_ID 124
-#define LXW_SOVERSION "11"
-
-#endif /* __LXW_XLSXWRITER_H__ */

+ 0 - 81
src/3rdparty/libxlsxwriter/include/xlsxwriter/app.h

@@ -1,81 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * app - A libxlsxwriter library for creating Excel XLSX app files.
- *
- */
-#ifndef __LXW_APP_H__
-#define __LXW_APP_H__
-
-#include <stdint.h>
-#include <string.h>
-#include "workbook.h"
-#include "common.h"
-
-/* Define the queue.h TAILQ structs for the App structs. */
-STAILQ_HEAD(lxw_heading_pairs, lxw_heading_pair);
-STAILQ_HEAD(lxw_part_names, lxw_part_name);
-
-typedef struct lxw_heading_pair {
-
-    char *key;
-    char *value;
-
-    STAILQ_ENTRY (lxw_heading_pair) list_pointers;
-
-} lxw_heading_pair;
-
-typedef struct lxw_part_name {
-
-    char *name;
-
-    STAILQ_ENTRY (lxw_part_name) list_pointers;
-
-} lxw_part_name;
-
-/* Struct to represent an App object. */
-typedef struct lxw_app {
-
-    FILE *file;
-
-    struct lxw_heading_pairs *heading_pairs;
-    struct lxw_part_names *part_names;
-    lxw_doc_properties *properties;
-
-    uint32_t num_heading_pairs;
-    uint32_t num_part_names;
-    uint8_t doc_security;
-
-} lxw_app;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_app *lxw_app_new(void);
-void lxw_app_free(lxw_app *app);
-void lxw_app_assemble_xml_file(lxw_app *self);
-void lxw_app_add_part_name(lxw_app *self, const char *name);
-void lxw_app_add_heading_pair(lxw_app *self, const char *key,
-                              const char *value);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _app_xml_declaration(lxw_app *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_APP_H__ */

Разница между файлами не показана из-за своего большого размера
+ 0 - 3964
src/3rdparty/libxlsxwriter/include/xlsxwriter/chart.h


+ 0 - 545
src/3rdparty/libxlsxwriter/include/xlsxwriter/chartsheet.h

@@ -1,545 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * chartsheet - A libxlsxwriter library for creating Excel XLSX chartsheet files.
- *
- */
-
-/**
- * @page chartsheet_page The Chartsheet object
- *
- * The Chartsheet object represents an Excel chartsheet, which is a type of
- * worksheet that only contains a chart. The Chartsheet object handles
- * operations such as adding a chart and setting the page layout.
- *
- * See @ref chartsheet.h for full details of the functionality.
- *
- * @file chartsheet.h
- *
- * @brief Functions related to adding data and formatting to a chartsheet.
- *
- * The Chartsheet object represents an Excel chartsheet. It handles operations
- * such as adding a chart and setting the page layout.
- *
- * A Chartsheet object isn't created directly. Instead a chartsheet is created
- * by calling the workbook_add_chartsheet() function from a Workbook object. A
- * chartsheet object functions as a worksheet and not as a chart. In order to
- * have it display data a #lxw_chart object must be created and added to the
- * chartsheet:
- *
- * @code
- *     #include "xlsxwriter.h"
- *
- *     int main() {
- *
- *         lxw_workbook   *workbook   = new_workbook("chartsheet.xlsx");
- *         lxw_worksheet  *worksheet  = workbook_add_worksheet(workbook, NULL);
- *         lxw_chartsheet *chartsheet = workbook_add_chartsheet(workbook, NULL);
- *         lxw_chart      *chart      = workbook_add_chart(workbook, LXW_CHART_BAR);
- *
- *         //... Set up the chart.
- *
- *         // Add the chart to the chartsheet.
- *         return workbook_close(workbook);
- *
- *     }
- * @endcode
- *
- * @image html chartsheet.png
- *
- * The data for the chartsheet chart must be contained on a separate
- * worksheet. That is why it is always created in conjunction with at least
- * one data worksheet, as shown above.
- */
-
-#ifndef __LXW_CHARTSHEET_H__
-#define __LXW_CHARTSHEET_H__
-
-#include <stdint.h>
-
-#include "common.h"
-#include "worksheet.h"
-#include "drawing.h"
-#include "utility.h"
-
-/**
- * @brief Struct to represent an Excel chartsheet.
- *
- * The members of the lxw_chartsheet struct aren't modified directly. Instead
- * the chartsheet properties are set by calling the functions shown in
- * chartsheet.h.
- */
-typedef struct lxw_chartsheet {
-
-    FILE *file;
-    lxw_worksheet *worksheet;
-    lxw_chart *chart;
-
-    struct lxw_protection_obj protection;
-    uint8_t is_protected;
-
-    const char *name;
-    const char *quoted_name;
-    const char *tmpdir;
-    uint16_t index;
-    uint8_t active;
-    uint8_t selected;
-    uint8_t hidden;
-    uint16_t *active_sheet;
-    uint16_t *first_sheet;
-    uint16_t rel_count;
-
-    STAILQ_ENTRY (lxw_chartsheet) list_pointers;
-
-} lxw_chartsheet;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-/**
- * @brief Insert a chart object into a chartsheet.
- *
- * @param chartsheet   Pointer to a lxw_chartsheet instance to be updated.
- * @param chart        A #lxw_chart object created via workbook_add_chart().
- *
- * @return A #lxw_error code.
- *
- * The `%chartsheet_set_chart()` function can be used to insert a chart into a
- * chartsheet. The chart object must be created first using the
- * `workbook_add_chart()` function and configured using the @ref chart.h
- * functions.
- *
- * @code
- *     // Create the chartsheet.
- *     lxw_chartsheet *chartsheet = workbook_add_chartsheet(workbook, NULL);
- *
- *     // Create a chart object.
- *     lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_LINE);
- *
- *     // Add a data series to the chart.
- *     chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$6");
- *
- *     // Insert the chart into the chartsheet.
- *     chartsheet_set_chart(chartsheet, chart);
- * @endcode
- *
- * @image html chartsheet2.png
- *
- * **Note:**
- *
- * A chart may only be inserted once into a chartsheet or a worksheet. If
- * several similar charts are required then each one must be created
- * separately.
- *
- */
-lxw_error chartsheet_set_chart(lxw_chartsheet *chartsheet, lxw_chart *chart);
-
-/* Not currently required since scale options aren't useful in a chartsheet. */
-lxw_error chartsheet_set_chart_opt(lxw_chartsheet *chartsheet,
-                                   lxw_chart *chart,
-                                   lxw_chart_options *user_options);
-
-/**
- * @brief Make a chartsheet the active, i.e., visible chartsheet.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- *
- * The `%chartsheet_activate()` function is used to specify which chartsheet
- * is initially visible in a multi-sheet workbook:
- *
- * @code
- *     lxw_worksheet  *worksheet1  = workbook_add_worksheet(workbook, NULL);
- *     lxw_chartsheet *chartsheet1 = workbook_add_chartsheet(workbook, NULL);
- *     lxw_chartsheet *chartsheet2 = workbook_add_chartsheet(workbook, NULL);
- *     lxw_chartsheet *chartsheet3 = workbook_add_chartsheet(workbook, NULL);
- *
- *     chartsheet_activate(chartsheet3);
- * @endcode
- *
- * @image html chartsheet_activate.png
- *
- * More than one chartsheet can be selected via the `chartsheet_select()`
- * function, see below, however only one chartsheet can be active.
- *
- * The default active chartsheet is the first chartsheet.
- *
- * See also `worksheet_activate()`.
- *
- */
-void chartsheet_activate(lxw_chartsheet *chartsheet);
-
-/**
- * @brief Set a chartsheet tab as selected.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- *
- * The `%chartsheet_select()` function is used to indicate that a chartsheet
- * is selected in a multi-sheet workbook:
- *
- * @code
- *     chartsheet_activate(chartsheet1);
- *     chartsheet_select(chartsheet2);
- *     chartsheet_select(chartsheet3);
- *
- * @endcode
- *
- * A selected chartsheet has its tab highlighted. Selecting chartsheets is a
- * way of grouping them together so that, for example, several chartsheets
- * could be printed in one go. A chartsheet that has been activated via the
- * `chartsheet_activate()` function will also appear as selected.
- *
- * See also `worksheet_select()`.
- *
- */
-void chartsheet_select(lxw_chartsheet *chartsheet);
-
-/**
- * @brief Hide the current chartsheet.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- *
- * The `%chartsheet_hide()` function is used to hide a chartsheet:
- *
- * @code
- *     chartsheet_hide(chartsheet2);
- * @endcode
- *
- * You may wish to hide a chartsheet in order to avoid confusing a user with
- * intermediate data or calculations.
- *
- * @image html hide_sheet.png
- *
- * A hidden chartsheet can not be activated or selected so this function is
- * mutually exclusive with the `chartsheet_activate()` and
- * `chartsheet_select()` functions. In addition, since the first chartsheet
- * will default to being the active chartsheet, you cannot hide the first
- * chartsheet without activating another sheet:
- *
- * @code
- *     chartsheet_activate(chartsheet2);
- *     chartsheet_hide(chartsheet1);
- * @endcode
- *
- * See also `worksheet_hide()`.
- *
- */
-void chartsheet_hide(lxw_chartsheet *chartsheet);
-
-/**
- * @brief Set current chartsheet as the first visible sheet tab.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- *
- * The `chartsheet_activate()` function determines which chartsheet is
- * initially selected.  However, if there are a large number of chartsheets the
- * selected chartsheet may not appear on the screen. To avoid this you can
- * select the leftmost visible chartsheet tab using
- * `%chartsheet_set_first_sheet()`:
- *
- * @code
- *     chartsheet_set_first_sheet(chartsheet19); // First visible chartsheet tab.
- *     chartsheet_activate(chartsheet20);        // First visible chartsheet.
- * @endcode
- *
- * This function is not required very often. The default value is the first
- * chartsheet.
- *
- * See also `worksheet_set_first_sheet()`.
- *
- */
-void chartsheet_set_first_sheet(lxw_chartsheet *chartsheet);
-
-/**
- * @brief Set the color of the chartsheet tab.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param color      The tab color.
- *
- * The `%chartsheet_set_tab_color()` function is used to change the color of
- * the chartsheet tab:
- *
- * @code
- *      chartsheet_set_tab_color(chartsheet1, LXW_COLOR_RED);
- *      chartsheet_set_tab_color(chartsheet2, LXW_COLOR_GREEN);
- *      chartsheet_set_tab_color(chartsheet3, 0xFF9900); // Orange.
- * @endcode
- *
- * The color should be an RGB integer value, see @ref working_with_colors.
- *
- * See also `worksheet_set_tab_color()`.
- */
-void chartsheet_set_tab_color(lxw_chartsheet *chartsheet, lxw_color_t color);
-
-/**
- * @brief Protect elements of a chartsheet from modification.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param password   A chartsheet password.
- * @param options    Chartsheet elements to protect.
- *
- * The `%chartsheet_protect()` function protects chartsheet elements from
- * modification:
- *
- * @code
- *     chartsheet_protect(chartsheet, "Some Password", options);
- * @endcode
- *
- * The `password` and lxw_protection pointer are both optional:
- *
- * @code
- *     chartsheet_protect(chartsheet2, NULL,       my_options);
- *     chartsheet_protect(chartsheet3, "password", NULL);
- *     chartsheet_protect(chartsheet4, "password", my_options);
- * @endcode
- *
- * Passing a `NULL` password is the same as turning on protection without a
- * password. Passing a `NULL` password and `NULL` options had no effect on
- * chartsheets.
- *
- * You can specify which chartsheet elements you wish to protect by passing a
- * lxw_protection pointer in the `options` argument. In Excel chartsheets only
- * have two protection options:
- *
- *     no_content
- *     no_objects
- *
- * All parameters are off by default. Individual elements can be protected as
- * follows:
- *
- * @code
- *     lxw_protection options = {
- *         .no_content  = 1,
- *         .no_objects  = 1,
- *     };
- *
- *     chartsheet_protect(chartsheet, NULL, &options);
- *
- * @endcode
- *
- * See also worksheet_protect().
- *
- * **Note:** Sheet level passwords in Excel offer **very** weak
- * protection. They don't encrypt your data and are very easy to
- * deactivate. Full workbook encryption is not supported by `libxlsxwriter`
- * since it requires a completely different file format.
- */
-void chartsheet_protect(lxw_chartsheet *chartsheet, const char *password,
-                        lxw_protection *options);
-
-/**
- * @brief Set the chartsheet zoom factor.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param scale      Chartsheet zoom factor.
- *
- * Set the chartsheet zoom factor in the range `10 <= zoom <= 400`:
- *
- * @code
- *     chartsheet_set_zoom(chartsheet, 75);
- * @endcode
- *
- * The default zoom factor is 100. It isn't possible to set the zoom to
- * "Selection" because it is calculated by Excel at run-time.
- *
- * See also `worksheet_set_zoom()`.
- */
-void chartsheet_set_zoom(lxw_chartsheet *chartsheet, uint16_t scale);
-
-/**
- * @brief Set the page orientation as landscape.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- *
- * This function is used to set the orientation of a chartsheet's printed page
- * to landscape. The default chartsheet orientation is landscape, so this
- * function isn't generally required:
- *
- * @code
- *     chartsheet_set_landscape(chartsheet);
- * @endcode
- */
-void chartsheet_set_landscape(lxw_chartsheet *chartsheet);
-
-/**
- * @brief Set the page orientation as portrait.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- *
- * This function is used to set the orientation of a chartsheet's printed page
- * to portrait:
- *
- * @code
- *     chartsheet_set_portrait(chartsheet);
- * @endcode
- */
-void chartsheet_set_portrait(lxw_chartsheet *chartsheet);
-
-/**
- * @brief Set the paper type for printing.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param paper_type The Excel paper format type.
- *
- * This function is used to set the paper format for the printed output of a
- * chartsheet:
- *
- * @code
- *     chartsheet_set_paper(chartsheet1, 1);  // US Letter
- *     chartsheet_set_paper(chartsheet2, 9);  // A4
- * @endcode
- *
- * If you do not specify a paper type the chartsheet will print using the
- * printer's default paper style.
- *
- * See `worksheet_set_paper()` for a full list of available paper sizes.
- */
-void chartsheet_set_paper(lxw_chartsheet *chartsheet, uint8_t paper_type);
-
-/**
- * @brief Set the chartsheet margins for the printed page.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param left       Left margin in inches.   Excel default is 0.7.
- * @param right      Right margin in inches.  Excel default is 0.7.
- * @param top        Top margin in inches.    Excel default is 0.75.
- * @param bottom     Bottom margin in inches. Excel default is 0.75.
- *
- * The `%chartsheet_set_margins()` function is used to set the margins of the
- * chartsheet when it is printed. The units are in inches. Specifying `-1` for
- * any parameter will give the default Excel value as shown above.
- *
- * @code
- *    chartsheet_set_margins(chartsheet, 1.3, 1.2, -1, -1);
- * @endcode
- *
- */
-void chartsheet_set_margins(lxw_chartsheet *chartsheet, double left,
-                            double right, double top, double bottom);
-
-/**
- * @brief Set the printed page header caption.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param string     The header string.
- *
- * @return A #lxw_error code.
- *
- * Headers and footers are generated using a string which is a combination of
- * plain text and control characters
- *
- * @code
- *     chartsheet_set_header(chartsheet, "&LHello");
- *
- *     //     ---------------------------------------------------------------
- *     //    |                                                               |
- *     //    | Hello                                                         |
- *     //    |                                                               |
- *
- *
- *     chartsheet_set_header(chartsheet, "&CHello");
- *
- *     //     ---------------------------------------------------------------
- *     //    |                                                               |
- *     //    |                          Hello                                |
- *     //    |                                                               |
- *
- *
- *     chartsheet_set_header(chartsheet, "&RHello");
- *
- *     //     ---------------------------------------------------------------
- *     //    |                                                               |
- *     //    |                                                         Hello |
- *     //    |                                                               |
- *
- *
- * @endcode
- *
- * See `worksheet_set_header()` for a full explanation of the syntax of
- * Excel's header formatting and control characters.
- *
- */
-lxw_error chartsheet_set_header(lxw_chartsheet *chartsheet,
-                                const char *string);
-
-/**
- * @brief Set the printed page footer caption.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param string     The footer string.
- *
- * @return A #lxw_error code.
- *
- * The syntax of this function is the same as chartsheet_set_header().
- *
- */
-lxw_error chartsheet_set_footer(lxw_chartsheet *chartsheet,
-                                const char *string);
-
-/**
- * @brief Set the printed page header caption with additional options.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param string     The header string.
- * @param options    Header options.
- *
- * @return A #lxw_error code.
- *
- * The syntax of this function is the same as chartsheet_set_header() with an
- * additional parameter to specify options for the header.
- *
- * Currently, the only available option is the header margin:
- *
- * @code
- *
- *    lxw_header_footer_options header_options = { 0.2 };
- *
- *    chartsheet_set_header_opt(chartsheet, "Some text", &header_options);
- *
- * @endcode
- *
- */
-lxw_error chartsheet_set_header_opt(lxw_chartsheet *chartsheet,
-                                    const char *string,
-                                    lxw_header_footer_options *options);
-
-/**
- * @brief Set the printed page footer caption with additional options.
- *
- * @param chartsheet Pointer to a lxw_chartsheet instance to be updated.
- * @param string     The footer string.
- * @param options    Footer options.
- *
- * @return A #lxw_error code.
- *
- * The syntax of this function is the same as chartsheet_set_header_opt().
- *
- */
-lxw_error chartsheet_set_footer_opt(lxw_chartsheet *chartsheet,
-                                    const char *string,
-                                    lxw_header_footer_options *options);
-
-lxw_chartsheet *lxw_chartsheet_new(lxw_worksheet_init_data *init_data);
-void lxw_chartsheet_free(lxw_chartsheet *chartsheet);
-void lxw_chartsheet_assemble_xml_file(lxw_chartsheet *chartsheet);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _chartsheet_xml_declaration(lxw_chartsheet *chartsheet);
-STATIC void _chartsheet_write_sheet_protection(lxw_chartsheet *chartsheet);
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_CHARTSHEET_H__ */

+ 0 - 77
src/3rdparty/libxlsxwriter/include/xlsxwriter/comment.h

@@ -1,77 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * comment - A libxlsxwriter library for creating Excel XLSX comment files.
- *
- */
-#ifndef __LXW_COMMENT_H__
-#define __LXW_COMMENT_H__
-
-#include <stdint.h>
-
-#include "common.h"
-#include "worksheet.h"
-
-/* Define the tree.h RB structs for the red-black head types. */
-RB_HEAD(lxw_author_ids, lxw_author_id);
-
-/*
- * Struct to represent a comment object.
- */
-typedef struct lxw_comment {
-
-    FILE *file;
-    struct lxw_comment_objs *comment_objs;
-    struct lxw_author_ids *author_ids;
-    char *comment_author;
-    uint32_t author_id;
-
-} lxw_comment;
-
-/* Struct to an author id */
-typedef struct lxw_author_id {
-    uint32_t id;
-    char *author;
-
-    RB_ENTRY (lxw_author_id) tree_pointers;
-} lxw_author_id;
-
-#define LXW_RB_GENERATE_AUTHOR_IDS(name, type, field, cmp) \
-    RB_GENERATE_INSERT_COLOR(name, type, field, static)    \
-    RB_GENERATE_REMOVE_COLOR(name, type, field, static)    \
-    RB_GENERATE_INSERT(name, type, field, cmp, static)     \
-    RB_GENERATE_REMOVE(name, type, field, static)          \
-    RB_GENERATE_FIND(name, type, field, cmp, static)       \
-    RB_GENERATE_NEXT(name, type, field, static)            \
-    RB_GENERATE_MINMAX(name, type, field, static)          \
-    /* Add unused struct to allow adding a semicolon */    \
-    struct lxw_rb_generate_author_ids{int unused;}
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_comment *lxw_comment_new(void);
-void lxw_comment_free(lxw_comment *comment);
-void lxw_comment_assemble_xml_file(lxw_comment *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _comment_xml_declaration(lxw_comment *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_COMMENT_H__ */

+ 0 - 466
src/3rdparty/libxlsxwriter/include/xlsxwriter/common.h

@@ -1,466 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- */
-
-/**
- * @file common.h
- *
- * @brief Common functions and defines for the libxlsxwriter library.
- *
- * <!-- Copyright 2014-2026, John McNamara, jmcnamara@cpan.org -->
- *
- */
-#ifndef __LXW_COMMON_H__
-#define __LXW_COMMON_H__
-
-#include <time.h>
-#include "third_party/queue.h"
-#include "third_party/tree.h"
-
-#ifndef TESTING
-#define STATIC static
-#else
-#define STATIC
-#endif
-
-#if __GNUC__ >= 5
-#define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
-#elif defined(_MSC_VER)
-#define DEPRECATED(func, msg) __declspec(deprecated, msg) func
-#else
-#define DEPRECATED(func, msg) func
-#endif
-
-/** Integer data type to represent a row value. Equivalent to `uint32_t`.
- *
- * The maximum row in Excel is 1,048,576.
- */
-typedef uint32_t lxw_row_t;
-
-/** Integer data type to represent a column value. Equivalent to `uint16_t`.
- *
- * The maximum column in Excel is 16,384.
- */
-typedef uint16_t lxw_col_t;
-
-/** Boolean values used in libxlsxwriter. */
-enum lxw_boolean {
-    /** False value. */
-    LXW_FALSE,
-    /** True value. */
-    LXW_TRUE,
-    /** False value. Used to turn off a property that is default on, in order
-     *  to distinguish it from an uninitialized value. */
-    LXW_EXPLICIT_FALSE
-};
-
-/**
- * @brief Error codes from libxlsxwriter functions.
- *
- * See the `lxw_strerror()` function for an example of how to convert the
- * enum number to a descriptive error message string.
- */
-typedef enum lxw_error {
-
-    /** No error. */
-    LXW_NO_ERROR = 0,
-
-    /** Memory error, failed to malloc() required memory. */
-    LXW_ERROR_MEMORY_MALLOC_FAILED,
-
-    /** Error creating output xlsx file. Usually a permissions error. */
-    LXW_ERROR_CREATING_XLSX_FILE,
-
-    /** Error encountered when creating a tmpfile during file assembly. */
-    LXW_ERROR_CREATING_TMPFILE,
-
-    /** Error reading a tmpfile. */
-    LXW_ERROR_READING_TMPFILE,
-
-    /** Zip generic error ZIP_ERRNO while creating the xlsx file. */
-    LXW_ERROR_ZIP_FILE_OPERATION,
-
-    /** Zip error ZIP_PARAMERROR while creating the xlsx file. */
-    LXW_ERROR_ZIP_PARAMETER_ERROR,
-
-    /** Zip error ZIP_BADZIPFILE (use_zip64 option may be required). */
-    LXW_ERROR_ZIP_BAD_ZIP_FILE,
-
-    /** Zip error ZIP_INTERNALERROR while creating the xlsx file. */
-    LXW_ERROR_ZIP_INTERNAL_ERROR,
-
-    /** File error or unknown zip error when adding sub file to xlsx file. */
-    LXW_ERROR_ZIP_FILE_ADD,
-
-    /** Unknown zip error when closing xlsx file. */
-    LXW_ERROR_ZIP_CLOSE,
-
-    /** Feature is not currently supported in this configuration. */
-    LXW_ERROR_FEATURE_NOT_SUPPORTED,
-
-    /** NULL function parameter ignored. */
-    LXW_ERROR_NULL_PARAMETER_IGNORED,
-
-    /** Function parameter validation error. */
-    LXW_ERROR_PARAMETER_VALIDATION,
-
-    /** Function string parameter is empty. */
-    LXW_ERROR_PARAMETER_IS_EMPTY,
-
-    /** A #lxw_datetime parameter has a validation error. */
-    LXW_ERROR_DATETIME_VALIDATION,
-
-    /** Worksheet name exceeds Excel's limit of 31 characters. */
-    LXW_ERROR_SHEETNAME_LENGTH_EXCEEDED,
-
-    /** Worksheet name cannot contain invalid characters: '[ ] : * ? / \\' */
-    LXW_ERROR_INVALID_SHEETNAME_CHARACTER,
-
-    /** Worksheet name cannot start or end with an apostrophe. */
-    LXW_ERROR_SHEETNAME_START_END_APOSTROPHE,
-
-    /** Worksheet name is already in use. */
-    LXW_ERROR_SHEETNAME_ALREADY_USED,
-
-    /** Parameter exceeds Excel's limit of 32 characters. */
-    LXW_ERROR_32_STRING_LENGTH_EXCEEDED,
-
-    /** Parameter exceeds Excel's limit of 128 characters. */
-    LXW_ERROR_128_STRING_LENGTH_EXCEEDED,
-
-    /** Parameter exceeds Excel's limit of 255 characters. */
-    LXW_ERROR_255_STRING_LENGTH_EXCEEDED,
-
-    /** String exceeds Excel's limit of 32,767 characters. */
-    LXW_ERROR_MAX_STRING_LENGTH_EXCEEDED,
-
-    /** Error finding internal string index. */
-    LXW_ERROR_SHARED_STRING_INDEX_NOT_FOUND,
-
-    /** Worksheet row or column index out of range. */
-    LXW_ERROR_WORKSHEET_INDEX_OUT_OF_RANGE,
-
-    /** Maximum hyperlink length (2079) exceeded. */
-    LXW_ERROR_WORKSHEET_MAX_URL_LENGTH_EXCEEDED,
-
-    /** Maximum number of worksheet URLs (65530) exceeded. */
-    LXW_ERROR_WORKSHEET_MAX_NUMBER_URLS_EXCEEDED,
-
-    /** Couldn't read image dimensions or DPI. */
-    LXW_ERROR_IMAGE_DIMENSIONS,
-
-    LXW_MAX_ERRNO
-} lxw_error;
-
-/** @brief Struct to represent a date and time in Excel.
- *
- * Struct to represent a date and time in Excel. See @ref working_with_dates.
- */
-typedef struct lxw_datetime {
-
-    /** Year     : 1900 - 9999 */
-    int year;
-    /** Month    : 1 - 12 */
-    int month;
-    /** Day      : 1 - 31 */
-    int day;
-    /** Hour     : 0 - 23 */
-    int hour;
-    /** Minute   : 0 - 59 */
-    int min;
-    /** Seconds  : 0 - 59.999 */
-    double sec;
-
-} lxw_datetime;
-
-enum lxw_custom_property_types {
-    LXW_CUSTOM_NONE,
-    LXW_CUSTOM_STRING,
-    LXW_CUSTOM_DOUBLE,
-    LXW_CUSTOM_INTEGER,
-    LXW_CUSTOM_BOOLEAN,
-    LXW_CUSTOM_DATETIME
-};
-
-/* Size of MD5 byte arrays. */
-#define LXW_MD5_SIZE              16
-
-/* Excel sheetname max of 31 chars. */
-#define LXW_SHEETNAME_MAX         31
-
-/* Max with all worksheet chars 4xUTF-8 bytes + start and end quotes + \0. */
-#define LXW_MAX_SHEETNAME_LENGTH  ((LXW_SHEETNAME_MAX * 4) + 2 + 1)
-
-/* Max col string length. */
-#define LXW_MAX_COL_NAME_LENGTH   sizeof("$XFD")
-
-/* Max row string length. */
-#define LXW_MAX_ROW_NAME_LENGTH   sizeof("$1048576")
-
-/* Max cell string length. */
-#define LXW_MAX_CELL_NAME_LENGTH  sizeof("$XFWD$1048576")
-
-/* Max range: $XFWD$1048576:$XFWD$1048576\0 */
-#define LXW_MAX_CELL_RANGE_LENGTH (LXW_MAX_CELL_NAME_LENGTH * 2)
-
-/* Max range formula Sheet1!$A$1:$C$5$ style. */
-#define LXW_MAX_FORMULA_RANGE_LENGTH (LXW_MAX_SHEETNAME_LENGTH + LXW_MAX_CELL_RANGE_LENGTH)
-
-/* Datetime string length. */
-#define LXW_DATETIME_LENGTH       sizeof("2016-12-12T23:00:00Z")
-
-/* GUID string length. */
-#define LXW_GUID_LENGTH           sizeof("{12345678-1234-1234-1234-1234567890AB}\0")
-
-#define LXW_UINT32_T_LENGTH       sizeof("4294967296")
-#define LXW_FILENAME_LENGTH       128
-#define LXW_IGNORE                1
-
-#define LXW_PORTRAIT              1
-#define LXW_LANDSCAPE             0
-
-#define LXW_SCHEMA_MS        "http://schemas.microsoft.com/office/2006/relationships"
-#define LXW_SCHEMA_ROOT      "http://schemas.openxmlformats.org"
-#define LXW_SCHEMA_DRAWING   LXW_SCHEMA_ROOT "/drawingml/2006"
-#define LXW_SCHEMA_OFFICEDOC LXW_SCHEMA_ROOT "/officeDocument/2006"
-#define LXW_SCHEMA_PACKAGE   LXW_SCHEMA_ROOT "/package/2006/relationships"
-#define LXW_SCHEMA_DOCUMENT  LXW_SCHEMA_ROOT "/officeDocument/2006/relationships"
-#define LXW_SCHEMA_CONTENT   LXW_SCHEMA_ROOT "/package/2006/content-types"
-
-/* Use REprintf() for error handling when compiled as an R library. */
-#ifdef USE_R_LANG
-#include <R.h>
-#define LXW_PRINTF REprintf
-#define LXW_STDERR
-#else
-#define LXW_PRINTF fprintf
-#define LXW_STDERR stderr,
-#endif
-
-#define LXW_ERROR(message)                      \
-    LXW_PRINTF(LXW_STDERR "[ERROR][%s:%d]: " message "\n", __FILE__, __LINE__)
-
-#define LXW_MEM_ERROR()                         \
-    LXW_ERROR("Memory allocation failed.")
-
-#define GOTO_LABEL_ON_MEM_ERROR(pointer, label) \
-    do {                                        \
-        if (!pointer) {                         \
-            LXW_MEM_ERROR();                    \
-            goto label;                         \
-        }                                       \
-    } while (0)
-
-#define RETURN_ON_MEM_ERROR(pointer, error)     \
-    do {                                        \
-        if (!pointer) {                         \
-            LXW_MEM_ERROR();                    \
-            return error;                       \
-        }                                       \
-    } while (0)
-
-#define RETURN_VOID_ON_MEM_ERROR(pointer)       \
-    do {                                        \
-        if (!pointer) {                         \
-            LXW_MEM_ERROR();                    \
-            return;                             \
-        }                                       \
-    } while (0)
-
-#define RETURN_ON_ERROR(error)                  \
-    do {                                        \
-        if (error)                              \
-            return error;                       \
-    } while (0)
-
-#define RETURN_AND_ZIPCLOSE_ON_ERROR(error)     \
-        do {                                    \
-            if (error) {                        \
-                zipClose(self->zipfile, NULL);  \
-                return error;                   \
-            }                                   \
-        } while (0)
-
-#define LXW_WARN(message)                       \
-    LXW_PRINTF(LXW_STDERR "[WARNING]: " message "\n")
-
-/* We can't use variadic macros here since we support ANSI C. */
-#define LXW_WARN_FORMAT(message)                \
-    LXW_PRINTF(LXW_STDERR "[WARNING]: " message "\n")
-
-#define LXW_WARN_FORMAT1(message, var)          \
-    LXW_PRINTF(LXW_STDERR "[WARNING]: " message "\n", var)
-
-#define LXW_WARN_FORMAT2(message, var1, var2)    \
-    LXW_PRINTF(LXW_STDERR "[WARNING]: " message "\n", var1, var2)
-
-#define LXW_WARN_FORMAT3(message, var1, var2, var3) \
-    LXW_PRINTF(LXW_STDERR "[WARNING]: " message "\n", var1, var2, var3)
-
-/* Chart axis type checks. */
-#define LXW_WARN_CAT_AXIS_ONLY(function)                                   \
-    do {                                                                   \
-        if (!axis->is_category) {                                          \
-            LXW_PRINTF(LXW_STDERR "[WARNING]: "                            \
-                    function "() is only valid for category axes\n");      \
-           return;                                                         \
-        }                                                                  \
-    } while (0)
-
-#define LXW_WARN_VALUE_AXIS_ONLY(function)                                 \
-    do {                                                                   \
-        if (!axis->is_value) {                                             \
-            LXW_PRINTF(LXW_STDERR "[WARNING]: "                            \
-                function "() is only valid for value axes\n");             \
-                return;                                                    \
-        }                                                                  \
-    } while (0)
-
-#define LXW_WARN_DATE_AXIS_ONLY(function)                                  \
-    do {                                                                   \
-        if (!axis->is_date) {                                              \
-            LXW_PRINTF(LXW_STDERR "[WARNING]: "                            \
-                    function "() is only valid for date axes\n");          \
-           return;                                                         \
-        }                                                                  \
-    } while (0)
-
-#define LXW_WARN_CAT_AND_DATE_AXIS_ONLY(function)                          \
-    do {                                                                   \
-        if (!axis->is_category && !axis->is_date) {                        \
-            LXW_PRINTF(LXW_STDERR "[WARNING]: "                            \
-                function "() is only valid for category and date axes\n"); \
-           return;                                                         \
-        }                                                                  \
-    } while (0)
-
-#define LXW_WARN_VALUE_AND_DATE_AXIS_ONLY(function)                        \
-    do {                                                                   \
-        if (!axis->is_value && !axis->is_date) {                           \
-            LXW_PRINTF(LXW_STDERR "[WARNING]: "                            \
-                function "() is only valid for value and date axes\n");    \
-            return;                                                        \
-        }                                                                  \
-    } while (0)
-
-#ifndef LXW_BIG_ENDIAN
-#define LXW_UINT16_HOST(n)    (n)
-#define LXW_UINT32_HOST(n)    (n)
-#define LXW_UINT16_NETWORK(n) ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8))
-#define LXW_UINT32_NETWORK(n) ((((n) & 0xFF)       << 24) | \
-                               (((n) & 0xFF00)     <<  8) | \
-                               (((n) & 0xFF0000)   >>  8) | \
-                               (((n) & 0xFF000000) >> 24))
-#else
-#define LXW_UINT16_NETWORK(n) (n)
-#define LXW_UINT32_NETWORK(n) (n)
-#define LXW_UINT16_HOST(n)    ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8))
-#define LXW_UINT32_HOST(n)    ((((n) & 0xFF)       << 24) | \
-                               (((n) & 0xFF00)     <<  8) | \
-                               (((n) & 0xFF0000)   >>  8) | \
-                               (((n) & 0xFF000000) >> 24))
-#endif
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-/* Compilers that have a native snprintf() can use it directly. */
-#ifdef _MSC_VER
-#define LXW_HAS_SNPRINTF
-#endif
-
-#ifdef LXW_HAS_SNPRINTF
-#define lxw_snprintf snprintf
-#else
-#define lxw_snprintf __builtin_snprintf
-#endif
-
-/* Define a snprintf for MSVC 2010. */
-#if defined(_MSC_VER) && _MSC_VER < 1900
-
-#include <stdarg.h>
-#define snprintf msvc2010_snprintf
-#define vsnprintf msvc2010_vsnprintf
-
-__inline int
-msvc2010_vsnprintf(char *str, size_t size, const char *format, va_list ap)
-{
-    int count = -1;
-
-    if (size != 0)
-        count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
-    if (count == -1)
-        count = _vscprintf(format, ap);
-
-    return count;
-}
-
-__inline int
-msvc2010_snprintf(char *str, size_t size, const char *format, ...)
-{
-    int count;
-    va_list ap;
-
-    va_start(ap, format);
-    count = msvc2010_vsnprintf(str, size, format, ap);
-    va_end(ap);
-
-    return count;
-}
-
-#endif
-
-/* Safer strcpy for fixed width char arrays. */
-#define lxw_strcpy(dest, src) \
-    lxw_snprintf(dest, sizeof(dest), "%s", src)
-
-/* Define the queue.h structs for the formats list. */
-STAILQ_HEAD(lxw_formats, lxw_format);
-
-/* Define the queue.h structs for the generic data structs. */
-STAILQ_HEAD(lxw_tuples, lxw_tuple);
-STAILQ_HEAD(lxw_custom_properties, lxw_custom_property);
-
-typedef struct lxw_tuple {
-    char *key;
-    char *value;
-
-    STAILQ_ENTRY (lxw_tuple) list_pointers;
-} lxw_tuple;
-
-/* Define custom property used in workbook.c and custom.c. */
-typedef struct lxw_custom_property {
-
-    enum lxw_custom_property_types type;
-    char *name;
-
-    union {
-        char *string;
-        double number;
-        int32_t integer;
-        uint8_t boolean;
-        lxw_datetime datetime;
-    } u;
-
-    STAILQ_ENTRY (lxw_custom_property) list_pointers;
-
-} lxw_custom_property;
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_COMMON_H__ */

+ 0 - 86
src/3rdparty/libxlsxwriter/include/xlsxwriter/content_types.h

@@ -1,86 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * content_types - A libxlsxwriter library for creating Excel XLSX
- *                 content_types files.
- *
- */
-#ifndef __LXW_CONTENT_TYPES_H__
-#define __LXW_CONTENT_TYPES_H__
-
-#include <stdint.h>
-#include <string.h>
-
-#include "common.h"
-
-#define LXW_APP_PACKAGE  "application/vnd.openxmlformats-package."
-#define LXW_APP_DOCUMENT "application/vnd.openxmlformats-officedocument."
-#define LXW_APP_MSEXCEL  "application/vnd.ms-excel."
-
-/*
- * Struct to represent a content_types.
- */
-typedef struct lxw_content_types {
-
-    FILE *file;
-
-    struct lxw_tuples *default_types;
-    struct lxw_tuples *overrides;
-
-} lxw_content_types;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_content_types *lxw_content_types_new(void);
-void lxw_content_types_free(lxw_content_types *content_types);
-void lxw_content_types_assemble_xml_file(lxw_content_types *content_types);
-void lxw_ct_add_default(lxw_content_types *content_types, const char *key,
-                        const char *value);
-void lxw_ct_add_override(lxw_content_types *content_types, const char *key,
-                         const char *value);
-void lxw_ct_add_worksheet_name(lxw_content_types *content_types,
-                               const char *name);
-void lxw_ct_add_chartsheet_name(lxw_content_types *content_types,
-                                const char *name);
-void lxw_ct_add_chart_name(lxw_content_types *content_types,
-                           const char *name);
-void lxw_ct_add_drawing_name(lxw_content_types *content_types,
-                             const char *name);
-void lxw_ct_add_table_name(lxw_content_types *content_types,
-                           const char *name);
-void lxw_ct_add_comment_name(lxw_content_types *content_types,
-                             const char *name);
-void lxw_ct_add_vml_name(lxw_content_types *content_types);
-
-void lxw_ct_add_shared_strings(lxw_content_types *content_types);
-void lxw_ct_add_calc_chain(lxw_content_types *content_types);
-void lxw_ct_add_custom_properties(lxw_content_types *content_types);
-void lxw_ct_add_metadata(lxw_content_types *content_types);
-void lxw_ct_add_rich_value(lxw_content_types *content_types);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _content_types_xml_declaration(lxw_content_types *self);
-STATIC void _write_default(lxw_content_types *self, const char *ext,
-                           const char *type);
-STATIC void _write_override(lxw_content_types *self, const char *part_name,
-                            const char *type);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_CONTENT_TYPES_H__ */

+ 0 - 52
src/3rdparty/libxlsxwriter/include/xlsxwriter/core.h

@@ -1,52 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * core - A libxlsxwriter library for creating Excel XLSX core files.
- *
- */
-#ifndef __LXW_CORE_H__
-#define __LXW_CORE_H__
-
-#include <stdint.h>
-
-#include "workbook.h"
-#include "common.h"
-
-/*
- * Struct to represent a core.
- */
-typedef struct lxw_core {
-
-    FILE *file;
-    lxw_doc_properties *properties;
-
-} lxw_core;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_core *lxw_core_new(void);
-void lxw_core_free(lxw_core *core);
-void lxw_core_assemble_xml_file(lxw_core *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _core_xml_declaration(lxw_core *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_CORE_H__ */

+ 0 - 53
src/3rdparty/libxlsxwriter/include/xlsxwriter/custom.h

@@ -1,53 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * custom - A libxlsxwriter library for creating Excel custom property files.
- *
- */
-#ifndef __LXW_CUSTOM_H__
-#define __LXW_CUSTOM_H__
-
-#include <stdint.h>
-
-#include "common.h"
-
-/*
- * Struct to represent a custom property file object.
- */
-typedef struct lxw_custom {
-
-    FILE *file;
-
-    struct lxw_custom_properties *custom_properties;
-    uint32_t pid;
-
-} lxw_custom;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_custom *lxw_custom_new(void);
-void lxw_custom_free(lxw_custom *custom);
-void lxw_custom_assemble_xml_file(lxw_custom *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _custom_xml_declaration(lxw_custom *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_CUSTOM_H__ */

+ 0 - 104
src/3rdparty/libxlsxwriter/include/xlsxwriter/drawing.h

@@ -1,104 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * drawing - A libxlsxwriter library for creating Excel XLSX drawing files.
- *
- */
-#ifndef __LXW_DRAWING_H__
-#define __LXW_DRAWING_H__
-
-#include <stdint.h>
-#include <string.h>
-
-#include "common.h"
-
-STAILQ_HEAD(lxw_drawing_objects, lxw_drawing_object);
-
-enum lxw_drawing_types {
-    LXW_DRAWING_NONE = 0,
-    LXW_DRAWING_IMAGE,
-    LXW_DRAWING_CHART,
-    LXW_DRAWING_SHAPE
-};
-
-enum image_types {
-    LXW_IMAGE_UNKNOWN = 0,
-    LXW_IMAGE_PNG,
-    LXW_IMAGE_JPEG,
-    LXW_IMAGE_BMP,
-    LXW_IMAGE_GIF
-};
-
-/* Coordinates used in a drawing object. */
-typedef struct lxw_drawing_coords {
-    uint32_t col;
-    uint32_t row;
-    double col_offset;
-    double row_offset;
-} lxw_drawing_coords;
-
-/* Object to represent the properties of a drawing. */
-typedef struct lxw_drawing_object {
-    uint8_t type;
-    uint8_t anchor;
-    struct lxw_drawing_coords from;
-    struct lxw_drawing_coords to;
-    uint64_t col_absolute;
-    uint64_t row_absolute;
-    uint32_t width;
-    uint32_t height;
-    uint8_t shape;
-    uint32_t rel_index;
-    uint32_t url_rel_index;
-    char *description;
-    char *tip;
-    uint8_t decorative;
-
-    STAILQ_ENTRY (lxw_drawing_object) list_pointers;
-
-} lxw_drawing_object;
-
-/*
- * Struct to represent a collection of drawings.
- */
-typedef struct lxw_drawing {
-
-    FILE *file;
-
-    uint8_t embedded;
-    uint8_t orientation;
-
-    struct lxw_drawing_objects *drawing_objects;
-
-} lxw_drawing;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_drawing *lxw_drawing_new(void);
-void lxw_drawing_free(lxw_drawing *drawing);
-void lxw_drawing_assemble_xml_file(lxw_drawing *self);
-void lxw_free_drawing_object(struct lxw_drawing_object *drawing_object);
-void lxw_add_drawing_object(lxw_drawing *drawing,
-                            lxw_drawing_object *drawing_object);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _drawing_xml_declaration(lxw_drawing *self);
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_DRAWING_H__ */

Разница между файлами не показана из-за своего большого размера
+ 0 - 1358
src/3rdparty/libxlsxwriter/include/xlsxwriter/format.h


+ 0 - 77
src/3rdparty/libxlsxwriter/include/xlsxwriter/hash_table.h

@@ -1,77 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * hash_table - Hash table functions for libxlsxwriter.
- *
- */
-
-#ifndef __LXW_HASH_TABLE_H__
-#define __LXW_HASH_TABLE_H__
-
-#include "common.h"
-
-/* Macro to loop over hash table elements in insertion order. */
-#define LXW_FOREACH_ORDERED(elem, hash_table) \
-    STAILQ_FOREACH((elem), (hash_table)->order_list, lxw_hash_order_pointers)
-
-/* List declarations. */
-STAILQ_HEAD(lxw_hash_order_list, lxw_hash_element);
-SLIST_HEAD(lxw_hash_bucket_list, lxw_hash_element);
-
-/* LXW_HASH hash table struct. */
-typedef struct lxw_hash_table {
-    uint32_t num_buckets;
-    uint32_t used_buckets;
-    uint32_t unique_count;
-    uint8_t free_key;
-    uint8_t free_value;
-
-    struct lxw_hash_order_list *order_list;
-    struct lxw_hash_bucket_list **buckets;
-} lxw_hash_table;
-
-/*
- * LXW_HASH table element struct.
- *
- * The hash elements contain pointers to allow them to be stored in
- * lists in the the hash table buckets and also pointers to track the
- * insertion order in a separate list.
- */
-typedef struct lxw_hash_element {
-    void *key;
-    void *value;
-
-    STAILQ_ENTRY (lxw_hash_element) lxw_hash_order_pointers;
-    SLIST_ENTRY (lxw_hash_element) lxw_hash_list_pointers;
-} lxw_hash_element;
-
-
- /* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_hash_element *lxw_hash_key_exists(lxw_hash_table *lxw_hash, void *key,
-                                      size_t key_len);
-lxw_hash_element *lxw_insert_hash_element(lxw_hash_table *lxw_hash, void *key,
-                                          void *value, size_t key_len);
-lxw_hash_table *lxw_hash_new(uint32_t num_buckets, uint8_t free_key,
-                             uint8_t free_value);
-void lxw_hash_free(lxw_hash_table *lxw_hash);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-#endif
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_HASH_TABLE_H__ */

+ 0 - 53
src/3rdparty/libxlsxwriter/include/xlsxwriter/metadata.h

@@ -1,53 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * metadata - A libxlsxwriter library for creating Excel XLSX metadata files.
- *
- */
-#ifndef __LXW_METADATA_H__
-#define __LXW_METADATA_H__
-
-#include <stdint.h>
-
-#include "common.h"
-
-/*
- * Struct to represent a metadata object.
- */
-typedef struct lxw_metadata {
-
-    FILE *file;
-    uint8_t has_dynamic_functions;
-    uint8_t has_embedded_images;
-    uint32_t num_embedded_images;
-
-} lxw_metadata;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_metadata *lxw_metadata_new(void);
-void lxw_metadata_free(lxw_metadata *metadata);
-void lxw_metadata_assemble_xml_file(lxw_metadata *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _metadata_xml_declaration(lxw_metadata *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_METADATA_H__ */

+ 0 - 106
src/3rdparty/libxlsxwriter/include/xlsxwriter/packager.h

@@ -1,106 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * packager - A libxlsxwriter library for creating Excel XLSX packager files.
- *
- */
-#ifndef __LXW_PACKAGER_H__
-#define __LXW_PACKAGER_H__
-
-#include <stdint.h>
-
-#ifdef USE_SYSTEM_MINIZIP
-#ifdef __GNUC__
-#pragma GCC system_header
-#endif
-#include "minizip/zip.h"
-#else
-#include "third_party/zip.h"
-#endif
-
-#include "common.h"
-#include "workbook.h"
-#include "worksheet.h"
-#include "shared_strings.h"
-#include "app.h"
-#include "core.h"
-#include "custom.h"
-#include "table.h"
-#include "theme.h"
-#include "styles.h"
-#include "format.h"
-#include "content_types.h"
-#include "relationships.h"
-#include "vml.h"
-#include "comment.h"
-#include "metadata.h"
-#include "rich_value.h"
-#include "rich_value_rel.h"
-#include "rich_value_types.h"
-#include "rich_value_structure.h"
-
-#define LXW_ZIP_BUFFER_SIZE (16384)
-
-/* If zip returns a ZIP_XXX error then errno is set and we can trap that in
- * workbook.c. Otherwise return a default libxlsxwriter error. */
-#define RETURN_ON_ZIP_ERROR(err, default_err)       \
-    do {                                            \
-        if (err == ZIP_ERRNO)                       \
-            return LXW_ERROR_ZIP_FILE_OPERATION;    \
-        else if (err == ZIP_PARAMERROR)             \
-            return LXW_ERROR_ZIP_PARAMETER_ERROR;   \
-        else if (err == ZIP_BADZIPFILE)             \
-            return LXW_ERROR_ZIP_BAD_ZIP_FILE;      \
-        else if (err == ZIP_INTERNALERROR)          \
-            return LXW_ERROR_ZIP_INTERNAL_ERROR;    \
-        else                                        \
-            return default_err;                     \
-    } while (0)
-
-/*
- * Struct to represent a packager.
- */
-typedef struct lxw_packager {
-
-    FILE *file;
-    lxw_workbook *workbook;
-
-    size_t buffer_size;
-    size_t output_buffer_size;
-    zipFile zipfile;
-    zip_fileinfo zipfile_info;
-    const char *filename;
-    const char *buffer;
-    char *output_buffer;
-    const char *tmpdir;
-    uint8_t use_zip64;
-
-} lxw_packager;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_packager *lxw_packager_new(const char *filename, const char *tmpdir,
-                               uint8_t use_zip64);
-void lxw_packager_free(lxw_packager *packager);
-lxw_error lxw_create_package(lxw_packager *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_PACKAGER_H__ */

+ 0 - 79
src/3rdparty/libxlsxwriter/include/xlsxwriter/relationships.h

@@ -1,79 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * relationships - A libxlsxwriter library for creating Excel XLSX
- *                 relationships files.
- *
- */
-#ifndef __LXW_RELATIONSHIPS_H__
-#define __LXW_RELATIONSHIPS_H__
-
-#include <stdint.h>
-
-#include "common.h"
-
-/* Define the queue.h STAILQ structs for the generic data structs. */
-STAILQ_HEAD(lxw_rel_tuples, lxw_rel_tuple);
-
-typedef struct lxw_rel_tuple {
-
-    char *type;
-    char *target;
-    char *target_mode;
-
-    STAILQ_ENTRY (lxw_rel_tuple) list_pointers;
-
-} lxw_rel_tuple;
-
-/*
- * Struct to represent a relationships.
- */
-typedef struct lxw_relationships {
-
-    FILE *file;
-
-    uint32_t rel_id;
-    struct lxw_rel_tuples *relationships;
-
-} lxw_relationships;
-
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_relationships *lxw_relationships_new(void);
-void lxw_free_relationships(lxw_relationships *relationships);
-void lxw_relationships_assemble_xml_file(lxw_relationships *self);
-
-void lxw_add_document_relationship(lxw_relationships *self, const char *type,
-                                   const char *target);
-void lxw_add_package_relationship(lxw_relationships *self, const char *type,
-                                  const char *target);
-void lxw_add_ms_package_relationship(lxw_relationships *self,
-                                     const char *type, const char *target);
-void lxw_add_worksheet_relationship(lxw_relationships *self, const char *type,
-                                    const char *target,
-                                    const char *target_mode);
-void lxw_add_rich_value_relationship(lxw_relationships *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _relationships_xml_declaration(lxw_relationships *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_RELATIONSHIPS_H__ */

+ 0 - 51
src/3rdparty/libxlsxwriter/include/xlsxwriter/rich_value.h

@@ -1,51 +0,0 @@
-/*
- * libxlsxwriter
- *
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
- *
- * rich_value - A libxlsxwriter library for creating Excel XLSX rich_value files.
- *
- */
-#ifndef __LXW_RICH_VALUE_H__
-#define __LXW_RICH_VALUE_H__
-
-#include <stdint.h>
-
-#include "common.h"
-#include "workbook.h"
-
-/*
- * Struct to represent a rich_value object.
- */
-typedef struct lxw_rich_value {
-
-    FILE *file;
-    lxw_workbook *workbook;
-
-} lxw_rich_value;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_rich_value *lxw_rich_value_new(void);
-void lxw_rich_value_free(lxw_rich_value *rich_value);
-void lxw_rich_value_assemble_xml_file(lxw_rich_value *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _rich_value_xml_declaration(lxw_rich_value *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_RICH_VALUE_H__ */

+ 0 - 50
src/3rdparty/libxlsxwriter/include/xlsxwriter/rich_value_rel.h

@@ -1,50 +0,0 @@
-/*
- * libxlsxwriter
- *
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
- *
- * rich_value_rel - A libxlsxwriter library for creating Excel XLSX rich_value_rel files.
- *
- */
-#ifndef __LXW_RICH_VALUE_REL_H__
-#define __LXW_RICH_VALUE_REL_H__
-
-#include <stdint.h>
-
-#include "common.h"
-
-/*
- * Struct to represent a rich_value_rel object.
- */
-typedef struct lxw_rich_value_rel {
-
-    FILE *file;
-    uint32_t num_embedded_images;
-
-} lxw_rich_value_rel;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_rich_value_rel *lxw_rich_value_rel_new(void);
-void lxw_rich_value_rel_free(lxw_rich_value_rel *rich_value_rel);
-void lxw_rich_value_rel_assemble_xml_file(lxw_rich_value_rel *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _rich_value_rel_xml_declaration(lxw_rich_value_rel *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_RICH_VALUE_REL_H__ */

+ 0 - 53
src/3rdparty/libxlsxwriter/include/xlsxwriter/rich_value_structure.h

@@ -1,53 +0,0 @@
-/*
- * libxlsxwriter
- *
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
- *
- * rich_value_structure - A libxlsxwriter library for creating Excel XLSX rich_value_structure files.
- *
- */
-#ifndef __LXW_RICH_VALUE_STRUCTURE_H__
-#define __LXW_RICH_VALUE_STRUCTURE_H__
-
-#include <stdint.h>
-
-#include "common.h"
-
-/*
- * Struct to represent a rich_value_structure object.
- */
-typedef struct lxw_rich_value_structure {
-
-    FILE *file;
-    uint8_t has_embedded_image_descriptions;
-
-} lxw_rich_value_structure;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_rich_value_structure *lxw_rich_value_structure_new(void);
-void lxw_rich_value_structure_free(lxw_rich_value_structure
-                                   *rich_value_structure);
-void lxw_rich_value_structure_assemble_xml_file(lxw_rich_value_structure
-                                                *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _rich_value_structure_xml_declaration(lxw_rich_value_structure
-                                                  *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_RICH_VALUE_STRUCTURE_H__ */

+ 0 - 49
src/3rdparty/libxlsxwriter/include/xlsxwriter/rich_value_types.h

@@ -1,49 +0,0 @@
-/*
- * libxlsxwriter
- *
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
- *
- * rich_value_types - A libxlsxwriter library for creating Excel XLSX rich_value_types files.
- *
- */
-#ifndef __LXW_RICH_VALUE_TYPES_H__
-#define __LXW_RICH_VALUE_TYPES_H__
-
-#include <stdint.h>
-
-#include "common.h"
-
-/*
- * Struct to represent a rich_value_types object.
- */
-typedef struct lxw_rich_value_types {
-
-    FILE *file;
-
-} lxw_rich_value_types;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_rich_value_types *lxw_rich_value_types_new(void);
-void lxw_rich_value_types_free(lxw_rich_value_types *rich_value_types);
-void lxw_rich_value_types_assemble_xml_file(lxw_rich_value_types *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _rich_value_types_xml_declaration(lxw_rich_value_types *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_RICH_VALUE_TYPES_H__ */

+ 0 - 86
src/3rdparty/libxlsxwriter/include/xlsxwriter/shared_strings.h

@@ -1,86 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * shared_strings - A libxlsxwriter library for creating Excel XLSX
- *                  sst files.
- *
- */
-#ifndef __LXW_SST_H__
-#define __LXW_SST_H__
-
-#include <string.h>
-#include <stdint.h>
-
-#include "common.h"
-
-/* Define a tree.h RB structure for storing shared strings. */
-RB_HEAD(sst_rb_tree, sst_element);
-
-/* Define a queue.h structure for storing shared strings in insertion order. */
-STAILQ_HEAD(sst_order_list, sst_element);
-
-/* Wrapper around RB_GENERATE_STATIC from tree.h to avoid unused function
- * warnings and to avoid portability issues with the _unused attribute. */
-#define LXW_RB_GENERATE_ELEMENT(name, type, field, cmp) \
-    RB_GENERATE_INSERT_COLOR(name, type, field, static) \
-    RB_GENERATE_INSERT(name, type, field, cmp, static)  \
-    /* Add unused struct to allow adding a semicolon */ \
-    struct lxw_rb_generate_element{int unused;}
-
-/*
- * Elements of the SST table. They contain pointers to allow them to
- * be stored in a RB tree and also pointers to track the insertion order
- * in a separate list.
- */
-struct sst_element {
-    uint32_t index;
-    char *string;
-    uint8_t is_rich_string;
-
-    STAILQ_ENTRY (sst_element) sst_order_pointers;
-    RB_ENTRY (sst_element) sst_tree_pointers;
-};
-
-/*
- * Struct to represent a sst.
- */
-typedef struct lxw_sst {
-    FILE *file;
-
-    uint32_t string_count;
-    uint32_t unique_count;
-
-    struct sst_order_list *order_list;
-    struct sst_rb_tree *rb_tree;
-
-} lxw_sst;
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_sst *lxw_sst_new(void);
-void lxw_sst_free(lxw_sst *sst);
-struct sst_element *lxw_get_sst_index(lxw_sst *sst, const char *string,
-                                      uint8_t is_rich_string);
-void lxw_sst_assemble_xml_file(lxw_sst *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _sst_xml_declaration(lxw_sst *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_SST_H__ */

+ 0 - 89
src/3rdparty/libxlsxwriter/include/xlsxwriter/styles.h

@@ -1,89 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * styles - A libxlsxwriter library for creating Excel XLSX styles files.
- *
- */
-#ifndef __LXW_STYLES_H__
-#define __LXW_STYLES_H__
-
-#include <stdint.h>
-#include <ctype.h>
-
-#include "format.h"
-
-/*
- * Struct to represent a styles.
- */
-typedef struct lxw_styles {
-
-    FILE *file;
-    uint32_t font_count;
-    uint32_t xf_count;
-    uint32_t dxf_count;
-    uint32_t num_format_count;
-    uint32_t border_count;
-    uint32_t fill_count;
-    struct lxw_formats *xf_formats;
-    struct lxw_formats *dxf_formats;
-    uint8_t has_hyperlink;
-    uint16_t hyperlink_font_id;
-    uint8_t has_comments;
-
-} lxw_styles;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_styles *lxw_styles_new(void);
-void lxw_styles_free(lxw_styles *styles);
-void lxw_styles_assemble_xml_file(lxw_styles *self);
-void lxw_styles_write_string_fragment(lxw_styles *self, const char *string);
-void lxw_styles_write_rich_font(lxw_styles *styles, lxw_format *format);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _styles_xml_declaration(lxw_styles *self);
-STATIC void _write_style_sheet(lxw_styles *self);
-STATIC void _write_font_size(lxw_styles *self, double font_size);
-STATIC void _write_font_color_theme(lxw_styles *self, uint8_t theme);
-STATIC void _write_font_name(lxw_styles *self, const char *font_name,
-                             uint8_t is_rich_string);
-STATIC void _write_font_family(lxw_styles *self, uint8_t font_family);
-STATIC void _write_font_scheme(lxw_styles *self, const char *font_scheme);
-STATIC void _write_font(lxw_styles *self, lxw_format *format, uint8_t is_dxf,
-                        uint8_t is_rich_string);
-STATIC void _write_fonts(lxw_styles *self);
-STATIC void _write_default_fill(lxw_styles *self, const char *pattern);
-STATIC void _write_fills(lxw_styles *self);
-STATIC void _write_border(lxw_styles *self, lxw_format *format,
-                          uint8_t is_dxf);
-STATIC void _write_borders(lxw_styles *self);
-STATIC void _write_style_xf(lxw_styles *self, uint8_t has_hyperlink,
-                            uint16_t font_id);
-STATIC void _write_cell_style_xfs(lxw_styles *self);
-STATIC void _write_xf(lxw_styles *self, lxw_format *format);
-STATIC void _write_cell_xfs(lxw_styles *self);
-STATIC void _write_cell_style(lxw_styles *self, char *name, uint8_t xf_id,
-                              uint8_t builtin_id);
-STATIC void _write_cell_styles(lxw_styles *self);
-STATIC void _write_dxfs(lxw_styles *self);
-STATIC void _write_table_styles(lxw_styles *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_STYLES_H__ */

+ 0 - 52
src/3rdparty/libxlsxwriter/include/xlsxwriter/table.h

@@ -1,52 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * table - A libxlsxwriter library for creating Excel XLSX table files.
- *
- */
-#ifndef __LXW_TABLE_H__
-#define __LXW_TABLE_H__
-
-#include <stdint.h>
-
-#include "common.h"
-
-/*
- * Struct to represent a table object.
- */
-typedef struct lxw_table {
-
-    FILE *file;
-
-    struct lxw_table_obj *table_obj;
-
-} lxw_table;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_table *lxw_table_new(void);
-void lxw_table_free(lxw_table *table);
-void lxw_table_assemble_xml_file(lxw_table *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-STATIC void _table_xml_declaration(lxw_table *self);
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_TABLE_H__ */

+ 0 - 48
src/3rdparty/libxlsxwriter/include/xlsxwriter/theme.h

@@ -1,48 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * theme - A libxlsxwriter library for creating Excel XLSX theme files.
- *
- */
-#ifndef __LXW_THEME_H__
-#define __LXW_THEME_H__
-
-#include <stdint.h>
-
-#include "common.h"
-
-/*
- * Struct to represent a theme.
- */
-typedef struct lxw_theme {
-
-    FILE *file;
-} lxw_theme;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_theme *lxw_theme_new(void);
-void lxw_theme_free(lxw_theme *theme);
-void lxw_theme_xml_declaration(lxw_theme *self);
-void lxw_theme_assemble_xml_file(lxw_theme *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_THEME_H__ */

+ 0 - 26
src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/emyg_dtoa.h

@@ -1,26 +0,0 @@
-/* emyg_dtoa.h
-** Copyright (C) 2015 Doug Currie
-** based on dtoa_milo.h
-** Copyright (C) 2014 Milo Yip
-**
-** Permission is hereby granted, free of charge, to any person obtaining a copy
-** of this software and associated documentation files (the "Software"), to deal
-** in the Software without restriction, including without limitation the rights
-** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-** copies of the Software, and to permit persons to whom the Software is
-** furnished to do so, subject to the following conditions:
-**
-** The above copyright notice and this permission notice shall be included in
-** all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-** THE SOFTWARE.
-*/
-
-/* Source from https://github.com/miloyip/dtoa-benchmark */
-void emyg_dtoa (double value, char* buffer);

+ 0 - 216
src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h

@@ -1,216 +0,0 @@
-/* ioapi.h -- IO base function header for compress/uncompress .zip
-   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
-
-         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
-
-         Modifications for Zip64 support
-         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
-
-         For more info read MiniZip_info.txt
-
-         Changes
-
-    Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)
-    Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
-               More if/def section may be needed to support other platforms
-    Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
-                          (but you should use iowin32.c for windows instead)
-
-*/
-
-
-/* Pragma added by libxlsxwriter to avoid warnings with -pedantic -ansi. */
-#ifndef _WIN32
-#pragma GCC system_header
-#endif
-
-#ifndef _ZLIBIOAPI64_H
-#define _ZLIBIOAPI64_H
-
-#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
-
-  /* Linux needs this to support file operation on files larger then 4+GB
-   * But might need better if/def to select just the platforms that needs them. */
-
-        #ifndef __USE_FILE_OFFSET64
-                #define __USE_FILE_OFFSET64
-        #endif
-        #ifndef __USE_LARGEFILE64
-                #define __USE_LARGEFILE64
-        #endif
-        #ifndef _LARGEFILE64_SOURCE
-                #define _LARGEFILE64_SOURCE
-        #endif
-        #ifndef _FILE_OFFSET_BIT
-                #define _FILE_OFFSET_BIT 64
-        #endif
-
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "zlib.h"
-
-#if defined(USE_FILE32API)
-#define fopen64 fopen
-#define ftello64 ftell
-#define fseeko64 fseek
-#else
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
-#define fopen64 fopen
-#define ftello64 ftello
-#define fseeko64 fseeko
-#endif
-#ifdef _MSC_VER
- #define fopen64 fopen
- #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
-  #define ftello64 _ftelli64
-  #define fseeko64 _fseeki64
- #else /* old MSC */
-  #define ftello64 ftell
-  #define fseeko64 fseek
- #endif
-#endif
-#endif
-
-/*
-#ifndef ZPOS64_T
-  #ifdef _WIN32
-                #define ZPOS64_T fpos_t
-  #else
-    #include <stdint.h>
-    #define ZPOS64_T uint64_t
-  #endif
-#endif
-*/
-
-#ifdef HAVE_MINIZIP64_CONF_H
-#include "mz64conf.h"
-#endif
-
-/* a type chosen by DEFINE */
-#ifdef HAVE_64BIT_INT_CUSTOM
-typedef  64BIT_INT_CUSTOM_TYPE ZPOS64_T;
-#else
-#ifdef HAS_STDINT_H
-#include "stdint.h"
-typedef uint64_t ZPOS64_T;
-#else
-
-
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-typedef unsigned __int64 ZPOS64_T;
-#else
-typedef unsigned long long int ZPOS64_T;
-#endif
-#endif
-#endif
-
-/* Maximum unsigned 32-bit value used as placeholder for zip64 */
-#ifndef MAXU32
-#define MAXU32 (0xffffffff)
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define ZLIB_FILEFUNC_SEEK_CUR (1)
-#define ZLIB_FILEFUNC_SEEK_END (2)
-#define ZLIB_FILEFUNC_SEEK_SET (0)
-
-#define ZLIB_FILEFUNC_MODE_READ      (1)
-#define ZLIB_FILEFUNC_MODE_WRITE     (2)
-#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
-
-#define ZLIB_FILEFUNC_MODE_EXISTING (4)
-#define ZLIB_FILEFUNC_MODE_CREATE   (8)
-
-
-#ifndef ZCALLBACK
- #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
-   #define ZCALLBACK CALLBACK
- #else
-   #define ZCALLBACK
- #endif
-#endif
-
-
-
-
-typedef voidpf   (ZCALLBACK *open_file_func)      (voidpf opaque, const char* filename, int mode);
-typedef uLong    (ZCALLBACK *read_file_func)      (voidpf opaque, voidpf stream, void* buf, uLong size);
-typedef uLong    (ZCALLBACK *write_file_func)     (voidpf opaque, voidpf stream, const void* buf, uLong size);
-typedef int      (ZCALLBACK *close_file_func)     (voidpf opaque, voidpf stream);
-typedef int      (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
-
-typedef long     (ZCALLBACK *tell_file_func)      (voidpf opaque, voidpf stream);
-typedef long     (ZCALLBACK *seek_file_func)      (voidpf opaque, voidpf stream, uLong offset, int origin);
-
-
-/* here is the "old" 32 bits structure */
-typedef struct zlib_filefunc_def_s
-{
-    open_file_func      zopen_file;
-    read_file_func      zread_file;
-    write_file_func     zwrite_file;
-    tell_file_func      ztell_file;
-    seek_file_func      zseek_file;
-    close_file_func     zclose_file;
-    testerror_file_func zerror_file;
-    voidpf              opaque;
-} zlib_filefunc_def;
-
-typedef ZPOS64_T (ZCALLBACK *tell64_file_func)    (voidpf opaque, voidpf stream);
-typedef long     (ZCALLBACK *seek64_file_func)    (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
-typedef voidpf   (ZCALLBACK *open64_file_func)    (voidpf opaque, const void* filename, int mode);
-
-typedef struct zlib_filefunc64_def_s
-{
-    open64_file_func    zopen64_file;
-    read_file_func      zread_file;
-    write_file_func     zwrite_file;
-    tell64_file_func    ztell64_file;
-    seek64_file_func    zseek64_file;
-    close_file_func     zclose_file;
-    testerror_file_func zerror_file;
-    voidpf              opaque;
-} zlib_filefunc64_def;
-
-void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
-void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
-
-/* now internal definition, only for zip.c and unzip.h */
-typedef struct zlib_filefunc64_32_def_s
-{
-    zlib_filefunc64_def zfile_func64;
-    open_file_func      zopen32_file;
-    tell_file_func      ztell32_file;
-    seek_file_func      zseek32_file;
-} zlib_filefunc64_32_def;
-
-
-#define ZREAD64(filefunc,filestream,buf,size)     ((*((filefunc).zfile_func64.zread_file))   ((filefunc).zfile_func64.opaque,filestream,buf,size))
-#define ZWRITE64(filefunc,filestream,buf,size)    ((*((filefunc).zfile_func64.zwrite_file))  ((filefunc).zfile_func64.opaque,filestream,buf,size))
-/* #define ZTELL64(filefunc,filestream)            ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) */
-/* #define ZSEEK64(filefunc,filestream,pos,mode)   ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) */
-#define ZCLOSE64(filefunc,filestream)             ((*((filefunc).zfile_func64.zclose_file))  ((filefunc).zfile_func64.opaque,filestream))
-#define ZERROR64(filefunc,filestream)             ((*((filefunc).zfile_func64.zerror_file))  ((filefunc).zfile_func64.opaque,filestream))
-
-voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
-long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
-ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
-
-void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
-
-#define ZOPEN64(filefunc,filename,mode)         (call_zopen64((&(filefunc)),(filename),(mode)))
-#define ZTELL64(filefunc,filestream)            (call_ztell64((&(filefunc)),(filestream)))
-#define ZSEEK64(filefunc,filestream,pos,mode)   (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif

+ 0 - 45
src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/md5.h

@@ -1,45 +0,0 @@
-/*
- * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
- * MD5 Message-Digest Algorithm (RFC 1321).
- *
- * Homepage:
- * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
- *
- * Author:
- * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
- *
- * This software was written by Alexander Peslyak in 2001.  No copyright is
- * claimed, and the software is hereby placed in the public domain.
- * In case this attempt to disclaim copyright and place the software in the
- * public domain is deemed null and void, then the software is
- * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
- * general public under the following terms:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted.
- *
- * There's ABSOLUTELY NO WARRANTY, express or implied.
- *
- * See md5.c for more information.
- */
-
-#ifdef HAVE_OPENSSL
-#include <openssl/md5.h>
-#elif !defined(_MD5_H)
-#define _MD5_H
-
-/* Any 32-bit or wider unsigned integer data type will do */
-typedef unsigned int MD5_u32plus;
-
-typedef struct {
-	MD5_u32plus lo, hi;
-	MD5_u32plus a, b, c, d;
-	unsigned char buffer[64];
-	MD5_u32plus block[16];
-} MD5_CTX;
-
-extern void MD5_Init(MD5_CTX *ctx);
-extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
-extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
-
-#endif

+ 0 - 694
src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/queue.h

@@ -1,694 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)queue.h	8.5 (Berkeley) 8/20/94
- * $FreeBSD$
- */
-
-#ifndef _SYS_QUEUE_H_
-#define	_SYS_QUEUE_H_
-
-/* #include <sys/cdefs.h> */
-
-/*
- * This file defines four types of data structures: singly-linked lists,
- * singly-linked tail queues, lists and tail queues.
- *
- * A singly-linked list is headed by a single forward pointer. The elements
- * are singly linked for minimum space and pointer manipulation overhead at
- * the expense of O(n) removal for arbitrary elements. New elements can be
- * added to the list after an existing element or at the head of the list.
- * Elements being removed from the head of the list should use the explicit
- * macro for this purpose for optimum efficiency. A singly-linked list may
- * only be traversed in the forward direction.  Singly-linked lists are ideal
- * for applications with large datasets and few or no removals or for
- * implementing a LIFO queue.
- *
- * A singly-linked tail queue is headed by a pair of pointers, one to the
- * head of the list and the other to the tail of the list. The elements are
- * singly linked for minimum space and pointer manipulation overhead at the
- * expense of O(n) removal for arbitrary elements. New elements can be added
- * to the list after an existing element, at the head of the list, or at the
- * end of the list. Elements being removed from the head of the tail queue
- * should use the explicit macro for this purpose for optimum efficiency.
- * A singly-linked tail queue may only be traversed in the forward direction.
- * Singly-linked tail queues are ideal for applications with large datasets
- * and few or no removals or for implementing a FIFO queue.
- *
- * A list is headed by a single forward pointer (or an array of forward
- * pointers for a hash table header). The elements are doubly linked
- * so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before
- * or after an existing element or at the head of the list. A list
- * may be traversed in either direction.
- *
- * A tail queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or
- * after an existing element, at the head of the list, or at the end of
- * the list. A tail queue may be traversed in either direction.
- *
- * For details on the use of these macros, see the queue(3) manual page.
- *
- *
- *				SLIST	LIST	STAILQ	TAILQ
- * _HEAD			+	+	+	+
- * _HEAD_INITIALIZER		+	+	+	+
- * _ENTRY			+	+	+	+
- * _INIT			+	+	+	+
- * _EMPTY			+	+	+	+
- * _FIRST			+	+	+	+
- * _NEXT			+	+	+	+
- * _PREV			-	+	-	+
- * _LAST			-	-	+	+
- * _FOREACH			+	+	+	+
- * _FOREACH_FROM		+	+	+	+
- * _FOREACH_SAFE		+	+	+	+
- * _FOREACH_FROM_SAFE		+	+	+	+
- * _FOREACH_REVERSE		-	-	-	+
- * _FOREACH_REVERSE_FROM	-	-	-	+
- * _FOREACH_REVERSE_SAFE	-	-	-	+
- * _FOREACH_REVERSE_FROM_SAFE	-	-	-	+
- * _INSERT_HEAD			+	+	+	+
- * _INSERT_BEFORE		-	+	-	+
- * _INSERT_AFTER		+	+	+	+
- * _INSERT_TAIL			-	-	+	+
- * _CONCAT			-	-	+	+
- * _REMOVE_AFTER		+	-	+	-
- * _REMOVE_HEAD			+	-	+	-
- * _REMOVE			+	+	+	+
- * _SWAP			+	+	+	+
- *
- */
-#ifdef QUEUE_MACRO_DEBUG
-/* Store the last 2 places the queue element or head was altered */
-struct qm_trace {
-	unsigned long	 lastline;
-	unsigned long	 prevline;
-	const char	*lastfile;
-	const char	*prevfile;
-};
-
-#define	TRACEBUF	struct qm_trace trace;
-#define	TRACEBUF_INITIALIZER	{ __FILE__, __LINE__, NULL, 0 } ,
-#define	TRASHIT(x)	do {(x) = (void *)-1;} while (0)
-#define	QMD_SAVELINK(name, link)	void **name = (void *)&(link)
-
-#define	QMD_TRACE_HEAD(head) do {					\
-	(head)->trace.prevline = (head)->trace.lastline;		\
-	(head)->trace.prevfile = (head)->trace.lastfile;		\
-	(head)->trace.lastline = __LINE__;				\
-	(head)->trace.lastfile = __FILE__;				\
-} while (0)
-
-#define	QMD_TRACE_ELEM(elem) do {					\
-	(elem)->trace.prevline = (elem)->trace.lastline;		\
-	(elem)->trace.prevfile = (elem)->trace.lastfile;		\
-	(elem)->trace.lastline = __LINE__;				\
-	(elem)->trace.lastfile = __FILE__;				\
-} while (0)
-
-#else
-#define	QMD_TRACE_ELEM(elem)
-#define	QMD_TRACE_HEAD(head)
-#define	QMD_SAVELINK(name, link)
-#define	TRACEBUF
-#define	TRACEBUF_INITIALIZER
-#define	TRASHIT(x)
-#endif	/* QUEUE_MACRO_DEBUG */
-
-/*
- * Singly-linked List declarations.
- */
-#define	SLIST_HEAD(name, type)						\
-struct name {								\
-	struct type *slh_first;	/* first element */			\
-}
-
-#define	SLIST_HEAD_INITIALIZER(head)					\
-	{ NULL }
-
-#define	SLIST_ENTRY(type)						\
-struct {								\
-	struct type *sle_next;	/* next element */			\
-}
-
-/*
- * Singly-linked List functions.
- */
-#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
-
-#define	SLIST_FIRST(head)	((head)->slh_first)
-
-#define	SLIST_FOREACH(var, head, field)					\
-	for ((var) = SLIST_FIRST((head));				\
-	    (var);							\
-	    (var) = SLIST_NEXT((var), field))
-
-#define	SLIST_FOREACH_FROM(var, head, field)				\
-	for ((var) = ((var) ? (var) : SLIST_FIRST((head)));		\
-	    (var);							\
-	    (var) = SLIST_NEXT((var), field))
-
-#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = SLIST_FIRST((head));				\
-	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	SLIST_FOREACH_FROM_SAFE(var, head, field, tvar)			\
-	for ((var) = ((var) ? (var) : SLIST_FIRST((head)));		\
-	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
-	for ((varp) = &SLIST_FIRST((head));				\
-	    ((var) = *(varp)) != NULL;					\
-	    (varp) = &SLIST_NEXT((var), field))
-
-#define	SLIST_INIT(head) do {						\
-	SLIST_FIRST((head)) = NULL;					\
-} while (0)
-
-#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
-	SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);	\
-	SLIST_NEXT((slistelm), field) = (elm);				\
-} while (0)
-
-#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
-	SLIST_NEXT((elm), field) = SLIST_FIRST((head));			\
-	SLIST_FIRST((head)) = (elm);					\
-} while (0)
-
-#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
-
-#define	SLIST_REMOVE(head, elm, type, field) do {			\
-	QMD_SAVELINK(oldnext, (elm)->field.sle_next);			\
-	if (SLIST_FIRST((head)) == (elm)) {				\
-		SLIST_REMOVE_HEAD((head), field);			\
-	}								\
-	else {								\
-		struct type *curelm = SLIST_FIRST((head));		\
-		while (SLIST_NEXT(curelm, field) != (elm))		\
-			curelm = SLIST_NEXT(curelm, field);		\
-		SLIST_REMOVE_AFTER(curelm, field);			\
-	}								\
-	TRASHIT(*oldnext);						\
-} while (0)
-
-#define SLIST_REMOVE_AFTER(elm, field) do {				\
-	SLIST_NEXT(elm, field) =					\
-	    SLIST_NEXT(SLIST_NEXT(elm, field), field);			\
-} while (0)
-
-#define	SLIST_REMOVE_HEAD(head, field) do {				\
-	SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);	\
-} while (0)
-
-#define SLIST_SWAP(head1, head2, type) do {				\
-	struct type *swap_first = SLIST_FIRST(head1);			\
-	SLIST_FIRST(head1) = SLIST_FIRST(head2);			\
-	SLIST_FIRST(head2) = swap_first;				\
-} while (0)
-
-/*
- * Singly-linked Tail queue declarations.
- */
-#define	STAILQ_HEAD(name, type)						\
-struct name {								\
-	struct type *stqh_first;/* first element */			\
-	struct type **stqh_last;/* addr of last next element */		\
-}
-
-#define	STAILQ_HEAD_INITIALIZER(head)					\
-	{ NULL, &(head).stqh_first }
-
-#define	STAILQ_ENTRY(type)						\
-struct {								\
-	struct type *stqe_next;	/* next element */			\
-}
-
-/*
- * Singly-linked Tail queue functions.
- */
-#define	STAILQ_CONCAT(head1, head2) do {				\
-	if (!STAILQ_EMPTY((head2))) {					\
-		*(head1)->stqh_last = (head2)->stqh_first;		\
-		(head1)->stqh_last = (head2)->stqh_last;		\
-		STAILQ_INIT((head2));					\
-	}								\
-} while (0)
-
-#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
-
-#define	STAILQ_FIRST(head)	((head)->stqh_first)
-
-#define	STAILQ_FOREACH(var, head, field)				\
-	for((var) = STAILQ_FIRST((head));				\
-	   (var);							\
-	   (var) = STAILQ_NEXT((var), field))
-
-#define	STAILQ_FOREACH_FROM(var, head, field)				\
-	for ((var) = ((var) ? (var) : STAILQ_FIRST((head)));		\
-	   (var);							\
-	   (var) = STAILQ_NEXT((var), field))
-
-#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = STAILQ_FIRST((head));				\
-	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)		\
-	for ((var) = ((var) ? (var) : STAILQ_FIRST((head)));		\
-	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	STAILQ_INIT(head) do {						\
-	STAILQ_FIRST((head)) = NULL;					\
-	(head)->stqh_last = &STAILQ_FIRST((head));			\
-} while (0)
-
-#define	STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\
-	if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-	STAILQ_NEXT((tqelm), field) = (elm);				\
-} while (0)
-
-#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
-	if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)	\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-	STAILQ_FIRST((head)) = (elm);					\
-} while (0)
-
-#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
-	STAILQ_NEXT((elm), field) = NULL;				\
-	*(head)->stqh_last = (elm);					\
-	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\
-} while (0)
-
-#define	STAILQ_LAST(head, type, field)					\
-	(STAILQ_EMPTY((head)) ? NULL :					\
-	    __containerof((head)->stqh_last, struct type, field.stqe_next))
-
-#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
-
-#define	STAILQ_REMOVE(head, elm, type, field) do {			\
-	QMD_SAVELINK(oldnext, (elm)->field.stqe_next);			\
-	if (STAILQ_FIRST((head)) == (elm)) {				\
-		STAILQ_REMOVE_HEAD((head), field);			\
-	}								\
-	else {								\
-		struct type *curelm = STAILQ_FIRST((head));		\
-		while (STAILQ_NEXT(curelm, field) != (elm))		\
-			curelm = STAILQ_NEXT(curelm, field);		\
-		STAILQ_REMOVE_AFTER(head, curelm, field);		\
-	}								\
-	TRASHIT(*oldnext);						\
-} while (0)
-
-#define STAILQ_REMOVE_AFTER(head, elm, field) do {			\
-	if ((STAILQ_NEXT(elm, field) =					\
-	     STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL)	\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-} while (0)
-
-#define	STAILQ_REMOVE_HEAD(head, field) do {				\
-	if ((STAILQ_FIRST((head)) =					\
-	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
-		(head)->stqh_last = &STAILQ_FIRST((head));		\
-} while (0)
-
-#define STAILQ_SWAP(head1, head2, type) do {				\
-	struct type *swap_first = STAILQ_FIRST(head1);			\
-	struct type **swap_last = (head1)->stqh_last;			\
-	STAILQ_FIRST(head1) = STAILQ_FIRST(head2);			\
-	(head1)->stqh_last = (head2)->stqh_last;			\
-	STAILQ_FIRST(head2) = swap_first;				\
-	(head2)->stqh_last = swap_last;					\
-	if (STAILQ_EMPTY(head1))					\
-		(head1)->stqh_last = &STAILQ_FIRST(head1);		\
-	if (STAILQ_EMPTY(head2))					\
-		(head2)->stqh_last = &STAILQ_FIRST(head2);		\
-} while (0)
-
-
-/*
- * List declarations.
- */
-#define	LIST_HEAD(name, type)						\
-struct name {								\
-	struct type *lh_first;	/* first element */			\
-}
-
-#define	LIST_HEAD_INITIALIZER(head)					\
-	{ NULL }
-
-#define	LIST_ENTRY(type)						\
-struct {								\
-	struct type *le_next;	/* next element */			\
-	struct type **le_prev;	/* address of previous next element */	\
-}
-
-/*
- * List functions.
- */
-
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define	QMD_LIST_CHECK_HEAD(head, field) do {				\
-	if (LIST_FIRST((head)) != NULL &&				\
-	    LIST_FIRST((head))->field.le_prev !=			\
-	     &LIST_FIRST((head)))					\
-		panic("Bad list head %p first->prev != head", (head));	\
-} while (0)
-
-#define	QMD_LIST_CHECK_NEXT(elm, field) do {				\
-	if (LIST_NEXT((elm), field) != NULL &&				\
-	    LIST_NEXT((elm), field)->field.le_prev !=			\
-	     &((elm)->field.le_next))					\
-	     	panic("Bad link elm %p next->prev != elm", (elm));	\
-} while (0)
-
-#define	QMD_LIST_CHECK_PREV(elm, field) do {				\
-	if (*(elm)->field.le_prev != (elm))				\
-		panic("Bad link elm %p prev->next != elm", (elm));	\
-} while (0)
-#else
-#define	QMD_LIST_CHECK_HEAD(head, field)
-#define	QMD_LIST_CHECK_NEXT(elm, field)
-#define	QMD_LIST_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define	LIST_EMPTY(head)	((head)->lh_first == NULL)
-
-#define	LIST_FIRST(head)	((head)->lh_first)
-
-#define	LIST_FOREACH(var, head, field)					\
-	for ((var) = LIST_FIRST((head));				\
-	    (var);							\
-	    (var) = LIST_NEXT((var), field))
-
-#define	LIST_FOREACH_FROM(var, head, field)				\
-	for ((var) = ((var) ? (var) : LIST_FIRST((head)));		\
-	    (var);							\
-	    (var) = LIST_NEXT((var), field))
-
-#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = LIST_FIRST((head));				\
-	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	LIST_FOREACH_FROM_SAFE(var, head, field, tvar)			\
-	for ((var) = ((var) ? (var) : LIST_FIRST((head)));		\
-	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	LIST_INIT(head) do {						\
-	LIST_FIRST((head)) = NULL;					\
-} while (0)
-
-#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
-	QMD_LIST_CHECK_NEXT(listelm, field);				\
-	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
-		LIST_NEXT((listelm), field)->field.le_prev =		\
-		    &LIST_NEXT((elm), field);				\
-	LIST_NEXT((listelm), field) = (elm);				\
-	(elm)->field.le_prev = &LIST_NEXT((listelm), field);		\
-} while (0)
-
-#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
-	QMD_LIST_CHECK_PREV(listelm, field);				\
-	(elm)->field.le_prev = (listelm)->field.le_prev;		\
-	LIST_NEXT((elm), field) = (listelm);				\
-	*(listelm)->field.le_prev = (elm);				\
-	(listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
-} while (0)
-
-#define	LIST_INSERT_HEAD(head, elm, field) do {				\
-	QMD_LIST_CHECK_HEAD((head), field);				\
-	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\
-		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
-	LIST_FIRST((head)) = (elm);					\
-	(elm)->field.le_prev = &LIST_FIRST((head));			\
-} while (0)
-
-#define	LIST_NEXT(elm, field)	((elm)->field.le_next)
-
-#define	LIST_PREV(elm, head, type, field)				\
-	((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL :		\
-	    __containerof((elm)->field.le_prev, struct type, field.le_next))
-
-#define	LIST_REMOVE(elm, field) do {					\
-	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\
-	QMD_SAVELINK(oldprev, (elm)->field.le_prev);			\
-	QMD_LIST_CHECK_NEXT(elm, field);				\
-	QMD_LIST_CHECK_PREV(elm, field);				\
-	if (LIST_NEXT((elm), field) != NULL)				\
-		LIST_NEXT((elm), field)->field.le_prev = 		\
-		    (elm)->field.le_prev;				\
-	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\
-	TRASHIT(*oldnext);						\
-	TRASHIT(*oldprev);						\
-} while (0)
-
-#define LIST_SWAP(head1, head2, type, field) do {			\
-	struct type *swap_tmp = LIST_FIRST((head1));			\
-	LIST_FIRST((head1)) = LIST_FIRST((head2));			\
-	LIST_FIRST((head2)) = swap_tmp;					\
-	if ((swap_tmp = LIST_FIRST((head1))) != NULL)			\
-		swap_tmp->field.le_prev = &LIST_FIRST((head1));		\
-	if ((swap_tmp = LIST_FIRST((head2))) != NULL)			\
-		swap_tmp->field.le_prev = &LIST_FIRST((head2));		\
-} while (0)
-
-/*
- * Tail queue declarations.
- */
-#define	TAILQ_HEAD(name, type)						\
-struct name {								\
-	struct type *tqh_first;	/* first element */			\
-	struct type **tqh_last;	/* addr of last next element */		\
-	TRACEBUF							\
-}
-
-#define	TAILQ_HEAD_INITIALIZER(head)					\
-	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
-
-#define	TAILQ_ENTRY(type)						\
-struct {								\
-	struct type *tqe_next;	/* next element */			\
-	struct type **tqe_prev;	/* address of previous next element */	\
-	TRACEBUF							\
-}
-
-/*
- * Tail queue functions.
- */
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define	QMD_TAILQ_CHECK_HEAD(head, field) do {				\
-	if (!TAILQ_EMPTY(head) &&					\
-	    TAILQ_FIRST((head))->field.tqe_prev !=			\
-	     &TAILQ_FIRST((head)))					\
-		panic("Bad tailq head %p first->prev != head", (head));	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_TAIL(head, field) do {				\
-	if (*(head)->tqh_last != NULL)					\
-	    	panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); 	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_NEXT(elm, field) do {				\
-	if (TAILQ_NEXT((elm), field) != NULL &&				\
-	    TAILQ_NEXT((elm), field)->field.tqe_prev !=			\
-	     &((elm)->field.tqe_next))					\
-		panic("Bad link elm %p next->prev != elm", (elm));	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_PREV(elm, field) do {				\
-	if (*(elm)->field.tqe_prev != (elm))				\
-		panic("Bad link elm %p prev->next != elm", (elm));	\
-} while (0)
-#else
-#define	QMD_TAILQ_CHECK_HEAD(head, field)
-#define	QMD_TAILQ_CHECK_TAIL(head, headname)
-#define	QMD_TAILQ_CHECK_NEXT(elm, field)
-#define	QMD_TAILQ_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define	TAILQ_CONCAT(head1, head2, field) do {				\
-	if (!TAILQ_EMPTY(head2)) {					\
-		*(head1)->tqh_last = (head2)->tqh_first;		\
-		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
-		(head1)->tqh_last = (head2)->tqh_last;			\
-		TAILQ_INIT((head2));					\
-		QMD_TRACE_HEAD(head1);					\
-		QMD_TRACE_HEAD(head2);					\
-	}								\
-} while (0)
-
-#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
-
-#define	TAILQ_FIRST(head)	((head)->tqh_first)
-
-#define	TAILQ_FOREACH(var, head, field)					\
-	for ((var) = TAILQ_FIRST((head));				\
-	    (var);							\
-	    (var) = TAILQ_NEXT((var), field))
-
-#define	TAILQ_FOREACH_FROM(var, head, field)				\
-	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
-	    (var);							\
-	    (var) = TAILQ_NEXT((var), field))
-
-#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = TAILQ_FIRST((head));				\
-	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\
-	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\
-	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
-	for ((var) = TAILQ_LAST((head), headname);			\
-	    (var);							\
-	    (var) = TAILQ_PREV((var), headname, field))
-
-#define	TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\
-	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
-	    (var);							\
-	    (var) = TAILQ_PREV((var), headname, field))
-
-#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
-	for ((var) = TAILQ_LAST((head), headname);			\
-	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
-	    (var) = (tvar))
-
-#define	TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
-	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\
-	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
-	    (var) = (tvar))
-
-#define	TAILQ_INIT(head) do {						\
-	TAILQ_FIRST((head)) = NULL;					\
-	(head)->tqh_last = &TAILQ_FIRST((head));			\
-	QMD_TRACE_HEAD(head);						\
-} while (0)
-
-#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
-	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
-	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
-		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
-		    &TAILQ_NEXT((elm), field);				\
-	else {								\
-		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
-		QMD_TRACE_HEAD(head);					\
-	}								\
-	TAILQ_NEXT((listelm), field) = (elm);				\
-	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-	QMD_TRACE_ELEM(&listelm->field);				\
-} while (0)
-
-#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
-	QMD_TAILQ_CHECK_PREV(listelm, field);				\
-	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
-	TAILQ_NEXT((elm), field) = (listelm);				\
-	*(listelm)->field.tqe_prev = (elm);				\
-	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-	QMD_TRACE_ELEM(&listelm->field);				\
-} while (0)
-
-#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
-	QMD_TAILQ_CHECK_HEAD(head, field);				\
-	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
-		TAILQ_FIRST((head))->field.tqe_prev =			\
-		    &TAILQ_NEXT((elm), field);				\
-	else								\
-		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
-	TAILQ_FIRST((head)) = (elm);					\
-	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
-	QMD_TRACE_HEAD(head);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
-	QMD_TAILQ_CHECK_TAIL(head, field);				\
-	TAILQ_NEXT((elm), field) = NULL;				\
-	(elm)->field.tqe_prev = (head)->tqh_last;			\
-	*(head)->tqh_last = (elm);					\
-	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
-	QMD_TRACE_HEAD(head);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define	TAILQ_LAST(head, headname)					\
-	(*(((struct headname *)((head)->tqh_last))->tqh_last))
-
-#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
-
-#define	TAILQ_PREV(elm, headname, field)				\
-	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
-
-#define	TAILQ_REMOVE(head, elm, field) do {				\
-	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
-	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
-	QMD_TAILQ_CHECK_NEXT(elm, field);				\
-	QMD_TAILQ_CHECK_PREV(elm, field);				\
-	if ((TAILQ_NEXT((elm), field)) != NULL)				\
-		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
-		    (elm)->field.tqe_prev;				\
-	else {								\
-		(head)->tqh_last = (elm)->field.tqe_prev;		\
-		QMD_TRACE_HEAD(head);					\
-	}								\
-	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
-	TRASHIT(*oldnext);						\
-	TRASHIT(*oldprev);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define TAILQ_SWAP(head1, head2, type, field) do {			\
-	struct type *swap_first = (head1)->tqh_first;			\
-	struct type **swap_last = (head1)->tqh_last;			\
-	(head1)->tqh_first = (head2)->tqh_first;			\
-	(head1)->tqh_last = (head2)->tqh_last;				\
-	(head2)->tqh_first = swap_first;				\
-	(head2)->tqh_last = swap_last;					\
-	if ((swap_first = (head1)->tqh_first) != NULL)			\
-		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
-	else								\
-		(head1)->tqh_last = &(head1)->tqh_first;		\
-	if ((swap_first = (head2)->tqh_first) != NULL)			\
-		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
-	else								\
-		(head2)->tqh_last = &(head2)->tqh_first;		\
-} while (0)
-
-#endif /* !_SYS_QUEUE_H_ */

+ 0 - 53
src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h

@@ -1,53 +0,0 @@
-/* $Id: tmpfileplus.h $ */
-/*
- * $Date: 2016-06-01 03:31Z $
- * $Revision: 2.0.0 $
- * $Author: dai $
- */
-
-/*
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * Copyright (c) 2012-16 David Ireland, DI Management Services Pty Ltd
- * <http://www.di-mgt.com.au/contact/>.
- */
-
-#if _MSC_VER > 1000
-#pragma once
-#endif
-
-#ifndef TMPFILEPLUS_H_
-#define TMPFILEPLUS_H_
-
-#include <stdio.h>
-
-/** Create a unique temporary file.
-@param dir (optional) directory to create file. If NULL use default TMP directory.
-@param prefix (optional) prefix for file name. If NULL use "tmp.".
-@param pathname (optional) pointer to a buffer to receive the temp filename. 
-	Allocated using `malloc()`; user to free. Ignored if NULL.
-@param keep If `keep` is nonzero and `pathname` is not NULL, then keep the file after closing. 
-	Otherwise file is automatically deleted when closed.
-@return Pointer to stream opened in binary read/write (w+b) mode, or a null pointer on error.
-@exception ENOMEM Not enough memory to allocate filename.
-*/
-FILE *tmpfileplus(const char *dir, const char *prefix, char **pathname, int keep);
-
-
-/** Create a unique temporary file with filename stored in a fixed-length buffer.
-@param dir (optional) directory to create file. If NULL use default directory.
-@param prefix (optional) prefix for file name. If NULL use "tmp.".
-@param pathnamebuf (optional) buffer to receive full pathname of temporary file. Ignored if NULL.
-@param pathsize Size of buffer to receive filename and its terminating null character.
-@param keep If `keep` is nonzero and `pathname` is not NULL, then keep the file after closing.
-	Otherwise file is automatically deleted when closed.
-@return Pointer to stream opened in binary read/write (w+b) mode, or a null pointer on error.
-@exception E2BIG Resulting filename is too big for the buffer `pathnamebuf`.
-*/
-FILE *tmpfileplus_f(const char *dir, const char *prefix, char *pathnamebuf, size_t pathsize, int keep);
-
-#define TMPFILE_KEEP 1
-
-#endif /* end TMPFILEPLUS_H_ */

+ 0 - 801
src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/tree.h

@@ -1,801 +0,0 @@
-/*	$NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $	*/
-/*	$OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $	*/
-/* $FreeBSD$ */
-
-/*-
- * Copyright 2002 Niels Provos <provos@citi.umich.edu>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef	_SYS_TREE_H_
-#define	_SYS_TREE_H_
-
-/* #include <sys/cdefs.h> */
-
-/*
- * This file defines data structures for different types of trees:
- * splay trees and red-black trees.
- *
- * A splay tree is a self-organizing data structure.  Every operation
- * on the tree causes a splay to happen.  The splay moves the requested
- * node to the root of the tree and partly rebalances it.
- *
- * This has the benefit that request locality causes faster lookups as
- * the requested nodes move to the top of the tree.  On the other hand,
- * every lookup causes memory writes.
- *
- * The Balance Theorem bounds the total access time for m operations
- * and n inserts on an initially empty tree as O((m + n)lg n).  The
- * amortized cost for a sequence of m accesses to a splay tree is O(lg n);
- *
- * A red-black tree is a binary search tree with the node color as an
- * extra attribute.  It fulfills a set of conditions:
- *	- every search path from the root to a leaf consists of the
- *	  same number of black nodes,
- *	- each red node (except for the root) has a black parent,
- *	- each leaf node is black.
- *
- * Every operation on a red-black tree is bounded as O(lg n).
- * The maximum height of a red-black tree is 2lg (n+1).
- */
-
-#define SPLAY_HEAD(name, type)						\
-struct name {								\
-	struct type *sph_root; /* root of the tree */			\
-}
-
-#define SPLAY_INITIALIZER(root)						\
-	{ NULL }
-
-#define SPLAY_INIT(root) do {						\
-	(root)->sph_root = NULL;					\
-} while (/*CONSTCOND*/ 0)
-
-#define SPLAY_ENTRY(type)						\
-struct {								\
-	struct type *spe_left; /* left element */			\
-	struct type *spe_right; /* right element */			\
-}
-
-#define SPLAY_LEFT(elm, field)		(elm)->field.spe_left
-#define SPLAY_RIGHT(elm, field)		(elm)->field.spe_right
-#define SPLAY_ROOT(head)		(head)->sph_root
-#define SPLAY_EMPTY(head)		(SPLAY_ROOT(head) == NULL)
-
-/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
-#define SPLAY_ROTATE_RIGHT(head, tmp, field) do {			\
-	SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field);	\
-	SPLAY_RIGHT(tmp, field) = (head)->sph_root;			\
-	(head)->sph_root = tmp;						\
-} while (/*CONSTCOND*/ 0)
-
-#define SPLAY_ROTATE_LEFT(head, tmp, field) do {			\
-	SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field);	\
-	SPLAY_LEFT(tmp, field) = (head)->sph_root;			\
-	(head)->sph_root = tmp;						\
-} while (/*CONSTCOND*/ 0)
-
-#define SPLAY_LINKLEFT(head, tmp, field) do {				\
-	SPLAY_LEFT(tmp, field) = (head)->sph_root;			\
-	tmp = (head)->sph_root;						\
-	(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);		\
-} while (/*CONSTCOND*/ 0)
-
-#define SPLAY_LINKRIGHT(head, tmp, field) do {				\
-	SPLAY_RIGHT(tmp, field) = (head)->sph_root;			\
-	tmp = (head)->sph_root;						\
-	(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);	\
-} while (/*CONSTCOND*/ 0)
-
-#define SPLAY_ASSEMBLE(head, node, left, right, field) do {		\
-	SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field);	\
-	SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
-	SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field);	\
-	SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field);	\
-} while (/*CONSTCOND*/ 0)
-
-/* Generates prototypes and inline functions */
-
-#define SPLAY_PROTOTYPE(name, type, field, cmp)				\
-void name##_SPLAY(struct name *, struct type *);			\
-void name##_SPLAY_MINMAX(struct name *, int);				\
-struct type *name##_SPLAY_INSERT(struct name *, struct type *);		\
-struct type *name##_SPLAY_REMOVE(struct name *, struct type *);		\
-									\
-/* Finds the node with the same key as elm */				\
-static __inline struct type *						\
-name##_SPLAY_FIND(struct name *head, struct type *elm)			\
-{									\
-	if (SPLAY_EMPTY(head))						\
-		return(NULL);						\
-	name##_SPLAY(head, elm);					\
-	if ((cmp)(elm, (head)->sph_root) == 0)				\
-		return (head->sph_root);				\
-	return (NULL);							\
-}									\
-									\
-static __inline struct type *						\
-name##_SPLAY_NEXT(struct name *head, struct type *elm)			\
-{									\
-	name##_SPLAY(head, elm);					\
-	if (SPLAY_RIGHT(elm, field) != NULL) {				\
-		elm = SPLAY_RIGHT(elm, field);				\
-		while (SPLAY_LEFT(elm, field) != NULL) {		\
-			elm = SPLAY_LEFT(elm, field);			\
-		}							\
-	} else								\
-		elm = NULL;						\
-	return (elm);							\
-}									\
-									\
-static __inline struct type *						\
-name##_SPLAY_MIN_MAX(struct name *head, int val)			\
-{									\
-	name##_SPLAY_MINMAX(head, val);					\
-        return (SPLAY_ROOT(head));					\
-}
-
-/* Main splay operation.
- * Moves node close to the key of elm to top
- */
-#define SPLAY_GENERATE(name, type, field, cmp)				\
-struct type *								\
-name##_SPLAY_INSERT(struct name *head, struct type *elm)		\
-{									\
-    if (SPLAY_EMPTY(head)) {						\
-	    SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL;	\
-    } else {								\
-	    int __comp;							\
-	    name##_SPLAY(head, elm);					\
-	    __comp = (cmp)(elm, (head)->sph_root);			\
-	    if(__comp < 0) {						\
-		    SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
-		    SPLAY_RIGHT(elm, field) = (head)->sph_root;		\
-		    SPLAY_LEFT((head)->sph_root, field) = NULL;		\
-	    } else if (__comp > 0) {					\
-		    SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
-		    SPLAY_LEFT(elm, field) = (head)->sph_root;		\
-		    SPLAY_RIGHT((head)->sph_root, field) = NULL;	\
-	    } else							\
-		    return ((head)->sph_root);				\
-    }									\
-    (head)->sph_root = (elm);						\
-    return (NULL);							\
-}									\
-									\
-struct type *								\
-name##_SPLAY_REMOVE(struct name *head, struct type *elm)		\
-{									\
-	struct type *__tmp;						\
-	if (SPLAY_EMPTY(head))						\
-		return (NULL);						\
-	name##_SPLAY(head, elm);					\
-	if ((cmp)(elm, (head)->sph_root) == 0) {			\
-		if (SPLAY_LEFT((head)->sph_root, field) == NULL) {	\
-			(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
-		} else {						\
-			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
-			(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
-			name##_SPLAY(head, elm);			\
-			SPLAY_RIGHT((head)->sph_root, field) = __tmp;	\
-		}							\
-		return (elm);						\
-	}								\
-	return (NULL);							\
-}									\
-									\
-void									\
-name##_SPLAY(struct name *head, struct type *elm)			\
-{									\
-	struct type __node, *__left, *__right, *__tmp;			\
-	int __comp;							\
-\
-	SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
-	__left = __right = &__node;					\
-\
-	while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) {		\
-		if (__comp < 0) {					\
-			__tmp = SPLAY_LEFT((head)->sph_root, field);	\
-			if (__tmp == NULL)				\
-				break;					\
-			if ((cmp)(elm, __tmp) < 0){			\
-				SPLAY_ROTATE_RIGHT(head, __tmp, field);	\
-				if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
-					break;				\
-			}						\
-			SPLAY_LINKLEFT(head, __right, field);		\
-		} else if (__comp > 0) {				\
-			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
-			if (__tmp == NULL)				\
-				break;					\
-			if ((cmp)(elm, __tmp) > 0){			\
-				SPLAY_ROTATE_LEFT(head, __tmp, field);	\
-				if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
-					break;				\
-			}						\
-			SPLAY_LINKRIGHT(head, __left, field);		\
-		}							\
-	}								\
-	SPLAY_ASSEMBLE(head, &__node, __left, __right, field);		\
-}									\
-									\
-/* Splay with either the minimum or the maximum element			\
- * Used to find minimum or maximum element in tree.			\
- */									\
-void name##_SPLAY_MINMAX(struct name *head, int __comp) \
-{									\
-	struct type __node, *__left, *__right, *__tmp;			\
-\
-	SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
-	__left = __right = &__node;					\
-\
-	while (1) {							\
-		if (__comp < 0) {					\
-			__tmp = SPLAY_LEFT((head)->sph_root, field);	\
-			if (__tmp == NULL)				\
-				break;					\
-			if (__comp < 0){				\
-				SPLAY_ROTATE_RIGHT(head, __tmp, field);	\
-				if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
-					break;				\
-			}						\
-			SPLAY_LINKLEFT(head, __right, field);		\
-		} else if (__comp > 0) {				\
-			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
-			if (__tmp == NULL)				\
-				break;					\
-			if (__comp > 0) {				\
-				SPLAY_ROTATE_LEFT(head, __tmp, field);	\
-				if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
-					break;				\
-			}						\
-			SPLAY_LINKRIGHT(head, __left, field);		\
-		}							\
-	}								\
-	SPLAY_ASSEMBLE(head, &__node, __left, __right, field);		\
-}
-
-#define SPLAY_NEGINF	-1
-#define SPLAY_INF	1
-
-#define SPLAY_INSERT(name, x, y)	name##_SPLAY_INSERT(x, y)
-#define SPLAY_REMOVE(name, x, y)	name##_SPLAY_REMOVE(x, y)
-#define SPLAY_FIND(name, x, y)		name##_SPLAY_FIND(x, y)
-#define SPLAY_NEXT(name, x, y)		name##_SPLAY_NEXT(x, y)
-#define SPLAY_MIN(name, x)		(SPLAY_EMPTY(x) ? NULL	\
-					: name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
-#define SPLAY_MAX(name, x)		(SPLAY_EMPTY(x) ? NULL	\
-					: name##_SPLAY_MIN_MAX(x, SPLAY_INF))
-
-#define SPLAY_FOREACH(x, name, head)					\
-	for ((x) = SPLAY_MIN(name, head);				\
-	     (x) != NULL;						\
-	     (x) = SPLAY_NEXT(name, head, x))
-
-/* Macros that define a red-black tree */
-#define RB_HEAD(name, type)						\
-struct name {								\
-	struct type *rbh_root; /* root of the tree */			\
-}
-
-#define RB_INITIALIZER(root)						\
-	{ NULL }
-
-#define RB_INIT(root) do {						\
-	(root)->rbh_root = NULL;					\
-} while (/*CONSTCOND*/ 0)
-
-#define RB_BLACK	0
-#define RB_RED		1
-#define RB_ENTRY(type)							\
-struct {								\
-	struct type *rbe_left;		/* left element */		\
-	struct type *rbe_right;		/* right element */		\
-	struct type *rbe_parent;	/* parent element */		\
-	int rbe_color;			/* node color */		\
-}
-
-#define RB_LEFT(elm, field)		(elm)->field.rbe_left
-#define RB_RIGHT(elm, field)		(elm)->field.rbe_right
-#define RB_PARENT(elm, field)		(elm)->field.rbe_parent
-#define RB_COLOR(elm, field)		(elm)->field.rbe_color
-#define RB_ROOT(head)			(head)->rbh_root
-#define RB_EMPTY(head)			(RB_ROOT(head) == NULL)
-
-#define RB_SET(elm, parent, field) do {					\
-	RB_PARENT(elm, field) = parent;					\
-	RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL;		\
-	RB_COLOR(elm, field) = RB_RED;					\
-} while (/*CONSTCOND*/ 0)
-
-#define RB_SET_BLACKRED(black, red, field) do {				\
-	RB_COLOR(black, field) = RB_BLACK;				\
-	RB_COLOR(red, field) = RB_RED;					\
-} while (/*CONSTCOND*/ 0)
-
-#ifndef RB_AUGMENT
-#define RB_AUGMENT(x)	do {} while (0)
-#endif
-
-#define RB_ROTATE_LEFT(head, elm, tmp, field) do {			\
-	(tmp) = RB_RIGHT(elm, field);					\
-	if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) {	\
-		RB_PARENT(RB_LEFT(tmp, field), field) = (elm);		\
-	}								\
-	RB_AUGMENT(elm);						\
-	if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {	\
-		if ((elm) == RB_LEFT(RB_PARENT(elm, field), field))	\
-			RB_LEFT(RB_PARENT(elm, field), field) = (tmp);	\
-		else							\
-			RB_RIGHT(RB_PARENT(elm, field), field) = (tmp);	\
-	} else								\
-		(head)->rbh_root = (tmp);				\
-	RB_LEFT(tmp, field) = (elm);					\
-	RB_PARENT(elm, field) = (tmp);					\
-	RB_AUGMENT(tmp);						\
-	if ((RB_PARENT(tmp, field)))					\
-		RB_AUGMENT(RB_PARENT(tmp, field));			\
-} while (/*CONSTCOND*/ 0)
-
-#define RB_ROTATE_RIGHT(head, elm, tmp, field) do {			\
-	(tmp) = RB_LEFT(elm, field);					\
-	if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) {	\
-		RB_PARENT(RB_RIGHT(tmp, field), field) = (elm);		\
-	}								\
-	RB_AUGMENT(elm);						\
-	if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {	\
-		if ((elm) == RB_LEFT(RB_PARENT(elm, field), field))	\
-			RB_LEFT(RB_PARENT(elm, field), field) = (tmp);	\
-		else							\
-			RB_RIGHT(RB_PARENT(elm, field), field) = (tmp);	\
-	} else								\
-		(head)->rbh_root = (tmp);				\
-	RB_RIGHT(tmp, field) = (elm);					\
-	RB_PARENT(elm, field) = (tmp);					\
-	RB_AUGMENT(tmp);						\
-	if ((RB_PARENT(tmp, field)))					\
-		RB_AUGMENT(RB_PARENT(tmp, field));			\
-} while (/*CONSTCOND*/ 0)
-
-/* Generates prototypes and inline functions */
-#define	RB_PROTOTYPE(name, type, field, cmp)				\
-	RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
-#define	RB_PROTOTYPE_STATIC(name, type, field, cmp)			\
-	RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
-#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr)		\
-	RB_PROTOTYPE_INSERT_COLOR(name, type, attr);			\
-	RB_PROTOTYPE_REMOVE_COLOR(name, type, attr);			\
-	RB_PROTOTYPE_INSERT(name, type, attr);				\
-	RB_PROTOTYPE_REMOVE(name, type, attr);				\
-	RB_PROTOTYPE_FIND(name, type, attr);				\
-	RB_PROTOTYPE_NFIND(name, type, attr);				\
-	RB_PROTOTYPE_NEXT(name, type, attr);				\
-	RB_PROTOTYPE_PREV(name, type, attr);				\
-	RB_PROTOTYPE_MINMAX(name, type, attr);
-#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr)			\
-	attr void name##_RB_INSERT_COLOR(struct name *, struct type *)
-#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr)			\
-	attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *)
-#define RB_PROTOTYPE_REMOVE(name, type, attr)				\
-	attr struct type *name##_RB_REMOVE(struct name *, struct type *)
-#define RB_PROTOTYPE_INSERT(name, type, attr)				\
-	attr struct type *name##_RB_INSERT(struct name *, struct type *)
-#define RB_PROTOTYPE_FIND(name, type, attr)				\
-	attr struct type *name##_RB_FIND(struct name *, struct type *)
-#define RB_PROTOTYPE_NFIND(name, type, attr)				\
-	attr struct type *name##_RB_NFIND(struct name *, struct type *)
-#define RB_PROTOTYPE_NEXT(name, type, attr)				\
-	attr struct type *name##_RB_NEXT(struct type *)
-#define RB_PROTOTYPE_PREV(name, type, attr)				\
-	attr struct type *name##_RB_PREV(struct type *)
-#define RB_PROTOTYPE_MINMAX(name, type, attr)				\
-	attr struct type *name##_RB_MINMAX(struct name *, int)
-
-/* Main rb operation.
- * Moves node close to the key of elm to top
- */
-#define	RB_GENERATE(name, type, field, cmp)				\
-	RB_GENERATE_INTERNAL(name, type, field, cmp,)
-#define	RB_GENERATE_STATIC(name, type, field, cmp)			\
-	RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
-#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr)		\
-	RB_GENERATE_INSERT_COLOR(name, type, field, attr)		\
-	RB_GENERATE_REMOVE_COLOR(name, type, field, attr)		\
-	RB_GENERATE_INSERT(name, type, field, cmp, attr)		\
-	RB_GENERATE_REMOVE(name, type, field, attr)			\
-	RB_GENERATE_FIND(name, type, field, cmp, attr)			\
-	RB_GENERATE_NFIND(name, type, field, cmp, attr)			\
-	RB_GENERATE_NEXT(name, type, field, attr)			\
-	RB_GENERATE_PREV(name, type, field, attr)			\
-	RB_GENERATE_MINMAX(name, type, field, attr)
-
-#define RB_GENERATE_INSERT_COLOR(name, type, field, attr)		\
-attr void								\
-name##_RB_INSERT_COLOR(struct name *head, struct type *elm)		\
-{									\
-	struct type *parent, *gparent, *tmp;				\
-	while ((parent = RB_PARENT(elm, field)) != NULL &&		\
-	    RB_COLOR(parent, field) == RB_RED) {			\
-		gparent = RB_PARENT(parent, field);			\
-		if (parent == RB_LEFT(gparent, field)) {		\
-			tmp = RB_RIGHT(gparent, field);			\
-			if (tmp && RB_COLOR(tmp, field) == RB_RED) {	\
-				RB_COLOR(tmp, field) = RB_BLACK;	\
-				RB_SET_BLACKRED(parent, gparent, field);\
-				elm = gparent;				\
-				continue;				\
-			}						\
-			if (RB_RIGHT(parent, field) == elm) {		\
-				RB_ROTATE_LEFT(head, parent, tmp, field);\
-				tmp = parent;				\
-				parent = elm;				\
-				elm = tmp;				\
-			}						\
-			RB_SET_BLACKRED(parent, gparent, field);	\
-			RB_ROTATE_RIGHT(head, gparent, tmp, field);	\
-		} else {						\
-			tmp = RB_LEFT(gparent, field);			\
-			if (tmp && RB_COLOR(tmp, field) == RB_RED) {	\
-				RB_COLOR(tmp, field) = RB_BLACK;	\
-				RB_SET_BLACKRED(parent, gparent, field);\
-				elm = gparent;				\
-				continue;				\
-			}						\
-			if (RB_LEFT(parent, field) == elm) {		\
-				RB_ROTATE_RIGHT(head, parent, tmp, field);\
-				tmp = parent;				\
-				parent = elm;				\
-				elm = tmp;				\
-			}						\
-			RB_SET_BLACKRED(parent, gparent, field);	\
-			RB_ROTATE_LEFT(head, gparent, tmp, field);	\
-		}							\
-	}								\
-	RB_COLOR(head->rbh_root, field) = RB_BLACK;			\
-}
-
-#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr)		\
-attr void								\
-name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
-{									\
-	struct type *tmp;						\
-	while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) &&	\
-	    elm != RB_ROOT(head)) {					\
-		if (RB_LEFT(parent, field) == elm) {			\
-			tmp = RB_RIGHT(parent, field);			\
-			if (RB_COLOR(tmp, field) == RB_RED) {		\
-				RB_SET_BLACKRED(tmp, parent, field);	\
-				RB_ROTATE_LEFT(head, parent, tmp, field);\
-				tmp = RB_RIGHT(parent, field);		\
-			}						\
-			if ((RB_LEFT(tmp, field) == NULL ||		\
-			    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
-			    (RB_RIGHT(tmp, field) == NULL ||		\
-			    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
-				RB_COLOR(tmp, field) = RB_RED;		\
-				elm = parent;				\
-				parent = RB_PARENT(elm, field);		\
-			} else {					\
-				if (RB_RIGHT(tmp, field) == NULL ||	\
-				    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
-					struct type *oleft;		\
-					if ((oleft = RB_LEFT(tmp, field)) \
-					    != NULL)			\
-						RB_COLOR(oleft, field) = RB_BLACK;\
-					RB_COLOR(tmp, field) = RB_RED;	\
-					RB_ROTATE_RIGHT(head, tmp, oleft, field);\
-					tmp = RB_RIGHT(parent, field);	\
-				}					\
-				RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
-				RB_COLOR(parent, field) = RB_BLACK;	\
-				if (RB_RIGHT(tmp, field))		\
-					RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\
-				RB_ROTATE_LEFT(head, parent, tmp, field);\
-				elm = RB_ROOT(head);			\
-				break;					\
-			}						\
-		} else {						\
-			tmp = RB_LEFT(parent, field);			\
-			if (RB_COLOR(tmp, field) == RB_RED) {		\
-				RB_SET_BLACKRED(tmp, parent, field);	\
-				RB_ROTATE_RIGHT(head, parent, tmp, field);\
-				tmp = RB_LEFT(parent, field);		\
-			}						\
-			if ((RB_LEFT(tmp, field) == NULL ||		\
-			    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
-			    (RB_RIGHT(tmp, field) == NULL ||		\
-			    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
-				RB_COLOR(tmp, field) = RB_RED;		\
-				elm = parent;				\
-				parent = RB_PARENT(elm, field);		\
-			} else {					\
-				if (RB_LEFT(tmp, field) == NULL ||	\
-				    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
-					struct type *oright;		\
-					if ((oright = RB_RIGHT(tmp, field)) \
-					    != NULL)			\
-						RB_COLOR(oright, field) = RB_BLACK;\
-					RB_COLOR(tmp, field) = RB_RED;	\
-					RB_ROTATE_LEFT(head, tmp, oright, field);\
-					tmp = RB_LEFT(parent, field);	\
-				}					\
-				RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
-				RB_COLOR(parent, field) = RB_BLACK;	\
-				if (RB_LEFT(tmp, field))		\
-					RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\
-				RB_ROTATE_RIGHT(head, parent, tmp, field);\
-				elm = RB_ROOT(head);			\
-				break;					\
-			}						\
-		}							\
-	}								\
-	if (elm)							\
-		RB_COLOR(elm, field) = RB_BLACK;			\
-}
-
-#define RB_GENERATE_REMOVE(name, type, field, attr)			\
-attr struct type *							\
-name##_RB_REMOVE(struct name *head, struct type *elm)			\
-{									\
-	struct type *child, *parent, *old = elm;			\
-	int color;							\
-	if (RB_LEFT(elm, field) == NULL)				\
-		child = RB_RIGHT(elm, field);				\
-	else if (RB_RIGHT(elm, field) == NULL)				\
-		child = RB_LEFT(elm, field);				\
-	else {								\
-		struct type *left;					\
-		elm = RB_RIGHT(elm, field);				\
-		while ((left = RB_LEFT(elm, field)) != NULL)		\
-			elm = left;					\
-		child = RB_RIGHT(elm, field);				\
-		parent = RB_PARENT(elm, field);				\
-		color = RB_COLOR(elm, field);				\
-		if (child)						\
-			RB_PARENT(child, field) = parent;		\
-		if (parent) {						\
-			if (RB_LEFT(parent, field) == elm)		\
-				RB_LEFT(parent, field) = child;		\
-			else						\
-				RB_RIGHT(parent, field) = child;	\
-			RB_AUGMENT(parent);				\
-		} else							\
-			RB_ROOT(head) = child;				\
-		if (RB_PARENT(elm, field) == old)			\
-			parent = elm;					\
-		(elm)->field = (old)->field;				\
-		if (RB_PARENT(old, field)) {				\
-			if (RB_LEFT(RB_PARENT(old, field), field) == old)\
-				RB_LEFT(RB_PARENT(old, field), field) = elm;\
-			else						\
-				RB_RIGHT(RB_PARENT(old, field), field) = elm;\
-			RB_AUGMENT(RB_PARENT(old, field));		\
-		} else							\
-			RB_ROOT(head) = elm;				\
-		RB_PARENT(RB_LEFT(old, field), field) = elm;		\
-		if (RB_RIGHT(old, field))				\
-			RB_PARENT(RB_RIGHT(old, field), field) = elm;	\
-		if (parent) {						\
-			left = parent;					\
-			do {						\
-				RB_AUGMENT(left);			\
-			} while ((left = RB_PARENT(left, field)) != NULL); \
-		}							\
-		goto color;						\
-	}								\
-	parent = RB_PARENT(elm, field);					\
-	color = RB_COLOR(elm, field);					\
-	if (child)							\
-		RB_PARENT(child, field) = parent;			\
-	if (parent) {							\
-		if (RB_LEFT(parent, field) == elm)			\
-			RB_LEFT(parent, field) = child;			\
-		else							\
-			RB_RIGHT(parent, field) = child;		\
-		RB_AUGMENT(parent);					\
-	} else								\
-		RB_ROOT(head) = child;					\
-color:									\
-	if (color == RB_BLACK)						\
-		name##_RB_REMOVE_COLOR(head, parent, child);		\
-	return (old);							\
-}									\
-
-#define RB_GENERATE_INSERT(name, type, field, cmp, attr)		\
-/* Inserts a node into the RB tree */					\
-attr struct type *							\
-name##_RB_INSERT(struct name *head, struct type *elm)			\
-{									\
-	struct type *tmp;						\
-	struct type *parent = NULL;					\
-	int comp = 0;							\
-	tmp = RB_ROOT(head);						\
-	while (tmp) {							\
-		parent = tmp;						\
-		comp = (cmp)(elm, parent);				\
-		if (comp < 0)						\
-			tmp = RB_LEFT(tmp, field);			\
-		else if (comp > 0)					\
-			tmp = RB_RIGHT(tmp, field);			\
-		else							\
-			return (tmp);					\
-	}								\
-	RB_SET(elm, parent, field);					\
-	if (parent != NULL) {						\
-		if (comp < 0)						\
-			RB_LEFT(parent, field) = elm;			\
-		else							\
-			RB_RIGHT(parent, field) = elm;			\
-		RB_AUGMENT(parent);					\
-	} else								\
-		RB_ROOT(head) = elm;					\
-	name##_RB_INSERT_COLOR(head, elm);				\
-	return (NULL);							\
-}
-
-#define RB_GENERATE_FIND(name, type, field, cmp, attr)			\
-/* Finds the node with the same key as elm */				\
-attr struct type *							\
-name##_RB_FIND(struct name *head, struct type *elm)			\
-{									\
-	struct type *tmp = RB_ROOT(head);				\
-	int comp;							\
-	while (tmp) {							\
-		comp = cmp(elm, tmp);					\
-		if (comp < 0)						\
-			tmp = RB_LEFT(tmp, field);			\
-		else if (comp > 0)					\
-			tmp = RB_RIGHT(tmp, field);			\
-		else							\
-			return (tmp);					\
-	}								\
-	return (NULL);							\
-}
-
-#define RB_GENERATE_NFIND(name, type, field, cmp, attr)			\
-/* Finds the first node greater than or equal to the search key */	\
-attr struct type *							\
-name##_RB_NFIND(struct name *head, struct type *elm)			\
-{									\
-	struct type *tmp = RB_ROOT(head);				\
-	struct type *res = NULL;					\
-	int comp;							\
-	while (tmp) {							\
-		comp = cmp(elm, tmp);					\
-		if (comp < 0) {						\
-			res = tmp;					\
-			tmp = RB_LEFT(tmp, field);			\
-		}							\
-		else if (comp > 0)					\
-			tmp = RB_RIGHT(tmp, field);			\
-		else							\
-			return (tmp);					\
-	}								\
-	return (res);							\
-}
-
-#define RB_GENERATE_NEXT(name, type, field, attr)			\
-/* ARGSUSED */								\
-attr struct type *							\
-name##_RB_NEXT(struct type *elm)					\
-{									\
-	if (RB_RIGHT(elm, field)) {					\
-		elm = RB_RIGHT(elm, field);				\
-		while (RB_LEFT(elm, field))				\
-			elm = RB_LEFT(elm, field);			\
-	} else {							\
-		if (RB_PARENT(elm, field) &&				\
-		    (elm == RB_LEFT(RB_PARENT(elm, field), field)))	\
-			elm = RB_PARENT(elm, field);			\
-		else {							\
-			while (RB_PARENT(elm, field) &&			\
-			    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
-				elm = RB_PARENT(elm, field);		\
-			elm = RB_PARENT(elm, field);			\
-		}							\
-	}								\
-	return (elm);							\
-}
-
-#define RB_GENERATE_PREV(name, type, field, attr)			\
-/* ARGSUSED */								\
-attr struct type *							\
-name##_RB_PREV(struct type *elm)					\
-{									\
-	if (RB_LEFT(elm, field)) {					\
-		elm = RB_LEFT(elm, field);				\
-		while (RB_RIGHT(elm, field))				\
-			elm = RB_RIGHT(elm, field);			\
-	} else {							\
-		if (RB_PARENT(elm, field) &&				\
-		    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))	\
-			elm = RB_PARENT(elm, field);			\
-		else {							\
-			while (RB_PARENT(elm, field) &&			\
-			    (elm == RB_LEFT(RB_PARENT(elm, field), field)))\
-				elm = RB_PARENT(elm, field);		\
-			elm = RB_PARENT(elm, field);			\
-		}							\
-	}								\
-	return (elm);							\
-}
-
-#define RB_GENERATE_MINMAX(name, type, field, attr)			\
-attr struct type *							\
-name##_RB_MINMAX(struct name *head, int val)				\
-{									\
-	struct type *tmp = RB_ROOT(head);				\
-	struct type *parent = NULL;					\
-	while (tmp) {							\
-		parent = tmp;						\
-		if (val < 0)						\
-			tmp = RB_LEFT(tmp, field);			\
-		else							\
-			tmp = RB_RIGHT(tmp, field);			\
-	}								\
-	return (parent);						\
-}
-
-#define RB_NEGINF	-1
-#define RB_INF	1
-
-#define RB_INSERT(name, x, y)	name##_RB_INSERT(x, y)
-#define RB_REMOVE(name, x, y)	name##_RB_REMOVE(x, y)
-#define RB_FIND(name, x, y)	name##_RB_FIND(x, y)
-#define RB_NFIND(name, x, y)	name##_RB_NFIND(x, y)
-#define RB_NEXT(name, x, y)	name##_RB_NEXT(y)
-#define RB_PREV(name, x, y)	name##_RB_PREV(y)
-#define RB_MIN(name, x)		name##_RB_MINMAX(x, RB_NEGINF)
-#define RB_MAX(name, x)		name##_RB_MINMAX(x, RB_INF)
-
-#define RB_FOREACH(x, name, head)					\
-	for ((x) = RB_MIN(name, head);					\
-	     (x) != NULL;						\
-	     (x) = name##_RB_NEXT(x))
-
-#define RB_FOREACH_FROM(x, name, y)					\
-	for ((x) = (y);							\
-	    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);	\
-	     (x) = (y))
-
-#define RB_FOREACH_SAFE(x, name, head, y)				\
-	for ((x) = RB_MIN(name, head);					\
-	    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);	\
-	     (x) = (y))
-
-#define RB_FOREACH_REVERSE(x, name, head)				\
-	for ((x) = RB_MAX(name, head);					\
-	     (x) != NULL;						\
-	     (x) = name##_RB_PREV(x))
-
-#define RB_FOREACH_REVERSE_FROM(x, name, y)				\
-	for ((x) = (y);							\
-	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
-	     (x) = (y))
-
-#define RB_FOREACH_REVERSE_SAFE(x, name, head, y)			\
-	for ((x) = RB_MAX(name, head);					\
-	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
-	     (x) = (y))
-
-#endif	/* _SYS_TREE_H_ */

+ 0 - 377
src/3rdparty/libxlsxwriter/include/xlsxwriter/third_party/zip.h

@@ -1,377 +0,0 @@
-/* zip.h -- IO on .zip files using zlib
-   Version 1.1, February 14h, 2010
-   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
-
-         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
-
-         Modifications for Zip64 support
-         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
-
-         For more info read MiniZip_info.txt
-
-         ---------------------------------------------------------------------------
-
-   Condition of use and distribution are the same than zlib :
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-        ---------------------------------------------------------------------------
-
-        Changes
-
-        See header of zip.h
-
-*/
-
-/* Pragma added by libxlsxwriter to avoid warnings with -pedantic -ansi. */
-#ifndef _WIN32
-#pragma GCC system_header
-#endif
-
-#ifndef _zip12_H
-#define _zip12_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* #define HAVE_BZIP2 */
-
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
-
-#ifndef _ZLIBIOAPI_H
-#include "ioapi.h"
-#endif
-
-/* Encryption not required by libxlsxwriter. */
-#ifndef NOCRYPT
-#define NOCRYPT
-#endif
-#ifndef NOUNCRYPT
-#define NOUNCRYPT
-#endif
-
-#ifdef HAVE_BZIP2
-#include "bzlib.h"
-#endif
-
-#define Z_BZIP2ED 12
-
-#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
-/* like the STRICT of WIN32, we define a pointer that cannot be converted
-    from (void*) without cast */
-typedef struct TagzipFile__ { int unused; } zipFile__;
-typedef zipFile__ *zipFile;
-#else
-typedef voidp zipFile;
-#endif
-
-#define ZIP_OK                          (0)
-#define ZIP_EOF                         (0)
-#define ZIP_ERRNO                       (Z_ERRNO)
-#define ZIP_PARAMERROR                  (-102)
-#define ZIP_BADZIPFILE                  (-103)
-#define ZIP_INTERNALERROR               (-104)
-
-#ifndef DEF_MEM_LEVEL
-#  if MAX_MEM_LEVEL >= 8
-#    define DEF_MEM_LEVEL 8
-#  else
-#    define DEF_MEM_LEVEL  MAX_MEM_LEVEL
-#  endif
-#endif
-/* default memLevel */
-
-/* tm_zip contain date/time info */
-typedef struct tm_zip_s
-{
-    int tm_sec;             /* seconds after the minute - [0,59] */
-    int tm_min;             /* minutes after the hour - [0,59] */
-    int tm_hour;            /* hours since midnight - [0,23] */
-    int tm_mday;            /* day of the month - [1,31] */
-    int tm_mon;             /* months since January - [0,11] */
-    int tm_year;            /* years - [1980..2044] */
-} tm_zip;
-
-typedef struct
-{
-    tm_zip      tmz_date;       /* date in understandable format           */
-    uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */
-/*    uLong       flag;        */   /* general purpose bit flag        2 bytes */
-
-    uLong       internal_fa;    /* internal file attributes        2 bytes */
-    uLong       external_fa;    /* external file attributes        4 bytes */
-} zip_fileinfo;
-
-typedef const char* zipcharpc;
-
-
-#define APPEND_STATUS_CREATE        (0)
-#define APPEND_STATUS_CREATEAFTER   (1)
-#define APPEND_STATUS_ADDINZIP      (2)
-
-extern zipFile ZEXPORT zipOpen(const char *pathname, int append);
-extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
-/*
-  Create a zipfile.
-     pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
-       an Unix computer "zlib/zlib113.zip".
-     if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
-       will be created at the end of the file.
-         (useful if the file contain a self extractor code)
-     if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
-       add files in existing zip (be sure you don't add file that doesn't exist)
-     If the zipfile cannot be opened, the return value is NULL.
-     Else, the return value is a zipFile Handle, usable with other function
-       of this zip package.
-*/
-
-/* Note : there is no delete function into a zipfile.
-   If you want delete file into a zipfile, you must open a zipfile, and create another
-   Of course, you can use RAW reading and writing to copy the file you did not want delete
-*/
-
-extern zipFile ZEXPORT zipOpen2(const char *pathname,
-                                int append,
-                                zipcharpc* globalcomment,
-                                zlib_filefunc_def* pzlib_filefunc_def);
-
-extern zipFile ZEXPORT zipOpen2_64(const void *pathname,
-                                   int append,
-                                   zipcharpc* globalcomment,
-                                   zlib_filefunc64_def* pzlib_filefunc_def);
-
-extern zipFile ZEXPORT zipOpen3(const void *pathname,
-                                int append,
-                                zipcharpc* globalcomment,
-                                zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
-
-extern int ZEXPORT zipOpenNewFileInZip(zipFile file,
-                                       const char* filename,
-                                       const zip_fileinfo* zipfi,
-                                       const void* extrafield_local,
-                                       uInt size_extrafield_local,
-                                       const void* extrafield_global,
-                                       uInt size_extrafield_global,
-                                       const char* comment,
-                                       int method,
-                                       int level);
-
-extern int ZEXPORT zipOpenNewFileInZip64(zipFile file,
-                                         const char* filename,
-                                         const zip_fileinfo* zipfi,
-                                         const void* extrafield_local,
-                                         uInt size_extrafield_local,
-                                         const void* extrafield_global,
-                                         uInt size_extrafield_global,
-                                         const char* comment,
-                                         int method,
-                                         int level,
-                                         int zip64);
-
-/*
-  Open a file in the ZIP for writing.
-  filename : the filename in zip (if NULL, '-' without quote will be used
-  *zipfi contain supplemental information
-  if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
-    contains the extrafield data for the local header
-  if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
-    contains the extrafield data for the global header
-  if comment != NULL, comment contain the comment string
-  method contain the compression method (0 for store, Z_DEFLATED for deflate)
-  level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
-  zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
-                    this MUST be '1' if the uncompressed size is >= 0xffffffff.
-
-*/
-
-
-extern int ZEXPORT zipOpenNewFileInZip2(zipFile file,
-                                        const char* filename,
-                                        const zip_fileinfo* zipfi,
-                                        const void* extrafield_local,
-                                        uInt size_extrafield_local,
-                                        const void* extrafield_global,
-                                        uInt size_extrafield_global,
-                                        const char* comment,
-                                        int method,
-                                        int level,
-                                        int raw);
-
-
-extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file,
-                                           const char* filename,
-                                           const zip_fileinfo* zipfi,
-                                           const void* extrafield_local,
-                                           uInt size_extrafield_local,
-                                           const void* extrafield_global,
-                                           uInt size_extrafield_global,
-                                           const char* comment,
-                                           int method,
-                                           int level,
-                                           int raw,
-                                           int zip64);
-/*
-  Same than zipOpenNewFileInZip, except if raw=1, we write raw file
- */
-
-extern int ZEXPORT zipOpenNewFileInZip3(zipFile file,
-                                        const char* filename,
-                                        const zip_fileinfo* zipfi,
-                                        const void* extrafield_local,
-                                        uInt size_extrafield_local,
-                                        const void* extrafield_global,
-                                        uInt size_extrafield_global,
-                                        const char* comment,
-                                        int method,
-                                        int level,
-                                        int raw,
-                                        int windowBits,
-                                        int memLevel,
-                                        int strategy,
-                                        const char* password,
-                                        uLong crcForCrypting);
-
-extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file,
-                                           const char* filename,
-                                           const zip_fileinfo* zipfi,
-                                           const void* extrafield_local,
-                                           uInt size_extrafield_local,
-                                           const void* extrafield_global,
-                                           uInt size_extrafield_global,
-                                           const char* comment,
-                                           int method,
-                                           int level,
-                                           int raw,
-                                           int windowBits,
-                                           int memLevel,
-                                           int strategy,
-                                           const char* password,
-                                           uLong crcForCrypting,
-                                           int zip64);
-
-/*
-  Same than zipOpenNewFileInZip2, except
-    windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
-    password : crypting password (NULL for no crypting)
-    crcForCrypting : crc of file to compress (needed for crypting)
- */
-
-extern int ZEXPORT zipOpenNewFileInZip4(zipFile file,
-                                        const char* filename,
-                                        const zip_fileinfo* zipfi,
-                                        const void* extrafield_local,
-                                        uInt size_extrafield_local,
-                                        const void* extrafield_global,
-                                        uInt size_extrafield_global,
-                                        const char* comment,
-                                        int method,
-                                        int level,
-                                        int raw,
-                                        int windowBits,
-                                        int memLevel,
-                                        int strategy,
-                                        const char* password,
-                                        uLong crcForCrypting,
-                                        uLong versionMadeBy,
-                                        uLong flagBase);
-
-
-extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file,
-                                           const char* filename,
-                                           const zip_fileinfo* zipfi,
-                                           const void* extrafield_local,
-                                           uInt size_extrafield_local,
-                                           const void* extrafield_global,
-                                           uInt size_extrafield_global,
-                                           const char* comment,
-                                           int method,
-                                           int level,
-                                           int raw,
-                                           int windowBits,
-                                           int memLevel,
-                                           int strategy,
-                                           const char* password,
-                                           uLong crcForCrypting,
-                                           uLong versionMadeBy,
-                                           uLong flagBase,
-                                           int zip64);
-/*
-  Same than zipOpenNewFileInZip4, except
-    versionMadeBy : value for Version made by field
-    flag : value for flag field (compression level info will be added)
- */
-
-
-extern int ZEXPORT zipWriteInFileInZip(zipFile file,
-                                       const void* buf,
-                                       unsigned len);
-/*
-  Write data in the zipfile
-*/
-
-extern int ZEXPORT zipCloseFileInZip(zipFile file);
-/*
-  Close the current file in the zipfile
-*/
-
-extern int ZEXPORT zipCloseFileInZipRaw(zipFile file,
-                                        uLong uncompressed_size,
-                                        uLong crc32);
-
-extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file,
-                                          ZPOS64_T uncompressed_size,
-                                          uLong crc32);
-
-/*
-  Close the current file in the zipfile, for file opened with
-    parameter raw=1 in zipOpenNewFileInZip2
-  uncompressed_size and crc32 are value for the uncompressed size
-*/
-
-extern int ZEXPORT zipClose(zipFile file,
-                            const char* global_comment);
-/*
-  Close the zipfile
-*/
-
-
-extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader);
-/*
-  zipRemoveExtraInfoBlock -  Added by Mathias Svensson
-
-  Remove extra information block from a extra information data for the local file header or central directory header
-
-  It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode.
-
-  0x0001 is the signature header for the ZIP64 extra information blocks
-
-  usage.
-                        Remove ZIP64 Extra information from a central director extra field data
-              zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001);
-
-                        Remove ZIP64 Extra information from a Local File Header extra field data
-        zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
-*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _zip64_H */

+ 0 - 309
src/3rdparty/libxlsxwriter/include/xlsxwriter/utility.h

@@ -1,309 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- */
-
-/**
- * @file utility.h
- *
- * @brief Utility functions for libxlsxwriter.
- *
- * <!-- Copyright 2014-2026, John McNamara, jmcnamara@cpan.org -->
- *
- */
-
-#ifndef __LXW_UTILITY_H__
-#define __LXW_UTILITY_H__
-
-#include <stdint.h>
-#ifndef _MSC_VER
-#include <strings.h>
-#endif
-#include "common.h"
-#include "xmlwriter.h"
-
-/**
- * @brief Convert an Excel `A1` cell string into a `(row, col)` pair.
- *
- * Convert an Excel `A1` cell string into a `(row, col)` pair.
- *
- * This is a little syntactic shortcut to help with worksheet layout:
- *
- * @code
- *      worksheet_write_string(worksheet, CELL("A1"), "Foo", NULL);
- *
- *      //Same as:
- *      worksheet_write_string(worksheet, 0, 0,       "Foo", NULL);
- * @endcode
- *
- * @note
- *
- * This macro shouldn't be used in performance critical situations since it
- * expands to two function calls.
- */
-#define CELL(cell) \
-    lxw_name_to_row(cell), lxw_name_to_col(cell)
-
-/**
- * @brief Convert an Excel `A:B` column range into a `(col1, col2)` pair.
- *
- * Convert an Excel `A:B` column range into a `(col1, col2)` pair.
- *
- * This is a little syntactic shortcut to help with worksheet layout:
- *
- * @code
- *     worksheet_set_column(worksheet, COLS("B:D"), 20, NULL, NULL);
- *
- *     // Same as:
- *     worksheet_set_column(worksheet, 1, 3,        20, NULL, NULL);
- * @endcode
- *
- */
-#define COLS(cols) \
-    lxw_name_to_col(cols), lxw_name_to_col_2(cols)
-
-/**
- * @brief Convert an Excel `A1:B2` range into a `(first_row, first_col,
- *        last_row, last_col)` sequence.
- *
- * Convert an Excel `A1:B2` range into a `(first_row, first_col, last_row,
- * last_col)` sequence.
- *
- * This is a little syntactic shortcut to help with worksheet layout.
- *
- * @code
- *     worksheet_print_area(worksheet, 0, 0, 41, 10); // A1:K42.
- *
- *     // Same as:
- *     worksheet_print_area(worksheet, RANGE("A1:K42"));
- * @endcode
- */
-#define RANGE(range) \
-    lxw_name_to_row(range), lxw_name_to_col(range), \
-    lxw_name_to_row_2(range), lxw_name_to_col_2(range)
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-/**
- * @brief Retrieve the library version.
- *
- * @return The "X.Y.Z" version string.
- *
- * Get the library version as a "X.Y.Z" version string
- *
- *  @code
- *      printf("Libxlsxwriter version = %s\n", lxw_version());
- *  @endcode
- *
- */
-const char *lxw_version(void);
-
-/**
- * @brief Retrieve the library version ID.
- *
- * @return The version ID.
- *
- * Get the library version such as "X.Y.Z" as a XYZ integer.
- *
- *  @code
- *      printf("Libxlsxwriter version id = %d\n", lxw_version_id());
- *  @endcode
- *
- */
-uint16_t lxw_version_id(void);
-
-/**
- * @brief Converts a libxlsxwriter error number to a string.
- *
- * The `%lxw_strerror` function converts a libxlsxwriter error number defined
- * by #lxw_error to a pointer to a string description of the error.
- * Similar to the standard library strerror(3) function.
- *
- * For example:
- *
- * @code
- *     lxw_error error = workbook_close(workbook);
- *
- *     if (error)
- *         printf("Error in workbook_close().\n"
- *                "Error %d = %s\n", error, lxw_strerror(error));
- * @endcode
- *
- * This would produce output like the following if the target file wasn't
- * writable:
- *
- *     Error in workbook_close().
- *     Error 2 = Error creating output xlsx file. Usually a permissions error.
- *
- * @param error_num The error number returned by a libxlsxwriter function.
- *
- * @return A pointer to a statically allocated string. Do not free.
- */
-char *lxw_strerror(lxw_error error_num);
-
-/* Create a quoted version of the worksheet name */
-char *lxw_quote_sheetname(const char *str);
-
-void lxw_col_to_name(char *col_name, lxw_col_t col_num, uint8_t absolute);
-
-void lxw_rowcol_to_cell(char *cell_name, lxw_row_t row, lxw_col_t col);
-
-void lxw_rowcol_to_cell_abs(char *cell_name,
-                            lxw_row_t row,
-                            lxw_col_t col, uint8_t abs_row, uint8_t abs_col);
-
-void lxw_rowcol_to_range(char *range,
-                         lxw_row_t first_row, lxw_col_t first_col,
-                         lxw_row_t last_row, lxw_col_t last_col);
-
-void lxw_rowcol_to_range_abs(char *range,
-                             lxw_row_t first_row, lxw_col_t first_col,
-                             lxw_row_t last_row, lxw_col_t last_col);
-
-void lxw_rowcol_to_formula_abs(char *formula, const char *sheetname,
-                               lxw_row_t first_row, lxw_col_t first_col,
-                               lxw_row_t last_row, lxw_col_t last_col);
-
-uint32_t lxw_name_to_row(const char *row_str);
-uint16_t lxw_name_to_col(const char *col_str);
-
-uint32_t lxw_name_to_row_2(const char *row_str);
-uint16_t lxw_name_to_col_2(const char *col_str);
-
-/**
- * @brief Converts a #lxw_datetime to an Excel datetime number.
- *
- * @param datetime A pointer to a #lxw_datetime struct.
- *
- * @return A double representing an Excel datetime.
- *
- * The `%lxw_datetime_to_excel_datetime()` function converts a datetime in
- * #lxw_datetime to an Excel datetime number:
- *
- * @code
- *     lxw_datetime datetime = {2013, 2, 28, 12, 0, 0.0};
- *
- *     double excel_datetime = lxw_datetime_to_excel_date(&datetime);
- * @endcode
- *
- * See @ref working_with_dates for more details on the Excel datetime format.
- */
-double lxw_datetime_to_excel_datetime(lxw_datetime *datetime);
-
-/**
- * @brief Converts a #lxw_datetime to an Excel datetime number with 1900/1904
- * epoch.
- *
- * This function is similar to `lxw_datetime_to_excel_datetime()` but it allows
- * you to specify whether to use the 1900 or 1904 epoch. See also the
- * `workbook_use_1904_epoch()` function.
- *
- * @param datetime A pointer to a #lxw_datetime struct.
- * @param use_1904_epoch A flag to indicate whether to use the 1904 epoch (true)
- *        or the 1900 epoch (false).
- *
- */
-double lxw_datetime_to_excel_date_with_epoch(lxw_datetime *datetime,
-                                             uint8_t use_1904_epoch);
-
-/**
- * @brief Validate a #lxw_datetime struct.
- *
- * Validates a #lxw_datetime struct to ensure its fields are within acceptable
- * ranges for Excel dates and times.
- *
- * The members of the #lxw_datetime struct and the range of their values are:
- *
- * Member   | Value
- * -------- | -----------
- * year     | 1900 - 9999
- * month    | 1 - 12
- * day      | 1 - 31
- * hour     | 0 - 23
- * min      | 0 - 59
- * sec      | 0 - 59.999
- *
- * @param datetime A pointer to a #lxw_datetime struct.
- *
- * @return A #lxw_error code. Either #LXW_NO_ERROR or
- *         #LXW_ERROR_DATETIME_VALIDATION if a field is out of range.
- */
-lxw_error lxw_datetime_validate(lxw_datetime *datetime);
-
-/**
- * @brief Converts a unix datetime to an Excel datetime number.
- *
- * @param unixtime Unix time (seconds since 1970-01-01)
- *
- * @return A double representing an Excel datetime.
- *
- * The `%lxw_unixtime_to_excel_date()` function converts a unix datetime to
- * an Excel datetime number:
- *
- * @code
- *     double excel_datetime = lxw_unixtime_to_excel_date(946684800);
- * @endcode
- *
- * See @ref working_with_dates for more details.
- */
-double lxw_unixtime_to_excel_date(int64_t unixtime);
-
-/**
- * @brief Converts a unix datetime to an Excel datetime number with 1900/1904
- * epoch.
- *
- * This function is similar to `lxw_unixtime_to_excel_date()` but it allows
- * you to specify whether to use the 1900 or 1904 epoch. See also the
- * `workbook_use_1904_epoch()` function.
- *
- * @param unixtime Unix time (seconds since 1970-01-01)
- * @param use_1904_epoch A flag to indicate whether to use the 1904 epoch (true)
- *        or the 1900 epoch (false).
- *
- */
-double lxw_unixtime_to_excel_date_with_epoch(int64_t unixtime,
-                                             uint8_t use_1904_epoch);
-
-char *lxw_strdup(const char *str);
-char *lxw_strdup_formula(const char *formula);
-size_t lxw_utf8_strlen(const char *str);
-void lxw_str_tolower(char *str);
-uint8_t lxw_str_is_empty(const char *str);
-
-/* Define a portable version of strcasecmp(). */
-#ifdef _MSC_VER
-#define lxw_strcasecmp _stricmp
-#else
-#define lxw_strcasecmp strcasecmp
-#endif
-
-FILE *lxw_tmpfile(const char *tmpdir);
-FILE *lxw_get_filehandle(char **buf, size_t *size, const char *tmpdir);
-FILE *lxw_fopen(const char *filename, const char *mode);
-
-/* Use the third party dtoa function to avoid locale issues with sprintf
- * double formatting. Otherwise we use a simple macro that falls back to the
- * default c-lib sprintf.
- */
-#ifdef USE_DTOA_LIBRARY
-int lxw_sprintf_dbl(char *data, double number);
-#else
-#define lxw_sprintf_dbl(data, number) \
-        lxw_snprintf(data, LXW_ATTR_32, "%.16G", number)
-#endif
-
-uint16_t lxw_hash_password(const char *password);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_UTILITY_H__ */

+ 0 - 56
src/3rdparty/libxlsxwriter/include/xlsxwriter/vml.h

@@ -1,56 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * vml - A libxlsxwriter library for creating Excel XLSX vml files.
- *
- */
-#ifndef __LXW_VML_H__
-#define __LXW_VML_H__
-
-#include <stdint.h>
-
-#include "common.h"
-#include "worksheet.h"
-
-/*
- * Struct to represent a vml object.
- */
-typedef struct lxw_vml {
-
-    FILE *file;
-    uint8_t type;
-    struct lxw_comment_objs *button_objs;
-    struct lxw_comment_objs *comment_objs;
-    struct lxw_comment_objs *image_objs;
-    char *vml_data_id_str;
-    uint32_t vml_shape_id;
-    uint8_t comment_display_default;
-
-} lxw_vml;
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-lxw_vml *lxw_vml_new(void);
-void lxw_vml_free(lxw_vml *vml);
-void lxw_vml_assemble_xml_file(lxw_vml *self);
-
-/* Declarations required for unit testing. */
-#ifdef TESTING
-
-#endif /* TESTING */
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __LXW_VML_H__ */

Разница между файлами не показана из-за своего большого размера
+ 0 - 1153
src/3rdparty/libxlsxwriter/include/xlsxwriter/workbook.h


Разница между файлами не показана из-за своего большого размера
+ 0 - 6005
src/3rdparty/libxlsxwriter/include/xlsxwriter/worksheet.h


+ 0 - 185
src/3rdparty/libxlsxwriter/include/xlsxwriter/xmlwriter.h

@@ -1,185 +0,0 @@
-/*
- * libxlsxwriter
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- * xmlwriter - A libxlsxwriter library for creating Excel XLSX
- *             XML files.
- *
- * The xmlwriter library is used to create the XML sub-components files
- * in the Excel XLSX file format.
- *
- * This library is used in preference to a more generic XML library to allow
- * for customization and optimization for the XLSX file format.
- *
- * The xmlwriter functions are only used internally and do not need to be
- * called directly by the end user.
- *
- */
-#ifndef __XMLWRITER_H__
-#define __XMLWRITER_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include "utility.h"
-
-#define LXW_MAX_ATTRIBUTE_LENGTH 2080   /* Max URL length. */
-#define LXW_ATTR_32              32
-
-#define LXW_ATTRIBUTE_COPY(dst, src)                    \
-    do{                                                 \
-        strncpy(dst, src, LXW_MAX_ATTRIBUTE_LENGTH -1); \
-        dst[LXW_MAX_ATTRIBUTE_LENGTH - 1] = '\0';       \
-    } while (0)
-
-
- /* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-/* Attribute used in XML elements. */
-struct xml_attribute {
-    char key[LXW_MAX_ATTRIBUTE_LENGTH];
-    char value[LXW_MAX_ATTRIBUTE_LENGTH];
-
-    /* Make the struct a queue.h list element. */
-    STAILQ_ENTRY (xml_attribute) list_entries;
-};
-
-/* Use queue.h macros to define the xml_attribute_list type. */
-STAILQ_HEAD(xml_attribute_list, xml_attribute);
-
-/* Create a new attribute struct to add to a xml_attribute_list. */
-struct xml_attribute *lxw_new_attribute_str(const char *key,
-                                            const char *value);
-struct xml_attribute *lxw_new_attribute_int(const char *key, int32_t value);
-struct xml_attribute *lxw_new_attribute_dbl(const char *key, double value);
-
-/* Macro to initialize the xml_attribute_list pointers. */
-#define LXW_INIT_ATTRIBUTES()                                 \
-    STAILQ_INIT(&attributes)
-
-/* Macro to add attribute string elements to xml_attribute_list. */
-#define LXW_PUSH_ATTRIBUTES_STR(key, value)                   \
-    do {                                                      \
-    attribute = lxw_new_attribute_str((key), (value));        \
-    STAILQ_INSERT_TAIL(&attributes, attribute, list_entries); \
-    } while (0)
-
-/* Macro to add attribute int values to xml_attribute_list. */
-#define LXW_PUSH_ATTRIBUTES_INT(key, value)                   \
-    do {                                                      \
-    attribute = lxw_new_attribute_int((key), (value));        \
-    STAILQ_INSERT_TAIL(&attributes, attribute, list_entries); \
-    } while (0)
-
-/* Macro to add attribute double values to xml_attribute_list. */
-#define LXW_PUSH_ATTRIBUTES_DBL(key, value)                   \
-    do {                                                      \
-    attribute = lxw_new_attribute_dbl((key), (value));        \
-    STAILQ_INSERT_TAIL(&attributes, attribute, list_entries); \
-    } while (0)
-
-/* Macro to free xml_attribute_list and attribute. */
-#define LXW_FREE_ATTRIBUTES()                                 \
-    do {                                                      \
-        while (!STAILQ_EMPTY(&attributes)) {                  \
-            attribute = STAILQ_FIRST(&attributes);            \
-            STAILQ_REMOVE_HEAD(&attributes, list_entries);    \
-            free(attribute);                                  \
-        }                                                     \
-    } while (0)
-
-/**
- * Create the XML declaration in an XML file.
- *
- * @param xmlfile A FILE pointer to the output XML file.
- */
-void lxw_xml_declaration(FILE *xmlfile);
-
-/**
- * Write an XML start tag with optional attributes.
- *
- * @param xmlfile    A FILE pointer to the output XML file.
- * @param tag        The XML tag to write.
- * @param attributes An optional list of attributes to add to the tag.
- */
-void lxw_xml_start_tag(FILE *xmlfile,
-                       const char *tag,
-                       struct xml_attribute_list *attributes);
-
-/**
- * Write an XML start tag with optional un-encoded attributes.
- * This is a minor optimization for attributes that don't need encoding.
- *
- * @param xmlfile    A FILE pointer to the output XML file.
- * @param tag        The XML tag to write.
- * @param attributes An optional list of attributes to add to the tag.
- */
-void lxw_xml_start_tag_unencoded(FILE *xmlfile,
-                                 const char *tag,
-                                 struct xml_attribute_list *attributes);
-
-/**
- * Write an XML end tag.
- *
- * @param xmlfile    A FILE pointer to the output XML file.
- * @param tag        The XML tag to write.
- */
-void lxw_xml_end_tag(FILE *xmlfile, const char *tag);
-
-/**
- * Write an XML empty tag with optional attributes.
- *
- * @param xmlfile    A FILE pointer to the output XML file.
- * @param tag        The XML tag to write.
- * @param attributes An optional list of attributes to add to the tag.
- */
-void lxw_xml_empty_tag(FILE *xmlfile,
-                       const char *tag,
-                       struct xml_attribute_list *attributes);
-
-/**
- * Write an XML empty tag with optional un-encoded attributes.
- * This is a minor optimization for attributes that don't need encoding.
- *
- * @param xmlfile    A FILE pointer to the output XML file.
- * @param tag        The XML tag to write.
- * @param attributes An optional list of attributes to add to the tag.
- */
-void lxw_xml_empty_tag_unencoded(FILE *xmlfile,
-                                 const char *tag,
-                                 struct xml_attribute_list *attributes);
-
-/**
- * Write an XML element containing data and optional attributes.
- *
- * @param xmlfile    A FILE pointer to the output XML file.
- * @param tag        The XML tag to write.
- * @param data       The data section of the XML element.
- * @param attributes An optional list of attributes to add to the tag.
- */
-void lxw_xml_data_element(FILE *xmlfile,
-                          const char *tag,
-                          const char *data,
-                          struct xml_attribute_list *attributes);
-
-void lxw_xml_rich_si_element(FILE *xmlfile, const char *string);
-
-uint8_t lxw_has_control_characters(const char *string);
-char *lxw_escape_control_characters(const char *string);
-char *lxw_escape_url_characters(const char *string, uint8_t escape_hash);
-
-char *lxw_escape_data(const char *data);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* __XMLWRITER_H__ */

+ 0 - 447
src/3rdparty/libxlsxwriter/src/app.c

@@ -1,447 +0,0 @@
-/*****************************************************************************
- * app - A library for creating Excel XLSX app files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/app.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new app object.
- */
-lxw_app *
-lxw_app_new(void)
-{
-    lxw_app *app = calloc(1, sizeof(lxw_app));
-    GOTO_LABEL_ON_MEM_ERROR(app, mem_error);
-
-    app->heading_pairs = calloc(1, sizeof(struct lxw_heading_pairs));
-    GOTO_LABEL_ON_MEM_ERROR(app->heading_pairs, mem_error);
-    STAILQ_INIT(app->heading_pairs);
-
-    app->part_names = calloc(1, sizeof(struct lxw_part_names));
-    GOTO_LABEL_ON_MEM_ERROR(app->part_names, mem_error);
-    STAILQ_INIT(app->part_names);
-
-    return app;
-
-mem_error:
-    lxw_app_free(app);
-    return NULL;
-}
-
-/*
- * Free a app object.
- */
-void
-lxw_app_free(lxw_app *app)
-{
-    lxw_heading_pair *heading_pair;
-    lxw_part_name *part_name;
-
-    if (!app)
-        return;
-
-    /* Free the lists in the App object. */
-    if (app->heading_pairs) {
-        while (!STAILQ_EMPTY(app->heading_pairs)) {
-            heading_pair = STAILQ_FIRST(app->heading_pairs);
-            STAILQ_REMOVE_HEAD(app->heading_pairs, list_pointers);
-            free(heading_pair->key);
-            free(heading_pair->value);
-            free(heading_pair);
-        }
-        free(app->heading_pairs);
-    }
-
-    if (app->part_names) {
-        while (!STAILQ_EMPTY(app->part_names)) {
-            part_name = STAILQ_FIRST(app->part_names);
-            STAILQ_REMOVE_HEAD(app->part_names, list_pointers);
-            free(part_name->name);
-            free(part_name);
-        }
-        free(app->part_names);
-    }
-
-    free(app);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_app_xml_declaration(lxw_app *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <Properties> element.
- */
-STATIC void
-_write_properties(lxw_app *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] = LXW_SCHEMA_OFFICEDOC "/extended-properties";
-    char xmlns_vt[] = LXW_SCHEMA_OFFICEDOC "/docPropsVTypes";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:vt", xmlns_vt);
-
-    lxw_xml_start_tag(self->file, "Properties", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <Application> element.
- */
-STATIC void
-_write_application(lxw_app *self)
-{
-    lxw_xml_data_element(self->file, "Application", "Microsoft Excel", NULL);
-}
-
-/*
- * Write the <DocSecurity> element.
- */
-STATIC void
-_write_doc_security(lxw_app *self)
-{
-    if (self->doc_security == 2)
-        lxw_xml_data_element(self->file, "DocSecurity", "2", NULL);
-    else
-        lxw_xml_data_element(self->file, "DocSecurity", "0", NULL);
-}
-
-/*
- * Write the <ScaleCrop> element.
- */
-STATIC void
-_write_scale_crop(lxw_app *self)
-{
-    lxw_xml_data_element(self->file, "ScaleCrop", "false", NULL);
-}
-
-/*
- * Write the <vt:lpstr> element.
- */
-STATIC void
-_write_vt_lpstr(lxw_app *self, const char *str)
-{
-    lxw_xml_data_element(self->file, "vt:lpstr", str, NULL);
-}
-
-/*
- * Write the <vt:i4> element.
- */
-STATIC void
-_write_vt_i4(lxw_app *self, const char *value)
-{
-    lxw_xml_data_element(self->file, "vt:i4", value, NULL);
-}
-
-/*
- * Write the <vt:variant> element.
- */
-STATIC void
-_write_vt_variant(lxw_app *self, const char *key, const char *value)
-{
-    /* Write the vt:lpstr element. */
-    lxw_xml_start_tag(self->file, "vt:variant", NULL);
-    _write_vt_lpstr(self, key);
-    lxw_xml_end_tag(self->file, "vt:variant");
-
-    /* Write the vt:i4 element. */
-    lxw_xml_start_tag(self->file, "vt:variant", NULL);
-    _write_vt_i4(self, value);
-    lxw_xml_end_tag(self->file, "vt:variant");
-}
-
-/*
- * Write the <vt:vector> element for the heading pairs.
- */
-STATIC void
-_write_vt_vector_heading_pairs(lxw_app *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    lxw_heading_pair *heading_pair;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("size", self->num_heading_pairs * 2);
-    LXW_PUSH_ATTRIBUTES_STR("baseType", "variant");
-
-    lxw_xml_start_tag(self->file, "vt:vector", &attributes);
-
-    STAILQ_FOREACH(heading_pair, self->heading_pairs, list_pointers) {
-        _write_vt_variant(self, heading_pair->key, heading_pair->value);
-    }
-
-    lxw_xml_end_tag(self->file, "vt:vector");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <vt:vector> element for the named parts.
- */
-STATIC void
-_write_vt_vector_lpstr_named_parts(lxw_app *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    lxw_part_name *part_name;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("size", self->num_part_names);
-    LXW_PUSH_ATTRIBUTES_STR("baseType", "lpstr");
-
-    lxw_xml_start_tag(self->file, "vt:vector", &attributes);
-
-    STAILQ_FOREACH(part_name, self->part_names, list_pointers) {
-        _write_vt_lpstr(self, part_name->name);
-    }
-
-    lxw_xml_end_tag(self->file, "vt:vector");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <HeadingPairs> element.
- */
-STATIC void
-_write_heading_pairs(lxw_app *self)
-{
-    lxw_xml_start_tag(self->file, "HeadingPairs", NULL);
-
-    /* Write the vt:vector element. */
-    _write_vt_vector_heading_pairs(self);
-
-    lxw_xml_end_tag(self->file, "HeadingPairs");
-}
-
-/*
- * Write the <TitlesOfParts> element.
- */
-STATIC void
-_write_titles_of_parts(lxw_app *self)
-{
-    lxw_xml_start_tag(self->file, "TitlesOfParts", NULL);
-
-    /* Write the vt:vector element. */
-    _write_vt_vector_lpstr_named_parts(self);
-
-    lxw_xml_end_tag(self->file, "TitlesOfParts");
-}
-
-/*
- * Write the <Manager> element.
- */
-STATIC void
-_write_manager(lxw_app *self)
-{
-    lxw_doc_properties *properties = self->properties;
-
-    if (!properties)
-        return;
-
-    if (properties->manager)
-        lxw_xml_data_element(self->file, "Manager", properties->manager,
-                             NULL);
-}
-
-/*
- * Write the <Company> element.
- */
-STATIC void
-_write_company(lxw_app *self)
-{
-    lxw_doc_properties *properties = self->properties;
-
-    if (properties && properties->company)
-        lxw_xml_data_element(self->file, "Company", properties->company,
-                             NULL);
-    else
-        lxw_xml_data_element(self->file, "Company", "", NULL);
-}
-
-/*
- * Write the <LinksUpToDate> element.
- */
-STATIC void
-_write_links_up_to_date(lxw_app *self)
-{
-    lxw_xml_data_element(self->file, "LinksUpToDate", "false", NULL);
-}
-
-/*
- * Write the <SharedDoc> element.
- */
-STATIC void
-_write_shared_doc(lxw_app *self)
-{
-    lxw_xml_data_element(self->file, "SharedDoc", "false", NULL);
-}
-
-/*
- * Write the <HyperlinkBase> element.
- */
-STATIC void
-_write_hyperlink_base(lxw_app *self)
-{
-    lxw_doc_properties *properties = self->properties;
-
-    if (!properties)
-        return;
-
-    if (properties->hyperlink_base)
-        lxw_xml_data_element(self->file, "HyperlinkBase",
-                             properties->hyperlink_base, NULL);
-}
-
-/*
- * Write the <HyperlinksChanged> element.
- */
-STATIC void
-_write_hyperlinks_changed(lxw_app *self)
-{
-    lxw_xml_data_element(self->file, "HyperlinksChanged", "false", NULL);
-}
-
-/*
- * Write the <AppVersion> element.
- */
-STATIC void
-_write_app_version(lxw_app *self)
-{
-    lxw_xml_data_element(self->file, "AppVersion", "12.0000", NULL);
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_app_assemble_xml_file(lxw_app *self)
-{
-
-    /* Write the XML declaration. */
-    _app_xml_declaration(self);
-
-    _write_properties(self);
-    _write_application(self);
-    _write_doc_security(self);
-    _write_scale_crop(self);
-    _write_heading_pairs(self);
-    _write_titles_of_parts(self);
-    _write_manager(self);
-    _write_company(self);
-    _write_links_up_to_date(self);
-    _write_shared_doc(self);
-    _write_hyperlink_base(self);
-    _write_hyperlinks_changed(self);
-    _write_app_version(self);
-
-    lxw_xml_end_tag(self->file, "Properties");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/
-
-/*
- * Add the name of a workbook Part such as 'Sheet1' or 'Print_Titles'.
- */
-void
-lxw_app_add_part_name(lxw_app *self, const char *name)
-{
-    lxw_part_name *part_name;
-
-    if (!name)
-        return;
-
-    part_name = calloc(1, sizeof(lxw_part_name));
-    GOTO_LABEL_ON_MEM_ERROR(part_name, mem_error);
-
-    part_name->name = lxw_strdup(name);
-    GOTO_LABEL_ON_MEM_ERROR(part_name->name, mem_error);
-
-    STAILQ_INSERT_TAIL(self->part_names, part_name, list_pointers);
-    self->num_part_names++;
-
-    return;
-
-mem_error:
-    if (part_name) {
-        free(part_name->name);
-        free(part_name);
-    }
-}
-
-/*
- * Add the name of a workbook Heading Pair such as 'Worksheets', 'Charts' or
- * 'Named Ranges'.
- */
-void
-lxw_app_add_heading_pair(lxw_app *self, const char *key, const char *value)
-{
-    lxw_heading_pair *heading_pair;
-
-    if (!key || !value)
-        return;
-
-    heading_pair = calloc(1, sizeof(lxw_heading_pair));
-    GOTO_LABEL_ON_MEM_ERROR(heading_pair, mem_error);
-
-    heading_pair->key = lxw_strdup(key);
-    GOTO_LABEL_ON_MEM_ERROR(heading_pair->key, mem_error);
-
-    heading_pair->value = lxw_strdup(value);
-    GOTO_LABEL_ON_MEM_ERROR(heading_pair->value, mem_error);
-
-    STAILQ_INSERT_TAIL(self->heading_pairs, heading_pair, list_pointers);
-    self->num_heading_pairs++;
-
-    return;
-
-mem_error:
-    if (heading_pair) {
-        free(heading_pair->key);
-        free(heading_pair->value);
-        free(heading_pair);
-    }
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 7051
src/3rdparty/libxlsxwriter/src/chart.c


+ 0 - 509
src/3rdparty/libxlsxwriter/src/chartsheet.c

@@ -1,509 +0,0 @@
-/*****************************************************************************
- * chartsheet - A library for creating Excel XLSX chartsheet files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/chartsheet.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new chartsheet object.
- */
-lxw_chartsheet *
-lxw_chartsheet_new(lxw_worksheet_init_data *init_data)
-{
-    lxw_chartsheet *chartsheet = calloc(1, sizeof(lxw_chartsheet));
-    GOTO_LABEL_ON_MEM_ERROR(chartsheet, mem_error);
-
-    /* Use an embedded worksheet instance to write XML records that are
-     * shared with worksheet.c. */
-    chartsheet->worksheet = lxw_worksheet_new(NULL);
-    GOTO_LABEL_ON_MEM_ERROR(chartsheet->worksheet, mem_error);
-
-    if (init_data) {
-        chartsheet->name = init_data->name;
-        chartsheet->quoted_name = init_data->quoted_name;
-        chartsheet->tmpdir = init_data->tmpdir;
-        chartsheet->index = init_data->index;
-        chartsheet->hidden = init_data->hidden;
-        chartsheet->active_sheet = init_data->active_sheet;
-        chartsheet->first_sheet = init_data->first_sheet;
-    }
-
-    chartsheet->worksheet->is_chartsheet = LXW_TRUE;
-    chartsheet->worksheet->zoom_scale_normal = LXW_FALSE;
-    chartsheet->worksheet->orientation = LXW_LANDSCAPE;
-
-    return chartsheet;
-
-mem_error:
-    lxw_chartsheet_free(chartsheet);
-    return NULL;
-}
-
-/*
- * Free a chartsheet object.
- */
-void
-lxw_chartsheet_free(lxw_chartsheet *chartsheet)
-{
-    if (!chartsheet)
-        return;
-
-    lxw_worksheet_free(chartsheet->worksheet);
-    free((void *) chartsheet->name);
-    free((void *) chartsheet->quoted_name);
-    free(chartsheet);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_chartsheet_xml_declaration(lxw_chartsheet *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <chartsheet> element.
- */
-STATIC void
-_chartsheet_write_chartsheet(lxw_chartsheet *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] = "http://schemas.openxmlformats.org/"
-        "spreadsheetml/2006/main";
-    char xmlns_r[] = "http://schemas.openxmlformats.org/"
-        "officeDocument/2006/relationships";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:r", xmlns_r);
-
-    lxw_xml_start_tag(self->file, "chartsheet", &attributes);
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <sheetPr> element.
- */
-STATIC void
-_chartsheet_write_sheet_pr(lxw_chartsheet *self)
-{
-    lxw_worksheet_write_sheet_pr(self->worksheet);
-}
-
-/*
- * Write the <sheetViews> element.
- */
-STATIC void
-_chartsheet_write_sheet_views(lxw_chartsheet *self)
-{
-    lxw_worksheet_write_sheet_views(self->worksheet);
-}
-
-/*
- * Write the <pageMargins> element.
- */
-STATIC void
-_chartsheet_write_page_margins(lxw_chartsheet *self)
-{
-    lxw_worksheet_write_page_margins(self->worksheet);
-}
-
-/*
- * Write the <drawing> elements.
- */
-STATIC void
-_chartsheet_write_drawings(lxw_chartsheet *self)
-{
-    lxw_worksheet_write_drawings(self->worksheet);
-}
-
-/*
- * Write the <sheetProtection> element.
- */
-STATIC void
-_chartsheet_write_sheet_protection(lxw_chartsheet *self)
-{
-    lxw_worksheet_write_sheet_protection(self->worksheet, &self->protection);
-}
-
-/*
- * Write the <pageSetup> element.
- */
-STATIC void
-_chartsheet_write_page_setup(lxw_chartsheet *self)
-{
-    lxw_worksheet_write_page_setup(self->worksheet);
-}
-
-/*
- * Write the <headerFooter> element.
- */
-STATIC void
-_chartsheet_write_header_footer(lxw_chartsheet *self)
-{
-    lxw_worksheet_write_header_footer(self->worksheet);
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_chartsheet_assemble_xml_file(lxw_chartsheet *self)
-{
-    /* Set the embedded worksheet filehandle to the same as the chartsheet. */
-    self->worksheet->file = self->file;
-
-    /* Write the XML declaration. */
-    _chartsheet_xml_declaration(self);
-
-    /* Write the chartsheet element. */
-    _chartsheet_write_chartsheet(self);
-
-    /* Write the sheetPr element. */
-    _chartsheet_write_sheet_pr(self);
-
-    /* Write the sheetViews element. */
-    _chartsheet_write_sheet_views(self);
-
-    /* Write the sheetProtection element. */
-    _chartsheet_write_sheet_protection(self);
-
-    /* Write the pageMargins element. */
-    _chartsheet_write_page_margins(self);
-
-    /* Write the chartsheet page setup. */
-    _chartsheet_write_page_setup(self);
-
-    /* Write the headerFooter element. */
-    _chartsheet_write_header_footer(self);
-
-    /* Write the drawing element. */
-    _chartsheet_write_drawings(self);
-
-    lxw_xml_end_tag(self->file, "chartsheet");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/
-/*
- * Set a chartsheet chart, with options.
- */
-lxw_error
-chartsheet_set_chart_opt(lxw_chartsheet *self,
-                         lxw_chart *chart, lxw_chart_options *user_options)
-{
-    lxw_object_properties *object_props;
-    lxw_chart_series *series;
-
-    if (!chart) {
-        LXW_WARN("chartsheet_set_chart()/_opt(): chart must be non-NULL.");
-        return LXW_ERROR_NULL_PARAMETER_IGNORED;
-    }
-
-    /* Check that the chart isn't being used more than once. */
-    if (chart->in_use) {
-        LXW_WARN("chartsheet_set_chart()/_opt(): the same chart object "
-                 "cannot be set for a chartsheet more than once.");
-
-        return LXW_ERROR_PARAMETER_VALIDATION;
-    }
-
-    /* Check that the chart has a data series. */
-    if (STAILQ_EMPTY(chart->series_list)) {
-        LXW_WARN("chartsheet_set_chart()/_opt(): chart must have a series.");
-
-        return LXW_ERROR_PARAMETER_VALIDATION;
-    }
-
-    /* Check that the chart has a 'values' series. */
-    STAILQ_FOREACH(series, chart->series_list, list_pointers) {
-        if (!series->values->formula && !series->values->sheetname) {
-            LXW_WARN("chartsheet_set_chart()/_opt(): chart must have a "
-                     "'values' series.");
-
-            return LXW_ERROR_PARAMETER_VALIDATION;
-        }
-    }
-
-    /* Create a new object to hold the chart image properties. */
-    object_props = calloc(1, sizeof(lxw_object_properties));
-    RETURN_ON_MEM_ERROR(object_props, LXW_ERROR_MEMORY_MALLOC_FAILED);
-
-    if (user_options) {
-        object_props->x_offset = user_options->x_offset;
-        object_props->y_offset = user_options->y_offset;
-        object_props->x_scale = user_options->x_scale;
-        object_props->y_scale = user_options->y_scale;
-    }
-
-    object_props->width = 480;
-    object_props->height = 288;
-
-    if (object_props->x_scale == 0.0)
-        object_props->x_scale = 1;
-
-    if (object_props->y_scale == 0.0)
-        object_props->y_scale = 1;
-
-    /* Store chart references so they can be ordered in the workbook. */
-    object_props->chart = chart;
-
-    /* Store the chart data in the embedded worksheet. */
-    STAILQ_INSERT_TAIL(self->worksheet->chart_data, object_props,
-                       list_pointers);
-
-    chart->in_use = LXW_TRUE;
-    chart->is_chartsheet = LXW_TRUE;
-
-    chart->is_protected = self->is_protected;
-
-    self->chart = chart;
-
-    return LXW_NO_ERROR;
-}
-
-/*
- * Set a chartsheet charts.
- */
-lxw_error
-chartsheet_set_chart(lxw_chartsheet *self, lxw_chart *chart)
-{
-    return chartsheet_set_chart_opt(self, chart, NULL);
-}
-
-/*
- * Set this chartsheet as a selected worksheet, i.e. the worksheet has its tab
- * highlighted.
- */
-void
-chartsheet_select(lxw_chartsheet *self)
-{
-    self->selected = LXW_TRUE;
-
-    /* Selected worksheet can't be hidden. */
-    self->hidden = LXW_FALSE;
-}
-
-/*
- * Set this chartsheet as the active worksheet, i.e. the worksheet that is
- * displayed when the workbook is opened. Also set it as selected.
- */
-void
-chartsheet_activate(lxw_chartsheet *self)
-{
-    self->worksheet->selected = LXW_TRUE;
-    self->worksheet->active = LXW_TRUE;
-
-    /* Active worksheet can't be hidden. */
-    self->worksheet->hidden = LXW_FALSE;
-
-    *self->active_sheet = self->index;
-}
-
-/*
- * Set this chartsheet as the first visible sheet. This is necessary
- * when there are a large number of worksheets and the activated
- * worksheet is not visible on the screen.
- */
-void
-chartsheet_set_first_sheet(lxw_chartsheet *self)
-{
-    /* Active worksheet can't be hidden. */
-    self->hidden = LXW_FALSE;
-
-    *self->first_sheet = self->index;
-}
-
-/*
- * Hide this chartsheet.
- */
-void
-chartsheet_hide(lxw_chartsheet *self)
-{
-    self->hidden = LXW_TRUE;
-
-    /* A hidden worksheet shouldn't be active or selected. */
-    self->selected = LXW_FALSE;
-
-    /* If this is active_sheet or first_sheet reset the workbook value. */
-    if (*self->first_sheet == self->index)
-        *self->first_sheet = 0;
-
-    if (*self->active_sheet == self->index)
-        *self->active_sheet = 0;
-}
-
-/*
- * Set the color of the chartsheet tab.
- */
-void
-chartsheet_set_tab_color(lxw_chartsheet *self, lxw_color_t color)
-{
-    self->worksheet->tab_color = color;
-}
-
-/*
- * Set the chartsheet protection flags to prevent modification of chartsheet
- * objects.
- */
-void
-chartsheet_protect(lxw_chartsheet *self, const char *password,
-                   lxw_protection *options)
-{
-    struct lxw_protection_obj *protect = &self->protection;
-
-    /* Copy any user parameters to the internal structure. */
-    if (options) {
-        protect->objects = options->no_objects;
-        protect->no_content = options->no_content;
-    }
-    else {
-        protect->objects = LXW_FALSE;
-        protect->no_content = LXW_FALSE;
-    }
-
-    if (password) {
-        uint16_t hash = lxw_hash_password(password);
-        lxw_snprintf(protect->hash, 5, "%X", hash);
-    }
-    else {
-        if (protect->objects && protect->no_content)
-            return;
-    }
-
-    protect->no_sheet = LXW_TRUE;
-    protect->scenarios = LXW_TRUE;
-    protect->is_configured = LXW_TRUE;
-
-    if (self->chart)
-        self->chart->is_protected = LXW_TRUE;
-    else
-        self->is_protected = LXW_TRUE;
-}
-
-/*
- * Set the chartsheet zoom factor.
- */
-void
-chartsheet_set_zoom(lxw_chartsheet *self, uint16_t scale)
-{
-    /* Confine the scale to Excel"s range */
-    if (scale < 10 || scale > 400) {
-        LXW_WARN("chartsheet_set_zoom(): "
-                 "Zoom factor scale outside range: 10 <= zoom <= 400.");
-        return;
-    }
-
-    self->worksheet->zoom = scale;
-}
-
-/*
- * Set the page orientation as portrait.
- */
-void
-chartsheet_set_portrait(lxw_chartsheet *self)
-{
-    worksheet_set_portrait(self->worksheet);
-}
-
-/*
- * Set the page orientation as landscape.
- */
-void
-chartsheet_set_landscape(lxw_chartsheet *self)
-{
-    worksheet_set_landscape(self->worksheet);
-}
-
-/*
- * Set the paper type. Example. 1 = US Letter, 9 = A4
- */
-void
-chartsheet_set_paper(lxw_chartsheet *self, uint8_t paper_size)
-{
-    worksheet_set_paper(self->worksheet, paper_size);
-}
-
-/*
- * Set all the page margins in inches.
- */
-void
-chartsheet_set_margins(lxw_chartsheet *self, double left, double right,
-                       double top, double bottom)
-{
-    worksheet_set_margins(self->worksheet, left, right, top, bottom);
-}
-
-/*
- * Set the page header caption and options.
- */
-lxw_error
-chartsheet_set_header_opt(lxw_chartsheet *self, const char *string,
-                          lxw_header_footer_options *options)
-{
-    return worksheet_set_header_opt(self->worksheet, string, options);
-}
-
-/*
- * Set the page footer caption and options.
- */
-lxw_error
-chartsheet_set_footer_opt(lxw_chartsheet *self, const char *string,
-                          lxw_header_footer_options *options)
-{
-    return worksheet_set_footer_opt(self->worksheet, string, options);
-}
-
-/*
- * Set the page header caption.
- */
-lxw_error
-chartsheet_set_header(lxw_chartsheet *self, const char *string)
-{
-    return chartsheet_set_header_opt(self, string, NULL);
-}
-
-/*
- * Set the page footer caption.
- */
-lxw_error
-chartsheet_set_footer(lxw_chartsheet *self, const char *string)
-{
-    return chartsheet_set_footer_opt(self, string, NULL);
-}

+ 0 - 444
src/3rdparty/libxlsxwriter/src/comment.c

@@ -1,444 +0,0 @@
-/*****************************************************************************
- * comment - A library for creating Excel XLSX comment files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/comment.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-STATIC int _author_id_cmp(lxw_author_id *tuple1, lxw_author_id *tuple2);
-
-#ifndef __clang_analyzer__
-LXW_RB_GENERATE_AUTHOR_IDS(lxw_author_ids, lxw_author_id,
-                           tree_pointers, _author_id_cmp);
-#endif
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Comparator for the author ids.
- */
-STATIC int
-_author_id_cmp(lxw_author_id *author_id1, lxw_author_id *author_id2)
-{
-    return strcmp(author_id1->author, author_id2->author);
-}
-
-/*
- * Check if an author already existing in the author/id table.
- */
-STATIC uint8_t
-_check_author(lxw_comment *self, char *author)
-{
-    lxw_author_id tmp_author_id;
-    lxw_author_id *existing_author = NULL;
-
-    if (!author)
-        return LXW_TRUE;
-
-    tmp_author_id.author = author;
-    existing_author = RB_FIND(lxw_author_ids,
-                              self->author_ids, &tmp_author_id);
-
-    if (existing_author)
-        return LXW_TRUE;
-    else
-        return LXW_FALSE;
-}
-
-/*
- * Get the index used for an author name.
- */
-STATIC uint32_t
-_get_author_index(lxw_comment *self, char *author)
-{
-    lxw_author_id tmp_author_id;
-    lxw_author_id *existing_author = NULL;
-    lxw_author_id *new_author_id = NULL;
-
-    if (!author)
-        return 0;
-
-    tmp_author_id.author = author;
-    existing_author = RB_FIND(lxw_author_ids,
-                              self->author_ids, &tmp_author_id);
-
-    if (existing_author) {
-        return existing_author->id;
-    }
-    else {
-        new_author_id = calloc(1, sizeof(lxw_author_id));
-
-        if (new_author_id) {
-            new_author_id->id = self->author_id;
-            new_author_id->author = lxw_strdup(author);
-            self->author_id++;
-
-            RB_INSERT(lxw_author_ids, self->author_ids, new_author_id);
-
-            return new_author_id->id;
-        }
-        else {
-            return 0;
-        }
-    }
-}
-
-/*
- * Create a new comment object.
- */
-lxw_comment *
-lxw_comment_new(void)
-{
-    lxw_comment *comment = calloc(1, sizeof(lxw_comment));
-    GOTO_LABEL_ON_MEM_ERROR(comment, mem_error);
-
-    comment->author_ids = calloc(1, sizeof(struct lxw_author_ids));
-    GOTO_LABEL_ON_MEM_ERROR(comment->author_ids, mem_error);
-    RB_INIT(comment->author_ids);
-
-    return comment;
-
-mem_error:
-    lxw_comment_free(comment);
-    return NULL;
-}
-
-/*
- * Free a comment object.
- */
-void
-lxw_comment_free(lxw_comment *comment)
-{
-    struct lxw_author_id *author_id;
-    struct lxw_author_id *next_author_id;
-
-    if (!comment)
-        return;
-
-    if (comment->author_ids) {
-        for (author_id =
-             RB_MIN(lxw_author_ids, comment->author_ids);
-             author_id; author_id = next_author_id) {
-
-            next_author_id =
-                RB_NEXT(lxw_author_ids, worksheet->author_id, author_id);
-            RB_REMOVE(lxw_author_ids, comment->author_ids, author_id);
-            free(author_id->author);
-            free(author_id);
-        }
-
-        free(comment->author_ids);
-    }
-
-    free(comment);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_comment_xml_declaration(lxw_comment *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Write the <t> element.
- */
-STATIC void
-_comment_write_text_t(lxw_comment *self, lxw_vml_obj *comment_obj)
-{
-    lxw_xml_data_element(self->file, "t", comment_obj->text, NULL);
-}
-
-/*
- * Write the <family> element.
- */
-STATIC void
-_comment_write_family(lxw_comment *self, lxw_vml_obj *comment_obj)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("val", comment_obj->font_family);
-
-    lxw_xml_empty_tag(self->file, "family", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <rFont> element.
- */
-STATIC void
-_comment_write_r_font(lxw_comment *self, lxw_vml_obj *comment_obj)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char font_name[LXW_ATTR_32];
-
-    if (comment_obj->font_name)
-        lxw_snprintf(font_name, LXW_ATTR_32, "%s", comment_obj->font_name);
-    else
-        lxw_snprintf(font_name, LXW_ATTR_32, "Tahoma");
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("val", font_name);
-
-    lxw_xml_empty_tag(self->file, "rFont", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <color> element.
- */
-STATIC void
-_comment_write_color(lxw_comment *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char indexed[] = "81";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("indexed", indexed);
-
-    lxw_xml_empty_tag(self->file, "color", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <sz> element.
- */
-STATIC void
-_comment_write_sz(lxw_comment *self, lxw_vml_obj *comment_obj)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_DBL("val", comment_obj->font_size);
-
-    lxw_xml_empty_tag(self->file, "sz", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <rPr> element.
- */
-STATIC void
-_comment_write_r_pr(lxw_comment *self, lxw_vml_obj *comment_obj)
-{
-    lxw_xml_start_tag(self->file, "rPr", NULL);
-
-    /* Write the sz element. */
-    _comment_write_sz(self, comment_obj);
-
-    /* Write the color element. */
-    _comment_write_color(self);
-
-    /* Write the rFont element. */
-    _comment_write_r_font(self, comment_obj);
-
-    /* Write the family element. */
-    _comment_write_family(self, comment_obj);
-
-    lxw_xml_end_tag(self->file, "rPr");
-}
-
-/*
- * Write the <r> element.
- */
-STATIC void
-_comment_write_r(lxw_comment *self, lxw_vml_obj *comment_obj)
-{
-    lxw_xml_start_tag(self->file, "r", NULL);
-
-    /* Write the rPr element. */
-    _comment_write_r_pr(self, comment_obj);
-
-    /* Write the t element. */
-    _comment_write_text_t(self, comment_obj);
-
-    lxw_xml_end_tag(self->file, "r");
-}
-
-/*
- * Write the <text> element.
- */
-STATIC void
-_comment_write_text(lxw_comment *self, lxw_vml_obj *comment_obj)
-{
-    lxw_xml_start_tag(self->file, "text", NULL);
-
-    /* Write the r element. */
-    _comment_write_r(self, comment_obj);
-
-    lxw_xml_end_tag(self->file, "text");
-}
-
-/*
- * Write the <comment> element.
- */
-STATIC void
-_comment_write_comment(lxw_comment *self, lxw_vml_obj *comment_obj)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char ref[LXW_MAX_CELL_NAME_LENGTH];
-
-    lxw_rowcol_to_cell(ref, comment_obj->row, comment_obj->col);
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("ref", ref);
-    LXW_PUSH_ATTRIBUTES_INT("authorId", comment_obj->author_id);
-
-    lxw_xml_start_tag(self->file, "comment", &attributes);
-
-    /* Write the text element. */
-    _comment_write_text(self, comment_obj);
-
-    lxw_xml_end_tag(self->file, "comment");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <commentList> element.
- */
-STATIC void
-_comment_write_comment_list(lxw_comment *self)
-{
-    lxw_vml_obj *comment_obj;
-
-    lxw_xml_start_tag(self->file, "commentList", NULL);
-
-    STAILQ_FOREACH(comment_obj, self->comment_objs, list_pointers) {
-        /* Write the comment element. */
-        _comment_write_comment(self, comment_obj);
-    }
-
-    lxw_xml_end_tag(self->file, "commentList");
-
-}
-
-/*
- * Write the <author> element.
- */
-STATIC void
-_comment_write_author(lxw_comment *self, char *author)
-{
-    lxw_xml_data_element(self->file, "author", author, NULL);
-}
-
-/*
- * Write the <authors> element.
- */
-STATIC void
-_comment_write_authors(lxw_comment *self)
-{
-    lxw_vml_obj *comment_obj;
-    char *author;
-
-    lxw_xml_start_tag(self->file, "authors", NULL);
-
-    /* Set the default author (from worksheet_set_comments_author()). */
-    if (self->comment_author) {
-        _get_author_index(self, self->comment_author);
-        _comment_write_author(self, self->comment_author);
-    }
-    else {
-        _get_author_index(self, "");
-        _comment_write_author(self, "");
-    }
-
-    STAILQ_FOREACH(comment_obj, self->comment_objs, list_pointers) {
-        author = comment_obj->author;
-
-        if (author) {
-
-            if (!_check_author(self, author))
-                _comment_write_author(self, author);
-
-            comment_obj->author_id = _get_author_index(self, author);
-        }
-    }
-
-    lxw_xml_end_tag(self->file, "authors");
-}
-
-/*
- * Write the <comments> element.
- */
-STATIC void
-_comment_write_comments(lxw_comment *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] =
-        "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-
-    lxw_xml_start_tag(self->file, "comments", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_comment_assemble_xml_file(lxw_comment *self)
-{
-    /* Write the XML declaration. */
-    _comment_xml_declaration(self);
-
-    /* Write the comments element. */
-    _comment_write_comments(self);
-
-    /* Write the authors element. */
-    _comment_write_authors(self);
-
-    /* Write the commentList element. */
-    _comment_write_comment_list(self);
-
-    lxw_xml_end_tag(self->file, "comments");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 413
src/3rdparty/libxlsxwriter/src/content_types.c

@@ -1,413 +0,0 @@
-/*****************************************************************************
- * content_types - A library for creating Excel XLSX content_types files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/content_types.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new content_types object.
- */
-lxw_content_types *
-lxw_content_types_new(void)
-{
-    lxw_content_types *content_types = calloc(1, sizeof(lxw_content_types));
-    GOTO_LABEL_ON_MEM_ERROR(content_types, mem_error);
-
-    content_types->default_types = calloc(1, sizeof(struct lxw_tuples));
-    GOTO_LABEL_ON_MEM_ERROR(content_types->default_types, mem_error);
-    STAILQ_INIT(content_types->default_types);
-
-    content_types->overrides = calloc(1, sizeof(struct lxw_tuples));
-    GOTO_LABEL_ON_MEM_ERROR(content_types->overrides, mem_error);
-    STAILQ_INIT(content_types->overrides);
-
-    lxw_ct_add_default(content_types, "rels",
-                       LXW_APP_PACKAGE "relationships+xml");
-    lxw_ct_add_default(content_types, "xml", "application/xml");
-
-    lxw_ct_add_override(content_types, "/docProps/app.xml",
-                        LXW_APP_DOCUMENT "extended-properties+xml");
-    lxw_ct_add_override(content_types, "/docProps/core.xml",
-                        LXW_APP_PACKAGE "core-properties+xml");
-    lxw_ct_add_override(content_types, "/xl/styles.xml",
-                        LXW_APP_DOCUMENT "spreadsheetml.styles+xml");
-    lxw_ct_add_override(content_types, "/xl/theme/theme1.xml",
-                        LXW_APP_DOCUMENT "theme+xml");
-
-    return content_types;
-
-mem_error:
-    lxw_content_types_free(content_types);
-    return NULL;
-}
-
-/*
- * Free a content_types object.
- */
-void
-lxw_content_types_free(lxw_content_types *content_types)
-{
-    lxw_tuple *default_type;
-    lxw_tuple *override;
-
-    if (!content_types)
-        return;
-
-    if (content_types->default_types) {
-        while (!STAILQ_EMPTY(content_types->default_types)) {
-            default_type = STAILQ_FIRST(content_types->default_types);
-            STAILQ_REMOVE_HEAD(content_types->default_types, list_pointers);
-            free(default_type->key);
-            free(default_type->value);
-            free(default_type);
-        }
-        free(content_types->default_types);
-    }
-
-    if (content_types->overrides) {
-        while (!STAILQ_EMPTY(content_types->overrides)) {
-            override = STAILQ_FIRST(content_types->overrides);
-            STAILQ_REMOVE_HEAD(content_types->overrides, list_pointers);
-            free(override->key);
-            free(override->value);
-            free(override);
-        }
-        free(content_types->overrides);
-    }
-
-    free(content_types);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_content_types_xml_declaration(lxw_content_types *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <Types> element.
- */
-STATIC void
-_write_types(lxw_content_types *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", LXW_SCHEMA_CONTENT);
-
-    lxw_xml_start_tag(self->file, "Types", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <Default> element.
- */
-STATIC void
-_write_default(lxw_content_types *self, const char *ext, const char *type)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("Extension", ext);
-    LXW_PUSH_ATTRIBUTES_STR("ContentType", type);
-
-    lxw_xml_empty_tag(self->file, "Default", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <Override> element.
- */
-STATIC void
-_write_override(lxw_content_types *self, const char *part_name,
-                const char *type)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("PartName", part_name);
-    LXW_PUSH_ATTRIBUTES_STR("ContentType", type);
-
-    lxw_xml_empty_tag(self->file, "Override", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Write out all of the <Default> types.
- */
-STATIC void
-_write_defaults(lxw_content_types *self)
-{
-    lxw_tuple *tuple;
-
-    STAILQ_FOREACH(tuple, self->default_types, list_pointers) {
-        _write_default(self, tuple->key, tuple->value);
-    }
-}
-
-/*
- * Write out all of the <Override> types.
- */
-STATIC void
-_write_overrides(lxw_content_types *self)
-{
-    lxw_tuple *tuple;
-
-    STAILQ_FOREACH(tuple, self->overrides, list_pointers) {
-        _write_override(self, tuple->key, tuple->value);
-    }
-}
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_content_types_assemble_xml_file(lxw_content_types *self)
-{
-    /* Write the XML declaration. */
-    _content_types_xml_declaration(self);
-
-    _write_types(self);
-    _write_defaults(self);
-    _write_overrides(self);
-
-    /* Close the content_types tag. */
-    lxw_xml_end_tag(self->file, "Types");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/
-/*
- * Add elements to the ContentTypes defaults.
- */
-void
-lxw_ct_add_default(lxw_content_types *self, const char *key,
-                   const char *value)
-{
-    lxw_tuple *tuple;
-
-    if (!key || !value)
-        return;
-
-    tuple = calloc(1, sizeof(lxw_tuple));
-    GOTO_LABEL_ON_MEM_ERROR(tuple, mem_error);
-
-    tuple->key = lxw_strdup(key);
-    GOTO_LABEL_ON_MEM_ERROR(tuple->key, mem_error);
-
-    tuple->value = lxw_strdup(value);
-    GOTO_LABEL_ON_MEM_ERROR(tuple->value, mem_error);
-
-    STAILQ_INSERT_TAIL(self->default_types, tuple, list_pointers);
-
-    return;
-
-mem_error:
-    if (tuple) {
-        free(tuple->key);
-        free(tuple->value);
-        free(tuple);
-    }
-}
-
-/*
- * Add elements to the ContentTypes overrides.
- */
-void
-lxw_ct_add_override(lxw_content_types *self, const char *key,
-                    const char *value)
-{
-    lxw_tuple *tuple;
-
-    if (!key || !value)
-        return;
-
-    tuple = calloc(1, sizeof(lxw_tuple));
-    GOTO_LABEL_ON_MEM_ERROR(tuple, mem_error);
-
-    tuple->key = lxw_strdup(key);
-    GOTO_LABEL_ON_MEM_ERROR(tuple->key, mem_error);
-
-    tuple->value = lxw_strdup(value);
-    GOTO_LABEL_ON_MEM_ERROR(tuple->value, mem_error);
-
-    STAILQ_INSERT_TAIL(self->overrides, tuple, list_pointers);
-
-    return;
-
-mem_error:
-    if (tuple) {
-        free(tuple->key);
-        free(tuple->value);
-        free(tuple);
-    }
-}
-
-/*
- * Add the name of a worksheet to the ContentTypes overrides.
- */
-void
-lxw_ct_add_worksheet_name(lxw_content_types *self, const char *name)
-{
-    lxw_ct_add_override(self, name,
-                        LXW_APP_DOCUMENT "spreadsheetml.worksheet+xml");
-}
-
-/*
- * Add the name of a chartsheet to the ContentTypes overrides.
- */
-void
-lxw_ct_add_chartsheet_name(lxw_content_types *self, const char *name)
-{
-    lxw_ct_add_override(self, name,
-                        LXW_APP_DOCUMENT "spreadsheetml.chartsheet+xml");
-}
-
-/*
- * Add the name of a chart to the ContentTypes overrides.
- */
-void
-lxw_ct_add_chart_name(lxw_content_types *self, const char *name)
-{
-    lxw_ct_add_override(self, name, LXW_APP_DOCUMENT "drawingml.chart+xml");
-}
-
-/*
- * Add the name of a drawing to the ContentTypes overrides.
- */
-void
-lxw_ct_add_drawing_name(lxw_content_types *self, const char *name)
-{
-    lxw_ct_add_override(self, name, LXW_APP_DOCUMENT "drawing+xml");
-}
-
-/*
- * Add the name of a table to the ContentTypes overrides.
- */
-void
-lxw_ct_add_table_name(lxw_content_types *self, const char *name)
-{
-    lxw_ct_add_override(self, name,
-                        LXW_APP_DOCUMENT "spreadsheetml.table+xml");
-}
-
-/*
- * Add the name of a VML drawing to the ContentTypes overrides.
- */
-void
-lxw_ct_add_vml_name(lxw_content_types *self)
-{
-    lxw_ct_add_default(self, "vml", LXW_APP_DOCUMENT "vmlDrawing");
-}
-
-/*
- * Add the name of a comment to the ContentTypes overrides.
- */
-void
-lxw_ct_add_comment_name(lxw_content_types *self, const char *name)
-{
-    lxw_ct_add_override(self, name,
-                        LXW_APP_DOCUMENT "spreadsheetml.comments+xml");
-}
-
-/*
- * Add the sharedStrings link to the ContentTypes overrides.
- */
-void
-lxw_ct_add_shared_strings(lxw_content_types *self)
-{
-    lxw_ct_add_override(self, "/xl/sharedStrings.xml",
-                        LXW_APP_DOCUMENT "spreadsheetml.sharedStrings+xml");
-}
-
-/*
- * Add the calcChain link to the ContentTypes overrides.
- */
-void
-lxw_ct_add_calc_chain(lxw_content_types *self)
-{
-    lxw_ct_add_override(self, "/xl/calcChain.xml",
-                        LXW_APP_DOCUMENT "spreadsheetml.calcChain+xml");
-}
-
-/*
- * Add the custom properties to the ContentTypes overrides.
- */
-void
-lxw_ct_add_custom_properties(lxw_content_types *self)
-{
-    lxw_ct_add_override(self, "/docProps/custom.xml",
-                        LXW_APP_DOCUMENT "custom-properties+xml");
-}
-
-/*
- * Add the metadata file to the ContentTypes overrides.
- */
-void
-lxw_ct_add_metadata(lxw_content_types *self)
-{
-    lxw_ct_add_override(self, "/xl/metadata.xml",
-                        LXW_APP_DOCUMENT "spreadsheetml.sheetMetadata+xml");
-}
-
-/*
- * Add the richValue files to the ContentTypes overrides.
- */
-void
-lxw_ct_add_rich_value(lxw_content_types *self)
-{
-    lxw_ct_add_override(self, "/xl/richData/rdRichValueTypes.xml",
-                        LXW_APP_MSEXCEL "rdrichvaluetypes+xml");
-
-    lxw_ct_add_override(self, "/xl/richData/rdrichvalue.xml",
-                        LXW_APP_MSEXCEL "rdrichvalue+xml");
-
-    lxw_ct_add_override(self, "/xl/richData/rdrichvaluestructure.xml",
-                        LXW_APP_MSEXCEL "rdrichvaluestructure+xml");
-
-    lxw_ct_add_override(self, "/xl/richData/richValueRel.xml",
-                        LXW_APP_MSEXCEL "richvaluerel+xml");
-
-}

+ 0 - 294
src/3rdparty/libxlsxwriter/src/core.c

@@ -1,294 +0,0 @@
-/*****************************************************************************
- * core - A library for creating Excel XLSX core files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/core.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new core object.
- */
-lxw_core *
-lxw_core_new(void)
-{
-    lxw_core *core = calloc(1, sizeof(lxw_core));
-    GOTO_LABEL_ON_MEM_ERROR(core, mem_error);
-
-    return core;
-
-mem_error:
-    lxw_core_free(core);
-    return NULL;
-}
-
-/*
- * Free a core object.
- */
-void
-lxw_core_free(lxw_core *core)
-{
-    if (!core)
-        return;
-
-    free(core);
-}
-
-/*
- * Convert a time_t to a ISO 8601 style "2010-01-01T00:00:00Z" date.
- */
-static void
-_datetime_to_iso8601_date(time_t *timer, char *str, size_t size)
-{
-    struct tm *tmp_datetime;
-    time_t current_time = time(NULL);
-
-    if (*timer)
-        tmp_datetime = gmtime(timer);
-    else
-        tmp_datetime = gmtime(&current_time);
-
-    strftime(str, size - 1, "%Y-%m-%dT%H:%M:%SZ", tmp_datetime);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_core_xml_declaration(lxw_core *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <cp:coreProperties> element.
- */
-STATIC void
-_write_cp_core_properties(lxw_core *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:cp",
-                            "http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:dc", "http://purl.org/dc/elements/1.1/");
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:dcterms", "http://purl.org/dc/terms/");
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:dcmitype", "http://purl.org/dc/dcmitype/");
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:xsi",
-                            "http://www.w3.org/2001/XMLSchema-instance");
-
-    lxw_xml_start_tag(self->file, "cp:coreProperties", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <dc:creator> element.
- */
-STATIC void
-_write_dc_creator(lxw_core *self)
-{
-    if (self->properties->author) {
-        lxw_xml_data_element(self->file, "dc:creator",
-                             self->properties->author, NULL);
-    }
-    else {
-        lxw_xml_data_element(self->file, "dc:creator", "", NULL);
-    }
-}
-
-/*
- * Write the <cp:lastModifiedBy> element.
- */
-STATIC void
-_write_cp_last_modified_by(lxw_core *self)
-{
-    if (self->properties->author) {
-        lxw_xml_data_element(self->file, "cp:lastModifiedBy",
-                             self->properties->author, NULL);
-    }
-    else {
-        lxw_xml_data_element(self->file, "cp:lastModifiedBy", "", NULL);
-    }
-}
-
-/*
- * Write the <dcterms:created> element.
- */
-STATIC void
-_write_dcterms_created(lxw_core *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char datetime[LXW_ATTR_32];
-
-    _datetime_to_iso8601_date(&self->properties->created, datetime,
-                              LXW_ATTR_32);
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xsi:type", "dcterms:W3CDTF");
-
-    lxw_xml_data_element(self->file, "dcterms:created", datetime,
-                         &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <dcterms:modified> element.
- */
-STATIC void
-_write_dcterms_modified(lxw_core *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char datetime[LXW_ATTR_32];
-
-    _datetime_to_iso8601_date(&self->properties->created, datetime,
-                              LXW_ATTR_32);
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xsi:type", "dcterms:W3CDTF");
-
-    lxw_xml_data_element(self->file, "dcterms:modified", datetime,
-                         &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <dc:title> element.
- */
-STATIC void
-_write_dc_title(lxw_core *self)
-{
-    if (!self->properties->title)
-        return;
-
-    lxw_xml_data_element(self->file, "dc:title", self->properties->title,
-                         NULL);
-}
-
-/*
- * Write the <dc:subject> element.
- */
-STATIC void
-_write_dc_subject(lxw_core *self)
-{
-    if (!self->properties->subject)
-        return;
-
-    lxw_xml_data_element(self->file, "dc:subject", self->properties->subject,
-                         NULL);
-}
-
-/*
- * Write the <cp:keywords> element.
- */
-STATIC void
-_write_cp_keywords(lxw_core *self)
-{
-    if (!self->properties->keywords)
-        return;
-
-    lxw_xml_data_element(self->file, "cp:keywords",
-                         self->properties->keywords, NULL);
-}
-
-/*
- * Write the <dc:description> element.
- */
-STATIC void
-_write_dc_description(lxw_core *self)
-{
-    if (!self->properties->comments)
-        return;
-
-    lxw_xml_data_element(self->file, "dc:description",
-                         self->properties->comments, NULL);
-}
-
-/*
- * Write the <cp:category> element.
- */
-STATIC void
-_write_cp_category(lxw_core *self)
-{
-    if (!self->properties->category)
-        return;
-
-    lxw_xml_data_element(self->file, "cp:category",
-                         self->properties->category, NULL);
-}
-
-/*
- * Write the <cp:contentStatus> element.
- */
-STATIC void
-_write_cp_content_status(lxw_core *self)
-{
-    if (!self->properties->status)
-        return;
-
-    lxw_xml_data_element(self->file, "cp:contentStatus",
-                         self->properties->status, NULL);
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_core_assemble_xml_file(lxw_core *self)
-{
-    /* Write the XML declaration. */
-    _core_xml_declaration(self);
-
-    _write_cp_core_properties(self);
-    _write_dc_title(self);
-    _write_dc_subject(self);
-    _write_dc_creator(self);
-    _write_cp_keywords(self);
-    _write_dc_description(self);
-    _write_cp_last_modified_by(self);
-    _write_dcterms_created(self);
-    _write_dcterms_modified(self);
-    _write_cp_category(self);
-    _write_cp_content_status(self);
-
-    lxw_xml_end_tag(self->file, "cp:coreProperties");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 225
src/3rdparty/libxlsxwriter/src/custom.c

@@ -1,225 +0,0 @@
-/*****************************************************************************
- * custom - A library for creating Excel custom property files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/custom.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new custom object.
- */
-lxw_custom *
-lxw_custom_new(void)
-{
-    lxw_custom *custom = calloc(1, sizeof(lxw_custom));
-    GOTO_LABEL_ON_MEM_ERROR(custom, mem_error);
-
-    return custom;
-
-mem_error:
-    lxw_custom_free(custom);
-    return NULL;
-}
-
-/*
- * Free a custom object.
- */
-void
-lxw_custom_free(lxw_custom *custom)
-{
-    if (!custom)
-        return;
-
-    free(custom);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_custom_xml_declaration(lxw_custom *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <vt:lpwstr> element.
- */
-STATIC void
-_chart_write_vt_lpwstr(lxw_custom *self, char *value)
-{
-    lxw_xml_data_element(self->file, "vt:lpwstr", value, NULL);
-}
-
-/*
- * Write the <vt:r8> element.
- */
-STATIC void
-_chart_write_vt_r_8(lxw_custom *self, double value)
-{
-    char data[LXW_ATTR_32];
-
-    lxw_sprintf_dbl(data, value);
-
-    lxw_xml_data_element(self->file, "vt:r8", data, NULL);
-}
-
-/*
- * Write the <vt:i4> element.
- */
-STATIC void
-_custom_write_vt_i_4(lxw_custom *self, int32_t value)
-{
-    char data[LXW_ATTR_32];
-
-    lxw_snprintf(data, LXW_ATTR_32, "%d", value);
-
-    lxw_xml_data_element(self->file, "vt:i4", data, NULL);
-}
-
-/*
- * Write the <vt:bool> element.
- */
-STATIC void
-_custom_write_vt_bool(lxw_custom *self, uint8_t value)
-{
-    if (value)
-        lxw_xml_data_element(self->file, "vt:bool", "true", NULL);
-    else
-        lxw_xml_data_element(self->file, "vt:bool", "false", NULL);
-}
-
-/*
- * Write the <vt:filetime> element.
- */
-STATIC void
-_custom_write_vt_filetime(lxw_custom *self, lxw_datetime *datetime)
-{
-    char data[LXW_DATETIME_LENGTH];
-
-    lxw_snprintf(data, LXW_DATETIME_LENGTH, "%4d-%02d-%02dT%02d:%02d:%02dZ",
-                 datetime->year, datetime->month, datetime->day,
-                 datetime->hour, datetime->min, (int) datetime->sec);
-
-    lxw_xml_data_element(self->file, "vt:filetime", data, NULL);
-}
-
-/*
- * Write the <property> element.
- */
-STATIC void
-_chart_write_custom_property(lxw_custom *self,
-                             lxw_custom_property *custom_property)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char fmtid[] = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}";
-
-    self->pid++;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("fmtid", fmtid);
-    LXW_PUSH_ATTRIBUTES_INT("pid", self->pid + 1);
-    LXW_PUSH_ATTRIBUTES_STR("name", custom_property->name);
-
-    lxw_xml_start_tag(self->file, "property", &attributes);
-
-    if (custom_property->type == LXW_CUSTOM_STRING) {
-        /* Write the vt:lpwstr element. */
-        _chart_write_vt_lpwstr(self, custom_property->u.string);
-    }
-    else if (custom_property->type == LXW_CUSTOM_DOUBLE) {
-        /* Write the vt:r8 element. */
-        _chart_write_vt_r_8(self, custom_property->u.number);
-    }
-    else if (custom_property->type == LXW_CUSTOM_INTEGER) {
-        /* Write the vt:i4 element. */
-        _custom_write_vt_i_4(self, custom_property->u.integer);
-    }
-    else if (custom_property->type == LXW_CUSTOM_BOOLEAN) {
-        /* Write the vt:bool element. */
-        _custom_write_vt_bool(self, custom_property->u.boolean);
-    }
-    else if (custom_property->type == LXW_CUSTOM_DATETIME) {
-        /* Write the vt:filetime element. */
-        _custom_write_vt_filetime(self, &custom_property->u.datetime);
-    }
-
-    lxw_xml_end_tag(self->file, "property");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <Properties> element.
- */
-STATIC void
-_write_custom_properties(lxw_custom *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] = LXW_SCHEMA_OFFICEDOC "/custom-properties";
-    char xmlns_vt[] = LXW_SCHEMA_OFFICEDOC "/docPropsVTypes";
-    lxw_custom_property *custom_property;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:vt", xmlns_vt);
-
-    lxw_xml_start_tag(self->file, "Properties", &attributes);
-
-    STAILQ_FOREACH(custom_property, self->custom_properties, list_pointers) {
-        _chart_write_custom_property(self, custom_property);
-    }
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_custom_assemble_xml_file(lxw_custom *self)
-{
-    /* Write the XML declaration. */
-    _custom_xml_declaration(self);
-
-    _write_custom_properties(self);
-
-    lxw_xml_end_tag(self->file, "Properties");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 967
src/3rdparty/libxlsxwriter/src/drawing.c

@@ -1,967 +0,0 @@
-/*****************************************************************************
- * drawing - A library for creating Excel XLSX drawing files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/common.h"
-#include "xlsxwriter/drawing.h"
-#include "xlsxwriter/worksheet.h"
-#include "xlsxwriter/utility.h"
-
-#define LXW_OBJ_NAME_LENGTH 14  /* "Picture 65536", or "Chart 65536" */
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new drawing collection.
- */
-lxw_drawing *
-lxw_drawing_new(void)
-{
-    lxw_drawing *drawing = calloc(1, sizeof(lxw_drawing));
-    GOTO_LABEL_ON_MEM_ERROR(drawing, mem_error);
-
-    drawing->drawing_objects = calloc(1, sizeof(struct lxw_drawing_objects));
-    GOTO_LABEL_ON_MEM_ERROR(drawing->drawing_objects, mem_error);
-
-    STAILQ_INIT(drawing->drawing_objects);
-
-    return drawing;
-
-mem_error:
-    lxw_drawing_free(drawing);
-    return NULL;
-}
-
-/*
- * Free a drawing object.
- */
-void
-lxw_free_drawing_object(lxw_drawing_object *drawing_object)
-{
-    if (!drawing_object)
-        return;
-
-    free(drawing_object->description);
-    free(drawing_object->tip);
-
-    free(drawing_object);
-}
-
-/*
- * Free a drawing collection.
- */
-void
-lxw_drawing_free(lxw_drawing *drawing)
-{
-    lxw_drawing_object *drawing_object;
-
-    if (!drawing)
-        return;
-
-    if (drawing->drawing_objects) {
-        while (!STAILQ_EMPTY(drawing->drawing_objects)) {
-            drawing_object = STAILQ_FIRST(drawing->drawing_objects);
-            STAILQ_REMOVE_HEAD(drawing->drawing_objects, list_pointers);
-            lxw_free_drawing_object(drawing_object);
-        }
-
-        free(drawing->drawing_objects);
-    }
-
-    free(drawing);
-}
-
-/*
- * Add a drawing object to the drawing collection.
- */
-void
-lxw_add_drawing_object(lxw_drawing *drawing,
-                       lxw_drawing_object *drawing_object)
-{
-    STAILQ_INSERT_TAIL(drawing->drawing_objects, drawing_object,
-                       list_pointers);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_drawing_xml_declaration(lxw_drawing *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <xdr:wsDr> element.
- */
-STATIC void
-_write_drawing_workspace(lxw_drawing *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns_xdr[] = LXW_SCHEMA_DRAWING "/spreadsheetDrawing";
-    char xmlns_a[] = LXW_SCHEMA_DRAWING "/main";
-
-    LXW_INIT_ATTRIBUTES();
-
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:xdr", xmlns_xdr);
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:a", xmlns_a);
-
-    lxw_xml_start_tag(self->file, "xdr:wsDr", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:col> element.
- */
-STATIC void
-_drawing_write_col(lxw_drawing *self, char *data)
-{
-    lxw_xml_data_element(self->file, "xdr:col", data, NULL);
-}
-
-/*
- * Write the <xdr:colOff> element.
- */
-STATIC void
-_drawing_write_col_off(lxw_drawing *self, char *data)
-{
-    lxw_xml_data_element(self->file, "xdr:colOff", data, NULL);
-}
-
-/*
- * Write the <xdr:row> element.
- */
-STATIC void
-_drawing_write_row(lxw_drawing *self, char *data)
-{
-    lxw_xml_data_element(self->file, "xdr:row", data, NULL);
-}
-
-/*
- * Write the <xdr:rowOff> element.
- */
-STATIC void
-_drawing_write_row_off(lxw_drawing *self, char *data)
-{
-    lxw_xml_data_element(self->file, "xdr:rowOff", data, NULL);
-}
-
-/*
- * Write the main part of the <xdr:from> and <xdr:to> elements.
- */
-STATIC void
-_drawing_write_coords(lxw_drawing *self, lxw_drawing_coords *coords)
-{
-    char data[LXW_UINT32_T_LENGTH];
-
-    lxw_snprintf(data, LXW_UINT32_T_LENGTH, "%u", coords->col);
-    _drawing_write_col(self, data);
-
-    lxw_snprintf(data, LXW_UINT32_T_LENGTH, "%u",
-                 (uint32_t) coords->col_offset);
-    _drawing_write_col_off(self, data);
-
-    lxw_snprintf(data, LXW_UINT32_T_LENGTH, "%u", coords->row);
-    _drawing_write_row(self, data);
-
-    lxw_snprintf(data, LXW_UINT32_T_LENGTH, "%u",
-                 (uint32_t) coords->row_offset);
-    _drawing_write_row_off(self, data);
-}
-
-/*
- * Write the <xdr:from> element.
- */
-STATIC void
-_drawing_write_from(lxw_drawing *self, lxw_drawing_coords *coords)
-{
-    lxw_xml_start_tag(self->file, "xdr:from", NULL);
-
-    _drawing_write_coords(self, coords);
-
-    lxw_xml_end_tag(self->file, "xdr:from");
-}
-
-/*
- * Write the <xdr:to> element.
- */
-STATIC void
-_drawing_write_to(lxw_drawing *self, lxw_drawing_coords *coords)
-{
-    lxw_xml_start_tag(self->file, "xdr:to", NULL);
-
-    _drawing_write_coords(self, coords);
-
-    lxw_xml_end_tag(self->file, "xdr:to");
-}
-
-/*
- * Write the <a:hlinkClick> element.
- */
-STATIC void
-_drawing_write_a_hlink_click(lxw_drawing *self, uint32_t rel_index, char *tip)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns_r[] = "http://schemas.openxmlformats.org/"
-        "officeDocument/2006/relationships";
-    char r_id[LXW_MAX_ATTRIBUTE_LENGTH];
-
-    lxw_snprintf(r_id, LXW_ATTR_32, "rId%d", rel_index);
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:r", xmlns_r);
-    LXW_PUSH_ATTRIBUTES_STR("r:id", r_id);
-
-    if (tip)
-        LXW_PUSH_ATTRIBUTES_STR("tooltip", tip);
-
-    lxw_xml_empty_tag(self->file, "a:hlinkClick", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a16:creationId> element.
- */
-STATIC void
-_drawing_write_a16_creation_id(lxw_drawing *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] = "http://schemas.microsoft.com/office/drawing/2014/main";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:a16", xmlns);
-    LXW_PUSH_ATTRIBUTES_STR("id", "{00000000-0008-0000-0000-000002000000}");
-
-    lxw_xml_empty_tag(self->file, "a16:creationId", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <adec:decorative> element.
- */
-STATIC void
-_workbook_write_adec_decorative(lxw_drawing *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] =
-        "http://schemas.microsoft.com/office/drawing/2017/decorative";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:adec", xmlns);
-    LXW_PUSH_ATTRIBUTES_STR("val", "1");
-
-    lxw_xml_empty_tag(self->file, "adec:decorative", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a:ext> element.
- */
-STATIC void
-_drawing_write_uri_ext(lxw_drawing *self, char *uri)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("uri", uri);
-
-    lxw_xml_start_tag(self->file, "a:ext", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the decorative elements.
- */
-STATIC void
-_workbook_write_decorative(lxw_drawing *self)
-{
-    lxw_xml_start_tag(self->file, "a:extLst", NULL);
-
-    _drawing_write_uri_ext(self, "{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}");
-    _drawing_write_a16_creation_id(self);
-    lxw_xml_end_tag(self->file, "a:ext");
-
-    _drawing_write_uri_ext(self, "{C183D7F6-B498-43B3-948B-1728B52AA6E4}");
-    _workbook_write_adec_decorative(self);
-    lxw_xml_end_tag(self->file, "a:ext");
-
-    lxw_xml_end_tag(self->file, "a:extLst");
-}
-
-/*
- * Write the <xdr:cNvPr> element.
- */
-STATIC void
-_drawing_write_c_nv_pr(lxw_drawing *self, char *object_name, uint32_t index,
-                       lxw_drawing_object *drawing_object)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    char name[LXW_OBJ_NAME_LENGTH];
-    lxw_snprintf(name, LXW_OBJ_NAME_LENGTH, "%s %d", object_name, index);
-
-    LXW_INIT_ATTRIBUTES();
-
-    LXW_PUSH_ATTRIBUTES_INT("id", index + 1);
-    LXW_PUSH_ATTRIBUTES_STR("name", name);
-
-    if (drawing_object && drawing_object->description
-        && strlen(drawing_object->description)
-        && !drawing_object->decorative) {
-
-        LXW_PUSH_ATTRIBUTES_STR("descr", drawing_object->description);
-    }
-
-    if (drawing_object
-        && (drawing_object->url_rel_index || drawing_object->decorative)) {
-        lxw_xml_start_tag(self->file, "xdr:cNvPr", &attributes);
-
-        if (drawing_object->url_rel_index) {
-            /* Write the a:hlinkClick element. */
-            _drawing_write_a_hlink_click(self,
-                                         drawing_object->url_rel_index,
-                                         drawing_object->tip);
-        }
-
-        if (drawing_object->decorative) {
-            _workbook_write_decorative(self);
-        }
-
-        lxw_xml_end_tag(self->file, "xdr:cNvPr");
-    }
-    else {
-        lxw_xml_empty_tag(self->file, "xdr:cNvPr", &attributes);
-    }
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a:picLocks> element.
- */
-STATIC void
-_drawing_write_a_pic_locks(lxw_drawing *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("noChangeAspect", "1");
-
-    lxw_xml_empty_tag(self->file, "a:picLocks", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:cNvPicPr> element.
- */
-STATIC void
-_drawing_write_c_nv_pic_pr(lxw_drawing *self)
-{
-    lxw_xml_start_tag(self->file, "xdr:cNvPicPr", NULL);
-
-    /* Write the a:picLocks element. */
-    _drawing_write_a_pic_locks(self);
-
-    lxw_xml_end_tag(self->file, "xdr:cNvPicPr");
-}
-
-/*
- * Write the <xdr:nvPicPr> element.
- */
-STATIC void
-_drawing_write_nv_pic_pr(lxw_drawing *self, uint32_t index,
-                         lxw_drawing_object *drawing_object)
-{
-    lxw_xml_start_tag(self->file, "xdr:nvPicPr", NULL);
-
-    /* Write the xdr:cNvPr element. */
-    _drawing_write_c_nv_pr(self, "Picture", index, drawing_object);
-
-    /* Write the xdr:cNvPicPr element. */
-    _drawing_write_c_nv_pic_pr(self);
-
-    lxw_xml_end_tag(self->file, "xdr:nvPicPr");
-}
-
-/*
- * Write the <a:blip> element.
- */
-STATIC void
-_drawing_write_a_blip(lxw_drawing *self, uint32_t index)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns_r[] = LXW_SCHEMA_OFFICEDOC "/relationships";
-    char r_id[LXW_MAX_ATTRIBUTE_LENGTH];
-
-    lxw_snprintf(r_id, LXW_ATTR_32, "rId%d", index);
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:r", xmlns_r);
-    LXW_PUSH_ATTRIBUTES_STR("r:embed", r_id);
-
-    lxw_xml_empty_tag(self->file, "a:blip", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a:fillRect> element.
- */
-STATIC void
-_drawing_write_a_fill_rect(lxw_drawing *self)
-{
-    lxw_xml_empty_tag(self->file, "a:fillRect", NULL);
-}
-
-/*
- * Write the <a:stretch> element.
- */
-STATIC void
-_drawing_write_a_stretch(lxw_drawing *self)
-{
-    lxw_xml_start_tag(self->file, "a:stretch", NULL);
-
-    /* Write the a:fillRect element. */
-    _drawing_write_a_fill_rect(self);
-
-    lxw_xml_end_tag(self->file, "a:stretch");
-}
-
-/*
- * Write the <xdr:blipFill> element.
- */
-STATIC void
-_drawing_write_blip_fill(lxw_drawing *self, uint32_t index)
-{
-    lxw_xml_start_tag(self->file, "xdr:blipFill", NULL);
-
-    /* Write the a:blip element. */
-    _drawing_write_a_blip(self, index);
-
-    /* Write the a:stretch element. */
-    _drawing_write_a_stretch(self);
-
-    lxw_xml_end_tag(self->file, "xdr:blipFill");
-}
-
-/*
- * Write the <a:ext> element.
- */
-STATIC void
-_drawing_write_a_ext(lxw_drawing *self, lxw_drawing_object *drawing_object)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("cx", drawing_object->width);
-    LXW_PUSH_ATTRIBUTES_INT("cy", drawing_object->height);
-
-    lxw_xml_empty_tag(self->file, "a:ext", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a:off> element.
- */
-STATIC void
-_drawing_write_a_off(lxw_drawing *self, lxw_drawing_object *drawing_object)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-
-    /* Use %d to allow for writing uint64_t on ansi 32bit systems. The largest
-       Excel value will fit without losing precision. */
-    LXW_PUSH_ATTRIBUTES_DBL("x", drawing_object->col_absolute);
-    LXW_PUSH_ATTRIBUTES_DBL("y", drawing_object->row_absolute);
-
-    lxw_xml_empty_tag(self->file, "a:off", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a:xfrm> element.
- */
-STATIC void
-_drawing_write_a_xfrm(lxw_drawing *self, lxw_drawing_object *drawing_object)
-{
-    lxw_xml_start_tag(self->file, "a:xfrm", NULL);
-
-    /* Write the a:off element. */
-    _drawing_write_a_off(self, drawing_object);
-
-    /* Write the a:ext element. */
-    _drawing_write_a_ext(self, drawing_object);
-
-    lxw_xml_end_tag(self->file, "a:xfrm");
-}
-
-/*
- * Write the <a:avLst> element.
- */
-STATIC void
-_drawing_write_a_av_lst(lxw_drawing *self)
-{
-    lxw_xml_empty_tag(self->file, "a:avLst", NULL);
-}
-
-/*
- * Write the <a:prstGeom> element.
- */
-STATIC void
-_drawing_write_a_prst_geom(lxw_drawing *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("prst", "rect");
-
-    lxw_xml_start_tag(self->file, "a:prstGeom", &attributes);
-
-    /* Write the a:avLst element. */
-    _drawing_write_a_av_lst(self);
-
-    lxw_xml_end_tag(self->file, "a:prstGeom");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:spPr> element.
- */
-STATIC void
-_drawing_write_sp_pr(lxw_drawing *self, lxw_drawing_object *drawing_object)
-{
-    lxw_xml_start_tag(self->file, "xdr:spPr", NULL);
-
-    /* Write the a:xfrm element. */
-    _drawing_write_a_xfrm(self, drawing_object);
-
-    /* Write the a:prstGeom element. */
-    _drawing_write_a_prst_geom(self);
-
-    lxw_xml_end_tag(self->file, "xdr:spPr");
-}
-
-/*
- * Write the <xdr:pic> element.
- */
-STATIC void
-_drawing_write_pic(lxw_drawing *self, uint32_t index,
-                   lxw_drawing_object *drawing_object)
-{
-    lxw_xml_start_tag(self->file, "xdr:pic", NULL);
-
-    /* Write the xdr:nvPicPr element. */
-    _drawing_write_nv_pic_pr(self, index, drawing_object);
-
-    /* Write the xdr:blipFill element. */
-    _drawing_write_blip_fill(self, drawing_object->rel_index);
-
-    /* Write the xdr:spPr element. */
-    _drawing_write_sp_pr(self, drawing_object);
-
-    lxw_xml_end_tag(self->file, "xdr:pic");
-}
-
-/*
- * Write the <xdr:clientData> element.
- */
-STATIC void
-_drawing_write_client_data(lxw_drawing *self)
-{
-    lxw_xml_empty_tag(self->file, "xdr:clientData", NULL);
-}
-
-/*
- * Write the <a:graphicFrameLocks> element.
- */
-STATIC void
-_drawing_write_a_graphic_frame_locks(lxw_drawing *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("noGrp", 1);
-
-    lxw_xml_empty_tag(self->file, "a:graphicFrameLocks", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:cNvGraphicFramePr> element.
- */
-STATIC void
-_drawing_write_c_nv_graphic_frame_pr(lxw_drawing *self)
-{
-    if (self->embedded) {
-        lxw_xml_empty_tag(self->file, "xdr:cNvGraphicFramePr", NULL);
-    }
-    else {
-        lxw_xml_start_tag(self->file, "xdr:cNvGraphicFramePr", NULL);
-
-        /* Write the a:graphicFrameLocks element. */
-        _drawing_write_a_graphic_frame_locks(self);
-
-        lxw_xml_end_tag(self->file, "xdr:cNvGraphicFramePr");
-    }
-}
-
-/*
- * Write the <xdr:nvGraphicFramePr> element.
- */
-STATIC void
-_drawing_write_nv_graphic_frame_pr(lxw_drawing *self, uint32_t index,
-                                   lxw_drawing_object *drawing_object)
-{
-    lxw_xml_start_tag(self->file, "xdr:nvGraphicFramePr", NULL);
-
-    /* Write the xdr:cNvPr element. */
-    _drawing_write_c_nv_pr(self, "Chart", index, drawing_object);
-
-    /* Write the xdr:cNvGraphicFramePr element. */
-    _drawing_write_c_nv_graphic_frame_pr(self);
-
-    lxw_xml_end_tag(self->file, "xdr:nvGraphicFramePr");
-}
-
-/*
- * Write the <a:off> element.
- */
-STATIC void
-_drawing_write_xfrm_offset(lxw_drawing *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("x", "0");
-    LXW_PUSH_ATTRIBUTES_STR("y", "0");
-
-    lxw_xml_empty_tag(self->file, "a:off", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a:ext> element.
- */
-STATIC void
-_drawing_write_xfrm_extension(lxw_drawing *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("cx", "0");
-    LXW_PUSH_ATTRIBUTES_STR("cy", "0");
-
-    lxw_xml_empty_tag(self->file, "a:ext", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:xfrm> element.
- */
-STATIC void
-_drawing_write_xfrm(lxw_drawing *self)
-{
-    lxw_xml_start_tag(self->file, "xdr:xfrm", NULL);
-
-    /* Write the a:off element. */
-    _drawing_write_xfrm_offset(self);
-
-    /* Write the a:ext element. */
-    _drawing_write_xfrm_extension(self);
-
-    lxw_xml_end_tag(self->file, "xdr:xfrm");
-}
-
-/*
- * Write the <c:chart> element.
- */
-STATIC void
-_drawing_write_chart(lxw_drawing *self, uint32_t index)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns_c[] = LXW_SCHEMA_DRAWING "/chart";
-    char xmlns_r[] = LXW_SCHEMA_OFFICEDOC "/relationships";
-    char r_id[LXW_MAX_ATTRIBUTE_LENGTH];
-
-    lxw_snprintf(r_id, LXW_ATTR_32, "rId%d", index);
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:c", xmlns_c);
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:r", xmlns_r);
-    LXW_PUSH_ATTRIBUTES_STR("r:id", r_id);
-
-    lxw_xml_empty_tag(self->file, "c:chart", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a:graphicData> element.
- */
-STATIC void
-_drawing_write_a_graphic_data(lxw_drawing *self, uint32_t index)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char uri[] = LXW_SCHEMA_DRAWING "/chart";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("uri", uri);
-
-    lxw_xml_start_tag(self->file, "a:graphicData", &attributes);
-
-    /* Write the c:chart element. */
-    _drawing_write_chart(self, index);
-
-    lxw_xml_end_tag(self->file, "a:graphicData");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <a:graphic> element.
- */
-STATIC void
-_drawing_write_a_graphic(lxw_drawing *self, uint32_t index)
-{
-
-    lxw_xml_start_tag(self->file, "a:graphic", NULL);
-
-    /* Write the a:graphicData element. */
-    _drawing_write_a_graphic_data(self, index);
-
-    lxw_xml_end_tag(self->file, "a:graphic");
-}
-
-/*
- * Write the <xdr:graphicFrame> element.
- */
-STATIC void
-_drawing_write_graphic_frame(lxw_drawing *self, uint32_t index,
-                             uint32_t rel_index,
-                             lxw_drawing_object *drawing_object)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("macro", "");
-
-    lxw_xml_start_tag(self->file, "xdr:graphicFrame", &attributes);
-
-    /* Write the xdr:nvGraphicFramePr element. */
-    _drawing_write_nv_graphic_frame_pr(self, index, drawing_object);
-
-    /* Write the xdr:xfrm element. */
-    _drawing_write_xfrm(self);
-
-    /* Write the a:graphic element. */
-    _drawing_write_a_graphic(self, rel_index);
-
-    lxw_xml_end_tag(self->file, "xdr:graphicFrame");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:twoCellAnchor> element.
- */
-STATIC void
-_drawing_write_two_cell_anchor(lxw_drawing *self, uint32_t index,
-                               lxw_drawing_object *drawing_object)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-
-    if (drawing_object->anchor == LXW_OBJECT_MOVE_DONT_SIZE)
-        LXW_PUSH_ATTRIBUTES_STR("editAs", "oneCell");
-    else if (drawing_object->anchor == LXW_OBJECT_DONT_MOVE_DONT_SIZE)
-        LXW_PUSH_ATTRIBUTES_STR("editAs", "absolute");
-
-    lxw_xml_start_tag(self->file, "xdr:twoCellAnchor", &attributes);
-
-    _drawing_write_from(self, &drawing_object->from);
-    _drawing_write_to(self, &drawing_object->to);
-
-    if (drawing_object->type == LXW_DRAWING_CHART) {
-        /* Write the xdr:graphicFrame element for charts. */
-        _drawing_write_graphic_frame(self, index, drawing_object->rel_index,
-                                     drawing_object);
-    }
-    else if (drawing_object->type == LXW_DRAWING_IMAGE) {
-        /* Write the xdr:pic element. */
-        _drawing_write_pic(self, index, drawing_object);
-    }
-    else {
-        /* Write the xdr:sp element for shapes. */
-        /* _drawing_write_sp(self, index, col_absolute, row_absolute, width,
-           height,  shape); */
-    }
-
-    /* Write the xdr:clientData element. */
-    _drawing_write_client_data(self);
-
-    lxw_xml_end_tag(self->file, "xdr:twoCellAnchor");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:ext> element.
- */
-STATIC void
-_drawing_write_ext(lxw_drawing *self, uint32_t cx, uint32_t cy)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("cx", cx);
-    LXW_PUSH_ATTRIBUTES_INT("cy", cy);
-
-    lxw_xml_empty_tag(self->file, "xdr:ext", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:pos> element.
- */
-STATIC void
-_drawing_write_pos(lxw_drawing *self, int32_t x, int32_t y)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("x", x);
-    LXW_PUSH_ATTRIBUTES_INT("y", y);
-
-    lxw_xml_empty_tag(self->file, "xdr:pos", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xdr:absoluteAnchor> element.
- */
-STATIC void
-_drawing_write_absolute_anchor(lxw_drawing *self, uint32_t frame_index)
-{
-    lxw_xml_start_tag(self->file, "xdr:absoluteAnchor", NULL);
-
-    if (self->orientation == LXW_LANDSCAPE) {
-        /* Write the xdr:pos element. */
-        _drawing_write_pos(self, 0, 0);
-
-        /* Write the xdr:ext element. */
-        _drawing_write_ext(self, 9308969, 6078325);
-    }
-    else {
-        /* Write the xdr:pos element. */
-        _drawing_write_pos(self, 0, -47625);
-
-        /* Write the xdr:ext element. */
-        _drawing_write_ext(self, 6162675, 6124575);
-    }
-
-    _drawing_write_graphic_frame(self, frame_index, frame_index, NULL);
-
-    /* Write the xdr:clientData element. */
-    _drawing_write_client_data(self);
-
-    lxw_xml_end_tag(self->file, "xdr:absoluteAnchor");
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_drawing_assemble_xml_file(lxw_drawing *self)
-{
-    uint32_t index;
-    lxw_drawing_object *drawing_object;
-
-    /* Write the XML declaration. */
-    _drawing_xml_declaration(self);
-
-    /* Write the xdr:wsDr element. */
-    _write_drawing_workspace(self);
-
-    if (self->embedded) {
-        index = 1;
-
-        STAILQ_FOREACH(drawing_object, self->drawing_objects, list_pointers) {
-            _drawing_write_two_cell_anchor(self, index, drawing_object);
-            index++;
-        }
-    }
-    else {
-        /* Write the xdr:absoluteAnchor element. Mainly for chartsheets. */
-        _drawing_write_absolute_anchor(self, 1);
-    }
-
-    lxw_xml_end_tag(self->file, "xdr:wsDr");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 832
src/3rdparty/libxlsxwriter/src/format.c

@@ -1,832 +0,0 @@
-/*****************************************************************************
- * format - A library for creating Excel XLSX format files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/format.h"
-#include "xlsxwriter/utility.h"
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new format object.
- */
-lxw_format *
-lxw_format_new(void)
-{
-    lxw_format *format = calloc(1, sizeof(lxw_format));
-    GOTO_LABEL_ON_MEM_ERROR(format, mem_error);
-
-    format->xf_format_indices = NULL;
-    format->dxf_format_indices = NULL;
-
-    format->xf_index = LXW_PROPERTY_UNSET;
-    format->dxf_index = LXW_PROPERTY_UNSET;
-    format->xf_id = 0;
-
-    format->font_name[0] = '\0';
-    format->font_scheme[0] = '\0';
-    format->num_format[0] = '\0';
-    format->num_format_index = 0;
-    format->font_index = 0;
-    format->has_font = LXW_FALSE;
-    format->has_dxf_font = LXW_FALSE;
-    format->font_size = 11.0;
-    format->bold = LXW_FALSE;
-    format->italic = LXW_FALSE;
-    format->font_color = LXW_COLOR_UNSET;
-    format->underline = LXW_UNDERLINE_NONE;
-    format->font_strikeout = LXW_FALSE;
-    format->font_outline = LXW_FALSE;
-    format->font_shadow = LXW_FALSE;
-    format->font_script = LXW_FALSE;
-    format->font_family = LXW_DEFAULT_FONT_FAMILY;
-    format->font_charset = LXW_FALSE;
-    format->font_condense = LXW_FALSE;
-    format->font_extend = LXW_FALSE;
-    format->theme = 0;
-    format->hyperlink = LXW_FALSE;
-
-    format->hidden = LXW_FALSE;
-    format->locked = LXW_TRUE;
-
-    format->text_h_align = LXW_ALIGN_NONE;
-    format->text_wrap = LXW_FALSE;
-    format->text_v_align = LXW_ALIGN_NONE;
-    format->text_justlast = LXW_FALSE;
-    format->rotation = 0;
-
-    format->fg_color = LXW_COLOR_UNSET;
-    format->bg_color = LXW_COLOR_UNSET;
-    format->pattern = LXW_PATTERN_NONE;
-    format->has_fill = LXW_FALSE;
-    format->has_dxf_fill = LXW_FALSE;
-    format->fill_index = 0;
-    format->fill_count = 0;
-
-    format->border_index = 0;
-    format->has_border = LXW_FALSE;
-    format->has_dxf_border = LXW_FALSE;
-    format->border_count = 0;
-
-    format->bottom = LXW_BORDER_NONE;
-    format->left = LXW_BORDER_NONE;
-    format->right = LXW_BORDER_NONE;
-    format->top = LXW_BORDER_NONE;
-    format->diag_border = LXW_BORDER_NONE;
-    format->diag_type = LXW_BORDER_NONE;
-    format->bottom_color = LXW_COLOR_UNSET;
-    format->left_color = LXW_COLOR_UNSET;
-    format->right_color = LXW_COLOR_UNSET;
-    format->top_color = LXW_COLOR_UNSET;
-    format->diag_color = LXW_COLOR_UNSET;
-
-    format->indent = 0;
-    format->shrink = LXW_FALSE;
-    format->merge_range = LXW_FALSE;
-    format->reading_order = 0;
-    format->just_distrib = LXW_FALSE;
-    format->color_indexed = LXW_FALSE;
-    format->font_only = LXW_FALSE;
-
-    format->quote_prefix = LXW_FALSE;
-
-    return format;
-
-mem_error:
-    lxw_format_free(format);
-    return NULL;
-}
-
-/*
- * Free a format object.
- */
-void
-lxw_format_free(lxw_format *format)
-{
-    if (!format)
-        return;
-
-    free(format);
-    format = NULL;
-}
-
-/*
- * Check a user input border.
- */
-STATIC uint8_t
-_check_border(uint8_t border)
-{
-    if (border >= LXW_BORDER_THIN && border <= LXW_BORDER_SLANT_DASH_DOT)
-        return border;
-    else
-        return LXW_BORDER_NONE;
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/
-
-/*
- * Returns a format struct suitable for hashing as a lookup key. This is
- * mainly a memcpy with any pointer members set to NULL.
- */
-STATIC lxw_format *
-_get_format_key(lxw_format *self)
-{
-    lxw_format *key = calloc(1, sizeof(lxw_format));
-    GOTO_LABEL_ON_MEM_ERROR(key, mem_error);
-
-    memcpy(key, self, sizeof(lxw_format));
-
-    /* Set pointer members to NULL since they aren't part of the comparison. */
-    key->xf_format_indices = NULL;
-    key->dxf_format_indices = NULL;
-    key->num_xf_formats = NULL;
-    key->num_dxf_formats = NULL;
-    key->list_pointers.stqe_next = NULL;
-
-    return key;
-
-mem_error:
-    return NULL;
-}
-
-/*
- * Returns a font struct suitable for hashing as a lookup key.
- */
-lxw_font *
-lxw_format_get_font_key(lxw_format *self)
-{
-    lxw_font *key = calloc(1, sizeof(lxw_font));
-    GOTO_LABEL_ON_MEM_ERROR(key, mem_error);
-
-    LXW_FORMAT_FIELD_COPY(key->font_name, self->font_name);
-    key->font_size = self->font_size;
-    key->bold = self->bold;
-    key->italic = self->italic;
-    key->underline = self->underline;
-    key->theme = self->theme;
-    key->font_color = self->font_color;
-    key->font_strikeout = self->font_strikeout;
-    key->font_outline = self->font_outline;
-    key->font_shadow = self->font_shadow;
-    key->font_script = self->font_script;
-    key->font_family = self->font_family;
-    key->font_charset = self->font_charset;
-    key->font_condense = self->font_condense;
-    key->font_extend = self->font_extend;
-
-    return key;
-
-mem_error:
-    return NULL;
-}
-
-/*
- * Returns a border struct suitable for hashing as a lookup key.
- */
-lxw_border *
-lxw_format_get_border_key(lxw_format *self)
-{
-    lxw_border *key = calloc(1, sizeof(lxw_border));
-    GOTO_LABEL_ON_MEM_ERROR(key, mem_error);
-
-    key->bottom = self->bottom;
-    key->left = self->left;
-    key->right = self->right;
-    key->top = self->top;
-    key->diag_border = self->diag_border;
-    key->diag_type = self->diag_type;
-    key->bottom_color = self->bottom_color;
-    key->left_color = self->left_color;
-    key->right_color = self->right_color;
-    key->top_color = self->top_color;
-    key->diag_color = self->diag_color;
-
-    return key;
-
-mem_error:
-    return NULL;
-}
-
-/*
- * Returns a pattern fill struct suitable for hashing as a lookup key.
- */
-lxw_fill *
-lxw_format_get_fill_key(lxw_format *self)
-{
-    lxw_fill *key = calloc(1, sizeof(lxw_fill));
-    GOTO_LABEL_ON_MEM_ERROR(key, mem_error);
-
-    key->fg_color = self->fg_color;
-    key->bg_color = self->bg_color;
-    key->pattern = self->pattern;
-
-    return key;
-
-mem_error:
-    return NULL;
-}
-
-/*
- * Returns the XF index number used by Excel to identify a format.
- */
-int32_t
-lxw_format_get_xf_index(lxw_format *self)
-{
-    lxw_format *format_key;
-    lxw_format *existing_format;
-    lxw_hash_element *hash_element;
-    lxw_hash_table *formats_hash_table = self->xf_format_indices;
-    int32_t index;
-
-    /* Note: The formats_hash_table/xf_format_indices contains the unique and
-     * more importantly the *used* formats in the workbook.
-     */
-
-    /* Format already has an index number so return it. */
-    if (self->xf_index != LXW_PROPERTY_UNSET) {
-        return self->xf_index;
-    }
-
-    /* Otherwise, the format doesn't have an index number so we assign one.
-     * First generate a unique key to identify the format in the hash table.
-     */
-    format_key = _get_format_key(self);
-
-    /* Return the default format index if the key generation failed. */
-    if (!format_key)
-        return 0;
-
-    /* Look up the format in the hash table. */
-    hash_element =
-        lxw_hash_key_exists(formats_hash_table, format_key,
-                            sizeof(lxw_format));
-
-    if (hash_element) {
-        /* Format matches existing format with an index. */
-        free(format_key);
-        existing_format = hash_element->value;
-        return existing_format->xf_index;
-    }
-    else {
-        /* New format requiring an index. */
-        index = formats_hash_table->unique_count;
-        self->xf_index = index;
-        lxw_insert_hash_element(formats_hash_table, format_key, self,
-                                sizeof(lxw_format));
-        return index;
-    }
-}
-
-/*
- * Returns the DXF index number used by Excel to identify a format.
- */
-int32_t
-lxw_format_get_dxf_index(lxw_format *self)
-{
-    lxw_format *format_key;
-    lxw_format *existing_format;
-    lxw_hash_element *hash_element;
-    lxw_hash_table *formats_hash_table = self->dxf_format_indices;
-    int32_t index;
-
-    /* Note: The formats_hash_table/dxf_format_indices contains the unique and
-     * more importantly the *used* formats in the workbook.
-     */
-
-    /* Format already has an index number so return it. */
-    if (self->dxf_index != LXW_PROPERTY_UNSET) {
-        return self->dxf_index;
-    }
-
-    /* Otherwise, the format doesn't have an index number so we assign one.
-     * First generate a unique key to identify the format in the hash table.
-     */
-    format_key = _get_format_key(self);
-
-    /* Return the default format index if the key generation failed. */
-    if (!format_key)
-        return 0;
-
-    /* Look up the format in the hash table. */
-    hash_element =
-        lxw_hash_key_exists(formats_hash_table, format_key,
-                            sizeof(lxw_format));
-
-    if (hash_element) {
-        /* Format matches existing format with an index. */
-        free(format_key);
-        existing_format = hash_element->value;
-        return existing_format->dxf_index;
-    }
-    else {
-        /* New format requiring an index. */
-        index = formats_hash_table->unique_count;
-        self->dxf_index = index;
-        lxw_insert_hash_element(formats_hash_table, format_key, self,
-                                sizeof(lxw_format));
-        return index;
-    }
-}
-
-/*
- * Set the font_name property.
- */
-void
-format_set_font_name(lxw_format *self, const char *font_name)
-{
-    LXW_FORMAT_FIELD_COPY(self->font_name, font_name);
-}
-
-/*
- * Set the font_size property.
- */
-void
-format_set_font_size(lxw_format *self, double size)
-{
-
-    if (size >= LXW_MIN_FONT_SIZE && size <= LXW_MAX_FONT_SIZE)
-        self->font_size = size;
-}
-
-/*
- * Set the font_color property.
- */
-void
-format_set_font_color(lxw_format *self, lxw_color_t color)
-{
-    self->font_color = color;
-}
-
-/*
- * Set the bold property.
- */
-void
-format_set_bold(lxw_format *self)
-{
-    self->bold = LXW_TRUE;
-}
-
-/*
- * Set the italic property.
- */
-
-void
-format_set_italic(lxw_format *self)
-{
-    self->italic = LXW_TRUE;
-}
-
-/*
- * Set the underline property.
- */
-void
-format_set_underline(lxw_format *self, uint8_t style)
-{
-    if (style >= LXW_UNDERLINE_SINGLE
-        && style <= LXW_UNDERLINE_DOUBLE_ACCOUNTING)
-        self->underline = style;
-}
-
-/*
- * Set the font_strikeout property.
- */
-void
-format_set_font_strikeout(lxw_format *self)
-{
-    self->font_strikeout = LXW_TRUE;
-}
-
-/*
- * Set the font_script property.
- */
-void
-format_set_font_script(lxw_format *self, uint8_t style)
-{
-    if (style >= LXW_FONT_SUPERSCRIPT && style <= LXW_FONT_SUBSCRIPT)
-        self->font_script = style;
-}
-
-/*
- * Set the font_outline property.
- */
-void
-format_set_font_outline(lxw_format *self)
-{
-    self->font_outline = LXW_TRUE;
-}
-
-/*
- * Set the font_shadow property.
- */
-void
-format_set_font_shadow(lxw_format *self)
-{
-    self->font_shadow = LXW_TRUE;
-}
-
-/*
- * Set the num_format property.
- */
-void
-format_set_num_format(lxw_format *self, const char *num_format)
-{
-    LXW_FORMAT_FIELD_COPY(self->num_format, num_format);
-}
-
-/*
- * Set the unlocked property.
- */
-void
-format_set_unlocked(lxw_format *self)
-{
-    self->locked = LXW_FALSE;
-}
-
-/*
- * Set the hidden property.
- */
-void
-format_set_hidden(lxw_format *self)
-{
-    self->hidden = LXW_TRUE;
-}
-
-/*
- * Set the align property.
- */
-void
-format_set_align(lxw_format *self, uint8_t value)
-{
-    if (value >= LXW_ALIGN_LEFT && value <= LXW_ALIGN_DISTRIBUTED) {
-        self->text_h_align = value;
-    }
-
-    if (value >= LXW_ALIGN_VERTICAL_TOP
-        && value <= LXW_ALIGN_VERTICAL_DISTRIBUTED) {
-        self->text_v_align = value;
-    }
-}
-
-/*
- * Set the text_wrap property.
- */
-void
-format_set_text_wrap(lxw_format *self)
-{
-    self->text_wrap = LXW_TRUE;
-}
-
-/*
- * Set the rotation property.
- */
-void
-format_set_rotation(lxw_format *self, int16_t angle)
-{
-    /* Convert user angle to Excel angle. */
-    if (angle == 270) {
-        self->rotation = 255;
-    }
-    else if (angle >= -90 && angle <= 90) {
-        if (angle < 0)
-            angle = -angle + 90;
-
-        self->rotation = angle;
-    }
-    else {
-        LXW_WARN("Rotation rotation outside range: -90 <= angle <= 90.");
-        self->rotation = 0;
-    }
-}
-
-/*
- * Set the indent property.
- */
-void
-format_set_indent(lxw_format *self, uint8_t value)
-{
-    self->indent = value;
-}
-
-/*
- * Set the shrink property.
- */
-void
-format_set_shrink(lxw_format *self)
-{
-    self->shrink = LXW_TRUE;
-}
-
-/*
- * Set the text_justlast property.
- */
-void
-format_set_text_justlast(lxw_format *self)
-{
-    self->text_justlast = LXW_TRUE;
-}
-
-/*
- * Set the pattern property.
- */
-void
-format_set_pattern(lxw_format *self, uint8_t value)
-{
-    if (value > LXW_PATTERN_GRAY_0625) {
-        LXW_WARN_FORMAT1("format_set_pattern(): invalid pattern value: %d",
-                         value);
-        return;
-    }
-
-    self->pattern = value;
-}
-
-/*
- * Set the bg_color property.
- */
-void
-format_set_bg_color(lxw_format *self, lxw_color_t color)
-{
-    self->bg_color = color;
-}
-
-/*
- * Set the fg_color property.
- */
-void
-format_set_fg_color(lxw_format *self, lxw_color_t color)
-{
-    self->fg_color = color;
-}
-
-/*
- * Set the border property.
- */
-void
-format_set_border(lxw_format *self, uint8_t style)
-{
-    style = _check_border(style);
-    self->bottom = style;
-    self->top = style;
-    self->left = style;
-    self->right = style;
-}
-
-/*
- * Set the border_color property.
- */
-void
-format_set_border_color(lxw_format *self, lxw_color_t color)
-{
-    self->bottom_color = color;
-    self->top_color = color;
-    self->left_color = color;
-    self->right_color = color;
-}
-
-/*
- * Set the bottom property.
- */
-void
-format_set_bottom(lxw_format *self, uint8_t style)
-{
-    self->bottom = _check_border(style);
-}
-
-/*
- * Set the bottom_color property.
- */
-void
-format_set_bottom_color(lxw_format *self, lxw_color_t color)
-{
-    self->bottom_color = color;
-}
-
-/*
- * Set the left property.
- */
-void
-format_set_left(lxw_format *self, uint8_t style)
-{
-    self->left = _check_border(style);
-}
-
-/*
- * Set the left_color property.
- */
-void
-format_set_left_color(lxw_format *self, lxw_color_t color)
-{
-    self->left_color = color;
-}
-
-/*
- * Set the right property.
- */
-void
-format_set_right(lxw_format *self, uint8_t style)
-{
-    self->right = _check_border(style);
-}
-
-/*
- * Set the right_color property.
- */
-void
-format_set_right_color(lxw_format *self, lxw_color_t color)
-{
-    self->right_color = color;
-}
-
-/*
- * Set the top property.
- */
-void
-format_set_top(lxw_format *self, uint8_t style)
-{
-    self->top = _check_border(style);
-}
-
-/*
- * Set the top_color property.
- */
-void
-format_set_top_color(lxw_format *self, lxw_color_t color)
-{
-    self->top_color = color;
-}
-
-/*
- * Set the diag_type property.
- */
-void
-format_set_diag_type(lxw_format *self, uint8_t type)
-{
-    if (type >= LXW_DIAGONAL_BORDER_UP && type <= LXW_DIAGONAL_BORDER_UP_DOWN)
-        self->diag_type = type;
-}
-
-/*
- * Set the diag_color property.
- */
-void
-format_set_diag_color(lxw_format *self, lxw_color_t color)
-{
-    self->diag_color = color;
-}
-
-/*
- * Set the diag_border property.
- */
-void
-format_set_diag_border(lxw_format *self, uint8_t style)
-{
-    if (style > LXW_BORDER_SLANT_DASH_DOT) {
-        LXW_WARN_FORMAT1("format_set_diag_border(): invalid border style: %d",
-                         style);
-        return;
-    }
-
-    self->diag_border = style;
-}
-
-/*
- * Set the num_format_index property.
- */
-void
-format_set_num_format_index(lxw_format *self, uint8_t value)
-{
-    self->num_format_index = value;
-}
-
-/*
- * Set the valign property.
- */
-void
-format_set_valign(lxw_format *self, uint8_t value)
-{
-    if (value > LXW_ALIGN_VERTICAL_DISTRIBUTED) {
-        LXW_WARN_FORMAT1
-            ("format_set_valign(): invalid vertical alignment value: %d",
-             value);
-        return;
-    }
-
-    self->text_v_align = value;
-}
-
-/*
- * Set the reading_order property.
- */
-void
-format_set_reading_order(lxw_format *self, uint8_t value)
-{
-    self->reading_order = value;
-}
-
-/*
- * Set the font_family property.
- */
-void
-format_set_font_family(lxw_format *self, uint8_t value)
-{
-    self->font_family = value;
-}
-
-/*
- * Set the font_charset property.
- */
-void
-format_set_font_charset(lxw_format *self, uint8_t value)
-{
-    self->font_charset = value;
-}
-
-/*
- * Set the font_scheme property.
- */
-void
-format_set_font_scheme(lxw_format *self, const char *font_scheme)
-{
-    LXW_FORMAT_FIELD_COPY(self->font_scheme, font_scheme);
-}
-
-/*
- * Set the font_condense property.
- */
-void
-format_set_font_condense(lxw_format *self)
-{
-    self->font_condense = LXW_TRUE;
-}
-
-/*
- * Set the font_extend property.
- */
-void
-format_set_font_extend(lxw_format *self)
-{
-    self->font_extend = LXW_TRUE;
-}
-
-/*
- * Set the theme property.
- */
-void
-format_set_theme(lxw_format *self, uint8_t value)
-{
-    self->theme = value;
-}
-
-/*
- * Set the color_indexed property.
- */
-void
-format_set_color_indexed(lxw_format *self, uint8_t value)
-{
-    self->color_indexed = value;
-}
-
-/*
- * Set the font_only property.
- */
-void
-format_set_font_only(lxw_format *self)
-{
-    self->font_only = LXW_TRUE;
-}
-
-/*
- * Set the theme property.
- */
-void
-format_set_hyperlink(lxw_format *self)
-{
-    self->hyperlink = LXW_TRUE;
-    self->xf_id = 1;
-    self->underline = LXW_UNDERLINE_SINGLE;
-    self->theme = 10;
-}
-
-/*
- * Set the quote_prefix property.
- */
-void
-format_set_quote_prefix(lxw_format *self)
-{
-    self->quote_prefix = LXW_TRUE;
-}

+ 0 - 224
src/3rdparty/libxlsxwriter/src/hash_table.c

@@ -1,224 +0,0 @@
-/*****************************************************************************
- * hash_table - Hash table functions for libxlsxwriter.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include "xlsxwriter/hash_table.h"
-
-/*
- * Calculate the hash key using the FNV function. See:
- * http://en.wikipedia.org/wiki/Fowler-Noll-Vo_hash_function
- */
-STATIC size_t
-_generate_hash_key(void *data, size_t data_len, size_t num_buckets)
-{
-    unsigned char *p = data;
-    size_t hash = 2166136261U;
-    size_t i;
-
-    for (i = 0; i < data_len; i++)
-        hash = (hash * 16777619) ^ p[i];
-
-    return hash % num_buckets;
-}
-
-/*
- * Check if an element exists in the hash table and return a pointer
- * to it if it does.
- */
-lxw_hash_element *
-lxw_hash_key_exists(lxw_hash_table *lxw_hash, void *key, size_t key_len)
-{
-    size_t hash_key = _generate_hash_key(key, key_len, lxw_hash->num_buckets);
-    struct lxw_hash_bucket_list *list;
-    lxw_hash_element *element;
-
-    if (!lxw_hash->buckets[hash_key]) {
-        /* The key isn't in the LXW_HASH hash table. */
-        return NULL;
-    }
-    else {
-        /* The key is already in the table or there is a hash collision. */
-        list = lxw_hash->buckets[hash_key];
-
-        /* Iterate over the keys in the bucket's linked list. */
-        SLIST_FOREACH(element, list, lxw_hash_list_pointers) {
-            if (memcmp(element->key, key, key_len) == 0) {
-                /* The key already exists in the table. */
-                return element;
-            }
-        }
-
-        /* Key doesn't exist in the list so this is a hash collision. */
-        return NULL;
-    }
-}
-
-/*
- * Insert or update a value in the LXW_HASH table based on a key
- * and return a pointer to the new or updated element.
- */
-lxw_hash_element *
-lxw_insert_hash_element(lxw_hash_table *lxw_hash, void *key, void *value,
-                        size_t key_len)
-{
-    size_t hash_key = _generate_hash_key(key, key_len, lxw_hash->num_buckets);
-    struct lxw_hash_bucket_list *list = NULL;
-    lxw_hash_element *element = NULL;
-
-    if (!lxw_hash->buckets[hash_key]) {
-        /* The key isn't in the LXW_HASH hash table. */
-
-        /* Create a linked list in the bucket to hold the lxw_hash keys. */
-        list = calloc(1, sizeof(struct lxw_hash_bucket_list));
-        GOTO_LABEL_ON_MEM_ERROR(list, mem_error1);
-
-        /* Initialize the bucket linked list. */
-        SLIST_INIT(list);
-
-        /* Create an lxw_hash element to add to the linked list. */
-        element = calloc(1, sizeof(lxw_hash_element));
-        GOTO_LABEL_ON_MEM_ERROR(element, mem_error1);
-
-        /* Store the key and value. */
-        element->key = key;
-        element->value = value;
-
-        /* Add the lxw_hash element to the bucket's linked list. */
-        SLIST_INSERT_HEAD(list, element, lxw_hash_list_pointers);
-
-        /* Also add it to the insertion order linked list. */
-        STAILQ_INSERT_TAIL(lxw_hash->order_list, element,
-                           lxw_hash_order_pointers);
-
-        /* Store the bucket list at the hash index. */
-        lxw_hash->buckets[hash_key] = list;
-
-        lxw_hash->used_buckets++;
-        lxw_hash->unique_count++;
-
-        return element;
-    }
-    else {
-        /* The key is already in the table or there is a hash collision. */
-        list = lxw_hash->buckets[hash_key];
-
-        /* Iterate over the keys in the bucket's linked list. */
-        SLIST_FOREACH(element, list, lxw_hash_list_pointers) {
-            if (memcmp(element->key, key, key_len) == 0) {
-                /* The key already exists in the table. Update the value. */
-                if (lxw_hash->free_value)
-                    free(element->value);
-
-                element->value = value;
-                return element;
-            }
-        }
-
-        /* Key doesn't exist in the list so this is a hash collision.
-         * Create an lxw_hash element to add to the linked list. */
-        element = calloc(1, sizeof(lxw_hash_element));
-        GOTO_LABEL_ON_MEM_ERROR(element, mem_error2);
-
-        /* Store the key and value. */
-        element->key = key;
-        element->value = value;
-
-        /* Add the lxw_hash element to the bucket linked list. */
-        SLIST_INSERT_HEAD(list, element, lxw_hash_list_pointers);
-
-        /* Also add it to the insertion order linked list. */
-        STAILQ_INSERT_TAIL(lxw_hash->order_list, element,
-                           lxw_hash_order_pointers);
-
-        lxw_hash->unique_count++;
-
-        return element;
-    }
-
-mem_error1:
-    free(list);
-
-mem_error2:
-    free(element);
-    return NULL;
-}
-
-/*
- * Create a new LXW_HASH hash table object.
- */
-lxw_hash_table *
-lxw_hash_new(uint32_t num_buckets, uint8_t free_key, uint8_t free_value)
-{
-    /* Create the new hash table. */
-    lxw_hash_table *lxw_hash = calloc(1, sizeof(lxw_hash_table));
-    RETURN_ON_MEM_ERROR(lxw_hash, NULL);
-
-    lxw_hash->free_key = free_key;
-    lxw_hash->free_value = free_value;
-
-    /* Add the lxw_hash element buckets. */
-    lxw_hash->buckets =
-        calloc(num_buckets, sizeof(struct lxw_hash_bucket_list *));
-    GOTO_LABEL_ON_MEM_ERROR(lxw_hash->buckets, mem_error);
-
-    /* Add a list for tracking the insertion order. */
-    lxw_hash->order_list = calloc(1, sizeof(struct lxw_hash_order_list));
-    GOTO_LABEL_ON_MEM_ERROR(lxw_hash->order_list, mem_error);
-
-    /* Initialize the order list. */
-    STAILQ_INIT(lxw_hash->order_list);
-
-    /* Store the number of buckets to calculate the load factor. */
-    lxw_hash->num_buckets = num_buckets;
-
-    return lxw_hash;
-
-mem_error:
-    lxw_hash_free(lxw_hash);
-    return NULL;
-}
-
-/*
- * Free the LXW_HASH hash table object.
- */
-void
-lxw_hash_free(lxw_hash_table *lxw_hash)
-{
-    size_t i;
-    lxw_hash_element *element;
-    lxw_hash_element *element_temp;
-
-    if (!lxw_hash)
-        return;
-
-    /* Free the lxw_hash_elements and data using the ordered linked list. */
-    if (lxw_hash->order_list) {
-        STAILQ_FOREACH_SAFE(element, lxw_hash->order_list,
-                            lxw_hash_order_pointers, element_temp) {
-            if (lxw_hash->free_key)
-                free(element->key);
-            if (lxw_hash->free_value)
-                free(element->value);
-            free(element);
-        }
-    }
-
-    /* Free the buckets from the hash table. */
-    for (i = 0; i < lxw_hash->num_buckets; i++) {
-        free(lxw_hash->buckets[i]);
-    }
-
-    free(lxw_hash->order_list);
-    free(lxw_hash->buckets);
-    free(lxw_hash);
-}

+ 0 - 439
src/3rdparty/libxlsxwriter/src/metadata.c

@@ -1,439 +0,0 @@
-/*****************************************************************************
- * metadata - A library for creating Excel XLSX metadata files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/metadata.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new metadata object.
- */
-lxw_metadata *
-lxw_metadata_new(void)
-{
-    lxw_metadata *metadata = calloc(1, sizeof(lxw_metadata));
-    GOTO_LABEL_ON_MEM_ERROR(metadata, mem_error);
-
-    return metadata;
-
-mem_error:
-    lxw_metadata_free(metadata);
-    return NULL;
-}
-
-/*
- * Free a metadata object.
- */
-void
-lxw_metadata_free(lxw_metadata *metadata)
-{
-    if (!metadata)
-        return;
-
-    free(metadata);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_metadata_xml_declaration(lxw_metadata *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <metadata> element.
- */
-STATIC void
-_metadata_write_metadata(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] = "http://schemas.openxmlformats.org/"
-        "spreadsheetml/2006/main";
-    char xmlns_xda[] = "http://schemas.microsoft.com/office/"
-        "spreadsheetml/2017/dynamicarray";
-    char xmlns_xlrd[] = "http://schemas.microsoft.com/office/"
-        "spreadsheetml/2017/richdata";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-
-    if (self->has_embedded_images)
-        LXW_PUSH_ATTRIBUTES_STR("xmlns:xlrd", xmlns_xlrd);
-
-    if (self->has_dynamic_functions)
-        LXW_PUSH_ATTRIBUTES_STR("xmlns:xda", xmlns_xda);
-
-    lxw_xml_start_tag(self->file, "metadata", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <metadataType> element for dynamic functions.
- */
-STATIC void
-_metadata_write_cell_metadata_type(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("name", "XLDAPR");
-    LXW_PUSH_ATTRIBUTES_INT("minSupportedVersion", 120000);
-    LXW_PUSH_ATTRIBUTES_INT("copy", 1);
-    LXW_PUSH_ATTRIBUTES_INT("pasteAll", 1);
-    LXW_PUSH_ATTRIBUTES_INT("pasteValues", 1);
-    LXW_PUSH_ATTRIBUTES_INT("merge", 1);
-    LXW_PUSH_ATTRIBUTES_INT("splitFirst", 1);
-    LXW_PUSH_ATTRIBUTES_INT("rowColShift", 1);
-    LXW_PUSH_ATTRIBUTES_INT("clearFormats", 1);
-    LXW_PUSH_ATTRIBUTES_INT("clearComments", 1);
-    LXW_PUSH_ATTRIBUTES_INT("assign", 1);
-    LXW_PUSH_ATTRIBUTES_INT("coerce", 1);
-    LXW_PUSH_ATTRIBUTES_INT("cellMeta", 1);
-
-    lxw_xml_empty_tag(self->file, "metadataType", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <metadataType> element for embedded images.
- */
-STATIC void
-_metadata_write_value_metadata_type(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("name", "XLRICHVALUE");
-    LXW_PUSH_ATTRIBUTES_INT("minSupportedVersion", 120000);
-    LXW_PUSH_ATTRIBUTES_INT("copy", 1);
-    LXW_PUSH_ATTRIBUTES_INT("pasteAll", 1);
-    LXW_PUSH_ATTRIBUTES_INT("pasteValues", 1);
-    LXW_PUSH_ATTRIBUTES_INT("merge", 1);
-    LXW_PUSH_ATTRIBUTES_INT("splitFirst", 1);
-    LXW_PUSH_ATTRIBUTES_INT("rowColShift", 1);
-    LXW_PUSH_ATTRIBUTES_INT("clearFormats", 1);
-    LXW_PUSH_ATTRIBUTES_INT("clearComments", 1);
-    LXW_PUSH_ATTRIBUTES_INT("assign", 1);
-    LXW_PUSH_ATTRIBUTES_INT("coerce", 1);
-
-    lxw_xml_empty_tag(self->file, "metadataType", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <metadataTypes> element.
- */
-STATIC void
-_metadata_write_metadata_types(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    uint8_t count = 0;
-
-    if (self->has_dynamic_functions)
-        count++;
-
-    if (self->has_embedded_images)
-        count++;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("count", count);
-
-    lxw_xml_start_tag(self->file, "metadataTypes", &attributes);
-
-    /* Write the metadataType element. */
-    if (self->has_dynamic_functions)
-        _metadata_write_cell_metadata_type(self);
-    if (self->has_embedded_images)
-        _metadata_write_value_metadata_type(self);
-
-    lxw_xml_end_tag(self->file, "metadataTypes");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xda:dynamicArrayProperties> element.
- */
-STATIC void
-_metadata_write_xda_dynamic_array_properties(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("fDynamic", "1");
-    LXW_PUSH_ATTRIBUTES_STR("fCollapsed", "0");
-
-    lxw_xml_empty_tag(self->file, "xda:dynamicArrayProperties", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <ext> element for dynamic functions.
- */
-STATIC void
-_metadata_write_cell_ext(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("uri", "{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}");
-
-    lxw_xml_start_tag(self->file, "ext", &attributes);
-
-    /* Write the xda:dynamicArrayProperties element. */
-    _metadata_write_xda_dynamic_array_properties(self);
-
-    lxw_xml_end_tag(self->file, "ext");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <xlrd:rvb> element.
- */
-STATIC void
-_metadata_write_xlrd_rvb(lxw_metadata *self, uint32_t index)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("i", index);
-
-    lxw_xml_empty_tag(self->file, "xlrd:rvb", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <ext> element for embedded images.
- */
-STATIC void
-_metadata_write_value_ext(lxw_metadata *self, uint32_t index)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("uri", "{3e2802c4-a4d2-4d8b-9148-e3be6c30e623}");
-
-    lxw_xml_start_tag(self->file, "ext", &attributes);
-
-    /* Write the xlrd:rvb element. */
-    _metadata_write_xlrd_rvb(self, index);
-
-    lxw_xml_end_tag(self->file, "ext");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <futureMetadata> element for dynamic functions.
- */
-STATIC void
-_metadata_write_cell_future_metadata(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("name", "XLDAPR");
-    LXW_PUSH_ATTRIBUTES_INT("count", 1);
-
-    lxw_xml_start_tag(self->file, "futureMetadata", &attributes);
-
-    lxw_xml_start_tag(self->file, "bk", NULL);
-    lxw_xml_start_tag(self->file, "extLst", NULL);
-
-    /* Write the ext element. */
-    _metadata_write_cell_ext(self);
-
-    lxw_xml_end_tag(self->file, "extLst");
-    lxw_xml_end_tag(self->file, "bk");
-
-    lxw_xml_end_tag(self->file, "futureMetadata");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <futureMetadata> element for embedded images.
- */
-STATIC void
-_metadata_write_value_future_metadata(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    uint32_t i;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("name", "XLRICHVALUE");
-    LXW_PUSH_ATTRIBUTES_INT("count", self->num_embedded_images);
-
-    lxw_xml_start_tag(self->file, "futureMetadata", &attributes);
-
-    for (i = 0; i < self->num_embedded_images; i++) {
-        lxw_xml_start_tag(self->file, "bk", NULL);
-
-        lxw_xml_start_tag(self->file, "extLst", NULL);
-
-        /* Write the ext element. */
-        _metadata_write_value_ext(self, i);
-
-        lxw_xml_end_tag(self->file, "extLst");
-        lxw_xml_end_tag(self->file, "bk");
-
-    }
-
-    lxw_xml_end_tag(self->file, "futureMetadata");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <rc> element.
- */
-STATIC void
-_metadata_write_rc(lxw_metadata *self, uint8_t type, uint32_t index)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("t", type);
-    LXW_PUSH_ATTRIBUTES_INT("v", index);
-
-    lxw_xml_empty_tag(self->file, "rc", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <cellMetadata> element for dynamic functions.
- */
-STATIC void
-_metadata_write_cell_metadata(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("count", "1");
-
-    lxw_xml_start_tag(self->file, "cellMetadata", &attributes);
-
-    lxw_xml_start_tag(self->file, "bk", NULL);
-
-    /* Write the rc element. */
-    _metadata_write_rc(self, 1, 0);
-
-    lxw_xml_end_tag(self->file, "bk");
-
-    lxw_xml_end_tag(self->file, "cellMetadata");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <cellMetadata> element for embedded images.
- */
-STATIC void
-_metadata_write_value_metadata(lxw_metadata *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    uint8_t type = 1;
-    uint32_t i;
-
-    if (self->has_dynamic_functions)
-        type = 2;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("count", self->num_embedded_images);
-
-    lxw_xml_start_tag(self->file, "valueMetadata", &attributes);
-
-    for (i = 0; i < self->num_embedded_images; i++) {
-        lxw_xml_start_tag(self->file, "bk", NULL);
-
-        /* Write the rc element. */
-        _metadata_write_rc(self, type, i);
-
-        lxw_xml_end_tag(self->file, "bk");
-    }
-
-    lxw_xml_end_tag(self->file, "valueMetadata");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_metadata_assemble_xml_file(lxw_metadata *self)
-{
-    /* Write the XML declaration. */
-    _metadata_xml_declaration(self);
-
-    /* Write the metadata element. */
-    _metadata_write_metadata(self);
-
-    /* Write the metadataTypes element. */
-    _metadata_write_metadata_types(self);
-
-    /* Write the futureMetadata element. */
-    if (self->has_dynamic_functions)
-        _metadata_write_cell_future_metadata(self);
-    if (self->has_embedded_images)
-        _metadata_write_value_future_metadata(self);
-
-    /* Write the cellMetadata element. */
-    if (self->has_dynamic_functions)
-        _metadata_write_cell_metadata(self);
-    if (self->has_embedded_images)
-        _metadata_write_value_metadata(self);
-
-    lxw_xml_end_tag(self->file, "metadata");
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 2265
src/3rdparty/libxlsxwriter/src/packager.c


+ 0 - 269
src/3rdparty/libxlsxwriter/src/relationships.c

@@ -1,269 +0,0 @@
-/*****************************************************************************
- * relationships - A library for creating Excel XLSX relationships files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include <string.h>
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/relationships.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new relationships object.
- */
-lxw_relationships *
-lxw_relationships_new(void)
-{
-    lxw_relationships *rels = calloc(1, sizeof(lxw_relationships));
-    GOTO_LABEL_ON_MEM_ERROR(rels, mem_error);
-
-    rels->relationships = calloc(1, sizeof(struct lxw_rel_tuples));
-    GOTO_LABEL_ON_MEM_ERROR(rels->relationships, mem_error);
-    STAILQ_INIT(rels->relationships);
-
-    return rels;
-
-mem_error:
-    lxw_free_relationships(rels);
-    return NULL;
-}
-
-/*
- * Free a relationships object.
- */
-void
-lxw_free_relationships(lxw_relationships *rels)
-{
-    lxw_rel_tuple *relationship;
-
-    if (!rels)
-        return;
-
-    if (rels->relationships) {
-        while (!STAILQ_EMPTY(rels->relationships)) {
-            relationship = STAILQ_FIRST(rels->relationships);
-            STAILQ_REMOVE_HEAD(rels->relationships, list_pointers);
-            free(relationship->type);
-            free(relationship->target);
-            free(relationship->target_mode);
-            free(relationship);
-        }
-
-        free(rels->relationships);
-    }
-
-    free(rels);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_relationships_xml_declaration(lxw_relationships *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <Relationship> element.
- */
-STATIC void
-_write_relationship(lxw_relationships *self, const char *type,
-                    const char *target, const char *target_mode)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char r_id[LXW_MAX_ATTRIBUTE_LENGTH] = { 0 };
-
-    self->rel_id++;
-    lxw_snprintf(r_id, LXW_ATTR_32, "rId%d", self->rel_id);
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("Id", r_id);
-    LXW_PUSH_ATTRIBUTES_STR("Type", type);
-    LXW_PUSH_ATTRIBUTES_STR("Target", target);
-
-    if (target_mode)
-        LXW_PUSH_ATTRIBUTES_STR("TargetMode", target_mode);
-
-    lxw_xml_empty_tag(self->file, "Relationship", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <Relationships> element.
- */
-STATIC void
-_write_relationships(lxw_relationships *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    lxw_rel_tuple *rel;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", LXW_SCHEMA_PACKAGE);
-
-    lxw_xml_start_tag(self->file, "Relationships", &attributes);
-
-    STAILQ_FOREACH(rel, self->relationships, list_pointers) {
-        _write_relationship(self, rel->type, rel->target, rel->target_mode);
-    }
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_relationships_assemble_xml_file(lxw_relationships *self)
-{
-    /* Write the XML declaration. */
-    _relationships_xml_declaration(self);
-
-    _write_relationships(self);
-
-    /* Close the relationships tag. */
-    lxw_xml_end_tag(self->file, "Relationships");
-}
-
-/*
- * Add a generic container relationship to XLSX .rels xml files.
- */
-STATIC void
-_add_relationship(lxw_relationships *self, const char *schema,
-                  const char *type, const char *target,
-                  const char *target_mode)
-{
-    lxw_rel_tuple *relationship;
-
-    if (!schema || !type || !target)
-        return;
-
-    relationship = calloc(1, sizeof(lxw_rel_tuple));
-    GOTO_LABEL_ON_MEM_ERROR(relationship, mem_error);
-
-    relationship->type = calloc(1, LXW_MAX_ATTRIBUTE_LENGTH);
-    GOTO_LABEL_ON_MEM_ERROR(relationship->type, mem_error);
-
-    /* Add the schema to the relationship type. */
-    lxw_snprintf(relationship->type, LXW_MAX_ATTRIBUTE_LENGTH, "%s%s",
-                 schema, type);
-
-    relationship->target = lxw_strdup(target);
-    GOTO_LABEL_ON_MEM_ERROR(relationship->target, mem_error);
-
-    if (target_mode) {
-        relationship->target_mode = lxw_strdup(target_mode);
-        GOTO_LABEL_ON_MEM_ERROR(relationship->target_mode, mem_error);
-    }
-
-    STAILQ_INSERT_TAIL(self->relationships, relationship, list_pointers);
-
-    return;
-
-mem_error:
-    if (relationship) {
-        free(relationship->type);
-        free(relationship->target);
-        free(relationship->target_mode);
-        free(relationship);
-    }
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/
-
-/*
- * Add a document relationship to XLSX .rels xml files.
- */
-void
-lxw_add_document_relationship(lxw_relationships *self, const char *type,
-                              const char *target)
-{
-    _add_relationship(self, LXW_SCHEMA_DOCUMENT, type, target, NULL);
-}
-
-/*
- * Add a package relationship to XLSX .rels xml files.
- */
-void
-lxw_add_package_relationship(lxw_relationships *self, const char *type,
-                             const char *target)
-{
-    _add_relationship(self, LXW_SCHEMA_PACKAGE, type, target, NULL);
-}
-
-/*
- * Add a MS schema package relationship to XLSX .rels xml files.
- */
-void
-lxw_add_ms_package_relationship(lxw_relationships *self, const char *type,
-                                const char *target)
-{
-    _add_relationship(self, LXW_SCHEMA_MS, type, target, NULL);
-}
-
-/*
- * Add a worksheet relationship to sheet .rels xml files.
- */
-void
-lxw_add_worksheet_relationship(lxw_relationships *self, const char *type,
-                               const char *target, const char *target_mode)
-{
-    _add_relationship(self, LXW_SCHEMA_DOCUMENT, type, target, target_mode);
-}
-
-/*
- * Add a richValue relationship to sheet .rels xml files.
- */
-void
-lxw_add_rich_value_relationship(lxw_relationships *self)
-{
-    _add_relationship(self,
-                      "http://schemas.microsoft.com/office/2022/10/relationships/",
-                      "richValueRel", "richData/richValueRel.xml", NULL);
-    _add_relationship(self,
-                      "http://schemas.microsoft.com/office/2017/06/relationships/",
-                      "rdRichValue", "richData/rdrichvalue.xml", NULL);
-    _add_relationship(self,
-                      "http://schemas.microsoft.com/office/2017/06/relationships/",
-                      "rdRichValueStructure",
-                      "richData/rdrichvaluestructure.xml", NULL);
-    _add_relationship(self,
-                      "http://schemas.microsoft.com/office/2017/06/relationships/",
-                      "rdRichValueTypes", "richData/rdRichValueTypes.xml",
-                      NULL);
-
-}

+ 0 - 191
src/3rdparty/libxlsxwriter/src/rich_value.c

@@ -1,191 +0,0 @@
-/*****************************************************************************
- * rich_value - A library for creating Excel XLSX rich_value files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/rich_value.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new rich_value object.
- */
-lxw_rich_value *
-lxw_rich_value_new(void)
-{
-    lxw_rich_value *rich_value = calloc(1, sizeof(lxw_rich_value));
-    GOTO_LABEL_ON_MEM_ERROR(rich_value, mem_error);
-
-    return rich_value;
-
-mem_error:
-    lxw_rich_value_free(rich_value);
-    return NULL;
-}
-
-/*
- * Free a rich_value object.
- */
-void
-lxw_rich_value_free(lxw_rich_value *rich_value)
-{
-    if (!rich_value)
-        return;
-
-    free(rich_value);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_rich_value_xml_declaration(lxw_rich_value *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Write the <v> element.
- */
-STATIC void
-_rich_value_write_v(lxw_rich_value *self, char *value)
-{
-    lxw_xml_data_element(self->file, "v", value, NULL);
-
-}
-
-/*
- * Write the <rv> element.
- */
-STATIC void
-_rich_value_write_rv(lxw_rich_value *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("s", "0");
-
-    lxw_xml_start_tag(self->file, "rv", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the metadata for each embedded image.
- */
-void
-lxw_rich_value_write_images(lxw_rich_value *self)
-{
-
-    lxw_workbook *workbook = self->workbook;
-    lxw_sheet *sheet;
-    lxw_worksheet *worksheet;
-    lxw_object_properties *object_props;
-    char value[LXW_UINT32_T_LENGTH];
-    uint32_t index = 0;
-    uint8_t type = 5;
-
-    STAILQ_FOREACH(sheet, workbook->sheets, list_pointers) {
-        if (sheet->is_chartsheet)
-            continue;
-        else
-            worksheet = sheet->u.worksheet;
-
-        STAILQ_FOREACH(object_props, worksheet->embedded_image_props,
-                       list_pointers) {
-
-            if (object_props->is_duplicate)
-                continue;
-
-            if (object_props->decorative)
-                type = 6;
-
-            /* Write the rv element. */
-            _rich_value_write_rv(self);
-
-            /* Write the v element. */
-            lxw_snprintf(value, LXW_UINT32_T_LENGTH, "%u", index);
-            _rich_value_write_v(self, value);
-
-            lxw_snprintf(value, LXW_UINT32_T_LENGTH, "%u", type);
-            _rich_value_write_v(self, value);
-
-            if (object_props->description && *object_props->description)
-                _rich_value_write_v(self, object_props->description);
-
-            lxw_xml_end_tag(self->file, "rv");
-
-            index++;
-        }
-    }
-}
-
-/*
- * Write the <rvData> element.
- */
-STATIC void
-_rich_value_write_rv_data(lxw_rich_value *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] =
-        "http://schemas.microsoft.com/office/spreadsheetml/2017/richdata";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_INT("count", self->workbook->num_embedded_images);
-
-    lxw_xml_start_tag(self->file, "rvData", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_rich_value_assemble_xml_file(lxw_rich_value *self)
-{
-    /* Write the XML declaration. */
-    _rich_value_xml_declaration(self);
-
-    /* Write the rvData element. */
-    _rich_value_write_rv_data(self);
-
-    lxw_rich_value_write_images(self);
-
-    lxw_xml_end_tag(self->file, "rvData");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 142
src/3rdparty/libxlsxwriter/src/rich_value_rel.c

@@ -1,142 +0,0 @@
-/*****************************************************************************
- * rich_value_rel - A library for creating Excel XLSX rich_value_rel files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/rich_value_rel.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new rich_value_rel object.
- */
-lxw_rich_value_rel *
-lxw_rich_value_rel_new(void)
-{
-    lxw_rich_value_rel *rich_value_rel =
-        calloc(1, sizeof(lxw_rich_value_rel));
-    GOTO_LABEL_ON_MEM_ERROR(rich_value_rel, mem_error);
-
-    return rich_value_rel;
-
-mem_error:
-    lxw_rich_value_rel_free(rich_value_rel);
-    return NULL;
-}
-
-/*
- * Free a rich_value_rel object.
- */
-void
-lxw_rich_value_rel_free(lxw_rich_value_rel *rich_value_rel)
-{
-    if (!rich_value_rel)
-        return;
-
-    free(rich_value_rel);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_rich_value_rel_xml_declaration(lxw_rich_value_rel *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Write the <rel> element.
- */
-STATIC void
-_rich_value_rel_write_rel(lxw_rich_value_rel *self, uint32_t rel_index)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char r_id[LXW_MAX_ATTRIBUTE_LENGTH];
-
-    lxw_snprintf(r_id, LXW_ATTR_32, "rId%d", rel_index);
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("r:id", r_id);
-
-    lxw_xml_empty_tag(self->file, "rel", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <richValueRels> element.
- */
-STATIC void
-_rich_value_rel_write_rich_value_rels(lxw_rich_value_rel *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] =
-        "http://schemas.microsoft.com/office/spreadsheetml/2022/richvaluerel";
-    char xmlns_r[] =
-        "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:r", xmlns_r);
-
-    lxw_xml_start_tag(self->file, "richValueRels", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_rich_value_rel_assemble_xml_file(lxw_rich_value_rel *self)
-{
-    uint32_t i;
-
-    /* Write the XML declaration. */
-    _rich_value_rel_xml_declaration(self);
-
-    /* Write the richValueRels element. */
-    _rich_value_rel_write_rich_value_rels(self);
-
-    for (i = 1; i <= self->num_embedded_images; i++) {
-        /* Write the rel element. */
-        _rich_value_rel_write_rel(self, i);
-    }
-
-    lxw_xml_end_tag(self->file, "richValueRels");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 162
src/3rdparty/libxlsxwriter/src/rich_value_structure.c

@@ -1,162 +0,0 @@
-/*****************************************************************************
- * rich_value_structure - A library for creating Excel XLSX rich_value_structure files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/rich_value_structure.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new rich_value_structure object.
- */
-lxw_rich_value_structure *
-lxw_rich_value_structure_new(void)
-{
-    lxw_rich_value_structure *rich_value_structure =
-        calloc(1, sizeof(lxw_rich_value_structure));
-    GOTO_LABEL_ON_MEM_ERROR(rich_value_structure, mem_error);
-
-    return rich_value_structure;
-
-mem_error:
-    lxw_rich_value_structure_free(rich_value_structure);
-    return NULL;
-}
-
-/*
- * Free a rich_value_structure object.
- */
-void
-lxw_rich_value_structure_free(lxw_rich_value_structure *rich_value_structure)
-{
-    if (!rich_value_structure)
-        return;
-
-    free(rich_value_structure);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_rich_value_structure_xml_declaration(lxw_rich_value_structure *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Write the <k> element.
- */
-STATIC void
-_rich_value_structure_write_k(lxw_rich_value_structure *self, char *name,
-                              char *type)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("n", name);
-    LXW_PUSH_ATTRIBUTES_STR("t", type);
-
-    lxw_xml_empty_tag(self->file, "k", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <s> element.
- */
-STATIC void
-_rich_value_structure_write_s(lxw_rich_value_structure *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("t", "_localImage");
-
-    lxw_xml_start_tag(self->file, "s", &attributes);
-
-    /* Write the k element. */
-    _rich_value_structure_write_k(self, "_rvRel:LocalImageIdentifier", "i");
-    _rich_value_structure_write_k(self, "CalcOrigin", "i");
-
-    if (self->has_embedded_image_descriptions)
-        _rich_value_structure_write_k(self, "Text", "s");
-
-    lxw_xml_end_tag(self->file, "s");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <rvStructures> element.
- */
-STATIC void
-_rich_value_structure_write_rv_structures(lxw_rich_value_structure *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] =
-        "http://schemas.microsoft.com/office/spreadsheetml/2017/richdata";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_STR("count", "1");
-
-    lxw_xml_start_tag(self->file, "rvStructures", &attributes);
-
-    /* Write the s element. */
-    _rich_value_structure_write_s(self);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_rich_value_structure_assemble_xml_file(lxw_rich_value_structure *self)
-{
-    /* Write the XML declaration. */
-    _rich_value_structure_xml_declaration(self);
-
-    /* Write the rvStructures element. */
-    _rich_value_structure_write_rv_structures(self);
-
-    lxw_xml_end_tag(self->file, "rvStructures");
-
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 199
src/3rdparty/libxlsxwriter/src/rich_value_types.c

@@ -1,199 +0,0 @@
-/*****************************************************************************
- * rich_value_types - A library for creating Excel XLSX rich_value_types files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/rich_value_types.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new rich_value_types object.
- */
-lxw_rich_value_types *
-lxw_rich_value_types_new(void)
-{
-    lxw_rich_value_types *rich_value_types =
-        calloc(1, sizeof(lxw_rich_value_types));
-    GOTO_LABEL_ON_MEM_ERROR(rich_value_types, mem_error);
-
-    return rich_value_types;
-
-mem_error:
-    lxw_rich_value_types_free(rich_value_types);
-    return NULL;
-}
-
-/*
- * Free a rich_value_types object.
- */
-void
-lxw_rich_value_types_free(lxw_rich_value_types *rich_value_types)
-{
-    if (!rich_value_types)
-        return;
-
-    free(rich_value_types);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_rich_value_types_xml_declaration(lxw_rich_value_types *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Write the <rvTypesInfo> element.
- */
-STATIC void
-_rich_value_types_write_rv_types_info(lxw_rich_value_types *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] =
-        "http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2";
-    char xmlns_mc[] =
-        "http://schemas.openxmlformats.org/markup-compatibility/2006";
-    char xmlns_x[] =
-        "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
-    char mc_ignorable[] = "x";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:mc", xmlns_mc);
-    LXW_PUSH_ATTRIBUTES_STR("mc:Ignorable", mc_ignorable);
-    LXW_PUSH_ATTRIBUTES_STR("xmlns:x", xmlns_x);
-
-    lxw_xml_start_tag(self->file, "rvTypesInfo", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <flag> element.
- */
-STATIC void
-_rich_value_types_write_flag(lxw_rich_value_types *self, char *name)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("name", name);
-    LXW_PUSH_ATTRIBUTES_STR("value", "1");
-
-    lxw_xml_empty_tag(self->file, "flag", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <key> element.
- */
-STATIC void
-_rich_value_types_write_key(lxw_rich_value_types *self, char *name)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("name", name);
-
-    lxw_xml_start_tag(self->file, "key", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <keyFlags> element.
- */
-STATIC void
-_rich_value_types_write_key_flags(lxw_rich_value_types *self)
-{
-    int i;
-    char *key_flags[10][3] = {
-        {"_Self", "ExcludeFromFile", "ExcludeFromCalcComparison"},
-        {"_DisplayString", "ExcludeFromCalcComparison", ""},
-        {"_Flags", "ExcludeFromCalcComparison", ""},
-        {"_Format", "ExcludeFromCalcComparison", ""},
-        {"_SubLabel", "ExcludeFromCalcComparison", ""},
-        {"_Attribution", "ExcludeFromCalcComparison", ""},
-        {"_Icon", "ExcludeFromCalcComparison", ""},
-        {"_Display", "ExcludeFromCalcComparison", ""},
-        {"_CanonicalPropertyNames", "ExcludeFromCalcComparison", ""},
-        {"_ClassificationId", "ExcludeFromCalcComparison", ""},
-    };
-
-    lxw_xml_start_tag(self->file, "global", NULL);
-    lxw_xml_start_tag(self->file, "keyFlags", NULL);
-
-    for (i = 0; i < 10; i++) {
-        char **flags = key_flags[i];
-
-        _rich_value_types_write_key(self, flags[0]);
-        _rich_value_types_write_flag(self, flags[1]);
-
-        if (*flags[2]) {
-            _rich_value_types_write_flag(self, flags[2]);
-
-        }
-
-        lxw_xml_end_tag(self->file, "key");
-    }
-
-    lxw_xml_end_tag(self->file, "keyFlags");
-    lxw_xml_end_tag(self->file, "global");
-}
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_rich_value_types_assemble_xml_file(lxw_rich_value_types *self)
-{
-    /* Write the XML declaration. */
-    _rich_value_types_xml_declaration(self);
-
-    /* Write the rvTypesInfo element. */
-    _rich_value_types_write_rv_types_info(self);
-
-    /* Write the keyFlags element. */
-    _rich_value_types_write_key_flags(self);
-
-    lxw_xml_end_tag(self->file, "rvTypesInfo");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 279
src/3rdparty/libxlsxwriter/src/shared_strings.c

@@ -1,279 +0,0 @@
-/*****************************************************************************
- * shared_strings - A library for creating Excel XLSX sst files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/shared_strings.h"
-#include "xlsxwriter/utility.h"
-#include <ctype.h>
-
-/*
- * Forward declarations.
- */
-
-STATIC int _element_cmp(struct sst_element *element1,
-                        struct sst_element *element2);
-
-#ifndef __clang_analyzer__
-LXW_RB_GENERATE_ELEMENT(sst_rb_tree, sst_element, sst_tree_pointers,
-                        _element_cmp);
-#endif
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new SST SharedString object.
- */
-lxw_sst *
-lxw_sst_new(void)
-{
-    /* Create the new shared string table. */
-    lxw_sst *sst = calloc(1, sizeof(lxw_sst));
-    RETURN_ON_MEM_ERROR(sst, NULL);
-
-    /* Add the sst RB tree. */
-    sst->rb_tree = calloc(1, sizeof(struct sst_rb_tree));
-    GOTO_LABEL_ON_MEM_ERROR(sst->rb_tree, mem_error);
-
-    /* Add a list for tracking the insertion order. */
-    sst->order_list = calloc(1, sizeof(struct sst_order_list));
-    GOTO_LABEL_ON_MEM_ERROR(sst->order_list, mem_error);
-
-    /* Initialize the order list. */
-    STAILQ_INIT(sst->order_list);
-
-    /* Initialize the RB tree. */
-    RB_INIT(sst->rb_tree);
-
-    return sst;
-
-mem_error:
-    lxw_sst_free(sst);
-    return NULL;
-}
-
-/*
- * Free a SST SharedString table object.
- */
-void
-lxw_sst_free(lxw_sst *sst)
-{
-    struct sst_element *sst_element;
-    struct sst_element *sst_element_temp;
-
-    if (!sst)
-        return;
-
-    /* Free the sst_elements and their data using the ordered linked list. */
-    if (sst->order_list) {
-        STAILQ_FOREACH_SAFE(sst_element, sst->order_list, sst_order_pointers,
-                            sst_element_temp) {
-
-            if (sst_element && sst_element->string)
-                free(sst_element->string);
-            if (sst_element)
-                free(sst_element);
-        }
-    }
-
-    free(sst->order_list);
-    free(sst->rb_tree);
-    free(sst);
-}
-
-/*
- * Comparator for the element structure
- */
-STATIC int
-_element_cmp(struct sst_element *element1, struct sst_element *element2)
-{
-    return strcmp(element1->string, element2->string);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-/*
- * Write the XML declaration.
- */
-STATIC void
-_sst_xml_declaration(lxw_sst *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <t> element.
- */
-STATIC void
-_write_t(lxw_sst *self, char *string)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    LXW_INIT_ATTRIBUTES();
-
-    /* Add attribute to preserve leading or trailing whitespace. */
-    if (isspace((unsigned char) string[0])
-        || isspace((unsigned char) string[strlen(string) - 1]))
-        LXW_PUSH_ATTRIBUTES_STR("xml:space", "preserve");
-
-    lxw_xml_data_element(self->file, "t", string, &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <si> element.
- */
-STATIC void
-_write_si(lxw_sst *self, char *string)
-{
-    uint8_t escaped_string = LXW_FALSE;
-
-    lxw_xml_start_tag(self->file, "si", NULL);
-
-    /* Look for and escape control chars in the string. */
-    if (lxw_has_control_characters(string)) {
-        string = lxw_escape_control_characters(string);
-        escaped_string = LXW_TRUE;
-    }
-
-    /* Write the t element. */
-    _write_t(self, string);
-
-    lxw_xml_end_tag(self->file, "si");
-
-    if (escaped_string)
-        free(string);
-}
-
-/*
- * Write the <si> element for rich strings.
- */
-STATIC void
-_write_rich_si(lxw_sst *self, char *string)
-{
-    lxw_xml_rich_si_element(self->file, string);
-}
-
-/*
- * Write the <sst> element.
- */
-STATIC void
-_write_sst(lxw_sst *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] =
-        "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_INT("count", self->string_count);
-    LXW_PUSH_ATTRIBUTES_INT("uniqueCount", self->unique_count);
-
-    lxw_xml_start_tag(self->file, "sst", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-STATIC void
-_write_sst_strings(lxw_sst *self)
-{
-    struct sst_element *sst_element;
-
-    STAILQ_FOREACH(sst_element, self->order_list, sst_order_pointers) {
-        /* Write the si element. */
-        if (sst_element->is_rich_string)
-            _write_rich_si(self, sst_element->string);
-        else
-            _write_si(self, sst_element->string);
-
-    }
-}
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_sst_assemble_xml_file(lxw_sst *self)
-{
-    /* Write the XML declaration. */
-    _sst_xml_declaration(self);
-
-    /* Write the sst element. */
-    _write_sst(self);
-
-    /* Write the sst strings. */
-    _write_sst_strings(self);
-
-    /* Close the sst tag. */
-    lxw_xml_end_tag(self->file, "sst");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/
-/*
- * Add to or find a string in the SST SharedString table and return it's index.
- */
-struct sst_element *
-lxw_get_sst_index(lxw_sst *sst, const char *string, uint8_t is_rich_string)
-{
-    struct sst_element *element;
-    struct sst_element *existing_element;
-
-    /* Create an sst element to potentially add to the table. */
-    element = calloc(1, sizeof(struct sst_element));
-    if (!element)
-        return NULL;
-
-    /* Create potential new element with the string and its index. */
-    element->index = sst->unique_count;
-    element->string = lxw_strdup(string);
-    element->is_rich_string = is_rich_string;
-
-    /* Try to insert it and see whether we already have that string. */
-    existing_element = RB_INSERT(sst_rb_tree, sst->rb_tree, element);
-
-    /* If existing_element is not NULL, then it already existed. */
-    /* Free new created element. */
-    if (existing_element) {
-        free(element->string);
-        free(element);
-        sst->string_count++;
-        return existing_element;
-    }
-
-    /* If it didn't exist, also add it to the insertion order linked list. */
-    STAILQ_INSERT_TAIL(sst->order_list, element, sst_order_pointers);
-
-    /* Update SST string counts. */
-    sst->string_count++;
-    sst->unique_count++;
-    return element;
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1454
src/3rdparty/libxlsxwriter/src/styles.c


+ 0 - 305
src/3rdparty/libxlsxwriter/src/table.c

@@ -1,305 +0,0 @@
-/*****************************************************************************
- * table - A library for creating Excel XLSX table files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/worksheet.h"
-#include "xlsxwriter/table.h"
-#include "xlsxwriter/utility.h"
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new table object.
- */
-lxw_table *
-lxw_table_new(void)
-{
-    lxw_table *table = calloc(1, sizeof(lxw_table));
-    GOTO_LABEL_ON_MEM_ERROR(table, mem_error);
-
-    return table;
-
-mem_error:
-    lxw_table_free(table);
-    return NULL;
-}
-
-/*
- * Free a table object.
- */
-void
-lxw_table_free(lxw_table *table)
-{
-    if (!table)
-        return;
-
-    free(table);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/*
- * Write the XML declaration.
- */
-STATIC void
-_table_xml_declaration(lxw_table *self)
-{
-    lxw_xml_declaration(self->file);
-}
-
-/*
- * Write the <table> element.
- */
-STATIC void
-_table_write_table(lxw_table *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char xmlns[] =
-        "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
-    lxw_table_obj *table_obj = self->table_obj;
-
-    LXW_INIT_ATTRIBUTES();
-
-    LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns);
-    LXW_PUSH_ATTRIBUTES_INT("id", table_obj->id);
-
-    if (table_obj->name)
-        LXW_PUSH_ATTRIBUTES_STR("name", table_obj->name);
-    else
-        LXW_PUSH_ATTRIBUTES_STR("name", "Table1");
-
-    if (table_obj->name)
-        LXW_PUSH_ATTRIBUTES_STR("displayName", table_obj->name);
-    else
-        LXW_PUSH_ATTRIBUTES_STR("displayName", "Table1");
-
-    LXW_PUSH_ATTRIBUTES_STR("ref", table_obj->sqref);
-
-    if (table_obj->no_header_row)
-        LXW_PUSH_ATTRIBUTES_STR("headerRowCount", "0");
-
-    if (table_obj->total_row)
-        LXW_PUSH_ATTRIBUTES_STR("totalsRowCount", "1");
-    else
-        LXW_PUSH_ATTRIBUTES_STR("totalsRowShown", "0");
-
-    lxw_xml_start_tag(self->file, "table", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <autoFilter> element.
- */
-STATIC void
-_table_write_auto_filter(lxw_table *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-
-    if (self->table_obj->no_autofilter)
-        return;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_STR("ref", self->table_obj->filter_sqref);
-
-    lxw_xml_empty_tag(self->file, "autoFilter", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <tableColumn> element.
- */
-STATIC void
-_table_write_table_column(lxw_table *self, uint16_t id,
-                          lxw_table_column *column)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    int32_t dfx_id;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("id", id);
-
-    LXW_PUSH_ATTRIBUTES_STR("name", column->header);
-
-    if (column->total_string) {
-        LXW_PUSH_ATTRIBUTES_STR("totalsRowLabel", column->total_string);
-    }
-    else if (column->total_function) {
-        if (column->total_function == LXW_TABLE_FUNCTION_AVERAGE)
-            LXW_PUSH_ATTRIBUTES_STR("totalsRowFunction", "average");
-        if (column->total_function == LXW_TABLE_FUNCTION_COUNT_NUMS)
-            LXW_PUSH_ATTRIBUTES_STR("totalsRowFunction", "countNums");
-        if (column->total_function == LXW_TABLE_FUNCTION_COUNT)
-            LXW_PUSH_ATTRIBUTES_STR("totalsRowFunction", "count");
-        if (column->total_function == LXW_TABLE_FUNCTION_MAX)
-            LXW_PUSH_ATTRIBUTES_STR("totalsRowFunction", "max");
-        if (column->total_function == LXW_TABLE_FUNCTION_MIN)
-            LXW_PUSH_ATTRIBUTES_STR("totalsRowFunction", "min");
-        if (column->total_function == LXW_TABLE_FUNCTION_STD_DEV)
-            LXW_PUSH_ATTRIBUTES_STR("totalsRowFunction", "stdDev");
-        if (column->total_function == LXW_TABLE_FUNCTION_SUM)
-            LXW_PUSH_ATTRIBUTES_STR("totalsRowFunction", "sum");
-        if (column->total_function == LXW_TABLE_FUNCTION_VAR)
-            LXW_PUSH_ATTRIBUTES_STR("totalsRowFunction", "var");
-    }
-
-    if (column->format) {
-        dfx_id = lxw_format_get_dxf_index(column->format);
-        LXW_PUSH_ATTRIBUTES_INT("dataDxfId", dfx_id);
-    }
-
-    if (column->formula) {
-        lxw_xml_start_tag(self->file, "tableColumn", &attributes);
-        lxw_xml_data_element(self->file, "calculatedColumnFormula",
-                             column->formula, NULL);
-        lxw_xml_end_tag(self->file, "tableColumn");
-    }
-    else {
-        lxw_xml_empty_tag(self->file, "tableColumn", &attributes);
-    }
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <tableColumns> element.
- */
-STATIC void
-_table_write_table_columns(lxw_table *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    uint16_t i;
-    uint16_t num_cols = self->table_obj->num_cols;
-    lxw_table_column **columns = self->table_obj->columns;
-
-    LXW_INIT_ATTRIBUTES();
-    LXW_PUSH_ATTRIBUTES_INT("count", num_cols);
-
-    lxw_xml_start_tag(self->file, "tableColumns", &attributes);
-
-    for (i = 0; i < num_cols; i++)
-        _table_write_table_column(self, i + 1, columns[i]);
-
-    lxw_xml_end_tag(self->file, "tableColumns");
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*
- * Write the <tableStyleInfo> element.
- */
-STATIC void
-_table_write_table_style_info(lxw_table *self)
-{
-    struct xml_attribute_list attributes;
-    struct xml_attribute *attribute;
-    char name[LXW_ATTR_32];
-    lxw_table_obj *table_obj = self->table_obj;
-
-    LXW_INIT_ATTRIBUTES();
-
-    if (table_obj->style_type == LXW_TABLE_STYLE_TYPE_LIGHT) {
-        if (table_obj->style_type_number != 0) {
-            lxw_snprintf(name, LXW_ATTR_32, "TableStyleLight%d",
-                         table_obj->style_type_number);
-            LXW_PUSH_ATTRIBUTES_STR("name", name);
-        }
-    }
-    else if (table_obj->style_type == LXW_TABLE_STYLE_TYPE_MEDIUM) {
-        lxw_snprintf(name, LXW_ATTR_32, "TableStyleMedium%d",
-                     table_obj->style_type_number);
-        LXW_PUSH_ATTRIBUTES_STR("name", name);
-    }
-    else if (table_obj->style_type == LXW_TABLE_STYLE_TYPE_DARK) {
-        lxw_snprintf(name, LXW_ATTR_32, "TableStyleDark%d",
-                     table_obj->style_type_number);
-        LXW_PUSH_ATTRIBUTES_STR("name", name);
-    }
-    else {
-        LXW_PUSH_ATTRIBUTES_STR("name", "TableStyleMedium9");
-    }
-
-    if (table_obj->first_column)
-        LXW_PUSH_ATTRIBUTES_STR("showFirstColumn", "1");
-    else
-        LXW_PUSH_ATTRIBUTES_STR("showFirstColumn", "0");
-
-    if (table_obj->last_column)
-        LXW_PUSH_ATTRIBUTES_STR("showLastColumn", "1");
-    else
-        LXW_PUSH_ATTRIBUTES_STR("showLastColumn", "0");
-
-    if (table_obj->no_banded_rows)
-        LXW_PUSH_ATTRIBUTES_STR("showRowStripes", "0");
-    else
-        LXW_PUSH_ATTRIBUTES_STR("showRowStripes", "1");
-
-    if (table_obj->banded_columns)
-        LXW_PUSH_ATTRIBUTES_STR("showColumnStripes", "1");
-    else
-        LXW_PUSH_ATTRIBUTES_STR("showColumnStripes", "0");
-
-    lxw_xml_empty_tag(self->file, "tableStyleInfo", &attributes);
-
-    LXW_FREE_ATTRIBUTES();
-}
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_table_assemble_xml_file(lxw_table *self)
-{
-    /* Write the XML declaration. */
-    _table_xml_declaration(self);
-
-    /* Write the table element. */
-    _table_write_table(self);
-
-    /* Write the autoFilter element. */
-    _table_write_auto_filter(self);
-
-    /* Write the tableColumns element. */
-    _table_write_table_columns(self);
-
-    /* Write the tableStyleInfo element. */
-    _table_write_table_style_info(self);
-
-    lxw_xml_end_tag(self->file, "table");
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 349
src/3rdparty/libxlsxwriter/src/theme.c

@@ -1,349 +0,0 @@
-/*****************************************************************************
- * theme - A library for creating Excel XLSX theme files.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include <string.h>
-
-#include "xlsxwriter/xmlwriter.h"
-#include "xlsxwriter/theme.h"
-#include "xlsxwriter/utility.h"
-
-const char *theme_strs[] = {
-    "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n",
-    "<a:theme xmlns:a=\"http://schemas.openxmlformats.org/",
-    "drawingml/2006/main\" name=\"Office Theme\">",
-    "<a:themeElements>",
-    "<a:clrScheme name=\"Office\"><a:dk1>",
-    "<a:sysClr val=\"windowText\" lastClr=\"000000\"/>",
-    "</a:dk1><a:lt1>",
-    "<a:sysClr val=\"window\" lastClr=\"FFFFFF\"/></a:lt1><a:dk2>",
-    "<a:srgbClr val=\"1F497D\"/></a:dk2><a:lt2>",
-    "<a:srgbClr val=\"EEECE1\"/></a:lt2><a:accent1>",
-    "<a:srgbClr val=\"4F81BD\"/></a:accent1><a:accent2>",
-    "<a:srgbClr val=\"C0504D\"/></a:accent2><a:accent3>",
-    "<a:srgbClr val=\"9BBB59\"/></a:accent3><a:accent4>",
-    "<a:srgbClr val=\"8064A2\"/></a:accent4><a:accent5>",
-    "<a:srgbClr val=\"4BACC6\"/></a:accent5><a:accent6>",
-    "<a:srgbClr val=\"F79646\"/></a:accent6><a:hlink>",
-    "<a:srgbClr val=\"0000FF\"/></a:hlink><a:folHlink>",
-    "<a:srgbClr val=\"800080\"/></a:folHlink></a:clrScheme>",
-    "<a:fontScheme name=\"Office\"><a:majorFont>",
-    "<a:latin typeface=\"Cambria\"/><a:ea typeface=\"\"/>",
-    "<a:cs typeface=\"\"/>",
-    "<a:font script=\"Jpan\" typeface=\"MS Pゴシック\"/>",
-    "<a:font script=\"Hang\" typeface=\"맑은 고딕\"/>",
-    "<a:font script=\"Hans\" typeface=\"宋体\"/>",
-    "<a:font script=\"Hant\" typeface=\"新細明體\"/>",
-    "<a:font script=\"Arab\" typeface=\"Times New Roman\"/>",
-    "<a:font script=\"Hebr\" typeface=\"Times New Roman\"/>",
-    "<a:font script=\"Thai\" typeface=\"Tahoma\"/>",
-    "<a:font script=\"Ethi\" typeface=\"Nyala\"/>",
-    "<a:font script=\"Beng\" typeface=\"Vrinda\"/>",
-    "<a:font script=\"Gujr\" typeface=\"Shruti\"/>",
-    "<a:font script=\"Khmr\" typeface=\"MoolBoran\"/>",
-    "<a:font script=\"Knda\" typeface=\"Tunga\"/>",
-    "<a:font script=\"Guru\" typeface=\"Raavi\"/>",
-    "<a:font script=\"Cans\" typeface=\"Euphemia\"/>",
-    "<a:font script=\"Cher\" typeface=\"Plantagenet Cherokee\"/>",
-    "<a:font script=\"Yiii\" typeface=\"Microsoft Yi Baiti\"/>",
-    "<a:font script=\"Tibt\" typeface=\"Microsoft Himalaya\"/>",
-    "<a:font script=\"Thaa\" typeface=\"MV Boli\"/>",
-    "<a:font script=\"Deva\" typeface=\"Mangal\"/>",
-    "<a:font script=\"Telu\" typeface=\"Gautami\"/>",
-    "<a:font script=\"Taml\" typeface=\"Latha\"/>",
-    "<a:font script=\"Syrc\" typeface=\"Estrangelo Edessa\"/>",
-    "<a:font script=\"Orya\" typeface=\"Kalinga\"/>",
-    "<a:font script=\"Mlym\" typeface=\"Kartika\"/>",
-    "<a:font script=\"Laoo\" typeface=\"DokChampa\"/>",
-    "<a:font script=\"Sinh\" typeface=\"Iskoola Pota\"/>",
-    "<a:font script=\"Mong\" typeface=\"Mongolian Baiti\"/>",
-    "<a:font script=\"Viet\" typeface=\"Times New Roman\"/>",
-    "<a:font script=\"Uigh\" typeface=\"Microsoft Uighur\"/>",
-    "</a:majorFont>",
-    "<a:minorFont>",
-    "<a:latin typeface=\"Calibri\"/>",
-    "<a:ea typeface=\"\"/>",
-    "<a:cs typeface=\"\"/>",
-    "<a:font script=\"Jpan\" typeface=\"MS Pゴシック\"/>",
-    "<a:font script=\"Hang\" typeface=\"맑은 고딕\"/>",
-    "<a:font script=\"Hans\" typeface=\"宋体\"/>",
-    "<a:font script=\"Hant\" typeface=\"新細明體\"/>",
-    "<a:font script=\"Arab\" typeface=\"Arial\"/>",
-    "<a:font script=\"Hebr\" typeface=\"Arial\"/>",
-    "<a:font script=\"Thai\" typeface=\"Tahoma\"/>",
-    "<a:font script=\"Ethi\" typeface=\"Nyala\"/>",
-    "<a:font script=\"Beng\" typeface=\"Vrinda\"/>",
-    "<a:font script=\"Gujr\" typeface=\"Shruti\"/>",
-    "<a:font script=\"Khmr\" typeface=\"DaunPenh\"/>",
-    "<a:font script=\"Knda\" typeface=\"Tunga\"/>",
-    "<a:font script=\"Guru\" typeface=\"Raavi\"/>",
-    "<a:font script=\"Cans\" typeface=\"Euphemia\"/>",
-    "<a:font script=\"Cher\" typeface=\"Plantagenet Cherokee\"/>",
-    "<a:font script=\"Yiii\" typeface=\"Microsoft Yi Baiti\"/>",
-    "<a:font script=\"Tibt\" typeface=\"Microsoft Himalaya\"/>",
-    "<a:font script=\"Thaa\" typeface=\"MV Boli\"/>",
-    "<a:font script=\"Deva\" typeface=\"Mangal\"/>",
-    "<a:font script=\"Telu\" typeface=\"Gautami\"/>",
-    "<a:font script=\"Taml\" typeface=\"Latha\"/>",
-    "<a:font script=\"Syrc\" typeface=\"Estrangelo Edessa\"/>",
-    "<a:font script=\"Orya\" typeface=\"Kalinga\"/>",
-    "<a:font script=\"Mlym\" typeface=\"Kartika\"/>",
-    "<a:font script=\"Laoo\" typeface=\"DokChampa\"/>",
-    "<a:font script=\"Sinh\" typeface=\"Iskoola Pota\"/>",
-    "<a:font script=\"Mong\" typeface=\"Mongolian Baiti\"/>",
-    "<a:font script=\"Viet\" typeface=\"Arial\"/>",
-    "<a:font script=\"Uigh\" typeface=\"Microsoft Uighur\"/>",
-    "</a:minorFont>",
-    "</a:fontScheme><a:fmtScheme name=\"Office\">",
-    "<a:fillStyleLst>",
-    "<a:solidFill>",
-    "<a:schemeClr val=\"phClr\"/>",
-    "</a:solidFill>",
-    "<a:gradFill rotWithShape=\"1\">",
-    "<a:gsLst>",
-    "<a:gs pos=\"0\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:tint val=\"50000\"/>",
-    "<a:satMod val=\"300000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "<a:gs pos=\"35000\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:tint val=\"37000\"/>",
-    "<a:satMod val=\"300000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "<a:gs pos=\"100000\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:tint val=\"15000\"/>",
-    "<a:satMod val=\"350000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "</a:gsLst>",
-    "<a:lin ang=\"16200000\" scaled=\"1\"/>",
-    "</a:gradFill>",
-    "<a:gradFill rotWithShape=\"1\">",
-    "<a:gsLst>",
-    "<a:gs pos=\"0\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:shade val=\"51000\"/>",
-    "<a:satMod val=\"130000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "<a:gs pos=\"80000\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:shade val=\"93000\"/>",
-    "<a:satMod val=\"130000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "<a:gs pos=\"100000\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:shade val=\"94000\"/>",
-    "<a:satMod val=\"135000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "</a:gsLst>",
-    "<a:lin ang=\"16200000\" scaled=\"0\"/>",
-    "</a:gradFill>",
-    "</a:fillStyleLst>",
-    "<a:lnStyleLst>",
-    "<a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">",
-    "<a:solidFill>",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:shade val=\"95000\"/>",
-    "<a:satMod val=\"105000\"/>",
-    "</a:schemeClr>",
-    "</a:solidFill>",
-    "<a:prstDash val=\"solid\"/>",
-    "</a:ln>",
-    "<a:ln w=\"25400\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">",
-    "<a:solidFill>",
-    "<a:schemeClr val=\"phClr\"/>",
-    "</a:solidFill>",
-    "<a:prstDash val=\"solid\"/>",
-    "</a:ln>",
-    "<a:ln w=\"38100\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">",
-    "<a:solidFill>",
-    "<a:schemeClr val=\"phClr\"/>",
-    "</a:solidFill>",
-    "<a:prstDash val=\"solid\"/>",
-    "</a:ln>",
-    "</a:lnStyleLst>",
-    "<a:effectStyleLst>",
-    "<a:effectStyle>",
-    "<a:effectLst>",
-    "<a:outerShdw blurRad=\"40000\" dist=\"20000\" ",
-    "dir=\"5400000\" rotWithShape=\"0\">",
-    "<a:srgbClr val=\"000000\">",
-    "<a:alpha val=\"38000\"/>",
-    "</a:srgbClr>",
-    "</a:outerShdw>",
-    "</a:effectLst>",
-    "</a:effectStyle>",
-    "<a:effectStyle>",
-    "<a:effectLst>",
-    "<a:outerShdw blurRad=\"40000\" dist=\"23000\" ",
-    "dir=\"5400000\" rotWithShape=\"0\">",
-    "<a:srgbClr val=\"000000\">",
-    "<a:alpha val=\"35000\"/>",
-    "</a:srgbClr>",
-    "</a:outerShdw>",
-    "</a:effectLst>",
-    "</a:effectStyle>",
-    "<a:effectStyle>",
-    "<a:effectLst>",
-    "<a:outerShdw blurRad=\"40000\" dist=\"23000\" ",
-    "dir=\"5400000\" rotWithShape=\"0\">",
-    "<a:srgbClr val=\"000000\">",
-    "<a:alpha val=\"35000\"/>",
-    "</a:srgbClr>",
-    "</a:outerShdw>",
-    "</a:effectLst>",
-    "<a:scene3d>",
-    "<a:camera prst=\"orthographicFront\">",
-    "<a:rot lat=\"0\" lon=\"0\" rev=\"0\"/>",
-    "</a:camera>",
-    "<a:lightRig rig=\"threePt\" dir=\"t\">",
-    "<a:rot lat=\"0\" lon=\"0\" rev=\"1200000\"/>",
-    "</a:lightRig>",
-    "</a:scene3d>",
-    "<a:sp3d>",
-    "<a:bevelT w=\"63500\" h=\"25400\"/>",
-    "</a:sp3d>",
-    "</a:effectStyle>",
-    "</a:effectStyleLst>",
-    "<a:bgFillStyleLst>",
-    "<a:solidFill>",
-    "<a:schemeClr val=\"phClr\"/>",
-    "</a:solidFill>",
-    "<a:gradFill rotWithShape=\"1\">",
-    "<a:gsLst>",
-    "<a:gs pos=\"0\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:tint val=\"40000\"/>",
-    "<a:satMod val=\"350000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "<a:gs pos=\"40000\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:tint val=\"45000\"/>",
-    "<a:shade val=\"99000\"/>",
-    "<a:satMod val=\"350000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "<a:gs pos=\"100000\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:shade val=\"20000\"/>",
-    "<a:satMod val=\"255000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "</a:gsLst>",
-    "<a:path path=\"circle\">",
-    "<a:fillToRect l=\"50000\" t=\"-80000\" r=\"50000\" b=\"180000\"/>",
-    "</a:path>",
-    "</a:gradFill>",
-    "<a:gradFill rotWithShape=\"1\">",
-    "<a:gsLst>",
-    "<a:gs pos=\"0\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:tint val=\"80000\"/>",
-    "<a:satMod val=\"300000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "<a:gs pos=\"100000\">",
-    "<a:schemeClr val=\"phClr\">",
-    "<a:shade val=\"30000\"/>",
-    "<a:satMod val=\"200000\"/>",
-    "</a:schemeClr>",
-    "</a:gs>",
-    "</a:gsLst>",
-    "<a:path path=\"circle\">",
-    "<a:fillToRect l=\"50000\" t=\"50000\" r=\"50000\" b=\"50000\"/>",
-    "</a:path>",
-    "</a:gradFill>",
-    "</a:bgFillStyleLst>",
-    "</a:fmtScheme>",
-    "</a:themeElements>",
-    "<a:objectDefaults/>",
-    "<a:extraClrSchemeLst/>",
-    "</a:theme>\n",
-    ""
-};
-
-/*
- * Forward declarations.
- */
-
-/*****************************************************************************
- *
- * Private functions.
- *
- ****************************************************************************/
-
-/*
- * Create a new theme object.
- */
-lxw_theme *
-lxw_theme_new(void)
-{
-    lxw_theme *theme = calloc(1, sizeof(lxw_theme));
-    GOTO_LABEL_ON_MEM_ERROR(theme, mem_error);
-
-    return theme;
-
-mem_error:
-    lxw_theme_free(theme);
-    return NULL;
-}
-
-/*
- * Free a theme object.
- */
-void
-lxw_theme_free(lxw_theme *theme)
-{
-    if (!theme)
-        return;
-
-    free(theme);
-}
-
-/*****************************************************************************
- *
- * XML functions.
- *
- ****************************************************************************/
-
-/* This library isn't a xmlwriter. */
-
-/*****************************************************************************
- *
- * XML file assembly functions.
- *
- ****************************************************************************/
-
-/*
- * Assemble and write the XML file.
- */
-void
-lxw_theme_assemble_xml_file(lxw_theme *self)
-{
-    int i = 0;
-
-    while (strlen(theme_strs[i])) {
-        fprintf(self->file, "%s", theme_strs[i]);
-        i++;
-    }
-}
-
-/*****************************************************************************
- *
- * Public functions.
- *
- ****************************************************************************/

+ 0 - 792
src/3rdparty/libxlsxwriter/src/utility.c

@@ -1,792 +0,0 @@
-/*****************************************************************************
- * utility - Utility functions for libxlsxwriter.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#ifdef USE_FMEMOPEN
-#define _POSIX_C_SOURCE 200809L
-#endif
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include "xlsxwriter.h"
-#include "xlsxwriter/common.h"
-#include "xlsxwriter/third_party/tmpfileplus.h"
-
-#ifdef USE_DTOA_LIBRARY
-#include "xlsxwriter/third_party/emyg_dtoa.h"
-#endif
-
-char *error_strings[LXW_MAX_ERRNO + 1] = {
-    "No error.",
-    "Memory error, failed to malloc() required memory.",
-    "Error creating output xlsx file. Usually a permissions error.",
-    "Error encountered when creating a tmpfile during file assembly.",
-    "Error reading a tmpfile.",
-    "Zip generic error ZIP_ERRNO while creating the xlsx file.",
-    "Zip error ZIP_PARAMERROR while creating the xlsx file.",
-    "Zip error ZIP_BADZIPFILE (use_zip64 option may be required).",
-    "Zip error ZIP_INTERNALERROR while creating the xlsx file.",
-    "File error or unknown zip error when adding sub file to xlsx file.",
-    "Unknown zip error when closing xlsx file.",
-    "Feature is not currently supported in this configuration.",
-    "NULL function parameter ignored.",
-    "Function parameter validation error.",
-    "Function string parameter is empty.",
-    "Datetime struct parameter has an invalid field value.",
-    "Worksheet name exceeds Excel's limit of 31 characters.",
-    "Worksheet name cannot contain invalid characters: '[ ] : * ? / \\'",
-    "Worksheet name cannot start or end with an apostrophe.",
-    "Worksheet name is already in use.",
-    "Parameter exceeds Excel's limit of 32 characters.",
-    "Parameter exceeds Excel's limit of 128 characters.",
-    "Parameter exceeds Excel's limit of 255 characters.",
-    "String exceeds Excel's limit of 32,767 characters.",
-    "Error finding internal string index.",
-    "Worksheet row or column index out of range.",
-    "Maximum hyperlink length (2079) exceeded.",
-    "Maximum number of worksheet URLs (65530) exceeded.",
-    "Couldn't read image dimensions or DPI.",
-    "Unknown error number."
-};
-
-char *
-lxw_strerror(lxw_error error_num)
-{
-    if (error_num > LXW_MAX_ERRNO)
-        error_num = LXW_MAX_ERRNO;
-
-    return error_strings[error_num];
-}
-
-/*
- * Convert Excel A-XFD style column name to zero based number.
- */
-void
-lxw_col_to_name(char *col_name, lxw_col_t col_num, uint8_t absolute)
-{
-    uint8_t pos = 0;
-    size_t len;
-    size_t i;
-
-    /* Change from 0 index to 1 index. */
-    col_num++;
-
-    /* Convert the column number to a string in reverse order. */
-    while (col_num) {
-
-        /* Get the remainder in base 26. */
-        int remainder = col_num % 26;
-
-        if (remainder == 0)
-            remainder = 26;
-
-        /* Convert the remainder value to a character. */
-        col_name[pos++] = 'A' + remainder - 1;
-        col_name[pos] = '\0';
-
-        /* Get the next order of magnitude. */
-        col_num = (col_num - 1) / 26;
-    }
-
-    if (absolute) {
-        col_name[pos] = '$';
-        col_name[pos + 1] = '\0';
-    }
-
-    /* Reverse the column name string. */
-    len = strlen(col_name);
-    for (i = 0; i < (len / 2); i++) {
-        char tmp = col_name[i];
-        col_name[i] = col_name[len - i - 1];
-        col_name[len - i - 1] = tmp;
-    }
-}
-
-/*
- * Convert zero indexed row and column to an Excel style A1 cell reference.
- */
-void
-lxw_rowcol_to_cell(char *cell_name, lxw_row_t row, lxw_col_t col)
-{
-    size_t pos;
-
-    /* Add the column to the cell. */
-    lxw_col_to_name(cell_name, col, 0);
-
-    /* Get the end of the cell. */
-    pos = strlen(cell_name);
-
-    /* Add the row to the cell. */
-    lxw_snprintf(&cell_name[pos], LXW_MAX_ROW_NAME_LENGTH, "%d", ++row);
-}
-
-/*
- * Convert zero indexed row and column to an Excel style $A$1 cell with
- * an absolute reference.
- */
-void
-lxw_rowcol_to_cell_abs(char *cell_name, lxw_row_t row, lxw_col_t col,
-                       uint8_t abs_row, uint8_t abs_col)
-{
-    size_t pos;
-
-    /* Add the column to the cell. */
-    lxw_col_to_name(cell_name, col, abs_col);
-
-    /* Get the end of the cell. */
-    pos = strlen(cell_name);
-
-    if (abs_row)
-        cell_name[pos++] = '$';
-
-    /* Add the row to the cell. */
-    lxw_snprintf(&cell_name[pos], LXW_MAX_ROW_NAME_LENGTH, "%d", ++row);
-}
-
-/*
- * Convert zero indexed row and column pair to an Excel style A1:C5
- * range reference.
- */
-void
-lxw_rowcol_to_range(char *range,
-                    lxw_row_t first_row, lxw_col_t first_col,
-                    lxw_row_t last_row, lxw_col_t last_col)
-{
-    size_t pos;
-
-    /* Add the first cell to the range. */
-    lxw_rowcol_to_cell(range, first_row, first_col);
-
-    /* If the start and end cells are the same just return a single cell. */
-    if (first_row == last_row && first_col == last_col)
-        return;
-
-    /* Get the end of the cell. */
-    pos = strlen(range);
-
-    /* Add the range separator. */
-    range[pos++] = ':';
-
-    /* Add the first cell to the range. */
-    lxw_rowcol_to_cell(&range[pos], last_row, last_col);
-}
-
-/*
- * Convert zero indexed row and column pairs to an Excel style $A$1:$C$5
- * range reference with absolute values.
- */
-void
-lxw_rowcol_to_range_abs(char *range,
-                        lxw_row_t first_row, lxw_col_t first_col,
-                        lxw_row_t last_row, lxw_col_t last_col)
-{
-    size_t pos;
-
-    /* Add the first cell to the range. */
-    lxw_rowcol_to_cell_abs(range, first_row, first_col, 1, 1);
-
-    /* If the start and end cells are the same just return a single cell. */
-    if (first_row == last_row && first_col == last_col)
-        return;
-
-    /* Get the end of the cell. */
-    pos = strlen(range);
-
-    /* Add the range separator. */
-    range[pos++] = ':';
-
-    /* Add the first cell to the range. */
-    lxw_rowcol_to_cell_abs(&range[pos], last_row, last_col, 1, 1);
-}
-
-/*
- * Convert sheetname and zero indexed row and column pairs to an Excel style
- * Sheet1!$A$1:$C$5 formula reference with absolute values.
- */
-void
-lxw_rowcol_to_formula_abs(char *formula, const char *sheetname,
-                          lxw_row_t first_row, lxw_col_t first_col,
-                          lxw_row_t last_row, lxw_col_t last_col)
-{
-    size_t pos;
-    char *quoted_name = lxw_quote_sheetname(sheetname);
-
-    strncpy(formula, quoted_name, LXW_MAX_FORMULA_RANGE_LENGTH - 1);
-    free(quoted_name);
-
-    /* Get the end of the sheetname. */
-    pos = strlen(formula);
-
-    /* Add the range separator. */
-    formula[pos++] = '!';
-
-    /* Add the first cell to the range. */
-    lxw_rowcol_to_cell_abs(&formula[pos], first_row, first_col, 1, 1);
-
-    /* If the start and end cells are the same just return a single cell. */
-    if (first_row == last_row && first_col == last_col)
-        return;
-
-    /* Get the end of the cell. */
-    pos = strlen(formula);
-
-    /* Add the range separator. */
-    formula[pos++] = ':';
-
-    /* Add the first cell to the range. */
-    lxw_rowcol_to_cell_abs(&formula[pos], last_row, last_col, 1, 1);
-}
-
-/*
- * Convert an Excel style A1 cell reference to a zero indexed row number.
- */
-lxw_row_t
-lxw_name_to_row(const char *row_str)
-{
-    lxw_row_t row_num = 0;
-
-    if (!row_str)
-        return row_num;
-
-    /* Skip the column letters and absolute symbol of the A1 cell. */
-    while (*row_str && !isdigit((unsigned char) *row_str))
-        row_str++;
-
-    /* Convert the row part of the A1 cell to a number. */
-    if (*row_str)
-        row_num = atoi(row_str);
-
-    if (row_num)
-        row_num--;
-
-    return row_num;
-}
-
-/*
- * Convert the second row of an Excel range ref to a zero indexed number.
- */
-uint32_t
-lxw_name_to_row_2(const char *row_str)
-{
-    if (!row_str)
-        return 0;
-
-    /* Find the : separator in the range. */
-    while (*row_str && *row_str != ':')
-        row_str++;
-
-    if (*row_str)
-        return lxw_name_to_row(++row_str);
-    else
-        return 0;
-}
-
-/*
- * Convert an Excel style A1 cell reference to a zero indexed column number.
- */
-lxw_col_t
-lxw_name_to_col(const char *col_str)
-{
-    lxw_col_t col_num = 0;
-
-    if (!col_str)
-        return col_num;
-
-    /* Convert leading column letters of A1 cell. Ignore absolute $ marker. */
-    while (*col_str && (isupper((unsigned char) *col_str) || *col_str == '$')) {
-        if (*col_str != '$')
-            col_num = (col_num * 26) + (*col_str - 'A' + 1);
-        col_str++;
-    }
-
-    if (col_num)
-        col_num--;
-
-    return col_num;
-}
-
-/*
- * Convert the second column of an Excel range ref to a zero indexed number.
- */
-uint16_t
-lxw_name_to_col_2(const char *col_str)
-{
-    if (!col_str)
-        return 0;
-
-    /* Find the : separator in the range. */
-    while (*col_str && *col_str != ':')
-        col_str++;
-
-    if (*col_str)
-        return lxw_name_to_col(++col_str);
-    else
-        return 0;
-}
-
-lxw_error
-lxw_datetime_validate(lxw_datetime *datetime)
-{
-    if (!datetime)
-        return LXW_ERROR_DATETIME_VALIDATION;
-
-    /*
-     * Excel uses the year 1900 as the default epoch but it uses 1899-12-31 as
-     * the 0 date and internally we use the 0-0-0 date for time only values.
-     */
-    if (datetime->year < 1900 &&
-        !(datetime->year == 0 &&
-          datetime->month == 0 && datetime->day == 0) &&
-        !(datetime->year == 1899 &&
-          datetime->month == 12 && datetime->day == 31)) {
-
-        LXW_WARN_FORMAT1("lxw_datetime_validate(): invalid year: %d. "
-                         "Valid range is 1900-9999.", datetime->year);
-
-        return LXW_ERROR_DATETIME_VALIDATION;
-    }
-
-    if (datetime->year > 9999) {
-        LXW_WARN_FORMAT1("lxw_datetime_validate(): invalid year: %d. "
-                         "Valid range is 1900-9999.", datetime->year);
-        return LXW_ERROR_DATETIME_VALIDATION;
-    }
-
-    if (datetime->year != 0) {
-        if (datetime->month < 1 || datetime->month > 12) {
-            LXW_WARN_FORMAT1("lxw_datetime_validate(): invalid month: %d. "
-                             "Valid range is 1-12.", datetime->month);
-            return LXW_ERROR_DATETIME_VALIDATION;
-        }
-
-        if (datetime->day < 1 || datetime->day > 31) {
-            LXW_WARN_FORMAT1("lxw_datetime_validate(): invalid day: %d. "
-                             "Valid range is 1-31.", datetime->day);
-            return LXW_ERROR_DATETIME_VALIDATION;
-        }
-    }
-
-    if (datetime->hour < 0 || datetime->hour > 23) {
-        LXW_WARN_FORMAT1("lxw_datetime_validate(): invalid hour: %d. "
-                         "Valid range is 0-23.", datetime->hour);
-        return LXW_ERROR_DATETIME_VALIDATION;
-    }
-
-    if (datetime->min < 0 || datetime->min > 59) {
-        LXW_WARN_FORMAT1("lxw_datetime_validate(): invalid minute: %d. "
-                         "Valid range is 0-59.", datetime->min);
-        return LXW_ERROR_DATETIME_VALIDATION;
-    }
-
-    if (datetime->sec < 0.0 || datetime->sec >= 60.0) {
-        LXW_WARN_FORMAT1("lxw_datetime_validate(): invalid seconds: %.3f. "
-                         "Valid range is 0.0-59.999.", datetime->sec);
-        return LXW_ERROR_DATETIME_VALIDATION;
-    }
-
-    return LXW_NO_ERROR;
-}
-
-/*
- * Convert a lxw_datetime struct to an Excel serial date, with a 1900
- * or 1904 epoch.
- */
-double
-lxw_datetime_to_excel_date_with_epoch(lxw_datetime *datetime,
-                                      uint8_t use_1904_epoch)
-{
-    int year = datetime->year;
-    int month = datetime->month;
-    int day = datetime->day;
-    int hour = datetime->hour;
-    int min = datetime->min;
-    double sec = datetime->sec;
-    double seconds;
-    int epoch = use_1904_epoch ? 1904 : 1900;
-    int offset = use_1904_epoch ? 4 : 0;
-    int norm = 300;
-    int range;
-    /* Set month days and check for leap year. */
-    int mdays[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-    int leap = 0;
-    int days = 0;
-    int i;
-
-    if (lxw_datetime_validate(datetime) != LXW_NO_ERROR)
-        return 0.0;
-
-    /* For times without dates set the default date for the epoch. */
-    if (!year) {
-        if (!use_1904_epoch) {
-            year = 1899;
-            month = 12;
-            day = 31;
-        }
-        else {
-            year = 1904;
-            month = 1;
-            day = 1;
-        }
-    }
-
-    /* Convert the Excel seconds to a fraction of the seconds in 24 hours. */
-    seconds = (hour * 60 * 60 + min * 60 + sec) / (24 * 60 * 60.0);
-
-    /* Special cases for Excel dates in the 1900 epoch. */
-    if (!use_1904_epoch) {
-        /* Excel 1900 epoch. */
-        if (year == 1899 && month == 12 && day == 31)
-            return seconds;
-
-        /* Excel 1900 epoch. */
-        if (year == 1900 && month == 1 && day == 0)
-            return seconds;
-
-        /* Excel false leapday */
-        if (year == 1900 && month == 2 && day == 29)
-            return 60 + seconds;
-    }
-
-    /* We calculate the date by calculating the number of days since the */
-    /* epoch and adjust for the number of leap days. We calculate the */
-    /* number of leap days by normalizing the year in relation to the */
-    /* epoch. Thus the year 2000 becomes 100 for 4-year and 100-year */
-    /* leapdays and 400 for 400-year leapdays. */
-    range = year - epoch;
-
-    if (year % 4 == 0 && (year % 100 > 0 || year % 400 == 0)) {
-        leap = 1;
-        mdays[2] = 29;
-    }
-
-    /*
-     * Calculate the serial date by accumulating the number of days
-     * since the epoch.
-     */
-
-    /* Add days for previous months. */
-    for (i = 0; i < month; i++) {
-        days += mdays[i];
-    }
-    /* Add days for current month. */
-    days += day;
-    /* Add days for all previous years.  */
-    days += range * 365;
-    /* Add 4 year leapdays. */
-    days += range / 4;
-    /* Remove 100 year leapdays. */
-    days -= (range + offset) / 100;
-    /* Add 400 year leapdays. */
-    days += (range + offset + norm) / 400;
-    /* Remove leap days already counted. */
-    days -= leap;
-
-    /* Adjust for Excel erroneously treating 1900 as a leap year. */
-    if (!use_1904_epoch && days > 59)
-        days++;
-
-    return days + seconds;
-}
-
-/*
- * Convert a lxw_datetime struct to an Excel serial date, for the 1900 epoch.
- */
-double
-lxw_datetime_to_excel_datetime(lxw_datetime *datetime)
-{
-    return lxw_datetime_to_excel_date_with_epoch(datetime, LXW_FALSE);
-}
-
-/*
- * Convert a unix datetime (1970/01/01 epoch) to an Excel serial date, with a
- * 1900 epoch.
- */
-double
-lxw_unixtime_to_excel_date(int64_t unixtime)
-{
-    return lxw_unixtime_to_excel_date_with_epoch(unixtime, LXW_FALSE);
-}
-
-/*
- * Convert a unix datetime (1970/01/01 epoch) to an Excel serial date, with a
- * 1900 or 1904 epoch.
- */
-double
-lxw_unixtime_to_excel_date_with_epoch(int64_t unixtime,
-                                      uint8_t use_1904_epoch)
-{
-    double excel_datetime = 0.0;
-    double epoch = use_1904_epoch ? 24107.0 : 25568.0;
-
-    excel_datetime = epoch + (unixtime / (24 * 60 * 60.0));
-
-    if (!use_1904_epoch && excel_datetime >= 60.0)
-        excel_datetime = excel_datetime + 1.0;
-
-    return excel_datetime;
-}
-
-/* Simple strdup() implementation since it isn't ANSI C. */
-char *
-lxw_strdup(const char *str)
-{
-    size_t len;
-    char *copy;
-
-    if (!str)
-        return NULL;
-
-    len = strlen(str) + 1;
-    copy = malloc(len);
-
-    if (copy)
-        memcpy(copy, str, len);
-
-    return copy;
-}
-
-/* Simple function to strdup() a formula string without the leading "=". */
-char *
-lxw_strdup_formula(const char *formula)
-{
-    if (!formula)
-        return NULL;
-
-    if (formula[0] == '=')
-        return lxw_strdup(formula + 1);
-    else
-        return lxw_strdup(formula);
-}
-
-/* Simple strlen that counts UTF-8 characters. Assumes well formed UTF-8. */
-size_t
-lxw_utf8_strlen(const char *str)
-{
-    size_t byte_count = 0;
-    size_t char_count = 0;
-
-    while (str[byte_count]) {
-        if ((str[byte_count] & 0xc0) != 0x80)
-            char_count++;
-
-        byte_count++;
-    }
-
-    return char_count;
-}
-
-/* Simple tolower() for strings. */
-void
-lxw_str_tolower(char *str)
-{
-    int i;
-
-    for (i = 0; str[i]; i++)
-        str[i] = tolower(str[i]);
-}
-
-/* Simple check for empty strings. */
-uint8_t
-lxw_str_is_empty(const char *str)
-{
-    if (str[0] == '\0')
-        return 1;
-    else
-        return 0;
-}
-
-/* Create a quoted version of the worksheet name, or return an unmodified
- * copy if it doesn't required quoting. */
-char *
-lxw_quote_sheetname(const char *str)
-{
-
-    uint8_t needs_quoting = 0;
-    size_t number_of_quotes = 2;
-    size_t i, j;
-    size_t len = strlen(str);
-
-    /* Don't quote the sheetname if it is already quoted. */
-    if (str[0] == '\'')
-        return lxw_strdup(str);
-
-    /* Check if the sheetname contains any characters that require it
-     * to be quoted. Also check for single quotes within the string. */
-    for (i = 0; i < len; i++) {
-        if (!isalnum((unsigned char) str[i]) && str[i] != '_'
-            && str[i] != '.')
-            needs_quoting = 1;
-
-        if (str[i] == '\'') {
-            needs_quoting = 1;
-            number_of_quotes++;
-        }
-    }
-
-    if (!needs_quoting) {
-        return lxw_strdup(str);
-    }
-    else {
-        /* Add single quotes to the start and end of the string. */
-        char *quoted_name = calloc(1, len + number_of_quotes + 1);
-        RETURN_ON_MEM_ERROR(quoted_name, NULL);
-
-        quoted_name[0] = '\'';
-
-        for (i = 0, j = 1; i < len; i++, j++) {
-            quoted_name[j] = str[i];
-
-            /* Double quote inline single quotes. */
-            if (str[i] == '\'') {
-                quoted_name[++j] = '\'';
-            }
-        }
-        quoted_name[j++] = '\'';
-        quoted_name[j++] = '\0';
-
-        return quoted_name;
-    }
-}
-
-/*
- * Thin wrapper for tmpfile() so it can be over-ridden with a user defined
- * version if required for safety or portability.
- */
-FILE *
-lxw_tmpfile(const char *tmpdir)
-{
-#ifndef USE_STANDARD_TMPFILE
-    return tmpfileplus(tmpdir, NULL, NULL, 0);
-#else
-    (void) tmpdir;
-    return tmpfile();
-#endif
-}
-
-/**
- * Return a memory-backed file if supported, otherwise a temporary one
- */
-FILE *
-lxw_get_filehandle(char **buf, size_t *size, const char *tmpdir)
-{
-    static size_t s;
-    if (!size)
-        size = &s;
-    *buf = NULL;
-    *size = 0;
-#ifdef USE_FMEMOPEN
-    (void) tmpdir;
-    return open_memstream(buf, size);
-#else
-    return lxw_tmpfile(tmpdir);
-#endif
-}
-
-/*
- * Use third party function to handle sprintf of doubles for locale portable
- * code.
- */
-#ifdef USE_DTOA_LIBRARY
-int
-lxw_sprintf_dbl(char *data, double number)
-{
-    emyg_dtoa(number, data);
-    return 0;
-}
-#endif
-
-/*
- * Retrieve runtime library version.
- */
-const char *
-lxw_version(void)
-{
-    return LXW_VERSION;
-}
-
-/*
- * Retrieve runtime library version ID.
- */
-uint16_t
-lxw_version_id(void)
-{
-    return LXW_VERSION_ID;
-}
-
-/*
- * Hash a worksheet password. Based on the algorithm in ECMA-376-4:2016,
- * Office Open XML File Formats - Transitional Migration Features,
- * Additional attributes for workbookProtection element (Part 1, §18.2.29).
- */
-uint16_t
-lxw_hash_password(const char *password)
-{
-    uint16_t byte_count = (uint16_t) strlen(password);
-    uint16_t hash = 0;
-    const char *p = &password[byte_count];
-
-    if (!byte_count)
-        return hash;
-
-    while (p-- != password) {
-        hash = ((hash >> 14) & 0x01) | ((hash << 1) & 0x7fff);
-        hash ^= *p & 0xFF;
-    }
-
-    hash = ((hash >> 14) & 0x01) | ((hash << 1) & 0x7fff);
-    hash ^= byte_count;
-    hash ^= 0xCE4B;
-
-    return hash;
-}
-
-/* Make a simple portable version of fopen() for Windows. */
-#ifdef __MINGW32__
-#undef _WIN32
-#endif
-
-#ifdef _WIN32
-
-#include <windows.h>
-
-FILE *
-lxw_fopen(const char *filename, const char *mode)
-{
-    int n;
-    wchar_t wide_filename[_MAX_PATH + 1] = L"";
-    wchar_t wide_mode[_MAX_PATH + 1] = L"";
-
-    n = MultiByteToWideChar(CP_UTF8, 0, filename, (int) strlen(filename),
-                            wide_filename, _MAX_PATH);
-
-    if (n == 0) {
-        LXW_ERROR("MultiByteToWideChar error: filename");
-        return NULL;
-    }
-
-    n = MultiByteToWideChar(CP_UTF8, 0, mode, (int) strlen(mode),
-                            wide_mode, _MAX_PATH);
-
-    if (n == 0) {
-        LXW_ERROR("MultiByteToWideChar error: mode");
-        return NULL;
-    }
-
-    return _wfopen(wide_filename, wide_mode);
-}
-#else
-FILE *
-lxw_fopen(const char *filename, const char *mode)
-{
-    return fopen(filename, mode);
-}
-#endif

Разница между файлами не показана из-за своего большого размера
+ 0 - 1063
src/3rdparty/libxlsxwriter/src/vml.c


Разница между файлами не показана из-за своего большого размера
+ 0 - 2900
src/3rdparty/libxlsxwriter/src/workbook.c


Разница между файлами не показана из-за своего большого размера
+ 0 - 11772
src/3rdparty/libxlsxwriter/src/worksheet.c


+ 0 - 449
src/3rdparty/libxlsxwriter/src/xmlwriter.c

@@ -1,449 +0,0 @@
-/*****************************************************************************
- * xmlwriter - A base library for libxlsxwriter libraries.
- *
- * Used in conjunction with the libxlsxwriter library.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "xlsxwriter/xmlwriter.h"
-
-#define LXW_AMP  "&amp;"
-#define LXW_LT   "&lt;"
-#define LXW_GT   "&gt;"
-#define LXW_QUOT "&quot;"
-#define LXW_NL   "&#xA;"
-
-/* Defines. */
-#define LXW_MAX_ENCODED_ATTRIBUTE_LENGTH (LXW_MAX_ATTRIBUTE_LENGTH*6)
-
-/* Forward declarations. */
-STATIC char *_escape_attributes(struct xml_attribute *attribute);
-
-char *lxw_escape_data(const char *data);
-
-STATIC void _fprint_escaped_attributes(FILE *xmlfile,
-                                       struct xml_attribute_list *attributes);
-
-STATIC void _fprint_escaped_data(FILE *xmlfile, const char *data);
-
-/*
- * Write the XML declaration.
- */
-void
-lxw_xml_declaration(FILE *xmlfile)
-{
-    fprintf(xmlfile, "<?xml version=\"1.0\" "
-            "encoding=\"UTF-8\" standalone=\"yes\"?>\n");
-}
-
-/*
- * Write an XML start tag with optional attributes.
- */
-void
-lxw_xml_start_tag(FILE *xmlfile,
-                  const char *tag, struct xml_attribute_list *attributes)
-{
-    fprintf(xmlfile, "<%s", tag);
-
-    _fprint_escaped_attributes(xmlfile, attributes);
-
-    fprintf(xmlfile, ">");
-}
-
-/*
- * Write an XML start tag with optional, unencoded, attributes.
- * This is a minor speed optimization for elements that don't need encoding.
- */
-void
-lxw_xml_start_tag_unencoded(FILE *xmlfile,
-                            const char *tag,
-                            struct xml_attribute_list *attributes)
-{
-    struct xml_attribute *attribute;
-
-    fprintf(xmlfile, "<%s", tag);
-
-    if (attributes) {
-        STAILQ_FOREACH(attribute, attributes, list_entries) {
-            fprintf(xmlfile, " %s=\"%s\"", attribute->key, attribute->value);
-        }
-    }
-
-    fprintf(xmlfile, ">");
-}
-
-/*
- * Write an XML end tag.
- */
-void
-lxw_xml_end_tag(FILE *xmlfile, const char *tag)
-{
-    fprintf(xmlfile, "</%s>", tag);
-}
-
-/*
- * Write an empty XML tag with optional attributes.
- */
-void
-lxw_xml_empty_tag(FILE *xmlfile,
-                  const char *tag, struct xml_attribute_list *attributes)
-{
-    fprintf(xmlfile, "<%s", tag);
-
-    _fprint_escaped_attributes(xmlfile, attributes);
-
-    fprintf(xmlfile, "/>");
-}
-
-/*
- * Write an XML start tag with optional, unencoded, attributes.
- * This is a minor speed optimization for elements that don't need encoding.
- */
-void
-lxw_xml_empty_tag_unencoded(FILE *xmlfile,
-                            const char *tag,
-                            struct xml_attribute_list *attributes)
-{
-    struct xml_attribute *attribute;
-
-    fprintf(xmlfile, "<%s", tag);
-
-    if (attributes) {
-        STAILQ_FOREACH(attribute, attributes, list_entries) {
-            fprintf(xmlfile, " %s=\"%s\"", attribute->key, attribute->value);
-        }
-    }
-
-    fprintf(xmlfile, "/>");
-}
-
-/*
- * Write an XML element containing data with optional attributes.
- */
-void
-lxw_xml_data_element(FILE *xmlfile,
-                     const char *tag,
-                     const char *data, struct xml_attribute_list *attributes)
-{
-    fprintf(xmlfile, "<%s", tag);
-
-    _fprint_escaped_attributes(xmlfile, attributes);
-
-    fprintf(xmlfile, ">");
-
-    _fprint_escaped_data(xmlfile, data);
-
-    fprintf(xmlfile, "</%s>", tag);
-}
-
-/*
- * Write an XML <si> element for rich strings, without encoding.
- */
-void
-lxw_xml_rich_si_element(FILE *xmlfile, const char *string)
-{
-    fprintf(xmlfile, "<si>%s</si>", string);
-}
-
-/*
- * Escape XML characters in attributes.
- */
-STATIC char *
-_escape_attributes(struct xml_attribute *attribute)
-{
-    char *encoded = (char *) calloc(LXW_MAX_ENCODED_ATTRIBUTE_LENGTH, 1);
-    char *p_encoded = encoded;
-    char *p_attr = attribute->value;
-
-    while (*p_attr) {
-        switch (*p_attr) {
-            case '&':
-                memcpy(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
-                p_encoded += sizeof(LXW_AMP) - 1;
-                break;
-            case '<':
-                memcpy(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
-                p_encoded += sizeof(LXW_LT) - 1;
-                break;
-            case '>':
-                memcpy(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
-                p_encoded += sizeof(LXW_GT) - 1;
-                break;
-            case '"':
-                memcpy(p_encoded, LXW_QUOT, sizeof(LXW_QUOT) - 1);
-                p_encoded += sizeof(LXW_QUOT) - 1;
-                break;
-            case '\n':
-                memcpy(p_encoded, LXW_NL, sizeof(LXW_NL) - 1);
-                p_encoded += sizeof(LXW_NL) - 1;
-                break;
-            default:
-                *p_encoded = *p_attr;
-                p_encoded++;
-                break;
-        }
-        p_attr++;
-    }
-
-    return encoded;
-}
-
-/*
- * Escape XML characters in data sections of tags.
- * Note, this is different from _escape_attributes()
- * in that double quotes are not escaped by Excel.
- */
-char *
-lxw_escape_data(const char *data)
-{
-    size_t encoded_len = (strlen(data) * 5 + 1);
-
-    char *encoded = (char *) calloc(encoded_len, 1);
-    char *p_encoded = encoded;
-
-    while (*data) {
-        switch (*data) {
-            case '&':
-                memcpy(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
-                p_encoded += sizeof(LXW_AMP) - 1;
-                break;
-            case '<':
-                memcpy(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
-                p_encoded += sizeof(LXW_LT) - 1;
-                break;
-            case '>':
-                memcpy(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
-                p_encoded += sizeof(LXW_GT) - 1;
-                break;
-            default:
-                *p_encoded = *data;
-                p_encoded++;
-                break;
-        }
-        data++;
-    }
-
-    return encoded;
-}
-
-/*
- * Check for control characters in strings.
- */
-uint8_t
-lxw_has_control_characters(const char *string)
-{
-    while (*string) {
-        /* 0xE0 == 0b11100000 masks values > 0x19 == 0b00011111. */
-        if (!(*string & 0xE0) && *string != 0x0A && *string != 0x09)
-            return LXW_TRUE;
-
-        string++;
-    }
-
-    return LXW_FALSE;
-}
-
-/*
- * Escape control characters in strings with _xHHHH_.
- */
-char *
-lxw_escape_control_characters(const char *string)
-{
-    size_t escape_len = sizeof("_xHHHH_") - 1;
-    size_t encoded_len = (strlen(string) * escape_len + 1);
-
-    char *encoded = (char *) calloc(encoded_len, 1);
-    char *p_encoded = encoded;
-
-    while (*string) {
-        switch (*string) {
-            case '\x01':
-            case '\x02':
-            case '\x03':
-            case '\x04':
-            case '\x05':
-            case '\x06':
-            case '\x07':
-            case '\x08':
-            case '\x0B':
-            case '\x0C':
-            case '\x0D':
-            case '\x0E':
-            case '\x0F':
-            case '\x10':
-            case '\x11':
-            case '\x12':
-            case '\x13':
-            case '\x14':
-            case '\x15':
-            case '\x16':
-            case '\x17':
-            case '\x18':
-            case '\x19':
-            case '\x1A':
-            case '\x1B':
-            case '\x1C':
-            case '\x1D':
-            case '\x1E':
-            case '\x1F':
-                lxw_snprintf(p_encoded, escape_len + 1, "_x%04X_", *string);
-                p_encoded += escape_len;
-                break;
-            default:
-                *p_encoded = *string;
-                p_encoded++;
-                break;
-        }
-        string++;
-    }
-
-    return encoded;
-}
-
-/*
- * Escape special characters in URL strings with with %XX.
- */
-char *
-lxw_escape_url_characters(const char *string, uint8_t escape_hash)
-{
-
-    size_t escape_len = sizeof("%XX") - 1;
-    size_t encoded_len = (strlen(string) * escape_len + 1);
-
-    char *encoded = (char *) calloc(encoded_len, 1);
-    char *p_encoded = encoded;
-
-    while (*string) {
-        switch (*string) {
-            case ' ':
-            case '"':
-            case '<':
-            case '>':
-            case '[':
-            case ']':
-            case '`':
-            case '^':
-            case '{':
-            case '}':
-                lxw_snprintf(p_encoded, escape_len + 1, "%%%2x", *string);
-                p_encoded += escape_len;
-                break;
-            case '#':
-                /* This is only escaped for "external:" style links. */
-                if (escape_hash) {
-                    lxw_snprintf(p_encoded, escape_len + 1, "%%%2x", *string);
-                    p_encoded += escape_len;
-                }
-                else {
-                    *p_encoded = *string;
-                    p_encoded++;
-                }
-                break;
-            case '%':
-                /* Only escape % if it isn't already an escape. */
-                if (!isxdigit(*(string + 1)) || !isxdigit(*(string + 2))) {
-                    lxw_snprintf(p_encoded, escape_len + 1, "%%%2x", *string);
-                    p_encoded += escape_len;
-                }
-                else {
-                    *p_encoded = *string;
-                    p_encoded++;
-                }
-                break;
-            default:
-                *p_encoded = *string;
-                p_encoded++;
-                break;
-        }
-        string++;
-    }
-
-    return encoded;
-}
-
-/* Write out escaped attributes. */
-STATIC void
-_fprint_escaped_attributes(FILE *xmlfile,
-                           struct xml_attribute_list *attributes)
-{
-    struct xml_attribute *attribute;
-
-    if (attributes) {
-        STAILQ_FOREACH(attribute, attributes, list_entries) {
-            fprintf(xmlfile, " %s=", attribute->key);
-
-            if (!strpbrk(attribute->value, "&<>\"\n")) {
-                fprintf(xmlfile, "\"%s\"", attribute->value);
-            }
-            else {
-                char *encoded = _escape_attributes(attribute);
-
-                if (encoded) {
-                    fprintf(xmlfile, "\"%s\"", encoded);
-
-                    free(encoded);
-                }
-            }
-        }
-    }
-}
-
-/* Write out escaped XML data. */
-STATIC void
-_fprint_escaped_data(FILE *xmlfile, const char *data)
-{
-    /* Escape the data section of the XML element. */
-    if (!strpbrk(data, "&<>")) {
-        fprintf(xmlfile, "%s", data);
-    }
-    else {
-        char *encoded = lxw_escape_data(data);
-        if (encoded) {
-            fprintf(xmlfile, "%s", encoded);
-            free(encoded);
-        }
-    }
-}
-
-/* Create a new string XML attribute. */
-struct xml_attribute *
-lxw_new_attribute_str(const char *key, const char *value)
-{
-    struct xml_attribute *attribute = malloc(sizeof(struct xml_attribute));
-
-    LXW_ATTRIBUTE_COPY(attribute->key, key);
-    LXW_ATTRIBUTE_COPY(attribute->value, value);
-
-    return attribute;
-}
-
-/* Create a new integer XML attribute. */
-struct xml_attribute *
-lxw_new_attribute_int(const char *key, int32_t value)
-{
-    struct xml_attribute *attribute = malloc(sizeof(struct xml_attribute));
-
-    LXW_ATTRIBUTE_COPY(attribute->key, key);
-    lxw_snprintf(attribute->value, LXW_MAX_ATTRIBUTE_LENGTH, "%d", value);
-
-    return attribute;
-}
-
-/* Create a new double XML attribute. */
-struct xml_attribute *
-lxw_new_attribute_dbl(const char *key, double value)
-{
-    struct xml_attribute *attribute = malloc(sizeof(struct xml_attribute));
-
-    LXW_ATTRIBUTE_COPY(attribute->key, key);
-    lxw_sprintf_dbl(attribute->value, value);
-
-    return attribute;
-}

+ 0 - 291
src/3rdparty/libxlsxwriter/third_party/md5/md5.c

@@ -1,291 +0,0 @@
-/*
- * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
- * MD5 Message-Digest Algorithm (RFC 1321).
- *
- * Homepage:
- * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
- *
- * Author:
- * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
- *
- * This software was written by Alexander Peslyak in 2001.  No copyright is
- * claimed, and the software is hereby placed in the public domain.
- * In case this attempt to disclaim copyright and place the software in the
- * public domain is deemed null and void, then the software is
- * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
- * general public under the following terms:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted.
- *
- * There's ABSOLUTELY NO WARRANTY, express or implied.
- *
- * (This is a heavily cut-down "BSD license".)
- *
- * This differs from Colin Plumb's older public domain implementation in that
- * no exactly 32-bit integer data type is required (any 32-bit or wider
- * unsigned integer data type will do), there's no compile-time endianness
- * configuration, and the function prototypes match OpenSSL's.  No code from
- * Colin Plumb's implementation has been reused; this comment merely compares
- * the properties of the two independent implementations.
- *
- * The primary goals of this implementation are portability and ease of use.
- * It is meant to be fast, but not as fast as possible.  Some known
- * optimizations are not included to reduce source code size and avoid
- * compile-time configuration.
- */
-
-#ifndef HAVE_OPENSSL
-
-#include <string.h>
-
-#include "md5.h"
-
-/*
- * The basic MD5 functions.
- *
- * F and G are optimized compared to their RFC 1321 definitions for
- * architectures that lack an AND-NOT instruction, just like in Colin Plumb's
- * implementation.
- */
-#define F(x, y, z)			((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z)			((y) ^ ((z) & ((x) ^ (y))))
-#define H(x, y, z)			(((x) ^ (y)) ^ (z))
-#define H2(x, y, z)			((x) ^ ((y) ^ (z)))
-#define I(x, y, z)			((y) ^ ((x) | ~(z)))
-
-/*
- * The MD5 transformation for all four rounds.
- */
-#define STEP(f, a, b, c, d, x, t, s) \
-	(a) += f((b), (c), (d)) + (x) + (t); \
-	(a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
-	(a) += (b);
-
-/*
- * SET reads 4 input bytes in little-endian byte order and stores them in a
- * properly aligned word in host byte order.
- *
- * The check for little-endian architectures that tolerate unaligned memory
- * accesses is just an optimization.  Nothing will break if it fails to detect
- * a suitable architecture.
- *
- * Unfortunately, this optimization may be a C strict aliasing rules violation
- * if the caller's data buffer has effective type that cannot be aliased by
- * MD5_u32plus.  In practice, this problem may occur if these MD5 routines are
- * inlined into a calling function, or with future and dangerously advanced
- * link-time optimizations.  For the time being, keeping these MD5 routines in
- * their own translation unit avoids the problem.
- */
-#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
-#define SET(n) \
-	(*(MD5_u32plus *)&ptr[(n) * 4])
-#define GET(n) \
-	SET(n)
-#else
-#define SET(n) \
-	(ctx->block[(n)] = \
-	(MD5_u32plus)ptr[(n) * 4] | \
-	((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
-	((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
-	((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
-#define GET(n) \
-	(ctx->block[(n)])
-#endif
-
-/*
- * This processes one or more 64-byte data blocks, but does NOT update the bit
- * counters.  There are no alignment requirements.
- */
-static const void *body(MD5_CTX *ctx, const void *data, unsigned long size)
-{
-	const unsigned char *ptr;
-	MD5_u32plus a, b, c, d;
-	MD5_u32plus saved_a, saved_b, saved_c, saved_d;
-
-	ptr = (const unsigned char *)data;
-
-	a = ctx->a;
-	b = ctx->b;
-	c = ctx->c;
-	d = ctx->d;
-
-	do {
-		saved_a = a;
-		saved_b = b;
-		saved_c = c;
-		saved_d = d;
-
-/* Round 1 */
-		STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
-		STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
-		STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
-		STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
-		STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
-		STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
-		STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
-		STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
-		STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
-		STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
-		STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
-		STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
-		STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
-		STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
-		STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
-		STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
-
-/* Round 2 */
-		STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
-		STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
-		STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
-		STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
-		STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
-		STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
-		STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
-		STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
-		STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
-		STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
-		STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
-		STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
-		STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
-		STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
-		STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
-		STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
-
-/* Round 3 */
-		STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
-		STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11)
-		STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
-		STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23)
-		STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
-		STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11)
-		STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
-		STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23)
-		STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
-		STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11)
-		STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
-		STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23)
-		STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
-		STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11)
-		STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
-		STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23)
-
-/* Round 4 */
-		STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
-		STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
-		STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
-		STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
-		STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
-		STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
-		STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
-		STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
-		STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
-		STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
-		STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
-		STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
-		STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
-		STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
-		STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
-		STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
-
-		a += saved_a;
-		b += saved_b;
-		c += saved_c;
-		d += saved_d;
-
-		ptr += 64;
-	} while (size -= 64);
-
-	ctx->a = a;
-	ctx->b = b;
-	ctx->c = c;
-	ctx->d = d;
-
-	return ptr;
-}
-
-void MD5_Init(MD5_CTX *ctx)
-{
-	ctx->a = 0x67452301;
-	ctx->b = 0xefcdab89;
-	ctx->c = 0x98badcfe;
-	ctx->d = 0x10325476;
-
-	ctx->lo = 0;
-	ctx->hi = 0;
-}
-
-void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
-{
-	MD5_u32plus saved_lo;
-	unsigned long used, available;
-
-	saved_lo = ctx->lo;
-	if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
-		ctx->hi++;
-	ctx->hi += size >> 29;
-
-	used = saved_lo & 0x3f;
-
-	if (used) {
-		available = 64 - used;
-
-		if (size < available) {
-			memcpy(&ctx->buffer[used], data, size);
-			return;
-		}
-
-		memcpy(&ctx->buffer[used], data, available);
-		data = (const unsigned char *)data + available;
-		size -= available;
-		body(ctx, ctx->buffer, 64);
-	}
-
-	if (size >= 64) {
-		data = body(ctx, data, size & ~(unsigned long)0x3f);
-		size &= 0x3f;
-	}
-
-	memcpy(ctx->buffer, data, size);
-}
-
-#define OUT(dst, src) \
-	(dst)[0] = (unsigned char)(src); \
-	(dst)[1] = (unsigned char)((src) >> 8); \
-	(dst)[2] = (unsigned char)((src) >> 16); \
-	(dst)[3] = (unsigned char)((src) >> 24);
-
-void MD5_Final(unsigned char *result, MD5_CTX *ctx)
-{
-	unsigned long used, available;
-
-	used = ctx->lo & 0x3f;
-
-	ctx->buffer[used++] = 0x80;
-
-	available = 64 - used;
-
-	if (available < 8) {
-		memset(&ctx->buffer[used], 0, available);
-		body(ctx, ctx->buffer, 64);
-		used = 0;
-		available = 64;
-	}
-
-	memset(&ctx->buffer[used], 0, available - 8);
-
-	ctx->lo <<= 3;
-	OUT(&ctx->buffer[56], ctx->lo)
-	OUT(&ctx->buffer[60], ctx->hi)
-
-	body(ctx, ctx->buffer, 64);
-
-	OUT(&result[0], ctx->a)
-	OUT(&result[4], ctx->b)
-	OUT(&result[8], ctx->c)
-	OUT(&result[12], ctx->d)
-
-	memset(ctx, 0, sizeof(*ctx));
-}
-
-#endif

+ 0 - 0
src/3rdparty/libxlsxwriter/third_party/md5/md5.h


Некоторые файлы не были показаны из-за большого количества измененных файлов