Re: Error: Stack overflow
Re: Error: Stack overflow
- Subject: Re: Error: Stack overflow
- From: Timothy Bates <email@hidden>
- Date: Sat, 03 May 2003 15:29:16 +1000
>
And if the OP wants to do something like search for a multi-character
>
string, your code doesn't really help much there either.
Has anyone developed a library of routines that allow the user to extract
text from a file or arbitrary size?
My current application searches parses a 60 page summary of matrix algebra
structural equation output into a nice set of html summaries. What I am
currently doing is reading in lines 1 at a time and seeing if they match my
start string, then appending to the result while lines match my continue
string (or until a line matches my end-of-this-object string). This works
fine and is not too terribly slow, and lets me use regular expressions to
validate line input (thanks again Smile creators!).
The problem comes if an object is never found (I haven't implemented a
method of returning to the last valid location and proceeding with a
modified search) or if the find string includes a line break. This would
require doing something like searching for the pattern in a multiple-line
chunk of text read into RAM, and then moving this window as required to
match the current search string.
I was just lazy enough to work around these difficulties, but a text search
script object (Has?) which could opens a frame of text, search inside it for
strings (grep or otherwise), be smart enough to get more text if it needs
it, and which maintains a state system so you know where the current read
head is, where the last object was successfully returned, and have the
ability to set properties like a max size of the text "heap" would be very
valuable to many users, I imagine. It could also have utility commands like
setReadHeadTo(location, [lines, bytes]).
A sort of Jon's String.lib but for files?
tim
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.