[Pyrex] Once more, what's wrong here

Robin Becker robin at reportlab.com
Wed Jan 14 23:06:07 CET 2004


I asked before, but didn't get any reply.

Can anyone say what's wrong here? I get the following when trying to
compile the c output

C:\code\reportlab\tex_wrap-1.00>xsetup.py build
running build
running build_ext
building '_tex_wrap' extension
C:\Program Files\Microsoft Visual Studio\VC98\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GX /DNDEBUG -IC:\Python\include -IC:\Py
thon\PC /Tc_tex_wrap.c /Fobuild\temp.win32-2.3\Release\_tex_wrap.obj
_tex_wrap.c
_tex_wrap.c(62) : error C2079: '__pyx_base' uses undefined struct 'None'
_tex_wrap.c(690) : error C2065: 'None' : undeclared identifier
_tex_wrap.c(690) : error C2100: illegal indirection
error: command '"C:\Program Files\Microsoft Visual
Studio\VC98\BIN\cl.exe"' failed with exit status 2


############################################
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.
    """
    def __init__(self, width, 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.
    """
    def __init__(self, width, stretch, 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):
        """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