File: stream.h

package info (click to toggle)
m68k-vme-tftplilo 1.0.0-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 316 kB
  • ctags: 637
  • sloc: ansic: 5,475; makefile: 78
file content (60 lines) | stat: -rw-r--r-- 1,944 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * stream.h -- Stream definitions
 *
 * Copyright (c) 1997 by Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
 *
 * Modified by Nick Holgate to suit VME Linux/m68k Loader.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive
 * for more details.
 */

#ifndef _stream_h
#define _stream_h

typedef struct _module {
    /* data supplied by the module */
    char *name;							/* name of this module */
    long maxbuf;						/* max. bytes a fillbuf() call
										 * can return */
    /* methods */
    int (*open)( void *data, long size);/* open the module */
    long (*fillbuf)( void *buf );		/* fill a buffer, max. maxbuf bytes
										 * returned */
    int (*skip)( long cnt );			/* skip data (for seek), optional,
										 * returns amount  skipped */
    int (*close)( void );				/* close the module */
    /* data maintained by general streams layer */
    char *buf;							/* current buffer */
    char *bufp;							/* pointer into buffer */
    long buf_cnt;						/* #chars left in buffer */
    long fpos;							/* position in stream */
    int eof;							/* EOF indicator */
    /* links to neighbour modules */
    struct _module *down, *up;
} MODULE;

/* initializer for fields in MODULE not supplied by module */
#define MOD_REST_INIT								\
	NULL, NULL, 0, 0, 0, 	/* buffer data */		\
	NULL, NULL				/* down, up pointers */

extern MODULE *currmod;		/* currently active module */

/***************************** Prototypes *****************************/

void stream_init( void );
void stream_push( MODULE *mod );
int sopen( void *data, long size);
long sread( void *buf, long cnt );
int sseek( long offset, int whence );
int sclose( void );

/************************* End of Prototypes **************************/
    
#endif  /* _stream_h */

/* Local Variables: */
/* tab-width: 4     */
/* End:             */