home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
c_news
/
07
/
cnews007.nws
< prev
Wrap
Text File
|
1988-05-29
|
28KB
|
605 lines
Volume 1, Number 7 30 May 1988
+---------------------------------------------------------------+
| |
| - C News - |
| |
| International |
| C Programming & Compiler Review |
| Newsletter |
| |
+---------------------------------------------------------------+
US Office:
Editor Barry Lynch
Technical Editor Marshall Presnell
Australian Office:
Editor David Nugent
Asst Editor Kevin Bergin
C News is published monthly by the C BBS as its official
newsletter. You are encouraged to submit articles for publication
in C News. Articles should be related to C programming and can be
Tutorials, reviews or articles of interest to the C programming
community. All Operating systems are fairly represented and this
newsletter shows no favoritism to any one in particular. Instruct-
ions on how to submit articles for publication is included on the
last page.
C News is the property of the C BBS and is Copyright 1988 by the
the C BBS. All rights are reserved and distribution is limited to
electronic distribution and personal printed copies. C News cannot
be resold at any profit, by any organization. All material enclosed
within the newsletter is the opinions of the writers and not the
C BBS or it's Sysop.
C News 1-07 30 May 1988
=================================================================
TABLE OF CONTENTS
=================================================================
1. EDITORIAL
The Heap: messages from the editor.................... 1
2. C Spot Run: A User Supported Library
by Todd Lehr .......................................... 2
3. Beginning C Functions
by Jack Hess ........................................ 5
4. NOTES
Article Submission Standards ............................. 8
Address's ............................................... 9
USER Response Form ....................................... 10
5. INDEX ................................................... 11
6. Distribution Points ..................................... 13
C News 1-07 Page 1 30 May 1988
================================================================
The Heap: Messages from the editor
================================================================
As you may notice, C News is later than usual with this issue.
This is due to a major event in my life, <House Purchase> that
caused all computer related activities to stop for the last month.
Now that the house is in order, I am desperately trying to get back
into the computers again. On the plate, are 1) get acquainted with
MSC Version 5.1 and the MS Editor, 2) Review the MS Version 2.0
Software Development kit, 3) a article on Software Copyrights, and
4) a review on a new project on the C BBS - a XENIX 386 BBS system
that supports Usenet and Fidonet. Hopefully, some of the articles
will be ready for Issue 8, which is scheduled for the end of June
at the moment.
So with that, I will leave and get back to the reading - That
I am so far behind on - of the backed up computer mag's. C U
in the next issue.
C News 1-07 Page 2 30 May 1988
================================================================
C Spot Run: A user supported library
================================================================
As a relatively new C programmer, one of the biggest
problems I had was the rewriting all the custom routines that I
had already written in Turbo Pascal. Fortunately for me, I
found C Spot Run, an excellent Shareware C Library, from New
Dimension Software, in Cherry Hill, NJ. (The address follows the
article). It contains functions for almost all aspects of
programming, and the source code is available from the author,
for a 50 dollar registration fee.
One of the main strengths of CSR is its data input
functions, with over 20 functions available, double that, if
you count their windowing counterparts. With this large
selection of input commands at your fingertips, CSR removes some
of the great drudgery in programming. These versatile routines
allow you to specify, field sizes, ranges, and default values.
There also are full line editing routines, that allow insertion,
deletion, and other manipulation of the input string. Modifying
these function calls to work in a window is as easy as adding a
"w" to the front of the function name, and inserting a window
identifer, this value is returned by the "wopen(...)" routine.
General Description of the Input Routines,
[w][f]inpt<type>[r][e][d](....)
| | | | | |
| | | | | +---> Allows default value to be
| | | | | specified
| | | | +------> Full Editing
| | | +---------> High/Low Range values
| | +-------------> Field Type (int or string)
| +----------------------> Allows field size argument
+-------------------------> Windowing Function Specifier
The windowing functions are easy to use, fast, and work extremely
well. Originally based on the "Windows for C" and "Windows BOSS"
C libraries, the functions should be familiar to users of those
packages.
CSR also has a rich assortment of screen I/O routines
with full color control, which also easily convert to use with
windows. Functions to place a string at and X,Y coordinate,
"putat(x,y,str)", or use a formatted output string
"putatf(x,y,frmt,str)" are included. The library also includes
string center and string center with formatted output,
"center(line,str), centerf(line,frmt,str)", as well as many other
character and cursor control functions. Also available are more
advanced routines, such as screen saving and restoring, functions
to draw boxes, screen scrolling, as well as many others. Another
C News 1-07 Page 3 30 May 1988
================================================================
C Spot Run: A user supported library
================================================================
helpful feature are the built in pop-up menu functions, in fact
there are two different types of menus. The first in a generic
pop-up which allows the specification of where to put the menu,
the border type, and a **char array of the menu options. The
options are automatically centered, as well as having formatting
options, such as horizontal lines, blank lines, and inactive
choices. The more advanced menu routine allow the passing of a
custom designed structure, from which the menu is then
constructed.
In addition to all the I/O routines, CSR also include
many functions not normally found in PD library packages. One
such example are the excellent timer functions. Routines are
included that allow the starting, stopping, and reading of 10
different timers, with accuracy of 1/10th of a second. There
also are sound functions included, providing background interrupt
driven sound, or "while you wait" sound. The main function is
"play(...)", which is identical to the BASIC PLAY function, thus
making the conversion of existing BASIC music routines much
easier. There also are some excellent directory management
routines, such as, "findfirst(...), findnext(...)" as well as a
built-in pop-up window that display a directory 36 files at a
time. Time and Date manipulation are also included in this
package, there are routines to convert date to and from a
integer serial number, as well as many other functions. There
are also primitive graphic and printer routines as well.
C Spot Run also comes with a few support programs,
CheckC, and Fline. CheckC is a curly brace, paren, quote,
comment checker. One drawback is that is doesn't support nested
comments. Fline is a program that takes a source file and copies
all lines that start in column 1, and put them in an output file.
Also included is an assembly language source shell, showing how
to write Assembly functions to interface with C. New Dimension
Software also wrote up a demo program that is included with
source.
Documentation is a very important part of a package such
as this, and CSR comes with a great set of docs. There is about
15 pages of explanations and notices, and following that is
about 250 pages of function descriptions. The description pages
are not numbered, so updates come with just the changed or new
description pages, which then can be inserted in proper order.
Also included is a Ascii chart, descriptions of the header files,
as well as a list of all the functions.
C News 1-07 Page 4 30 May 1988
================================================================
C Spot Run: A user supported library
================================================================
All in all I find the C Spot Run library to be an
excellent C library package, and from experience with the author
I know that it is, and will continue to be an excellently
supported package(The program is supported at the Pineland's
BBS, 107/414). If there are any complaints that I have it would
be that some of the OBJect files are very large, so use of one
function will add a large amount of overhead to your program.
Also CSR currently supports only TurboC and MSC 4.0, but with
the source code available to registered user this should not be
a major problem.
Author's Address
===========================
Bob Pritchett
New Dimension Software
23 Pawtucket Dr.
Cherry Hill, NJ 08003
===========================
Todd Lehr
Eastern C Board
107/335
C News 1-07 Page 5 30 May 1988
================================================================
Beginning C Functions: By Jack Hess
================================================================
While reading messages in the C ECHO net mail, I began to see
quite a few messages from beginning 'C' programmers requesting the
creation of a new ECHO devoted to beginning programmers. I too am
a beginner but, I do not agree with this, I feel we need the
experience and wisdom that the more seasoned programmers bring to
the ECHO. Though I don't agree with them, I do understand their
need. It can be quite intimidating at times, seeing some of the
questions and the code other programmers have posted in the ECHO,
and it seems embarrassing to ask some of the more basic programming
questions. Instead of creating a new ECHO, it is my hope that a new
section devoted to "Beginners Teaching Beginners", can be created in
the C Newsletter. This way beginners will be learning from someone
with their own perspective, or on their own level if you will. This
is the purpose of this article.
The question that's asked quite frequently by beginners is,
"What's the best way to clear the screen?". This depends on whether
or not anyone else will be using your program. The simplest way to
clear the screen is by using ANSI escape codes, but it requires any
system running the program to have ansi.sys loaded in the config.sys
file of their computer. This may not always be the case. It's simple
and requires only one line of code to clear the screen:
printf("%c[2J", 27); /* 27 is the non-printing ASCII code for ESCAPE */
OR
printf("\x1B[2J"); /* this is a variation of the same thing */
Another way to clear the screen is by using a call to the video
BIOS, contained in ROM on IBM PC compatible computers. This would
require that the computer the program is running on to be BIOS
compatible. This code is for a TURBO C compiler:
#include <dos.h>
void cls()
{
union REGS r; /* defined in dos.h header file */
r.h.ah=6; /* load ah register with screen SCROLL PAGE UP code */
r.h.al=0; /* al register = no. of lines to scroll, 0 = all */
r.h.ch=0; /* ch register = row of upper left corner of screen */
r.h.cl=0; /* cl register = column of upper left corner */
r.h.dh=24; /* dh register = row of lower right corner of screen */
r.h.dl=79; /* dl register = column of lower right corner */
r.h.bh=7; /* bh register = character attribute, 7 = NORMAL */
int86(0x10,&r,&r); /* call VIDEO BIOS INTERRUPT 10h */
}
C News 1-07 Page 6 30 May 1988
================================================================
Beginning C Functions: By Jack Hess
================================================================
It is not necessary to understand UNIONS or interrupts to use
this function, and it's pretty fast. Although this method is
frowned upon by more experienced programmers, my guess it's the
extra overhead of a call to the BIOS through an interrupt. So, it
was at this point that I decided to try my hand at a more inter-
mediate step up to mixing 'C' with assembly language. I wrote an
assembly language procedure to write zeros directly into video ram
on my display adapter. This is the fastest method possible to clear
the screen. By doing so I learned a great many new things; the
command line version of TURBO C, TCC, the linker, TLINK, and not
least of all, some assembly language. First I wrote the assembly
procedure with the MICROSOFT Macro Assembler V4.0, if you don't
have MASM you might try this with the SHAREWARE assembler, A86.
Although, I have not tried this, and cannot assure your success.
The first step is to compile the assembly source to an object module
by using:
MASM CLS.ASM,,;
The source code for the assembly procedure is:
;----------------------------------------------------------------------;
; FAST_CLS assembly procedure to be called from TURBO C V1.5 ;
; This procedure clears the screen by writing zeros directly into the ;
; screen buffer on the video adapter defined in variable "vid_mem".;
; This is the fastest way to clear the screen. ;
;----------------------------------------------------------------------;
PUBLIC _FAST_CLS ; This tells the linker your procedure can be
NAME FAST_CLS ; called from other modules ie. C source file
_TEXT SEGMENT BYTE PUBLIC 'CODE' ; Set up segment,
TURBO C specific
ASSUME CS:_TEXT
VID_MEM EQU 0B000h ; Segment for MONO display adapter
; change for your display type
; CGA = 0B800h
;------------------------------------------------------------------;
_FAST_CLS PROC NEAR
PUSH BP ; Save the BP register
MOV BP,SP ; Make BP point to top of stack
MOV AX,VID_MEM ; Point to mono display
MOV ES,AX ; Source = video adapter
MOV DI,0 ; Destination = upper left corner
MOV AX,0 ; Will fill buffer with zeros
MOV CX,2000 ; Number of characters to write
C News 1-07 Page 7 30 May 1988
================================================================
Beginning C Functions: By Jack Hess
================================================================
REP STOSW ; Fill screen buffer fast!
POP BP ; Restore BP register
RET ; Return to calling program
_FAST_CLS ENDP
;------------------------------------------------------------------;
_TEXT ENDS
END
This is the simplest method for mixing 'C' with assembly,
because there is no parameter passing involved, this procedure is
self contained. Maybe in a future article, we could discuss parameter
passing if there is an interest for this type of article. The leading
(_) underscore in the procedure name is necessary, so that it can be
recognized as an extern function, and be linked into the main 'C'
program at link time. When calling the function from your 'C' program
it is called by it's name only (ie. fast_cls();). The next step is to
compile your 'C' program that calls the fast_cls() function, by typing:
TCC -ms -c prog_name.c
This means compile the source code to an object module only (no linking),
using small memory model. The next step is to link your main 'C' program
with the assembly module, by typing:
TLINK lib\c0s prog_name cls, prog_name,,lib\cs
This will link your program, the assembly module, and the small memory
model library into an executable file call PROG_NAME.
I hope this has been of interest to you, and maybe you have learned a
few new topics in 'C'. I was once told in college that 10% of the
learning process is teaching to others, and I have certainly learned
a few things bringing it to you. I hope to be C'ing you in the future.
REFERENCES:
TURBO C Users Manual, Borland Int'l.
USING ASSEMBLY LANGUAGE, Allen L. Wyatt, QUE Publishing
SUPERCHARGING C WITH ASSEMBLY LANGUAGE, Harry R. Chesley &
Mitchell Waite, The Waite Group, Addison Wesley Publishing
ADVANCED TURBO C, Herbert Schildt, BORLAND-OSBORNE-McGRAW HILL
THE BITWORKS, Douglas Wiig, The Inputer magazine
Jack T. Hess
1213 Delores Dr.
Garland, Tx. 75040
(214) 414-1803 C News 1-07 Page 8 30 May 1988
================================================================
ARTICLE SUBMISSION STANDARDS AND ADDRESSES
================================================================
As I have repeatedly stated in this newsletter and previous
issues, I would like to see user-submitted articles, reviews or
questions. Listed below are the standards that should be
followed to make my job easier as an editor.
- Articles should be submitted in a ASCII non-formatted
file.
- If the article include code fragments as examples. Then
you can include the entire source file if you like for
inclusion with the newsletter.
- Book or magazine reviews should follow the same format,
that is outlined in this issue. The publisher, author,
title, and ISBN number are a must.
- Compiler/and or product reviews, should include the
version number and manufacture. If possible, reviews
should include a sample program with benchmarks.
If you have any questions you can contact me at the
address's included on the next page.
C News 1-07 Page 9 30 May 1988
================================================================
ADDRESSES
================================================================
The C BBS is located at:
C BBS
% BCL Limited
P.O. Box 9162
McLean VA, 22102
or you can send netmail to:
1:109/713
C News 1-07 Page 10 30 May 1988
================================================================
USER RESPONSE FORM:
================================================================
This form will be included as a regular feature in all future
issues of C NEWS.
What did you think of the content of this Issue? _____________
_______________________________________________________________
What improvements can you think of that would make C News a
better tool for the C Community?
_______________________________________________________________
_______________________________________________________________
What is your favorite section or sections? ___________________
_______________________________________________________________
What don't you like about C News? ____________________________
_______________________________________________________________
Additional Comments: _________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
C News 1-07 Page 11 30 May 1988
================================================================
INDEX
================================================================
Subject: Issue:
Articles:
Additional Comments of Filename Wild.. 6
Beginning C Functions 7
C Spot Run: A User Supported Library 7
Filename Wildcard Expansion in MSC 4
Integrated Environment: TC & QC 5
Talking with a Fossil 5
TurboC and Interrupts: A few Questions 2
Book Reviews:
C Chest: and other treasures. 6
C Database Development 1
C Programming Guide 1
C Programming Language 1
C Programmer's Guide to Serial Communications 3
C Programmer's Library 1
C Primer Plus 1
C the Complete Reference 2
Crafting C Tools for the IBM PC 2
Learning to Program in C 1
Microsoft C Programming on the IBM PC 1
MS-DOS Developer's Guide 4
Programming in Windows 3
Reliable Data Structures in C 1
TurboC: Memory Resident Utilities 5
TurboC Programmer's Reference Book 2
Compilers:
QuickC 1
Software Reviews:
Bplus11.arc 3
C_Dates.arc 4
Cdate.arc 4
Casm.arc 3
C-subr.arc 4
Docu.arc 3
Jcl-src.arc 4
Mscpopup.arc 3
Ndmake41.arc 4
C News 1-07 Page 12 30 May 1988
================================================================
INDEX
================================================================
Subject: Issue:
Software Reviews Cont:
Nuc-subr.arc 3
Prndoc.arc 6
Sed.arc 6
Shift_c.arc 4
Sysact11.arc 4
Tp_to_qc.arc 3
Xenixarc.arc 4
C News 1-07 Page 13 30 May 1988
================================================================
DISTRIBUTION POINTS
================================================================
Board Name Number Net/Node Sysop
United States
C BBS (703) 440-0240 1:109/713 Barry Lynch
Burke, VA
Jaz C-Scape (904) 724-1377 1:112/1027 Tom Evans
Jacksonville, FL
Links.BBS (916) 343-4422 1:119/13 Tom Baughman
Chico, CA
Eastern C Board (201) 247-6748 1:107/335 Todd Lehr
Rutgers1 (201) 932-4066 1:107/320 Michael Keyles
Rutgers, NJ
PTC Net (206) 757-4248 1:138/4 Arlen Fletcher
Washington, State
Canada
Another BBS System (416) 465-7752 1:148/208 Mark Bowman
Toronto, Canada
Europe
Fido_N1_1 31-8350-37156 2:500/1 Henk Wevers
The Netherlands
Australia
Alpha-Centuri BBS 011-61-3-874-3559 3:632/348 David Nugent