Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/runtime/gc/writer.h
ViewVC logotype

Annotation of /sml/trunk/src/runtime/gc/writer.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download) (as text)

1 : monnier 249 /* writer.h
2 :     *
3 :     * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
4 :     *
5 :     * This is an abstraction of a buffered output device for writing
6 :     * heap data.
7 :     */
8 :    
9 :     #ifndef _WRITER_
10 :     #define _WRITER_
11 :    
12 :     #include <stdio.h> /* for FILE */
13 :    
14 :     typedef struct writer {
15 :     bool_t errFlg;
16 :     void *data;
17 :     void (*putWord)(struct writer *, Word_t);
18 :     void (*write)(struct writer *, const void *, Addr_t);
19 :     void (*flush)(struct writer *);
20 :     long (*tell)(struct writer *);
21 :     void (*seek)(struct writer *, long offset);
22 :     void (*free)(struct writer *);
23 :     } writer_t;
24 :    
25 :     /* open a file for writing, and make a file for it */
26 :     extern writer_t *WR_OpenFile (FILE *file);
27 :     /* make a writer from a region of memory */
28 :     extern writer_t *WR_OpenMem (Byte_t *data, Addr_t len);
29 :    
30 :     #define WR_Error(wr) ((wr)->errFlg)
31 :     #define WR_Put(wr, w) ((wr)->putWord((wr), (w)))
32 :     #define WR_Write(wr, data, nbytes) ((wr)->write((wr), (data), (nbytes)))
33 :     #define WR_Flush(wr) ((wr)->flush(wr))
34 :     #define WR_Tell(wr) ((wr)->tell(wr))
35 :     #define WR_Seek(wr, offset) ((wr)->seek((wr), (offset)))
36 :     #define WR_Free(wr) ((wr)->free(wr))
37 :    
38 :     #endif /* !_WRITER_ */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0