This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch openformula in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 47032aefbaedc538f58cf70300b3b6d11b46912c Author: Pedro Giffuni <[email protected]> AuthorDate: Tue Nov 17 14:33:13 2026 -0500 fix: Wire DATEDIF BIFF import mapping to native opcode Change BIFF5/BIFF7 function ID 351 (DATEDIF) from ocNoName to ocDateDif in xlformula.cxx saFuncTable_5. This enables XLS import of DATEDIF to resolve to the native evaluator instead of producing #NAME!. - Preserves argument count metadata (3 args) and EXC_FUNCFLAG_IMPORTONLY - DATESTRING (ID 352) and NUMBERSTRING (ID 353) remain as ocNoName - BIFF export remains unsupported (import-only policy unchanged) - ocDateDif = SC_OPCODE_DATEDIF = 415, already registered and dispatched Updated audit documentation across all 5 deliverable files. Static verification: code change reviewed, opcode registration confirmed in compiler.hrc, opcode.hxx, interpr4.cxx. --- .../biff-function-mapping-audit.md | 186 +++++++++++++++++++++ .../biff-function-mapping.tsv | 28 ++++ .../function-gap-inventory.md | 37 +++- .../function-gap-summary.tsv | 2 +- .../function-implementation-roadmap.md | 4 + .../function-source-audit.md | 13 +- main/sc/source/filter/excel/xlformula.cxx | 2 +- 7 files changed, 263 insertions(+), 9 deletions(-) diff --git a/audit/openformula-function-gaps/biff-function-mapping-audit.md b/audit/openformula-function-gaps/biff-function-mapping-audit.md new file mode 100644 index 0000000000..8889ae93ec --- /dev/null +++ b/audit/openformula-function-gaps/biff-function-mapping-audit.md @@ -0,0 +1,186 @@ +BIFF Formula Function Mapping Audit +==================================== + +Branch: openformula +HEAD: a330cbd51b (DATEDIF BIFF import mapping fix) +Audit type: Read-only source inspection (no build, no runtime execution) + +Methodology +----------- +Inspected `main/sc/source/filter/excel/xlformula.cxx` which contains all +BIFF formula function mapping tables: + +- saFuncTable_2 (BIFF2, IDs 0-211) +- saFuncTable_3 (BIFF3, IDs 219-244) +- saFuncTable_4 (BIFF4, IDs 214-332) +- saFuncTable_5 (BIFF5/7, IDs 70-354) +- saFuncTable_8 (BIFF8, IDs 358-367) +- saFuncTable_Oox (OOXML future functions, _xlfn. prefix, NOID/255) +- saFuncTable_Odf (OpenFormula namespace, _xlfnodf. prefix, NOID/255) + +Import path: `FillXclFuncMap()` skips EXC_FUNCFLAG_EXPORTONLY entries, +adds entries with non-NOID BIFF function IDs to maXclFuncMap. +Export path: `FillScFuncMap()` skips EXC_FUNCFLAG_IMPORTONLY entries, +adds all others to maScFuncMap keyed by opcode. + +BIFF function IDs and Calc opcode IDs are distinct namespaces. A BIFF +function ID is the number Excel uses in its binary file format; a Calc +opcode is AOO's internal representation. The BIFF tables map between them. + +Inventory +--------- + +27 functions inventoried. All functions recently implemented or reviewed +in the OpenFormula compatibility work (H.1–H.3) plus existing function-gap +inventory entries and the B-function family (LENB/RIGHTB/MIDB/LEFTB). + +| # | Function | Opcode | Native Evaluator | BIFF ID | Import | Export | Classification | +|---|----------|--------|-----------------|---------|--------|--------|----------------| +| 1 | NUMBERVALUE | ocNumberValue (392) | Yes | None (_xlfnodf) | NOID import-only | 255 export-only | Correct | +| 2 | FINDB | ocFinDB (412) | Yes | None | none | none | Unclear | +| 3 | SEARCHB | ocSearchB (413) | Yes | None | none | none | Unclear | +| 4 | REPLACEB | ocReplaceB (414) | Yes | None | none | none | Unclear | +| 5 | DATEDIF | ocDateDif (415) | Yes | BIFF5 ID 351 | ocDateDif import-only | none | Correct (was ocNoName defect, fixed) | +| 6 | IFNA | ocIfna | Yes | None (_xlfn) | NOID import-only | 255 export-only | Correct | +| 7 | SKEWP | ocSkewP | Yes | None (_xlfn) | NOID import-only | 255 export-only | Correct | +| 8 | IFERROR | ocIfError | Yes | None (_xlfn) | NOID import-only | 255 export-only | Correct | +| 9 | BITAND | ocBitAnd | Yes | None (_xlfn) | NOID import-only | 255 export-only | Correct | +| 10 | BITOR | ocBitOr | Yes | None (_xlfn) | NOID import-only | 255 export-only | Correct | +| 11 | BITXOR | ocBitXor | Yes | None (_xlfn) | NOID import-only | 255 export-only | Correct | +| 12 | BITLSHIFT | ocBitLShift | Yes | None (_xlfn) | NOID import-only | 255 export-only | Correct | +| 13 | BITRSHIFT | ocBitRShift | Yes | None (_xlfn) | NOID import-only | 255 export-only | Correct | +| 14 | ISOWEEKNUM | ocWeek | Yes | None (_xlfnodf) | NOID import-only | 255 export-only | Correct | +| 15 | DDE | ocDde (369) | Yes | None | none | none | Intentional limitation | +| 16 | ODDFPRICE | None (AddIn) | No | None | none | none | Intentional limitation | +| 17 | ODDFYIELD | None (AddIn) | No | None | none | none | Intentional limitation | +| 18 | RRI | ocZGZ | Yes | None (_xlfnodf) | NOID import-only | 255 export-only | Correct | +| 19 | ERROR.TYPE | ocErrorType (151) | Yes | BIFF4 ID 261 | ocErrorType both | ocErrorType both | Correct | +| 20 | GETPIVOTDATA | ocGetPivotData (390) | Yes | BIFF8 ID 358 | ocGetPivotData both | ocGetPivotData both | Correct | +| 21 | FDIST | ocFDist (315) | Yes | BIFF4 ID 281 | ocFDist both | ocFDist both | Correct | +| 22 | FINV | ocFInv (359) | Yes | BIFF4 ID 282 | ocFInv both | ocFInv both | Correct | +| 23 | HARMEAN | ocHarmMean (321) | Yes | BIFF4 ID 320 | ocHarmMean both | ocHarmMean both | Correct | +| 24 | LEFTB | ocLeftB (402) | Yes | BIFF2 ID 208 | ocLeftB both | ocLeftB both | Correct | +| 25 | RIGHTB | ocRightB (401) | Yes | BIFF2 ID 209 | ocRightB both | ocRightB both | Correct | +| 26 | MIDB | ocMidB (403) | Yes | BIFF2 ID 210 | ocMidB both | ocMidB both | Correct | +| 27 | LENB | ocLenB (400) | Yes | BIFF2 ID 211 | ocLenB both | ocLenB both | Correct | + +Import Findings +--------------- + +DATEDIF (BIFF5 ID 351): Was mapped to ocNoName → #NAME! on import. Fixed +in commit a330cbd51b to map to ocDateDif. Import-only flag preserved. +BIFF8 table (saFuncTable_8) does not include DATEDIF. + +All functions in saFuncTable_Oox (_xlfn. prefix) have NOID as BIFF +function ID for import, meaning they cannot be imported via BIFF ID +lookup. These are Excel future functions (Excel 2007/2010/2013+) that +don't exist in older BIFF versions. This is intentional. + +All functions in saFuncTable_Odf (_xlfnodf. prefix) have NOID as BIFF +function ID for import, meaning they cannot be imported via BIFF ID +lookup. These are ODF namespace functions not defined in BIFF. This is +intentional. + +Functions FINDB, SEARCHB, REPLACEB, DDE have native evaluators but no +BIFF function ID in any AOO table. BIFF may define IDs for FINDB/SEARCHB/ +REPLACEB in later versions (Excel does have these functions), but AOO does +not implement those mappings. Classification: unclear. + +Functions ODDFPRICE, ODDFYIELD are Analysis AddIn functions with no native +opcode. Classification: intentional limitation. + +Function DDE has a native opcode and evaluator but is not a BIFF function. +Classification: intentional limitation. + +Export Findings +--------------- + +All functions in saFuncTable_Oox have EXC_FUNCFLAG_EXPORTONLY entries with +BIFF ID 255 (future function marker). These are exported to BIFF as future +functions using the _xlfn. name mechanism. Correct for OOXML future +functions. + +All functions in saFuncTable_Odf have EXC_FUNCFLAG_EXPORTONLY entries with +BIFF ID 255 (future function marker). These are exported to BIFF using the +_xlfnodf. name mechanism. Correct for ODF namespace functions. + +DATEDIF is import-only in saFuncTable_5 (BIFF ID 351). No export mapping +exists. DATEDIF is imported from BIFF but not exported back to BIFF — this +is an intentional import-only policy, not an export defect. The function's +BIFF import mapping was corrected from ocNoName to ocDateDif in commit +a330cbd51b. + +Functions in saFuncTable_2 (BIFF2 IDs 208-211 for B-functions) and +saFuncTable_4 (BIFF4 IDs 261-320) and saFuncTable_8 (BIFF8 ID 358) have +both import and export mappings. Correct. + +Remaining ocNoName entries in BIFF tables: +- DATESTRING (BIFF5 ID 352): No native opcode. Intentional. +- NUMBERSTRING (BIFF5 ID 353): No native opcode. Intentional. +- PHONETIC (BIFF8 ID 360): No native opcode. Intentional. + +Adjacent Compatibility Layers +----------------------------- + +OOXML/XLSX mappings (saFuncTable_Oox) are separate from BIFF mappings and +use _xlfn. prefix names with NOID/255 BIFF IDs. These are not confused with +BIFF support - NOID means no BIFF function ID exists. + +ODF namespace mappings (saFuncTable_Odf) use _xlfnodf. prefix names with +NOID/255 BIFF IDs. These are distinct from native BIFF function IDs. + +BIFF function IDs and Calc opcode IDs are distinct namespaces. BIFF ID 255 +is used as a sentinel for "future function" in OOXML/OXDF namespace +mappings, not as a real BIFF function ID for import purposes. + +Defects Found +------------- + +1. DATEDIF: BIFF5 ID 351 mapped to ocNoName → #NAME! on import. FIXED + in commit a330cbd51b (ocNoName → ocDateDif). No remaining defect. + +No remaining BIFF import or export defects were found for the inventoried +functions. + +Functions Requiring Follow-up +----------------------------- + +- FINDB, SEARCHB, REPLACEB: No BIFF function ID in any AOO table + (saFuncTable_2/3/4/5/8, saFuncTable_Oox, saFuncTable_Odf). The related + extract functions LEFTB/RIGHTB/MIDB/LENB DO have BIFF2 IDs (208-211), + but the find/replace/search variants are absent from all tables. + Classification: unclear — AOO has native evaluators and opcode + dispatch, but no BIFF import/export mapping exists. XLS import of + FINDB/SEARCHB/REPLACEB formulas would fail in AOO. + +- DATEDIF import: Supported via BIFF5 ID 351 → ocDateDif (import-only). + No BIFF export mapping exists by design. Not a defect — import-only + policy is intentional. + +Statistics +---------- +- Total functions inventoried: 27 +- Correct mappings: 21 +- Import defects: 0 (DATEDIF ocNoName defect was fixed before this audit) +- Export defects: 0 +- Intentional limitations: 3 (DDE, ODDFPRICE, ODDFYIELD) +- Unclear: 3 (FINDB, SEARCHB, REPLACEB - BIFF function IDs unknown in AOO tables) +- Functions with native evaluators but no BIFF mapping: 4 (FINDB, SEARCHB, REPLACEB, DDE) +- Functions implemented via AddIn (no native opcode): 2 (ODDFPRICE, ODDFYIELD) + +Source References +----------------- +- BIFF function tables: main/sc/source/filter/excel/xlformula.cxx + - saFuncTable_2: lines 74-218 + - saFuncTable_3: lines 220-246 + - saFuncTable_4: lines 248-322 + - saFuncTable_5: lines 324-346 + - saFuncTable_8: lines 348-364 + - saFuncTable_Oox: lines 366-393 + - saFuncTable_Odf: lines 395-430 +- Import path: FillXclFuncMap(), lines 481-493 +- Export path: FillScFuncMap(), lines 495-500 +- Opcode definitions: main/formula/inc/formula/compiler.hrc +- Opcode enum: main/formula/inc/formula/opcode.hxx +- Function name registration: main/formula/source/core/resource/core_resource.src +- Evaluator dispatch: main/sc/source/core/tool/interpr4.cxx diff --git a/audit/openformula-function-gaps/biff-function-mapping.tsv b/audit/openformula-function-gaps/biff-function-mapping.tsv new file mode 100644 index 0000000000..60e3cdf66b --- /dev/null +++ b/audit/openformula-function-gaps/biff-function-mapping.tsv @@ -0,0 +1,28 @@ +function opcode native_evaluator biff_function_id biff_import_mapping biff_export_mapping import_status export_status classification source_reference notes +NUMBERVALUE ocNumberValue (392) Yes - ScNumberValue() None (_xlfnodf.NUMBERVALUE) NOID import-only 255 export-only no-biff-id xlfnodf-export correct xlformula.cxx:418 (saFuncTable_Odf), interpr4.cxx:3559 ODF namespace function; not a BIFF native function +FINDB ocFinDB (412) Yes - ScFindB() None none none no-mapping no-mapping unclear interpr4.cxx:3772 Confirmed absent from all AOO BIFF tables; LEFTB/RIGHTB/MIDB/LENB have BIFF2 IDs 208-211 but FINDB has no mapping +SEARCHB ocSearchB (413) Yes - ScSearchB() None none none no-mapping no-mapping unclear interpr4.cxx:3773 Confirmed absent from all AOO BIFF tables; LEFTB/RIGHTB/MIDB/LENB have BIFF2 IDs 208-211 but SEARCHB has no mapping +REPLACEB ocReplaceB (414) Yes - ScReplaceB() None none none no-mapping no-mapping unclear interpr4.cxx:3774 Confirmed absent from all AOO BIFF tables; LEFTB/RIGHTB/MIDB/LENB have BIFF2 IDs 208-211 but REPLACEB has no mapping +DATEDIF ocDateDif (415) Yes - ScDateDif() BIFF5 ID 351 ocDateDif import-only none biff-import-only none correct xlformula.cxx:342 (saFuncTable_5), interpr4.cxx:3775 Fixed from ocNoName to ocDateDif in commit a330cbd51b; import-only (BIFF export intentionally unsupported) +IFNA ocIfna Yes - ScIfna() None (_xlfn.IFNA) NOID import-only 255 export-only no-biff-id xlfn-export correct xlformula.cxx:377 (saFuncTable_Oox), interpr4.cxx:3453 Excel future function; not a BIFF native function +SKEWP ocSkewP Yes - ScSkewP() None (_xlfn.SKEW.P) NOID import-only 255 export-only no-biff-id xlfn-export correct xlformula.cxx:381 (saFuncTable_Oox), interpr4.cxx:3699 Excel future function; not a BIFF native function +IFERROR ocIfError Yes - ScIfError() None (_xlfn.IFERROR) NOID import-only 255 export-only no-biff-id xlfn-export correct xlformula.cxx:379 (saFuncTable_Oox), interpr4.cxx:3454 Excel future function; not a BIFF native function +BITAND ocBitAnd Yes - ScBitAnd() None (_xlfn.BITAND) NOID import-only 255 export-only no-biff-id xlfn-export correct xlformula.cxx:383 (saFuncTable_Oox), interpr4.cxx:3779 Excel future function; not a BIFF native function +BITOR ocBitOr Yes - ScBitOr() None (_xlfn.BITOR) NOID import-only 255 export-only no-biff-id xlfn-export correct xlformula.cxx:385 (saFuncTable_Oox), interpr4.cxx:3780 Excel future function; not a BIFF native function +BITXOR ocBitXor Yes - ScBitXor() None (_xlfn.BITXOR) NOID import-only 255 export-only no-biff-id xlfn-export correct xlformula.cxx:387 (saFuncTable_Oox), interpr4.cxx:3781 Excel future function; not a BIFF native function +BITLSHIFT ocBitLShift Yes - ScBitLShift() None (_xlfn.BITLSHIFT) NOID import-only 255 export-only no-biff-id xlfn-export correct xlformula.cxx:389 (saFuncTable_Oox), interpr4.cxx:3782 Excel future function; not a BIFF native function +BITRSHIFT ocBitRShift Yes - ScBitRShift() None (_xlfn.BITRSHIFT) NOID import-only 255 export-only no-biff-id xlfn-export correct xlformula.cxx:391 (saFuncTable_Oox), interpr4.cxx:3783 Excel future function; not a BIFF native function +ISOWEEKNUM ocWeek Yes - ScGetWeekOfYear() None (_xlfnodf.ISOWEEKNUM) NOID import-only 255 export-only no-biff-id xlfnodf-export correct xlformula.cxx:416 (saFuncTable_Odf), interpr4.cxx:3517 ODF namespace function; not a BIFF native function +DDE ocDde (369) Yes - ScDde() None none none no-mapping no-mapping intentional-limitation interpr4.cxx:3755 DDE is not a BIFF function; no BIFF ID exists; application-level DDE feature +ODDFPRICE None (AddIn) No - Analysis AddIn None none none no-mapping no-mapping intentional-limitation odffmap.cxx:127 Analysis AddIn function; no native opcode; no BIFF mapping +ODDFYIELD None (AddIn) No - Analysis AddIn None none none no-mapping no-mapping intentional-limitation odffmap.cxx:128 Analysis AddIn function; no native opcode; no BIFF mapping +RRI ocZGZ Yes - ScZGZ() None (_xlfnodf.RRI) NOID import-only 255 export-only no-biff-id xlfnodf-export correct xlformula.cxx:422 (saFuncTable_Odf), interpr4.cxx:3618 ODF namespace function; not a BIFF native function +ERROR.TYPE ocErrorType (151) Yes - ScErrorType() BIFF4 ID 261 ocErrorType both ocErrorType both biff-both biff-both correct xlformula.cxx:257 (saFuncTable_4), interpr4.cxx:3752 Native BIFF function with both import and export +GETPIVOTDATA ocGetPivotData (390) Yes - ScGetPivotData() BIFF8 ID 358 ocGetPivotData both ocGetPivotData both biff-both biff-both correct xlformula.cxx:351 (saFuncTable_8), interpr4.cxx:3765 Native BIFF8 function with both import and export +FDIST ocFDist (315) Yes - ScFDist() BIFF4 ID 281 + _xlfnodf.FDIST ocFDist both (BIFF4) / NOID import-only (ODF) ocFDist both (BIFF4) / 255 export-only (ODF) biff-both biff-both correct xlformula.cxx:270 (saFuncTable_4), xlformula.cxx:410 (saFuncTable_Odf), interpr4.cxx:3691 Has both BIFF4 native mapping and ODF namespace mapping +FINV ocFInv (359) Yes - ScFInv() BIFF4 ID 282 + _xlfnodf.FINV ocFInv both (BIFF4) / NOID import-only (ODF) ocFInv both (BIFF4) / 255 export-only (ODF) biff-both biff-both correct xlformula.cxx:271 (saFuncTable_4), xlformula.cxx:411 (saFuncTable_Odf), interpr4.cxx:3744 Has both BIFF4 native mapping and ODF namespace mapping +HARMEAN ocHarmMean (321) Yes - ScHarMean() BIFF4 ID 320 ocHarmMean both ocHarmMean both biff-both biff-both correct xlformula.cxx:309 (saFuncTable_4), interpr4.cxx:3618 (approx) Native BIFF4 function with both import and export +LEFTB ocLeftB (402) Yes - ScLeftB() BIFF2 ID 208 ocLeftB both ocLeftB both biff-both biff-both correct xlformula.cxx:211 (saFuncTable_2), interpr4.cxx:3770 Native BIFF2 function with both import and export +RIGHTB ocRightB (401) Yes - ScRightB() BIFF2 ID 209 ocRightB both ocRightB both biff-both biff-both correct xlformula.cxx:212 (saFuncTable_2), interpr4.cxx:3769 Native BIFF2 function with both import and export +MIDB ocMidB (403) Yes - ScMidB() BIFF2 ID 210 ocMidB both ocMidB both biff-both biff-both correct xlformula.cxx:213 (saFuncTable_2), interpr4.cxx:3771 Native BIFF2 function with both import and export +LENB ocLenB (400) Yes - ScLenB() BIFF2 ID 211 ocLenB both ocLenB both biff-both biff-both correct xlformula.cxx:214 (saFuncTable_2), interpr4.cxx:3768 Native BIFF2 function with both import and export diff --git a/audit/openformula-function-gaps/function-gap-inventory.md b/audit/openformula-function-gaps/function-gap-inventory.md index 6869e2a75b..66fa5ef08b 100644 --- a/audit/openformula-function-gaps/function-gap-inventory.md +++ b/audit/openformula-function-gaps/function-gap-inventory.md @@ -12,7 +12,7 @@ Summary table of all 15 audited functions. | FINDB | Present | ocFinDB (412) | ScFindB() | Yes (HID_FUNC_FINDB) | No | N/A | No | No | No | No | None — implementation complete at source level | Resolved (was P1) | HIGH | | REPLACEB | Present | ocReplaceB (414) | ScReplaceB() | Yes (HID_FUNC_REPLACEB) | No | N/A | No | No | No | No | None — implementation complete at source level | Resolved (was P1) | HIGH | | SEARCHB | Present | ocSearchB (413) | ScSearchB() | Yes (HID_FUNC_SEARCHB) | No | N/A | No | No | No | No | None — implementation complete at source level | Resolved (was P1) | HIGH | -| DATEDIF | Present | ocDateDif (415) | ScDateDif() | Yes (HID_FUNC_DATEDIF) | Yes | Large Group | Yes(BIFF5/7,ID351,→#NAME!) | No | No | No | None — implementation complete at source level | Resolved (was P1) | HIGH | +| DATEDIF | Present | ocDateDif (415) | ScDateDif() | Yes (HID_FUNC_DATEDIF) | Yes | Large Group | Yes(BIFF5/7,ID351,ocDateDif) | No | No | No | None — implementation complete at source level | Resolved (was P1) | HIGH | | ISOWEEKNUM | Partial (wrong semantics) | ocWeek | ScGetWeekOfYear() | German only (KALENDERWOCHE) | No | N/A | No | Yes (ODF table, import-only) | No | _xlfnodf.ISOWEEKNUM | ISO 8601 semantics not implemented (only SUN/MON start) | P1 | MEDIUM | | DDE | Present (platform-dependent) | ocDde (369) | ScDde() | Yes (HID_FUNC_DDE) | No | N/A | No | No | No | No | Platform-dependent; no file-format mapping | DEFER | HIGH | | ODDFPRICE | Present (AddIn) | None | getOddfprice() (AddIn) | Yes (HID_AAI_FUNC_ODDFPRICE) | No | N/A | No | No | No | No | Analysis AddIn, not native | P2 | HIGH | @@ -40,3 +40,38 @@ Notes: spec/security questions. - Confidence: HIGH = direct source evidence; MEDIUM = source evidence exists but runtime behavior unverified. + +BIFF Compatibility +------------------ + +See audit/openformula-function-gaps/biff-function-mapping-audit.md for the +detailed BIFF import/export mapping audit and +audit/openformula-function-gaps/biff-function-mapping.tsv for the +machine-readable inventory. + +Key findings: +- DATEDIF BIFF5 ID 351 was mapped to ocNoName (→ #NAME! on import) and + was fixed to ocDateDif in commit a330cbd51b. DATEDIF is import-only + (BIFF export intentionally unsupported). +- FINDB, SEARCHB, REPLACEB have native evaluators but no BIFF function ID + in any AOO table (classification: unclear — confirmed absent from + saFuncTable_2/3/4/5/8, saFuncTable_Oox, saFuncTable_Odf; LEFTB/RIGHTB/ + MIDB/LENB have BIFF2 IDs 208-211 but the find/replace/search variants + do not). +- DDE has a native opcode and evaluator but no BIFF mapping (intentional + limitation — DDE is not a BIFF function). +- ODDFPRICE and ODDFYIELD are Analysis AddIn functions with no native + opcode and no BIFF mapping (intentional limitation). +- All other inventoried functions have correct BIFF mappings where BIFF + function IDs exist. +- OOXML future functions (IFNA, IFERROR, SKEWP, BITAND, BITOR, BITXOR, + BITLSHIFT, BITRSHIFT) and ODF namespace functions (ISOWEEKNUM, + NUMBERVALUE, RRI, FDIST, FINV) use _xlfn./_xlfnodf. prefix names with + NOID/255 BIFF IDs — no BIFF import, future-function export only. + +Classification summary (27 functions): +- Correct: 21 +- Intentional limitations: 3 (DDE, ODDFPRICE, ODDFYIELD) +- Unclear: 3 (FINDB, SEARCHB, REPLACEB) +- Import defects: 0 (DATEDIF ocNoName defect fixed before this audit) +- Export defects: 0 diff --git a/audit/openformula-function-gaps/function-gap-summary.tsv b/audit/openformula-function-gaps/function-gap-summary.tsv index fb03ac8752..3d9b75172b 100644 --- a/audit/openformula-function-gaps/function-gap-summary.tsv +++ b/audit/openformula-function-gaps/function-gap-summary.tsv @@ -2,7 +2,7 @@ function odf_1_4_defined odf_group opcode parser_name evaluator help xls_import FINDB No N/A ocFinDB(412) FINDB ScFindB() Yes (HID_FUNC_FINDB) No No No No None — implementation complete at source level Resolved (was P1) HIGH compiler.hrc:412; interpr4.cxx:3772 dispatch, interpr1.cxx:8155 evaluator; DBCS byte semantics REPLACEB No N/A ocReplaceB(414) REPLACEB ScReplaceB() Yes (HID_FUNC_REPLACEB) No No No No None — implementation complete at source level Resolved (was P1) HIGH compiler.hrc:414; interpr4.cxx:3774 dispatch, interpr1.cxx:8250 evaluator; DBCS byte semantics SEARCHB No N/A ocSearchB(413) SEARCHB ScSearchB() Yes (HID_FUNC_SEARCHB) No No No No None — implementation complete at source level Resolved (was P1) HIGH compiler.hrc:413; interpr4.cxx:3773 dispatch, interpr1.cxx:8197 evaluator; DBCS byte semantics -DATEDIF Yes Large Group ocDateDif(415) DATEDIF ScDateDif() Yes (HID_FUNC_DATEDIF) Yes(BIFF5/7,ID351,→#NAME!) No No No None — implementation complete at source level Resolved (was P1) HIGH compiler.hrc:415; interpr4.cxx:3775 dispatch, interpr2.cxx:443 evaluator; ODF 6.10.3 conformant; BIFF import still maps to ocNoName +DATEDIF Yes Large Group ocDateDif(415) DATEDIF ScDateDif() Yes (HID_FUNC_DATEDIF) Yes(BIFF5/7,ID351,ocDateDif) No No No None — implementation complete at source level Resolved (was P1) HIGH compiler.hrc:415; interpr4.cxx:3775 dispatch, interpr2.cxx:443 evaluator; xlformula.cxx:342 BIFF import maps to ocDateDif (import-only); ODF 6.10.3 conformant ISOWEEKNUM No N/A ocWeek ISOWEEKNUM ScGetWeekOfYear() German only (KALENDERWOCHE) No Yes(ODF table,import-only) No _xlfnodf.ISOWEEKNUM ISO 8601 semantics not implemented (SUN/MON start only) P1 MEDIUM interpr2.cxx:227 ScGetWeekOfYear() uses Date::GetWeekOfYear(); no ISO week-1=first-Thursday logic DDE No N/A ocDde(369) DDE ScDde() Yes (HID_FUNC_DDE) No No No No Platform-dependent; no file-format mapping DEFER HIGH interpr2.cxx:2150; DDE via sfx2::LinkManager; disabled in server mode ODDFPRICE No N/A None ODDFPRICE getOddfprice() (AddIn) Yes (HID_AAI_FUNC_ODDFPRICE) No No No No Analysis AddIn, not native P2 HIGH odffmap.cxx:127; financial.cxx:404; AddIn mechanism only diff --git a/audit/openformula-function-gaps/function-implementation-roadmap.md b/audit/openformula-function-gaps/function-implementation-roadmap.md index b010a3a89c..19673e682e 100644 --- a/audit/openformula-function-gaps/function-implementation-roadmap.md +++ b/audit/openformula-function-gaps/function-implementation-roadmap.md @@ -69,6 +69,10 @@ Changes: 8. Added 15 regression test cases to calcval-cases14.tsv covering basic days/months/years, same date, month boundaries, leap year dates, component formats (md/ym/yd), reverse dates, and invalid formats. + 9. Fixed BIFF5/BIFF7 import mapping in xlformula.cxx line 342: + changed `ocNoName` → `ocDateDif` for function ID 351 (DATEDIF), + preserving EXC_FUNCFLAG_IMPORTONLY flag. BIFF import now resolves + DATEDIF to the native evaluator instead of producing #NAME!. Semantic design: See datedif-semantic-design.md for detailed algorithm specification including reverse-date policy, time fraction handling, and diff --git a/audit/openformula-function-gaps/function-source-audit.md b/audit/openformula-function-gaps/function-source-audit.md index a1e357f318..3843d84d8f 100644 --- a/audit/openformula-function-gaps/function-source-audit.md +++ b/audit/openformula-function-gaps/function-source-audit.md @@ -160,10 +160,11 @@ A. Function registration - Help entry: HID_FUNC_DATEDIF (helpids.h line 768+, hidother.src). - ODF formula namespace mapping: DATEDIF in ODF section of core_resource.src. - - Excel import mapping: BIFF5/BIFF7 function ID 351 still mapped to - ocNoName in xlformula.cxx line 342 (import-only, produces #NAME!). - Native opcode not yet wired to BIFF import table. - - Excel export mapping: None. + - Excel import mapping: BIFF5/BIFF7 function ID 351 now maps to + ocDateDif in xlformula.cxx line 342 (import-only). BIFF import + resolves DATEDIF to the native evaluator instead of ocNoName. + BIFF8 table (saFuncTable_8) does not include DATEDIF. + - Excel export mapping: None (import-only policy unchanged). B. Actual implementation: ScInterpreter::ScDateDif() at interpr2.cxx:443. Implements ODF 1.4 §6.10.3 with all six formats (y, m, d, md, ym, yd). @@ -175,8 +176,8 @@ B. Actual implementation: ScInterpreter::ScDateDif() at interpr2.cxx:443. Detailed algorithm in audit/openformula-function-gaps/datedif-semantic-design.md. C. Format compatibility - - XLS import: BIFF5/BIFF7 function ID 351 maps to ocNoName → #NAME!. - Native opcode not yet wired to BIFF import table. + - XLS import: BIFF5/BIFF7 function ID 351 maps to ocDateDif. + Import resolves DATEDIF to the native evaluator. Import-only. - XLS import (BIFF8): Not in saFuncTable_8. Not recognized. - XLSX import: Not in saFuncTable_Oox. Not recognized. - XLS export: None. diff --git a/main/sc/source/filter/excel/xlformula.cxx b/main/sc/source/filter/excel/xlformula.cxx index 2ff4d7925b..dfa980d365 100644 --- a/main/sc/source/filter/excel/xlformula.cxx +++ b/main/sc/source/filter/excel/xlformula.cxx @@ -339,7 +339,7 @@ static const XclFunctionInfo saFuncTable_5[] = { ocCountIf, 346, 2, 2, V, { RO, VR }, 0, 0 }, { ocCountEmptyCells, 347, 1, 1, V, { RO }, 0, 0 }, { ocISPMT, 350, 4, 4, V, { VR }, 0, 0 }, - { ocNoName, 351, 3, 3, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATEDIF + { ocDateDif, 351, 3, 3, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATEDIF { ocNoName, 352, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATESTRING { ocNoName, 353, 2, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // NUMBERSTRING { ocRoman, 354, 1, 2, V, { VR }, 0, 0 }
