hpstdio.h

Go to the documentation of this file.
00001 
00002 // Simple Stream Library for HP49g+
00003 
00004 //& ****************************************************************************
00005 //&
00006 //& Written by Ingo Blank, September 2004
00007 //& 
00008 //& Copyright (C) 2004 The HP-GCC Development Team
00009 //&
00010 //& ****************************************************************************
00011 //&
00012 //&
00013 //& This file is part of HP-GCC.
00014 //&
00015 //& HP-GCC is free software; you can redistribute it and/or modify
00016 //& it under the terms of the GNU General Public License as published by
00017 //& the Free Software Foundation; either version 2, or (at your option)
00018 //& any later version.
00019 //& 
00020 //& HP-GCC is distributed in the hope that it will be useful,
00021 //& but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 //& MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 //& GNU General Public License for more details.
00024 //& 
00025 //& You should have received a copy of the GNU General Public License
00026 //& along with HP-GCC; see the file COPYING. 
00027 //&
00028 //& As a special exception, you may use this file as part of a free software
00029 //& library without restriction.  Specifically, if other files instantiate
00030 //& templates or use macros or inline functions from this file, or you compile
00031 //& this file and link it with other files to produce an executable, this
00032 //& file does not by itself cause the resulting executable to be covered by
00033 //& the GNU General Public License.  This exception does not however
00034 //& invalidate any other reasons why the executable file might be covered by
00035 //& the GNU General Public License.
00036 //&
00037 //& ****************************************************************************
00038 
00039 // $Header: /cvsroot/hpgcc/sources/hplib/hpstdio.h,v 1.11 2005/04/30 10:17:55 iblank Exp $
00040 
00041 #ifndef __HPSTDIO_H
00042 #define __HPSTDIO_H
00043 
00044 // LONG TYPE DEFINITION, ADDED BY CLAUDIO 01/14/05
00045 #ifndef _LONGLONG_DEF
00046 typedef unsigned long long ULONGLONG;
00047 typedef long long LONGLONG;
00048 #define _LONGLONG_DEF
00049 #endif
00050 
00051 
00052 #include <hpsys.h>
00053 #include <kos.h>
00054 #include <stdarg.h>
00055 
00056 typedef struct
00057 {
00058     H_FILE    handle;
00059     int     eof_state;
00060 } FILE;
00061 
00062 // open file list handling < ibl ; 2005-02-06 >
00063 
00064 typedef struct _open_list_entry {
00065     FILE *file;
00066     struct _open_list_entry *next;
00067 } OPEN_LIST_ENTRY;
00068 
00069 
00070 #define SEEK_SET 0
00071 #define SEEK_CUR 1
00072 #define SEEK_END 2
00073 
00074 FILE *fopen(const char *fn, const char *mode);
00075 
00076 int fclose(FILE *f);
00077 
00078 int fgetc(FILE *f);
00079 
00080 char * fgets(char *buf, int n, FILE *f);
00081 
00082 int fputc(int c, FILE *f);
00083 
00084 int fputs(const char *s, FILE *f);
00085 
00086 SIZE_T fread(void *buf, SIZE_T size, SIZE_T cnt, FILE *f);
00087 
00088 SIZE_T fwrite(const void *buf, SIZE_T size, SIZE_T cnt, FILE *f);
00089 
00090 
00091 int fseek (FILE *f, long offset, int whence);
00092 #define rewind(f) fseek((f),0L,SEEK_SET)
00093 int feof(FILE *f);
00094 
00095 
00097 
00102 void *get_minifont();
00103 
00104 // Note: Bigfont is always 8*8 pixels
00105 //       Height is for display puposes only
00106 //       Width is normally 6 pixels
00107 char *get_bigfont();
00108 int get_bigfontheight();
00109 
00110 
00115 int        readint();
00116 
00121 unsigned    readuint();
00122 
00127 unsigned    readhex();
00128 
00133 LONGLONG    readlonglong();
00134 
00139 ULONGLONG    readulonglong();
00140 
00145 double    readdouble();
00146 
00147 
00153 EXTERN int puts(const char *);
00154 
00161 EXTERN int putchar(int);
00162 
00169 // standard file functions
00170 
00171 int write(int fd, const char *buf, size_t count);
00172 int isatty(int fd);
00173 
00174 #ifdef NO_ASSEMBLY_GETS
00175 EXTERN char    *_gets(char *buf);
00176 #define gets _gets
00177 #else
00178 EXTERN char    *gets(char *buf);
00179 #endif
00180 
00181 // console io
00182 
00188 int printf(const char *fmt, ...);
00189 int sprintf(char *out, const char *fmt, ...);
00190 int vsprintf(char *out,const char *fmt, va_list argp);
00191 int fprintf(FILE *f, const char *fmt, ...);
00192 
00193 
00194 // Stripped down Integer versions of *printf
00195 // These are lacking floating point formats
00196 
00197 int iprintf(const char *fmt, ...);
00198 int isprintf(char *out, const char *fmt, ...);
00199 int ivsprintf(char *out,const char *fmt, va_list argp);
00200 int ifprintf(FILE *f, const char *fmt, ...);
00201 
00202 
00203 #ifdef TINY_PRINTF
00204 #define printf iprintf
00205 #define sprintf isprintf
00206 #define vsprintf ivsprintf
00207 #define fprintf ifprintf
00208 #endif
00209 
00210 
00211 // *scanf family
00212 
00213 int _vsscanf(const char *str, const char *format, va_list ap);
00214 int _sscanf(const char *s, const char *f, ...);
00215 int _scanf(const char *f, ...);
00216 
00217 #define vsscanf _vsscanf
00218 #define sscanf _sscanf
00219 #define scanf _scanf
00220 
00221 
00222 #ifndef DOXYGEN_SKIP
00223 int get_decimal_digits();
00224 void set_decimal_digits(int v);
00225 char *get_decimal_separator();
00226 void set_decimal_separator(char a);
00227 #endif
00228 
00229 
00230 
00231 #endif // __HPSTDIO_H

Generated on Fri Feb 16 16:43:16 2007 for HP-GCCLibrary by  doxygen 1.5.0