home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!aplcen.apl.jhu.edu!ddsdx2.jhuapl.edu!dlc
- From: dlc@ddsdx2.jhuapl.edu (Dave Collard x7468)
- Subject: Re: pragma INTERFACE to MTH$RANDOM in DEC ADA?
- Message-ID: <1992Sep2.122928.22153@aplcen.apl.jhu.edu>
- Sender: news@aplcen.apl.jhu.edu (USENET News System)
- Organization: Johns Hopkins University
- References: <ELLIOTTM.92Sep2032817@beach.csulb.edu>
- Distribution: usa
- Date: Wed, 2 Sep 92 12:29:28 GMT
- Lines: 53
-
- In <ELLIOTTM.92Sep2032817@beach.csulb.edu> elliottm@beach.csulb.edu (Mike Elliott) writes:
-
- >I've gotten stuck trying to interface to the VMS math library routine
- >MTH$RANDOM, which takes the address of an integer seed as its argument, and
- >returns a FLOAT. Ada rightly complains if I declare my routine as a function
- >taking an in out INTEGER parameter, but my other attempts to trick DEC ADA into
- >iterfacing to this routine have also failed. They include
-
- > 1) declaring the function to take a parameter of type access INTEGER, which
- > points to an actual intger which can be changed (the INTEGER pointed to
- > remains immutable),
-
- > 2) declaring the function to take a parameter of type SYSTEM'ADDRESS, and
- > passing it the address of some integer (the INTEGER at said address
- > remains stubbornly unchanged).
-
- >I'm sure there's some way to do this, but my only two DEC ADA manuals shed no
- >light on how. They do illustrate how to interface to routines like MTH$SQRT,
- >which rightly take a parameter of type in FLOAT, and these attempts have been
- >successful.
- >--
-
- -- MTH$RANDOM
- --
- -- Random-Number Generator, Uniformly Distributed
- --
- -- The Random-Number Generator, Uniformly Distributed
- -- routine is a general random-number generator.
- --
-
- procedure RANDOM (
- RESULT : out FLOAT; -- return value
- SEED : in out UNSIGNED_LONGWORD);
-
- pragma INTERFACE (EXTERNAL, RANDOM);
-
- pragma IMPORT_VALUED_PROCEDURE (RANDOM, "mth$random",
- (FLOAT, UNSIGNED_LONGWORD),
- (VALUE, REFERENCE));
-
- this is the interface supplied by DEC. What version of Ada are you using?
- They supply an interface to everything in the math lib, just
-
- with MTH;
-
- look in ADA$PREDEFINED:MTH_.ADC for the spec. If you don't have this
- then you are working with a pretty old version of DEC Ada. If you can't
- find this, then email me.
-
-
- --Thor
- collard@capsrv.jhuapl.edu
- dlc@ddsdx2.jhuapl.edu
-