PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
driver.h
Go to the documentation of this file.
1 
10 #ifndef _SYS_DRIVER_H
11 #define _SYS_DRIVER_H
12 
24 typedef struct __driver _Driver;
25 
88 struct __driver {
100  const char *prefix;
101 
110  int (*fopen)(FILE *fp, const char *name, const char *mode);
111 
117  int (*fclose)(FILE *fp);
118 
128  int (*read)(FILE *fp, unsigned char *buf, int size);
129 
139  int (*write)(FILE *fp, unsigned char *buf, int size);
140 
149  int (*seek)(FILE *fp, long offset, int whence);
150 
156  int (*remove)(const char *name);
157 
164  int (*getbyte)(FILE *fp);
165 
173  int (*putbyte)(int c, FILE *fp);
174 };
175 
182 extern _Driver *_driverlist[];
183 
184 /* some standard functions that are useful in drivers */
185 
187 int _null_read(FILE *fp, unsigned char *buf, int size);
189 int _null_write(FILE *fp, unsigned char *buf, int size);
190 
192 int _term_read(FILE *fp, unsigned char *buf, int size);
194 int _term_write(FILE *fp, unsigned char *buf, int size);
195 
196 #endif
_null_read
int _null_read(FILE *fp, unsigned char *buf, int size)
_term_read
int _term_read(FILE *fp, unsigned char *buf, int size)
__driver::getbyte
int(* getbyte)(FILE *fp)
Definition: driver.h:164
__driver::write
int(* write)(FILE *fp, unsigned char *buf, int size)
Definition: driver.h:139
__driver::seek
int(* seek)(FILE *fp, long offset, int whence)
Definition: driver.h:149
_FILE
Definition: stdio.h:62
__driver::prefix
const char * prefix
Definition: driver.h:100
__driver
Generic and customizable driver struct for stdio devices.
Definition: driver.h:88
__driver::fclose
int(* fclose)(FILE *fp)
Definition: driver.h:117
__driver::fopen
int(* fopen)(FILE *fp, const char *name, const char *mode)
Definition: driver.h:110
_null_write
int _null_write(FILE *fp, unsigned char *buf, int size)
_term_write
int _term_write(FILE *fp, unsigned char *buf, int size)
__driver::read
int(* read)(FILE *fp, unsigned char *buf, int size)
Definition: driver.h:128
__driver::remove
int(* remove)(const char *name)
Definition: driver.h:156
_driverlist
_Driver * _driverlist[]
Device driver array of __driver structs.
Definition: addfiledriver.c:7
__driver::putbyte
int(* putbyte)(int c, FILE *fp)
Definition: driver.h:173