earleh@eleazar.dartmouth.edu (Earle R. Horton) (08/09/89)
I have a program which solicits floating point values from the user. Usually I use a modeless dialog editText item for this purpose, with the font in the dialog being a user-configurable variable. This is not a high-volume-input program, but rather needs to obtain maybe a half-dozen floating point values to use as parameters to a simulation. I have been looking at the Script Manager 2.0 documentation recently, and it seems that it would be really neat to be able to use it to parse any locally-valid floating point representation. It does seem to be a rather complicated package, however, with about the same degree of complexity as the Macintosh File Manager, and I scarcely would know where to start if I wanted to use it for my rather simple requirements. My requirements are simple: convert an editText item, input in any font or script, to floating point extended or double using the new Script Manager for full generality. Has anyone done this, or (hopefully) have example code? My plans at present include writing output data as either binary or ASCII digits, but hey, I wouldn't turn up my nose at any output routines, either. Earle R. Horton
isle@eleazar.dartmouth.edu (Ken Hancock) (08/09/89)
In article <14919@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu (Earle R. Horton) writes: > > I have a program which solicits floating point values from the >user... >recently, and it seems that it would be really neat to be able to use >it to parse any locally-valid floating point representation. It does >seem to be a rather complicated package, however, with about the same >degree of complexity as the Macintosh File Manager, and I scarcely >would know where to start if I wanted to use it for my rather simple >requirements. Earle, I know exactly what you mean. I'm doing the same thing and looked at the Script Manager 2.0 documentation and threw in the towel and did it by hand.... Ken Ken Hancock '90 | E-mail: (BITNET/UUCP/INTERNET) Computer Resource Center Consultant | isle@eleazar.dartmouth.edu ------------------------------------+--------------------------------------- DISCLAIMER? I don't get paid enough to worry about disclaimers.
ericsc@microsoft.UUCP (Eric Schlegel) (08/09/89)
In article <14919@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu (Earle R. Horton) writes: > My requirements are simple: convert an editText item, input in >any font or script, to floating point extended or double using the new >Script Manager for full generality. Use the SANE routine Str2Num, which takes a string and returns an extended. According to IM V-302 (the docs for version 1 Script Man): Applications that want to check ASCII strings to see if they are valid numeric fields, or convert ASCII strings to their equivalent numeric values, should use the SANE routines to do so. These routines will always return the correct result, regardless of the script in which the number is written. eric ---- These opinions are MINE, ALL MINE!!!
earleh@eleazar.dartmouth.edu (Earle R. Horton) (08/10/89)
In article <7304@microsoft.UUCP> ericsc@microsoft.UUCP (Eric Schlegel) writes: >In article <14919@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu (Earle R. Horton) writes: >> My requirements are simple: convert an editText item, input in >>any font or script, to floating point extended or double using the new >>Script Manager for full generality. > >Use the SANE routine Str2Num, which takes a string and returns an >extended. According to IM V-302 (the docs for version 1 Script Man): > > Applications that want to check ASCII strings to see if they > are valid numeric fields, or convert ASCII strings to their > equivalent numeric values, should use the SANE routines to > do so. These routines will always return the correct result, > regardless of the script in which the number is written. According to the version 2 Script Manager manual, this is not enough. It mentions such things as alternate numeric character sets that would have to be filtered to ASCII before SANE would accept them. It also says that the new number routines (Script Manager version 2) provide a means to read both formatted and simple numbers in any script. I've been through this document a couple times, and it is not obvious how one would go about reading a simple number, given that the number could be in any script and would not necessarily contain ASCII digits. There is also an example illustrating the tokenizer in the new Script Manager, and showing what appear to be Japanese characters being expanded to a string containing ASCII digits. So, the original question still stands: How to read an arbitrary number entered by the user in his local script using the latest Script Manager for fullest generality? Earle R. Horton