home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GRIPS 2: Government Rast…rocessing Software & Data
/
GRIPS_2.cdr
/
dos
/
imdisp
/
imgprog.doc
< prev
next >
Wrap
Text File
|
1989-05-14
|
38KB
|
888 lines
PROGRAMMERS MANUAL FOR IMAGE DISPLAY AND I/O ROUTINES
IMDISP is written in a modular way so that it is easy to change
it to work with different display devices or on other computers.
The code can also easily be adapted for use in other application
programs. There are device dependent image display modules,
general image display subroutines, image I/O routines, and image label
and command line parsing routines. The general purpose display routines
can draw lines, write text with different fonts, manipulate a cursor,
interactively adjust the palette, display histograms, etc.
The IMDISP system is written in the "C" computer langauge.
Model of Device Independent Image Display
The image display is modeled as having coordinates ranging from 1 to
"dispnl" from top to bottom and from 1 to "dispns" from left to right
(i.e. a line-sample space). There is one image plane that can take
on "numDN" values. There is assumed to be a lookup table to convert
those DN values into voltages for the red, green, and blue guns in the
monitor. There are "numshades" shades of each primary color for a total
of numshades**3 different colors. The palette is a table of numDN
entries, with each entry containing the three primary color intensities
on a scale from 0 to 255.
There are five global variables that define the display
characteristics and are set in the DISPDRIV module: dispnl, dispns,
numDN, numshades, OneScreen. There are two related contants:
MAXDISPNL and MAXDISPNS.
The cursor, text, and font global variables are in the DISPUTIL module.
The image control block constants and variables are in the IMAGEIO module.
Compiling and Linking Routines
This document describes the "C" language version of the IMDISP
system. The routines are written in Microsoft C version 5.1 on an
IBM AT compatible computer. The large memory module is used. There
is one module (dispsub.asm) written in 8086 assembly language for reasons
of execution speed.
The following commands are are used to compile and link the subroutines
and programs. They are contained in the COMPLINK.BAT file.
cl /AL /c dispio.c disputil.c fileio.c fileutil.c imageio.c imagutil.c
imdisp.c labutil.c memutil.c
masm dispsub.asm;
link/NOE imdisp+dispsub+dispio+disputil+fileio+filesel+imagutil+
imageio+labutil+memutil/stack:8000/exepack;
LIST OF PROGRAMS
IMDISP.C - Main program, help, command drivers.
DISPIO.C - Display on/off, read/write lines, pixels, palette.
DISPUTIL.C - Font, cursor, text and palette routines.
DISPSUB.ASM - Assembly language routines for EGA/PGA display.
FILEIO.C - MSDOS and CDROM file input/output routines.
FILEUTIL.C - File menu and wild card routines.
IMAGEIO.C - Image open/close/read routines.
IMAGUTIL.C - Palette, histogram, profile and stretch routines.
LABUTIL.C - Label parsing routines.
MEMUTIL.C - Special memory allocation routines (malloc/free).
-----------------------------------------------------------------
Routines for image display
--------------------------
Module: DISPIO
DisplayOn
DisplayOff
WritePalette (palette)
WritePixel (line, sample, DNvalue)
ReadPixel (line, sample, DNvalue)
DisplayLine (buffer, line, samp, ns)
ClearDisplay (DNvalue)
PutRefresh (buffer, line, ss, ns)
GetRefresh (buffer, line, ss, ns)
Module: DISPSUB
_putmem
_getmem
WritePixelEGA (line, samp, DN)
DisplayLineEGA (buffer, line, samp, ns)
int ClearDisplayEGA (DN,dispnl)
_PGAsend
_EGAinit (initializes special 480 line EGA mode).
Module: DISPUTIL
InitDisplay
ReadPalette (palette)
DrawLine (line1, sample1, line2, sample2, DNvalue)
DrawBox (line, samp, linesize, sampsize, DNvalue)
RemoveCursor
PlaceCursor (line, sample, DNvalue)
MoveCursor (line, sample)
Font (FontType)
DrawText (text, line, sample, height, angle, DNvalue)
LengthText (text, height, TextLength)
TypeText (text)
TypeTextLine (text)
AcceptText (string)
WriteText (text)
Module: IMAGUTIL
DiddlePalette (numcolors)
DisplayHistogram (histbuffer, numbins, minDN, maxDN)
Stretch (DNlow, DNhigh : Integer);
Profile
Routines for image and file Input/Output
----------------------------------------
Module: FILEUTIL
FileSel (selFilename)
Wildexp (argc, argv)
Module: IMAGEIO
OpenImage (filename, unit, IOmode, nl, ns, bitsperpix, status)
ReadLine (unit, buffer, line, ss, ns, status)
WriteLine (unit, buffer, line, ss, ns, status)
CloseImage (unit, status)
CheckStatus (status)
ConvertLine (inbuffer, outbuffer, inbits, outbits, ns, status)
Module: LABUTIL
GetLabelInteger (LabelBuf, Len, Keyword, default, value, flag)
GetLabelReal (LabelBuf, Len, Keyword, default, value, flag)
GetLabelString (LabelBuf, Len, Keyword, default, value, flag)
InterpretLabel (LabelBuf, Len, labelsize, nline, nsamp, bitsperpix,
reclen, lineheadbytes, DetachedFilename)
MakeLabel (LabelBuf, labelsize, nline, nsamp, bitsperpix, reclen)
GetCommand (CommandString, CommandList)
GetKeywordInteger (CommandString, Keyword, default, value, flag)
GetKeywordReal (CommandString, Keyword, default, value, flag)
GetKeywordString (CommandString, Keyword, default, value, flag)
Module: FILEIO
OpenFile (filename, unit, IOmode, blocksize, status)
ReadBlocks (unit, buffer, StartBlock, NumBlocks, BlocksRead, status)
WriteBlocks (unit, buffer, StartBlock, NumBlocks, status)
CloseFile (unit, status)
InitializeCD (status)
ReadBlocksCD (buffer, StartBlock, NumBlocks, status)
SUMMARY AND USE OF SUBROUTINES
/*** Module: DISPIO
DISPIO contains the device dependent display routines for
the Color Graphics Adapter (CGA), the Enhanced Graphics Adapter (EGA),
the Professional Graphics Adapter (PGA), and the Video Graphics Array
(VGA). The global variables that define the device are allocated and
initialized here.
***/
DisplayOn()
/*** DisplayOn figures out which display device is on the system and
then initializes for that device. The device is turned on.
The global variables that define the display characteristics
and the default color palette are initialized. The refresh
buffer is zeroed.
***/
DisplayOff()
/*** DisplayOff turns off the display device returning the screen
to text mode.
***/
WritePalette (coltab)
/*** WritePalette updates the display device palette with the
palette passed in coltab. coltab must be of type Color.
***/
WritePixel (line, sample, DN)
/*** WritePixel writes a pixel on the display screen.
Parameter type description
line integer The line coordinate of the pixel
sample integer The sample coordinate of the pixel
DN integer The DN value of the pixel
***/
ReadPixel (line, sample, p_DN)
/*** ReadPixel read a pixel value from the display screen.
Parameter type description
line integer The line coordinate of the pixel
sample integer The sample coordinate of the pixel
p_DN int ptr The DN value of the pixel is returned
***/
DisplayLine (buffer, line, sample, ns)
/*** DisplayLine writes a line of pixels on the display screen.
Parameter type description
buffer char ptr The array of pixel values
line integer The line coordinate of the first pixel
sample integer The sample coordinate of the first pixel
ns integer The number of pixels to display
***/
ClearDisplay (DN)
/*** ClearDisplay sets the whole display to a particular value.
Parameter type description
DN integer The DN value to set (usually 0)
***/
PutRefresh (buffer, line, ss, ns)
/*** PutRefresh stores a line of pixels in the refresh buffer.
Parameter type description
buffer char ptr The array of pixel values
line integer The line coordinate of the first pixel
sample integer The sample coordinate of the first pixel
ns integer The number of pixels to store
***/
GetRefresh (buffer, line, ss, ns)
/*** GetRefresh reads a line of pixels from the refresh buffer.
Parameter type description
buffer char ptr The receiving array of pixel values
line integer The line coordinate of the first pixel
sample integer The sample coordinate of the first pixel
ns integer The number of pixels to read
***/
--------------------------------------------------------------------------
/*** Module: DISPUTIL
Device Independant General Purpose Graphics Routines
Includes line drawing, text display, and cursor routines.
***/
InitDisplay()
/*** InitDisplay turns the display device on, loads the default palette,
initializes the global variables, and loads the font arrays.
***/
ReadPalette (coltab)
/*** ReadPalette returns the current color palette in coltab.
coltab is of type Color.
***/
DrawLine (x1, y1, x2, y2, color)
/*** DrawLine draws a line of pixels from the first point to the
second point with the desired DN value. Clipping is not performed.
Parameter Type Description
x1 int the line coordinate of the first point
y1 int the sample coordinate of the first point
x2 int the line coordinate of the second point
y2 int the sample coordinate of the second point
color int the DN value of the drawn pixels
***/
DrawBox (line, samp, lsize, ssize, color)
/*** DrawBox draws a solid rectangle on the screen.
Used for erasing parts of the screen.
Parameter Type Description
line int starting line coordinate of rectangle
samp int starting sample coordinate of rectangle
lsize int number of lines in rectangle
ssize int number of samples in rectangle
color int the DN value to draw the box
***/
Font (FontType)
/*** Font reads in the font file for type FontType and fills the
font arrays appropriately. If FontType = 0 the internal font file
is used instead. FontType = 5 reads in font file 005.FNT, etc.
The global variable thefont is set to the font number.
The format of a font file is a sequence of bytes. The first byte
is the number of characters defined in the font. For each
character there is the following: the ascii code, the number of
line strokes, the character width, and then the list of line strokes.
Each line stroke consists of three bytes: the pen motion, and the
x and y coordinate. The width, x, and y values are converted
back into character coordinates by subtracting 50 and dividing
by 100. The pen is 2 for pen down, and 3 for pen up.
***/
DrawText (text, line, sample, height, angle, DNvalue)
/*** DrawText draws a text string on the display using the
current font.
Parameter Type Description
text char ptr text string to display
line int line coordinate of lower left of first char
sample int sample coordinate of lower left of first char
height int height of characters in pixels
angle int angle in degrees ccw from positive sample direction
DNvalue int the DN value to draw the pixels in with
***/
LengthText (text, height, p_TextLength)
/*** LengthText finds the length in pixels of a given text string.
Parameter Type Description
text char ptr text string to display
height int height of characters in pixels
p_TextLength int ptr where to return length of string
***/
TypeText (TypeString)
/*** TypeText displays a line of text on the screen at the current
text location with a height of 15 pixels. The area is first erased.
The text position is advanced to the next position after the last
character.
Parameter Type Description
TypeString char ptr text string to display
***/
TypeTextLine (TypeString)
/*** TypeTextLine displays a line of text on the screen using TypeText.
The text position is advanced to the beginning of the next line.
Parameter Type Description
TypeString char ptr text string to display
***/
AcceptText (AcceptString)
/*** AcceptString gets a string from the keyboard. The characters
are echoed on the display screen using DrawText. The string is
terminated with a return (ascii 13). Backspace deleting is supported.
The text position is left at the beginning of the next line.
Parameter Type Description
AcceptString char ptr returned text string from user
***/
WriteText (text)
/*** WriteText writes out a line of text to the user. If there
is only one screen then the text is written on the image display.
Otherwise it is written to the terminal.
Parameter Type Description
text char ptr text string to display
***/
RemoveCursor()
/*** RemoveCursor removes the cursor, if it is on, from the display
screen, replacing the original pixel values.
***/
PlaceCursor (line, sample, cursDN)
/*** PlaceCursor puts the cursor, if it is not already on, on the
screen, while storing the original pixel values.
Parameter Type Description
line int the line coordinate to put the cursor at
sample int the sample coordinate to put the cursor at
cursDN int the DN value of the cursor
***/
MoveCursor (p_line, p_sample)
/*** MoveCursor performs the cursor mode operation.
The user moves the cursor around using the numeric keypad.
The cursor moves in discrete steps whose size can be changed.
The final cursor position is returned.
Parameter Type Description
p_line int ptr the cursor line coordinate
p_sample int ptr the cursor sample coordinate
***/
--------------------------------------------------------------------------
/*** Module: IMAGUTIL
Special Purpose Device Independant Display Routines
Contains high level display routines such as interactive palette
adjustment, histogram display, and image profile drawing.
***/
DiddlePalette (numdiddle)
/*** DiddlePalette performs interactive adjustment of the color
palette. A wedge of numdiddle DN values, from 0 to the maximum,
is displayed at the bottom of the screen, and the palette is
changed to have only numdiddle distinct shades. Then a loop
for user input is entered. The active color is the one in the
wedge with the small black box inside it.
The following is a list of commands:
Character Action
4 (6) move to next lower (higher) color in wedge
r (R) decrease (increase) amount of red one notch
g (G) decrease (increase) amount of green one notch
b (B) decrease (increase) amount of blue one notch
2 (8) decrease (increase) amount of all colors one notch
. exit from palette diddle mode
The wedge is erased after the user exits.
Parameter Type Description
numdiddle int number of colors in the wedge and resulting palette
***/
DisplayHistogram (histbuf, numbins, minDN, maxDN)
/*** DisplayHistogram diplays the passed histogram on the screen.
The third highest bin in the histogram is used to scale the
plot. The axes of the plot are labeled and annotated. The
number in each bin is indicated by the length of the line
drawn vertically from the axis.
Parameter Type Description
histbuf long int array the array of count values for each bin
numbins int the number of bins in the histogram
minDN int the minimum DN value in the histogram
maxDN int the maximum DN value in the histogram
***/
Stretch (DNlow, DNhigh)
/*** Stretch applies a linear gray scale ramp to the palette
starting with 0 at Dnlow and proceeding to 255 at DNhigh.
Parameter Type Description
DNlow int the starting DN value of the linear ramp
DNhigh int the ending DN value of the linear ramp
***/
Profile()
/*** Profile plots a profile of the pixel values between two points
on the screen. Cursor mode is used to select the two endpoints.
A line is drawn between the endpoints and a plot of DN value
versus distance along the line is made.
***/
--------------------------------------------------------------------------
/*** Module: IMAGEIO
Image I/O routines for labeled images
Includes routines for opening images, reading and writing
image lines, and converting pixel formats.
***/
OpenImage (filename, unit, IOmode, p_nline, p_nsamp, p_bitsperpix, status)
/*** OpenImage opens an image file either for reading or writing.
The size of the image and pixel format are returned if the file
is opened for reading. If the file is opened for writing
then the passed number of lines and samples and pixel format are
used for the new image. The unit number is used to refer to the
file in subsequent operations. If the file is opened for input
then the label processing routines will parse Vicar2 and PDS
labels and will prompt for user info if the image is unlabeled.
PDS detached labels are handled transparently in this routine.
If the file is for writing then a PDS label will be output.
An error is returned if there is insufficient room to dynamically
allocate the image buffer, or if there is a file error.
For images with pixel sizes less than a byte, each line is assumed
to start with a new byte.
Parameter Type In/out Description
filename char ptr in Name of image file to open
unit int in Unit number of image (0,1,2...)
IOmode char ptr in Access mode of file
("r..." for reading, "w..." for writing)
p_nline int ptr in/out The number of lines in the image
p_nsamp int ptr in/out The number of samples in the image
p_bitsperpix int ptr in/out The number of bits in a pixel (pixel format)
(16 for integer, 8 for byte,
4 for nibble, 1 for binary)
status char ptr out Return string with error message
(0 length string if no error)
***/
ReadLine (unit, buffer, line, ss, ns, status)
/*** ReadLine reads a line of pixels from the image into the user's
buffer. The reading is completely random access, the lines may
be read in any order; it is more efficient, however, to read lines
sequentially. Partial image lines may be read. The output data
is in the same format as the file (the convert routine may be
used to convert pixel formats).
Parameter Type In/out Description
unit int in Unit number of image (same as in open)
buffer char ptr out Buffer to receive pixels
line int in The number of the image line to read (1 is first)
ss int in The starting sample in the line
ns int in The number of samples to read into buffer
status char ptr out Return string with error message
(0 length string if no error)
***/
WriteLine (unit, buffer, line, ss, ns, status)
/*** WriteLine writes a line of pixels from the user buffer to the image.
Although the writing is buffered, completely random access will not
work; the image lines should be written sequentially.
Partial image lines may be written. The input data must be in the
same format as the file (no conversion is performed).
Parameter Type In/out Description
unit int in Unit number of image (same as in open)
buffer char ptr in Buffer of image pixels
line int in The number of the image line to write
ss int in The starting sample in the line
ns int in The number of samples to write from buffer
status char ptr out Return string with error message
(0 length string if no error)
***/
CloseImage (unit, status)
/*** CloseImage closes the image file. If the image is opened for
writing then the image buffer is first flushed.
Parameter Type In/out Description
unit int in Unit number of image (same as in open)
status char ptr out Return string with error message
(0 length string if no error)
***/
CheckStatus (status)
/*** CheckStatus checks the status string passed in. If there
is no error the routine returns, otherwise the error message
is printed to the terminal and the program is aborted.
***/
ConvertLine (inbuffer, outbuffer, inbits, outbits, ns, status)
/*** ConvertLine converts a line of pixels into a different format.
Parameter Type In/out Description
inbuffer char ptr in The input buffer of pixels
outbuffer char ptr out The output buffer of pixels
inbits int in The pixel format of the input buffer
outbits int in The pixel format of the output buffer
ns int in The number of samples to convert
status char ptr out Return string with error message
Conversions supported : outbits
1 4 8 16
inbits 1 . - . . . means supported
4 - . . .
8 . . . .
16 . . . .
***/
--------------------------------------------------------------------------
/*** Module: LABUTIL
Label Processing Routines
***/
GetLabelInteger (LabelBuf, LabelBufLen, Keyword, defaul, p_value, p_flag)
/*** GetLabelInteger returns the integer value following the keyword in the
label buffer. If the keyword is not there then the default value
is returned. The flag indicates whether the keyword is there.
Parameter Type In/out Description
LabelBuf char ptr in The buffer containing the label
LabelBufLen int in The length in bytes of the label buffer
Keyword char ptr in The keyword string to match
defaul int in The value to return if no keyword or value
p_value int ptr out The returned value
p_flag int ptr out The flag: -1 if no keyword match
0 if illegal value, 1 if keyword and value
***/
GetLabelReal (LabelBuf, LabelBufLen, Keyword, defaul, p_value, p_flag)
/*** GetLabelReal returns the real value following the keyword in the
label buffer. If the keyword is not there then the default value
is returned. The flag indicates whether the keyword is there.
Parameter Type In/out Description
LabelBuf char ptr in The buffer containing the label
LabelBufLen int in The length in bytes of the label buffer
Keyword char ptr in The keyword string to match
defaul float in The value to return if no keyword or value
p_value float ptr out The returned value
p_flag int ptr out The flag: -1 if no keyword match
0 if illegal value, 1 if keyword and value
***/
GetLabelString (LabelBuf, LabelBufLen, Keyword, defaul, value, p_flag)
/*** GetLabelString returns the string value following the keyword in the
label buffer. If the keyword is not there then the default value
is returned. The flag indicates whether the keyword is there.
Parameter Type In/out Description
LabelBuf char ptr in The buffer containing the label
LabelBufLen int in The length in bytes of the label buffer
Keyword char ptr in The keyword string to match
defaul char ptr in The value to return if no keyword or value
p_value char ptr out The returned value
p_flag int ptr out The flag: -1 if no keyword match
0 if illegal value, 1 if keyword and value
***/
InterpretLabel (buf, len, p_labelsize, p_nline, p_nsamp,
p_bitsperpix, p_reclen, p_lineheadbytes,
DetachedFileName)
/*** InterpretLabel interprets the label in the buffer to extract
the image information. First something is identified to determine
whether the image has a PDS label or a Vicar2 label or no label.
If the image is labeled then the appropriate keyword values are
extracted, otherwise the user is prompted for the into.
Parameter Type In/out Description
buf char ptr in The label buffer
len int in The length in bytes of the label buffer
p_labelsize int ptr out The size of the label or header to skip
p_nline int ptr out The number of lines in the image
p_nsamp int ptr out The number of samples in the image
p_bitsperpix int ptr out The pixel format (16,8,4,1)
p_reclen int ptr out The record length in bytes
p_lineheadbytes int ptr out The header bytes at beginning of each line
DetachedFileName char ptr out The name of the file of data
null string if no detached label
***/
MakeLabel (Buf, p_labelsize, nline, nsamp, bitsperpix, reclen)
/*** MakeLabel creates a PDS label in the buffer, having the appropriate
image parameters.
Parameter Type In/out Description
Buf char ptr out The label buffer
p_labelsize int ptr out The size of the label
nline int out The number of lines in the image
nsamp int out The number of samples in the image
bitsperpix int out The pixel format (16,8,4,1)
reclen int out The record length in bytes
***/
int GetCommand (CommandString, CommandList)
/*** GetCommand is an integer function that returns the number of
the command that is in the beginning of the CommandString parameter.
The command is assigned a number according to the list of
commands in the CommandList string parameter. The list of commands
should be in uppercase and have spaces between the commmand.
***/
GetKeywordInteger (CommandString, Keyword, defaul, p_value, p_flag)
/*** GetKeywordInteger scans the CommandString for the Keyword
and returns the value of the following integer.
Parameter Type In/out Description
CommandString char ptr in The command string to scan thru
Keyword char ptr in The keyword string to match
defaul int in The default value to return if
no keyword or illegal value
p_value int ptr out The returned value
p_flag int ptr out The flag: -1 for no keyword match
0 for keyword with no/bad value
1 for keyword and good value
***/
GetKeywordReal (CommandString, Keyword, defaul, p_value, p_flag)
/*** GetKeywordReal scans the CommandString for the Keyword
and returns the value of the following real.
Parameter Type In/out Description
CommandString char ptr in The command string to scan thru
Keyword char ptr in The keyword string to match
defaul float in The default value to return if
no keyword or illegal value
p_value float ptr out The returned value
p_flag int ptr out The flag: -1 for no keyword match
0 for keyword with no/bad value
1 for keyword and good value
***/
GetKeywordString (CommandString, Keyword, defaul, value, p_flag)
/*** GetKeywordString scans the CommandString for the Keyword
and returns the value of the following string.
Parameter Type In/out Description
CommandString char ptr in The command string to scan thru
Keyword char ptr in The keyword string to match
defaul char ptr in The default value to return if
no keyword or illegal value
p_value char ptr out The returned value
p_flag int ptr out The flag: -1 for no keyword match
0 for keyword with no/bad value
1 for keyword and good value
***/
--------------------------------------------------------------------------
/*** Module: FILEIO
Contains block level I/O routines for MS-DOS files.
***/
OpenFile (filename, unit, IOmode, p_blocksize, status)
/*** OpenFile opens a file with the given file name.
The file may be open for reading or writing.
If the file name begins with "CD:" then it is assumed to be an
absolute CD-ROM file on a non-standard CD-ROM. The file name is
of the form "CD:mm:ss:bb", where mm is the minute of the starting
sector, ss is the second, and bb is the block number within the second.
The logical blocksize to be used in the image I/O routines
is returned.
Parameter Type In/out Description
filename char ptr in File name string
unit int in Unit number (0,1,2...)
IOmode char ptr in "r..." for reading, 'w...' for writing
p_blocksize int ptr out The returned logical blocksize to use
status char ptr out The error message string
(0 length for no error)
***/
ReadBlocks (unit, buffer, startblock, numblocks, p_blocksread, status)
/*** ReadBlocks reads blocks from the file into the buffer.
Parameter Type In/out Description
unit int in Unit number from open
buffer char ptr out The output buffer of data
startblock long int in The starting logical block
numblocks int in The number of blocks to read
p_blocksread int ptr out The number of blocks actually read
status char ptr out The error message string
(0 length for no error)
***/
WriteBlocks (unit, buffer, startblock, numblocks, status)
/*** WriteBlocks writes blocks from the buffer to the file.
Parameter Type In/out Description
unit int in Unit number from open
buffer char ptr in The input buffer of data
startblock long int in The starting logical block
numblocks int in The number of blocks to write
status char ptr out The error message string
(0 length for no error)
***/
CloseFile (unit, status)
/*** CloseFile closes the file.
Parameter Type In/out Description
unit int in Unit number from open
status char ptr out The error message string
(0 length for no error)
***/
--------------------------------------------------------------------------
InitializeCD (p_PB_size, status)
/*** InitializeCD initializes the CD player and returns the
physical block size.
Parameter Type Description
p_PB_size int ptr The size of the physical blocks for this driver.
(in this case 2048 bytes)
status char ptr Error message string (0 length if no error)
***/
ReadBlocksCD (buffer, StartPB, NumPB, status)
/*** ReadBlocksCD reads blocks from the CD-ROM to the user's buffer.
Parameter Type Description
buffer char ptr Buffer to receive data
StartPB long int The starting absolute physical block
NumPB int The number of physical blocks to read
status char ptr Error message string (0 length if no error)
***/
--------------------------------------------------------------------------
Low Level Block I/O with MS-DOS for non-standard CD-ROM's
InitializeCD (p_PB_size, status)
/*** InitializeCD initializes the CD player and returns the
physical block size.
Parameter Type Description
p_PB_size int ptr The size of the physical blocks for this driver.
(in this case 2048 bytes)
status char ptr Error message string (0 length if no error)
***/
ReadBlocksCD (buffer, StartPB, NumPB, status)
/*** ReadBlocksCD reads blocks from the CD-ROM to the user's buffer.
Parameter Type Description
buffer char ptr Buffer to receive data
StartPB long int The starting absolute physical block
NumPB int The number of physical blocks to read
status char ptr Error message string (0 length if no error)
***/
--------------------------------------------------------------------
/*** Module: FILEUTIL
Contains file selection and wildcard expansion routines.
***/
int FileSel(selFilename)
/*** filesel -- allow user to browse directories and select image
files for display. Returns selected file name.
Parameter Type Description
selFilename char ptr filename selected for processing.
***/
wildexp(oargcp, oargvp)
/*** wildexp -- expand wildcard file name. Returns array of pointers
to filenames meeting wildcard specifications.
Parameter Type Description
oargcp int ptr pointer to number of values in oargvp
oargvp char ptr ptr ptr pointers to text strings containing
file names meeting wild card specification.
***/
Memory Allocation Procedures
Willard Gersbacher - CompuServe User ID: (76117,2611)
The procedures included in this archive provide functionally equivalent
memory allocation procedures for the main memory procedures used in C.
These procedures were written primarily because of a need to minimize
memory usage for a large program under development. The MSC 5.1
library procedures were not satisfactory for this application because
they did not release memory back to the system when it was 'free'ed.
Additionally, they tended to allocate too much memory under certain
circumstances which lead to a reduction in space available for other
programs and data which were currently active at the time.
These procedures should only be used with large data model programs
(i.e., compact, large, and huge memory models). No provision has been
made for small or medium model programs.
/* The following routines from the ALLOC.ARC distribution file
have all been incorporated in MEMUTIL.C */
free.c - Functional equivalent to free. Included in this
file is an additional procedure _ffree which calls
free.
malloc.c - Functional equivalent of malloc. This file also
contains the memory structures which are used to
keep track of the blocks of memory allocated. In
addition, the procedure _fmalloc is defined which
just makes a call to malloc.
memutil.c - This file contains a set of procedures which are
used by the main memory allocation procedures to
maintain the memory structure used to keep track of
the user allocations and frees.
reduceal.c - This procedure may be called to reduce the memory
allocated to a program. It attempts to release back
to DOS the memory not currently being used.
reducedd.c - This procedure may be called to reduce the default
data segment to the minimum size required. Normally
this should be called before any calls to memory
allocation procedures. Included in this file are
dummy procedures for _nmalloc and _nfree. These
latter procedures were included because some
of the MSC library uses the near heap for memory
allocation (even though you may be using large
data model programs). Since this procedure does
away with any space which might be used for near
heap allocation, this forces the procedures which
call them to use the 'far' heap.