📄 xms.h
字号:
#ifndef _DEF_XMS_H
#define _DEF_XMS_H
#include <stdio.h>
struct EMB
{
long Leng; //长度
unsigned SourceHandle; //源句柄
long SourceOfs; //偏移量
unsigned DestinHandle; //目标句柄
long DestinOfs; //目标偏移量
};
class XMS
{
public:
static int OK;
int handle;
XMS(int size); //分配扩展内存块
~XMS(); //释放扩展内存块
static int Init(void);
static unsigned FreeSize(void); //查询自由扩展内存块
static unsigned LargestBlock(void);//返回最大自由扩展内存块的大小
int Move(struct EMB *emb); //移动扩展内存块
int ReAlloc(int size); //重新分配扩展内存块
int Put(long dp,void *sp,long leng);
int Get(void *dp,long sp,long leng);
int Transfer(long dp,long sp,long len);
};
enum WHERE
{
inNONE = 0,
inMEM = 1,
inXMS = 2,
inHD = 3
};
union HANDLE
{
void *mem;
class XMS *xms;
FILE *file;
};
class MEMORY
{
public:
int OK;
int where;
long leng;
union HANDLE handle;
MEMORY(){};
MEMORY(void *buf,long length){ PutBuf(buf,length); };
~MEMORY();
void PutBuf(void *data,long length);
//将基本内存中数据弹入扩充内存,data是数据的指针,length为长度。
int GetBuf(void *buf,long offset,int ll);
// 读取扩充内存中数据,buf是要存放数据的缓冲区指针,offset为偏移量
// ll为要读的长度,返回值是指实际读取的长度,如果正确则返回ll值。
};
class FILETOXMS : public MEMORY
{
public: // 将文件调入扩充内存中
FILETOXMS(char *filename);
};
/*class IMAGE
{
public:
int where;
union HANDLE handle;
int x1,y1,x2,y2,xn,yn;
int ssize;
long Isize;
public:
IMAGE(){};
IMAGE(int xx1,int yy1,int xx2,int yy2,int whe)
{ GetImage(xx1,yy1,xx2,yy2,whe); }
~IMAGE(){};
void GetImage(int xx1,int yy1,int xx2,int yy2,int whe);
//保存图象,whe是指保存在基本内存(inMEM),扩充内存(inXMS),硬盘(inHD)中。
void PutImage(int xx1,int yy1);
//将保存的图象复原在左上角为(xx1,yy1)的位置。
protected:
void GetImageMEM();
void PutImageMEM(int xx1,int yy1);
void GetImageXMS();
void PutImageXMS(int xx1,int yy1);
void GetImageHD();
void PutImageHD(int xx1,int yy1);
public:
void GetScanLine(int x1,int y,int n,char far *buf);
// 读扫描线至缓冲区,n是宽度。
void PutScanLine(int x1,int y,int n,char far *buf);
// 从缓冲区读数据写扫描线
};
*/
class IMAGE
{
public:
int where;
union HANDLE handle;
int x1,y1,x2,y2,xn,yn;
int ssize;
long Isize;
public:
//IMAGE(){};
IMAGE(int xx1,int yy1,int xx2,int yy2,int whe);
//保存图象,whe是指保存在基本内存(inMEM),扩充内存(inXMS),硬盘(inHD)中。
~IMAGE();
void GetImage();
void PutImage(int xx1,int yy1);
//将保存的图象复原在左上角为(xx1,yy1)的位置。
protected:
void GetImageXMS();
void PutImageXMS(int xx1,int yy1);
void GetImageHD();
void PutImageHD(int xx1,int yy1);
void GetImageMEM();
void PutImageMEM(int xx1,int yy1);
// void GetImageXMS();
// void PutImageXMS(int xx1,int yy1);
// void GetImageHD();
// void PutImageHD(int xx1,int yy1);
public:
void GetScanLine(int x1,int y,int n,char far *buf);
// 读扫描线至缓冲区,n是宽度。
void PutScanLine(int x1,int y,int n,char far *buf);
// 从缓冲区读数据写扫描线
};
/*class MENUIMAGE : public IMAGE
{
public:
MENUIMAGE(int xx1,int yy1,int xx2,int yy2,int whe);
~MENUIMAGE();
void GetImage();
void PutImage(int xx1,int yy1);
};
*/
#endif _DEF_XMS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -