Switch to python3
This commit is contained in:
parent
531041e89a
commit
9ba4b6a91a
5286 changed files with 677347 additions and 576888 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
*.pyo
|
*.pyo
|
||||||
*.pyd
|
*.pyd
|
||||||
|
__pycache__
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip'
|
|
||||||
__requires__ = 'pip==1.5.6'
|
|
||||||
import sys
|
|
||||||
from pkg_resources import load_entry_point
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(
|
|
||||||
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
|
|
||||||
)
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip2.7'
|
|
||||||
__requires__ = 'pip==1.5.6'
|
|
||||||
import sys
|
|
||||||
from pkg_resources import load_entry_point
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(
|
|
||||||
load_entry_point('pip==1.5.6', 'console_scripts', 'pip2.7')()
|
|
||||||
)
|
|
11
Darwin/bin/pip3
Normal file
11
Darwin/bin/pip3
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from pip import main
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||||
|
sys.exit(main())
|
|
@ -1 +0,0 @@
|
||||||
python2
|
|
|
@ -1 +0,0 @@
|
||||||
python2.7
|
|
Binary file not shown.
1
Darwin/bin/python3
Symbolic link
1
Darwin/bin/python3
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
python3.4
|
BIN
Darwin/bin/python3.4
Executable file
BIN
Darwin/bin/python3.4
Executable file
Binary file not shown.
|
@ -1,535 +0,0 @@
|
||||||
/* File automatically generated by Parser/asdl_c.py. */
|
|
||||||
|
|
||||||
#include "asdl.h"
|
|
||||||
|
|
||||||
typedef struct _mod *mod_ty;
|
|
||||||
|
|
||||||
typedef struct _stmt *stmt_ty;
|
|
||||||
|
|
||||||
typedef struct _expr *expr_ty;
|
|
||||||
|
|
||||||
typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5,
|
|
||||||
Param=6 } expr_context_ty;
|
|
||||||
|
|
||||||
typedef struct _slice *slice_ty;
|
|
||||||
|
|
||||||
typedef enum _boolop { And=1, Or=2 } boolop_ty;
|
|
||||||
|
|
||||||
typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7,
|
|
||||||
RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 }
|
|
||||||
operator_ty;
|
|
||||||
|
|
||||||
typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
|
|
||||||
|
|
||||||
typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
|
|
||||||
In=9, NotIn=10 } cmpop_ty;
|
|
||||||
|
|
||||||
typedef struct _comprehension *comprehension_ty;
|
|
||||||
|
|
||||||
typedef struct _excepthandler *excepthandler_ty;
|
|
||||||
|
|
||||||
typedef struct _arguments *arguments_ty;
|
|
||||||
|
|
||||||
typedef struct _keyword *keyword_ty;
|
|
||||||
|
|
||||||
typedef struct _alias *alias_ty;
|
|
||||||
|
|
||||||
|
|
||||||
enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
|
|
||||||
Suite_kind=4};
|
|
||||||
struct _mod {
|
|
||||||
enum _mod_kind kind;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
asdl_seq *body;
|
|
||||||
} Module;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *body;
|
|
||||||
} Interactive;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty body;
|
|
||||||
} Expression;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *body;
|
|
||||||
} Suite;
|
|
||||||
|
|
||||||
} v;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3,
|
|
||||||
Delete_kind=4, Assign_kind=5, AugAssign_kind=6, Print_kind=7,
|
|
||||||
For_kind=8, While_kind=9, If_kind=10, With_kind=11,
|
|
||||||
Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14,
|
|
||||||
Assert_kind=15, Import_kind=16, ImportFrom_kind=17,
|
|
||||||
Exec_kind=18, Global_kind=19, Expr_kind=20, Pass_kind=21,
|
|
||||||
Break_kind=22, Continue_kind=23};
|
|
||||||
struct _stmt {
|
|
||||||
enum _stmt_kind kind;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
identifier name;
|
|
||||||
arguments_ty args;
|
|
||||||
asdl_seq *body;
|
|
||||||
asdl_seq *decorator_list;
|
|
||||||
} FunctionDef;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
identifier name;
|
|
||||||
asdl_seq *bases;
|
|
||||||
asdl_seq *body;
|
|
||||||
asdl_seq *decorator_list;
|
|
||||||
} ClassDef;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty value;
|
|
||||||
} Return;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *targets;
|
|
||||||
} Delete;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *targets;
|
|
||||||
expr_ty value;
|
|
||||||
} Assign;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty target;
|
|
||||||
operator_ty op;
|
|
||||||
expr_ty value;
|
|
||||||
} AugAssign;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty dest;
|
|
||||||
asdl_seq *values;
|
|
||||||
bool nl;
|
|
||||||
} Print;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty target;
|
|
||||||
expr_ty iter;
|
|
||||||
asdl_seq *body;
|
|
||||||
asdl_seq *orelse;
|
|
||||||
} For;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty test;
|
|
||||||
asdl_seq *body;
|
|
||||||
asdl_seq *orelse;
|
|
||||||
} While;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty test;
|
|
||||||
asdl_seq *body;
|
|
||||||
asdl_seq *orelse;
|
|
||||||
} If;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty context_expr;
|
|
||||||
expr_ty optional_vars;
|
|
||||||
asdl_seq *body;
|
|
||||||
} With;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty type;
|
|
||||||
expr_ty inst;
|
|
||||||
expr_ty tback;
|
|
||||||
} Raise;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *body;
|
|
||||||
asdl_seq *handlers;
|
|
||||||
asdl_seq *orelse;
|
|
||||||
} TryExcept;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *body;
|
|
||||||
asdl_seq *finalbody;
|
|
||||||
} TryFinally;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty test;
|
|
||||||
expr_ty msg;
|
|
||||||
} Assert;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *names;
|
|
||||||
} Import;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
identifier module;
|
|
||||||
asdl_seq *names;
|
|
||||||
int level;
|
|
||||||
} ImportFrom;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty body;
|
|
||||||
expr_ty globals;
|
|
||||||
expr_ty locals;
|
|
||||||
} Exec;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *names;
|
|
||||||
} Global;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty value;
|
|
||||||
} Expr;
|
|
||||||
|
|
||||||
} v;
|
|
||||||
int lineno;
|
|
||||||
int col_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
|
|
||||||
IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8,
|
|
||||||
SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,
|
|
||||||
Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15,
|
|
||||||
Num_kind=16, Str_kind=17, Attribute_kind=18,
|
|
||||||
Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22};
|
|
||||||
struct _expr {
|
|
||||||
enum _expr_kind kind;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
boolop_ty op;
|
|
||||||
asdl_seq *values;
|
|
||||||
} BoolOp;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty left;
|
|
||||||
operator_ty op;
|
|
||||||
expr_ty right;
|
|
||||||
} BinOp;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
unaryop_ty op;
|
|
||||||
expr_ty operand;
|
|
||||||
} UnaryOp;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
arguments_ty args;
|
|
||||||
expr_ty body;
|
|
||||||
} Lambda;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty test;
|
|
||||||
expr_ty body;
|
|
||||||
expr_ty orelse;
|
|
||||||
} IfExp;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *keys;
|
|
||||||
asdl_seq *values;
|
|
||||||
} Dict;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *elts;
|
|
||||||
} Set;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty elt;
|
|
||||||
asdl_seq *generators;
|
|
||||||
} ListComp;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty elt;
|
|
||||||
asdl_seq *generators;
|
|
||||||
} SetComp;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty key;
|
|
||||||
expr_ty value;
|
|
||||||
asdl_seq *generators;
|
|
||||||
} DictComp;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty elt;
|
|
||||||
asdl_seq *generators;
|
|
||||||
} GeneratorExp;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty value;
|
|
||||||
} Yield;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty left;
|
|
||||||
asdl_int_seq *ops;
|
|
||||||
asdl_seq *comparators;
|
|
||||||
} Compare;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty func;
|
|
||||||
asdl_seq *args;
|
|
||||||
asdl_seq *keywords;
|
|
||||||
expr_ty starargs;
|
|
||||||
expr_ty kwargs;
|
|
||||||
} Call;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty value;
|
|
||||||
} Repr;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
object n;
|
|
||||||
} Num;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
string s;
|
|
||||||
} Str;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty value;
|
|
||||||
identifier attr;
|
|
||||||
expr_context_ty ctx;
|
|
||||||
} Attribute;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty value;
|
|
||||||
slice_ty slice;
|
|
||||||
expr_context_ty ctx;
|
|
||||||
} Subscript;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
identifier id;
|
|
||||||
expr_context_ty ctx;
|
|
||||||
} Name;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *elts;
|
|
||||||
expr_context_ty ctx;
|
|
||||||
} List;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *elts;
|
|
||||||
expr_context_ty ctx;
|
|
||||||
} Tuple;
|
|
||||||
|
|
||||||
} v;
|
|
||||||
int lineno;
|
|
||||||
int col_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum _slice_kind {Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4};
|
|
||||||
struct _slice {
|
|
||||||
enum _slice_kind kind;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
expr_ty lower;
|
|
||||||
expr_ty upper;
|
|
||||||
expr_ty step;
|
|
||||||
} Slice;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
asdl_seq *dims;
|
|
||||||
} ExtSlice;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
expr_ty value;
|
|
||||||
} Index;
|
|
||||||
|
|
||||||
} v;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _comprehension {
|
|
||||||
expr_ty target;
|
|
||||||
expr_ty iter;
|
|
||||||
asdl_seq *ifs;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum _excepthandler_kind {ExceptHandler_kind=1};
|
|
||||||
struct _excepthandler {
|
|
||||||
enum _excepthandler_kind kind;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
expr_ty type;
|
|
||||||
expr_ty name;
|
|
||||||
asdl_seq *body;
|
|
||||||
} ExceptHandler;
|
|
||||||
|
|
||||||
} v;
|
|
||||||
int lineno;
|
|
||||||
int col_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _arguments {
|
|
||||||
asdl_seq *args;
|
|
||||||
identifier vararg;
|
|
||||||
identifier kwarg;
|
|
||||||
asdl_seq *defaults;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _keyword {
|
|
||||||
identifier arg;
|
|
||||||
expr_ty value;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _alias {
|
|
||||||
identifier name;
|
|
||||||
identifier asname;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define Module(a0, a1) _Py_Module(a0, a1)
|
|
||||||
mod_ty _Py_Module(asdl_seq * body, PyArena *arena);
|
|
||||||
#define Interactive(a0, a1) _Py_Interactive(a0, a1)
|
|
||||||
mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena);
|
|
||||||
#define Expression(a0, a1) _Py_Expression(a0, a1)
|
|
||||||
mod_ty _Py_Expression(expr_ty body, PyArena *arena);
|
|
||||||
#define Suite(a0, a1) _Py_Suite(a0, a1)
|
|
||||||
mod_ty _Py_Suite(asdl_seq * body, PyArena *arena);
|
|
||||||
#define FunctionDef(a0, a1, a2, a3, a4, a5, a6) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6)
|
|
||||||
stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
|
|
||||||
asdl_seq * decorator_list, int lineno, int col_offset,
|
|
||||||
PyArena *arena);
|
|
||||||
#define ClassDef(a0, a1, a2, a3, a4, a5, a6) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6)
|
|
||||||
stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * body,
|
|
||||||
asdl_seq * decorator_list, int lineno, int col_offset,
|
|
||||||
PyArena *arena);
|
|
||||||
#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3)
|
|
||||||
stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3)
|
|
||||||
stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena
|
|
||||||
*arena);
|
|
||||||
#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4)
|
|
||||||
stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
|
|
||||||
lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Print(a0, a1, a2, a3, a4, a5) _Py_Print(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6)
|
|
||||||
stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
|
|
||||||
orelse, int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
|
|
||||||
int col_offset, PyArena *arena);
|
|
||||||
#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
|
|
||||||
int col_offset, PyArena *arena);
|
|
||||||
#define With(a0, a1, a2, a3, a4, a5) _Py_With(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body,
|
|
||||||
int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Raise(a0, a1, a2, a3, a4, a5) _Py_Raise(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define TryExcept(a0, a1, a2, a3, a4, a5) _Py_TryExcept(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
|
|
||||||
int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define TryFinally(a0, a1, a2, a3, a4) _Py_TryFinally(a0, a1, a2, a3, a4)
|
|
||||||
stmt_ty _Py_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4)
|
|
||||||
stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
|
|
||||||
PyArena *arena);
|
|
||||||
#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3)
|
|
||||||
stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena
|
|
||||||
*arena);
|
|
||||||
#define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int
|
|
||||||
lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Exec(a0, a1, a2, a3, a4, a5) _Py_Exec(a0, a1, a2, a3, a4, a5)
|
|
||||||
stmt_ty _Py_Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3)
|
|
||||||
stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena
|
|
||||||
*arena);
|
|
||||||
#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3)
|
|
||||||
stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2)
|
|
||||||
stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Break(a0, a1, a2) _Py_Break(a0, a1, a2)
|
|
||||||
stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2)
|
|
||||||
stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset,
|
|
||||||
PyArena *arena);
|
|
||||||
#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5)
|
|
||||||
expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset,
|
|
||||||
PyArena *arena);
|
|
||||||
#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset,
|
|
||||||
PyArena *arena);
|
|
||||||
#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5)
|
|
||||||
expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3)
|
|
||||||
expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5)
|
|
||||||
expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int
|
|
||||||
lineno, int col_offset, PyArena *arena);
|
|
||||||
#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3)
|
|
||||||
expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5)
|
|
||||||
expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,
|
|
||||||
int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7)
|
|
||||||
expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
|
|
||||||
starargs, expr_ty kwargs, int lineno, int col_offset, PyArena
|
|
||||||
*arena);
|
|
||||||
#define Repr(a0, a1, a2, a3) _Py_Repr(a0, a1, a2, a3)
|
|
||||||
expr_ty _Py_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3)
|
|
||||||
expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3)
|
|
||||||
expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5)
|
|
||||||
expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
|
|
||||||
lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5)
|
|
||||||
expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
|
|
||||||
lineno, int col_offset, PyArena *arena);
|
|
||||||
#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4)
|
|
||||||
expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int
|
|
||||||
col_offset, PyArena *arena);
|
|
||||||
#define Ellipsis(a0) _Py_Ellipsis(a0)
|
|
||||||
slice_ty _Py_Ellipsis(PyArena *arena);
|
|
||||||
#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3)
|
|
||||||
slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
|
|
||||||
#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1)
|
|
||||||
slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena);
|
|
||||||
#define Index(a0, a1) _Py_Index(a0, a1)
|
|
||||||
slice_ty _Py_Index(expr_ty value, PyArena *arena);
|
|
||||||
#define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3)
|
|
||||||
comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq *
|
|
||||||
ifs, PyArena *arena);
|
|
||||||
#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5)
|
|
||||||
excepthandler_ty _Py_ExceptHandler(expr_ty type, expr_ty name, asdl_seq * body,
|
|
||||||
int lineno, int col_offset, PyArena *arena);
|
|
||||||
#define arguments(a0, a1, a2, a3, a4) _Py_arguments(a0, a1, a2, a3, a4)
|
|
||||||
arguments_ty _Py_arguments(asdl_seq * args, identifier vararg, identifier
|
|
||||||
kwarg, asdl_seq * defaults, PyArena *arena);
|
|
||||||
#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2)
|
|
||||||
keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena);
|
|
||||||
#define alias(a0, a1, a2) _Py_alias(a0, a1, a2)
|
|
||||||
alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena);
|
|
||||||
|
|
||||||
PyObject* PyAST_mod2obj(mod_ty t);
|
|
||||||
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
|
|
||||||
int PyAST_Check(PyObject* obj);
|
|
|
@ -1,178 +0,0 @@
|
||||||
#ifndef Py_PYTHON_H
|
|
||||||
#define Py_PYTHON_H
|
|
||||||
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
|
|
||||||
|
|
||||||
/* Include nearly all Python header files */
|
|
||||||
|
|
||||||
#include "patchlevel.h"
|
|
||||||
#include "pyconfig.h"
|
|
||||||
#include "pymacconfig.h"
|
|
||||||
|
|
||||||
/* Cyclic gc is always enabled, starting with release 2.3a1. Supply the
|
|
||||||
* old symbol for the benefit of extension modules written before then
|
|
||||||
* that may be conditionalizing on it. The core doesn't use it anymore.
|
|
||||||
*/
|
|
||||||
#ifndef WITH_CYCLE_GC
|
|
||||||
#define WITH_CYCLE_GC 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#ifndef UCHAR_MAX
|
|
||||||
#error "Something's broken. UCHAR_MAX should be defined in limits.h."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UCHAR_MAX != 255
|
|
||||||
#error "Python's source code assumes C's unsigned char is an 8-bit type."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
|
|
||||||
#define _SGI_MP_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#ifndef NULL
|
|
||||||
# error "Python.h requires that stdio.h define NULL."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#ifdef HAVE_ERRNO_H
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For size_t? */
|
|
||||||
#ifdef HAVE_STDDEF_H
|
|
||||||
#include <stddef.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* CAUTION: Build setups should ensure that NDEBUG is defined on the
|
|
||||||
* compiler command line when building Python in release mode; else
|
|
||||||
* assert() calls won't be removed.
|
|
||||||
*/
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "pyport.h"
|
|
||||||
|
|
||||||
/* pyconfig.h or pyport.h may or may not define DL_IMPORT */
|
|
||||||
#ifndef DL_IMPORT /* declarations for DLL import/export */
|
|
||||||
#define DL_IMPORT(RTYPE) RTYPE
|
|
||||||
#endif
|
|
||||||
#ifndef DL_EXPORT /* declarations for DLL import/export */
|
|
||||||
#define DL_EXPORT(RTYPE) RTYPE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
|
|
||||||
* PYMALLOC_DEBUG is in error if pymalloc is not in use.
|
|
||||||
*/
|
|
||||||
#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
|
|
||||||
#define PYMALLOC_DEBUG
|
|
||||||
#endif
|
|
||||||
#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
|
|
||||||
#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
|
|
||||||
#endif
|
|
||||||
#include "pymath.h"
|
|
||||||
#include "pymem.h"
|
|
||||||
|
|
||||||
#include "object.h"
|
|
||||||
#include "objimpl.h"
|
|
||||||
|
|
||||||
#include "pydebug.h"
|
|
||||||
|
|
||||||
#include "unicodeobject.h"
|
|
||||||
#include "intobject.h"
|
|
||||||
#include "boolobject.h"
|
|
||||||
#include "longobject.h"
|
|
||||||
#include "floatobject.h"
|
|
||||||
#ifndef WITHOUT_COMPLEX
|
|
||||||
#include "complexobject.h"
|
|
||||||
#endif
|
|
||||||
#include "rangeobject.h"
|
|
||||||
#include "stringobject.h"
|
|
||||||
#include "memoryobject.h"
|
|
||||||
#include "bufferobject.h"
|
|
||||||
#include "bytesobject.h"
|
|
||||||
#include "bytearrayobject.h"
|
|
||||||
#include "tupleobject.h"
|
|
||||||
#include "listobject.h"
|
|
||||||
#include "dictobject.h"
|
|
||||||
#include "enumobject.h"
|
|
||||||
#include "setobject.h"
|
|
||||||
#include "methodobject.h"
|
|
||||||
#include "moduleobject.h"
|
|
||||||
#include "funcobject.h"
|
|
||||||
#include "classobject.h"
|
|
||||||
#include "fileobject.h"
|
|
||||||
#include "cobject.h"
|
|
||||||
#include "pycapsule.h"
|
|
||||||
#include "traceback.h"
|
|
||||||
#include "sliceobject.h"
|
|
||||||
#include "cellobject.h"
|
|
||||||
#include "iterobject.h"
|
|
||||||
#include "genobject.h"
|
|
||||||
#include "descrobject.h"
|
|
||||||
#include "warnings.h"
|
|
||||||
#include "weakrefobject.h"
|
|
||||||
|
|
||||||
#include "codecs.h"
|
|
||||||
#include "pyerrors.h"
|
|
||||||
|
|
||||||
#include "pystate.h"
|
|
||||||
|
|
||||||
#include "pyarena.h"
|
|
||||||
#include "modsupport.h"
|
|
||||||
#include "pythonrun.h"
|
|
||||||
#include "ceval.h"
|
|
||||||
#include "sysmodule.h"
|
|
||||||
#include "intrcheck.h"
|
|
||||||
#include "import.h"
|
|
||||||
|
|
||||||
#include "abstract.h"
|
|
||||||
|
|
||||||
#include "compile.h"
|
|
||||||
#include "eval.h"
|
|
||||||
|
|
||||||
#include "pyctype.h"
|
|
||||||
#include "pystrtod.h"
|
|
||||||
#include "pystrcmp.h"
|
|
||||||
#include "dtoa.h"
|
|
||||||
|
|
||||||
/* _Py_Mangle is defined in compile.c */
|
|
||||||
PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
|
|
||||||
|
|
||||||
/* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */
|
|
||||||
#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
|
|
||||||
|
|
||||||
/* PyArg_NoArgs should not be necessary.
|
|
||||||
Set ml_flags in the PyMethodDef to METH_NOARGS. */
|
|
||||||
#define PyArg_NoArgs(v) PyArg_Parse(v, "")
|
|
||||||
|
|
||||||
/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
|
|
||||||
#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
|
|
||||||
|
|
||||||
#include "pyfpe.h"
|
|
||||||
|
|
||||||
/* These definitions must match corresponding definitions in graminit.h.
|
|
||||||
There's code in compile.c that checks that they are the same. */
|
|
||||||
#define Py_single_input 256
|
|
||||||
#define Py_file_input 257
|
|
||||||
#define Py_eval_input 258
|
|
||||||
|
|
||||||
#ifdef HAVE_PTH
|
|
||||||
/* GNU pth user-space thread support */
|
|
||||||
#include <pth.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define macros for inline documentation. */
|
|
||||||
#define PyDoc_VAR(name) static char name[]
|
|
||||||
#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
|
|
||||||
#ifdef WITH_DOC_STRINGS
|
|
||||||
#define PyDoc_STR(str) str
|
|
||||||
#else
|
|
||||||
#define PyDoc_STR(str) ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !Py_PYTHON_H */
|
|
|
@ -1,45 +0,0 @@
|
||||||
#ifndef Py_ASDL_H
|
|
||||||
#define Py_ASDL_H
|
|
||||||
|
|
||||||
typedef PyObject * identifier;
|
|
||||||
typedef PyObject * string;
|
|
||||||
typedef PyObject * object;
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
typedef enum {false, true} bool;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* It would be nice if the code generated by asdl_c.py was completely
|
|
||||||
independent of Python, but it is a goal the requires too much work
|
|
||||||
at this stage. So, for example, I'll represent identifiers as
|
|
||||||
interned Python strings.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* XXX A sequence should be typed so that its use can be typechecked. */
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int size;
|
|
||||||
void *elements[1];
|
|
||||||
} asdl_seq;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int size;
|
|
||||||
int elements[1];
|
|
||||||
} asdl_int_seq;
|
|
||||||
|
|
||||||
asdl_seq *asdl_seq_new(int size, PyArena *arena);
|
|
||||||
asdl_int_seq *asdl_int_seq_new(int size, PyArena *arena);
|
|
||||||
|
|
||||||
#define asdl_seq_GET(S, I) (S)->elements[(I)]
|
|
||||||
#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
|
|
||||||
#ifdef Py_DEBUG
|
|
||||||
#define asdl_seq_SET(S, I, V) { \
|
|
||||||
int _asdl_i = (I); \
|
|
||||||
assert((S) && _asdl_i < (S)->size); \
|
|
||||||
(S)->elements[_asdl_i] = (V); \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !Py_ASDL_H */
|
|
|
@ -1,13 +0,0 @@
|
||||||
#ifndef Py_AST_H
|
|
||||||
#define Py_AST_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(mod_ty) PyAST_FromNode(const node *, PyCompilerFlags *flags,
|
|
||||||
const char *, PyArena *);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_AST_H */
|
|
|
@ -1,33 +0,0 @@
|
||||||
|
|
||||||
/* Buffer object interface */
|
|
||||||
|
|
||||||
/* Note: the object's structure is private */
|
|
||||||
|
|
||||||
#ifndef Py_BUFFEROBJECT_H
|
|
||||||
#define Py_BUFFEROBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyBuffer_Type;
|
|
||||||
|
|
||||||
#define PyBuffer_Check(op) (Py_TYPE(op) == &PyBuffer_Type)
|
|
||||||
|
|
||||||
#define Py_END_OF_BUFFER (-1)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base,
|
|
||||||
Py_ssize_t offset, Py_ssize_t size);
|
|
||||||
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base,
|
|
||||||
Py_ssize_t offset,
|
|
||||||
Py_ssize_t size);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, Py_ssize_t size);
|
|
||||||
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyBuffer_New(Py_ssize_t size);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_BUFFEROBJECT_H */
|
|
|
@ -1,75 +0,0 @@
|
||||||
#ifndef Py_BYTES_CTYPE_H
|
|
||||||
#define Py_BYTES_CTYPE_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The internal implementation behind PyString (bytes) and PyBytes (buffer)
|
|
||||||
* methods of the given names, they operate on ASCII byte strings.
|
|
||||||
*/
|
|
||||||
extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len);
|
|
||||||
extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len);
|
|
||||||
extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len);
|
|
||||||
extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len);
|
|
||||||
extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len);
|
|
||||||
extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len);
|
|
||||||
extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len);
|
|
||||||
|
|
||||||
/* These store their len sized answer in the given preallocated *result arg. */
|
|
||||||
extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len);
|
|
||||||
extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len);
|
|
||||||
extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len);
|
|
||||||
extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len);
|
|
||||||
extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len);
|
|
||||||
|
|
||||||
/* Shared __doc__ strings. */
|
|
||||||
extern const char _Py_isspace__doc__[];
|
|
||||||
extern const char _Py_isalpha__doc__[];
|
|
||||||
extern const char _Py_isalnum__doc__[];
|
|
||||||
extern const char _Py_isdigit__doc__[];
|
|
||||||
extern const char _Py_islower__doc__[];
|
|
||||||
extern const char _Py_isupper__doc__[];
|
|
||||||
extern const char _Py_istitle__doc__[];
|
|
||||||
extern const char _Py_lower__doc__[];
|
|
||||||
extern const char _Py_upper__doc__[];
|
|
||||||
extern const char _Py_title__doc__[];
|
|
||||||
extern const char _Py_capitalize__doc__[];
|
|
||||||
extern const char _Py_swapcase__doc__[];
|
|
||||||
|
|
||||||
/* These are left in for backward compatibility and will be removed
|
|
||||||
in 2.8/3.2 */
|
|
||||||
#define ISLOWER(c) Py_ISLOWER(c)
|
|
||||||
#define ISUPPER(c) Py_ISUPPER(c)
|
|
||||||
#define ISALPHA(c) Py_ISALPHA(c)
|
|
||||||
#define ISDIGIT(c) Py_ISDIGIT(c)
|
|
||||||
#define ISXDIGIT(c) Py_ISXDIGIT(c)
|
|
||||||
#define ISALNUM(c) Py_ISALNUM(c)
|
|
||||||
#define ISSPACE(c) Py_ISSPACE(c)
|
|
||||||
|
|
||||||
#undef islower
|
|
||||||
#define islower(c) undefined_islower(c)
|
|
||||||
#undef isupper
|
|
||||||
#define isupper(c) undefined_isupper(c)
|
|
||||||
#undef isalpha
|
|
||||||
#define isalpha(c) undefined_isalpha(c)
|
|
||||||
#undef isdigit
|
|
||||||
#define isdigit(c) undefined_isdigit(c)
|
|
||||||
#undef isxdigit
|
|
||||||
#define isxdigit(c) undefined_isxdigit(c)
|
|
||||||
#undef isalnum
|
|
||||||
#define isalnum(c) undefined_isalnum(c)
|
|
||||||
#undef isspace
|
|
||||||
#define isspace(c) undefined_isspace(c)
|
|
||||||
|
|
||||||
/* These are left in for backward compatibility and will be removed
|
|
||||||
in 2.8/3.2 */
|
|
||||||
#define TOLOWER(c) Py_TOLOWER(c)
|
|
||||||
#define TOUPPER(c) Py_TOUPPER(c)
|
|
||||||
|
|
||||||
#undef tolower
|
|
||||||
#define tolower(c) undefined_tolower(c)
|
|
||||||
#undef toupper
|
|
||||||
#define toupper(c) undefined_toupper(c)
|
|
||||||
|
|
||||||
/* this is needed because some docs are shared from the .o, not static */
|
|
||||||
#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
|
|
||||||
|
|
||||||
#endif /* !Py_BYTES_CTYPE_H */
|
|
|
@ -1,27 +0,0 @@
|
||||||
#define PyBytesObject PyStringObject
|
|
||||||
#define PyBytes_Type PyString_Type
|
|
||||||
|
|
||||||
#define PyBytes_Check PyString_Check
|
|
||||||
#define PyBytes_CheckExact PyString_CheckExact
|
|
||||||
#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED
|
|
||||||
#define PyBytes_AS_STRING PyString_AS_STRING
|
|
||||||
#define PyBytes_GET_SIZE PyString_GET_SIZE
|
|
||||||
#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS
|
|
||||||
|
|
||||||
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
|
|
||||||
#define PyBytes_FromString PyString_FromString
|
|
||||||
#define PyBytes_FromFormatV PyString_FromFormatV
|
|
||||||
#define PyBytes_FromFormat PyString_FromFormat
|
|
||||||
#define PyBytes_Size PyString_Size
|
|
||||||
#define PyBytes_AsString PyString_AsString
|
|
||||||
#define PyBytes_Repr PyString_Repr
|
|
||||||
#define PyBytes_Concat PyString_Concat
|
|
||||||
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
|
|
||||||
#define _PyBytes_Resize _PyString_Resize
|
|
||||||
#define _PyBytes_Eq _PyString_Eq
|
|
||||||
#define PyBytes_Format PyString_Format
|
|
||||||
#define _PyBytes_FormatLong _PyString_FormatLong
|
|
||||||
#define PyBytes_DecodeEscape PyString_DecodeEscape
|
|
||||||
#define _PyBytes_Join _PyString_Join
|
|
||||||
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
|
|
||||||
#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping
|
|
|
@ -1,73 +0,0 @@
|
||||||
#ifndef Py_CSTRINGIO_H
|
|
||||||
#define Py_CSTRINGIO_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
|
|
||||||
This header provides access to cStringIO objects from C.
|
|
||||||
Functions are provided for calling cStringIO objects and
|
|
||||||
macros are provided for testing whether you have cStringIO
|
|
||||||
objects.
|
|
||||||
|
|
||||||
Before calling any of the functions or macros, you must initialize
|
|
||||||
the routines with:
|
|
||||||
|
|
||||||
PycString_IMPORT
|
|
||||||
|
|
||||||
This would typically be done in your init function.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PycStringIO_CAPSULE_NAME "cStringIO.cStringIO_CAPI"
|
|
||||||
|
|
||||||
#define PycString_IMPORT \
|
|
||||||
PycStringIO = ((struct PycStringIO_CAPI*)PyCapsule_Import(\
|
|
||||||
PycStringIO_CAPSULE_NAME, 0))
|
|
||||||
|
|
||||||
/* Basic functions to manipulate cStringIO objects from C */
|
|
||||||
|
|
||||||
static struct PycStringIO_CAPI {
|
|
||||||
|
|
||||||
/* Read a string from an input object. If the last argument
|
|
||||||
is -1, the remainder will be read.
|
|
||||||
*/
|
|
||||||
int(*cread)(PyObject *, char **, Py_ssize_t);
|
|
||||||
|
|
||||||
/* Read a line from an input object. Returns the length of the read
|
|
||||||
line as an int and a pointer inside the object buffer as char** (so
|
|
||||||
the caller doesn't have to provide its own buffer as destination).
|
|
||||||
*/
|
|
||||||
int(*creadline)(PyObject *, char **);
|
|
||||||
|
|
||||||
/* Write a string to an output object*/
|
|
||||||
int(*cwrite)(PyObject *, const char *, Py_ssize_t);
|
|
||||||
|
|
||||||
/* Get the output object as a Python string (returns new reference). */
|
|
||||||
PyObject *(*cgetvalue)(PyObject *);
|
|
||||||
|
|
||||||
/* Create a new output object */
|
|
||||||
PyObject *(*NewOutput)(int);
|
|
||||||
|
|
||||||
/* Create an input object from a Python string
|
|
||||||
(copies the Python string reference).
|
|
||||||
*/
|
|
||||||
PyObject *(*NewInput)(PyObject *);
|
|
||||||
|
|
||||||
/* The Python types for cStringIO input and output objects.
|
|
||||||
Note that you can do input on an output object.
|
|
||||||
*/
|
|
||||||
PyTypeObject *InputType, *OutputType;
|
|
||||||
|
|
||||||
} *PycStringIO;
|
|
||||||
|
|
||||||
/* These can be used to test if you have one */
|
|
||||||
#define PycStringIO_InputCheck(O) \
|
|
||||||
(Py_TYPE(O)==PycStringIO->InputType)
|
|
||||||
#define PycStringIO_OutputCheck(O) \
|
|
||||||
(Py_TYPE(O)==PycStringIO->OutputType)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_CSTRINGIO_H */
|
|
|
@ -1,153 +0,0 @@
|
||||||
#ifndef Py_CEVAL_H
|
|
||||||
#define Py_CEVAL_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Interface to random parts in ceval.c */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
|
|
||||||
PyObject *, PyObject *, PyObject *);
|
|
||||||
|
|
||||||
/* Inline this */
|
|
||||||
#define PyEval_CallObject(func,arg) \
|
|
||||||
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
|
|
||||||
const char *format, ...);
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
|
|
||||||
const char *methodname,
|
|
||||||
const char *format, ...);
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
|
|
||||||
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
|
|
||||||
|
|
||||||
struct _frame; /* Avoid including frameobject.h */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
|
|
||||||
PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void);
|
|
||||||
PyAPI_FUNC(int) PyEval_GetRestricted(void);
|
|
||||||
|
|
||||||
/* Look at the current frame's (if any) code's co_flags, and turn on
|
|
||||||
the corresponding compiler flags in cf->cf_flags. Return 1 if any
|
|
||||||
flag was set, else return 0. */
|
|
||||||
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) Py_FlushLine(void);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
|
|
||||||
PyAPI_FUNC(int) Py_MakePendingCalls(void);
|
|
||||||
|
|
||||||
/* Protection against deeply nested recursive calls */
|
|
||||||
PyAPI_FUNC(void) Py_SetRecursionLimit(int);
|
|
||||||
PyAPI_FUNC(int) Py_GetRecursionLimit(void);
|
|
||||||
|
|
||||||
#define Py_EnterRecursiveCall(where) \
|
|
||||||
(_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
|
|
||||||
_Py_CheckRecursiveCall(where))
|
|
||||||
#define Py_LeaveRecursiveCall() \
|
|
||||||
(--PyThreadState_GET()->recursion_depth)
|
|
||||||
PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where);
|
|
||||||
PyAPI_DATA(int) _Py_CheckRecursionLimit;
|
|
||||||
#ifdef USE_STACKCHECK
|
|
||||||
# define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit)
|
|
||||||
#else
|
|
||||||
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
|
|
||||||
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc);
|
|
||||||
|
|
||||||
/* this used to be handled on a per-thread basis - now just two globals */
|
|
||||||
PyAPI_DATA(volatile int) _Py_Ticker;
|
|
||||||
PyAPI_DATA(int) _Py_CheckInterval;
|
|
||||||
|
|
||||||
/* Interface for threads.
|
|
||||||
|
|
||||||
A module that plans to do a blocking system call (or something else
|
|
||||||
that lasts a long time and doesn't touch Python data) can allow other
|
|
||||||
threads to run as follows:
|
|
||||||
|
|
||||||
...preparations here...
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
|
||||||
...blocking system call here...
|
|
||||||
Py_END_ALLOW_THREADS
|
|
||||||
...interpret result here...
|
|
||||||
|
|
||||||
The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
|
|
||||||
{}-surrounded block.
|
|
||||||
To leave the block in the middle (e.g., with return), you must insert
|
|
||||||
a line containing Py_BLOCK_THREADS before the return, e.g.
|
|
||||||
|
|
||||||
if (...premature_exit...) {
|
|
||||||
Py_BLOCK_THREADS
|
|
||||||
PyErr_SetFromErrno(PyExc_IOError);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
An alternative is:
|
|
||||||
|
|
||||||
Py_BLOCK_THREADS
|
|
||||||
if (...premature_exit...) {
|
|
||||||
PyErr_SetFromErrno(PyExc_IOError);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
Py_UNBLOCK_THREADS
|
|
||||||
|
|
||||||
For convenience, that the value of 'errno' is restored across
|
|
||||||
Py_END_ALLOW_THREADS and Py_BLOCK_THREADS.
|
|
||||||
|
|
||||||
WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND
|
|
||||||
Py_END_ALLOW_THREADS!!!
|
|
||||||
|
|
||||||
The function PyEval_InitThreads() should be called only from
|
|
||||||
initthread() in "threadmodule.c".
|
|
||||||
|
|
||||||
Note that not yet all candidates have been converted to use this
|
|
||||||
mechanism!
|
|
||||||
*/
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
|
|
||||||
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
|
|
||||||
|
|
||||||
#ifdef WITH_THREAD
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
|
|
||||||
PyAPI_FUNC(void) PyEval_InitThreads(void);
|
|
||||||
PyAPI_FUNC(void) PyEval_AcquireLock(void);
|
|
||||||
PyAPI_FUNC(void) PyEval_ReleaseLock(void);
|
|
||||||
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
|
|
||||||
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
|
|
||||||
PyAPI_FUNC(void) PyEval_ReInitThreads(void);
|
|
||||||
|
|
||||||
#define Py_BEGIN_ALLOW_THREADS { \
|
|
||||||
PyThreadState *_save; \
|
|
||||||
_save = PyEval_SaveThread();
|
|
||||||
#define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
|
|
||||||
#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
|
|
||||||
#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* !WITH_THREAD */
|
|
||||||
|
|
||||||
#define Py_BEGIN_ALLOW_THREADS {
|
|
||||||
#define Py_BLOCK_THREADS
|
|
||||||
#define Py_UNBLOCK_THREADS
|
|
||||||
#define Py_END_ALLOW_THREADS }
|
|
||||||
|
|
||||||
#endif /* !WITH_THREAD */
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_CEVAL_H */
|
|
|
@ -1,83 +0,0 @@
|
||||||
|
|
||||||
/* Class object interface */
|
|
||||||
|
|
||||||
/* Revealing some structures (not for general use) */
|
|
||||||
|
|
||||||
#ifndef Py_CLASSOBJECT_H
|
|
||||||
#define Py_CLASSOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *cl_bases; /* A tuple of class objects */
|
|
||||||
PyObject *cl_dict; /* A dictionary */
|
|
||||||
PyObject *cl_name; /* A string */
|
|
||||||
/* The following three are functions or NULL */
|
|
||||||
PyObject *cl_getattr;
|
|
||||||
PyObject *cl_setattr;
|
|
||||||
PyObject *cl_delattr;
|
|
||||||
PyObject *cl_weakreflist; /* List of weak references */
|
|
||||||
} PyClassObject;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyClassObject *in_class; /* The class object */
|
|
||||||
PyObject *in_dict; /* A dictionary */
|
|
||||||
PyObject *in_weakreflist; /* List of weak references */
|
|
||||||
} PyInstanceObject;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *im_func; /* The callable object implementing the method */
|
|
||||||
PyObject *im_self; /* The instance it is bound to, or NULL */
|
|
||||||
PyObject *im_class; /* The class that asked for the method */
|
|
||||||
PyObject *im_weakreflist; /* List of weak references */
|
|
||||||
} PyMethodObject;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type;
|
|
||||||
|
|
||||||
#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)
|
|
||||||
#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
|
|
||||||
#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *,
|
|
||||||
PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);
|
|
||||||
|
|
||||||
/* Look up attribute with name (a string) on instance object pinst, using
|
|
||||||
* only the instance and base class dicts. If a descriptor is found in
|
|
||||||
* a class dict, the descriptor is returned without calling it.
|
|
||||||
* Returns NULL if nothing found, else a borrowed reference to the
|
|
||||||
* value associated with name in the dict in which name was found.
|
|
||||||
* The point of this routine is that it never calls arbitrary Python
|
|
||||||
* code, so is always "safe": all it does is dict lookups. The function
|
|
||||||
* can't fail, never sets an exception, and NULL is not an error (it just
|
|
||||||
* means "not found").
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);
|
|
||||||
|
|
||||||
/* Macros for direct access to these values. Type checks are *not*
|
|
||||||
done, so use with care. */
|
|
||||||
#define PyMethod_GET_FUNCTION(meth) \
|
|
||||||
(((PyMethodObject *)meth) -> im_func)
|
|
||||||
#define PyMethod_GET_SELF(meth) \
|
|
||||||
(((PyMethodObject *)meth) -> im_self)
|
|
||||||
#define PyMethod_GET_CLASS(meth) \
|
|
||||||
(((PyMethodObject *)meth) -> im_class)
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_CLASSOBJECT_H */
|
|
|
@ -1,89 +0,0 @@
|
||||||
/*
|
|
||||||
CObjects are marked Pending Deprecation as of Python 2.7.
|
|
||||||
The full schedule for 2.x is as follows:
|
|
||||||
- CObjects are marked Pending Deprecation in Python 2.7.
|
|
||||||
- CObjects will be marked Deprecated in Python 2.8
|
|
||||||
(if there is one).
|
|
||||||
- CObjects will be removed in Python 2.9 (if there is one).
|
|
||||||
|
|
||||||
Additionally, for the Python 3.x series:
|
|
||||||
- CObjects were marked Deprecated in Python 3.1.
|
|
||||||
- CObjects will be removed in Python 3.2.
|
|
||||||
|
|
||||||
You should switch all use of CObjects to capsules. Capsules
|
|
||||||
have a safer and more consistent API. For more information,
|
|
||||||
see Include/pycapsule.h, or read the "Capsules" topic in
|
|
||||||
the "Python/C API Reference Manual".
|
|
||||||
|
|
||||||
Python 2.7 no longer uses CObjects itself; all objects which
|
|
||||||
were formerly CObjects are now capsules. Note that this change
|
|
||||||
does not by itself break binary compatibility with extensions
|
|
||||||
built for previous versions of Python--PyCObject_AsVoidPtr()
|
|
||||||
has been changed to also understand capsules.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* original file header comment follows: */
|
|
||||||
|
|
||||||
/* C objects to be exported from one extension module to another.
|
|
||||||
|
|
||||||
C objects are used for communication between extension modules.
|
|
||||||
They provide a way for an extension module to export a C interface
|
|
||||||
to other extension modules, so that extension modules can use the
|
|
||||||
Python import mechanism to link to one another.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef Py_COBJECT_H
|
|
||||||
#define Py_COBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyCObject_Type;
|
|
||||||
|
|
||||||
#define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type)
|
|
||||||
|
|
||||||
/* Create a PyCObject from a pointer to a C object and an optional
|
|
||||||
destructor function. If the second argument is non-null, then it
|
|
||||||
will be called with the first argument if and when the PyCObject is
|
|
||||||
destroyed.
|
|
||||||
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr(
|
|
||||||
void *cobj, void (*destruct)(void*));
|
|
||||||
|
|
||||||
|
|
||||||
/* Create a PyCObject from a pointer to a C object, a description object,
|
|
||||||
and an optional destructor function. If the third argument is non-null,
|
|
||||||
then it will be called with the first and second arguments if and when
|
|
||||||
the PyCObject is destroyed.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc(
|
|
||||||
void *cobj, void *desc, void (*destruct)(void*,void*));
|
|
||||||
|
|
||||||
/* Retrieve a pointer to a C object from a PyCObject. */
|
|
||||||
PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *);
|
|
||||||
|
|
||||||
/* Retrieve a pointer to a description object from a PyCObject. */
|
|
||||||
PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *);
|
|
||||||
|
|
||||||
/* Import a pointer to a C object from a module using a PyCObject. */
|
|
||||||
PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name);
|
|
||||||
|
|
||||||
/* Modify a C object. Fails (==0) if object has a destructor. */
|
|
||||||
PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
void *cobject;
|
|
||||||
void *desc;
|
|
||||||
void (*destructor)(void *);
|
|
||||||
} PyCObject;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_COBJECT_H */
|
|
|
@ -1,40 +0,0 @@
|
||||||
|
|
||||||
#ifndef Py_COMPILE_H
|
|
||||||
#define Py_COMPILE_H
|
|
||||||
|
|
||||||
#include "code.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Public interface */
|
|
||||||
struct _node; /* Declare the existence of this type */
|
|
||||||
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
|
|
||||||
|
|
||||||
/* Future feature support */
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int ff_features; /* flags set by future statements */
|
|
||||||
int ff_lineno; /* line number of last future statement */
|
|
||||||
} PyFutureFeatures;
|
|
||||||
|
|
||||||
#define FUTURE_NESTED_SCOPES "nested_scopes"
|
|
||||||
#define FUTURE_GENERATORS "generators"
|
|
||||||
#define FUTURE_DIVISION "division"
|
|
||||||
#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
|
|
||||||
#define FUTURE_WITH_STATEMENT "with_statement"
|
|
||||||
#define FUTURE_PRINT_FUNCTION "print_function"
|
|
||||||
#define FUTURE_UNICODE_LITERALS "unicode_literals"
|
|
||||||
|
|
||||||
|
|
||||||
struct _mod; /* Declare the existence of this type */
|
|
||||||
PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *,
|
|
||||||
PyCompilerFlags *, PyArena *);
|
|
||||||
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_COMPILE_H */
|
|
|
@ -1,156 +0,0 @@
|
||||||
#ifndef Py_DICTOBJECT_H
|
|
||||||
#define Py_DICTOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Dictionary object type -- mapping from hashable object to object */
|
|
||||||
|
|
||||||
/* The distribution includes a separate file, Objects/dictnotes.txt,
|
|
||||||
describing explorations into dictionary design and optimization.
|
|
||||||
It covers typical dictionary use patterns, the parameters for
|
|
||||||
tuning dictionaries, and several ideas for possible optimizations.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
There are three kinds of slots in the table:
|
|
||||||
|
|
||||||
1. Unused. me_key == me_value == NULL
|
|
||||||
Does not hold an active (key, value) pair now and never did. Unused can
|
|
||||||
transition to Active upon key insertion. This is the only case in which
|
|
||||||
me_key is NULL, and is each slot's initial state.
|
|
||||||
|
|
||||||
2. Active. me_key != NULL and me_key != dummy and me_value != NULL
|
|
||||||
Holds an active (key, value) pair. Active can transition to Dummy upon
|
|
||||||
key deletion. This is the only case in which me_value != NULL.
|
|
||||||
|
|
||||||
3. Dummy. me_key == dummy and me_value == NULL
|
|
||||||
Previously held an active (key, value) pair, but that was deleted and an
|
|
||||||
active pair has not yet overwritten the slot. Dummy can transition to
|
|
||||||
Active upon key insertion. Dummy slots cannot be made Unused again
|
|
||||||
(cannot have me_key set to NULL), else the probe sequence in case of
|
|
||||||
collision would have no way to know they were once active.
|
|
||||||
|
|
||||||
Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to
|
|
||||||
hold a search finger. The me_hash field of Unused or Dummy slots has no
|
|
||||||
meaning otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* PyDict_MINSIZE is the minimum size of a dictionary. This many slots are
|
|
||||||
* allocated directly in the dict object (in the ma_smalltable member).
|
|
||||||
* It must be a power of 2, and at least 4. 8 allows dicts with no more
|
|
||||||
* than 5 active entries to live in ma_smalltable (and so avoid an
|
|
||||||
* additional malloc); instrumentation suggested this suffices for the
|
|
||||||
* majority of dicts (consisting mostly of usually-small instance dicts and
|
|
||||||
* usually-small dicts created to pass keyword arguments).
|
|
||||||
*/
|
|
||||||
#define PyDict_MINSIZE 8
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
/* Cached hash code of me_key. Note that hash codes are C longs.
|
|
||||||
* We have to use Py_ssize_t instead because dict_popitem() abuses
|
|
||||||
* me_hash to hold a search finger.
|
|
||||||
*/
|
|
||||||
Py_ssize_t me_hash;
|
|
||||||
PyObject *me_key;
|
|
||||||
PyObject *me_value;
|
|
||||||
} PyDictEntry;
|
|
||||||
|
|
||||||
/*
|
|
||||||
To ensure the lookup algorithm terminates, there must be at least one Unused
|
|
||||||
slot (NULL key) in the table.
|
|
||||||
The value ma_fill is the number of non-NULL keys (sum of Active and Dummy);
|
|
||||||
ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL
|
|
||||||
values == the number of Active items).
|
|
||||||
To avoid slowing down lookups on a near-full table, we resize the table when
|
|
||||||
it's two-thirds full.
|
|
||||||
*/
|
|
||||||
typedef struct _dictobject PyDictObject;
|
|
||||||
struct _dictobject {
|
|
||||||
PyObject_HEAD
|
|
||||||
Py_ssize_t ma_fill; /* # Active + # Dummy */
|
|
||||||
Py_ssize_t ma_used; /* # Active */
|
|
||||||
|
|
||||||
/* The table contains ma_mask + 1 slots, and that's a power of 2.
|
|
||||||
* We store the mask instead of the size because the mask is more
|
|
||||||
* frequently needed.
|
|
||||||
*/
|
|
||||||
Py_ssize_t ma_mask;
|
|
||||||
|
|
||||||
/* ma_table points to ma_smalltable for small tables, else to
|
|
||||||
* additional malloc'ed memory. ma_table is never NULL! This rule
|
|
||||||
* saves repeated runtime null-tests in the workhorse getitem and
|
|
||||||
* setitem calls.
|
|
||||||
*/
|
|
||||||
PyDictEntry *ma_table;
|
|
||||||
PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
|
|
||||||
PyDictEntry ma_smalltable[PyDict_MINSIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyDict_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyDictIterValue_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyDictIterItem_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyDictKeys_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyDictItems_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyDictValues_Type;
|
|
||||||
|
|
||||||
#define PyDict_Check(op) \
|
|
||||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
|
|
||||||
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
|
|
||||||
#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type)
|
|
||||||
#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type)
|
|
||||||
#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type)
|
|
||||||
/* This excludes Values, since they are not sets. */
|
|
||||||
# define PyDictViewSet_Check(op) \
|
|
||||||
(PyDictKeys_Check(op) || PyDictItems_Check(op))
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyDict_New(void);
|
|
||||||
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
|
|
||||||
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
|
|
||||||
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
|
|
||||||
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
|
|
||||||
PyAPI_FUNC(int) PyDict_Next(
|
|
||||||
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
|
|
||||||
PyAPI_FUNC(int) _PyDict_Next(
|
|
||||||
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
|
|
||||||
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
|
|
||||||
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
|
|
||||||
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
|
|
||||||
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
|
|
||||||
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
|
|
||||||
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
|
|
||||||
PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash);
|
|
||||||
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
|
||||||
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
|
|
||||||
|
|
||||||
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
|
|
||||||
PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
|
|
||||||
|
|
||||||
/* PyDict_Merge updates/merges from a mapping object (an object that
|
|
||||||
supports PyMapping_Keys() and PyObject_GetItem()). If override is true,
|
|
||||||
the last occurrence of a key wins, else the first. The Python
|
|
||||||
dict.update(other) is equivalent to PyDict_Merge(dict, other, 1).
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
|
|
||||||
PyObject *other,
|
|
||||||
int override);
|
|
||||||
|
|
||||||
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
|
|
||||||
iterable objects of length 2. If override is true, the last occurrence
|
|
||||||
of a key wins, else the first. The Python dict constructor dict(seq2)
|
|
||||||
is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1).
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
|
|
||||||
PyObject *seq2,
|
|
||||||
int override);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
|
|
||||||
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
|
|
||||||
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_DICTOBJECT_H */
|
|
|
@ -1,15 +0,0 @@
|
||||||
#ifndef PY_NO_SHORT_FLOAT_REPR
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
|
|
||||||
PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
|
|
||||||
int *decpt, int *sign, char **rve);
|
|
||||||
PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,25 +0,0 @@
|
||||||
|
|
||||||
/* Interface to execute compiled code */
|
|
||||||
|
|
||||||
#ifndef Py_EVAL_H
|
|
||||||
#define Py_EVAL_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co,
|
|
||||||
PyObject *globals,
|
|
||||||
PyObject *locals,
|
|
||||||
PyObject **args, int argc,
|
|
||||||
PyObject **kwds, int kwdc,
|
|
||||||
PyObject **defs, int defc,
|
|
||||||
PyObject *closure);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_EVAL_H */
|
|
|
@ -1,97 +0,0 @@
|
||||||
|
|
||||||
/* File object interface */
|
|
||||||
|
|
||||||
#ifndef Py_FILEOBJECT_H
|
|
||||||
#define Py_FILEOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
FILE *f_fp;
|
|
||||||
PyObject *f_name;
|
|
||||||
PyObject *f_mode;
|
|
||||||
int (*f_close)(FILE *);
|
|
||||||
int f_softspace; /* Flag used by 'print' command */
|
|
||||||
int f_binary; /* Flag which indicates whether the file is
|
|
||||||
open in binary (1) or text (0) mode */
|
|
||||||
char* f_buf; /* Allocated readahead buffer */
|
|
||||||
char* f_bufend; /* Points after last occupied position */
|
|
||||||
char* f_bufptr; /* Current buffer position */
|
|
||||||
char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */
|
|
||||||
int f_univ_newline; /* Handle any newline convention */
|
|
||||||
int f_newlinetypes; /* Types of newlines seen */
|
|
||||||
int f_skipnextlf; /* Skip next \n */
|
|
||||||
PyObject *f_encoding;
|
|
||||||
PyObject *f_errors;
|
|
||||||
PyObject *weakreflist; /* List of weak references */
|
|
||||||
int unlocked_count; /* Num. currently running sections of code
|
|
||||||
using f_fp with the GIL released. */
|
|
||||||
int readable;
|
|
||||||
int writable;
|
|
||||||
} PyFileObject;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyFile_Type;
|
|
||||||
|
|
||||||
#define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type)
|
|
||||||
#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *);
|
|
||||||
PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int);
|
|
||||||
PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *);
|
|
||||||
PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors);
|
|
||||||
PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *,
|
|
||||||
int (*)(FILE *));
|
|
||||||
PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *);
|
|
||||||
PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *);
|
|
||||||
PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
|
||||||
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
|
||||||
PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int);
|
|
||||||
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
|
||||||
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
|
|
||||||
|
|
||||||
/* The default encoding used by the platform file system APIs
|
|
||||||
If non-NULL, this is different than the default encoding for strings
|
|
||||||
*/
|
|
||||||
PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
|
|
||||||
|
|
||||||
/* Routines to replace fread() and fgets() which accept any of \r, \n
|
|
||||||
or \r\n as line terminators.
|
|
||||||
*/
|
|
||||||
#define PY_STDIOTEXTMODE "b"
|
|
||||||
char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
|
|
||||||
size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);
|
|
||||||
|
|
||||||
/* A routine to do sanity checking on the file mode string. returns
|
|
||||||
non-zero on if an exception occurred
|
|
||||||
*/
|
|
||||||
int _PyFile_SanitizeMode(char *mode);
|
|
||||||
|
|
||||||
#if defined _MSC_VER && _MSC_VER >= 1400
|
|
||||||
/* A routine to check if a file descriptor is valid on Windows. Returns 0
|
|
||||||
* and sets errno to EBADF if it isn't. This is to avoid Assertions
|
|
||||||
* from various functions in the Windows CRT beginning with
|
|
||||||
* Visual Studio 2005
|
|
||||||
*/
|
|
||||||
int _PyVerify_fd(int fd);
|
|
||||||
#elif defined _MSC_VER && _MSC_VER >= 1200
|
|
||||||
/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */
|
|
||||||
#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0)
|
|
||||||
#else
|
|
||||||
#define _PyVerify_fd(A) (1) /* dummy */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A routine to check if a file descriptor can be select()-ed. */
|
|
||||||
#ifdef HAVE_SELECT
|
|
||||||
#define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE))
|
|
||||||
#else
|
|
||||||
#define _PyIsSelectable_fd(FD) (1)
|
|
||||||
#endif /* HAVE_SELECT */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_FILEOBJECT_H */
|
|
|
@ -1,140 +0,0 @@
|
||||||
|
|
||||||
/* Float object interface */
|
|
||||||
|
|
||||||
/*
|
|
||||||
PyFloatObject represents a (double precision) floating point number.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef Py_FLOATOBJECT_H
|
|
||||||
#define Py_FLOATOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
double ob_fval;
|
|
||||||
} PyFloatObject;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyFloat_Type;
|
|
||||||
|
|
||||||
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
|
|
||||||
#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
|
|
||||||
|
|
||||||
/* The str() precision PyFloat_STR_PRECISION is chosen so that in most cases,
|
|
||||||
the rounding noise created by various operations is suppressed, while
|
|
||||||
giving plenty of precision for practical use. */
|
|
||||||
|
|
||||||
#define PyFloat_STR_PRECISION 12
|
|
||||||
|
|
||||||
#ifdef Py_NAN
|
|
||||||
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Py_RETURN_INF(sign) do \
|
|
||||||
if (copysign(1., sign) == 1.) { \
|
|
||||||
return PyFloat_FromDouble(Py_HUGE_VAL); \
|
|
||||||
} else { \
|
|
||||||
return PyFloat_FromDouble(-Py_HUGE_VAL); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
PyAPI_FUNC(double) PyFloat_GetMax(void);
|
|
||||||
PyAPI_FUNC(double) PyFloat_GetMin(void);
|
|
||||||
PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void);
|
|
||||||
|
|
||||||
/* Return Python float from string PyObject. Second argument ignored on
|
|
||||||
input, and, if non-NULL, NULL is stored into *junk (this tried to serve a
|
|
||||||
purpose once but can't be made to work as intended). */
|
|
||||||
PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk);
|
|
||||||
|
|
||||||
/* Return Python float from C double. */
|
|
||||||
PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double);
|
|
||||||
|
|
||||||
/* Extract C double from Python float. The macro version trades safety for
|
|
||||||
speed. */
|
|
||||||
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
|
|
||||||
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
|
|
||||||
|
|
||||||
/* Write repr(v) into the char buffer argument, followed by null byte. The
|
|
||||||
buffer must be "big enough"; >= 100 is very safe.
|
|
||||||
PyFloat_AsReprString(buf, x) strives to print enough digits so that
|
|
||||||
PyFloat_FromString(buf) then reproduces x exactly. */
|
|
||||||
PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v);
|
|
||||||
|
|
||||||
/* Write str(v) into the char buffer argument, followed by null byte. The
|
|
||||||
buffer must be "big enough"; >= 100 is very safe. Note that it's
|
|
||||||
unusual to be able to get back the float you started with from
|
|
||||||
PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to
|
|
||||||
preserve precision across conversions. */
|
|
||||||
PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v);
|
|
||||||
|
|
||||||
/* _PyFloat_{Pack,Unpack}{4,8}
|
|
||||||
*
|
|
||||||
* The struct and pickle (at least) modules need an efficient platform-
|
|
||||||
* independent way to store floating-point values as byte strings.
|
|
||||||
* The Pack routines produce a string from a C double, and the Unpack
|
|
||||||
* routines produce a C double from such a string. The suffix (4 or 8)
|
|
||||||
* specifies the number of bytes in the string.
|
|
||||||
*
|
|
||||||
* On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats
|
|
||||||
* these functions work by copying bits. On other platforms, the formats the
|
|
||||||
* 4- byte format is identical to the IEEE-754 single precision format, and
|
|
||||||
* the 8-byte format to the IEEE-754 double precision format, although the
|
|
||||||
* packing of INFs and NaNs (if such things exist on the platform) isn't
|
|
||||||
* handled correctly, and attempting to unpack a string containing an IEEE
|
|
||||||
* INF or NaN will raise an exception.
|
|
||||||
*
|
|
||||||
* On non-IEEE platforms with more precision, or larger dynamic range, than
|
|
||||||
* 754 supports, not all values can be packed; on non-IEEE platforms with less
|
|
||||||
* precision, or smaller dynamic range, not all values can be unpacked. What
|
|
||||||
* happens in such cases is partly accidental (alas).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* The pack routines write 4 or 8 bytes, starting at p. le is a bool
|
|
||||||
* argument, true if you want the string in little-endian format (exponent
|
|
||||||
* last, at p+3 or p+7), false if you want big-endian format (exponent
|
|
||||||
* first, at p).
|
|
||||||
* Return value: 0 if all is OK, -1 if error (and an exception is
|
|
||||||
* set, most likely OverflowError).
|
|
||||||
* There are two problems on non-IEEE platforms:
|
|
||||||
* 1): What this does is undefined if x is a NaN or infinity.
|
|
||||||
* 2): -0.0 and +0.0 produce the same string.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
|
|
||||||
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
|
|
||||||
|
|
||||||
/* Used to get the important decimal digits of a double */
|
|
||||||
PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum);
|
|
||||||
PyAPI_FUNC(void) _PyFloat_DigitsInit(void);
|
|
||||||
|
|
||||||
/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool
|
|
||||||
* argument, true if the string is in little-endian format (exponent
|
|
||||||
* last, at p+3 or p+7), false if big-endian (exponent first, at p).
|
|
||||||
* Return value: The unpacked double. On error, this is -1.0 and
|
|
||||||
* PyErr_Occurred() is true (and an exception is set, most likely
|
|
||||||
* OverflowError). Note that on a non-IEEE platform this will refuse
|
|
||||||
* to unpack a string that represents a NaN or infinity.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
|
|
||||||
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
|
|
||||||
|
|
||||||
/* free list api */
|
|
||||||
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
|
|
||||||
|
|
||||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
|
||||||
(Advanced String Formatting). */
|
|
||||||
PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
|
|
||||||
char *format_spec,
|
|
||||||
Py_ssize_t format_spec_len);
|
|
||||||
|
|
||||||
/* Round a C double x to the closest multiple of 10**-ndigits. Returns a
|
|
||||||
Python float on success, or NULL (with an appropriate exception set) on
|
|
||||||
failure. Used in builtin_round in bltinmodule.c. */
|
|
||||||
PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_FLOATOBJECT_H */
|
|
|
@ -1,89 +0,0 @@
|
||||||
|
|
||||||
/* Frame object interface */
|
|
||||||
|
|
||||||
#ifndef Py_FRAMEOBJECT_H
|
|
||||||
#define Py_FRAMEOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int b_type; /* what kind of block this is */
|
|
||||||
int b_handler; /* where to jump to find handler */
|
|
||||||
int b_level; /* value stack level to pop to */
|
|
||||||
} PyTryBlock;
|
|
||||||
|
|
||||||
typedef struct _frame {
|
|
||||||
PyObject_VAR_HEAD
|
|
||||||
struct _frame *f_back; /* previous frame, or NULL */
|
|
||||||
PyCodeObject *f_code; /* code segment */
|
|
||||||
PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
|
|
||||||
PyObject *f_globals; /* global symbol table (PyDictObject) */
|
|
||||||
PyObject *f_locals; /* local symbol table (any mapping) */
|
|
||||||
PyObject **f_valuestack; /* points after the last local */
|
|
||||||
/* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
|
|
||||||
Frame evaluation usually NULLs it, but a frame that yields sets it
|
|
||||||
to the current stack top. */
|
|
||||||
PyObject **f_stacktop;
|
|
||||||
PyObject *f_trace; /* Trace function */
|
|
||||||
|
|
||||||
/* If an exception is raised in this frame, the next three are used to
|
|
||||||
* record the exception info (if any) originally in the thread state. See
|
|
||||||
* comments before set_exc_info() -- it's not obvious.
|
|
||||||
* Invariant: if _type is NULL, then so are _value and _traceback.
|
|
||||||
* Desired invariant: all three are NULL, or all three are non-NULL. That
|
|
||||||
* one isn't currently true, but "should be".
|
|
||||||
*/
|
|
||||||
PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
|
|
||||||
|
|
||||||
PyThreadState *f_tstate;
|
|
||||||
int f_lasti; /* Last instruction if called */
|
|
||||||
/* Call PyFrame_GetLineNumber() instead of reading this field
|
|
||||||
directly. As of 2.3 f_lineno is only valid when tracing is
|
|
||||||
active (i.e. when f_trace is set). At other times we use
|
|
||||||
PyCode_Addr2Line to calculate the line from the current
|
|
||||||
bytecode index. */
|
|
||||||
int f_lineno; /* Current line number */
|
|
||||||
int f_iblock; /* index in f_blockstack */
|
|
||||||
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
|
|
||||||
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
|
|
||||||
} PyFrameObject;
|
|
||||||
|
|
||||||
|
|
||||||
/* Standard object interface */
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
|
||||||
|
|
||||||
#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
|
|
||||||
#define PyFrame_IsRestricted(f) \
|
|
||||||
((f)->f_builtins != (f)->f_tstate->interp->builtins)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
|
||||||
PyObject *, PyObject *);
|
|
||||||
|
|
||||||
|
|
||||||
/* The rest of the interface is specific for frame objects */
|
|
||||||
|
|
||||||
/* Block management functions */
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
|
|
||||||
PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);
|
|
||||||
|
|
||||||
/* Extend the value stack */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int);
|
|
||||||
|
|
||||||
/* Conversions between "fast locals" and locals in dictionary */
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
|
|
||||||
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
|
|
||||||
|
|
||||||
/* Return the line of code the frame is currently executing. */
|
|
||||||
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_FRAMEOBJECT_H */
|
|
|
@ -1,40 +0,0 @@
|
||||||
|
|
||||||
/* Generator object interface */
|
|
||||||
|
|
||||||
#ifndef Py_GENOBJECT_H
|
|
||||||
#define Py_GENOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct _frame; /* Avoid including frameobject.h */
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
/* The gi_ prefix is intended to remind of generator-iterator. */
|
|
||||||
|
|
||||||
/* Note: gi_frame can be NULL if the generator is "finished" */
|
|
||||||
struct _frame *gi_frame;
|
|
||||||
|
|
||||||
/* True if generator is being executed. */
|
|
||||||
int gi_running;
|
|
||||||
|
|
||||||
/* The code object backing the generator */
|
|
||||||
PyObject *gi_code;
|
|
||||||
|
|
||||||
/* List of weak reference. */
|
|
||||||
PyObject *gi_weakreflist;
|
|
||||||
} PyGenObject;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyGen_Type;
|
|
||||||
|
|
||||||
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
|
|
||||||
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
|
|
||||||
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_GENOBJECT_H */
|
|
|
@ -1,87 +0,0 @@
|
||||||
/* Generated by Parser/pgen */
|
|
||||||
|
|
||||||
#define single_input 256
|
|
||||||
#define file_input 257
|
|
||||||
#define eval_input 258
|
|
||||||
#define decorator 259
|
|
||||||
#define decorators 260
|
|
||||||
#define decorated 261
|
|
||||||
#define funcdef 262
|
|
||||||
#define parameters 263
|
|
||||||
#define varargslist 264
|
|
||||||
#define fpdef 265
|
|
||||||
#define fplist 266
|
|
||||||
#define stmt 267
|
|
||||||
#define simple_stmt 268
|
|
||||||
#define small_stmt 269
|
|
||||||
#define expr_stmt 270
|
|
||||||
#define augassign 271
|
|
||||||
#define print_stmt 272
|
|
||||||
#define del_stmt 273
|
|
||||||
#define pass_stmt 274
|
|
||||||
#define flow_stmt 275
|
|
||||||
#define break_stmt 276
|
|
||||||
#define continue_stmt 277
|
|
||||||
#define return_stmt 278
|
|
||||||
#define yield_stmt 279
|
|
||||||
#define raise_stmt 280
|
|
||||||
#define import_stmt 281
|
|
||||||
#define import_name 282
|
|
||||||
#define import_from 283
|
|
||||||
#define import_as_name 284
|
|
||||||
#define dotted_as_name 285
|
|
||||||
#define import_as_names 286
|
|
||||||
#define dotted_as_names 287
|
|
||||||
#define dotted_name 288
|
|
||||||
#define global_stmt 289
|
|
||||||
#define exec_stmt 290
|
|
||||||
#define assert_stmt 291
|
|
||||||
#define compound_stmt 292
|
|
||||||
#define if_stmt 293
|
|
||||||
#define while_stmt 294
|
|
||||||
#define for_stmt 295
|
|
||||||
#define try_stmt 296
|
|
||||||
#define with_stmt 297
|
|
||||||
#define with_item 298
|
|
||||||
#define except_clause 299
|
|
||||||
#define suite 300
|
|
||||||
#define testlist_safe 301
|
|
||||||
#define old_test 302
|
|
||||||
#define old_lambdef 303
|
|
||||||
#define test 304
|
|
||||||
#define or_test 305
|
|
||||||
#define and_test 306
|
|
||||||
#define not_test 307
|
|
||||||
#define comparison 308
|
|
||||||
#define comp_op 309
|
|
||||||
#define expr 310
|
|
||||||
#define xor_expr 311
|
|
||||||
#define and_expr 312
|
|
||||||
#define shift_expr 313
|
|
||||||
#define arith_expr 314
|
|
||||||
#define term 315
|
|
||||||
#define factor 316
|
|
||||||
#define power 317
|
|
||||||
#define atom 318
|
|
||||||
#define listmaker 319
|
|
||||||
#define testlist_comp 320
|
|
||||||
#define lambdef 321
|
|
||||||
#define trailer 322
|
|
||||||
#define subscriptlist 323
|
|
||||||
#define subscript 324
|
|
||||||
#define sliceop 325
|
|
||||||
#define exprlist 326
|
|
||||||
#define testlist 327
|
|
||||||
#define dictorsetmaker 328
|
|
||||||
#define classdef 329
|
|
||||||
#define arglist 330
|
|
||||||
#define argument 331
|
|
||||||
#define list_iter 332
|
|
||||||
#define list_for 333
|
|
||||||
#define list_if 334
|
|
||||||
#define comp_iter 335
|
|
||||||
#define comp_for 336
|
|
||||||
#define comp_if 337
|
|
||||||
#define testlist1 338
|
|
||||||
#define encoding_decl 339
|
|
||||||
#define yield_expr 340
|
|
|
@ -1,71 +0,0 @@
|
||||||
|
|
||||||
/* Module definition and import interface */
|
|
||||||
|
|
||||||
#ifndef Py_IMPORT_H
|
|
||||||
#define Py_IMPORT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
|
||||||
char *name, PyObject *co, char *pathname);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name,
|
|
||||||
PyObject *globals, PyObject *locals, PyObject *fromlist, int level);
|
|
||||||
|
|
||||||
#define PyImport_ImportModuleEx(n, g, l, f) \
|
|
||||||
PyImport_ImportModuleLevel(n, g, l, f, -1)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
|
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
|
|
||||||
PyAPI_FUNC(void) PyImport_Cleanup(void);
|
|
||||||
PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
|
|
||||||
|
|
||||||
#ifdef WITH_THREAD
|
|
||||||
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
|
|
||||||
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
|
|
||||||
#else
|
|
||||||
#define _PyImport_AcquireLock()
|
|
||||||
#define _PyImport_ReleaseLock() 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
|
|
||||||
const char *, PyObject *, char *, size_t, FILE **, PyObject **);
|
|
||||||
PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *);
|
|
||||||
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
|
|
||||||
PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *);
|
|
||||||
|
|
||||||
struct _inittab {
|
|
||||||
char *name;
|
|
||||||
void (*initfunc)(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
|
|
||||||
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void));
|
|
||||||
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
|
|
||||||
|
|
||||||
struct _frozen {
|
|
||||||
char *name;
|
|
||||||
unsigned char *code;
|
|
||||||
int size;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Embedding apps may change this pointer to point to their favorite
|
|
||||||
collection of frozen modules: */
|
|
||||||
|
|
||||||
PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_IMPORT_H */
|
|
|
@ -1,81 +0,0 @@
|
||||||
|
|
||||||
/* Integer object interface */
|
|
||||||
|
|
||||||
/*
|
|
||||||
PyIntObject represents a (long) integer. This is an immutable object;
|
|
||||||
an integer cannot change its value after creation.
|
|
||||||
|
|
||||||
There are functions to create new integer objects, to test an object
|
|
||||||
for integer-ness, and to get the integer value. The latter functions
|
|
||||||
returns -1 and sets errno to EBADF if the object is not an PyIntObject.
|
|
||||||
None of the functions should be applied to nil objects.
|
|
||||||
|
|
||||||
The type PyIntObject is (unfortunately) exposed here so we can declare
|
|
||||||
_Py_TrueStruct and _Py_ZeroStruct in boolobject.h; don't use this.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef Py_INTOBJECT_H
|
|
||||||
#define Py_INTOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
long ob_ival;
|
|
||||||
} PyIntObject;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyInt_Type;
|
|
||||||
|
|
||||||
#define PyInt_Check(op) \
|
|
||||||
PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS)
|
|
||||||
#define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
|
|
||||||
#ifdef Py_USING_UNICODE
|
|
||||||
PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
|
|
||||||
#endif
|
|
||||||
PyAPI_FUNC(PyObject *) PyInt_FromLong(long);
|
|
||||||
PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t);
|
|
||||||
PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t);
|
|
||||||
PyAPI_FUNC(long) PyInt_AsLong(PyObject *);
|
|
||||||
PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *);
|
|
||||||
PyAPI_FUNC(int) _PyInt_AsInt(PyObject *);
|
|
||||||
PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *);
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(long) PyInt_GetMax(void);
|
|
||||||
|
|
||||||
/* Macro, trading safety for speed */
|
|
||||||
#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
|
|
||||||
|
|
||||||
/* These aren't really part of the Int object, but they're handy; the protos
|
|
||||||
* are necessary for systems that need the magic of PyAPI_FUNC and that want
|
|
||||||
* to have stropmodule as a dynamically loaded module instead of building it
|
|
||||||
* into the main Python shared library/DLL. Guido thinks I'm weird for
|
|
||||||
* building it this way. :-) [cjh]
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int);
|
|
||||||
PyAPI_FUNC(long) PyOS_strtol(char *, char **, int);
|
|
||||||
|
|
||||||
/* free list api */
|
|
||||||
PyAPI_FUNC(int) PyInt_ClearFreeList(void);
|
|
||||||
|
|
||||||
/* Convert an integer to the given base. Returns a string.
|
|
||||||
If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'.
|
|
||||||
If newstyle is zero, then use the pre-2.6 behavior of octal having
|
|
||||||
a leading "0" */
|
|
||||||
PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle);
|
|
||||||
|
|
||||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
|
||||||
(Advanced String Formatting). */
|
|
||||||
PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj,
|
|
||||||
char *format_spec,
|
|
||||||
Py_ssize_t format_spec_len);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_INTOBJECT_H */
|
|
|
@ -1,15 +0,0 @@
|
||||||
|
|
||||||
#ifndef Py_INTRCHECK_H
|
|
||||||
#define Py_INTRCHECK_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
|
|
||||||
PyAPI_FUNC(void) PyOS_InitInterrupts(void);
|
|
||||||
PyAPI_FUNC(void) PyOS_AfterFork(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_INTRCHECK_H */
|
|
|
@ -1,135 +0,0 @@
|
||||||
#ifndef Py_LONGOBJECT_H
|
|
||||||
#define Py_LONGOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Long (arbitrary precision) integer object interface */
|
|
||||||
|
|
||||||
typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyLong_Type;
|
|
||||||
|
|
||||||
#define PyLong_Check(op) \
|
|
||||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
|
|
||||||
#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromDouble(double);
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t);
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t);
|
|
||||||
PyAPI_FUNC(long) PyLong_AsLong(PyObject *);
|
|
||||||
PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *);
|
|
||||||
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
|
|
||||||
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
|
|
||||||
PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *);
|
|
||||||
PyAPI_FUNC(int) _PyLong_AsInt(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
|
|
||||||
|
|
||||||
/* For use by intobject.c only */
|
|
||||||
#define _PyLong_AsSsize_t PyLong_AsSsize_t
|
|
||||||
#define _PyLong_FromSize_t PyLong_FromSize_t
|
|
||||||
#define _PyLong_FromSsize_t PyLong_FromSsize_t
|
|
||||||
PyAPI_DATA(int) _PyLong_DigitValue[256];
|
|
||||||
|
|
||||||
/* _PyLong_Frexp returns a double x and an exponent e such that the
|
|
||||||
true value is approximately equal to x * 2**e. e is >= 0. x is
|
|
||||||
0.0 if and only if the input is 0 (in which case, e and x are both
|
|
||||||
zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is
|
|
||||||
possible if the number of bits doesn't fit into a Py_ssize_t, sets
|
|
||||||
OverflowError and returns -1.0 for x, 0 for e. */
|
|
||||||
PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e);
|
|
||||||
|
|
||||||
PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
|
|
||||||
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *);
|
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
|
|
||||||
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
|
|
||||||
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
|
|
||||||
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
|
|
||||||
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
|
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);
|
|
||||||
#ifdef Py_USING_UNICODE
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
|
|
||||||
v must not be NULL, and must be a normalized long.
|
|
||||||
There are no error cases.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
|
|
||||||
|
|
||||||
|
|
||||||
/* _PyLong_NumBits. Return the number of bits needed to represent the
|
|
||||||
absolute value of a long. For example, this returns 1 for 1 and -1, 2
|
|
||||||
for 2 and -2, and 2 for 3 and -3. It returns 0 for 0.
|
|
||||||
v must not be NULL, and must be a normalized long.
|
|
||||||
(size_t)-1 is returned and OverflowError set if the true result doesn't
|
|
||||||
fit in a size_t.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
|
|
||||||
|
|
||||||
/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in
|
|
||||||
base 256, and return a Python long with the same numeric value.
|
|
||||||
If n is 0, the integer is 0. Else:
|
|
||||||
If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB;
|
|
||||||
else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the
|
|
||||||
LSB.
|
|
||||||
If is_signed is 0/false, view the bytes as a non-negative integer.
|
|
||||||
If is_signed is 1/true, view the bytes as a 2's-complement integer,
|
|
||||||
non-negative if bit 0x80 of the MSB is clear, negative if set.
|
|
||||||
Error returns:
|
|
||||||
+ Return NULL with the appropriate exception set if there's not
|
|
||||||
enough memory to create the Python long.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
|
|
||||||
const unsigned char* bytes, size_t n,
|
|
||||||
int little_endian, int is_signed);
|
|
||||||
|
|
||||||
/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long
|
|
||||||
v to a base-256 integer, stored in array bytes. Normally return 0,
|
|
||||||
return -1 on error.
|
|
||||||
If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at
|
|
||||||
bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and
|
|
||||||
the LSB at bytes[n-1].
|
|
||||||
If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes
|
|
||||||
are filled and there's nothing special about bit 0x80 of the MSB.
|
|
||||||
If is_signed is 1/true, bytes is filled with the 2's-complement
|
|
||||||
representation of v's value. Bit 0x80 of the MSB is the sign bit.
|
|
||||||
Error returns (-1):
|
|
||||||
+ is_signed is 0 and v < 0. TypeError is set in this case, and bytes
|
|
||||||
isn't altered.
|
|
||||||
+ n isn't big enough to hold the full mathematical value of v. For
|
|
||||||
example, if is_signed is 0 and there are more digits in the v than
|
|
||||||
fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of
|
|
||||||
being large enough to hold a sign bit. OverflowError is set in this
|
|
||||||
case, but bytes holds the least-signficant n bytes of the true value.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
|
|
||||||
unsigned char* bytes, size_t n,
|
|
||||||
int little_endian, int is_signed);
|
|
||||||
|
|
||||||
/* _PyLong_Format: Convert the long to a string object with given base,
|
|
||||||
appending a base prefix of 0[box] if base is 2, 8 or 16.
|
|
||||||
Add a trailing "L" if addL is non-zero.
|
|
||||||
If newstyle is zero, then use the pre-2.6 behavior of octal having
|
|
||||||
a leading "0", instead of the prefix "0o" */
|
|
||||||
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle);
|
|
||||||
|
|
||||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
|
||||||
(Advanced String Formatting). */
|
|
||||||
PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj,
|
|
||||||
char *format_spec,
|
|
||||||
Py_ssize_t format_spec_len);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_LONGOBJECT_H */
|
|
|
@ -1,74 +0,0 @@
|
||||||
/* Memory view object. In Python this is available as "memoryview". */
|
|
||||||
|
|
||||||
#ifndef Py_MEMORYOBJECT_H
|
|
||||||
#define Py_MEMORYOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyMemoryView_Type;
|
|
||||||
|
|
||||||
#define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type)
|
|
||||||
|
|
||||||
/* Get a pointer to the underlying Py_buffer of a memoryview object. */
|
|
||||||
#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view)
|
|
||||||
/* Get a pointer to the PyObject from which originates a memoryview object. */
|
|
||||||
#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj)
|
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
|
|
||||||
int buffertype,
|
|
||||||
char fort);
|
|
||||||
|
|
||||||
/* Return a contiguous chunk of memory representing the buffer
|
|
||||||
from an object in a memory view object. If a copy is made then the
|
|
||||||
base object for the memory view will be a *new* bytes object.
|
|
||||||
|
|
||||||
Otherwise, the base-object will be the object itself and no
|
|
||||||
data-copying will be done.
|
|
||||||
|
|
||||||
The buffertype argument can be PyBUF_READ, PyBUF_WRITE,
|
|
||||||
PyBUF_SHADOW to determine whether the returned buffer
|
|
||||||
should be READONLY, WRITABLE, or set to update the
|
|
||||||
original buffer if a copy must be made. If buffertype is
|
|
||||||
PyBUF_WRITE and the buffer is not contiguous an error will
|
|
||||||
be raised. In this circumstance, the user can use
|
|
||||||
PyBUF_SHADOW to ensure that a a writable temporary
|
|
||||||
contiguous buffer is returned. The contents of this
|
|
||||||
contiguous buffer will be copied back into the original
|
|
||||||
object after the memoryview object is deleted as long as
|
|
||||||
the original object is writable and allows setting an
|
|
||||||
exclusive write lock. If this is not allowed by the
|
|
||||||
original object, then a BufferError is raised.
|
|
||||||
|
|
||||||
If the object is multi-dimensional and if fortran is 'F',
|
|
||||||
the first dimension of the underlying array will vary the
|
|
||||||
fastest in the buffer. If fortran is 'C', then the last
|
|
||||||
dimension will vary the fastest (C-style contiguous). If
|
|
||||||
fortran is 'A', then it does not matter and you will get
|
|
||||||
whatever the object decides is more efficient.
|
|
||||||
|
|
||||||
A new reference is returned that must be DECREF'd when finished.
|
|
||||||
*/
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info);
|
|
||||||
/* create new if bufptr is NULL
|
|
||||||
will be a new bytesobject in base */
|
|
||||||
|
|
||||||
|
|
||||||
/* The struct is declared here so that macros can work, but it shouldn't
|
|
||||||
be considered public. Don't access those fields directly, use the macros
|
|
||||||
and functions instead! */
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *base;
|
|
||||||
Py_buffer view;
|
|
||||||
} PyMemoryViewObject;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_MEMORYOBJECT_H */
|
|
|
@ -1,93 +0,0 @@
|
||||||
|
|
||||||
/* Method object interface */
|
|
||||||
|
|
||||||
#ifndef Py_METHODOBJECT_H
|
|
||||||
#define Py_METHODOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This is about the type 'builtin_function_or_method',
|
|
||||||
not Python methods in user-defined classes. See classobject.h
|
|
||||||
for the latter. */
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyCFunction_Type;
|
|
||||||
|
|
||||||
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)
|
|
||||||
|
|
||||||
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
|
|
||||||
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
|
|
||||||
PyObject *);
|
|
||||||
typedef PyObject *(*PyNoArgsFunction)(PyObject *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
|
|
||||||
PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
|
|
||||||
|
|
||||||
/* Macros for direct access to these values. Type checks are *not*
|
|
||||||
done, so use with care. */
|
|
||||||
#define PyCFunction_GET_FUNCTION(func) \
|
|
||||||
(((PyCFunctionObject *)func) -> m_ml -> ml_meth)
|
|
||||||
#define PyCFunction_GET_SELF(func) \
|
|
||||||
(((PyCFunctionObject *)func) -> m_self)
|
|
||||||
#define PyCFunction_GET_FLAGS(func) \
|
|
||||||
(((PyCFunctionObject *)func) -> m_ml -> ml_flags)
|
|
||||||
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
|
|
||||||
|
|
||||||
struct PyMethodDef {
|
|
||||||
const char *ml_name; /* The name of the built-in function/method */
|
|
||||||
PyCFunction ml_meth; /* The C function that implements it */
|
|
||||||
int ml_flags; /* Combination of METH_xxx flags, which mostly
|
|
||||||
describe the args expected by the C func */
|
|
||||||
const char *ml_doc; /* The __doc__ attribute, or NULL */
|
|
||||||
};
|
|
||||||
typedef struct PyMethodDef PyMethodDef;
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);
|
|
||||||
|
|
||||||
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
|
|
||||||
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
|
|
||||||
PyObject *);
|
|
||||||
|
|
||||||
/* Flag passed to newmethodobject */
|
|
||||||
#define METH_OLDARGS 0x0000
|
|
||||||
#define METH_VARARGS 0x0001
|
|
||||||
#define METH_KEYWORDS 0x0002
|
|
||||||
/* METH_NOARGS and METH_O must not be combined with the flags above. */
|
|
||||||
#define METH_NOARGS 0x0004
|
|
||||||
#define METH_O 0x0008
|
|
||||||
|
|
||||||
/* METH_CLASS and METH_STATIC are a little different; these control
|
|
||||||
the construction of methods for a class. These cannot be used for
|
|
||||||
functions in modules. */
|
|
||||||
#define METH_CLASS 0x0010
|
|
||||||
#define METH_STATIC 0x0020
|
|
||||||
|
|
||||||
/* METH_COEXIST allows a method to be entered eventhough a slot has
|
|
||||||
already filled the entry. When defined, the flag allows a separate
|
|
||||||
method, "__contains__" for example, to coexist with a defined
|
|
||||||
slot like sq_contains. */
|
|
||||||
|
|
||||||
#define METH_COEXIST 0x0040
|
|
||||||
|
|
||||||
typedef struct PyMethodChain {
|
|
||||||
PyMethodDef *methods; /* Methods of this type */
|
|
||||||
struct PyMethodChain *link; /* NULL or base type */
|
|
||||||
} PyMethodChain;
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *,
|
|
||||||
const char *);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyMethodDef *m_ml; /* Description of the C function to call */
|
|
||||||
PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
|
|
||||||
PyObject *m_module; /* The __module__ attribute, can be anything */
|
|
||||||
} PyCFunctionObject;
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_METHODOBJECT_H */
|
|
|
@ -1,134 +0,0 @@
|
||||||
|
|
||||||
#ifndef Py_MODSUPPORT_H
|
|
||||||
#define Py_MODSUPPORT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Module support interface */
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
|
|
||||||
to mean Py_ssize_t */
|
|
||||||
#ifdef PY_SSIZE_T_CLEAN
|
|
||||||
#define PyArg_Parse _PyArg_Parse_SizeT
|
|
||||||
#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
|
|
||||||
#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
|
|
||||||
#define PyArg_VaParse _PyArg_VaParse_SizeT
|
|
||||||
#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
|
|
||||||
#define Py_BuildValue _Py_BuildValue_SizeT
|
|
||||||
#define Py_VaBuildValue _Py_VaBuildValue_SizeT
|
|
||||||
#else
|
|
||||||
PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
|
|
||||||
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
|
|
||||||
PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
|
|
||||||
const char *, char **, ...);
|
|
||||||
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
|
|
||||||
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
|
|
||||||
PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
|
|
||||||
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
|
|
||||||
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
|
|
||||||
const char *, char **, va_list);
|
|
||||||
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
|
|
||||||
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
|
|
||||||
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
|
|
||||||
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
|
|
||||||
#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
|
|
||||||
|
|
||||||
#define PYTHON_API_VERSION 1013
|
|
||||||
#define PYTHON_API_STRING "1013"
|
|
||||||
/* The API version is maintained (independently from the Python version)
|
|
||||||
so we can detect mismatches between the interpreter and dynamically
|
|
||||||
loaded modules. These are diagnosed by an error message but
|
|
||||||
the module is still loaded (because the mismatch can only be tested
|
|
||||||
after loading the module). The error message is intended to
|
|
||||||
explain the core dump a few seconds later.
|
|
||||||
|
|
||||||
The symbol PYTHON_API_STRING defines the same value as a string
|
|
||||||
literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
|
|
||||||
|
|
||||||
Please add a line or two to the top of this log for each API
|
|
||||||
version change:
|
|
||||||
|
|
||||||
22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths
|
|
||||||
|
|
||||||
19-Aug-2002 GvR 1012 Changes to string object struct for
|
|
||||||
interning changes, saving 3 bytes.
|
|
||||||
|
|
||||||
17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
|
|
||||||
|
|
||||||
25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
|
|
||||||
PyFrame_New(); Python 2.1a2
|
|
||||||
|
|
||||||
14-Mar-2000 GvR 1009 Unicode API added
|
|
||||||
|
|
||||||
3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
|
|
||||||
|
|
||||||
3-Dec-1998 GvR 1008 Python 1.5.2b1
|
|
||||||
|
|
||||||
18-Jan-1997 GvR 1007 string interning and other speedups
|
|
||||||
|
|
||||||
11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
|
|
||||||
|
|
||||||
30-Jul-1996 GvR Slice and ellipses syntax added
|
|
||||||
|
|
||||||
23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
|
|
||||||
|
|
||||||
7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
|
|
||||||
|
|
||||||
10-Jan-1995 GvR Renamed globals to new naming scheme
|
|
||||||
|
|
||||||
9-Jan-1995 GvR Initial version (incompatible with older API)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
|
||||||
/* Special defines for Windows versions used to live here. Things
|
|
||||||
have changed, and the "Version" is now in a global string variable.
|
|
||||||
Reason for this is that this for easier branding of a "custom DLL"
|
|
||||||
without actually needing a recompile. */
|
|
||||||
#endif /* MS_WINDOWS */
|
|
||||||
|
|
||||||
#if SIZEOF_SIZE_T != SIZEOF_INT
|
|
||||||
/* On a 64-bit system, rename the Py_InitModule4 so that 2.4
|
|
||||||
modules cannot get loaded into a 2.5 interpreter */
|
|
||||||
#define Py_InitModule4 Py_InitModule4_64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Py_TRACE_REFS
|
|
||||||
/* When we are tracing reference counts, rename Py_InitModule4 so
|
|
||||||
modules compiled with incompatible settings will generate a
|
|
||||||
link-time error. */
|
|
||||||
#if SIZEOF_SIZE_T != SIZEOF_INT
|
|
||||||
#undef Py_InitModule4
|
|
||||||
#define Py_InitModule4 Py_InitModule4TraceRefs_64
|
|
||||||
#else
|
|
||||||
#define Py_InitModule4 Py_InitModule4TraceRefs
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods,
|
|
||||||
const char *doc, PyObject *self,
|
|
||||||
int apiver);
|
|
||||||
|
|
||||||
#define Py_InitModule(name, methods) \
|
|
||||||
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
|
|
||||||
PYTHON_API_VERSION)
|
|
||||||
|
|
||||||
#define Py_InitModule3(name, methods, doc) \
|
|
||||||
Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
|
|
||||||
PYTHON_API_VERSION)
|
|
||||||
|
|
||||||
PyAPI_DATA(char *) _Py_PackageContext;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_MODSUPPORT_H */
|
|
|
@ -1,24 +0,0 @@
|
||||||
|
|
||||||
/* Module object interface */
|
|
||||||
|
|
||||||
#ifndef Py_MODULEOBJECT_H
|
|
||||||
#define Py_MODULEOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyModule_Type;
|
|
||||||
|
|
||||||
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
|
|
||||||
#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyModule_New(const char *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
|
|
||||||
PyAPI_FUNC(char *) PyModule_GetName(PyObject *);
|
|
||||||
PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *);
|
|
||||||
PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_MODULEOBJECT_H */
|
|
|
@ -1,162 +0,0 @@
|
||||||
#ifndef Py_OPCODE_H
|
|
||||||
#define Py_OPCODE_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Instruction opcodes for compiled code */
|
|
||||||
|
|
||||||
#define STOP_CODE 0
|
|
||||||
#define POP_TOP 1
|
|
||||||
#define ROT_TWO 2
|
|
||||||
#define ROT_THREE 3
|
|
||||||
#define DUP_TOP 4
|
|
||||||
#define ROT_FOUR 5
|
|
||||||
#define NOP 9
|
|
||||||
|
|
||||||
#define UNARY_POSITIVE 10
|
|
||||||
#define UNARY_NEGATIVE 11
|
|
||||||
#define UNARY_NOT 12
|
|
||||||
#define UNARY_CONVERT 13
|
|
||||||
|
|
||||||
#define UNARY_INVERT 15
|
|
||||||
|
|
||||||
#define BINARY_POWER 19
|
|
||||||
|
|
||||||
#define BINARY_MULTIPLY 20
|
|
||||||
#define BINARY_DIVIDE 21
|
|
||||||
#define BINARY_MODULO 22
|
|
||||||
#define BINARY_ADD 23
|
|
||||||
#define BINARY_SUBTRACT 24
|
|
||||||
#define BINARY_SUBSCR 25
|
|
||||||
#define BINARY_FLOOR_DIVIDE 26
|
|
||||||
#define BINARY_TRUE_DIVIDE 27
|
|
||||||
#define INPLACE_FLOOR_DIVIDE 28
|
|
||||||
#define INPLACE_TRUE_DIVIDE 29
|
|
||||||
|
|
||||||
#define SLICE 30
|
|
||||||
/* Also uses 31-33 */
|
|
||||||
|
|
||||||
#define STORE_SLICE 40
|
|
||||||
/* Also uses 41-43 */
|
|
||||||
|
|
||||||
#define DELETE_SLICE 50
|
|
||||||
/* Also uses 51-53 */
|
|
||||||
|
|
||||||
#define STORE_MAP 54
|
|
||||||
#define INPLACE_ADD 55
|
|
||||||
#define INPLACE_SUBTRACT 56
|
|
||||||
#define INPLACE_MULTIPLY 57
|
|
||||||
#define INPLACE_DIVIDE 58
|
|
||||||
#define INPLACE_MODULO 59
|
|
||||||
#define STORE_SUBSCR 60
|
|
||||||
#define DELETE_SUBSCR 61
|
|
||||||
|
|
||||||
#define BINARY_LSHIFT 62
|
|
||||||
#define BINARY_RSHIFT 63
|
|
||||||
#define BINARY_AND 64
|
|
||||||
#define BINARY_XOR 65
|
|
||||||
#define BINARY_OR 66
|
|
||||||
#define INPLACE_POWER 67
|
|
||||||
#define GET_ITER 68
|
|
||||||
|
|
||||||
#define PRINT_EXPR 70
|
|
||||||
#define PRINT_ITEM 71
|
|
||||||
#define PRINT_NEWLINE 72
|
|
||||||
#define PRINT_ITEM_TO 73
|
|
||||||
#define PRINT_NEWLINE_TO 74
|
|
||||||
#define INPLACE_LSHIFT 75
|
|
||||||
#define INPLACE_RSHIFT 76
|
|
||||||
#define INPLACE_AND 77
|
|
||||||
#define INPLACE_XOR 78
|
|
||||||
#define INPLACE_OR 79
|
|
||||||
#define BREAK_LOOP 80
|
|
||||||
#define WITH_CLEANUP 81
|
|
||||||
#define LOAD_LOCALS 82
|
|
||||||
#define RETURN_VALUE 83
|
|
||||||
#define IMPORT_STAR 84
|
|
||||||
#define EXEC_STMT 85
|
|
||||||
#define YIELD_VALUE 86
|
|
||||||
#define POP_BLOCK 87
|
|
||||||
#define END_FINALLY 88
|
|
||||||
#define BUILD_CLASS 89
|
|
||||||
|
|
||||||
#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */
|
|
||||||
|
|
||||||
#define STORE_NAME 90 /* Index in name list */
|
|
||||||
#define DELETE_NAME 91 /* "" */
|
|
||||||
#define UNPACK_SEQUENCE 92 /* Number of sequence items */
|
|
||||||
#define FOR_ITER 93
|
|
||||||
#define LIST_APPEND 94
|
|
||||||
|
|
||||||
#define STORE_ATTR 95 /* Index in name list */
|
|
||||||
#define DELETE_ATTR 96 /* "" */
|
|
||||||
#define STORE_GLOBAL 97 /* "" */
|
|
||||||
#define DELETE_GLOBAL 98 /* "" */
|
|
||||||
#define DUP_TOPX 99 /* number of items to duplicate */
|
|
||||||
#define LOAD_CONST 100 /* Index in const list */
|
|
||||||
#define LOAD_NAME 101 /* Index in name list */
|
|
||||||
#define BUILD_TUPLE 102 /* Number of tuple items */
|
|
||||||
#define BUILD_LIST 103 /* Number of list items */
|
|
||||||
#define BUILD_SET 104 /* Number of set items */
|
|
||||||
#define BUILD_MAP 105 /* Always zero for now */
|
|
||||||
#define LOAD_ATTR 106 /* Index in name list */
|
|
||||||
#define COMPARE_OP 107 /* Comparison operator */
|
|
||||||
#define IMPORT_NAME 108 /* Index in name list */
|
|
||||||
#define IMPORT_FROM 109 /* Index in name list */
|
|
||||||
#define JUMP_FORWARD 110 /* Number of bytes to skip */
|
|
||||||
|
|
||||||
#define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning
|
|
||||||
of code */
|
|
||||||
#define JUMP_IF_TRUE_OR_POP 112 /* "" */
|
|
||||||
#define JUMP_ABSOLUTE 113 /* "" */
|
|
||||||
#define POP_JUMP_IF_FALSE 114 /* "" */
|
|
||||||
#define POP_JUMP_IF_TRUE 115 /* "" */
|
|
||||||
|
|
||||||
#define LOAD_GLOBAL 116 /* Index in name list */
|
|
||||||
|
|
||||||
#define CONTINUE_LOOP 119 /* Start of loop (absolute) */
|
|
||||||
#define SETUP_LOOP 120 /* Target address (relative) */
|
|
||||||
#define SETUP_EXCEPT 121 /* "" */
|
|
||||||
#define SETUP_FINALLY 122 /* "" */
|
|
||||||
|
|
||||||
#define LOAD_FAST 124 /* Local variable number */
|
|
||||||
#define STORE_FAST 125 /* Local variable number */
|
|
||||||
#define DELETE_FAST 126 /* Local variable number */
|
|
||||||
|
|
||||||
#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */
|
|
||||||
/* CALL_FUNCTION_XXX opcodes defined below depend on this definition */
|
|
||||||
#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */
|
|
||||||
#define MAKE_FUNCTION 132 /* #defaults */
|
|
||||||
#define BUILD_SLICE 133 /* Number of items */
|
|
||||||
|
|
||||||
#define MAKE_CLOSURE 134 /* #free vars */
|
|
||||||
#define LOAD_CLOSURE 135 /* Load free variable from closure */
|
|
||||||
#define LOAD_DEREF 136 /* Load and dereference from closure cell */
|
|
||||||
#define STORE_DEREF 137 /* Store into cell */
|
|
||||||
|
|
||||||
/* The next 3 opcodes must be contiguous and satisfy
|
|
||||||
(CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */
|
|
||||||
#define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */
|
|
||||||
#define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */
|
|
||||||
#define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */
|
|
||||||
|
|
||||||
#define SETUP_WITH 143
|
|
||||||
|
|
||||||
/* Support for opargs more than 16 bits long */
|
|
||||||
#define EXTENDED_ARG 145
|
|
||||||
|
|
||||||
#define SET_ADD 146
|
|
||||||
#define MAP_ADD 147
|
|
||||||
|
|
||||||
|
|
||||||
enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE,
|
|
||||||
PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD};
|
|
||||||
|
|
||||||
#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_OPCODE_H */
|
|
|
@ -1,63 +0,0 @@
|
||||||
#ifndef Py_OSDEFS_H
|
|
||||||
#define Py_OSDEFS_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Operating system dependencies */
|
|
||||||
|
|
||||||
/* Mod by chrish: QNX has WATCOM, but isn't DOS */
|
|
||||||
#if !defined(__QNX__)
|
|
||||||
#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2)
|
|
||||||
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
|
||||||
#define MAXPATHLEN 260
|
|
||||||
#define SEP '/'
|
|
||||||
#define ALTSEP '\\'
|
|
||||||
#else
|
|
||||||
#define SEP '\\'
|
|
||||||
#define ALTSEP '/'
|
|
||||||
#define MAXPATHLEN 256
|
|
||||||
#endif
|
|
||||||
#define DELIM ';'
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RISCOS
|
|
||||||
#define SEP '.'
|
|
||||||
#define MAXPATHLEN 256
|
|
||||||
#define DELIM ','
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Filename separator */
|
|
||||||
#ifndef SEP
|
|
||||||
#define SEP '/'
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Max pathname length */
|
|
||||||
#ifdef __hpux
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#ifndef PATH_MAX
|
|
||||||
#define PATH_MAX MAXPATHLEN
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MAXPATHLEN
|
|
||||||
#if defined(PATH_MAX) && PATH_MAX > 1024
|
|
||||||
#define MAXPATHLEN PATH_MAX
|
|
||||||
#else
|
|
||||||
#define MAXPATHLEN 1024
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Search path entry delimiter */
|
|
||||||
#ifndef DELIM
|
|
||||||
#define DELIM ':'
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_OSDEFS_H */
|
|
|
@ -1,64 +0,0 @@
|
||||||
|
|
||||||
/* Parser-tokenizer link interface */
|
|
||||||
|
|
||||||
#ifndef Py_PARSETOK_H
|
|
||||||
#define Py_PARSETOK_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int error;
|
|
||||||
const char *filename;
|
|
||||||
int lineno;
|
|
||||||
int offset;
|
|
||||||
char *text;
|
|
||||||
int token;
|
|
||||||
int expected;
|
|
||||||
} perrdetail;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define PyPARSE_YIELD_IS_KEYWORD 0x0001
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PyPARSE_DONT_IMPLY_DEDENT 0x0002
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define PyPARSE_WITH_IS_KEYWORD 0x0003
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PyPARSE_PRINT_IS_FUNCTION 0x0004
|
|
||||||
#define PyPARSE_UNICODE_LITERALS 0x0008
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
|
|
||||||
perrdetail *);
|
|
||||||
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
|
|
||||||
char *, char *, perrdetail *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
|
|
||||||
perrdetail *, int);
|
|
||||||
PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *,
|
|
||||||
int, char *, char *,
|
|
||||||
perrdetail *, int);
|
|
||||||
PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(FILE *, const char *, grammar *,
|
|
||||||
int, char *, char *,
|
|
||||||
perrdetail *, int *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *,
|
|
||||||
const char *,
|
|
||||||
grammar *, int,
|
|
||||||
perrdetail *, int);
|
|
||||||
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(const char *,
|
|
||||||
const char *,
|
|
||||||
grammar *, int,
|
|
||||||
perrdetail *, int *);
|
|
||||||
|
|
||||||
/* Note that he following function is defined in pythonrun.c not parsetok.c. */
|
|
||||||
PyAPI_FUNC(void) PyParser_SetError(perrdetail *);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_PARSETOK_H */
|
|
|
@ -1,43 +0,0 @@
|
||||||
|
|
||||||
/* Newfangled version identification scheme.
|
|
||||||
|
|
||||||
This scheme was added in Python 1.5.2b2; before that time, only PATCHLEVEL
|
|
||||||
was available. To test for presence of the scheme, test for
|
|
||||||
defined(PY_MAJOR_VERSION).
|
|
||||||
|
|
||||||
When the major or minor version changes, the VERSION variable in
|
|
||||||
configure.ac must also be changed.
|
|
||||||
|
|
||||||
There is also (independent) API version information in modsupport.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Values for PY_RELEASE_LEVEL */
|
|
||||||
#define PY_RELEASE_LEVEL_ALPHA 0xA
|
|
||||||
#define PY_RELEASE_LEVEL_BETA 0xB
|
|
||||||
#define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */
|
|
||||||
#define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */
|
|
||||||
/* Higher for patch releases */
|
|
||||||
|
|
||||||
/* Version parsed out into numeric values */
|
|
||||||
/*--start constants--*/
|
|
||||||
#define PY_MAJOR_VERSION 2
|
|
||||||
#define PY_MINOR_VERSION 7
|
|
||||||
#define PY_MICRO_VERSION 6
|
|
||||||
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
|
|
||||||
#define PY_RELEASE_SERIAL 0
|
|
||||||
|
|
||||||
/* Version as a string */
|
|
||||||
#define PY_VERSION "2.7.6"
|
|
||||||
/*--end constants--*/
|
|
||||||
|
|
||||||
/* Subversion Revision number of this file (not of the repository). Empty
|
|
||||||
since Mercurial migration. */
|
|
||||||
#define PY_PATCHLEVEL_REVISION ""
|
|
||||||
|
|
||||||
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
|
|
||||||
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
|
|
||||||
#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
|
|
||||||
(PY_MINOR_VERSION << 16) | \
|
|
||||||
(PY_MICRO_VERSION << 8) | \
|
|
||||||
(PY_RELEASE_LEVEL << 4) | \
|
|
||||||
(PY_RELEASE_SERIAL << 0))
|
|
|
@ -1,41 +0,0 @@
|
||||||
|
|
||||||
#ifndef Py_PYDEBUG_H
|
|
||||||
#define Py_PYDEBUG_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_DATA(int) Py_DebugFlag;
|
|
||||||
PyAPI_DATA(int) Py_VerboseFlag;
|
|
||||||
PyAPI_DATA(int) Py_InteractiveFlag;
|
|
||||||
PyAPI_DATA(int) Py_InspectFlag;
|
|
||||||
PyAPI_DATA(int) Py_OptimizeFlag;
|
|
||||||
PyAPI_DATA(int) Py_NoSiteFlag;
|
|
||||||
PyAPI_DATA(int) Py_BytesWarningFlag;
|
|
||||||
PyAPI_DATA(int) Py_UseClassExceptionsFlag;
|
|
||||||
PyAPI_DATA(int) Py_FrozenFlag;
|
|
||||||
PyAPI_DATA(int) Py_TabcheckFlag;
|
|
||||||
PyAPI_DATA(int) Py_UnicodeFlag;
|
|
||||||
PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
|
|
||||||
PyAPI_DATA(int) Py_DivisionWarningFlag;
|
|
||||||
PyAPI_DATA(int) Py_DontWriteBytecodeFlag;
|
|
||||||
PyAPI_DATA(int) Py_NoUserSiteDirectory;
|
|
||||||
/* _XXX Py_QnewFlag should go away in 3.0. It's true iff -Qnew is passed,
|
|
||||||
on the command line, and is used in 2.2 by ceval.c to make all "/" divisions
|
|
||||||
true divisions (which they will be in 3.0). */
|
|
||||||
PyAPI_DATA(int) _Py_QnewFlag;
|
|
||||||
/* Warn about 3.x issues */
|
|
||||||
PyAPI_DATA(int) Py_Py3kWarningFlag;
|
|
||||||
PyAPI_DATA(int) Py_HashRandomizationFlag;
|
|
||||||
|
|
||||||
/* this is a wrapper around getenv() that pays attention to
|
|
||||||
Py_IgnoreEnvironmentFlag. It should be used for getting variables like
|
|
||||||
PYTHONPATH and PYTHONHOME from the environment */
|
|
||||||
#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) Py_FatalError(const char *message);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_PYDEBUG_H */
|
|
|
@ -1,328 +0,0 @@
|
||||||
#ifndef Py_ERRORS_H
|
|
||||||
#define Py_ERRORS_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Error objects */
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *dict;
|
|
||||||
PyObject *args;
|
|
||||||
PyObject *message;
|
|
||||||
} PyBaseExceptionObject;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *dict;
|
|
||||||
PyObject *args;
|
|
||||||
PyObject *message;
|
|
||||||
PyObject *msg;
|
|
||||||
PyObject *filename;
|
|
||||||
PyObject *lineno;
|
|
||||||
PyObject *offset;
|
|
||||||
PyObject *text;
|
|
||||||
PyObject *print_file_and_line;
|
|
||||||
} PySyntaxErrorObject;
|
|
||||||
|
|
||||||
#ifdef Py_USING_UNICODE
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *dict;
|
|
||||||
PyObject *args;
|
|
||||||
PyObject *message;
|
|
||||||
PyObject *encoding;
|
|
||||||
PyObject *object;
|
|
||||||
Py_ssize_t start;
|
|
||||||
Py_ssize_t end;
|
|
||||||
PyObject *reason;
|
|
||||||
} PyUnicodeErrorObject;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *dict;
|
|
||||||
PyObject *args;
|
|
||||||
PyObject *message;
|
|
||||||
PyObject *code;
|
|
||||||
} PySystemExitObject;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *dict;
|
|
||||||
PyObject *args;
|
|
||||||
PyObject *message;
|
|
||||||
PyObject *myerrno;
|
|
||||||
PyObject *strerror;
|
|
||||||
PyObject *filename;
|
|
||||||
} PyEnvironmentErrorObject;
|
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *dict;
|
|
||||||
PyObject *args;
|
|
||||||
PyObject *message;
|
|
||||||
PyObject *myerrno;
|
|
||||||
PyObject *strerror;
|
|
||||||
PyObject *filename;
|
|
||||||
PyObject *winerror;
|
|
||||||
} PyWindowsErrorObject;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Error handling definitions */
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
|
|
||||||
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
|
|
||||||
PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
|
|
||||||
PyAPI_FUNC(void) PyErr_Clear(void);
|
|
||||||
PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
|
|
||||||
PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
|
|
||||||
|
|
||||||
#ifdef Py_DEBUG
|
|
||||||
#define _PyErr_OCCURRED() PyErr_Occurred()
|
|
||||||
#else
|
|
||||||
#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Error testing and normalization */
|
|
||||||
PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
|
|
||||||
PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
|
|
||||||
PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
|
|
||||||
|
|
||||||
/* */
|
|
||||||
|
|
||||||
#define PyExceptionClass_Check(x) \
|
|
||||||
(PyClass_Check((x)) || (PyType_Check((x)) && \
|
|
||||||
PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)))
|
|
||||||
|
|
||||||
#define PyExceptionInstance_Check(x) \
|
|
||||||
(PyInstance_Check((x)) || \
|
|
||||||
PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS))
|
|
||||||
|
|
||||||
#define PyExceptionClass_Name(x) \
|
|
||||||
(PyClass_Check((x)) \
|
|
||||||
? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \
|
|
||||||
: (char *)(((PyTypeObject*)(x))->tp_name))
|
|
||||||
|
|
||||||
#define PyExceptionInstance_Class(x) \
|
|
||||||
((PyInstance_Check((x)) \
|
|
||||||
? (PyObject*)((PyInstanceObject*)(x))->in_class \
|
|
||||||
: (PyObject*)((x)->ob_type)))
|
|
||||||
|
|
||||||
|
|
||||||
/* Predefined exceptions */
|
|
||||||
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_BaseException;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_Exception;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_StopIteration;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_StandardError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_LookupError;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_AssertionError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_AttributeError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_EOFError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_FloatingPointError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_EnvironmentError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_IOError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_OSError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_ImportError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_IndexError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_KeyError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_MemoryError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_NameError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_OverflowError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_RuntimeError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_SyntaxError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_IndentationError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_TabError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_ReferenceError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_SystemError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_SystemExit;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_TypeError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_UnboundLocalError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_UnicodeError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_ValueError;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError;
|
|
||||||
#ifdef MS_WINDOWS
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_WindowsError;
|
|
||||||
#endif
|
|
||||||
#ifdef __VMS
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_VMSError;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_BufferError;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
|
|
||||||
|
|
||||||
/* Predefined warning categories */
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_Warning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_UserWarning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_DeprecationWarning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_FutureWarning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_ImportWarning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_BytesWarning;
|
|
||||||
|
|
||||||
|
|
||||||
/* Convenience functions */
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyErr_BadArgument(void);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
|
|
||||||
PyObject *, PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
|
|
||||||
PyObject *, const char *);
|
|
||||||
#ifdef MS_WINDOWS
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
|
|
||||||
PyObject *, const Py_UNICODE *);
|
|
||||||
#endif /* MS_WINDOWS */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
|
|
||||||
Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
|
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
|
|
||||||
int, const char *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
|
|
||||||
int, const char *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
|
|
||||||
int, const Py_UNICODE *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
|
|
||||||
PyObject *,int, PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
|
|
||||||
PyObject *,int, const char *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
|
|
||||||
PyObject *,int, const Py_UNICODE *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
|
|
||||||
#endif /* MS_WINDOWS */
|
|
||||||
|
|
||||||
/* Export the old function so that the existing API remains available: */
|
|
||||||
PyAPI_FUNC(void) PyErr_BadInternalCall(void);
|
|
||||||
PyAPI_FUNC(void) _PyErr_BadInternalCall(char *filename, int lineno);
|
|
||||||
/* Mask the old API with a call to the new API for code compiled under
|
|
||||||
Python 2.0: */
|
|
||||||
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
|
|
||||||
|
|
||||||
/* Function to create a new exception */
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_NewException(
|
|
||||||
char *name, PyObject *base, PyObject *dict);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
|
|
||||||
char *name, char *doc, PyObject *base, PyObject *dict);
|
|
||||||
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
|
|
||||||
|
|
||||||
/* In sigcheck.c or signalmodule.c */
|
|
||||||
PyAPI_FUNC(int) PyErr_CheckSignals(void);
|
|
||||||
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
|
|
||||||
|
|
||||||
/* In signalmodule.c */
|
|
||||||
int PySignal_SetWakeupFd(int fd);
|
|
||||||
|
|
||||||
/* Support for adding program text to SyntaxErrors */
|
|
||||||
PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
|
|
||||||
PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
|
|
||||||
|
|
||||||
#ifdef Py_USING_UNICODE
|
|
||||||
/* The following functions are used to create and modify unicode
|
|
||||||
exceptions from C */
|
|
||||||
|
|
||||||
/* create a UnicodeDecodeError object */
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
|
|
||||||
const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
|
|
||||||
|
|
||||||
/* create a UnicodeEncodeError object */
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
|
|
||||||
const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
|
|
||||||
|
|
||||||
/* create a UnicodeTranslateError object */
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
|
|
||||||
const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
|
|
||||||
|
|
||||||
/* get the encoding attribute */
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);
|
|
||||||
|
|
||||||
/* get the object attribute */
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);
|
|
||||||
|
|
||||||
/* get the value of the start attribute (the int * may not be NULL)
|
|
||||||
return 0 on success, -1 on failure */
|
|
||||||
PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);
|
|
||||||
|
|
||||||
/* assign a new value to the start attribute
|
|
||||||
return 0 on success, -1 on failure */
|
|
||||||
PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);
|
|
||||||
|
|
||||||
/* get the value of the end attribute (the int *may not be NULL)
|
|
||||||
return 0 on success, -1 on failure */
|
|
||||||
PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);
|
|
||||||
|
|
||||||
/* assign a new value to the end attribute
|
|
||||||
return 0 on success, -1 on failure */
|
|
||||||
PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);
|
|
||||||
|
|
||||||
/* get the value of the reason attribute */
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);
|
|
||||||
|
|
||||||
/* assign a new value to the reason attribute
|
|
||||||
return 0 on success, -1 on failure */
|
|
||||||
PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
|
|
||||||
PyObject *, const char *);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
|
|
||||||
PyObject *, const char *);
|
|
||||||
PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
|
|
||||||
PyObject *, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* These APIs aren't really part of the error implementation, but
|
|
||||||
often needed to format error messages; the native C lib APIs are
|
|
||||||
not available on all platforms, which is why we provide emulations
|
|
||||||
for those platforms in Python/mysnprintf.c,
|
|
||||||
WARNING: The return value of snprintf varies across platforms; do
|
|
||||||
not rely on any particular behavior; eventually the C99 defn may
|
|
||||||
be reliable.
|
|
||||||
*/
|
|
||||||
#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF)
|
|
||||||
# define HAVE_SNPRINTF
|
|
||||||
# define snprintf _snprintf
|
|
||||||
# define vsnprintf _vsnprintf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
|
|
||||||
Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
|
|
||||||
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
|
|
||||||
Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_ERRORS_H */
|
|
|
@ -1,18 +0,0 @@
|
||||||
|
|
||||||
#ifndef Py_PYGETOPT_H
|
|
||||||
#define Py_PYGETOPT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_DATA(int) _PyOS_opterr;
|
|
||||||
PyAPI_DATA(int) _PyOS_optind;
|
|
||||||
PyAPI_DATA(char *) _PyOS_optarg;
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) _PyOS_ResetGetOpt(void);
|
|
||||||
PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_PYGETOPT_H */
|
|
|
@ -1,217 +0,0 @@
|
||||||
/*
|
|
||||||
** pymactoolbox.h - globals defined in mactoolboxglue.c
|
|
||||||
*/
|
|
||||||
#ifndef Py_PYMACTOOLBOX_H
|
|
||||||
#define Py_PYMACTOOLBOX_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
|
|
||||||
#ifndef __LP64__
|
|
||||||
#include <QuickTime/QuickTime.h>
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Helper routines for error codes and such.
|
|
||||||
*/
|
|
||||||
char *PyMac_StrError(int); /* strerror with mac errors */
|
|
||||||
extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
|
|
||||||
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
|
|
||||||
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
|
|
||||||
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
|
|
||||||
fsspec->path */
|
|
||||||
#endif /* __LP64__ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** These conversion routines are defined in mactoolboxglue.c itself.
|
|
||||||
*/
|
|
||||||
int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */
|
|
||||||
PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */
|
|
||||||
|
|
||||||
PyObject *PyMac_BuildNumVersion(NumVersion);/* Convert NumVersion to PyObject */
|
|
||||||
|
|
||||||
int PyMac_GetStr255(PyObject *, Str255); /* argument parser for Str255 */
|
|
||||||
PyObject *PyMac_BuildStr255(Str255); /* Convert Str255 to PyObject */
|
|
||||||
PyObject *PyMac_BuildOptStr255(Str255); /* Convert Str255 to PyObject,
|
|
||||||
NULL to None */
|
|
||||||
|
|
||||||
int PyMac_GetRect(PyObject *, Rect *); /* argument parser for Rect */
|
|
||||||
PyObject *PyMac_BuildRect(Rect *); /* Convert Rect to PyObject */
|
|
||||||
|
|
||||||
int PyMac_GetPoint(PyObject *, Point *); /* argument parser for Point */
|
|
||||||
PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */
|
|
||||||
|
|
||||||
int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for
|
|
||||||
EventRecord */
|
|
||||||
PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to
|
|
||||||
PyObject */
|
|
||||||
|
|
||||||
int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */
|
|
||||||
PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */
|
|
||||||
int PyMac_Getwide(PyObject *, wide *); /* argument parser for wide */
|
|
||||||
PyObject *PyMac_Buildwide(wide *); /* Convert wide to PyObject */
|
|
||||||
|
|
||||||
/*
|
|
||||||
** The rest of the routines are implemented by extension modules. If they are
|
|
||||||
** dynamically loaded mactoolboxglue will contain a stub implementation of the
|
|
||||||
** routine, which imports the module, whereupon the module's init routine will
|
|
||||||
** communicate the routine pointer back to the stub.
|
|
||||||
** If USE_TOOLBOX_OBJECT_GLUE is not defined there is no glue code, and the
|
|
||||||
** extension modules simply declare the routine. This is the case for static
|
|
||||||
** builds (and could be the case for MacPython CFM builds, because CFM extension
|
|
||||||
** modules can reference each other without problems).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef USE_TOOLBOX_OBJECT_GLUE
|
|
||||||
/*
|
|
||||||
** These macros are used in the module init code. If we use toolbox object glue
|
|
||||||
** it sets the function pointer to point to the real function.
|
|
||||||
*/
|
|
||||||
#define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) { \
|
|
||||||
extern PyObject *(*PyMacGluePtr_##rtn)(object); \
|
|
||||||
PyMacGluePtr_##rtn = _##rtn; \
|
|
||||||
}
|
|
||||||
#define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) { \
|
|
||||||
extern int (*PyMacGluePtr_##rtn)(PyObject *, object *); \
|
|
||||||
PyMacGluePtr_##rtn = _##rtn; \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/*
|
|
||||||
** If we don't use toolbox object glue the init macros are empty. Moreover, we define
|
|
||||||
** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included.
|
|
||||||
*/
|
|
||||||
#define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn)
|
|
||||||
#define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn)
|
|
||||||
#endif /* USE_TOOLBOX_OBJECT_GLUE */
|
|
||||||
|
|
||||||
/* macfs exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
|
|
||||||
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
|
|
||||||
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
|
|
||||||
|
|
||||||
/* AE exports */
|
|
||||||
extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */
|
|
||||||
extern PyObject *AEDesc_NewBorrowed(AppleEvent *);
|
|
||||||
extern int AEDesc_Convert(PyObject *, AppleEvent *);
|
|
||||||
|
|
||||||
/* Cm exports */
|
|
||||||
extern PyObject *CmpObj_New(Component);
|
|
||||||
extern int CmpObj_Convert(PyObject *, Component *);
|
|
||||||
extern PyObject *CmpInstObj_New(ComponentInstance);
|
|
||||||
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
|
|
||||||
|
|
||||||
/* Ctl exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *CtlObj_New(ControlHandle);
|
|
||||||
extern int CtlObj_Convert(PyObject *, ControlHandle *);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* Dlg exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *DlgObj_New(DialogPtr);
|
|
||||||
extern int DlgObj_Convert(PyObject *, DialogPtr *);
|
|
||||||
extern PyObject *DlgObj_WhichDialog(DialogPtr);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* Drag exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *DragObj_New(DragReference);
|
|
||||||
extern int DragObj_Convert(PyObject *, DragReference *);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* List exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *ListObj_New(ListHandle);
|
|
||||||
extern int ListObj_Convert(PyObject *, ListHandle *);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* Menu exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *MenuObj_New(MenuHandle);
|
|
||||||
extern int MenuObj_Convert(PyObject *, MenuHandle *);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* Qd exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *GrafObj_New(GrafPtr);
|
|
||||||
extern int GrafObj_Convert(PyObject *, GrafPtr *);
|
|
||||||
extern PyObject *BMObj_New(BitMapPtr);
|
|
||||||
extern int BMObj_Convert(PyObject *, BitMapPtr *);
|
|
||||||
extern PyObject *QdRGB_New(RGBColor *);
|
|
||||||
extern int QdRGB_Convert(PyObject *, RGBColor *);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* Qdoffs exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *GWorldObj_New(GWorldPtr);
|
|
||||||
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* Qt exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *TrackObj_New(Track);
|
|
||||||
extern int TrackObj_Convert(PyObject *, Track *);
|
|
||||||
extern PyObject *MovieObj_New(Movie);
|
|
||||||
extern int MovieObj_Convert(PyObject *, Movie *);
|
|
||||||
extern PyObject *MovieCtlObj_New(MovieController);
|
|
||||||
extern int MovieCtlObj_Convert(PyObject *, MovieController *);
|
|
||||||
extern PyObject *TimeBaseObj_New(TimeBase);
|
|
||||||
extern int TimeBaseObj_Convert(PyObject *, TimeBase *);
|
|
||||||
extern PyObject *UserDataObj_New(UserData);
|
|
||||||
extern int UserDataObj_Convert(PyObject *, UserData *);
|
|
||||||
extern PyObject *MediaObj_New(Media);
|
|
||||||
extern int MediaObj_Convert(PyObject *, Media *);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* Res exports */
|
|
||||||
extern PyObject *ResObj_New(Handle);
|
|
||||||
extern int ResObj_Convert(PyObject *, Handle *);
|
|
||||||
extern PyObject *OptResObj_New(Handle);
|
|
||||||
extern int OptResObj_Convert(PyObject *, Handle *);
|
|
||||||
|
|
||||||
/* TE exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *TEObj_New(TEHandle);
|
|
||||||
extern int TEObj_Convert(PyObject *, TEHandle *);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* Win exports */
|
|
||||||
#ifndef __LP64__
|
|
||||||
extern PyObject *WinObj_New(WindowPtr);
|
|
||||||
extern int WinObj_Convert(PyObject *, WindowPtr *);
|
|
||||||
extern PyObject *WinObj_WhichWindow(WindowPtr);
|
|
||||||
#endif /* !__LP64__ */
|
|
||||||
|
|
||||||
/* CF exports */
|
|
||||||
extern PyObject *CFObj_New(CFTypeRef);
|
|
||||||
extern int CFObj_Convert(PyObject *, CFTypeRef *);
|
|
||||||
extern PyObject *CFTypeRefObj_New(CFTypeRef);
|
|
||||||
extern int CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
|
|
||||||
extern PyObject *CFStringRefObj_New(CFStringRef);
|
|
||||||
extern int CFStringRefObj_Convert(PyObject *, CFStringRef *);
|
|
||||||
extern PyObject *CFMutableStringRefObj_New(CFMutableStringRef);
|
|
||||||
extern int CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *);
|
|
||||||
extern PyObject *CFArrayRefObj_New(CFArrayRef);
|
|
||||||
extern int CFArrayRefObj_Convert(PyObject *, CFArrayRef *);
|
|
||||||
extern PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef);
|
|
||||||
extern int CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *);
|
|
||||||
extern PyObject *CFDictionaryRefObj_New(CFDictionaryRef);
|
|
||||||
extern int CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *);
|
|
||||||
extern PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef);
|
|
||||||
extern int CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *);
|
|
||||||
extern PyObject *CFURLRefObj_New(CFURLRef);
|
|
||||||
extern int CFURLRefObj_Convert(PyObject *, CFURLRef *);
|
|
||||||
extern int OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,122 +0,0 @@
|
||||||
/* The PyMem_ family: low-level memory allocation interfaces.
|
|
||||||
See objimpl.h for the PyObject_ memory family.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef Py_PYMEM_H
|
|
||||||
#define Py_PYMEM_H
|
|
||||||
|
|
||||||
#include "pyport.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* BEWARE:
|
|
||||||
|
|
||||||
Each interface exports both functions and macros. Extension modules should
|
|
||||||
use the functions, to ensure binary compatibility across Python versions.
|
|
||||||
Because the Python implementation is free to change internal details, and
|
|
||||||
the macros may (or may not) expose details for speed, if you do use the
|
|
||||||
macros you must recompile your extensions with each Python release.
|
|
||||||
|
|
||||||
Never mix calls to PyMem_ with calls to the platform malloc/realloc/
|
|
||||||
calloc/free. For example, on Windows different DLLs may end up using
|
|
||||||
different heaps, and if you use PyMem_Malloc you'll get the memory from the
|
|
||||||
heap used by the Python DLL; it could be a disaster if you free()'ed that
|
|
||||||
directly in your own extension. Using PyMem_Free instead ensures Python
|
|
||||||
can return the memory to the proper heap. As another example, in
|
|
||||||
PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_
|
|
||||||
memory functions in special debugging wrappers that add additional
|
|
||||||
debugging info to dynamic memory blocks. The system routines have no idea
|
|
||||||
what to do with that stuff, and the Python wrappers have no idea what to do
|
|
||||||
with raw blocks obtained directly by the system routines then.
|
|
||||||
|
|
||||||
The GIL must be held when using these APIs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Raw memory interface
|
|
||||||
* ====================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Functions
|
|
||||||
|
|
||||||
Functions supplying platform-independent semantics for malloc/realloc/
|
|
||||||
free. These functions make sure that allocating 0 bytes returns a distinct
|
|
||||||
non-NULL pointer (whenever possible -- if we're flat out of memory, NULL
|
|
||||||
may be returned), even if the platform malloc and realloc don't.
|
|
||||||
Returned pointers must be checked for NULL explicitly. No action is
|
|
||||||
performed on failure (no exception is set, no warning is printed, etc).
|
|
||||||
*/
|
|
||||||
|
|
||||||
PyAPI_FUNC(void *) PyMem_Malloc(size_t);
|
|
||||||
PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t);
|
|
||||||
PyAPI_FUNC(void) PyMem_Free(void *);
|
|
||||||
|
|
||||||
/* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are
|
|
||||||
no longer supported. They used to call PyErr_NoMemory() on failure. */
|
|
||||||
|
|
||||||
/* Macros. */
|
|
||||||
#ifdef PYMALLOC_DEBUG
|
|
||||||
/* Redirect all memory operations to Python's debugging allocator. */
|
|
||||||
#define PyMem_MALLOC _PyMem_DebugMalloc
|
|
||||||
#define PyMem_REALLOC _PyMem_DebugRealloc
|
|
||||||
#define PyMem_FREE _PyMem_DebugFree
|
|
||||||
|
|
||||||
#else /* ! PYMALLOC_DEBUG */
|
|
||||||
|
|
||||||
/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL
|
|
||||||
for malloc(0), which would be treated as an error. Some platforms
|
|
||||||
would return a pointer with no memory behind it, which would break
|
|
||||||
pymalloc. To solve these problems, allocate an extra byte. */
|
|
||||||
/* Returns NULL to indicate error if a negative size or size larger than
|
|
||||||
Py_ssize_t can represent is supplied. Helps prevents security holes. */
|
|
||||||
#define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
|
|
||||||
: malloc((n) ? (n) : 1))
|
|
||||||
#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
|
|
||||||
: realloc((p), (n) ? (n) : 1))
|
|
||||||
#define PyMem_FREE free
|
|
||||||
|
|
||||||
#endif /* PYMALLOC_DEBUG */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Type-oriented memory interface
|
|
||||||
* ==============================
|
|
||||||
*
|
|
||||||
* Allocate memory for n objects of the given type. Returns a new pointer
|
|
||||||
* or NULL if the request was too large or memory allocation failed. Use
|
|
||||||
* these macros rather than doing the multiplication yourself so that proper
|
|
||||||
* overflow checking is always done.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PyMem_New(type, n) \
|
|
||||||
( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
|
|
||||||
( (type *) PyMem_Malloc((n) * sizeof(type)) ) )
|
|
||||||
#define PyMem_NEW(type, n) \
|
|
||||||
( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
|
|
||||||
( (type *) PyMem_MALLOC((n) * sizeof(type)) ) )
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The value of (p) is always clobbered by this macro regardless of success.
|
|
||||||
* The caller MUST check if (p) is NULL afterwards and deal with the memory
|
|
||||||
* error if so. This means the original value of (p) MUST be saved for the
|
|
||||||
* caller's memory error handler to not lose track of it.
|
|
||||||
*/
|
|
||||||
#define PyMem_Resize(p, type, n) \
|
|
||||||
( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
|
|
||||||
(type *) PyMem_Realloc((p), (n) * sizeof(type)) )
|
|
||||||
#define PyMem_RESIZE(p, type, n) \
|
|
||||||
( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
|
|
||||||
(type *) PyMem_REALLOC((p), (n) * sizeof(type)) )
|
|
||||||
|
|
||||||
/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used
|
|
||||||
* anymore. They're just confusing aliases for PyMem_{Free,FREE} now.
|
|
||||||
*/
|
|
||||||
#define PyMem_Del PyMem_Free
|
|
||||||
#define PyMem_DEL PyMem_FREE
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !Py_PYMEM_H */
|
|
|
@ -1,200 +0,0 @@
|
||||||
|
|
||||||
/* Thread and interpreter state structures and their interfaces */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Py_PYSTATE_H
|
|
||||||
#define Py_PYSTATE_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* State shared between threads */
|
|
||||||
|
|
||||||
struct _ts; /* Forward */
|
|
||||||
struct _is; /* Forward */
|
|
||||||
|
|
||||||
typedef struct _is {
|
|
||||||
|
|
||||||
struct _is *next;
|
|
||||||
struct _ts *tstate_head;
|
|
||||||
|
|
||||||
PyObject *modules;
|
|
||||||
PyObject *sysdict;
|
|
||||||
PyObject *builtins;
|
|
||||||
PyObject *modules_reloading;
|
|
||||||
|
|
||||||
PyObject *codec_search_path;
|
|
||||||
PyObject *codec_search_cache;
|
|
||||||
PyObject *codec_error_registry;
|
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
|
||||||
int dlopenflags;
|
|
||||||
#endif
|
|
||||||
#ifdef WITH_TSC
|
|
||||||
int tscdump;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} PyInterpreterState;
|
|
||||||
|
|
||||||
|
|
||||||
/* State unique per thread */
|
|
||||||
|
|
||||||
struct _frame; /* Avoid including frameobject.h */
|
|
||||||
|
|
||||||
/* Py_tracefunc return -1 when raising an exception, or 0 for success. */
|
|
||||||
typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *);
|
|
||||||
|
|
||||||
/* The following values are used for 'what' for tracefunc functions: */
|
|
||||||
#define PyTrace_CALL 0
|
|
||||||
#define PyTrace_EXCEPTION 1
|
|
||||||
#define PyTrace_LINE 2
|
|
||||||
#define PyTrace_RETURN 3
|
|
||||||
#define PyTrace_C_CALL 4
|
|
||||||
#define PyTrace_C_EXCEPTION 5
|
|
||||||
#define PyTrace_C_RETURN 6
|
|
||||||
|
|
||||||
typedef struct _ts {
|
|
||||||
/* See Python/ceval.c for comments explaining most fields */
|
|
||||||
|
|
||||||
struct _ts *next;
|
|
||||||
PyInterpreterState *interp;
|
|
||||||
|
|
||||||
struct _frame *frame;
|
|
||||||
int recursion_depth;
|
|
||||||
/* 'tracing' keeps track of the execution depth when tracing/profiling.
|
|
||||||
This is to prevent the actual trace/profile code from being recorded in
|
|
||||||
the trace/profile. */
|
|
||||||
int tracing;
|
|
||||||
int use_tracing;
|
|
||||||
|
|
||||||
Py_tracefunc c_profilefunc;
|
|
||||||
Py_tracefunc c_tracefunc;
|
|
||||||
PyObject *c_profileobj;
|
|
||||||
PyObject *c_traceobj;
|
|
||||||
|
|
||||||
PyObject *curexc_type;
|
|
||||||
PyObject *curexc_value;
|
|
||||||
PyObject *curexc_traceback;
|
|
||||||
|
|
||||||
PyObject *exc_type;
|
|
||||||
PyObject *exc_value;
|
|
||||||
PyObject *exc_traceback;
|
|
||||||
|
|
||||||
PyObject *dict; /* Stores per-thread state */
|
|
||||||
|
|
||||||
/* tick_counter is incremented whenever the check_interval ticker
|
|
||||||
* reaches zero. The purpose is to give a useful measure of the number
|
|
||||||
* of interpreted bytecode instructions in a given thread. This
|
|
||||||
* extremely lightweight statistic collector may be of interest to
|
|
||||||
* profilers (like psyco.jit()), although nothing in the core uses it.
|
|
||||||
*/
|
|
||||||
int tick_counter;
|
|
||||||
|
|
||||||
int gilstate_counter;
|
|
||||||
|
|
||||||
PyObject *async_exc; /* Asynchronous exception to raise */
|
|
||||||
long thread_id; /* Thread id where this tstate was created */
|
|
||||||
|
|
||||||
int trash_delete_nesting;
|
|
||||||
PyObject *trash_delete_later;
|
|
||||||
|
|
||||||
/* XXX signal handlers should also be here */
|
|
||||||
|
|
||||||
} PyThreadState;
|
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
|
|
||||||
PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *);
|
|
||||||
PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
|
|
||||||
PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *);
|
|
||||||
PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *);
|
|
||||||
PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
|
|
||||||
PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
|
|
||||||
#ifdef WITH_THREAD
|
|
||||||
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
|
|
||||||
PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
|
|
||||||
PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *);
|
|
||||||
|
|
||||||
|
|
||||||
/* Variable and macro for in-line access to current thread state */
|
|
||||||
|
|
||||||
PyAPI_DATA(PyThreadState *) _PyThreadState_Current;
|
|
||||||
|
|
||||||
#ifdef Py_DEBUG
|
|
||||||
#define PyThreadState_GET() PyThreadState_Get()
|
|
||||||
#else
|
|
||||||
#define PyThreadState_GET() (_PyThreadState_Current)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef
|
|
||||||
enum {PyGILState_LOCKED, PyGILState_UNLOCKED}
|
|
||||||
PyGILState_STATE;
|
|
||||||
|
|
||||||
/* Ensure that the current thread is ready to call the Python
|
|
||||||
C API, regardless of the current state of Python, or of its
|
|
||||||
thread lock. This may be called as many times as desired
|
|
||||||
by a thread so long as each call is matched with a call to
|
|
||||||
PyGILState_Release(). In general, other thread-state APIs may
|
|
||||||
be used between _Ensure() and _Release() calls, so long as the
|
|
||||||
thread-state is restored to its previous state before the Release().
|
|
||||||
For example, normal use of the Py_BEGIN_ALLOW_THREADS/
|
|
||||||
Py_END_ALLOW_THREADS macros are acceptable.
|
|
||||||
|
|
||||||
The return value is an opaque "handle" to the thread state when
|
|
||||||
PyGILState_Ensure() was called, and must be passed to
|
|
||||||
PyGILState_Release() to ensure Python is left in the same state. Even
|
|
||||||
though recursive calls are allowed, these handles can *not* be shared -
|
|
||||||
each unique call to PyGILState_Ensure must save the handle for its
|
|
||||||
call to PyGILState_Release.
|
|
||||||
|
|
||||||
When the function returns, the current thread will hold the GIL.
|
|
||||||
|
|
||||||
Failure is a fatal error.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void);
|
|
||||||
|
|
||||||
/* Release any resources previously acquired. After this call, Python's
|
|
||||||
state will be the same as it was prior to the corresponding
|
|
||||||
PyGILState_Ensure() call (but generally this state will be unknown to
|
|
||||||
the caller, hence the use of the GILState API.)
|
|
||||||
|
|
||||||
Every call to PyGILState_Ensure must be matched by a call to
|
|
||||||
PyGILState_Release on the same thread.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
|
|
||||||
|
|
||||||
/* Helper/diagnostic function - get the current thread state for
|
|
||||||
this thread. May return NULL if no GILState API has been used
|
|
||||||
on the current thread. Note that the main thread always has such a
|
|
||||||
thread-state, even if no auto-thread-state call has been made
|
|
||||||
on the main thread.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
|
|
||||||
|
|
||||||
/* The implementation of sys._current_frames() Returns a dict mapping
|
|
||||||
thread id to that thread's current frame.
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void);
|
|
||||||
|
|
||||||
/* Routines for advanced debuggers, requested by David Beazley.
|
|
||||||
Don't use unless you know what you are doing! */
|
|
||||||
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
|
|
||||||
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
|
|
||||||
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
|
|
||||||
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
|
|
||||||
|
|
||||||
typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_);
|
|
||||||
|
|
||||||
/* hook for PyEval_GetFrame(), requested for Psyco */
|
|
||||||
PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_PYSTATE_H */
|
|
|
@ -1,181 +0,0 @@
|
||||||
|
|
||||||
/* Interfaces to parse and execute pieces of python code */
|
|
||||||
|
|
||||||
#ifndef Py_PYTHONRUN_H
|
|
||||||
#define Py_PYTHONRUN_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
|
|
||||||
CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
|
|
||||||
CO_FUTURE_UNICODE_LITERALS)
|
|
||||||
#define PyCF_MASK_OBSOLETE (CO_NESTED)
|
|
||||||
#define PyCF_SOURCE_IS_UTF8 0x0100
|
|
||||||
#define PyCF_DONT_IMPLY_DEDENT 0x0200
|
|
||||||
#define PyCF_ONLY_AST 0x0400
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int cf_flags; /* bitmask of CO_xxx flags relevant to future */
|
|
||||||
} PyCompilerFlags;
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) Py_SetProgramName(char *);
|
|
||||||
PyAPI_FUNC(char *) Py_GetProgramName(void);
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) Py_SetPythonHome(char *);
|
|
||||||
PyAPI_FUNC(char *) Py_GetPythonHome(void);
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) Py_Initialize(void);
|
|
||||||
PyAPI_FUNC(void) Py_InitializeEx(int);
|
|
||||||
PyAPI_FUNC(void) Py_Finalize(void);
|
|
||||||
PyAPI_FUNC(int) Py_IsInitialized(void);
|
|
||||||
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
|
|
||||||
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
|
|
||||||
PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
|
|
||||||
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
|
|
||||||
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
|
|
||||||
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
|
|
||||||
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *,
|
|
||||||
int, PyCompilerFlags *flags,
|
|
||||||
PyArena *);
|
|
||||||
PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int,
|
|
||||||
char *, char *,
|
|
||||||
PyCompilerFlags *, int *,
|
|
||||||
PyArena *);
|
|
||||||
#define PyParser_SimpleParseString(S, B) \
|
|
||||||
PyParser_SimpleParseStringFlags(S, B, 0)
|
|
||||||
#define PyParser_SimpleParseFile(FP, S, B) \
|
|
||||||
PyParser_SimpleParseFileFlags(FP, S, B, 0)
|
|
||||||
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
|
|
||||||
int);
|
|
||||||
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
|
|
||||||
int, int);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
|
|
||||||
PyObject *, PyCompilerFlags *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int,
|
|
||||||
PyObject *, PyObject *, int,
|
|
||||||
PyCompilerFlags *);
|
|
||||||
|
|
||||||
#define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL)
|
|
||||||
PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
|
|
||||||
PyCompilerFlags *);
|
|
||||||
PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyErr_Print(void);
|
|
||||||
PyAPI_FUNC(void) PyErr_PrintEx(int);
|
|
||||||
PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) Py_Exit(int);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
|
|
||||||
|
|
||||||
/* Bootstrap */
|
|
||||||
PyAPI_FUNC(int) Py_Main(int argc, char **argv);
|
|
||||||
|
|
||||||
/* Use macros for a bunch of old variants */
|
|
||||||
#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
|
|
||||||
#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
|
|
||||||
#define PyRun_AnyFileEx(fp, name, closeit) \
|
|
||||||
PyRun_AnyFileExFlags(fp, name, closeit, NULL)
|
|
||||||
#define PyRun_AnyFileFlags(fp, name, flags) \
|
|
||||||
PyRun_AnyFileExFlags(fp, name, 0, flags)
|
|
||||||
#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
|
|
||||||
#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
|
|
||||||
#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
|
|
||||||
#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
|
|
||||||
#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
|
|
||||||
#define PyRun_File(fp, p, s, g, l) \
|
|
||||||
PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
|
|
||||||
#define PyRun_FileEx(fp, p, s, g, l, c) \
|
|
||||||
PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
|
|
||||||
#define PyRun_FileFlags(fp, p, s, g, l, flags) \
|
|
||||||
PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
|
|
||||||
|
|
||||||
/* In getpath.c */
|
|
||||||
PyAPI_FUNC(char *) Py_GetProgramFullPath(void);
|
|
||||||
PyAPI_FUNC(char *) Py_GetPrefix(void);
|
|
||||||
PyAPI_FUNC(char *) Py_GetExecPrefix(void);
|
|
||||||
PyAPI_FUNC(char *) Py_GetPath(void);
|
|
||||||
|
|
||||||
/* In their own files */
|
|
||||||
PyAPI_FUNC(const char *) Py_GetVersion(void);
|
|
||||||
PyAPI_FUNC(const char *) Py_GetPlatform(void);
|
|
||||||
PyAPI_FUNC(const char *) Py_GetCopyright(void);
|
|
||||||
PyAPI_FUNC(const char *) Py_GetCompiler(void);
|
|
||||||
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
|
|
||||||
PyAPI_FUNC(const char *) _Py_svnversion(void);
|
|
||||||
PyAPI_FUNC(const char *) Py_SubversionRevision(void);
|
|
||||||
PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
|
|
||||||
PyAPI_FUNC(const char *) _Py_hgidentifier(void);
|
|
||||||
PyAPI_FUNC(const char *) _Py_hgversion(void);
|
|
||||||
|
|
||||||
/* Internal -- various one-time initializations */
|
|
||||||
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
|
|
||||||
PyAPI_FUNC(PyObject *) _PySys_Init(void);
|
|
||||||
PyAPI_FUNC(void) _PyImport_Init(void);
|
|
||||||
PyAPI_FUNC(void) _PyExc_Init(void);
|
|
||||||
PyAPI_FUNC(void) _PyImportHooks_Init(void);
|
|
||||||
PyAPI_FUNC(int) _PyFrame_Init(void);
|
|
||||||
PyAPI_FUNC(int) _PyInt_Init(void);
|
|
||||||
PyAPI_FUNC(int) _PyLong_Init(void);
|
|
||||||
PyAPI_FUNC(void) _PyFloat_Init(void);
|
|
||||||
PyAPI_FUNC(int) PyByteArray_Init(void);
|
|
||||||
PyAPI_FUNC(void) _PyRandom_Init(void);
|
|
||||||
|
|
||||||
/* Various internal finalizers */
|
|
||||||
PyAPI_FUNC(void) _PyExc_Fini(void);
|
|
||||||
PyAPI_FUNC(void) _PyImport_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyMethod_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyFrame_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyCFunction_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyDict_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyTuple_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyList_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PySet_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyString_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyInt_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyFloat_Fini(void);
|
|
||||||
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
|
|
||||||
PyAPI_FUNC(void) PyByteArray_Fini(void);
|
|
||||||
|
|
||||||
/* Stuff with no proper home (yet) */
|
|
||||||
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
|
|
||||||
PyAPI_DATA(int) (*PyOS_InputHook)(void);
|
|
||||||
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
|
|
||||||
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
|
|
||||||
|
|
||||||
/* Stack size, in "pointers" (so we get extra safety margins
|
|
||||||
on 64-bit platforms). On a 32-bit platform, this translates
|
|
||||||
to a 8k margin. */
|
|
||||||
#define PYOS_STACK_MARGIN 2048
|
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
|
|
||||||
/* Enable stack checking under Microsoft C */
|
|
||||||
#define USE_STACKCHECK
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_STACKCHECK
|
|
||||||
/* Check that we aren't overflowing our stack */
|
|
||||||
PyAPI_FUNC(int) PyOS_CheckStack(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
typedef void (*PyOS_sighandler_t)(int);
|
|
||||||
PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
|
|
||||||
PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
|
|
||||||
|
|
||||||
/* Random */
|
|
||||||
PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_PYTHONRUN_H */
|
|
|
@ -1,41 +0,0 @@
|
||||||
|
|
||||||
#ifndef Py_PYTHREAD_H
|
|
||||||
#define Py_PYTHREAD_H
|
|
||||||
|
|
||||||
typedef void *PyThread_type_lock;
|
|
||||||
typedef void *PyThread_type_sema;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyThread_init_thread(void);
|
|
||||||
PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *);
|
|
||||||
PyAPI_FUNC(void) PyThread_exit_thread(void);
|
|
||||||
PyAPI_FUNC(long) PyThread_get_thread_ident(void);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void);
|
|
||||||
PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock);
|
|
||||||
PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int);
|
|
||||||
#define WAIT_LOCK 1
|
|
||||||
#define NOWAIT_LOCK 0
|
|
||||||
PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock);
|
|
||||||
|
|
||||||
PyAPI_FUNC(size_t) PyThread_get_stacksize(void);
|
|
||||||
PyAPI_FUNC(int) PyThread_set_stacksize(size_t);
|
|
||||||
|
|
||||||
/* Thread Local Storage (TLS) API */
|
|
||||||
PyAPI_FUNC(int) PyThread_create_key(void);
|
|
||||||
PyAPI_FUNC(void) PyThread_delete_key(int);
|
|
||||||
PyAPI_FUNC(int) PyThread_set_key_value(int, void *);
|
|
||||||
PyAPI_FUNC(void *) PyThread_get_key_value(int);
|
|
||||||
PyAPI_FUNC(void) PyThread_delete_key_value(int key);
|
|
||||||
|
|
||||||
/* Cleanup after a fork */
|
|
||||||
PyAPI_FUNC(void) PyThread_ReInitTLS(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !Py_PYTHREAD_H */
|
|
|
@ -1,44 +0,0 @@
|
||||||
#ifndef Py_SLICEOBJECT_H
|
|
||||||
#define Py_SLICEOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The unique ellipsis object "..." */
|
|
||||||
|
|
||||||
PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
|
|
||||||
|
|
||||||
#define Py_Ellipsis (&_Py_EllipsisObject)
|
|
||||||
|
|
||||||
/* Slice object interface */
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
A slice object containing start, stop, and step data members (the
|
|
||||||
names are from range). After much talk with Guido, it was decided to
|
|
||||||
let these be any arbitrary python type. Py_None stands for omitted values.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *start, *stop, *step; /* not NULL */
|
|
||||||
} PySliceObject;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PySlice_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
|
|
||||||
|
|
||||||
#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
|
|
||||||
PyObject* step);
|
|
||||||
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
|
|
||||||
PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
|
|
||||||
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
|
|
||||||
PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length,
|
|
||||||
Py_ssize_t *start, Py_ssize_t *stop,
|
|
||||||
Py_ssize_t *step, Py_ssize_t *slicelength);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_SLICEOBJECT_H */
|
|
|
@ -1,210 +0,0 @@
|
||||||
|
|
||||||
/* String (str/bytes) object interface */
|
|
||||||
|
|
||||||
#ifndef Py_STRINGOBJECT_H
|
|
||||||
#define Py_STRINGOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
Type PyStringObject represents a character string. An extra zero byte is
|
|
||||||
reserved at the end to ensure it is zero-terminated, but a size is
|
|
||||||
present so strings with null bytes in them can be represented. This
|
|
||||||
is an immutable object type.
|
|
||||||
|
|
||||||
There are functions to create new string objects, to test
|
|
||||||
an object for string-ness, and to get the
|
|
||||||
string value. The latter function returns a null pointer
|
|
||||||
if the object is not of the proper type.
|
|
||||||
There is a variant that takes an explicit size as well as a
|
|
||||||
variant that assumes a zero-terminated string. Note that none of the
|
|
||||||
functions should be applied to nil objects.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
|
|
||||||
Interning strings (ob_sstate) tries to ensure that only one string
|
|
||||||
object with a given value exists, so equality tests can be one pointer
|
|
||||||
comparison. This is generally restricted to strings that "look like"
|
|
||||||
Python identifiers, although the intern() builtin can be used to force
|
|
||||||
interning of any string.
|
|
||||||
Together, these sped the interpreter by up to 20%. */
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_VAR_HEAD
|
|
||||||
long ob_shash;
|
|
||||||
int ob_sstate;
|
|
||||||
char ob_sval[1];
|
|
||||||
|
|
||||||
/* Invariants:
|
|
||||||
* ob_sval contains space for 'ob_size+1' elements.
|
|
||||||
* ob_sval[ob_size] == 0.
|
|
||||||
* ob_shash is the hash of the string or -1 if not computed yet.
|
|
||||||
* ob_sstate != 0 iff the string object is in stringobject.c's
|
|
||||||
* 'interned' dictionary; in this case the two references
|
|
||||||
* from 'interned' to this object are *not counted* in ob_refcnt.
|
|
||||||
*/
|
|
||||||
} PyStringObject;
|
|
||||||
|
|
||||||
#define SSTATE_NOT_INTERNED 0
|
|
||||||
#define SSTATE_INTERNED_MORTAL 1
|
|
||||||
#define SSTATE_INTERNED_IMMORTAL 2
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyBaseString_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyString_Type;
|
|
||||||
|
|
||||||
#define PyString_Check(op) \
|
|
||||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS)
|
|
||||||
#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
|
|
||||||
PyAPI_FUNC(PyObject *) PyString_FromString(const char *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list)
|
|
||||||
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
|
|
||||||
PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...)
|
|
||||||
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
|
||||||
PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *);
|
|
||||||
PyAPI_FUNC(char *) PyString_AsString(PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int);
|
|
||||||
PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *);
|
|
||||||
PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *);
|
|
||||||
PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t);
|
|
||||||
PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*);
|
|
||||||
PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *);
|
|
||||||
PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int,
|
|
||||||
int, char**, int*);
|
|
||||||
PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t,
|
|
||||||
const char *, Py_ssize_t,
|
|
||||||
const char *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyString_InternInPlace(PyObject **);
|
|
||||||
PyAPI_FUNC(void) PyString_InternImmortal(PyObject **);
|
|
||||||
PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *);
|
|
||||||
PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void);
|
|
||||||
|
|
||||||
/* Use only if you know it's a string */
|
|
||||||
#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate)
|
|
||||||
|
|
||||||
/* Macro, trading safety for speed */
|
|
||||||
#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
|
|
||||||
#define PyString_GET_SIZE(op) Py_SIZE(op)
|
|
||||||
|
|
||||||
/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*,
|
|
||||||
x must be an iterable object. */
|
|
||||||
PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x);
|
|
||||||
|
|
||||||
/* --- Generic Codecs ----------------------------------------------------- */
|
|
||||||
|
|
||||||
/* Create an object by decoding the encoded string s of the
|
|
||||||
given size. */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) PyString_Decode(
|
|
||||||
const char *s, /* encoded string */
|
|
||||||
Py_ssize_t size, /* size of buffer */
|
|
||||||
const char *encoding, /* encoding */
|
|
||||||
const char *errors /* error handling */
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Encodes a char buffer of the given size and returns a
|
|
||||||
Python object. */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) PyString_Encode(
|
|
||||||
const char *s, /* string char buffer */
|
|
||||||
Py_ssize_t size, /* number of chars to encode */
|
|
||||||
const char *encoding, /* encoding */
|
|
||||||
const char *errors /* error handling */
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Encodes a string object and returns the result as Python
|
|
||||||
object. */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) PyString_AsEncodedObject(
|
|
||||||
PyObject *str, /* string object */
|
|
||||||
const char *encoding, /* encoding */
|
|
||||||
const char *errors /* error handling */
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Encodes a string object and returns the result as Python string
|
|
||||||
object.
|
|
||||||
|
|
||||||
If the codec returns an Unicode object, the object is converted
|
|
||||||
back to a string using the default encoding.
|
|
||||||
|
|
||||||
DEPRECATED - use PyString_AsEncodedObject() instead. */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) PyString_AsEncodedString(
|
|
||||||
PyObject *str, /* string object */
|
|
||||||
const char *encoding, /* encoding */
|
|
||||||
const char *errors /* error handling */
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Decodes a string object and returns the result as Python
|
|
||||||
object. */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) PyString_AsDecodedObject(
|
|
||||||
PyObject *str, /* string object */
|
|
||||||
const char *encoding, /* encoding */
|
|
||||||
const char *errors /* error handling */
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Decodes a string object and returns the result as Python string
|
|
||||||
object.
|
|
||||||
|
|
||||||
If the codec returns an Unicode object, the object is converted
|
|
||||||
back to a string using the default encoding.
|
|
||||||
|
|
||||||
DEPRECATED - use PyString_AsDecodedObject() instead. */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) PyString_AsDecodedString(
|
|
||||||
PyObject *str, /* string object */
|
|
||||||
const char *encoding, /* encoding */
|
|
||||||
const char *errors /* error handling */
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Provides access to the internal data buffer and size of a string
|
|
||||||
object or the default encoded version of an Unicode object. Passing
|
|
||||||
NULL as *len parameter will force the string buffer to be
|
|
||||||
0-terminated (passing a string with embedded NULL characters will
|
|
||||||
cause an exception). */
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyString_AsStringAndSize(
|
|
||||||
register PyObject *obj, /* string or Unicode object */
|
|
||||||
register char **s, /* pointer to buffer variable */
|
|
||||||
register Py_ssize_t *len /* pointer to length variable or NULL
|
|
||||||
(only possible for 0-terminated
|
|
||||||
strings) */
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/* Using the current locale, insert the thousands grouping
|
|
||||||
into the string pointed to by buffer. For the argument descriptions,
|
|
||||||
see Objects/stringlib/localeutil.h */
|
|
||||||
PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGroupingLocale(char *buffer,
|
|
||||||
Py_ssize_t n_buffer,
|
|
||||||
char *digits,
|
|
||||||
Py_ssize_t n_digits,
|
|
||||||
Py_ssize_t min_width);
|
|
||||||
|
|
||||||
/* Using explicit passed-in values, insert the thousands grouping
|
|
||||||
into the string pointed to by buffer. For the argument descriptions,
|
|
||||||
see Objects/stringlib/localeutil.h */
|
|
||||||
PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGrouping(char *buffer,
|
|
||||||
Py_ssize_t n_buffer,
|
|
||||||
char *digits,
|
|
||||||
Py_ssize_t n_digits,
|
|
||||||
Py_ssize_t min_width,
|
|
||||||
const char *grouping,
|
|
||||||
const char *thousands_sep);
|
|
||||||
|
|
||||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
|
||||||
(Advanced String Formatting). */
|
|
||||||
PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj,
|
|
||||||
char *format_spec,
|
|
||||||
Py_ssize_t format_spec_len);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_STRINGOBJECT_H */
|
|
|
@ -1,99 +0,0 @@
|
||||||
#ifndef Py_STRUCTMEMBER_H
|
|
||||||
#define Py_STRUCTMEMBER_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Interface to map C struct members to Python object attributes */
|
|
||||||
|
|
||||||
#include <stddef.h> /* For offsetof */
|
|
||||||
|
|
||||||
/* The offsetof() macro calculates the offset of a structure member
|
|
||||||
in its structure. Unfortunately this cannot be written down
|
|
||||||
portably, hence it is provided by a Standard C header file.
|
|
||||||
For pre-Standard C compilers, here is a version that usually works
|
|
||||||
(but watch out!): */
|
|
||||||
|
|
||||||
#ifndef offsetof
|
|
||||||
#define offsetof(type, member) ( (int) & ((type*)0) -> member )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* An array of memberlist structures defines the name, type and offset
|
|
||||||
of selected members of a C structure. These can be read by
|
|
||||||
PyMember_Get() and set by PyMember_Set() (except if their READONLY flag
|
|
||||||
is set). The array must be terminated with an entry whose name
|
|
||||||
pointer is NULL. */
|
|
||||||
|
|
||||||
struct memberlist {
|
|
||||||
/* Obsolete version, for binary backwards compatibility */
|
|
||||||
char *name;
|
|
||||||
int type;
|
|
||||||
int offset;
|
|
||||||
int flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct PyMemberDef {
|
|
||||||
/* Current version, use this */
|
|
||||||
char *name;
|
|
||||||
int type;
|
|
||||||
Py_ssize_t offset;
|
|
||||||
int flags;
|
|
||||||
char *doc;
|
|
||||||
} PyMemberDef;
|
|
||||||
|
|
||||||
/* Types */
|
|
||||||
#define T_SHORT 0
|
|
||||||
#define T_INT 1
|
|
||||||
#define T_LONG 2
|
|
||||||
#define T_FLOAT 3
|
|
||||||
#define T_DOUBLE 4
|
|
||||||
#define T_STRING 5
|
|
||||||
#define T_OBJECT 6
|
|
||||||
/* XXX the ordering here is weird for binary compatibility */
|
|
||||||
#define T_CHAR 7 /* 1-character string */
|
|
||||||
#define T_BYTE 8 /* 8-bit signed int */
|
|
||||||
/* unsigned variants: */
|
|
||||||
#define T_UBYTE 9
|
|
||||||
#define T_USHORT 10
|
|
||||||
#define T_UINT 11
|
|
||||||
#define T_ULONG 12
|
|
||||||
|
|
||||||
/* Added by Jack: strings contained in the structure */
|
|
||||||
#define T_STRING_INPLACE 13
|
|
||||||
|
|
||||||
/* Added by Lillo: bools contained in the structure (assumed char) */
|
|
||||||
#define T_BOOL 14
|
|
||||||
|
|
||||||
#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
|
|
||||||
when the value is NULL, instead of
|
|
||||||
converting to None. */
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
#define T_LONGLONG 17
|
|
||||||
#define T_ULONGLONG 18
|
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
|
|
||||||
#define T_PYSSIZET 19 /* Py_ssize_t */
|
|
||||||
|
|
||||||
|
|
||||||
/* Flags */
|
|
||||||
#define READONLY 1
|
|
||||||
#define RO READONLY /* Shorthand */
|
|
||||||
#define READ_RESTRICTED 2
|
|
||||||
#define PY_WRITE_RESTRICTED 4
|
|
||||||
#define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED)
|
|
||||||
|
|
||||||
|
|
||||||
/* Obsolete API, for binary backwards compatibility */
|
|
||||||
PyAPI_FUNC(PyObject *) PyMember_Get(const char *, struct memberlist *, const char *);
|
|
||||||
PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *);
|
|
||||||
|
|
||||||
/* Current API, use this */
|
|
||||||
PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *);
|
|
||||||
PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_STRUCTMEMBER_H */
|
|
|
@ -1,41 +0,0 @@
|
||||||
|
|
||||||
/* Tuple object interface */
|
|
||||||
|
|
||||||
#ifndef Py_STRUCTSEQ_H
|
|
||||||
#define Py_STRUCTSEQ_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct PyStructSequence_Field {
|
|
||||||
char *name;
|
|
||||||
char *doc;
|
|
||||||
} PyStructSequence_Field;
|
|
||||||
|
|
||||||
typedef struct PyStructSequence_Desc {
|
|
||||||
char *name;
|
|
||||||
char *doc;
|
|
||||||
struct PyStructSequence_Field *fields;
|
|
||||||
int n_in_sequence;
|
|
||||||
} PyStructSequence_Desc;
|
|
||||||
|
|
||||||
extern char* PyStructSequence_UnnamedField;
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
|
|
||||||
PyStructSequence_Desc *desc);
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_VAR_HEAD
|
|
||||||
PyObject *ob_item[1];
|
|
||||||
} PyStructSequence;
|
|
||||||
|
|
||||||
/* Macro, *only* to be used to fill in brand new objects */
|
|
||||||
#define PyStructSequence_SET_ITEM(op, i, v) \
|
|
||||||
(((PyStructSequence *)(op))->ob_item[i] = v)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_STRUCTSEQ_H */
|
|
|
@ -1,98 +0,0 @@
|
||||||
#ifndef Py_SYMTABLE_H
|
|
||||||
#define Py_SYMTABLE_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock }
|
|
||||||
_Py_block_ty;
|
|
||||||
|
|
||||||
struct _symtable_entry;
|
|
||||||
|
|
||||||
struct symtable {
|
|
||||||
const char *st_filename; /* name of file being compiled */
|
|
||||||
struct _symtable_entry *st_cur; /* current symbol table entry */
|
|
||||||
struct _symtable_entry *st_top; /* module entry */
|
|
||||||
PyObject *st_symbols; /* dictionary of symbol table entries */
|
|
||||||
PyObject *st_stack; /* stack of namespace info */
|
|
||||||
PyObject *st_global; /* borrowed ref to MODULE in st_symbols */
|
|
||||||
int st_nblocks; /* number of blocks */
|
|
||||||
PyObject *st_private; /* name of current class or NULL */
|
|
||||||
PyFutureFeatures *st_future; /* module's future features */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _symtable_entry {
|
|
||||||
PyObject_HEAD
|
|
||||||
PyObject *ste_id; /* int: key in st_symbols */
|
|
||||||
PyObject *ste_symbols; /* dict: name to flags */
|
|
||||||
PyObject *ste_name; /* string: name of block */
|
|
||||||
PyObject *ste_varnames; /* list of variable names */
|
|
||||||
PyObject *ste_children; /* list of child ids */
|
|
||||||
_Py_block_ty ste_type; /* module, class, or function */
|
|
||||||
int ste_unoptimized; /* false if namespace is optimized */
|
|
||||||
int ste_nested; /* true if block is nested */
|
|
||||||
unsigned ste_free : 1; /* true if block has free variables */
|
|
||||||
unsigned ste_child_free : 1; /* true if a child block has free vars,
|
|
||||||
including free refs to globals */
|
|
||||||
unsigned ste_generator : 1; /* true if namespace is a generator */
|
|
||||||
unsigned ste_varargs : 1; /* true if block has varargs */
|
|
||||||
unsigned ste_varkeywords : 1; /* true if block has varkeywords */
|
|
||||||
unsigned ste_returns_value : 1; /* true if namespace uses return with
|
|
||||||
an argument */
|
|
||||||
int ste_lineno; /* first line of block */
|
|
||||||
int ste_opt_lineno; /* lineno of last exec or import * */
|
|
||||||
int ste_tmpname; /* counter for listcomp temp vars */
|
|
||||||
struct symtable *ste_table;
|
|
||||||
} PySTEntryObject;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PySTEntry_Type;
|
|
||||||
|
|
||||||
#define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type)
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *,
|
|
||||||
PyFutureFeatures *);
|
|
||||||
PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
|
|
||||||
|
|
||||||
/* Flags for def-use information */
|
|
||||||
|
|
||||||
#define DEF_GLOBAL 1 /* global stmt */
|
|
||||||
#define DEF_LOCAL 2 /* assignment in code block */
|
|
||||||
#define DEF_PARAM 2<<1 /* formal parameter */
|
|
||||||
#define USE 2<<2 /* name is used */
|
|
||||||
#define DEF_FREE 2<<3 /* name used but not defined in nested block */
|
|
||||||
#define DEF_FREE_CLASS 2<<4 /* free variable from class's method */
|
|
||||||
#define DEF_IMPORT 2<<5 /* assignment occurred via import */
|
|
||||||
|
|
||||||
#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT)
|
|
||||||
|
|
||||||
/* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol
|
|
||||||
table. GLOBAL is returned from PyST_GetScope() for either of them.
|
|
||||||
It is stored in ste_symbols at bits 12-14.
|
|
||||||
*/
|
|
||||||
#define SCOPE_OFF 11
|
|
||||||
#define SCOPE_MASK 7
|
|
||||||
|
|
||||||
#define LOCAL 1
|
|
||||||
#define GLOBAL_EXPLICIT 2
|
|
||||||
#define GLOBAL_IMPLICIT 3
|
|
||||||
#define FREE 4
|
|
||||||
#define CELL 5
|
|
||||||
|
|
||||||
/* The following three names are used for the ste_unoptimized bit field */
|
|
||||||
#define OPT_IMPORT_STAR 1
|
|
||||||
#define OPT_EXEC 2
|
|
||||||
#define OPT_BARE_EXEC 4
|
|
||||||
#define OPT_TOPLEVEL 8 /* top-level names, including eval and exec */
|
|
||||||
|
|
||||||
#define GENERATOR 1
|
|
||||||
#define GENERATOR_EXPRESSION 2
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_SYMTABLE_H */
|
|
|
@ -1,29 +0,0 @@
|
||||||
|
|
||||||
/* System module interface */
|
|
||||||
|
|
||||||
#ifndef Py_SYSMODULE_H
|
|
||||||
#define Py_SYSMODULE_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PySys_GetObject(char *);
|
|
||||||
PyAPI_FUNC(int) PySys_SetObject(char *, PyObject *);
|
|
||||||
PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *);
|
|
||||||
PyAPI_FUNC(void) PySys_SetArgv(int, char **);
|
|
||||||
PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int);
|
|
||||||
PyAPI_FUNC(void) PySys_SetPath(char *);
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
|
|
||||||
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
|
||||||
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
|
|
||||||
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
|
|
||||||
PyAPI_FUNC(void) PySys_AddWarnOption(char *);
|
|
||||||
PyAPI_FUNC(int) PySys_HasWarnOptions(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_SYSMODULE_H */
|
|
|
@ -1,26 +0,0 @@
|
||||||
/* timefuncs.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Utility function related to timemodule.c. */
|
|
||||||
|
|
||||||
#ifndef TIMEFUNCS_H
|
|
||||||
#define TIMEFUNCS_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Cast double x to time_t, but raise ValueError if x is too large
|
|
||||||
* to fit in a time_t. ValueError is set on return iff the return
|
|
||||||
* value is (time_t)-1 and PyErr_Occurred().
|
|
||||||
*/
|
|
||||||
PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x);
|
|
||||||
|
|
||||||
/* Get the current time since the epoch in seconds */
|
|
||||||
PyAPI_FUNC(double) _PyTime_FloatTime(void);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* TIMEFUNCS_H */
|
|
|
@ -1,85 +0,0 @@
|
||||||
|
|
||||||
/* Token types */
|
|
||||||
|
|
||||||
#ifndef Py_TOKEN_H
|
|
||||||
#define Py_TOKEN_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */
|
|
||||||
|
|
||||||
#define ENDMARKER 0
|
|
||||||
#define NAME 1
|
|
||||||
#define NUMBER 2
|
|
||||||
#define STRING 3
|
|
||||||
#define NEWLINE 4
|
|
||||||
#define INDENT 5
|
|
||||||
#define DEDENT 6
|
|
||||||
#define LPAR 7
|
|
||||||
#define RPAR 8
|
|
||||||
#define LSQB 9
|
|
||||||
#define RSQB 10
|
|
||||||
#define COLON 11
|
|
||||||
#define COMMA 12
|
|
||||||
#define SEMI 13
|
|
||||||
#define PLUS 14
|
|
||||||
#define MINUS 15
|
|
||||||
#define STAR 16
|
|
||||||
#define SLASH 17
|
|
||||||
#define VBAR 18
|
|
||||||
#define AMPER 19
|
|
||||||
#define LESS 20
|
|
||||||
#define GREATER 21
|
|
||||||
#define EQUAL 22
|
|
||||||
#define DOT 23
|
|
||||||
#define PERCENT 24
|
|
||||||
#define BACKQUOTE 25
|
|
||||||
#define LBRACE 26
|
|
||||||
#define RBRACE 27
|
|
||||||
#define EQEQUAL 28
|
|
||||||
#define NOTEQUAL 29
|
|
||||||
#define LESSEQUAL 30
|
|
||||||
#define GREATEREQUAL 31
|
|
||||||
#define TILDE 32
|
|
||||||
#define CIRCUMFLEX 33
|
|
||||||
#define LEFTSHIFT 34
|
|
||||||
#define RIGHTSHIFT 35
|
|
||||||
#define DOUBLESTAR 36
|
|
||||||
#define PLUSEQUAL 37
|
|
||||||
#define MINEQUAL 38
|
|
||||||
#define STAREQUAL 39
|
|
||||||
#define SLASHEQUAL 40
|
|
||||||
#define PERCENTEQUAL 41
|
|
||||||
#define AMPEREQUAL 42
|
|
||||||
#define VBAREQUAL 43
|
|
||||||
#define CIRCUMFLEXEQUAL 44
|
|
||||||
#define LEFTSHIFTEQUAL 45
|
|
||||||
#define RIGHTSHIFTEQUAL 46
|
|
||||||
#define DOUBLESTAREQUAL 47
|
|
||||||
#define DOUBLESLASH 48
|
|
||||||
#define DOUBLESLASHEQUAL 49
|
|
||||||
#define AT 50
|
|
||||||
/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
|
|
||||||
#define OP 51
|
|
||||||
#define ERRORTOKEN 52
|
|
||||||
#define N_TOKENS 53
|
|
||||||
|
|
||||||
/* Special definitions for cooperation with parser */
|
|
||||||
|
|
||||||
#define NT_OFFSET 256
|
|
||||||
|
|
||||||
#define ISTERMINAL(x) ((x) < NT_OFFSET)
|
|
||||||
#define ISNONTERMINAL(x) ((x) >= NT_OFFSET)
|
|
||||||
#define ISEOF(x) ((x) == ENDMARKER)
|
|
||||||
|
|
||||||
|
|
||||||
PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */
|
|
||||||
PyAPI_FUNC(int) PyToken_OneChar(int);
|
|
||||||
PyAPI_FUNC(int) PyToken_TwoChars(int, int);
|
|
||||||
PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_TOKEN_H */
|
|
|
@ -1,31 +0,0 @@
|
||||||
|
|
||||||
#ifndef Py_TRACEBACK_H
|
|
||||||
#define Py_TRACEBACK_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct _frame;
|
|
||||||
|
|
||||||
/* Traceback interface */
|
|
||||||
|
|
||||||
typedef struct _traceback {
|
|
||||||
PyObject_HEAD
|
|
||||||
struct _traceback *tb_next;
|
|
||||||
struct _frame *tb_frame;
|
|
||||||
int tb_lasti;
|
|
||||||
int tb_lineno;
|
|
||||||
} PyTracebackObject;
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *);
|
|
||||||
PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *);
|
|
||||||
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int);
|
|
||||||
|
|
||||||
/* Reveal traceback type so we can typecheck traceback objects */
|
|
||||||
PyAPI_DATA(PyTypeObject) PyTraceBack_Type;
|
|
||||||
#define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_TRACEBACK_H */
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,23 +0,0 @@
|
||||||
#ifndef Py_WARNINGS_H
|
|
||||||
#define Py_WARNINGS_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) _PyWarnings_Init(void);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t);
|
|
||||||
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int,
|
|
||||||
const char *, PyObject *);
|
|
||||||
|
|
||||||
#define PyErr_WarnPy3k(msg, stacklevel) \
|
|
||||||
(Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0)
|
|
||||||
|
|
||||||
/* DEPRECATED: Use PyErr_WarnEx() instead. */
|
|
||||||
#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !Py_WARNINGS_H */
|
|
||||||
|
|
569
Darwin/include/python3.4m/Python-ast.h
Normal file
569
Darwin/include/python3.4m/Python-ast.h
Normal file
|
@ -0,0 +1,569 @@
|
||||||
|
/* File automatically generated by Parser/asdl_c.py. */
|
||||||
|
|
||||||
|
#include "asdl.h"
|
||||||
|
|
||||||
|
typedef struct _mod *mod_ty;
|
||||||
|
|
||||||
|
typedef struct _stmt *stmt_ty;
|
||||||
|
|
||||||
|
typedef struct _expr *expr_ty;
|
||||||
|
|
||||||
|
typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5,
|
||||||
|
Param=6 } expr_context_ty;
|
||||||
|
|
||||||
|
typedef struct _slice *slice_ty;
|
||||||
|
|
||||||
|
typedef enum _boolop { And=1, Or=2 } boolop_ty;
|
||||||
|
|
||||||
|
typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7,
|
||||||
|
RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 }
|
||||||
|
operator_ty;
|
||||||
|
|
||||||
|
typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
|
||||||
|
|
||||||
|
typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
|
||||||
|
In=9, NotIn=10 } cmpop_ty;
|
||||||
|
|
||||||
|
typedef struct _comprehension *comprehension_ty;
|
||||||
|
|
||||||
|
typedef struct _excepthandler *excepthandler_ty;
|
||||||
|
|
||||||
|
typedef struct _arguments *arguments_ty;
|
||||||
|
|
||||||
|
typedef struct _arg *arg_ty;
|
||||||
|
|
||||||
|
typedef struct _keyword *keyword_ty;
|
||||||
|
|
||||||
|
typedef struct _alias *alias_ty;
|
||||||
|
|
||||||
|
typedef struct _withitem *withitem_ty;
|
||||||
|
|
||||||
|
|
||||||
|
enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
|
||||||
|
Suite_kind=4};
|
||||||
|
struct _mod {
|
||||||
|
enum _mod_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
asdl_seq *body;
|
||||||
|
} Module;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *body;
|
||||||
|
} Interactive;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty body;
|
||||||
|
} Expression;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *body;
|
||||||
|
} Suite;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3,
|
||||||
|
Delete_kind=4, Assign_kind=5, AugAssign_kind=6, For_kind=7,
|
||||||
|
While_kind=8, If_kind=9, With_kind=10, Raise_kind=11,
|
||||||
|
Try_kind=12, Assert_kind=13, Import_kind=14,
|
||||||
|
ImportFrom_kind=15, Global_kind=16, Nonlocal_kind=17,
|
||||||
|
Expr_kind=18, Pass_kind=19, Break_kind=20, Continue_kind=21};
|
||||||
|
struct _stmt {
|
||||||
|
enum _stmt_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
identifier name;
|
||||||
|
arguments_ty args;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *decorator_list;
|
||||||
|
expr_ty returns;
|
||||||
|
} FunctionDef;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
identifier name;
|
||||||
|
asdl_seq *bases;
|
||||||
|
asdl_seq *keywords;
|
||||||
|
expr_ty starargs;
|
||||||
|
expr_ty kwargs;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *decorator_list;
|
||||||
|
} ClassDef;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Return;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *targets;
|
||||||
|
} Delete;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *targets;
|
||||||
|
expr_ty value;
|
||||||
|
} Assign;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty target;
|
||||||
|
operator_ty op;
|
||||||
|
expr_ty value;
|
||||||
|
} AugAssign;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty target;
|
||||||
|
expr_ty iter;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
} For;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty test;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
} While;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty test;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
} If;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *items;
|
||||||
|
asdl_seq *body;
|
||||||
|
} With;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty exc;
|
||||||
|
expr_ty cause;
|
||||||
|
} Raise;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *handlers;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
asdl_seq *finalbody;
|
||||||
|
} Try;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty test;
|
||||||
|
expr_ty msg;
|
||||||
|
} Assert;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *names;
|
||||||
|
} Import;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
identifier module;
|
||||||
|
asdl_seq *names;
|
||||||
|
int level;
|
||||||
|
} ImportFrom;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *names;
|
||||||
|
} Global;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *names;
|
||||||
|
} Nonlocal;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Expr;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
int lineno;
|
||||||
|
int col_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
|
||||||
|
IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8,
|
||||||
|
SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,
|
||||||
|
Yield_kind=12, YieldFrom_kind=13, Compare_kind=14,
|
||||||
|
Call_kind=15, Num_kind=16, Str_kind=17, Bytes_kind=18,
|
||||||
|
NameConstant_kind=19, Ellipsis_kind=20, Attribute_kind=21,
|
||||||
|
Subscript_kind=22, Starred_kind=23, Name_kind=24,
|
||||||
|
List_kind=25, Tuple_kind=26};
|
||||||
|
struct _expr {
|
||||||
|
enum _expr_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
boolop_ty op;
|
||||||
|
asdl_seq *values;
|
||||||
|
} BoolOp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty left;
|
||||||
|
operator_ty op;
|
||||||
|
expr_ty right;
|
||||||
|
} BinOp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
unaryop_ty op;
|
||||||
|
expr_ty operand;
|
||||||
|
} UnaryOp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
arguments_ty args;
|
||||||
|
expr_ty body;
|
||||||
|
} Lambda;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty test;
|
||||||
|
expr_ty body;
|
||||||
|
expr_ty orelse;
|
||||||
|
} IfExp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *keys;
|
||||||
|
asdl_seq *values;
|
||||||
|
} Dict;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *elts;
|
||||||
|
} Set;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty elt;
|
||||||
|
asdl_seq *generators;
|
||||||
|
} ListComp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty elt;
|
||||||
|
asdl_seq *generators;
|
||||||
|
} SetComp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty key;
|
||||||
|
expr_ty value;
|
||||||
|
asdl_seq *generators;
|
||||||
|
} DictComp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty elt;
|
||||||
|
asdl_seq *generators;
|
||||||
|
} GeneratorExp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Yield;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} YieldFrom;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty left;
|
||||||
|
asdl_int_seq *ops;
|
||||||
|
asdl_seq *comparators;
|
||||||
|
} Compare;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty func;
|
||||||
|
asdl_seq *args;
|
||||||
|
asdl_seq *keywords;
|
||||||
|
expr_ty starargs;
|
||||||
|
expr_ty kwargs;
|
||||||
|
} Call;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
object n;
|
||||||
|
} Num;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
string s;
|
||||||
|
} Str;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bytes s;
|
||||||
|
} Bytes;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
singleton value;
|
||||||
|
} NameConstant;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
identifier attr;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Attribute;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
slice_ty slice;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Subscript;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Starred;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
identifier id;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Name;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *elts;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} List;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *elts;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Tuple;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
int lineno;
|
||||||
|
int col_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _slice_kind {Slice_kind=1, ExtSlice_kind=2, Index_kind=3};
|
||||||
|
struct _slice {
|
||||||
|
enum _slice_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
expr_ty lower;
|
||||||
|
expr_ty upper;
|
||||||
|
expr_ty step;
|
||||||
|
} Slice;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *dims;
|
||||||
|
} ExtSlice;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Index;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _comprehension {
|
||||||
|
expr_ty target;
|
||||||
|
expr_ty iter;
|
||||||
|
asdl_seq *ifs;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _excepthandler_kind {ExceptHandler_kind=1};
|
||||||
|
struct _excepthandler {
|
||||||
|
enum _excepthandler_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
expr_ty type;
|
||||||
|
identifier name;
|
||||||
|
asdl_seq *body;
|
||||||
|
} ExceptHandler;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
int lineno;
|
||||||
|
int col_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _arguments {
|
||||||
|
asdl_seq *args;
|
||||||
|
arg_ty vararg;
|
||||||
|
asdl_seq *kwonlyargs;
|
||||||
|
asdl_seq *kw_defaults;
|
||||||
|
arg_ty kwarg;
|
||||||
|
asdl_seq *defaults;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _arg {
|
||||||
|
identifier arg;
|
||||||
|
expr_ty annotation;
|
||||||
|
int lineno;
|
||||||
|
int col_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _keyword {
|
||||||
|
identifier arg;
|
||||||
|
expr_ty value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _alias {
|
||||||
|
identifier name;
|
||||||
|
identifier asname;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _withitem {
|
||||||
|
expr_ty context_expr;
|
||||||
|
expr_ty optional_vars;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define Module(a0, a1) _Py_Module(a0, a1)
|
||||||
|
mod_ty _Py_Module(asdl_seq * body, PyArena *arena);
|
||||||
|
#define Interactive(a0, a1) _Py_Interactive(a0, a1)
|
||||||
|
mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena);
|
||||||
|
#define Expression(a0, a1) _Py_Expression(a0, a1)
|
||||||
|
mod_ty _Py_Expression(expr_ty body, PyArena *arena);
|
||||||
|
#define Suite(a0, a1) _Py_Suite(a0, a1)
|
||||||
|
mod_ty _Py_Suite(asdl_seq * body, PyArena *arena);
|
||||||
|
#define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7)
|
||||||
|
stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
|
||||||
|
asdl_seq * decorator_list, expr_ty returns, int lineno,
|
||||||
|
int col_offset, PyArena *arena);
|
||||||
|
#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
|
||||||
|
stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords,
|
||||||
|
expr_ty starargs, expr_ty kwargs, asdl_seq * body,
|
||||||
|
asdl_seq * decorator_list, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5)
|
||||||
|
stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6)
|
||||||
|
stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
|
||||||
|
orelse, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5)
|
||||||
|
stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
|
||||||
|
int col_offset, PyArena *arena);
|
||||||
|
#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5)
|
||||||
|
stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
|
||||||
|
int col_offset, PyArena *arena);
|
||||||
|
#define With(a0, a1, a2, a3, a4) _Py_With(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define Raise(a0, a1, a2, a3, a4) _Py_Raise(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define Try(a0, a1, a2, a3, a4, a5, a6) _Py_Try(a0, a1, a2, a3, a4, a5, a6)
|
||||||
|
stmt_ty _Py_Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
|
||||||
|
asdl_seq * finalbody, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5)
|
||||||
|
stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Nonlocal(a0, a1, a2, a3) _Py_Nonlocal(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Nonlocal(asdl_seq * names, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2)
|
||||||
|
stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Break(a0, a1, a2) _Py_Break(a0, a1, a2)
|
||||||
|
stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2)
|
||||||
|
stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define YieldFrom(a0, a1, a2, a3) _Py_YieldFrom(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_YieldFrom(expr_ty value, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,
|
||||||
|
int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7)
|
||||||
|
expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
|
||||||
|
starargs, expr_ty kwargs, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Bytes(a0, a1, a2, a3) _Py_Bytes(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Bytes(bytes s, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define NameConstant(a0, a1, a2, a3) _Py_NameConstant(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_NameConstant(singleton value, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Ellipsis(a0, a1, a2) _Py_Ellipsis(a0, a1, a2)
|
||||||
|
expr_ty _Py_Ellipsis(int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Starred(a0, a1, a2, a3, a4) _Py_Starred(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Starred(expr_ty value, expr_context_ty ctx, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3)
|
||||||
|
slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
|
||||||
|
#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1)
|
||||||
|
slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena);
|
||||||
|
#define Index(a0, a1) _Py_Index(a0, a1)
|
||||||
|
slice_ty _Py_Index(expr_ty value, PyArena *arena);
|
||||||
|
#define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3)
|
||||||
|
comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq *
|
||||||
|
ifs, PyArena *arena);
|
||||||
|
#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5)
|
||||||
|
excepthandler_ty _Py_ExceptHandler(expr_ty type, identifier name, asdl_seq *
|
||||||
|
body, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define arguments(a0, a1, a2, a3, a4, a5, a6) _Py_arguments(a0, a1, a2, a3, a4, a5, a6)
|
||||||
|
arguments_ty _Py_arguments(asdl_seq * args, arg_ty vararg, asdl_seq *
|
||||||
|
kwonlyargs, asdl_seq * kw_defaults, arg_ty kwarg,
|
||||||
|
asdl_seq * defaults, PyArena *arena);
|
||||||
|
#define arg(a0, a1, a2) _Py_arg(a0, a1, a2)
|
||||||
|
arg_ty _Py_arg(identifier arg, expr_ty annotation, PyArena *arena);
|
||||||
|
#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2)
|
||||||
|
keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena);
|
||||||
|
#define alias(a0, a1, a2) _Py_alias(a0, a1, a2)
|
||||||
|
alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena);
|
||||||
|
#define withitem(a0, a1, a2) _Py_withitem(a0, a1, a2)
|
||||||
|
withitem_ty _Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena
|
||||||
|
*arena);
|
||||||
|
|
||||||
|
PyObject* PyAST_mod2obj(mod_ty t);
|
||||||
|
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
|
||||||
|
int PyAST_Check(PyObject* obj);
|
133
Darwin/include/python3.4m/Python.h
Normal file
133
Darwin/include/python3.4m/Python.h
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
#ifndef Py_PYTHON_H
|
||||||
|
#define Py_PYTHON_H
|
||||||
|
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
|
||||||
|
|
||||||
|
/* Include nearly all Python header files */
|
||||||
|
|
||||||
|
#include "patchlevel.h"
|
||||||
|
#include "pyconfig.h"
|
||||||
|
#include "pymacconfig.h"
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#ifndef UCHAR_MAX
|
||||||
|
#error "Something's broken. UCHAR_MAX should be defined in limits.h."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UCHAR_MAX != 255
|
||||||
|
#error "Python's source code assumes C's unsigned char is an 8-bit type."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
|
||||||
|
#define _SGI_MP_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#ifndef NULL
|
||||||
|
# error "Python.h requires that stdio.h define NULL."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For size_t? */
|
||||||
|
#ifdef HAVE_STDDEF_H
|
||||||
|
#include <stddef.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* CAUTION: Build setups should ensure that NDEBUG is defined on the
|
||||||
|
* compiler command line when building Python in release mode; else
|
||||||
|
* assert() calls won't be removed.
|
||||||
|
*/
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "pyport.h"
|
||||||
|
#include "pymacro.h"
|
||||||
|
|
||||||
|
#include "pyatomic.h"
|
||||||
|
|
||||||
|
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
|
||||||
|
* PYMALLOC_DEBUG is in error if pymalloc is not in use.
|
||||||
|
*/
|
||||||
|
#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
|
||||||
|
#define PYMALLOC_DEBUG
|
||||||
|
#endif
|
||||||
|
#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
|
||||||
|
#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
|
||||||
|
#endif
|
||||||
|
#include "pymath.h"
|
||||||
|
#include "pytime.h"
|
||||||
|
#include "pymem.h"
|
||||||
|
|
||||||
|
#include "object.h"
|
||||||
|
#include "objimpl.h"
|
||||||
|
#include "typeslots.h"
|
||||||
|
#include "pyhash.h"
|
||||||
|
|
||||||
|
#include "pydebug.h"
|
||||||
|
|
||||||
|
#include "bytearrayobject.h"
|
||||||
|
#include "bytesobject.h"
|
||||||
|
#include "unicodeobject.h"
|
||||||
|
#include "longobject.h"
|
||||||
|
#include "longintrepr.h"
|
||||||
|
#include "boolobject.h"
|
||||||
|
#include "floatobject.h"
|
||||||
|
#include "complexobject.h"
|
||||||
|
#include "rangeobject.h"
|
||||||
|
#include "memoryobject.h"
|
||||||
|
#include "tupleobject.h"
|
||||||
|
#include "listobject.h"
|
||||||
|
#include "dictobject.h"
|
||||||
|
#include "enumobject.h"
|
||||||
|
#include "setobject.h"
|
||||||
|
#include "methodobject.h"
|
||||||
|
#include "moduleobject.h"
|
||||||
|
#include "funcobject.h"
|
||||||
|
#include "classobject.h"
|
||||||
|
#include "fileobject.h"
|
||||||
|
#include "pycapsule.h"
|
||||||
|
#include "traceback.h"
|
||||||
|
#include "sliceobject.h"
|
||||||
|
#include "cellobject.h"
|
||||||
|
#include "iterobject.h"
|
||||||
|
#include "genobject.h"
|
||||||
|
#include "descrobject.h"
|
||||||
|
#include "warnings.h"
|
||||||
|
#include "weakrefobject.h"
|
||||||
|
#include "structseq.h"
|
||||||
|
#include "namespaceobject.h"
|
||||||
|
|
||||||
|
#include "codecs.h"
|
||||||
|
#include "pyerrors.h"
|
||||||
|
|
||||||
|
#include "pystate.h"
|
||||||
|
|
||||||
|
#include "pyarena.h"
|
||||||
|
#include "modsupport.h"
|
||||||
|
#include "pythonrun.h"
|
||||||
|
#include "ceval.h"
|
||||||
|
#include "sysmodule.h"
|
||||||
|
#include "intrcheck.h"
|
||||||
|
#include "import.h"
|
||||||
|
|
||||||
|
#include "abstract.h"
|
||||||
|
#include "bltinmodule.h"
|
||||||
|
|
||||||
|
#include "compile.h"
|
||||||
|
#include "eval.h"
|
||||||
|
|
||||||
|
#include "pyctype.h"
|
||||||
|
#include "pystrtod.h"
|
||||||
|
#include "pystrcmp.h"
|
||||||
|
#include "dtoa.h"
|
||||||
|
#include "fileutils.h"
|
||||||
|
#include "pyfpe.h"
|
||||||
|
|
||||||
|
#endif /* !Py_PYTHON_H */
|
|
@ -7,6 +7,7 @@ extern "C" {
|
||||||
#ifdef PY_SSIZE_T_CLEAN
|
#ifdef PY_SSIZE_T_CLEAN
|
||||||
#define PyObject_CallFunction _PyObject_CallFunction_SizeT
|
#define PyObject_CallFunction _PyObject_CallFunction_SizeT
|
||||||
#define PyObject_CallMethod _PyObject_CallMethod_SizeT
|
#define PyObject_CallMethod _PyObject_CallMethod_SizeT
|
||||||
|
#define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Abstract Object Interface (many thanks to Jim Fulton) */
|
/* Abstract Object Interface (many thanks to Jim Fulton) */
|
||||||
|
@ -143,7 +144,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
|
||||||
int PyObject_HasAttrString(PyObject *o, char *attr_name);
|
int PyObject_HasAttrString(PyObject *o, const char *attr_name);
|
||||||
|
|
||||||
Returns 1 if o has the attribute attr_name, and 0 otherwise.
|
Returns 1 if o has the attribute attr_name, and 0 otherwise.
|
||||||
This is equivalent to the Python expression:
|
This is equivalent to the Python expression:
|
||||||
|
@ -155,7 +156,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
|
||||||
PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name);
|
PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name);
|
||||||
|
|
||||||
Retrieve an attributed named attr_name form object o.
|
Retrieve an attributed named attr_name form object o.
|
||||||
Returns the attribute value on success, or NULL on failure.
|
Returns the attribute value on success, or NULL on failure.
|
||||||
|
@ -188,7 +189,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
|
||||||
int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v);
|
int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v);
|
||||||
|
|
||||||
Set the value of the attribute named attr_name, for object o,
|
Set the value of the attribute named attr_name, for object o,
|
||||||
to the value, v. Returns -1 on failure. This is
|
to the value, v. Returns -1 on failure. This is
|
||||||
|
@ -208,7 +209,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* implemented as a macro:
|
/* implemented as a macro:
|
||||||
|
|
||||||
int PyObject_DelAttrString(PyObject *o, char *attr_name);
|
int PyObject_DelAttrString(PyObject *o, const char *attr_name);
|
||||||
|
|
||||||
Delete attribute named attr_name, for object o. Returns
|
Delete attribute named attr_name, for object o. Returns
|
||||||
-1 on failure. This is the equivalent of the Python
|
-1 on failure. This is the equivalent of the Python
|
||||||
|
@ -228,29 +229,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
*/
|
*/
|
||||||
#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL)
|
#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL)
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Compare the values of o1 and o2 using a routine provided by
|
|
||||||
o1, if one exists, otherwise with a routine provided by o2.
|
|
||||||
The result of the comparison is returned in result. Returns
|
|
||||||
-1 on failure. This is the equivalent of the Python
|
|
||||||
statement: result=cmp(o1,o2).
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
|
||||||
|
|
||||||
int PyObject_Compare(PyObject *o1, PyObject *o2);
|
|
||||||
|
|
||||||
Compare the values of o1 and o2 using a routine provided by
|
|
||||||
o1, if one exists, otherwise with a routine provided by o2.
|
|
||||||
Returns the result of the comparison on success. On error,
|
|
||||||
the value returned is undefined. This is equivalent to the
|
|
||||||
Python expression: cmp(o1,o2).
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
|
||||||
PyObject *PyObject_Repr(PyObject *o);
|
PyObject *PyObject_Repr(PyObject *o);
|
||||||
|
@ -259,7 +237,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
string representation on success, NULL on failure. This is
|
string representation on success, NULL on failure. This is
|
||||||
the equivalent of the Python expression: repr(o).
|
the equivalent of the Python expression: repr(o).
|
||||||
|
|
||||||
Called by the repr() built-in function and by reverse quotes.
|
Called by the repr() built-in function.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -271,20 +249,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
string representation on success, NULL on failure. This is
|
string representation on success, NULL on failure. This is
|
||||||
the equivalent of the Python expression: str(o).)
|
the equivalent of the Python expression: str(o).)
|
||||||
|
|
||||||
Called by the str() built-in function and by the print
|
Called by the str() and print() built-in functions.
|
||||||
statement.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
|
||||||
|
|
||||||
PyObject *PyObject_Unicode(PyObject *o);
|
|
||||||
|
|
||||||
Compute the unicode representation of object, o. Returns the
|
|
||||||
unicode representation on success, NULL on failure. This is
|
|
||||||
the equivalent of the Python expression: unistr(o).)
|
|
||||||
|
|
||||||
Called by the unistr() built-in function.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -296,35 +261,30 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
object is callable and 0 otherwise.
|
object is callable and 0 otherwise.
|
||||||
|
|
||||||
This function always succeeds.
|
This function always succeeds.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
|
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
|
||||||
PyObject *args, PyObject *kw);
|
PyObject *args, PyObject *kw);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Call a callable Python object, callable_object, with
|
Call a callable Python object, callable_object, with
|
||||||
arguments and keywords arguments. The 'args' argument can not be
|
arguments and keywords arguments. The 'args' argument can not be
|
||||||
NULL, but the 'kw' argument can be NULL.
|
NULL, but the 'kw' argument can be NULL.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object,
|
PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object,
|
||||||
PyObject *args);
|
PyObject *args);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Call a callable Python object, callable_object, with
|
Call a callable Python object, callable_object, with
|
||||||
arguments given by the tuple, args. If no arguments are
|
arguments given by the tuple, args. If no arguments are
|
||||||
needed, then args may be NULL. Returns the result of the
|
needed, then args may be NULL. Returns the result of the
|
||||||
call on success, or NULL on failure. This is the equivalent
|
call on success, or NULL on failure. This is the equivalent
|
||||||
of the Python expression: apply(o,args).
|
of the Python expression: o(*args).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object,
|
PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object,
|
||||||
char *format, ...);
|
const char *format, ...);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Call a callable Python object, callable_object, with a
|
Call a callable Python object, callable_object, with a
|
||||||
|
@ -332,13 +292,13 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
using a mkvalue-style format string. The format may be NULL,
|
using a mkvalue-style format string. The format may be NULL,
|
||||||
indicating that no arguments are provided. Returns the
|
indicating that no arguments are provided. Returns the
|
||||||
result of the call on success, or NULL on failure. This is
|
result of the call on success, or NULL on failure. This is
|
||||||
the equivalent of the Python expression: apply(o,args).
|
the equivalent of the Python expression: o(*args).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, char *m,
|
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o,
|
||||||
char *format, ...);
|
const char *method,
|
||||||
|
const char *format, ...);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Call the method named m of object o with a variable number of
|
Call the method named m of object o with a variable number of
|
||||||
|
@ -349,26 +309,44 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Python expression: o.method(args).
|
Python expression: o.method(args).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *o,
|
||||||
|
_Py_Identifier *method,
|
||||||
|
const char *format, ...);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Like PyObject_CallMethod, but expect a _Py_Identifier* as the
|
||||||
|
method name.
|
||||||
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
|
PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
|
||||||
char *format, ...);
|
const char *format,
|
||||||
|
...);
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o,
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o,
|
||||||
char *name,
|
const char *name,
|
||||||
char *format, ...);
|
const char *format,
|
||||||
|
...);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *o,
|
||||||
|
_Py_Identifier *name,
|
||||||
|
const char *format,
|
||||||
|
...);
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
|
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
|
||||||
...);
|
...);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Call a callable Python object, callable_object, with a
|
Call a callable Python object, callable_object, with a
|
||||||
variable number of C arguments. The C arguments are provided
|
variable number of C arguments. The C arguments are provided
|
||||||
as PyObject * values, terminated by a NULL. Returns the
|
as PyObject * values, terminated by a NULL. Returns the
|
||||||
result of the call on success, or NULL on failure. This is
|
result of the call on success, or NULL on failure. This is
|
||||||
the equivalent of the Python expression: apply(o,args).
|
the equivalent of the Python expression: o(*args).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o,
|
PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o,
|
||||||
PyObject *m, ...);
|
PyObject *method, ...);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *o,
|
||||||
|
struct _Py_Identifier *method,
|
||||||
|
...);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Call the method named m of object o with a variable number of
|
Call the method named m of object o with a variable number of
|
||||||
|
@ -386,7 +364,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Compute and return the hash, hash_value, of an object, o. On
|
Compute and return the hash, hash_value, of an object, o. On
|
||||||
failure, return -1. This is the equivalent of the Python
|
failure, return -1. This is the equivalent of the Python
|
||||||
expression: hash(o).
|
expression: hash(o).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -397,7 +374,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns 1 if the object, o, is considered to be true, 0 if o is
|
Returns 1 if the object, o, is considered to be true, 0 if o is
|
||||||
considered to be false and -1 on failure. This is equivalent to the
|
considered to be false and -1 on failure. This is equivalent to the
|
||||||
Python expression: not not o
|
Python expression: not not o
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
@ -407,7 +383,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns 0 if the object, o, is considered to be true, 1 if o is
|
Returns 0 if the object, o, is considered to be true, 1 if o is
|
||||||
considered to be false and -1 on failure. This is equivalent to the
|
considered to be false and -1 on failure. This is equivalent to the
|
||||||
Python expression: not o
|
Python expression: not o
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o);
|
PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o);
|
||||||
|
@ -425,7 +400,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
both sequence and mapping protocols, the sequence size is
|
both sequence and mapping protocols, the sequence size is
|
||||||
returned. On error, -1 is returned. This is the equivalent
|
returned. On error, -1 is returned. This is the equivalent
|
||||||
to the Python expression: len(o).
|
to the Python expression: len(o).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* For DLL compatibility */
|
/* For DLL compatibility */
|
||||||
|
@ -433,7 +407,10 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o);
|
PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o);
|
||||||
#define PyObject_Length PyObject_Size
|
#define PyObject_Length PyObject_Size
|
||||||
|
|
||||||
PyAPI_FUNC(Py_ssize_t) _PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o);
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Guess the size of object o using len(o) or o.__length_hint__().
|
Guess the size of object o using len(o) or o.__length_hint__().
|
||||||
|
@ -447,7 +424,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Return element of o corresponding to the object, key, or NULL
|
Return element of o corresponding to the object, key, or NULL
|
||||||
on failure. This is the equivalent of the Python expression:
|
on failure. This is the equivalent of the Python expression:
|
||||||
o[key].
|
o[key].
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v);
|
PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v);
|
||||||
|
@ -458,7 +434,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
statement: o[key]=v.
|
statement: o[key]=v.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key);
|
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Remove the mapping for object, key, from the object *o.
|
Remove the mapping for object, key, from the object *o.
|
||||||
|
@ -473,9 +449,15 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
This is the equivalent of the Python statement: del o[key].
|
This is the equivalent of the Python statement: del o[key].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* old buffer API
|
||||||
|
FIXME: usage of these should all be replaced in Python itself
|
||||||
|
but for backwards compatibility we will implement them.
|
||||||
|
Their usage without a corresponding "unlock" mechansim
|
||||||
|
may create issues (but they would already be there). */
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj,
|
PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj,
|
||||||
const char **buffer,
|
const char **buffer,
|
||||||
Py_ssize_t *buffer_len);
|
Py_ssize_t *buffer_len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Takes an arbitrary object which must support the (character,
|
Takes an arbitrary object which must support the (character,
|
||||||
|
@ -486,7 +468,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
0 is returned on success. buffer and buffer_len are only
|
0 is returned on success. buffer and buffer_len are only
|
||||||
set in case no error occurs. Otherwise, -1 is returned and
|
set in case no error occurs. Otherwise, -1 is returned and
|
||||||
an exception set.
|
an exception set.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
|
PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
|
||||||
|
@ -495,12 +476,11 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Checks whether an arbitrary object supports the (character,
|
Checks whether an arbitrary object supports the (character,
|
||||||
single segment) buffer interface. Returns 1 on success, 0
|
single segment) buffer interface. Returns 1 on success, 0
|
||||||
on failure.
|
on failure.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
|
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
|
||||||
const void **buffer,
|
const void **buffer,
|
||||||
Py_ssize_t *buffer_len);
|
Py_ssize_t *buffer_len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Same as PyObject_AsCharBuffer() except that this API expects
|
Same as PyObject_AsCharBuffer() except that this API expects
|
||||||
|
@ -511,29 +491,27 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
0 is returned on success. buffer and buffer_len are only
|
0 is returned on success. buffer and buffer_len are only
|
||||||
set in case no error occurs. Otherwise, -1 is returned and
|
set in case no error occurs. Otherwise, -1 is returned and
|
||||||
an exception set.
|
an exception set.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
|
PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
|
||||||
void **buffer,
|
void **buffer,
|
||||||
Py_ssize_t *buffer_len);
|
Py_ssize_t *buffer_len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Takes an arbitrary object which must support the (writeable,
|
Takes an arbitrary object which must support the (writable,
|
||||||
single segment) buffer interface and returns a pointer to a
|
single segment) buffer interface and returns a pointer to a
|
||||||
writeable memory location in buffer of size buffer_len.
|
writable memory location in buffer of size buffer_len.
|
||||||
|
|
||||||
0 is returned on success. buffer and buffer_len are only
|
0 is returned on success. buffer and buffer_len are only
|
||||||
set in case no error occurs. Otherwise, -1 is returned and
|
set in case no error occurs. Otherwise, -1 is returned and
|
||||||
an exception set.
|
an exception set.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* new buffer API */
|
/* new buffer API */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#define PyObject_CheckBuffer(obj) \
|
#define PyObject_CheckBuffer(obj) \
|
||||||
(((obj)->ob_type->tp_as_buffer != NULL) && \
|
(((obj)->ob_type->tp_as_buffer != NULL) && \
|
||||||
(PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \
|
|
||||||
((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
|
((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
|
||||||
|
|
||||||
/* Return 1 if the getbuffer function is available, otherwise
|
/* Return 1 if the getbuffer function is available, otherwise
|
||||||
|
@ -562,11 +540,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Implementation in memoryobject.c */
|
||||||
PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view,
|
PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view,
|
||||||
Py_ssize_t len, char fort);
|
Py_ssize_t len, char order);
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf,
|
PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf,
|
||||||
Py_ssize_t len, char fort);
|
Py_ssize_t len, char order);
|
||||||
|
|
||||||
|
|
||||||
/* Copy len bytes of data from the contiguous chunk of memory
|
/* Copy len bytes of data from the contiguous chunk of memory
|
||||||
|
@ -575,7 +554,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
error (i.e. the object does not have a buffer interface or
|
error (i.e. the object does not have a buffer interface or
|
||||||
it is not working).
|
it is not working).
|
||||||
|
|
||||||
If fort is 'F' and the object is multi-dimensional,
|
If fort is 'F', then if the object is multi-dimensional,
|
||||||
then the data will be copied into the array in
|
then the data will be copied into the array in
|
||||||
Fortran-style (first dimension varies the fastest). If
|
Fortran-style (first dimension varies the fastest). If
|
||||||
fort is 'C', then the data will be copied into the array
|
fort is 'C', then the data will be copied into the array
|
||||||
|
@ -590,7 +569,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
/* Copy the data from the src buffer to the buffer of destination
|
/* Copy the data from the src buffer to the buffer of destination
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort);
|
PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort);
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
|
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
|
||||||
|
@ -619,6 +598,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* Releases a Py_buffer obtained from getbuffer ParseTuple's s*.
|
/* Releases a Py_buffer obtained from getbuffer ParseTuple's s*.
|
||||||
*/
|
*/
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj,
|
PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj,
|
||||||
PyObject *format_spec);
|
PyObject *format_spec);
|
||||||
|
@ -635,8 +615,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
is an iterator, this returns itself. */
|
is an iterator, this returns itself. */
|
||||||
|
|
||||||
#define PyIter_Check(obj) \
|
#define PyIter_Check(obj) \
|
||||||
(PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \
|
((obj)->ob_type->tp_iternext != NULL && \
|
||||||
(obj)->ob_type->tp_iternext != NULL && \
|
|
||||||
(obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
|
(obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
|
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
|
||||||
|
@ -654,7 +633,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
false otherwise.
|
false otherwise.
|
||||||
|
|
||||||
This function always succeeds.
|
This function always succeeds.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2);
|
||||||
|
@ -662,8 +640,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
/*
|
/*
|
||||||
Returns the result of adding o1 and o2, or null on failure.
|
Returns the result of adding o1 and o2, or null on failure.
|
||||||
This is the equivalent of the Python expression: o1+o2.
|
This is the equivalent of the Python expression: o1+o2.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2);
|
||||||
|
@ -672,7 +648,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of subtracting o2 from o1, or null on
|
Returns the result of subtracting o2 from o1, or null on
|
||||||
failure. This is the equivalent of the Python expression:
|
failure. This is the equivalent of the Python expression:
|
||||||
o1-o2.
|
o1-o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2);
|
||||||
|
@ -681,17 +656,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of multiplying o1 and o2, or null on
|
Returns the result of multiplying o1 and o2, or null on
|
||||||
failure. This is the equivalent of the Python expression:
|
failure. This is the equivalent of the Python expression:
|
||||||
o1*o2.
|
o1*o2.
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Divide(PyObject *o1, PyObject *o2);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Returns the result of dividing o1 by o2, or null on failure.
|
|
||||||
This is the equivalent of the Python expression: o1/o2.
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2);
|
||||||
|
@ -700,8 +664,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of dividing o1 by o2 giving an integral result,
|
Returns the result of dividing o1 by o2 giving an integral result,
|
||||||
or null on failure.
|
or null on failure.
|
||||||
This is the equivalent of the Python expression: o1//o2.
|
This is the equivalent of the Python expression: o1//o2.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2);
|
||||||
|
@ -710,8 +672,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of dividing o1 by o2 giving a float result,
|
Returns the result of dividing o1 by o2 giving a float result,
|
||||||
or null on failure.
|
or null on failure.
|
||||||
This is the equivalent of the Python expression: o1/o2.
|
This is the equivalent of the Python expression: o1/o2.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2);
|
||||||
|
@ -720,8 +680,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the remainder of dividing o1 by o2, or null on
|
Returns the remainder of dividing o1 by o2, or null on
|
||||||
failure. This is the equivalent of the Python expression:
|
failure. This is the equivalent of the Python expression:
|
||||||
o1%o2.
|
o1%o2.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2);
|
||||||
|
@ -730,18 +688,15 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
See the built-in function divmod. Returns NULL on failure.
|
See the built-in function divmod. Returns NULL on failure.
|
||||||
This is the equivalent of the Python expression:
|
This is the equivalent of the Python expression:
|
||||||
divmod(o1,o2).
|
divmod(o1,o2).
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2,
|
PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2,
|
||||||
PyObject *o3);
|
PyObject *o3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
See the built-in function pow. Returns NULL on failure.
|
See the built-in function pow. Returns NULL on failure.
|
||||||
This is the equivalent of the Python expression:
|
This is the equivalent of the Python expression:
|
||||||
pow(o1,o2,o3), where o3 is optional.
|
pow(o1,o2,o3), where o3 is optional.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o);
|
PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o);
|
||||||
|
@ -749,7 +704,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
/*
|
/*
|
||||||
Returns the negation of o on success, or null on failure.
|
Returns the negation of o on success, or null on failure.
|
||||||
This is the equivalent of the Python expression: -o.
|
This is the equivalent of the Python expression: -o.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o);
|
PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o);
|
||||||
|
@ -757,7 +711,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
/*
|
/*
|
||||||
Returns the (what?) of o on success, or NULL on failure.
|
Returns the (what?) of o on success, or NULL on failure.
|
||||||
This is the equivalent of the Python expression: +o.
|
This is the equivalent of the Python expression: +o.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o);
|
PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o);
|
||||||
|
@ -765,7 +718,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
/*
|
/*
|
||||||
Returns the absolute value of o, or null on failure. This is
|
Returns the absolute value of o, or null on failure. This is
|
||||||
the equivalent of the Python expression: abs(o).
|
the equivalent of the Python expression: abs(o).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o);
|
PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o);
|
||||||
|
@ -774,8 +726,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the bitwise negation of o on success, or NULL on
|
Returns the bitwise negation of o on success, or NULL on
|
||||||
failure. This is the equivalent of the Python expression:
|
failure. This is the equivalent of the Python expression:
|
||||||
~o.
|
~o.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2);
|
||||||
|
@ -784,8 +734,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of left shifting o1 by o2 on success, or
|
Returns the result of left shifting o1 by o2 on success, or
|
||||||
NULL on failure. This is the equivalent of the Python
|
NULL on failure. This is the equivalent of the Python
|
||||||
expression: o1 << o2.
|
expression: o1 << o2.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2);
|
||||||
|
@ -794,7 +742,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of right shifting o1 by o2 on success, or
|
Returns the result of right shifting o1 by o2 on success, or
|
||||||
NULL on failure. This is the equivalent of the Python
|
NULL on failure. This is the equivalent of the Python
|
||||||
expression: o1 >> o2.
|
expression: o1 >> o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2);
|
||||||
|
@ -804,7 +751,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
NULL on failure. This is the equivalent of the Python
|
NULL on failure. This is the equivalent of the Python
|
||||||
expression: o1&o2.
|
expression: o1&o2.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2);
|
||||||
|
@ -813,8 +759,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the bitwise exclusive or of o1 by o2 on success, or
|
Returns the bitwise exclusive or of o1 by o2 on success, or
|
||||||
NULL on failure. This is the equivalent of the Python
|
NULL on failure. This is the equivalent of the Python
|
||||||
expression: o1^o2.
|
expression: o1^o2.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2);
|
||||||
|
@ -823,79 +767,35 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of bitwise or on o1 and o2 on success, or
|
Returns the result of bitwise or on o1 and o2 on success, or
|
||||||
NULL on failure. This is the equivalent of the Python
|
NULL on failure. This is the equivalent of the Python
|
||||||
expression: o1|o2.
|
expression: o1|o2.
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
|
||||||
|
|
||||||
int PyNumber_Coerce(PyObject **p1, PyObject **p2);
|
|
||||||
|
|
||||||
This function takes the addresses of two variables of type
|
|
||||||
PyObject*.
|
|
||||||
|
|
||||||
If the objects pointed to by *p1 and *p2 have the same type,
|
|
||||||
increment their reference count and return 0 (success).
|
|
||||||
If the objects can be converted to a common numeric type,
|
|
||||||
replace *p1 and *p2 by their converted value (with 'new'
|
|
||||||
reference counts), and return 0.
|
|
||||||
If no conversion is possible, or if some other error occurs,
|
|
||||||
return -1 (failure) and don't increment the reference counts.
|
|
||||||
The call PyNumber_Coerce(&o1, &o2) is equivalent to the Python
|
|
||||||
statement o1, o2 = coerce(o1, o2).
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PyIndex_Check(obj) \
|
#define PyIndex_Check(obj) \
|
||||||
((obj)->ob_type->tp_as_number != NULL && \
|
((obj)->ob_type->tp_as_number != NULL && \
|
||||||
PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_INDEX) && \
|
|
||||||
(obj)->ob_type->tp_as_number->nb_index != NULL)
|
(obj)->ob_type->tp_as_number->nb_index != NULL)
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o);
|
PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the object converted to a Python long or int
|
Returns the object converted to a Python int
|
||||||
or NULL with an error raised on failure.
|
or NULL with an error raised on failure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc);
|
PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc);
|
||||||
|
|
||||||
/*
|
|
||||||
Returns the Integral instance converted to an int. The
|
|
||||||
instance is expected to be int or long or have an __int__
|
|
||||||
method. Steals integral's reference. error_format will be
|
|
||||||
used to create the TypeError if integral isn't actually an
|
|
||||||
Integral instance. error_format should be a format string
|
|
||||||
that can accept a char* naming integral's type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt(
|
|
||||||
PyObject *integral,
|
|
||||||
const char* error_format);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the object converted to Py_ssize_t by going through
|
Returns the object converted to Py_ssize_t by going through
|
||||||
PyNumber_Index first. If an overflow error occurs while
|
PyNumber_Index first. If an overflow error occurs while
|
||||||
converting the int-or-long to Py_ssize_t, then the second argument
|
converting the int to Py_ssize_t, then the second argument
|
||||||
is the error-type to return. If it is NULL, then the overflow error
|
is the error-type to return. If it is NULL, then the overflow error
|
||||||
is cleared and the value is clipped.
|
is cleared and the value is clipped.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Int(PyObject *o);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Returns the o converted to an integer object on success, or
|
|
||||||
NULL on failure. This is the equivalent of the Python
|
|
||||||
expression: int(o).
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o);
|
PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the o converted to a long integer object on success,
|
Returns the o converted to an integer object on success, or
|
||||||
or NULL on failure. This is the equivalent of the Python
|
NULL on failure. This is the equivalent of the Python
|
||||||
expression: long(o).
|
expression: int(o).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o);
|
PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o);
|
||||||
|
@ -914,7 +814,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of adding o2 to o1, possibly in-place, or null
|
Returns the result of adding o2 to o1, possibly in-place, or null
|
||||||
on failure. This is the equivalent of the Python expression:
|
on failure. This is the equivalent of the Python expression:
|
||||||
o1 += o2.
|
o1 += o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2);
|
||||||
|
@ -923,7 +822,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of subtracting o2 from o1, possibly in-place or
|
Returns the result of subtracting o2 from o1, possibly in-place or
|
||||||
null on failure. This is the equivalent of the Python expression:
|
null on failure. This is the equivalent of the Python expression:
|
||||||
o1 -= o2.
|
o1 -= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2);
|
||||||
|
@ -932,38 +830,26 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of multiplying o1 by o2, possibly in-place, or
|
Returns the result of multiplying o1 by o2, possibly in-place, or
|
||||||
null on failure. This is the equivalent of the Python expression:
|
null on failure. This is the equivalent of the Python expression:
|
||||||
o1 *= o2.
|
o1 *= o2.
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Returns the result of dividing o1 by o2, possibly in-place, or null
|
|
||||||
on failure. This is the equivalent of the Python expression:
|
|
||||||
o1 /= o2.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
|
||||||
PyObject *o2);
|
PyObject *o2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the result of dividing o1 by o2 giving an integral result,
|
Returns the result of dividing o1 by o2 giving an integral result,
|
||||||
possibly in-place, or null on failure.
|
possibly in-place, or null on failure.
|
||||||
This is the equivalent of the Python expression:
|
This is the equivalent of the Python expression:
|
||||||
o1 /= o2.
|
o1 /= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1,
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1,
|
||||||
PyObject *o2);
|
PyObject *o2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the result of dividing o1 by o2 giving a float result,
|
Returns the result of dividing o1 by o2 giving a float result,
|
||||||
possibly in-place, or null on failure.
|
possibly in-place, or null on failure.
|
||||||
This is the equivalent of the Python expression:
|
This is the equivalent of the Python expression:
|
||||||
o1 /= o2.
|
o1 /= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2);
|
||||||
|
@ -972,17 +858,15 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the remainder of dividing o1 by o2, possibly in-place, or
|
Returns the remainder of dividing o1 by o2, possibly in-place, or
|
||||||
null on failure. This is the equivalent of the Python expression:
|
null on failure. This is the equivalent of the Python expression:
|
||||||
o1 %= o2.
|
o1 %= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
|
PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
|
||||||
PyObject *o3);
|
PyObject *o3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the result of raising o1 to the power of o2, possibly
|
Returns the result of raising o1 to the power of o2, possibly
|
||||||
in-place, or null on failure. This is the equivalent of the Python
|
in-place, or null on failure. This is the equivalent of the Python
|
||||||
expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present.
|
expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2);
|
||||||
|
@ -991,7 +875,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of left shifting o1 by o2, possibly in-place, or
|
Returns the result of left shifting o1 by o2, possibly in-place, or
|
||||||
null on failure. This is the equivalent of the Python expression:
|
null on failure. This is the equivalent of the Python expression:
|
||||||
o1 <<= o2.
|
o1 <<= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2);
|
||||||
|
@ -1000,7 +883,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of right shifting o1 by o2, possibly in-place or
|
Returns the result of right shifting o1 by o2, possibly in-place or
|
||||||
null on failure. This is the equivalent of the Python expression:
|
null on failure. This is the equivalent of the Python expression:
|
||||||
o1 >>= o2.
|
o1 >>= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2);
|
||||||
|
@ -1009,7 +891,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of bitwise and of o1 and o2, possibly in-place,
|
Returns the result of bitwise and of o1 and o2, possibly in-place,
|
||||||
or null on failure. This is the equivalent of the Python
|
or null on failure. This is the equivalent of the Python
|
||||||
expression: o1 &= o2.
|
expression: o1 &= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2);
|
||||||
|
@ -1018,7 +899,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the bitwise exclusive or of o1 by o2, possibly in-place, or
|
Returns the bitwise exclusive or of o1 by o2, possibly in-place, or
|
||||||
null on failure. This is the equivalent of the Python expression:
|
null on failure. This is the equivalent of the Python expression:
|
||||||
o1 ^= o2.
|
o1 ^= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2);
|
PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2);
|
||||||
|
@ -1027,10 +907,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Returns the result of bitwise or of o1 and o2, possibly in-place,
|
Returns the result of bitwise or of o1 and o2, possibly in-place,
|
||||||
or null on failure. This is the equivalent of the Python
|
or null on failure. This is the equivalent of the Python
|
||||||
expression: o1 |= o2.
|
expression: o1 |= o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base);
|
PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1049,14 +927,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
otherwise.
|
otherwise.
|
||||||
|
|
||||||
This function always succeeds.
|
This function always succeeds.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o);
|
PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return the size of sequence object o, or -1 on failure.
|
Return the size of sequence object o, or -1 on failure.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* For DLL compatibility */
|
/* For DLL compatibility */
|
||||||
|
@ -1071,7 +947,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Return the concatenation of o1 and o2 on success, and NULL on
|
Return the concatenation of o1 and o2 on success, and NULL on
|
||||||
failure. This is the equivalent of the Python
|
failure. This is the equivalent of the Python
|
||||||
expression: o1+o2.
|
expression: o1+o2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count);
|
PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count);
|
||||||
|
@ -1080,7 +955,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Return the result of repeating sequence object o count times,
|
Return the result of repeating sequence object o count times,
|
||||||
or NULL on failure. This is the equivalent of the Python
|
or NULL on failure. This is the equivalent of the Python
|
||||||
expression: o1*count.
|
expression: o1*count.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i);
|
PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i);
|
||||||
|
@ -1096,7 +970,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Return the slice of sequence object o between i1 and i2, or
|
Return the slice of sequence object o between i1 and i2, or
|
||||||
NULL on failure. This is the equivalent of the Python
|
NULL on failure. This is the equivalent of the Python
|
||||||
expression: o[i1:i2].
|
expression: o[i1:i2].
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v);
|
PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v);
|
||||||
|
@ -1105,7 +978,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Assign object v to the ith element of o. Returns
|
Assign object v to the ith element of o. Returns
|
||||||
-1 on failure. This is the equivalent of the Python
|
-1 on failure. This is the equivalent of the Python
|
||||||
statement: o[i]=v.
|
statement: o[i]=v.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i);
|
PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i);
|
||||||
|
@ -1117,7 +989,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2,
|
PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2,
|
||||||
PyObject *v);
|
PyObject *v);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Assign the sequence object, v, to the slice in sequence
|
Assign the sequence object, v, to the slice in sequence
|
||||||
|
@ -1149,7 +1021,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
|
PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
|
||||||
/*
|
/*
|
||||||
Returns the sequence, o, as a tuple, unless it's already a
|
Return the sequence, o, as a list, unless it's already a
|
||||||
tuple or list. Use PySequence_Fast_GET_ITEM to access the
|
tuple or list. Use PySequence_Fast_GET_ITEM to access the
|
||||||
members of this list, and PySequence_Fast_GET_SIZE to get its length.
|
members of this list, and PySequence_Fast_GET_SIZE to get its length.
|
||||||
|
|
||||||
|
@ -1198,11 +1070,13 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Use __contains__ if possible, else _PySequence_IterSearch().
|
Use __contains__ if possible, else _PySequence_IterSearch().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#define PY_ITERSEARCH_COUNT 1
|
#define PY_ITERSEARCH_COUNT 1
|
||||||
#define PY_ITERSEARCH_INDEX 2
|
#define PY_ITERSEARCH_INDEX 2
|
||||||
#define PY_ITERSEARCH_CONTAINS 3
|
#define PY_ITERSEARCH_CONTAINS 3
|
||||||
PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq,
|
PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq,
|
||||||
PyObject *obj, int operation);
|
PyObject *obj, int operation);
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
Iterate over seq. Result depends on the operation:
|
Iterate over seq. Result depends on the operation:
|
||||||
PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if
|
PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if
|
||||||
|
@ -1282,7 +1156,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* implemented as a macro:
|
/* implemented as a macro:
|
||||||
|
|
||||||
int PyMapping_DelItemString(PyObject *o, char *key);
|
int PyMapping_DelItemString(PyObject *o, const char *key);
|
||||||
|
|
||||||
Remove the mapping for object, key, from the object *o.
|
Remove the mapping for object, key, from the object *o.
|
||||||
Returns -1 on failure. This is equivalent to
|
Returns -1 on failure. This is equivalent to
|
||||||
|
@ -1300,12 +1174,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
*/
|
*/
|
||||||
#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
|
#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key);
|
PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
On success, return 1 if the mapping object has the key, key,
|
On success, return 1 if the mapping object has the key, key,
|
||||||
and 0 otherwise. This is equivalent to the Python expression:
|
and 0 otherwise. This is equivalent to the Python expression:
|
||||||
o.has_key(key).
|
key in o.
|
||||||
|
|
||||||
This function always succeeds.
|
This function always succeeds.
|
||||||
*/
|
*/
|
||||||
|
@ -1315,45 +1189,37 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
/*
|
/*
|
||||||
Return 1 if the mapping object has the key, key,
|
Return 1 if the mapping object has the key, key,
|
||||||
and 0 otherwise. This is equivalent to the Python expression:
|
and 0 otherwise. This is equivalent to the Python expression:
|
||||||
o.has_key(key).
|
key in o.
|
||||||
|
|
||||||
This function always succeeds.
|
This function always succeeds.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Implemented as macro:
|
PyAPI_FUNC(PyObject *) PyMapping_Keys(PyObject *o);
|
||||||
|
|
||||||
PyObject *PyMapping_Keys(PyObject *o);
|
/*
|
||||||
|
On success, return a list or tuple of the keys in object o.
|
||||||
On success, return a list of the keys in object o. On
|
On failure, return NULL.
|
||||||
failure, return NULL. This is equivalent to the Python
|
|
||||||
expression: o.keys().
|
|
||||||
*/
|
*/
|
||||||
#define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL)
|
|
||||||
|
|
||||||
/* Implemented as macro:
|
PyAPI_FUNC(PyObject *) PyMapping_Values(PyObject *o);
|
||||||
|
|
||||||
PyObject *PyMapping_Values(PyObject *o);
|
/*
|
||||||
|
On success, return a list or tuple of the values in object o.
|
||||||
On success, return a list of the values in object o. On
|
On failure, return NULL.
|
||||||
failure, return NULL. This is equivalent to the Python
|
|
||||||
expression: o.values().
|
|
||||||
*/
|
*/
|
||||||
#define PyMapping_Values(O) PyObject_CallMethod(O,"values",NULL)
|
|
||||||
|
|
||||||
/* Implemented as macro:
|
PyAPI_FUNC(PyObject *) PyMapping_Items(PyObject *o);
|
||||||
|
|
||||||
PyObject *PyMapping_Items(PyObject *o);
|
/*
|
||||||
|
On success, return a list or tuple of the items in object o,
|
||||||
On success, return a list of the items in object o, where
|
where each item is a tuple containing a key-value pair.
|
||||||
each item is a tuple containing a key-value pair. On
|
On failure, return NULL.
|
||||||
failure, return NULL. This is equivalent to the Python
|
|
||||||
expression: o.items().
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL)
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key);
|
PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o,
|
||||||
|
const char *key);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return element of o corresponding to the object, key, or NULL
|
Return element of o corresponding to the object, key, or NULL
|
||||||
|
@ -1361,7 +1227,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
o[key].
|
o[key].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key,
|
PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key,
|
||||||
PyObject *value);
|
PyObject *value);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1378,10 +1244,15 @@ PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass);
|
||||||
/* issubclass(object, typeorclass) */
|
/* issubclass(object, typeorclass) */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
|
PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
|
||||||
|
|
||||||
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
|
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
|
||||||
|
|
||||||
|
PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* For internal use by buffer API functions */
|
/* For internal use by buffer API functions */
|
||||||
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
|
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
|
37
Darwin/include/python3.4m/accu.h
Normal file
37
Darwin/include/python3.4m/accu.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_ACCU_H
|
||||||
|
#define Py_ACCU_H
|
||||||
|
|
||||||
|
/*** This is a private API for use by the interpreter and the stdlib.
|
||||||
|
*** Its definition may be changed or removed at any moment.
|
||||||
|
***/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A two-level accumulator of unicode objects that avoids both the overhead
|
||||||
|
* of keeping a huge number of small separate objects, and the quadratic
|
||||||
|
* behaviour of using a naive repeated concatenation scheme.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef small /* defined by some Windows headers */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject *large; /* A list of previously accumulated large strings */
|
||||||
|
PyObject *small; /* Pending small strings */
|
||||||
|
} _PyAccu;
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc);
|
||||||
|
PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc);
|
||||||
|
PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* Py_ACCU_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
45
Darwin/include/python3.4m/asdl.h
Normal file
45
Darwin/include/python3.4m/asdl.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#ifndef Py_ASDL_H
|
||||||
|
#define Py_ASDL_H
|
||||||
|
|
||||||
|
typedef PyObject * identifier;
|
||||||
|
typedef PyObject * string;
|
||||||
|
typedef PyObject * bytes;
|
||||||
|
typedef PyObject * object;
|
||||||
|
typedef PyObject * singleton;
|
||||||
|
|
||||||
|
/* It would be nice if the code generated by asdl_c.py was completely
|
||||||
|
independent of Python, but it is a goal the requires too much work
|
||||||
|
at this stage. So, for example, I'll represent identifiers as
|
||||||
|
interned Python strings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* XXX A sequence should be typed so that its use can be typechecked. */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Py_ssize_t size;
|
||||||
|
void *elements[1];
|
||||||
|
} asdl_seq;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Py_ssize_t size;
|
||||||
|
int elements[1];
|
||||||
|
} asdl_int_seq;
|
||||||
|
|
||||||
|
asdl_seq *_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena);
|
||||||
|
asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
|
||||||
|
|
||||||
|
#define asdl_seq_GET(S, I) (S)->elements[(I)]
|
||||||
|
#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
|
||||||
|
#ifdef Py_DEBUG
|
||||||
|
#define asdl_seq_SET(S, I, V) \
|
||||||
|
do { \
|
||||||
|
Py_ssize_t _asdl_i = (I); \
|
||||||
|
assert((S) != NULL); \
|
||||||
|
assert(_asdl_i < (S)->size); \
|
||||||
|
(S)->elements[_asdl_i] = (V); \
|
||||||
|
} while (0)
|
||||||
|
#else
|
||||||
|
#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_ASDL_H */
|
22
Darwin/include/python3.4m/ast.h
Normal file
22
Darwin/include/python3.4m/ast.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef Py_AST_H
|
||||||
|
#define Py_AST_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyAST_Validate(mod_ty);
|
||||||
|
PyAPI_FUNC(mod_ty) PyAST_FromNode(
|
||||||
|
const node *n,
|
||||||
|
PyCompilerFlags *flags,
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
PyArena *arena);
|
||||||
|
PyAPI_FUNC(mod_ty) PyAST_FromNodeObject(
|
||||||
|
const node *n,
|
||||||
|
PyCompilerFlags *flags,
|
||||||
|
PyObject *filename,
|
||||||
|
PyArena *arena);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_AST_H */
|
14
Darwin/include/python3.4m/bltinmodule.h
Normal file
14
Darwin/include/python3.4m/bltinmodule.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef Py_BLTINMODULE_H
|
||||||
|
#define Py_BLTINMODULE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyFilter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyMap_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyZip_Type;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_BLTINMODULE_H */
|
|
@ -7,8 +7,6 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef PyIntObject PyBoolObject;
|
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyBool_Type;
|
PyAPI_DATA(PyTypeObject) PyBool_Type;
|
||||||
|
|
||||||
#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
|
#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
|
||||||
|
@ -17,10 +15,10 @@ PyAPI_DATA(PyTypeObject) PyBool_Type;
|
||||||
Don't forget to apply Py_INCREF() when returning either!!! */
|
Don't forget to apply Py_INCREF() when returning either!!! */
|
||||||
|
|
||||||
/* Don't use these directly */
|
/* Don't use these directly */
|
||||||
PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct;
|
PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct;
|
||||||
|
|
||||||
/* Use these macros */
|
/* Use these macros */
|
||||||
#define Py_False ((PyObject *) &_Py_ZeroStruct)
|
#define Py_False ((PyObject *) &_Py_FalseStruct)
|
||||||
#define Py_True ((PyObject *) &_Py_TrueStruct)
|
#define Py_True ((PyObject *) &_Py_TrueStruct)
|
||||||
|
|
||||||
/* Macros for returning Py_True or Py_False, respectively */
|
/* Macros for returning Py_True or Py_False, respectively */
|
|
@ -19,13 +19,16 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Object layout */
|
/* Object layout */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_VAR_HEAD
|
PyObject_VAR_HEAD
|
||||||
|
Py_ssize_t ob_alloc; /* How many bytes allocated in ob_bytes */
|
||||||
|
char *ob_bytes; /* Physical backing buffer */
|
||||||
|
char *ob_start; /* Logical start inside ob_bytes */
|
||||||
/* XXX(nnorwitz): should ob_exports be Py_ssize_t? */
|
/* XXX(nnorwitz): should ob_exports be Py_ssize_t? */
|
||||||
int ob_exports; /* how many buffer exports */
|
int ob_exports; /* How many buffer exports */
|
||||||
Py_ssize_t ob_alloc; /* How many bytes allocated */
|
|
||||||
char *ob_bytes;
|
|
||||||
} PyByteArrayObject;
|
} PyByteArrayObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Type object */
|
/* Type object */
|
||||||
PyAPI_DATA(PyTypeObject) PyByteArray_Type;
|
PyAPI_DATA(PyTypeObject) PyByteArray_Type;
|
||||||
|
@ -44,12 +47,14 @@ PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *);
|
||||||
PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
|
PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
|
||||||
|
|
||||||
/* Macros, trading safety for speed */
|
/* Macros, trading safety for speed */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#define PyByteArray_AS_STRING(self) \
|
#define PyByteArray_AS_STRING(self) \
|
||||||
(assert(PyByteArray_Check(self)), \
|
(assert(PyByteArray_Check(self)), \
|
||||||
Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_bytes : _PyByteArray_empty_string)
|
Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string)
|
||||||
#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)),Py_SIZE(self))
|
#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self))
|
||||||
|
|
||||||
PyAPI_DATA(char) _PyByteArray_empty_string[];
|
PyAPI_DATA(char) _PyByteArray_empty_string[];
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
46
Darwin/include/python3.4m/bytes_methods.h
Normal file
46
Darwin/include/python3.4m/bytes_methods.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_BYTES_CTYPE_H
|
||||||
|
#define Py_BYTES_CTYPE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray)
|
||||||
|
* methods of the given names, they operate on ASCII byte strings.
|
||||||
|
*/
|
||||||
|
extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len);
|
||||||
|
|
||||||
|
/* These store their len sized answer in the given preallocated *result arg. */
|
||||||
|
extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len);
|
||||||
|
extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len);
|
||||||
|
extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len);
|
||||||
|
extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len);
|
||||||
|
extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len);
|
||||||
|
|
||||||
|
/* This one gets the raw argument list. */
|
||||||
|
extern PyObject* _Py_bytes_maketrans(PyObject *args);
|
||||||
|
|
||||||
|
/* Shared __doc__ strings. */
|
||||||
|
extern const char _Py_isspace__doc__[];
|
||||||
|
extern const char _Py_isalpha__doc__[];
|
||||||
|
extern const char _Py_isalnum__doc__[];
|
||||||
|
extern const char _Py_isdigit__doc__[];
|
||||||
|
extern const char _Py_islower__doc__[];
|
||||||
|
extern const char _Py_isupper__doc__[];
|
||||||
|
extern const char _Py_istitle__doc__[];
|
||||||
|
extern const char _Py_lower__doc__[];
|
||||||
|
extern const char _Py_upper__doc__[];
|
||||||
|
extern const char _Py_title__doc__[];
|
||||||
|
extern const char _Py_capitalize__doc__[];
|
||||||
|
extern const char _Py_swapcase__doc__[];
|
||||||
|
extern const char _Py_maketrans__doc__[];
|
||||||
|
|
||||||
|
/* this is needed because some docs are shared from the .o, not static */
|
||||||
|
#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
|
||||||
|
|
||||||
|
#endif /* !Py_BYTES_CTYPE_H */
|
||||||
|
#endif /* !Py_LIMITED_API */
|
128
Darwin/include/python3.4m/bytesobject.h
Normal file
128
Darwin/include/python3.4m/bytesobject.h
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
|
||||||
|
/* Bytes (String) object interface */
|
||||||
|
|
||||||
|
#ifndef Py_BYTESOBJECT_H
|
||||||
|
#define Py_BYTESOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
Type PyBytesObject represents a character string. An extra zero byte is
|
||||||
|
reserved at the end to ensure it is zero-terminated, but a size is
|
||||||
|
present so strings with null bytes in them can be represented. This
|
||||||
|
is an immutable object type.
|
||||||
|
|
||||||
|
There are functions to create new string objects, to test
|
||||||
|
an object for string-ness, and to get the
|
||||||
|
string value. The latter function returns a null pointer
|
||||||
|
if the object is not of the proper type.
|
||||||
|
There is a variant that takes an explicit size as well as a
|
||||||
|
variant that assumes a zero-terminated string. Note that none of the
|
||||||
|
functions should be applied to nil objects.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
|
||||||
|
This significantly speeds up dict lookups. */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
Py_hash_t ob_shash;
|
||||||
|
char ob_sval[1];
|
||||||
|
|
||||||
|
/* Invariants:
|
||||||
|
* ob_sval contains space for 'ob_size+1' elements.
|
||||||
|
* ob_sval[ob_size] == 0.
|
||||||
|
* ob_shash is the hash of the string or -1 if not computed yet.
|
||||||
|
*/
|
||||||
|
} PyBytesObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyBytes_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
|
||||||
|
|
||||||
|
#define PyBytes_Check(op) \
|
||||||
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
|
||||||
|
#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
|
||||||
|
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
|
||||||
|
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
|
||||||
|
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
|
||||||
|
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
|
||||||
|
const char *, Py_ssize_t,
|
||||||
|
const char *);
|
||||||
|
|
||||||
|
/* Macro, trading safety for speed */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
|
||||||
|
(((PyBytesObject *)(op))->ob_sval))
|
||||||
|
#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
|
||||||
|
x must be an iterable object. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Provides access to the internal data buffer and size of a string
|
||||||
|
object or the default encoded version of an Unicode object. Passing
|
||||||
|
NULL as *len parameter will force the string buffer to be
|
||||||
|
0-terminated (passing a string with embedded NULL characters will
|
||||||
|
cause an exception). */
|
||||||
|
PyAPI_FUNC(int) PyBytes_AsStringAndSize(
|
||||||
|
PyObject *obj, /* string or Unicode object */
|
||||||
|
char **s, /* pointer to buffer variable */
|
||||||
|
Py_ssize_t *len /* pointer to length variable or NULL
|
||||||
|
(only possible for 0-terminated
|
||||||
|
strings) */
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Using the current locale, insert the thousands grouping
|
||||||
|
into the string pointed to by buffer. For the argument descriptions,
|
||||||
|
see Objects/stringlib/localeutil.h */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer,
|
||||||
|
Py_ssize_t n_buffer,
|
||||||
|
char *digits,
|
||||||
|
Py_ssize_t n_digits,
|
||||||
|
Py_ssize_t min_width);
|
||||||
|
|
||||||
|
/* Using explicit passed-in values, insert the thousands grouping
|
||||||
|
into the string pointed to by buffer. For the argument descriptions,
|
||||||
|
see Objects/stringlib/localeutil.h */
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer,
|
||||||
|
Py_ssize_t n_buffer,
|
||||||
|
char *digits,
|
||||||
|
Py_ssize_t n_digits,
|
||||||
|
Py_ssize_t min_width,
|
||||||
|
const char *grouping,
|
||||||
|
const char *thousands_sep);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flags used by string formatting */
|
||||||
|
#define F_LJUST (1<<0)
|
||||||
|
#define F_SIGN (1<<1)
|
||||||
|
#define F_BLANK (1<<2)
|
||||||
|
#define F_ALT (1<<3)
|
||||||
|
#define F_ZERO (1<<4)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_BYTESOBJECT_H */
|
|
@ -1,5 +1,5 @@
|
||||||
/* Cell object interface */
|
/* Cell object interface */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#ifndef Py_CELLOBJECT_H
|
#ifndef Py_CELLOBJECT_H
|
||||||
#define Py_CELLOBJECT_H
|
#define Py_CELLOBJECT_H
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -26,3 +26,4 @@ PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* !Py_TUPLEOBJECT_H */
|
#endif /* !Py_TUPLEOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
205
Darwin/include/python3.4m/ceval.h
Normal file
205
Darwin/include/python3.4m/ceval.h
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
#ifndef Py_CEVAL_H
|
||||||
|
#define Py_CEVAL_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Interface to random parts in ceval.c */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
|
||||||
|
PyObject *, PyObject *, PyObject *);
|
||||||
|
|
||||||
|
/* Inline this */
|
||||||
|
#define PyEval_CallObject(func,arg) \
|
||||||
|
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
|
||||||
|
const char *format, ...);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
|
||||||
|
const char *methodname,
|
||||||
|
const char *format, ...);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct _frame; /* Avoid including frameobject.h */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
|
||||||
|
PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void);
|
||||||
|
|
||||||
|
/* Look at the current frame's (if any) code's co_flags, and turn on
|
||||||
|
the corresponding compiler flags in cf->cf_flags. Return 1 if any
|
||||||
|
flag was set, else return 0. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
|
||||||
|
PyAPI_FUNC(int) Py_MakePendingCalls(void);
|
||||||
|
|
||||||
|
/* Protection against deeply nested recursive calls
|
||||||
|
|
||||||
|
In Python 3.0, this protection has two levels:
|
||||||
|
* normal anti-recursion protection is triggered when the recursion level
|
||||||
|
exceeds the current recursion limit. It raises a RuntimeError, and sets
|
||||||
|
the "overflowed" flag in the thread state structure. This flag
|
||||||
|
temporarily *disables* the normal protection; this allows cleanup code
|
||||||
|
to potentially outgrow the recursion limit while processing the
|
||||||
|
RuntimeError.
|
||||||
|
* "last chance" anti-recursion protection is triggered when the recursion
|
||||||
|
level exceeds "current recursion limit + 50". By construction, this
|
||||||
|
protection can only be triggered when the "overflowed" flag is set. It
|
||||||
|
means the cleanup code has itself gone into an infinite loop, or the
|
||||||
|
RuntimeError has been mistakingly ignored. When this protection is
|
||||||
|
triggered, the interpreter aborts with a Fatal Error.
|
||||||
|
|
||||||
|
In addition, the "overflowed" flag is automatically reset when the
|
||||||
|
recursion level drops below "current recursion limit - 50". This heuristic
|
||||||
|
is meant to ensure that the normal anti-recursion protection doesn't get
|
||||||
|
disabled too long.
|
||||||
|
|
||||||
|
Please note: this scheme has its own limitations. See:
|
||||||
|
http://mail.python.org/pipermail/python-dev/2008-August/082106.html
|
||||||
|
for some observations.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(void) Py_SetRecursionLimit(int);
|
||||||
|
PyAPI_FUNC(int) Py_GetRecursionLimit(void);
|
||||||
|
|
||||||
|
#define Py_EnterRecursiveCall(where) \
|
||||||
|
(_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
|
||||||
|
_Py_CheckRecursiveCall(where))
|
||||||
|
#define Py_LeaveRecursiveCall() \
|
||||||
|
do{ if(_Py_MakeEndRecCheck(PyThreadState_GET()->recursion_depth)) \
|
||||||
|
PyThreadState_GET()->overflowed = 0; \
|
||||||
|
} while(0)
|
||||||
|
PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where);
|
||||||
|
PyAPI_DATA(int) _Py_CheckRecursionLimit;
|
||||||
|
|
||||||
|
#ifdef USE_STACKCHECK
|
||||||
|
/* With USE_STACKCHECK, we artificially decrement the recursion limit in order
|
||||||
|
to trigger regular stack checks in _Py_CheckRecursiveCall(), except if
|
||||||
|
the "overflowed" flag is set, in which case we need the true value
|
||||||
|
of _Py_CheckRecursionLimit for _Py_MakeEndRecCheck() to function properly.
|
||||||
|
*/
|
||||||
|
# define _Py_MakeRecCheck(x) \
|
||||||
|
(++(x) > (_Py_CheckRecursionLimit += PyThreadState_GET()->overflowed - 1))
|
||||||
|
#else
|
||||||
|
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _Py_MakeEndRecCheck(x) \
|
||||||
|
(--(x) < ((_Py_CheckRecursionLimit > 100) \
|
||||||
|
? (_Py_CheckRecursionLimit - 50) \
|
||||||
|
: (3 * (_Py_CheckRecursionLimit >> 2))))
|
||||||
|
|
||||||
|
#define Py_ALLOW_RECURSION \
|
||||||
|
do { unsigned char _old = PyThreadState_GET()->recursion_critical;\
|
||||||
|
PyThreadState_GET()->recursion_critical = 1;
|
||||||
|
|
||||||
|
#define Py_END_ALLOW_RECURSION \
|
||||||
|
PyThreadState_GET()->recursion_critical = _old; \
|
||||||
|
} while(0);
|
||||||
|
|
||||||
|
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
|
||||||
|
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc);
|
||||||
|
|
||||||
|
/* Interface for threads.
|
||||||
|
|
||||||
|
A module that plans to do a blocking system call (or something else
|
||||||
|
that lasts a long time and doesn't touch Python data) can allow other
|
||||||
|
threads to run as follows:
|
||||||
|
|
||||||
|
...preparations here...
|
||||||
|
Py_BEGIN_ALLOW_THREADS
|
||||||
|
...blocking system call here...
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
|
...interpret result here...
|
||||||
|
|
||||||
|
The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
|
||||||
|
{}-surrounded block.
|
||||||
|
To leave the block in the middle (e.g., with return), you must insert
|
||||||
|
a line containing Py_BLOCK_THREADS before the return, e.g.
|
||||||
|
|
||||||
|
if (...premature_exit...) {
|
||||||
|
Py_BLOCK_THREADS
|
||||||
|
PyErr_SetFromErrno(PyExc_IOError);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
An alternative is:
|
||||||
|
|
||||||
|
Py_BLOCK_THREADS
|
||||||
|
if (...premature_exit...) {
|
||||||
|
PyErr_SetFromErrno(PyExc_IOError);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
Py_UNBLOCK_THREADS
|
||||||
|
|
||||||
|
For convenience, that the value of 'errno' is restored across
|
||||||
|
Py_END_ALLOW_THREADS and Py_BLOCK_THREADS.
|
||||||
|
|
||||||
|
WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND
|
||||||
|
Py_END_ALLOW_THREADS!!!
|
||||||
|
|
||||||
|
The function PyEval_InitThreads() should be called only from
|
||||||
|
init_thread() in "_threadmodule.c".
|
||||||
|
|
||||||
|
Note that not yet all candidates have been converted to use this
|
||||||
|
mechanism!
|
||||||
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
|
||||||
|
|
||||||
|
#ifdef WITH_THREAD
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_InitThreads(void);
|
||||||
|
PyAPI_FUNC(void) _PyEval_FiniThreads(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_AcquireLock(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_ReleaseLock(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
|
||||||
|
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
|
||||||
|
PyAPI_FUNC(void) PyEval_ReInitThreads(void);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
|
||||||
|
PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Py_BEGIN_ALLOW_THREADS { \
|
||||||
|
PyThreadState *_save; \
|
||||||
|
_save = PyEval_SaveThread();
|
||||||
|
#define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
|
||||||
|
#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
|
||||||
|
#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !WITH_THREAD */
|
||||||
|
|
||||||
|
#define Py_BEGIN_ALLOW_THREADS {
|
||||||
|
#define Py_BLOCK_THREADS
|
||||||
|
#define Py_UNBLOCK_THREADS
|
||||||
|
#define Py_END_ALLOW_THREADS }
|
||||||
|
|
||||||
|
#endif /* !WITH_THREAD */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
|
||||||
|
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_CEVAL_H */
|
58
Darwin/include/python3.4m/classobject.h
Normal file
58
Darwin/include/python3.4m/classobject.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/* Former class object interface -- now only bound methods are here */
|
||||||
|
|
||||||
|
/* Revealing some structures (not for general use) */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_CLASSOBJECT_H
|
||||||
|
#define Py_CLASSOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyObject *im_func; /* The callable object implementing the method */
|
||||||
|
PyObject *im_self; /* The instance it is bound to */
|
||||||
|
PyObject *im_weakreflist; /* List of weak references */
|
||||||
|
} PyMethodObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyMethod_Type;
|
||||||
|
|
||||||
|
#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
|
||||||
|
|
||||||
|
/* Macros for direct access to these values. Type checks are *not*
|
||||||
|
done, so use with care. */
|
||||||
|
#define PyMethod_GET_FUNCTION(meth) \
|
||||||
|
(((PyMethodObject *)meth) -> im_func)
|
||||||
|
#define PyMethod_GET_SELF(meth) \
|
||||||
|
(((PyMethodObject *)meth) -> im_self)
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyObject *func;
|
||||||
|
} PyInstanceMethodObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
|
||||||
|
|
||||||
|
#define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
|
||||||
|
|
||||||
|
/* Macros for direct access to these values. Type checks are *not*
|
||||||
|
done, so use with care. */
|
||||||
|
#define PyInstanceMethod_GET_FUNCTION(meth) \
|
||||||
|
(((PyInstanceMethodObject *)meth) -> func)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_CLASSOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
|
@ -1,5 +1,6 @@
|
||||||
/* Definitions for bytecode */
|
/* Definitions for bytecode */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#ifndef Py_CODE_H
|
#ifndef Py_CODE_H
|
||||||
#define Py_CODE_H
|
#define Py_CODE_H
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -10,6 +11,7 @@ extern "C" {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
int co_argcount; /* #arguments, except *args */
|
int co_argcount; /* #arguments, except *args */
|
||||||
|
int co_kwonlyargcount; /* #keyword only arguments */
|
||||||
int co_nlocals; /* #local variables */
|
int co_nlocals; /* #local variables */
|
||||||
int co_stacksize; /* #entries needed for evaluation stack */
|
int co_stacksize; /* #entries needed for evaluation stack */
|
||||||
int co_flags; /* CO_..., see below */
|
int co_flags; /* CO_..., see below */
|
||||||
|
@ -19,9 +21,10 @@ typedef struct {
|
||||||
PyObject *co_varnames; /* tuple of strings (local variable names) */
|
PyObject *co_varnames; /* tuple of strings (local variable names) */
|
||||||
PyObject *co_freevars; /* tuple of strings (free variable names) */
|
PyObject *co_freevars; /* tuple of strings (free variable names) */
|
||||||
PyObject *co_cellvars; /* tuple of strings (cell variable names) */
|
PyObject *co_cellvars; /* tuple of strings (cell variable names) */
|
||||||
/* The rest doesn't count for hash/cmp */
|
/* The rest doesn't count for hash or comparisons */
|
||||||
PyObject *co_filename; /* string (where it was loaded from) */
|
unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */
|
||||||
PyObject *co_name; /* string (name, for reference) */
|
PyObject *co_filename; /* unicode (where it was loaded from) */
|
||||||
|
PyObject *co_name; /* unicode (name, for reference) */
|
||||||
int co_firstlineno; /* first source line number */
|
int co_firstlineno; /* first source line number */
|
||||||
PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See
|
PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See
|
||||||
Objects/lnotab_notes.txt for details. */
|
Objects/lnotab_notes.txt for details. */
|
||||||
|
@ -43,8 +46,8 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
#define CO_NOFREE 0x0040
|
#define CO_NOFREE 0x0040
|
||||||
|
|
||||||
|
/* These are no longer used. */
|
||||||
#if 0
|
#if 0
|
||||||
/* This is no longer used. Stopped defining in 2.5, do not re-use. */
|
|
||||||
#define CO_GENERATOR_ALLOWED 0x1000
|
#define CO_GENERATOR_ALLOWED 0x1000
|
||||||
#endif
|
#endif
|
||||||
#define CO_FUTURE_DIVISION 0x2000
|
#define CO_FUTURE_DIVISION 0x2000
|
||||||
|
@ -53,12 +56,17 @@ typedef struct {
|
||||||
#define CO_FUTURE_PRINT_FUNCTION 0x10000
|
#define CO_FUTURE_PRINT_FUNCTION 0x10000
|
||||||
#define CO_FUTURE_UNICODE_LITERALS 0x20000
|
#define CO_FUTURE_UNICODE_LITERALS 0x20000
|
||||||
|
|
||||||
|
#define CO_FUTURE_BARRY_AS_BDFL 0x40000
|
||||||
|
|
||||||
|
/* This value is found in the co_cell2arg array when the associated cell
|
||||||
|
variable does not correspond to an argument. The maximum number of
|
||||||
|
arguments is 255 (indexed up to 254), so 255 work as a special flag.*/
|
||||||
|
#define CO_CELL_NOT_AN_ARG 255
|
||||||
|
|
||||||
/* This should be defined if a future statement modifies the syntax.
|
/* This should be defined if a future statement modifies the syntax.
|
||||||
For example, when a keyword is added.
|
For example, when a keyword is added.
|
||||||
*/
|
*/
|
||||||
#if 1
|
|
||||||
#define PY_PARSER_REQUIRES_FUTURE_KEYWORD
|
#define PY_PARSER_REQUIRES_FUTURE_KEYWORD
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */
|
#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */
|
||||||
|
|
||||||
|
@ -69,8 +77,9 @@ PyAPI_DATA(PyTypeObject) PyCode_Type;
|
||||||
|
|
||||||
/* Public interface */
|
/* Public interface */
|
||||||
PyAPI_FUNC(PyCodeObject *) PyCode_New(
|
PyAPI_FUNC(PyCodeObject *) PyCode_New(
|
||||||
int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
|
int, int, int, int, int, PyObject *, PyObject *,
|
||||||
PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
|
PyObject *, PyObject *, PyObject *, PyObject *,
|
||||||
|
PyObject *, PyObject *, int, PyObject *);
|
||||||
/* same as struct above */
|
/* same as struct above */
|
||||||
|
|
||||||
/* Creates a new empty code object with the specified source location. */
|
/* Creates a new empty code object with the specified source location. */
|
||||||
|
@ -83,10 +92,6 @@ PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
|
||||||
PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
|
PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
|
||||||
|
|
||||||
/* for internal use only */
|
/* for internal use only */
|
||||||
#define _PyCode_GETCODEPTR(co, pp) \
|
|
||||||
((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \
|
|
||||||
((co)->co_code, 0, (void **)(pp)))
|
|
||||||
|
|
||||||
typedef struct _addr_pair {
|
typedef struct _addr_pair {
|
||||||
int ap_lower;
|
int ap_lower;
|
||||||
int ap_upper;
|
int ap_upper;
|
||||||
|
@ -95,8 +100,10 @@ typedef struct _addr_pair {
|
||||||
/* Update *bounds to describe the first and one-past-the-last instructions in the
|
/* Update *bounds to describe the first and one-past-the-last instructions in the
|
||||||
same line as lasti. Return the number of that line.
|
same line as lasti. Return the number of that line.
|
||||||
*/
|
*/
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
|
PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
|
||||||
int lasti, PyAddrPair *bounds);
|
int lasti, PyAddrPair *bounds);
|
||||||
|
#endif
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
|
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
|
||||||
PyObject *names, PyObject *lineno_obj);
|
PyObject *names, PyObject *lineno_obj);
|
||||||
|
@ -105,3 +112,4 @@ PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* !Py_CODE_H */
|
#endif /* !Py_CODE_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
|
@ -27,7 +27,7 @@ PyAPI_FUNC(int) PyCodec_Register(
|
||||||
PyObject *search_function
|
PyObject *search_function
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Codec register lookup API.
|
/* Codec registry lookup API.
|
||||||
|
|
||||||
Looks up the given encoding and returns a CodecInfo object with
|
Looks up the given encoding and returns a CodecInfo object with
|
||||||
function attributes which implement the different aspects of
|
function attributes which implement the different aspects of
|
||||||
|
@ -45,9 +45,22 @@ PyAPI_FUNC(int) PyCodec_Register(
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
|
PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
|
||||||
const char *encoding
|
const char *encoding
|
||||||
);
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Codec registry encoding check API.
|
||||||
|
|
||||||
|
Returns 1/0 depending on whether there is a registered codec for
|
||||||
|
the given encoding.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCodec_KnownEncoding(
|
||||||
|
const char *encoding
|
||||||
|
);
|
||||||
|
|
||||||
/* Generic codec based encoding API.
|
/* Generic codec based encoding API.
|
||||||
|
|
||||||
|
@ -81,6 +94,53 @@ PyAPI_FUNC(PyObject *) PyCodec_Decode(
|
||||||
const char *errors
|
const char *errors
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* Text codec specific encoding and decoding API.
|
||||||
|
|
||||||
|
Checks the encoding against a list of codecs which do not
|
||||||
|
implement a str<->bytes encoding before attempting the
|
||||||
|
operation.
|
||||||
|
|
||||||
|
Please note that these APIs are internal and should not
|
||||||
|
be used in Python C extensions.
|
||||||
|
|
||||||
|
XXX (ncoghlan): should we make these, or something like them, public
|
||||||
|
in Python 3.5+?
|
||||||
|
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding(
|
||||||
|
const char *encoding,
|
||||||
|
const char *alternate_command
|
||||||
|
);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodec_EncodeText(
|
||||||
|
PyObject *object,
|
||||||
|
const char *encoding,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
|
||||||
|
PyObject *object,
|
||||||
|
const char *encoding,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
/* These two aren't actually text encoding specific, but _io.TextIOWrapper
|
||||||
|
* is the only current API consumer.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder(
|
||||||
|
PyObject *codec_info,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
|
||||||
|
PyObject *codec_info,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* --- Codec Lookup APIs --------------------------------------------------
|
/* --- Codec Lookup APIs --------------------------------------------------
|
||||||
|
|
||||||
All APIs return a codec object with incremented refcount and are
|
All APIs return a codec object with incremented refcount and are
|
||||||
|
@ -161,6 +221,8 @@ PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
|
||||||
/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
|
/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
|
||||||
PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
|
PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
|
||||||
|
|
||||||
|
PyAPI_DATA(const char *) Py_hexdigits;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
72
Darwin/include/python3.4m/compile.h
Normal file
72
Darwin/include/python3.4m/compile.h
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
#ifndef Py_COMPILE_H
|
||||||
|
#define Py_COMPILE_H
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#include "code.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Public interface */
|
||||||
|
struct _node; /* Declare the existence of this type */
|
||||||
|
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
|
||||||
|
|
||||||
|
/* Future feature support */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ff_features; /* flags set by future statements */
|
||||||
|
int ff_lineno; /* line number of last future statement */
|
||||||
|
} PyFutureFeatures;
|
||||||
|
|
||||||
|
#define FUTURE_NESTED_SCOPES "nested_scopes"
|
||||||
|
#define FUTURE_GENERATORS "generators"
|
||||||
|
#define FUTURE_DIVISION "division"
|
||||||
|
#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
|
||||||
|
#define FUTURE_WITH_STATEMENT "with_statement"
|
||||||
|
#define FUTURE_PRINT_FUNCTION "print_function"
|
||||||
|
#define FUTURE_UNICODE_LITERALS "unicode_literals"
|
||||||
|
#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
|
||||||
|
|
||||||
|
struct _mod; /* Declare the existence of this type */
|
||||||
|
#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
|
||||||
|
PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
|
||||||
|
struct _mod *mod,
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
PyCompilerFlags *flags,
|
||||||
|
int optimize,
|
||||||
|
PyArena *arena);
|
||||||
|
PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(
|
||||||
|
struct _mod *mod,
|
||||||
|
PyObject *filename,
|
||||||
|
PyCompilerFlags *flags,
|
||||||
|
int optimize,
|
||||||
|
PyArena *arena);
|
||||||
|
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(
|
||||||
|
struct _mod * mod,
|
||||||
|
const char *filename /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(
|
||||||
|
struct _mod * mod,
|
||||||
|
PyObject *filename
|
||||||
|
);
|
||||||
|
|
||||||
|
/* _Py_Mangle is defined in compile.c */
|
||||||
|
PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
|
||||||
|
|
||||||
|
#define PY_INVALID_STACK_EFFECT INT_MAX
|
||||||
|
PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_LIMITED_API */
|
||||||
|
|
||||||
|
/* These definitions must match corresponding definitions in graminit.h.
|
||||||
|
There's code in compile.c that checks that they are the same. */
|
||||||
|
#define Py_single_input 256
|
||||||
|
#define Py_file_input 257
|
||||||
|
#define Py_eval_input 258
|
||||||
|
|
||||||
|
#endif /* !Py_COMPILE_H */
|
|
@ -6,6 +6,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
typedef struct {
|
typedef struct {
|
||||||
double real;
|
double real;
|
||||||
double imag;
|
double imag;
|
||||||
|
@ -28,7 +29,7 @@ PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex);
|
||||||
PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex);
|
PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex);
|
||||||
PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex);
|
PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex);
|
||||||
PyAPI_FUNC(double) c_abs(Py_complex);
|
PyAPI_FUNC(double) c_abs(Py_complex);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Complex object interface */
|
/* Complex object interface */
|
||||||
|
|
||||||
|
@ -36,29 +37,39 @@ PyAPI_FUNC(double) c_abs(Py_complex);
|
||||||
PyComplexObject represents a complex number with double-precision
|
PyComplexObject represents a complex number with double-precision
|
||||||
real and imaginary parts.
|
real and imaginary parts.
|
||||||
*/
|
*/
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
Py_complex cval;
|
Py_complex cval;
|
||||||
} PyComplexObject;
|
} PyComplexObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyComplex_Type;
|
PyAPI_DATA(PyTypeObject) PyComplex_Type;
|
||||||
|
|
||||||
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
|
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
|
||||||
#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type)
|
#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type)
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
|
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
|
||||||
|
#endif
|
||||||
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
|
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
|
||||||
|
|
||||||
PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
|
PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
|
||||||
PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
|
PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
|
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||||
(Advanced String Formatting). */
|
(Advanced String Formatting). */
|
||||||
PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj,
|
#ifndef Py_LIMITED_API
|
||||||
char *format_spec,
|
PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter(
|
||||||
Py_ssize_t format_spec_len);
|
_PyUnicodeWriter *writer,
|
||||||
|
PyObject *obj,
|
||||||
|
PyObject *format_spec,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/* datetime.h
|
/* datetime.h
|
||||||
*/
|
*/
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#ifndef DATETIME_H
|
#ifndef DATETIME_H
|
||||||
#define DATETIME_H
|
#define DATETIME_H
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -34,7 +34,7 @@ extern "C" {
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
long hashcode; /* -1 when unknown */
|
Py_hash_t hashcode; /* -1 when unknown */
|
||||||
int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
|
int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
|
||||||
int seconds; /* 0 <= seconds < 24*3600 is invariant */
|
int seconds; /* 0 <= seconds < 24*3600 is invariant */
|
||||||
int microseconds; /* 0 <= microseconds < 1000000 is invariant */
|
int microseconds; /* 0 <= microseconds < 1000000 is invariant */
|
||||||
|
@ -51,7 +51,7 @@ typedef struct
|
||||||
*/
|
*/
|
||||||
#define _PyTZINFO_HEAD \
|
#define _PyTZINFO_HEAD \
|
||||||
PyObject_HEAD \
|
PyObject_HEAD \
|
||||||
long hashcode; \
|
Py_hash_t hashcode; \
|
||||||
char hastzinfo; /* boolean flag */
|
char hastzinfo; /* boolean flag */
|
||||||
|
|
||||||
/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
|
/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
|
||||||
|
@ -135,6 +135,12 @@ typedef struct
|
||||||
(((PyDateTime_Time*)o)->data[4] << 8) | \
|
(((PyDateTime_Time*)o)->data[4] << 8) | \
|
||||||
((PyDateTime_Time*)o)->data[5])
|
((PyDateTime_Time*)o)->data[5])
|
||||||
|
|
||||||
|
/* Apply for time delta instances */
|
||||||
|
#define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days)
|
||||||
|
#define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds)
|
||||||
|
#define PyDateTime_DELTA_GET_MICROSECONDS(o) \
|
||||||
|
(((PyDateTime_Delta*)o)->microseconds)
|
||||||
|
|
||||||
|
|
||||||
/* Define structure for C API. */
|
/* Define structure for C API. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -161,9 +167,6 @@ typedef struct {
|
||||||
#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
|
#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
|
||||||
|
|
||||||
|
|
||||||
/* "magic" constant used to partially protect against developer mistakes. */
|
|
||||||
#define DATETIME_API_MAGIC 0x414548d5
|
|
||||||
|
|
||||||
#ifdef Py_BUILD_CORE
|
#ifdef Py_BUILD_CORE
|
||||||
|
|
||||||
/* Macros for type checking when building the Python core. */
|
/* Macros for type checking when building the Python core. */
|
||||||
|
@ -237,3 +240,4 @@ static PyDateTime_CAPI *PyDateTimeAPI = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* !Py_LIMITED_API */
|
|
@ -16,6 +16,7 @@ typedef struct PyGetSetDef {
|
||||||
void *closure;
|
void *closure;
|
||||||
} PyGetSetDef;
|
} PyGetSetDef;
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
|
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
|
||||||
void *wrapped);
|
void *wrapped);
|
||||||
|
|
||||||
|
@ -37,15 +38,18 @@ struct wrapperbase {
|
||||||
|
|
||||||
/* Various kinds of descriptor objects */
|
/* Various kinds of descriptor objects */
|
||||||
|
|
||||||
#define PyDescr_COMMON \
|
|
||||||
PyObject_HEAD \
|
|
||||||
PyTypeObject *d_type; \
|
|
||||||
PyObject *d_name
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyDescr_COMMON;
|
PyObject_HEAD
|
||||||
|
PyTypeObject *d_type;
|
||||||
|
PyObject *d_name;
|
||||||
|
PyObject *d_qualname;
|
||||||
} PyDescrObject;
|
} PyDescrObject;
|
||||||
|
|
||||||
|
#define PyDescr_COMMON PyDescrObject d_common
|
||||||
|
|
||||||
|
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
||||||
|
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyDescr_COMMON;
|
PyDescr_COMMON;
|
||||||
PyMethodDef *d_method;
|
PyMethodDef *d_method;
|
||||||
|
@ -66,21 +70,28 @@ typedef struct {
|
||||||
struct wrapperbase *d_base;
|
struct wrapperbase *d_base;
|
||||||
void *d_wrapped; /* This can be any function pointer */
|
void *d_wrapped; /* This can be any function pointer */
|
||||||
} PyWrapperDescrObject;
|
} PyWrapperDescrObject;
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
|
PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type;
|
||||||
PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
|
|
||||||
PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
|
PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
|
||||||
PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
|
PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyMethodDescr_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type;
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
|
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
|
||||||
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
|
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
|
||||||
|
struct PyMemberDef; /* forward declaration for following prototype */
|
||||||
PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
|
PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
|
||||||
struct PyMemberDef *);
|
struct PyMemberDef *);
|
||||||
PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
|
PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
|
||||||
struct PyGetSetDef *);
|
struct PyGetSetDef *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
||||||
struct wrapperbase *, void *);
|
struct wrapperbase *, void *);
|
||||||
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
|
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
|
||||||
|
#endif
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
|
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
|
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
|
126
Darwin/include/python3.4m/dictobject.h
Normal file
126
Darwin/include/python3.4m/dictobject.h
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
#ifndef Py_DICTOBJECT_H
|
||||||
|
#define Py_DICTOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Dictionary object type -- mapping from hashable object to object */
|
||||||
|
|
||||||
|
/* The distribution includes a separate file, Objects/dictnotes.txt,
|
||||||
|
describing explorations into dictionary design and optimization.
|
||||||
|
It covers typical dictionary use patterns, the parameters for
|
||||||
|
tuning dictionaries, and several ideas for possible optimizations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
|
||||||
|
typedef struct _dictkeysobject PyDictKeysObject;
|
||||||
|
|
||||||
|
/* The ma_values pointer is NULL for a combined table
|
||||||
|
* or points to an array of PyObject* for a split table
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
Py_ssize_t ma_used;
|
||||||
|
PyDictKeysObject *ma_keys;
|
||||||
|
PyObject **ma_values;
|
||||||
|
} PyDictObject;
|
||||||
|
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDict_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictIterValue_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictIterItem_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictKeys_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictItems_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictValues_Type;
|
||||||
|
|
||||||
|
#define PyDict_Check(op) \
|
||||||
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
|
||||||
|
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
|
||||||
|
#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type)
|
||||||
|
#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type)
|
||||||
|
#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type)
|
||||||
|
/* This excludes Values, since they are not sets. */
|
||||||
|
# define PyDictViewSet_Check(op) \
|
||||||
|
(PyDictKeys_Check(op) || PyDictItems_Check(op))
|
||||||
|
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_New(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp,
|
||||||
|
struct _Py_Identifier *key);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_SetDefault(
|
||||||
|
PyObject *mp, PyObject *key, PyObject *defaultobj);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
|
||||||
|
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
|
||||||
|
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
|
||||||
|
PyAPI_FUNC(int) PyDict_Next(
|
||||||
|
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyDictKeysObject *_PyDict_NewKeysForClass(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
|
||||||
|
PyAPI_FUNC(int) _PyDict_Next(
|
||||||
|
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
|
||||||
|
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
||||||
|
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
|
||||||
|
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
|
||||||
|
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
|
||||||
|
#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyDict_ClearFreeList(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
|
||||||
|
PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
|
||||||
|
|
||||||
|
/* PyDict_Merge updates/merges from a mapping object (an object that
|
||||||
|
supports PyMapping_Keys() and PyObject_GetItem()). If override is true,
|
||||||
|
the last occurrence of a key wins, else the first. The Python
|
||||||
|
dict.update(other) is equivalent to PyDict_Merge(dict, other, 1).
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
|
||||||
|
PyObject *other,
|
||||||
|
int override);
|
||||||
|
|
||||||
|
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
|
||||||
|
iterable objects of length 2. If override is true, the last occurrence
|
||||||
|
of a key wins, else the first. The Python dict constructor dict(seq2)
|
||||||
|
is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1).
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
|
||||||
|
PyObject *seq2,
|
||||||
|
int override);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key);
|
||||||
|
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
|
||||||
|
PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item);
|
||||||
|
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key);
|
||||||
|
PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
|
||||||
|
|
||||||
|
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
|
||||||
|
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_DICTOBJECT_H */
|
19
Darwin/include/python3.4m/dtoa.h
Normal file
19
Darwin/include/python3.4m/dtoa.h
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef PY_NO_SHORT_FLOAT_REPR
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
|
||||||
|
PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
|
||||||
|
int *decpt, int *sign, char **rve);
|
||||||
|
PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
|
||||||
|
PyAPI_FUNC(double) _Py_dg_stdnan(int sign);
|
||||||
|
PyAPI_FUNC(double) _Py_dg_infinity(int sign);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
499
Darwin/include/python3.4m/dynamic_annotations.h
Normal file
499
Darwin/include/python3.4m/dynamic_annotations.h
Normal file
|
@ -0,0 +1,499 @@
|
||||||
|
/* Copyright (c) 2008-2009, Google Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Neither the name of Google Inc. nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from
|
||||||
|
* this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ---
|
||||||
|
* Author: Kostya Serebryany
|
||||||
|
* Copied to CPython by Jeffrey Yasskin, with all macros renamed to
|
||||||
|
* start with _Py_ to avoid colliding with users embedding Python, and
|
||||||
|
* with deprecated macros removed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This file defines dynamic annotations for use with dynamic analysis
|
||||||
|
tool such as valgrind, PIN, etc.
|
||||||
|
|
||||||
|
Dynamic annotation is a source code annotation that affects
|
||||||
|
the generated code (that is, the annotation is not a comment).
|
||||||
|
Each such annotation is attached to a particular
|
||||||
|
instruction and/or to a particular object (address) in the program.
|
||||||
|
|
||||||
|
The annotations that should be used by users are macros in all upper-case
|
||||||
|
(e.g., _Py_ANNOTATE_NEW_MEMORY).
|
||||||
|
|
||||||
|
Actual implementation of these macros may differ depending on the
|
||||||
|
dynamic analysis tool being used.
|
||||||
|
|
||||||
|
See http://code.google.com/p/data-race-test/ for more information.
|
||||||
|
|
||||||
|
This file supports the following dynamic analysis tools:
|
||||||
|
- None (DYNAMIC_ANNOTATIONS_ENABLED is not defined or zero).
|
||||||
|
Macros are defined empty.
|
||||||
|
- ThreadSanitizer, Helgrind, DRD (DYNAMIC_ANNOTATIONS_ENABLED is 1).
|
||||||
|
Macros are defined as calls to non-inlinable empty functions
|
||||||
|
that are intercepted by Valgrind. */
|
||||||
|
|
||||||
|
#ifndef __DYNAMIC_ANNOTATIONS_H__
|
||||||
|
#define __DYNAMIC_ANNOTATIONS_H__
|
||||||
|
|
||||||
|
#ifndef DYNAMIC_ANNOTATIONS_ENABLED
|
||||||
|
# define DYNAMIC_ANNOTATIONS_ENABLED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DYNAMIC_ANNOTATIONS_ENABLED != 0
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when implementing condition variables such as CondVar,
|
||||||
|
using conditional critical sections (Await/LockWhen) and when constructing
|
||||||
|
user-defined synchronization mechanisms.
|
||||||
|
|
||||||
|
The annotations _Py_ANNOTATE_HAPPENS_BEFORE() and
|
||||||
|
_Py_ANNOTATE_HAPPENS_AFTER() can be used to define happens-before arcs in
|
||||||
|
user-defined synchronization mechanisms: the race detector will infer an
|
||||||
|
arc from the former to the latter when they share the same argument
|
||||||
|
pointer.
|
||||||
|
|
||||||
|
Example 1 (reference counting):
|
||||||
|
|
||||||
|
void Unref() {
|
||||||
|
_Py_ANNOTATE_HAPPENS_BEFORE(&refcount_);
|
||||||
|
if (AtomicDecrementByOne(&refcount_) == 0) {
|
||||||
|
_Py_ANNOTATE_HAPPENS_AFTER(&refcount_);
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Example 2 (message queue):
|
||||||
|
|
||||||
|
void MyQueue::Put(Type *e) {
|
||||||
|
MutexLock lock(&mu_);
|
||||||
|
_Py_ANNOTATE_HAPPENS_BEFORE(e);
|
||||||
|
PutElementIntoMyQueue(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Type *MyQueue::Get() {
|
||||||
|
MutexLock lock(&mu_);
|
||||||
|
Type *e = GetElementFromMyQueue();
|
||||||
|
_Py_ANNOTATE_HAPPENS_AFTER(e);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
Note: when possible, please use the existing reference counting and message
|
||||||
|
queue implementations instead of inventing new ones. */
|
||||||
|
|
||||||
|
/* Report that wait on the condition variable at address "cv" has succeeded
|
||||||
|
and the lock at address "lock" is held. */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) \
|
||||||
|
AnnotateCondVarWait(__FILE__, __LINE__, cv, lock)
|
||||||
|
|
||||||
|
/* Report that wait on the condition variable at "cv" has succeeded. Variant
|
||||||
|
w/o lock. */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_WAIT(cv) \
|
||||||
|
AnnotateCondVarWait(__FILE__, __LINE__, cv, NULL)
|
||||||
|
|
||||||
|
/* Report that we are about to signal on the condition variable at address
|
||||||
|
"cv". */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_SIGNAL(cv) \
|
||||||
|
AnnotateCondVarSignal(__FILE__, __LINE__, cv)
|
||||||
|
|
||||||
|
/* Report that we are about to signal_all on the condition variable at "cv". */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \
|
||||||
|
AnnotateCondVarSignalAll(__FILE__, __LINE__, cv)
|
||||||
|
|
||||||
|
/* Annotations for user-defined synchronization mechanisms. */
|
||||||
|
#define _Py_ANNOTATE_HAPPENS_BEFORE(obj) _Py_ANNOTATE_CONDVAR_SIGNAL(obj)
|
||||||
|
#define _Py_ANNOTATE_HAPPENS_AFTER(obj) _Py_ANNOTATE_CONDVAR_WAIT(obj)
|
||||||
|
|
||||||
|
/* Report that the bytes in the range [pointer, pointer+size) are about
|
||||||
|
to be published safely. The race checker will create a happens-before
|
||||||
|
arc from the call _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) to
|
||||||
|
subsequent accesses to this memory.
|
||||||
|
Note: this annotation may not work properly if the race detector uses
|
||||||
|
sampling, i.e. does not observe all memory accesses.
|
||||||
|
*/
|
||||||
|
#define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \
|
||||||
|
AnnotatePublishMemoryRange(__FILE__, __LINE__, pointer, size)
|
||||||
|
|
||||||
|
/* Instruct the tool to create a happens-before arc between mu->Unlock() and
|
||||||
|
mu->Lock(). This annotation may slow down the race detector and hide real
|
||||||
|
races. Normally it is used only when it would be difficult to annotate each
|
||||||
|
of the mutex's critical sections individually using the annotations above.
|
||||||
|
This annotation makes sense only for hybrid race detectors. For pure
|
||||||
|
happens-before detectors this is a no-op. For more details see
|
||||||
|
http://code.google.com/p/data-race-test/wiki/PureHappensBeforeVsHybrid . */
|
||||||
|
#define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) \
|
||||||
|
AnnotateMutexIsUsedAsCondVar(__FILE__, __LINE__, mu)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when defining memory allocators, or when memory that
|
||||||
|
was protected in one way starts to be protected in another. */
|
||||||
|
|
||||||
|
/* Report that a new memory at "address" of size "size" has been allocated.
|
||||||
|
This might be used when the memory has been retrieved from a free list and
|
||||||
|
is about to be reused, or when a the locking discipline for a variable
|
||||||
|
changes. */
|
||||||
|
#define _Py_ANNOTATE_NEW_MEMORY(address, size) \
|
||||||
|
AnnotateNewMemory(__FILE__, __LINE__, address, size)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when defining FIFO queues that transfer data between
|
||||||
|
threads. */
|
||||||
|
|
||||||
|
/* Report that the producer-consumer queue (such as ProducerConsumerQueue) at
|
||||||
|
address "pcq" has been created. The _Py_ANNOTATE_PCQ_* annotations should
|
||||||
|
be used only for FIFO queues. For non-FIFO queues use
|
||||||
|
_Py_ANNOTATE_HAPPENS_BEFORE (for put) and _Py_ANNOTATE_HAPPENS_AFTER (for
|
||||||
|
get). */
|
||||||
|
#define _Py_ANNOTATE_PCQ_CREATE(pcq) \
|
||||||
|
AnnotatePCQCreate(__FILE__, __LINE__, pcq)
|
||||||
|
|
||||||
|
/* Report that the queue at address "pcq" is about to be destroyed. */
|
||||||
|
#define _Py_ANNOTATE_PCQ_DESTROY(pcq) \
|
||||||
|
AnnotatePCQDestroy(__FILE__, __LINE__, pcq)
|
||||||
|
|
||||||
|
/* Report that we are about to put an element into a FIFO queue at address
|
||||||
|
"pcq". */
|
||||||
|
#define _Py_ANNOTATE_PCQ_PUT(pcq) \
|
||||||
|
AnnotatePCQPut(__FILE__, __LINE__, pcq)
|
||||||
|
|
||||||
|
/* Report that we've just got an element from a FIFO queue at address "pcq". */
|
||||||
|
#define _Py_ANNOTATE_PCQ_GET(pcq) \
|
||||||
|
AnnotatePCQGet(__FILE__, __LINE__, pcq)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations that suppress errors. It is usually better to express the
|
||||||
|
program's synchronization using the other annotations, but these can
|
||||||
|
be used when all else fails. */
|
||||||
|
|
||||||
|
/* Report that we may have a benign race at "pointer", with size
|
||||||
|
"sizeof(*(pointer))". "pointer" must be a non-void* pointer. Insert at the
|
||||||
|
point where "pointer" has been allocated, preferably close to the point
|
||||||
|
where the race happens. See also _Py_ANNOTATE_BENIGN_RACE_STATIC. */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE(pointer, description) \
|
||||||
|
AnnotateBenignRaceSized(__FILE__, __LINE__, pointer, \
|
||||||
|
sizeof(*(pointer)), description)
|
||||||
|
|
||||||
|
/* Same as _Py_ANNOTATE_BENIGN_RACE(address, description), but applies to
|
||||||
|
the memory range [address, address+size). */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \
|
||||||
|
AnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description)
|
||||||
|
|
||||||
|
/* Request the analysis tool to ignore all reads in the current thread
|
||||||
|
until _Py_ANNOTATE_IGNORE_READS_END is called.
|
||||||
|
Useful to ignore intentional racey reads, while still checking
|
||||||
|
other reads and all writes.
|
||||||
|
See also _Py_ANNOTATE_UNPROTECTED_READ. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_BEGIN() \
|
||||||
|
AnnotateIgnoreReadsBegin(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Stop ignoring reads. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_END() \
|
||||||
|
AnnotateIgnoreReadsEnd(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore writes. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_WRITES_BEGIN() \
|
||||||
|
AnnotateIgnoreWritesBegin(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Stop ignoring writes. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_WRITES_END() \
|
||||||
|
AnnotateIgnoreWritesEnd(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Start ignoring all memory accesses (reads and writes). */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \
|
||||||
|
do {\
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_BEGIN();\
|
||||||
|
_Py_ANNOTATE_IGNORE_WRITES_BEGIN();\
|
||||||
|
}while(0)\
|
||||||
|
|
||||||
|
/* Stop ignoring all memory accesses. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END() \
|
||||||
|
do {\
|
||||||
|
_Py_ANNOTATE_IGNORE_WRITES_END();\
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_END();\
|
||||||
|
}while(0)\
|
||||||
|
|
||||||
|
/* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore synchronization events:
|
||||||
|
RWLOCK* and CONDVAR*. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_SYNC_BEGIN() \
|
||||||
|
AnnotateIgnoreSyncBegin(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Stop ignoring sync events. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_SYNC_END() \
|
||||||
|
AnnotateIgnoreSyncEnd(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
|
||||||
|
/* Enable (enable!=0) or disable (enable==0) race detection for all threads.
|
||||||
|
This annotation could be useful if you want to skip expensive race analysis
|
||||||
|
during some period of program execution, e.g. during initialization. */
|
||||||
|
#define _Py_ANNOTATE_ENABLE_RACE_DETECTION(enable) \
|
||||||
|
AnnotateEnableRaceDetection(__FILE__, __LINE__, enable)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful for debugging. */
|
||||||
|
|
||||||
|
/* Request to trace every access to "address". */
|
||||||
|
#define _Py_ANNOTATE_TRACE_MEMORY(address) \
|
||||||
|
AnnotateTraceMemory(__FILE__, __LINE__, address)
|
||||||
|
|
||||||
|
/* Report the current thread name to a race detector. */
|
||||||
|
#define _Py_ANNOTATE_THREAD_NAME(name) \
|
||||||
|
AnnotateThreadName(__FILE__, __LINE__, name)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when implementing locks. They are not
|
||||||
|
normally needed by modules that merely use locks.
|
||||||
|
The "lock" argument is a pointer to the lock object. */
|
||||||
|
|
||||||
|
/* Report that a lock has been created at address "lock". */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_CREATE(lock) \
|
||||||
|
AnnotateRWLockCreate(__FILE__, __LINE__, lock)
|
||||||
|
|
||||||
|
/* Report that the lock at address "lock" is about to be destroyed. */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_DESTROY(lock) \
|
||||||
|
AnnotateRWLockDestroy(__FILE__, __LINE__, lock)
|
||||||
|
|
||||||
|
/* Report that the lock at address "lock" has been acquired.
|
||||||
|
is_w=1 for writer lock, is_w=0 for reader lock. */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \
|
||||||
|
AnnotateRWLockAcquired(__FILE__, __LINE__, lock, is_w)
|
||||||
|
|
||||||
|
/* Report that the lock at address "lock" is about to be released. */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_RELEASED(lock, is_w) \
|
||||||
|
AnnotateRWLockReleased(__FILE__, __LINE__, lock, is_w)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when implementing barriers. They are not
|
||||||
|
normally needed by modules that merely use barriers.
|
||||||
|
The "barrier" argument is a pointer to the barrier object. */
|
||||||
|
|
||||||
|
/* Report that the "barrier" has been initialized with initial "count".
|
||||||
|
If 'reinitialization_allowed' is true, initialization is allowed to happen
|
||||||
|
multiple times w/o calling barrier_destroy() */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) \
|
||||||
|
AnnotateBarrierInit(__FILE__, __LINE__, barrier, count, \
|
||||||
|
reinitialization_allowed)
|
||||||
|
|
||||||
|
/* Report that we are about to enter barrier_wait("barrier"). */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_WAIT_BEFORE(barrier) \
|
||||||
|
AnnotateBarrierWaitBefore(__FILE__, __LINE__, barrier)
|
||||||
|
|
||||||
|
/* Report that we just exited barrier_wait("barrier"). */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_WAIT_AFTER(barrier) \
|
||||||
|
AnnotateBarrierWaitAfter(__FILE__, __LINE__, barrier)
|
||||||
|
|
||||||
|
/* Report that the "barrier" has been destroyed. */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_DESTROY(barrier) \
|
||||||
|
AnnotateBarrierDestroy(__FILE__, __LINE__, barrier)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful for testing race detectors. */
|
||||||
|
|
||||||
|
/* Report that we expect a race on the variable at "address".
|
||||||
|
Use only in unit tests for a race detector. */
|
||||||
|
#define _Py_ANNOTATE_EXPECT_RACE(address, description) \
|
||||||
|
AnnotateExpectRace(__FILE__, __LINE__, address, description)
|
||||||
|
|
||||||
|
/* A no-op. Insert where you like to test the interceptors. */
|
||||||
|
#define _Py_ANNOTATE_NO_OP(arg) \
|
||||||
|
AnnotateNoOp(__FILE__, __LINE__, arg)
|
||||||
|
|
||||||
|
/* Force the race detector to flush its state. The actual effect depends on
|
||||||
|
* the implementation of the detector. */
|
||||||
|
#define _Py_ANNOTATE_FLUSH_STATE() \
|
||||||
|
AnnotateFlushState(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
|
||||||
|
#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
|
||||||
|
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_CREATE(lock) /* empty */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_DESTROY(lock) /* empty */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) /* empty */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_RELEASED(lock, is_w) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) /* */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_WAIT_BEFORE(barrier) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_WAIT_AFTER(barrier) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_DESTROY(barrier) /* empty */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) /* empty */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_WAIT(cv) /* empty */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_SIGNAL(cv) /* empty */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL(cv) /* empty */
|
||||||
|
#define _Py_ANNOTATE_HAPPENS_BEFORE(obj) /* empty */
|
||||||
|
#define _Py_ANNOTATE_HAPPENS_AFTER(obj) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(address, size) /* empty */
|
||||||
|
#define _Py_ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size) /* empty */
|
||||||
|
#define _Py_ANNOTATE_SWAP_MEMORY_RANGE(address, size) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PCQ_CREATE(pcq) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PCQ_DESTROY(pcq) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PCQ_PUT(pcq) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PCQ_GET(pcq) /* empty */
|
||||||
|
#define _Py_ANNOTATE_NEW_MEMORY(address, size) /* empty */
|
||||||
|
#define _Py_ANNOTATE_EXPECT_RACE(address, description) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE(address, description) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) /* empty */
|
||||||
|
#define _Py_ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) /* empty */
|
||||||
|
#define _Py_ANNOTATE_TRACE_MEMORY(arg) /* empty */
|
||||||
|
#define _Py_ANNOTATE_THREAD_NAME(name) /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_BEGIN() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_END() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_WRITES_BEGIN() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_WRITES_END() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_SYNC_BEGIN() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_SYNC_END() /* empty */
|
||||||
|
#define _Py_ANNOTATE_ENABLE_RACE_DETECTION(enable) /* empty */
|
||||||
|
#define _Py_ANNOTATE_NO_OP(arg) /* empty */
|
||||||
|
#define _Py_ANNOTATE_FLUSH_STATE() /* empty */
|
||||||
|
|
||||||
|
#endif /* DYNAMIC_ANNOTATIONS_ENABLED */
|
||||||
|
|
||||||
|
/* Use the macros above rather than using these functions directly. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void AnnotateRWLockCreate(const char *file, int line,
|
||||||
|
const volatile void *lock);
|
||||||
|
void AnnotateRWLockDestroy(const char *file, int line,
|
||||||
|
const volatile void *lock);
|
||||||
|
void AnnotateRWLockAcquired(const char *file, int line,
|
||||||
|
const volatile void *lock, long is_w);
|
||||||
|
void AnnotateRWLockReleased(const char *file, int line,
|
||||||
|
const volatile void *lock, long is_w);
|
||||||
|
void AnnotateBarrierInit(const char *file, int line,
|
||||||
|
const volatile void *barrier, long count,
|
||||||
|
long reinitialization_allowed);
|
||||||
|
void AnnotateBarrierWaitBefore(const char *file, int line,
|
||||||
|
const volatile void *barrier);
|
||||||
|
void AnnotateBarrierWaitAfter(const char *file, int line,
|
||||||
|
const volatile void *barrier);
|
||||||
|
void AnnotateBarrierDestroy(const char *file, int line,
|
||||||
|
const volatile void *barrier);
|
||||||
|
void AnnotateCondVarWait(const char *file, int line,
|
||||||
|
const volatile void *cv,
|
||||||
|
const volatile void *lock);
|
||||||
|
void AnnotateCondVarSignal(const char *file, int line,
|
||||||
|
const volatile void *cv);
|
||||||
|
void AnnotateCondVarSignalAll(const char *file, int line,
|
||||||
|
const volatile void *cv);
|
||||||
|
void AnnotatePublishMemoryRange(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
long size);
|
||||||
|
void AnnotateUnpublishMemoryRange(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
long size);
|
||||||
|
void AnnotatePCQCreate(const char *file, int line,
|
||||||
|
const volatile void *pcq);
|
||||||
|
void AnnotatePCQDestroy(const char *file, int line,
|
||||||
|
const volatile void *pcq);
|
||||||
|
void AnnotatePCQPut(const char *file, int line,
|
||||||
|
const volatile void *pcq);
|
||||||
|
void AnnotatePCQGet(const char *file, int line,
|
||||||
|
const volatile void *pcq);
|
||||||
|
void AnnotateNewMemory(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
long size);
|
||||||
|
void AnnotateExpectRace(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
const char *description);
|
||||||
|
void AnnotateBenignRace(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
const char *description);
|
||||||
|
void AnnotateBenignRaceSized(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
long size,
|
||||||
|
const char *description);
|
||||||
|
void AnnotateMutexIsUsedAsCondVar(const char *file, int line,
|
||||||
|
const volatile void *mu);
|
||||||
|
void AnnotateTraceMemory(const char *file, int line,
|
||||||
|
const volatile void *arg);
|
||||||
|
void AnnotateThreadName(const char *file, int line,
|
||||||
|
const char *name);
|
||||||
|
void AnnotateIgnoreReadsBegin(const char *file, int line);
|
||||||
|
void AnnotateIgnoreReadsEnd(const char *file, int line);
|
||||||
|
void AnnotateIgnoreWritesBegin(const char *file, int line);
|
||||||
|
void AnnotateIgnoreWritesEnd(const char *file, int line);
|
||||||
|
void AnnotateEnableRaceDetection(const char *file, int line, int enable);
|
||||||
|
void AnnotateNoOp(const char *file, int line,
|
||||||
|
const volatile void *arg);
|
||||||
|
void AnnotateFlushState(const char *file, int line);
|
||||||
|
|
||||||
|
/* Return non-zero value if running under valgrind.
|
||||||
|
|
||||||
|
If "valgrind.h" is included into dynamic_annotations.c,
|
||||||
|
the regular valgrind mechanism will be used.
|
||||||
|
See http://valgrind.org/docs/manual/manual-core-adv.html about
|
||||||
|
RUNNING_ON_VALGRIND and other valgrind "client requests".
|
||||||
|
The file "valgrind.h" may be obtained by doing
|
||||||
|
svn co svn://svn.valgrind.org/valgrind/trunk/include
|
||||||
|
|
||||||
|
If for some reason you can't use "valgrind.h" or want to fake valgrind,
|
||||||
|
there are two ways to make this function return non-zero:
|
||||||
|
- Use environment variable: export RUNNING_ON_VALGRIND=1
|
||||||
|
- Make your tool intercept the function RunningOnValgrind() and
|
||||||
|
change its return value.
|
||||||
|
*/
|
||||||
|
int RunningOnValgrind(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus)
|
||||||
|
|
||||||
|
/* _Py_ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads.
|
||||||
|
|
||||||
|
Instead of doing
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_BEGIN();
|
||||||
|
... = x;
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_END();
|
||||||
|
one can use
|
||||||
|
... = _Py_ANNOTATE_UNPROTECTED_READ(x); */
|
||||||
|
template <class T>
|
||||||
|
inline T _Py_ANNOTATE_UNPROTECTED_READ(const volatile T &x) {
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_BEGIN();
|
||||||
|
T res = x;
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_END();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
/* Apply _Py_ANNOTATE_BENIGN_RACE_SIZED to a static variable. */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \
|
||||||
|
namespace { \
|
||||||
|
class static_var ## _annotator { \
|
||||||
|
public: \
|
||||||
|
static_var ## _annotator() { \
|
||||||
|
_Py_ANNOTATE_BENIGN_RACE_SIZED(&static_var, \
|
||||||
|
sizeof(static_var), \
|
||||||
|
# static_var ": " description); \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
static static_var ## _annotator the ## static_var ## _annotator;\
|
||||||
|
}
|
||||||
|
#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
|
||||||
|
|
||||||
|
#define _Py_ANNOTATE_UNPROTECTED_READ(x) (x)
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */
|
||||||
|
|
||||||
|
#endif /* DYNAMIC_ANNOTATIONS_ENABLED */
|
||||||
|
|
||||||
|
#endif /* __DYNAMIC_ANNOTATIONS_H__ */
|
|
@ -29,6 +29,8 @@ extern "C" {
|
||||||
#define E_EOFS 23 /* EOF in triple-quoted string */
|
#define E_EOFS 23 /* EOF in triple-quoted string */
|
||||||
#define E_EOLS 24 /* EOL in single-quoted string */
|
#define E_EOLS 24 /* EOL in single-quoted string */
|
||||||
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
|
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
|
||||||
|
#define E_IDENTIFIER 26 /* Invalid characters in identifier */
|
||||||
|
#define E_BADSINGLE 27 /* Ill-formed single statement input */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
27
Darwin/include/python3.4m/eval.h
Normal file
27
Darwin/include/python3.4m/eval.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
/* Interface to execute compiled code */
|
||||||
|
|
||||||
|
#ifndef Py_EVAL_H
|
||||||
|
#define Py_EVAL_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co,
|
||||||
|
PyObject *globals,
|
||||||
|
PyObject *locals,
|
||||||
|
PyObject **args, int argc,
|
||||||
|
PyObject **kwds, int kwdc,
|
||||||
|
PyObject **defs, int defc,
|
||||||
|
PyObject *kwdefs, PyObject *closure);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_EVAL_H */
|
58
Darwin/include/python3.4m/fileobject.h
Normal file
58
Darwin/include/python3.4m/fileobject.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/* File object interface (what's left of it -- see io.py) */
|
||||||
|
|
||||||
|
#ifndef Py_FILEOBJECT_H
|
||||||
|
#define Py_FILEOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PY_STDIOTEXTMODE "b"
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
|
||||||
|
const char *, const char *,
|
||||||
|
const char *, int);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
||||||
|
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
||||||
|
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The default encoding used by the platform file system APIs
|
||||||
|
If non-NULL, this is different than the default encoding for strings
|
||||||
|
*/
|
||||||
|
PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
|
||||||
|
PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
|
||||||
|
|
||||||
|
/* Internal API
|
||||||
|
|
||||||
|
The std printer acts as a preliminary sys.stderr until the new io
|
||||||
|
infrastructure is in place. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
|
||||||
|
PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
|
||||||
|
|
||||||
|
#if defined _MSC_VER && _MSC_VER >= 1400
|
||||||
|
/* A routine to check if a file descriptor is valid on Windows. Returns 0
|
||||||
|
* and sets errno to EBADF if it isn't. This is to avoid Assertions
|
||||||
|
* from various functions in the Windows CRT beginning with
|
||||||
|
* Visual Studio 2005
|
||||||
|
*/
|
||||||
|
int _PyVerify_fd(int fd);
|
||||||
|
#else
|
||||||
|
#define _PyVerify_fd(A) (1) /* dummy */
|
||||||
|
#endif
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
/* A routine to check if a file descriptor can be select()-ed. */
|
||||||
|
#ifdef HAVE_SELECT
|
||||||
|
#define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE))
|
||||||
|
#else
|
||||||
|
#define _PyIsSelectable_fd(FD) (1)
|
||||||
|
#endif /* HAVE_SELECT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_FILEOBJECT_H */
|
79
Darwin/include/python3.4m/fileutils.h
Normal file
79
Darwin/include/python3.4m/fileutils.h
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
#ifndef Py_FILEUTILS_H
|
||||||
|
#define Py_FILEUTILS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
|
||||||
|
|
||||||
|
PyAPI_FUNC(wchar_t *) _Py_char2wchar(
|
||||||
|
const char *arg,
|
||||||
|
size_t *size);
|
||||||
|
|
||||||
|
PyAPI_FUNC(char*) _Py_wchar2char(
|
||||||
|
const wchar_t *text,
|
||||||
|
size_t *error_pos);
|
||||||
|
|
||||||
|
#if defined(HAVE_STAT) && !defined(MS_WINDOWS)
|
||||||
|
PyAPI_FUNC(int) _Py_wstat(
|
||||||
|
const wchar_t* path,
|
||||||
|
struct stat *buf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STAT
|
||||||
|
PyAPI_FUNC(int) _Py_stat(
|
||||||
|
PyObject *path,
|
||||||
|
struct stat *statbuf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _Py_open(
|
||||||
|
const char *pathname,
|
||||||
|
int flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(FILE *) _Py_wfopen(
|
||||||
|
const wchar_t *path,
|
||||||
|
const wchar_t *mode);
|
||||||
|
|
||||||
|
PyAPI_FUNC(FILE*) _Py_fopen(
|
||||||
|
const char *pathname,
|
||||||
|
const char *mode);
|
||||||
|
|
||||||
|
PyAPI_FUNC(FILE*) _Py_fopen_obj(
|
||||||
|
PyObject *path,
|
||||||
|
const char *mode);
|
||||||
|
|
||||||
|
#ifdef HAVE_READLINK
|
||||||
|
PyAPI_FUNC(int) _Py_wreadlink(
|
||||||
|
const wchar_t *path,
|
||||||
|
wchar_t *buf,
|
||||||
|
size_t bufsiz);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_REALPATH
|
||||||
|
PyAPI_FUNC(wchar_t*) _Py_wrealpath(
|
||||||
|
const wchar_t *path,
|
||||||
|
wchar_t *resolved_path,
|
||||||
|
size_t resolved_path_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
|
||||||
|
wchar_t *buf,
|
||||||
|
size_t size);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _Py_get_inheritable(int fd);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
|
||||||
|
int *atomic_flag_works);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_dup(int fd);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_FILEUTILS_H */
|
128
Darwin/include/python3.4m/floatobject.h
Normal file
128
Darwin/include/python3.4m/floatobject.h
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
|
||||||
|
/* Float object interface */
|
||||||
|
|
||||||
|
/*
|
||||||
|
PyFloatObject represents a (double precision) floating point number.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_FLOATOBJECT_H
|
||||||
|
#define Py_FLOATOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
double ob_fval;
|
||||||
|
} PyFloatObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyFloat_Type;
|
||||||
|
|
||||||
|
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
|
||||||
|
#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
|
||||||
|
|
||||||
|
#ifdef Py_NAN
|
||||||
|
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Py_RETURN_INF(sign) do \
|
||||||
|
if (copysign(1., sign) == 1.) { \
|
||||||
|
return PyFloat_FromDouble(Py_HUGE_VAL); \
|
||||||
|
} else { \
|
||||||
|
return PyFloat_FromDouble(-Py_HUGE_VAL); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
PyAPI_FUNC(double) PyFloat_GetMax(void);
|
||||||
|
PyAPI_FUNC(double) PyFloat_GetMin(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void);
|
||||||
|
|
||||||
|
/* Return Python float from string PyObject. */
|
||||||
|
PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*);
|
||||||
|
|
||||||
|
/* Return Python float from C double. */
|
||||||
|
PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double);
|
||||||
|
|
||||||
|
/* Extract C double from Python float. The macro version trades safety for
|
||||||
|
speed. */
|
||||||
|
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* _PyFloat_{Pack,Unpack}{4,8}
|
||||||
|
*
|
||||||
|
* The struct and pickle (at least) modules need an efficient platform-
|
||||||
|
* independent way to store floating-point values as byte strings.
|
||||||
|
* The Pack routines produce a string from a C double, and the Unpack
|
||||||
|
* routines produce a C double from such a string. The suffix (4 or 8)
|
||||||
|
* specifies the number of bytes in the string.
|
||||||
|
*
|
||||||
|
* On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats
|
||||||
|
* these functions work by copying bits. On other platforms, the formats the
|
||||||
|
* 4- byte format is identical to the IEEE-754 single precision format, and
|
||||||
|
* the 8-byte format to the IEEE-754 double precision format, although the
|
||||||
|
* packing of INFs and NaNs (if such things exist on the platform) isn't
|
||||||
|
* handled correctly, and attempting to unpack a string containing an IEEE
|
||||||
|
* INF or NaN will raise an exception.
|
||||||
|
*
|
||||||
|
* On non-IEEE platforms with more precision, or larger dynamic range, than
|
||||||
|
* 754 supports, not all values can be packed; on non-IEEE platforms with less
|
||||||
|
* precision, or smaller dynamic range, not all values can be unpacked. What
|
||||||
|
* happens in such cases is partly accidental (alas).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The pack routines write 4 or 8 bytes, starting at p. le is a bool
|
||||||
|
* argument, true if you want the string in little-endian format (exponent
|
||||||
|
* last, at p+3 or p+7), false if you want big-endian format (exponent
|
||||||
|
* first, at p).
|
||||||
|
* Return value: 0 if all is OK, -1 if error (and an exception is
|
||||||
|
* set, most likely OverflowError).
|
||||||
|
* There are two problems on non-IEEE platforms:
|
||||||
|
* 1): What this does is undefined if x is a NaN or infinity.
|
||||||
|
* 2): -0.0 and +0.0 produce the same string.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
|
||||||
|
|
||||||
|
/* Needed for the old way for marshal to store a floating point number.
|
||||||
|
Returns the string length copied into p, -1 on error.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len);
|
||||||
|
|
||||||
|
/* Used to get the important decimal digits of a double */
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum);
|
||||||
|
PyAPI_FUNC(void) _PyFloat_DigitsInit(void);
|
||||||
|
|
||||||
|
/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool
|
||||||
|
* argument, true if the string is in little-endian format (exponent
|
||||||
|
* last, at p+3 or p+7), false if big-endian (exponent first, at p).
|
||||||
|
* Return value: The unpacked double. On error, this is -1.0 and
|
||||||
|
* PyErr_Occurred() is true (and an exception is set, most likely
|
||||||
|
* OverflowError). Note that on a non-IEEE platform this will refuse
|
||||||
|
* to unpack a string that represents a NaN or infinity.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
|
||||||
|
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
|
||||||
|
|
||||||
|
/* free list api */
|
||||||
|
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
|
||||||
|
|
||||||
|
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||||
|
(Advanced String Formatting). */
|
||||||
|
PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter(
|
||||||
|
_PyUnicodeWriter *writer,
|
||||||
|
PyObject *obj,
|
||||||
|
PyObject *format_spec,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end);
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_FLOATOBJECT_H */
|
95
Darwin/include/python3.4m/frameobject.h
Normal file
95
Darwin/include/python3.4m/frameobject.h
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
|
||||||
|
/* Frame object interface */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_FRAMEOBJECT_H
|
||||||
|
#define Py_FRAMEOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int b_type; /* what kind of block this is */
|
||||||
|
int b_handler; /* where to jump to find handler */
|
||||||
|
int b_level; /* value stack level to pop to */
|
||||||
|
} PyTryBlock;
|
||||||
|
|
||||||
|
typedef struct _frame {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
struct _frame *f_back; /* previous frame, or NULL */
|
||||||
|
PyCodeObject *f_code; /* code segment */
|
||||||
|
PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
|
||||||
|
PyObject *f_globals; /* global symbol table (PyDictObject) */
|
||||||
|
PyObject *f_locals; /* local symbol table (any mapping) */
|
||||||
|
PyObject **f_valuestack; /* points after the last local */
|
||||||
|
/* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
|
||||||
|
Frame evaluation usually NULLs it, but a frame that yields sets it
|
||||||
|
to the current stack top. */
|
||||||
|
PyObject **f_stacktop;
|
||||||
|
PyObject *f_trace; /* Trace function */
|
||||||
|
|
||||||
|
/* In a generator, we need to be able to swap between the exception
|
||||||
|
state inside the generator and the exception state of the calling
|
||||||
|
frame (which shouldn't be impacted when the generator "yields"
|
||||||
|
from an except handler).
|
||||||
|
These three fields exist exactly for that, and are unused for
|
||||||
|
non-generator frames. See the save_exc_state and swap_exc_state
|
||||||
|
functions in ceval.c for details of their use. */
|
||||||
|
PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
|
||||||
|
/* Borrowed reference to a generator, or NULL */
|
||||||
|
PyObject *f_gen;
|
||||||
|
|
||||||
|
int f_lasti; /* Last instruction if called */
|
||||||
|
/* Call PyFrame_GetLineNumber() instead of reading this field
|
||||||
|
directly. As of 2.3 f_lineno is only valid when tracing is
|
||||||
|
active (i.e. when f_trace is set). At other times we use
|
||||||
|
PyCode_Addr2Line to calculate the line from the current
|
||||||
|
bytecode index. */
|
||||||
|
int f_lineno; /* Current line number */
|
||||||
|
int f_iblock; /* index in f_blockstack */
|
||||||
|
char f_executing; /* whether the frame is still executing */
|
||||||
|
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
|
||||||
|
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
|
||||||
|
} PyFrameObject;
|
||||||
|
|
||||||
|
|
||||||
|
/* Standard object interface */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
||||||
|
|
||||||
|
#define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
||||||
|
PyObject *, PyObject *);
|
||||||
|
|
||||||
|
|
||||||
|
/* The rest of the interface is specific for frame objects */
|
||||||
|
|
||||||
|
/* Block management functions */
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
|
||||||
|
PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);
|
||||||
|
|
||||||
|
/* Extend the value stack */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int);
|
||||||
|
|
||||||
|
/* Conversions between "fast locals" and locals in dictionary */
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f);
|
||||||
|
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
|
||||||
|
|
||||||
|
/* Return the line of code the frame is currently executing. */
|
||||||
|
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_FRAMEOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
/* Function object interface */
|
/* Function object interface */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#ifndef Py_FUNCOBJECT_H
|
#ifndef Py_FUNCOBJECT_H
|
||||||
#define Py_FUNCOBJECT_H
|
#define Py_FUNCOBJECT_H
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -10,7 +10,7 @@ extern "C" {
|
||||||
/* Function objects and code objects should not be confused with each other:
|
/* Function objects and code objects should not be confused with each other:
|
||||||
*
|
*
|
||||||
* Function objects are created by the execution of the 'def' statement.
|
* Function objects are created by the execution of the 'def' statement.
|
||||||
* They reference a code object in their func_code attribute, which is a
|
* They reference a code object in their __code__ attribute, which is a
|
||||||
* purely syntactic object, i.e. nothing more than a compiled version of some
|
* purely syntactic object, i.e. nothing more than a compiled version of some
|
||||||
* source code lines. There is one code object per source code "fragment",
|
* source code lines. There is one code object per source code "fragment",
|
||||||
* but each code object can be referenced by zero or many function objects
|
* but each code object can be referenced by zero or many function objects
|
||||||
|
@ -20,15 +20,18 @@ extern "C" {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
PyObject *func_code; /* A code object */
|
PyObject *func_code; /* A code object, the __code__ attribute */
|
||||||
PyObject *func_globals; /* A dictionary (other mappings won't do) */
|
PyObject *func_globals; /* A dictionary (other mappings won't do) */
|
||||||
PyObject *func_defaults; /* NULL or a tuple */
|
PyObject *func_defaults; /* NULL or a tuple */
|
||||||
|
PyObject *func_kwdefaults; /* NULL or a dict */
|
||||||
PyObject *func_closure; /* NULL or a tuple of cell objects */
|
PyObject *func_closure; /* NULL or a tuple of cell objects */
|
||||||
PyObject *func_doc; /* The __doc__ attribute, can be anything */
|
PyObject *func_doc; /* The __doc__ attribute, can be anything */
|
||||||
PyObject *func_name; /* The __name__ attribute, a string object */
|
PyObject *func_name; /* The __name__ attribute, a string object */
|
||||||
PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */
|
PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */
|
||||||
PyObject *func_weakreflist; /* List of weak references */
|
PyObject *func_weakreflist; /* List of weak references */
|
||||||
PyObject *func_module; /* The __module__ attribute, can be anything */
|
PyObject *func_module; /* The __module__ attribute, can be anything */
|
||||||
|
PyObject *func_annotations; /* Annotations, a dict or NULL */
|
||||||
|
PyObject *func_qualname; /* The qualified name */
|
||||||
|
|
||||||
/* Invariant:
|
/* Invariant:
|
||||||
* func_closure contains the bindings for func_code->co_freevars, so
|
* func_closure contains the bindings for func_code->co_freevars, so
|
||||||
|
@ -42,13 +45,18 @@ PyAPI_DATA(PyTypeObject) PyFunction_Type;
|
||||||
#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type)
|
#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type)
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
|
PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_NewWithQualName(PyObject *, PyObject *, PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);
|
PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *);
|
PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *);
|
PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *);
|
PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *);
|
||||||
PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *);
|
PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *);
|
PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *);
|
||||||
PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);
|
PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *);
|
||||||
|
|
||||||
/* Macros for direct access to these values. Type checks are *not*
|
/* Macros for direct access to these values. Type checks are *not*
|
||||||
done, so use with care. */
|
done, so use with care. */
|
||||||
|
@ -60,8 +68,12 @@ PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);
|
||||||
(((PyFunctionObject *)func) -> func_module)
|
(((PyFunctionObject *)func) -> func_module)
|
||||||
#define PyFunction_GET_DEFAULTS(func) \
|
#define PyFunction_GET_DEFAULTS(func) \
|
||||||
(((PyFunctionObject *)func) -> func_defaults)
|
(((PyFunctionObject *)func) -> func_defaults)
|
||||||
|
#define PyFunction_GET_KW_DEFAULTS(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_kwdefaults)
|
||||||
#define PyFunction_GET_CLOSURE(func) \
|
#define PyFunction_GET_CLOSURE(func) \
|
||||||
(((PyFunctionObject *)func) -> func_closure)
|
(((PyFunctionObject *)func) -> func_closure)
|
||||||
|
#define PyFunction_GET_ANNOTATIONS(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_annotations)
|
||||||
|
|
||||||
/* The classmethod and staticmethod types lives here, too */
|
/* The classmethod and staticmethod types lives here, too */
|
||||||
PyAPI_DATA(PyTypeObject) PyClassMethod_Type;
|
PyAPI_DATA(PyTypeObject) PyClassMethod_Type;
|
||||||
|
@ -74,3 +86,4 @@ PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* !Py_FUNCOBJECT_H */
|
#endif /* !Py_FUNCOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
46
Darwin/include/python3.4m/genobject.h
Normal file
46
Darwin/include/python3.4m/genobject.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
/* Generator object interface */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_GENOBJECT_H
|
||||||
|
#define Py_GENOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct _frame; /* Avoid including frameobject.h */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
/* The gi_ prefix is intended to remind of generator-iterator. */
|
||||||
|
|
||||||
|
/* Note: gi_frame can be NULL if the generator is "finished" */
|
||||||
|
struct _frame *gi_frame;
|
||||||
|
|
||||||
|
/* True if generator is being executed. */
|
||||||
|
char gi_running;
|
||||||
|
|
||||||
|
/* The code object backing the generator */
|
||||||
|
PyObject *gi_code;
|
||||||
|
|
||||||
|
/* List of weak reference. */
|
||||||
|
PyObject *gi_weakreflist;
|
||||||
|
} PyGenObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyGen_Type;
|
||||||
|
|
||||||
|
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
|
||||||
|
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
|
||||||
|
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
|
||||||
|
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
|
||||||
|
PyObject *_PyGen_Send(PyGenObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_GENOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
84
Darwin/include/python3.4m/graminit.h
Normal file
84
Darwin/include/python3.4m/graminit.h
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/* Generated by Parser/pgen */
|
||||||
|
|
||||||
|
#define single_input 256
|
||||||
|
#define file_input 257
|
||||||
|
#define eval_input 258
|
||||||
|
#define decorator 259
|
||||||
|
#define decorators 260
|
||||||
|
#define decorated 261
|
||||||
|
#define funcdef 262
|
||||||
|
#define parameters 263
|
||||||
|
#define typedargslist 264
|
||||||
|
#define tfpdef 265
|
||||||
|
#define varargslist 266
|
||||||
|
#define vfpdef 267
|
||||||
|
#define stmt 268
|
||||||
|
#define simple_stmt 269
|
||||||
|
#define small_stmt 270
|
||||||
|
#define expr_stmt 271
|
||||||
|
#define testlist_star_expr 272
|
||||||
|
#define augassign 273
|
||||||
|
#define del_stmt 274
|
||||||
|
#define pass_stmt 275
|
||||||
|
#define flow_stmt 276
|
||||||
|
#define break_stmt 277
|
||||||
|
#define continue_stmt 278
|
||||||
|
#define return_stmt 279
|
||||||
|
#define yield_stmt 280
|
||||||
|
#define raise_stmt 281
|
||||||
|
#define import_stmt 282
|
||||||
|
#define import_name 283
|
||||||
|
#define import_from 284
|
||||||
|
#define import_as_name 285
|
||||||
|
#define dotted_as_name 286
|
||||||
|
#define import_as_names 287
|
||||||
|
#define dotted_as_names 288
|
||||||
|
#define dotted_name 289
|
||||||
|
#define global_stmt 290
|
||||||
|
#define nonlocal_stmt 291
|
||||||
|
#define assert_stmt 292
|
||||||
|
#define compound_stmt 293
|
||||||
|
#define if_stmt 294
|
||||||
|
#define while_stmt 295
|
||||||
|
#define for_stmt 296
|
||||||
|
#define try_stmt 297
|
||||||
|
#define with_stmt 298
|
||||||
|
#define with_item 299
|
||||||
|
#define except_clause 300
|
||||||
|
#define suite 301
|
||||||
|
#define test 302
|
||||||
|
#define test_nocond 303
|
||||||
|
#define lambdef 304
|
||||||
|
#define lambdef_nocond 305
|
||||||
|
#define or_test 306
|
||||||
|
#define and_test 307
|
||||||
|
#define not_test 308
|
||||||
|
#define comparison 309
|
||||||
|
#define comp_op 310
|
||||||
|
#define star_expr 311
|
||||||
|
#define expr 312
|
||||||
|
#define xor_expr 313
|
||||||
|
#define and_expr 314
|
||||||
|
#define shift_expr 315
|
||||||
|
#define arith_expr 316
|
||||||
|
#define term 317
|
||||||
|
#define factor 318
|
||||||
|
#define power 319
|
||||||
|
#define atom 320
|
||||||
|
#define testlist_comp 321
|
||||||
|
#define trailer 322
|
||||||
|
#define subscriptlist 323
|
||||||
|
#define subscript 324
|
||||||
|
#define sliceop 325
|
||||||
|
#define exprlist 326
|
||||||
|
#define testlist 327
|
||||||
|
#define dictorsetmaker 328
|
||||||
|
#define classdef 329
|
||||||
|
#define arglist 330
|
||||||
|
#define argument 331
|
||||||
|
#define comp_iter 332
|
||||||
|
#define comp_for 333
|
||||||
|
#define comp_if 334
|
||||||
|
#define encoding_decl 335
|
||||||
|
#define yield_expr 336
|
||||||
|
#define yield_arg 337
|
|
@ -69,14 +69,14 @@ typedef struct {
|
||||||
/* FUNCTIONS */
|
/* FUNCTIONS */
|
||||||
|
|
||||||
grammar *newgrammar(int start);
|
grammar *newgrammar(int start);
|
||||||
dfa *adddfa(grammar *g, int type, char *name);
|
dfa *adddfa(grammar *g, int type, const char *name);
|
||||||
int addstate(dfa *d);
|
int addstate(dfa *d);
|
||||||
void addarc(dfa *d, int from, int to, int lbl);
|
void addarc(dfa *d, int from, int to, int lbl);
|
||||||
dfa *PyGrammar_FindDFA(grammar *g, int type);
|
dfa *PyGrammar_FindDFA(grammar *g, int type);
|
||||||
|
|
||||||
int addlabel(labellist *ll, int type, char *str);
|
int addlabel(labellist *ll, int type, const char *str);
|
||||||
int findlabel(labellist *ll, int type, char *str);
|
int findlabel(labellist *ll, int type, const char *str);
|
||||||
char *PyGrammar_LabelRepr(label *lb);
|
const char *PyGrammar_LabelRepr(label *lb);
|
||||||
void translatelabels(grammar *g);
|
void translatelabels(grammar *g);
|
||||||
|
|
||||||
void addfirstsets(grammar *g);
|
void addfirstsets(grammar *g);
|
130
Darwin/include/python3.4m/import.h
Normal file
130
Darwin/include/python3.4m/import.h
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
|
||||||
|
/* Module definition and import interface */
|
||||||
|
|
||||||
|
#ifndef Py_IMPORT_H
|
||||||
|
#define Py_IMPORT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyImportZip_Init(void);
|
||||||
|
|
||||||
|
PyMODINIT_FUNC PyInit_imp(void);
|
||||||
|
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
|
||||||
|
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
PyObject *co
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
PyObject *co,
|
||||||
|
const char *pathname /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
PyObject *co,
|
||||||
|
const char *pathname, /* decoded from the filesystem encoding */
|
||||||
|
const char *cpathname /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
|
||||||
|
PyObject *name,
|
||||||
|
PyObject *co,
|
||||||
|
PyObject *pathname,
|
||||||
|
PyObject *cpathname
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
|
||||||
|
PyObject *name
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_AddModule(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
PyObject *globals,
|
||||||
|
PyObject *locals,
|
||||||
|
PyObject *fromlist,
|
||||||
|
int level
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
|
||||||
|
PyObject *name,
|
||||||
|
PyObject *globals,
|
||||||
|
PyObject *locals,
|
||||||
|
PyObject *fromlist,
|
||||||
|
int level
|
||||||
|
);
|
||||||
|
|
||||||
|
#define PyImport_ImportModuleEx(n, g, l, f) \
|
||||||
|
PyImport_ImportModuleLevel(n, g, l, f, 0)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
|
||||||
|
PyAPI_FUNC(void) PyImport_Cleanup(void);
|
||||||
|
PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
|
||||||
|
PyObject *name
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifdef WITH_THREAD
|
||||||
|
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
|
||||||
|
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
|
||||||
|
#else
|
||||||
|
#define _PyImport_AcquireLock()
|
||||||
|
#define _PyImport_ReleaseLock() 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
|
||||||
|
PyObject *mod,
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
|
||||||
|
|
||||||
|
struct _inittab {
|
||||||
|
const char *name; /* ASCII encoded string */
|
||||||
|
PyObject* (*initfunc)(void);
|
||||||
|
};
|
||||||
|
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
|
||||||
|
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyImport_AppendInittab(
|
||||||
|
const char *name, /* ASCII encoded string */
|
||||||
|
PyObject* (*initfunc)(void)
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
struct _frozen {
|
||||||
|
const char *name; /* ASCII encoded string */
|
||||||
|
const unsigned char *code;
|
||||||
|
int size;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Embedding apps may change this pointer to point to their favorite
|
||||||
|
collection of frozen modules: */
|
||||||
|
|
||||||
|
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_IMPORT_H */
|
21
Darwin/include/python3.4m/intrcheck.h
Normal file
21
Darwin/include/python3.4m/intrcheck.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
#ifndef Py_INTRCHECK_H
|
||||||
|
#define Py_INTRCHECK_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
|
||||||
|
PyAPI_FUNC(void) PyOS_InitInterrupts(void);
|
||||||
|
PyAPI_FUNC(void) PyOS_AfterFork(void);
|
||||||
|
PyAPI_FUNC(int) _PyOS_IsMainThread(void);
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
/* windows.h is not included by Python.h so use void* instead of HANDLE */
|
||||||
|
PyAPI_FUNC(void*) _PyOS_SigintEvent(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_INTRCHECK_H */
|
|
@ -6,16 +6,18 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PySeqIter_Type;
|
PyAPI_DATA(PyTypeObject) PySeqIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCallIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type;
|
||||||
|
|
||||||
#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type)
|
#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type)
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
|
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyCallIter_Type;
|
|
||||||
|
|
||||||
#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type)
|
#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type)
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
|
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -19,6 +19,7 @@ returned item's reference count.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_VAR_HEAD
|
PyObject_VAR_HEAD
|
||||||
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
|
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
|
||||||
|
@ -37,8 +38,12 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
Py_ssize_t allocated;
|
Py_ssize_t allocated;
|
||||||
} PyListObject;
|
} PyListObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
PyAPI_DATA(PyTypeObject) PyList_Type;
|
PyAPI_DATA(PyTypeObject) PyList_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyListIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyListRevIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PySortWrapper_Type;
|
||||||
|
|
||||||
#define PyList_Check(op) \
|
#define PyList_Check(op) \
|
||||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
|
||||||
|
@ -55,12 +60,19 @@ PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
|
||||||
PyAPI_FUNC(int) PyList_Sort(PyObject *);
|
PyAPI_FUNC(int) PyList_Sort(PyObject *);
|
||||||
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
|
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
|
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyList_ClearFreeList(void);
|
||||||
|
PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Macro, trading safety for speed */
|
/* Macro, trading safety for speed */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
|
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
|
||||||
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
|
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
|
||||||
#define PyList_GET_SIZE(op) Py_SIZE(op)
|
#define PyList_GET_SIZE(op) Py_SIZE(op)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
#ifndef Py_LONGINTREPR_H
|
#ifndef Py_LONGINTREPR_H
|
||||||
#define Py_LONGINTREPR_H
|
#define Py_LONGINTREPR_H
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -5,9 +6,9 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* This is published for the benefit of "friend" marshal.c only. */
|
/* This is published for the benefit of "friends" marshal.c and _decimal.c. */
|
||||||
|
|
||||||
/* Parameters of the long integer representation. There are two different
|
/* Parameters of the integer representation. There are two different
|
||||||
sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit
|
sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit
|
||||||
integer type, and one set for 15-bit digits with each digit stored in an
|
integer type, and one set for 15-bit digits with each digit stored in an
|
||||||
unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at
|
unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at
|
||||||
|
@ -28,11 +29,14 @@ extern "C" {
|
||||||
of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)
|
of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)
|
||||||
conversion functions
|
conversion functions
|
||||||
|
|
||||||
- the long <-> size_t/Py_ssize_t conversion functions expect that
|
- the Python int <-> size_t/Py_ssize_t conversion functions expect that
|
||||||
PyLong_SHIFT is strictly less than the number of bits in a size_t
|
PyLong_SHIFT is strictly less than the number of bits in a size_t
|
||||||
|
|
||||||
- the marshal code currently expects that PyLong_SHIFT is a multiple of 15
|
- the marshal code currently expects that PyLong_SHIFT is a multiple of 15
|
||||||
|
|
||||||
|
- NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single
|
||||||
|
digit; with the current values this forces PyLong_SHIFT >= 9
|
||||||
|
|
||||||
The values 15 and 30 should fit all of the above requirements, on any
|
The values 15 and 30 should fit all of the above requirements, on any
|
||||||
platform.
|
platform.
|
||||||
*/
|
*/
|
||||||
|
@ -63,11 +67,6 @@ typedef long stwodigits; /* signed variant of twodigits */
|
||||||
#define PyLong_BASE ((digit)1 << PyLong_SHIFT)
|
#define PyLong_BASE ((digit)1 << PyLong_SHIFT)
|
||||||
#define PyLong_MASK ((digit)(PyLong_BASE - 1))
|
#define PyLong_MASK ((digit)(PyLong_BASE - 1))
|
||||||
|
|
||||||
/* b/w compatibility with Python 2.5 */
|
|
||||||
#define SHIFT PyLong_SHIFT
|
|
||||||
#define BASE PyLong_BASE
|
|
||||||
#define MASK PyLong_MASK
|
|
||||||
|
|
||||||
#if PyLong_SHIFT % 5 != 0
|
#if PyLong_SHIFT % 5 != 0
|
||||||
#error "longobject.c requires that PyLong_SHIFT be divisible by 5"
|
#error "longobject.c requires that PyLong_SHIFT be divisible by 5"
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,7 +83,7 @@ typedef long stwodigits; /* signed variant of twodigits */
|
||||||
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available.
|
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available.
|
||||||
|
|
||||||
CAUTION: Generic code manipulating subtypes of PyVarObject has to
|
CAUTION: Generic code manipulating subtypes of PyVarObject has to
|
||||||
aware that longs abuse ob_size's sign bit.
|
aware that ints abuse ob_size's sign bit.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct _longobject {
|
struct _longobject {
|
||||||
|
@ -101,3 +100,4 @@ PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* !Py_LONGINTREPR_H */
|
#endif /* !Py_LONGINTREPR_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue