From 2bc9a3d2cb4e20931ff7ab06259698409a95613e Mon Sep 17 00:00:00 2001 From: kichikuou Date: Fri, 10 Apr 2026 14:29:20 +0900 Subject: [PATCH] MainEXFile: Fix Col() to accept EX_LIST MainEXFile.Col() returns the number of items for EX_LIST handles. Also removed the FIXME comments from Row and Col since the semantics appear correct. --- src/hll/MainEXFile.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hll/MainEXFile.c b/src/hll/MainEXFile.c index 035d0be..5e04388 100644 --- a/src/hll/MainEXFile.c +++ b/src/hll/MainEXFile.c @@ -225,13 +225,16 @@ static int MainEXFile_RA2Handle(int handle, int row, struct string *format_name) static int MainEXFile_Row(int handle) { struct ex_table *t = handle_to_table(handle); - return t ? t->nr_rows : 0; // FIXME: should this be nr_columns? + return t ? t->nr_rows : 0; } static int MainEXFile_Col(int handle) { + if (handle > 0 && (unsigned)handle < nr_handles && + handles[handle]->type == EX_LIST) + return handles[handle]->list->nr_items; struct ex_table *t = handle_to_table(handle); - return t ? t->nr_columns : 0; // FIXME: should this be nr_rows? + return t ? t->nr_columns : 0; } static int MainEXFile_Type(int handle)