Re: Do shell script and special characters
Re: Do shell script and special characters
- Subject: Re: Do shell script and special characters
- From: "Arthur J. Knapp" <email@hidden>
- Date: Wed, 23 Oct 2002 11:58:34 -0400
>
Date: Mon, 21 Oct 2002 22:32:53 +0200
>
From: Helmut Fuchs <email@hidden>
>
Subject: Re: Do shell script and special characters
>
And I wish, for that among other reasons, that a binary block data
>
type should finally be invented for AppleScript, which should allow
>
for conversions from mere bytes into various other data formats (e.g.
>
string encodings) and back. Then AppleScript could finally become a
>
hub, where software of different cultural backgrounds neatly finds
>
together.
Yes, yes, yes. This would be a wonderful addition to the language.
REALBasic has a datatype called something like "memory block". It
allows an experienced scripter to work directly with raw data in a way
that the language itself does not support with built in data types.
In AppleScript, where so very little datatypes are directly supported,
(or simply hidden), it would be wonderful to do something like this:
set binaryData to [something] as binary block data
(* We might imagine that this data type has a few special "methods"
*)
-- Use the "text x thru y" type of syntax, except with bytes:
--
set twoBytes to bytes 1 thru 2 of binaryData
-- More coercions:
--
set shortInt to bytes 1 thru 2 of binaryData as short integer
-- A built-in understanding of basic data types:
--
set pascalStr to Pascal string of binaryData starting at byte 15
--
--> AppleScript treats byte 15 of binaryData as the length byte of
-- a Pascal string and returns the appropriate data
set CStr to C string of binaryData starting at byte 15
--
--> AppleScript returns bytes starting at byte 15 until it encounters
-- a null.
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
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.