Re: Problem with reading 4-byte floats from file on Intel
Re: Problem with reading 4-byte floats from file on Intel
- Subject: Re: Problem with reading 4-byte floats from file on Intel
- From: email@hidden
- Date: Tue, 04 Dec 2007 12:25:08 -0500
Hi folks,
More strange behavior... sorry for the length of this message.
After more experimenting, I have come up with the following:
1. You may recall that this is my main line of code
set floatList to read file_alias from 0 for 512 as small real
Here is a complete short script:
on run
set file_alias to choose file
set floatList to read file_alias from 0 for 512 as small real
end run
If I compile this script as an application (or an application bundle) on
my Intel Mac, I can click on the app and run it once. The 2nd time I
try to run it, the following dialog is displayed "Could not run this
script because of a numeric overflow in the script. -2702"
If I change the "512" to "256" in the script, all is well, and I can
launch the app many times in a row. Is there some limitation that I
need to be aware of for memory allocation? I am concerned that this
might somehow be machine-dependent. Is it?
2. The "read as small real" operation seems to be byte swapped. So a
file containing the bytes 01 02 03 04, read in as a small real in
AppleScript, appears as 04 03 02 01. I assume that this means that the
Script Editor runs its scripts through Rosetta??
With this small script:
on run
set file_alias to choose file
set floatList to read file_alias from 0 for 256 as small real
display alert "first float is: " & (real 1 in floatList as text)
end run
compare the result of the first float to this in the Terminal app:
od -vf -N 16 your_file_name
By the way, this script is designed to be launched from inside a shell
script inside an Installer. The files I need to test are 2GB each, but
I only need to read the first 128 floats.
As always, any help is GREATLY appreciated.
- Rick
On 12/4/2007 9:06 AM, email@hidden wrote:
Hello JJ,
I'll generate a small example and post.
How do you generate a list of scripting additions?
- Rick
On 12/4/2007 4:05 AM, jj wrote:
Has anybody else had a successful experience reading 4-byte floats (aka
"small real") with AppleScript (especially on an Intel Mac)?
No errors here: Mac Mini Intel, OS X 10.4.11.
Tested in both Smile and Script Editor.
Maybe you can upload a sample file somewhere and post a list of scripting
additions in your OS?
jj
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden