From: hull@hao.ucar.edu (Howard Hull)
Subject: Manx Aztec C and minrexx
Keywords: AmigaLibDisk450 minrexx
Reply-To: hull@ncar.ucar.edu (Howard Hull)
Organization: High Altitude Observatory/NCAR, Boulder CO
Distribution: na
Date: Mon, 28 Sep 1992 03:27:17 GMT

Putting it in a nutshell, if you have any experience merging minrexx with
programs compiled under Manx Aztec C 5.2a, perhaps I could persuade you to
read on.  Otherwise, what follows will be for the curious...

I'm getting fairly close now to being able to release MemMometer v2.40, which
is an update to MemMometer2.20 on AmigaLibDisk 496.  It will have additional
trivial modifications to the menus to allow inclusion of some '040 board mem
areas, and it will (I hope) have an ARexx port to allow graphical examination
of selected memory areas via ARexx script command.  I took a look at SimpleRexx
and MinRexx to see which would be the easiest to port under Manx Aztec C 5.2a,
for the state of my MM v2.20 code.  While Michael Sinz included some worthwhile
documentation with SimpleRexx, it seemed to me to be a bit too Latticized to
convert easily to Aztec C.  So I went to work on Tom Rokicki's MinRexx.  I've
succeded in getting it to compile with the -DTALKTOREXX define set; the program
runs that way pretty much the same as it does without this -D directive.  But
at first pass, the ARexx doesn't seem to connect (running under AmigaDOS 2.04)
that it runs at all is at least encouraging.  However, there are some major
differences between the Manx and the SAS C environment; to wit, the minrexx
makefile, as it is used with the freedraw example is:
--------
CC=lc
OPT=-cus -v -O
CFLAGS=$(OPT) -DTALKTOREXX
LIBS=lib lib:lc.lib lib:lcm.lib lib:amiga.lib sc sd

.SUFFIXES: .o .c
.c.o:
		$(CC) $(CFLAGS) $*.c

all: freedraw

freedraw: freedraw.o minrexx.o
	blink from lib:c.o freedraw.o minrexx.o to freedraw $(LIBS)

clean:
	delete freedraw.o origfreedraw.o freedraw origfreedraw minrexx.o
--------
What are "lib" "sc" and "sd"?  Why does it need "amiga.lib"?
What I had to do to my Aztec makefile to get things to compile was
Assign LIB: HD1:Aztec/lib/libs  and then "make" with
--------
CC=cc
OPT=-o MM
CFLAGS= -DTALKTOREXX
LIBS= lib:c.lib lib:m.lib

.SUFFIXES: .o .c
.c.o:
        $(CC) $(CFLAGS) $*.c

all: MM

MM: mm.o mminit.o minrexx.o
    ln mm.o mminit.o minrexx.o $(LIBS) $(OPT)

mm.o: mm.h mm.c

mminit.o: mm.h mminit.c

minrexx.o: minrexx.c

clean:
    delete mm.o mminit.o minrexx.o mm
--------
I also had to modify several include directives, i.e., what for Lattice C
(in the file minrexx.h) was
--------
#include <proto/all.h>
#include <string.h>
#include <rexx/rxslib.h>
#include <rexx/rexx_protos.h>
#include <rexx/rexx_pragmas.h>
--------
became several more references under Aztec:
--------
#include <clib/all_protos.h>
#include <string.h>
#include <rexx/rxslib.h>
#include <rexx/errors.h>
#include <rexx/rexxio.h>
#include <rexx/storage.h>
#include <clib/rexxsyslib_protos.h>
#include <pragmas/rexxsyslib_lib.h>
--------
I don't know if I got them all, got too few, or got too many - except that
there were no linker complaints, so I must have whatever minrexx looks for.
However, when I invoke make, though all my code goes through ok, minrexx.c
has a tough time with Aztec, to wit:
--------
1> make
    cc -DTALKTOREXX mm.c
Aztec C68k/Amiga 5.2a Sep 25 1991 17:04:29
              Copyright 1991 by Manx Software Systems, Inc.
    cc -DTALKTOREXX mminit.c
Aztec C68k/Amiga 5.2a Sep 25 1991 17:04:29
              Copyright 1991 by Manx Software Systems, Inc.
    cc -DTALKTOREXX minrexx.c
Aztec C68k/Amiga 5.2a Sep 25 1991 17:04:29
              Copyright 1991 by Manx Software Systems, Inc.

      if (FindPort(s)[0m==NULL)
                    ^
minrexx.c:106: WARNING 124: invalid ptr/ptr expression: 
         rexxPort = CreatePort(s,[0m 0L) ;
                                ^
minrexx.c:107: WARNING 124: invalid ptr/ptr expression: 
            ((int (*)(struct RexxMessage *))(RexxMsg->rm_Args[1]))(RexxMsg) ;
                                                                          ^
minrexx.c:201: WARNING 124: invalid ptr/ptr expression: 
                  syncRexxCmd(RexxMsg->rm_Args[0], RexxMsg) ;
                                                 ^
minrexx.c:250: WARNING 124: invalid ptr/ptr expression: 
   return((RexxSysBase = (struct RxsLib *)OpenLibrary(RXSNAME, 0L)) != NULL) ;
                                                             ^
minrexx.c:287: WARNING 124: invalid ptr/ptr expression: 
             CreateRexxMsg(rexxPort, extension, rexxPort->mp_Node.ln_Name)) &&
                                              ^
minrexx.c:337: WARNING 124: invalid ptr/ptr expression: 
             CreateRexxMsg(rexxPort, extension, rexxPort->mp_Node.ln_Name)) &&
                                                                         ^
minrexx.c:337: WARNING 124: invalid ptr/ptr expression: 
             (RexxMsg->rm_Args[0] = CreateArgstring(s, (long)strlen(s)))) {
                                                     ^
minrexx.c:338: WARNING 124: invalid ptr/ptr expression: 
      if (rexxport = FindPort(RXSDIR)[0m)
                                    ^
minrexx.c:346: WARNING 124: invalid ptr/ptr expression: 
         secondary = (long)CreateArgstring(string, (long)strlen(string)) ;
                                                 ^
minrexx.c:423: WARNING 124: invalid ptr/ptr expression: 
    ln mm.o mminit.o minrexx.o lib:c.lib lib:m.lib -o MM
Aztec C68K Linker 5.2a  Sep  4 1991 12:07:03
Base: 000000   Code: 005938  Data: 0001a4  Udata: 001940  Total: 00741c
pass2 cleanup
1> 
--------
This is a 32 bit integer compile for Aztec.  My code will also compile c16.lib
and runs just fine that way too(but of course no -DTALKTOREXX for 16-bit ints).
As I said, even the 32-bit executable runs ok in so far as it's own functions.
However, try the trivialy edited example rexx script "version.mm" (below)
--------
/* This script gets the release version from the MemMometer executable */

options results

address 'mm' 'Version'

say result
--------
the result I get is
--------
+++ Error 13 in line 5: Host environment not found
Command returned 10/13: Host environment not found
--------
Which isn't too promising...
I can package up and send inquirers the MM v2.40 source code, since it will be
released PD anyway, if you're interested.  But, I can see where debug for this
beast is going to be labyrinthian, I think.  So if anyone has any advice for
minrexx and Aztec, send email, please!
						Best Regards,  Howard Hull
						hull@ncar.ucar.edu