gonzui


Format: Advanced Search

t2ex/t2ex_source/include/t2ex/stdio.hbare sourcepermlink (0.03 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T2EX Software Package
    4:  *
    5:  *    Copyright 2012 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2012/12/12.
   10:  *    Modified by T-Engine Forum at 2013/03/14.
   11:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/04.
   12:  *
   13:  *----------------------------------------------------------------------
   14:  */
   15: /*
   16:  * This software package is available for use, modification, 
   17:  * and redistribution in accordance with the terms of the attached 
   18:  * T-License 2.x.
   19:  * If you want to redistribute the source code, you need to attach 
   20:  * the T-License 2.x document.
   21:  * There's no obligation to publish the content, and no obligation 
   22:  * to disclose it to the TRON Forum if you have modified the 
   23:  * software package.
   24:  * You can also distribute the modified source code. In this case, 
   25:  * please register the modification to T-Kernel traceability service.
   26:  * People can know the history of modifications by the service, 
   27:  * and can be sure that the version you have inherited some 
   28:  * modification of a particular version or not.
   29:  *
   30:  *    http://trace.tron.org/tk/?lang=en
   31:  *    http://trace.tron.org/tk/?lang=ja
   32:  *
   33:  * As per the provisions of the T-License 2.x, TRON Forum ensures that 
   34:  * the portion of the software that is copyrighted by Ken Sakamura or 
   35:  * the TRON Forum does not infringe the copyrights of a third party.
   36:  * However, it does not make any warranty other than this.
   37:  * DISCLAIMER: TRON Forum and Ken Sakamura shall not be held
   38:  * responsible for any consequences or damages caused directly or
   39:  * indirectly by the use of this software package.
   40:  *
   41:  * The source codes in bsd_source.tar.gz in this software package are 
   42:  * derived from NetBSD or OpenBSD and not covered under T-License 2.x.
   43:  * They need to be changed or redistributed according to the 
   44:  * representation of each source header.
   45:  */
   46: 
   47: /*
   48:  *      @(#)stdio.h
   49:  *
   50:  */
   51: 
   52: #ifndef __STDIO_H__
   53: #define __STDIO_H__
   54: 
   55: #include <stdtype.h>
   56: #include <stdarg.h>
   57: #include <stdint.h>
   58: #include <errno.h>
   59: #include <tk/typedef.h>
   60: #include <sys/types.h>
   61: 
   62: typedef struct _FILE {          /* File handle */
   63:         int    opaque[23];
   64: } FILE;
   65: 
   66: typedef off_t   fpos_t;           /* Position within file */
   67: typedef off64_t fpos64_t;       /* Position within file (64bits) */
   68: 
   69: #define EOF             (-1)               /* File termination */
   70: 
   71: #define _IOFBF          0               /* Complete buffering mode */
   72: #define _IOLBF          1               /* Line-buffering mode */
   73: #define _IONBF          2               /* Non-buffering mode */
   74: 
   75: #define BUFSIZ          1024            /* Buffer size    minimum: 256 */
   76: #define FILENAME_MAX    256                /* File name length */
   77: 
   78: #define TMP_MAX         25             /* Temporary file count  minimum: 25 */
   79: #define L_tmpnam        16             /* Temporary file name length */
   80: 
   81: #define SEEK_SET        0              /* From the top */
   82: #define SEEK_CUR        1              /* From the current position */
   83: #define SEEK_END        2              /* From the termination */
   84: 
   85: #if     1
   86: IMPORT  FILE    __sF[];
   87: #define stdin           (&__sF[0])       /* Standard input */
   88: #define stdout          (&__sF[1])      /* Standard output */
   89: #define stderr          (&__sF[2])      /* Standard error output */
   90: #else
   91: IMPORT  FILE     *__stdin, *__stdout, *__stderr;
   92: #define stdin           __stdin          /* Standard input */
   93: #define stdout          __stdout        /* Standard output */
   94: #define stderr          __stderr        /* Standard error output */
   95: #endif
   96: 
   97: #ifdef __cplusplus
   98: extern "C" {
   99: #endif
  100: 
  101: /* File access function */
  102: IMPORT  FILE     *fopen(const char *path, const char *mode);
  103: IMPORT  FILE     *fopen_eno(const char *path, const char *mode, errno_t *eno);
  104: IMPORT  FILE     *freopen(const char *path, const char *mode, FILE *stream);
  105: IMPORT  FILE     *freopen_eno(const char *path, const char *mode, FILE *stream, errno_t *eno);
  106: IMPORT  int      fclose(FILE *stream);
  107: IMPORT  int      fclose_eno(FILE *stream, errno_t *eno);
  108: IMPORT  int      fflush(FILE *stream);
  109: IMPORT  void     setbuf(FILE *stream, char *buf);
  110: IMPORT  int      setvbuf(FILE *stream, char *buf, int mode, size_t size);
  111: 
  112: /* File descriptor access function */
  113: IMPORT  int      fileno(FILE *stream);
  114: IMPORT  FILE     *fdopen(int fd, const char *mode);
  115: IMPORT  FILE     *fdopen_eno(int fd, const char *mode, errno_t *eno);
  116: 
  117: /* Character I/O function */
  118: IMPORT  int      fputc(int c, FILE *stream);
  119: #define putc(c, fp)     fputc(c, fp)
  120: #define putchar(c)      fputc(c, stdout)
  121: IMPORT  int      fputs(const char *s, FILE *stream);
  122: IMPORT  int      puts(const char *s);
  123: IMPORT  int      fgetc(FILE *stream);
  124: #define getc(fp)        fgetc(fp)
  125: #define getchar()       fgetc(stdin)
  126: IMPORT  char     *fgets(char *s, int size, FILE *stream);
  127: IMPORT  int      ungetc(int c, FILE *stream);
  128: 
  129: /* Direct I/O function */
  130: IMPORT  size_t   fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
  131: IMPORT  size_t   fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
  132: 
  133: /* File positioning function */
  134: IMPORT  int      fseek(FILE *stream, off_t offset, int whence);
  135: IMPORT  int      fseek64(FILE *stream, off64_t offset, int whence);
  136: IMPORT  int      fgetpos(FILE *stream, fpos_t *pos);
  137: IMPORT  int      fgetpos64(FILE *stream, fpos64_t *pos);
  138: IMPORT  int      fsetpos(FILE *stream, const fpos_t *pos);
  139: IMPORT  int      fsetpos64(FILE *stream, const fpos64_t *pos);
  140: IMPORT  long     ftell(FILE *stream);
  141: IMPORT  int64_t  ftell64(FILE *stream);
  142: IMPORT  void     rewind(FILE *stream);
  143: 
  144: /* Error processing function */
  145: IMPORT  void     clearerr(FILE *stream);
  146: IMPORT  int      feof(FILE *stream);
  147: IMPORT  errno_t  ferror(FILE *stream);
  148: 
  149: /* Initializer */
  150: IMPORT  ER       libc_stdio_init(void);
  151: IMPORT  ER       libc_stdio_cleanup(void);
  152: 
  153: /* printf/scanf function */
  154: IMPORT  int      fprintf(FILE *stream, const char *format, ...);
  155: IMPORT  int      printf(const char *format, ...);
  156: IMPORT  int      snprintf(char *str, size_t size, const char *format, ...);
  157: IMPORT  int      sprintf(char *str, const char *format, ...);
  158: IMPORT  int      vfprintf(FILE *stream, const char *format, va_list ap);
  159: IMPORT  int      vprintf(const char *format, va_list ap);
  160: IMPORT  int      vsnprintf(char *str, size_t size, const char *format, va_list ap);
  161: IMPORT  int      vsprintf(char *str, const char *format, va_list ap);
  162: IMPORT  int      fscanf(FILE *stream, const char *format, ...);
  163: IMPORT  int      scanf(const char *format, ...);
  164: IMPORT  int      sscanf(const char *str, const char *format, ...);
  165: IMPORT  int      vfscanf(FILE *stream, const char *format, va_list ap);
  166: IMPORT  int      vscanf(const char *format, va_list ap);
  167: IMPORT  int      vsscanf(const char *str, const char *format, va_list ap);
  168: 
  169: #ifdef __cplusplus
  170: }
  171: #endif
  172: #endif  /* __STDIO_H__ */
  173: