-
Notifications
You must be signed in to change notification settings - Fork 8
/
starlark.h
100 lines (72 loc) · 2.17 KB
/
starlark.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef PYTHON_STARLARK_GO_H
#define PYTHON_STARLARK_GO_H
#include <stdint.h>
#include <stdlib.h>
#define PY_SSIZE_T_CLEAN
#undef Py_LIMITED_API
#include <Python.h>
/* Starlark object */
typedef struct Starlark {
PyObject_HEAD uintptr_t handle;
} Starlark;
/* Helpers for Cgo, which can't handle varargs or macros */
Starlark *starlarkAlloc(PyTypeObject *type);
void starlarkFree(Starlark *self);
int parseInitArgs(
PyObject *args, PyObject *kwargs, PyObject **globals, PyObject **print
);
int parseEvalArgs(
PyObject *args,
PyObject *kwargs,
char **expr,
char **filename,
unsigned int *convert,
PyObject **print
);
int parseExecArgs(
PyObject *args, PyObject *kwargs, char **defs, char **filename, PyObject **print
);
int parseGetGlobalArgs(
PyObject *args, PyObject *kwargs, char **name, PyObject **default_value
);
int parsePopGlobalArgs(
PyObject *args, PyObject *kwargs, char **name, PyObject **default_value
);
PyObject *makeStarlarkErrorArgs(const char *error_msg, const char *error_type);
PyObject *makeSyntaxErrorArgs(
const char *error_msg,
const char *error_type,
const char *msg,
const char *filename,
const unsigned int line,
const unsigned int column
);
PyObject *makeEvalErrorArgs(
const char *error_msg,
const char *error_type,
const char *filename,
const unsigned int line,
const unsigned int column,
const char *function_name,
const char *backtrace
);
PyObject *makeResolveErrorItem(
const char *msg, const unsigned int line, const unsigned int column
);
PyObject *makeResolveErrorArgs(
const char *error_msg, const char *error_type, PyObject *errors
);
PyObject *cgoPy_BuildString(const char *src);
PyObject *cgoPy_NewRef(PyObject *obj);
int cgoPyFloat_Check(PyObject *obj);
int cgoPyLong_Check(PyObject *obj);
int cgoPyUnicode_Check(PyObject *obj);
int cgoPyBytes_Check(PyObject *obj);
int cgoPySet_Check(PyObject *obj);
int cgoPyTuple_Check(PyObject *obj);
int cgoPyMapping_Check(PyObject *obj);
int cgoPyDict_Check(PyObject *obj);
int cgoPyList_Check(PyObject *obj);
int cgoPyFunc_Check(PyObject *obj);
int cgoPyMethod_Check(PyObject *obj);
#endif /* PYTHON_STARLARK_GO_H */