|
|
1.1 ! root 1: /* ! 2: * _DEFS286.H 5.20A June 8, 1995 ! 3: * ! 4: * The Greenleaf Comm Library ! 5: * ! 6: * Copyright (C) 1985-1995 Greenleaf Software Inc. All Rights Reserved. ! 7: * ! 8: * NOTES ! 9: * ! 10: * This header file contains prototypes and miscellaneous definitions ! 11: * for use with all 16 bit DOS Extenders. The functions and macros ! 12: * in this file are intended to provide a transparent and uniform ! 13: * set of functions that can be used with any 286 DOS Extender. ! 14: * ! 15: * Things we need to define in order to support a 285DOS Extender. ! 16: * These can be macros, typedefs, functions, or whatever. It ! 17: * all depends on what DOS Extender and compiler you are using. ! 18: * ! 19: * Functions defined in all caps might be defined as Macros. ! 20: * ! 21: * Defined by the compiler Defined by the DOS Extender ! 22: * ! 23: * GF_REALPTR16 GF_DPMI16 ! 24: * GF_SEG16 _GetDosSelector ! 25: * GF_OFF16 _GetRealAddress ! 26: * _GetDs _GetOldProtHandler ! 27: * _GetOldRealHandler ! 28: * _SetHandlers ! 29: * _AllocateDosMemory ! 30: * _FreeDosMemory ! 31: * _LockRegion ! 32: * Always defined: GF_X16 ! 33: * ! 34: * CONTENTS ! 35: * ! 36: * MODIFICATIONS ! 37: * ! 38: * December 1, 1994 5.10A : Initial release. ! 39: */ ! 40: ! 41: #if !defined( _DEFS286_H ) ! 42: #define _DEFS286_H ! 43: ! 44: #include "compiler.h" ! 45: #include <dos.h> ! 46: ! 47: /* ! 48: * Identify the DOS Extender. ! 49: */ ! 50: ! 51: #if defined( DOSX286 ) ! 52: # define GF_X16 ! 53: #elif defined( DOS16M ) ! 54: # define GF_DPMI16 ! 55: # define GF_X16 ! 56: #elif defined( GF_BORLAND_CPP ) && defined( __DPMI16__ ) ! 57: # define GF_DPMI16 ! 58: # define GF_X16 ! 59: #endif ! 60: ! 61: #ifdef GF_X16 ! 62: ! 63: /* ! 64: * Under 16 bit DOS extenders, we will have to manipulate 16:16 ! 65: * real pointers from time to time. This structure definition and ! 66: * associated macros make that a little easier to do. Note that you ! 67: * don't *ever* want to load a real mode pointer into a pointer variable, ! 68: * this will cause a fast GPF. These structures are nice and safe. ! 69: */ ! 70: ! 71: typedef struct _tag_realptr { ! 72: unsigned int offset; ! 73: unsigned int segment; ! 74: } GF_REALPTR16; ! 75: #define GF_SEG16( x ) (x).segment /* Tag: Extender private */ ! 76: #define GF_OFF16( x ) (x).offset /* Tag: Extender private */ ! 77: ! 78: /* ! 79: * The following functions are prototyped for every DOS Extender and ! 80: * compiler. The prototypes are identical regardeless of the tool, ! 81: * so you won't see any ifdefs here. ! 82: */ ! 83: ! 84: #ifdef __cplusplus ! 85: extern "C" { ! 86: #endif ! 87: ! 88: unsigned int GF_CONV _GetDosSelector( unsigned int segment ); ! 89: GF_REALPTR16 GF_CONV _GetRealAddress( void far *protected_address ); ! 90: void far *GF_CONV _GetOldProtHandler( int interrupt_number ); ! 91: GF_REALPTR16 GF_CONV _GetOldRealHandler( int interrupt_number ); ! 92: int GF_CONV _SetHandlers( int interrupt_number, void far *prot_handler, GF_REALPTR16 real_handler ); ! 93: void far *GF_CONV _AllocateDosMemory( int size ); ! 94: int GF_CONV _FreeDosMemory( void far *p ); ! 95: int GF_CONV _LockRegion( void far *base, int size ); ! 96: unsigned int GF_CONV _GetDs( void ); ! 97: ! 98: #ifdef __cplusplus ! 99: } ! 100: #endif ! 101: #endif /* #ifdef GF_X16 */ ! 102: #endif /* #if !defined( _DEFS286_H ) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.