[comp.sys.apollo] bitmap and image conversion programs

@gdt.bath.ac.uk (04/08/90)

The graphics programs made available by ROQUE OLIVEIRA
(oliveria@caen.engin.umich.edu) at freebie.engin.umich.edu
contain gpr calls of the following type...

       status_$t   status;

       gpr_$***(...,...,&status)

Why is status passed as &status?

I'm using SR9.7 (still, maybe this summer we'll "upgrade" :-)),
Apollo CC, Rev 5.50

All the domain_examples I've seen, pass status as plain status (for example) -
I know it seems right passing by address, but it doesn't work for me.

Could someone explain?

[ The progs. work if I take all the &'s out, and dereference character arrays,
  and put in a #if SR9 for the SR9 /sys/ins #include files. ]

[ I've got the recent bgc.pas converted to bgc.c if anyone is interested ]


Ta,
Martin

lambert@spectrum.eecs.unsw.oz (Tim Lambert) (04/09/90)

In article <1990Apr8.161841.14435@bath.ac.uk> @gdt.bath.ac.uk writes:

   The graphics programs made available by ROQUE OLIVEIRA
   (oliveria@caen.engin.umich.edu) at freebie.engin.umich.edu
   contain gpr calls of the following type...

	  status_$t   status;

	  gpr_$***(...,...,&status)

   Why is status passed as &status?

   I'm using SR9.7 (still, maybe this summer we'll "upgrade" :-)),
   Apollo CC, Rev 5.50

Because he's using
#include <apollo/gpr.h>
and not
#include /sys/ins/gpr.ins.c

Compare /sys/ins/gpr.ins.c

   std_$call void   gpr_$terminate ();

with /usr/include/apollo/gpr.h

   extern void gpr_$terminate (
       boolean            & delete_disp,    /*whether to delete dm frame */
       status_$t          * status);        /*returned status */

The std_$call makes all the arguments get passed by reference (so when you
say just status, the address gets passed), whereas the function prototype
says that status is passed by value so you need the more natural &status.

The function prototype is preferable since the types of arguments get
checked, but I don't think this exists in 9.7

   [ I've got the recent bgc.pas converted to bgc.c if anyone is interested ]

Wow! Does it work under 9.7? :-)

rees@dabo.ifs.umich.edu (Jim Rees) (04/09/90)

In article <1990Apr8.161841.14435@bath.ac.uk>, @gdt.bath.ac.uk writes:
> 
> The graphics programs made available by ROQUE OLIVEIRA
> (oliveria@caen.engin.umich.edu) at freebie.engin.umich.edu
> contain gpr calls of the following type...
> 
>        status_$t   status;
> 
>        gpr_$***(...,...,&status)
> 
> Why is status passed as &status?
> 

This is the way it's done with the new <apollo/*.h> include files, which use
ANSI C declarations.  It's much nicer than the old std_$call ("/sys/ins")
way, but you can't mix and match.  Code written for /sys/ins can't be used
with <apollo> without changing all the out params (as you have discovered).

> [ I've got the recent bgc.pas converted to bgc.c if anyone is interested ]

I am, but your article had a bad address on it "@gdt.bath.ac.uk" so I can't
mail to you.