home *** CD-ROM | disk | FTP | other *** search
- /*
- * This file is part of a Macintosh port of GNU Emacs.
- * Copyright (C) 1993, 1994 Marc Parmet. All rights reserved.
- *
- * GNU Emacs is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
- #ifndef __STDIO__
- #define __STDIO__
-
- #include <Files.h>
- #include <string.h>
-
- #define BUFSIZ 512
- #define _NFILE 16
-
- #if defined(powerc)
- #pragma options align=mac68k
- #endif
-
- typedef struct _iobuf {
- int fd;
- char flag;
- char havepushback,havespec,external_base;
- char pushback,err;
- FSSpec spec;
- unsigned char *base;
- int cnt; // When writing, the number of chars in the buffer written but not flushed.
- // When reading, the number of chars in the buffer still to read.
- int buflen; // When reading, the length of valid contents of the buffer
- // When writing, the same.
- } FILE;
-
- #if defined(powerc)
- #pragma options align=reset
- #endif
-
- FILE *_iob(int);
-
- #define stdin (_iob(0))
- #define stdout (_iob(1))
- #define stderr (_iob(2))
-
- #define _READ 01
- #define _WRITE 02
- #define _AUTO 04
- #define EOF (-1)
-
- FILE *fopen(char *,char *);
- FILE *freopen(char *,char *,FILE *);
- FILE *fdopen(int,char *);
- void fprintf(FILE *,char *,...);
- void sprintf(char *,char *,...);
- void printf(char *,...);
- char *fgets(char *s,int n,FILE *fp);
- FILE *popen(char *name,char *mode);
-
- #define getc(fp) ((fp)->cnt && !(fp)->havepushback ? (fp)->base[(fp)->buflen - (fp)->cnt--] : _getc(fp))
- #define getchar() getc(stdin)
-
- #define putc(c,fp) ((fp)->cnt < (fp)->buflen ? (fp)->base[(fp)->cnt++] = c : _putc(c,fp))
- #define putchar(c) putc(c,stdout)
-
- #endif
-