aboutsummaryrefslogtreecommitdiffstats
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/asserts.asm18
1 files changed, 14 insertions, 4 deletions
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