Header头文件的原型C语言.doc_第1页
Header头文件的原型C语言.doc_第2页
Header头文件的原型C语言.doc_第3页
Header头文件的原型C语言.doc_第4页
Header头文件的原型C语言.doc_第5页
已阅读5页,还剩55页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

/*alloc.hmemory management functions and variables.*/#if _STDC_#define _Cdecl#else#define _Cdeclcdecl#endif#ifndef _STDDEF#define _STDDEF#ifndef _PTRDIFF_T#define _PTRDIFF_T#ifdefined(_LARGE_) | defined(_HUGE_) | defined(_COMPACT_)typedef longptrdiff_t;#elsetypedef intptrdiff_t;#endif#endif#ifndef _SIZE_T#define _SIZE_Ttypedef unsigned size_t;#endif#endif#ifndef NULL#if defined(_TINY_) | defined(_SMALL_) | defined(_MEDIUM_)#define NULL0#else#define NULL0L#endif#endifint_Cdecl brk(void *addr);void*_Cdecl calloc(size_t nitems, size_t size);#if defined(_COMPACT_) | defined(_LARGE_) | defined(_HUGE_)unsigned long _Cdecl coreleft(void);#elseunsigned _Cdecl coreleft(void);#endifvoid _Cdecl free(void *block);void*_Cdecl malloc(size_t size);void*_Cdecl realloc(void *block, size_t size);void*_Cdecl sbrk(int incr);#if !_STDC_void far * _Cdecl farcalloc(unsigned long nunits, unsigned long unitsz);unsigned long _Cdecl farcoreleft(void);void _Cdecl farfree(void far *block);void far *_Cdecl farmalloc(unsigned long nbytes);void far *_Cdecl farrealloc(void far *oldblock, unsigned long nbytes);#endif/*assert.hassert macro*/#include /* fprintf() prototype & stderr definition */#include /* abort() prototype */#if!defined(NDEBUG)#define assert(p)if(!(p)fprintf(stderr,Assertion failed: %s, file %s, line %dn,#p, _FILE_, _LINE_);abort();#else#define assert(p)#endif/*bios.hAccess to bios services.*/#if _STDC_#define _Cdecl#else#define _Cdeclcdecl#endifint_Cdecl bioscom(int cmd, char abyte, int port);int_Cdecl biosdisk(int cmd, int drive, int head, int track, int sector,int nsects, void *buffer);int_Cdecl biosequip(void);int_Cdecl bioskey(int cmd);int_Cdecl biosmemory(void);int_Cdecl biosprint(int cmd, int abyte, int port);long_Cdecl biostime(int cmd, long newtime);/*conio.hDirect MSDOS console input/output.*/#if!defined(_VIDEO)#define _VIDEO#if _STDC_#define _Cdecl#else#define _Cdeclcdecl#endif#ifndef_OLDCONIO_struct text_info unsigned char winleft;unsigned char wintop;unsigned char winright;unsigned char winbottom;unsigned char attribute;unsigned char normattr;unsigned char currmode;unsigned char screenheight;unsigned char screenwidth;unsigned char curx;unsigned char cury;enum text_modes LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7 ;#if!defined(_COLORS)#define _COLORSenum COLORS BLACK,/* dark colors */BLUE,GREEN,CYAN,RED,MAGENTA,BROWN,LIGHTGRAY,DARKGRAY,/* light colors */LIGHTBLUE,LIGHTGREEN,LIGHTCYAN,LIGHTRED,LIGHTMAGENTA,YELLOW,WHITE;#endif#define BLINK128/* blink bit */extern int _Cdecl directvideo;void _Cdecl clreol(void);void _Cdecl clrscr(void);void _Cdecl delline(void);int _Cdecl gettext(int left, int top, int right, int bottom, void *destin);void _Cdecl gettextinfo(struct text_info *r);void _Cdecl gotoxy(int x, int y);void _Cdecl highvideo(void);void _Cdecl insline(void);void _Cdecl lowvideo(void);int _Cdecl movetext(int left, int top, int right, int bottom, int destleft, int desttop);void _Cdecl normvideo(void);int _Cdecl puttext(int left, int top, int right, int bottom, void *source);void _Cdecl textattr(int newattr);void _Cdecl textbackground(int newcolor);void _Cdecl textcolor(int newcolor);void _Cdecl textmode(int newmode);int _Cdecl wherex(void);int _Cdecl wherey(void);void _Cdecl window(int left, int top, int right, int bottom);#endifchar*_Cdecl cgets(char *str);int _Cdecl cprintf(const char *format, .);int _Cdecl cputs(const char *str);int _Cdecl cscanf(const char *format, .);int _Cdecl getch(void);int _Cdecl getche(void);char*_Cdecl getpass(const char *prompt);int _Cdecl kbhit(void);int _Cdecl putch(int c);int _Cdecl ungetch(int ch);#endif/*ctype.hDefines the ctype macros.*/#if _STDC_#define _Cdecl#else#define _Cdeclcdecl#endif#define _IS_SP1/* is space */#define _IS_DIG2/* is digit indicator */#define _IS_UPP4/* is upper case */#define _IS_LOW8/* is lower case */#define _IS_HEX16/* A-F or a-f */#define _IS_CTL32/* Control */#define _IS_PUN64/* punctuation */externchar _Cdecl _ctype; /* Character type array */#define isalnum(c)(_ctype(c) + 1 & (_IS_DIG | _IS_UPP | _IS_LOW)#define isalpha(c)(_ctype(c) + 1 & (_IS_UPP | _IS_LOW)#define isascii(c)(unsigned)(c) = 0x21 & (c) = 0x20 & (c) 16)typedef struct chardrive;/* do not change*/charpattern 13;/* these fields,*/charreserved 7;/* Microsoft reserved */charattrib;shorttime;shortdate;longsize;charnameZ 13;/* result of the search, asciiz */dosSearchInfo;/* used with DOS functions 4E, 4F*/int _Cdecl absread(int drive, int nsects, int lsect, void *buffer);int _Cdecl abswrite(int drive, int nsects, int lsect, void *buffer);int _Cdecl allocmem(unsigned size, unsigned *segp);int _Cdecl bdos(int dosfun, unsigned dosdx, unsigned dosal);int _Cdecl bdosptr(int dosfun, void *argument, unsigned dosal);structcountry *_Cdecl country(int xcode, struct country *cp);void _Cdecl ctrlbrk(int _Cdecl (*handler)(void);void _Cdecl delay(unsigned milliseconds);void _Cdecl disable(void);int _Cdecl dosexterr(struct DOSERROR *eblkp);long _Cdecl dostounix(struct date *d, struct time *t);void _emit_();void _Cdecl enable(void);int _Cdecl freemem(unsigned segx);int _Cdecl getcbrk(void);void _Cdecl getdate(struct date *datep);void _Cdecl getdfree(unsigned char drive, struct dfree *dtable);void _Cdecl getfat(unsigned char drive, struct fatinfo *dtable);void _Cdecl getfatd(struct fatinfo *dtable);unsigned _Cdecl getpsp(void);int _Cdecl getswitchar(void);void _Cdecl gettime(struct time *timep);voidinterrupt (* _Cdecl getvect(int interruptno) ();int _Cdecl getverify(void);void _Cdecl harderr(int _Cdecl (*handler)();void _Cdecl hardresume(int axret);void _Cdecl hardretn(int retn);int _Cdecl inport(int portid);unsigned char_Cdecl inportb(int portid);int _Cdecl int86(int intno, union REGS *inregs, union REGS *outregs);int _Cdecl int86x(int intno, union REGS *inregs, union REGS *outregs, struct SREGS *segregs);int _Cdecl intdos(union REGS *inregs, union REGS *outregs);int _Cdecl intdosx(union REGS *inregs, union REGS *outregs, struct SREGS *segregs);void _Cdecl intr(int intno, struct REGPACK *preg);void _Cdecl keep(unsigned char status, unsigned size);void _Cdecl nosound(void);void _Cdecl outport(int portid, int value);void _Cdecl outportb(int portid, unsigned char value);char*_Cdecl parsfnm(const char *cmdline, struct fcb *fcb, int opt);int _Cdecl peek(unsigned segment, unsigned offset);char _Cdecl peekb(unsigned segment, unsigned offset);void _Cdecl poke(unsigned segment, unsigned offset, int value);void _Cdecl pokeb(unsigned segment, unsigned offset, char value);int _Cdecl randbrd(struct fcb *fcb, int rcnt);int _Cdecl randbwr(struct fcb *fcb, int rcnt);void _Cdecl segread(struct SREGS *segp);int _Cdecl setblock(unsigned segx, unsigned newsize);int _Cdecl setcbrk(int cbrkvalue);void _Cdecl setdate(struct date *datep);void _Cdecl setswitchar(char ch);void _Cdecl settime(struct time *timep);void _Cdecl setvect(int interruptno, void interrupt (*isr) ();void _Cdecl setverify(int value);void _Cdecl sleep(unsigned seconds);void _Cdecl sound(unsigned frequency);void _Cdecl unixtodos(long time, struct date *d, struct time *t);int _Cdeclunlink(const char *path);/* These are in-line functions. These prototypes just clean up some syntax checks and code generation. */void_Cdecl_cli_(void);void_Cdecl_sti_(void);unsigned char _Cdecl _inportb_(int portid);void_Cdecl_outportb_(int portid, unsigned char value);void_Cdecl_int_(int interruptnum);#define disable()_cli_()/* Clear interrupt flag */#define enable()_sti_()/* Set interrupt flag */#define inportb(portid) _inportb_(portid)/* Byte IN instruction */#define outportb(portid, v) _outportb_(portid,v)/* Byte OUT instruction */#define geninterrupt(i) _int_(i)/* Interrupt instruction */* some other compilers use inp, outp for inportb, outportb */#define inp(portid)inportb(portid)#define outp(portid,v)outportb(portid,v)#if !_STDC_char far *cdecl getdta(void);void cdecl setdta(char far *dta);#define MK_FP(seg,ofs)(void far *) (unsigned long)(seg) 16) | (unsigned)(ofs)#define poke(a,b,c)(*(int far*)MK_FP(a),(b) = (int)(c)#define pokeb(a,b,c)(*(char far*)MK_FP(a),(b) = (char)(c)#define peek(a,b)(*(int far*)MK_FP(a),(b)#define peekb(a,b)(*(char far*)MK_FP(a),(b)#endif#endif/*errno.hDefines the system error variable errno and the errornumbers set by system calls. Errors which exist in Unix(tm)but not MSDOS have value -1.*/#if _STDC_#define _Cdecl#else#define _Cdeclcdecl#endif/* Dos Error Codes */#define EZERO 0/* Error 0*/#define EINVFNC 1/* Invalid function number*/#define ENOFILE 2/* File not found*/#define ENOPATH 3/* Path not found*/#define ECONTR 7/* Memory blocks destroyed*/#define EINVMEM 9/* Invalid memory block address */#define EINVENV 10/* Invalid environment*/#define EINVFMT 11/* Invalid format*/#define EINVACC 12/* Invalid access code*/#define EINVDAT 13/* Invalid data*/#define EINVDRV 15/* Invalid drive specified*/#define ECURDIR 16/* Attempt to remove CurDir*/#define ENOTSAM 17/* Not same device*/#define ENMFILE 18/* No more files*/#define ENOENT 2/* No such file or directory*/#define EMFILE 4/* Too many open files*/#define EACCES 5/* Permission denied*/#define EBADF 6/* Bad file number*/#define ENOMEM 8/* Not enough core*/#define ENODEV15/* No such device*/#define EINVAL19/* Invalid argument*/#define E2BIG20/* Arg list too long*/#define ENOEXEC 21/* Exec format error*/#define EXDEV22/* Cross-device link*/#define EDOM33/* Math argument*/#define ERANGE34/* Result too large*/#define EEXIST35/* File already exists*/#define EFAULT-1/* Unknown error*/#define EPERM-1/* UNIX - not MSDOS*/#define ESRCH-1/* UNIX - not MSDOS*/#define EINTR-1/* UNIX - not MSDOS*/#define EIO-1/* UNIX - not MSDOS*/#define ENXIO-1/* UNIX - not MSDOS*/#define ECHILD-1/* UNIX - not MSDOS*/#define EAGAIN-1/* UNIX - not MSDOS*/#define ENOTBLK -1/* UNIX - not MSDOS*/#define EBUSY-1/* UNIX - not MSDOS*/#define ENOTDIR -1/* UNIX - not MSDOS*/#define EISDIR-1/* UNIX - not MSDOS*/#define ENFILE-1/* UNIX - not MSDOS*/#define ENOTTY-1/* UNIX - not MSDOS*/#define ETXTBSY -1/* UNIX - not MSDOS*/#define EFBIG-1/* UNIX - not MSDOS*/#define ENOSPC-1/* UNIX - not MSDOS*/#define ESPIPE-1/* UNIX - not MSDOS*/#define EROFS-1/* UNIX - not MSDOS*/#define EMLINK-1/* UNIX - not MSDOS*/#define EPIPE-1/* UNIX - not MSDOS*/#define EUCLEAN -1/* UNIX - not MSDOS*/#define _sys_nerr 35/* highest defined system error number */externint_Cdecl errno;externint_Cdecl_doserrno;/*fcntl.hDefine flag values accessible to open.*/#if _STDC_#define _Cdecl#else#define _Cdeclcdecl#endifextern int _Cdecl _fmode;/* The first three can only be set by open */#define O_RDONLY 1#define O_WRONLY 2#define O_RDWR 4/* Flag values for open only */#define O_CREAT0x0100/* create and open file */#define O_TRUNC0x0200/* open with truncation */#define O_EXCL0x0400/* exclusive open */* The open flags defined above are not needed after open, hence they are re-used for other purposes when the file is running. Sorry, its getting crowded !*/#define _O_RUNFLAGS0x0700#define _O_EOF0x0200 /* set when text file hits Z */* a file in append mode may be written to only at its end.*/#define O_APPEND0x0800/* to end of file */ /* MSDOS special bits */#define O_CHANGED0x1000/* user may read these bits, but*/#define O_DEVICE0x2000/* only RTLio functions may touch.*/#define O_TEXT0x4000/* CR-LF translation*/#define O_BINARY0x8000/* no translation*/* DOS 3.x options */#define O_NOINHERIT0x80#define O_DENYALL0x10#define O_DENYWRITE0x20#define O_DENYREAD0x30#define O_DENYNONE0x40/*float.hD

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论