Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

stdio.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002  *  Copyright (C) 2003 Dallas Semiconductor Corporation, All Rights Reserved.
00003  * 
00004  *  Permission is hereby granted, free of charge, to any person obtaining a
00005  *  copy of this software and associated documentation files (the "Software"),
00006  *  to deal in the Software without restriction, including without limitation
00007  *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008  *  and/or sell copies of the Software, and to permit persons to whom the
00009  *  Software is furnished to do so, subject to the following conditions:
00010  * 
00011  *  The above copyright notice and this permission notice shall be included
00012  *  in all copies or substantial portions of the Software.
00013  * 
00014  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015  *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016  *  MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017  *  IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
00018  *  OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019  *  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020  *  OTHER DEALINGS IN THE SOFTWARE.
00021  * 
00022  *  Except as contained in this notice, the name of Dallas Semiconductor
00023  *  shall not be used except as stated in the Dallas Semiconductor
00024  *  Branding Policy.
00025  * ---------------------------------------------------------------------------
00026  */
00027 #ifndef _STDIO
00028 #define _STDIO
00029 
00030 #include <stddef.h>
00031 
00102 #define FS_VERSION        10
00103 
00104 
00105 #ifndef NULL
00106 
00108  #define NULL ((void *) 0)
00109 #endif
00110 
00111 #ifndef _SIZE_T
00112 
00114  #define _SIZE_T
00115  typedef unsigned int size_t;
00116 #endif
00117 
00118 #ifndef _OFF_T
00119 
00121  #define _OFF_T
00122  typedef unsigned int off_t;
00123 #endif
00124 
00125 #ifndef _FPOS_T
00126 
00128  #define _FPOS_T
00129  typedef long fpos_t;
00130 #endif
00131 
00132 
00135 #define FILE_FLAGS_EOF    1
00136 
00138 #define FILE_FLAGS_TEMP   2
00139 
00144 #define FILE_TYPE_TINIFS  1
00145 
00151 struct file_structure
00152 {
00153   int flags;                  
00154   int error;                  
00155   int type;                   
00156   void* fd;                   
00157   unsigned char* fname_copy;  
00158 };
00159 
00162 typedef struct file_structure FILE;
00163 
00164 #pragma SAVE
00165 #pragma REGPARMS
00166 
00167 //Size of <stdio.h> buffers. 
00168 // This doesn't really matter right now.  We may add it in the future.
00169 //#define BUFSIZ         1024
00170 
00171 
00172 // WARNING WARNING WARNING!!! If FILENAME_MAX ever changes (unlikely), make sure to change it in nat_fs.a51 as well.
00173 
00177 #define FILENAME_MAX   255
00178 
00182 #define FOPEN_MAX      8
00183 
00186 #define L_tmpnam       20
00187 
00188 
00193 #define SEEK_CUR       0x5555
00194 
00198 #define SEEK_END       0x5556
00199 
00202 #define SEEK_SET       0x5557
00203 
00207 #define TMP_MAX        10
00208 
00211 #define EOF            -1
00212 
00216 #define P_tmpdir       "temp"
00217 
00229 //---------------------------------------------------------------------------
00230 void     clearerr(FILE* f_handle);                                               
00231 
00248 //---------------------------------------------------------------------------
00249 int      fclose(FILE* f_handle);                                                 
00250 
00264 //---------------------------------------------------------------------------
00265 int      feof(FILE* f_handle);                                                   
00266 
00281 //---------------------------------------------------------------------------
00282 int      ferror(FILE* f_handle);                                                 
00283 
00302 //---------------------------------------------------------------------------
00303 int      fgetc(FILE* f_handle);                                                  
00304 
00325 //---------------------------------------------------------------------------
00326 int      fgetpos(FILE* f_handle, fpos_t* position);                              
00327 
00353 //---------------------------------------------------------------------------
00354 char*    fgets(char* string, int num, FILE* f_handle);                           
00355 
00376 //---------------------------------------------------------------------------
00377 FILE*    fopen(const char* filename, const char* mode);                          
00378 
00397 //---------------------------------------------------------------------------
00398 int      fputc(int ch, FILE* f_handle);                                          
00399 
00418 //---------------------------------------------------------------------------
00419 int      fputs(const char* str, FILE* f_handle);                                 
00420 
00444 //---------------------------------------------------------------------------
00445 size_t   fread(void* ptr, size_t size, size_t num, FILE* f_handle);              
00446 
00466 //---------------------------------------------------------------------------
00467 FILE*    freopen(const char* newfilename, const char* mode, FILE* old_handle);   
00468 
00498 //---------------------------------------------------------------------------
00499 int      fseek(FILE* f_handle, long int offset, int tag);                        
00500 
00529 //---------------------------------------------------------------------------
00530 int      fseeko(FILE* f_handle, off_t offset, int tag);                          
00531 
00552 //---------------------------------------------------------------------------
00553 int      fsetpos(FILE* f_handle, const fpos_t* position);                        
00554 
00575 //---------------------------------------------------------------------------
00576 long     ftell(FILE* f_handle);                                                  
00577 
00598 //---------------------------------------------------------------------------
00599 off_t    ftello(FILE* f_handle);                                                 
00600 
00616 //---------------------------------------------------------------------------
00617 void     flockfile(FILE* f_handle);                                              
00618 
00637 //---------------------------------------------------------------------------
00638 int      ftrylockfile(FILE* f_handle);                                           
00639 
00656 //---------------------------------------------------------------------------
00657 void     funlockfile(FILE* f_handle);                                            
00658 
00682 //---------------------------------------------------------------------------
00683 size_t   fwrite(const void* ptr, size_t size, size_t num, FILE* f_handle);       
00684 
00704 //---------------------------------------------------------------------------
00705 int      getc(FILE* f_handle);                                                   
00706 
00726 //---------------------------------------------------------------------------
00727 int      putc(int value, FILE* f_handle);                                        
00728 
00743 //---------------------------------------------------------------------------
00744 int      remove(const char* filename);                                           
00745 
00763 //---------------------------------------------------------------------------
00764 int      rename(const char* oldname, const char* newname);                       
00765 
00786 //---------------------------------------------------------------------------
00787 void     rewind(FILE* f_handle);                                                 
00788 
00811 //---------------------------------------------------------------------------
00812 char*    tempnam(const char* dirname, const char* pfx);                          
00813 
00827 //---------------------------------------------------------------------------
00828 FILE*    tmpfile(void);                                                          
00829 
00851 //---------------------------------------------------------------------------
00852 char*    tmpnam(char* nametarget);                                               
00853 
00869 //---------------------------------------------------------------------------
00870 int      fflush(FILE* f_handle);
00871 
00872 
00873 
00874 // Non-standard functions that are useful/necessary.
00875 
00876 
00877 
00909 //---------------------------------------------------------------------------
00910 int      fcleaninit(char numfd, int numblocks, void* start_address);
00911 
00947 //---------------------------------------------------------------------------
00948 int      finit(char numfd, int numblocks, void* start_address);
00949 
00963 //---------------------------------------------------------------------------
00964 int      fexists(char* filename);
00965 
00988 //---------------------------------------------------------------------------
00989 void*    fopen_fd(const char* filename, const char* mode);
00990 
01013 //---------------------------------------------------------------------------
01014 unsigned int freadbytes(void* buffer, int length, FILE* stream);
01015 
01037 //---------------------------------------------------------------------------
01038 unsigned int fwritebytes(void* buffer, int length, FILE* stream);
01039 
01053 //---------------------------------------------------------------------------
01054 unsigned long getfreefsram();
01055 
01066 //---------------------------------------------------------------------------
01067 int      mkdir(char* dirname);
01068 
01069 
01070 
01071 
01072 /*
01073  * The following functions are provided by the Keil libraries.  We re-export them
01074  * since we are basically overriding stdio.h here.  Please see the Keil 
01075  * documentation for information on these functions.
01076  */
01077 
01084 extern char _getkey (void);
01091 extern char getchar (void);
01098 extern char ungetchar (char);
01105 extern char putchar (char);
01112 extern int printf   (const char *, ...);
01119 extern int sprintf  (char *, const char *, ...);
01126 extern int vprintf  (const char *, char *);
01133 extern int vsprintf (char *, const char *, char *);
01140 extern char *gets (char *, int n);
01147 extern int scanf (const char *, ...);
01154 extern int sscanf (char *, const char *, ...);
01161 extern int puts (const char *);
01162 
01163 
01169 //---------------------------------------------------------------------------
01170 unsigned int filesystem_version(void);
01171 
01172 
01173 
01174 #pragma RESTORE
01175 
01176 
01177 #endif

Copyright 2005 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.