I have a linked list UDT with a push method that takes in one string argument.
I am trying to use varargs to send a list of strings to a sub that iterates over the list
and calls the UDT's push method for each string. I cannot use the first argument
as an argument count.
I could use the __FB_ARG_COUNT__ intrinsic macro but don't know how to use
it in a sub/function.
My expectation here is that cva_arg(args, zstring ptr) will return a valid zstring ptr
for each argument passed or null when all arguments have been iterated over.
Code: Select all
sub pushstrings (s as string, ...)
dim args as cva_list
cva_start(args, s)
dim zsp as zstring ptr = 0
print s
'call list.push
zsp = cva_arg(args, zstring ptr)
do while zsp <> 0
print *zsp
'call list.push
zsp = cva_arg(args, zstring ptr)
loop
cva_end(args)
end sub
pushstrings("first s", "ab1", "aab2")
Code: Select all
first s
ab1
aab2
ab1
What am I missing?
Thanks.
GWBc