Hi all,
Just for giggles, I decided to write a QT to reverse a string. This
is what I came up with (as written, must be called 'rev'):
%If:"%_Rev_Init"="":"%-
%___%If:'%_Rev_Src'='':'%_Rev_Src(%Clipboard)'%-
%___%SetPattRegExp('(?s)(.)(.*)')%-
%___%_Rev_Out('')%-
%___%_Rev_Init('T')":""%-
%-
%RegExpBlindMatch(%_Rev_Src)%-
%_Rev_Out("%Subpatt(1)%_Rev_Out")%-
%_Rev_Src(%Subpatt(2))%-
%-
%If:"%_Rev_Src"<>"":"%Qinclude(rev)":"%_Rev_Out"%-
It works for short strings, but crashes TB! with long ones. It appears
to crash when the input string gets much over 900 characters, but it
may depend on available memory.
Does anyone see a problem with my QT or am I just recursing too deep
and overflowing the stack? Is there a known limit to recursion in TB!?
If the problem is recursing too deep, is it a bug that I can crash
TB!, or is this just a case of "don't do that!"?
--
egroeG
Using TB! 2.02.3 CE on Windows XP Pro 5.1, Build 2600, Service Pack 1.
________________________________________________________
http://www.silverstones.com/thebat/TBUDLInfo.html