File: popplermodule.c

package info (click to toggle)
python-poppler 0.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,384 kB
  • ctags: 120
  • sloc: sh: 10,208; makefile: 95; python: 89; ansic: 37
file content (62 lines) | stat: -rw-r--r-- 1,874 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
61
62
/* -*- Mode: C; c-basic-offset: 4 -*-
 * Copyright (C) 2007-2008, Gian Mario Tagliaretti
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

/* include this first, before NO_IMPORT_PYGOBJECT is defined */

#include <pygobject.h>
#include <pygtk/pygtk.h>
#include <glib/poppler.h>

#include <pycairo.h>
Pycairo_CAPI_t *Pycairo_CAPI;

void py_poppler_register_classes (PyObject *d);
void py_poppler_add_constants (PyObject *module, const gchar *strip_prefix);

extern PyMethodDef py_poppler_functions[];

DL_EXPORT(void)
initpoppler(void)
{
    PyObject *m, *d;

    Pycairo_IMPORT;

    init_pygobject ();

    m = Py_InitModule ("poppler", py_poppler_functions);
    d = PyModule_GetDict (m);

    py_poppler_register_classes (d);
    
    py_poppler_add_constants(m, "POPPLER_");

    PyModule_AddObject(m, "pypoppler_version",
                       Py_BuildValue("iii",
                                     PYPOPPLER_MAJOR_VERSION,
                                     PYPOPPLER_MINOR_VERSION,
                                     PYPOPPLER_MICRO_VERSION));
    
    if (PyErr_Occurred ()) {
        Py_FatalError ("can't initialise module globalkeys");
    }
}