[comp.sys.atari.st] Shareware C Compiler Available

baron@transys.UUCP (03/31/87)

I recently ran across a shareware C compiler with assembler and limited 
libraries included.

If there is any interest in this ( it may have passed through here before )
I will be happy to arc and post it. It is about 90k arced and could be cut down
by leaving out a few things.

Please e-mail to me if you are interested in this.

I have used it and it works reasonably well.
It was authored by a fellow in New Jersey, here is the REAME file:


-----begin quote ------------
This disk contains a limited shareware C compiler for your use and enjoyment.
You should find a number of directories on this disk which contain the 
following files:

  bin
    cc.ttp	- translates C code to intermediate code
    as.ttp	- translates intermediate code to machine code
    hd.ttp	- hex dump utility
    cat.ttp	- file concatenation utility
    grep.ttp	- utility to search for a string in a file
    ss.ttp      - simple spreadsheet program
    ue.ttp	- public domain microEmacs editor 
    mkt.bat	- batch program to compile "x.c" into "x.ttp"
    mkp.bat	- batch program to compile "x.c" into "x.prg"
    obj.bat	- batch program to compile "x.c" into "x.s"

  lib
    prg.s	- startup intermediate code for .PRG programs
    ttp.s	- startup intermediate code for .TTP programs
    lib.a	- library used to create .TTP programs
    gem.a	- library used to create .PRG programs
    lib.c	- c code for lib.a
    gem.c       - c code for gem.a
    stdio.h	- standard i/o header
    gem.h	- header for GEM AES routines

  src
    ss.c	- source for a simple spreadsheet program
    cat.c	- source the file concatenation program
    grep.c	- source for the string search program
    hd.c        - source for the hex dump program

You will also find the following files in the root directory:

    rmd209.acc	- public domain ramdisk accessory
    command.tos	- public domain command line interpreter
    boot.bat	- copy tools into the ramdisk

The compiler (cc.ttp) is preprocessor, parser, and code generator all rolled
into a single program.  Please refer to the "C Programming Language" by K&R.
The compiler has the following features, limitations, and shortcomings:

  features
    - symbol names can be any length
    - built-in "trap" generator "trap(NUM, arg1, arg2, ...)"

  limitations
    - Only globals can be (very carefully) initialized.  No type checking 
      is done between the initializing value and the type of the global 
      being initialized.  This is crude but it works.  Accepted initializer
      values are (long or short) constant expressions, strings, and symbols.

  what's missing
    - type specifiers: float double auto static
    - goto and labels
    - preprocessor: #undef and the #if family
    - structure assignments

The output of the compiler is ascii text and each line maps into a 
single instruction.  This intermediate code is as terse as I can make it (to
save disk space) but is still readable (by me at least).  (I have plans to 
improve this to make things easier for an optimizer).  The output of the 
compiler is always placed in a file called "yc.out" in the current directory.
Any error messages are displayed on the screen.

The assembler (as.ttp) reads the intermediate code in a single pass and 
keeps everything in memory before generating the file "ya.out" in the 
current directory.  The size limit of the program to be compiled is basically
the size of the available memory.  The "ya.out" file should be renamed to 
one of the standard extensions (.TTP, .PRG, .TOS) before executing it.  
The command line of the assembler should always list a startup file 
first (see ttp.s or prg.s) then the intermediate files of the program, 
then "-L" followed by any libraries.  Any errors encountered by the 
assembler terminates assembly.  A "-M" argument to the assembler will 
generate an address map of all global symbols in the file "ya.map".

A library is simply intermediate code, but is handled differently by the 
assembler than regular intermediate code.  Intermediate code (the 
files before "-L") are read and processed directly; all symbols and
code are accepted without question.  A library is read without processing 
until a symbol is found that is needed but not defined.  From that point 
on, the library is read and processed until the next symbol is encountered.
At the next symbol, the "needed but not defined" test is applied again 
and processing or scanning continues as necessary.

The libraries include TOS, VDI, and AES routines taken from the Abacus books.
I plan to document the library routines later.  I have also included basic
<stdio.h> routines.  I have included the source for lib.a and gem.a (see
lib.c and gem.c).  A lot of library routines you would expect to see are
missing, and for that I apologize.

Creating .TTP programs is straightforward and better tested than .PRG (GEM) 
program creation.  In a .TTP process, the main function is called with 
the standard arguments:

	main(argc, argv) int argc; char *argv[];

Redirection of input and output using >outfile, >>appendfile, or <infile 
on the command line is handled by a startup routine linked into the 
compiled program.  Reads and writes to the screen are built to map '\n' 
to/from "\n\r".

Support for GEM programs (.PRG) is not completely debugged.  I have included
the GEM.A library but must honestly admit it is not yet ready.  Many of the
routines found in the Abacus books are present in the library.  The VDI
routines are working.  The window routines, form_alert, and evnt_multi
of AES are working.  My stumbling block right now is adequate documentation 
that would enable me to build a (working) Resource Construction Set.  
I'm working on it...

Let me give you an example of how I use these tools.  I normally place
everything I need in the ramdisk before I start using boot.bat.
I then start command.tos, use "path d:",  and insert a new working disk.  
I use microEmacs (ue.ttp) to create or edit C programs.  If I have a 
program contained in a single file, I use either mkt.bat or mkp.bat to 
compile and link a .TTP or .PRG program, respectively.  For example,

	mkt grep

will compile the program grep.c and create an executable called grep.ttp.
If the C program is contained in a number of files, I use obj.bat to create 
intermediate files having the same names as the C programs except for 
a .s extension.  I then write a link.bat that will combine all the 
intermediate files together along with the necessary libraries.  For example,

	d:as d:ttp.s main.s io.s calc.s display.s -L d:lib.a

would serve as a link.bat for a (mythical) spreadsheet program.

I bought my 520ST in April 1986.  Almost all the software I have is either 
public domain or shareware.  I have supported the shareware idea in the past,
but I'd like to see it happen for myself.  If you like what you find here,
please send a donation along with your name and address.  I'd like to run a
newsletter to discuss bugs, enhancements, and hints.  There is a lot 
I would like to do with this in the future.  Many of the limitations are
easy to fix, and I really do need a Resource Construction Set (if I can 
only figure out how to make object trees that work!).  I hope you enjoy
this software.  It is not for sale by anyone, and I reserve all rights 
to its ownership.  Feel free to pass it on to other ST owners, but please
pass on the whole disk, including this "readme" file.  I welcome any comments
you may have; send mail to:

	Mark A. Johnson
	85 Coleman Ave
	Red Bank, NJ 07701

paone@topaz.UUCP (04/01/87)

Post it!! Please.  I could use something other then Lattice for the
small programs that I wirte.

By the way, does anyone have a PD assembler out there?
-- 
Phil Paone
paone@topaz.rutgers.edu

"Admiral...There be whales here"

akw@osupyr.UUCP (04/01/87)

In article <315@transys.UUCP> baron@transys.UUCP (Joe Portman) writes:
>
>
>I recently ran across a shareware C compiler with assembler and limited 
>libraries included.
>
>If there is any interest in this ( it may have passed through here before )
>I will be happy to arc and post it. It is about 90k arced and could be cut down
>by leaving out a few things.

Dear Sir:

Post, POST, *POST!*



Andy Weaver / akw@osupyr.UUCP / 614.293.1195 or .292.1741
The Ohio State University / Columbus, OH / "Go Bucks."
"Like cold water to the bones, so is good news from a distant land." Prov25.25

Disclaimer:  If Ohio State knew I had UseNet access, they would probably
have to ask what exactly UseNet is. And how much they should charge.

jcs@odyssey.UUCP (04/02/87)

RE:
	>I recently ran across a shareware C compiler with assembler and limited 
	>libraries included.

Please, pretty please, POST IT!!!!