[pypy-svn] r15739 - in pypy/dist/pypy/rpython/memory: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Sat Aug 6 17:42:33 CEST 2005
Author: cfbolz
Date: Sat Aug 6 17:42:31 2005
New Revision: 15739
Modified:
pypy/dist/pypy/rpython/memory/lltypesimulation.py
pypy/dist/pypy/rpython/memory/test/test_lltypesimulation.py
Log:
added bools.
Modified: pypy/dist/pypy/rpython/memory/lltypesimulation.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/lltypesimulation.py (original)
+++ pypy/dist/pypy/rpython/memory/lltypesimulation.py Sat Aug 6 17:42:31 2005
@@ -10,6 +10,7 @@
primitive_to_fmt = {lltype.Signed: "i",
lltype.Unsigned: "I",
lltype.Char: "c",
+ lltype.Bool: "B",
}
#returns some sort of layout information that is useful for the simulatorptr
@@ -32,6 +33,8 @@
return "i"
elif isinstance(TYPE, lltype.FuncType):
return "i"
+ elif isinstance(TYPE, lltype.PyObjectType):
+ return "i"
else:
assert 0, "type %s not yet implemented" % (TYPE, )
@@ -48,6 +51,8 @@
return get_fixed_size(lltype.Unsigned)
elif isinstance(TYPE, lltype.FuncType):
return get_fixed_size(lltype.Unsigned)
+ elif isinstance(TYPE, lltype.PyObjectType):
+ return get_fixed_size(lltype.Unsigned)
assert 0, "not yet implemented"
def get_variable_size(TYPE):
@@ -64,6 +69,8 @@
return 0
elif isinstance(TYPE, lltype.FuncType):
return 0
+ elif isinstance(TYPE, lltype.PyObjectType):
+ return 0
else:
assert 0, "not yet implemented"
Modified: pypy/dist/pypy/rpython/memory/test/test_lltypesimulation.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_lltypesimulation.py (original)
+++ pypy/dist/pypy/rpython/memory/test/test_lltypesimulation.py Sat Aug 6 17:42:31 2005
@@ -4,17 +4,21 @@
def test_struct():
S0 = lltype.GcStruct("s0", ('a', lltype.Signed),
- ('b', lltype.Signed), ('c', lltype.Char))
+ ('b', lltype.Signed), ('c', lltype.Char),
+ ('d', lltype.Bool))
s0 = malloc(S0)
assert s0.a == 0
assert s0.b == 0
assert s0.c == '\x00'
+ assert s0.b == 0
s0.a = 42
s0.b = 43
s0.c = 'x'
+ s0.d = True
assert s0.a == 42
assert s0.b == 43
assert s0.c == 'x'
+ assert s0.d == 1
s0.a = 1
s0.b = s0.a
assert s0.a == 1
@@ -34,7 +38,6 @@
assert [x[z].v for z in range(3)] == [1, 2, 3]
-
def define_list(T):
List_typ = lltype.GcStruct(
"list", ("items", lltype.Ptr(lltype.GcArray(('item',T)))))
More information about the Pypy-commit
mailing list