How to use the SAS C Compiler

SAS/C

Updated: 13 Sept 2018

The SAS C compiler was released by SAS Institute Inc in 1992. The product was originally called Lattice C. The last version of SAS C was 6.58. You can download latest latest patches from Aminet and the Unofficial SAS C Page.

Contents of SAS/C Package:

SAS/C Development System Quick Reference Guide
SAS/C Development System Library Reference
SAS/C Development System Users's Guide
SAS/C 6.50 Floppy Disks 1-6
SAS/C 6.51 Patch Disk

For more up to date includes and libraries, download and install the latest NDK3.9 .

SAS/C manuals are available from Archvie.org:
Volume 1: System user's Guide
System Library Reference

Old Lattice C 5 manuals are available:
Lattice C 5.10 Volume 1
Lattice C 5.10 Volume 2

Installation

Insert disk 1 and run Install_SAS_6.50 and follow the prompts to install the compiler, libraries and header files onto the hard disk or to three blank floppy disks.
It is possible (but not recommened) to run SAS/C from three working floppy disks although having multiple floppy drives is advisable.

Directories and folders

An SAS/C installation contains a number of directories and assigns needed for it to run.

SC: - The main installation folder and assign containing the programs, libraries, headers and sample code.
SC:C - The compiler program files (added to path)
LIB: - The SAS/C and Amiga link library files
INCLUDE: - The C compiler and amiga NDUK header files
CXXINCLUDE: - The C++ compiler header files

SAS/C Main Programs

SC - The SAS/C C Compiler
SE - The SAS/C Editor
SLINK - The library linker
ASM - The SAS/C 680x0 Assembler
SCOPTS - The SAS/C Options configuration tool
SMAKE - The SAS/C Make tool using smakefile project config
CPR - The SAS/C Source Debugger (CodeProbe)

How to create an SAS/C Project

The simplest method is to copy the starter_project folder from the SC folder to your development area on your hard disk. This contains the main project icons to write, build and create a SAS/C project:

Starter

Edit - Runs the SAS/C Editor to write C programs
Find - To search files for strings
Build - To compile and link SAS/C projects
Debug - To locate errors on your project
SCoptions - To configure project options

a. To begin, run Edit to enter or modify your C programs and should be save with a filename such as program.c or program.cxx if its a C++ program or program.h for a header file.

b. Run SCoptions to set the project's compiler and link options (see the sc help files for more information).

i. Select Linker options. Change from NoLink to Link.
ii. Change Startup from NoStartup to Startup =c.
iii. Click Save

c. Click on Build to compiler and link your project. It is possible to compile (F4) or build (R-Amiga-B) your project from within the editor.

SAS/C Makefile

For more complex projects with multiple source file, you need a makefile (or a smakefile in this case) which contains details of which files to include to compile, what lkbk libraries are required and what the final program file is called. You can use a simple command called mkmk which you can specify the input source files, what the target program is called.
e.g.

mkmk file1.c file2.c file3.c TARGET=progname

Here is a sample smakefile from the example code for Amproc
(I have added some remarks to explain the format):

# Amiprock smakefile

# List of C object files to include
OBJS= test.o amiproc.o

# List of final programs to create

all: simple test
# What to do to do a clean build.
# Delete object, link, map and gst file.

clean:
delete \#?.o \#?.lnk \#?.map \#?.gst simple test

# Compile instructions for 'simple' program

simple: simple.o amiproc.o
sc link to simple simple.o amiproc.o

# Compile instructions for 'test' program

test: test.o amiproc.o
sc link to test test.o amiproc.o

# Compile instructions for each source file and header

test.o: test.c amiproc.h

amiproc.o: amiproc.c amiproc.h

Amiga C Compilers - VBCC