MACSCRPT Archives

May 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Mark Lively <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 24 May 2006 12:16:28 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (63 lines)
On May 24, 2006, at 11:51 AM, John Baxter wrote:

> On May 24, 2006, at 8:24 AM, Duane L. Mitchell wrote:
>
>> ((current date) - pReferenceDate)
>>
>> I was hoping it would be more interesting than this. I had all the  
>> various
>> solution scripts to try and did not get the chance to run them. I  
>> suppose
>> the question remains how can one create the above expression on a PPC
>> machine so that it works on an Intel machine without having to  
>> recompile.
>> Perhaps using one or another of the previously suggested solutions  
>> for both
>> sides of the minus sign would work?
>
> Subject to correction, of course, I'm reasonably sure that the  
> problem is not with
> current date
> but with the value compiled into pReferenceDate.
>
> It seems highly probably that Apple failed to make compiled date  
> values portable between PPC and Mac (which would have required code  
> in the PPC version to deal with dates with the PPC byte order--very  
> different in a signed 64-bit number from the Intel byte order.
>
> The various scripting solutions which involve injecting the parts  
> of a date into a date value, at run time, work around the problem,  
> and are most likely the best workaround we'll have until (a) Apple  
> releases a fix and (b) all clients are on some unknown version  
> after 10.4.6 (that is, approximately, forever).
>
> We have enough information now for someone with both sorts of  
> machines (I lack an Intel) to determine whether
> Jan 1, 1904 00:00:01
> is compiled as
> 01 00 00 00  00 00 00 00
> or
> 00 00 00 00  01 00 00 00
> in Intel.  In PPC it is
> 00 00 00 00  00 00 00 01
>
> The fancy formatting which makes a date object look like a date is  
> done at display time.
>
>   --John (who long ago wrote Frontier code which would turn an  
> incoming AppleScript date into a Frontier date--that code may now  
> be broken depending on the above layout determination)
>

The solution is to do what they are doing in other parts of the  
system and store everything PPC and then do the conversion on read  
in.  It seems like AS dates fell through the cracks.  Byte swapping  
is a very fast operation, and if you do it at load time you only have  
to do it once.

This solution though would break any scripts compiled on intel  
machines before the switch unless there is an attempt to compensate  
for that by changing the versioning.

-Mark

ATOM RSS1 RSS2