home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
ST_USER
/
1990
/
USERSP90.MSA
/
TEXT_CLINIC.DOC
< prev
next >
Wrap
Text File
|
1990-07-25
|
5KB
|
125 lines
C L I N I C
In Mathew Lodge's Clinic this month there are questions
on C, the STE, as well as a guide to using GDOS fonts
Welcome to this second disk-based clinic. The change over to disk means that
you don't have to type the listings in any more - something you might
appreciate with the longer C listings being sent in. First of all, a short
question about the STE.
STE cookies?
============
There have been several rumours flying around about the 'Cookie Jar' feature of
the STE. David Hoggan (and I!) have the following query: "Atari's 'cookie jar'
(which contains information on the hardware internally and externally attached
to the STE). What is it, and can anybody get it to work?"
C for yourself
==============
The C language is proving popular with ST programmers, judging by the amount of
code that is sent to the clinic. This month I've had a few queries about C, the
first of which is from Simon May of Bury St. Edmunds, Suffolk.
"From the public domain, I've acquired Gulam (a UNIX like shell), and
Sozobon C. I'm currently trying to get the GULAM.PRG program to "auto" load in
medium resolution. The DESKTOP.INF file on the disk was saved in medium
resolution.
"If I put GULAM in the AUTO folder, it loads okay, but in low res. I've
tried a small C program to change resolution, then Pexec GULAM.PRG. The program
loads, but the screen display is complete garbage. A friend informs me that I
need a GEM start routine. What exactly would a this do, and could I easily
write one?
"Finally, I cannot output to the printer from C. I try to use the 'stdprn'
file handle with fprintf, but in Gulam the output appears on the screen, and
from the desktop my output just disappears."
Fontastic
=========
Andrew Brown of Wetherby in West Yorkshire wanted to use the font features of
Atari GDOS, but couldn't find any documentation. By burning a little midnight
oil and deciphering a few books, he came up with this description of how to use
fonts.
"You will of course need GDOS.PRG in your AUTO folder, and a correctly set
up ASSIGN.SYS file together with all the fonts you're going to use. After the
initial appl_init() call, you will need to determine the VDI graphics handle
for the screen, then load up all the fonts into memory, like this:
main()
{
int gr_handle, ap_id, dummy, font_count, font_index;
char name[35];
ap_id=appl_init();
gr_handle=graf_handle(&dummy,&dummy,&dummy,&dummy);
font_count=vst_load_fonts(gr_handle,1);
The variable, 'font-count', is the number of fonts successfully loaded from
disk. The actual number available for use is one greater than this because of
the permanently resident ROM 6x6 system font. To select a font, you need to do
the following VDI call:
vst_font(gr_handle,font_index);
Unfortunately, 'font_index' is not simply a number between one and the
number of fonts available. Each font has its own unique identification number
that has to be determined by the following VDI call:
font_index=vqt_name(gr_handle,number,&name[0]);
Here, 'number' is the 1 to n+1 number described above. This function also
returns the full name of the font in the character array 'name', that can be up
to 35 characters long. The font is now selected and can be used with v_gtext
and v_justified as normal. Manipulation with vst_effects, vst_height and so on
all work as normal.
The only other font function that merits a specific mention is this one:
vqt_font(gr_handle,&minADE,&maxADE,&distances[0],&maxwidth,&effects[0]);
The int variable 'minADE' is the lowest ASCII character in the font and
'maxADE' is the highest. The 'distances' array (five words) will be filled with
relative distances of the top, ascent, half, descent and bottom line from the
baseline, and 'maxwidth' is the width of the widest character in the font. The
five-word 'effects' array is filled with information telling you how GDOS makes
the characters italic, light, underlined and so on.
Finally, as your program exits, do not forget this call:
vst_unload_fonts(gr_handle,1);"
Winding down
============
Keep the letters coming - especially the solutions and comments on other
people's problems and ideas, but don't forget that the clinic depends on your
problems too! Remember to include your full name (or title, if preferred), and
give your phone number if possible.
If you have a listing longer than about 25 lines then please include it on
a disk - I don't have time to type long listings in. Putting the text of your
letter on disk is doubly helpful - First Word or First Word Plus format if
possible, but straight ASCII is fine.
If you are sending a complete program, then I also like to see it running
before putting it into the column, so please include a double-clickable version
of your program if at all possible. If you want the disk and/or listing back,
also include a stamped addressed envelope. No SAE, no disk.
Mathew Lodge
Programmer's Clinic
Maen Melin
Holmes Chapel Road
Lach Dennis
Northwich
Cheshire
CW9 7SZ