solaris build error and speedometer widget

Sorry for the long post, 2 things..

The first is that I am getting a compiler error on Solaris. This is
installing v0.80, I was wondering if anyone had seen this...

/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:324:

error: `wmemcmp' undeclared (first use this function)
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:324:

error: (Each undeclared identifier is reported only once for each
function it
appears in.)
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:

In static member function `static const wchar_t*
std::char_traits<wchar_t>::find(const wchar_t*, size_t, const
wchar_t&)':
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:332:

error: invalid conversion from `const wchar_t*' to `wchar_t*'
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:332:

error: initializing argument 1 of `wchar_t* std::wmemchr(wchar_t*,
wchar_t,
size_t)'
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:

In static member function `static wchar_t*
std::char_traits<wchar_t>::move(wchar_t*, const wchar_t*, size_t)':
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:336:

error: `wmemmove' undeclared (first use this function)
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:

In static member function `static wchar_t*
std::char_traits<wchar_t>::copy(wchar_t*, const wchar_t*, size_t)':
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:340:

error: `wmemcpy' undeclared (first use this function)
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:

In static member function `static wchar_t*
std::char_traits<wchar_t>::assign(wchar_t*, size_t, wchar_t)':
/work/net-local-b/sparc-sun-solaris2.8/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/bits/char_traits.h:344:

error: `wmemset' undeclared (first use this function)
./CXX/Extensions.hxx: In constructor
`Py::PythonExtension<T>::PythonExtension()
[with T = Py::ExtensionModuleBasePtr]':
CXX/cxx_extensions.cxx:92: instantiated from here
./CXX/Extensions.hxx:472: warning: right-hand operand of comma has no
effect
error: command 'gcc' failed with exit status 1

The second thing is that I wrote a speedometer widget. It is basically
a half pie chart with 3 color coded wedges, tick marks on the dial and
a needle that positions between 1 and 100 ( the value passed ). It's a
quick job ( esp. the mangled borrow from the arrow drawing code :slight_smile:
designed to make small dial graphics for 'dashboard' type UIs. But
turns out I will not need it or work on it, so I'm sending it out there
for the community.

S

here is the dial.py listing..

#!/usr/bin/env python
"""
Make a dial
"""

from pylab import *
from matplotlib.patches import Patch, Rectangle, Circle, Polygon,
Wedge,
Shadow, bbox_artist
from math import *

import os
# map to radian
degree_map = {}
degrees = range( 270, 360 ) + range( 0, 91 )
i = 0
for degree in degrees:
    degree_map[i] = degree
    i += 1
image_counter = 0

def make_dial( outdir, value ):
    global image_counter
    filename = 'dial_%s' % image_counter
    image_counter += 1
    
    # scale to 180 and map to radians
    value = value * 1.8
    degree = degree_map[int(value)]

    # make a square figure and axes
    fig = figure(figsize=(1,.5), edgecolor='white')
    ax = axes( [0, 0, 1, 2])
    ax.set_frame_on( False )
    ax.xaxis._visible = False
    ax.yaxis._visible = False

    s = Circle( (.5, 0), .5, facecolor='black' )
    ax.add_patch( s )

    if value <= 180 and value >= 130 :
        color = 'green'
    else:
        color = 'gray'
    w = Wedge((.5,0), .47, 0, 50, facecolor=color, edgecolor=color)
    ax.add_patch( w )

    if value < 130 and value >= 50:
        color = 'yellow'
    else:
        color = 'gray'
    w = Wedge((.5,0), .47, 50, 130, facecolor=color, edgecolor=color)
    ax.add_patch( w )

    if value < 50:
        color = 'red'
    else:
        color = 'gray'
    w = Wedge((.5,0), .47, 130, 180, facecolor=color, edgecolor=color)
    ax.add_patch( w )

    def _mark( degree, r1=.35, r2=.4, width=.01, color='white' ):
        
        x1 = sin( (degree*(pi/180))) * r1
        y1 = cos( (degree*(pi/180))) * r1
        x2 = sin( (degree*(pi/180))) * r2
        y2 = cos( (degree*(pi/180))) *r2
        x1 += .009
        x2 += .009
        dx = x2-x1
        dy = y2-y1
        width = width
        arrow = array( [
            [ 0.0, 0.2 ],
            [ 0.0, -0.2],
            [ 0.8, -0.2 ],
            [ 0.8, 0.2 ] ] )
        L = sqrt(dx**2+dy**2)
        arrow[:,0] *= L
        arrow[:,1] *= width
        cx = float(dx)/L
        sx = float(dy)/L
        M = array( [ [ cx, sx],[ -sx, cx ] ] )
        verts = matrixmultiply( arrow, M ) + [x1+.5,y1]
        s = Polygon( [ tuple(t) for t in verts ], facecolor=color,
edgecolor=color )
        ax.add_patch( s )

    _mark( 0 ) #not sure why, but it likes the extra mark call
    _mark( 0 )
    _mark( 20 )
    _mark( 40 )
    _mark( 60 )
    _mark( 80 )
    _mark( 340 )
    _mark( 320 )
    _mark( 300 )
    _mark( 280 )

    if value < 50:
        color = 'white'
    else:
        color = 'black'
    _mark( degree, 0, .48, .1, color )

    fullpath = outdir + os.sep + filename
    savefig( fullpath, dpi=30)
    return filename

if __name__ == '__main__':
    make_dial( '.', 100 )

···

____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com