~ubuntu-branches/ubuntu/utopic/python-lzma/utopic

« back to all changes in this revision

Viewing changes to liblzma_fileobj.h

  • Committer: Bazaar Package Importer
  • Author(s): Richard Darst
  • Date: 2010-04-19 14:16:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100419141648-qwz3nm7shemqp37n
Tags: 0.5.3-1
* New upstream version
* Upgrade to 3.0 (quilt) just to be able to use .orig.tar.bz2
* Bump standards-version to 3.8.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef LIBLZMA_FILEOBJ_H
2
 
#define LIBLZMA_FILEOBJ_H 1
3
 
 
4
 
#include "liblzma.h"
5
 
#include "liblzma_file.h"
6
 
#include <structmember.h>
7
 
 
8
 
/* Our very own off_t-like type, 64-bit if possible */
9
 
/* copied from Objects/fileobject.c */
10
 
#if !defined(HAVE_LARGEFILE_SUPPORT)
11
 
typedef off_t Py_off_t;
12
 
#elif SIZEOF_OFF_T >= 8
13
 
typedef off_t Py_off_t;
14
 
#elif SIZEOF_FPOS_T >= 8
15
 
typedef fpos_t Py_off_t;
16
 
#else
17
 
#error "Large file support, but neither off_t nor fpos_t is large enough."
18
 
#endif
19
 
 
20
 
#define BUF(v) PyString_AS_STRING((PyStringObject *)v)
21
 
 
22
 
typedef enum file_mode_e {
23
 
        MODE_CLOSED = 0,
24
 
        MODE_READ = 1,
25
 
        MODE_READ_EOF = 2,
26
 
        MODE_WRITE = 3
27
 
} file_mode;
28
 
 
29
 
#define LZMAFileObject_Check(v)  (Py_TYPE(v) == &LZMAFile_Type)
30
 
 
31
 
typedef struct {
32
 
        PyObject_HEAD
33
 
        PyObject *file;
34
 
 
35
 
        char* f_buf;            /* Allocated readahead buffer */
36
 
        char* f_bufend;         /* Points after last occupied position */
37
 
        char* f_bufptr;         /* Current buffer position */
38
 
 
39
 
        int f_softspace;        /* Flag used by 'print' command */
40
 
 
41
 
        bool f_univ_newline;    /* Handle any newline convention */
42
 
        int f_newlinetypes;     /* Types of newlines seen */
43
 
        bool f_skipnextlf;      /* Skip next \n */
44
 
 
45
 
        lzma_FILE *fp;
46
 
        lzma_options_lzma options;
47
 
        lzma_filter filters[LZMA_FILTERS_MAX + 2];
48
 
        uint64_t memlimit;
49
 
 
50
 
        file_mode mode;
51
 
        Py_off_t pos;
52
 
        Py_off_t size;
53
 
#ifdef WITH_THREAD
54
 
        PyThread_type_lock lock;
55
 
#endif
56
 
} LZMAFileObject;
57
 
 
58
 
extern PyTypeObject LZMAFile_Type;
59
 
 
60
 
#endif /* LIBLZMA_FILEOBJ_H */