microsoft quickc v1.0

This commit is contained in:
davidly 2024-07-01 15:54:38 -07:00
parent b584a463b0
commit c44895077c
100 changed files with 6004 additions and 0 deletions

View File

@ -0,0 +1,49 @@
/* fatal messages */
1001 "could not execute '%s'"
1002 "too many open files, cannot redirect '%s'"
1000 "UNKNOWN COMMAND LINE FATAL ERROR\n\t\tContact Microsoft Technical Support"
/* error messages */
2001 "too many symbols predefined with -D"
2002 "a previously defined model specification has been overridden"
2003 "missing source file name"
2007 "bad %s flag, would overwrite '%s' with '%s'"
2008 "too many %s flags, '%s'"
2009 "unknown option '%c' in '%s'"
2010 "unknown floating point option"
2011 "only one floating point model allowed"
2012 "too many linker flags on command line"
2013 "incomplete model specification"
/* 2014 "-ND not allowed with -Ad" */
2015 "assembly files are not handled"
2016 "-Gw and -ND %s are incompatible"
2017 "-Gw and -Au flags are incompatible"
2018 "cannot open linker cmd file"
2019 "cannot overwrite the source file, '%s'"
2020 "-Gc option requires extended keywords to be enabled (-Ze)"
2021 "invalid numerical argument '%s'"
2022 "cannot open help file, '%s'"
2023 "invalid model specification - small model only"
2000 "UNKNOWN COMMAND LINE ERROR\n\t\tContact Microsoft Technical Support"
/* warning messages */
4001 "listing has precedence over assembly output"
4002 "ignoring unknown flag '%s'"
4003 "80186/286 selected over 8086 for code generation"
4004 "optimizing for time over space"
4005 "could not execute '%s';\nPlease enter new file name (full path) or Ctrl-C to quit: "
4006 "only one of -P/-E/-EP allowed, -P selected"
4007 "-C ignored (must also specify -P or -E or -EP)"
4008 "non-standard model -- defaulting to large model libraries"
4009 "threshold only for far/huge data, ignored"
4010 "-Gp not implemented, ignored"
4011 "preprocessing overrides source listing"
4012 "function declarations override source listing"
4013 "combined listing has precedence over object listing"
4014 "invalid value %d for '%s'. Default %d is used"
4015 "different default models - defaulting to %s model"
4017 "conflicting stack checking options - stack checking disabled"
4000 "UNKNOWN COMMAND LINE WARNING\n\t\tContact Microsoft Technical Support"

View File

@ -0,0 +1,35 @@
#include <stdio.h>
#ifndef MWC
#include <string.h>
#include <stdlib.h>
#endif
#define DIGITS_TO_FIND 200 /*9009*/
int main() {
int N = DIGITS_TO_FIND;
int x = 0;
int a[ DIGITS_TO_FIND ];
int n;
for (n = N - 1; n > 0; --n) {
a[n] = 1;
}
a[1] = 2, a[0] = 0;
while (N > 9) {
n = N--;
while (--n) {
a[n] = x % n;
x = 10 * a[n-1] + x/n;
}
printf("%d", x);
}
printf( "\ndone\n" );
return 0;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,28 @@
There is a bug in IBM PC-DOS 3.20 which may cause improper operation of a
program if a floating point exception is generated. This patch to IBM
PC-DOS 3.20 is provided to insure proper operation of programs which may
generate floating point exceptions. In particular, the C runtime routine
signal with the SIGFPE parameter does not work with the unpatched version
of IBM PC-DOS 3.20. IBM has also made a patch for this problem available.
Procedure for patching IBM PC-DOS 3.20:
1. Use the DOS sys command to transfer IBMDOS.COM and IBMBIO.COM
to a writable diskette.
2. Copy command.com, sys.com and debug.com from your IBM DOS 3.20
diskette to the new diskette.
3. Copy stkpat.bat, stkpat.scr, rmrhs.exe and setrhs.exe from the
\patch directory to the new diskette.
4. Reboot the system from the new diskette.
5. Run stkpat.bat. This patches the IBMBIO.COM on the new diskette.
6. Use the DOS sys command to transfer the patch to any other
IBM PC-DOS 3.20 diskette.
If you are running any version of DOS 3.20 other than IBM PC-DOS 3.20, contact
your hardware manufacturer (OEM) to find out if the problem exists in your
DOS 3.20 version.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
echo This script will work only on drive a:
rmrhs
debug ibmbio.com <stkpat.scr
setrhs

View File

@ -0,0 +1,5 @@
a c48
jmp short c64
w
q

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,51 @@
QUICK C COMPILER OPTIONS
-MEMORY MODEL-
/AS small model (default)
/AC compact model
/AM medium model
/AL large model
-OPTIMIZATION-
/O enable optimization (same as /Ot)
/Od disable optimizations
/Ol enable loop optimizations
/Ox enable optimization (same as /Otl)
/Ot enable optimization
-CODE GENERATION-
/G0 8086 instructions (default)
/G2 286 instructions
/Gc Pascal style function calls
/Gs no stack checking
/Gt[number] data size threshold
-OUTPUT FILES-
/Fe<executable file>
/Fm[map file]
/Fo<object file>
-PREPROCESSOR-
/C don't strip comments
/D<name>[=text] define macro
/E preprocess to stdout
/EP same as /E but no #line
/I<name> add #include path
/P preprocess to file
/U<name> remove predefined macro
/u remove all predefined macros
/X ignore "standard places"
-LANGUAGE-
/Za disable extensions
/Zd line number information
/Ze enable extensions (default)
/Zi symbolic debugging information
/Zl remove default library info
/Zp pack structures
/Zq enable debug interrupts
/Zr enable pointer checking
/Zs syntax check only
-FLOATING POINT-
/FPi inline with emulator (default)
/FPi87 inline with 8087
-MISCELLANEOUS-
/c compile only, no link
/W<number> warning level
-LINKING-
/F<hex_number> stack size (hex. bytes)
/link [linker_options_and_libraries]

Binary file not shown.

View File

@ -0,0 +1,72 @@
/* The following functions are NOT in core */
/*
* Math and Standard library functions as of 9/2/87.
*/
_fheapchk _fheapset _fheapwalk
_nheapchk _nheapset _nheapwalk
_heapchk _heapset _heapwalk _lrotl _makepath
_lrotr _rotl _rotr _searchenv _splitpath
abs alloca asctime bsearch cgets
chsize clock cprintf cscanf ctime
daylight difftime div dup dup2
ecvt fcloseall fcvt fdopen fgetchar
fgetpos fputchar freopen fsetpos ftime
gcvt getpid getw gmtime inp
inpw labs ldiv lfind localtime
locking lsearch memicmp mktemp mktime
outp outpw perror putenv putw
qsort rand rename spawnlp spawnlpe
spawnvp srand stat strerror strnicmp
strtod strtol strtoul swab tempnam
umask ungetch utime
/*
* Floating point routines as of 7/2/87
*/
asin atan atan2 cabs
ceil cos cosh dieeetomsbin dmsbintoieee
exp fabs fieeetomsbin floor fmod
fmsbintoieee frexp hypot j0 j1
jn ldexp log log10 matherr
modf pow sin sinh sqrt
tan tanh y0 y1 yn
_clear87 _control87 _status87
/*
* New DOS Interface Functions as of 7/29/87
*/
_chain_intr _disable _dos_allocmem _dos_close _dos_creat
_dos_creatnew _dos_findfirst _dos_findnext _dos_freemem _dos_getdate
_dos_getdiskfree _dos_getdrive _dos_getfileattr
_dos_getftime _dos_getvect _dos_keep _dos_open
_dos_setblock _dos_setdate _dos_setdrive _dos_setfileattr
_dos_setftime _dos_settime _dos_setvect _enable
_harderr _hardresume _hardretn
/*
* New BIOS Interface Functions as of 7/29/87
*/
_bios_serialcom _bios_disk _bios_equiplist
_bios_keybrd _bios_memsize _bios_printer
_bios_timeofday
/*
* Graphics rouines as of 6/25/87
*/
$graphics
_arc _displaycursor _floodfill _getcolor _getfillmask
_getlinestyle _getphyscoord _gettextcolor _getvideoconfig _lineto
_outtext _putimage _remapallpalette _selectpalette _setbkcolor
_setcolor _setfillmask _setlogorg _settextcolor _settextwindow
_setviewport _wrapon _clearscreen _ellipse _getbkcolor
_getcurrentposition _getimage _getlogcoord _getpixel
_gettextposition _imagesize _moveto _pie
_rectangle _remappalette _setactivepage _setcliprgn
_setlinestyle _setpixel _settextposition _setvideomode _setvisualpage

View File

@ -0,0 +1,28 @@
#include <stdio.h>
main()
{
int i, done;
printf ("table of squares (every sixth number)\n");
printf ("\nfor loop\n");
printf ("number\t\tsquare\n");
for (i=0; i<= 20; i+=6)
printf ("%d\t\t%d\n",i, i*i);
printf ("\nwhile loop\n");
printf ("number\t\tsquare\n");
i = 0;
while (i <= 20) {
printf ("%d\t\t%d\n",i, i*i);
i += 6;
}
printf ("\nwhile (nonzero test expression version)\n");
printf ("number\t\tsquare\n");
i = 0;
done = 0;
while (!done) { /* will execute until done = 1 */
printf ("%d\t\t%d\n",i, i*i);
i += 6;
if (i > 20)
done = 1;
}
}

View File

@ -0,0 +1,34 @@
#include <stdio.h>
#include <ctype.h> /* needed to use conversion function toupper */
main()
{
char response [10];
char test_char;
printf ("Please enter your response (yes/no/quit): ");
scanf ("%s", response); /* formatted input into a string */
if (toupper(response[0]) == 'Q') { /* test for q */
printf ("program exit\n"); /* execute if equal to q */
exit(1);
}
switch (response[0]) { /* switch based on first character */
case 'y': /* multiple case labels */
case 'n':
printf ("lowercase y or n as first letter\n");
break;
default:
printf ("not a lowercase y or n as first letter\n");
break;
}
test_char = toupper(response[0]); /* convert to uppercase */
switch (test_char) {
case 'Y':
printf ("Response is yes\n");
break;
case 'N':
printf ("Response is no\n");
break;
default:
printf ("Please enter a yes or no\n");
}
}

View File

@ -0,0 +1,27 @@
#include <stdio.h> /* include standard header file */
typedef char * string; /* rename a char * type to string */
int strlen1 (string); /* function prototype */
/* declare & initialize test character array (string) */
char test_string [] = "This is a C string";
main()
{
int x;
x = strlen1 (test_string);
printf ("length (array method): %d\n",x);
}
/* array & subscript version */
strlen1 (s)
char s[];
{
int i = 0;
while (s[i] != '\0')
i++;
return (i);
}

View File

@ -0,0 +1,54 @@
#include <stdio.h> /* include standard header file */
typedef char * string; /* rename a char * type to string */
int strlen1 (string); /* function prototype */
/* declare & initialize test character array (string) */
char test_string [] = "This is a C string";
main()
{
int x;
x = strlen1 (test_string);
printf ("length (array method): %d\n",x);
x = strlen2 (test_string);
printf ("length (increment pointer method): %d\n",x);
x = strlen3 (test_string);
printf ("length (pointer subtraction method): %d\n",x);
}
/* array & subscript version */
strlen1 (s)
char s[];
{
int i = 0;
while (s[i] != '\0')
i++;
return (i);
}
/* pointer-incrementing version */
strlen2 (s)
char *s;
{
int i;
for (i=0; *s != '\0'; s++) /* increment pointer variable s */
i++;
return (i);
}
/* pointer-subtraction version */
strlen3 (s)
char *s;
{
char *p = s; /* set p to point to first character of s */
while (*p != '\0')
p++; /* advance to next character */
return (p-s);
}

View File

@ -0,0 +1,47 @@
#include <stdio.h>
#include <ctype.h>
main()
{
int number_compare ();
int string_compare ();
char s1[80], s2[80];
printf ("generic test for equality\n");
printf ("enter first item:\n");
gets (s1);
printf ("enter second item:\n");
gets (s2);
if (isalpha (*s1))
compare (s1, s2, string_compare); /* pass address */
else
compare (s1, s2, number_compare); /* pass address */
}
compare (a, b, compare_function)
char *a, *b;
/* pointer to function that returns an int */
int (*compare_function) ();
{
/* use indirection operator
to invoke correct compare function */
if ((*compare_function) (a,b))
printf ("equal\n");
else
printf ("not equal\n");
}
number_compare (a,b)
char *a, *b;
{
if (atoi (a) == atoi(b))
return (1);
else
return (0);
}
string_compare (a,b)
char *a, *b;
{
if (strcmp(a,b))
return (0);
else
return (1);
}

View File

@ -0,0 +1,14 @@
#include <stdio.h>
#include <time.h>
main()
{
struct tm *current_time;
time_t long_time; /* time value */
time (&long_time); /* get number of seconds into long_time */
/* convert to time structure */
current_time = localtime(&long_time);
/* use member-selection operator to access
individual element of structure */
printf ("hour: %d\n", current_time->tm_hour);
}

View File

@ -0,0 +1,21 @@
#include <stdio.h>
typedef char * string;
main()
{
char c, j;
int i;
string item1[10], item2[10];
float x;
printf ("please enter a single character:\n");
c = getchar();
printf ("\tthe character just input was -- %c\n",c);
printf ("\nenter a digit, a string, a float, and a string: ");
scanf ("%d %s %f %s", &i, item1, &x, item2);
printf ("\n\ayou entered\n");
printf ("%d\n%s\n%f\n%s", i, item1, x, item2);
printf ("\n\nexample of conversion specifications:\n");
printf ("decimal\toctal\thex\tcharacter\n");
for (j = 65; j<=70; j++)
printf ("%d\t%o\t%x\t%c\n", j,j,j,j);
}

View File

@ -0,0 +1,41 @@
#include <stdio.h>
#include <ctype.h>
main()
{
FILE *fopen(), *fp_in, *fp_out;
char fn_in[12], fn_out[12]; /* allow room for filename.ext */
printf ("enter name of input file: ");
scanf ("%s", fn_in);
printf ("enter name of output file: ");
scanf ("%s", fn_out);
fp_out = fopen (fn_out, "w");
fp_in = fopen (fn_in,"r");
/* check for nonexistent input file and exit if fopen failed */
if (fp_in == NULL) {
printf ("No input file %s\n",fn_in);
exit (1);
}
/* if fopen is OK then execute the rest of the program */
convert_file(fp_in,fp_out);
printf ("\nFile %s cleaned up\n",fn_in);
printf ("Output in file: %s\n",fn_out);
fclose (fp_in);
fclose (fp_out);
return (0);
}
convert_file (input,output)
FILE *input, *output;
{
int c;
/* get characters until EOF */
while ((c = getc (input)) != EOF){
if (isupper(c)) /* convert case */
c = tolower (c);
else
c = toupper (c);
fputc(c,output); /* print it to the output file */
}
}

View File

@ -0,0 +1,41 @@
#include <stdio.h>
#include <ctype.h>
main(argc,argv)
char *argv[];
int argc;
{
FILE *fopen(), *fp_in, *fp_out;
/* check for correct number of arguments */
if (argc != 3) {
printf ("correct usage is:\n");
printf ("c03_15b input-file output-file\n");
exit(0);
}
fp_out = fopen (argv[2], "w");
fp_in = fopen (argv[1],"r");
/* check for nonexistent input file and exit if fopen failed */
if (fp_in == NULL) {
printf ("input file error : %s\n",argv[1]);
exit (1);
}
/* if fopen is OK then execute the rest of the program */
convert_file(fp_in,fp_out);
printf ("\nFile %s converted\n",argv[1]);
printf ("Output in file: %s\n",argv[2]);
fclose (fp_in);
fclose (fp_out);
return (1);
}
convert_file (input,output)
FILE *input, *output;
{
int c;
/* get characters until EOF */
while ((c = getc (input)) != EOF){
if (isupper(c)) /* convert case */
c = tolower (c);
else
c = toupper (c);
fputc(c,output); /* print it to the output file */
}
}

View File

@ -0,0 +1,56 @@
#include <stdio.h>
#include <ctype.h>
#include <graph.h>
struct videoconfig vc; /* variable vc of type videoconfig */
/* define an array of video modes and mode names
since the numbers are not continuous */
int modes[12] = {_TEXTBW40, _TEXTC40, _TEXTBW80, _TEXTC80,
_MRES4COLOR, _MRESNOCOLOR, _HRESBW, _TEXTMONO,
_MRES16COLOR, _HRES16COLOR, _ERESNOCOLOR, _ERESCOLOR};
char *modenames[] = {"_TEXTBW40", "_TEXTC40", "_TEXTBW80",
"_TEXTC80", "_MRES4COLOR", "_MRESNOCOLOR",
"_HRESBW", "_TEXTMONO", "_MRES16COLOR",
"_HRES16COLOR","_ERESNOCOLOR","_ERESCOLOR" };
main()
{
int i;
/* test all video modes */
for (i=0; i<= 11; i++) {
if (!_setvideomode (modes[i])) { /* if _setvideomode fails */
_clearscreen (_GCLEARSCREEN);
_setvideomode (_DEFAULTMODE);
printf ("video mode:\t%s\n",modenames[i]);
printf ("This video mode is not supported\n");
printf ("Hit return for next video mode");
getchar();
}
else
{
_getvideoconfig (&vc);
printf ("\n video mode:\t%s\n",modenames[i]);
printf (" x pixels:\t%d\n",vc.numxpixels);
printf (" y pixels:\t%d\n",vc.numypixels);
printf (" text columns:\t%d\n",vc.numtextcols);
printf (" text rows:\t%d\n",vc.numtextrows);
printf (" # of colors:\t%d\n",vc.numcolors);
printf (" bits/pixel:\t%d\n",vc.bitsperpixel);
printf (" video pages:\t%d\n",vc.numvideopages);
printf (" mode:\t\t%d\n",vc.mode);
printf (" adapter:\t%d\n",vc.adapter);
printf (" monitor:\t%d\n",vc.monitor);
printf (" memory:\t%d\n",vc.memory);
printf (" Hit return for next video mode");
_setcolor (1);
_rectangle (_GBORDER,0,0,vc.numxpixels-5,vc.numypixels-5);
getchar();
_clearscreen (_GCLEARSCREEN);
}
}
_setvideomode (_DEFAULTMODE);
}

View File

@ -0,0 +1,25 @@
#include <stdio.h>
#include <graph.h>
char buffer [255];
main()
{
int i;
long int j, delay;
_setvideomode (_TEXTC80);
for (j=0; j<= 7; j++) {
_setbkcolor (j); /* background colors */
_settextposition (1,1);
printf ("bkcolor: %d\n", j);
for (i=0; i<= 15; i++) {
_settextcolor (i); /* text colors */
_settextposition (5+i,1);
sprintf (buffer, "Color: %d\n", i);
_outtext (buffer);
}
for (delay = 0; delay <= 200000; delay++); /* pause */
;
}
_clearscreen (_GCLEARSCREEN);
_setvideomode (_DEFAULTMODE);
}

View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <graph.h>
long bkcolor[8] = {_BLACK, _BLUE, _GREEN, _CYAN,
_RED, _MAGENTA, _BROWN, _WHITE};
char *bkcolor_name [] = {"_BLACK", "_BLUE", "_GREEN",
"_CYAN", "_RED", "_MAGENTA", "_BROWN", "_WHITE"};
main()
{
int i, j, k, delay;
_setvideomode (_MRES4COLOR); /* uses CGA color mode */
for (i=0; i<= 3; i++) {
_selectpalette (i);
for (k=0; k <= 7; k++) {
_setbkcolor (bkcolor[k]);
for (j=0; j<=3; j++) {
_settextposition (1,1);
printf ("background color: %8s\n", bkcolor_name[k]);
printf ("palette: %d\ncolor: %d\n",i,j);
_setcolor (j);
_rectangle (_GFILLINTERIOR,160,100,320,200);
for (delay=0; delay <= 20000; delay++)
;
}
}
}
_setvideomode (_DEFAULTMODE);
}

View File

@ -0,0 +1,29 @@
#include <stdio.h>
#include <graph.h>
main()
{
_setvideomode (_ERESCOLOR);
_settextposition (1,1); /* normal palette */
printf ("Normal palette\n");
printf ("Hit enter to change palette");
_setcolor (4); /* red in default palette */
_rectangle (_GFILLINTERIOR, 50,50,200,200);
getchar(); /* wait for Enter key */
_remappalette (4, _BLUE); /* make red into blue */
_settextposition (1,1);
printf ("Remapped palette\n");
printf ("Hit enter to change palette");
_setcolor (4); /* formerly red, now blue */
_rectangle (_GFILLINTERIOR, 50,50,200,200);
getchar(); /* wait for Enter key */
_remappalette (4, _RED); /* restore */
_settextposition (1,1);
printf ("Restored palette\n");
printf ("Hit enter to clear the screen");
_setcolor (4); /* red */
_rectangle (_GFILLINTERIOR,50,50,200,200);
getchar(); /* wait for Enter key */
_clearscreen (_GCLEARSCREEN);
_setvideomode (_DEFAULTMODE);
}

View File

@ -0,0 +1,50 @@
/* hyppix.c -- hypocycloid plotter (pixel version ) */
#include <stdio.h>
#include <graph.h>
#include <math.h>
#include <conio.h>
struct videoconfig vc;
char error_message [] = "This video mode is not supported";
main()
{
if (_setvideomode(_MRES4COLOR) == 0) {
printf ("%s\n", error_message);
exit(0);
}
_getvideoconfig (&vc);
hypcycle(); /* call drawing function */
_clearscreen(_GCLEARSCREEN);
_setvideomode (_DEFAULTMODE); /* restore video mode */
}
hypcycle()
{
float pi=3.14159; /* declare and initialize */
float a,h,b,r,x0,y0,x,y, ang;
int i;
x0 = vc.numxpixels/2 -1;
y0 = vc.numypixels/2 -1;
printf ("Enter circle ratio (>=1): ");
scanf ("%f", &r);
printf ("\nEnter pen position (>1): ");
scanf ("%f",&h);
_clearscreen(_GCLEARSCREEN);
_setcolor (1);
_moveto (x0,0); /* draw axes */
_lineto (x0,vc.numypixels);
_moveto (0,y0);
_lineto (vc.numxpixels,y0);
a = 0.5*r*vc.numypixels/(r+h-1);
b = a/r;
h = h*b;
_setcolor (2);
ang = 0;
while (!kbhit()) { /* draw hypocycloid */
for (i=1; i<= 20; i++) {
ang = ang + 2*pi/100;
x = x0+(a-b)*cos(ang)+h*cos(ang*(a-b)/b);
y = y0-(a-b)*sin(ang)+h*sin(ang*(a-b)/b);
_setpixel (x,y);
}
}
}

View File

@ -0,0 +1,24 @@
#include <stdio.h>
#include <graph.h>
char mask1 [] = {0,66,36,24,24,36,66,0}; /* two fill patterns */
char mask2 [] = {0,24,0,102,102,0,24,0};
char error_message [] = "This video mode is not supported";
main()
{
if (_setvideomode(_MRES4COLOR) == 0) {
printf ("%s\n", error_message);
exit(0);
}
_setfillmask (mask1);
_setcolor (1); /* use multiple colors */
_rectangle (_GBORDER,0,0,150,150);
_setcolor (2);
_floodfill (100,100,1); /* stop at border of color 1 */
_setcolor (3);
_setfillmask (mask2);
_floodfill (100,100,1);
getchar(); /* wait for carriage return */
_clearscreen(_GCLEARSCREEN);
_setvideomode (_DEFAULTMODE); /* restore video mode */
}

View File

@ -0,0 +1,70 @@
#include <malloc.h> /* needed for buffer use */
#include <stdio.h>
#include <graph.h>
#include <math.h>
#include <conio.h>
struct videoconfig vc;
char error_message [] = "This video mode is not supported";
char far *buffer; /* used with _getimage & _putimage */
main()
{
if (_setvideomode(_MRES4COLOR) == 0) {
printf ("%s\n", error_message);
exit(0);
}
_getvideoconfig (&vc);
draw_and_store_figure(); /* place figure in buffer */
_clearscreen (_GCLEARSCREEN);
hypcycle(); /* call drawing function */
_clearscreen(_GCLEARSCREEN);
_setvideomode (_DEFAULTMODE); /* restore video mode */
}
hypcycle()
{
float pi=3.14159; /* declare and initialize */
float a,h,b,r,x0,y0,x,y, ang;
int i;
x0 = vc.numxpixels/2 -1;
y0 = vc.numypixels/2 -1;
printf ("Enter circle ratio (>=1): ");
scanf ("%f", &r);
printf ("\nEnter pen position (>1): ");
scanf ("%f",&h);
_clearscreen(_GCLEARSCREEN);
_setcolor (1);
_moveto (x0,0); /* draw axes */
_lineto (x0,vc.numypixels);
_moveto (0,y0);
_lineto (vc.numxpixels,y0);
a = 0.5*r*vc.numypixels/(r+h-1);
b = a/r;
h = h*b;
_setcolor (2);
ang = 0;
while (!kbhit()) { /* draw hypocycloid */
for (i=1; i<= 20; i++) {
ang = ang + 2*pi/100;
x = x0+(a-b)*cos(ang)+h*cos(ang*(a-b)/b);
y = y0-(a-b)*sin(ang)+h*sin(ang*(a-b)/b);
_putimage (x,y,buffer,_GXOR);
}
}
}
draw_and_store_figure()
{
_setbkcolor (0L);
_setcolor (1);
_rectangle (_GBORDER,0,0,10,10);
_setcolor (2);
_rectangle (_GFILLINTERIOR,1,1,9,9);
_setcolor (3);
_moveto (1,1);
_lineto (9,9);
_moveto (1,9);
_lineto (9,1);
buffer=(char far *)malloc((unsigned int)_imagesize(0,0,10,10));
_getimage (0,0,10,10, buffer);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,923 @@
/*
GRDEMO.C - Demonstrates capabilities of the QuickC graphics library
Since this program uses functions not found in the QuickC core
library or the graphics library, you must use a program list to
compile in memory. Select Set Program List from the File menu
and enter GRDEMO as the program list name. Then specify GRDEMO
as the only entry in the program list.
An alternative is to create a quick library containing the routines
used in GRDEMO. Use the following lines to build the quick library
and load it into QuickC:
QLIB /s grdemo.c
QC /l grdemo.qlb grdemo
*/
#include <graph.h>
#include <string.h>
#include <math.h>
#include <bios.h>
/* Functions - prototypes and macros */
/* Demo functions */
void circles(void); /* Demo selections */
void sphere(void);
int polygons(void);
int spiral(int, int);
int inspiral(int, int, int);
void adjust(void);
int menu(int, int, char* []); /* Menus */
void box(int, int, int, int);
void itemize(int, int, char*, int);
int nextatrib(int); /* Color changes */
void nextcolor(void);
/* Turtle graphics routines */
/* Initiate and set defaults */
short setturtle(short);
void home(void);
/* Control pen and color */
int pendown(int);
short fillstate(short);
short penatrib(short);
short borderatrib(short);
/* Control angle */
short turn(short);
short turnto(short);
/* Turtle movement */
short move(short);
short moveto(short, short);
short poly(short, short);
/* Figures (defined as macros) */
/* Puts a circle with radius <r> at current location.
Returns nonzero if successful. */
#define circle(r) _ellipse(tc.isFill, \
tc.xCur-(r), adj(tc.yCur-(r)), tc.xCur+(r), adj(tc.yCur+(r)))
/* Puts an ellipse with width <w> and height <h> at current location.
Returns nonzero if successful. */
#define ellipse(w,h) _ellipse(tc.isFill, tc.xCur-((w)/2), \
adj(tc.yCur-((h)/2)), tc.xCur+((w)/2), adj(tc.yCur+((h)/2)))
/* Miscellaneous */
/* Fills starting at the current location.
Returns nonzero if successful. */
#define fillin() _floodfill(tc.xCur, adj(tc.yCur),tc.border)
/* Returns nonzero if the current location is onscreen. */
#define onscreen() (!((tc.xCur < -xMAX) || (tc.xCur > xMAX) || \
(tc.yCur < -yMAX) || (tc.yCur > yMAX)))
/* Returns a long int mixed from red <r>, green <g>, and blue <b> bytes. */
#define RGB(r,g,b) (((long) ((b) << 8 | (g)) << 8) | (r))
short adj(short);
unsigned cursor(unsigned);
/* Constants */
#define xMAX (tc.xCnt / 2)
#define yMAX (tc.yCnt / 2)
#define CIRCUMFERENCE 360
#define HALFCIRCUMFERENCE 180
#define PI 3.141593
#define DEFAULT -1
#define TRUE 1
#define FALSE 0
#define NULL 0
#define TCURSOROFF 0x2020
#define LASTATR 15
#define NLASTATR 14
/* Scan codes */
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
#define ENTER 28
/* Structures for configuration and other data */
struct videoconfig vc;
struct {
long xUnits, yUnits;
short xCnt, yCnt;
short xCur, yCur;
short angle;
short border;
short numAtribs;
short numColors;
short atrib;
short isPen;
short isFill;
} tc = { 125, 90 }; /* Initial values for aspect.
Change to adjust for your screen. */
/* Initial and work arrays for remapable colors. */
long iColors[] = {
_BLACK, _BLUE, _GREEN, _CYAN,
_RED, _MAGENTA, _BROWN, _WHITE,
_GRAY, _LIGHTBLUE, _LIGHTGREEN, _LIGHTCYAN,
_LIGHTRED, _LIGHTMAGENTA, _LIGHTYELLOW, _BRIGHTWHITE };
long wColors[256];
/* Array and enum for main menu */
char *mnuMain[] = {
"Quit",
"Circles",
"Sphere",
"Tunnel",
"Spiral",
"Inverted Spiral",
"Adjust Aspect",
"Change Mode",
NULL };
enum { QUIT, CIRCLES, SPHERE, TUNNEL, SPIRAL, INSPIRAL, ADJUST, CHANGE };
/* Arrays for video modes */
char *mnuModes[] = {
"MRES4COLOR ",
"MRESNOCOLOR",
"HRESBW",
"MRES16COLOR",
"HRES16COLOR",
"ERESCOLOR",
"VRES2COLOR",
"VRES16COLOR",
"MRES256COLOR",
NULL };
/* Array for modes */
int modes[] = {
_MRES4COLOR,
_MRESNOCOLOR,
_HRESBW,
_MRES16COLOR,
_HRES16COLOR,
_ERESCOLOR,
_VRES2COLOR,
_VRES16COLOR,
_MRES256COLOR,
_ERESNOCOLOR,
DEFAULT };
/* Structure for menu attributes (variables for color and monochrome) */
struct mnuAtr {
int fgNormal, fgSelect, fgBorder;
long bgNormal, bgSelect, bgBorder;
int centered;
char nw[2], ne[2], se[2], sw[2], ns[2], ew[2];
} menus = {
0, 15, 4,
3, 4, 3,
TRUE,
"\xda", "\xbf", "\xd9", "\xc0", "\xb3", "\xc4"
};
struct mnuAtr bwmenus = {
0x70, 0xf, 0x70,
0x7, 0x70, 0x7,
TRUE,
"\xda", "\xbf", "\xd9", "\xc0", "\xb3", "\xc4"
};
char mess1[] = {
"Graphics Demonstration Program" } ;
char mess2[] = {
"Move to menu selection with cursor keys, press ENTER to select" };
int lmess1 = sizeof(mess1), lmess2 = sizeof(mess2);
main ()
{
int choice, crow, ccol;
int tmode, vmode;
_getvideoconfig(&vc);
crow = vc.numtextrows / 2;
ccol = vc.numtextcols / 2;
/* Select best text and graphics modes and adjust menus */
switch (vc.adapter) {
case _MDPA :
puts("No graphics mode available.\n");
exit(0);
case _CGA :
mnuModes[3] = NULL;
vmode = _MRES4COLOR;
break;
case _EGA :
mnuModes[6] = NULL;
if (vc.memory > 64)
vmode = _ERESCOLOR;
else
vmode = _HRES16COLOR;
break;
case _VGA :
case _MCGA :
vmode = _MRES256COLOR;
break;
}
switch (vc.mode) {
case _TEXTBW80 :
menus = bwmenus;
case _TEXTBW40 :
_setvideomode(_TEXTBW80);
break;
case _TEXTC40 :
tmode = _TEXTC80;
break;
case _TEXTMONO :
case _ERESNOCOLOR :
menus = bwmenus;
tmode = _TEXTMONO;
vmode = _ERESNOCOLOR;
mnuMain[7] = NULL;
break;
default :
tmode = _TEXTC80;
}
_setvideomode(tmode);
srand(time(0L));
_settextposition(1,40 - (lmess1 / 2));
_outtext(mess1);
_settextposition(2,40 - (lmess2 / 2));
_outtext(mess2);
/* Select and branch to menu choices */
for (;;) {
choice = menu(crow,ccol,mnuMain);
setturtle(vmode);
switch (choice) {
case QUIT :
_setvideomode (_DEFAULTMODE); exit(0);
case CIRCLES :
circles(); break;
case SPHERE :
sphere(); break;
case TUNNEL :
nextatrib(0);
pendown(FALSE);
moveto(-xMAX * .3, yMAX * .3);
turn(35);
pendown(TRUE);
polygons();
while (!kbhit())
nextcolor();
break;
case SPIRAL :
nextatrib(0);
spiral((rand() % 50) + 30, (rand() % 4) + 1);
while (!kbhit())
nextcolor();
break;
case INSPIRAL :
nextatrib(0);
inspiral((rand() % 12) + 8, (rand() %20) + 2,
(rand() % 30) + 1);
while (!kbhit())
nextcolor();
break;
case ADJUST :
adjust();
_setvideomode(tmode);
continue;
case CHANGE :
for (;;) {
_setvideomode (tmode);
vmode = modes[menu(crow,ccol,mnuModes)];
if (!setturtle(vmode)) {
_settextposition(1,22);
_outtext("Mode not available on this machine.\n");
} else
break;
}
_setvideomode (tmode);
continue;
}
_bios_keybrd(_KEYBRD_READ);
_setvideomode (tmode);
}
}
/* Put circles of varying sizes and colors on screen in a round pattern */
void circles()
{
int i, x, y;
long tb;
tb = _getbkcolor();
if ((vc.mode < _HRESBW) || (vc.numcolors == 2))
fillstate(FALSE);
else {
fillstate(TRUE);
_setbkcolor(_BRIGHTWHITE);
}
pendown(FALSE);
for (;;) {
if (vc.numcolors <= 4)
nextcolor();
for (i = 5; i <= 150; ++i) { /* Draw circles */
x = (xMAX-30) * atan(sin(i / PI));
y = (yMAX-30) * atan(cos(i / PI));
penatrib(nextatrib(DEFAULT));
moveto(x,y);
circle (i % 30);
if (kbhit()) {
_setbkcolor(tb);
pendown(TRUE);
return;
}
}
}
}
/* Draw and fill sphere; rotate colors in EGA modes;
change palette in CGA modes */
void sphere()
{
int i, ix, x, y, border, inc;
y = x = tc.yCnt * 0.9;
fillstate(FALSE);
nextatrib(0);
inc = y / 14;
border = penatrib(DEFAULT);
borderatrib(border);
for (ix = inc; ix <= x; ix += (inc * 2)) /* Draw circles */
ellipse(ix, y);
fillstate(TRUE);
pendown(FALSE);
turn(90);
x /= 2;
moveto(-x + inc,0);
while (tc.xCur <= (x - inc)) { /* Fill circles */
penatrib(nextatrib(DEFAULT));
fillin();
move(inc);
}
while (!kbhit()) /* Rotate colors */
nextcolor();
pendown(TRUE);
}
/* Draw polygons of increasing size by incrementing the number of sides.
Return 1 for user interrupt, 0 for edge of screen encountered. */
int polygons()
{
int sides = 3, size = 2, atrib = 1;
for (;;) {
penatrib(nextatrib(atrib++ % NLASTATR));
if (!poly(sides++,size++))
return(0);
if (kbhit())
return(1);
}
}
/* Draw a spiral by increasing each side of a rotating figure.
<angle> determines tightness.
<inc> determines size.
Return 1 for user interrupt, 0 for edge of screen encountered. */
int spiral(angle, inc)
int angle, inc;
{
int side = 1, atrib = 1;
for (;;) {
penatrib(nextatrib(atrib++ % NLASTATR));
if (!move(side += inc))
return(0);
turn(angle);
if (kbhit())
return(1);
}
}
/* Draw an inverted spiral by increasing each angle of a rotating figure.
<side> determines size.
<angle> determines shape.
<inc> determines tightness and shape.
Return 1 for user interrupt, 0 for edge of screen encountered. */
int inspiral(side, angle, inc)
int side, angle, inc;
{
int atrib = 1;
for (;;) {
penatrib(nextatrib(atrib++ % NLASTATR));
if (!move(side))
return(0);
turn(angle += inc);
if (kbhit())
return(1);
}
}
/* Draw an adjustable circle to enable the user to visually adjust the
screen aspect. */
void adjust()
{
int i, y, pen, radius = yMAX * .6;
char buffer[3];
pen = penatrib(DEFAULT);
_outtext("Modify initial structure\nvalues in program");
_outtext("\n\nAdjust with cursor keys: ");
_outtext("\n UP - adjust up");
_outtext("\n DOWN - adjust down");
_outtext("\n ENTER - finished\n\n");
_outtext("xUnits 125\n");
for (;;) {
y = tc.yUnits;
penatrib(pen);
home();
pendown(FALSE); /* Draw white circle with cross. */
moveto(75,0);
circle(radius);
for (i = 1; i <= 4; i++) {
pendown(TRUE);
move(radius);
turn(180);
pendown(FALSE);
move(radius);
turn(90);
}
_settextposition(11,1); /* Show units and adjust */
_outtext("yUnits ");
ltoa(tc.yUnits,buffer,10);
_outtext(buffer);
_outtext(" ");
switch ((_bios_keybrd(_KEYBRD_READ) & 0xff00) >> 8) {
case UP :
--y;
break;
case DOWN :
++y;
break;
case ENTER :
tc.yUnits = y;
return;
}
penatrib(0); /* Erase circle with black */
moveto(75,0);
circle(radius);
for (i = 1; i <= 4; i++) {
pendown(TRUE);
move(radius);
turn(180);
pendown(FALSE);
move(radius);
turn(90);
}
tc.yUnits = y;
}
}
/* Put menu on screen.
Starting <row> and <column>.
Array of menu <items> strings.
Global structure variable <menus> determines:
Colors of border, normal items, and selected item.
Centered or left justfied.
Border characters.
Returns number of item selected. */
int menu(row, col, items)
int row, col;
char *items[];
{
int i, num, max = 2, prev, curr = 0, choice;
int litem[25];
long bcolor;
cursor(TCURSOROFF);
bcolor = _getbkcolor();
/* Count items, find longest, and put length of each in array */
for (num = 0; items[num]; num++) {
litem[num] = strlen(items[num]);
max = (litem[num] > max) ? litem[num] : max;
}
max += 2;
if (menus.centered) {
row -= num / 2;
col -= max / 2;
}
/* Draw menu box */
_settextcolor(menus.fgBorder);
_setbkcolor(menus.bgBorder);
box(row++,col++,num,max);
/* Put items in menu */
for (i = 0; i < num; ++i) {
if (i == curr) {
_settextcolor(menus.fgSelect);
_setbkcolor(menus.bgSelect);
} else {
_settextcolor(menus.fgNormal);
_setbkcolor(menus.bgNormal);
}
itemize(row+i,col,items[i],max - litem[i]);
}
/* Get selection */
for (;;) {
switch ((_bios_keybrd(_KEYBRD_READ) & 0xff00) >> 8) {
case UP :
prev = curr;
curr = (curr > 0) ? (--curr % num) : num-1;
break;
case DOWN :
prev = curr;
curr = (curr < num) ? (++curr % num) : 0;
break;
case ENTER :
_setbkcolor(bcolor);
return(curr);
default :
continue;
}
_settextcolor(menus.fgSelect);
_setbkcolor(menus.bgSelect);
itemize(row+curr,col,items[curr],max - litem[curr]);
_settextcolor(menus.fgNormal);
_setbkcolor(menus.bgNormal);
itemize(row+prev,col,items[prev],max - litem[prev]);
}
}
/* Draw menu box.
<row> and <col> are upper left of box.
<hi> and <wid> are height and width. */
void box(row, col, hi, wid)
int row, col, hi, wid;
{
int i;
char temp[80];
_settextposition(row,col);
temp[0] = *menus.nw;
memset(temp+1,*menus.ew,wid);
temp[wid+1] = *menus.ne;
temp[wid+2] = NULL;
_outtext(temp);
for (i = 1; i <= hi; ++i) {
_settextposition(row+i,col);
_outtext(menus.ns);
_settextposition(row+i,col+wid+1);
_outtext(menus.ns);
}
_settextposition(row+hi+1,col);
temp[0] = *menus.sw;
memset(temp+1,*menus.ew,wid);
temp[wid+1] = *menus.se;
temp[wid+2] = NULL;
_outtext(temp);
}
/* Put an item in menu.
<row> and <col> are left position.
<str> is the string item.
<len> is the number of blanks to fill. */
void itemize(row,col,str,len)
int row, col, len;
char str[];
{
char temp[80];
_settextposition(row,col);
_outtext(" ");
_outtext(str);
memset(temp,' ',len--);
temp[len] = NULL;
_outtext(temp);
}
/* Rotate to next color attribute.
<init> initializes new starting color.
(specify DEFAULT to rotate to next color)
Return rotated color attribute. */
int nextatrib(init)
int init;
{
static int atr;
if (vc.numcolors == 2)
return(atr = !atr);
if (!(init == DEFAULT))
atr = init;
return(atr = (atr % (tc.numAtribs-1) + 1));
}
/* Rotate to next palette array for EGA and higher.
Rotate palette for CGA color. */
void nextcolor(void)
{
static int co = 0;
int w, i;
if ((--co < 0) || (co >= tc.numColors - 1))
co = tc.numColors - 1;
w = co;
if (vc.adapter > _CGA) {
for (i = LASTATR-1; i > 0; --i) {
_remappalette(i, wColors[w]);
if (--w < 0)
w = tc.numColors - 1;
}
}
}
/* Set the display mode and establish turtle defaults.
<mode> is the mode to set.
Returns 0 if mode is invalid, else returns nonzero. */
short setturtle(mode)
short mode;
{
int ret, i = 0, btm, top = 63, inc, red = 0, green = 0, blue = 0;
float ratio;
_getvideoconfig(&vc);
if (mode < _MRES4COLOR)
return(0);
if (!(mode == vc.mode)) {
if(!(ret = _setvideomode(mode)))
return(0);
_getvideoconfig(&vc);
} else
ret = mode;
home();
switch (vc.mode) { /* Set palette defaults */
case _MRES256COLOR :
tc.numColors = tc.numAtribs = 125;
inc = btm = 12;
break;
case _ERESCOLOR :
case _VRES16COLOR :
/* For full 64 color palette, btm = 0; tc.numColors = 64 */
inc = btm = 16; tc.numColors = 27;
break;
case _MRES4COLOR :
case _MRESNOCOLOR :
inc = 32; btm = 0; tc.numColors = 8;
break;
default:
tc.numColors = 16;
memcpy(wColors,iColors,16 * sizeof(iColors[0]));
_remapallpalette(iColors);
return(ret);
}
/* Fill palette arrays */
for (blue = btm; blue <= top; blue += inc)
for (green = btm; green <= top; green += inc)
for (red = btm; red <= top; red += inc)
wColors[i++] = RGB(red, green, blue);
nextcolor();
return(ret);
}
/* Sets initial turtle parameters. Use to reset without changing mode. */
void home()
{
float ratio;
if (vc.mode == _MRES256COLOR)
tc.numAtribs = 125;
else
tc.numAtribs = vc.numcolors;
tc.xCnt = vc.numxpixels;
tc.yCnt = vc.numypixels;
_setlogorg(tc.xCnt / 2, tc.yCnt / 2);
ratio = (float)(tc.xUnits * tc.yCnt) / (tc.yUnits * tc.xCnt);
tc.yCnt /= ratio;
tc.xCur = 0;
tc.yCur = 0;
tc.isPen = 1;
_moveto(0, 0);
tc.angle = 0;
_remappalette(LASTATR,_BRIGHTWHITE);
borderatrib(LASTATR);
penatrib(LASTATR);
fillstate(_GBORDER);
}
/* Makes the turtle pen used in move() and moveto() visible or invisible.
<state> can be TRUE (visible), FALSE (invisible),
or DEFAULT (return current)
Returns current state. */
int pendown(state)
int state;
{
switch (state) {
case TRUE:
tc.isPen = TRUE;
break;
case FALSE:
tc.isPen = FALSE;
}
return(tc.isPen);
}
/* Determines whether figures should be filled.
<state> can be TRUE (fill), FALSE (border only),
or DEFAULT (return current)
Returns current state. */
short fillstate(state)
short state;
{
switch (state) {
case _GBORDER:
case FALSE:
tc.isFill = _GBORDER;
break;
case _GFILLINTERIOR:
case TRUE:
tc.isFill = _GFILLINTERIOR;
}
return(tc.isFill);
}
/* Sets the color attribute of the pen.
<atrib> is new atribute (use DEFAULT to get current).
Returns current color attribute. */
short penatrib(atrib)
short atrib;
{
if (!(atrib == DEFAULT)) {
_setcolor(tc.atrib = atrib);
}
return(tc.atrib);
}
/* Sets the color attribute to be used as a boundary in fills.
<border> is new border (use DEFAULT to get current).
Returns border attribute. */
short borderatrib(border)
short border;
{
if (!(border == DEFAULT))
tc.border = border;
return(tc.border);
}
/* Sets a new turtle <angle> relative to the current angle.
Returns the new angle. */
short turn(angle)
short angle;
{
return(tc.angle = ((tc.angle + angle) % CIRCUMFERENCE));
}
/* Sets a specified turtle <angle>.
Returns the new angle. */
short turnto(angle)
short angle;
{
return(tc.angle = (angle % CIRCUMFERENCE));
}
/* Moves from the current position in the current direction. A line is
drawn if the pen is down. The current position is reset.
<distance> is the adjusted length of line.
Returns 0 if the new position is off the screen. */
short move(distance)
short distance;
{
short dX, dY, ret;
double workangle;
workangle = (tc.angle - 90) * PI / HALFCIRCUMFERENCE;
dX = distance * cos(workangle);
dY = distance * sin(workangle);
if (tc.isPen)
_lineto(tc.xCur + dX, adj(tc.yCur + dY));
else
_moveto(tc.xCur + dX, adj(tc.yCur + dY));
tc.xCur += dX;
tc.yCur += dY;
return(onscreen());
}
/* Moves from the current position to a specified position. A line is
drawn if the pen is down. The current position is reset.
<x> and <y> are destination coordinates.
Returns 0 if new position is off screen. */
short moveto(x, y)
short x, y;
{
if (tc.isPen)
_lineto(x, adj(y));
else
_moveto(x, adj(y));
tc.xCur = x;
tc.yCur = y;
return(onscreen());
}
/* Draws a polygon
<number> specifies how many sides.
<side> specifies the length of each side.
Returns 0 if any part of polygon is off screen. */
short poly(number,side)
short number, side;
{
int i, ret = 1;
double angle;
angle = 360 / number;
for (i = 1; i <= number; ++i) {
ret = move(side) && ret;
turn(angle);
}
return(ret);
}
/* Adjusts a specified <y> value for screen aspect.
Returns the new value. */
short adj(y)
short y;
{
if (y)
y = (y * (tc.xUnits*vc.numypixels)) / (tc.yUnits*vc.numxpixels);
return(y);
}
/* Change the cursor shape.
<value> has starting line in upper byte, ending line in lower byte.
Returns the previous cursor value. */
unsigned cursor(value)
unsigned value;
{
union REGS inregs, outregs;
int ret;
inregs.h.ah = 3; /* Get old cursor */
inregs.h.bh = 0;
int86(0x10,&inregs,&outregs);
ret = outregs.x.cx;
inregs.h.ah = 1; /* Set new cursor */
inregs.x.cx = value;
int86(0x10,&inregs,&outregs);
return(ret);
}

View File

@ -0,0 +1,2 @@
files=20
buffers=10

View File

@ -0,0 +1,3 @@
set INCLUDE=..\include
set LIB=..\lib
set TMP=..\tmp

Binary file not shown.

View File

@ -0,0 +1,35 @@
/* sieve.c */
/* Eratosthenes Sieve Prime Number Program in C from Byte Jan 1983
to compare the speed. */
#include <stdio.h>
#define TRUE 1
#define FALSE 0
#define SIZE 8190
typedef int bool;
char flags[SIZE+1];
int main()
{
int i,k;
int prime,count,iter;
for (iter = 1; iter <= 10; iter++) { /* do program 10 times */
count = 0; /* initialize prime counter */
for (i = 0; i <= SIZE; i++) /* set all flags TRUE */
flags[i] = TRUE;
for (i = 0; i <= SIZE; i++) {
if (flags[i]) { /* found a prime */
prime = i + i + 3; /* twice index + 3 */
for (k = i + prime; k <= SIZE; k += prime)
flags[k] = FALSE; /* kill all multiples */
count++; /* primes found */
}
}
}
printf("%d primes.\n",count); /*primes found in 10th pass */
return 0;
}

View File

@ -0,0 +1,165 @@
#include <stdio.h>
#ifdef AZTEC86
#include <stdlib.h>
#endif
#ifdef HISOFTC
#include <stdlib.h>
#endif
#ifdef WATCOM
#include <malloc.h>
#include <process.h>
#endif
#ifdef powerc
#define allocs 50
#else
#ifdef HISOFTC
#define allocs 66 /* not enough RAM with hisoft to go higher */
#else
/* most c runtimes work up to 69, but use 66 to have a consistent benchmark */
#define allocs 66
#endif
#endif
int logging = 1;
char * memset_x( p, v, c ) char * p; int v; int c;
{
unsigned char * pc = (unsigned char *) p;
unsigned char val = (unsigned char) ( v & 0xff );
int i;
if ( 0 == p )
{
printf( "request to memset a null pointer\n" );
exit( 1 );
}
if ( logging )
#ifdef CPMTIME
printf( " memset p %u, v %d, val %x, c %d\n", p, v, val, c );
#else
#ifdef HISOFTC
printf( " memset p %u, v %d, val %x, c %d\n", p, v, val, c );
#else
printf( " memset p %p, v %d, val %x, c %d\n", p, v, val, c );
#endif
#endif
for ( i = 0; i < c; i++ )
*pc++ = val;
return p;
}
void chkmem( p, v, c ) char * p; int v; int c;
{
unsigned char * pc = (unsigned char *) p;
unsigned char val = (unsigned char) ( v & 0xff );
int i;
if ( 0 == p )
{
printf( "request to chkmem a null pointer\n" );
exit( 1 );
}
for ( i = 0; i < c; i++ )
{
if ( *pc != val )
{
#ifdef CPMTIME
printf( "memory isn't as expected! p %u, v %d, c %d, *pc %d\n",p, v, c, *pc );
#else
printf( "memory isn't as expected! p %p, v %d, c %d, *pc %d\n",p, v, c, *pc );
#endif
exit( 1 );
}
pc++;
}
}
int main( argc, argv ) int argc; char * argv[];
{
int i, cb, c_cb, j;
char * pc;
char * ap[ allocs ];
logging = ( argc > 1 );
pc = argv[ 0 ]; /* evade compiler warning */
for ( j = 0; j < 10; j++ )
{
if ( logging )
printf( "in alloc mode\n" );
for ( i = 0; i < allocs; i++ )
{
cb = 8 + ( i * 10 );
c_cb = cb + 5;
if ( logging )
printf( " i, cb: %d %d\n", i, cb );
pc = (char *) calloc( c_cb, 1 );
chkmem( pc, 0, c_cb );
memset_x( pc, 0xcc, c_cb );
ap[ i ] = (char *) malloc( cb );
memset_x( ap[ i ], 0xaa, cb );
chkmem( pc, 0xcc, c_cb );
free( pc );
}
if ( logging )
printf( "in free mode, even first\n" );
for ( i = 0; i < allocs; i += 2 )
{
cb = 8 + ( i * 10 );
c_cb = cb + 3;
if ( logging )
printf( " i, cb: %d %d\n", i, cb );
pc = (char *) calloc( c_cb, 1 );
chkmem( pc, 0, c_cb );
memset_x( pc, 0xcc, c_cb );
chkmem( ap[ i ], 0xaa, cb );
memset_x( ap[ i ], 0xff, cb );
free( ap[ i ] );
chkmem( pc, 0xcc, c_cb );
free( pc );
}
if ( logging )
printf( "in free mode, now odd\n" );
for ( i = 1; i < allocs; i += 2 )
{
cb = 8 + ( i * 10 );
c_cb = cb + 7;
if ( logging )
printf( " i, cb: %d %d\n", i, cb );
pc = (char *) calloc( c_cb, 1 );
chkmem( pc, 0, c_cb );
memset_x( pc, 0xcc, c_cb );
chkmem( ap[ i ], 0xaa, cb );
memset_x( ap[ i ], 0xff, cb );
free( ap[ i ] );
chkmem( pc, 0xcc, c_cb );
free( pc );
}
}
printf( "success\n" );
return 0;
}

View File

@ -0,0 +1,527 @@
/*
This version builds with old compilers including:
Aztec C 1.06 for 8080 & Z80 on CP/M.
Microsoft C Compiler V1.04 for 8086 on DOS. (This is Lattice C)
Microsoft C Compiler V2.03 for 8086 on DOS. (Still Lattice C)
Microsoft C Compiler V3.00 for 8086 on DOS.
QuickC 1.0
Turbo C 2.0
The syntax is old and reminds me of 7th grade summer vacation.
Much of this code is awkward to satisfy the lowest common denominator of many compilers.
unsigned long isn't supported in many older compilers, so long is used instead.
Early DOS and CP/M require register variabes to be int, not char or other types.
The perf improvement of using register-int instead of stack-char is worth it.
*/
#define LINT_ARGS
#include <stdio.h>
#ifdef DOSTIME
#include <time.h>
#include <dos.h>
#endif
#define true 1
#define false 0
/* Function Pointers are the fastest implementation for almost every compiler */
#define UseFunPointers 1
#define UseWinner2 2
#define UseLookForWinner 3
#define WinMethod UseFunPointers
#define ABPrune true /* alpha beta pruning */
#define WinLosePrune true /* stop early on win/lose */
#define ScoreWin 6
#define ScoreTie 5
#define ScoreLose 4
#define ScoreMax 9
#define ScoreMin 2
#define DefaultIterations 100
#define PieceX 1
#define PieceO 2
#define PieceBlank 0
typedef char ttype; /* 8-bit and 16-bit cpus do best with char aside from register in locals */
int g_Iterations = DefaultIterations;
ttype g_board[ 9 ];
#if WinMethod == UseFunPointers
ttype pos0func()
{
/* using "register int" instead of "ttype" for x is faster on 8086 and Z80 */
register int x = g_board[0];
if ( ( x == g_board[1] && x == g_board[2] ) ||
( x == g_board[3] && x == g_board[6] ) ||
( x == g_board[4] && x == g_board[8] ) )
return x;
return PieceBlank;
}
ttype pos1func()
{
register int x = g_board[1];
if ( ( x == g_board[0] && x == g_board[2] ) ||
( x == g_board[4] && x == g_board[7] ) )
return x;
return PieceBlank;
}
ttype pos2func()
{
register int x = g_board[2];
if ( ( x == g_board[0] && x == g_board[1] ) ||
( x == g_board[5] && x == g_board[8] ) ||
( x == g_board[4] && x == g_board[6] ) )
return x;
return PieceBlank;
}
ttype pos3func()
{
register int x = g_board[3];
if ( ( x == g_board[4] && x == g_board[5] ) ||
( x == g_board[0] && x == g_board[6] ) )
return x;
return PieceBlank;
}
ttype pos4func()
{
register int x = g_board[4];
if ( ( x == g_board[0] && x == g_board[8] ) ||
( x == g_board[2] && x == g_board[6] ) ||
( x == g_board[1] && x == g_board[7] ) ||
( x == g_board[3] && x == g_board[5] ) )
return x;
return PieceBlank;
}
ttype pos5func()
{
register int x = g_board[5];
if ( ( x == g_board[3] && x == g_board[4] ) ||
( x == g_board[2] && x == g_board[8] ) )
return x;
return PieceBlank;
}
ttype pos6func()
{
register int x = g_board[6];
if ( ( x == g_board[7] && x == g_board[8] ) ||
( x == g_board[0] && x == g_board[3] ) ||
( x == g_board[4] && x == g_board[2] ) )
return x;
return PieceBlank;
}
ttype pos7func()
{
register int x = g_board[7];
if ( ( x == g_board[6] && x == g_board[8] ) ||
( x == g_board[1] && x == g_board[4] ) )
return x;
return PieceBlank;
}
ttype pos8func()
{
register int x = g_board[8];
if ( ( x == g_board[6] && x == g_board[7] ) ||
( x == g_board[2] && x == g_board[5] ) ||
( x == g_board[0] && x == g_board[4] ) )
return x;
return PieceBlank;
}
typedef ttype pfunc_t();
pfunc_t * winner_functions[9] =
{
pos0func,
pos1func,
pos2func,
pos3func,
pos4func,
pos5func,
pos6func,
pos7func,
pos8func,
};
#endif
#if WinMethod == UseWinner2
ttype winner2( move ) ttype move;
{
register int x; /* faster than ttype x on the stack */
switch( move ) /* msc v3 from 1985 generates a jump table! */
{
case 0:
{
x = g_board[ 0 ];
if ( ( ( x == g_board[1] ) && ( x == g_board[2] ) ) ||
( ( x == g_board[3] ) && ( x == g_board[6] ) ) ||
( ( x == g_board[4] ) && ( x == g_board[8] ) ) )
return x;
break;
}
case 1:
{
x = g_board[ 1 ];
if ( ( ( x == g_board[0] ) && ( x == g_board[2] ) ) ||
( ( x == g_board[4] ) && ( x == g_board[7] ) ) )
return x;
break;
}
case 2:
{
x = g_board[ 2 ];
if ( ( ( x == g_board[0] ) && ( x == g_board[1] ) ) ||
( ( x == g_board[5] ) && ( x == g_board[8] ) ) ||
( ( x == g_board[4] ) && ( x == g_board[6] ) ) )
return x;
break;
}
case 3:
{
x = g_board[ 3 ];
if ( ( ( x == g_board[4] ) && ( x == g_board[5] ) ) ||
( ( x == g_board[0] ) && ( x == g_board[6] ) ) )
return x;
break;
}
case 4:
{
x = g_board[ 4 ];
if ( ( ( x == g_board[0] ) && ( x == g_board[8] ) ) ||
( ( x == g_board[2] ) && ( x == g_board[6] ) ) ||
( ( x == g_board[1] ) && ( x == g_board[7] ) ) ||
( ( x == g_board[3] ) && ( x == g_board[5] ) ) )
return x;
break;
}
case 5:
{
x = g_board[ 5 ];
if ( ( ( x == g_board[3] ) && ( x == g_board[4] ) ) ||
( ( x == g_board[2] ) && ( x == g_board[8] ) ) )
return x;
break;
}
case 6:
{
x = g_board[ 6 ];
if ( ( ( x == g_board[7] ) && ( x == g_board[8] ) ) ||
( ( x == g_board[0] ) && ( x == g_board[3] ) ) ||
( ( x == g_board[4] ) && ( x == g_board[2] ) ) )
return x;
break;
}
case 7:
{
x = g_board[ 7 ];
if ( ( ( x == g_board[6] ) && ( x == g_board[8] ) ) ||
( ( x == g_board[1] ) && ( x == g_board[4] ) ) )
return x;
break;
}
case 8:
{
x = g_board[ 8 ];
if ( ( ( x == g_board[6] ) && ( x == g_board[7] ) ) ||
( ( x == g_board[2] ) && ( x == g_board[5] ) ) ||
( ( x == g_board[0] ) && ( x == g_board[4] ) ) )
return x;
break;
}
}
return PieceBlank;
} /*winner2*/
#endif
#if WinMethod == UseLookForWinner
ttype LookForWinner()
{
register int p = g_board[0]; /* faster as register int than ttype on 8086 and Z80 */
if ( PieceBlank != p )
{
if ( p == g_board[1] && p == g_board[2] )
return p;
if ( p == g_board[3] && p == g_board[6] )
return p;
}
p = g_board[3];
if ( PieceBlank != p && p == g_board[4] && p == g_board[5] )
return p;
p = g_board[6];
if ( PieceBlank != p && p == g_board[7] && p == g_board[8] )
return p;
p = g_board[1];
if ( PieceBlank != p && p == g_board[4] && p == g_board[7] )
return p;
p = g_board[2];
if ( PieceBlank != p && p == g_board[5] && p == g_board[8] )
return p;
p = g_board[4];
if ( PieceBlank != p )
{
if ( ( p == g_board[0] ) && ( p == g_board[8] ) )
return p;
if ( ( p == g_board[2] ) && ( p == g_board[6] ) )
return p;
}
return PieceBlank;
} /*LookForWinner*/
#endif
int g_IMoves = 0;
ttype MinMax( alpha, beta, depth, move ) ttype alpha; ttype beta; ttype depth; ttype move;
{
ttype pieceMove, score; /* better perf with char than int. out of registers so use stack */
register int p, value; /* better perf with these as an int on Z80, 8080, and 8086 */
g_IMoves++;
if ( depth >= 4 )
{
#if WinMethod == UseFunPointers
p = ( * winner_functions[ move ] )();
#endif
#if WinMethod == UseWinner2
p = winner2( move );
#endif
#if WinMethod == UseLookForWinner
p = LookForWinner();
#endif
if ( PieceBlank != p )
{
if ( PieceX == p )
return ScoreWin;
return ScoreLose;
}
if ( 8 == depth )
return ScoreTie;
}
if ( depth & 1 )
{
value = ScoreMin;
pieceMove = PieceX;
}
else
{
value = ScoreMax;
pieceMove = PieceO;
}
for ( p = 0; p < 9; p++ )
{
if ( PieceBlank == g_board[ p ] )
{
g_board[p] = pieceMove;
score = MinMax( alpha, beta, depth + 1, p );
g_board[p] = PieceBlank;
if ( depth & 1 )
{
#if WinLosePrune /* #if statements must be in first column for MS C 1.0 */
if ( ScoreWin == score )
return ScoreWin;
#endif
if ( score > value )
{
value = score;
#if ABPrune
if ( value >= beta )
return value;
if ( value > alpha )
alpha = value;
#endif
}
}
else
{
#if WinLosePrune
if ( ScoreLose == score )
return ScoreLose;
#endif
if ( score < value )
{
value = score;
#if ABPrune
if ( value <= alpha )
return value;
if ( value < beta )
beta = value;
#endif
}
}
}
}
return value;
} /*MinMax*/
long g_Moves = 0;
int FindSolution( position ) ttype position;
{
register int i;
for ( i = 0; i < 9; i++ )
g_board[ i ] = PieceBlank;
g_board[ position ] = PieceX;
for ( i = 0; i < g_Iterations; i++ )
{
g_IMoves = 0;
MinMax( ScoreMin, ScoreMax, 0, position );
g_Moves += g_IMoves; /* do the 4-byte long addition once per loop to save work */
}
return 0;
} /*FindSolution*/
#ifdef CPMTIME
struct CPMTimeValue
{
int h, m, s, l;
};
void print_time_now()
{
/* This CP/M BDOS call of 105 is only implemented in NTVCM -- it's not a standard CP/M 2.2 call */
struct CPMTimeValue t;
t.h = t.m = t.s = t.l = 0;
bdos( 105, &t );
printf( "current time: %02d:%02d:%02d.%02d\n", t.h, t.m, t.s, t.l );
} /*print_time_now*/
long get_ms()
{
/* This CP/M BDOS call of 105 is only implemented in NTVCM -- it's not a standard CP/M 2.2 call */
long h, m, s, l;
struct CPMTimeValue t;
t.h = t.m = t.s = t.l = 0;
bdos( 105, &t );
h = t.h;
m = t.m;
s = t.s;
l = t.l;
return h * 3600000 + m * 60000 + s * 1000 + l * 10;
} /*get_ms*/
#else /* no elif with old compilers */
#ifdef DOSTIME
void print_time_now()
{
/* Make a DOS interrupt call to get the time */
union REGS wrIn, wrOut;
wrIn.h.ah = 0x2c;
intdos( &wrIn, &wrOut );
printf( "current time: %02d:%02d:%02d.%02d\n", wrOut.h.ch, wrOut.h.cl, wrOut.h.dh, wrOut.h.dl );
fflush( stdout );
} /*print_time_now*/
long get_ms()
{
/* this function takes about 3 milliseconds on the original IBM PC */
long h, m, s, l;
union REGS wrIn, wrOut;
wrIn.h.ah = 0x2c;
intdos( &wrIn, &wrOut );
h = wrOut.h.ch;
m = wrOut.h.cl;
s = wrOut.h.dh;
l = wrOut.h.dl;
return h * 3600000 + m * 60000 + s * 1000 + l * 10;
} /*get_ms*/
#else
/* must do this on actual CP/M machines */
int print_time_now() { return 0; }
long get_ms() { return 0; }
#endif
#endif
int main( argc, argv ) int argc; char * argv[];
{
long start_time, end_time;
if ( 2 == argc )
sscanf( argv[ 1 ], "%d", &g_Iterations ); /* no atoi in MS C 1.0 */
start_time = get_ms();
FindSolution( 0 );
FindSolution( 1 );
FindSolution( 4 );
end_time = get_ms();
printf( "runtime in ms: %ld\n", end_time - start_time );
printf( "move count: %ld\n", g_Moves ); /* 6493 * g_Iterations */
printf( "iteration count: %d\n", g_Iterations );
printf( "method: %s\n",
( WinMethod == UseFunPointers ) ? "function pointers" :
( WinMethod == UseWinner2 ) ? "winner2" :
( WinMethod == UseLookForWinner ) ? "look for winner" :
"invalid method" );
return 0;
} /*main*/

View File

@ -0,0 +1,5 @@
del %1.obj
ntvdm /f /t /c qcl /DDOSTIME /I..\include /AS /Ox /Gs /c %1.c
ntvdm /t link %1,,%1,..\lib\slibce+..\lib\em
copy %1.exe %1_qc1.exe
ntvdm /c /p %1 10

View File

@ -0,0 +1,3 @@
ntvdm -t -e:include=..\include,lib=..\lib qc ttt.c

View File

@ -0,0 +1,3 @@
ntvdm -C:50 -t -e:include=..\include,lib=..\lib qc ttt.c

View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <graph.h>
long bkcolor[8] = {_BLACK, _BLUE, _GREEN, _CYAN,
_RED, _MAGENTA, _BROWN, _WHITE};
char *bkcolor_name [] = {"_BLACK", "_BLUE", "_GREEN",
"_CYAN", "_RED", "_MAGENTA", "_BROWN", "_WHITE"};
main()
{
int i, j, k, delay;
_setvideomode (_MRES4COLOR); /* uses CGA color mode */
for (i=0; i<= 3; i++) {
_selectpalette (i);
for (k=0; k <= 7; k++) {
_setbkcolor (bkcolor[k]);
for (j=0; j<=3; j++) {
_settextposition (1,1);
printf ("background color: %8s\n", bkcolor_name[k]);
printf ("palette: %d\ncolor: %d\n",i,j);
_setcolor (j);
_rectangle (_GFILLINTERIOR,160,100,320,200);
for (delay=0; delay <= 20000; delay++)
;
}
}
}
_setvideomode (_DEFAULTMODE);
}

View File

@ -0,0 +1,33 @@
/***
*assert.h - define the assert macro
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the assert(exp) macro.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef _ASSERT_DEFINED
#ifndef NDEBUG
static char _assertstring[] = "Assertion failed: %s, file %s, line %d\n";
#define assert(exp) { \
if (!(exp)) { \
fprintf(stderr, _assertstring, #exp, __FILE__, __LINE__); \
abort(); \
} \
}
#else
#define assert(exp)
#endif /* NDEBUG */
#define _ASSERT_DEFINED
#endif /* _ASSERT_DEFINED */

View File

@ -0,0 +1,180 @@
/***
*bios.h - declarations for bios interface functions and supporting definitions
*
* Copyright (c) 1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file declares the constants, structures, and functions
* used for accessing and using various BIOS interfaces.
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* manifest constants for BIOS serial communications (RS-232) support */
/* serial port services */
#define _COM_INIT 0 /* init serial port */
#define _COM_SEND 1 /* send character */
#define _COM_RECEIVE 2 /* receive character */
#define _COM_STATUS 3 /* get serial port status */
/* serial port initializers. One and only one constant from each of the
* following four groups - character size, stop bit, parity, and baud rate -
* must be specified in the initialization byte.
*/
/* character size initializers */
#define _COM_CHR7 2 /* 7 bits characters */
#define _COM_CHR8 3 /* 8 bits characters */
/* stop bit values - on or off */
#define _COM_STOP1 0 /* 1 stop bit */
#define _COM_STOP2 4 /* 2 stop bits */
/* parity initializers */
#define _COM_NOPARITY 0 /* no parity */
#define _COM_ODDPARITY 8 /* odd parity */
#define _COM_EVENPARITY 24 /* even parity */
/* baud rate initializers */
#define _COM_110 0 /* 110 baud */
#define _COM_150 32 /* 150 baud */
#define _COM_300 64 /* 300 baud */
#define _COM_600 96 /* 600 baud */
#define _COM_1200 128 /* 1200 baud */
#define _COM_2400 160 /* 2400 baud */
#define _COM_4800 192 /* 4800 baud */
#define _COM_9600 224 /* 9600 baud */
/* manifest constants for BIOS disk support */
/* disk services */
#define _DISK_RESET 0 /* reset disk controller */
#define _DISK_STATUS 1 /* get disk status */
#define _DISK_READ 2 /* read disk sectors */
#define _DISK_WRITE 3 /* write disk sectors */
#define _DISK_VERIFY 4 /* verify disk sectors */
#define _DISK_FORMAT 3 /* format disk track */
/* struct used to send/receive information to/from the BIOS disk services */
#ifndef NO_EXT_KEYS /* extensions must be enabled */
#ifndef DISKINFO_T_DEFINED
struct diskinfo_t {
unsigned drive;
unsigned head;
unsigned track;
unsigned sector;
unsigned nsectors;
void far *buffer;
};
#define DISKINFO_T_DEFINED
#endif
#endif /* NO_EXT_KEYS */
/* manifest constants for BIOS keyboard support */
/* keyboard services */
#define _KEYBRD_READ 0 /* read next character from keyboard */
#define _KEYBRD_READY 1 /* check for keystroke */
#define _KEYBRD_SHIFTSTATUS 2 /* get current shift key status */
/* manifest constants for BIOS printer support */
/* printer services */
#define _PRINTER_WRITE 0 /* write character to printer */
#define _PRINTER_INIT 1 /* intialize printer */
#define _PRINTER_STATUS 2 /* get printer status */
/* manifest constants for BIOS time of day support */
/* time of day services */
#define _TIME_GETCLOCK 0 /* get current clock count */
#define _TIME_SETCLOCK 1 /* set current clock count */
#ifndef _REGS_DEFINED
/* word registers */
struct WORDREGS {
unsigned int ax;
unsigned int bx;
unsigned int cx;
unsigned int dx;
unsigned int si;
unsigned int di;
unsigned int cflag;
};
/* byte registers */
struct BYTEREGS {
unsigned char al, ah;
unsigned char bl, bh;
unsigned char cl, ch;
unsigned char dl, dh;
};
/* general purpose registers union -
* overlays the corresponding word and byte registers.
*/
union REGS {
struct WORDREGS x;
struct BYTEREGS h;
};
/* segment registers */
struct SREGS {
unsigned int es;
unsigned int cs;
unsigned int ss;
unsigned int ds;
};
#define _REGS_DEFINED
#endif /* _REGS_DEFINED */
/* function prototypes */
unsigned _CDECL _bios_equiplist(void);
unsigned _CDECL _bios_keybrd(unsigned);
unsigned _CDECL _bios_memsize(void);
unsigned _CDECL _bios_printer(unsigned, unsigned, unsigned);
unsigned _CDECL _bios_serialcom(unsigned, unsigned, unsigned);
unsigned _CDECL _bios_timeofday(unsigned, long *);
int _CDECL int86(int, union REGS *, union REGS *);
int _CDECL int86x(int, union REGS *, union REGS *, struct SREGS *);
#ifndef NO_EXT_KEYS /* extensions must be enabled */
unsigned _CDECL _bios_disk(unsigned, struct diskinfo_t *);
#endif /* NO_EXT_KEYS */

View File

@ -0,0 +1,33 @@
/***
*conio.h - console and port I/O declarations
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This include file contains the function declarations for
* the MS C V2.03 compatible console and port I/O routines.
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* function prototypes */
char * _CDECL cgets(char *);
int _CDECL cprintf(char *, ...);
int _CDECL cputs(char *);
int _CDECL cscanf(char *, ...);
int _CDECL getch(void);
int _CDECL getche(void);
int _CDECL inp(unsigned int);
unsigned _CDECL inpw(unsigned int);
int _CDECL kbhit(void);
int _CDECL outp(unsigned int, int);
unsigned _CDECL outpw(unsigned int, unsigned int);
int _CDECL putch(int);
int _CDECL ungetch(int);

View File

@ -0,0 +1,68 @@
/***
*ctype.h - character conversion macros and ctype macros
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines macros for character classification/conversion.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
/*
* This declaration allows the user access to the ctype look-up
* array _ctype defined in ctype.obj by simply including ctype.h
*/
extern unsigned char _NEAR _CDECL _ctype[];
/* set bit masks for the possible character types */
#define _UPPER 0x1 /* upper case letter */
#define _LOWER 0x2 /* lower case letter */
#define _DIGIT 0x4 /* digit[0-9] */
#define _SPACE 0x8 /* tab, carriage return, newline, */
/* vertical tab or form feed */
#define _PUNCT 0x10 /* punctuation character */
#define _CONTROL 0x20 /* control character */
#define _BLANK 0x40 /* space char */
#define _HEX 0x80 /* hexadecimal digit */
/* the character classification macro definitions */
#define isalpha(c) ( (_ctype+1)[c] & (_UPPER|_LOWER) )
#define isupper(c) ( (_ctype+1)[c] & _UPPER )
#define islower(c) ( (_ctype+1)[c] & _LOWER )
#define isdigit(c) ( (_ctype+1)[c] & _DIGIT )
#define isxdigit(c) ( (_ctype+1)[c] & _HEX )
#define isspace(c) ( (_ctype+1)[c] & _SPACE )
#define ispunct(c) ( (_ctype+1)[c] & _PUNCT )
#define isalnum(c) ( (_ctype+1)[c] & (_UPPER|_LOWER|_DIGIT) )
#define isprint(c) ( (_ctype+1)[c] & (_BLANK|_PUNCT|_UPPER|_LOWER|_DIGIT) )
#define isgraph(c) ( (_ctype+1)[c] & (_PUNCT|_UPPER|_LOWER|_DIGIT) )
#define iscntrl(c) ( (_ctype+1)[c] & _CONTROL )
#define isascii(c) ( (unsigned)(c) < 0x80 )
#define _tolower(c) ( (c)-'A'+'a' )
#define _toupper(c) ( (c)-'a'+'A' )
#define toupper(c) ( (islower(c)) ? _toupper(c) : (c) )
#define tolower(c) ( (isupper(c)) ? _tolower(c) : (c) )
#define toascii(c) ( (c) & 0x7f )
/* MS C version 2.0 extended ctype macros */
#define iscsymf(c) (isalpha(c) || ((c) == '_'))
#define iscsym(c) (isalnum(c) || ((c) == '_'))

View File

@ -0,0 +1,24 @@
/***
*direct.h - function declarations for directory handling/creation
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This include file contains the function declarations for the library
* functions related to directory handling and creation.
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* function prototypes */
int _CDECL chdir(char *);
char * _CDECL getcwd(char *, int);
int _CDECL mkdir(char *);
int _CDECL rmdir(char *);

View File

@ -0,0 +1,220 @@
/***
*dos.h - definitions for MS-DOS interface routines
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the structs and unions used for the direct DOS interface
* routines; includes macros to access the segment and offset
* values of far pointers, so that they may be used by the routines; and
* provides function prototypes for direct DOS interface functions.
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
#ifndef _REGS_DEFINED
/* word registers */
struct WORDREGS {
unsigned int ax;
unsigned int bx;
unsigned int cx;
unsigned int dx;
unsigned int si;
unsigned int di;
unsigned int cflag;
};
/* byte registers */
struct BYTEREGS {
unsigned char al, ah;
unsigned char bl, bh;
unsigned char cl, ch;
unsigned char dl, dh;
};
/* general purpose registers union -
* overlays the corresponding word and byte registers.
*/
union REGS {
struct WORDREGS x;
struct BYTEREGS h;
};
/* segment registers */
struct SREGS {
unsigned int es;
unsigned int cs;
unsigned int ss;
unsigned int ds;
};
#define _REGS_DEFINED
#endif
/* dosexterror structure */
#ifndef _DOSERROR_DEFINED
struct DOSERROR {
int exterror;
char class;
char action;
char locus;
};
#define _DOSERROR_DEFINED
#endif
/* _dos_findfirst structure */
#ifndef _FIND_T_DEFINED
struct find_t {
char reserved[21];
char attrib;
unsigned wr_time;
unsigned wr_date;
long size;
char name[13];
};
#define _FIND_T_DEFINED
#endif
/* _dos_getdate/_dossetdate and _dos_gettime/_dos_settime structures */
#ifndef _DATETIME_T_DEFINED
struct dosdate_t {
unsigned char day; /* 1-31 */
unsigned char month; /* 1-12 */
unsigned int year; /* 1980-2099 */
unsigned char dayofweek; /* 0-6, 0=Sunday */
};
struct dostime_t {
unsigned char hour; /* 0-23 */
unsigned char minute; /* 0-59 */
unsigned char second; /* 0-59 */
unsigned char hsecond; /* 0-99 */
};
#define _DATETIME_T_DEFINED
#endif
/* _dos_getdiskfree structure */
#ifndef _DISKFREE_T_DEFINED
struct diskfree_t {
unsigned total_clusters;
unsigned avail_clusters;
unsigned sectors_per_cluster;
unsigned bytes_per_sector;
};
#define _DISKFREE_T_DEFINED
#endif
/* manifest constants for _hardresume result parameter */
#define _HARDERR_IGNORE 0 /* Ignore the error */
#define _HARDERR_RETRY 1 /* Retry the operation */
#define _HARDERR_ABORT 2 /* Abort program issuing Interrupt 23h */
#define _HARDERR_FAIL 3 /* Fail the system call in progress */
/* _HARDERR_FAIL is not supported on DOS 2.x */
/* File attribute constants */
#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
#define _A_RDONLY 0x01 /* Read only file */
#define _A_HIDDEN 0x02 /* Hidden file */
#define _A_SYSTEM 0x04 /* System file */
#define _A_VOLID 0x08 /* Volume ID file */
#define _A_SUBDIR 0x10 /* Subdirectory */
#define _A_ARCH 0x20 /* Archive file */
/* macros to break MS C "far" pointers into their segment and offset
* components
*/
#define FP_SEG(fp) (*((unsigned *)&(fp) + 1))
#define FP_OFF(fp) (*((unsigned *)&(fp)))
/* external variable declarations */
extern unsigned int _NEAR _CDECL _osversion;
/* function prototypes */
int _CDECL bdos(int, unsigned int, unsigned int);
void _CDECL _disable(void);
unsigned _CDECL _dos_allocmem(unsigned, unsigned *);
unsigned _CDECL _dos_close(int);
unsigned _CDECL _dos_creat(char *, unsigned, int *);
unsigned _CDECL _dos_creatnew(char *, unsigned, int *);
unsigned _CDECL _dos_findfirst(char *, unsigned, struct find_t *);
unsigned _CDECL _dos_findnext(struct find_t *);
unsigned _CDECL _dos_freemem(unsigned);
void _CDECL _dos_getdate(struct dosdate_t *);
void _CDECL _dos_getdrive(unsigned *);
unsigned _CDECL _dos_getdiskfree(unsigned, struct diskfree_t *);
unsigned _CDECL _dos_getfileattr(char *, unsigned *);
unsigned _CDECL _dos_getftime(int, unsigned *, unsigned *);
void _CDECL _dos_gettime(struct dostime_t *);
void _CDECL _dos_keep(unsigned, unsigned);
unsigned _CDECL _dos_open(char *, unsigned, int *);
unsigned _CDECL _dos_setblock(unsigned, unsigned, unsigned *);
unsigned _CDECL _dos_setdate(struct dosdate_t *);
void _CDECL _dos_setdrive(unsigned, unsigned *);
unsigned _CDECL _dos_setfileattr(char *, unsigned);
unsigned _CDECL _dos_setftime(int, unsigned, unsigned);
unsigned _CDECL _dos_settime(struct dostime_t *);
int _CDECL dosexterr(struct DOSERROR *);
void _CDECL _enable(void);
void _CDECL _hardresume(int);
void _CDECL _hardretn(int);
int _CDECL intdos(union REGS *, union REGS *);
int _CDECL intdosx(union REGS *, union REGS *, struct SREGS *);
int _CDECL int86(int, union REGS *, union REGS *);
int _CDECL int86x(int, union REGS *, union REGS *, struct SREGS *);
void _CDECL segread(struct SREGS *);
#ifndef NO_EXT_KEYS /* extensions enabled */
void _CDECL _chain_intr(void (_CDECL interrupt far *)());
void (_CDECL interrupt far * _CDECL _dos_getvect(unsigned))();
unsigned _CDECL _dos_read(int, void far *, unsigned, unsigned *);
void _CDECL _dos_setvect(unsigned, void (_CDECL interrupt far *)());
unsigned _CDECL _dos_write(int, void far *, unsigned, unsigned *);
void _CDECL _harderr(void (far *)());
#endif /* NO_EXT_KEYS */

View File

@ -0,0 +1,50 @@
/***
*errno.h - system wide error numbers (set by system calls)
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the system-wide error numbers (set by
* system calls). Conforms to the XENIX standard. Extended
* for compatibility with Uniforum standard.
* [System V]
*
*******************************************************************************/
#define EZERO 0
#define EPERM 1
#define ENOENT 2
#define ESRCH 3
#define EINTR 4
#define EIO 5
#define ENXIO 6
#define E2BIG 7
#define ENOEXEC 8
#define EBADF 9
#define ECHILD 10
#define EAGAIN 11
#define ENOMEM 12
#define EACCES 13
#define EFAULT 14
#define ENOTBLK 15
#define EBUSY 16
#define EEXIST 17
#define EXDEV 18
#define ENODEV 19
#define ENOTDIR 20
#define EISDIR 21
#define EINVAL 22
#define ENFILE 23
#define EMFILE 24
#define ENOTTY 25
#define ETXTBSY 26
#define EFBIG 27
#define ENOSPC 28
#define ESPIPE 29
#define EROFS 30
#define EMLINK 31
#define EPIPE 32
#define EDOM 33
#define ERANGE 34
#define EUCLEAN 35
#define EDEADLOCK 36

View File

@ -0,0 +1,35 @@
/***
*fcntl.h - file control options used by open()
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines constants for the file control options used
* by the open() function.
* [System V]
*
*******************************************************************************/
#define O_RDONLY 0x0000 /* open for reading only */
#define O_WRONLY 0x0001 /* open for writing only */
#define O_RDWR 0x0002 /* open for reading and writing */
#define O_APPEND 0x0008 /* writes done at eof */
#define O_CREAT 0x0100 /* create and open file */
#define O_TRUNC 0x0200 /* open and truncate */
#define O_EXCL 0x0400 /* open only if file doesn't already exist */
/* O_TEXT files have <cr><lf> sequences translated to <lf> on read()'s,
** and <lf> sequences translated to <cr><lf> on write()'s
*/
#define O_TEXT 0x4000 /* file mode is text (translated) */
#define O_BINARY 0x8000 /* file mode is binary (untranslated) */
/* macro to translate the C 2.0 name used to force binary mode for files */
#define O_RAW O_BINARY
/* Open handle inherit bit */
#define O_NOINHERIT 0x0080 /* child process doesn't inherit file */

View File

@ -0,0 +1,137 @@
/***
*float.h - constants for floating point values
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains defines for a number of implementation dependent
* values which are commonly used by sophisticated numerical (floating
* point) programs.
* [ANSI]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
#define DBL_DIG 15 /* # of decimal digits of precision */
#define DBL_EPSILON 2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
#define DBL_MANT_DIG 53 /* # of bits in mantissa */
#define DBL_MAX 1.7976931348623158e+308 /* max value */
#define DBL_MAX_10_EXP 308 /* max decimal exponent */
#define DBL_MAX_EXP 1024 /* max binary exponent */
#define DBL_MIN 2.2250738585072014e-308 /* min positive value */
#define DBL_MIN_10_EXP -307 /* min decimal exponent
#define DBL_MIN_EXP -1021 /* min binary exponent */
#define DBL_RADIX 2 /* exponent radix */
#define DBL_ROUNDS 0 /* addition rounding: chops */
#define FLT_DIG 6 /* # of decimal digits of precision */
#define FLT_EPSILON 1.192092896e-07 /* smallest such that 1.0+FLT_EPSILON != 1.0 */
#define FLT_GUARD 0
#define FLT_MANT_DIG 24 /* # of bits in mantissa */
#define FLT_MAX 3.402823466e+38 /* max value */
#define FLT_MAX_10_EXP 38 /* max decimal exponent */
#define FLT_MAX_EXP 128 /* max binary exponent */
#define FLT_MIN 1.175494351e-38 /* min positive value */
#define FLT_MIN_10_EXP -37 /* min decimal exponent */
#define FLT_MIN_EXP -125 /* min binary exponent */
#define FLT_NORMALIZE 0
#define FLT_RADIX 2 /* exponent radix */
#define FLT_ROUNDS 0 /* addition rounding: chops */
#define LDBL_DIG DBL_DIG /* # of decimal digits of precision */
#define LDBL_EPSILON DBL_EPSILON /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
#define LDBL_MANT_DIG DBL_MANT_DIG /* # of bits in mantissa */
#define LDBL_MAX DBL_MAX /* max value */
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP /* max decimal exponent */
#define LDBL_MAX_EXP DBL_MAX_EXP /* max binary exponent */
#define LDBL_MIN DBL_MIN /* min positive value */
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP /* min deimal exponent
#define LDBL_MIN_EXP DBL_MIN_EXP /* min binary exponent */
#define LDBL_RADIX DBL_RADIX /* exponent radix */
#define LDBL_ROUNDS DBL_ROUNDS /* addition rounding: chops */
/*
* 8087/80287 math control information
*/
/* User Control Word Mask and bit definitions.
* These definitions match the 8087/80287
*/
#define MCW_EM 0x003f /* interrupt Exception Masks */
#define EM_INVALID 0x0001 /* invalid */
#define EM_DENORMAL 0x0002 /* denormal */
#define EM_ZERODIVIDE 0x0004 /* zero divide */
#define EM_OVERFLOW 0x0008 /* overflow */
#define EM_UNDERFLOW 0x0010 /* underflow */
#define EM_INEXACT 0x0020 /* inexact (precision) */
#define MCW_IC 0x1000 /* Infinity Control */
#define IC_AFFINE 0x1000 /* affine */
#define IC_PROJECTIVE 0x0000 /* projective */
#define MCW_RC 0x0c00 /* Rounding Control */
#define RC_CHOP 0x0c00 /* chop */
#define RC_UP 0x0800 /* up */
#define RC_DOWN 0x0400 /* down */
#define RC_NEAR 0x0000 /* near */
#define MCW_PC 0x0300 /* Precision Control */
#define PC_24 0x0000 /* 24 bits */
#define PC_53 0x0200 /* 53 bits */
#define PC_64 0x0300 /* 64 bits */
/* initial Control Word value */
#define CW_DEFAULT ( IC_AFFINE + RC_NEAR + PC_64 + EM_DENORMAL + EM_UNDERFLOW + EM_INEXACT )
/* user Status Word bit definitions */
#define SW_INVALID 0x0001 /* invalid */
#define SW_DENORMAL 0x0002 /* denormal */
#define SW_ZERODIVIDE 0x0004 /* zero divide */
#define SW_OVERFLOW 0x0008 /* overflow */
#define SW_UNDERFLOW 0x0010 /* underflow */
#define SW_INEXACT 0x0020 /* inexact (precision) */
/* invalid subconditions (SW_INVALID also set) */
#define SW_UNEMULATED 0x0040 /* unemulated instruction */
#define SW_SQRTNEG 0x0080 /* square root of a neg number */
#define SW_STACKOVERFLOW 0x0200 /* FP stack overflow */
#define SW_STACKUNDERFLOW 0x0400 /* FP stack underflow */
/* Floating point error signals and return codes */
#define FPE_INVALID 0x81
#define FPE_DENORMAL 0x82
#define FPE_ZERODIVIDE 0x83
#define FPE_OVERFLOW 0x84
#define FPE_UNDERFLOW 0x85
#define FPE_INEXACT 0x86
#define FPE_UNEMULATED 0x87
#define FPE_SQRTNEG 0x88
#define FPE_STACKOVERFLOW 0x8a
#define FPE_STACKUNDERFLOW 0x8b
#define FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */
/* function prototypes */
unsigned int _CDECL _clear87(void);
unsigned int _CDECL _control87(unsigned int,unsigned int);
void _CDECL _fpreset(void);
unsigned int _CDECL _status87(void);

View File

@ -0,0 +1,214 @@
/***
*graph.h - declare constants and functions for graphics library
*
* Copyright (c) 1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file declares the graphics library functions and
* the manifest constants that are used with them.
*
*******************************************************************************/
/* user-visible declarations for Quick-C Graphics Library */
#ifndef _GRAPH_T_DEFINED
/* structure for _getvideoconfig() as visible to user */
struct videoconfig {
short numxpixels; /* number of pixels on X axis */
short numypixels; /* number of pixels on Y axis */
short numtextcols; /* number of text columns available */
short numtextrows; /* number of text rows available */
short numcolors; /* number of actual colors */
short bitsperpixel; /* number of bits per pixel */
short numvideopages; /* number of available video pages */
short mode; /* current video mode */
short adapter; /* active display adapter */
short monitor; /* active display monitor */
short memory; /* adapter video memory in K bytes */
};
/* return value of _setlogorg(), etc. */
struct xycoord {
short xcoord;
short ycoord;
};
/* structure for text position */
struct rccoord {
short row;
short col;
};
#define _GRAPH_T_DEFINED
#endif
/* SETUP AND CONFIGURATION */
short far cdecl _setvideomode(short);
/* arguments to _setvideomode() */
#define _DEFAULTMODE -1 /* restore screen to original mode */
#define _TEXTBW40 0 /* 40 x 25 text, 16 grey */
#define _TEXTC40 1 /* 40 x 25 text, 16/8 color */
#define _TEXTBW80 2 /* 80 x 25 text, 16 grey */
#define _TEXTC80 3 /* 80 x 25 text, 16/8 color */
#define _MRES4COLOR 4 /* 320 x 200, 4 color */
#define _MRESNOCOLOR 5 /* 320 x 200, 4 grey */
#define _HRESBW 6 /* 640 x 200, BW */
#define _TEXTMONO 7 /* 80 x 25 text, BW */
#define _MRES16COLOR 13 /* 320 x 200, 16 color */
#define _HRES16COLOR 14 /* 640 x 200, 16 color */
#define _ERESNOCOLOR 15 /* 640 x 350, BW */
#define _ERESCOLOR 16 /* 640 x 350, 4 or 16 color */
#define _VRES2COLOR 17 /* 640 x 480, BW */
#define _VRES16COLOR 18 /* 640 x 480, 16 color */
#define _MRES256COLOR 19 /* 320 x 200, 256 color */
short far cdecl _setactivepage(short);
short far cdecl _setvisualpage(short);
/* videoconfig adapter values */
/* these manifest constants can be used to test adapter values for */
/* a particular adapter using the bitwise-AND operator (&) */
#define _MDPA 0x0001 /* Monochrome Display Adapter (MDPA) */
#define _CGA 0x0002 /* Color Graphics Adapter (CGA) */
#define _EGA 0x0004 /* Enhanced Graphics Adapter (EGA) */
#define _MCGA 0x0008 /* MultiColor Graphics Array (MCGA) */
#define _VGA 0x0010 /* Video Graphics Array (VGA) */
/* videoconfig monitor values */
/* these manifest constants can be used to test monitor values for */
/* a particular monitor using the bitwise-AND operator (&) */
#define _MONO 0x0001 /* Monochrome */
#define _COLOR 0x0002 /* Color (or Enhanced emulating color) */
#define _ENHCOLOR 0x0004 /* Enhanced Color */
#define _ANALOG 0x0018 /* Analog */
struct videoconfig far * far cdecl _getvideoconfig(struct videoconfig far *);
/* COORDINATE SYSTEMS */
struct xycoord far cdecl _setlogorg(short, short);
struct xycoord far cdecl _getlogcoord(short, short);
struct xycoord far cdecl _getphyscoord(short, short);
void far cdecl _setcliprgn(short, short, short, short);
void far cdecl _setviewport(short, short, short, short);
/* OUTPUT ROUTINES */
/* control parameters for Rectangle, Ellipse and Pie */
#define _GBORDER 2 /* draw outline only */
#define _GFILLINTERIOR 3 /* fill using current fill mask */
#define _GCLEARSCREEN 0
#define _GVIEWPORT 1
#define _GWINDOW 2
void far cdecl _clearscreen(short);
struct xycoord far cdecl _moveto(short, short);
struct xycoord far cdecl _getcurrentposition(void);
short far cdecl _lineto(short, short);
short far cdecl _rectangle(short, short, short, short, short);
short far cdecl _ellipse(short, short, short, short, short);
short far cdecl _arc(short, short, short, short, short, short, short, short);
short far cdecl _pie(short, short, short, short, short, short, short, short, short);
short far cdecl _setpixel(short, short);
short far cdecl _getpixel(short, short);
short far cdecl _floodfill(short, short, short);
/* PEN COLOR, LINE STYLE, FILL PATTERN */
short far cdecl _setcolor(short);
short far cdecl _getcolor(void);
void far cdecl _setlinestyle(unsigned short);
unsigned short far cdecl _getlinestyle(void);
void far cdecl _setfillmask(unsigned char far *);
unsigned char far * far cdecl _getfillmask(unsigned char far *);
/* COLOR SELECTION */
long far cdecl _setbkcolor(long);
long far cdecl _getbkcolor(void);
long far cdecl _remappalette(short, long);
short far cdecl _remapallpalette(long far *);
short far cdecl _selectpalette(short);
/* TEXT */
#define _GCURSOROFF 0
#define _GCURSORON 1
#define _GWRAPOFF 0
#define _GWRAPON 1
void far cdecl _settextwindow(short, short, short, short);
void far cdecl _outtext(char far *);
short far cdecl _wrapon(short);
short far cdecl _displaycursor(short);
struct rccoord far cdecl _settextposition(short, short);
struct rccoord far cdecl _gettextposition(void);
short far cdecl _settextcolor(short);
short far cdecl _gettextcolor(void);
/* SCREEN IMAGES */
void far cdecl _getimage(short, short, short, short, char far *);
void far cdecl _putimage(short, short, char far *, short);
long far cdecl _imagesize(short, short, short, short);
/* "action verbs" for _putimage() */
#define _GPSET 3
#define _GPRESET 2
#define _GAND 1
#define _GOR 0
#define _GXOR 4
/* universal color values: */
#define _BLACK 0x000000L
#define _BLUE 0x2a0000L
#define _GREEN 0x002a00L
#define _CYAN 0x2a2a00L
#define _RED 0x00002aL
#define _MAGENTA 0x2a002aL
#define _BROWN 0x00152aL
#define _WHITE 0x2a2a2aL
#define _GRAY 0x151515L
#define _LIGHTBLUE 0x3F1515L
#define _LIGHTGREEN 0x153f15L
#define _LIGHTCYAN 0x3f3f15L
#define _LIGHTRED 0x15153fL
#define _LIGHTMAGENTA 0x3f153fL
#define _LIGHTYELLOW 0x153f3fL
#define _BRIGHTWHITE 0x3f3f3fL
/* mono mode F color values: */
#define _MODEFOFF 0L
#define _MODEFOFFTOON 1L
#define _MODEFOFFTOHI 2L
#define _MODEFONTOOFF 3L
#define _MODEFON 4L
#define _MODEFONTOHI 5L
#define _MODEFHITOOFF 6L
#define _MODEFHITOON 7L
#define _MODEFHI 8L
/* mono mode 7 color values: */
#define _MODE7OFF 0L
#define _MODE7ON 1L
#define _MODE7HI 2L

View File

@ -0,0 +1,44 @@
/***
*io.h - declarations for low-level file handling and I/O functions
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the function declarations for the low-level
* file handling and I/O functions.
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* function prototypes */
int _CDECL access(char *, int);
int _CDECL chmod(char *, int);
int _CDECL chsize(int, long);
int _CDECL close(int);
int _CDECL creat(char *, int);
int _CDECL dup(int);
int _CDECL dup2(int, int);
int _CDECL eof(int);
long _CDECL filelength(int);
int _CDECL isatty(int);
int _CDECL locking(int, int, long);
long _CDECL lseek(int, long, int);
char * _CDECL mktemp(char *);
int _CDECL open(char *, int, ...);
int _CDECL read(int, char *, unsigned int);
int _CDECL remove(const char *);
int _CDECL rename(const char *, const char *);
int _CDECL setmode(int, int);
int _CDECL sopen(char *, int, int, ...);
long _CDECL tell(int);
int _CDECL umask(int);
int _CDECL unlink(const char *);
int _CDECL write(int, char *, unsigned int);

View File

@ -0,0 +1,32 @@
/***
*limits.h - implementation dependent values
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* contains defines for a number of implementation dependent values
* which are commonly used in C programs.
* [ANSI]
*
*******************************************************************************/
#ifndef _CHAR_UNSIGNED
#define CHAR_MAX 127 /* maximum char value */
#define CHAR_MIN -127 /* mimimum char value */
#else
#define CHAR_MAX 255
#define CHAR_MIN 0
#endif
#define SCHAR_MAX 127 /* maximum signed char value */
#define SCHAR_MIN -127 /* minimum signed char value */
#define UCHAR_MAX 255 /* maximum unsigned char value */
#define CHAR_BIT 8 /* number of bits in a char */
#define USHRT_MAX 0xffff /* maximum unsigned short value */
#define SHRT_MAX 32767 /* maximum (signed) short value */
#define SHRT_MIN -32767 /* minimum (signed) short value */
#define UINT_MAX 0xffff /* maximum unsigned int value */
#define ULONG_MAX 0xffffffff /* maximum unsigned long value */
#define INT_MAX 32767 /* maximum (signed) int value */
#define INT_MIN -32767 /* minimum (signed) int value */
#define LONG_MAX 2147483647 /* maximum (signed) long value */
#define LONG_MIN -2147483647 /* minimum (signed) long value */

View File

@ -0,0 +1,125 @@
/***
*malloc.h - declarations and definitions for memory allocation functions
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Contains the function declarations for memory allocation functions;
* also defines manifest constants and types used by the heap routines.
* [System V]
*
*******************************************************************************/
#define _HEAPEMPTY -1
#define _HEAPOK -2
#define _HEAPBADBEGIN -3
#define _HEAPBADNODE -4
#define _HEAPEND -5
#define _HEAPBADPTR -6
#define _FREEENTRY 0
#define _USEDENTRY 1
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#define _SIZE_T_DEFINED
#endif
#if (!defined(NO_EXT_KEYS))
#ifndef _HEAPINFO_DEFINED
typedef struct _heapinfo {
int far * _pentry;
size_t _size;
int _useflag;
} _HEAPINFO;
#define _HEAPINFO_DEFINED
#endif
#else /* NO_EXT_KEYS */
#if (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
#ifndef _HEAPINFO_DEFINED
typedef struct _heapinfo {
int * _pentry;
size_t _size;
int _useflag;
} _HEAPINFO;
#define _HEAPINFO_DEFINED
#endif
#endif /* M_I86CM || M_I86LM || M_I86HM */
#endif /* NO_EXT_KEYS */
#if (defined(M_I86SM) || defined(M_I86MM))
#define _heapchk _nheapchk
#define _heapset _nheapset
#define _heapwalk _nheapwalk
#endif
#if (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
#define _heapchk _fheapchk
#define _heapset _fheapset
#define _heapwalk _fheapwalk
#endif
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
/* external variable declarations */
extern unsigned int _NEAR _CDECL _amblksiz;
/* function prototypes */
void * _CDECL alloca(size_t);
void * _CDECL calloc(size_t, size_t);
void * _CDECL _expand(void *, size_t);
int _CDECL _fheapchk(void);
int _CDECL _fheapset(unsigned int);
unsigned int _CDECL _freect(size_t);
void _CDECL free(void *);
void * _CDECL malloc(size_t);
size_t _CDECL _memavl(void);
size_t _CDECL _memmax(void);
size_t _CDECL _msize(void *);
int _CDECL _nheapchk(void);
int _CDECL _nheapset(unsigned int);
void * _CDECL realloc(void *, size_t);
void * _CDECL sbrk(int);
size_t _CDECL stackavail(void);
#ifndef NO_EXT_KEYS /* extensions enabled */
void cdecl _ffree(void far *);
void far * cdecl _fmalloc(size_t);
size_t cdecl _fmsize(void far *);
#ifndef _QC
void huge * cdecl halloc(long, size_t);
void cdecl hfree(void huge *);
#endif
void cdecl _nfree(void near *);
void near * cdecl _nmalloc(size_t);
size_t cdecl _nmsize(void near *);
int cdecl _nheapwalk(struct _heapinfo *);
int cdecl _fheapwalk(struct _heapinfo *);
#else
#if (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
int _nheapwalk(struct _heapinfo *);
int _fheapwalk(struct _heapinfo *);
#endif /* M_I86CM || M_I86LM || M_I86HM */
#endif /* NO_EXT_KEYS */

View File

@ -0,0 +1,111 @@
/***
*math.h - definitions and declarations for math library
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains constant definitions and external subroutine
* declarations for the math subroutine library.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* definition of exception struct - this struct is passed to the matherr
* routine when a floating point exception is detected
*/
#ifndef _EXCEPTION_DEFINED
struct exception {
int type; /* exception type - see below */
char *name; /* name of function where error occured */
double arg1; /* first argument to function */
double arg2; /* second argument (if any) to function */
double retval; /* value to be returned by function */
} ;
#define _EXCEPTION_DEFINED
#endif
/* definition of a complex struct to be used by those who use cabs and
* want type checking on their argument
*/
#ifndef _COMPLEX_DEFINED
struct complex {
double x,y; /* real and imaginary parts */
} ;
#define _COMPLEX_DEFINED
#endif
/* Constant definitions for the exception type passed in the exception struct
*/
#define DOMAIN 1 /* argument domain error */
#define SING 2 /* argument singularity */
#define OVERFLOW 3 /* overflow range error */
#define UNDERFLOW 4 /* underflow range error */
#define TLOSS 5 /* total loss of precision */
#define PLOSS 6 /* partial loss of precision */
#define EDOM 33
#define ERANGE 34
/* definitions of HUGE and HUGE_VAL - respectively the XENIX and ANSI names
* for a value returned in case of error by a number of the floating point
* math routines
*/
extern double HUGE;
#define HUGE_VAL HUGE
/* function prototypes */
int _CDECL abs(int);
double _CDECL acos(double);
double _CDECL asin(double);
double _CDECL atan(double);
double _CDECL atan2(double, double);
double _CDECL atof(const char *);
double _CDECL cabs(struct complex);
double _CDECL ceil(double);
double _CDECL cos(double);
double _CDECL cosh(double);
int _CDECL dieeetomsbin(double *, double *);
int _CDECL dmsbintoieee(double *, double *);
double _CDECL exp(double);
double _CDECL fabs(double);
int _CDECL fieeetomsbin(float *, float *);
double _CDECL floor(double);
double _CDECL fmod(double, double);
int _CDECL fmsbintoieee(float *, float *);
double _CDECL frexp(double, int *);
double _CDECL hypot(double, double);
double _CDECL j0(double);
double _CDECL j1(double);
double _CDECL jn(int, double);
long _CDECL labs(long);
double _CDECL ldexp(double, int);
double _CDECL log(double);
double _CDECL log10(double);
int _CDECL matherr(struct exception *);
double _CDECL modf(double, double *);
double _CDECL pow(double, double);
double _CDECL sin(double);
double _CDECL sinh(double);
double _CDECL sqrt(double);
double _CDECL tan(double);
double _CDECL tanh(double);
double _CDECL y0(double);
double _CDECL y1(double);
double _CDECL yn(int, double);

View File

@ -0,0 +1,34 @@
/***
*memory.h - declarations for buffer (memory) manipulation routines
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This include file contains the function declarations for the
* buffer (memory) manipulation routines.
* [System V]
*
*******************************************************************************/
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#define _SIZE_T_DEFINED
#endif
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* function prototypes */
void * _CDECL memccpy(void *, void *, int, unsigned int);
void * _CDECL memchr(const void *, int, size_t);
int _CDECL memcmp(const void *, const void *, size_t);
void * _CDECL memcpy(void *, const void *, size_t);
int _CDECL memicmp(void *, void *, unsigned int);
void * _CDECL memset(void *, int, size_t);
void _CDECL movedata(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);

View File

@ -0,0 +1,56 @@
/***
*process.h - definition and declarations for process control functions
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the modeflag values for spawnxx calls. Only
* P_WAIT and P_OVERLAY are currently implemented on DOS 2 & 3.
* P_NOWAIT is also enabled on DOS 4. Also contains the function
* argument declarations for all process control related routines.
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
/* modeflag values for spawnxx routines */
extern int _NEAR _CDECL _p_overlay;
#define P_WAIT 0
#define P_NOWAIT 1
#define P_OVERLAY _p_overlay
#define OLD_P_OVERLAY 2
/* function prototypes */
void _CDECL abort(void);
int _CDECL execl(char *, char *, ...);
int _CDECL execle(char *, char *, ...);
int _CDECL execlp(char *, char *, ...);
int _CDECL execlpe(char *, char *, ...);
int _CDECL execv(char *, char **);
int _CDECL execve(char *, char **, char **);
int _CDECL execvp(char *, char **);
int _CDECL execvpe(char *, char **, char **);
void _CDECL exit(int);
void _CDECL _exit(int);
int _CDECL getpid(void);
int _CDECL spawnl(int, char *, char *, ...);
int _CDECL spawnle(int, char *, char *, ...);
int _CDECL spawnlp(int, char *, char *, ...);
int _CDECL spawnlpe(int, char *, char *, ...);
int _CDECL spawnv(int, char *, char **);
int _CDECL spawnve(int, char *, char **, char **);
int _CDECL spawnvp(int, char *, char **);
int _CDECL spawnvpe(int, char *, char **, char **);
int _CDECL system(const char *);

View File

@ -0,0 +1,31 @@
/***
*search.h - declarations for searcing/sorting routines
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the declarations for the sorting and
* searching routines.
* [System V]
*
*******************************************************************************/
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#define _SIZE_T_DEFINED
#endif
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* function prototypes */
char * _CDECL lsearch(char *, char *, unsigned int *, unsigned int, int (_CDECL *)(void *, void *));
char * _CDECL lfind(char *, char *, unsigned int *, unsigned int, int (_CDECL *)(void *, void *));
void * _CDECL bsearch(const void *, const void *, size_t, size_t, int (_CDECL *)(const void *, const void *));
void _CDECL qsort(void *, size_t, size_t, int (_CDECL *)(const void *, const void*));

View File

@ -0,0 +1,34 @@
/***
*setjmp.h - definitions/declarations for setjmp/longjmp routines
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the machine-dependent buffer used by
* setjmp/longjmp to save and restore the program state, and
* declarations for those routines.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* define the buffer type for holding the state information */
#define _JBLEN 9 /* bp, di, si, sp, ret addr, ds */
#ifndef _JMP_BUF_DEFINED
typedef int jmp_buf[_JBLEN];
#define _JMP_BUF_DEFINED
#endif
/* function prototypes */
int _CDECL setjmp(jmp_buf);
void _CDECL longjmp(jmp_buf, int);

View File

@ -0,0 +1,15 @@
/***
*share.h - defines file sharing modes for sopen
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the file sharing modes for sopen().
*
*******************************************************************************/
#define SH_COMPAT 0x00 /* compatibility mode */
#define SH_DENYRW 0x10 /* deny read/write mode */
#define SH_DENYWR 0x20 /* deny write mode */
#define SH_DENYRD 0x30 /* deny read mode */
#define SH_DENYNO 0x40 /* deny none mode */

View File

@ -0,0 +1,53 @@
/***
*signal.h - defines signal values and routines
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the signal values and declares the signal functions.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
#ifndef _SIG_ATOMIC_T_DEFINED
typedef int sig_atomic_t;
#define _SIG_ATOMIC_T_DEFINED
#endif
#define NSIG 23 /* maximum signal number + 1 */
/* signal types */
/* SIGINT, SIGFPE, SIGILL, SIGSEGV, and SIGABRT are recognized on DOS 3.x */
#define SIGINT 2 /* interrupt - corresponds to DOS 3.x int 23H */
#define SIGILL 4 /* illegal instruction - invalid function image */
#define SIGFPE 8 /* floating point exception */
#define SIGTERM 15 /* Software termination signal from kill */
#define SIGABRT 22 /* abnormal termination triggered by abort call */
/* signal action codes */
/* SIG_DFL and SIG_IGN are recognized on DOS 3.x */
#define SIG_DFL (void (*)())0 /* default signal action */
#define SIG_IGN (void (*)())1 /* ignore */
/* signal error value (returned by signal call on error) */
#define SIG_ERR (void (*)())-1 /* signal error value */
/* function prototypes */
void (_CDECL * _CDECL signal(int, void (_CDECL *)()))();
int _CDECL raise(int);

View File

@ -0,0 +1,20 @@
/***
*stdarg.h - defines ANSI-style macros for variable argument functions
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines ANSI-style macros for accessing arguments
* of functions which take a variable number of arguments.
* [ANSI]
*
*******************************************************************************/
#ifndef _VA_LIST_DEFINED
typedef char *va_list;
#define _VA_LIST_DEFINED
#endif
#define va_start(ap,v) ap = (va_list)&v + sizeof(v)
#define va_arg(ap,t) ((t*)(ap += sizeof(t)))[-1]
#define va_end(ap) ap = NULL

View File

@ -0,0 +1,47 @@
/***
*stddef.h - definitions/declarations for common constants, types, variables
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains definitions and declarations for some commonly
* used constants, types, and variables.
* [ANSI]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
/* define NULL pointer value */
#if (defined(M_I86SM) || defined(M_I86MM))
#define NULL 0
#elif (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
#define NULL 0L
#endif
/* declare reference to errno */
extern int _NEAR _CDECL errno;
/* define the implementation dependent size types */
#ifndef _PTRDIFF_T_DEFINED
typedef int ptrdiff_t;
#define _PTRDIFF_T_DEFINED
#endif
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#define _SIZE_T_DEFINED
#endif

View File

@ -0,0 +1,165 @@
/***
*stdio.h - definitions/declarations for standard I/O routines
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the structures, values, macros, and functions
* used by the level 2 I/O ("standard I/O") routines.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#define _SIZE_T_DEFINED
#endif
#ifndef _VA_LIST_DEFINED
typedef char *va_list;
#define _VA_LIST_DEFINED
#endif
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
/* buffered I/O macros */
#define BUFSIZ 512
#define _NFILE 20
#define EOF (-1)
#ifndef _FILE_DEFINED
#define FILE struct _iobuf
#define _FILE_DEFINED
#endif
/* P_tmpnam: Directory where temporary files may be created.
* L_tmpnam size = size of P_tmpdir
* + 1 (in case P_tmpdir does not end in "\\")
* + 6 (for the temp number string)
* + 1 (for the null terminator)
*/
#define P_tmpdir "\\"
#define L_tmpnam sizeof(P_tmpdir)+8
#define SEEK_CUR 1
#define SEEK_END 2
#define SEEK_SET 0
#define SYS_OPEN 20
#define TMP_MAX 32767
/* define NULL pointer value */
#if (defined(M_I86SM) || defined(M_I86MM))
#define NULL 0
#elif (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
#define NULL 0L
#endif
/* define file control block */
#ifndef _IOB_DEFINED
extern FILE {
char *_ptr;
int _cnt;
char *_base;
char _flag;
char _file;
} _NEAR _CDECL _iob[];
#define _IOB_DEFINED
#endif
#define fpos_t long /* file position variable */
#define stdin (&_iob[0])
#define stdout (&_iob[1])
#define stderr (&_iob[2])
#define stdaux (&_iob[3])
#define stdprn (&_iob[4])
#define _IOREAD 0x01
#define _IOWRT 0x02
#define _IOFBF 0x0
#define _IOLBF 0x40
#define _IONBF 0x04
#define _IOMYBUF 0x08
#define _IOEOF 0x10
#define _IOERR 0x20
#define _IOSTRG 0x40
#define _IORW 0x80
#define getc(f) (--(f)->_cnt >= 0 ? 0xff & *(f)->_ptr++ : _filbuf(f))
#define putc(c,f) (--(f)->_cnt >= 0 ? 0xff & (*(f)->_ptr++ = (char)(c)) : \
_flsbuf((c),(f)))
#define getchar() getc(stdin)
#define putchar(c) putc((c),stdout)
#define feof(f) ((f)->_flag & _IOEOF)
#define ferror(f) ((f)->_flag & _IOERR)
#define fileno(f) ((f)->_file)
/* function prototypes */
int _CDECL _filbuf(FILE *);
int _CDECL _flsbuf(int, FILE *);
void _CDECL clearerr(FILE *);
int _CDECL fclose(FILE *);
int _CDECL fcloseall(void);
FILE * _CDECL fdopen(int, char *);
int _CDECL fflush(FILE *);
int _CDECL fgetc(FILE *);
int _CDECL fgetchar(void);
int _CDECL fgetpos(FILE *, fpos_t *);
char * _CDECL fgets(char *, int, FILE *);
int _CDECL flushall(void);
FILE * _CDECL fopen(const char *, const char *);
int _CDECL fprintf(FILE *, const char *, ...);
int _CDECL fputc(int, FILE *);
int _CDECL fputchar(int);
int _CDECL fputs(const char *, FILE *);
size_t _CDECL fread(void *, size_t, size_t, FILE *);
FILE * _CDECL freopen(const char *, const char *, FILE *);
int _CDECL fscanf(FILE *, const char *, ...);
int _CDECL fsetpos(FILE *, const fpos_t *);
int _CDECL fseek(FILE *, long, int);
long _CDECL ftell(FILE *);
size_t _CDECL fwrite(const void *, size_t, size_t, FILE *);
char * _CDECL gets(char *);
int _CDECL getw(FILE *);
void _CDECL perror(const char *);
int _CDECL printf(const char *, ...);
int _CDECL puts(const char *);
int _CDECL putw(int, FILE *);
int _CDECL remove(const char *);
int _CDECL rename(const char *, const char *);
void _CDECL rewind(FILE *);
int _CDECL rmtmp(void);
int _CDECL scanf(const char *, ...);
void _CDECL setbuf(FILE *, char *);
int _CDECL setvbuf(FILE *, char *, int, size_t);
int _CDECL sprintf(char *, const char *, ...);
int _CDECL sscanf(const char *, const char *, ...);
char * _CDECL tempnam(char *, char *);
FILE * _CDECL tmpfile(void);
char * _CDECL tmpnam(char *);
int _CDECL ungetc(int, FILE *);
int _CDECL unlink(const char *);
int _CDECL vfprintf(FILE *, const char *, va_list);
int _CDECL vprintf(const char *, va_list);
int _CDECL vsprintf(char *, const char *, va_list);

View File

@ -0,0 +1,147 @@
/***
*stdlib.h - declarations/definitions for commonly used library functions
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This include file contains the function declarations for
* commonly used library functions which either don't fit somewhere
* else, or, like toupper/tolower, can't be declared in the normal
* place (ctype.h in the case of toupper/tolower) for other reasons.
* [ANSI]
*
*******************************************************************************/
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#define _SIZE_T_DEFINED
#endif
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
/* definition of the return type for the onexit() function */
#ifndef _ONEXIT_T_DEFINED
typedef int (_CDECL * _CDECL onexit_t)();
#define _ONEXIT_T_DEFINED
#endif
/* Data structure definitions for div and ldiv runtimes. */
#ifndef _DIV_T_DEFINED
typedef struct {
int quot;
int rem;
} div_t;
typedef struct {
long quot;
long rem;
} ldiv_t;
#define _DIV_T_DEFINED
#endif
/* Maximum value that can be returned by the rand function. */
#define RAND_MAX 0x7fff
/* min and max macros */
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
/* sizes for buffers used by the _makepath() and _splitpath() functions.
* note that the sizes include space for 0-terminator
*/
#define _MAX_PATH 80 /* max. length of full pathname */
#define _MAX_DRIVE 3 /* max. length of drive component */
#define _MAX_DIR 66 /* max. length of path component */
#define _MAX_FNAME 9 /* max. length of file name component */
#define _MAX_EXT 5 /* max. length of extension component */
/* external variable declarations */
extern int _NEAR _CDECL errno; /* XENIX style error number */
extern int _NEAR _CDECL _doserrno; /* MS-DOS system error value */
extern char * _NEAR _CDECL sys_errlist[]; /* perror error message table */
extern int _NEAR _CDECL sys_nerr; /* # of entries in sys_errlist table */
extern char ** _NEAR _CDECL environ; /* pointer to environment table */
extern unsigned int _NEAR _CDECL _psp; /* Program Segment Prefix */
extern int _NEAR _CDECL _fmode; /* default file translation mode */
/* DOS major/minor version numbers */
extern unsigned char _NEAR _CDECL _osmajor;
extern unsigned char _NEAR _CDECL _osminor;
/* function prototypes */
void _CDECL abort(void);
int _CDECL abs(int);
int _CDECL atexit(void (_CDECL *)(void));
double _CDECL atof(const char *);
int _CDECL atoi(const char *);
long _CDECL atol(const char *);
void * _CDECL bsearch(const void *, const void *, size_t, size_t, int (_CDECL *)(const void *, const void *));
void * _CDECL calloc(size_t, size_t);
div_t _CDECL div(int, int);
char * _CDECL ecvt(double, int, int *, int *);
void _CDECL exit(int);
void _CDECL _exit(int);
char * _CDECL fcvt(double, int, int *, int *);
void _CDECL free(void *);
char * _CDECL gcvt(double, int, char *);
char * _CDECL getenv(const char *);
char * _CDECL itoa(int, char *, int);
long _CDECL labs(long);
ldiv_t _CDECL ldiv(long, long);
unsigned long _CDECL _lrotl(unsigned long, int);
unsigned long _CDECL _lrotr(unsigned long, int);
char * _CDECL ltoa(long, char *, int);
void _CDECL _makepath(char *, char *, char *, char *, char *);
void * _CDECL malloc(size_t);
onexit_t _CDECL onexit(onexit_t);
void _CDECL perror(const char *);
int _CDECL putenv(char *);
void _CDECL qsort(void *, size_t, size_t, int (_CDECL *)(const void *, const void *));
unsigned int _CDECL _rotl(unsigned int, int);
unsigned int _CDECL _rotr(unsigned int, int);
int _CDECL rand(void);
void * _CDECL realloc(void *, size_t);
void _CDECL _searchenv(char *, char *, char *);
void _CDECL _splitpath(char *, char *, char *, char *, char *);
void _CDECL srand(unsigned int);
double _CDECL strtod(const char *, char **);
long _CDECL strtol(const char *, char **, int);
unsigned long _CDECL strtoul(const char *, char **, int);
void _CDECL swab(char *, char *, int);
int _CDECL system(const char *);
char * _CDECL ultoa(unsigned long, char *, int);
#ifndef tolower /* tolower has been undefined - use function */
int _CDECL tolower(int);
#endif /* tolower */
#ifndef toupper /* toupper has been undefined - use function */
int _CDECL toupper(int);
#endif /* toupper */

View File

@ -0,0 +1,61 @@
/***
*string.h - declarations for string manipulation functions
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the function declarations for the string
* manipulation functions.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#define _SIZE_T_DEFINED
#endif
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#else /* extensions not enabled */
#define _CDECL
#endif /* NO_EXT_KEYS */
/* function prototypes */
void * _CDECL memccpy(void *, void *, int, unsigned int);
void * _CDECL memchr(const void *, int, size_t);
int _CDECL memcmp(const void *, const void *, size_t);
int _CDECL memicmp(void *, void *, unsigned int);
void * _CDECL memcpy(void *, const void *, size_t);
void * _CDECL memmove(void *, const void *, size_t);
void * _CDECL memset(void *, int, size_t);
void _CDECL movedata(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
char * _CDECL strcat(char *, const char *);
char * _CDECL strchr(const char *, int);
int _CDECL strcmp(const char *, const char *);
int _CDECL strcmpi(const char *, const char *);
int _CDECL stricmp(const char *, const char *);
char * _CDECL strcpy(char *, const char *);
size_t _CDECL strcspn(const char *, const char *);
char * _CDECL strdup(const char *);
char * _CDECL _strerror(char *);
char * _CDECL strerror(int);
size_t _CDECL strlen(const char *);
char * _CDECL strlwr(char *);
char * _CDECL strncat(char *, const char *, size_t);
int _CDECL strncmp(const char *, const char *, size_t);
int _CDECL strnicmp(const char *, const char *, size_t);
char * _CDECL strncpy(char *, const char *, size_t);
char * _CDECL strnset(char *, int, size_t);
char * _CDECL strpbrk(const char *, const char *);
char * _CDECL strrchr(const char *, int);
char * _CDECL strrev(char *);
char * _CDECL strset(char *, int);
size_t _CDECL strspn(const char *, const char *);
char * _CDECL strstr(const char *, const char *);
char * _CDECL strtok(char *, const char *);
char * _CDECL strupr(char *);

View File

@ -0,0 +1,16 @@
/***
*sys\locking.h - flags for locking() function
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the flags for the locking() function.
* [System V]
*
*******************************************************************************/
#define LK_UNLCK 0 /* unlock the file region */
#define LK_LOCK 1 /* lock the file region */
#define LK_NBLCK 2 /* non-blocking lock */
#define LK_RLCK 3 /* lock for writing */
#define LK_NBRLCK 4 /* non-blocking lock for writing */

View File

@ -0,0 +1,56 @@
/***
*sys\stat.h - defines structure used by stat() and fstat()
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the structure used by the stat() and fstat()
* routines.
* [System V]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define CDECL cdecl
#else /* extensions not enabled */
#define CDECL
#endif /* NO_EXT_KEYS */
#ifndef _TIME_T_DEFINED
typedef long time_t;
#define _TIME_T_DEFINED
#endif
/* define structure for returning status information */
#ifndef _STAT_DEFINED
struct stat {
dev_t st_dev;
ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
dev_t st_rdev;
off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};
#define _STAT_DEFINED
#endif
#define S_IFMT 0170000 /* file type mask */
#define S_IFDIR 0040000 /* directory */
#define S_IFCHR 0020000 /* character special */
#define S_IFREG 0100000 /* regular */
#define S_IREAD 0000400 /* read permission, owner */
#define S_IWRITE 0000200 /* write permission, owner */
#define S_IEXEC 0000100 /* execute/search permission, owner */
/* function prototypes */
int CDECL fstat(int, struct stat *);
int CDECL stat(char *, struct stat *);

View File

@ -0,0 +1,40 @@
/***
*sys\timeb.h - definition/declarations for ftime()
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file define the ftime() function and the types it uses.
* [System V]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define CDECL cdecl
#else /* extensions not enabled */
#define CDECL
#endif /* NO_EXT_KEYS */
#ifndef _TIME_T_DEFINED
typedef long time_t;
#define _TIME_T_DEFINED
#endif
/* structure returned by ftime system call */
#ifndef _TIMEB_DEFINED
struct timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
#define _TIMEB_DEFINED
#endif
/* function prototypes */
void CDECL ftime(struct timeb *);

View File

@ -0,0 +1,31 @@
/***
*sys\types.h - types returned by system level calls for file and time info
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines types used in defining values returned by system
* level calls for file status and time information.
* [System V]
*
*******************************************************************************/
#ifndef _INO_T_DEFINED
typedef unsigned short ino_t; /* i-node number (not used on DOS) */
#define _INO_T_DEFINED
#endif
#ifndef _TIME_T_DEFINED
typedef long time_t;
#define _TIME_T_DEFINED
#endif
#ifndef _DEV_T_DEFINED
typedef short dev_t; /* device code */
#define _DEV_T_DEFINED
#endif
#ifndef _OFF_T_DEFINED
typedef long off_t; /* file offset value */
#define _OFF_T_DEFINED
#endif

View File

@ -0,0 +1,40 @@
/***
*sys\utime.h - definitions/declarations for utime()
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the structure used by the utime routine to set
* new file access and modification times. NOTE - MS-DOS
* does not recognize access time, so this field will
* always be ignored and the modification time field will be
* used to set the new time.
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define CDECL cdecl
#else /* extensions not enabled */
#define CDECL
#endif /* NO_EXT_KEYS */
#ifndef _TIME_T_DEFINED
typedef long time_t;
#define _TIME_T_DEFINED
#endif
/* define struct used by utime() function */
#ifndef _UTIMBUF_DEFINED
struct utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};
#define _UTIMBUF_DEFINED
#endif
/* function prototypes */
int CDECL utime(char *, struct utimbuf *);

View File

@ -0,0 +1,75 @@
/***
*time.h - definitions/declarations for time routines
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file has declarations of time routines and defines
* the structure returned by the localtime and gmtime routines and
* used by asctime.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
/* define the implementation defined time type */
#ifndef _TIME_T_DEFINED
typedef long time_t; /* time value */
#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
#endif
#ifndef _CLOCK_T_DEFINED
typedef long clock_t;
#define _CLOCK_T_DEFINED
#endif
#ifndef _TM_DEFINED
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
};
#define _TM_DEFINED
#endif
#define CLK_TCK 1000
/* extern declarations for the global variables used by the ctime family of
* routines.
*/
extern int _NEAR _CDECL daylight; /* non-zero if daylight savings time is used */
extern long _NEAR _CDECL timezone; /* difference in seconds between GMT and local time */
extern char * _NEAR _CDECL tzname[2]; /* standard/daylight savings time zone names */
/* function prototypes */
char * _CDECL asctime(const struct tm *);
char * _CDECL ctime(const time_t *);
clock_t _CDECL clock(void);
double _CDECL difftime(time_t, time_t);
struct tm * _CDECL gmtime(const time_t *);
struct tm * _CDECL localtime(const time_t *);
time_t _CDECL mktime(struct tm *);
char * _CDECL _strdate(char *);
char * _CDECL _strtime(char *);
time_t _CDECL time(time_t *);
void _CDECL tzset(void);

View File

@ -0,0 +1,21 @@
/***
*varargs.h - XENIX style macros for variable argument functions
*
* Copyright (c) 1985-1987, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines XENIX style macros for accessing arguments of a
* function which takes a variable number of arguments.
* [System V]
*
*******************************************************************************/
#ifndef _VA_LIST_DEFINED
typedef char *va_list;
#define _VA_LIST_DEFINED
#endif
#define va_dcl va_list va_alist;
#define va_start(ap) ap = (va_list)&va_alist
#define va_arg(ap,t) ((t*)(ap += sizeof(t)))[-1]
#define va_end(ap) ap = NULL

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.