This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch openformula
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 7eb007d6e390dd9f70da211ed595a679683c3c1f
Author: Jim Jagielski <[email protected]>
AuthorDate: Sun Nov 15 12:52:25 2026 -0500

    odf_docs: string literals can now reach 32767 characters
---
 odf_docs/openformula-milestone-g-sequence.md       | 10 +++++-----
 odf_docs/openformula-small-group-audit.md          |  4 ++--
 odf_docs/openformula-small-group-semantic-audit.md | 10 +++++-----
 odf_docs/openformula-small-group-semantic-gaps.tsv |  4 ++--
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/odf_docs/openformula-milestone-g-sequence.md 
b/odf_docs/openformula-milestone-g-sequence.md
index f512d3e585..8c15773856 100644
--- a/odf_docs/openformula-milestone-g-sequence.md
+++ b/odf_docs/openformula-milestone-g-sequence.md
@@ -13,7 +13,7 @@
 | G.2 | Fixed | `b5a1b43b5b`, `30877e2746` (fix); `ad46309f51` (docs, 3 test 
rows) | `ScDBCount()` missing-field path uses `CountRecords()` 
(dociter.cxx:685-716) which iterates row-by-row via `IsQueryValid()`; 
`ScDBCount2()` same pattern; calcval `DB.*` regression cases added. 
`DB.DCOUNT.nf.nocrit` gives 3 (was 0) | 
 | G.3 | Complete (decision documented) | `7e6ad45c82` | COUNTBLANK 
formula-cell `""` behavior decision: `lcl_IsCountBlankEmpty()` 
(interpr1.cxx:4745-4758) inspects formula results and treats 
formula-cell-returning-`""` as blank — implementation-defined per §6.13.8; no 
code change needed |
 | G.4 | Compatibility audit complete (decision documented) | `ac2d06a54a` | 
`bRowArray` shortcut present in `ScIndex()` (interpr1.cxx:7588-7612); 
`INDEX(H1:L1;3)` returns column value instead of ODF 1.4 Error; kept as 
legacy-compatible deviation |
-| G.5 | Run on Linux aarch64 | `1ac0d2f4ee`, `fb522d42ea` (source audit); 
results in `openformula-small-group-audit.md` | Formula length, parameter count 
and nesting: MET. String length: PARTIAL, string literals stop at about 1021 
characters (Err:513), run-time strings reach 32767. Formula limit raised from 
512 to 2048 tokens |
+| G.5 | Run on Linux aarch64 | `1ac0d2f4ee`, `fb522d42ea` (source audit); 
results in `openformula-small-group-audit.md` | Formula length, parameter count 
and nesting: MET. String length: MET, string literals and run-time strings both 
reach 32767 (literals stopped at 1021 before). Formula limit raised from 512 to 
2048 tokens |
 | G.6 | Complete (source-level audit) | `551759aef8` | All 11 ODF 1.4 §2.3.2.B 
syntax requirements source-audited; implementation present for all; no blocking 
limits; all classified RUNTIME_PENDING. Includes Basic Expressions, Constant 
Numbers, Constant Strings, Operators, Functions, Nonstandard Function Names, 
References, Simple Named Expressions, Errors, Whitespace. Runtime verification 
blocked (no build tree) |
 
 **Runtime results:** the Basic Limits (G.5) rows were run on a Linux aarch64 
build. Items marked RUNTIME_PENDING have no recorded run.
@@ -100,11 +100,11 @@ ODF 1.4 §3.7 requires: (1) formulas up to at least 1024 
characters, (2) at leas
 |---|---|---|---|---|
 | G.5.1 | F-GAP-006 | Formula length | The compiler limit was 512 tokens; it 
is now 2048 (MAXCODE, compiler.hxx:59). MAXSTRLEN=1024 per symbol 
(compiler.hxx:60). `SG.BL-001-1024chars` matches. | MET |
 | G.5.2 | F-GAP-007 | Parameter count | No global 30-param cap; MAX uses 
MustHaveParamCountMin(1) (interpr1.cxx:3396-3400). `SG.BL-002-30params` 
matches; more than 255 arguments is an error. | MET |
-| G.5.3 | F-GAP-008 | String length | STRING_MAXLEN=65,535 (string.hxx:119, 
STRING32 not defined) > 32,767; `SG.BL-003-32767chars` matches. A string 
literal of 1022 characters or more gives Err:513 (MAXSTRLEN=1024). | PARTIAL |
+| G.5.3 | F-GAP-008 | String length | STRING_MAXLEN=65,535 (string.hxx:119, 
STRING32 not defined) > 32,767; `SG.BL-003-32767chars` matches. A string 
literal of up to 32767 characters is accepted (`MAXSTRLITLEN`; 
`SG.BL-003-literal32767` matches), 32768 gives Err:513. | MET |
 | G.5.4 | F-GAP-009 | Nesting depth | The parser stops at a recursion count of 
42 (nRecursionMax, FormulaCompiler.cxx:782 and :1341). `SG.BL-004-7nesting` 
matches. | MET |
 
 **Dependencies:** None.  
-**Open:** string literals stop at about 1021 characters; not fixed.
+String literals used to stop at about 1021 characters (Err:513); 
`MAXSTRLITLEN` now allows 32767.
 
 ## Phase G.6 — Low-Risk: Syntax Verification
 
@@ -147,7 +147,7 @@ G.4 compatibility audit: `bRowArray` shortcut present 
(interpr1.cxx:7588-7612);
 | G.2 (ScDBCount) | Low | Fix applied via `CountRecords()`; regression tests 
added | Fixed |
 | G.3 (COUNTBLANK) | Low | Decision documented; implementation already in 
place via `lcl_IsCountBlankEmpty()` | Complete (decision documented) |
 | G.4 (INDEX compat) | Medium | Compatibility audit complete; `bRowArray` 
shortcut present; ODF 1.4 deviation documented | Compatibility audit complete 
(decision documented) |
-| G.5 (limits audit) | Low | Run on Linux aarch64: 3 MET, 1 PARTIAL (string 
literals stop at about 1021 characters) | Run |
+| G.5 (limits audit) | Low | Run on Linux aarch64: 4 MET (string literals 
raised from 1021 to 32767 characters) | Run |
 | G.6 (syntax audit) | Low | Source audit complete; implementation present for 
all 11 syntax requirements; no blocking limits; all classified RUNTIME_PENDING 
| Complete (source-level) |
 
 ## Definition of Done for Milestone G
@@ -158,7 +158,7 @@ G.4 compatibility audit: `bRowArray` shortcut present 
(interpr1.cxx:7588-7612);
 - G.2 result: `DB.DCOUNT.nf.nocrit` gives 3 (was 0); the three `DB.*.zero` 
rows are not yet recorded as run
 - G.3 COUNTBLANK behavior: decision documented — `lcl_IsCountBlankEmpty()` 
(interpr1.cxx:4745-4758) inspects formula results and treats 
formula-cell-returning-`""` as blank for COUNTBLANK (implementation-defined per 
§6.13.8); ISBLANK (§6.13.14) returns FALSE for empty string — the two differ, 
which §6.13.8 allows. No code change needed.
 - G.4 INDEX compatibility: compatibility audit complete — `bRowArray` shortcut 
present in `ScIndex()` (interpr1.cxx:7588-7612); `INDEX(H1:L1;3)` returns 
column value instead of ODF 1.4 Error; kept as documented legacy-compatible 
deviation |
-- G.5 Basic Limits: run on Linux aarch64 — formula length, parameter count and 
nesting MET; string length PARTIAL (string literals stop at about 1021 
characters, run-time strings reach 32767). Formula limit raised from 512 to 
2048 tokens (MAXCODE).
+- G.5 Basic Limits: run on Linux aarch64 — formula length, parameter count and 
nesting MET; string length MET (string literals and run-time strings both reach 
32767). Formula limit raised from 512 to 2048 tokens (MAXCODE).
 - G.6 Syntax Verification: source audit complete — implementation present for 
all 11 ODF 1.4 §2.3.2.B syntax requirements (Basic Expressions, Constant 
Numbers, Constant Strings, Operators, Functions, Nonstandard Function Names, 
References, Simple Named Expressions, Errors, Whitespace) plus Criteria 
§4.11.11 (covered under F-GAP-004). All classified RUNTIME_PENDING. Runtime 
verification blocked (no build tree).
 - G.6 runtime tests: prepared, not yet run
 - No production changes without corresponding calcval test coverage
diff --git a/odf_docs/openformula-small-group-audit.md 
b/odf_docs/openformula-small-group-audit.md
index 806f842c03..766398842d 100644
--- a/odf_docs/openformula-small-group-audit.md
+++ b/odf_docs/openformula-small-group-audit.md
@@ -35,10 +35,10 @@ Therefore **no conformance level (Small/Medium/Large) may 
be claimed for AOO Cal
 |-------|-------------|--------|-----------------|-------------------|
 | SG-BL-001 | Formula length >= 1024 characters | **MET** | The compiler limit 
was 512 tokens, too few for 1024 characters of `1+1+...`; it is now 2048 
(`MAXCODE`, compiler.hxx:59). Calcval `SG.BL-001-1024chars` (1026 characters, 
result 513) matches on a Linux aarch64 build. | Yes |
 | SG-BL-002 | >= 30 parameters per function | **MET** | `SG.BL-002-30params` 
(MAX with 30 arguments) matches on a Linux aarch64 build; a call with more than 
255 arguments is an error. | Yes |
-| SG-BL-003 | Strings up to 32767 ASCII chars | **PARTIAL** | Strings produced 
at run time reach 32767 characters (`SG.BL-003-32767chars`, 
`LEN(REPT("a";32767))`, matches). A string literal in a formula is limited by 
`MAXSTRLEN` (1024): literals of 1022 characters or more give Err:513. Not 
fixed. | Partly |
+| SG-BL-003 | Strings up to 32767 ASCII chars | **MET** | Run-time strings 
reach 32767 characters (`SG.BL-003-32767chars`, `LEN(REPT("a";32767))`) and so 
do string literals in a formula (`SG.BL-003-literal32767`; the limit is 
`MAXSTRLITLEN`, compiler.hxx). `SG.BL-003-literal1022` covers the old 
1021-character limit. A literal of 32768 gives Err:513. All three match on a 
Linux aarch64 build. | Yes |
 | SG-BL-004 | >= 7 nesting levels of functions | **MET** | 
`SG.BL-004-7nesting` (7 nested IF levels) matches on a Linux aarch64 build. The 
parser has a recursion guard of 42 (`nRecursionMax`, FormulaCompiler.cxx:782 
and :1341). | Yes |
 
-**Finding:** the four limits were run on Linux aarch64. Formula length, 
parameter count and nesting meet the requirement. For strings only run-time 
results reach 32767 characters; string literals stop at about 1021 (open).
+**Finding:** the four limits were run on Linux aarch64. Formula length, 
parameter count and nesting meet the requirement. String length also meets it: 
run-time strings and string literals both reach 32767 characters (literals 
stopped at 1021 before).
 
 ---
 
diff --git a/odf_docs/openformula-small-group-semantic-audit.md 
b/odf_docs/openformula-small-group-semantic-audit.md
index 4ef07ba36c..b023053382 100644
--- a/odf_docs/openformula-small-group-semantic-audit.md
+++ b/odf_docs/openformula-small-group-semantic-audit.md
@@ -285,9 +285,9 @@ None required. The ScDBCount empty-cell fix (F-GAP-004) is 
in (commits b5a1b43b5
 - `main/sc/inc/compiler.hxx:59`: `MAXCODE = 2048` — maximum number of 
**tokens** in a formula.
 - `main/sc/inc/compiler.hxx:60`: `MAXSTRLEN = 1024` — maximum length of **one 
symbol** (individual token/string literal), not the formula as a whole.
 - `main/sc/source/core/tool/compiler.cxx:3973-3978`: Token array overflow 
(`errCodeOverflow`) triggers when `aArr.GetLen() >= MAXCODE`.
-- `main/sc/source/core/tool/compiler.cxx:2689-2691`: String literal overflow 
(`errStringOverflow`) when a single symbol exceeds `MAXSTRLEN-1` (1023 chars).
+- `main/sc/source/core/tool/compiler.cxx:2689-2691`: String literal overflow 
(`errStringOverflow`) when a symbol exceeds `MAXSTRLEN-1` (1023 chars); a 
string literal may now reach `MAXSTRLITLEN` (32767).
 - A 1026-character formula like `=1+1+...+1` (512 `+1` repetitions) requires 
~1025 tokens, well under MAXCODE=2048. Each token (`1` or `+`) is well under 
MAXSTRLEN=1024.
-- **Limitation:** A single string literal in a formula cannot exceed 1023 
characters (excluding quotes) due to MAXSTRLEN=1024. This does not prevent a 
1024+ character formula composed of short tokens.
+- A single string literal could not exceed 1021 characters because of 
MAXSTRLEN=1024; `MAXSTRLITLEN` (32767) now applies to literals. Other symbols 
are still limited by MAXSTRLEN.
 
 **Classification:** RUNTIME_PENDING — Source appears capable (no formula-text 
cap; MAXCODE=2048 tokens supports 1024+ char formulas with short tokens), but 
runtime test `SG.BL-001-1024chars` not executed.
 
@@ -314,12 +314,12 @@ None required. The ScDBCount empty-cell fix (F-GAP-004) 
is in (commits b5a1b43b5
 **Source finding:**
 - `main/tools/inc/tools/string.hxx:110-120`: `STRING_MAXLEN` definition. 
`STRING32` is **not defined** anywhere in the codebase, so default applies: 
`STRING_MAXLEN = 0xFFFF = 65,535` (> 32,767 ODF minimum).
 - `main/sc/source/core/inc/interpre.hxx:930-936`: `CheckStringResultLen()` 
enforces STRING_MAXLEN at string concatenation (REPT, `&` operator, etc.).
-- `main/sc/source/core/tool/compiler.cxx:2689-2691`: MAXSTRLEN=1024 limits 
individual **string literals** in formulas to 1023 chars (excluding quotes).
+- `main/sc/source/core/tool/compiler.cxx:2689-2691`: string literals in 
formulas were limited by MAXSTRLEN=1024 to 1021 characters; they now use 
`MAXSTRLITLEN` (32767).
 - `main/sc/source/core/tool/interpr1.cxx:7777-7790` (REPT), `:8296` 
(CONCATENATE), `:8324`: Use STRING_MAXLEN for result length checks.
 - `LEN(REPT("a";32767))` — the "a" literal is 1 char (well under MAXSTRLEN), 
REPT creates 32,767-char string at runtime (under STRING_MAXLEN=65,535).
-- **Limitation:** A direct 32,767-character string literal like `="aaa...a"` 
in a formula would fail at compile time due to MAXSTRLEN=1024. But ODF §3.7 
requires strings of up to 32,767 characters to be *permitted*, which REPT 
demonstrates.
+- A direct 32,767-character string literal like `="aaa...a"` used to fail at 
compile time (Err:513); it is now accepted.
 
-**Classification:** RUNTIME_PENDING — Source supports runtime strings ≥32,767 
chars (STRING_MAXLEN=65,535; REPT creates them). String literals limited to 
1023 chars does not violate ODF §3.7 (which concerns string values, not literal 
syntax). Runtime test `SG.BL-003-32767chars` not executed.
+**Classification:** RUNTIME_PENDING — Source supports runtime strings ≥32,767 
chars (STRING_MAXLEN=65,535; REPT creates them). Since this audit, string 
literals were raised to 32767 chars; `SG.BL-003-32767chars`, 
`SG.BL-003-literal1022` and `SG.BL-003-literal32767` were run and match.
 
 ---
 
diff --git a/odf_docs/openformula-small-group-semantic-gaps.tsv 
b/odf_docs/openformula-small-group-semantic-gaps.tsv
index 0473c59e6b..7d91e82b3b 100644
--- a/odf_docs/openformula-small-group-semantic-gaps.tsv
+++ b/odf_docs/openformula-small-group-semantic-gaps.tsv
@@ -4,9 +4,9 @@ F-GAP-002       §6.13.8 COUNTBLANK counts empty cells; cell 
returning "" blankness is
 F-GAP-003      §6.14.6 INDEX single-argument row vector returns error (no 
row-vector shortcut) main/sc/source/core/tool/interpr1.cxx:7448 (ScIndex); 
bRowArray shortcut PRESENT at :7588-7612 (restored by commit 8f3b3b25a2, undid 
Milestone A bb58e28fc2)    ODF 1.2 had explicit row-vector shortcut (Row acts 
as column offset); deleted in ODF 1.4 per OFFICE-4144. Current AOO code keeps 
bRowArray (ODF 1.3/Excel compatible, NOT ODF 1.4 compliant). INDEX(H1:L1;3) 
returns value 30 instead of Error. Test  [...]
 F-GAP-004      §4.11.11        Criteria syntax supported in database functions 
main/sc/source/core/tool/interpr1.cxx:6664 (GetDBParams), :6803 (DBIterator); 
:6871-6902 (ScDBCount), :6905-6935 (ScDBCount2); dociter.cxx:685-716 
(CountRecords); queryparam.cxx:106-144 (operator prefix parsing)     Criteria 
operators parsed: <>, <=, <, >=, >, =; bQueryByString via IsNumberFormat; 
bRegExp via MayBeRegExp. DBCount empty-cell limitation RESOLVED: ScDBCount 
missing-field path uses CountRecords() (dociter.cxx:685 [...]
 F-GAP-005      §4.11.11        Database criteria: text criteria, wildcards, 
empty criteria     main/sc/source/core/tool/queryparam.cxx:106-144 (operator 
parsing); interpr1.cxx:6745-6748 (bQueryByString/bRegExp)     Text criteria 
supported via bQueryByString; wildcard/RegExp via MayBeRegExp; empty criteria 
cell (svMissing) handled as missing field   Required by ODF 1.4; partially 
verified Medium  Verify wildcard and text criteria matching      calcval: no 
dedicated wildcard/empty-criteria cases — not covered
-F-GAP-006      §3.7    Formula length at least 1024 characters 
main/sc/inc/compiler.hxx:59-60 (MAXCODE=2048 tokens, MAXSTRLEN=1024 per 
symbol); main/sc/source/core/tool/compiler.cxx:3973-3978,:2689-2691     No 
formula-text length limit; MAXCODE=2048 max tokens, MAXSTRLEN=1024 max chars 
per single symbol. A 1026-char formula needs ~1025 tokens < 2048, each token < 
1024 chars. Single string literal limited to 1023 chars. MET — the 512-token 
limit was raised to 2048 (MAXCODE); matches on Linux aarch64         [...]
+F-GAP-006      §3.7    Formula length at least 1024 characters 
main/sc/inc/compiler.hxx:59-60 (MAXCODE=2048 tokens, MAXSTRLEN=1024 per 
symbol); main/sc/source/core/tool/compiler.cxx:3973-3978,:2689-2691     No 
formula-text length limit; MAXCODE=2048 max tokens, MAXSTRLEN=1024 max chars 
per single symbol. A 1026-char formula needs ~1025 tokens < 2048, each token < 
1024 chars. A string literal may now reach 32767 chars (it was limited to 
1021). MET — the 512-token limit was raised to 2048 (MAXCODE); m [...]
 F-GAP-007      §3.7    At least 30 parameters per function where prototype 
permits     main/sc/source/core/inc/interpre.hxx:897-927 (MustHaveParamCount 
family); main/sc/source/core/tool/interpr1.cxx:3396-3400 (ScMax uses 
MustHaveParamCountMin)    Per-function parameter count enforced via 
MustHaveParamCount/MustHaveParamCountMin/MustHaveParamCountMax. No global 
30-param cap found. MAX uses MustHaveParamCountMin(nParamCount, 1) — no upper 
cap beyond MAXCODE=2048 tokens. Parameter count via GetByte() supp [...]
-F-GAP-008      §3.7    Strings up to 32767 ASCII characters    
main/tools/inc/tools/string.hxx:110-120 (STRING_MAXLEN definition); 
main/sc/source/core/inc/interpre.hxx:930-936 (CheckStringResultLen); 
main/sc/source/core/tool/compiler.cxx:2689-2691 (MAXSTRLEN per literal)        
STRING32 not defined → default STRING_MAXLEN = 0xFFFF = 65,535 (> 32,767 ODF 
minimum). CheckStringResultLen enforces at concatenation (REPT, & operator). 
MAXSTRLEN=1024 limits individual string literals in formulas to 1023 chars (e 
[...]
+F-GAP-008      §3.7    Strings up to 32767 ASCII characters    
main/tools/inc/tools/string.hxx:110-120 (STRING_MAXLEN definition); 
main/sc/source/core/inc/interpre.hxx:930-936 (CheckStringResultLen); 
main/sc/source/core/tool/compiler.cxx:2689-2691 (MAXSTRLEN per literal)        
STRING32 not defined → default STRING_MAXLEN = 0xFFFF = 65,535 (> 32,767 ODF 
minimum). CheckStringResultLen enforces at concatenation (REPT, & operator). A 
string literal in a formula was limited to 1021 characters by MAXSTRLEN=102 
[...]
 F-GAP-009      §3.7    At least 7 nesting levels of functions  
main/formula/source/core/api/FormulaCompiler.cxx:782,:1341 (nRecursionMax=42, 
errStackOverflow); main/sc/inc/compiler.hxx:61 (MAXJUMPCOUNT=32, the jump 
targets of CHOOSE; IF and IFNA use it with at most 3 and 2, 
FormulaCompiler.cxx:1101-1103)      The parser stops with errStackOverflow once 
its recursion count passes 42. MAXCODE=2048 total tokens is the other ceiling 
(7 nested IFs ≈ 15 tokens).   MET — 7 nested IF levels match on Linux aarch 
[...]
 F-GAP-010      §5.5    Operator precedence per Table 1 
main/sc/source/core/tool/compiler.cxx (parser grammar: RangeLine → 
IntersectionLine → RangeLine → UnaryLine → binary ops); 
main/sc/inc/compiler.hxx:61 (MAXJUMPCOUNT=32, CHOOSE only)   Parser structure 
exists with correct precedence hierarchy: ! > : > prefix +,- > ^ > *,/ > +,- > 
& > comparison. Precedence can be overridden with parentheses. Precedence not 
verified at runtime.      RUNTIME_PENDING — source has correct operator 
precedence structure;  [...]
 F-GAP-011      §5.8    Reference syntax supported      
main/sc/source/core/tool/compiler.cxx (IsReference, PopDoubleRef/PopSingleRef); 
main/sc/inc/compiler.hxx        Cell and range reference handling present in 
compiler; references begin with '[' to disambiguate from function names; 
supports cell, row, column, whole-row, whole-column references    
RUNTIME_PENDING — source has correct reference syntax structure; runtime 
verification required  Low     Runtime reference test  calcval: SYN-008-ref, 
SYN-008-range — RUNT [...]

Reply via email to