summaryrefslogtreecommitdiff
path: root/lang_ext/python/cext.h
blob: e0e7832edb1198ae031204e2d24883752797d9c4 (plain)
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
/*
 * upb - a minimalist implementation of protocol buffers.
 *
 * Copyright (c) 2009 Joshua Haberman.  See LICENSE for details.
 *
 */

#ifndef UPB_PYTHON_CEXT_H_
#define UPB_PYTHON_CEXT_H_

#include <Python.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  PyObject_HEAD
  struct upb_context *context;
  PyObject *created_defs;
} PyUpb_Context;

typedef struct {
  PyObject_HEAD
  struct upb_msgdef *def;
  PyUpb_Context *context;
} PyUpb_MsgDef;

extern PyTypeObject PyUpb_MsgDefType;

/* What format string should be passed to PyArg_ParseTuple to get just a raw
 * string of bytes and a length. */
#if PY_MAJOR_VERSION >= 3
#define BYTES_FORMAT "y#"
#else
#define BYTES_FORMAT "s#"
#endif

#define RETURN_BOOL(val) if(val) { Py_RETURN_TRUE; } else { Py_RETURN_FALSE; }

extern PyMODINIT_FUNC initdefinition(void);
extern PyMODINIT_FUNC initpb(void);

#ifdef __cplusplus
}  /* extern "C" */
#endif

#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback