jkc@eleazar.dartmouth.edu (Kevin Calhoun) (03/15/89)
Does the String2Date routine documented in the Inside Macintosh
Interim Chapter Draft of the Script Manager 2.0, dated February,
1989, really work under System 6.0.3? I'm using the following
code and getting mixed results. The handle h is locked when I
call String2Date --
err := InitDateCache(@myDateCache);
if err = noErr then
string2dateResult := String2Date(h^, GetHandleSize(h)-1,
@myDateCache, lengthUsed, dateTime);
If the text in h is "September 1, 1987", this works well, but if
it's "September 10, 1987", I get a privilege violation (of all things)
with the pc pointing to a STOP instruction (of all things) in the
itl4 resource. Whenever I use this format for the date, as long as
the day of the month is less than 10, all's well, but otherwise I'm
in trouble. If I use the short date format, as in "9/1/87", it
never works.
I'm trying to write a HyperCard XFCN that will convert dates
properly even when they fall outside of the magic range of 1/1/1904
to whenever it is that I can't remember now and can't calculate in
my head on the fly. I suspect that HyperCard doesn't yet rely on
the new Script Manager routines because they don't work. Can anyone
confirm my suspicion?
--Kevin Calhoun
Courseware Development
Dartmouth College
"Is is buggy in here or is it just me?"jkc@eleazar.dartmouth.edu (Kevin Calhoun) (03/17/89)
I take back all the nasty things I wrote (and thought) about the new Script Manager routine String2Date. I wrote: > err := InitDateCache(@myDateCache); > if err = noErr then > string2dateResult := String2Date(h^, GetHandleSize(h)-1, ^^^^^^^^^^^^^^^^^^ > @myDateCache, lengthUsed, dateTime); The problem here is that h is actually much larger than the text that represents the date I want to convert. If I make this err := InitDateCache(@myDateCache); if err = noErr then string2dateResult := String2Date(h^, StringLength(paramPtr, h^), @myDateCache, lengthUsed, dateTime); then everything is as hunky as it is dorey. So, sorry if I ruffled the feathers of the folks who worked on the Script Manager. The documentation warns that it's very sensitive to garbage input, and that's no joke. -- Kevin Calhoun Courseware Development Dartmouth College