Benchmark Modula-2
11 messages in this thread
Aglet Modula-2 AmigaDOS V2.04 Interface
VERSION
1.0-040693
COMPANY / AUTHOR
Thomas Breeden
Aglet Software
Box 3314
Charlottesville, VA 22903
804-973-7058
email : CompuServe 75210,2424
Internet 75210.2424@compuserve.com
DESCRIPTION
The Aglet Modula-2 V2.04 Interface consists of over one hundred modules
providing the Benchmark (TM) Modula-2 programmer with a calling
interface to all of the Amiga system resident library functions
distributed with AmigaDOS v2.04, as well as definitions of all
system record structures and flags.
Note: This product has no connection with Avant-Garde software or
Leon Frenkel, the author of the Benchmark product.
These M2 interface DEFINITION MODULEs follow closely the C language
"includes" interface of ".h" file distributed by CATS.
The supplied modules replace the Amiga-specific modules delivered
(for AmigaDOS v1.2) with the original Benchmark compiler. Compatibility
is maintained with the rest of the Benchmark system, with the exception
of the "Simplified Amiga Library" add-on.
Source for all the DEFINITION and IMPLEMENTATION modules of the interface
is also included.
Also included is a program, DoIFace, which can be used to create a
similar interface for Benchmark programs to additional Amiga resident
libraries.
SPECIAL REQUIREMENTS
v2.04 AmigaDOS
Benchmark Modula-2 Compiler
PRICE
The package is available from me for US$ 35.00. Shipping is included
to destinations in the United States, Canada, and Mexico. For other
destinations, please add an additional US$ 3.00.
Residents of Virginia must add an additional 4.5% state sales tax
($1.58).
Please make your check or money order out to Thomas M. Breeden.
DISTRIBUTABILITY
Each distribution is copyrighted and licensed for a single computer.
Commodore copyrighted commentary material is distributed under an
"Includes Distribution License" from CATS.
README
A number of Test/Example programs are included, showing the usage of
many of the new features of AmigaDOS 2.04, such as public screens,
file notification, gadtools, asl, etc. (Otherwise, no specific
documentation on using AmigaDOS v2.04 is included.)
Two additional examples of interfacing to Amiga Resident Libraries
are included: 1) the AmigaGuide library from Commodore 2) the ISAM
library from RedShift Software.
——————————————————- AmigaDOS is a trademark
of Commodore-Amiga, Inc. Benchmark is a trademark of Avant-Garde Software.
Commodore (R) is a registered trademark of Commodore Electronics Limited. Amiga
is a registered trademark of Commodore-Amiga, Inc. CompuServe is a registered
trademark of CompuServe, Incorporated.
Thomas,
Will this interface also work with the M2Sprint Modula-2 compiler?
Gary
– via Whap!
Gary,
I wrote the M2 interface specifically for the Benchmark compiler. None of the
binaries will be any use for M2Sprint.
You might be able to make use of the DEFINITION file sources if you are going
to do the same thing for M2Sprint. There are some compiler assumptions there,
but they may be ok for M2Sprint as well. eg, INTEGER/CARDINAL/BITSET is 16 bits
SET OF <something with 8 or fewer items> is 8 bits
SET OF [0..31] is allowed
RECORD fields bigger than byte are word aligned
I can get you more details, if you'd like.
You might try getting in touch with Leon Frenkel in Plano, TX. Maybe he'd give
you a fire sale price on Benchmark.
Tom Breeden 75210,2424
Also note that while M2S follows the C= convention of passing pointers in
the Amiga libs, BM2 supplied libs generally pass the actual record
structure. For example:
M2S: PROCEDURE OpenScreen(newScreen:NewScreenPtr):ScreenPtr;
BM2: PROCEDURE OpenScreen(VAR newScreen:NewScreen):ScreenPtr;
The M2S way is preferred only because it's consistent with the way C folks
do things. How do you do it?
Tags are another matter entirely. How are they implemented?
— Art
Art –
(butting in here) Are you sure BM passes the whole structure? My
understanding of variable parameters vs. value parameters is that with
variable parameters only the address of the structure is pushed onto the
stack. In other words, your examples would be equivalent in what was put
on the stack, though not in what would be required by the parser to
compile (i.e., in the first case the address of a stack or global variable
_or_ a pointer to a memory-allocated area would do, whereas in the second
case only a stack or global variable could be passed).
I could always be wrong (it happens all the time 8^) ) but that's the
way I've always thought about it.
Harry
Art,
Harry is right. For the Benchmark, and probably just about any M2 compiler, a
VAR parameter will simply result in the passing of the address of the
parameter. So either way could be used.
using "VAR param:record" can result in fewer "ADR(param)" constructs in your M2
program. OTOH, it's a little dicey in the case that a C NULL address is
meaningful for the parameter. For Benchmark, and probably other compilers, you
can get away with "paramptr := NIL" and then passing "paramptr^". It's never
dereferenced, and so gets to the Library routine as 0.
In the Benchmark v2.04 interface, I generally used the VAR param:record
approach, since that is the one generally used in the earlier interface. In
cases where I knew that NIL would be often used, however, I declared it the
other way, "paramptr:recordptr".
Tags are really the same thing. C's variable number of parameters is not an
issue, since every tag based routine has a "A", array of tags, version. Using
M2's open arrays might be reasonable, but for efficiency I just declared the
tag array as "VAR t:TagItem", with the expectation that "t[0]" would be sent. A
"TagDone" tag will always end the tag array.
I left the .tiData field of the TagItem as LONGCARD. A type transfer has to be
used to assign a pointer into that field.
Tom Breeden 75210,2424
Art???????????
What are you saying?? the two calls are equivalent.
You all are right, of course. Both M2S and Benchmark put the same thing on the
stack whether passing pointers explicitly or using the VAR parameter. I was
speaking just about the conceptual approach. — Art
Thomas,
Care to do a version for M2 Sprint (also owned by AvantGarde)?
wmc – via Autopilot!
Wayne,
If I had the compiler, and enough time, I'd be game to do an M2 Sprint version.
As it is, however, I can't do it.
The sources of the DEFINITION modules for the Benchmark interface might be of
some help to any of you M2 Sprint users who want to roll your own. I'd be glad
to make as complete a list as I can of all the probable compiler- specific
things there. (You'll need a license from CBM if you redistribute their
material).
Tom Breeden 75210, 2424
Tom,
Thats a very generous offer, but I have my hands full with my business at
the moment. (e.g. I no longer have "free evenings" to pursue "hobbies"
like developing programs and such.)
I'll keep it in mind in case I come to my senses and decide to go work
for someone else. :^}
wmc – via Autopilot!