From d79c578abd993f7eee4e85462a8cd5b7c4e14646 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:16:40 -0500 Subject: Specify a max item length for `list_start` (#552) --- macros/asserts.asm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'macros/asserts.asm') diff --git a/macros/asserts.asm b/macros/asserts.asm index e2de1505..11e0ee99 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -4,8 +4,8 @@ MACRO? _redef_current_label IF DEF(\1) PURGE \1 ENDC - IF _NARG == 3 + (\3) - DEF \1 EQUS "\<_NARG>" + IF _NARG > 2 + DEF \1 EQUS "\3" ELIF STRLEN(#__SCOPE__) IF {{__SCOPE__}} - @ == 0 DEF \1 EQUS #{__SCOPE__} @@ -19,7 +19,8 @@ ENDM MACRO? table_width DEF CURRENT_TABLE_WIDTH = \1 - _redef_current_label CURRENT_TABLE_START, "._table_width\@", 2, \# + SHIFT + _redef_current_label CURRENT_TABLE_START, "._table_width\@", \# ENDM MACRO? assert_table_length @@ -40,11 +41,20 @@ ENDM MACRO? list_start DEF list_index = 0 - _redef_current_label CURRENT_LIST_START, "._list_start\@", 1, \# + DEF list_item_length = 0 + IF _NARG > 0 + DEF list_item_length = \1 + SHIFT + ENDC + _redef_current_label CURRENT_LIST_START, "._list_start\@", \# ENDM MACRO? li ASSERT STRFIND(\1, "@") == -1, "String terminator \"@\" in list entry: \1" + IF list_item_length + ASSERT CHARLEN(\1) <= list_item_length, \ + "List entry longer than {d:list_item_length} characters: \1" + ENDC db \1, "@" DEF list_index += 1 ENDM -- cgit v1.3.1-sl0p