~ubuntu-branches/debian/squeeze/alpine/squeeze

« back to all changes in this revision

Viewing changes to pith/store.h

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2007-02-17 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070217131742-99x5c6cpg1pbkdhw
Tags: upstream-0.82+dfsg
ImportĀ upstreamĀ versionĀ 0.82+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id: store.h 237 2006-11-16 04:08:15Z mikes@u.washington.edu $
 
3
 *
 
4
 * ========================================================================
 
5
 * Copyright 2006 University of Washington
 
6
 *
 
7
 * Licensed under the Apache License, Version 2.0 (the "License");
 
8
 * you may not use this file except in compliance with the License.
 
9
 * You may obtain a copy of the License at
 
10
 *
 
11
 *     http://www.apache.org/licenses/LICENSE-2.0
 
12
 *
 
13
 * ========================================================================
 
14
 */
 
15
 
 
16
#ifndef PITH_STORE_INCLUDED
 
17
#define PITH_STORE_INCLUDED
 
18
 
 
19
 
 
20
typedef enum {CharStarStar, CharStar, FileStar,
 
21
                TmpFileStar, PipeStar, ExternalText} SourceType;
 
22
 
 
23
 
 
24
/*
 
25
 * typedef used by storage object routines
 
26
 */
 
27
 
 
28
typedef struct store_object {
 
29
    unsigned char *dp;          /* current position in data             */
 
30
    unsigned char *eod;         /* end of current data                  */
 
31
    void          *txt;         /* container's data                     */
 
32
    unsigned char *eot;         /* end of space alloc'd for data        */
 
33
    int  (*writec)(int, struct store_object *);
 
34
    int  (*readc)(unsigned char *, struct store_object *);
 
35
    int  (*puts)(struct store_object *, char *);
 
36
    fpos_t         used;        /* amount of object in use              */
 
37
    char          *name;        /* optional object name                 */
 
38
    SourceType     src;         /* what we're copying into              */
 
39
    short          flags;       /* flags relating to object use         */
 
40
    unsigned char  cbuf[6];     /* used for converting to or from       */
 
41
    unsigned char *cbufp;       /*   locale-specific charset            */
 
42
    unsigned char *cbufend;
 
43
    PARAMETER      *attr;       /* attribute list                       */
 
44
} STORE_S;
 
45
 
 
46
#define so_writec(c, so)        ((*(so)->writec)((c), (so)))
 
47
#define so_readc(c, so)         ((*(so)->readc)((c), (so)))
 
48
#define so_puts(so, s)          ((*(so)->puts)((so), (s)))
 
49
 
 
50
 
 
51
/* exported protoypes */
 
52
STORE_S *so_get(SourceType, char *, int);
 
53
int      so_give(STORE_S **);
 
54
int      so_nputs(STORE_S *, char *, long);
 
55
int      so_seek(STORE_S *, long, int);
 
56
int      so_truncate(STORE_S *, long);
 
57
long     so_tell(STORE_S *);
 
58
char    *so_attr(STORE_S *, char *, char *);
 
59
int      so_release(STORE_S *);
 
60
void    *so_text(STORE_S *);
 
61
char    *so_fgets(STORE_S *, char *, size_t);
 
62
void     so_register_external_driver(STORE_S *(*)(void),
 
63
                                     int      (*)(STORE_S **),
 
64
                                     int      (*)(int, STORE_S *),
 
65
                                     int      (*)(unsigned char *, STORE_S *),
 
66
                                     int      (*)(STORE_S *, char *),
 
67
                                     int      (*)(STORE_S *, long, int),
 
68
                                     int      (*)(STORE_S *, off_t),
 
69
                                     int      (*)(STORE_S *));
 
70
 
 
71
 
 
72
#endif /* PITH_STORE_INCLUDED */