Guido van Rossum guido at cwi.nl
Wed Feb 20 04:35:26 AEST 1991
Previous message (by thread): unbatcher out of sync?
Next message (by thread): Python 0.9.1 part 03/21
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
: This is a shell archive.
: Extract with 'sh this_file'.
: Extract this part first since it makes all directories
echo 'Start of pack.out, part 01 out of 21:'
echo -n 'Making directories ... '
err="no"
test -d 'demo' || mkdir 'demo' || err="yes"
test -d 'demo/scripts' || mkdir 'demo/scripts' || err="yes"
test -d 'demo/sgi' || mkdir 'demo/sgi' || err="yes"
test -d 'demo/sgi/audio' || mkdir 'demo/sgi/audio' || err="yes"
test -d 'demo/sgi/audio_stdwin' || mkdir 'demo/sgi/audio_stdwin' || err="yes"
test -d 'demo/sgi/gl' || mkdir 'demo/sgi/gl' || err="yes"
test -d 'demo/sgi/gl_panel' || mkdir 'demo/sgi/gl_panel' || err="yes"
test -d 'demo/sgi/gl_panel/apanel' || mkdir 'demo/sgi/gl_panel/apanel' || err="yes"
test -d 'demo/sgi/gl_panel/flying' || mkdir 'demo/sgi/gl_panel/flying' || err="yes"
test -d 'demo/sgi/gl_panel/nurbs' || mkdir 'demo/sgi/gl_panel/nurbs' || err="yes"
test -d 'demo/sgi/gl_panel/twoview' || mkdir 'demo/sgi/gl_panel/twoview' || err="yes"
test -d 'demo/stdwin' || mkdir 'demo/stdwin' || err="yes"
test -d 'doc' || mkdir 'doc' || err="yes"
test -d 'lib' || mkdir 'lib' || err="yes"
test -d 'src' || mkdir 'src' || err="yes"
echo 'done'
if test "$err" = "yes"
then echo "didn't make it."
fi
if test -s 'README'
then echo '*** I will not over-write existing file README'
else
echo 'x - README'
sed 's/^X//' > 'README' << 'EOF'
This is Python, an extensible interpreted programming language that
combines remarkable power with very clear syntax.
This is version 0.9 (the first beta release), patchlevel 1.
Python can be used instead of shell, Awk or Perl scripts, to write
prototypes of real applications, or as an extension language of large
systems, you name it. There are built-in modules that interface to
the operating system and to various window systems: X11, the Mac
window system (you need STDWIN for these two), and Silicon Graphics'
GL library. It runs on most modern versions of UNIX, on the Mac, and
I wouldn't be surprised if it ran on MS-DOS unchanged. I developed it
mostly on an SGI IRIS workstation (using IRIX 3.1 and 3.2) and on the
Mac, but have tested it also on SunOS (4.1) and BSD 4.3 (tahoe).
Building and installing Python is easy (but do read the Makefile).
A UNIX style manual page and extensive documentation (in LaTeX format)
are provided. (In the beta release, the documentation is still under
development.)
Please try it out and send me your comments (on anything -- the
language design, implementation, portability, installation,
documentation) and the modules you wrote for it, to make the first
real release better. If you needed to hack the source to get it to
compile and run on a particular machine, send me the fixes -- I'll try
to incorporate them into the next patch. If you can't get it to work
at all, send me a *detailed* description of the problem and I may look
into it.
If you want to profit of the X11 or Mac window interface, you'll need
STDWIN. This is a portable window system interface by the same
author. The versions of STDWIN floating around on some archives are
not sufficiently up-to-date for use with Python. I will distribute
the latest and greatest STDWIN version at about the same time as Python.
I am the author of Python:
Guido van Rossum
CWI, dept. CST
Kruislaan 413
1098 SJ Amsterdam
The Netherlands
E-mail: guido at cwi.nl
The Python source is copyrighted, but you can freely use and copy it
as long as you don't change or remove the copyright:
/***********************************************************
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
Netherlands.
# Fancy NURBS demo. Require Z buffer and Panel Library.
from gl import *
from GL import *
from DEVICE import *
from nurbsdata import *
import panel
#
# flags = trim_f, invis_f, cpvis_f, tpvis_f, axvis_f, freeze_f
#
TRIM = 0
VIS = 1
CPVIS = 2
TPVIS = 3
AXVIS = 4
FREEZE = 5
flags = [0, 1, 0, 0, 0, 0]
def draw_axis () :
cpack (0x0)
zero = (0.0, 0.0, 0.0)
#
one = (1.0, 0.0, 0.0)
smallline (zero, one)
cmov (1.0, 0.0, 0.0)
charstr ('x')
#
one = (0.0, 1.0, 0.0)
smallline (zero, one)
cmov (0.0, 1.0, 0.0)
charstr ('y')
#
one = (0.0, 0.0, 1.0)
smallline (zero, one)
cmov (0.0, 0.0, 1.0)
charstr ('z')
DELTA = 0.1
def cross (p) :
p0 = [p[0], p[1], p[2]]
p1 = [p[0], p[1], p[2]]
for i in range (0, 3) :
p0[i] = p0[i] + DELTA
p1[i] = p1[i] - DELTA
smallline (p0, p1)
p0[i] = p0[i] - DELTA
p1[i] = p1[i] + DELTA
def smallline (p0, p1) :
bgnline ()
v3f (p0)
v3f (p1)
endline ()
def draw_pts (pnts, color) :
linewidth (2)
cpack (color)
for i in pnts :
cross (i)
def init_windows():
foreground()
wid = winopen('nurbs')
wintitle('NURBS Surface')
doublebuffer()
RGBmode()
gconfig()
lsetdepth(0x000, 0x7fffff)
zbuffer( TRUE )
def init_view():
mmode(MPROJECTION)
ortho( -5., 5., -5., 5., -5., 5. )
#
mmode(MVIEWING)
loadmatrix(idmat)
#
lmbind(MATERIAL, 1)
def set_scene(flags):
#
lmbind(MATERIAL, 0)
RGBcolor(150,150,150)
lmbind(MATERIAL, 1)
clear()
zclear()
#
if not flags[FREEZE] :
rotate( 100, 'y' )
rotate( 100, 'z' )
def draw_trim_surface(flags):
pnts = ctlpoints
if flags[VIS] :
bgnsurface()
nurbssurface(surfknots,surfknots,pnts,ORDER,ORDER,N_XYZ)
if flags[TRIM]:
bgntrim()
nurbscurve(trimknots,trimpoints,ORDER-1,N_STW)
endtrim()
endsurface()
#
if flags[CPVIS] :
for i in pnts :
draw_pts (i, RED)
#
if flags[TPVIS] :
tpts = trimpoints
draw_pts (tpts, YELLOW)
#
if flags[AXVIS] :
draw_axis ()
#
swapbuffers()
def make_lights():
lmdef(DEFLMODEL,1,[])
lmdef(DEFLIGHT,1,[])
#
# define material #1
#
a = []
a = a + [EMISSION, 0.0, 0.0, 0.0]
a = a + [AMBIENT, 0.1, 0.1, 0.1]
a = a + [DIFFUSE, 0.6, 0.3, 0.3]
a = a + [SPECULAR, 0.0, 0.6, 0.0]
a = a + [SHININESS, 2.0]
a = a + [LMNULL]
lmdef(DEFMATERIAL, 1, a)
#
# turn on lighting
#
lmbind(LIGHT0, 1)
lmbind(LMODEL, 1)
def main():
init_windows()
make_lights()
init_view()
#
panel.needredraw()
panels = panel.defpanellist('nurbs.s')
p = panels[0]
#
def cbtrim (a) :
flags[TRIM:TRIM+1] = [int (a.val)]
p.trim.upfunc = cbtrim
#
def cbquit (a) :
import sys
sys.exit (1)
p.quit.upfunc = cbquit
#
def cbmotion (a) :
flags[FREEZE:FREEZE+1] = [int (a.val)]
p.motion.upfunc = cbmotion
#
def cbxyzaxis (a) :
flags[AXVIS:AXVIS+1] = [int (a.val)]
p.xyzaxis.upfunc = cbxyzaxis
#
def cbtrimpnts (a) :
flags[TPVIS:TPVIS+1] = [int (a.val)]
p.trimpnts.upfunc = cbtrimpnts
#
def cbcntlpnts (a) :
flags[CPVIS:CPVIS+1] = [int (a.val)]
p.cntlpnts.upfunc = cbcntlpnts
#
def cbnurb (a) :
flags[VIS:VIS+1] = [int (a.val)]
p.nurb.upfunc = cbnurb
#
set_scene(flags)
setnurbsproperty( N_ERRORCHECKING, 1.0 )
setnurbsproperty( N_PIXEL_TOLERANCE, 50.0 )
draw_trim_surface(flags)
#
while 1:
act = panel.dopanel()
#
wid = panel.userredraw ()
if wid :
winset (wid)
reshapeviewport()
set_scene(flags)
draw_trim_surface(flags)
#
set_scene(flags)
draw_trim_surface(flags)
main()