[comp.sys.mac.programmer] Map info in PRAM?

saaf@joker.optics.rochester.edu (Lennart Saaf) (01/15/91)

I am trying to access the lattitude and longitude information that is
used by the Map cdev. I assumed that it is stored in parameter RAM,
based partly on the fact that the MacEnvy system configuration cdev
suggests that this is so. There are some reserved (as of IM2) bits in
the fields that make up the PRAM record, but these don't seem to
change when the lattitude & longitude are changed with the Map cdev.
I can't find anything in the Map cdev itself where this info might be
kept. Anyway, even if the Map cdev is trashed, MacEnvy still shows the
same coordinates. I have looked in IM and the tech notes for clues but
haven't found anything. Any clues?

Len
--
------------------------------------------------------------------------
| Len Saaf, The Institute of Optics, Univ. of Rochester, Rochester, NY |
| Internet: saaf@joker.optics.rochester.edu        Bitnet: SAAF@UOROPT |
------------------------------------------------------------------------

peirce@outpost.UUCP (Michael Peirce) (01/16/91)

In article <SAAF.91Jan15094106@joker.optics.rochester.edu>, saaf@joker.optics.rochester.edu (Lennart Saaf) writes:
> 
> I am trying to access the lattitude and longitude information that is
> used by the Map cdev. I assumed that it is stored in parameter RAM,
> based partly on the fact that the MacEnvy system configuration cdev
> suggests that this is so. There are some reserved (as of IM2) bits in
> the fields that make up the PRAM record, but these don't seem to
> change when the lattitude & longitude are changed with the Map cdev.
> I can't find anything in the Map cdev itself where this info might be
> kept. Anyway, even if the Map cdev is trashed, MacEnvy still shows the
> same coordinates. I have looked in IM and the tech notes for clues but
> haven't found anything. Any clues?

Try using the script manager.  There is a call called ReadLocation
that returns a record of the following format:

	MachineLocation = RECORD
		latitude: Fract;
		longitude: Fract;
		CASE INTEGER OF
		  0:
			(dlsDelta: SignedByte); 	{signed byte; daylight savings delta}
	 	 1:
			(gmtDelta: LONGINT);		{must mask - see documentation}
		END;

There is also a WriteLocation call to make changes.  Don't muck with
the PRAM directly, use the supported calls!

-- michael


--  Michael Peirce         --   outpost!peirce@claris.com
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--           & Consulting  --   (408) 244-6554, AppleLink: PEIRCE

resnick@cogsci.uiuc.edu (Pete Resnick) (01/16/91)

In article <SAAF.91Jan15094106@joker.optics.rochester.edu>
saaf@joker.optics.rochester.edu (Lennart Saaf) writes:

>I am trying to access the lattitude and longitude information that is
>used by the Map cdev.

This is part of the Script Manager 2.0. The interim chapter was on apple.com
some time ago, but you will have to look and see if it is still there. Anyway,
you call:

ReadLocation(&myLocation);

where myLocation is a:

struct MachineLocation {
	Fract latitude;
	Fract longitude;
	union {
		char dlsDelta;
		long gmtDelta;
	} gmtFlags;
};

For use of the gmtFlags, see the documentation.

pr
--
Pete Resnick     (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet  : resnick@cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD

saaf@joker.optics.rochester.edu (Lennart Saaf) (01/16/91)

In article <1991Jan15.224711.1379@ux1.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes:
> 
> In article <SAAF.91Jan15094106@joker.optics.rochester.edu>
> saaf@joker.optics.rochester.edu (Lennart Saaf) writes:
> 
> >I am trying to access the lattitude and longitude information that is
> >used by the Map cdev.
> 
> This is part of the Script Manager 2.0. The interim chapter was on apple.com
> some time ago, but you will have to look and see if it is still
> there.

I found it on sumex (91511 Jun 22 1989 ./apple/doc/script-mgr-2-0.hqx)
after Michael Peirce posted the info that the script manager was
involved. I wrote an XCMD to read in the values last night--easy, once
you've got the docs. I still need to write an XCMD to set the values.
I may post them to comp.sys.mac.hypercard when they're done.

Thanks, Michael and Pete.

Len
--
------------------------------------------------------------------------
| Len Saaf, The Institute of Optics, Univ. of Rochester, Rochester, NY |
| Internet: saaf@joker.optics.rochester.edu        Bitnet: SAAF@UOROPT |
------------------------------------------------------------------------