[Pyrex] Newbie shreeks for help?
Robin Becker
robin at reportlab.com
Sat Dec 20 11:48:30 CET 2003
I'm a newbie with pyrex, but I can't see what I'm doing wrong in the
code below, I get errors
_tex_wrap.c(640) : error C2065: 'None' : undeclared identifier
_tex_wrap.c(640) : error C2100: illegal indirection
_tex_wrap.c(648) : error C2100: illegal indirection
error: command '"C:\Program Files\Microsoft Visual
Studio\VC98\BIN\cl.exe"' failed with exit status 2
But I'm not using None anywhere.
I think the error comes from inheriting from class _Box. At the
indicated lines I see stuff like
__pyx_vtable_9_tex_wrap_Box.__pyx_base = *None;
but I don't see a definition of None in the c code.
################################################
cdef class _Box:
cdef readonly int penalty, flagged, is_glue, is_penalty, is_box
cdef char* character
cdef double width, stretch, shrink
cdef class Box(_Box):
"""Class representing a glyph or character. Boxes have a fixed
width that doesn't change.
"""
cdef __init__(self, double width, char* character):
self.character = character
self.width = width
self.stretch = self.shrink = self.penalty = self.flagged =
self.is_glue = self.is_penalty = 0
self.is_box = 1
cdef class Glue(_Box):
"""Class representing a bit of glue. Glue has a preferred width,
but it can stretch up to an additional distance, and can shrink
by a certain amount. Line breaks can be placed at any point where
glue immediately follows a box.
"""
cdef __init__(self, double width, double stretch, double shrink):
self.width = width
self.stretch = stretch
self.shrink = shrink
self.is_glue = 1
self.is_box = self.is_penalty = 0
cdef compute_width(self, double r):
"""Return how long this glue should be, for the given adjustment
ratio r."""
if r < 0: return self.width + r*self.shrink
else: return self.width + r*self.stretch
--
Robin Becker
More information about the Pyrex
mailing list