Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
00f9ab2d
Commit
00f9ab2d
authored
Aug 24, 2014
by
Travis Hance
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
got operator.c to compile (added a lot more unimplemented c api functions)
parent
27c2ced5
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
719 additions
and
6 deletions
+719
-6
include/Python.h
include/Python.h
+1
-1
include/pyconfig.h
include/pyconfig.h
+2
-0
include/unicodeobject.h
include/unicodeobject.h
+4
-0
src/Makefile
src/Makefile
+1
-1
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+3
-1
src/runtime/capi.cpp
src/runtime/capi.cpp
+282
-1
src/runtime/dict.cpp
src/runtime/dict.cpp
+24
-0
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+4
-0
src/runtime/types.cpp
src/runtime/types.cpp
+5
-1
src/runtime/types.h
src/runtime/types.h
+5
-1
src/runtime/unicode.cpp
src/runtime/unicode.cpp
+388
-0
No files found.
include/Python.h
View file @
00f9ab2d
...
...
@@ -16,7 +16,6 @@
#define PYSTON_EXTINCLUDE_PYTHON_H
#include <assert.h>
#include <ctype.h> // it looks like this gets included via unicodeobject.h in CPython
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
...
...
@@ -39,6 +38,7 @@
#include "pydebug.h"
#include "unicodeobject.h"
#include "intobject.h"
#include "boolobject.h"
#include "longobject.h"
...
...
include/pyconfig.h
View file @
00f9ab2d
...
...
@@ -32,5 +32,7 @@
#define HAVE_ASINH 1
#define HAVE_ATANH 1
#define HAVE_EXPM1 1
#define Py_USING_UNICODE 1
#define Py_UNICODE_SIZE 4
#endif
/*Py_PYCONFIG_H*/
include/unicodeobject.h
View file @
00f9ab2d
...
...
@@ -426,8 +426,12 @@ typedef struct {
PyAPI_DATA
(
PyTypeObject
)
PyUnicode_Type
;
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC
(
bool
)
PyUnicode_Check
(
PyObject
*
);
#if 0
#define PyUnicode_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
#endif
#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type)
/* Fast access macros */
...
...
src/Makefile
View file @
00f9ab2d
...
...
@@ -268,7 +268,7 @@ SRCS := $(MAIN_SRCS) $(STDLIB_SRCS)
STDLIB_OBJS
:=
stdlib.bc.o stdlib.stripped.bc.o
STDLIB_RELEASE_OBJS
:=
stdlib.release.bc.o
STDMODULE_SRCS
:=
errnomodule.c shamodule.c sha256module.c sha512module.c _math.c mathmodule.c md5.c md5module.c _sre.c
$(EXTRA_STDMODULE_SRCS)
STDMODULE_SRCS
:=
errnomodule.c shamodule.c sha256module.c sha512module.c _math.c mathmodule.c md5.c md5module.c _sre.c
operator.c
$(EXTRA_STDMODULE_SRCS)
FROM_CPYTHON_SRCS
:=
$(
addprefix
../lib_python/2.7_Modules/,
$(STDMODULE_SRCS)
)
$(
wildcard
capi/
*
.c
)
# The stdlib objects have slightly longer dependency chains,
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
00f9ab2d
...
...
@@ -419,7 +419,7 @@ extern "C" {
BoxedClass
*
BaseException
,
*
Exception
,
*
StandardError
,
*
AssertionError
,
*
AttributeError
,
*
GeneratorExit
,
*
TypeError
,
*
NameError
,
*
KeyError
,
*
IndexError
,
*
IOError
,
*
OSError
,
*
ZeroDivisionError
,
*
ValueError
,
*
UnboundLocalError
,
*
RuntimeError
,
*
ImportError
,
*
StopIteration
,
*
Warning
,
*
SyntaxError
,
*
OverflowError
,
*
DeprecationWarning
,
*
MemoryError
,
*
LookupError
,
*
EnvironmentError
,
*
ArithmeticError
;
*
MemoryError
,
*
LookupError
,
*
EnvironmentError
,
*
ArithmeticError
,
*
BufferError
;
}
Box
*
exceptionNew1
(
BoxedClass
*
cls
)
{
...
...
@@ -607,6 +607,7 @@ void setupBuiltins() {
DeprecationWarning
=
makeBuiltinException
(
Warning
,
"DeprecationWarning"
);
/*BytesWarning =*/
makeBuiltinException
(
Warning
,
"BytesWarning"
);
MemoryError
=
makeBuiltinException
(
StandardError
,
"MemoryError"
);
BufferError
=
makeBuiltinException
(
StandardError
,
"BufferError"
);
repr_obj
=
new
BoxedFunction
(
boxRTFunction
((
void
*
)
repr
,
UNKNOWN
,
1
));
builtins_module
->
giveAttr
(
"repr"
,
repr_obj
);
...
...
@@ -700,6 +701,7 @@ void setupBuiltins() {
builtins_module
->
giveAttr
(
"object"
,
object_cls
);
builtins_module
->
giveAttr
(
"str"
,
str_cls
);
builtins_module
->
giveAttr
(
"basestring"
,
basestring_cls
);
builtins_module
->
giveAttr
(
"unicode"
,
unicode_cls
);
builtins_module
->
giveAttr
(
"int"
,
int_cls
);
builtins_module
->
giveAttr
(
"long"
,
long_cls
);
builtins_module
->
giveAttr
(
"float"
,
float_cls
);
...
...
src/runtime/capi.cpp
View file @
00f9ab2d
...
...
@@ -71,8 +71,15 @@ MAKE_CHECK(Long, long_cls)
MAKE_CHECK
(
List
,
list_cls
)
MAKE_CHECK
(
Tuple
,
tuple_cls
)
MAKE_CHECK
(
Dict
,
dict_cls
)
#ifdef Py_USING_UNICODE
MAKE_CHECK
(
Unicode
,
unicode_cls
)
#endif
#undef MAKE_CHECK
extern
"C"
{
int
Py_Py3kWarningFlag
;
}
extern
"C"
PyObject
*
PyDict_New
()
{
return
new
BoxedDict
();
}
...
...
@@ -286,6 +293,25 @@ extern "C" void PyObject_Free(void* p) {
ASSERT
(
0
,
"I think this is good enough but I'm not sure; should test"
);
}
extern
"C"
PyObject
*
_PyObject_GC_Malloc
(
size_t
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
_PyObject_GC_New
(
PyTypeObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyVarObject
*
_PyObject_GC_NewVar
(
PyTypeObject
*
,
Py_ssize_t
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
void
PyObject_GC_Track
(
void
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
void
PyObject_GC_UnTrack
(
void
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
void
PyObject_GC_Del
(
void
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyObject_CallObject
(
PyObject
*
obj
,
PyObject
*
args
)
{
RELEASE_ASSERT
(
args
,
""
);
// actually it looks like this is allowed to be NULL
RELEASE_ASSERT
(
args
->
cls
==
tuple_cls
,
""
);
...
...
@@ -334,6 +360,14 @@ extern "C" PyObject* PyObject_GetIter(PyObject*) {
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyObject_GetAttr
(
PyObject
*
o
,
PyObject
*
attr_name
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyObject_GenericGetAttr
(
PyObject
*
o
,
PyObject
*
name
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyObject_GetItem
(
PyObject
*
o
,
PyObject
*
key
)
{
try
{
return
getitem
(
o
,
key
);
...
...
@@ -342,10 +376,65 @@ extern "C" PyObject* PyObject_GetItem(PyObject* o, PyObject* key) {
}
}
extern
"C"
int
PyObject_SetItem
(
PyObject
*
o
,
PyObject
*
key
,
PyObject
*
v
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyObject_DelItem
(
PyObject
*
o
,
PyObject
*
key
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyObject_RichCompare
(
PyObject
*
o1
,
PyObject
*
o2
,
int
opid
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyObject_IsTrue
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyObject_Not
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyObject_Call
(
PyObject
*
callable_object
,
PyObject
*
args
,
PyObject
*
kw
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
void
PyObject_ClearWeakRefs
(
PyObject
*
object
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyObject_GetBuffer
(
PyObject
*
exporter
,
Py_buffer
*
view
,
int
flags
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
_PyArg_NoKeywords
(
const
char
*
funcname
,
PyObject
*
kw
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PySequence_Check
(
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
Py_ssize_t
PySequence_Size
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PySequence_Concat
(
PyObject
*
o1
,
PyObject
*
o2
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PySequence_Repeat
(
PyObject
*
o
,
Py_ssize_t
count
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PySequence_InPlaceConcat
(
PyObject
*
o1
,
PyObject
*
o2
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PySequence_InPlaceRepeat
(
PyObject
*
o
,
Py_ssize_t
count
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PySequence_GetItem
(
PyObject
*
o
,
Py_ssize_t
i
)
{
try
{
...
...
@@ -365,6 +454,46 @@ extern "C" PyObject* PySequence_GetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t
}
}
extern
"C"
int
PySequence_SetItem
(
PyObject
*
o
,
Py_ssize_t
i
,
PyObject
*
v
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PySequence_DelItem
(
PyObject
*
o
,
Py_ssize_t
i
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PySequence_SetSlice
(
PyObject
*
o
,
Py_ssize_t
i1
,
Py_ssize_t
i2
,
PyObject
*
v
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PySequence_DelSlice
(
PyObject
*
o
,
Py_ssize_t
i1
,
Py_ssize_t
i2
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
Py_ssize_t
PySequence_Count
(
PyObject
*
o
,
PyObject
*
value
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PySequence_Contains
(
PyObject
*
o
,
PyObject
*
value
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
Py_ssize_t
PySequence_Index
(
PyObject
*
o
,
PyObject
*
value
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PySequence_List
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PySequence_Tuple
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PySequence_Fast
(
PyObject
*
o
,
const
char
*
m
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyIter_Next
(
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
...
...
@@ -453,7 +582,15 @@ extern "C" void PyMem_Free(void* ptr) {
gc_compat_free
(
ptr
);
}
extern
"C"
PyObject
*
PyNumber_Divide
(
PyObject
*
,
PyObject
*
)
{
extern
"C"
int
PyNumber_Check
(
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Add
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Subtract
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
...
...
@@ -461,6 +598,150 @@ extern "C" PyObject* PyNumber_Multiply(PyObject*, PyObject*) {
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Divide
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_FloorDivide
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_TrueDivide
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Remainder
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Divmod
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Power
(
PyObject
*
,
PyObject
*
,
PyObject
*
o3
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Negative
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Positive
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Absolute
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Invert
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Lshift
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Rshift
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_And
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Xor
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Or
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceAdd
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceSubtract
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceMultiply
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceDivide
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceFloorDivide
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceTrueDivide
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceRemainder
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlacePower
(
PyObject
*
,
PyObject
*
,
PyObject
*
o3
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceLshift
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceRshift
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceAnd
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceXor
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_InPlaceOr
(
PyObject
*
,
PyObject
*
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyNumber_Coerce
(
PyObject
**
,
PyObject
**
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyNumber_CoerceEx
(
PyObject
**
,
PyObject
**
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Int
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Long
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Float
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_Index
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyNumber_ToBase
(
PyObject
*
n
,
int
base
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
Py_ssize_t
PyNumber_AsSsize_t
(
PyObject
*
o
,
PyObject
*
exc
)
{
Py_FatalError
(
"unimplemented"
);
}
BoxedModule
*
importTestExtension
()
{
const
char
*
pathname
=
"../test/test_extension/test.so"
;
void
*
handle
=
dlopen
(
pathname
,
RTLD_NOW
);
...
...
src/runtime/dict.cpp
View file @
00f9ab2d
...
...
@@ -256,6 +256,30 @@ extern "C" Box* dictInit(BoxedDict* self, BoxedTuple* args, BoxedDict* kwargs) {
return
None
;
}
extern
"C"
int
PyMapping_Check
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
Py_ssize_t
PyMapping_Size
(
PyObject
*
o
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyMapping_HasKeyString
(
PyObject
*
o
,
char
*
key
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyMapping_HasKey
(
PyObject
*
o
,
PyObject
*
key
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
PyObject
*
PyMapping_GetItemString
(
PyObject
*
o
,
char
*
key
)
{
Py_FatalError
(
"unimplemented"
);
}
extern
"C"
int
PyMapping_SetItemString
(
PyObject
*
o
,
char
*
key
,
PyObject
*
v
)
{
Py_FatalError
(
"unimplemented"
);
}
BoxedClass
*
dict_iterator_cls
=
NULL
;
extern
"C"
void
dictIteratorGCHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGCHandler
(
v
,
b
);
...
...
src/runtime/tuple.cpp
View file @
00f9ab2d
...
...
@@ -100,6 +100,10 @@ Box* tupleGetitemSlice(BoxedTuple* self, BoxedSlice* slice) {
return
_tupleSlice
(
self
,
start
,
stop
,
step
);
}
extern
"C"
PyObject
*
PyTuple_GetSlice
(
PyObject
*
p
,
Py_ssize_t
low
,
Py_ssize_t
high
)
{
Py_FatalError
(
"unimplemented"
);
}
Box
*
tupleGetitem
(
BoxedTuple
*
self
,
Box
*
slice
)
{
assert
(
self
->
cls
==
tuple_cls
);
...
...
src/runtime/types.cpp
View file @
00f9ab2d
...
...
@@ -41,6 +41,7 @@ extern "C" void init_sha512();
extern
"C"
void
init_md5
();
extern
"C"
void
init_sre
();
extern
"C"
void
initmath
();
extern
"C"
void
initoperator
();
namespace
pyston
{
...
...
@@ -290,7 +291,7 @@ extern "C" void closureGCHandler(GCVisitor* v, Box* b) {
extern
"C"
{
BoxedClass
*
object_cls
,
*
type_cls
,
*
none_cls
,
*
bool_cls
,
*
int_cls
,
*
float_cls
,
*
str_cls
,
*
function_cls
,
*
instancemethod_cls
,
*
list_cls
,
*
slice_cls
,
*
module_cls
,
*
dict_cls
,
*
tuple_cls
,
*
file_cls
,
*
member_cls
,
*
closure_cls
,
*
generator_cls
,
*
complex_cls
,
*
basestring_cls
;
*
closure_cls
,
*
generator_cls
,
*
complex_cls
,
*
basestring_cls
,
*
unicode_cls
;
BoxedTuple
*
EmptyTuple
;
...
...
@@ -662,6 +663,7 @@ void setupRuntime() {
// TODO we leak all the string data!
str_cls
=
new
BoxedClass
(
type_cls
,
basestring_cls
,
NULL
,
0
,
sizeof
(
BoxedString
),
false
);
unicode_cls
=
new
BoxedClass
(
type_cls
,
basestring_cls
,
NULL
,
0
,
sizeof
(
BoxedUnicode
),
false
);
// It wasn't safe to add __base__ attributes until object+type+str are set up, so do that now:
type_cls
->
giveAttr
(
"__base__"
,
object_cls
);
...
...
@@ -821,6 +823,8 @@ void setupRuntime() {
init_md5
();
init_sre
();
initmath
();
// TODO enable this
// initoperator();
setupSysEnd
();
...
...
src/runtime/types.h
View file @
00f9ab2d
...
...
@@ -77,7 +77,7 @@ Box* getSysStdout();
extern
"C"
{
extern
BoxedClass
*
object_cls
,
*
type_cls
,
*
bool_cls
,
*
int_cls
,
*
long_cls
,
*
float_cls
,
*
str_cls
,
*
function_cls
,
*
none_cls
,
*
instancemethod_cls
,
*
list_cls
,
*
slice_cls
,
*
module_cls
,
*
dict_cls
,
*
tuple_cls
,
*
file_cls
,
*
xrange_cls
,
*
member_cls
,
*
method_cls
,
*
closure_cls
,
*
generator_cls
,
*
complex_cls
,
*
basestring_cls
;
*
member_cls
,
*
method_cls
,
*
closure_cls
,
*
generator_cls
,
*
complex_cls
,
*
basestring_cls
,
*
unicode_cls
;
}
extern
"C"
{
extern
Box
*
None
,
*
NotImplemented
,
*
True
,
*
False
;
}
extern
"C"
{
...
...
@@ -232,6 +232,10 @@ public:
BoxedString
(
const
std
::
string
&
s
)
__attribute__
((
visibility
(
"default"
)))
:
Box
(
str_cls
),
s
(
s
)
{}
};
class
BoxedUnicode
:
public
Box
{
// TODO implementation
};
class
BoxedInstanceMethod
:
public
Box
{
public:
// obj is NULL for unbound instancemethod
...
...
src/runtime/unicode.cpp
0 → 100644
View file @
00f9ab2d
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment