SUMMARY
Question:
What is the cause of getting the "String Formula Too Complex" error
message when passing strings in a CALL statement? Is there a limit to
the number of string constants that can be passed in a CALL?
Response:
Only up to nine string constants can be passed in all nested calls
added together starting in a given call from the main program. To pass
more string constants, pass string variables instead of constants in
the CALL parameter list. If no string constants are passed to a
second-level call, it is possible to pass ten string constants in the
first-level call. This limitation applies to the BASIC interpreter
Versions 2.10 and 3.00 for the Apple Macintosh and the interpreter in
QuickBASIC Version 1.00 for the Apple Macintosh. The limitation does
not pertain to compiled programs.
Code Example
In the following program, the first-level CALL PROMPT passes eight
string constants, and a second-level subprogram CALL passes two more
string constants. As a result, you get a "String Formula Too Complex"
error at run time:
CALL Prompt (1,"Input String:",25,"N","O"," ","+","Y","Y","Y",2!,Timout$)
END
SUB Prompt (Device%,Strout$,Numchr%,Hotchr$,Cvtcase$,Mask$,
Cursor$,Range$,Userbells$,Local$,Maxmin!,Timout$) STATIC
CALL Modemout (Device%,Local$,"N","N",Userbells$,Strout$)
END SUB
SUB Modemout (Device%,Local$,Invisible$,Creturn$,Userbells$,Strout$) STATIC
A$="A"
END SUB
If you remove ("+",) from the CALL Prompt line and remove the
corresponding formal argument (Cursor$,) from the SUB Prompt line, the
program works properly, since a total of nine string constants have
been passed in the two nested calls.