Intel iC-86 Compiler v4.5

This commit is contained in:
davidly 2024-07-02 07:18:39 -07:00
parent c8956768f2
commit 20ea3e7590
119 changed files with 40909 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
PATH=G:\INTEL\IC86;
rem -- :INCLUDE: is used to locate iC-86 header files
SET :INCLUDE:=G:\INTEL\IC86\INC

View File

@ -0,0 +1,2 @@
FILES=20
BUFFERS=30

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;
}

View File

@ -0,0 +1,119 @@
DOS 3.3 (046-N) 8086 LINKER, V3.1
INPUT FILES: LIBS\CSTDOSS.OBJ, C:\T_SETJMP.OBJ, C:\LIBS\CDOSS.LIB,
UTIL\CEL87.LIB, UTIL\E8087.LIB, UTIL\DE8087, LIBS\CLIB87.LIB
OUTPUT FILE: EXE
CONTROLS SPECIFIED IN INVOCATION COMMAND:
DATE: 06/27/<4 TIME: 07:37:49
LINK MAP OF MODULE CQ_CSTART
LOGICAL SEGMENTS INCLUDED:
LENGTH ADDRESS ALIGN SEGMENT CLASS OVERLAY
0000H ------ G ??SEG
3456H ------ G CODE CODE
0710H ------ G DATA DATA
0002H ------ G MEMORY MEMORY
0834H ------ G STACK STACK
0330H ------ G CONST CONST
01B7H ------ W MQ_CEL_CODE MQ_CEL_CODE
00D2H ------ W MQ_CEL_CONST MQ_CEL_CONST
0000H ------ G LIB_E87_PUB
0030H ------ W LIB_E87_INT
0028H ------ G LIB_E87_INIT
3B34H ------ G A?MED AQMCODE
0014H ------ G A?MUN AQMDATA
0005H ------ G A?MJU AQMDATA
0050H ------ G A?MSK AQMDATA
000EH ------ G A?MSR AQMDATA
000CH ------ W CQ_EMUNULL_COD CODE
-E
0000H ------ W CQ_EMUNULL_DAT DATA
-A
INPUT MODULES INCLUDED:
LIBS\CSTDOSS.OBJ(CQ_CSTART)
C:\T_SETJMP.OBJ(T_SETJMP)
C:\LIBS\CDOSS.LIB(CQ__MAIN3)
C:\LIBS\CDOSS.LIB(CQ_EXIT)
C:\LIBS\CDOSS.LIB(CQ__EXIT_IN)
C:\LIBS\CDOSS.LIB(CQ__STDIO_I)
C:\LIBS\CDOSS.LIB(CQ__THREAD_)
C:\LIBS\CDOSS.LIB(CQ_PRINTF)
C:\LIBS\CDOSS.LIB(CQ__EXIT)
C:\LIBS\CDOSS.LIB(CQ_LONGJMP)
C:\LIBS\CDOSS.LIB(CQ_SETJMP)
C:\LIBS\CDOSS.LIB(CQ_PUTC)
C:\LIBS\CDOSS.LIB(CQ__CREATE)
C:\LIBS\CDOSS.LIB(CQ__SEMAPHO)
C:\LIBS\CDOSS.LIB(CQ__STDOPEN)
C:\LIBS\CDOSS.LIB(CQ_FCLOSEAL)
C:\LIBS\CDOSS.LIB(CQ__DOPRNT)
C:\LIBS\CDOSS.LIB(CQ_FFLUSH)
C:\LIBS\CDOSS.LIB(CQ_FLUSHALL)
C:\LIBS\CDOSS.LIB(CQ__QUIT)
C:\LIBS\CDOSS.LIB(CQ_MALLOC)
C:\LIBS\CDOSS.LIB(CQ_REALLOC)
C:\LIBS\CDOSS.LIB(CQ_ISATTY)
C:\LIBS\CDOSS.LIB(CQ_CTYPE)
C:\LIBS\CDOSS.LIB(LQ_ULONG_DIVIDE)
C:\LIBS\CDOSS.LIB(CQ__FMODE_I)
C:\LIBS\CDOSS.LIB(CQ__FINFO_I)
C:\LIBS\CDOSS.LIB(CQ__MAIN0)
C:\LIBS\CDOSS.LIB(CQ__MAIN2)
C:\LIBS\CDOSS.LIB(CQ__MAIN4)
C:\LIBS\CDOSS.LIB(CQ__MAINLAS)
C:\LIBS\CDOSS.LIB(CQ_AUXSTART)
C:\LIBS\CDOSS.LIB(CQ_IFHCOUNT)
C:\LIBS\CDOSS.LIB(CQ_NFILE)
C:\LIBS\CDOSS.LIB(CQ_FCLOSE)
C:\LIBS\CDOSS.LIB(CQ__FLSBUF)
C:\LIBS\CDOSS.LIB(CQ__INIT_CL)
C:\LIBS\CDOSS.LIB(CQ__FLTPRNT)
C:\LIBS\CDOSS.LIB(CQ__VALIDAT)
C:\LIBS\CDOSS.LIB(CQ_LSEEK)
C:\LIBS\CDOSS.LIB(CQ_WRITE)
C:\LIBS\CDOSS.LIB(CQ_RAISE)
C:\LIBS\CDOSS.LIB(CQ__MAP_LEN)
C:\LIBS\CDOSS.LIB(CQ_FREE)
C:\LIBS\CDOSS.LIB(CQ_REMOVE)
C:\LIBS\CDOSS.LIB(CQ__DTOS)
C:\LIBS\CDOSS.LIB(CQ_SIGNAL)
C:\LIBS\CDOSS.LIB(CQ_CLOSE)
C:\LIBS\CDOSS.LIB(CQ__CTLCINT)
C:\LIBS\CDOSS.LIB(CQ__MALLOC)
C:\LIBS\CDOSS.LIB(CQ_SYSINT21)
C:\LIBS\CDOSS.LIB(CQ__DOSF25)
C:\LIBS\CDOSS.LIB(CQ__DOSF35)
C:\LIBS\CDOSS.LIB(CQ__DOSF48)
C:\LIBS\CDOSS.LIB(CQ_MEMMOVE)
C:\LIBS\CDOSS.LIB(CQ_STRLEN)
C:\LIBS\CDOSS.LIB(CQ_STRUPR)
C:\LIBS\CDOSS.LIB(CQ__DTOBCD)
C:\LIBS\CDOSS.LIB(CQ__POW_10)
C:\LIBS\CDOSS.LIB(CQ_LOG10)
C:\LIBS\CDOSS.LIB(CQ_UNLINK)
C:\LIBS\CDOSS.LIB(CQ__RAISE)
C:\LIBS\CDOSS.LIB(CQ_SBRK)
C:\LIBS\CDOSS.LIB(CQ__CLEAR87)
C:\LIBS\CDOSS.LIB(CQ__ERR_MAP)
C:\LIBS\CDOSS.LIB(CQ__STATUS87)
C:\LIBS\CDOSS.LIB(CQ_MATHERR)
C:\LIBS\CDOSS.LIB(CQ_BDOS)
UTIL\CEL87.LIB(LOG10)
UTIL\CEL87.LIB(MQ_NAN)
UTIL\CEL87.LIB(MQ_I)
UTIL\CEL87.LIB(MQ_LOG)
UTIL\CEL87.LIB(MQ_PII)
UTIL\CEL87.LIB(MQ_NQ)
UTIL\CEL87.LIB(DECIDE)
UTIL\CEL87.LIB(MQERSTACK)
UTIL\CEL87.LIB(YL2X)
UTIL\CEL87.LIB(CONSTANTS)
UTIL\CEL87.LIB(RERR)
UTIL\E8087.LIB(EPUB)
UTIL\E8087.LIB(ENIT)
UTIL\DE8087(VERSIONNUMBERV1P3)
LIBS\CLIB87.LIB(CQ_EMUNULL)

Binary file not shown.

Binary file not shown.

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,169 @@
#include <stdio.h>
#ifdef AZTEC86
#include <stdlib.h>
#endif
#ifdef HISOFTC
#include <stdlib.h>
#endif
#ifdef INTELC
#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 10
#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*/

Binary file not shown.

View File

@ -0,0 +1,31 @@
/* assert.h - define the assert macro
* $Version: 1.9 $
* Copyright (c) 1984, 85 Computer Innovations Inc, ALL RIGHTS RESERVED.
* Copyright (c) 1988, 89 Intel Corporation, ALL RIGHTS RESERVED.
*/
#undef assert
#ifndef NDEBUG
#ifndef _stdioh
#include <stdio.h>
#endif
#ifndef _stdlibh
#include <stdlib.h>
#endif
#define assert(_exp_) { \
if (!(_exp_)) { \
fprintf(stderr, "Assertion failed: %s, file %s, line %d\n", \
#_exp_, __FILE__, __LINE__); \
abort(); \
} \
}
#else
#define assert(ignore)
#endif /* NDEBUG */

View File

@ -0,0 +1,131 @@
/* bios.h - BIOS functions
* $Version: 1.2 $
* Copyright 1990,91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _biosh
#define _biosh
#pragma fixedparams("_bios_disk", "_bios_equiplist", "_bios_keybrd")
#pragma fixedparams("_bios_memsize", "_bios_printer", "_bios_serialcom")
#pragma fixedparams("_bios_timeofday")
/* BIOS COM port configuration constants */
#define _COM_INIT 0x00 /* Initialize the com port */
#define _COM_SEND 0x01 /* Send a byte to the com port */
#define _COM_RECEIVE 0x02 /* Get a byte from the com port */
#define _COM_STATUS 0x03 /* Get status from the com port */
#define _COM_110 0x00 /* Baud rate: 110 */
#define _COM_150 0x20 /* Baud rate: 150 */
#define _COM_300 0x40 /* Baud rate: 300 */
#define _COM_600 0x60 /* Baud rate: 600 */
#define _COM_1200 0x80 /* Baud rate: 1200 */
#define _COM_2400 0xA0 /* Baud rate: 2400 */
#define _COM_4800 0xC0 /* Baud rate: 4800 */
#define _COM_9600 0xE0 /* Baud rate: 9600 */
#define _COM_CHR7 0x02 /* Seven data bits per character */
#define _COM_CHR8 0x03 /* Eight data bits per character */
#define _COM_NOPARITY 0x00 /* No parity check */
#define _COM_ODDPARITY 0x08 /* Check for odd parity */
#define _COM_EVENPARITY 0x18 /* Check for even parity */
#define _COM_STOP1 0x00 /* One stop bit */
#define _COM_STOP2 0x04 /* Two stop bits */
/* BIOS disk operations */
#define _DISK_RESET 0x00 /* Reset the disk controller */
#define _DISK_STATUS 0x01 /* Get status from the disk */
#define _DISK_READ 0x02 /* Read sectors from the disk */
#define _DISK_WRITE 0x03 /* Write sectors to the disk */
#define _DISK_VERIFY 0x04 /* Verify disk sectors */
#define _DISK_FORMAT 0x05 /* Format a disk track */
#ifndef _FAR
#define _FAR
#define _HUGE
#define _NEAR
#endif
/* BIOS disk structure */
#ifndef _diskinfo_t
#pragma align (diskinfo_t)
struct diskinfo_t {
unsigned short drive;
unsigned short head;
unsigned short track;
unsigned short sector;
unsigned short nsectors;
void _FAR *buffer;
};
#define _diskinfo_t
#define _DISKINFO_T_DEFINED
#endif /* _diskinfo_t */
/* BIOS keyboard operations */
#define _KEYBRD_READ 0x00 /* Get next character from keyboard */
#define _KEYBRD_READY 0x01 /* See if a keystroke is ready */
#define _KEYBRD_SHIFTSTATUS 0x02 /* Get status of shift key */
/* BIOS enhanced keyboards operations */
#define _NKEYBRD_READ 0x10 /* Get next character from keyboard */
#define _NKEYBRD_READY 0x11 /* See if a keystroke is ready */
#define _NKEYBRD_SHIFTSTATUS 0x12 /* Get status of Shift key */
/* BIOS printer operations */
#define _PRINTER_WRITE 0x00 /* Write characters to the printer */
#define _PRINTER_INIT 0x01 /* Initialize the printer */
#define _PRINTER_STATUS 0x02 /* Get status from the printer */
/* BIOS clock operations */
#define _TIME_GETCLOCK 0x00 /* Get the clock counter */
#define _TIME_SETCLOCK 0x01 /* Set the clock counter */
/* Registers union - overlay the DWORD, WORD, and BYTE register
* structures into the same memory area. Declaration of "eax" and "ax"
* entries the same (unsigned) for ease of porting code using "ax". Also,
* note the optional 16-bit implementation of 'x' field.
*/
#ifndef _regs
#pragma align (DWORDREGS)
#pragma align (WORDREGS)
#pragma align (BYTEREGS)
union REGS {
struct DWORDREGS {unsigned eax, ebx, ecx, edx, esi,
edi, cflag, eflags, ebp;} w;
struct WORDREGS {unsigned ax, bx, cx, dx, si,
di, cflag, flags, bp;} x;
#if _ARCHITECTURE_ == 386 || _ARCHITECTURE_ == 486
struct BYTEREGS {unsigned al:8, ah:8, :16, bl:8, bh:8, :16,
cl:8, ch:8, :16, dl:8, dh:8, :16;} h;
#else
struct BYTEREGS {unsigned al:8, ah:8, bl:8, bh:8,
cl:8, ch:8, dl:8, dh:8;} h;
#endif
};
/* Selector/Segment register structure */
#pragma align (SREGS)
struct SREGS {unsigned short es, cs, ss, ds, fs, gs;};
#define _regs
#endif /* _regs */
/*
* Function prototypes
*/
unsigned int _bios_disk(unsigned, struct diskinfo_t *);
unsigned int _bios_equiplist(void);
unsigned int _bios_keybrd(unsigned);
unsigned int _bios_memsize(void);
unsigned int _bios_printer(unsigned, unsigned, unsigned);
unsigned int _bios_serialcom(unsigned, unsigned, unsigned);
unsigned int _bios_timeofday(unsigned, long *);
#endif /* _biosh */

View File

@ -0,0 +1,28 @@
/* conio.h - low level I/O function prototypes
* $Version: 1.17 $
* Copyright (C) 1988-91 Intel Corporation, ALL RIGHTS RESERVED
*/
#ifndef _conioh
#define _conioh
/*lint -library */
#pragma fixedparams("cgets", "cputs", "getch", "getche")
#pragma fixedparams("kbhit", "putch", "ungetch")
#pragma varparams("cprintf", "cscanf")
/*
* Function prototypes:
*/
char *cgets(char *);
int cprintf(const char *, ...);
int cputs(const char *);
int cscanf(const char *, ...);
int getch(void);
int getche(void);
int kbhit(void);
int putch(int);
int ungetch(int);
#endif /* _conioh */

View File

@ -0,0 +1,80 @@
/* ctype.h - character tests
* $Version: 1.22 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _ctypeh
#define _ctypeh
/*lint -library */
#pragma fixedparams("_tolower", "_toupper", "isalnum", "isascii", "isalpha")
#pragma fixedparams("iscntrl", "isdigit", "isgraph", "islower", "isodigit")
#pragma fixedparams("isprint", "ispunct", "isspace", "isupper", "isxdigit")
#pragma fixedparams("tolower", "toupper")
#define _UPPER 0x01
#define _LOWER 0x02
#define _DIGIT 0x04
#define _SPACE 0x08
#define _PUNCT 0x10
#define _CONTROL 0x20
#define _BLANK 0x40
#define _HEX 0x80
/*
* Function prototypes:
*/
int isalnum(int);
int isalpha(int);
int isascii(int);
int iscntrl(int);
int iscsym(int);
int iscsymf(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isodigit(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
int toascii(int);
int _tolower(int);
int tolower(int);
int _toupper(int);
int toupper(int);
/*
* Macros for ctype functions:
*/
#if _FAR_CODE_ || _ROM_ || !_FAR_DATA_
extern const unsigned char _ctype[257];
#define isalnum(_c) (_ctype[(unsigned char)(_c)] & (_DIGIT|_LOWER|_UPPER))
#define isalpha(_c) (_ctype[(unsigned char)(_c)] & (_LOWER|_UPPER))
#define iscntrl(_c) (_ctype[(unsigned char)(_c)] & (_CONTROL))
#define isdigit(_c) (_ctype[(unsigned char)(_c)] & (_DIGIT))
#define isgraph(_c) (_ctype[(unsigned char)(_c)] & (_DIGIT|_LOWER|_PUNCT|_UPPER))
#define islower(_c) (_ctype[(unsigned char)(_c)] & (_LOWER))
#define isprint(_c) (_ctype[(unsigned char)(_c)] & (_DIGIT|_LOWER|_PUNCT|_BLANK|_UPPER))
#define ispunct(_c) (_ctype[(unsigned char)(_c)] & (_PUNCT))
#define isspace(_c) (_ctype[(unsigned char)(_c)] & (_SPACE))
#define isupper(_c) (_ctype[(unsigned char)(_c)] & (_UPPER))
#define isxdigit(_c) (_ctype[(unsigned char)(_c)] & (_HEX))
#endif
#define isascii(_c) (int)((unsigned)(_c)<=0x7f)
#define toascii(_c) (int)((unsigned)(_c)&0x7f)
#define _tolower(_c) ((_c)+'a'-'A')
#define _toupper(_c) ((_c)+'A'-'a')
/*
* iscsym() and iscsymf() are only defined as macros:
*/
#define iscsym(_c) ((isalnum(_c)) || (_c == '_'))
#define iscsymf(_c) ((isalpha(_c)) || (_c == '_'))
#endif /* _ctypeh */

View File

@ -0,0 +1,31 @@
/* direct.h - directory manipulation function prototypes
* $Version: 1.14 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _directh
#define _directh
/*lint -library */
#pragma fixedparams("chdir", "_chdrive", "filedir", "gcdir", "getcwd")
#pragma fixedparams("_getdcwd", "_getdrive", "mkdir", "rmdir")
#ifndef _mode_t
#define _mode_t
typedef unsigned long mode_t;
#endif
/*
* Function prototypes:
*/
int chdir(const char *);
int _chdrive(int);
char *filedir(const char *, unsigned);
char *gcdir(const char *);
char *getcwd(char *, int);
char *_getdcwd(int, char *, int);
int _getdrive(void);
int mkdir(const char *, mode_t);
int rmdir(const char *);
#endif /* _directh */

View File

@ -0,0 +1,235 @@
/* dos.h - This file defines data structures for DOS access.
* $Version: 1.32 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _dosh
#define _dosh
/*lint -library */
#pragma fixedparams("_dos_allocmem", "_dos_close", "_dos_creat")
#pragma fixedparams("_dos_creatnew", "_dos_findfirst", "_dos_findnext")
#pragma fixedparams("_dos_freemem", "_dos_getdate", "_dos_getdiskfree")
#pragma fixedparams("_dos_getdrive", "_dos_getfileattr", "_dos_getftime")
#pragma fixedparams("_dos_gettime", "_dos_open", "_dos_read")
#pragma fixedparams("_dos_setblock", "_dos_setdate", "_dos_setdrive")
#pragma fixedparams("_dos_setfileattr", "_dos_setftime", "_dos_settime")
#pragma fixedparams("_dos_write")
#pragma fixedparams("bdos", "_ctlcint", "dosexterr", "int86")
#pragma fixedparams("int86x", "intdos", "intdosx", "loadexec")
#pragma fixedparams("ptrdiff", "_quit", "sysint", "sysint21")
/*
* File attribute masks:
*/
#define _A_NORMAL 0x00 /* Normal file access, read/write OK */
#define _A_RDONLY 0x01 /* File is read-only */
#define _A_HIDDEN 0x02 /* File is hidden */
#define _A_SYSTEM 0x04 /* File is a system file */
#define _A_VOLID 0x08 /* File holds volume ID */
#define _A_SUBDIR 0x10 /* File is a subdirectory */
#define _A_ARCH 0x20 /* File needs to be archived */
#ifndef _FAR
#define _FAR far
#define _NEAR near
#endif
/* used by functions needing the DS register or seg. and off. of a pointer */
extern unsigned _dataseg;
#define DATASEG() _dataseg
#define FP_OFF(p) (((unsigned *)(&(p)))[0])
#define FP_SEG(p) (((unsigned *)(&(p)))[1])
#define _NP_OFF(p) ((unsigned)p)
#define _NP_SEG(p) _dataseg
#if !_FAR_DATA_ /* near data */
#define P_SEG(p) _NP_SEG(p)
#define P_OFF(p) _NP_OFF(p)
#else /* far or huge data */
#define P_SEG(p) FP_SEG(p)
#define P_OFF(p) FP_OFF(p)
#endif
#define _doserrno ((_thread_ptr()->__doserrno)) /* DOS system error variable */
#pragma align (DOSERROR)
struct DOSERROR {
int exterror;
char class, action, locus;
};
/*
* Structure used by loadexec function:
*/
#pragma align (pblock)
struct pblock {
unsigned env; /* segment address of environment */
char _FAR *com_line; /* program command line */
char _FAR *fcb1;
char _FAR *fcb2;
};
/*
* Used by sysint() and sysint21():
*/
#pragma align (regval)
struct regval {
unsigned int ax, bx, cx, dx, si, di, ds, es, bp;
};
#ifndef _regs
#pragma align (DWORDREGS)
#pragma align (WORDREGS)
#pragma align (BYTEREGS)
union REGS {
struct DWORDREGS {unsigned eax, ebx, ecx, edx, esi,
edi, cflag, eflags, ebp;} w;
struct WORDREGS {unsigned ax, bx, cx, dx, si,
di, cflag, flags, bp;} x;
#if _ARCHITECTURE_ == 386 || _ARCHITECTURE_ == 486
struct BYTEREGS {unsigned al:8, ah:8, :16, bl:8, bh:8, :16,
cl:8, ch:8, :16, dl:8, dh:8, :16;} h;
#else
struct BYTEREGS {unsigned al:8, ah:8, bl:8, bh:8,
cl:8, ch:8, dl:8, dh:8;} h;
#endif
};
#pragma align (SREGS)
struct SREGS {
unsigned short es, cs, ss, ds, fs, gs;
};
#define _regs
#endif /* _regs */
#ifndef _find_t
/* structure used by _dos_findfirst */
/*
* Structure used by _dos_findfirst:
*/
#pragma noalign (find_t)
struct find_t {
char reserved[21]; /* Reserved for DOS */
char attrib; /* Returned attribute */
unsigned short wr_time; /* Time file last written */
unsigned short wr_date; /* Date file last written */
long size; /* Size of file */
char name[13]; /* String containing the filename */
};
#define _find_t
#endif
/*
* Structure used by _dos_getdate and _dos_setdate:
*/
#pragma align (dosdate_t)
struct dosdate_t {
unsigned char day; /* Range: 1-31 */
unsigned char month; /* Range: 1-12 */
unsigned short year; /* Range: 1980-2099 */
unsigned char dayofweek; /* Range: 0-6 (0=Sun, 1=Mon, etc.) */
};
/*
* Structure used by _dos_gettime and _dos_settime:
*/
#pragma align (dostime_t)
struct dostime_t {
unsigned char hour; /* Range: 0-23 */
unsigned char minute; /* Range: 0-59 */
unsigned char second; /* Range: 0-59 */
unsigned char hsecond; /* Range: 0-99 */
};
/*
* Structure used by _dos_getdiskfree:
*/
#pragma align (diskfree_t)
struct diskfree_t {
unsigned short total_clusters;
unsigned short avail_clusters;
unsigned short sectors_per_cluster;
unsigned short bytes_per_sector;
};
/*
* Function prototypes:
*/
int bdos(int, unsigned int, unsigned int);
void _FAR _ctlcint(void);
unsigned _dos_allocmem(unsigned, unsigned *);
unsigned _dos_close(int);
unsigned _dos_creat(const char *, unsigned, int *);
unsigned _dos_creatnew(const char *, unsigned, int *);
unsigned _dos_findfirst(const char *, unsigned, struct find_t *);
unsigned _dos_findnext(struct find_t *);
unsigned _dos_freemem(unsigned);
void _dos_getdate(struct dosdate_t *);
unsigned _dos_getdiskfree(unsigned, struct diskfree_t *);
void _dos_getdrive(unsigned *);
unsigned _dos_getfileattr(const char *, unsigned *);
unsigned _dos_getftime(int, unsigned *, unsigned *);
void _dos_gettime(struct dostime_t *);
unsigned _dos_open(const char *, unsigned, int *);
unsigned _dos_read(int, void *, unsigned, unsigned *);
unsigned _dos_setblock(unsigned, unsigned, unsigned *);
unsigned _dos_setdate(struct dosdate_t *);
void _dos_setdrive(unsigned, unsigned *);
unsigned _dos_setfileattr(const char *, unsigned);
unsigned _dos_setftime(int, unsigned, unsigned);
unsigned _dos_settime(struct dostime_t *);
unsigned _dos_write(int, const void *, unsigned, unsigned *);
int dosexterr(struct DOSERROR *);
int int86(int, const union REGS *, union REGS *);
int int86x(int, const union REGS *, union REGS *, struct SREGS *);
int intdos(const union REGS *, union REGS *);
int intdosx(const union REGS *, union REGS *, struct SREGS *);
int loadexec(char _FAR *, struct pblock _FAR *, int);
long ptrdiff(void _FAR *, void _FAR *);
void _quit(int);
int sysint(unsigned, const struct regval *, struct regval *);
int sysint21(const struct regval *, struct regval *);
/*
* Non-ANSI function also prototyped in stdlib.h
*/
#ifndef _stdlib_dos
#define _stdlib_dos
#pragma fixedparams("segread")
void segread(struct SREGS *);
#endif
#ifndef _dosh_builtin
#define _dosh_builtin
/*
* Processor status flag values:
*/
#define _FLAG_CARRY 0x0001 /* Carry flag */
#define _FLAG_PARITY 0x0004 /* Parity flag */
#define _FLAG_AUXCARRY 0x0010 /* Auxillary carry flag */
#define _FLAG_ZERO 0x0040 /* Zero flag */
#define _FLAG_SIGN 0x0080 /* Sign flag */
#define _FLAG_TRAP 0x0100 /* Trap flag */
#define _FLAG_INTERRUPT 0x0200 /* Interrupt enable flag */
#define _FLAG_DIRECTION 0x0400 /* Direction flag */
#define _FLAG_OVERFLOW 0x0800 /* Overflow flag */
#define _FLAG_IOPL 0x3000 /* IO privilege level mask */
#define _FLAG_NESTED 0x4000 /* Nested task flag */
#define _FLAG_RESUME 0x10000 /* Resume flag */
#define _FLAG_VM 0x20000 /* Virtual 86 mode */
#endif /* _dosh_builtin */
#endif /* _dosh */

View File

@ -0,0 +1,66 @@
/* errno.h - error number definitions
* $Version: 1.17 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _errnoh
#define _errnoh
/*lint -library */
#ifndef _reenth
#include <reent.h>
#endif
#define errno (_thread_ptr()->_errno)
#ifndef EBUSY /* These mnemonics are also defined in RMXERR.H */
#define EBUSY 3 /* system resource busy */
#define EEXIST 6 /* file already exists */
#define EIO 43 /* I/O error */
#endif
#define E2BIG 1 /* size of argument list too long */
#define EACCES 2 /* file access denied */
#define EAGAIN 4 /* system resource temporarily unavailable */
#define EBADF 5 /* invalid file descriptor */
#define ECHILD 7 /* no child process */
#define EDEADLK 8 /* resource deadlock avoided */
#define EDEADLOCK 9 /* locking violation */
#define EDOM 10 /* math arg out of domain of func */
#define EFAULT 11 /* bad address */
#define EFBIG 12 /* file too large */
#define EFREE 13 /* bad free pointer */
#define EINTR 14 /* interrupted function call */
#define EINVAL 15 /* invalid argument or operation */
#define EISDIR 16 /* is a directory */
#define EMFILE 17 /* too many open files for process */
#define EMLINK 18 /* too many links */
#define ENAMETOOLONG 19 /* filename too long */
#define ENFILE 20 /* system file table overflow */
#define ENODEV 21 /* no such device */
#define ENOENT 22 /* file or path not found */
#define ENOEXEC 23 /* file not executable */
#define ENOLCK 24 /* no locks available */
#define ENOMEM 25 /* not enough space */
#define ENOSPC 26 /* no space left on device */
#define ENOSYS 27 /* function not implemented */
#define ENOTBLK 28 /* block device required */
#define ENOTDIR 29 /* not a directory */
#define ENOTEMPTY 30 /* directory not empty */
#define ENOTTY 31 /* inappropriate I/O control */
#define ENXIO 32 /* no such device or address */
#define EPERM 33 /* operation not permitted */
#define EPIPE 34 /* broken pipe */
#define ERANGE 35 /* math functon result not representable */
#define EROFS 36 /* read only file system */
#define ESIGNAL 37 /* bad signal vector */
#define ESPIPE 38 /* illegal seek */
#define ESRCH 39 /* no such process */
#define ETXTBSY 40 /* text file busy */
#define EXDEV 41 /* improper link */
#define _NUM_ERR_NUMS 44 /* for strerror() */
#endif /* _errnoh */

View File

@ -0,0 +1,27 @@
/* fcntl.h - file control options for the open function
* $Version: 1.13 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _fcntlh
#define _fcntlh
/*lint -library */
#define O_RDONLY 0x0000 /* read only */
#define O_WRONLY 0x0001 /* write only */
#define O_RDWR 0x0002 /* read/write, update mode */
#define O_APPEND 0x0008 /* append mode */
#define O_CREAT 0x0100 /* create and open file */
#define O_TRUNC 0x0200 /* length is truncated to 0 */
#define O_EXCL 0x0400 /* exclusive open, used with O_CREAT */
#define O_NOCTTY 0x1000 /* the open of a terminal device shall not become
the controling terminal for the process */
#define O_NONBLOCK 0x2000 /* the open function shall return without waiting
for the device to be ready or available */
#define O_TEXT 0x4000 /* ascii mode, <cr><lf> xlates, CNTL-Z */
#define O_BINARY 0x8000 /* mode is binary (no translation) */
#endif /* _fcntlh */

View File

@ -0,0 +1,42 @@
/* fileio3.h - internal to I/O source
* $Version: 1.22 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _fileio3h
#define _fileio3h
/*lint -library */
#ifndef _stdioh
#include <stdio.h>
#endif
#ifndef _typesh
#include <sys/types.h>
#endif
/* defines for osfile (fd's) not used in streams */
#define _IOAPPEND 0x2000
#define _IOASCII 0x100
struct _io_block {
int osfile;
off_t foffset;
int fseekp;
off_t fbytes;
off_t feofpos;
dev_t device;
};
extern struct _io_block *_iocb;
extern int _nfile;
#define _IOCB(n) \
((struct _io_block *)((char *)_iocb + (n * sizeof(struct _io_block))))
#define _FD_CHECK 1
#define __READ 1
#define __WRITE 2
#endif /* _fileio3h */

View File

@ -0,0 +1,144 @@
/* float.h - 8087 control function prototypes
* $Version: 1.14 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _floath
#define _floath
/*lint -library */
#define DBL_DIG 15 /* maximum decimal digits of double precision */
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.7976931348623157e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.2250738585072014e-308
#define DBL_MIN_10_EXP (-307)
#define DBL_MIN_EXP (-1021)
#define DBL_RADIX 2 /* Radix of the floating-point number */
/* e.g., a binary machine */
#define DBL_ROUNDS 1
#define FLT_DIG 6 /* maximum decimal digits of float precision */
#define FLT_EPSILON 1.19209290e-7F
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282347e+38F
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435e-38F
#define FLT_MIN_10_EXP (-37)
#define FLT_MIN_EXP (-125)
#define FLT_RADIX 2 /* radix of the floating point number /*
/* e.g. a binary machine */
#define FLT_ROUNDS 1 /* 1 == round to nearest */
/*****************************************************************************
** These values are full IEEE/ANSI defined, but are not supported under iC386.
** Since Long Double is not supported under iC386, these values will be
** defined as the same as DBL, above.
******************************************************************************/
#if 0
#define LDBL_DIG 18 /* max decimal digits of long double precisn */
#define LDBL_EPSILON 1.08420217248550443401e-19L
#define LDBL_MANT_DIG 64
#define LDBL_MAX 1.18973149535723176502e+4932L
#define LDBL_MAX_10_EXP 4932
#define LDBL_MAX_EXP 16384
#define LDBL_MIN 3.36210314311209350626e-4932L /* relatively close */
#define LDBL_MIN_10_EXP (-4931)
#define LDBL_MIN_EXP (-16381)
#define LDBL_RADIX 2 /* Radix of the floating-point number */
/* e.g., a binary machine */
#define LDBL_ROUNDS 1
#else
#define LDBL_DIG DBL_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_RADIX 2 /* Radix of the floating-point number */
/* e.g., a binary machine */
#define LDBL_ROUNDS 1
#endif
/*
* Numeric coprocessor configuration constants:
*/
#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 */
#define CW_DEFAULT (IC_AFFINE + RC_NEAR + PC_64 + EM_INVALID + EM_DENORMAL + \
EM_ZERODIVIDE + EM_OVERFLOW + EM_UNDERFLOW + EM_INEXACT)
/*
* User status word:
*/
#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) */
#define SW_UNEMULATED 0x0040 /* Unemulated instruction */
#define SW_SQRTNEG 0x0080 /* Square root of a neg number */
#define SW_STACKOVERFLOW 0x0200 /* Floating-point stack overflow */
#define SW_STACKUNDERFLOW 0x0400 /* Floating-point 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:
*/
#ifndef _87_functions
#define _87_functions
unsigned int _control87(unsigned int, unsigned int);
void _fpreset(void);
#endif
#endif /* _floath */

View File

@ -0,0 +1,31 @@
/* i186.h - 80186 processor specific header file
* $Version: 1.5 $
* Copyright 1988, 89, 90 Intel Corporation, ALL RIGHTS RESERVED.
*/
#if !defined(_I186_)
#define _I186_
#include <i86.h>
#pragma _builtin_("blockinbyte"==20)
void blockinbyte( unsigned short port,
unsigned char *destination,
unsigned int count);
#pragma _builtin_("blockinword"==21)
void blockinword( unsigned short port,
unsigned int *destination,
unsigned int count);
#pragma _builtin_("blockoutbyte"==22)
void blockoutbyte( unsigned short port,
unsigned char const *source,
unsigned int count);
#pragma _builtin_("blockoutword"==23)
void blockoutword( unsigned short port,
unsigned int const *source,
unsigned int count);
#endif

View File

@ -0,0 +1,116 @@
/* i286.h - 80286 processor specific header file
* $Version: 1.11 $
* Copyright 1988, 89, 90 Intel Corporation, ALL RIGHTS RESERVED.
*/
#if !defined(_I286_)
#define _I286_
#include <i186.h>
#define FLAG_IOPL 0x3000
#define FLAG_NESTED 0x4000
/*** For additional interrupt handling ***/
#pragma _builtin_("waitforinterrupt"==24)
void waitforinterrupt(void);
/*** For manipulation of the Task Register ***/
#pragma _builtin_("gettaskregister"==25)
selector gettaskregister(void);
#pragma _builtin_("settaskregister"==26)
void settaskregister(selector value);
#if _LONG64_
typedef unsigned int base_addr;
#else
typedef unsigned long base_addr;
#endif
#pragma NOALIGN("descriptor_table_reg")
struct descriptor_table_reg
{
unsigned short limit; /* 16 bits of limit */
base_addr base; /* physical base address */
};
/*** For manipulation of the Global Descriptor Table ***/
#pragma _builtin_("saveglobaltable"==27)
void saveglobaltable(struct descriptor_table_reg *location);
#pragma _builtin_("restoreglobaltable"==28)
void restoreglobaltable(struct descriptor_table_reg const *location);
/*** For manipulation of the Interrupt Descriptor Table ***/
#pragma _builtin_("saveinterrupttable"==29)
void saveinterrupttable(struct descriptor_table_reg *location);
#pragma _builtin_("restoreinterrupttable"==30)
void restoreinterrupttable(struct descriptor_table_reg const *location);
/*** For the manipulation of the Local Descriptor Table Register ***/
#pragma _builtin_("getlocaltable"==31)
selector getlocaltable(void);
#pragma _builtin_("setlocaltable"==32)
void setlocaltable(selector sel);
/*** For the manipulation of the Machine Status Register ***/
#define MSW_PROTECTION_ENABLE 0x0001
#define MSW_MONITOR_COPROCESSOR 0x0002
#define MSW_EMULATE_COPROCESSOR 0x0004
#define MSW_TASK_SWITCHED 0x0008
#pragma _builtin_("getmachinestatus"==33)
unsigned short getmachinestatus(void);
#pragma _builtin_("setmachinestatus"==34)
void setmachinestatus(unsigned short value);
/*** For clearing task switched flag in machine status ***/
#pragma _builtin_("cleartaskswitchedflag"==35)
void cleartaskswitchedflag(void);
/*** For segment information ***/
#define AR_PRESENT 0x8000
#define AR_PRIV_MASK 0x6000
#define AR_PRIV_SHIFT 13
#define AR_PRIVILEGE(x) (((x) & AR_PRIV_MASK) >> AR_PRIV_SHIFT)
#define AR_SEGMENT 0x1000
#define AR_EXECUTABLE 0x0800
#define AR_EXPAND_DOWN 0x0400
#define AR_WRITABLE 0x0200
#define AR_CONFORMING 0x0400
#define AR_READABLE 0x0200
#define AR_ACCESSED 0x0100
#define AR_386_TYPE 0x0800
#define AR_GATE 0x0400
#define AR_GATE_MASK 0x0300
#define AR_GATE_TYPE(x) ((x) & AR_GATE_MASK)
#define AR_CALL_GATE 0x0000
#define AR_TASK_GATE 0x0100
#define AR_INTR_GATE 0x0200
#define AR_TRAP_GATE 0x0300
#define AR_TSS 0x0100
#define AR_BUSY 0x0200
#pragma _builtin_("getaccessrights"==36)
unsigned int getaccessrights(selector sel);
#pragma _builtin_("getsegmentlimit"==37)
unsigned int getsegmentlimit(selector sel);
#pragma _builtin_("segmentreadable"==38)
int segmentreadable(selector sel);
#pragma _builtin_("segmentwritable"==39)
int segmentwritable(selector sel);
/*** For adjusting the requested privilege level ***/
#pragma _builtin_("adjustrpl"==40)
selector adjustrpl(selector sel);
#endif

View File

@ -0,0 +1,108 @@
/* i386.h - 80386 processor specific header file
* $Version: 1.12 $
* Copyright 1990 Intel Corporation, ALL RIGHTS RESERVED.
*/
#if !defined(_I386_)
#define _I386_
#include <i286.h>
#pragma _builtin_("getcontrolregister"==41)
unsigned int getcontrolregister( const unsigned char );
#pragma _builtin_("setcontrolregister"==42)
void setcontrolregister( const unsigned char, unsigned int );
#define CR0_EXTENSION_TYPE 0x0010
#define CR0_PAGING_ENABLED 0x8000
#pragma _builtin_("getdebugregister"==43)
unsigned int getdebugregister( const unsigned char );
#pragma _builtin_("setdebugregister"==44)
void setdebugregister( const unsigned char, unsigned int );
#pragma _builtin_("gettestregister"==45)
unsigned int gettestregister( const unsigned char );
#pragma _builtin_("settestregister"==46)
void settestregister( const unsigned char, unsigned int );
#pragma _builtin_("inhword"==67)
unsigned short inhword(unsigned short port);
#pragma _builtin_("outhword"==68)
void outhword(unsigned short port,
unsigned short value);
#pragma _builtin_("blockinhword"==69)
void blockinhword( unsigned short port,
unsigned short *destination,
unsigned int count);
#pragma _builtin_("blockouthword"==70)
void blockouthword( unsigned short port,
unsigned short const *source,
unsigned int count);
#pragma ALIGN("i387_protected_addr")
struct i387_protected_addr
{
unsigned ip_offset : 32;
unsigned cs_sel : 16;
unsigned opcode : 11, : 5;
unsigned op_offset : 32;
unsigned op_sel : 16, : 16;
};
#pragma ALIGN("i387_real_address")
struct i387_real_address
{
unsigned ip1 : 16, : 16;
unsigned opcode : 11, : 1;
unsigned ip2 : 16, : 4;
unsigned op1 : 16, : 16, : 12;
unsigned op2 : 16, : 4;
};
union i387_address
{
struct i387_real_address real;
struct i387_protected_addr prot;
};
#pragma ALIGN("i387_environment")
struct i387_environment
{
unsigned control: 16, : 16;
unsigned status : 16, : 16;
unsigned tag : 16, : 16;
union i387_address ptrs_n_opcode;
};
struct i387_state
{
struct i387_environment environment;
tempreal_t stack[8];
};
#if _ARCHITECTURE_ >= 386
#pragma _builtin_("saverealstatus"==18)
void saverealstatus(struct i387_state *savearea);
#pragma _builtin_("restorerealstatus"==19)
void restorerealstatus(struct i387_state const *savearea);
#endif
#define FLAG_RESUME 0x10000
#define FLAG_VM 0x20000
#pragma _builtin_("word_rol"==78)
unsigned int word_rol(unsigned int, unsigned int);
#pragma _builtin_("word_ror"==79)
unsigned int word_ror(unsigned int, unsigned int);
#endif

View File

@ -0,0 +1,25 @@
/* i486.h - 80486 processor specific header file
* $Version: 1.6 $
* Copyright 1990 Intel Corporation, ALL RIGHTS RESERVED.
*/
#if !defined(_I486_)
#define _I486_
#include <i386.h>
#define FLAG_ALIGNCHECK 0x40000
#pragma _builtin_("byteswap"==47)
unsigned int byteswap(unsigned int);
#pragma _builtin_("invalidatedatacache"==48)
void invalidatedatacache(void);
#pragma _builtin_("wbinvalidatedatacache"==49)
void wbinvalidatedatacache(void);
#pragma _builtin_("invalidatetlbentry"==50)
void invalidatetlbentry(void far *);
#endif

View File

@ -0,0 +1,14 @@
/* i8086.h - 8086 processor specific only header file
* $Version: 1.6 $
* Copyright 1988, 89, 90 Intel Corporation, ALL RIGHTS RESERVED.
*/
#if !defined(_I8086_)
#define _I8086_
#include <i86.h>
#pragma _builtin_("setinterrupt"==1)
void setinterrupt(const unsigned char number, void far (*handler)(void));
#endif

View File

@ -0,0 +1,181 @@
/* i86.h - 8086 processor specific header file
* $Version: 1.9 $
* Copyright 1988, 89, 90 Intel Corporation, ALL RIGHTS RESERVED.
*/
#if !defined(_I86_)
#define _I86_
#pragma extend
#pragma _selector_("selector")
/*** For manipulation of selector ***/
#pragma _builtin_("buildptr"==2)
void far *buildptr( selector sel,
void near *offset);
#pragma _builtin_("lockset"==3)
unsigned char lockset(unsigned char *lockptr,
unsigned char newvalue);
#pragma _builtin_("enable"==4)
void enable(void);
#pragma _builtin_("disable"==5)
void disable(void);
#pragma _builtin_("causeinterrupt"==6)
void causeinterrupt(unsigned char number);
#pragma _builtin_("halt"==7)
void halt(void);
#pragma _builtin_("getflags"==8)
unsigned int getflags(void);
#pragma _builtin_("setflags"==9)
void setflags(unsigned int value);
#define FLAG_CARRY 0x0001
#define FLAG_PARITY 0x0004
#define FLAG_AUXCARRY 0x0010
#define FLAG_ZERO 0x0040
#define FLAG_SIGN 0x0080
#define FLAG_TRAP 0x0100
#define FLAG_INTERRUPT 0x0200
#define FLAG_DIRECTION 0x0400
#define FLAG_OVERFLOW 0x0800
#pragma _builtin_("inbyte"==10)
unsigned char inbyte(unsigned short port);
#pragma _builtin_("inword"==11)
unsigned int inword(unsigned short port);
#pragma _builtin_("outbyte"==12)
void outbyte(unsigned short port,
unsigned char value);
#pragma _builtin_("outword"==13)
void outword(unsigned short port,
unsigned int value);
#pragma _builtin_("initrealmathunit"==14)
void initrealmathunit(void);
#pragma _builtin_("setrealmode"==15)
void setrealmode(unsigned short mode);
#pragma _builtin_("getrealstatus"==16)
unsigned short getrealstatus(void);
#pragma _builtin_("getrealerror"==17)
unsigned short getrealerror(void);
#define I87_INVALID_OPERATION 0x0001
#define I87_DENORMALIZED_OPERAND 0x0002
#define I87_ZERO_DIVIDE 0x0004
#define I87_OVERFLOW 0x0008
#define I87_UNDERFLOW 0x0010
#define I87_PRECISION 0x0020
#define I87_CONTROL_PRECISION 0x0300
#define I87_PRECISION_24_BIT 0x0000
#define I87_PRECISION_53_BIT 0x0200
#define I87_PRECISION_64_BIT 0x0300
#define I87_CONTROL_ROUNDING 0x0C00
#define I87_ROUND_NEAREST 0x0000
#define I87_ROUND_DOWN 0x0400
#define I87_ROUND_UP 0x0800
#define I87_ROUND_CHOP 0x0C00
#define I87_CONTROL_INFINITY 0x1000
#define I87_INFINITY_PROJECTIVE 0x0000
#define I87_INFINITY_AFFINE 0x1000
#define I87_STATUS_ERROR 0x0080
#define I87_STATUS_STACKTOP_MASK 0x3800
#define I87_STATUS_STACKTOP_SHIFT 11
#define I87_STATUS_STACKTOP(env) (((env).status & I87_STATUS_STACKTOP_MASK) \
>> I87_STATUS_STACKTOP_SHIFT)
#define I87_STACK_TOP(env) I87_STATUS_STACKTOP(env)
#define I87_STATUS_BUSY 0x8000
#define I87_STATUS_CONDITION_CODE 0x4700
#define I87_CONDITION_C0 0x0100
#define I87_CONDITION_C1 0x0200
#define I87_CONDITION_C2 0x0400
#define I87_CONDITION_C3 0x4000
#pragma ALIGN("i87_real_address")
struct i87_real_address
{
unsigned offset : 16, : 0;
unsigned opcode : 11, : 1;
unsigned selector: 4, : 0;
};
#define I87_REAL_ADDRESS(addr) buildptr((selector)((addr).selector & 0xF000),\
(void near *)(addr).offset)
union i87_address
{
struct i87_real_address real;
void far *protected;
};
#pragma ALIGN("i87_environment")
struct i87_environment
{
unsigned control: 16, : 0;
unsigned status : 16, : 0;
unsigned tag : 16, : 0;
union i87_address instruction;
union i87_address operand;
};
#define I87_TAG_MASK 0x0003
#define I87_TAG_SHIFT 2
#define I87_TAG(x, y) (((x).tag >> (I87_TAG_SHIFT * (y))) & I87_TAG_MASK)
#pragma NOALIGN("i87_tempreal")
struct i87_tempreal
{
char significand[8];
unsigned exponent: 15;
#if defined(SBITFIELD)
signed sign: 1;
#else
unsigned sign: 1;
#endif
};
typedef struct i87_tempreal tempreal_t;
struct i87_state
{
struct i87_environment environment;
tempreal_t stack[8];
};
#if _ARCHITECTURE_ < 386
#pragma _builtin_("saverealstatus"==18)
void saverealstatus(struct i87_state *savearea);
#pragma _builtin_("restorerealstatus"==19)
void restorerealstatus(struct i87_state const *savearea);
#endif
#pragma _builtin_("byte_rol"==74)
unsigned char byte_rol(unsigned char, unsigned int);
#pragma _builtin_("byte_ror"==75)
unsigned char byte_ror(unsigned char, unsigned int);
#pragma _builtin_("hword_rol"==76)
unsigned short hword_rol(unsigned short, unsigned int);
#pragma _builtin_("hword_ror"==77)
unsigned short hword_ror(unsigned short, unsigned int);
#endif

View File

@ -0,0 +1,61 @@
/* io.h - file access function prototypes
* $Version: 1.33 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _ioh
#define _ioh
/*lint -library */
#ifndef _timeh
#include <time.h>
#endif
#ifndef _typesh
#include <sys/types.h>
#endif
#pragma fixedparams("access", "chmod", "chown", "chsize", "close")
#pragma fixedparams("creat", "dup", "dup2", "eof", "filelength")
#pragma fixedparams("isatty", "link", "locking", "lseek", "ltell")
#pragma fixedparams("mktemp", "read", "setmode", "umask", "unlink")
#pragma fixedparams("write", "tell", "_open")
#pragma fixedparams("_stdio_stdopen", "_map_length")
#pragma varparams("open", "sopen")
/*
* Function prototypes:
*/
int access(const char *, int);
int chmod(const char *, mode_t);
int chown(const char *, uid_t, gid_t);
int chsize(int, long);
int close(int);
int creat(const char *, mode_t);
int dup(int);
int dup2(int, int);
int eof(int);
long filelength(int);
int isatty(int);
int link(const char *, const char *);
int locking(int, int, long);
off_t lseek(int, off_t, int);
long ltell(int);
int _map_length(int, const void *, size_t);
char *mktemp(char *);
int open(const char *, int, ...);
int _open(const char *, unsigned int, unsigned int, unsigned int);
int read(int, char *, unsigned int);
int setmode(int, int);
int sopen(const char *, unsigned int, unsigned int, ...);
int _stdio_stdopen(int);
long tell(int);
mode_t umask(mode_t);
int unlink(const char *);
int write(int, const char *, unsigned int);
#ifdef _CLIB
#endif
#endif /* _ioh */

View File

@ -0,0 +1,45 @@
/* limits.h - compiler limits
* $Version: 1.20 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _limitsh
#define _limitsh
/*lint -library */
#define CHAR_BIT 8 /* number of bits in a byte */
#define UCHAR_MAX 255u /* maximum value of an unsigned char */
#define SCHAR_MAX 127 /* maximum value for a signed char */
#define SCHAR_MIN (-128) /* minimum value of a signed char
(-SCHAR_MAX - 1) */
#if '\xFF' < 0
#define CHAR_MAX SCHAR_MAX /* maximum value of a 'plain' char */
#define CHAR_MIN SCHAR_MIN /* minimum value of a 'plain' char */
#else
#define CHAR_MAX UCHAR_MAX /* maximum value of a 'plain' char */
#define CHAR_MIN 0 /* minimum value of a 'plain' char */
#endif
#define USHRT_MAX 65535u /* maximum value of an unsigned short */
#define SHRT_MAX 32767 /* maximum value of a short int */
#define SHRT_MIN (-32768) /* minimum value of a short int
(-SHRT_MAX - 1) */
#define ULONG_MAX 4294967295u /* maximum value of an unsigned long */
#define LONG_MAX 2147483647l /* maximum value of a long int */
#define LONG_MIN (-2147483647l-1)/* minimum value of a long int
(-LONG_MAX - 1) */
#if _ARCHITECTURE_ <= 286
#define INT_MAX SHRT_MAX /* maximum value of an int */
#define INT_MIN SHRT_MIN /* minimum value of an int */
#define UINT_MAX USHRT_MAX /* maximum value of an unsigned int */
#else
#define INT_MAX LONG_MAX /* maximum value of an int */
#define INT_MIN LONG_MIN /* minimum value of an int */
#define UINT_MAX ULONG_MAX /* maximum value of an unsigned int */
#endif
#define MB_LEN_MAX 1
#endif /* _limitsh */

View File

@ -0,0 +1,80 @@
/* lint.h - PC-Lint configuration file for Intel C
* $Version: 1.3 $
* Copyright (c) 1989 Intel Corporation, ALL RIGHTS RESERVED.
* PC-Lint is a trademark of Gimplel Software.
*/
#ifndef _pclinth
#define _pclinth
/*lint -library */
/*lint -hsb^3 s=space after each message
b=indicator goes below the source line
^=use caret (^) as the "indicator"
3=height of message is 3 lines
*/
/*lint -w(78,4) 78=number of chars per line
4=indent continued lines 4 chars
*/
/*lint -d_ARCHITECTURE_ this preprocessor symbol is pre-defined */
/*lint -d_FAR_CODE_ this preprocessor symbol is pre-defined */
/*lint -d_FAR_DATA_ this preprocessor symbol is pre-defined */
#if _ARCHITECTURE_ == 386
/*lint -d_LONG64_ this preprocessor symbol is pre-defined */
#endif
/*lint -d_NPX_ this preprocessor symbol is pre-defined */
/*lint -d_OPTIMIZE_ this preprocessor symbol is pre-defined */
/*lint -d_ROM_ this preprocessor symbol is pre-defined */
/*lint +fce continue-on-error true */
/*lint -fcu char-is-unsigned false (signed) */
#if _ARCHITECTURE_ == 86 || _ARCHITECTURE_ == 186 || _ARCHITECTURE_ == 286
/*lint -fdl ptr-diff-is-long false (int) */
#elif _ARCHITECTURE_ == 386
/*lint +fdl ptr-diff-is-long true */
#endif
/*lint -fie int-model-for-enum false (strict) */
/*lint -fkp k&r-preproc false (ANSI) */
/*lint +rw(*ms) activate all Microsoft keywords */
/*lint -rw(_loadds,_export,_saveregs,huge,fortran,pascal,cdecl,interrupt)
disable these MS keywords */
/*lint +rw(alien,readonly)
these are Intel reserved (w/EXTEND) */
/*lint -t4 tabsize=4 (default) */
/*lint -$ accept $ in identifiers */
/*lint -sb8 bits in a byte */
/*lint -sc1 sizeof(char) returns 1 */
/*lint -ss2 sizeof(short) returns 2 */
#if _ARCHITECTURE_ == 86 || _ARCHITECTURE_ == 186 || _ARCHITECTURE_ == 286
/*lint -si2 sizeof(int) returns 2 */
#elif _ARCHITECTURE_ == 386
/*lint -si4 sizeof(int) returns 4 */
#endif
#if _ARCHITECTURE_ == 386
# if _LONG64_
/*lint -sl8 sizeof(long) returns 8 */
# endif
#else
/*lint -sl4 sizeof(long) returns 4 */
#endif
/*lint -sf4 sizeof(float) returns 4 */
/*lint -sd8 sizeof(double) returns 8 */
/*lint -sld8 sizeof(long double) returns 8 */
/*lint -spNP2 near code pointers are 2 bytes */
/*lint -spND2 near data pointers are 2 bytes */
/*lint -spFP4 far code pointers are 4 bytes */
/*lint -spFD4 far data pointers are 4 bytes */
/*lint -dselector="void *"
for linting ONLY, treat selector
as "void *"
*/
/*lint -e537 disable "repeated include file" */
/*lint -e75 disable "too late to change sizes" */
#endif /* _pclinth */

View File

@ -0,0 +1,51 @@
/* locale.h - header for locale functions
* Copyright (c) 1990 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _localeh
#define _localeh
#pragma fixedparams("setlocale", "localeconv")
#ifndef NULL
#define NULL ((void *)0)
#endif
#pragma align (lconv)
struct lconv {
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
};
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5
#define LC_MIN LC_ALL
#define LC_MAX LC_TIME
/*
* Function prototypes:
*/
char *setlocale(int, const char *);
struct lconv *localeconv(void);
#endif /* _localeh */

View File

@ -0,0 +1,143 @@
/* math.h - math and trig definitions
* $Version: 1.25 $
* Copyright (c) 1984,85,86,87 Computer Innovations Inc, ALL RIGHTS RESERVED.
* Copyright (c) 1988,89, 90 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _mathh
#define _mathh
/*lint -library */
#pragma fixedparams("acos", "asin", "atan", "atan2", "ceil")
#pragma fixedparams("cos", "cosh", "exp", "fabs", "floor")
#pragma fixedparams("fmod", "frexp", "j0", "j1", "jn")
#pragma fixedparams("ldexp", "log", "log10", "matherr", "modf")
#pragma fixedparams("pow", "sin", "sinh", "sqrt", "square")
#pragma fixedparams("tan", "tanh", "y0", "y1", "yn")
#ifndef HUGE_VAL
#define HUGE_VAL 1.7976931348623157e+308 /* DBL_MAX */
#endif
/*
* Exception types for matherr():
*/
#define DOMAIN 1 /* Argument domain error */
#define SING 2 /* Singularity error */
#define OVERFLOW 3 /* Function overflow error */
#define UNDERFLOW 4 /* Function underflow error */
#define TLOSS 5 /* Total loss of precision */
#define PLOSS 6 /* Partial loss of precision */
/*
* Function prototypes:
*/
double acos(double);
double asin(double);
double atan(double);
double atan2(double, double);
double cos(double);
double sin(double);
double tan(double);
double cosh(double);
double sinh(double);
double tanh(double);
double exp(double);
double frexp(double, int *);
double ldexp(double, int);
double log(double);
double log10(double);
double modf(double, double *);
double pow(double, double);
double sqrt(double);
double ceil(double);
double fabs(double);
double floor(double);
double fmod(double, double);
/* non-ANSI declarations */
#pragma align (exception)
struct exception {
int type;
char *name;
double arg1;
double arg2;
double retval;
};
#pragma align (complex)
struct complex {
double x;
double y;
};
double j0(double);
double j1(double);
double jn(int, double);
int matherr(struct exception *); /* this is just a stub */
double square(double);
double y0(double);
double y1(double);
double yn(int, double);
/*
* Compiler built-in functions:
*/
#ifndef _mathh_builtin
#define _mathh_builtin
#pragma _builtin_("_fabs_"==53)
double _fabs_(double);
#define fabs(x) _fabs_(x)
#pragma _builtin_("_sqrt_"==54)
double _sqrt_(double);
#define sqrt(x) _sqrt_(x)
#if _ARCHITECTURE_ == 386 || _ARCHITECTURE_ == 486
/* The following builtins are only valid in a 387/486 environment */
#pragma _builtin_("_log_"==55)
double _log_(double);
#define log(x) _log_(x)
#pragma _builtin_("_log10_"==56)
double _log10_(double);
#define log10(x) _log10_(x)
#pragma _builtin_("_cos_"==57)
double _cos_(double);
#define cos(x) _cos_(x)
#pragma _builtin_("_sin_"==58)
double _sin_(double);
#define sin(x) _sin_(x)
#pragma _builtin_("_tan_"==59)
double _tan_(double);
#define tan(x) _tan_(x)
#pragma _builtin_("_acos_"==60)
double _acos_(double);
#define acos(x) _acos_(x)
#pragma _builtin_("_asin_"==61)
double _asin_(double);
#define asin(x) _asin_(x)
#pragma _builtin_("_atan2_"==62)
double _atan2_(double,double);
#define atan2(x,y) _atan2_(x,y)
#pragma _builtin_("_atan_"==63)
double _atan_(double);
#define atan(x) _atan_(x)
#endif /* _ARCHITECTURE_ */
#endif /* _mathh_builtin */
#endif /* _mathh */

View File

@ -0,0 +1,56 @@
/* process.h - process control function prototypes
* $Version: 1.25 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _processh
#define _processh
/*lint -library */
#ifndef _typesh
#include <sys/types.h>
#endif
#pragma fixedparams("_exit", "_doexec", "getegid", "getgid", "getpid")
#pragma fixedparams("getuid", "sleep")
#pragma fixedparams("_exec", "execv", "execve", "execvp", "execvpe")
#pragma fixedparams("_spawn", "spawnv", "spawnve", "spawnvp", "spawnvpe")
#pragma varparams("execl", "execle", "execlp", "execlpe")
#pragma varparams("spawnl", "spawnle", "spawnlp", "spawnlpe")
#define P_WAIT 0
#define P_NOWAIT 1
#define P_OVERLAY 2
/*
* Function prototypes:
*/
int _doexec(int, int, int, int, int, int, char *, char *, char *,
char *, char *, char *);
int _exec(const char *, const char **, const char **, int);
int execl(const char *, const char *, ...);
int execle(const char *, const char *, ...);
int execlp(const char *, const char *, ...);
int execlpe(const char *, const char *,...);
int execv(const char *, const char **);
int execve(const char *, const char **, const char **);
int execvp(const char *, const char **);
int execvpe(const char *, const char **, const char **);
void _exit(int);
gid_t getgid(void);
gid_t getegid(void);
pid_t getpid(void);
uid_t getuid(void);
unsigned sleep(unsigned int);
int _spawn(int, const char *, const char **, const char **, int);
int spawnl(int, const char *, const char *, ...);
int spawnle(int, const char *, const char *,...);
int spawnlp(int, const char *, const char *, ...);
int spawnlpe(int, const char *, const char *, ...);
int spawnv(int, const char *, const char **);
int spawnve(int, const char *, const char **, const char **);
int spawnvp(int, const char *, const char **);
int spawnvpe(int, const char *, const char **, const char **);
#endif /* _processh */

View File

@ -0,0 +1,126 @@
/* reent.h - iC86 header file for reentrancy hooks
* $Version: 1.22 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _reenth
#define _reenth
/*lint -library */
#pragma fixedparams("_exit_init", "_stdio_init", "_thread_init")
#pragma fixedparams("_init_clib_data")
#pragma fixedparams("_exit_create", "_stdio_create", "_thread_create")
#pragma fixedparams("_exit_ptr", "_stdio_ptr", "_thread_ptr", "_tzset_ptr")
#pragma fixedparams("_semaphore_delete", "_semaphore_init")
#pragma fixedparams("_semaphore_signal", "_semaphore_wait")
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef _size_t
#define _size_t
typedef unsigned size_t;
#endif
#ifndef _localeh
#include <locale.h>
#endif
#ifndef _free_list_item_t
#define _free_list_item_t
#pragma align (free_list_item)
struct free_list_item {
struct free_list_item *next;
unsigned length;
};
#endif
#pragma align (_heap)
struct _heap {
void *_malloc_sem;
struct free_list_item *_primary_free_list;
struct free_list_item *_secondary_free_list;
int _secondary_list_count;
struct free_list_item *_allocated_list;
int _allocated_list_count;
unsigned int _last_fill; /* Last fill value used */
unsigned char _fill_set; /* Has _heapset been called */
};
#pragma align (_locale)
struct _locale {
struct lconv _locale_conv;
char *_locale_array[LC_MAX+1];
};
#pragma align (_tzset)
struct _tzset {
char *_tzname[2];
long _timezone;
int _daylight;
};
#define INIT_OK 0
#define THREAD_INIT_ERROR 2
#pragma align (_exit)
struct _exit {
void *open_stream_sem;
struct _iobuf *open_stream_list; /* list is maintained as a stack */
void *exit_handler_sem;
int exit_handler_count;
void (*exit_handler_list[32])();
};
#pragma align (_thread)
struct _thread
{
int _errno;
char *_strtok_buffer;
struct tm *_gmtime_buffer;
unsigned long _rand_seed;
struct _heap *_heap_header;
struct _locale *_locale_data;
struct _tzset *_tzset_data;
char _asctime_buffer[26];
int __doserrno;
};
/*
* Function prototypes:
*/
int _exit_init(void);
int _stdio_init(void);
int _thread_init(void);
void _init_clib_data(struct _thread *);
struct _exit *_exit_create(size_t);
struct _stdio *_stdio_create(size_t);
struct _thread *_thread_create(size_t);
struct _exit *_exit_ptr(void);
struct _stdio *_stdio_ptr(void);
struct _thread *_thread_ptr(void);
struct _tzset *_tzset_ptr(void);
void _semaphore_delete(void **);
void _semaphore_init(void **);
void _semaphore_signal(void **);
void _semaphore_wait(void **);
#define _EXIT_PTR _exit_ptr()
#define _STDIO_PTR _stdio_ptr()
#define _THREAD_PTR _thread_ptr()
#endif /* _reenth */
#ifndef _stdio_stream
#ifdef _stdioh
#define _stdio_stream
struct _stdio {
FILE _stdin; /* stdin stream */
FILE _stdout; /* stdout stream */
FILE _stderr; /* stderr stream */
};
#endif /* _stdioh */
#endif /* _stdio_stream */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,274 @@
/* rmxerr.h - signal handling header file
* $Version: 1.2 $
* Copyright (c) 1989, 90 Intel Corporation, ALL RIGHTS RESERVED.
*/
/* * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* E N V I R O N M E N T A L E R R O R S */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * */
#ifndef EBUSY /* These mnemonics are also defined in ERRNO.H */
#define EBUSY 0x3 /* region is in use */
#define EEXIST 0x6 /* token does not refer to an
* iRMX object */
#define EIO 0x2b /* io error */
#endif
/* Nucleus exception codes */
#define EOK 0x0
#define ETIME 0x1 /* TIME limit exceeded */
#define EMEM 0x2 /* memory allocation exceeded */
#define ELIMIT 0x4 /* some limit exceeded */
#define ECONTEXT 0x5 /* request out of context */
#define ESTATE 0x7 /* ready task resumed */
#define ENOTCONFIGURED 0x8
#define EINTERRUPTSATURATION 0x9 /* interrupt task accumulated
* the maximum allowable
* number of SIGNAL$INTERRUPT
* requests */
#define EINTERRUPTOVERFLOW 0xa /* interrupt task accumulated
* more than the maximum
* allowable number of
* SIGNAL$INTERRUPT requests */
#define ETRANSMISSION 0xb /* error in message transmission */
#define ESLOT 0xc /* there are no available GDT slots */
#define EDATACHAIN 0xd /* buffer returned is a data chain */
/* Nucleus Communication Service exception codes */
#define ECANCELLED 0xe1 /* RSVP transaction cancelled
* by remote host */
#define EHOSTID 0xe2 /* invalid host id parameter */
#define ENOLOCALBUFFER 0xe3 /* insufficient buffer available
* on local host to receive message */
#define ENOREMOTEBUFFER 0xe4 /* insufficient buffer available
* on remote host to receive message */
#define ERESOURCELIMIT 0xe6 /* exceeded limit of number of
* simultaneous messages */
#define ETRANSID 0xe8 /* invalid transaction id parameter */
#define EDISCONNECTED 0xe9 /* null socket parameter used
* with port that is not connected */
#define ETRANSLIMIT 0xea /* exceeded limit of number of
* simultaneous transactions */
/* IOS exception codes */
#define EFEXIST 0x20 /* file already exists */
#define EFNEXIST 0x21 /* non-existant File */
#define EDEVFD 0x22 /* device and file driver
* incompatible */
#define ESUPPORT 0x23 /* function not supported */
#define EEMPTYENTRY 0x24 /* directory entry is empty */
#define EDIREND 0x25 /* no more directory entries */
#define EFACCESS 0x26 /* access to file denied */
#define EFTYPE 0x27 /* invalid file type */
#define ESHARE 0x28 /* file cannot be shared with others */
#define ESPACE 0x29 /* insufficient space on volume */
#define EIDDR 0x2a /* bad device driver request */
#define EFLUSHING 0x2c /* other end of stream file
* is gone */
#define EILLVOL 0x2d /* illegal volume type */
#define EDEVOFFLINE 0x2e /* device is off line */
#define EIFDR 0x2f /* illegal file driver request */
#define EFRAGMENTATION 0x30 /* file too fragmented to extend */
#define EDIRNOTEMPTY 0x31 /* directory not empty */
#define ENOTFILECONN 0x32 /* not a file connection */
#define ENOTDEVICECONN 0x33 /* not a device connection */
#define ECONNNOTOPEN 0x34 /* connection is not open for
* requested operation */
#define ECONNOPEN 0x35 /* connection already open */
#define EBUFFEREDCONN 0x36 /* connection opened by EIOS
* but now accessed by BIOS */
#define EOUTSTANDINGCONNS 0x37 /* specified soft detach has
* left device connections intact */
#define EALREADYATTACHED 0x38 /* device already attached */
#define EDEVDETACHING 0x39 /* specified file on a device
* in the process of being detached */
#define ENOTSAMEDEVICE 0x3a /* existing and new pathnames
* not on same device */
#define EILLOGICALRENAME 0x3b /* new pathname includes
* existing pathname */
#define ESTREAMSPECIAL 0x3c /* stream file request out
* of context */
#define EINVALIDFNODE 0x3d /* invalid file descriptor */
#define EPATHNAMESYNTAX 0x3e /* pathname null or contains
* invalid characters */
#define EFNODELIMIT 0x3f /* insufficient fnodes on volume */
/* EIOS exception codes */
#define ELOGNAMESYNTAX 0x40 /* invalid logical name */
#define ECANNOTCLOSE 0x41 /* buffers cannot be flushed */
#define EIOMEM 0x42 /* IO system has insufficent memory */
#define EMEDIA 0x44 /* no disk in drive */
#define ELOGNAMENEXIST 0x45 /* logical name does not exist */
#define ENOTOWNER 0x46 /* user trying to detach a
* device is not the device's owner */
#define EIOJOB 0x47 /* job is not a valid IO job */
#define EUDFFORMAT 0x48 /* udf is corrupted */
#define ENAMENEXIST 0x49 /* user name not present in udf */
#define EUIDNEXIST 0x4a /* user token doesn't match udf */
#define EPASSWORDMISMATCH 0x4b /* incorrect password */
#define EUDFIO 0x4c /* specified UDF file cannot
* be found */
/* Expanded IO exception codes */
#define EIOUNCLASS 0x50 /* an unclassified error has
* occured */
#define EIOSOFT 0x51 /* soft error has occured */
#define EIOHARD 0x52 /* hard error has occured */
#define EIOOPRINT 0x53 /* device is not ready */
#define EIOWRPROT 0x54 /* write protected */
#define EIONODATA 0x55 /* no data on the next TAPE record */
#define EIOMODE 0x56 /* a tape drive attempted
* a read/write operation
* before the previous one
* completed */
#define EIONOSPARES 0x57 /* an attempt was made to assign
* an alternate track, but no
* more were available */
#define EIOALTASSIGNED 0x58 /* an alternate was assigned
* during this I/O operation */
/* Application Loader exception codes */
#define EBADHEADER 0x62 /* an invalid object file header */
#define EEOF 0x65 /* unexpected End of File
* while reading a record */
#define ENOLOADERMEM 0x67
#define ENOSTART 0x6c /* the Application Loader
* could not find the start
* address */
#define EJOBSIZE 0x6d /* The max. memory pool size of
* job being loaded is smaller
* than the amount required to
* load it */
#define EOVERLAY 0x6e /* the overlay name does not match */
#define ELOADERSUPPORT 0x6f /* The file requires features
* not supported by this
* configuration of the
* Application Loader */
/* Human Interface exception codes */
#define ELITERAL 0x80 /* literal with no closing
* quote detected while parsing */
#define ESTRINGBUFFER 0x81 /* buffer too small for
* O.S. returned string */
#define ESEPARATOR 0x82 /* illegal command separator */
#define ECONTINUED 0x83 /* user parse buffer is continued */
#define EINVALIDNUMERIC 0x84 /* invalid form of number */
#define ELIST 0x85 /* missing value-list value */
#define EWILDCARD 0x86 /* invalid wildcard character usage */
#define EPREPOSITION 0x87 /* invalid preposition usage */
#define EPATH 0x88 /* invalid path name */
#define ECONTROLC 0x89 /* job cancelled via a control-C */
#define ECONTROL 0x8a /* invalid control */
#define EUNMATCHEDLISTS 0x8b
#define EINVALIDDATE 0x8c
#define ENOPARAMETERS 0x8d /* no parameters found in
* command line */
#define EVERSION 0x8e /* version of entered command
* incompatible with system */
#define EGETPATHORDER 0x8f /* get$output$pathname called
* before get$input$pathname */
#define EPERMISSION 0x90 /* do not have proper access */
#define EINVALIDTIME 0x91 /* setting of time was invalid */
/* UDI exception codes */
#define EUNKNOWNEXIT 0xc0 /* normal termination */
#define EWARNINGEXIT 0xc1 /* warning termination */
#define EERROREXIT 0xc2 /* error termination */
#define EFATALEXIT 0xc3 /* fatal error termination */
#define EABORTEXIT 0xc4 /* user program aborted */
#define EUDIINTERNAL 0xc5 /* unrecoverable internal error */
/* * * * * * * * * * * * * * * * * * * * */
/* */
/* P R O G R A M M I N G E R R O R S */
/* */
/* * * * * * * * * * * * * * * * * * * * */
/* Nucleus exception codes */
#define EZERODIVIDE 0x8000
#define EOVERFLOW 0x8001 /* overflow interrupt occured */
#define ETYPE 0x8002 /* token parameter is of
* invalid type */
#define EPARAM 0x8004 /* parameter has an invalid value */
#define EBADCALL 0x8005 /* An OS extension received an
* invalid code */
#define EARRAYBOUNDS 0x8006 /* array overflow*/
#define ENDPERROR 0x8007 /* NPX error has occured */
#define EILLEGALOPCODE 0x8008
#define EEMULATORTRAP 0x8009 /* an ESC instruction was
* encountered with emulator
* bit set in MSW */
#define ECHECKEXCEPTION 0x800a /* a PASCAL task exceeded CASE
* statement boundary */
#define ECPUXFERDATALIMIT 0x800b /* the NPX tried to access an
* address that is out of
* segment bound */
#define EPROTECTION 0x800d /* General Protection error */
#define ENOTPRESENT 0x800e /* A request to load a segment
* register whose segment is
* not present */
#define EBADADDR 0x800f /* Invalid logical address */
/* Nucleus Communication Service exception codes */
#define EPROTOCOL 0x80e0 /* port parameter is wrong
* protocol */
#define EPORTIDUSED 0x80e1 /* request port id is in use */
#define ENUCBADBUF 0x80e2 /* invalid buffer pointer or
* insufficient buffer length */
/* IOS exception codes */
/* EIOS exception codes */
#define ENOUSER 0x8021 /* no default user is defined */
#define ENOPREFIX 0x8022 /* no default prefix is defined */
#define EBADBUFF 0x8023 /* specified buffer too small
* for requested operation */
#define ENOTLOGNAME 0x8040 /* the specified object is
* not a device or file connection */
#define ENOTDEVICE 0x8041 /* the specified object is
* not a device connection */
#define ENOTCONNECTION 0x8042 /* the specified object is
* not a file connection */
/* Application Loader exception codes */
#define EJOBPARAM 0x8060 /* maximum memory specified
* is less than the minimum
* memory specified */
/* HI exception codes */
#define EPARSETABLES 0x8080 /* internal error in parse tables */
#define EJOBTABLES 0x8081 /* internal inconsistency
* in job tables */
#define EDEFAULTSO 0x8083 /* default output name string
* specified is invalid */
#define ESTRING 0x8084 /* Returned pathname exceeds
* 255 characters in length */
#define EERROROUTPUT 0x8085 /* send$eo$response called
* when command connection
* allows only send$co$response */
/* UDI exception codes */
#define ERESERVEPARAM 0x80c6 /* calling program attempted
* to reserve more than 12
* files or buffers */
#define EOPENPARAM 0x80c7 /* calling program attempted
* to open a file with more
* than two buffers */

View File

@ -0,0 +1,21 @@
/* search.h - searching and sorting function prototypes
* $Version: 1.14 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _searchh
#define _searchh
/*lint -library */
#pragma fixedparams("lfind", "lsearch")
/*
* Function prototypes:
*/
void *lfind(const void *, const void *, unsigned *, unsigned,
int (*)(const void *, const void *));
void *lsearch(const void *, void *, unsigned *, unsigned,
int (*)(const void *, const void *));
#endif /* _searchh */

View File

@ -0,0 +1,22 @@
/* setjmp.h - define the set jump stuff
* $Version: 1.11 $
* Copyright (C) 1988-91 Intel Corporation, ALL RIGHTS RESERVED
*/
#ifndef _setjmph
#define _setjmph
/*lint -library */
#pragma fixedparams("longjmp", "setjmp")
#define _JBLEN 9
typedef int jmp_buf[_JBLEN];
/*
* Function prototypes:
*/
void longjmp(jmp_buf, int);
int setjmp(jmp_buf);
#endif /* _setjmph */

View File

@ -0,0 +1,16 @@
/* share.h - file sharing permission levels
* $Version: 1.11 $
* Copyright (C) 1988-91 Intel Corporation, ALL RIGHTS RESERVED
*/
#ifndef _shareh
#define _shareh
/*lint -library */
#define SH_COMPAT 0x00
#define SH_DENYRW 0x10
#define SH_DENYWR 0x20
#define SH_DENYRD 0x30
#define SH_DENYNO 0x40
#endif /* _shareh */

View File

@ -0,0 +1,75 @@
/* signal.h - signal handling header file
* $Version: 1.20 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _signalh
#define _signalh
/*lint -library */
#pragma fixedparams("_sig_abrt_dfl", "_sig_alloc_dfl", "_sig_break_dfl")
#pragma fixedparams("_sig_fpe_dfl", "_sig_free_dfl", "_sig_ill_dfl")
#pragma fixedparams("_sig_int_dfl", "_sig_read_dfl", "_sig_segv_dfl")
#pragma fixedparams("_sig_term_dfl", "_sig_write_dfl", "_sig_null")
#pragma fixedparams("_sig_err_dummy", "_sig_dfl_dummy", "_sig_ign_dummy")
#pragma fixedparams("_sig_dfl", "raise", "signal")
typedef char sig_atomic_t;
/*
* Signal definitions:
*/
#define SIGILL 1 /* illegal instruction signal */
#define SIGINT 2 /* interactive attention signal */
#define SIGALLOC 3 /* dynamic memory allocation failure signal */
#define SIGFREE 4 /* bad free pointer signal */
#define SIGTERM 5 /* terminate signal */
#define SIGREAD 6 /* read error signal */
#define SIGWRITE 7 /* write error signal */
#define SIGFPE 8 /* floating point exception signal */
#define SIGSEGV 9 /* segment violation signal */
#define SIGABRT 10 /* abnormal termination signal */
#define SIGBREAK 11 /* Ctrl_break sequence */
#define SIGUSR1 12 /* User-defined signal 1 */
#define SIGUSR2 13 /* User-defined signal 2 */
#define SIGUSR3 14 /* User-defined signal 3 */
#define SIGSIZE 15 /* Number of defined signals */
extern void _sig_ill_dfl(void);
extern void _sig_int_dfl(void);
extern void _sig_alloc_dfl(void);
extern void _sig_free_dfl(void);
extern void _sig_term_dfl(void);
extern void _sig_read_dfl(void);
extern void _sig_write_dfl(void);
extern void _sig_fpe_dfl(void);
extern void _sig_segv_dfl(void);
extern void _sig_abrt_dfl(void);
extern void _sig_break_dfl(void);
extern void _sig_null(void);
extern void _sig_err_dummy(int);
extern void _sig_dfl_dummy(int);
extern void _sig_ign_dummy(int);
/*
* Signal vector arrays
*/
extern void (*_sig_eval[SIGSIZE])();
extern void (*_sig_dfl[SIGSIZE])();
/*
* Signal processing macros
*/
#define SIG_DFL (&_sig_dfl_dummy)
#define SIG_ERR (&_sig_err_dummy)
#define SIG_IGN (&_sig_ign_dummy)
/*
* Function prototypes:
*/
void (*signal (int, void (*)(int)))(int);
int raise(int);
#endif /* _signalh */

View File

@ -0,0 +1,25 @@
/* stdarg.h - macros and types for variable argument list to a function
* $Version: 1.9 $
* Copyright (C) 1988-91 Intel Corporation, ALL RIGHTS RESERVED
*/
#ifndef _stdargh
#define _stdargh
/*lint -library */
#ifndef _va_list
#define _va_list
typedef char *va_list;
#endif
#define _sizeof_param(type) \
((sizeof(type)+sizeof(int)-1) & (~(sizeof(int)-1)))
#define va_start(ap,paramn) \
(ap=((char *)&(paramn)+_sizeof_param(paramn)))
#define va_arg(ap,type) \
(*((type *)((ap+=_sizeof_param(type))-_sizeof_param(type))))
#define va_end(ap)
#endif /* _stdargh */

View File

@ -0,0 +1,32 @@
/* stddef.h - This file contains "standard definitions"
* $Version: 1.13 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _stddefh
#define _stddefh
/*lint -library */
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef _ptrdiff_t
typedef int ptrdiff_t;
#define _ptrdiff_t
#endif
#ifndef _size_t
#define _size_t
typedef unsigned size_t; /* result of sizeof operator */
#endif
#ifndef _wchar_t
#define _wchar_t
typedef char wchar_t;
#endif
#define offsetof(s_type, memb) ((size_t)(char *)&((s_type *)0)->memb)
#define NUL '\0' /* string terminator */
#endif /* _stddefh */

View File

@ -0,0 +1,178 @@
/* stdio.h - standard I/O header file
* $Version: 1.46 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _stdioh
#define _stdioh
/*lint -library */
#pragma fixedparams("rename", "tempnam", "tmpnam")
#pragma fixedparams("_fsopen")
#pragma fixedparams("clearerr")
#pragma fixedparams("fclose", "feof", "ferror", "fflush", "fgetc")
#pragma fixedparams("fgets", "fopen", "fputc", "fputs", "fread")
#pragma fixedparams("freopen", "fseek", "ftell", "fwrite", "getc")
#pragma fixedparams("getchar", "gets", "perror", "putc", "putchar")
#pragma fixedparams("puts", "remove", "rewind", "setbuf", "setvbuf")
#pragma fixedparams("tmpfile", "ungetc", "vfprintf", "vprintf", "vsprintf")
#pragma fixedparams("fgetpos", "fsetpos")
#pragma fixedparams("fcloseall", "fdopen", "fgetchar", "fileno", "flushall")
#pragma fixedparams("fputchar", "getw", "putw", "rmtmp")
#pragma varparams("fprintf", "fscanf", "printf", "scanf", "sprintf")
#pragma varparams("sscanf")
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef _fpos_t
#define _fpos_t
typedef unsigned long fpos_t;
#endif
#ifndef _size_t
#define _size_t
typedef unsigned size_t;
#endif
#ifndef _va_list
typedef char *va_list;
#define _VA_LIST_DEFINED
#define _va_list
#endif
#define BUFSIZ 512
#define FOPEN_MAX 20
#define TMP_MAX 4096
#define FILENAME_MAX 127
#define EOF (-1)
#define L_tmpnam 13
#define P_tmpdir "\\"
#define _IOREAD 0x01
#define _IOWRT 0x02
#define _IOFBF 0x00 /* neither line nor char buffering */
#define _IOLBF 0x40
#define _IONBF 0x04
#define _IOMYBUF 0x08
#define _IOEOF 0x10
#define _IOERR 0x20
#define _IOSTRG 0x40
#define _IORW 0x80
#define _IODIRTY 0x200
#define _IO_STD_STREAM 0x1000
/* seek */
#ifndef SEEK_SET
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif
#ifndef _reenth
#pragma align (_iobuf)
#endif
#ifndef _FILE_t
struct _iobuf {
unsigned char *_ptr;
int _cnt;
unsigned char *_base;
int _flag;
int _fd; /* File descriptor number */
int _size; /* File buffer size */
char *_temp_name; /* Temporary file name */
void *_sem; /* Semaphore */
struct _iobuf *_next_stream; /* Pointer to the next stream */
};
typedef struct _iobuf FILE;
#define _FILE_t
#endif
#include <reent.h>
#define stdin (&_stdio_ptr()->_stdin)
#define stdout (&_stdio_ptr()->_stdout)
#define stderr (&_stdio_ptr()->_stderr)
/*
* Function prototypes:
*/
void clearerr(FILE *);
int fclose(FILE *);
int fcloseall(void);
FILE *fdopen(int, const char *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetchar(void);
int fgetpos(FILE *, fpos_t *);
char *fgets(char *, int, FILE *);
int fileno(FILE *);
int flushall(void);
FILE *fopen(const char *, const char *);
int fprintf(FILE *, const char *, ...);
int fputc(int, FILE *);
int fputchar(int);
int fputs(const char *, FILE *);
size_t fread(void *, size_t, size_t, FILE *);
FILE *freopen(const char *, const char *, FILE *);
int fscanf(FILE *, const char *, ...);
int fseek(FILE *, long int, int);
int fsetpos(FILE *, const fpos_t *);
FILE *_fsopen(const char *, const char *, int);
long int ftell(FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);
int getc(FILE *);
int getchar(void);
char *gets(char *);
int getw(FILE *);
void perror(const char *);
int printf(const char *, ...);
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int putw(int, FILE *);
int remove(const char *);
int rename(const char *, const char *);
void rewind(FILE *);
int rmtmp(void);
int scanf(const char *, ...);
void setbuf(FILE *, char *);
int setvbuf(FILE *, char *, int, size_t);
int sprintf(char *, const char *, ...);
int sscanf(const char *, const char *, ...);
char *tempnam(char *, const char *);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int, FILE *);
int vfprintf(FILE *, const char *, va_list);
int vprintf( const char *, va_list);
int vsprintf(char *, const char *, va_list);
/*
* Macro implementation of stdio functions:
*/
#define feof(f) ((f)->_flag & _IOEOF)
#define ferror(f) ((f)->_flag & _IOERR)
#define fgetchar() fgetc(stdin)
#define fileno(f) ((f)->_fd)
#define getchar() getc(stdin)
#define putchar(c) putc((c),stdout)
#define _ungetc_
#define getc(_s) (((((_s)->_cnt) > 0) && (((_s)->_cnt) < ((_s)->_size))) \
? (((_s)->_cnt--), (unsigned char)(*(_s)->_ptr++)) : ((getc)(_s)))
#define putc(_c,_s) (((((_s)->_cnt) > 0) && (((_s)->_cnt) < ((_s)->_size))) \
? (((_s)->_cnt--), (*((_s)->_ptr++)=(unsigned char)(_c))) : ((putc)(_c,_s)))
#endif /* _stdioh */

View File

@ -0,0 +1,183 @@
/* stdlib.h - standard utility functions
* $Version: 1.41 $
* Copyright (C) 1988-91 Intel Corporation, ALL RIGHTS RESERVED
*/
#ifndef _stdlibh
#define _stdlibh
/*lint -library */
#pragma fixedparams("abort", "getenv", "putenv", "swab", "system")
#pragma fixedparams("sbrk")
#pragma fixedparams("atof", "ecvt", "fcvt", "ftoa", "gcvt")
#pragma fixedparams("strtod")
#pragma fixedparams("abs", "atexit", "atoi", "atol", "bsearch")
#pragma fixedparams("calloc", "div", "exit", "free", "labs")
#pragma fixedparams("ldiv", "malloc", "qsort", "rand", "realloc")
#pragma fixedparams("srand", "strtol", "strtoul", "mblen", "mbtowc")
#pragma fixedparams("wctomb", "mbstowcs", "wcstombs")
#pragma fixedparams("itoa", "itoh", "ltoa", "ltoh", "ltos")
#pragma fixedparams("onexit", "ultoa", "utoa")
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef _size_t
#define _size_t
typedef unsigned size_t;
#endif
#ifndef _wchar_t
#define _wchar_t
typedef char wchar_t;
#endif
#ifndef _div_t
typedef struct {
int quot;
int rem;
} div_t;
typedef struct {
long quot;
long rem;
} ldiv_t;
#define _div_t
#endif
#ifndef _regs
#pragma align (DWORDREGS)
#pragma align (WORDREGS)
#pragma align (BYTEREGS)
union REGS {
struct DWORDREGS {unsigned eax, ebx, ecx, edx, esi,
edi, cflag, eflags, ebp;} w;
struct WORDREGS {unsigned ax, bx, cx, dx, si,
di, cflag, flags, bp;} x;
#if _ARCHITECTURE_ == 386 || _ARCHITECTURE_ == 486
struct BYTEREGS {unsigned al:8, ah:8, :16, bl:8, bh:8, :16,
cl:8, ch:8, :16, dl:8, dh:8, :16;} h;
#else
struct BYTEREGS {unsigned al:8, ah:8, bl:8, bh:8,
cl:8, ch:8, dl:8, dh:8;} h;
#endif
};
#pragma align (SREGS)
struct SREGS {
unsigned short es, cs, ss, ds, fs, gs;
};
#define _regs
#endif /* _regs */
typedef int (*onexit_t)(void);
#define RAND_MAX 0x7FFF
#define MB_CUR_MAX 1
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define _MAX_PATH 260 /* Max length of full pathname */
#define _MAX_DRIVE 3 /* Max length of drive component */
#define _MAX_DIR 256 /* Max length of path component */
#define _MAX_FNAME 256 /* Max length of file name component */
#define _MAX_EXT 256 /* Max length of extension component */
extern int _fmode; /* Default file translation mode */
/*
* Function prototypes:
*/
void abort(void);
int abs(int);
int atexit(void (*)(void));
double atof(const char *);
int atoi(const char *);
long atol(const char *);
void *bsearch(const void *, const void *, size_t, size_t,
int (*)(const void *, const void *));
void *calloc(size_t, size_t);
div_t div(int, int);
char *ecvt(double, int, int *, int *);
void exit(int);
char *fcvt(double, int, int *, int *);
void free(void *);
char *ftoa(double, char *, unsigned int, unsigned int);
char *_fullpath(char *, const char *, size_t);
char *gcvt(double, int, char *);
char *getenv(const char *);
char *itoa(int, char *, int);
char *itoh(int, char *);
long labs(long);
ldiv_t ldiv(long, long);
char *ltoa(long, char *, int);
char *ltoh(unsigned long, char *);
char *ltos(long int, char *, int);
void _makepath(char *, const char *, const char *,
const char *, const char *);
void *malloc(size_t);
int mblen(const char *, size_t);
size_t mbstowcs(wchar_t *, const char *, size_t);
int mbtowc(wchar_t *, const char *, size_t);
onexit_t onexit(onexit_t);
int putenv(const char *);
void qsort(void *, size_t, size_t, int (*)(const void *,
const void *));
int rand(void);
void *realloc(void *, size_t);
void *sbrk(unsigned);
void _searchenv(const char *, const char *, char *);
void _splitpath(const char *, char *, char *, char *, char *);
void srand(unsigned int);
double strtod(const char *, char **);
long strtol(const char *, char **, int);
unsigned long strtoul(const char *, char **, int);
void swab(const char *, char *, int);
int system(const char *);
char *ultoa(unsigned long, char *, int);
char *utoa(unsigned int, char *, int);
size_t wcstombs(char *, const wchar_t *, size_t);
int wctomb(char *, wchar_t);
/*
* Non-ANSI function also prototyped in dos.h
*/
#ifndef _stdlib_dos
#define _stdlib_dos
#pragma fixedparams("segread")
void segread(struct SREGS *);
#endif
/*
* Compiler built-in functions:
*/
#ifndef _stdlibh_builtin
#define _stdlibh_builtin
#pragma _builtin_("_abs_"==51)
int _abs_(int);
#define abs(x) _abs_(x)
#pragma _builtin_("_labs_"==52)
long _labs_(long);
#define labs(x) _labs_(x)
#endif /* _stdlibh_builtin */
/*
* Macro definitions:
*/
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define _strtold(_a, _b) (long double)strtod(_a, _b)
#endif /* _stdlibh */

View File

@ -0,0 +1,91 @@
/* string.h - string function prototypes
* $Version: 1.28 $
* Copyright (c) 1984,85,86,87 Computer Innovations Inc, ALL RIGHTS RESERVED.
* Copyright (c) 1988,89, 90 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _stringh
#define _stringh
/*lint -library */
#pragma fixedparams("memchr", "memcmp", "memcpy", "memset", "memmove")
#pragma fixedparams("strcat", "strchr", "strcmp", "strcpy", "strcspn")
#pragma fixedparams("strlen", "strncat", "strncmp", "strncpy", "strpbrk")
#pragma fixedparams("strrchr", "strspn", "strstr", "strtok", "strcoll")
#pragma fixedparams("strxfrm")
#pragma fixedparams("movedata", "strerror")
#pragma fixedparams("memccpy", "memicmp", "strcmpi", "strdup", "stricmp")
#pragma fixedparams("strlwr", "strnicmp", "strnset", "strrev", "strset")
#pragma fixedparams("strupr", "udistr")
#pragma fixedparams("cstr")
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef _size_t
#define _size_t
typedef unsigned size_t;
#endif
/*
* Function prototypes:
*/
char *cstr(char *, const char *);
void *memccpy(void *, const void *, int, int);
void *memchr(const void *, int, size_t);
int memcmp(const void*, const void*, size_t);
void *memcpy(void*, const void*, size_t);
int memicmp(const void *, const void *, unsigned);
void *memmove(void *, const void *, size_t);
void *memset(void*, int, size_t);
void movedata(unsigned, unsigned, unsigned, unsigned, unsigned);
char *strcat(char *, const char *);
char *strchr(const char *, int);
int strcmp(const char *, const char *);
int strcmpi(const char *, const char *);
int strcoll(const char *, const char *);
char *strcpy(char*, const char*);
size_t strcspn(const char *, const char *);
char *strdup(const char *);
char *strerror(int);
int stricmp(const char *, const char *);
size_t strlen(const char *);
char *strlwr(char *);
char *strncat(char *, const char *, size_t);
int strncmp(const char *, const char *, size_t);
char *strncpy(char *, const char *, size_t);
int strnicmp(const char *, const char *, size_t);
char *strnset(char *, int, size_t);
char *strpbrk(const char *, const char *);
char *strrchr(const char *, int);
char *strrev(char *);
char *strset(char *, int);
size_t strspn(const char *, const char *);
char *strstr(const char *, const char *);
char *strtok(char *, const char *);
char *strupr(char *);
size_t strxfrm(char *, const char *, size_t);
char *udistr(char *, const char *);
/*
* Compiler built-in functions:
*/
#ifndef _stringh_builtin
#define _stringh_builtin
#pragma _builtin_("_memcpy_"==64)
void *_memcpy_(void*, const void*, size_t);
#define memcpy(x,y,z) _memcpy_(x,y,z)
#pragma _builtin_("_memset_"==65)
void *_memset_(void*, int, size_t);
#define memset(x,y,z) _memset_(x,y,z)
#pragma _builtin_("_strcpy_"==71)
char *_strcpy_(char*, const char*);
#define strcpy(x,y) _strcpy_(x,y)
#endif /* _stringh_builtin */
#endif /* _stringh */

View File

@ -0,0 +1,17 @@
/* locking.h - modes for locking()
* $Version: 1.11 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _lockingh
#define _lockingh
/*lint -library */
#define LK_UNLCK 0
#define LK_LOCK 1
#define LK_NBLCK 2
#define LK_RLCK 3
#define LK_NBRLCK 4
#endif /* _lockingh */

View File

@ -0,0 +1,118 @@
/* stat.h - file stat structure
* $Version: 1.19 $
* Copyright (C) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _stath
#define _stath
/*lint -library */
#ifndef _typesh
#include <sys/types.h>
#endif
#pragma fixedparams("fstat", "stat")
/*
* File types
*/
#define S_IFMT 0xF000 /* mask */
#define S_IFIFO 0x1000 /* fifo file */
#define S_IFCHR 0x2000 /* character device */
#define S_IFDIR 0x4000 /* directory */
#define S_IFBLK 0x6000 /* block device */
#define S_IFREG 0x8000 /* regular file */
/*
* Macros to test file types
*/
#define S_ISDIR(m) (((m) & S_IFMT ) == S_IFDIR)
#define S_ISCHR(m) (((m) & S_IFMT ) == S_IFCHR)
#define S_ISBLK(m) (((m) & S_IFMT ) == S_IFBLK)
#define S_ISREG(m) (((m) & S_IFMT ) == S_IFREG)
#define S_ISFIFO(m) (((m) & S_IFMT ) == S_IFIFO)
/*
* File access permission levels (in octal)
*/
#define S_ISGID 0002000 /* set group ID on execution */
#define S_ISUID 0001000 /* set user ID on execution */
#define S_IREAD 0000400 /* pre-POSIX definition */
#define S_IWRITE 0000200 /* pre-POSIX definition */
#define S_IEXEC 0000100 /* Pre-POSIX definition */
#define S_IARCHIVE 0100000 /* DOS specific mode */
#define S_ISUBDIR 0040000 /* DOS specific mode */
#define S_IVOLUME 0020000 /* DOS specific mode */
#define S_ISYSTEM 0010000 /* DOS specific mode */
#define S_IHIDDEN 0004000 /* DOS specific mode */
/*
* File owner class (in octal)
*/
#define S_IRWXU 0000700 /* mask for file owner class */
#define S_IRUSR 0000400 /* read permission for file owner class */
#define S_IWUSR 0000200 /* write permission for file owner class */
#define S_IXUSR 0000100 /* execute/search permission for file owner class */
/*
* File group class (in octal)
*/
#define S_IRWXG 0000070 /* mask for file group class */
#define S_IRGRP 0000040 /* read permission for file group class */
#define S_IWGRP 0000020 /* write permission for file group class */
#define S_IXGRP 0000010 /* execute or search permission for file group class */
/*
* File other class (in octal)
*/
#define S_IRWXO 0000007 /* mask for file other class */
#define S_IROTH 0000004 /* read permission for file other class */
#define S_IWOTH 0000002 /* write permission for file other class */
#define S_IXOTH 0000001 /* execute or search permission for file other class */
/*
* Structure used by _dos_findfirst
*/
#ifndef _find_t
#pragma noalign (find_t)
struct find_t {
char reserved[21]; /* Reserved for DOS */
char attrib; /* Returned attribute */
unsigned short wr_time; /* Time file last written */
unsigned short wr_date; /* Date file last written */
long size; /* Size of file */
char name[13]; /* String containing the filename */
};
#define _find_t
#endif
/*
* file stat structure
*/
#pragma align (stat)
struct stat {
dev_t st_dev; /* ID of device containing this file */
ino_t st_ino; /* File serial number */
mode_t st_mode; /* File mode */
nlink_t st_nlink; /* Number of links */
uid_t st_uid; /* User ID of the file's owner */
gid_t st_gid; /* Group ID of the file's group */
dev_t st_rdev; /* Same as st_dev */
off_t st_size; /* File size in bytes (regular files only) */
time_t st_atime; /* Time of last access */
time_t st_mtime; /* Time of last data modification */
time_t st_ctime; /* Time of last file status change */
};
/*
* Function prototypes:
*/
int fstat(int, struct stat *);
int stat(const char *, struct stat *);
#endif /* _stath */

View File

@ -0,0 +1,70 @@
/* types.h -
* $Version: 1.5 $
* Copyright (C) 1989-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _typesh
#define _typesh
#ifndef _dev_t
typedef unsigned long dev_t;
#define _dev_t
#endif
#ifndef _fpos_t
typedef unsigned long fpos_t;
#define _fpos_t
#endif
#ifndef _gid_t
typedef unsigned short gid_t;
#define _gid_t
#endif
#ifndef _ino_t
typedef unsigned long ino_t;
#define _ino_t
#endif
#ifndef _mode_t
typedef unsigned long mode_t;
#define _mode_t
#endif
#ifndef _nlink_t
typedef unsigned long nlink_t;
#define _nlink_t
#endif
#ifndef _off_t
#if _ARCHITECTURE_ == 386 || _ARCHITECTURE_ == 486
typedef int off_t;
#else
typedef long off_t;
#endif /* _ARCHITECTURE_ */
#define _off_t
#endif
#ifndef _pid_t
typedef long pid_t;
#define _pid_t
#endif
#ifndef _size_t
typedef unsigned size_t;
#define _size_t
#endif
#ifndef _time_t
typedef long time_t;
#define _time_t
#endif
#ifndef _uid_t
typedef unsigned short uid_t;
#define _uid_t
#endif
#endif /* _typesh */

View File

@ -0,0 +1,29 @@
/* utime.h - basic struct for utime()
* $Version: 1.15 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _utimeh
#define _utimeh
/*lint -library */
#ifndef _time_t
typedef long time_t;
#define _time_t
#endif
#pragma fixedparams("utime")
#pragma align (utimbuf)
struct utimbuf {
time_t actime; /* time of last access - not available under DOS */
time_t modtime; /* time of last modification */
};
/*
* Function prototypes:
*/
int utime(const char *, struct utimbuf *);
#endif /* _utimeh */

View File

@ -0,0 +1,74 @@
/* time.h - basic struct for time(), asctime(), localtime()
* $Version: 1.29 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _timeh
#define _timeh
/*lint -library */
#pragma fixedparams("asctime", "clock", "ctime", "difftime", "gmtime")
#pragma fixedparams("localtime", "mktime", "strftime", "time", "tzset")
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef _size_t
#define _size_t
typedef unsigned size_t;
#endif
#ifndef _time_t
#define _time_t
#if _ARCHITECTURE_ == 386 || _ARCHITECTURE_ == 486
typedef unsigned time_t;
#else
typedef unsigned long time_t;
#endif /* _ARCHITECTURE_ */
#endif
typedef unsigned long clock_t;
#define CLK_TCK 1000
#define CLOCKS_PER_SEC 1000
#ifndef _reenth
#pragma align (tm)
#endif
struct tm {
int tm_sec; /* seconds (0-59) */
int tm_min; /* minutes (0-59) */
int tm_hour; /* hours (0-23) */
int tm_mday; /* days (1-31) */
int tm_mon; /* months (0-11) */
int tm_year; /* year (minus 1900) */
int tm_wday; /* day of week (sun = 0) */
int tm_yday; /* day of year (0-365) */
int tm_isdst; /* non-zero if DST */
};
/*
* Function prototypes:
*/
char *asctime(const struct tm *);
clock_t clock(void);
char *ctime(const time_t *);
double difftime(time_t, time_t);
struct tm *gmtime(const time_t *);
struct tm *localtime(const time_t *);
time_t mktime(struct tm *);
size_t strftime(char *, size_t, const char *, const struct tm *);
time_t time(time_t *);
void tzset(void);
#include <reent.h>
#define daylight (_tzset_ptr()->_daylight)
#define timezone (_tzset_ptr()->_timezone)
#define tzname (_tzset_ptr()->_tzname)
#endif /* _timeh */

View File

@ -0,0 +1,213 @@
/*
* udi.h - iRMX (reg. TM) UDI System Call interface functions
* $Version: 1.3 $
* Copyright (C) 1989, 90 Intel Corporation, ALL RIGHTS RESERVED
*/
#ifndef _udih
#define _udih
#include <i86.h>
#include <time.h>
#ifndef _plmtypes
#define _plmtypes
#if _ARCHITECTURE_ < 386
#define NATIVE_WORD unsigned short /* 16-bit machine */
#else
#define NATIVE_WORD unsigned long /* 32-bit machine */
#endif
#define BYTE unsigned char
#define STRING char
#define BOOLEAN unsigned char
#define WORD unsigned short
#define DWORD unsigned long
#define TOKEN selector
#define SELECTOR selector
#endif
/* -------------------------------------------------------------------- */
/*
* iRMX UDI interface functions
*/
#pragma fixedparams("dqallocate","dqattach","dqchangeaccess")
#pragma fixedparams("dqchangeextension","dqclose","dqcreate")
#pragma fixedparams("dqdecodeexception","dqdecodetime","dqdelete")
#pragma fixedparams("dqdetach","dqexit","dqfileinfo","dqfree")
#pragma fixedparams("dqgetargument","dqgetconnectionstatus")
#pragma fixedparams("dqgetexceptionhandler","dqgetmsize","dqgetsize")
#pragma fixedparams("dqgetsystemid","dqgettime","dqmallocate","dqmfree")
#pragma fixedparams("dqopen","dqread","dqrename")
#pragma fixedparams("dqreserveiomemory","dqseek","dqspecial")
#pragma fixedparams("dqswitchbuffer","dqtrapcc","dqtrapexception")
#pragma fixedparams("dqtruncate","dqwrite")
/* iRMX UDI structure usage:
*
* CONNSTATUSSTRUCT - dqgetconnectionstatus
* DATETIMESTRUCT - dqdecodetime
* FILEINFOSTRUCT - dqfileinfo
* HANDLERPTRSTRUCT - dqgetexceptionhandler, dqtrapcc, dqtrapexception
*/
#pragma noalign (connstatusstruct)
typedef struct connstatusstruct {
BYTE open;
BYTE access;
BYTE seek;
DWORD fileptr;
} CONNSTATUSSTRUCT;
#pragma noalign (datetimestruct)
typedef struct datetimestruct {
time_t systemtime;
BYTE date[8];
BYTE time[8];
} DATETIMESTRUCT;
#pragma noalign (fileinfostruct)
typedef struct fileinfostruct {
BYTE owner[15];
DWORD length;
BYTE type;
BYTE owneraccess;
BYTE worldaccess;
time_t creationtime;
time_t modifytime;
BYTE groupaccess;
BYTE reserved[19];
} FILEINFOSTRUCT;
#pragma noalign (handlerptrstruct)
typedef struct handlerptrstruct {
NATIVE_WORD offset;
SELECTOR base;
} HANDLERPTRSTRUCT;
extern TOKEN dqallocate(NATIVE_WORD,
WORD far *);
extern TOKEN dqattach(STRING far *,
WORD far *);
extern void dqchangeaccess(STRING far *,
BYTE,
BYTE,
WORD far *);
extern void dqchangeextension(STRING far *,
STRING far *,
WORD far *);
extern void dqclose(TOKEN,
WORD far *);
extern TOKEN dqcreate(STRING far *,
WORD far *);
extern void dqdecodeexception(WORD,
STRING far *,
WORD far *);
extern void dqdecodetime(DATETIMESTRUCT far *,
WORD far *);
extern void dqdelete(STRING far *,
WORD far *);
extern void dqdetach(TOKEN,
WORD far *);
extern void dqexit(WORD);
extern void dqfileinfo(TOKEN,
BYTE,
FILEINFOSTRUCT far *,
WORD far *);
extern void dqfree(TOKEN,
WORD far *);
extern BYTE dqgetargument(STRING far *,
WORD far *);
extern void dqgetconnectionstatus(TOKEN,
CONNSTATUSSTRUCT far *,
WORD far *);
extern void dqgetexceptionhandler(
HANDLERPTRSTRUCT far *,
WORD far *);
extern NATIVE_WORD dqgetsize(TOKEN,
WORD far *);
extern void dqgetsystemid(BYTE far * id,
WORD far *);
extern void dqgettime(BYTE far *,
WORD far *);
extern BYTE far * dqmallocate(DWORD,
WORD far *);
extern void dqmfree(BYTE far *,
WORD far *);
extern DWORD dqgetmsize(BYTE far *,
WORD far *);
extern void dqopen(TOKEN,
BYTE,
BYTE,
WORD far *);
#if _ARCHITECTURE_ < 386
#pragma fixedparams("dqoverlay")
extern void dqoverlay(STRING far *,
WORD far *);
#endif
extern NATIVE_WORD dqread(TOKEN,
BYTE far *,
NATIVE_WORD,
WORD far *);
extern void dqrename(STRING far *,
STRING far *,
WORD far *);
extern void dqreserveiomemory(WORD,
WORD,
WORD far *);
extern void dqseek(TOKEN,
BYTE,
DWORD,
WORD far *);
extern void dqspecial(BYTE,
void far *,
WORD far *);
extern WORD dqswitchbuffer(BYTE far *,
WORD far *);
extern void dqtrapcc(HANDLERPTRSTRUCT far *,
WORD far *);
extern void dqtrapexception(HANDLERPTRSTRUCT far *,
WORD far *);
extern void dqtruncate(TOKEN,
WORD far *);
extern void dqwrite(TOKEN,
BYTE far *,
NATIVE_WORD,
WORD far *);
#endif /* _udih */

View File

@ -0,0 +1,31 @@
/* unistd.h - file access function prototypes
* $Version: 1.4 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _unistdh
#define _unistdh
/*lint -library */
#define F_OK 0
#define X_OK 1
#define W_OK 2
#define R_OK 4
/* seek */
#ifndef SEEK_SET
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif
#undef _POSIX_JOB_CONTROL
#undef _POSIX_SAVED_IDS
#define _POSIX_VERSION 198808L
#define _POSIX_CHOWN_RESTRICTED -1
#define _POSIX_NO_TRUNC -1
#define _POSIX_VDISABLE -1
#endif /* _unistdh */

View File

@ -0,0 +1,598 @@
; macros and defines for assembly language code
; $Version: 1.28 $
; Copyright 1988,89,90,91 Intel Corporation, ALL RIGHTS RESERVED
%' errno values returned by assembly routines
EACCES equ 2
EBADF equ 5
EDOM equ 10
%' controls
%' module name
%*define(module=name) (%define(module_name)(%name))
%' memory model
%*define(small) (%set(far_code, 0)%set(far_stack, 0)%set(set_ds, 0)%set(set_sregs, 1))
%*define(medium) (%set(far_code, 1)%set(far_stack, 0)%set(set_ds, 0)%set(set_sregs, 1))
%*define(compact) (%set(far_code, 0)%set(far_stack, 1)%set(set_ds, 0)%set(set_sregs, 1))
%*define(large) (%set(far_code, 1)%set(far_stack, 1)%set(set_ds, 1)%set(set_sregs, 1))
%*define(flat) (%set(far_code, 0)%set(far_stack, 0)%set(set_ds, 0)%set(set_sregs, 0))
%' memory submodel
%*define(ram) (%set(const_in_code, 0))
%*define(rom) (%set(const_in_code, 1))
%' calling convention
%*define(varparams) (%set(fpl, 0))
%*define(fixedparams) (%set(fpl, 1))
%' instruction set
%*define(mod86) (%set(i186_instrs, 0))
%*define(mod186) (%set(i186_instrs, 1))
%' assembler
%*define(asm86) (%set(i86_asm, 1)%set(i286_asm, 0)%set(i386_asm, 0)%set(i32_asm ,0))
%*define(asm286) (%set(i86_asm, 0)%set(i286_asm, 1)%set(i386_asm, 0)%set(i32_asm ,0)%set(i186_instrs, 1))
%*define(asm386) (%set(i86_asm, 0)%set(i286_asm, 0)%set(i386_asm ,1)%set(i32_asm ,0)%set(i186_instrs, 1))
%*define(asm32) (%set(i86_asm, 0)%set(i286_asm, 0)%set(i386_asm ,1)%set(i32_asm ,1)%set(i186_instrs, 1))
%' stack size
%*define(stacksize=size) (%set(stack_size, %size))
%' abbreviations
%*define(cp) (%compact)
%*define(fp) (%fixedparams)
%*define(fl) (%flat)
%*define(la) (%large)
%*define(md) (%medium)
%*define(sm) (%small)
%*define(vp) (%varparams)
%' defaults
%module=anonymous
%small
%ram
%fixedparams
%mod86
%asm86
%stacksize=0
%' parse the controls
%match(control controls)(%controls)
%while(%len(%control) ne 0)
(
%match(control=argument)(%control)
%if(%len(%argument) ne 0)
then(
%%control=%argument
)else(
%%control
)fi
%match(control controls)(%controls)
)
%' instruction set implications
%if(%i186_instrs)
then(
%*define(enter) (enter)
%*define(leave) (leave)
%if(%i386_asm)
then(
%*define(pusha) (pushad)
%*define(popa) (popad)
)else(
%*define(pusha) (pusha)
%*define(popa) (popa)
)fi
)else(
%*define(enter locals, level)
(
push bp
mov bp, sp
%if(%locals ne 0)
then(
sub sp, %locals
)fi
)
%*define(leave)
(
mov sp, bp
pop bp
)
%*define(pusha)
(
push ax
push cx
push dx
push bx
push bx ; dummy value for sp
push bp
push si
push di
)
%*define(popa)
(
pop di
pop si
pop bp
pop bx ; dummy value for sp
pop bx
pop dx
pop cx
pop ax
)
)fi
%if(%i386_asm)
then(
%define(lodsw) (lodsd)
%define(movsw) (movsd)
%define(movsx) (movsx)
%define(movzx) (movzx)
%define(pushf) (pushfd)
)else(
%define(lodsw) (lodsw)
%define(movsw) (movsw)
%define(movsx) (mov)
%define(movzx) (mov)
%define(pushf) (pushf)
)fi
%' 16-bit vs. 32-bit register
%' ( note that reg_size uses the assembler definition of word and dword)
%if(%i386_asm)
then(
%define(ax) (eax)
%define(bx) (ebx)
%define(cx) (ecx)
%define(dx) (edx)
%define(bp) (ebp)
%define(sp) (esp)
%define(si) (esi)
%define(di) (edi)
%define(reg_size) (dword ptr)
)else(
%define(ax) (ax)
%define(bx) (bx)
%define(cx) (cx)
%define(dx) (dx)
%define(bp) (bp)
%define(sp) (sp)
%define(si) (si)
%define(di) (di)
%define(reg_size) (word ptr)
)fi
%' declaration conveniences (as defined by the assembler, not the compiler)
%set(byte, 1)
%set(word, 2)
%set(dword, 4)
%set(qword, 8)
%set(tbyte, 10)
%if(%i386_asm)
then(
%set(pword, 8)
%set(int_size, 4)
%define(int) (dword)
%define(dint) (dd)
%define(far_ptr) (pword)
)else(
%' %set(pword, 4)
%set(int_size, 2)
%define(int) (word)
%define(dint) (dw)
%define(far_ptr) (dword)
)fi
%' memory model implications
%' medium/large vs. small/compact
%' %code is the name of the code segment for this module
%' %fnc is the type of a global function
%' %fnc_ptr is the size of a function pointer
%if(%far_code)
then(
%define(code) (%module_name%(_)code)
%define(fnc) (far)
%if(%i386_asm)
then(
%define(fnc_ptr) (pword)
%define(min_prmoff) (12)
)else(
%define(fnc_ptr) (dword)
%define(min_prmoff) (6)
)fi
%*define(extern_fnc(name))
(
extrn %name:far
)
%if(%i386_asm)
then(
%define(cgroup) (code32)
)else(
%define(cgroup) (%code)
)fi
)else(
%if(%i386_asm)
then(
%define(code) (code32)
)else(
%define(code) (code)
)fi
%if(%i86_asm)
then (
%define(cgroup) (cgroup)
)fi
%if(%i286_asm)
then(
%define(cgroup) (code)
)fi
%if(%i386_asm)
then(
%define(cgroup) (code32)
)fi
%define(fnc) (near)
%if(%i386_asm)
then(
%define(fnc_ptr) (dword)
%define(min_prmoff) (8)
)else(
%define(fnc_ptr) (word)
%define(min_prmoff) (4)
)fi
%*define(extern_fnc(name))
(
%code segment
extrn %name:near
%code ends
)
)fi
%define(tos) (%module_name%(_)tos)
%' large vs. small/medium/compact
%' %data is the name of the segment to contain any static variable data
%' %data_used is set if the data segment is referenced
%if(%set_ds)
then(
%*define(data) (%set(data_used, 1) %module_name%(_)data)
%define(dgroup) (%data)
%*define(extern(type, name))
(
extrn %name:%type
)
)else(
%*define(data) (%set(data_used, 1) data)
%if(%i286_asm or %i386_asm)
then(
%define(dgroup) (data)
)else(
%define(dgroup) (dgroup)
)fi
%*define(extern(type, name))
(
%data segment
extrn %name:%type
%data ends
)
)fi
%' ram vs. rom
%' %far_data is true iff data pointers have selectors
%' %const is the name of the segment to contain the constant data
%if(%const_in_code)
then(
%set(far_data, 1)
%define(const) (%code)
%if(%far_code)
then(
%*define(extern_const(type, name))
(
extrn %name:%type
)
)else(
%*define(extern_const(type, name))
(
%code segment
extrn %name:%type
%code ends
)
)fi
)else(
%set(far_data, %far_stack)
%if(%i286_asm or %i386_asm or %set_ds)
then(
%define(const) (%data)
)else(
%define(const) (const)
)fi
%if(%set_ds)
then(
%*define(extern_const(type, name))
(
extrn %name:%type
)
)else(
%*define(extern_const(type, name))
(
%const segment
extrn %name:%type
%const ends
)
)fi
)fi
%' small/medium vs. compact/large
%' %stack is the name of the stack segment
%if(not %far_stack)
then(
%if(%i286_asm or %i386_asm)
then(
%define(stack) (data)
%define(sgroup) (data)
)else(
%define(stack) (stack)
%define(sgroup) (dgroup)
)fi
)else(
%define(stack) (stack)
%define(sgroup) (stack)
)fi
%' compact/large/rom vs. small/medium ram
%' %ptr is the type of a data pointer
%' %data_ptr is the size of a data pointer
%if(%far_data)
then(
%*define(mov|lsr) (%lsr)
%*define(if_sel(stuff)) (%stuff)
%*define(if_nsel(stuff)) ()
%if(%i386_asm)
then(
%define(ptr) (pword)
%define(data_ptr) (8)
)else(
%define(ptr) (dword)
%define(data_ptr) (4)
)fi
)else(
%*define(mov|lsr) (mov)
%*define(if_sel(stuff)) ()
%*define(if_nsel(stuff)) (%stuff)
%if(%i386_asm)
then(
%define(ptr) (dword)
%define(data_ptr) (4)
)else(
%define(ptr) (word)
%define(data_ptr) (2)
)fi
)fi
%' calling convention implications
%if(%fpl)
then(
%*define(ret) (ret %prmlen)
%if(%i386_asm)
then(
%define(retsel) (edx)
%define(retoff) (eax)
)else(
%define(retsel) (es)
%define(retoff) (bx)
)fi
%*define(param(type, name))
(
%if (%%type eq %byte) then ( %'make sure it is word aligned
%set(prmlen, %prmlen + %word)
) else (
%set(prmlen, %prmlen + %%type)
) fi
%define(%name)(%type ptr [%bp + %(%prmoff + %prmlen) - %prmlen])
)
%*define(param_flt(type, name)) () %'in FPL, the double parameters
%'are on the NDP stack
)else(
%*define(ret) (ret)
%if(%i386_asm)
then(
%define(retsel) (edx)
%define(retoff) (eax)
)else(
%define(retsel) (dx)
%define(retoff) (ax)
)fi
%*define(param(type, name))
(
%define(%name) (%type ptr [%bp + %(%prmoff) + %prmlen])
%if (%%type eq %byte) then ( %'make sure it is word aligned
%set(prmlen, %prmlen + %word)
) else (
%set(prmlen, %prmlen + %%type)
) fi
)
%*define(param_flt(type, name)) %'in VPL, the double parameters
( %'are on the CPU stack
%define(%name) (%type ptr [%bp + %(%prmoff) + %prmlen])
%set(prmlen, %prmlen + %%type)
)
)fi
%' function bracketing
%*define(function(name))
(
%set(prmoff, %min_prmoff)
%set(prmlen, 0)
%set(autolen, 0)
%code segment
%name proc %fnc
public %name
)
%*define(endf(name))
(
%name endp
%code ends
)
%' function parameters and locals
%*define(auto(type, name))
(
%set(autolen, %autolen + %%type)
%define(%name) (%type ptr [%bp - %autolen])
)
%' function prolog and epilog
%*define(prolog(registers))
(
%set(push_bx, 0)
%set(push_si, 0)
%set(push_di, 0)
%set(push_es, 0)
%set(push_ds, %set_ds and %data_used)
%match(register regs)(%registers)
%while(%len(%register) ne 0)
(
%set(push_%register, 1)
%match(register regs)(%regs)
)
%set(push_bx, %push_bx and not %fpl)
%set(push_si, %push_si and not %fpl)
%set(push_di, %push_di and not %fpl)
%if(%push_bx)
then(
%set(prmoff, %prmoff + %int_size)
push %bx
)fi
%if(%push_si)
then(
%set(prmoff, %prmoff + %int_size)
push %si
)fi
%if(%push_di)
then(
%set(prmoff, %prmoff + %int_size)
push %di
)fi
%if(%push_es and %i386_asm and %set_sregs)
then(
%set(prmoff, %prmoff + %int_size)
push es
)fi
%if(%push_ds and %set_sregs)
then(
%set(prmoff, %prmoff + %int_size)
push ds
%if(%set_ds and %data_used)
then(
mov cx, %data
mov ds, cx
)fi
)fi
%enter %autolen, 0
)
%*define(epilog)
(
%leave
%if(%push_ds and %set_sregs)
then(
pop ds
)fi
%if(%push_es and %i386_asm and %set_sregs)
then(
pop es
)fi
%if(%push_di)
then(
pop %di
)fi
%if(%push_si)
then(
pop %si
)fi
%if(%push_bx)
then(
pop %bx
)fi
)
%' segment definitions
name %module_name
%if(%i286_asm or %i386_asm)
then(
%code segment er public
%code ends
%data segment rw public
%data ends
%stack stackseg %stack_size
assume ds:%data
assume es:nothing
assume ss:%stack
)else(
%code segment para public 'code'
%code ends
%data segment para public 'data'
%data ends
memory segment para memory 'memory'
memory ends
%stack segment para stack 'stack'
%if(%stack_size ne 0)
then(
db %stack_size dup (?)
)fi
%tos label word
%stack ends
%if(not %const_in_code and not %set_ds)
then(
%const segment para public 'const'
%const ends
)fi
%if(not %far_code)
then(
%cgroup group %code
)fi
%if(not %set_ds)
then(
%dgroup group %data %'
%if(not %const_in_code) then(, %const)fi %'
%if(not %far_stack) then(, %stack, memory)fi
)fi
assume cs:%cgroup
assume ds:%dgroup
assume es:nothing
assume ss:%if(not %far_stack) then(%dgroup) else(%stack) fi
)fi
%set(data_used, 0)

View File

@ -0,0 +1,43 @@
/* _alloc.h - alloc and free header definitions
* $Version: 1.20 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef __alloch
#define __alloch
/*lint -library */
#ifndef _limitsh
#include <limits.h>
#endif
#pragma fixedparams("_malloc_find", "_merge_free_blocks")
#pragma fixedparams("_merge_free_lists", "_malloc_take", "_free")
#ifndef _free_list_item_t
#define _free_list_item_t
#pragma align (free_list_item)
struct free_list_item {
struct free_list_item *next;
unsigned length;
};
#endif
#ifndef NULL
#define NULL ((void *)0)
#endif
#define _FREE_LIST_SIZE 20
#define FH_SIZE sizeof(struct free_list_item)
#define INTSIZE sizeof(int)
#define MIN_ALLOC sizeof(int)
#define MAX_ALLOC (UINT_MAX - FH_SIZE)
void _merge_free_lists(void);
int _merge_free_blocks(struct free_list_item *);
void _malloc_take(struct free_list_item *, unsigned);
struct free_list_item *_malloc_find(unsigned);
void _free(struct free_list_item *);
#endif /* __alloch */

View File

@ -0,0 +1,40 @@
/* _clib.h - internal library header file
* $Version: 1.3 $
* Copyright (c) 91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef _clibh
#define _clibh
#ifndef _stdioh
#include <stdio.h>
#endif
#pragma fixedparams("_doprnt", "_doscan", "_dtobcd", "_dtos", "_filbuf")
#pragma fixedparams("_fflush", "_flsbuf", "_fltprnt", "_fltscan", "_fopen")
#pragma fixedparams("_getch", "_modeparse", "_pow_10", "_putch")
#define STREAM_IO 0 /* Used by _doscan */
#define CONSOLE_IO 1
/*
* Function prototypes:
*/
int _doprnt(const char *, char* *, FILE *, int (*)());
int _doscan(const char *, char* *, FILE *, int (*)(), int (*)(), int);
int _dtobcd(double, char *);
int _dtos(double, char *);
size_t _filbuf(char *, size_t, FILE *);
int _fflush(FILE *);
size_t _flsbuf(char *, size_t, FILE *);
int _fltprnt(int, va_list, char, int, unsigned, int,
unsigned, unsigned, FILE *, int (*fp)());
int _fltscan(FILE *, unsigned, unsigned, va_list *, unsigned,
int (*getfp)(), int (*putfp)(), int);
FILE *_fopen(int, unsigned);
int _getch(FILE *);
unsigned _modeparse(const char *);
double _pow_10(int);
int _putch(int, FILE *);
#endif /* _clibh */

View File

@ -0,0 +1,65 @@
/* _dos.h - This file defines data structures for DOS access.
* $Version: 1.2 $
* Copyright (c) 1990,91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef __dosh
#define __dosh
/*lint -library */
#pragma fixedparams("_dosf25", "_dosf35", "_dosf3f", "_dosf40", "_dosf48")
#pragma fixedparams("_dosf49", "_dosf4a", "_dosf4e", "abstoptr", "ptrtoabs")
#ifndef _FAR
#define _FAR far
#define _HUGE huge
#define _NEAR near
#endif
#ifndef OK
#define OK 0
#define ERROR -1
#endif
#ifndef _mode_t
#define _mode_t
typedef unsigned long mode_t;
#endif
extern int _chbuf;
extern mode_t _umask;
#ifndef _find_t
/*
* structure used by _dos_findfirst
*/
#pragma noalign (find_t)
struct find_t {
char reserved[21]; /* reserved for dos */
char attrib; /* returned attribute */
unsigned short wr_time; /* time file last written */
unsigned short wr_date; /* date file last written */
long size; /* size of file */
char name[13]; /* string containing the filename */
};
#define _find_t
#endif
/*
* Function prototypes:
*/
int _dosf25(int, void _FAR *);
void _FAR *_dosf35(int);
int _dosf3f(int, char *, unsigned int);
int _dosf40(int, char *, unsigned int);
void *_dosf48(unsigned int);
int _dosf49(void _FAR *);
int _dosf4a(unsigned int, unsigned int);
int _dosf4e(const char *, struct find_t *, unsigned int);
void _FAR *abstoptr(unsigned long);
unsigned long ptrtoabs(void _FAR *);
#define abstoptr(a) \
(void _FAR *)((((unsigned long)a>>4)<<16)|(unsigned long)(a&0xF))
#endif /* __dosh */

View File

@ -0,0 +1,83 @@
/* _math.h - internal math and trig definitions
* $Version: 1.24 $
* Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
*/
#ifndef __mathh
#define __mathh
#define mqerACS MQERACS
#define mqerASN MQERASN
#define mqerATN MQERATN
#define mqerAT2 MQERAT2
#define mqerCOS MQERCOS
#define mqerSIN MQERSIN
#define mqerTAN MQERTAN
#define mqerEXP MQEREXP
#define mqerLGE MQERLGE
#define mqerLGD MQERLGD
#define mqerY2X MQERY2X
#pragma fixedparams("MQERACS", "MQERASN", "MQERATN", "MQERAT2", "MQERCOS")
#pragma fixedparams("MQERSIN", "MQERTAN", "MQEREXP", "MQERLGE", "MQERLGD")
#pragma fixedparams("MQERY2X")
#pragma fixedparams("_ceil", "_clear87", "_err_map", "_floor", "_j0")
#pragma fixedparams("_j1", "_jn", "_modf", "_sqrt", "_square")
#pragma fixedparams("_status87", "_y0", "_y1", "_yn")
#define NPX_EXCEPTION 0X007F
#define NPX_OVERFLOW 0X0008
#define NPX_UNDERFLOW 0X0010
#define NPX_PRECISION 0X0020
#if _ARCHITECTURE_ == 386 || _ARCHITECTURE_ == 486
extern near double mqerACS(double);
extern near double mqerASN(double);
extern near double mqerATN(double);
extern near double mqerAT2(double, double);
extern near double mqerCOS(double);
extern near double mqerSIN(double);
extern near double mqerTAN(double);
extern near double mqerEXP(double);
extern near double mqerLGE(double);
extern near double mqerLGD(double);
extern near double mqerY2X(double, double);
#else /* _ARCHITECTURE_ */
extern far double mqerACS(double);
extern far double mqerASN(double);
extern far double mqerATN(double);
extern far double mqerAT2(double, double);
extern far double mqerCOS(double);
extern far double mqerSIN(double);
extern far double mqerTAN(double);
extern far double mqerEXP(double);
extern far double mqerLGE(double);
extern far double mqerLGD(double);
extern far double mqerY2X(double, double);
#endif /* _ARCHITECTURE_ */
/*
* function prototypes
*/
double _ceil(double);
unsigned _clear87(void);
int _err_map(int);
double _floor(double);
double _j0(double);
double _j1(double);
double _jn(int, double);
double _modf(double, double *);
double _sqrt(double);
double _square(double);
unsigned _status87(void);
double _y0(double);
double _y1(double);
double _yn(int, double);
#endif /* __mathh */

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.

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.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
@echo off
rem the compiler and libs\* c runtime is from https://winworldpc.com/product/intel-ic-86-compiler/45
rem the linker and u\* objects are from https://winworldpc.com/product/intel-iapx-86-88-family-utilities/42
rem use u not util for the directory name to keep the link86 command tail < 127 characters
setlocal
ntvdm -r:. -e::include:=inc ic86 %1.c small optimize(3) mod86 diagnostic( 2 ) define (INTELC)
if %ERRORLEVEL% == 0 ( goto nowlink )
echo compile failed
goto eof
:nowlink
rem 8087 required
rem ntvdm -r:. link86 libs\cstdoss.obj,c:\%1.obj,c:\libs\cdoss.lib,u\cel87.lib,u\8087.lib,libs\clib87.lib TO %1.exe exe
rem 8087 emulator
ntvdm -r:. link86 libs\cstdoss.obj,%1.obj,c:\libs\cdoss.lib,u\cel87.lib,u\e8087.lib,u\de8087,libs\clib87.lib TO %1.exe exe
if %ERRORLEVEL% == 0 ( goto eof )
echo link failed
:eof

View File

@ -0,0 +1,293 @@
;/*
; * INTEL CORPORATION PROPRIETARY INFORMATION
; *
; * This software is supplied under the terms of a
; * license agreement or non-disclosure agreement with
; * Intel Corporation and may not be copied or disclosed
; * except in accordance with the terms of that agreement.
; *
; * Title: cstart
; */
; This is the starting point for all c programs.
; $Version: 1.46 $
; Copyright (C) 1988 Intel Corporation, ALL RIGHTS RESERVED
%define(controls)(module=cq_cstart fixedparams %controls)
%' environment symbols
%set(MS_DOS,0)
%set(RMX,0)
%set(NUK,0)
%set(ARGS,1)
%*define(embedded) (%set(HOSTED,0))
%*define(nucleus) (%set(HOSTED,0)%set(RMX,1)%set(NUK,1)%set(ARGS,0))
%*define(rmx1) (%set(HOSTED,1)%set(RMX,1))
%*define(rmx2) (%set(HOSTED,1)%set(RMX,1))
%*define(rmx3) (%set(HOSTED,1)%set(RMX,1))
%*define(rmx4) (%set(HOSTED,1)%set(RMX,1))
%*define(db386) (%set(HOSTED,1)%set(ARGS,1))
%*define(dos) (%set(HOSTED,1)%set(MS_DOS,1))
%*define(em) (%embedded)
%*define(nuc) (%nucleus)
%' define the default environment
%dos
$include(:include:util.ah)
%set(medium_rom, %far_code and %const_in_code)
%DATA segment
dw ?
%DATA ends
%CONST segment
dw ?
%CONST ends
%if(%i86_asm)
then(
%STACK segment
stacktop dw ?
%STACK ends
)fi
;
; External data and program linkage:
;
%if(%HOSTED)
then(
%' If the C-Libraries execute in an environment with operating system
%' support, then the following externals must be declared:
%' Define the external linkage for the parameters to main():
%'
%if(%ARGS)
then(
%if(%medium_rom)
then(
extrn _argc:word
extrn _argv:%ptr
)else(
%extern(%int, _argc)
%extern(%ptr, _argv)
)fi
)fi
%' Define the external linkage for the C-Library functions that
%' require operating system support:
%'
%extern_fnc(_exit_init)
%extern_fnc(exit)
%extern_fnc(_exit)
%extern_fnc(_stdio_init)
%if(%ARGS)
then(
%extern_fnc(_get_args)
)fi
)fi
%' The RMX operating system environment requires additional initialization:
%'
%if(%RMX)
then(
%extern_fnc(_global_init)
)fi
%' Define the external linkage for initializing the E80187 emulator (86 only):
%'
%if(%i86_asm)
then(
extrn xq_inite187:far
)fi
%' Define the external linkage for initializing the coprocessor:
%'
%if(%i386_asm)
then(
extrn init87:near
)else(
extrn init87:far
)fi
%' All environments must execute the following routines:
%'
%extern_fnc(_thread_init)
%extern_fnc(main)
%' Define the size of the memory blocks requested
%' through the sbrk() interface:
%'
%data segment
public _amblksiz
_amblksiz %dint ?
%if(%RMX)
then(
public _num_eios_bufs
public _rmx_nucleus
_num_eios_bufs %dint ?
_rmx_nucleus %dint ?
)fi
%data ends
%code segment
begin:
;
; Initialize the C-Library and, if necessary, the target
; environment:
;
cld ;
%if(%i86_asm)
then(
call xq_inite187 ; initialize E80187 emulator
)fi
call init87 ; initialize the coprocessor
mov _amblksiz,8192
%if(%RMX)
then(
mov _num_eios_bufs,2
%if(%NUK)
then( mov _rmx_nucleus,1
)else(mov _rmx_nucleus,0
)fi
)fi
%' For embedded environments, the following call to _thread_init() is
%' the only initialization required by the C-Library. Other ebmedded
%' environment specific initializations should be put after this call.
%'
%if(not %HOSTED)
then(
%if(%NUK)
then(
call _global_init ; initialize RMX specific global data
or %ax, %ax
jz L1
hlt
L1:
)fi
call _thread_init ; initialize CLIB thread data
or %ax, %ax
jz L2
hlt
L2:
)else(
%if(%RMX)
then(
call _global_init ; initialize RMX specific global data
or %ax, %ax
jz L1
push %ax
call _exit
L1:
)fi
call _thread_init ; initialize CLIB thread data
or %ax, %ax
jz L2
push %ax
call _exit
L2:
call _exit_init ; initialize CLIB exit handlers
or %ax, %ax
jz L3
push %ax
call _exit
L3:
call _stdio_init ; initialize CLIB standard streams
or %ax, %ax
jz L4
push %ax
call _exit
L4:
%if(%ARGS)
then(
call _get_args ; setup parameters to main()
or %ax, %ax
jz L5
push %ax
call _exit
L5:
)fi
%if(%ARGS)
then(
%if(%far_data)
then(
%' define code for passing paramerers to main() for compact and large models
%'
%*define(push_argc)
(
%if(%set_ds or %medium_rom)
then( mov cx, seg _argc
)else( mov cx, ds
)fi
mov es, cx
push %reg_size es:_argc ; push number of arguments to main()
)
%*define(push_argv)
(
%if(%set_ds or %medium_rom)
then( mov cx, seg _argv
)else( mov cx, ds
)fi
mov es, cx
%movsx %ax, word ptr es:_argv+%int_size
push %ax ; push segment selector and
push %reg_size es:_argv ; offset of array containing argument
)
)else(
%' define code for passing paramerers to main() for small and medium model
%'
%*define(push_argc)
(
push %reg_size _argc ; push number of arguments to main()
)
%*define(push_argv)
(
push %reg_size _argv ; push address of array containing argument addresses
)
)fi
)fi
)fi
;
; Invoke the user's program:
;
%if(not %HOSTED)
then(
call main ; no parameters passed to main()
hlt ; ERROR: no return expected in a
; non-hosted environment
)else(
%' set up command line arguments for main()
%'
%if(%ARGS)
then(
%if(%fpl)
then(
%push_argc
%push_argv
)else(
%push_argv
%push_argc
)fi
)fi
call main ; call the user's programs
push %ax ; set the termination value
call exit ; and quietly exit
)fi
%code ends
end begin, ds:%dgroup, %'
ss:%sgroup %if(%i86_asm)then( :stacktop )fi

View File

@ -0,0 +1,272 @@
/* _thread_create() - allocate memory for struct _thread
* _exit_create() - allocate memory for struct _exit
* _stdio_create() - allocate memory for struct _stdio
* _exit_ptr() - get pointer to struct _exit
* _stdio_ptr() - get pointer to struct _stdio
* _thread_ptr() - get pointer to struct _thread
* $Version: 1.25 $
* Copyright (c) 1988 Intel Corporation, ALL RIGHTS RESERVED.
*/
#include <reent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <_dos.h>
#include <dos.h>
#include <fileio3.h>
#pragma fixedparams(_get_misc_parms, _dq_getsize)
extern void _get_misc_parms();
extern int _main0();
extern int _main2();
extern void _main4();
extern void _mainlast();
extern unsigned _dq_getsize();
extern unsigned _amblksiz;
extern char _FAR *_argument_ptr;
extern char _FAR *_environ_ptr;
/*
* Allocate memory for CLIB's global data and thread context:
*/
unsigned _heapmod;
unsigned _proglen;
unsigned _dataseg;
unsigned _psp;
unsigned _FAR *_pspseg;
char **environ;
struct _io_block *_iocb = NULL;/* File handle information structure */
int _fileinfo; /* */
int _fmode; /* used by _stdio_create() to set _osfile[] */
int _chbuf = EOF; /* 1-character buffer for ungetched character */
mode_t _umask = 0; /* */
void _FAR *_init_ctlc = (void _FAR *)0;
void _FAR *_curr_ctlc = (void _FAR *)0;
char cvt_buffer[350]; /* buffer used by ecvt() and fcvt() */
static struct tm _gmtime_str;
static struct _heap _heap_str;
static struct _locale _locale_str;
static struct _tzset _tzset_str;
struct _exit _exit_str;
struct _stdio _stdio_str;
struct _thread _thread_str;
struct _thread *_thread_create(size_t size)
{
struct regval regs;
struct
{
unsigned udi2dos;
unsigned psp;
void *memory;
} misc;
unsigned status;
long data_bytes;
void _NEAR *near_heap;
unsigned near_heap_bytes;
void _FAR *far_heap;
unsigned far_heap_paras;
/*
* Initialize all CLIB externally accessed data items:
*/
_get_misc_parms(&misc);
_psp = misc.psp;
_pspseg = (void _FAR *)((unsigned long)_psp << 16);
/*
* Initialize the target independent CLIB global data:
*/
_thread_str._heap_header = &_heap_str;
_thread_str._locale_data = &_locale_str;
_thread_str._gmtime_buffer = &_gmtime_str;
_init_clib_data(&_thread_str);
/*
* Set-up the environment for the initial heap:
*/
#if !_FAR_DATA_ /* small and medium model */
_dataseg = (unsigned long)(void _FAR *)&_dataseg >> 16;
near_heap = misc.memory;
if (misc.udi2dos)
{
data_bytes = _dq_getsize(_dataseg, &status);
far_heap = (_FAR *)_dosf48(1);
_proglen = 1;
_heapmod = FP_SEG(far_heap);
}
else
{
data_bytes = 0x10000;
far_heap = (void _FAR *)((_dataseg + 0x1000L) << 16);
_heapmod = _psp;
}
near_heap_bytes = data_bytes - (unsigned)near_heap;
far_heap_paras = 1;
#else /* compact and large model */
near_heap = 0;
near_heap_bytes = 0;
far_heap = misc.memory;
if (misc.udi2dos)
{
_heapmod = FP_SEG(far_heap);
_proglen = far_heap_paras = _dq_getsize(_heapmod, &status) >> 4;
}
else
{
_heapmod = _psp;
far_heap_paras = _amblksiz >> 4;
}
#endif
if (!misc.udi2dos)
{
regs.ax = 0x4a00;
regs.es = _psp;
regs.bx = _proglen = FP_SEG(far_heap) + far_heap_paras - _psp;
if (sysint21(&regs, &regs) & 1)
{
static char const _FAR msg[] = "Insufficient memory\r\n$";
regs.ax = 0x0900;
regs.dx = FP_OFF(msg);
regs.ds = FP_SEG(msg);
sysint21(&regs, &regs);
regs.ax = 0x4c01;
}
_pspseg[1] = _psp + _proglen;
}
/*
* set up the initial heap:
*/
_main0(near_heap, near_heap_bytes, far_heap, far_heap_paras);
/*
* Initialize the target dependent timezone data:
*/
_thread_str._tzset_data = &_tzset_str;
if (!(_tzset_str._tzname[0] = (char *)malloc(4)))
return (struct _thread *)NULL;
if (!(_tzset_str._tzname[1] = (char *)malloc(4)))
return (struct _thread *)NULL;
strcpy(_tzset_str._tzname[0], "PST");
strcpy(_tzset_str._tzname[1], "PDT");
_tzset_str._timezone = 8 * 60 * 60;
_tzset_str._daylight = 1;
/*
* process environment variable:
*/
if (_main2())
return (struct _thread *)NULL;
/*
* process interrupts
*/
_main4();
/*
* initialize _fmode: (O_TEXT by default, O_BINARY if binmode.obj
* is linked before the C Runtime Library); initialize _fileinfo:
* (0 by default (don't pass open file info to child), 1 if
* fileinfo.obj is linked before the C Runtime Library)
*/
_fmode_init();
_finfo_init();
return (&_thread_str);
}
struct _exit *_exit_create(size_t size)
{
return (&_exit_str);
}
struct _stdio *_stdio_create(size_t size)
{
struct _io_block *iocb;
/*
* Allocate memory for the iocb structures and initialize the iocb
* elements for the pre-connected devices:
*/
if ( _init_handle_count(_nfile) == -1 ) /* Initialize handle structure */
return (struct _stdio *) NULL;
iocb = _IOCB(0); /* stdin */
iocb->osfile = _IOASCII | _IOREAD;
iocb->foffset = 0;
iocb->fseekp = 0;
iocb->fbytes = 0;
iocb = _IOCB(1); /* stdout */
iocb->osfile = _IOASCII | _IOWRT;
iocb->foffset = 0;
iocb->fseekp = 0;
iocb->fbytes = 0;
iocb = _IOCB(2); /* stderr */
iocb->osfile = _IOASCII | _IOWRT |_IONBF;
iocb->foffset = 0;
iocb->fseekp = 0;
iocb->fbytes = 0;
iocb = _IOCB(3);
iocb->osfile = 0;
iocb = _IOCB(4);
iocb->osfile = 0;
_mainlast(); /* set up the program clock */
return (&_stdio_str);
}
struct _exit *(_exit_ptr)(void)
{
return (&_exit_str);
}
struct _stdio *(_stdio_ptr)(void)
{
return (&_stdio_str);
}
struct _thread *(_thread_ptr)(void)
{
return (&_thread_str);
}

View File

@ -0,0 +1,71 @@
/*
* This file contains four routines:
* _semaphore_init() - initialize semaphore
* _semaphore_delete() - delete a semaphore
* _semaphore_wait() - wait for the event to occur
* _semaphore_signal() - clear the event
*
* If the user application is being executed in a multi-threaded
* environment, the user is responsible for designing and implementing
* all four routines. CLIB-n86 uses these routines to protect its
* data structures from simultaneous update errors.
*
* For the single-threaded DOS environment, these routines perform NO
* operations: they are just stubs to resolve the references in the body
* of the C-Library code.
*
* $Version: 1.8 $
* Copyright (c) 1988 Intel Corporation, ALL RIGHTS RESERVED.
*/
#define DEBUG 0
#include <reent.h>
#if DEBUG
#include <conio.h>
#endif
static void **top = 0;
void (_semaphore_init)(void **sema)
{
#if DEBUG
*sema = sema;
#endif
}
void (_semaphore_delete)(void **sema)
{
#if DEBUG
*sema = sema;
#endif
}
void (_semaphore_wait)(void **sema)
{
#if DEBUG
if (*sema != sema)
{
cprintf("_semaphore_wait: ERROR: %p != %p\n", *sema, sema);
}
if (top != 0)
{
cprintf("_semaphore_wait: WARNING: %p != NULL\n", top);
}
*sema = top;
top = sema;
#endif
}
void (_semaphore_signal)(void **sema)
{
#if DEBUG
if (sema != top)
{
cprintf("_semaphore_signal: ERROR: %p != %p\n", sema, top);
}
top = *sema;
*sema = sema;
#endif
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More