CODE CLINIC #1: UP THE HILL...
-------------------------------------------------------INTRODUCTION
It seems like only yesterday, I was slaving away at C64 Basic
(1983) and knew that someday I would learn to write killer code; Then I
bought an A500 (1989) and began rewriting my 64Basic to AmigaBasic, again
I knew that someday I would write killer code.
I now own an A1200 and SAS/C 6.0 (waiting for my upgrade to 6.5).
I own several books with titles such as C by example and Teach yourself
C, and while these books are very helpful in learning the C language, you
will not be writing killer code by the end of the exercises.
In this column I will try to guide you "up the hill" to writing
killer C code. This column is not for beginners, it's assumed you have
an understanding of ANSI/C coding. If you don't, any bookstore will have
books such as the ones I listed above. I myself will be learning new
skills as we go "up the hill." Oh yeah, our goal is to reach the top.
-------------------------------------------------------------PREP
#include <stdio.h>
main()
{
printf("HelloWorld\n");
}
This is the first code every C programmer will learn. In this first
column we will `Amigatize' this code. Basically, when I say `amigatize' I
mean use Intuition. Intuition is defined in the ROM Kernel Manual-
Libraries as: the collective name for the function libraries, data
structures and other elements needed to create a graphical interface for
Amiga applications, AMIGATIZE!!!
How would you `amigatize' this simple program?
Here is a list of things we will do to make this an Amiga program.
o OPEN A WINDOW IN WORKBENCH WITH A
CLOSEGADGET TO END THE PROGRAM.
-----------------------------------------------------------LETS GO-
This article is intended for NEW Amiga C language coders.
Those of you who have genius IQ's, forgive us mere mortals.
OK, with all that out of the way lets' dive into some code!
*****------------------------- *****-------------------------
* N * ALL CODE IS INTENDED | * N * I COMPILED THIS CODE |
* O * FOR VERSION 2.0 OR | * O * WITH SAS/C V6.0 AND |
* T * ABOVE... | * T * HAD NO ERRORS OR |
* E * | * E * WARNINGS |
*****------------------------- *****-------------------------
.C..C.O.D.E..............................................................
#include <exec/types.h> /* THE INCLUDE FILES WE NEED */
#include <intuition/intuition.h> #include <intuition/intuitionbase.h>
#include <intuition/screens.h> #include <clib/exec_protos.h> #include
converted with guide2html by Kochtopf