From 0368b726a1859e3c063df5a93f19ccb4254be22a Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 11 May 2007 16:50:42 +0000 Subject: Merged revisions 55225-55227,55229-55269 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/p3yk ................ r55238 | guido.van.rossum | 2007-05-10 16:46:05 -0700 (Thu, 10 May 2007) | 9 lines Merged revisions 55227 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r55227 | guido.van.rossum | 2007-05-10 10:20:15 -0700 (Thu, 10 May 2007) | 2 lines Fix a bug in test_c_api() that caused a negative refcount. ........ ................ r55246 | neal.norwitz | 2007-05-11 00:01:52 -0700 (Fri, 11 May 2007) | 1 line Remove commands.getstatus() it is obsolete. ................ r55248 | neal.norwitz | 2007-05-11 00:29:05 -0700 (Fri, 11 May 2007) | 2 lines Remove bsddb185 support. ................ r55249 | neal.norwitz | 2007-05-11 00:29:50 -0700 (Fri, 11 May 2007) | 1 line Remove bsddb185 module too ................ r55250 | neal.norwitz | 2007-05-11 00:32:13 -0700 (Fri, 11 May 2007) | 1 line bsddb185: Gotta remove from the file checked in, not Setup ................ r55251 | neal.norwitz | 2007-05-11 00:53:26 -0700 (Fri, 11 May 2007) | 1 line Remove obsolete IRIX modules (as much as I could find, there is probably more) ................ r55252 | neal.norwitz | 2007-05-11 00:55:35 -0700 (Fri, 11 May 2007) | 1 line Remove SGI turd. ................ r55254 | georg.brandl | 2007-05-11 03:11:01 -0700 (Fri, 11 May 2007) | 2 lines Add a case for set comprehensions to the "cannot assign to" switch. ................ r55255 | georg.brandl | 2007-05-11 03:11:25 -0700 (Fri, 11 May 2007) | 2 lines Fix wrong imports. ................ r55261 | georg.brandl | 2007-05-11 07:37:48 -0700 (Fri, 11 May 2007) | 2 lines Remove removed tex files. ................ r55262 | georg.brandl | 2007-05-11 08:28:41 -0700 (Fri, 11 May 2007) | 2 lines Commit PEP 3132 implementation. ................ r55264 | georg.brandl | 2007-05-11 08:50:19 -0700 (Fri, 11 May 2007) | 2 lines Check in the inevitable AST version number and format Py_ssize_t with %zd. ................ r55265 | neal.norwitz | 2007-05-11 09:12:22 -0700 (Fri, 11 May 2007) | 1 line Remove mention of os.popen* and popen2.* since these will be removed. ................ r55266 | neal.norwitz | 2007-05-11 09:19:57 -0700 (Fri, 11 May 2007) | 1 line Get doc to build again (almost, the doc is fine) ................ r55267 | neal.norwitz | 2007-05-11 09:21:02 -0700 (Fri, 11 May 2007) | 1 line Really get doc to build (remove use of string module) ................ r55269 | neal.norwitz | 2007-05-11 09:29:43 -0700 (Fri, 11 May 2007) | 1 line Add some notes to cleanup later ................ --- Doc/Makefile.deps | 7 - Doc/lib/lib.tex | 9 +- Doc/lib/libal.tex | 181 -- Doc/lib/libbsddb.tex | 8 - Doc/lib/libcd.tex | 304 -- Doc/lib/libcommands.tex | 12 - Doc/lib/libfl.tex | 507 --- Doc/lib/libfm.tex | 93 - Doc/lib/libgl.tex | 224 -- Doc/lib/libimgfile.tex | 66 - Doc/lib/libsgi.tex | 7 - Doc/lib/libundoc.tex | 19 - Doc/tools/mkackshtml | 7 +- Grammar/Grammar | 5 +- Include/Python-ast.h | 11 +- Include/graminit.h | 53 +- Include/opcode.h | 2 + Lib/commands.py | 11 +- Lib/subprocess.py | 69 - Lib/test/regrtest.py | 99 - Lib/test/test_al.py | 23 - Lib/test/test_bsddb185.py | 43 - Lib/test/test_cd.py | 26 - Lib/test/test_cl.py | 78 - Lib/test/test_commands.py | 22 - Lib/test/test_gl.py | 150 - Lib/test/test_imgfile.py | 116 - Lib/test/test_listcomps.py | 2 +- Lib/test/test_setcomps.py | 6 +- Lib/test/test_unpack_ex.py | 157 + Misc/NEWS | 9 + Modules/Setup.dist | 52 - Modules/almodule.c | 3226 ------------------- Modules/bsddbmodule.c | 858 ----- Modules/cdmodule.c | 796 ----- Modules/cgen.py | 520 --- Modules/cgensupport.c | 310 -- Modules/cgensupport.h | 64 - Modules/clmodule.c | 2559 --------------- Modules/flmodule.c | 2139 ------------- Modules/fmmodule.c | 264 -- Modules/glmodule.c | 7628 -------------------------------------------- Modules/imgfile.c | 504 --- Modules/parsermodule.c | 23 +- Modules/sgimodule.c | 55 - Modules/svmodule.c | 966 ------ PC/os2emx/Makefile | 8 - PC/os2emx/config.c | 2 - Parser/Python.asdl | 1 + Python/Python-ast.c | 49 + Python/ast.c | 28 + Python/ceval.c | 76 +- Python/compile.c | 46 +- Python/graminit.c | 744 ++--- Python/symtable.c | 3 + README | 14 +- setup.py | 26 - 57 files changed, 805 insertions(+), 22482 deletions(-) delete mode 100644 Doc/lib/libal.tex delete mode 100644 Doc/lib/libcd.tex delete mode 100644 Doc/lib/libfl.tex delete mode 100644 Doc/lib/libfm.tex delete mode 100644 Doc/lib/libgl.tex delete mode 100644 Doc/lib/libimgfile.tex delete mode 100644 Doc/lib/libsgi.tex delete mode 100755 Lib/test/test_al.py delete mode 100644 Lib/test/test_bsddb185.py delete mode 100755 Lib/test/test_cd.py delete mode 100755 Lib/test/test_cl.py delete mode 100755 Lib/test/test_gl.py delete mode 100755 Lib/test/test_imgfile.py create mode 100644 Lib/test/test_unpack_ex.py delete mode 100644 Modules/almodule.c delete mode 100644 Modules/bsddbmodule.c delete mode 100644 Modules/cdmodule.c delete mode 100644 Modules/cgen.py delete mode 100644 Modules/cgensupport.c delete mode 100644 Modules/cgensupport.h delete mode 100644 Modules/clmodule.c delete mode 100644 Modules/flmodule.c delete mode 100644 Modules/fmmodule.c delete mode 100644 Modules/glmodule.c delete mode 100644 Modules/imgfile.c delete mode 100644 Modules/sgimodule.c delete mode 100644 Modules/svmodule.c diff --git a/Doc/Makefile.deps b/Doc/Makefile.deps index 3371f61..426c7ea1 100644 --- a/Doc/Makefile.deps +++ b/Doc/Makefile.deps @@ -209,13 +209,6 @@ LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \ lib/libsha.tex \ lib/libhmac.tex \ lib/libstdwin.tex \ - lib/libsgi.tex \ - lib/libal.tex \ - lib/libcd.tex \ - lib/libfl.tex \ - lib/libfm.tex \ - lib/libgl.tex \ - lib/libimgfile.tex \ lib/libsun.tex \ lib/libxdrlib.tex \ lib/libimghdr.tex \ diff --git a/Doc/lib/lib.tex b/Doc/lib/lib.tex index b201039..aa4d3e8 100644 --- a/Doc/lib/lib.tex +++ b/Doc/lib/lib.tex @@ -429,22 +429,17 @@ and how to embed it in other applications. % OTHER PLATFORM-SPECIFIC STUFF % ============= +% XXX(nnorwitz): all these modules (down to next comment) need to be (re)moved. %\input{libamoeba} % AMOEBA ONLY %\input{libstdwin} % STDWIN ONLY -\input{libsgi} % SGI IRIX ONLY -\input{libal} -\input{libcd} -\input{libfl} -\input{libfm} -\input{libgl} -\input{libimgfile} \input{libjpeg} %\input{libpanel} \input{libsun} % SUNOS ONLY \input{libsunaudio} +% XXX(nnorwitz): the modules below this comment should be kept. \input{windows} % MS Windows ONLY \input{libmsilib} diff --git a/Doc/lib/libal.tex b/Doc/lib/libal.tex deleted file mode 100644 index e3fdc91..0000000 --- a/Doc/lib/libal.tex +++ /dev/null @@ -1,181 +0,0 @@ -\section{\module{al} --- - Audio functions on the SGI} - -\declaremodule{builtin}{al} - \platform{IRIX} -\modulesynopsis{Audio functions on the SGI.} - - -This module provides access to the audio facilities of the SGI Indy -and Indigo workstations. See section 3A of the IRIX man pages for -details. You'll need to read those man pages to understand what these -functions do! Some of the functions are not available in IRIX -releases before 4.0.5. Again, see the manual to check whether a -specific function is available on your platform. - -All functions and methods defined in this module are equivalent to -the C functions with \samp{AL} prefixed to their name. - -Symbolic constants from the C header file \code{} are -defined in the standard module -\refmodule[al-constants]{AL}\refstmodindex{AL}, see below. - -\warning{The current version of the audio library may dump core -when bad argument values are passed rather than returning an error -status. Unfortunately, since the precise circumstances under which -this may happen are undocumented and hard to check, the Python -interface can provide no protection against this kind of problems. -(One example is specifying an excessive queue size --- there is no -documented upper limit.)} - -The module defines the following functions: - - -\begin{funcdesc}{openport}{name, direction\optional{, config}} -The name and direction arguments are strings. The optional -\var{config} argument is a configuration object as returned by -\function{newconfig()}. The return value is an \dfn{audio port -object}; methods of audio port objects are described below. -\end{funcdesc} - -\begin{funcdesc}{newconfig}{} -The return value is a new \dfn{audio configuration object}; methods of -audio configuration objects are described below. -\end{funcdesc} - -\begin{funcdesc}{queryparams}{device} -The device argument is an integer. The return value is a list of -integers containing the data returned by \cfunction{ALqueryparams()}. -\end{funcdesc} - -\begin{funcdesc}{getparams}{device, list} -The \var{device} argument is an integer. The list argument is a list -such as returned by \function{queryparams()}; it is modified in place -(!). -\end{funcdesc} - -\begin{funcdesc}{setparams}{device, list} -The \var{device} argument is an integer. The \var{list} argument is a -list such as returned by \function{queryparams()}. -\end{funcdesc} - - -\subsection{Configuration Objects \label{al-config-objects}} - -Configuration objects returned by \function{newconfig()} have the -following methods: - -\begin{methoddesc}[audio configuration]{getqueuesize}{} -Return the queue size. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{setqueuesize}{size} -Set the queue size. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{getwidth}{} -Get the sample width. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{setwidth}{width} -Set the sample width. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{getchannels}{} -Get the channel count. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{setchannels}{nchannels} -Set the channel count. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{getsampfmt}{} -Get the sample format. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{setsampfmt}{sampfmt} -Set the sample format. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{getfloatmax}{} -Get the maximum value for floating sample formats. -\end{methoddesc} - -\begin{methoddesc}[audio configuration]{setfloatmax}{floatmax} -Set the maximum value for floating sample formats. -\end{methoddesc} - - -\subsection{Port Objects \label{al-port-objects}} - -Port objects, as returned by \function{openport()}, have the following -methods: - -\begin{methoddesc}[audio port]{closeport}{} -Close the port. -\end{methoddesc} - -\begin{methoddesc}[audio port]{getfd}{} -Return the file descriptor as an int. -\end{methoddesc} - -\begin{methoddesc}[audio port]{getfilled}{} -Return the number of filled samples. -\end{methoddesc} - -\begin{methoddesc}[audio port]{getfillable}{} -Return the number of fillable samples. -\end{methoddesc} - -\begin{methoddesc}[audio port]{readsamps}{nsamples} -Read a number of samples from the queue, blocking if necessary. -Return the data as a string containing the raw data, (e.g., 2 bytes per -sample in big-endian byte order (high byte, low byte) if you have set -the sample width to 2 bytes). -\end{methoddesc} - -\begin{methoddesc}[audio port]{writesamps}{samples} -Write samples into the queue, blocking if necessary. The samples are -encoded as described for the \method{readsamps()} return value. -\end{methoddesc} - -\begin{methoddesc}[audio port]{getfillpoint}{} -Return the `fill point'. -\end{methoddesc} - -\begin{methoddesc}[audio port]{setfillpoint}{fillpoint} -Set the `fill point'. -\end{methoddesc} - -\begin{methoddesc}[audio port]{getconfig}{} -Return a configuration object containing the current configuration of -the port. -\end{methoddesc} - -\begin{methoddesc}[audio port]{setconfig}{config} -Set the configuration from the argument, a configuration object. -\end{methoddesc} - -\begin{methoddesc}[audio port]{getstatus}{list} -Get status information on last error. -\end{methoddesc} - - -\section{\module{AL} --- - Constants used with the \module{al} module} - -\declaremodule[al-constants]{standard}{AL} - \platform{IRIX} -\modulesynopsis{Constants used with the \module{al} module.} - - -This module defines symbolic constants needed to use the built-in -module \refmodule{al} (see above); they are equivalent to those defined -in the C header file \code{} except that the name prefix -\samp{AL_} is omitted. Read the module source for a complete list of -the defined names. Suggested use: - -\begin{verbatim} -import al -from AL import * -\end{verbatim} diff --git a/Doc/lib/libbsddb.tex b/Doc/lib/libbsddb.tex index 6e86d24..793237b 100644 --- a/Doc/lib/libbsddb.tex +++ b/Doc/lib/libbsddb.tex @@ -94,14 +94,6 @@ interpretation. \end{funcdesc} -\begin{notice} -Beginning in 2.3 some \UNIX{} versions of Python may have a \module{bsddb185} -module. This is present \emph{only} to allow backwards compatibility with -systems which ship with the old Berkeley DB 1.85 database library. The -\module{bsddb185} module should never be used directly in new code. -\end{notice} - - \begin{seealso} \seemodule{dbhash}{DBM-style interface to the \module{bsddb}} \end{seealso} diff --git a/Doc/lib/libcd.tex b/Doc/lib/libcd.tex deleted file mode 100644 index 83bd2ba..0000000 --- a/Doc/lib/libcd.tex +++ /dev/null @@ -1,304 +0,0 @@ -\section{\module{cd} --- - CD-ROM access on SGI systems} - -\declaremodule{builtin}{cd} - \platform{IRIX} -\modulesynopsis{Interface to the CD-ROM on Silicon Graphics systems.} - - -This module provides an interface to the Silicon Graphics CD library. -It is available only on Silicon Graphics systems. - -The way the library works is as follows. A program opens the CD-ROM -device with \function{open()} and creates a parser to parse the data -from the CD with \function{createparser()}. The object returned by -\function{open()} can be used to read data from the CD, but also to get -status information for the CD-ROM device, and to get information about -the CD, such as the table of contents. Data from the CD is passed to -the parser, which parses the frames, and calls any callback -functions that have previously been added. - -An audio CD is divided into \dfn{tracks} or \dfn{programs} (the terms -are used interchangeably). Tracks can be subdivided into -\dfn{indices}. An audio CD contains a \dfn{table of contents} which -gives the starts of the tracks on the CD. Index 0 is usually the -pause before the start of a track. The start of the track as given by -the table of contents is normally the start of index 1. - -Positions on a CD can be represented in two ways. Either a frame -number or a tuple of three values, minutes, seconds and frames. Most -functions use the latter representation. Positions can be both -relative to the beginning of the CD, and to the beginning of the -track. - -Module \module{cd} defines the following functions and constants: - - -\begin{funcdesc}{createparser}{} -Create and return an opaque parser object. The methods of the parser -object are described below. -\end{funcdesc} - -\begin{funcdesc}{msftoframe}{minutes, seconds, frames} -Converts a \code{(\var{minutes}, \var{seconds}, \var{frames})} triple -representing time in absolute time code into the corresponding CD -frame number. -\end{funcdesc} - -\begin{funcdesc}{open}{\optional{device\optional{, mode}}} -Open the CD-ROM device. The return value is an opaque player object; -methods of the player object are described below. The device is the -name of the SCSI device file, e.g. \code{'/dev/scsi/sc0d4l0'}, or -\code{None}. If omitted or \code{None}, the hardware inventory is -consulted to locate a CD-ROM drive. The \var{mode}, if not omitted, -should be the string \code{'r'}. -\end{funcdesc} - -The module defines the following variables: - -\begin{excdesc}{error} -Exception raised on various errors. -\end{excdesc} - -\begin{datadesc}{DATASIZE} -The size of one frame's worth of audio data. This is the size of the -audio data as passed to the callback of type \code{audio}. -\end{datadesc} - -\begin{datadesc}{BLOCKSIZE} -The size of one uninterpreted frame of audio data. -\end{datadesc} - -The following variables are states as returned by -\function{getstatus()}: - -\begin{datadesc}{READY} -The drive is ready for operation loaded with an audio CD. -\end{datadesc} - -\begin{datadesc}{NODISC} -The drive does not have a CD loaded. -\end{datadesc} - -\begin{datadesc}{CDROM} -The drive is loaded with a CD-ROM. Subsequent play or read operations -will return I/O errors. -\end{datadesc} - -\begin{datadesc}{ERROR} -An error occurred while trying to read the disc or its table of -contents. -\end{datadesc} - -\begin{datadesc}{PLAYING} -The drive is in CD player mode playing an audio CD through its audio -jacks. -\end{datadesc} - -\begin{datadesc}{PAUSED} -The drive is in CD layer mode with play paused. -\end{datadesc} - -\begin{datadesc}{STILL} -The equivalent of \constant{PAUSED} on older (non 3301) model Toshiba -CD-ROM drives. Such drives have never been shipped by SGI. -\end{datadesc} - -\begin{datadesc}{audio} -\dataline{pnum} -\dataline{index} -\dataline{ptime} -\dataline{atime} -\dataline{catalog} -\dataline{ident} -\dataline{control} -Integer constants describing the various types of parser callbacks -that can be set by the \method{addcallback()} method of CD parser -objects (see below). -\end{datadesc} - - -\subsection{Player Objects} -\label{player-objects} - -Player objects (returned by \function{open()}) have the following -methods: - -\begin{methoddesc}[CD player]{allowremoval}{} -Unlocks the eject button on the CD-ROM drive permitting the user to -eject the caddy if desired. -\end{methoddesc} - -\begin{methoddesc}[CD player]{bestreadsize}{} -Returns the best value to use for the \var{num_frames} parameter of -the \method{readda()} method. Best is defined as the value that -permits a continuous flow of data from the CD-ROM drive. -\end{methoddesc} - -\begin{methoddesc}[CD player]{close}{} -Frees the resources associated with the player object. After calling -\method{close()}, the methods of the object should no longer be used. -\end{methoddesc} - -\begin{methoddesc}[CD player]{eject}{} -Ejects the caddy from the CD-ROM drive. -\end{methoddesc} - -\begin{methoddesc}[CD player]{getstatus}{} -Returns information pertaining to the current state of the CD-ROM -drive. The returned information is a tuple with the following values: -\var{state}, \var{track}, \var{rtime}, \var{atime}, \var{ttime}, -\var{first}, \var{last}, \var{scsi_audio}, \var{cur_block}. -\var{rtime} is the time relative to the start of the current track; -\var{atime} is the time relative to the beginning of the disc; -\var{ttime} is the total time on the disc. For more information on -the meaning of the values, see the man page \manpage{CDgetstatus}{3dm}. -The value of \var{state} is one of the following: \constant{ERROR}, -\constant{NODISC}, \constant{READY}, \constant{PLAYING}, -\constant{PAUSED}, \constant{STILL}, or \constant{CDROM}. -\end{methoddesc} - -\begin{methoddesc}[CD player]{gettrackinfo}{track} -Returns information about the specified track. The returned -information is a tuple consisting of two elements, the start time of -the track and the duration of the track. -\end{methoddesc} - -\begin{methoddesc}[CD player]{msftoblock}{min, sec, frame} -Converts a minutes, seconds, frames triple representing a time in -absolute time code into the corresponding logical block number for the -given CD-ROM drive. You should use \function{msftoframe()} rather than -\method{msftoblock()} for comparing times. The logical block number -differs from the frame number by an offset required by certain CD-ROM -drives. -\end{methoddesc} - -\begin{methoddesc}[CD player]{play}{start, play} -Starts playback of an audio CD in the CD-ROM drive at the specified -track. The audio output appears on the CD-ROM drive's headphone and -audio jacks (if fitted). Play stops at the end of the disc. -\var{start} is the number of the track at which to start playing the -CD; if \var{play} is 0, the CD will be set to an initial paused -state. The method \method{togglepause()} can then be used to commence -play. -\end{methoddesc} - -\begin{methoddesc}[CD player]{playabs}{minutes, seconds, frames, play} -Like \method{play()}, except that the start is given in minutes, -seconds, and frames instead of a track number. -\end{methoddesc} - -\begin{methoddesc}[CD player]{playtrack}{start, play} -Like \method{play()}, except that playing stops at the end of the -track. -\end{methoddesc} - -\begin{methoddesc}[CD player]{playtrackabs}{track, minutes, seconds, frames, play} -Like \method{play()}, except that playing begins at the specified -absolute time and ends at the end of the specified track. -\end{methoddesc} - -\begin{methoddesc}[CD player]{preventremoval}{} -Locks the eject button on the CD-ROM drive thus preventing the user -from arbitrarily ejecting the caddy. -\end{methoddesc} - -\begin{methoddesc}[CD player]{readda}{num_frames} -Reads the specified number of frames from an audio CD mounted in the -CD-ROM drive. The return value is a string representing the audio -frames. This string can be passed unaltered to the -\method{parseframe()} method of the parser object. -\end{methoddesc} - -\begin{methoddesc}[CD player]{seek}{minutes, seconds, frames} -Sets the pointer that indicates the starting point of the next read of -digital audio data from a CD-ROM. The pointer is set to an absolute -time code location specified in \var{minutes}, \var{seconds}, and -\var{frames}. The return value is the logical block number to which -the pointer has been set. -\end{methoddesc} - -\begin{methoddesc}[CD player]{seekblock}{block} -Sets the pointer that indicates the starting point of the next read of -digital audio data from a CD-ROM. The pointer is set to the specified -logical block number. The return value is the logical block number to -which the pointer has been set. -\end{methoddesc} - -\begin{methoddesc}[CD player]{seektrack}{track} -Sets the pointer that indicates the starting point of the next read of -digital audio data from a CD-ROM. The pointer is set to the specified -track. The return value is the logical block number to which the -pointer has been set. -\end{methoddesc} - -\begin{methoddesc}[CD player]{stop}{} -Stops the current playing operation. -\end{methoddesc} - -\begin{methoddesc}[CD player]{togglepause}{} -Pauses the CD if it is playing, and makes it play if it is paused. -\end{methoddesc} - - -\subsection{Parser Objects} -\label{cd-parser-objects} - -Parser objects (returned by \function{createparser()}) have the -following methods: - -\begin{methoddesc}[CD parser]{addcallback}{type, func, arg} -Adds a callback for the parser. The parser has callbacks for eight -different types of data in the digital audio data stream. Constants -for these types are defined at the \module{cd} module level (see above). -The callback is called as follows: \code{\var{func}(\var{arg}, type, -data)}, where \var{arg} is the user supplied argument, \var{type} is -the particular type of callback, and \var{data} is the data returned -for this \var{type} of callback. The type of the data depends on the -\var{type} of callback as follows: - -\begin{tableii}{l|p{4in}}{code}{Type}{Value} - \lineii{audio}{String which can be passed unmodified to -\function{al.writesamps()}.} - \lineii{pnum}{Integer giving the program (track) number.} - \lineii{index}{Integer giving the index number.} - \lineii{ptime}{Tuple consisting of the program time in minutes, -seconds, and frames.} - \lineii{atime}{Tuple consisting of the absolute time in minutes, -seconds, and frames.} - \lineii{catalog}{String of 13 characters, giving the catalog number -of the CD.} - \lineii{ident}{String of 12 characters, giving the ISRC -identification number of the recording. The string consists of two -characters country code, three characters owner code, two characters -giving the year, and five characters giving a serial number.} - \lineii{control}{Integer giving the control bits from the CD -subcode data} -\end{tableii} -\end{methoddesc} - -\begin{methoddesc}[CD parser]{deleteparser}{} -Deletes the parser and frees the memory it was using. The object -should not be used after this call. This call is done automatically -when the last reference to the object is removed. -\end{methoddesc} - -\begin{methoddesc}[CD parser]{parseframe}{frame} -Parses one or more frames of digital audio data from a CD such as -returned by \method{readda()}. It determines which subcodes are -present in the data. If these subcodes have changed since the last -frame, then \method{parseframe()} executes a callback of the -appropriate type passing to it the subcode data found in the frame. -Unlike the \C{} function, more than one frame of digital audio data -can be passed to this method. -\end{methoddesc} - -\begin{methoddesc}[CD parser]{removecallback}{type} -Removes the callback for the given \var{type}. -\end{methoddesc} - -\begin{methoddesc}[CD parser]{resetparser}{} -Resets the fields of the parser used for tracking subcodes to an -initial state. \method{resetparser()} should be called after the disc -has been changed. -\end{methoddesc} diff --git a/Doc/lib/libcommands.tex b/Doc/lib/libcommands.tex index fa9b464..4a5fa55 100644 --- a/Doc/lib/libcommands.tex +++ b/Doc/lib/libcommands.tex @@ -35,16 +35,6 @@ Like \function{getstatusoutput()}, except the exit status is ignored and the return value is a string containing the command's output. \end{funcdesc} -\begin{funcdesc}{getstatus}{file} -Return the output of \samp{ls -ld \var{file}} as a string. This -function uses the \function{getoutput()} function, and properly -escapes backslashes and dollar signs in the argument. - -\deprecated{2.6}{This function is nonobvious and useless, - also the name is misleading in the presence of - \function{getstatusoutput()}.} -\end{funcdesc} - Example: \begin{verbatim} @@ -57,8 +47,6 @@ Example: (256, 'sh: /bin/junk: not found') >>> commands.getoutput('ls /bin/ls') '/bin/ls' ->>> commands.getstatus('/bin/ls') -'-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls' \end{verbatim} \begin{seealso} diff --git a/Doc/lib/libfl.tex b/Doc/lib/libfl.tex deleted file mode 100644 index bafb8e4..0000000 --- a/Doc/lib/libfl.tex +++ /dev/null @@ -1,507 +0,0 @@ -\section{\module{fl} --- - FORMS library for graphical user interfaces} - -\declaremodule{builtin}{fl} - \platform{IRIX} -\modulesynopsis{FORMS library for applications with graphical user - interfaces.} - - -This module provides an interface to the FORMS Library\index{FORMS -Library} by Mark Overmars\index{Overmars, Mark}. The source for the -library can be retrieved by anonymous ftp from host -\samp{ftp.cs.ruu.nl}, directory \file{SGI/FORMS}. It was last tested -with version 2.0b. - -Most functions are literal translations of their C equivalents, -dropping the initial \samp{fl_} from their name. Constants used by -the library are defined in module \refmodule[fl-constants]{FL} -described below. - -The creation of objects is a little different in Python than in C: -instead of the `current form' maintained by the library to which new -FORMS objects are added, all functions that add a FORMS object to a -form are methods of the Python object representing the form. -Consequently, there are no Python equivalents for the C functions -\cfunction{fl_addto_form()} and \cfunction{fl_end_form()}, and the -equivalent of \cfunction{fl_bgn_form()} is called -\function{fl.make_form()}. - -Watch out for the somewhat confusing terminology: FORMS uses the word -\dfn{object} for the buttons, sliders etc. that you can place in a form. -In Python, `object' means any value. The Python interface to FORMS -introduces two new Python object types: form objects (representing an -entire form) and FORMS objects (representing one button, slider etc.). -Hopefully this isn't too confusing. - -There are no `free objects' in the Python interface to FORMS, nor is -there an easy way to add object classes written in Python. The FORMS -interface to GL event handling is available, though, so you can mix -FORMS with pure GL windows. - -\strong{Please note:} importing \module{fl} implies a call to the GL -function \cfunction{foreground()} and to the FORMS routine -\cfunction{fl_init()}. - -\subsection{Functions Defined in Module \module{fl}} -\nodename{FL Functions} - -Module \module{fl} defines the following functions. For more -information about what they do, see the description of the equivalent -C function in the FORMS documentation: - -\begin{funcdesc}{make_form}{type, width, height} -Create a form with given type, width and height. This returns a -\dfn{form} object, whose methods are described below. -\end{funcdesc} - -\begin{funcdesc}{do_forms}{} -The standard FORMS main loop. Returns a Python object representing -the FORMS object needing interaction, or the special value -\constant{FL.EVENT}. -\end{funcdesc} - -\begin{funcdesc}{check_forms}{} -Check for FORMS events. Returns what \function{do_forms()} above -returns, or \code{None} if there is no event that immediately needs -interaction. -\end{funcdesc} - -\begin{funcdesc}{set_event_call_back}{function} -Set the event callback function. -\end{funcdesc} - -\begin{funcdesc}{set_graphics_mode}{rgbmode, doublebuffering} -Set the graphics modes. -\end{funcdesc} - -\begin{funcdesc}{get_rgbmode}{} -Return the current rgb mode. This is the value of the C global -variable \cdata{fl_rgbmode}. -\end{funcdesc} - -\begin{funcdesc}{show_message}{str1, str2, str3} -Show a dialog box with a three-line message and an OK button. -\end{funcdesc} - -\begin{funcdesc}{show_question}{str1, str2, str3} -Show a dialog box with a three-line message and YES and NO buttons. -It returns \code{1} if the user pressed YES, \code{0} if NO. -\end{funcdesc} - -\begin{funcdesc}{show_choice}{str1, str2, str3, but1\optional{, - but2\optional{, but3}}} -Show a dialog box with a three-line message and up to three buttons. -It returns the number of the button clicked by the user -(\code{1}, \code{2} or \code{3}). -\end{funcdesc} - -\begin{funcdesc}{show_input}{prompt, default} -Show a dialog box with a one-line prompt message and text field in -which the user can enter a string. The second argument is the default -input string. It returns the string value as edited by the user. -\end{funcdesc} - -\begin{funcdesc}{show_file_selector}{message, directory, pattern, default} -Show a dialog box in which the user can select a file. It returns -the absolute filename selected by the user, or \code{None} if the user -presses Cancel. -\end{funcdesc} - -\begin{funcdesc}{get_directory}{} -\funcline{get_pattern}{} -\funcline{get_filename}{} -These functions return the directory, pattern and filename (the tail -part only) selected by the user in the last -\function{show_file_selector()} call. -\end{funcdesc} - -\begin{funcdesc}{qdevice}{dev} -\funcline{unqdevice}{dev} -\funcline{isqueued}{dev} -\funcline{qtest}{} -\funcline{qread}{} -%\funcline{blkqread}{?} -\funcline{qreset}{} -\funcline{qenter}{dev, val} -\funcline{get_mouse}{} -\funcline{tie}{button, valuator1, valuator2} -These functions are the FORMS interfaces to the corresponding GL -functions. Use these if you want to handle some GL events yourself -when using \function{fl.do_events()}. When a GL event is detected that -FORMS cannot handle, \function{fl.do_forms()} returns the special value -\constant{FL.EVENT} and you should call \function{fl.qread()} to read -the event from the queue. Don't use the equivalent GL functions! -\end{funcdesc} - -\begin{funcdesc}{color}{} -\funcline{mapcolor}{} -\funcline{getmcolor}{} -See the description in the FORMS documentation of -\cfunction{fl_color()}, \cfunction{fl_mapcolor()} and -\cfunction{fl_getmcolor()}. -\end{funcdesc} - -\subsection{Form Objects} -\label{form-objects} - -Form objects (returned by \function{make_form()} above) have the -following methods. Each method corresponds to a C function whose -name is prefixed with \samp{fl_}; and whose first argument is a form -pointer; please refer to the official FORMS documentation for -descriptions. - -All the \method{add_*()} methods return a Python object representing -the FORMS object. Methods of FORMS objects are described below. Most -kinds of FORMS object also have some methods specific to that kind; -these methods are listed here. - -\begin{flushleft} - -\begin{methoddesc}[form]{show_form}{placement, bordertype, name} - Show the form. -\end{methoddesc} - -\begin{methoddesc}[form]{hide_form}{} - Hide the form. -\end{methoddesc} - -\begin{methoddesc}[form]{redraw_form}{} - Redraw the form. -\end{methoddesc} - -\begin{methoddesc}[form]{set_form_position}{x, y} -Set the form's position. -\end{methoddesc} - -\begin{methoddesc}[form]{freeze_form}{} -Freeze the form. -\end{methoddesc} - -\begin{methoddesc}[form]{unfreeze_form}{} - Unfreeze the form. -\end{methoddesc} - -\begin{methoddesc}[form]{activate_form}{} - Activate the form. -\end{methoddesc} - -\begin{methoddesc}[form]{deactivate_form}{} - Deactivate the form. -\end{methoddesc} - -\begin{methoddesc}[form]{bgn_group}{} - Begin a new group of objects; return a group object. -\end{methoddesc} - -\begin{methoddesc}[form]{end_group}{} - End the current group of objects. -\end{methoddesc} - -\begin{methoddesc}[form]{find_first}{} - Find the first object in the form. -\end{methoddesc} - -\begin{methoddesc}[form]{find_last}{} - Find the last object in the form. -\end{methoddesc} - -%--- - -\begin{methoddesc}[form]{add_box}{type, x, y, w, h, name} -Add a box object to the form. -No extra methods. -\end{methoddesc} - -\begin{methoddesc}[form]{add_text}{type, x, y, w, h, name} -Add a text object to the form. -No extra methods. -\end{methoddesc} - -%\begin{methoddesc}[form]{add_bitmap}{type, x, y, w, h, name} -%Add a bitmap object to the form. -%\end{methoddesc} - -\begin{methoddesc}[form]{add_clock}{type, x, y, w, h, name} -Add a clock object to the form. \\ -Method: -\method{get_clock()}. -\end{methoddesc} - -%--- - -\begin{methoddesc}[form]{add_button}{type, x, y, w, h, name} -Add a button object to the form. \\ -Methods: -\method{get_button()}, -\method{set_button()}. -\end{methoddesc} - -\begin{methoddesc}[form]{add_lightbutton}{type, x, y, w, h, name} -Add a lightbutton object to the form. \\ -Methods: -\method{get_button()}, -\method{set_button()}. -\end{methoddesc} - -\begin{methoddesc}[form]{add_roundbutton}{type, x, y, w, h, name} -Add a roundbutton object to the form. \\ -Methods: -\method{get_button()}, -\method{set_button()}. -\end{methoddesc} - -%--- - -\begin{methoddesc}[form]{add_slider}{type, x, y, w, h, name} -Add a slider object to the form. \\ -Methods: -\method{set_slider_value()}, -\method{get_slider_value()}, -\method{set_slider_bounds()}, -\method{get_slider_bounds()}, -\method{set_slider_return()}, -\method{set_slider_size()}, -\method{set_slider_precision()}, -\method{set_slider_step()}. -\end{methoddesc} - -\begin{methoddesc}[form]{add_valslider}{type, x, y, w, h, name} -Add a valslider object to the form. \\ -Methods: -\method{set_slider_value()}, -\method{get_slider_value()}, -\method{set_slider_bounds()}, -\method{get_slider_bounds()}, -\method{set_slider_return()}, -\method{set_slider_size()}, -\method{set_slider_precision()}, -\method{set_slider_step()}. -\end{methoddesc} - -\begin{methoddesc}[form]{add_dial}{type, x, y, w, h, name} -Add a dial object to the form. \\ -Methods: -\method{set_dial_value()}, -\method{get_dial_value()}, -\method{set_dial_bounds()}, -\method{get_dial_bounds()}. -\end{methoddesc} - -\begin{methoddesc}[form]{add_positioner}{type, x, y, w, h, name} -Add a positioner object to the form. \\ -Methods: -\method{set_positioner_xvalue()}, -\method{set_positioner_yvalue()}, -\method{set_positioner_xbounds()}, -\method{set_positioner_ybounds()}, -\method{get_positioner_xvalue()}, -\method{get_positioner_yvalue()}, -\method{get_positioner_xbounds()}, -\method{get_positioner_ybounds()}. -\end{methoddesc} - -\begin{methoddesc}[form]{add_counter}{type, x, y, w, h, name} -Add a counter object to the form. \\ -Methods: -\method{set_counter_value()}, -\method{get_counter_value()}, -\method{set_counter_bounds()}, -\method{set_counter_step()}, -\method{set_counter_precision()}, -\method{set_counter_return()}. -\end{methoddesc} - -%--- - -\begin{methoddesc}[form]{add_input}{type, x, y, w, h, name} -Add a input object to the form. \\ -Methods: -\method{set_input()}, -\method{get_input()}, -\method{set_input_color()}, -\method{set_input_return()}. -\end{methoddesc} - -%--- - -\begin{methoddesc}[form]{add_menu}{type, x, y, w, h, name} -Add a menu object to the form. \\ -Methods: -\method{set_menu()}, -\method{get_menu()}, -\method{addto_menu()}. -\end{methoddesc} - -\begin{methoddesc}[form]{add_choice}{type, x, y, w, h, name} -Add a choice object to the form. \\ -Methods: -\method{set_choice()}, -\method{get_choice()}, -\method{clear_choice()}, -\method{addto_choice()}, -\method{replace_choice()}, -\method{delete_choice()}, -\method{get_choice_text()}, -\method{set_choice_fontsize()}, -\method{set_choice_fontstyle()}. -\end{methoddesc} - -\begin{methoddesc}[form]{add_browser}{type, x, y, w, h, name} -Add a browser object to the form. \\ -Methods: -\method{set_browser_topline()}, -\method{clear_browser()}, -\method{add_browser_line()}, -\method{addto_browser()}, -\method{insert_browser_line()}, -\method{delete_browser_line()}, -\method{replace_browser_line()}, -\method{get_browser_line()}, -\method{load_browser()}, -\method{get_browser_maxline()}, -\method{select_browser_line()}, -\method{deselect_browser_line()}, -\method{deselect_browser()}, -\method{isselected_browser_line()}, -\method{get_browser()}, -\method{set_browser_fontsize()}, -\method{set_browser_fontstyle()}, -\method{set_browser_specialkey()}. -\end{methoddesc} - -%--- - -\begin{methoddesc}[form]{add_timer}{type, x, y, w, h, name} -Add a timer object to the form. \\ -Methods: -\method{set_timer()}, -\method{get_timer()}. -\end{methoddesc} -\end{flushleft} - -Form objects have the following data attributes; see the FORMS -documentation: - -\begin{tableiii}{l|l|l}{member}{Name}{C Type}{Meaning} - \lineiii{window}{int (read-only)}{GL window id} - \lineiii{w}{float}{form width} - \lineiii{h}{float}{form height} - \lineiii{x}{float}{form x origin} - \lineiii{y}{float}{form y origin} - \lineiii{deactivated}{int}{nonzero if form is deactivated} - \lineiii{visible}{int}{nonzero if form is visible} - \lineiii{frozen}{int}{nonzero if form is frozen} - \lineiii{doublebuf}{int}{nonzero if double buffering on} -\end{tableiii} - -\subsection{FORMS Objects} -\label{forms-objects} - -Besides methods specific to particular kinds of FORMS objects, all -FORMS objects also have the following methods: - -\begin{methoddesc}[FORMS object]{set_call_back}{function, argument} -Set the object's callback function and argument. When the object -needs interaction, the callback function will be called with two -arguments: the object, and the callback argument. (FORMS objects -without a callback function are returned by \function{fl.do_forms()} -or \function{fl.check_forms()} when they need interaction.) Call this -method without arguments to remove the callback function. -\end{methoddesc} - -\begin{methoddesc}[FORMS object]{delete_object}{} - Delete the object. -\end{methoddesc} - -\begin{methoddesc}[FORMS object]{show_object}{} - Show the object. -\end{methoddesc} - -\begin{methoddesc}[FORMS object]{hide_object}{} - Hide the object. -\end{methoddesc} - -\begin{methoddesc}[FORMS object]{redraw_object}{} - Redraw the object. -\end{methoddesc} - -\begin{methoddesc}[FORMS object]{freeze_object}{} - Freeze the object. -\end{methoddesc} - -\begin{methoddesc}[FORMS object]{unfreeze_object}{} - Unfreeze the object. -\end{methoddesc} - -%\begin{methoddesc}[FORMS object]{handle_object}{} XXX -%\end{methoddesc} - -%\begin{methoddesc}[FORMS object]{handle_object_direct}{} XXX -%\end{methoddesc} - -FORMS objects have these data attributes; see the FORMS documentation: - -\begin{tableiii}{l|l|l}{member}{Name}{C Type}{Meaning} - \lineiii{objclass}{int (read-only)}{object class} - \lineiii{type}{int (read-only)}{object type} - \lineiii{boxtype}{int}{box type} - \lineiii{x}{float}{x origin} - \lineiii{y}{float}{y origin} - \lineiii{w}{float}{width} - \lineiii{h}{float}{height} - \lineiii{col1}{int}{primary color} - \lineiii{col2}{int}{secondary color} - \lineiii{align}{int}{alignment} - \lineiii{lcol}{int}{label color} - \lineiii{lsize}{float}{label font size} - \lineiii{label}{string}{label string} - \lineiii{lstyle}{int}{label style} - \lineiii{pushed}{int (read-only)}{(see FORMS docs)} - \lineiii{focus}{int (read-only)}{(see FORMS docs)} - \lineiii{belowmouse}{int (read-only)}{(see FORMS docs)} - \lineiii{frozen}{int (read-only)}{(see FORMS docs)} - \lineiii{active}{int (read-only)}{(see FORMS docs)} - \lineiii{input}{int (read-only)}{(see FORMS docs)} - \lineiii{visible}{int (read-only)}{(see FORMS docs)} - \lineiii{radio}{int (read-only)}{(see FORMS docs)} - \lineiii{automatic}{int (read-only)}{(see FORMS docs)} -\end{tableiii} - - -\section{\module{FL} --- - Constants used with the \module{fl} module} - -\declaremodule[fl-constants]{standard}{FL} - \platform{IRIX} -\modulesynopsis{Constants used with the \module{fl} module.} - - -This module defines symbolic constants needed to use the built-in -module \refmodule{fl} (see above); they are equivalent to those defined in -the C header file \code{} except that the name prefix -\samp{FL_} is omitted. Read the module source for a complete list of -the defined names. Suggested use: - -\begin{verbatim} -import fl -from FL import * -\end{verbatim} - - -\section{\module{flp} --- - Functions for loading stored FORMS designs} - -\declaremodule{standard}{flp} - \platform{IRIX} -\modulesynopsis{Functions for loading stored FORMS designs.} - - -This module defines functions that can read form definitions created -by the `form designer' (\program{fdesign}) program that comes with the -FORMS library (see module \refmodule{fl} above). - -For now, see the file \file{flp.doc} in the Python library source -directory for a description. - -XXX A complete description should be inserted here! diff --git a/Doc/lib/libfm.tex b/Doc/lib/libfm.tex deleted file mode 100644 index 0a0c237..0000000 --- a/Doc/lib/libfm.tex +++ /dev/null @@ -1,93 +0,0 @@ -\section{\module{fm} --- - \emph{Font Manager} interface} - -\declaremodule{builtin}{fm} - \platform{IRIX} -\modulesynopsis{\emph{Font Manager} interface for SGI workstations.} - - -This module provides access to the IRIS \emph{Font Manager} library. -\index{Font Manager, IRIS} -\index{IRIS Font Manager} -It is available only on Silicon Graphics machines. -See also: \emph{4Sight User's Guide}, section 1, chapter 5: ``Using -the IRIS Font Manager.'' - -This is not yet a full interface to the IRIS Font Manager. -Among the unsupported features are: matrix operations; cache -operations; character operations (use string operations instead); some -details of font info; individual glyph metrics; and printer matching. - -It supports the following operations: - -\begin{funcdesc}{init}{} -Initialization function. -Calls \cfunction{fminit()}. -It is normally not necessary to call this function, since it is called -automatically the first time the \module{fm} module is imported. -\end{funcdesc} - -\begin{funcdesc}{findfont}{fontname} -Return a font handle object. -Calls \code{fmfindfont(\var{fontname})}. -\end{funcdesc} - -\begin{funcdesc}{enumerate}{} -Returns a list of available font names. -This is an interface to \cfunction{fmenumerate()}. -\end{funcdesc} - -\begin{funcdesc}{prstr}{string} -Render a string using the current font (see the \function{setfont()} font -handle method below). -Calls \code{fmprstr(\var{string})}. -\end{funcdesc} - -\begin{funcdesc}{setpath}{string} -Sets the font search path. -Calls \code{fmsetpath(\var{string})}. -(XXX Does not work!?!) -\end{funcdesc} - -\begin{funcdesc}{fontpath}{} -Returns the current font search path. -\end{funcdesc} - -Font handle objects support the following operations: - -\begin{methoddesc}[font handle]{scalefont}{factor} -Returns a handle for a scaled version of this font. -Calls \code{fmscalefont(\var{fh}, \var{factor})}. -\end{methoddesc} - -\begin{methoddesc}[font handle]{setfont}{} -Makes this font the current font. -Note: the effect is undone silently when the font handle object is -deleted. -Calls \code{fmsetfont(\var{fh})}. -\end{methoddesc} - -\begin{methoddesc}[font handle]{getfontname}{} -Returns this font's name. -Calls \code{fmgetfontname(\var{fh})}. -\end{methoddesc} - -\begin{methoddesc}[font handle]{getcomment}{} -Returns the comment string associated with this font. -Raises an exception if there is none. -Calls \code{fmgetcomment(\var{fh})}. -\end{methoddesc} - -\begin{methoddesc}[font handle]{getfontinfo}{} -Returns a tuple giving some pertinent data about this font. -This is an interface to \code{fmgetfontinfo()}. -The returned tuple contains the following numbers: -\code{(}\var{printermatched}, \var{fixed_width}, \var{xorig}, -\var{yorig}, \var{xsize}, \var{ysize}, \var{height}, -\var{nglyphs}\code{)}. -\end{methoddesc} - -\begin{methoddesc}[font handle]{getstrwidth}{string} -Returns the width, in pixels, of \var{string} when drawn in this font. -Calls \code{fmgetstrwidth(\var{fh}, \var{string})}. -\end{methoddesc} diff --git a/Doc/lib/libgl.tex b/Doc/lib/libgl.tex deleted file mode 100644 index ecf4c36..0000000 --- a/Doc/lib/libgl.tex +++ /dev/null @@ -1,224 +0,0 @@ -\section{\module{gl} --- - \emph{Graphics Library} interface} - -\declaremodule{builtin}{gl} - \platform{IRIX} -\modulesynopsis{Functions from the Silicon Graphics \emph{Graphics Library}.} - - -This module provides access to the Silicon Graphics -\emph{Graphics Library}. -It is available only on Silicon Graphics machines. - -\warning{Some illegal calls to the GL library cause the Python -interpreter to dump core. -In particular, the use of most GL calls is unsafe before the first -window is opened.} - -The module is too large to document here in its entirety, but the -following should help you to get started. -The parameter conventions for the C functions are translated to Python as -follows: - -\begin{itemize} -\item -All (short, long, unsigned) int values are represented by Python -integers. -\item -All float and double values are represented by Python floating point -numbers. -In most cases, Python integers are also allowed. -\item -All arrays are represented by one-dimensional Python lists. -In most cases, tuples are also allowed. -\item -\begin{sloppypar} -All string and character arguments are represented by Python strings, -for instance, -\code{winopen('Hi There!')} -and -\code{rotate(900, 'z')}. -\end{sloppypar} -\item -All (short, long, unsigned) integer arguments or return values that are -only used to specify the length of an array argument are omitted. -For example, the C call - -\begin{verbatim} -lmdef(deftype, index, np, props) -\end{verbatim} - -is translated to Python as - -\begin{verbatim} -lmdef(deftype, index, props) -\end{verbatim} - -\item -Output arguments are omitted from the argument list; they are -transmitted as function return values instead. -If more than one value must be returned, the return value is a tuple. -If the C function has both a regular return value (that is not omitted -because of the previous rule) and an output argument, the return value -comes first in the tuple. -Examples: the C call - -\begin{verbatim} -getmcolor(i, &red, &green, &blue) -\end{verbatim} - -is translated to Python as - -\begin{verbatim} -red, green, blue = getmcolor(i) -\end{verbatim} - -\end{itemize} - -The following functions are non-standard or have special argument -conventions: - -\begin{funcdesc}{varray}{argument} -%JHXXX the argument-argument added -Equivalent to but faster than a number of -\code{v3d()} -calls. -The \var{argument} is a list (or tuple) of points. -Each point must be a tuple of coordinates -\code{(\var{x}, \var{y}, \var{z})} or \code{(\var{x}, \var{y})}. -The points may be 2- or 3-dimensional but must all have the -same dimension. -Float and int values may be mixed however. -The points are always converted to 3D double precision points -by assuming \code{\var{z} = 0.0} if necessary (as indicated in the man page), -and for each point -\code{v3d()} -is called. -\end{funcdesc} - -\begin{funcdesc}{nvarray}{} -Equivalent to but faster than a number of -\code{n3f} -and -\code{v3f} -calls. -The argument is an array (list or tuple) of pairs of normals and points. -Each pair is a tuple of a point and a normal for that point. -Each point or normal must be a tuple of coordinates -\code{(\var{x}, \var{y}, \var{z})}. -Three coordinates must be given. -Float and int values may be mixed. -For each pair, -\code{n3f()} -is called for the normal, and then -\code{v3f()} -is called for the point. -\end{funcdesc} - -\begin{funcdesc}{vnarray}{} -Similar to -\code{nvarray()} -but the pairs have the point first and the normal second. -\end{funcdesc} - -\begin{funcdesc}{nurbssurface}{s_k, t_k, ctl, s_ord, t_ord, type} -% XXX s_k[], t_k[], ctl[][] -Defines a nurbs surface. -The dimensions of -\code{\var{ctl}[][]} -are computed as follows: -\code{[len(\var{s_k}) - \var{s_ord}]}, -\code{[len(\var{t_k}) - \var{t_ord}]}. -\end{funcdesc} - -\begin{funcdesc}{nurbscurve}{knots, ctlpoints, order, type} -Defines a nurbs curve. -The length of ctlpoints is -\code{len(\var{knots}) - \var{order}}. -\end{funcdesc} - -\begin{funcdesc}{pwlcurve}{points, type} -Defines a piecewise-linear curve. -\var{points} -is a list of points. -\var{type} -must be -\code{N_ST}. -\end{funcdesc} - -\begin{funcdesc}{pick}{n} -\funcline{select}{n} -The only argument to these functions specifies the desired size of the -pick or select buffer. -\end{funcdesc} - -\begin{funcdesc}{endpick}{} -\funcline{endselect}{} -These functions have no arguments. -They return a list of integers representing the used part of the -pick/select buffer. -No method is provided to detect buffer overrun. -\end{funcdesc} - -Here is a tiny but complete example GL program in Python: - -\begin{verbatim} -import gl, GL, time - -def main(): - gl.foreground() - gl.prefposition(500, 900, 500, 900) - w = gl.winopen('CrissCross') - gl.ortho2(0.0, 400.0, 0.0, 400.0) - gl.color(GL.WHITE) - gl.clear() - gl.color(GL.RED) - gl.bgnline() - gl.v2f(0.0, 0.0) - gl.v2f(400.0, 400.0) - gl.endline() - gl.bgnline() - gl.v2f(400.0, 0.0) - gl.v2f(0.0, 400.0) - gl.endline() - time.sleep(5) - -main() -\end{verbatim} - - -\begin{seealso} - \seetitle[http://pyopengl.sourceforge.net/] - {PyOpenGL: The Python OpenGL Binding} - {An interface to OpenGL\index{OpenGL} is also available; - see information about the - \strong{PyOpenGL}\index{PyOpenGL} project online at - \url{http://pyopengl.sourceforge.net/}. This may be a - better option if support for SGI hardware from before - about 1996 is not required.} -\end{seealso} - - -\section{\module{DEVICE} --- - Constants used with the \module{gl} module} - -\declaremodule{standard}{DEVICE} - \platform{IRIX} -\modulesynopsis{Constants used with the \module{gl} module.} - -This modules defines the constants used by the Silicon Graphics -\emph{Graphics Library} that C programmers find in the header file -\code{}. -Read the module source file for details. - - -\section{\module{GL} --- - Constants used with the \module{gl} module} - -\declaremodule[gl-constants]{standard}{GL} - \platform{IRIX} -\modulesynopsis{Constants used with the \module{gl} module.} - -This module contains constants used by the Silicon Graphics -\emph{Graphics Library} from the C header file \code{}. -Read the module source file for details. diff --git a/Doc/lib/libimgfile.tex b/Doc/lib/libimgfile.tex deleted file mode 100644 index 1aad965..0000000 --- a/Doc/lib/libimgfile.tex +++ /dev/null @@ -1,66 +0,0 @@ -\section{\module{imgfile} --- - Support for SGI imglib files} - -\declaremodule{builtin}{imgfile} - \platform{IRIX} -\modulesynopsis{Support for SGI imglib files.} - - -The \module{imgfile} module allows Python programs to access SGI imglib image -files (also known as \file{.rgb} files). The module is far from -complete, but is provided anyway since the functionality that there is -enough in some cases. Currently, colormap files are not supported. - -The module defines the following variables and functions: - -\begin{excdesc}{error} -This exception is raised on all errors, such as unsupported file type, etc. -\end{excdesc} - -\begin{funcdesc}{getsizes}{file} -This function returns a tuple \code{(\var{x}, \var{y}, \var{z})} where -\var{x} and \var{y} are the size of the image in pixels and -\var{z} is the number of -bytes per pixel. Only 3 byte RGB pixels and 1 byte greyscale pixels -are currently supported. -\end{funcdesc} - -\begin{funcdesc}{read}{file} -This function reads and decodes the image on the specified file, and -returns it as a Python string. The string has either 1 byte greyscale -pixels or 4 byte RGBA pixels. The bottom left pixel is the first in -the string. This format is suitable to pass to \function{gl.lrectwrite()}, -for instance. -\end{funcdesc} - -\begin{funcdesc}{readscaled}{file, x, y, filter\optional{, blur}} -This function is identical to read but it returns an image that is -scaled to the given \var{x} and \var{y} sizes. If the \var{filter} and -\var{blur} parameters are omitted scaling is done by -simply dropping or duplicating pixels, so the result will be less than -perfect, especially for computer-generated images. - -Alternatively, you can specify a filter to use to smooth the image -after scaling. The filter forms supported are \code{'impulse'}, -\code{'box'}, \code{'triangle'}, \code{'quadratic'} and -\code{'gaussian'}. If a filter is specified \var{blur} is an optional -parameter specifying the blurriness of the filter. It defaults to \code{1.0}. - -\function{readscaled()} makes no attempt to keep the aspect ratio -correct, so that is the users' responsibility. -\end{funcdesc} - -\begin{funcdesc}{ttob}{flag} -This function sets a global flag which defines whether the scan lines -of the image are read or written from bottom to top (flag is zero, -compatible with SGI GL) or from top to bottom(flag is one, -compatible with X). The default is zero. -\end{funcdesc} - -\begin{funcdesc}{write}{file, data, x, y, z} -This function writes the RGB or greyscale data in \var{data} to image -file \var{file}. \var{x} and \var{y} give the size of the image, -\var{z} is 1 for 1 byte greyscale images or 3 for RGB images (which are -stored as 4 byte values of which only the lower three bytes are used). -These are the formats returned by \function{gl.lrectread()}. -\end{funcdesc} diff --git a/Doc/lib/libsgi.tex b/Doc/lib/libsgi.tex deleted file mode 100644 index ca17ad0..0000000 --- a/Doc/lib/libsgi.tex +++ /dev/null @@ -1,7 +0,0 @@ -\chapter{SGI IRIX Specific Services} -\label{sgi} - -The modules described in this chapter provide interfaces to features -that are unique to SGI's IRIX operating system (versions 4 and 5). - -\localmoduletable diff --git a/Doc/lib/libundoc.tex b/Doc/lib/libundoc.tex index e7d388f..041e3dd 100644 --- a/Doc/lib/libundoc.tex +++ b/Doc/lib/libundoc.tex @@ -46,11 +46,6 @@ document these. \item[\module{posixpath}] --- Implementation of \module{os.path} on \POSIX. - -\item[\module{bsddb185}] ---- Backwards compatibility module for systems which still use the Berkeley - DB 1.85 module. It is normally only available on certain BSD \UNIX-based - systems. It should never be used directly. \end{description} @@ -97,17 +92,3 @@ installing the shared object if using dynamically-loaded extensions. --- Measure time intervals to high resolution (use \function{time.clock()} instead). \end{description} - -\section{SGI-specific Extension modules} - -The following are SGI specific, and may be out of touch with the -current version of reality. - -\begin{description} -\item[\module{cl}] ---- Interface to the SGI compression library. - -\item[\module{sv}] ---- Interface to the ``simple video'' board on SGI Indigo - (obsolete hardware). -\end{description} diff --git a/Doc/tools/mkackshtml b/Doc/tools/mkackshtml index b5fe7ba..ac126e0 100755 --- a/Doc/tools/mkackshtml +++ b/Doc/tools/mkackshtml @@ -1,7 +1,6 @@ #! /usr/bin/env python # -*- Python -*- -import string import support import sys @@ -12,7 +11,7 @@ def collect(fp): line = fp.readline() if not line: break - line = string.strip(line) + line = line.strip() if line: names.append(line) else: @@ -32,7 +31,7 @@ def main(): colnums.append(percol*i) options.aesop_type = "information" fp = options.get_output_file() - fp.write(string.rstrip(options.get_header()) + "\n") + fp.write(options.get_header().rstrip() + "\n") fp.write(THANKS + "\n") fp.write('\n') for i in range(percol): @@ -44,7 +43,7 @@ def main(): pass fp.write(" \n") fp.write("
\n") - fp.write(string.rstrip(options.get_footer()) + "\n") + fp.write(options.get_footer().rstrip() + "\n") fp.close() THANKS = '''\ diff --git a/Grammar/Grammar b/Grammar/Grammar index 0e49e35..fa1a3d7 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -89,8 +89,9 @@ lambdef_nocond: 'lambda' [varargslist] ':' test_nocond or_test: and_test ('or' and_test)* and_test: not_test ('and' not_test)* not_test: 'not' not_test | comparison -comparison: expr (comp_op expr)* +comparison: star_expr (comp_op star_expr)* comp_op: '<'|'>'|'=='|'>='|'<='|'!='|'in'|'not' 'in'|'is'|'is' 'not' +star_expr: ['*'] expr expr: xor_expr ('|' xor_expr)* xor_expr: and_expr ('^' and_expr)* and_expr: shift_expr ('&' shift_expr)* @@ -108,7 +109,7 @@ trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME subscriptlist: subscript (',' subscript)* [','] subscript: test | [test] ':' [test] [sliceop] sliceop: ':' [test] -exprlist: expr (',' expr)* [','] +exprlist: star_expr (',' star_expr)* [','] testlist: test (',' test)* [','] dictorsetmaker: ( (test ':' test (',' test ':' test)* [',']) | (test (comp_for | (',' test)* [','])) ) diff --git a/Include/Python-ast.h b/Include/Python-ast.h index d88076b..6eec6c3 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -186,7 +186,8 @@ enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, SetComp_kind=9, GeneratorExp_kind=10, Yield_kind=11, Compare_kind=12, Call_kind=13, Num_kind=14, Str_kind=15, Bytes_kind=16, Ellipsis_kind=17, Attribute_kind=18, - Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22}; + Subscript_kind=19, Starred_kind=20, Name_kind=21, + List_kind=22, Tuple_kind=23}; struct _expr { enum _expr_kind kind; union { @@ -284,6 +285,11 @@ struct _expr { } Subscript; struct { + expr_ty value; + expr_context_ty ctx; + } Starred; + + struct { identifier id; expr_context_ty ctx; } Name; @@ -499,6 +505,9 @@ expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int #define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5) expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); +#define Starred(a0, a1, a2, a3, a4) _Py_Starred(a0, a1, a2, a3, a4) +expr_ty _Py_Starred(expr_ty value, expr_context_ty ctx, int lineno, int + col_offset, PyArena *arena); #define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4) expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); diff --git a/Include/graminit.h b/Include/graminit.h index 0596fb1..6e1d409 100644 --- a/Include/graminit.h +++ b/Include/graminit.h @@ -55,29 +55,30 @@ #define not_test 310 #define comparison 311 #define comp_op 312 -#define expr 313 -#define xor_expr 314 -#define and_expr 315 -#define shift_expr 316 -#define arith_expr 317 -#define term 318 -#define factor 319 -#define power 320 -#define atom 321 -#define testlist_comp 322 -#define trailer 323 -#define subscriptlist 324 -#define subscript 325 -#define sliceop 326 -#define exprlist 327 -#define testlist 328 -#define dictorsetmaker 329 -#define classdef 330 -#define arglist 331 -#define argument 332 -#define comp_iter 333 -#define comp_for 334 -#define comp_if 335 -#define testlist1 336 -#define encoding_decl 337 -#define yield_expr 338 +#define star_expr 313 +#define expr 314 +#define xor_expr 315 +#define and_expr 316 +#define shift_expr 317 +#define arith_expr 318 +#define term 319 +#define factor 320 +#define power 321 +#define atom 322 +#define testlist_comp 323 +#define trailer 324 +#define subscriptlist 325 +#define subscript 326 +#define sliceop 327 +#define exprlist 328 +#define testlist 329 +#define dictorsetmaker 330 +#define classdef 331 +#define arglist 332 +#define argument 333 +#define comp_iter 334 +#define comp_for 335 +#define comp_if 336 +#define testlist1 337 +#define encoding_decl 338 +#define yield_expr 339 diff --git a/Include/opcode.h b/Include/opcode.h index 5fbb037..6717977 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -85,6 +85,8 @@ extern "C" { #define DELETE_NAME 91 /* "" */ #define UNPACK_SEQUENCE 92 /* Number of sequence items */ #define FOR_ITER 93 +#define UNPACK_EX 94 /* Num items before variable part + + (Num items after variable part << 8) */ #define STORE_ATTR 95 /* Index in name list */ #define DELETE_ATTR 96 /* "" */ diff --git a/Lib/commands.py b/Lib/commands.py index d19aa1a..ee4db85 100644 --- a/Lib/commands.py +++ b/Lib/commands.py @@ -19,7 +19,7 @@ Encapsulates the basic operation: [Note: it would be nice to add functions to interpret the exit status.] """ -__all__ = ["getstatusoutput","getoutput","getstatus"] +__all__ = ["getstatusoutput", "getoutput"] # Module 'commands' # @@ -28,15 +28,6 @@ __all__ = ["getstatusoutput","getoutput","getstatus"] # NB This only works (and is only relevant) for UNIX. -# Get 'ls -l' status for an object into a string -# -def getstatus(file): - """Return output of "ls -ld " in a string.""" - import warnings - warnings.warn("commands.getstatus() is deprecated", DeprecationWarning) - return getoutput('ls -ld' + mkarg(file)) - - # Get the output from a shell command into a string. # The exit status is ignored; a trailing newline is stripped. # Assume the command will work with '{ ... ; } 2>&1' around it.. diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 53d5db0..30c2a24 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -17,8 +17,6 @@ intends to replace several other, older modules and functions, like: os.system os.spawn* -os.popen* -popen2.* commands.* Information about how the subprocess module can be used to replace these @@ -283,73 +281,6 @@ Environment example: os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env) ==> Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) - - -Replacing os.popen* -------------------- -pipe = os.popen(cmd, mode='r', bufsize) -==> -pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout - -pipe = os.popen(cmd, mode='w', bufsize) -==> -pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin - - -(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize) -==> -p = Popen(cmd, shell=True, bufsize=bufsize, - stdin=PIPE, stdout=PIPE, close_fds=True) -(child_stdin, child_stdout) = (p.stdin, p.stdout) - - -(child_stdin, - child_stdout, - child_stderr) = os.popen3(cmd, mode, bufsize) -==> -p = Popen(cmd, shell=True, bufsize=bufsize, - stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) -(child_stdin, - child_stdout, - child_stderr) = (p.stdin, p.stdout, p.stderr) - - -(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize) -==> -p = Popen(cmd, shell=True, bufsize=bufsize, - stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) -(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) - - -Replacing popen2.* ------------------- -Note: If the cmd argument to popen2 functions is a string, the command -is executed through /bin/sh. If it is a list, the command is directly -executed. - -(child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode) -==> -p = Popen(["somestring"], shell=True, bufsize=bufsize - stdin=PIPE, stdout=PIPE, close_fds=True) -(child_stdout, child_stdin) = (p.stdout, p.stdin) - - -(child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode) -==> -p = Popen(["mycmd", "myarg"], bufsize=bufsize, - stdin=PIPE, stdout=PIPE, close_fds=True) -(child_stdout, child_stdin) = (p.stdout, p.stdin) - -The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen, -except that: - -* subprocess.Popen raises an exception if the execution fails -* the capturestderr argument is replaced with the stderr argument. -* stdin=PIPE and stdout=PIPE must be specified. -* popen2 closes all filedescriptors by default, but you have to specify - close_fds=True with subprocess.Popen. - - """ import sys diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 331b441..7458b5e 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -818,11 +818,7 @@ _expectations = { """ test__locale test_applesingle - test_al - test_bsddb185 test_bsddb3 - test_cd - test_cl test_commands test_crypt test_curses @@ -831,9 +827,7 @@ _expectations = { test_fcntl test_fork1 test_gdbm - test_gl test_grp - test_imgfile test_ioctl test_largefile test_linuxaudiodev @@ -855,15 +849,9 @@ _expectations = { """, 'linux2': """ - test_al test_applesingle - test_bsddb185 - test_cd - test_cl test_curses test_dl - test_gl - test_imgfile test_largefile test_linuxaudiodev test_nis @@ -875,14 +863,10 @@ _expectations = { """, 'mac': """ - test_al test_atexit test_bsddb - test_bsddb185 test_bsddb3 test_bz2 - test_cd - test_cl test_commands test_crypt test_curses @@ -890,10 +874,8 @@ _expectations = { test_dl test_fcntl test_fork1 - test_gl test_grp test_ioctl - test_imgfile test_largefile test_linuxaudiodev test_locale @@ -919,15 +901,9 @@ _expectations = { """, 'unixware7': """ - test_al test_applesingle test_bsddb - test_bsddb185 - test_cd - test_cl test_dl - test_gl - test_imgfile test_largefile test_linuxaudiodev test_minidom @@ -943,15 +919,9 @@ _expectations = { """, 'openunix8': """ - test_al test_applesingle test_bsddb - test_bsddb185 - test_cd - test_cl test_dl - test_gl - test_imgfile test_largefile test_linuxaudiodev test_minidom @@ -967,18 +937,12 @@ _expectations = { """, 'sco_sv3': """ - test_al test_applesingle test_asynchat test_bsddb - test_bsddb185 - test_cd - test_cl test_dl test_fork1 test_gettext - test_gl - test_imgfile test_largefile test_linuxaudiodev test_locale @@ -1000,15 +964,11 @@ _expectations = { """, 'riscos': """ - test_al test_applesingle test_asynchat test_atexit test_bsddb - test_bsddb185 test_bsddb3 - test_cd - test_cl test_commands test_crypt test_dbm @@ -1016,9 +976,7 @@ _expectations = { test_fcntl test_fork1 test_gdbm - test_gl test_grp - test_imgfile test_largefile test_linuxaudiodev test_locale @@ -1043,12 +1001,7 @@ _expectations = { """, 'darwin': """ - test_al - test_cd - test_cl test_gdbm - test_gl - test_imgfile test_largefile test_linuxaudiodev test_locale @@ -1059,18 +1012,12 @@ _expectations = { """, 'sunos5': """ - test_al test_applesingle test_bsddb - test_bsddb185 - test_cd - test_cl test_curses test_dbm test_gdbm - test_gl test_gzip - test_imgfile test_linuxaudiodev test_openpty test_sqlite @@ -1080,18 +1027,12 @@ _expectations = { """, 'hp-ux11': """ - test_al test_applesingle test_bsddb - test_bsddb185 - test_cd - test_cl test_curses test_dl test_gdbm - test_gl test_gzip - test_imgfile test_largefile test_linuxaudiodev test_locale @@ -1109,16 +1050,10 @@ _expectations = { """, 'atheos': """ - test_al test_applesingle - test_bsddb185 - test_cd - test_cl test_curses test_dl test_gdbm - test_gl - test_imgfile test_largefile test_linuxaudiodev test_locale @@ -1134,16 +1069,10 @@ _expectations = { """, 'cygwin': """ - test_al test_applesingle - test_bsddb185 test_bsddb3 - test_cd - test_cl test_curses test_dbm - test_gl - test_imgfile test_ioctl test_largefile test_linuxaudiodev @@ -1156,18 +1085,12 @@ _expectations = { """, 'os2emx': """ - test_al test_applesingle test_audioop - test_bsddb185 test_bsddb3 - test_cd - test_cl test_commands test_curses test_dl - test_gl - test_imgfile test_largefile test_linuxaudiodev test_mhlib @@ -1185,15 +1108,10 @@ _expectations = { 'freebsd4': """ test_aepack - test_al test_applesingle test_bsddb test_bsddb3 - test_cd - test_cl test_gdbm - test_gl - test_imgfile test_linuxaudiodev test_locale test_macfs @@ -1219,19 +1137,13 @@ _expectations = { 'aix5': """ test_aepack - test_al test_applesingle test_bsddb - test_bsddb185 test_bsddb3 test_bz2 - test_cd - test_cl test_dl test_gdbm - test_gl test_gzip - test_imgfile test_linuxaudiodev test_macfs test_macostools @@ -1249,17 +1161,12 @@ _expectations = { 'openbsd3': """ test_aepack - test_al test_applesingle test_bsddb test_bsddb3 - test_cd - test_cl test_ctypes test_dl test_gdbm - test_gl - test_imgfile test_linuxaudiodev test_locale test_macfs @@ -1281,19 +1188,13 @@ _expectations = { 'netbsd3': """ test_aepack - test_al test_applesingle test_bsddb - test_bsddb185 test_bsddb3 - test_cd - test_cl test_ctypes test_curses test_dl test_gdbm - test_gl - test_imgfile test_linuxaudiodev test_locale test_macfs diff --git a/Lib/test/test_al.py b/Lib/test/test_al.py deleted file mode 100755 index e97ca65..0000000 --- a/Lib/test/test_al.py +++ /dev/null @@ -1,23 +0,0 @@ -#! /usr/bin/env python -"""Whimpy test script for the al module - Roger E. Masse -""" -import al -from test.test_support import verbose - -alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams', - 'newconfig', 'openport', 'queryparams', 'setparams'] - -# This is a very unobtrusive test for the existence of the al module and all its -# attributes. More comprehensive examples can be found in Demo/al - -def main(): - # touch all the attributes of al without doing anything - if verbose: - print('Touching al module attributes...') - for attr in alattrs: - if verbose: - print('touching: ', attr) - getattr(al, attr) - -main() diff --git a/Lib/test/test_bsddb185.py b/Lib/test/test_bsddb185.py deleted file mode 100644 index df1ece0..0000000 --- a/Lib/test/test_bsddb185.py +++ /dev/null @@ -1,43 +0,0 @@ -"""Tests for the bsddb185 module. - -The file 185test.db found in Lib/test/ is for testing purposes with this -testing suite. - -""" -from test.test_support import verbose, run_unittest, findfile -import unittest -import bsddb185 -import anydbm -import whichdb -import os -import tempfile -import shutil - -class Bsddb185Tests(unittest.TestCase): - - def test_open_existing_hash(self): - # Verify we can open a file known to be a hash v2 file - db = bsddb185.hashopen(findfile("185test.db")) - self.assertEqual(db["1"], "1") - db.close() - - def test_whichdb(self): - # Verify that whichdb correctly sniffs the known hash v2 file - self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185") - - def test_anydbm_create(self): - # Verify that anydbm.open does *not* create a bsddb185 file - tmpdir = tempfile.mkdtemp() - try: - dbfile = os.path.join(tmpdir, "foo.db") - anydbm.open(dbfile, "c").close() - ftype = whichdb.whichdb(dbfile) - self.assertNotEqual(ftype, "bsddb185") - finally: - shutil.rmtree(tmpdir) - -def test_main(): - run_unittest(Bsddb185Tests) - -if __name__ == "__main__": - test_main() diff --git a/Lib/test/test_cd.py b/Lib/test/test_cd.py deleted file mode 100755 index 217b38b..0000000 --- a/Lib/test/test_cd.py +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/bin/env python -"""Whimpy test script for the cd module - Roger E. Masse -""" -import cd -from test.test_support import verbose - -cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY', - 'STILL', '__doc__', '__name__', 'atime', 'audio', 'catalog', 'control', 'createparser', 'error', - 'ident', 'index', 'msftoframe', 'open', 'pnum', 'ptime'] - - -# This is a very inobtrusive test for the existence of the cd module and all its -# attributes. More comprehensive examples can be found in Demo/cd and -# require that you have a CD and a CD ROM drive - -def main(): - # touch all the attributes of cd without doing anything - if verbose: - print('Touching cd module attributes...') - for attr in cdattrs: - if verbose: - print('touching: ', attr) - getattr(cd, attr) - -main() diff --git a/Lib/test/test_cl.py b/Lib/test/test_cl.py deleted file mode 100755 index 0df7f6f..0000000 --- a/Lib/test/test_cl.py +++ /dev/null @@ -1,78 +0,0 @@ -#! /usr/bin/env python -"""Whimpy test script for the cl module - Roger E. Masse -""" -import cl -from test.test_support import verbose - -clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID', -'ALGORITHM_VERSION', 'AUDIO', 'AWARE_ERROR', 'AWARE_MPEG_AUDIO', -'AWARE_MULTIRATE', 'AWCMP_CONST_QUAL', 'AWCMP_FIXED_RATE', -'AWCMP_INDEPENDENT', 'AWCMP_JOINT_STEREO', 'AWCMP_LOSSLESS', -'AWCMP_MPEG_LAYER_I', 'AWCMP_MPEG_LAYER_II', 'AWCMP_STEREO', -'Algorithm', 'AlgorithmNumber', 'AlgorithmType', 'AudioFormatName', -'BAD_ALGORITHM_NAME', 'BAD_ALGORITHM_TYPE', 'BAD_BLOCK_SIZE', -'BAD_BOARD', 'BAD_BUFFERING', 'BAD_BUFFERLENGTH_NEG', -'BAD_BUFFERLENGTH_ODD', 'BAD_BUFFER_EXISTS', 'BAD_BUFFER_HANDLE', -'BAD_BUFFER_POINTER', 'BAD_BUFFER_QUERY_SIZE', 'BAD_BUFFER_SIZE', -'BAD_BUFFER_SIZE_POINTER', 'BAD_BUFFER_TYPE', -'BAD_COMPRESSION_SCHEME', 'BAD_COMPRESSOR_HANDLE', -'BAD_COMPRESSOR_HANDLE_POINTER', 'BAD_FRAME_SIZE', -'BAD_FUNCTIONALITY', 'BAD_FUNCTION_POINTER', 'BAD_HEADER_SIZE', -'BAD_INITIAL_VALUE', 'BAD_INTERNAL_FORMAT', 'BAD_LICENSE', -'BAD_MIN_GT_MAX', 'BAD_NO_BUFFERSPACE', 'BAD_NUMBER_OF_BLOCKS', -'BAD_PARAM', 'BAD_PARAM_ID_POINTER', 'BAD_PARAM_TYPE', 'BAD_POINTER', -'BAD_PVBUFFER', 'BAD_SCHEME_POINTER', 'BAD_STREAM_HEADER', -'BAD_STRING_POINTER', 'BAD_TEXT_STRING_PTR', 'BEST_FIT', -'BIDIRECTIONAL', 'BITRATE_POLICY', 'BITRATE_TARGET', -'BITS_PER_COMPONENT', 'BLENDING', 'BLOCK_SIZE', 'BOTTOM_UP', -'BUFFER_NOT_CREATED', 'BUF_DATA', 'BUF_FRAME', 'BytesPerPixel', -'BytesPerSample', 'CHANNEL_POLICY', 'CHROMA_THRESHOLD', 'CODEC', -'COMPONENTS', 'COMPRESSED_BUFFER_SIZE', 'COMPRESSION_RATIO', -'COMPRESSOR', 'CONTINUOUS_BLOCK', 'CONTINUOUS_NONBLOCK', -'CompressImage', 'DATA', 'DECOMPRESSOR', 'DecompressImage', -'EDGE_THRESHOLD', 'ENABLE_IMAGEINFO', 'END_OF_SEQUENCE', 'ENUM_VALUE', -'EXACT_COMPRESSION_RATIO', 'EXTERNAL_DEVICE', 'FLOATING_ENUM_VALUE', -'FLOATING_RANGE_VALUE', 'FRAME', 'FRAME_BUFFER_SIZE', -'FRAME_BUFFER_SIZE_ZERO', 'FRAME_RATE', 'FRAME_TYPE', 'G711_ALAW', -'G711_ULAW', 'GRAYSCALE', 'GetAlgorithmName', 'HDCC', -'HDCC_SAMPLES_PER_TILE', 'HDCC_TILE_THRESHOLD', 'HEADER_START_CODE', -'IMAGE_HEIGHT', 'IMAGE_WIDTH', 'INTERNAL_FORMAT', -'INTERNAL_IMAGE_HEIGHT', 'INTERNAL_IMAGE_WIDTH', 'INTRA', 'JPEG', -'JPEG_ERROR', 'JPEG_NUM_PARAMS', 'JPEG_QUALITY_FACTOR', -'JPEG_QUANTIZATION_TABLES', 'JPEG_SOFTWARE', 'JPEG_STREAM_HEADERS', -'KEYFRAME', 'LAST_FRAME_INDEX', 'LAYER', 'LUMA_THRESHOLD', -'MAX_NUMBER_OF_AUDIO_ALGORITHMS', 'MAX_NUMBER_OF_ORIGINAL_FORMATS', -'MAX_NUMBER_OF_PARAMS', 'MAX_NUMBER_OF_VIDEO_ALGORITHMS', 'MONO', -'MPEG_VIDEO', 'MVC1', 'MVC2', 'MVC2_BLENDING', 'MVC2_BLENDING_OFF', -'MVC2_BLENDING_ON', 'MVC2_CHROMA_THRESHOLD', 'MVC2_EDGE_THRESHOLD', -'MVC2_ERROR', 'MVC2_LUMA_THRESHOLD', 'NEXT_NOT_AVAILABLE', -'NOISE_MARGIN', 'NONE', 'NUMBER_OF_FRAMES', 'NUMBER_OF_PARAMS', -'ORIENTATION', 'ORIGINAL_FORMAT', 'OpenCompressor', -'OpenDecompressor', 'PARAM_OUT_OF_RANGE', 'PREDICTED', 'PREROLL', -'ParamID', 'ParamNumber', 'ParamType', 'QUALITY_FACTOR', -'QUALITY_LEVEL', 'QueryAlgorithms', 'QueryMaxHeaderSize', -'QueryScheme', 'QuerySchemeFromName', 'RANGE_VALUE', 'RGB', 'RGB332', -'RGB8', 'RGBA', 'RGBX', 'RLE', 'RLE24', 'RTR', 'RTR1', -'RTR_QUALITY_LEVEL', 'SAMPLES_PER_TILE', 'SCHEME_BUSY', -'SCHEME_NOT_AVAILABLE', 'SPEED', 'STEREO_INTERLEAVED', -'STREAM_HEADERS', 'SetDefault', 'SetMax', 'SetMin', 'TILE_THRESHOLD', -'TOP_DOWN', 'ULAW', 'UNCOMPRESSED', 'UNCOMPRESSED_AUDIO', -'UNCOMPRESSED_VIDEO', 'UNKNOWN_SCHEME', 'VIDEO', 'VideoFormatName', -'Y', 'YCbCr', 'YCbCr422', 'YCbCr422DC', 'YCbCr422HC', 'YUV', 'YUV422', -'YUV422DC', 'YUV422HC', '__doc__', '__name__', 'cvt_type', 'error'] - - -# This is a very inobtrusive test for the existence of the cl -# module and all its attributes. - -def main(): - # touch all the attributes of al without doing anything - if verbose: - print('Touching cl module attributes...') - for attr in clattrs: - if verbose: - print('touching: ', attr) - getattr(cl, attr) - -main() diff --git a/Lib/test/test_commands.py b/Lib/test/test_commands.py index d899d66..1b84306 100644 --- a/Lib/test/test_commands.py +++ b/Lib/test/test_commands.py @@ -4,10 +4,6 @@ ''' import unittest import os, tempfile, re -import warnings - -warnings.filterwarnings('ignore', r".*commands.getstatus.. is deprecated", - DeprecationWarning) from test.test_support import TestSkipped, run_unittest, reap_children from commands import * @@ -42,28 +38,10 @@ class CommandTests(unittest.TestCase): if dir is not None: os.rmdir(dir) - def test_getstatus(self): - # This pattern should match 'ls -ld /.' on any posix - # system, however perversely configured. Even on systems - # (e.g., Cygwin) where user and group names can have spaces: - # drwxr-xr-x 15 Administ Domain U 4096 Aug 12 12:50 / - # drwxr-xr-x 15 Joe User My Group 4096 Aug 12 12:50 / - # Note that the first case above has a space in the group name - # while the second one has a space in both names. - pat = r'''d......... # It is a directory. - \+? # It may have ACLs. - \s+\d+ # It has some number of links. - [^/]* # Skip user, group, size, and date. - /\. # and end with the name of the file. - ''' - - self.assert_(re.match(pat, getstatus("/."), re.VERBOSE)) - def test_main(): run_unittest(CommandTests) reap_children() - if __name__ == "__main__": test_main() diff --git a/Lib/test/test_gl.py b/Lib/test/test_gl.py deleted file mode 100755 index adae10e..0000000 --- a/Lib/test/test_gl.py +++ /dev/null @@ -1,150 +0,0 @@ -#! /usr/bin/env python -"""Very simple test script for the SGI gl library extension module - taken mostly from the documentation. - Roger E. Masse -""" -from test.test_support import verbose, TestSkipped -import gl, GL, time - -glattrs = ['RGBcolor', 'RGBcursor', 'RGBmode', 'RGBrange', 'RGBwritemask', -'__doc__', '__name__', 'addtopup', 'altgetmatrix', 'arc', 'arcf', -'arcfi', 'arcfs', 'arci', 'arcs', 'attachcursor', 'backbuffer', -'backface', 'bbox2', 'bbox2i', 'bbox2s', 'bgnclosedline', 'bgnline', -'bgnpoint', 'bgnpolygon', 'bgnsurface', 'bgntmesh', 'bgntrim', -'blankscreen', 'blanktime', 'blendfunction', 'blink', 'c3f', 'c3i', -'c3s', 'c4f', 'c4i', 'c4s', 'callobj', 'charstr', 'chunksize', 'circ', -'circf', 'circfi', 'circfs', 'circi', 'circs', 'clear', -'clearhitcode', 'clkoff', 'clkon', 'closeobj', 'cmode', 'cmov', -'cmov2', 'cmov2i', 'cmov2s', 'cmovi', 'cmovs', 'color', 'colorf', -'compactify', 'concave', 'cpack', 'crv', 'crvn', 'curorigin', -'cursoff', 'curson', 'curstype', 'curvebasis', 'curveit', -'curveprecision', 'cyclemap', 'czclear', 'defbasis', 'defcursor', -'deflinestyle', 'delobj', 'deltag', 'depthcue', 'devport', 'dglclose', -'dglopen', 'dither', 'dopup', 'doublebuffer', 'draw', 'draw2', -'draw2i', 'draw2s', 'drawi', 'drawmode', 'draws', 'editobj', -'endclosedline', 'endfullscrn', 'endline', 'endpick', 'endpoint', -'endpolygon', 'endpupmode', 'endselect', 'endsurface', 'endtmesh', -'endtrim', 'finish', 'font', 'foreground', 'freepup', 'frontbuffer', -'fudge', 'fullscrn', 'gRGBcolor', 'gRGBmask', 'gammaramp', 'gbegin', -'gconfig', 'genobj', 'gentag', 'getbackface', 'getbuffer', -'getbutton', 'getcmmode', 'getcolor', 'getcpos', 'getcursor', -'getdcm', 'getdepth', 'getdescender', 'getdisplaymode', 'getdrawmode', -'getfont', 'getgdesc', 'getgpos', 'getheight', 'gethitcode', -'getlsbackup', 'getlsrepeat', 'getlstyle', 'getlwidth', 'getmap', -'getmatrix', 'getmcolor', 'getmmode', 'getmonitor', -'getnurbsproperty', 'getopenobj', 'getorigin', 'getothermonitor', -'getpattern', 'getplanes', 'getport', 'getresetls', 'getscrmask', -'getshade', 'getsize', 'getsm', 'gettp', 'getvaluator', 'getvideo', -'getviewport', 'getwritemask', 'getzbuffer', 'gewrite', 'gflush', -'ginit', 'glcompat', 'greset', 'gselect', 'gsync', 'gversion', -'iconsize', 'icontitle', 'imakebackground', 'initnames', 'ismex', -'isobj', 'isqueued', 'istag', 'keepaspect', 'lRGBrange', 'lampoff', -'lampon', 'linesmooth', 'linewidth', 'lmbind', 'lmcolor', 'lmdef', -'loadmatrix', 'loadname', 'logicop', 'lookat', 'lrectread', -'lrectwrite', 'lsbackup', 'lsetdepth', 'lshaderange', 'lsrepeat', -'makeobj', 'maketag', 'mapcolor', 'mapw', 'mapw2', 'maxsize', -'minsize', 'mmode', 'move', 'move2', 'move2i', 'move2s', 'movei', -'moves', 'multimap', 'multmatrix', 'n3f', 'newpup', 'newtag', -'noborder', 'noise', 'noport', 'normal', 'nurbscurve', 'nurbssurface', -'nvarray', 'objdelete', 'objinsert', 'objreplace', 'onemap', 'ortho', -'ortho2', 'overlay', 'packrect', 'pagecolor', 'pagewritemask', -'passthrough', 'patch', 'patchbasis', 'patchcurves', 'patchprecision', -'pclos', 'pdr', 'pdr2', 'pdr2i', 'pdr2s', 'pdri', 'pdrs', -'perspective', 'pick', 'picksize', 'pixmode', 'pmv', 'pmv2', 'pmv2i', -'pmv2s', 'pmvi', 'pmvs', 'pnt', 'pnt2', 'pnt2i', 'pnt2s', 'pnti', -'pnts', 'pntsmooth', 'polarview', 'polf', 'polf2', 'polf2i', 'polf2s', -'polfi', 'polfs', 'poly', 'poly2', 'poly2i', 'poly2s', 'polyi', -'polys', 'popattributes', 'popmatrix', 'popname', 'popviewport', -'prefposition', 'prefsize', 'pupmode', 'pushattributes', 'pushmatrix', -'pushname', 'pushviewport', 'pwlcurve', 'qdevice', 'qenter', 'qgetfd', -'qread', 'qreset', 'qtest', 'rcrv', 'rcrvn', 'rdr', 'rdr2', 'rdr2i', -'rdr2s', 'rdri', 'rdrs', 'readdisplay', 'readsource', 'rect', -'rectcopy', 'rectf', 'rectfi', 'rectfs', 'recti', 'rects', 'rectzoom', -'resetls', 'reshapeviewport', 'ringbell', 'rmv', 'rmv2', 'rmv2i', -'rmv2s', 'rmvi', 'rmvs', 'rot', 'rotate', 'rpatch', 'rpdr', 'rpdr2', -'rpdr2i', 'rpdr2s', 'rpdri', 'rpdrs', 'rpmv', 'rpmv2', 'rpmv2i', -'rpmv2s', 'rpmvi', 'rpmvs', 'sbox', 'sboxf', 'sboxfi', 'sboxfs', -'sboxi', 'sboxs', 'scale', 'screenspace', 'scrmask', 'setbell', -'setcursor', 'setdepth', 'setlinestyle', 'setmap', 'setmonitor', -'setnurbsproperty', 'setpattern', 'setpup', 'setshade', 'setvaluator', -'setvideo', 'shademodel', 'shaderange', 'singlebuffer', 'smoothline', -'spclos', 'splf', 'splf2', 'splf2i', 'splf2s', 'splfi', 'splfs', -'stepunit', 'strwidth', 'subpixel', 'swapbuffers', 'swapinterval', -'swaptmesh', 'swinopen', 'textcolor', 'textinit', 'textport', -'textwritemask', 'tie', 'tpoff', 'tpon', 'translate', 'underlay', -'unpackrect', 'unqdevice', 'v2d', 'v2f', 'v2i', 'v2s', 'v3d', 'v3f', -'v3i', 'v3s', 'v4d', 'v4f', 'v4i', 'v4s', 'varray', 'videocmd', -'viewport', 'vnarray', 'winattach', 'winclose', 'winconstraints', -'windepth', 'window', 'winget', 'winmove', 'winopen', 'winpop', -'winposition', 'winpush', 'winset', 'wintitle', 'wmpack', 'writemask', -'writepixels', 'xfpt', 'xfpt2', 'xfpt2i', 'xfpt2s', 'xfpt4', 'xfpt4i', -'xfpt4s', 'xfpti', 'xfpts', 'zbuffer', 'zclear', 'zdraw', 'zfunction', -'zsource', 'zwritemask'] - -def main(): - # insure that we at least have an X display before continuing. - import os - try: - display = os.environ['DISPLAY'] - except: - raise TestSkipped, "No $DISPLAY -- skipping gl test" - - # touch all the attributes of gl without doing anything - if verbose: - print('Touching gl module attributes...') - for attr in glattrs: - if verbose: - print('touching: ', attr) - getattr(gl, attr) - - # create a small 'Crisscross' window - if verbose: - print('Creating a small "CrissCross" window...') - print('foreground') - gl.foreground() - if verbose: - print('prefposition') - gl.prefposition(500, 900, 500, 900) - if verbose: - print('winopen "CrissCross"') - w = gl.winopen('CrissCross') - if verbose: - print('clear') - gl.clear() - if verbose: - print('ortho2') - gl.ortho2(0.0, 400.0, 0.0, 400.0) - if verbose: - print('color WHITE') - gl.color(GL.WHITE) - if verbose: - print('color RED') - gl.color(GL.RED) - if verbose: - print('bgnline') - gl.bgnline() - if verbose: - print('v2f') - gl.v2f(0.0, 0.0) - gl.v2f(400.0, 400.0) - if verbose: - print('endline') - gl.endline() - if verbose: - print('bgnline') - gl.bgnline() - if verbose: - print('v2i') - gl.v2i(400, 0) - gl.v2i(0, 400) - if verbose: - print('endline') - gl.endline() - if verbose: - print('Displaying window for 2 seconds...') - time.sleep(2) - if verbose: - print('winclose') - gl.winclose(w) - -main() diff --git a/Lib/test/test_imgfile.py b/Lib/test/test_imgfile.py deleted file mode 100755 index 4e31cb1..0000000 --- a/Lib/test/test_imgfile.py +++ /dev/null @@ -1,116 +0,0 @@ -#! /usr/bin/env python - -"""Simple test script for imgfile.c - Roger E. Masse -""" - -from test.test_support import verbose, unlink, findfile - -import imgfile, uu, os - - -def main(): - - uu.decode(findfile('testrgb.uue'), 'test.rgb') - uu.decode(findfile('greyrgb.uue'), 'greytest.rgb') - - # Test a 3 byte color image - testimage('test.rgb') - - # Test a 1 byte greyscale image - testimage('greytest.rgb') - - unlink('test.rgb') - unlink('greytest.rgb') - -def testimage(name): - """Run through the imgfile's battery of possible methods - on the image passed in name. - """ - - import sys - import os - - outputfile = '/tmp/deleteme' - - # try opening the name directly - try: - # This function returns a tuple (x, y, z) where x and y are the size - # of the image in pixels and z is the number of bytes per pixel. Only - # 3 byte RGB pixels and 1 byte greyscale pixels are supported. - sizes = imgfile.getsizes(name) - except imgfile.error: - # get a more qualified path component of the script... - if __name__ == '__main__': - ourname = sys.argv[0] - else: # ...or the full path of the module - ourname = sys.modules[__name__].__file__ - - parts = ourname.split(os.sep) - parts[-1] = name - name = os.sep.join(parts) - sizes = imgfile.getsizes(name) - if verbose: - print('Opening test image: %s, sizes: %s' % (name, str(sizes))) - # This function reads and decodes the image on the specified file, - # and returns it as a python string. The string has either 1 byte - # greyscale pixels or 4 byte RGBA pixels. The bottom left pixel - # is the first in the string. This format is suitable to pass - # to gl.lrectwrite, for instance. - image = imgfile.read(name) - - # This function writes the RGB or greyscale data in data to - # image file file. x and y give the size of the image, z is - # 1 for 1 byte greyscale images or 3 for RGB images (which - # are stored as 4 byte values of which only the lower three - # bytes are used). These are the formats returned by gl.lrectread. - if verbose: - print('Writing output file') - imgfile.write (outputfile, image, sizes[0], sizes[1], sizes[2]) - - - if verbose: - print('Opening scaled test image: %s, sizes: %s' % (name, str(sizes))) - # This function is identical to read but it returns an image that - # is scaled to the given x and y sizes. If the filter and blur - # parameters are omitted scaling is done by simply dropping - # or duplicating pixels, so the result will be less than perfect, - # especially for computer-generated images. Alternatively, - # you can specify a filter to use to smoothen the image after - # scaling. The filter forms supported are 'impulse', 'box', - # 'triangle', 'quadratic' and 'gaussian'. If a filter is - # specified blur is an optional parameter specifying the - # blurriness of the filter. It defaults to 1.0. readscaled - # makes no attempt to keep the aspect ratio correct, so that - # is the users' responsibility. - if verbose: - print('Filtering with "impulse"') - simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'impulse', 2.0) - - # This function sets a global flag which defines whether the - # scan lines of the image are read or written from bottom to - # top (flag is zero, compatible with SGI GL) or from top to - # bottom(flag is one, compatible with X). The default is zero. - if verbose: - print('Switching to X compatibility') - imgfile.ttob (1) - - if verbose: - print('Filtering with "triangle"') - simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'triangle', 3.0) - if verbose: - print('Switching back to SGI compatibility') - imgfile.ttob (0) - - if verbose: print('Filtering with "quadratic"') - simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'quadratic') - if verbose: print('Filtering with "gaussian"') - simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'gaussian', 1.0) - - if verbose: - print('Writing output file') - imgfile.write (outputfile, simage, sizes[0]/2, sizes[1]/2, sizes[2]) - - os.unlink(outputfile) - -main() diff --git a/Lib/test/test_listcomps.py b/Lib/test/test_listcomps.py index 6590777..684b716 100644 --- a/Lib/test/test_listcomps.py +++ b/Lib/test/test_listcomps.py @@ -435,7 +435,7 @@ def test_main(verbose=None): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_doctest(test_genexps, verbose) + test_support.run_doctest(test_listcomps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) diff --git a/Lib/test/test_setcomps.py b/Lib/test/test_setcomps.py index 021fd96..7b09527 100644 --- a/Lib/test/test_setcomps.py +++ b/Lib/test/test_setcomps.py @@ -436,15 +436,15 @@ __test__ = {'doctests' : doctests} def test_main(verbose=None): import sys from test import test_support - from test import test_listcomps - test_support.run_doctest(test_listcomps, verbose) + from test import test_setcomps + test_support.run_doctest(test_setcomps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_doctest(test_genexps, verbose) + test_support.run_doctest(test_setcomps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py new file mode 100644 index 0000000..557e449 --- /dev/null +++ b/Lib/test/test_unpack_ex.py @@ -0,0 +1,157 @@ +# Tests for extended unpacking, starred expressions. + +doctests = """ + +Unpack tuple + + >>> t = (1, 2, 3) + >>> a, *b, c = t + >>> a == 1 and b == [2] and c == 3 + True + +Unpack list + + >>> l = [4, 5, 6] + >>> a, *b = l + >>> a == 4 and b == [5, 6] + True + +Unpack implied tuple + + >>> *a, = 7, 8, 9 + >>> a == [7, 8, 9] + True + +Unpack string... fun! + + >>> a, *b = 'one' + >>> a == 'o' and b == ['n', 'e'] + True + +Unpack long sequence + + >>> a, b, c, *d, e, f, g = range(10) + >>> (a, b, c, d, e, f, g) == (0, 1, 2, [3, 4, 5, 6], 7, 8, 9) + True + +Unpack short sequence + + >>> a, *b, c = (1, 2) + >>> a == 1 and c == 2 and b == [] + True + +Unpack generic sequence + + >>> class Seq: + ... def __getitem__(self, i): + ... if i >= 0 and i < 3: return i + ... raise IndexError + ... + >>> a, *b = Seq() + >>> a == 0 and b == [1, 2] + True + +Unpack in for statement + + >>> for a, *b, c in [(1,2,3), (4,5,6,7)]: + ... print(a, b, c) + ... + 1 [2] 3 + 4 [5, 6] 7 + +Unpack in list + + >>> [a, *b, c] = range(5) + >>> a == 0 and b == [1, 2, 3] and c == 4 + True + +Multiple targets + + >>> a, *b, c = *d, e = range(5) + >>> a == 0 and b == [1, 2, 3] and c == 4 and d == [0, 1, 2, 3] and e == 4 + True + +Now for some failures + +Unpacking non-sequence + + >>> a, *b = 7 + Traceback (most recent call last): + ... + TypeError: 'int' object is not iterable + +Unpacking sequence too short + + >>> a, *b, c, d, e = Seq() + Traceback (most recent call last): + ... + ValueError: need more than 3 values to unpack + +Unpacking a sequence where the test for too long raises a different kind of +error + + >>> class BozoError(Exception): + ... pass + ... + >>> class BadSeq: + ... def __getitem__(self, i): + ... if i >= 0 and i < 3: + ... return i + ... elif i == 3: + ... raise BozoError + ... else: + ... raise IndexError + ... + +Trigger code while not expecting an IndexError (unpack sequence too long, wrong +error) + + >>> a, *b, c, d, e = BadSeq() + Traceback (most recent call last): + ... + test.test_unpack_ex.BozoError + +Now some general starred expressions (all fail). + + >>> a, *b, c, *d, e = range(10) # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: two starred expressions in assignment (...) + + >>> [*b, *c] = range(10) # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: two starred expressions in assignment (...) + + >>> *a = range(10) # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: starred assignment target must be in a list or tuple (...) + + >>> *a # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can use starred expression only as assignment target (...) + + >>> *1 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can use starred expression only as assignment target (...) + + >>> x = *a # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can use starred expression only as assignment target (...) + +""" + +__test__ = {'doctests' : doctests} + +def test_main(verbose=False): + import sys + from test import test_support + from test import test_unpack_ex + test_support.run_doctest(test_unpack_ex, verbose) + +if __name__ == "__main__": + test_main(verbose=True) diff --git a/Misc/NEWS b/Misc/NEWS index 729cbc7..b9c8ef9 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,6 +26,9 @@ TO DO Core and Builtins ----------------- +- PEP 3132 was accepted. That means that you can do ``a, *b = range(5)`` + to assign 0 to a and [1, 2, 3, 4] to b. + - range() now returns an iterator rather than a list. Floats are not allowed. xrange() is no longer defined. @@ -172,6 +175,12 @@ Extension Modules Library ------- +- Remove obsolete IRIX modules: al, cd, cl, fl, fm, gl, imgfile, sgi, sv. + +- Remove bsddb185 module it was obsolete. + +- Remove commands.getstatus() it was obsolete. + - Remove functions in string and strop modules that are also string methods. - Remove obsolete modules: xmllib, stringold. diff --git a/Modules/Setup.dist b/Modules/Setup.dist index 173dfcc..363eb8e 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -133,11 +133,6 @@ zipimport zipimport.c # The Python symtable module depends on .h files that setup.py doesn't track _symtable symtablemodule.c -# The SGI specific GL module: - -GLHACK=-Dclear=__GLclear -#gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11 - # Pure module. Cannot be linked dynamically. # -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE #WHICH_PURE_PRODUCTS=-DWITH_ALL_PURE @@ -250,42 +245,6 @@ GLHACK=-Dclear=__GLclear #_sha shamodule.c -# SGI IRIX specific modules -- off by default. - -# These module work on any SGI machine: - -# *** gl must be enabled higher up in this file *** -#fm fmmodule.c $(GLHACK) -lfm -lgl # Font Manager -#sgi sgimodule.c # sgi.nap() and a few more - -# This module requires the header file -# /usr/people/4Dgifts/iristools/include/izoom.h: -#imgfile imgfile.c -limage -lgutil -lgl -lm # Image Processing Utilities - - -# These modules require the Multimedia Development Option (I think): - -#al almodule.c -laudio # Audio Library -#cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library -#cl clmodule.c -lcl -lawareaudio # Compression Library -#sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11 # Starter Video - - -# The FORMS library, by Mark Overmars, implements user interface -# components such as dialogs and buttons using SGI's GL and FM -# libraries. You must ftp the FORMS library separately from -# ftp://ftp.cs.ruu.nl/pub/SGI/FORMS. It was tested with FORMS 2.2a. -# NOTE: if you want to be able to use FORMS and curses simultaneously -# (or both link them statically into the same binary), you must -# compile all of FORMS with the cc option "-Dclear=__GLclear". - -# The FORMS variable must point to the FORMS subdirectory of the forms -# toplevel directory: - -#FORMS=/ufs/guido/src/forms/FORMS -#fl flmodule.c -I$(FORMS) $(GLHACK) $(FORMS)/libforms.a -lfm -lgl - - # SunOS specific modules -- off by default: #sunaudiodev sunaudiodev.c @@ -409,17 +368,6 @@ GLHACK=-Dclear=__GLclear #DBLIB=$(DB)/lib #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER) -# Historical Berkeley DB 1.85 -# -# This module is deprecated; the 1.85 version of the Berkeley DB library has -# bugs that can cause data corruption. If you can, use later versions of the -# library instead, available from . - -#DB=/depot/sundry/src/berkeley-db/db.1.85 -#DBPORT=$(DB)/PORT/irix.5.3 -#bsddb185 bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a - - # Helper module for various ascii-encoders #binascii binascii.c diff --git a/Modules/almodule.c b/Modules/almodule.c deleted file mode 100644 index 0a45d2e..0000000 --- a/Modules/almodule.c +++ /dev/null @@ -1,3226 +0,0 @@ - -#define OLD_INTERFACE /* define for pre-Irix 6 interface */ - -#include "Python.h" -#include "stringobject.h" -#include -#include - -#ifndef AL_NO_ELEM -#ifndef OLD_INTERFACE -#define OLD_INTERFACE -#endif /* OLD_INTERFACE */ -#endif /* AL_NO_ELEM */ - -static PyObject *ErrorObject; - -/* ----------------------------------------------------- */ - -/* Declarations for objects of type port */ - -typedef struct { - PyObject_HEAD - /* XXXX Add your own stuff here */ - ALport port; -} alpobject; - -static PyTypeObject Alptype; - - - -/* ---------------------------------------------------------------- */ - -/* Declarations for objects of type config */ - -typedef struct { - PyObject_HEAD - /* XXXX Add your own stuff here */ - ALconfig config; -} alcobject; - -static PyTypeObject Alctype; - - -static void -ErrorHandler(long code, const char *fmt, ...) -{ - va_list args; - char buf[128]; - - va_start(args, fmt); - vsprintf(buf, fmt, args); - va_end(args); - PyErr_SetString(ErrorObject, buf); -} - -#ifdef AL_NO_ELEM /* IRIX 6 */ - -static PyObject * -param2python(int resource, int param, ALvalue value, ALparamInfo *pinfo) -{ - ALparamInfo info; - - if (pinfo == NULL) { - pinfo = &info; - if (alGetParamInfo(resource, param, &info) < 0) - return NULL; - } - switch (pinfo->elementType) { - case AL_PTR_ELEM: - /* XXXX don't know how to handle this */ - case AL_NO_ELEM: - Py_INCREF(Py_None); - return Py_None; - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - return PyInt_FromLong((long) value.i); - case AL_INT64_ELEM: - return PyLong_FromLongLong(value.ll); - case AL_FIXED_ELEM: - return PyFloat_FromDouble(alFixedToDouble(value.ll)); - case AL_CHAR_ELEM: - if (value.ptr == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString((char *) value.ptr); - default: - PyErr_SetString(ErrorObject, "unknown element type"); - return NULL; - } -} - -static int -python2elem(PyObject *item, void *ptr, int elementType) -{ - switch (elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - if (!PyInt_Check(item)) { - PyErr_BadArgument(); - return -1; - } - *((int *) ptr) = PyInt_AsLong(item); - break; - case AL_INT64_ELEM: - if (PyInt_Check(item)) - *((long long *) ptr) = PyInt_AsLong(item); - else if (PyLong_Check(item)) - *((long long *) ptr) = PyLong_AsLongLong(item); - else { - PyErr_BadArgument(); - return -1; - } - break; - case AL_FIXED_ELEM: - if (PyInt_Check(item)) - *((long long *) ptr) = alDoubleToFixed((double) PyInt_AsLong(item)); - else if (PyFloat_Check(item)) - *((long long *) ptr) = alDoubleToFixed(PyFloat_AsDouble(item)); - else { - PyErr_BadArgument(); - return -1; - } - break; - default: - PyErr_SetString(ErrorObject, "unknown element type"); - return -1; - } - return 0; -} - -static int -python2param(int resource, ALpv *param, PyObject *value, ALparamInfo *pinfo) -{ - ALparamInfo info; - int i, stepsize; - PyObject *item; - - if (pinfo == NULL) { - pinfo = &info; - if (alGetParamInfo(resource, param->param, &info) < 0) - return -1; - } - switch (pinfo->valueType) { - case AL_STRING_VAL: - if (pinfo->elementType != AL_CHAR_ELEM) { - PyErr_SetString(ErrorObject, "unknown element type"); - return -1; - } - if (!PyString_Check(value)) { - PyErr_BadArgument(); - return -1; - } - param->value.ptr = PyString_AS_STRING(value); - param->sizeIn = PyString_GET_SIZE(value)+1; /*account for NUL*/ - break; - case AL_SET_VAL: - case AL_VECTOR_VAL: - if (!PyList_Check(value) && !PyTuple_Check(value)) { - PyErr_BadArgument(); - return -1; - } - switch (pinfo->elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - param->sizeIn = PySequence_Size(value); - param->value.ptr = PyMem_NEW(int, param->sizeIn); - stepsize = sizeof(int); - break; - case AL_INT64_ELEM: - case AL_FIXED_ELEM: - param->sizeIn = PySequence_Size(value); - param->value.ptr = PyMem_NEW(long long, param->sizeIn); - stepsize = sizeof(long long); - break; - } - for (i = 0; i < param->sizeIn; i++) { - item = PySequence_GetItem(value, i); - if (python2elem(item, (void *) ((char *) param->value.ptr + i*stepsize), pinfo->elementType) < 0) { - PyMem_DEL(param->value.ptr); - return -1; - } - } - break; - case AL_SCALAR_VAL: - switch (pinfo->elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - return python2elem(value, (void *) ¶m->value.i, - pinfo->elementType); - case AL_INT64_ELEM: - case AL_FIXED_ELEM: - return python2elem(value, (void *) ¶m->value.ll, - pinfo->elementType); - default: - PyErr_SetString(ErrorObject, "unknown element type"); - return -1; - } - } - return 0; -} - -static int -python2params(int resource1, int resource2, PyObject *list, ALpv **pvsp, ALparamInfo **pinfop) -{ - PyObject *item; - ALpv *pvs; - ALparamInfo *pinfo; - int npvs, i; - - npvs = PyList_Size(list); - pvs = PyMem_NEW(ALpv, npvs); - pinfo = PyMem_NEW(ALparamInfo, npvs); - for (i = 0; i < npvs; i++) { - item = PyList_GetItem(list, i); - if (!PyArg_ParseTuple(item, "iO", &pvs[i].param, &item)) - goto error; - if (alGetParamInfo(resource1, pvs[i].param, &pinfo[i]) < 0 && - alGetParamInfo(resource2, pvs[i].param, &pinfo[i]) < 0) - goto error; - if (python2param(resource1, &pvs[i], item, &pinfo[i]) < 0) - goto error; - } - - *pvsp = pvs; - *pinfop = pinfo; - return npvs; - - error: - /* XXXX we should clean up everything */ - if (pvs) - PyMem_DEL(pvs); - if (pinfo) - PyMem_DEL(pinfo); - return -1; -} - -/* -------------------------------------------------------- */ - - -static PyObject * -SetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig, int)) -{ - int par; - - if (!PyArg_ParseTuple(args, "i:SetConfig", &par)) - return NULL; - - if ((*func)(self->config, par) == -1) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -GetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig)) -{ - int par; - - if (!PyArg_ParseTuple(args, ":GetConfig")) - return NULL; - - if ((par = (*func)(self->config)) == -1) - return NULL; - - return PyInt_FromLong((long) par); -} - -PyDoc_STRVAR(alc_SetWidth__doc__, -"alSetWidth: set the wordsize for integer audio data."); - -static PyObject * -alc_SetWidth(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetWidth); -} - - -PyDoc_STRVAR(alc_GetWidth__doc__, -"alGetWidth: get the wordsize for integer audio data."); - -static PyObject * -alc_GetWidth(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetWidth); -} - - -PyDoc_STRVAR(alc_SetSampFmt__doc__, -"alSetSampFmt: set the sample format setting in an audio ALconfig " -"structure."); - -static PyObject * -alc_SetSampFmt(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetSampFmt); -} - - -PyDoc_STRVAR(alc_GetSampFmt__doc__, -"alGetSampFmt: get the sample format setting in an audio ALconfig " -"structure."); - -static PyObject * -alc_GetSampFmt(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetSampFmt); -} - - -PyDoc_STRVAR(alc_SetChannels__doc__, -"alSetChannels: set the channel settings in an audio ALconfig."); - -static PyObject * -alc_SetChannels(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetChannels); -} - - -PyDoc_STRVAR(alc_GetChannels__doc__, -"alGetChannels: get the channel settings in an audio ALconfig."); - -static PyObject * -alc_GetChannels(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetChannels); -} - - -PyDoc_STRVAR(alc_SetFloatMax__doc__, -"alSetFloatMax: set the maximum value of floating point sample data."); - -static PyObject * -alc_SetFloatMax(alcobject *self, PyObject *args) -{ - double maximum_value; - - if (!PyArg_ParseTuple(args, "d:SetFloatMax", &maximum_value)) - return NULL; - if (alSetFloatMax(self->config, maximum_value) < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alc_GetFloatMax__doc__, -"alGetFloatMax: get the maximum value of floating point sample data."); - -static PyObject * -alc_GetFloatMax(alcobject *self, PyObject *args) -{ - double maximum_value; - - if (!PyArg_ParseTuple(args, ":GetFloatMax")) - return NULL; - if ((maximum_value = alGetFloatMax(self->config)) == 0) - return NULL; - return PyFloat_FromDouble(maximum_value); -} - - -PyDoc_STRVAR(alc_SetDevice__doc__, -"alSetDevice: set the device setting in an audio ALconfig structure."); - -static PyObject * -alc_SetDevice(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetDevice); -} - - -PyDoc_STRVAR(alc_GetDevice__doc__, -"alGetDevice: get the device setting in an audio ALconfig structure."); - -static PyObject * -alc_GetDevice(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetDevice); -} - - -PyDoc_STRVAR(alc_SetQueueSize__doc__, -"alSetQueueSize: set audio port buffer size."); - -static PyObject * -alc_SetQueueSize(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetQueueSize); -} - - -PyDoc_STRVAR(alc_GetQueueSize__doc__, -"alGetQueueSize: get audio port buffer size."); - -static PyObject * -alc_GetQueueSize(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetQueueSize); -} - -#endif /* AL_NO_ELEM */ - -static PyObject * -setconfig(alcobject *self, PyObject *args, int (*func)(ALconfig, long)) -{ - long par; - - if (!PyArg_ParseTuple(args, "l:SetConfig", &par)) - return NULL; - - if ((*func)(self->config, par) == -1) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -getconfig(alcobject *self, PyObject *args, long (*func)(ALconfig)) -{ - long par; - - if (!PyArg_ParseTuple(args, ":GetConfig")) - return NULL; - - if ((par = (*func)(self->config)) == -1) - return NULL; - - return PyInt_FromLong((long) par); -} - -static PyObject * -alc_setqueuesize (alcobject *self, PyObject *args) -{ - return setconfig(self, args, ALsetqueuesize); -} - -static PyObject * -alc_getqueuesize (alcobject *self, PyObject *args) -{ - return getconfig(self, args, ALgetqueuesize); -} - -static PyObject * -alc_setwidth (alcobject *self, PyObject *args) -{ - return setconfig(self, args, ALsetwidth); -} - -static PyObject * -alc_getwidth (alcobject *self, PyObject *args) -{ - return getconfig(self, args, ALgetwidth); -} - -static PyObject * -alc_getchannels (alcobject *self, PyObject *args) -{ - return getconfig(self, args, ALgetchannels); -} - -static PyObject * -alc_setchannels (alcobject *self, PyObject *args) -{ - return setconfig(self, args, ALsetchannels); -} - -#ifdef AL_405 - -static PyObject * -alc_getsampfmt (alcobject *self, PyObject *args) -{ - return getconfig(self, args, ALgetsampfmt); -} - -static PyObject * -alc_setsampfmt (alcobject *self, PyObject *args) -{ - return setconfig(self, args, ALsetsampfmt); -} - -static PyObject * -alc_getfloatmax(alcobject *self, PyObject *args) -{ - double arg; - - if (!PyArg_ParseTuple(args, ":GetFloatMax")) - return 0; - if ((arg = ALgetfloatmax(self->config)) == 0) - return NULL; - return PyFloat_FromDouble(arg); -} - -static PyObject * -alc_setfloatmax(alcobject *self, PyObject *args) -{ - double arg; - - if (!PyArg_ParseTuple(args, "d:SetFloatMax", &arg)) - return 0; - if (ALsetfloatmax(self->config, arg) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} -#endif /* AL_405 */ - -static struct PyMethodDef alc_methods[] = { -#ifdef AL_NO_ELEM /* IRIX 6 */ - {"SetWidth", (PyCFunction)alc_SetWidth, METH_VARARGS, alc_SetWidth__doc__}, - {"GetWidth", (PyCFunction)alc_GetWidth, METH_VARARGS, alc_GetWidth__doc__}, - {"SetSampFmt", (PyCFunction)alc_SetSampFmt, METH_VARARGS, alc_SetSampFmt__doc__}, - {"GetSampFmt", (PyCFunction)alc_GetSampFmt, METH_VARARGS, alc_GetSampFmt__doc__}, - {"SetChannels", (PyCFunction)alc_SetChannels, METH_VARARGS, alc_SetChannels__doc__}, - {"GetChannels", (PyCFunction)alc_GetChannels, METH_VARARGS, alc_GetChannels__doc__}, - {"SetFloatMax", (PyCFunction)alc_SetFloatMax, METH_VARARGS, alc_SetFloatMax__doc__}, - {"GetFloatMax", (PyCFunction)alc_GetFloatMax, METH_VARARGS, alc_GetFloatMax__doc__}, - {"SetDevice", (PyCFunction)alc_SetDevice, METH_VARARGS, alc_SetDevice__doc__}, - {"GetDevice", (PyCFunction)alc_GetDevice, METH_VARARGS, alc_GetDevice__doc__}, - {"SetQueueSize", (PyCFunction)alc_SetQueueSize, METH_VARARGS, alc_SetQueueSize__doc__}, - {"GetQueueSize", (PyCFunction)alc_GetQueueSize, METH_VARARGS, alc_GetQueueSize__doc__}, -#endif /* AL_NO_ELEM */ - {"getqueuesize", (PyCFunction)alc_getqueuesize, METH_VARARGS}, - {"setqueuesize", (PyCFunction)alc_setqueuesize, METH_VARARGS}, - {"getwidth", (PyCFunction)alc_getwidth, METH_VARARGS}, - {"setwidth", (PyCFunction)alc_setwidth, METH_VARARGS}, - {"getchannels", (PyCFunction)alc_getchannels, METH_VARARGS}, - {"setchannels", (PyCFunction)alc_setchannels, METH_VARARGS}, -#ifdef AL_405 - {"getsampfmt", (PyCFunction)alc_getsampfmt, METH_VARARGS}, - {"setsampfmt", (PyCFunction)alc_setsampfmt, METH_VARARGS}, - {"getfloatmax", (PyCFunction)alc_getfloatmax, METH_VARARGS}, - {"setfloatmax", (PyCFunction)alc_setfloatmax, METH_VARARGS}, -#endif /* AL_405 */ - - {NULL, NULL} /* sentinel */ -}; - -/* ---------- */ - - -static PyObject * -newalcobject(ALconfig config) -{ - alcobject *self; - - self = PyObject_New(alcobject, &Alctype); - if (self == NULL) - return NULL; - /* XXXX Add your own initializers here */ - self->config = config; - return (PyObject *) self; -} - - -static void -alc_dealloc(alcobject *self) -{ - /* XXXX Add your own cleanup code here */ -#ifdef AL_NO_ELEM /* IRIX 6 */ - (void) alFreeConfig(self->config); /* ignore errors */ -#else - (void) ALfreeconfig(self->config); /* ignore errors */ -#endif - PyObject_Del(self); -} - -static PyObject * -alc_getattr(alcobject *self, char *name) -{ - /* XXXX Add your own getattr code here */ - return Py_FindMethod(alc_methods, (PyObject *)self, name); -} - -PyDoc_STRVAR(Alctype__doc__, ""); - -static PyTypeObject Alctype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "al.config", /*tp_name*/ - sizeof(alcobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)alc_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)alc_getattr, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - - /* Space for future expansion */ - 0L,0L,0L,0L, - Alctype__doc__ /* Documentation string */ -}; - -/* End of code for config objects */ -/* ---------------------------------------------------------------- */ - -#ifdef AL_NO_ELEM /* IRIX 6 */ - -PyDoc_STRVAR(alp_SetConfig__doc__, -"alSetConfig: set the ALconfig of an audio ALport."); - -static PyObject * -alp_SetConfig(alpobject *self, PyObject *args) -{ - alcobject *config; - if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config)) - return NULL; - if (alSetConfig(self->port, config->config) < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alp_GetConfig__doc__, -"alGetConfig: get the ALconfig of an audio ALport."); - -static PyObject * -alp_GetConfig(alpobject *self, PyObject *args) -{ - ALconfig config; - if (!PyArg_ParseTuple(args, ":GetConfig")) - return NULL; - if ((config = alGetConfig(self->port)) == NULL) - return NULL; - return newalcobject(config); -} - - -PyDoc_STRVAR(alp_GetResource__doc__, -"alGetResource: get the resource associated with an audio port."); - -static PyObject * -alp_GetResource(alpobject *self, PyObject *args) -{ - int resource; - - if (!PyArg_ParseTuple(args, ":GetResource")) - return NULL; - if ((resource = alGetResource(self->port)) == 0) - return NULL; - return PyInt_FromLong((long) resource); -} - - -PyDoc_STRVAR(alp_GetFD__doc__, -"alGetFD: get the file descriptor for an audio port."); - -static PyObject * -alp_GetFD(alpobject *self, PyObject *args) -{ - int fd; - - if (!PyArg_ParseTuple(args, ":GetFD")) - return NULL; - - if ((fd = alGetFD(self->port)) < 0) - return NULL; - - return PyInt_FromLong((long) fd); -} - - -PyDoc_STRVAR(alp_GetFilled__doc__, -"alGetFilled: return the number of filled sample frames in " -"an audio port."); - -static PyObject * -alp_GetFilled(alpobject *self, PyObject *args) -{ - int filled; - - if (!PyArg_ParseTuple(args, ":GetFilled")) - return NULL; - if ((filled = alGetFilled(self->port)) < 0) - return NULL; - return PyInt_FromLong((long) filled); -} - - -PyDoc_STRVAR(alp_GetFillable__doc__, -"alGetFillable: report the number of unfilled sample frames " -"in an audio port."); - -static PyObject * -alp_GetFillable(alpobject *self, PyObject *args) -{ - int fillable; - - if (!PyArg_ParseTuple(args, ":GetFillable")) - return NULL; - if ((fillable = alGetFillable(self->port)) < 0) - return NULL; - return PyInt_FromLong((long) fillable); -} - - -PyDoc_STRVAR(alp_ReadFrames__doc__, -"alReadFrames: read sample frames from an audio port."); - -static PyObject * -alp_ReadFrames(alpobject *self, PyObject *args) -{ - int framecount; - PyObject *v; - int size; - int ch; - ALconfig c; - - if (!PyArg_ParseTuple(args, "i:ReadFrames", &framecount)) - return NULL; - if (framecount < 0) { - PyErr_SetString(ErrorObject, "negative framecount"); - return NULL; - } - c = alGetConfig(self->port); - switch (alGetSampFmt(c)) { - case AL_SAMPFMT_TWOSCOMP: - switch (alGetWidth(c)) { - case AL_SAMPLE_8: - size = 1; - break; - case AL_SAMPLE_16: - size = 2; - break; - case AL_SAMPLE_24: - size = 4; - break; - default: - PyErr_SetString(ErrorObject, "can't determine width"); - alFreeConfig(c); - return NULL; - } - break; - case AL_SAMPFMT_FLOAT: - size = 4; - break; - case AL_SAMPFMT_DOUBLE: - size = 8; - break; - default: - PyErr_SetString(ErrorObject, "can't determine format"); - alFreeConfig(c); - return NULL; - } - ch = alGetChannels(c); - alFreeConfig(c); - if (ch < 0) { - PyErr_SetString(ErrorObject, "can't determine # of channels"); - return NULL; - } - size *= ch; - v = PyString_FromStringAndSize((char *) NULL, size * framecount); - if (v == NULL) - return NULL; - - Py_BEGIN_ALLOW_THREADS - alReadFrames(self->port, (void *) PyString_AS_STRING(v), framecount); - Py_END_ALLOW_THREADS - - return v; -} - - -PyDoc_STRVAR(alp_DiscardFrames__doc__, -"alDiscardFrames: discard audio from an audio port."); - -static PyObject * -alp_DiscardFrames(alpobject *self, PyObject *args) -{ - int framecount; - - if (!PyArg_ParseTuple(args, "i:DiscardFrames", &framecount)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - framecount = alDiscardFrames(self->port, framecount); - Py_END_ALLOW_THREADS - - if (framecount < 0) - return NULL; - - return PyInt_FromLong((long) framecount); -} - - -PyDoc_STRVAR(alp_ZeroFrames__doc__, -"alZeroFrames: write zero-valued sample frames to an audio port."); - -static PyObject * -alp_ZeroFrames(alpobject *self, PyObject *args) -{ - int framecount; - - if (!PyArg_ParseTuple(args, "i:ZeroFrames", &framecount)) - return NULL; - - if (framecount < 0) { - PyErr_SetString(ErrorObject, "negative framecount"); - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - alZeroFrames(self->port, framecount); - Py_END_ALLOW_THREADS - - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alp_SetFillPoint__doc__, -"alSetFillPoint: set low- or high-water mark for an audio port."); - -static PyObject * -alp_SetFillPoint(alpobject *self, PyObject *args) -{ - int fillpoint; - - if (!PyArg_ParseTuple(args, "i:SetFillPoint", &fillpoint)) - return NULL; - - if (alSetFillPoint(self->port, fillpoint) < 0) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alp_GetFillPoint__doc__, -"alGetFillPoint: get low- or high-water mark for an audio port."); - -static PyObject * -alp_GetFillPoint(alpobject *self, PyObject *args) -{ - int fillpoint; - - if (!PyArg_ParseTuple(args, ":GetFillPoint")) - return NULL; - - if ((fillpoint = alGetFillPoint(self->port)) < 0) - return NULL; - - return PyInt_FromLong((long) fillpoint); -} - - -PyDoc_STRVAR(alp_GetFrameNumber__doc__, -"alGetFrameNumber: get the absolute sample frame number " -"associated with a port."); - -static PyObject * -alp_GetFrameNumber(alpobject *self, PyObject *args) -{ - stamp_t fnum; - - if (!PyArg_ParseTuple(args, ":GetFrameNumber")) - return NULL; - - if (alGetFrameNumber(self->port, &fnum) < 0) - return NULL; - - return PyLong_FromLongLong((long long) fnum); -} - - -PyDoc_STRVAR(alp_GetFrameTime__doc__, -"alGetFrameTime: get the time at which a sample frame came " -"in or will go out."); - -static PyObject * -alp_GetFrameTime(alpobject *self, PyObject *args) -{ - stamp_t fnum, time; - PyObject *ret, *v0, *v1; - - if (!PyArg_ParseTuple(args, ":GetFrameTime")) - return NULL; - if (alGetFrameTime(self->port, &fnum, &time) < 0) - return NULL; - v0 = PyLong_FromLongLong((long long) fnum); - v1 = PyLong_FromLongLong((long long) time); - if (PyErr_Occurred()) { - Py_XDECREF(v0); - Py_XDECREF(v1); - return NULL; - } - ret = PyTuple_Pack(2, v0, v1); - Py_DECREF(v0); - Py_DECREF(v1); - return ret; -} - - -PyDoc_STRVAR(alp_WriteFrames__doc__, -"alWriteFrames: write sample frames to an audio port."); - -static PyObject * -alp_WriteFrames(alpobject *self, PyObject *args) -{ - char *samples; - int length; - int size, ch; - ALconfig c; - - if (!PyArg_ParseTuple(args, "s#:WriteFrames", &samples, &length)) - return NULL; - c = alGetConfig(self->port); - switch (alGetSampFmt(c)) { - case AL_SAMPFMT_TWOSCOMP: - switch (alGetWidth(c)) { - case AL_SAMPLE_8: - size = 1; - break; - case AL_SAMPLE_16: - size = 2; - break; - case AL_SAMPLE_24: - size = 4; - break; - default: - PyErr_SetString(ErrorObject, "can't determine width"); - alFreeConfig(c); - return NULL; - } - break; - case AL_SAMPFMT_FLOAT: - size = 4; - break; - case AL_SAMPFMT_DOUBLE: - size = 8; - break; - default: - PyErr_SetString(ErrorObject, "can't determine format"); - alFreeConfig(c); - return NULL; - } - ch = alGetChannels(c); - alFreeConfig(c); - if (ch < 0) { - PyErr_SetString(ErrorObject, "can't determine # of channels"); - return NULL; - } - size *= ch; - if (length % size != 0) { - PyErr_SetString(ErrorObject, - "buffer length not whole number of frames"); - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - alWriteFrames(self->port, (void *) samples, length / size); - Py_END_ALLOW_THREADS - - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alp_ClosePort__doc__, "alClosePort: close an audio port."); - -static PyObject * -alp_ClosePort(alpobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":ClosePort")) - return NULL; - if (alClosePort(self->port) < 0) - return NULL; - self->port = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -#endif /* AL_NO_ELEM */ - -#ifdef OLD_INTERFACE -static PyObject * -alp_closeport(alpobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":ClosePort")) - return NULL; - if (ALcloseport(self->port) < 0) - return NULL; - self->port = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -alp_getfd(alpobject *self, PyObject *args) -{ - int fd; - - if (!PyArg_ParseTuple(args, ":GetFD")) - return NULL; - if ((fd = ALgetfd(self-> port)) == -1) - return NULL; - return PyInt_FromLong(fd); -} - -static PyObject * -alp_getfilled(alpobject *self, PyObject *args) -{ - long count; - - if (!PyArg_ParseTuple(args, ":GetFilled")) - return NULL; - if ((count = ALgetfilled(self-> port)) == -1) - return NULL; - return PyInt_FromLong(count); -} - -static PyObject * -alp_getfillable(alpobject *self, PyObject *args) -{ - long count; - - if (!PyArg_ParseTuple(args, ":GetFillable")) - return NULL; - if ((count = ALgetfillable(self-> port)) == -1) - return NULL; - return PyInt_FromLong (count); -} - -static PyObject * -alp_readsamps(alpobject *self, PyObject *args) -{ - long count; - PyObject *v; - ALconfig c; - int width; - int ret; - - if (!PyArg_ParseTuple(args, "l:readsamps", &count)) - return NULL; - - if (count <= 0) { - PyErr_SetString(ErrorObject, "al.readsamps : arg <= 0"); - return NULL; - } - - c = ALgetconfig(self->port); -#ifdef AL_405 - width = ALgetsampfmt(c); - if (width == AL_SAMPFMT_FLOAT) - width = sizeof(float); - else if (width == AL_SAMPFMT_DOUBLE) - width = sizeof(double); - else - width = ALgetwidth(c); -#else - width = ALgetwidth(c); -#endif /* AL_405 */ - ALfreeconfig(c); - v = PyString_FromStringAndSize((char *)NULL, width * count); - if (v == NULL) - return NULL; - - Py_BEGIN_ALLOW_THREADS - ret = ALreadsamps(self->port, (void *) PyString_AsString(v), count); - Py_END_ALLOW_THREADS - if (ret == -1) { - Py_DECREF(v); - return NULL; - } - - return (v); -} - -static PyObject * -alp_writesamps(alpobject *self, PyObject *args) -{ - char *buf; - int size, width; - ALconfig c; - int ret; - - if (!PyArg_ParseTuple(args, "s#:writesamps", &buf, &size)) - return NULL; - - c = ALgetconfig(self->port); -#ifdef AL_405 - width = ALgetsampfmt(c); - if (width == AL_SAMPFMT_FLOAT) - width = sizeof(float); - else if (width == AL_SAMPFMT_DOUBLE) - width = sizeof(double); - else - width = ALgetwidth(c); -#else - width = ALgetwidth(c); -#endif /* AL_405 */ - ALfreeconfig(c); - Py_BEGIN_ALLOW_THREADS - ret = ALwritesamps (self->port, (void *) buf, (long) size / width); - Py_END_ALLOW_THREADS - if (ret == -1) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -alp_getfillpoint(alpobject *self, PyObject *args) -{ - long count; - - if (!PyArg_ParseTuple(args, ":GetFillPoint")) - return NULL; - if ((count = ALgetfillpoint(self->port)) == -1) - return NULL; - return PyInt_FromLong(count); -} - -static PyObject * -alp_setfillpoint(alpobject *self, PyObject *args) -{ - long count; - - if (!PyArg_ParseTuple(args, "l:SetFillPoint", &count)) - return NULL; - if (ALsetfillpoint(self->port, count) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -alp_setconfig(alpobject *self, PyObject *args) -{ - alcobject *config; - - if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config)) - return NULL; - if (ALsetconfig(self->port, config->config) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -alp_getconfig(alpobject *self, PyObject *args) -{ - ALconfig config; - - if (!PyArg_ParseTuple(args, ":GetConfig")) - return NULL; - config = ALgetconfig(self->port); - if (config == NULL) - return NULL; - return newalcobject(config); -} - -#ifdef AL_405 -static PyObject * -alp_getstatus(alpobject *self, PyObject *args) -{ - PyObject *list, *v; - long *PVbuffer; - long length; - int i; - - if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &list)) - return NULL; - length = PyList_Size(list); - PVbuffer = PyMem_NEW(long, length); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - for (i = 0; i < length; i++) { - v = PyList_GetItem(list, i); - if (!PyInt_Check(v)) { - PyMem_DEL(PVbuffer); - PyErr_BadArgument(); - return NULL; - } - PVbuffer[i] = PyInt_AsLong(v); - } - - if (ALgetstatus(self->port, PVbuffer, length) == -1) - return NULL; - - for (i = 0; i < length; i++) - PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); - - PyMem_DEL(PVbuffer); - - Py_INCREF(Py_None); - return Py_None; -} -#endif /* AL_405 */ - -#endif /* OLD_INTERFACE */ - -static struct PyMethodDef alp_methods[] = { -#ifdef AL_NO_ELEM /* IRIX 6 */ - {"SetConfig", (PyCFunction)alp_SetConfig, METH_VARARGS, alp_SetConfig__doc__}, - {"GetConfig", (PyCFunction)alp_GetConfig, METH_VARARGS, alp_GetConfig__doc__}, - {"GetResource", (PyCFunction)alp_GetResource, METH_VARARGS, alp_GetResource__doc__}, - {"GetFD", (PyCFunction)alp_GetFD, METH_VARARGS, alp_GetFD__doc__}, - {"GetFilled", (PyCFunction)alp_GetFilled, METH_VARARGS, alp_GetFilled__doc__}, - {"GetFillable", (PyCFunction)alp_GetFillable, METH_VARARGS, alp_GetFillable__doc__}, - {"ReadFrames", (PyCFunction)alp_ReadFrames, METH_VARARGS, alp_ReadFrames__doc__}, - {"DiscardFrames", (PyCFunction)alp_DiscardFrames, METH_VARARGS, alp_DiscardFrames__doc__}, - {"ZeroFrames", (PyCFunction)alp_ZeroFrames, METH_VARARGS, alp_ZeroFrames__doc__}, - {"SetFillPoint", (PyCFunction)alp_SetFillPoint, METH_VARARGS, alp_SetFillPoint__doc__}, - {"GetFillPoint", (PyCFunction)alp_GetFillPoint, METH_VARARGS, alp_GetFillPoint__doc__}, - {"GetFrameNumber", (PyCFunction)alp_GetFrameNumber, METH_VARARGS, alp_GetFrameNumber__doc__}, - {"GetFrameTime", (PyCFunction)alp_GetFrameTime, METH_VARARGS, alp_GetFrameTime__doc__}, - {"WriteFrames", (PyCFunction)alp_WriteFrames, METH_VARARGS, alp_WriteFrames__doc__}, - {"ClosePort", (PyCFunction)alp_ClosePort, METH_VARARGS, alp_ClosePort__doc__}, -#endif /* AL_NO_ELEM */ -#ifdef OLD_INTERFACE - {"closeport", (PyCFunction)alp_closeport, METH_VARARGS}, - {"getfd", (PyCFunction)alp_getfd, METH_VARARGS}, - {"fileno", (PyCFunction)alp_getfd, METH_VARARGS}, - {"getfilled", (PyCFunction)alp_getfilled, METH_VARARGS}, - {"getfillable", (PyCFunction)alp_getfillable, METH_VARARGS}, - {"readsamps", (PyCFunction)alp_readsamps, METH_VARARGS}, - {"writesamps", (PyCFunction)alp_writesamps, METH_VARARGS}, - {"setfillpoint", (PyCFunction)alp_setfillpoint, METH_VARARGS}, - {"getfillpoint", (PyCFunction)alp_getfillpoint, METH_VARARGS}, - {"setconfig", (PyCFunction)alp_setconfig, METH_VARARGS}, - {"getconfig", (PyCFunction)alp_getconfig, METH_VARARGS}, -#ifdef AL_405 - {"getstatus", (PyCFunction)alp_getstatus, METH_VARARGS}, -#endif /* AL_405 */ -#endif /* OLD_INTERFACE */ - - {NULL, NULL} /* sentinel */ -}; - -/* ---------- */ - - -static PyObject * -newalpobject(ALport port) -{ - alpobject *self; - - self = PyObject_New(alpobject, &Alptype); - if (self == NULL) - return NULL; - /* XXXX Add your own initializers here */ - self->port = port; - return (PyObject *) self; -} - - -static void -alp_dealloc(alpobject *self) -{ - /* XXXX Add your own cleanup code here */ - if (self->port) { -#ifdef AL_NO_ELEM /* IRIX 6 */ - alClosePort(self->port); -#else - ALcloseport(self->port); -#endif - } - PyObject_Del(self); -} - -static PyObject * -alp_getattr(alpobject *self, char *name) -{ - /* XXXX Add your own getattr code here */ - if (self->port == NULL) { - PyErr_SetString(ErrorObject, "port already closed"); - return NULL; - } - return Py_FindMethod(alp_methods, (PyObject *)self, name); -} - -PyDoc_STRVAR(Alptype__doc__, ""); - -static PyTypeObject Alptype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "al.port", /*tp_name*/ - sizeof(alpobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)alp_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)alp_getattr, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - - /* Space for future expansion */ - 0L,0L,0L,0L, - Alptype__doc__ /* Documentation string */ -}; - -/* End of code for port objects */ -/* -------------------------------------------------------- */ - - -#ifdef AL_NO_ELEM /* IRIX 6 */ - -PyDoc_STRVAR(al_NewConfig__doc__, -"alNewConfig: create and initialize an audio ALconfig structure."); - -static PyObject * -al_NewConfig(PyObject *self, PyObject *args) -{ - ALconfig config; - - if (!PyArg_ParseTuple(args, ":NewConfig")) - return NULL; - if ((config = alNewConfig()) == NULL) - return NULL; - return newalcobject(config); -} - -PyDoc_STRVAR(al_OpenPort__doc__, -"alOpenPort: open an audio port."); - -static PyObject * -al_OpenPort(PyObject *self, PyObject *args) -{ - ALport port; - char *name, *dir; - alcobject *config = NULL; - - if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config)) - return NULL; - if ((port = alOpenPort(name, dir, config ? config->config : NULL)) == NULL) - return NULL; - return newalpobject(port); -} - -PyDoc_STRVAR(al_Connect__doc__, -"alConnect: connect two audio I/O resources."); - -static PyObject * -al_Connect(PyObject *self, PyObject *args) -{ - int source, dest, nprops = 0, id, i; - ALpv *props = NULL; - ALparamInfo *propinfo = NULL; - PyObject *propobj = NULL; - - if (!PyArg_ParseTuple(args, "ii|O!:Connect", &source, &dest, &PyList_Type, &propobj)) - return NULL; - if (propobj != NULL) { - nprops = python2params(source, dest, propobj, &props, &propinfo); - if (nprops < 0) - return NULL; - } - - id = alConnect(source, dest, props, nprops); - - if (props) { - for (i = 0; i < nprops; i++) { - switch (propinfo[i].valueType) { - case AL_SET_VAL: - case AL_VECTOR_VAL: - PyMem_DEL(props[i].value.ptr); - break; - } - } - PyMem_DEL(props); - PyMem_DEL(propinfo); - } - - if (id < 0) - return NULL; - return PyInt_FromLong((long) id); -} - -PyDoc_STRVAR(al_Disconnect__doc__, -"alDisconnect: delete a connection between two audio I/O resources."); - -static PyObject * -al_Disconnect(PyObject *self, PyObject *args) -{ - int res; - - if (!PyArg_ParseTuple(args, "i:Disconnect", &res)) - return NULL; - if (alDisconnect(res) < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(al_GetParams__doc__, -"alGetParams: get the values of audio resource parameters."); - -static PyObject * -al_GetParams(PyObject *self, PyObject *args) -{ - int resource; - PyObject *pvslist, *item = NULL, *v = NULL; - ALpv *pvs; - int i, j, npvs; - ALparamInfo *pinfo; - - if (!PyArg_ParseTuple(args, "iO!:GetParams", &resource, &PyList_Type, &pvslist)) - return NULL; - npvs = PyList_Size(pvslist); - pvs = PyMem_NEW(ALpv, npvs); - pinfo = PyMem_NEW(ALparamInfo, npvs); - for (i = 0; i < npvs; i++) { - item = PyList_GetItem(pvslist, i); - if (!PyInt_Check(item)) { - item = NULL; - PyErr_SetString(ErrorObject, "list of integers expected"); - goto error; - } - pvs[i].param = (int) PyInt_AsLong(item); - item = NULL; /* not needed anymore */ - if (alGetParamInfo(resource, pvs[i].param, &pinfo[i]) < 0) - goto error; - switch (pinfo[i].valueType) { - case AL_NO_VAL: - break; - case AL_MATRIX_VAL: - pinfo[i].maxElems *= pinfo[i].maxElems2; - /* fall through */ - case AL_STRING_VAL: - case AL_SET_VAL: - case AL_VECTOR_VAL: - switch (pinfo[i].elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - pvs[i].value.ptr = PyMem_NEW(int, pinfo[i].maxElems); - pvs[i].sizeIn = pinfo[i].maxElems; - break; - case AL_INT64_ELEM: - case AL_FIXED_ELEM: - pvs[i].value.ptr = PyMem_NEW(long long, pinfo[i].maxElems); - pvs[i].sizeIn = pinfo[i].maxElems; - break; - case AL_CHAR_ELEM: - pvs[i].value.ptr = PyMem_NEW(char, 32); - pvs[i].sizeIn = 32; - break; - case AL_NO_ELEM: - case AL_PTR_ELEM: - default: - PyErr_SetString(ErrorObject, "internal error"); - goto error; - } - break; - case AL_SCALAR_VAL: - break; - default: - PyErr_SetString(ErrorObject, "internal error"); - goto error; - } - if (pinfo[i].valueType == AL_MATRIX_VAL) { - pinfo[i].maxElems /= pinfo[i].maxElems2; - pvs[i].sizeIn /= pinfo[i].maxElems2; - pvs[i].size2In = pinfo[i].maxElems2; - } - } - if (alGetParams(resource, pvs, npvs) < 0) - goto error; - if (!(v = PyList_New(npvs))) - goto error; - for (i = 0; i < npvs; i++) { - if (pvs[i].sizeOut < 0) { - char buf[32]; - PyOS_snprintf(buf, sizeof(buf), - "problem with param %d", i); - PyErr_SetString(ErrorObject, buf); - goto error; - } - switch (pinfo[i].valueType) { - case AL_NO_VAL: - item = Py_None; - Py_INCREF(item); - break; - case AL_STRING_VAL: - item = PyString_FromString(pvs[i].value.ptr); - PyMem_DEL(pvs[i].value.ptr); - break; - case AL_MATRIX_VAL: - /* XXXX this is not right */ - pvs[i].sizeOut *= pvs[i].size2Out; - /* fall through */ - case AL_SET_VAL: - case AL_VECTOR_VAL: - item = PyList_New(pvs[i].sizeOut); - for (j = 0; j < pvs[i].sizeOut; j++) { - switch (pinfo[i].elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - PyList_SetItem(item, j, PyInt_FromLong((long) ((int *) pvs[i].value.ptr)[j])); - break; - case AL_INT64_ELEM: - PyList_SetItem(item, j, PyLong_FromLongLong(((long long *) pvs[i].value.ptr)[j])); - break; - case AL_FIXED_ELEM: - PyList_SetItem(item, j, PyFloat_FromDouble(alFixedToDouble(((long long *) pvs[i].value.ptr)[j]))); - break; - default: - PyErr_SetString(ErrorObject, "internal error"); - goto error; - } - } - PyMem_DEL(pvs[i].value.ptr); - break; - case AL_SCALAR_VAL: - item = param2python(resource, pvs[i].param, pvs[i].value, &pinfo[i]); - break; - } - if (PyErr_Occurred() || - PyList_SetItem(v, i, Py_BuildValue("(iO)", pvs[i].param, - item)) < 0 || - PyErr_Occurred()) - goto error; - Py_DECREF(item); - } - PyMem_DEL(pvs); - PyMem_DEL(pinfo); - return v; - - error: - Py_XDECREF(v); - Py_XDECREF(item); - if (pvs) - PyMem_DEL(pvs); - if (pinfo) - PyMem_DEL(pinfo); - return NULL; -} - -PyDoc_STRVAR(al_SetParams__doc__, -"alSetParams: set the values of audio resource parameters."); - -static PyObject * -al_SetParams(PyObject *self, PyObject *args) -{ - int resource; - PyObject *pvslist; - ALpv *pvs; - ALparamInfo *pinfo; - int npvs, i; - - if (!PyArg_ParseTuple(args, "iO!:SetParams", &resource, &PyList_Type, &pvslist)) - return NULL; - npvs = python2params(resource, -1, pvslist, &pvs, &pinfo); - if (npvs < 0) - return NULL; - - if (alSetParams(resource, pvs, npvs) < 0) - goto error; - - /* cleanup */ - for (i = 0; i < npvs; i++) { - switch (pinfo[i].valueType) { - case AL_SET_VAL: - case AL_VECTOR_VAL: - PyMem_DEL(pvs[i].value.ptr); - break; - } - } - PyMem_DEL(pvs); - PyMem_DEL(pinfo); - - Py_INCREF(Py_None); - return Py_None; - - error: - /* XXXX we should clean up everything */ - if (pvs) - PyMem_DEL(pvs); - if (pinfo) - PyMem_DEL(pinfo); - return NULL; -} - -PyDoc_STRVAR(al_QueryValues__doc__, -"alQueryValues: get the set of possible values for a parameter."); - -static PyObject * -al_QueryValues(PyObject *self, PyObject *args) -{ - int resource, param; - ALvalue *return_set = NULL; - int setsize = 32, qualsize = 0, nvals, i; - ALpv *quals = NULL; - ALparamInfo pinfo; - ALparamInfo *qualinfo = NULL; - PyObject *qualobj = NULL; - PyObject *res = NULL, *item; - - if (!PyArg_ParseTuple(args, "ii|O!:QueryValues", &resource, ¶m, - &PyList_Type, &qualobj)) - return NULL; - if (qualobj != NULL) { - qualsize = python2params(resource, param, qualobj, &quals, &qualinfo); - if (qualsize < 0) - return NULL; - } - setsize = 32; - return_set = PyMem_NEW(ALvalue, setsize); - if (return_set == NULL) { - PyErr_NoMemory(); - goto cleanup; - } - - retry: - nvals = alQueryValues(resource, param, return_set, setsize, quals, qualsize); - if (nvals < 0) - goto cleanup; - if (nvals > setsize) { - setsize = nvals; - PyMem_RESIZE(return_set, ALvalue, setsize); - if (return_set == NULL) { - PyErr_NoMemory(); - goto cleanup; - } - goto retry; - } - - if (alGetParamInfo(resource, param, &pinfo) < 0) - goto cleanup; - - res = PyList_New(nvals); - if (res == NULL) - goto cleanup; - for (i = 0; i < nvals; i++) { - item = param2python(resource, param, return_set[i], &pinfo); - if (item == NULL || - PyList_SetItem(res, i, item) < 0) { - Py_DECREF(res); - res = NULL; - goto cleanup; - } - } - - cleanup: - if (return_set) - PyMem_DEL(return_set); - if (quals) { - for (i = 0; i < qualsize; i++) { - switch (qualinfo[i].valueType) { - case AL_SET_VAL: - case AL_VECTOR_VAL: - PyMem_DEL(quals[i].value.ptr); - break; - } - } - PyMem_DEL(quals); - PyMem_DEL(qualinfo); - } - - return res; -} - -PyDoc_STRVAR(al_GetParamInfo__doc__, -"alGetParamInfo: get information about a parameter on " -"a particular audio resource."); - -static PyObject * -al_GetParamInfo(PyObject *self, PyObject *args) -{ - int res, param; - ALparamInfo pinfo; - PyObject *v, *item; - - if (!PyArg_ParseTuple(args, "ii:GetParamInfo", &res, ¶m)) - return NULL; - if (alGetParamInfo(res, param, &pinfo) < 0) - return NULL; - v = PyDict_New(); - if (!v) return NULL; - - item = PyInt_FromLong((long) pinfo.resource); - PyDict_SetItemString(v, "resource", item); - Py_DECREF(item); - - item = PyInt_FromLong((long) pinfo.param); - PyDict_SetItemString(v, "param", item); - Py_DECREF(item); - - item = PyInt_FromLong((long) pinfo.valueType); - PyDict_SetItemString(v, "valueType", item); - Py_DECREF(item); - - if (pinfo.valueType != AL_NO_VAL && pinfo.valueType != AL_SCALAR_VAL) { - /* multiple values */ - item = PyInt_FromLong((long) pinfo.maxElems); - PyDict_SetItemString(v, "maxElems", item); - Py_DECREF(item); - - if (pinfo.valueType == AL_MATRIX_VAL) { - /* 2 dimensional */ - item = PyInt_FromLong((long) pinfo.maxElems2); - PyDict_SetItemString(v, "maxElems2", item); - Py_DECREF(item); - } - } - - item = PyInt_FromLong((long) pinfo.elementType); - PyDict_SetItemString(v, "elementType", item); - Py_DECREF(item); - - item = PyString_FromString(pinfo.name); - PyDict_SetItemString(v, "name", item); - Py_DECREF(item); - - item = param2python(res, param, pinfo.initial, &pinfo); - PyDict_SetItemString(v, "initial", item); - Py_DECREF(item); - - if (pinfo.elementType != AL_ENUM_ELEM && - pinfo.elementType != AL_RESOURCE_ELEM && - pinfo.elementType != AL_CHAR_ELEM) { - /* range param */ - item = param2python(res, param, pinfo.min, &pinfo); - PyDict_SetItemString(v, "min", item); - Py_DECREF(item); - - item = param2python(res, param, pinfo.max, &pinfo); - PyDict_SetItemString(v, "max", item); - Py_DECREF(item); - - item = param2python(res, param, pinfo.minDelta, &pinfo); - PyDict_SetItemString(v, "minDelta", item); - Py_DECREF(item); - - item = param2python(res, param, pinfo.maxDelta, &pinfo); - PyDict_SetItemString(v, "maxDelta", item); - Py_DECREF(item); - - item = PyInt_FromLong((long) pinfo.specialVals); - PyDict_SetItemString(v, "specialVals", item); - Py_DECREF(item); - } - - return v; -} - -PyDoc_STRVAR(al_GetResourceByName__doc__, -"alGetResourceByName: find an audio resource by name."); - -static PyObject * -al_GetResourceByName(PyObject *self, PyObject *args) -{ - int res, start_res, type; - char *name; - - if (!PyArg_ParseTuple(args, "isi:GetResourceByName", &start_res, &name, &type)) - return NULL; - if ((res = alGetResourceByName(start_res, name, type)) == 0) - return NULL; - return PyInt_FromLong((long) res); -} - -PyDoc_STRVAR(al_IsSubtype__doc__, -"alIsSubtype: indicate if one resource type is a subtype of another."); - -static PyObject * -al_IsSubtype(PyObject *self, PyObject *args) -{ - int type, subtype; - - if (!PyArg_ParseTuple(args, "ii:IsSubtype", &type, &subtype)) - return NULL; - return PyInt_FromLong((long) alIsSubtype(type, subtype)); -} - -PyDoc_STRVAR(al_SetErrorHandler__doc__, ""); - -static PyObject * -al_SetErrorHandler(PyObject *self, PyObject *args) -{ - - if (!PyArg_ParseTuple(args, ":SetErrorHandler")) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -#endif /* AL_NO_ELEM */ - -#ifdef OLD_INTERFACE - -static PyObject * -al_openport(PyObject *self, PyObject *args) -{ - char *name, *dir; - ALport port; - alcobject *config = NULL; - - if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config)) - return NULL; - if ((port = ALopenport(name, dir, config ? config->config : NULL)) == NULL) - return NULL; - return newalpobject(port); -} - -static PyObject * -al_newconfig(PyObject *self, PyObject *args) -{ - ALconfig config; - - if (!PyArg_ParseTuple(args, ":NewConfig")) - return NULL; - if ((config = ALnewconfig ()) == NULL) - return NULL; - return newalcobject(config); -} - -static PyObject * -al_queryparams(PyObject *self, PyObject *args) -{ - long device; - long length; - long *PVbuffer; - long PVdummy[2]; - PyObject *v = NULL; - int i; - - if (!PyArg_ParseTuple(args, "l:queryparams", &device)) - return NULL; - if ((length = ALqueryparams(device, PVdummy, 2L)) == -1) - return NULL; - if ((PVbuffer = PyMem_NEW(long, length)) == NULL) - return PyErr_NoMemory(); - if (ALqueryparams(device, PVbuffer, length) >= 0 && - (v = PyList_New((int)length)) != NULL) { - for (i = 0; i < length; i++) - PyList_SetItem(v, i, PyInt_FromLong(PVbuffer[i])); - } - PyMem_DEL(PVbuffer); - return v; -} - -static PyObject * -doParams(PyObject *args, int (*func)(long, long *, long), int modified) -{ - long device; - PyObject *list, *v; - long *PVbuffer; - long length; - int i; - - if (!PyArg_ParseTuple(args, "lO!", &device, &PyList_Type, &list)) - return NULL; - length = PyList_Size(list); - PVbuffer = PyMem_NEW(long, length); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - for (i = 0; i < length; i++) { - v = PyList_GetItem(list, i); - if (!PyInt_Check(v)) { - PyMem_DEL(PVbuffer); - PyErr_BadArgument(); - return NULL; - } - PVbuffer[i] = PyInt_AsLong(v); - } - - if ((*func)(device, PVbuffer, length) == -1) { - PyMem_DEL(PVbuffer); - return NULL; - } - - if (modified) { - for (i = 0; i < length; i++) - PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); - } - - PyMem_DEL(PVbuffer); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -al_getparams(PyObject *self, PyObject *args) -{ - return doParams(args, ALgetparams, 1); -} - -static PyObject * -al_setparams(PyObject *self, PyObject *args) -{ - return doParams(args, ALsetparams, 0); -} - -static PyObject * -al_getname(PyObject *self, PyObject *args) -{ - long device, descriptor; - char *name; - - if (!PyArg_ParseTuple(args, "ll:getname", &device, &descriptor)) - return NULL; - if ((name = ALgetname(device, descriptor)) == NULL) - return NULL; - return PyString_FromString(name); -} - -static PyObject * -al_getdefault(PyObject *self, PyObject *args) -{ - long device, descriptor, value; - - if (!PyArg_ParseTuple(args, "ll:getdefault", &device, &descriptor)) - return NULL; - if ((value = ALgetdefault(device, descriptor)) == -1) - return NULL; - return PyLong_FromLong(value); -} - -static PyObject * -al_getminmax(PyObject *self, PyObject *args) -{ - long device, descriptor, min, max; - - if (!PyArg_ParseTuple(args, "ll:getminmax", &device, &descriptor)) - return NULL; - min = -1; - max = -1; - if (ALgetminmax(device, descriptor, &min, &max) == -1) - return NULL; - return Py_BuildValue("ll", min, max); -} - -#endif /* OLD_INTERFACE */ - -/* List of methods defined in the module */ - -static struct PyMethodDef al_methods[] = { -#ifdef AL_NO_ELEM /* IRIX 6 */ - {"NewConfig", (PyCFunction)al_NewConfig, METH_VARARGS, al_NewConfig__doc__}, - {"OpenPort", (PyCFunction)al_OpenPort, METH_VARARGS, al_OpenPort__doc__}, - {"Connect", (PyCFunction)al_Connect, METH_VARARGS, al_Connect__doc__}, - {"Disconnect", (PyCFunction)al_Disconnect, METH_VARARGS, al_Disconnect__doc__}, - {"GetParams", (PyCFunction)al_GetParams, METH_VARARGS, al_GetParams__doc__}, - {"SetParams", (PyCFunction)al_SetParams, METH_VARARGS, al_SetParams__doc__}, - {"QueryValues", (PyCFunction)al_QueryValues, METH_VARARGS, al_QueryValues__doc__}, - {"GetParamInfo", (PyCFunction)al_GetParamInfo, METH_VARARGS, al_GetParamInfo__doc__}, - {"GetResourceByName", (PyCFunction)al_GetResourceByName, METH_VARARGS, al_GetResourceByName__doc__}, - {"IsSubtype", (PyCFunction)al_IsSubtype, METH_VARARGS, al_IsSubtype__doc__}, -#if 0 - /* this one not supported */ - {"SetErrorHandler", (PyCFunction)al_SetErrorHandler, METH_VARARGS, al_SetErrorHandler__doc__}, -#endif -#endif /* AL_NO_ELEM */ -#ifdef OLD_INTERFACE - {"openport", (PyCFunction)al_openport, METH_VARARGS}, - {"newconfig", (PyCFunction)al_newconfig, METH_VARARGS}, - {"queryparams", (PyCFunction)al_queryparams, METH_VARARGS}, - {"getparams", (PyCFunction)al_getparams, METH_VARARGS}, - {"setparams", (PyCFunction)al_setparams, METH_VARARGS}, - {"getname", (PyCFunction)al_getname, METH_VARARGS}, - {"getdefault", (PyCFunction)al_getdefault, METH_VARARGS}, - {"getminmax", (PyCFunction)al_getminmax, METH_VARARGS}, -#endif /* OLD_INTERFACE */ - - {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ -}; - - -/* Initialization function for the module (*must* be called inital) */ - -PyDoc_STRVAR(al_module_documentation, ""); - -void -inital(void) -{ - PyObject *m, *d, *x; - - /* Create the module and add the functions */ - m = Py_InitModule4("al", al_methods, - al_module_documentation, - (PyObject*)NULL,PYTHON_API_VERSION); - if (m == NULL) - return; - - /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); - ErrorObject = PyErr_NewException("al.error", NULL, NULL); - PyDict_SetItemString(d, "error", ErrorObject); - - /* XXXX Add constants here */ -#ifdef AL_4CHANNEL - x = PyInt_FromLong((long) AL_4CHANNEL); - if (x == NULL || PyDict_SetItemString(d, "FOURCHANNEL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ADAT_IF_TYPE - x = PyInt_FromLong((long) AL_ADAT_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "ADAT_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ADAT_MCLK_TYPE - x = PyInt_FromLong((long) AL_ADAT_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "ADAT_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_AES_IF_TYPE - x = PyInt_FromLong((long) AL_AES_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "AES_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_AES_MCLK_TYPE - x = PyInt_FromLong((long) AL_AES_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "AES_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ANALOG_IF_TYPE - x = PyInt_FromLong((long) AL_ANALOG_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "ANALOG_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ASSOCIATE - x = PyInt_FromLong((long) AL_ASSOCIATE); - if (x == NULL || PyDict_SetItemString(d, "ASSOCIATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_BUFFER_NULL - x = PyInt_FromLong((long) AL_BAD_BUFFER_NULL); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_NULL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_BUFFERLENGTH - x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_BUFFERLENGTH_NEG - x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH_NEG); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_BUFFERLENGTH_ODD - x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH_ODD); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_CHANNELS - x = PyInt_FromLong((long) AL_BAD_CHANNELS); - if (x == NULL || PyDict_SetItemString(d, "BAD_CHANNELS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_CONFIG - x = PyInt_FromLong((long) AL_BAD_CONFIG); - if (x == NULL || PyDict_SetItemString(d, "BAD_CONFIG", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_COUNT_NEG - x = PyInt_FromLong((long) AL_BAD_COUNT_NEG); - if (x == NULL || PyDict_SetItemString(d, "BAD_COUNT_NEG", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_DEVICE - x = PyInt_FromLong((long) AL_BAD_DEVICE); - if (x == NULL || PyDict_SetItemString(d, "BAD_DEVICE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_DEVICE_ACCESS - x = PyInt_FromLong((long) AL_BAD_DEVICE_ACCESS); - if (x == NULL || PyDict_SetItemString(d, "BAD_DEVICE_ACCESS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_DIRECTION - x = PyInt_FromLong((long) AL_BAD_DIRECTION); - if (x == NULL || PyDict_SetItemString(d, "BAD_DIRECTION", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_FILLPOINT - x = PyInt_FromLong((long) AL_BAD_FILLPOINT); - if (x == NULL || PyDict_SetItemString(d, "BAD_FILLPOINT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_FLOATMAX - x = PyInt_FromLong((long) AL_BAD_FLOATMAX); - if (x == NULL || PyDict_SetItemString(d, "BAD_FLOATMAX", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_ILLEGAL_STATE - x = PyInt_FromLong((long) AL_BAD_ILLEGAL_STATE); - if (x == NULL || PyDict_SetItemString(d, "BAD_ILLEGAL_STATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_NO_PORTS - x = PyInt_FromLong((long) AL_BAD_NO_PORTS); - if (x == NULL || PyDict_SetItemString(d, "BAD_NO_PORTS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_NOT_FOUND - x = PyInt_FromLong((long) AL_BAD_NOT_FOUND); - if (x == NULL || PyDict_SetItemString(d, "BAD_NOT_FOUND", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_NOT_IMPLEMENTED - x = PyInt_FromLong((long) AL_BAD_NOT_IMPLEMENTED); - if (x == NULL || PyDict_SetItemString(d, "BAD_NOT_IMPLEMENTED", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_OUT_OF_MEM - x = PyInt_FromLong((long) AL_BAD_OUT_OF_MEM); - if (x == NULL || PyDict_SetItemString(d, "BAD_OUT_OF_MEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PARAM - x = PyInt_FromLong((long) AL_BAD_PARAM); - if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PERMISSIONS - x = PyInt_FromLong((long) AL_BAD_PERMISSIONS); - if (x == NULL || PyDict_SetItemString(d, "BAD_PERMISSIONS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PORT - x = PyInt_FromLong((long) AL_BAD_PORT); - if (x == NULL || PyDict_SetItemString(d, "BAD_PORT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PORTSTYLE - x = PyInt_FromLong((long) AL_BAD_PORTSTYLE); - if (x == NULL || PyDict_SetItemString(d, "BAD_PORTSTYLE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PVBUFFER - x = PyInt_FromLong((long) AL_BAD_PVBUFFER); - if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_QSIZE - x = PyInt_FromLong((long) AL_BAD_QSIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_QSIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_RATE - x = PyInt_FromLong((long) AL_BAD_RATE); - if (x == NULL || PyDict_SetItemString(d, "BAD_RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_RESOURCE - x = PyInt_FromLong((long) AL_BAD_RESOURCE); - if (x == NULL || PyDict_SetItemString(d, "BAD_RESOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_SAMPFMT - x = PyInt_FromLong((long) AL_BAD_SAMPFMT); - if (x == NULL || PyDict_SetItemString(d, "BAD_SAMPFMT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_TRANSFER_SIZE - x = PyInt_FromLong((long) AL_BAD_TRANSFER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_TRANSFER_SIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_WIDTH - x = PyInt_FromLong((long) AL_BAD_WIDTH); - if (x == NULL || PyDict_SetItemString(d, "BAD_WIDTH", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CHANNEL_MODE - x = PyInt_FromLong((long) AL_CHANNEL_MODE); - if (x == NULL || PyDict_SetItemString(d, "CHANNEL_MODE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CHANNELS - x = PyInt_FromLong((long) AL_CHANNELS); - if (x == NULL || PyDict_SetItemString(d, "CHANNELS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CHAR_ELEM - x = PyInt_FromLong((long) AL_CHAR_ELEM); - if (x == NULL || PyDict_SetItemString(d, "CHAR_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CLOCK_GEN - x = PyInt_FromLong((long) AL_CLOCK_GEN); - if (x == NULL || PyDict_SetItemString(d, "CLOCK_GEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CLOCKGEN_TYPE - x = PyInt_FromLong((long) AL_CLOCKGEN_TYPE); - if (x == NULL || PyDict_SetItemString(d, "CLOCKGEN_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CONNECT - x = PyInt_FromLong((long) AL_CONNECT); - if (x == NULL || PyDict_SetItemString(d, "CONNECT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CONNECTION_TYPE - x = PyInt_FromLong((long) AL_CONNECTION_TYPE); - if (x == NULL || PyDict_SetItemString(d, "CONNECTION_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CONNECTIONS - x = PyInt_FromLong((long) AL_CONNECTIONS); - if (x == NULL || PyDict_SetItemString(d, "CONNECTIONS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CRYSTAL_MCLK_TYPE - x = PyInt_FromLong((long) AL_CRYSTAL_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "CRYSTAL_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEFAULT_DEVICE - x = PyInt_FromLong((long) AL_DEFAULT_DEVICE); - if (x == NULL || PyDict_SetItemString(d, "DEFAULT_DEVICE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEFAULT_INPUT - x = PyInt_FromLong((long) AL_DEFAULT_INPUT); - if (x == NULL || PyDict_SetItemString(d, "DEFAULT_INPUT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEFAULT_OUTPUT - x = PyInt_FromLong((long) AL_DEFAULT_OUTPUT); - if (x == NULL || PyDict_SetItemString(d, "DEFAULT_OUTPUT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEST - x = PyInt_FromLong((long) AL_DEST); - if (x == NULL || PyDict_SetItemString(d, "DEST", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEVICE_TYPE - x = PyInt_FromLong((long) AL_DEVICE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "DEVICE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEVICES - x = PyInt_FromLong((long) AL_DEVICES); - if (x == NULL || PyDict_SetItemString(d, "DEVICES", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DIGITAL_IF_TYPE - x = PyInt_FromLong((long) AL_DIGITAL_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "DIGITAL_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DIGITAL_INPUT_RATE - x = PyInt_FromLong((long) AL_DIGITAL_INPUT_RATE); - if (x == NULL || PyDict_SetItemString(d, "DIGITAL_INPUT_RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DISCONNECT - x = PyInt_FromLong((long) AL_DISCONNECT); - if (x == NULL || PyDict_SetItemString(d, "DISCONNECT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ENUM_ELEM - x = PyInt_FromLong((long) AL_ENUM_ELEM); - if (x == NULL || PyDict_SetItemString(d, "ENUM_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ENUM_VALUE - x = PyInt_FromLong((long) AL_ENUM_VALUE); - if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_INPUT_OVERFLOW - x = PyInt_FromLong((long) AL_ERROR_INPUT_OVERFLOW); - if (x == NULL || PyDict_SetItemString(d, "ERROR_INPUT_OVERFLOW", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_LENGTH - x = PyInt_FromLong((long) AL_ERROR_LENGTH); - if (x == NULL || PyDict_SetItemString(d, "ERROR_LENGTH", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_LOCATION_LSP - x = PyInt_FromLong((long) AL_ERROR_LOCATION_LSP); - if (x == NULL || PyDict_SetItemString(d, "ERROR_LOCATION_LSP", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_LOCATION_MSP - x = PyInt_FromLong((long) AL_ERROR_LOCATION_MSP); - if (x == NULL || PyDict_SetItemString(d, "ERROR_LOCATION_MSP", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_NUMBER - x = PyInt_FromLong((long) AL_ERROR_NUMBER); - if (x == NULL || PyDict_SetItemString(d, "ERROR_NUMBER", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_OUTPUT_UNDERFLOW - x = PyInt_FromLong((long) AL_ERROR_OUTPUT_UNDERFLOW); - if (x == NULL || PyDict_SetItemString(d, "ERROR_OUTPUT_UNDERFLOW", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_TYPE - x = PyInt_FromLong((long) AL_ERROR_TYPE); - if (x == NULL || PyDict_SetItemString(d, "ERROR_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_FIXED_ELEM - x = PyInt_FromLong((long) AL_FIXED_ELEM); - if (x == NULL || PyDict_SetItemString(d, "FIXED_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_FIXED_MCLK_TYPE - x = PyInt_FromLong((long) AL_FIXED_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "FIXED_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_GAIN - x = PyInt_FromLong((long) AL_GAIN); - if (x == NULL || PyDict_SetItemString(d, "GAIN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_GAIN_REF - x = PyInt_FromLong((long) AL_GAIN_REF); - if (x == NULL || PyDict_SetItemString(d, "GAIN_REF", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_HRB_TYPE - x = PyInt_FromLong((long) AL_HRB_TYPE); - if (x == NULL || PyDict_SetItemString(d, "HRB_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_COUNT - x = PyInt_FromLong((long) AL_INPUT_COUNT); - if (x == NULL || PyDict_SetItemString(d, "INPUT_COUNT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_DEVICE_TYPE - x = PyInt_FromLong((long) AL_INPUT_DEVICE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_DEVICE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_DIGITAL - x = PyInt_FromLong((long) AL_INPUT_DIGITAL); - if (x == NULL || PyDict_SetItemString(d, "INPUT_DIGITAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_HRB_TYPE - x = PyInt_FromLong((long) AL_INPUT_HRB_TYPE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_HRB_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_LINE - x = PyInt_FromLong((long) AL_INPUT_LINE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_LINE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_MIC - x = PyInt_FromLong((long) AL_INPUT_MIC); - if (x == NULL || PyDict_SetItemString(d, "INPUT_MIC", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_PORT_TYPE - x = PyInt_FromLong((long) AL_INPUT_PORT_TYPE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_PORT_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_RATE - x = PyInt_FromLong((long) AL_INPUT_RATE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_SOURCE - x = PyInt_FromLong((long) AL_INPUT_SOURCE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_SOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INT32_ELEM - x = PyInt_FromLong((long) AL_INT32_ELEM); - if (x == NULL || PyDict_SetItemString(d, "INT32_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INT64_ELEM - x = PyInt_FromLong((long) AL_INT64_ELEM); - if (x == NULL || PyDict_SetItemString(d, "INT64_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INTERFACE - x = PyInt_FromLong((long) AL_INTERFACE); - if (x == NULL || PyDict_SetItemString(d, "INTERFACE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INTERFACE_TYPE - x = PyInt_FromLong((long) AL_INTERFACE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "INTERFACE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INVALID_PARAM - x = PyInt_FromLong((long) AL_INVALID_PARAM); - if (x == NULL || PyDict_SetItemString(d, "INVALID_PARAM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INVALID_VALUE - x = PyInt_FromLong((long) AL_INVALID_VALUE); - if (x == NULL || PyDict_SetItemString(d, "INVALID_VALUE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_JITTER - x = PyInt_FromLong((long) AL_JITTER); - if (x == NULL || PyDict_SetItemString(d, "JITTER", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LABEL - x = PyInt_FromLong((long) AL_LABEL); - if (x == NULL || PyDict_SetItemString(d, "LABEL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT_INPUT_ATTEN - x = PyInt_FromLong((long) AL_LEFT_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "LEFT_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT_MONITOR_ATTEN - x = PyInt_FromLong((long) AL_LEFT_MONITOR_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "LEFT_MONITOR_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT_SPEAKER_GAIN - x = PyInt_FromLong((long) AL_LEFT_SPEAKER_GAIN); - if (x == NULL || PyDict_SetItemString(d, "LEFT_SPEAKER_GAIN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT1_INPUT_ATTEN - x = PyInt_FromLong((long) AL_LEFT1_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "LEFT1_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT2_INPUT_ATTEN - x = PyInt_FromLong((long) AL_LEFT2_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "LEFT2_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LINE_IF_TYPE - x = PyInt_FromLong((long) AL_LINE_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "LINE_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LOCKED - x = PyInt_FromLong((long) AL_LOCKED); - if (x == NULL || PyDict_SetItemString(d, "LOCKED", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MASTER_CLOCK - x = PyInt_FromLong((long) AL_MASTER_CLOCK); - if (x == NULL || PyDict_SetItemString(d, "MASTER_CLOCK", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MATRIX_VAL - x = PyInt_FromLong((long) AL_MATRIX_VAL); - if (x == NULL || PyDict_SetItemString(d, "MATRIX_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_ERROR - x = PyInt_FromLong((long) AL_MAX_ERROR); - if (x == NULL || PyDict_SetItemString(d, "MAX_ERROR", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_EVENT_PARAM - x = PyInt_FromLong((long) AL_MAX_EVENT_PARAM); - if (x == NULL || PyDict_SetItemString(d, "MAX_EVENT_PARAM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_PBUFSIZE - x = PyInt_FromLong((long) AL_MAX_PBUFSIZE); - if (x == NULL || PyDict_SetItemString(d, "MAX_PBUFSIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_PORTS - x = PyInt_FromLong((long) AL_MAX_PORTS); - if (x == NULL || PyDict_SetItemString(d, "MAX_PORTS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_RESOURCE_ID - x = PyInt_FromLong((long) AL_MAX_RESOURCE_ID); - if (x == NULL || PyDict_SetItemString(d, "MAX_RESOURCE_ID", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_SETSIZE - x = PyInt_FromLong((long) AL_MAX_SETSIZE); - if (x == NULL || PyDict_SetItemString(d, "MAX_SETSIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_STRLEN - x = PyInt_FromLong((long) AL_MAX_STRLEN); - if (x == NULL || PyDict_SetItemString(d, "MAX_STRLEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MCLK_TYPE - x = PyInt_FromLong((long) AL_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MIC_IF_TYPE - x = PyInt_FromLong((long) AL_MIC_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "MIC_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MONITOR_CTL - x = PyInt_FromLong((long) AL_MONITOR_CTL); - if (x == NULL || PyDict_SetItemString(d, "MONITOR_CTL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MONITOR_OFF - x = PyInt_FromLong((long) AL_MONITOR_OFF); - if (x == NULL || PyDict_SetItemString(d, "MONITOR_OFF", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MONITOR_ON - x = PyInt_FromLong((long) AL_MONITOR_ON); - if (x == NULL || PyDict_SetItemString(d, "MONITOR_ON", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MONO - x = PyInt_FromLong((long) AL_MONO); - if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MUTE - x = PyInt_FromLong((long) AL_MUTE); - if (x == NULL || PyDict_SetItemString(d, "MUTE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NAME - x = PyInt_FromLong((long) AL_NAME); - if (x == NULL || PyDict_SetItemString(d, "NAME", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NEG_INFINITY - x = PyInt_FromLong((long) AL_NEG_INFINITY); - if (x == NULL || PyDict_SetItemString(d, "NEG_INFINITY", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NEG_INFINITY_BIT - x = PyInt_FromLong((long) AL_NEG_INFINITY_BIT); - if (x == NULL || PyDict_SetItemString(d, "NEG_INFINITY_BIT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_CHANGE - x = PyInt_FromLong((long) AL_NO_CHANGE); - if (x == NULL || PyDict_SetItemString(d, "NO_CHANGE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_CHANGE_BIT - x = PyInt_FromLong((long) AL_NO_CHANGE_BIT); - if (x == NULL || PyDict_SetItemString(d, "NO_CHANGE_BIT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_ELEM - x = PyInt_FromLong((long) AL_NO_ELEM); - if (x == NULL || PyDict_SetItemString(d, "NO_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_ERRORS - x = PyInt_FromLong((long) AL_NO_ERRORS); - if (x == NULL || PyDict_SetItemString(d, "NO_ERRORS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_OP - x = PyInt_FromLong((long) AL_NO_OP); - if (x == NULL || PyDict_SetItemString(d, "NO_OP", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_VAL - x = PyInt_FromLong((long) AL_NO_VAL); - if (x == NULL || PyDict_SetItemString(d, "NO_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NULL_INTERFACE - x = PyInt_FromLong((long) AL_NULL_INTERFACE); - if (x == NULL || PyDict_SetItemString(d, "NULL_INTERFACE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NULL_RESOURCE - x = PyInt_FromLong((long) AL_NULL_RESOURCE); - if (x == NULL || PyDict_SetItemString(d, "NULL_RESOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OPTICAL_IF_TYPE - x = PyInt_FromLong((long) AL_OPTICAL_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "OPTICAL_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_COUNT - x = PyInt_FromLong((long) AL_OUTPUT_COUNT); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_COUNT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_DEVICE_TYPE - x = PyInt_FromLong((long) AL_OUTPUT_DEVICE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_DEVICE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_HRB_TYPE - x = PyInt_FromLong((long) AL_OUTPUT_HRB_TYPE); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_HRB_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_PORT_TYPE - x = PyInt_FromLong((long) AL_OUTPUT_PORT_TYPE); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_PORT_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_RATE - x = PyInt_FromLong((long) AL_OUTPUT_RATE); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PARAM_BIT - x = PyInt_FromLong((long) AL_PARAM_BIT); - if (x == NULL || PyDict_SetItemString(d, "PARAM_BIT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PARAMS - x = PyInt_FromLong((long) AL_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "PARAMS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORT_COUNT - x = PyInt_FromLong((long) AL_PORT_COUNT); - if (x == NULL || PyDict_SetItemString(d, "PORT_COUNT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORT_TYPE - x = PyInt_FromLong((long) AL_PORT_TYPE); - if (x == NULL || PyDict_SetItemString(d, "PORT_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORTS - x = PyInt_FromLong((long) AL_PORTS); - if (x == NULL || PyDict_SetItemString(d, "PORTS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORTSTYLE_DIRECT - x = PyInt_FromLong((long) AL_PORTSTYLE_DIRECT); - if (x == NULL || PyDict_SetItemString(d, "PORTSTYLE_DIRECT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORTSTYLE_SERIAL - x = PyInt_FromLong((long) AL_PORTSTYLE_SERIAL); - if (x == NULL || PyDict_SetItemString(d, "PORTSTYLE_SERIAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PRINT_ERRORS - x = PyInt_FromLong((long) AL_PRINT_ERRORS); - if (x == NULL || PyDict_SetItemString(d, "PRINT_ERRORS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PTR_ELEM - x = PyInt_FromLong((long) AL_PTR_ELEM); - if (x == NULL || PyDict_SetItemString(d, "PTR_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RANGE_VALUE - x = PyInt_FromLong((long) AL_RANGE_VALUE); - if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE - x = PyInt_FromLong((long) AL_RATE); - if (x == NULL || PyDict_SetItemString(d, "RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_11025 - x = PyInt_FromLong((long) AL_RATE_11025); - if (x == NULL || PyDict_SetItemString(d, "RATE_11025", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_16000 - x = PyInt_FromLong((long) AL_RATE_16000); - if (x == NULL || PyDict_SetItemString(d, "RATE_16000", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_22050 - x = PyInt_FromLong((long) AL_RATE_22050); - if (x == NULL || PyDict_SetItemString(d, "RATE_22050", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_32000 - x = PyInt_FromLong((long) AL_RATE_32000); - if (x == NULL || PyDict_SetItemString(d, "RATE_32000", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_44100 - x = PyInt_FromLong((long) AL_RATE_44100); - if (x == NULL || PyDict_SetItemString(d, "RATE_44100", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_48000 - x = PyInt_FromLong((long) AL_RATE_48000); - if (x == NULL || PyDict_SetItemString(d, "RATE_48000", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_8000 - x = PyInt_FromLong((long) AL_RATE_8000); - if (x == NULL || PyDict_SetItemString(d, "RATE_8000", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_1 - x = PyInt_FromLong((long) AL_RATE_AES_1); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_1", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_1s - x = PyInt_FromLong((long) AL_RATE_AES_1s); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_1s", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_2 - x = PyInt_FromLong((long) AL_RATE_AES_2); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_2", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_3 - x = PyInt_FromLong((long) AL_RATE_AES_3); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_3", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_4 - x = PyInt_FromLong((long) AL_RATE_AES_4); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_4", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_6 - x = PyInt_FromLong((long) AL_RATE_AES_6); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_6", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_FRACTION_D - x = PyInt_FromLong((long) AL_RATE_FRACTION_D); - if (x == NULL || PyDict_SetItemString(d, "RATE_FRACTION_D", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_FRACTION_N - x = PyInt_FromLong((long) AL_RATE_FRACTION_N); - if (x == NULL || PyDict_SetItemString(d, "RATE_FRACTION_N", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_INPUTRATE - x = PyInt_FromLong((long) AL_RATE_INPUTRATE); - if (x == NULL || PyDict_SetItemString(d, "RATE_INPUTRATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_NO_DIGITAL_INPUT - x = PyInt_FromLong((long) AL_RATE_NO_DIGITAL_INPUT); - if (x == NULL || PyDict_SetItemString(d, "RATE_NO_DIGITAL_INPUT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_UNACQUIRED - x = PyInt_FromLong((long) AL_RATE_UNACQUIRED); - if (x == NULL || PyDict_SetItemString(d, "RATE_UNACQUIRED", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_UNDEFINED - x = PyInt_FromLong((long) AL_RATE_UNDEFINED); - if (x == NULL || PyDict_SetItemString(d, "RATE_UNDEFINED", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_REF_0DBV - x = PyInt_FromLong((long) AL_REF_0DBV); - if (x == NULL || PyDict_SetItemString(d, "REF_0DBV", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_REF_NONE - x = PyInt_FromLong((long) AL_REF_NONE); - if (x == NULL || PyDict_SetItemString(d, "REF_NONE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESERVED1_TYPE - x = PyInt_FromLong((long) AL_RESERVED1_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESERVED1_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESERVED2_TYPE - x = PyInt_FromLong((long) AL_RESERVED2_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESERVED2_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESERVED3_TYPE - x = PyInt_FromLong((long) AL_RESERVED3_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESERVED3_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESERVED4_TYPE - x = PyInt_FromLong((long) AL_RESERVED4_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESERVED4_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESOURCE - x = PyInt_FromLong((long) AL_RESOURCE); - if (x == NULL || PyDict_SetItemString(d, "RESOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESOURCE_ELEM - x = PyInt_FromLong((long) AL_RESOURCE_ELEM); - if (x == NULL || PyDict_SetItemString(d, "RESOURCE_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESOURCE_TYPE - x = PyInt_FromLong((long) AL_RESOURCE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESOURCE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT_INPUT_ATTEN - x = PyInt_FromLong((long) AL_RIGHT_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT_MONITOR_ATTEN - x = PyInt_FromLong((long) AL_RIGHT_MONITOR_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT_MONITOR_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT_SPEAKER_GAIN - x = PyInt_FromLong((long) AL_RIGHT_SPEAKER_GAIN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT_SPEAKER_GAIN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT1_INPUT_ATTEN - x = PyInt_FromLong((long) AL_RIGHT1_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT1_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT2_INPUT_ATTEN - x = PyInt_FromLong((long) AL_RIGHT2_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT2_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPFMT_DOUBLE - x = PyInt_FromLong((long) AL_SAMPFMT_DOUBLE); - if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_DOUBLE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPFMT_FLOAT - x = PyInt_FromLong((long) AL_SAMPFMT_FLOAT); - if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_FLOAT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPFMT_TWOSCOMP - x = PyInt_FromLong((long) AL_SAMPFMT_TWOSCOMP); - if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_TWOSCOMP", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPLE_16 - x = PyInt_FromLong((long) AL_SAMPLE_16); - if (x == NULL || PyDict_SetItemString(d, "SAMPLE_16", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPLE_24 - x = PyInt_FromLong((long) AL_SAMPLE_24); - if (x == NULL || PyDict_SetItemString(d, "SAMPLE_24", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPLE_8 - x = PyInt_FromLong((long) AL_SAMPLE_8); - if (x == NULL || PyDict_SetItemString(d, "SAMPLE_8", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SCALAR_VAL - x = PyInt_FromLong((long) AL_SCALAR_VAL); - if (x == NULL || PyDict_SetItemString(d, "SCALAR_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SET_VAL - x = PyInt_FromLong((long) AL_SET_VAL); - if (x == NULL || PyDict_SetItemString(d, "SET_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SHORT_NAME - x = PyInt_FromLong((long) AL_SHORT_NAME); - if (x == NULL || PyDict_SetItemString(d, "SHORT_NAME", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SMPTE272M_IF_TYPE - x = PyInt_FromLong((long) AL_SMPTE272M_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SMPTE272M_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SOURCE - x = PyInt_FromLong((long) AL_SOURCE); - if (x == NULL || PyDict_SetItemString(d, "SOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_IF_TYPE - x = PyInt_FromLong((long) AL_SPEAKER_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_MUTE_CTL - x = PyInt_FromLong((long) AL_SPEAKER_MUTE_CTL); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_CTL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_MUTE_OFF - x = PyInt_FromLong((long) AL_SPEAKER_MUTE_OFF); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_OFF", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_MUTE_ON - x = PyInt_FromLong((long) AL_SPEAKER_MUTE_ON); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_ON", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_PLUS_LINE_IF_TYPE - x = PyInt_FromLong((long) AL_SPEAKER_PLUS_LINE_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_PLUS_LINE_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_STEREO - x = PyInt_FromLong((long) AL_STEREO); - if (x == NULL || PyDict_SetItemString(d, "STEREO", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_STRING_VAL - x = PyInt_FromLong((long) AL_STRING_VAL); - if (x == NULL || PyDict_SetItemString(d, "STRING_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SUBSYSTEM - x = PyInt_FromLong((long) AL_SUBSYSTEM); - if (x == NULL || PyDict_SetItemString(d, "SUBSYSTEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SUBSYSTEM_TYPE - x = PyInt_FromLong((long) AL_SUBSYSTEM_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SUBSYSTEM_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SYNC_INPUT_TO_AES - x = PyInt_FromLong((long) AL_SYNC_INPUT_TO_AES); - if (x == NULL || PyDict_SetItemString(d, "SYNC_INPUT_TO_AES", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SYNC_OUTPUT_TO_AES - x = PyInt_FromLong((long) AL_SYNC_OUTPUT_TO_AES); - if (x == NULL || PyDict_SetItemString(d, "SYNC_OUTPUT_TO_AES", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SYSTEM - x = PyInt_FromLong((long) AL_SYSTEM); - if (x == NULL || PyDict_SetItemString(d, "SYSTEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SYSTEM_TYPE - x = PyInt_FromLong((long) AL_SYSTEM_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SYSTEM_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_TEST_IF_TYPE - x = PyInt_FromLong((long) AL_TEST_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "TEST_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_TYPE - x = PyInt_FromLong((long) AL_TYPE); - if (x == NULL || PyDict_SetItemString(d, "TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_TYPE_BIT - x = PyInt_FromLong((long) AL_TYPE_BIT); - if (x == NULL || PyDict_SetItemString(d, "TYPE_BIT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_UNUSED_COUNT - x = PyInt_FromLong((long) AL_UNUSED_COUNT); - if (x == NULL || PyDict_SetItemString(d, "UNUSED_COUNT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_UNUSED_PORTS - x = PyInt_FromLong((long) AL_UNUSED_PORTS); - if (x == NULL || PyDict_SetItemString(d, "UNUSED_PORTS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_VARIABLE_MCLK_TYPE - x = PyInt_FromLong((long) AL_VARIABLE_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "VARIABLE_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_VECTOR_VAL - x = PyInt_FromLong((long) AL_VECTOR_VAL); - if (x == NULL || PyDict_SetItemString(d, "VECTOR_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_VIDEO_MCLK_TYPE - x = PyInt_FromLong((long) AL_VIDEO_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "VIDEO_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_WORDSIZE - x = PyInt_FromLong((long) AL_WORDSIZE); - if (x == NULL || PyDict_SetItemString(d, "WORDSIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif - -#ifdef AL_NO_ELEM /* IRIX 6 */ - (void) alSetErrorHandler(ErrorHandler); -#endif /* AL_NO_ELEM */ -#ifdef OLD_INTERFACE - (void) ALseterrorhandler(ErrorHandler); -#endif /* OLD_INTERFACE */ - - error: - return; -} diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c deleted file mode 100644 index cccdf2a..0000000 --- a/Modules/bsddbmodule.c +++ /dev/null @@ -1,858 +0,0 @@ -/* Berkeley DB interface. - Author: Michael McLay - Hacked: Guido van Rossum - Btree and Recno additions plus sequence methods: David Ely - Hacked by Gustavo Niemeyer fixing recno - support. - - XXX To do: - - provide a way to access the various hash functions - - support more open flags - - The windows port of the Berkeley DB code is hard to find on the web: - www.nightmare.com/software.html -*/ - -#include "Python.h" -#ifdef WITH_THREAD -#include "pythread.h" -#endif - -#include -#include -#include -#ifdef HAVE_DB_185_H -#include -#else -#include -#endif -/* Please don't include internal header files of the Berkeley db package - (it messes up the info required in the Setup file) */ - -typedef struct { - PyObject_HEAD - DB *di_bsddb; - int di_size; /* -1 means recompute */ - int di_type; -#ifdef WITH_THREAD - PyThread_type_lock di_lock; -#endif -} bsddbobject; - -static PyTypeObject Bsddbtype; - -#define is_bsddbobject(v) ((v)->ob_type == &Bsddbtype) -#define check_bsddbobject_open(v, r) if ((v)->di_bsddb == NULL) \ - { PyErr_SetString(BsddbError, \ - "BSDDB object has already been closed"); \ - return r; } - -static PyObject *BsddbError; - -static PyObject * -newdbhashobject(char *file, int flags, int mode, - int bsize, int ffactor, int nelem, int cachesize, - int hash, int lorder) -{ - bsddbobject *dp; - HASHINFO info; - - if ((dp = PyObject_New(bsddbobject, &Bsddbtype)) == NULL) - return NULL; - - info.bsize = bsize; - info.ffactor = ffactor; - info.nelem = nelem; - info.cachesize = cachesize; - info.hash = NULL; /* XXX should derive from hash argument */ - info.lorder = lorder; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - Py_BEGIN_ALLOW_THREADS - dp->di_bsddb = dbopen(file, flags, mode, DB_HASH, &info); - Py_END_ALLOW_THREADS - if (dp->di_bsddb == NULL) { - PyErr_SetFromErrno(BsddbError); -#ifdef WITH_THREAD - dp->di_lock = NULL; -#endif - Py_DECREF(dp); - return NULL; - } - - dp->di_size = -1; - dp->di_type = DB_HASH; - -#ifdef WITH_THREAD - dp->di_lock = PyThread_allocate_lock(); - if (dp->di_lock == NULL) { - PyErr_SetString(BsddbError, "can't allocate lock"); - Py_DECREF(dp); - return NULL; - } -#endif - - return (PyObject *)dp; -} - -static PyObject * -newdbbtobject(char *file, int flags, int mode, - int btflags, int cachesize, int maxkeypage, - int minkeypage, int psize, int lorder) -{ - bsddbobject *dp; - BTREEINFO info; - - if ((dp = PyObject_New(bsddbobject, &Bsddbtype)) == NULL) - return NULL; - - info.flags = btflags; - info.cachesize = cachesize; - info.maxkeypage = maxkeypage; - info.minkeypage = minkeypage; - info.psize = psize; - info.lorder = lorder; - info.compare = 0; /* Use default comparison functions, for now..*/ - info.prefix = 0; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - Py_BEGIN_ALLOW_THREADS - dp->di_bsddb = dbopen(file, flags, mode, DB_BTREE, &info); - Py_END_ALLOW_THREADS - if (dp->di_bsddb == NULL) { - PyErr_SetFromErrno(BsddbError); -#ifdef WITH_THREAD - dp->di_lock = NULL; -#endif - Py_DECREF(dp); - return NULL; - } - - dp->di_size = -1; - dp->di_type = DB_BTREE; - -#ifdef WITH_THREAD - dp->di_lock = PyThread_allocate_lock(); - if (dp->di_lock == NULL) { - PyErr_SetString(BsddbError, "can't allocate lock"); - Py_DECREF(dp); - return NULL; - } -#endif - - return (PyObject *)dp; -} - -static PyObject * -newdbrnobject(char *file, int flags, int mode, - int rnflags, int cachesize, int psize, int lorder, - size_t reclen, u_char bval, char *bfname) -{ - bsddbobject *dp; - RECNOINFO info; - int fd; - - if ((dp = PyObject_New(bsddbobject, &Bsddbtype)) == NULL) - return NULL; - - info.flags = rnflags; - info.cachesize = cachesize; - info.psize = psize; - info.lorder = lorder; - info.reclen = reclen; - info.bval = bval; - info.bfname = bfname; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - /* This is a hack to avoid a dbopen() bug that happens when - * it fails. */ - fd = open(file, flags); - if (fd == -1) { - dp->di_bsddb = NULL; - } - else { - close(fd); - Py_BEGIN_ALLOW_THREADS - dp->di_bsddb = dbopen(file, flags, mode, DB_RECNO, &info); - Py_END_ALLOW_THREADS - } - if (dp->di_bsddb == NULL) { - PyErr_SetFromErrno(BsddbError); -#ifdef WITH_THREAD - dp->di_lock = NULL; -#endif - Py_DECREF(dp); - return NULL; - } - - dp->di_size = -1; - dp->di_type = DB_RECNO; - -#ifdef WITH_THREAD - dp->di_lock = PyThread_allocate_lock(); - if (dp->di_lock == NULL) { - PyErr_SetString(BsddbError, "can't allocate lock"); - Py_DECREF(dp); - return NULL; - } -#endif - - return (PyObject *)dp; -} - -static void -bsddb_dealloc(bsddbobject *dp) -{ -#ifdef WITH_THREAD - if (dp->di_lock) { - PyThread_acquire_lock(dp->di_lock, 0); - PyThread_release_lock(dp->di_lock); - PyThread_free_lock(dp->di_lock); - dp->di_lock = NULL; - } -#endif - if (dp->di_bsddb != NULL) { - int status; - Py_BEGIN_ALLOW_THREADS - status = (dp->di_bsddb->close)(dp->di_bsddb); - Py_END_ALLOW_THREADS - if (status != 0) - fprintf(stderr, - "Python bsddb: close errno %d in dealloc\n", - errno); - } - PyObject_Del(dp); -} - -#ifdef WITH_THREAD -#define BSDDB_BGN_SAVE(_dp) \ - Py_BEGIN_ALLOW_THREADS PyThread_acquire_lock(_dp->di_lock,1); -#define BSDDB_END_SAVE(_dp) \ - PyThread_release_lock(_dp->di_lock); Py_END_ALLOW_THREADS -#else -#define BSDDB_BGN_SAVE(_dp) Py_BEGIN_ALLOW_THREADS -#define BSDDB_END_SAVE(_dp) Py_END_ALLOW_THREADS -#endif - -static Py_ssize_t -bsddb_length(bsddbobject *dp) -{ - check_bsddbobject_open(dp, -1); - if (dp->di_size < 0) { - DBT krec, drec; - int status; - int size = 0; - BSDDB_BGN_SAVE(dp) - for (status = (dp->di_bsddb->seq)(dp->di_bsddb, - &krec, &drec,R_FIRST); - status == 0; - status = (dp->di_bsddb->seq)(dp->di_bsddb, - &krec, &drec, R_NEXT)) - size++; - BSDDB_END_SAVE(dp) - if (status < 0) { - PyErr_SetFromErrno(BsddbError); - return -1; - } - dp->di_size = size; - } - return dp->di_size; -} - -static PyObject * -bsddb_subscript(bsddbobject *dp, PyObject *key) -{ - int status; - DBT krec, drec; - char *data,buf[4096]; - int size; - PyObject *result; - recno_t recno; - - if (dp->di_type == DB_RECNO) { - if (!PyArg_Parse(key, "i", &recno)) { - PyErr_SetString(PyExc_TypeError, - "key type must be integer"); - return NULL; - } - krec.data = &recno; - krec.size = sizeof(recno); - } - else { - if (!PyArg_Parse(key, "s#", &data, &size)) { - PyErr_SetString(PyExc_TypeError, - "key type must be string"); - return NULL; - } - krec.data = data; - krec.size = size; - } - check_bsddbobject_open(dp, NULL); - - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->get)(dp->di_bsddb, &krec, &drec, 0); - if (status == 0) { - if (drec.size > sizeof(buf)) data = malloc(drec.size); - else data = buf; - if (data!=NULL) memcpy(data,drec.data,drec.size); - } - BSDDB_END_SAVE(dp) - if (data==NULL) return PyErr_NoMemory(); - if (status != 0) { - if (status < 0) - PyErr_SetFromErrno(BsddbError); - else - PyErr_SetObject(PyExc_KeyError, key); - return NULL; - } - - result = PyString_FromStringAndSize(data, (int)drec.size); - if (data != buf) free(data); - return result; -} - -static int -bsddb_ass_sub(bsddbobject *dp, PyObject *key, PyObject *value) -{ - int status; - DBT krec, drec; - char *data; - int size; - recno_t recno; - - if (dp->di_type == DB_RECNO) { - if (!PyArg_Parse(key, "i", &recno)) { - PyErr_SetString(PyExc_TypeError, - "bsddb key type must be integer"); - return -1; - } - krec.data = &recno; - krec.size = sizeof(recno); - } - else { - if (!PyArg_Parse(key, "s#", &data, &size)) { - PyErr_SetString(PyExc_TypeError, - "bsddb key type must be string"); - return -1; - } - krec.data = data; - krec.size = size; - } - check_bsddbobject_open(dp, -1); - dp->di_size = -1; - if (value == NULL) { - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->del)(dp->di_bsddb, &krec, 0); - BSDDB_END_SAVE(dp) - } - else { - if (!PyArg_Parse(value, "s#", &data, &size)) { - PyErr_SetString(PyExc_TypeError, - "bsddb value type must be string"); - return -1; - } - drec.data = data; - drec.size = size; - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->put)(dp->di_bsddb, &krec, &drec, 0); - BSDDB_END_SAVE(dp) - } - if (status != 0) { - if (status < 0) - PyErr_SetFromErrno(BsddbError); - else - PyErr_SetObject(PyExc_KeyError, key); - return -1; - } - return 0; -} - -static PyMappingMethods bsddb_as_mapping = { - (lenfunc)bsddb_length, /*mp_length*/ - (binaryfunc)bsddb_subscript, /*mp_subscript*/ - (objobjargproc)bsddb_ass_sub, /*mp_ass_subscript*/ -}; - -static PyObject * -bsddb_close(bsddbobject *dp) -{ - if (dp->di_bsddb != NULL) { - int status; - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->close)(dp->di_bsddb); - BSDDB_END_SAVE(dp) - if (status != 0) { - dp->di_bsddb = NULL; - PyErr_SetFromErrno(BsddbError); - return NULL; - } - } - dp->di_bsddb = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -bsddb_keys(bsddbobject *dp) -{ - PyObject *list, *item=NULL; - DBT krec, drec; - char *data=NULL,buf[4096]; - int status; - int err; - - check_bsddbobject_open(dp, NULL); - list = PyList_New(0); - if (list == NULL) - return NULL; - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec, &drec, R_FIRST); - if (status == 0) { - if (krec.size > sizeof(buf)) data = malloc(krec.size); - else data = buf; - if (data != NULL) memcpy(data,krec.data,krec.size); - } - BSDDB_END_SAVE(dp) - if (status == 0 && data==NULL) return PyErr_NoMemory(); - while (status == 0) { - if (dp->di_type == DB_RECNO) - item = PyInt_FromLong(*((int*)data)); - else - item = PyString_FromStringAndSize(data, - (int)krec.size); - if (data != buf) free(data); - if (item == NULL) { - Py_DECREF(list); - return NULL; - } - err = PyList_Append(list, item); - Py_DECREF(item); - if (err != 0) { - Py_DECREF(list); - return NULL; - } - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->seq) - (dp->di_bsddb, &krec, &drec, R_NEXT); - if (status == 0) { - if (krec.size > sizeof(buf)) - data = malloc(krec.size); - else data = buf; - if (data != NULL) - memcpy(data,krec.data,krec.size); - } - BSDDB_END_SAVE(dp) - if (data == NULL) return PyErr_NoMemory(); - } - if (status < 0) { - PyErr_SetFromErrno(BsddbError); - Py_DECREF(list); - return NULL; - } - if (dp->di_size < 0) - dp->di_size = PyList_Size(list); /* We just did the work */ - return list; -} - -static PyObject * -bsddb_contains(bsddbobject *dp, PyObject *args) -{ - DBT krec, drec; - int status; - char *data; - int size; - recno_t recno; - - if (dp->di_type == DB_RECNO) { - if (!PyArg_ParseTuple(args, "i;key type must be integer", - &recno)) { - return NULL; - } - krec.data = &recno; - krec.size = sizeof(recno); - } - else { - if (!PyArg_ParseTuple(args, "s#;key type must be string", - &data, &size)) { - return NULL; - } - krec.data = data; - krec.size = size; - } - check_bsddbobject_open(dp, NULL); - - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->get)(dp->di_bsddb, &krec, &drec, 0); - BSDDB_END_SAVE(dp) - if (status < 0) { - PyErr_SetFromErrno(BsddbError); - return NULL; - } - - return PyInt_FromLong(status == 0); -} - -static PyObject * -bsddb_set_location(bsddbobject *dp, PyObject *key) -{ - int status; - DBT krec, drec; - char *data,buf[4096]; - int size; - PyObject *result; - recno_t recno; - - if (dp->di_type == DB_RECNO) { - if (!PyArg_ParseTuple(key, "i;key type must be integer", - &recno)) { - return NULL; - } - krec.data = &recno; - krec.size = sizeof(recno); - } - else { - if (!PyArg_ParseTuple(key, "s#;key type must be string", - &data, &size)) { - return NULL; - } - krec.data = data; - krec.size = size; - } - check_bsddbobject_open(dp, NULL); - - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec, &drec, R_CURSOR); - if (status == 0) { - if (drec.size > sizeof(buf)) data = malloc(drec.size); - else data = buf; - if (data!=NULL) memcpy(data,drec.data,drec.size); - } - BSDDB_END_SAVE(dp) - if (data==NULL) return PyErr_NoMemory(); - if (status != 0) { - if (status < 0) - PyErr_SetFromErrno(BsddbError); - else - PyErr_SetObject(PyExc_KeyError, key); - return NULL; - } - - if (dp->di_type == DB_RECNO) - result = Py_BuildValue("is#", *((int*)krec.data), - data, drec.size); - else - result = Py_BuildValue("s#s#", krec.data, krec.size, - data, drec.size); - if (data != buf) free(data); - return result; -} - -static PyObject * -bsddb_seq(bsddbobject *dp, int sequence_request) -{ - int status; - DBT krec, drec; - char *kdata=NULL,kbuf[4096]; - char *ddata=NULL,dbuf[4096]; - PyObject *result; - - check_bsddbobject_open(dp, NULL); - krec.data = 0; - krec.size = 0; - - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec, - &drec, sequence_request); - if (status == 0) { - if (krec.size > sizeof(kbuf)) kdata = malloc(krec.size); - else kdata = kbuf; - if (kdata != NULL) memcpy(kdata,krec.data,krec.size); - if (drec.size > sizeof(dbuf)) ddata = malloc(drec.size); - else ddata = dbuf; - if (ddata != NULL) memcpy(ddata,drec.data,drec.size); - } - BSDDB_END_SAVE(dp) - if (status == 0) { - if ((kdata == NULL) || (ddata == NULL)) - return PyErr_NoMemory(); - } - else { - /* (status != 0) */ - if (status < 0) - PyErr_SetFromErrno(BsddbError); - else - PyErr_SetString(PyExc_KeyError, "no key/data pairs"); - return NULL; - } - - if (dp->di_type == DB_RECNO) - result = Py_BuildValue("is#", *((int*)kdata), - ddata, drec.size); - else - result = Py_BuildValue("s#s#", kdata, krec.size, - ddata, drec.size); - if (kdata != kbuf) free(kdata); - if (ddata != dbuf) free(ddata); - return result; -} - -static PyObject * -bsddb_next(bsddbobject *dp) -{ - return bsddb_seq(dp, R_NEXT); -} -static PyObject * -bsddb_previous(bsddbobject *dp) -{ - return bsddb_seq(dp, R_PREV); -} -static PyObject * -bsddb_first(bsddbobject *dp) -{ - return bsddb_seq(dp, R_FIRST); -} -static PyObject * -bsddb_last(bsddbobject *dp) -{ - return bsddb_seq(dp, R_LAST); -} -static PyObject * -bsddb_sync(bsddbobject *dp) -{ - int status; - - check_bsddbobject_open(dp, NULL); - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->sync)(dp->di_bsddb, 0); - BSDDB_END_SAVE(dp) - if (status != 0) { - PyErr_SetFromErrno(BsddbError); - return NULL; - } - return PyInt_FromLong(status = 0); -} -static PyMethodDef bsddb_methods[] = { - {"close", (PyCFunction)bsddb_close, METH_NOARGS}, - {"keys", (PyCFunction)bsddb_keys, METH_NOARGS}, - {"__contains__", (PyCFunction)bsddb_contains, METH_VARARGS}, - {"set_location", (PyCFunction)bsddb_set_location, METH_VARARGS}, - {"next", (PyCFunction)bsddb_next, METH_NOARGS}, - {"previous", (PyCFunction)bsddb_previous, METH_NOARGS}, - {"first", (PyCFunction)bsddb_first, METH_NOARGS}, - {"last", (PyCFunction)bsddb_last, METH_NOARGS}, - {"sync", (PyCFunction)bsddb_sync, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -bsddb_getattr(PyObject *dp, char *name) -{ - return Py_FindMethod(bsddb_methods, dp, name); -} - -static PyTypeObject Bsddbtype = { - PyObject_HEAD_INIT(NULL) - 0, - "bsddb.bsddb", - sizeof(bsddbobject), - 0, - (destructor)bsddb_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)bsddb_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - &bsddb_as_mapping, /*tp_as_mapping*/ -}; - -static PyObject * -bsdhashopen(PyObject *self, PyObject *args) -{ - char *file; - char *flag = NULL; - int flags = O_RDONLY; - int mode = 0666; - int bsize = 0; - int ffactor = 0; - int nelem = 0; - int cachesize = 0; - int hash = 0; /* XXX currently ignored */ - int lorder = 0; - - if (!PyArg_ParseTuple(args, "z|siiiiiii:hashopen", - &file, &flag, &mode, - &bsize, &ffactor, &nelem, &cachesize, - &hash, &lorder)) - return NULL; - if (flag != NULL) { - /* XXX need to pass O_EXCL, O_EXLOCK, O_NONBLOCK, O_SHLOCK */ - if (flag[0] == 'r') - flags = O_RDONLY; - else if (flag[0] == 'w') - flags = O_RDWR; - else if (flag[0] == 'c') - flags = O_RDWR|O_CREAT; - else if (flag[0] == 'n') - flags = O_RDWR|O_CREAT|O_TRUNC; - else { - PyErr_SetString(BsddbError, - "Flag should begin with 'r', 'w', 'c' or 'n'"); - return NULL; - } - if (flag[1] == 'l') { -#if defined(O_EXLOCK) && defined(O_SHLOCK) - if (flag[0] == 'r') - flags |= O_SHLOCK; - else - flags |= O_EXLOCK; -#else - PyErr_SetString(BsddbError, - "locking not supported on this platform"); - return NULL; -#endif - } - } - return newdbhashobject(file, flags, mode, - bsize, ffactor, nelem, cachesize, hash, lorder); -} - -static PyObject * -bsdbtopen(PyObject *self, PyObject *args) -{ - char *file; - char *flag = NULL; - int flags = O_RDONLY; - int mode = 0666; - int cachesize = 0; - int maxkeypage = 0; - int minkeypage = 0; - int btflags = 0; - unsigned int psize = 0; - int lorder = 0; - - if (!PyArg_ParseTuple(args, "z|siiiiiii:btopen", - &file, &flag, &mode, - &btflags, &cachesize, &maxkeypage, &minkeypage, - &psize, &lorder)) - return NULL; - if (flag != NULL) { - /* XXX need to pass O_EXCL, O_EXLOCK, O_NONBLOCK, O_SHLOCK */ - if (flag[0] == 'r') - flags = O_RDONLY; - else if (flag[0] == 'w') - flags = O_RDWR; - else if (flag[0] == 'c') - flags = O_RDWR|O_CREAT; - else if (flag[0] == 'n') - flags = O_RDWR|O_CREAT|O_TRUNC; - else { - PyErr_SetString(BsddbError, - "Flag should begin with 'r', 'w', 'c' or 'n'"); - return NULL; - } - if (flag[1] == 'l') { -#if defined(O_EXLOCK) && defined(O_SHLOCK) - if (flag[0] == 'r') - flags |= O_SHLOCK; - else - flags |= O_EXLOCK; -#else - PyErr_SetString(BsddbError, - "locking not supported on this platform"); - return NULL; -#endif - } - } - return newdbbtobject(file, flags, mode, - btflags, cachesize, maxkeypage, minkeypage, - psize, lorder); -} - -static PyObject * -bsdrnopen(PyObject *self, PyObject *args) -{ - char *file; - char *flag = NULL; - int flags = O_RDONLY; - int mode = 0666; - int cachesize = 0; - int rnflags = 0; - unsigned int psize = 0; - int lorder = 0; - size_t reclen = 0; - char *bval = ""; - char *bfname = NULL; - - if (!PyArg_ParseTuple(args, "z|siiiiiiss:rnopen", - &file, &flag, &mode, - &rnflags, &cachesize, &psize, &lorder, - &reclen, &bval, &bfname)) - return NULL; - - if (flag != NULL) { - /* XXX need to pass O_EXCL, O_EXLOCK, O_NONBLOCK, O_SHLOCK */ - if (flag[0] == 'r') - flags = O_RDONLY; - else if (flag[0] == 'w') - flags = O_RDWR; - else if (flag[0] == 'c') - flags = O_RDWR|O_CREAT; - else if (flag[0] == 'n') - flags = O_RDWR|O_CREAT|O_TRUNC; - else { - PyErr_SetString(BsddbError, - "Flag should begin with 'r', 'w', 'c' or 'n'"); - return NULL; - } - if (flag[1] == 'l') { -#if defined(O_EXLOCK) && defined(O_SHLOCK) - if (flag[0] == 'r') - flags |= O_SHLOCK; - else - flags |= O_EXLOCK; -#else - PyErr_SetString(BsddbError, - "locking not supported on this platform"); - return NULL; -#endif - } - else if (flag[1] != '\0') { - PyErr_SetString(BsddbError, - "Flag char 2 should be 'l' or absent"); - return NULL; - } - } - return newdbrnobject(file, flags, mode, rnflags, cachesize, - psize, lorder, reclen, bval[0], bfname); -} - -static PyMethodDef bsddbmodule_methods[] = { - {"hashopen", (PyCFunction)bsdhashopen, METH_VARARGS}, - {"btopen", (PyCFunction)bsdbtopen, METH_VARARGS}, - {"rnopen", (PyCFunction)bsdrnopen, METH_VARARGS}, - /* strictly for use by dbhhash!!! */ - {"open", (PyCFunction)bsdhashopen, METH_VARARGS}, - {0, 0}, -}; - -PyMODINIT_FUNC -initbsddb185(void) { - PyObject *m, *d; - - Bsddbtype.ob_type = &PyType_Type; - m = Py_InitModule("bsddb185", bsddbmodule_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - BsddbError = PyErr_NewException("bsddb.error", NULL, NULL); - if (BsddbError != NULL) - PyDict_SetItemString(d, "error", BsddbError); -} diff --git a/Modules/cdmodule.c b/Modules/cdmodule.c deleted file mode 100644 index f8efd39..0000000 --- a/Modules/cdmodule.c +++ /dev/null @@ -1,796 +0,0 @@ -/* CD module -- interface to Mark Callow's and Roger Chickering's */ - /* CD Audio Library (CD). */ - -#include -#include -#include "Python.h" - -#define NCALLBACKS 8 - -typedef struct { - PyObject_HEAD - CDPLAYER *ob_cdplayer; -} cdplayerobject; - -static PyObject *CdError; /* exception cd.error */ - -static PyObject * -CD_allowremoval(cdplayerobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":allowremoval")) - return NULL; - - CDallowremoval(self->ob_cdplayer); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_preventremoval(cdplayerobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":preventremoval")) - return NULL; - - CDpreventremoval(self->ob_cdplayer); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_bestreadsize(cdplayerobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":bestreadsize")) - return NULL; - - return PyInt_FromLong((long) CDbestreadsize(self->ob_cdplayer)); -} - -static PyObject * -CD_close(cdplayerobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":close")) - return NULL; - - if (!CDclose(self->ob_cdplayer)) { - PyErr_SetFromErrno(CdError); /* XXX - ??? */ - return NULL; - } - self->ob_cdplayer = NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_eject(cdplayerobject *self, PyObject *args) -{ - CDSTATUS status; - - if (!PyArg_ParseTuple(args, ":eject")) - return NULL; - - if (!CDeject(self->ob_cdplayer)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "eject failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_getstatus(cdplayerobject *self, PyObject *args) -{ - CDSTATUS status; - - if (!PyArg_ParseTuple(args, ":getstatus")) - return NULL; - - if (!CDgetstatus(self->ob_cdplayer, &status)) { - PyErr_SetFromErrno(CdError); /* XXX - ??? */ - return NULL; - } - - return Py_BuildValue("(ii(iii)(iii)(iii)iiii)", status.state, - status.track, status.min, status.sec, status.frame, - status.abs_min, status.abs_sec, status.abs_frame, - status.total_min, status.total_sec, status.total_frame, - status.first, status.last, status.scsi_audio, - status.cur_block); -} - -static PyObject * -CD_gettrackinfo(cdplayerobject *self, PyObject *args) -{ - int track; - CDTRACKINFO info; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "i:gettrackinfo", &track)) - return NULL; - - if (!CDgettrackinfo(self->ob_cdplayer, track, &info)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "gettrackinfo failed"); - return NULL; - } - - return Py_BuildValue("((iii)(iii))", - info.start_min, info.start_sec, info.start_frame, - info.total_min, info.total_sec, info.total_frame); -} - -static PyObject * -CD_msftoblock(cdplayerobject *self, PyObject *args) -{ - int min, sec, frame; - - if (!PyArg_ParseTuple(args, "iii:msftoblock", &min, &sec, &frame)) - return NULL; - - return PyInt_FromLong((long) CDmsftoblock(self->ob_cdplayer, - min, sec, frame)); -} - -static PyObject * -CD_play(cdplayerobject *self, PyObject *args) -{ - int start, play; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "ii:play", &start, &play)) - return NULL; - - if (!CDplay(self->ob_cdplayer, start, play)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "play failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_playabs(cdplayerobject *self, PyObject *args) -{ - int min, sec, frame, play; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "iiii:playabs", &min, &sec, &frame, &play)) - return NULL; - - if (!CDplayabs(self->ob_cdplayer, min, sec, frame, play)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "playabs failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_playtrack(cdplayerobject *self, PyObject *args) -{ - int start, play; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "ii:playtrack", &start, &play)) - return NULL; - - if (!CDplaytrack(self->ob_cdplayer, start, play)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "playtrack failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_playtrackabs(cdplayerobject *self, PyObject *args) -{ - int track, min, sec, frame, play; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "iiiii:playtrackabs", &track, &min, &sec, - &frame, &play)) - return NULL; - - if (!CDplaytrackabs(self->ob_cdplayer, track, min, sec, frame, play)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "playtrackabs failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_readda(cdplayerobject *self, PyObject *args) -{ - int numframes, n; - PyObject *result; - - if (!PyArg_ParseTuple(args, "i:readda", &numframes)) - return NULL; - - result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); - if (result == NULL) - return NULL; - - n = CDreadda(self->ob_cdplayer, - (CDFRAME *) PyString_AsString(result), numframes); - if (n == -1) { - Py_DECREF(result); - PyErr_SetFromErrno(CdError); - return NULL; - } - if (n < numframes) - _PyString_Resize(&result, n * sizeof(CDFRAME)); - - return result; -} - -static PyObject * -CD_seek(cdplayerobject *self, PyObject *args) -{ - int min, sec, frame; - long PyTryBlock; - - if (!PyArg_ParseTuple(args, "iii:seek", &min, &sec, &frame)) - return NULL; - - PyTryBlock = CDseek(self->ob_cdplayer, min, sec, frame); - if (PyTryBlock == -1) { - PyErr_SetFromErrno(CdError); - return NULL; - } - - return PyInt_FromLong(PyTryBlock); -} - -static PyObject * -CD_seektrack(cdplayerobject *self, PyObject *args) -{ - int track; - long PyTryBlock; - - if (!PyArg_ParseTuple(args, "i:seektrack", &track)) - return NULL; - - PyTryBlock = CDseektrack(self->ob_cdplayer, track); - if (PyTryBlock == -1) { - PyErr_SetFromErrno(CdError); - return NULL; - } - - return PyInt_FromLong(PyTryBlock); -} - -static PyObject * -CD_seekblock(cdplayerobject *self, PyObject *args) -{ - unsigned long PyTryBlock; - - if (!PyArg_ParseTuple(args, "l:seekblock", &PyTryBlock)) - return NULL; - - PyTryBlock = CDseekblock(self->ob_cdplayer, PyTryBlock); - if (PyTryBlock == (unsigned long) -1) { - PyErr_SetFromErrno(CdError); - return NULL; - } - - return PyInt_FromLong(PyTryBlock); -} - -static PyObject * -CD_stop(cdplayerobject *self, PyObject *args) -{ - CDSTATUS status; - - if (!PyArg_ParseTuple(args, ":stop")) - return NULL; - - if (!CDstop(self->ob_cdplayer)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "stop failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_togglepause(cdplayerobject *self, PyObject *args) -{ - CDSTATUS status; - - if (!PyArg_ParseTuple(args, ":togglepause")) - return NULL; - - if (!CDtogglepause(self->ob_cdplayer)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "togglepause failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef cdplayer_methods[] = { - {"allowremoval", (PyCFunction)CD_allowremoval, METH_VARARGS}, - {"bestreadsize", (PyCFunction)CD_bestreadsize, METH_VARARGS}, - {"close", (PyCFunction)CD_close, METH_VARARGS}, - {"eject", (PyCFunction)CD_eject, METH_VARARGS}, - {"getstatus", (PyCFunction)CD_getstatus, METH_VARARGS}, - {"gettrackinfo", (PyCFunction)CD_gettrackinfo, METH_VARARGS}, - {"msftoblock", (PyCFunction)CD_msftoblock, METH_VARARGS}, - {"play", (PyCFunction)CD_play, METH_VARARGS}, - {"playabs", (PyCFunction)CD_playabs, METH_VARARGS}, - {"playtrack", (PyCFunction)CD_playtrack, METH_VARARGS}, - {"playtrackabs", (PyCFunction)CD_playtrackabs, METH_VARARGS}, - {"preventremoval", (PyCFunction)CD_preventremoval, METH_VARARGS}, - {"readda", (PyCFunction)CD_readda, METH_VARARGS}, - {"seek", (PyCFunction)CD_seek, METH_VARARGS}, - {"seekblock", (PyCFunction)CD_seekblock, METH_VARARGS}, - {"seektrack", (PyCFunction)CD_seektrack, METH_VARARGS}, - {"stop", (PyCFunction)CD_stop, METH_VARARGS}, - {"togglepause", (PyCFunction)CD_togglepause, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -cdplayer_dealloc(cdplayerobject *self) -{ - if (self->ob_cdplayer != NULL) - CDclose(self->ob_cdplayer); - PyObject_Del(self); -} - -static PyObject * -cdplayer_getattr(cdplayerobject *self, char *name) -{ - if (self->ob_cdplayer == NULL) { - PyErr_SetString(PyExc_RuntimeError, "no player active"); - return NULL; - } - return Py_FindMethod(cdplayer_methods, (PyObject *)self, name); -} - -PyTypeObject CdPlayertype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "cd.cdplayer", /*tp_name*/ - sizeof(cdplayerobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cdplayer_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)cdplayer_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - -static PyObject * -newcdplayerobject(CDPLAYER *cdp) -{ - cdplayerobject *p; - - p = PyObject_New(cdplayerobject, &CdPlayertype); - if (p == NULL) - return NULL; - p->ob_cdplayer = cdp; - return (PyObject *) p; -} - -static PyObject * -CD_open(PyObject *self, PyObject *args) -{ - char *dev, *direction; - CDPLAYER *cdp; - - /* - * Variable number of args. - * First defaults to "None", second defaults to "r". - */ - dev = NULL; - direction = "r"; - if (!PyArg_ParseTuple(args, "|zs:open", &dev, &direction)) - return NULL; - - cdp = CDopen(dev, direction); - if (cdp == NULL) { - PyErr_SetFromErrno(CdError); - return NULL; - } - - return newcdplayerobject(cdp); -} - -typedef struct { - PyObject_HEAD - CDPARSER *ob_cdparser; - struct { - PyObject *ob_cdcallback; - PyObject *ob_cdcallbackarg; - } ob_cdcallbacks[NCALLBACKS]; -} cdparserobject; - -static void -CD_callback(void *arg, CDDATATYPES type, void *data) -{ - PyObject *result, *args, *v = NULL; - char *p; - int i; - cdparserobject *self; - - self = (cdparserobject *) arg; - args = PyTuple_New(3); - if (args == NULL) - return; - Py_INCREF(self->ob_cdcallbacks[type].ob_cdcallbackarg); - PyTuple_SetItem(args, 0, self->ob_cdcallbacks[type].ob_cdcallbackarg); - PyTuple_SetItem(args, 1, PyInt_FromLong((long) type)); - switch (type) { - case cd_audio: - v = PyString_FromStringAndSize(data, CDDA_DATASIZE); - break; - case cd_pnum: - case cd_index: - v = PyInt_FromLong(((CDPROGNUM *) data)->value); - break; - case cd_ptime: - case cd_atime: -#define ptr ((struct cdtimecode *) data) - v = Py_BuildValue("(iii)", - ptr->mhi * 10 + ptr->mlo, - ptr->shi * 10 + ptr->slo, - ptr->fhi * 10 + ptr->flo); -#undef ptr - break; - case cd_catalog: - v = PyString_FromStringAndSize(NULL, 13); - p = PyString_AsString(v); - for (i = 0; i < 13; i++) - *p++ = ((char *) data)[i] + '0'; - break; - case cd_ident: -#define ptr ((struct cdident *) data) - v = PyString_FromStringAndSize(NULL, 12); - p = PyString_AsString(v); - CDsbtoa(p, ptr->country, 2); - p += 2; - CDsbtoa(p, ptr->owner, 3); - p += 3; - *p++ = ptr->year[0] + '0'; - *p++ = ptr->year[1] + '0'; - *p++ = ptr->serial[0] + '0'; - *p++ = ptr->serial[1] + '0'; - *p++ = ptr->serial[2] + '0'; - *p++ = ptr->serial[3] + '0'; - *p++ = ptr->serial[4] + '0'; -#undef ptr - break; - case cd_control: - v = PyInt_FromLong((long) *((unchar *) data)); - break; - } - PyTuple_SetItem(args, 2, v); - if (PyErr_Occurred()) { - Py_DECREF(args); - return; - } - - result = PyEval_CallObject(self->ob_cdcallbacks[type].ob_cdcallback, - args); - Py_DECREF(args); - Py_XDECREF(result); -} - -static PyObject * -CD_deleteparser(cdparserobject *self, PyObject *args) -{ - int i; - - if (!PyArg_ParseTuple(args, ":deleteparser")) - return NULL; - - CDdeleteparser(self->ob_cdparser); - self->ob_cdparser = NULL; - - /* no sense in keeping the callbacks, so remove them */ - for (i = 0; i < NCALLBACKS; i++) { - Py_XDECREF(self->ob_cdcallbacks[i].ob_cdcallback); - self->ob_cdcallbacks[i].ob_cdcallback = NULL; - Py_XDECREF(self->ob_cdcallbacks[i].ob_cdcallbackarg); - self->ob_cdcallbacks[i].ob_cdcallbackarg = NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_parseframe(cdparserobject *self, PyObject *args) -{ - char *cdfp; - int length; - CDFRAME *p; - - if (!PyArg_ParseTuple(args, "s#:parseframe", &cdfp, &length)) - return NULL; - - if (length % sizeof(CDFRAME) != 0) { - PyErr_SetString(PyExc_TypeError, "bad length"); - return NULL; - } - - p = (CDFRAME *) cdfp; - while (length > 0) { - CDparseframe(self->ob_cdparser, p); - length -= sizeof(CDFRAME); - p++; - if (PyErr_Occurred()) - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_removecallback(cdparserobject *self, PyObject *args) -{ - int type; - - if (!PyArg_ParseTuple(args, "i:removecallback", &type)) - return NULL; - - if (type < 0 || type >= NCALLBACKS) { - PyErr_SetString(PyExc_TypeError, "bad type"); - return NULL; - } - - CDremovecallback(self->ob_cdparser, (CDDATATYPES) type); - - Py_XDECREF(self->ob_cdcallbacks[type].ob_cdcallback); - self->ob_cdcallbacks[type].ob_cdcallback = NULL; - - Py_XDECREF(self->ob_cdcallbacks[type].ob_cdcallbackarg); - self->ob_cdcallbacks[type].ob_cdcallbackarg = NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_resetparser(cdparserobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":resetparser")) - return NULL; - - CDresetparser(self->ob_cdparser); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_addcallback(cdparserobject *self, PyObject *args) -{ - int type; - PyObject *func, *funcarg; - - /* XXX - more work here */ - if (!PyArg_ParseTuple(args, "iOO:addcallback", &type, &func, &funcarg)) - return NULL; - - if (type < 0 || type >= NCALLBACKS) { - PyErr_SetString(PyExc_TypeError, "argument out of range"); - return NULL; - } - -#ifdef CDsetcallback - CDaddcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, - (void *) self); -#else - CDsetcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, - (void *) self); -#endif - Py_XDECREF(self->ob_cdcallbacks[type].ob_cdcallback); - Py_INCREF(func); - self->ob_cdcallbacks[type].ob_cdcallback = func; - Py_XDECREF(self->ob_cdcallbacks[type].ob_cdcallbackarg); - Py_INCREF(funcarg); - self->ob_cdcallbacks[type].ob_cdcallbackarg = funcarg; - -/* - if (type == cd_audio) { - sigfpe_[_UNDERFL].repls = _ZERO; - handle_sigfpes(_ON, _EN_UNDERFL, NULL, - _ABORT_ON_ERROR, NULL); - } -*/ - - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef cdparser_methods[] = { - {"addcallback", (PyCFunction)CD_addcallback, METH_VARARGS}, - {"deleteparser", (PyCFunction)CD_deleteparser, METH_VARARGS}, - {"parseframe", (PyCFunction)CD_parseframe, METH_VARARGS}, - {"removecallback", (PyCFunction)CD_removecallback, METH_VARARGS}, - {"resetparser", (PyCFunction)CD_resetparser, METH_VARARGS}, - /* backward compatibility */ - {"setcallback", (PyCFunction)CD_addcallback, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -cdparser_dealloc(cdparserobject *self) -{ - int i; - - for (i = 0; i < NCALLBACKS; i++) { - Py_XDECREF(self->ob_cdcallbacks[i].ob_cdcallback); - self->ob_cdcallbacks[i].ob_cdcallback = NULL; - Py_XDECREF(self->ob_cdcallbacks[i].ob_cdcallbackarg); - self->ob_cdcallbacks[i].ob_cdcallbackarg = NULL; - } - CDdeleteparser(self->ob_cdparser); - PyObject_Del(self); -} - -static PyObject * -cdparser_getattr(cdparserobject *self, char *name) -{ - if (self->ob_cdparser == NULL) { - PyErr_SetString(PyExc_RuntimeError, "no parser active"); - return NULL; - } - - return Py_FindMethod(cdparser_methods, (PyObject *)self, name); -} - -PyTypeObject CdParsertype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "cd.cdparser", /*tp_name*/ - sizeof(cdparserobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cdparser_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)cdparser_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - -static PyObject * -newcdparserobject(CDPARSER *cdp) -{ - cdparserobject *p; - int i; - - p = PyObject_New(cdparserobject, &CdParsertype); - if (p == NULL) - return NULL; - p->ob_cdparser = cdp; - for (i = 0; i < NCALLBACKS; i++) { - p->ob_cdcallbacks[i].ob_cdcallback = NULL; - p->ob_cdcallbacks[i].ob_cdcallbackarg = NULL; - } - return (PyObject *) p; -} - -static PyObject * -CD_createparser(PyObject *self, PyObject *args) -{ - CDPARSER *cdp; - - if (!PyArg_ParseTuple(args, ":createparser")) - return NULL; - cdp = CDcreateparser(); - if (cdp == NULL) { - PyErr_SetString(CdError, "createparser failed"); - return NULL; - } - - return newcdparserobject(cdp); -} - -static PyObject * -CD_msftoframe(PyObject *self, PyObject *args) -{ - int min, sec, frame; - - if (!PyArg_ParseTuple(args, "iii:msftoframe", &min, &sec, &frame)) - return NULL; - - return PyInt_FromLong((long) CDmsftoframe(min, sec, frame)); -} - -static PyMethodDef CD_methods[] = { - {"open", (PyCFunction)CD_open, METH_VARARGS}, - {"createparser", (PyCFunction)CD_createparser, METH_VARARGS}, - {"msftoframe", (PyCFunction)CD_msftoframe, METH_VARARGS}, - {NULL, NULL} /* Sentinel */ -}; - -void -initcd(void) -{ - PyObject *m, *d; - - m = Py_InitModule("cd", CD_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - - CdError = PyErr_NewException("cd.error", NULL, NULL); - PyDict_SetItemString(d, "error", CdError); - - /* Identifiers for the different types of callbacks from the parser */ - PyDict_SetItemString(d, "audio", PyInt_FromLong((long) cd_audio)); - PyDict_SetItemString(d, "pnum", PyInt_FromLong((long) cd_pnum)); - PyDict_SetItemString(d, "index", PyInt_FromLong((long) cd_index)); - PyDict_SetItemString(d, "ptime", PyInt_FromLong((long) cd_ptime)); - PyDict_SetItemString(d, "atime", PyInt_FromLong((long) cd_atime)); - PyDict_SetItemString(d, "catalog", PyInt_FromLong((long) cd_catalog)); - PyDict_SetItemString(d, "ident", PyInt_FromLong((long) cd_ident)); - PyDict_SetItemString(d, "control", PyInt_FromLong((long) cd_control)); - - /* Block size information for digital audio data */ - PyDict_SetItemString(d, "DATASIZE", - PyInt_FromLong((long) CDDA_DATASIZE)); - PyDict_SetItemString(d, "BLOCKSIZE", - PyInt_FromLong((long) CDDA_BLOCKSIZE)); - - /* Possible states for the cd player */ - PyDict_SetItemString(d, "ERROR", PyInt_FromLong((long) CD_ERROR)); - PyDict_SetItemString(d, "NODISC", PyInt_FromLong((long) CD_NODISC)); - PyDict_SetItemString(d, "READY", PyInt_FromLong((long) CD_READY)); - PyDict_SetItemString(d, "PLAYING", PyInt_FromLong((long) CD_PLAYING)); - PyDict_SetItemString(d, "PAUSED", PyInt_FromLong((long) CD_PAUSED)); - PyDict_SetItemString(d, "STILL", PyInt_FromLong((long) CD_STILL)); -#ifdef CD_CDROM /* only newer versions of the library */ - PyDict_SetItemString(d, "CDROM", PyInt_FromLong((long) CD_CDROM)); -#endif -} diff --git a/Modules/cgen.py b/Modules/cgen.py deleted file mode 100644 index 93c21b1..0000000 --- a/Modules/cgen.py +++ /dev/null @@ -1,520 +0,0 @@ -######################################################################## -# Copyright (c) 2000, BeOpen.com. -# Copyright (c) 1995-2000, Corporation for National Research Initiatives. -# Copyright (c) 1990-1995, Stichting Mathematisch Centrum. -# All rights reserved. -# -# See the file "Misc/COPYRIGHT" for information on usage and -# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. -######################################################################## - -# Python script to parse cstubs file for gl and generate C stubs. -# usage: python cgen.py glmodule.c -# -# NOTE: You must first make a python binary without the "GL" option -# before you can run this, when building Python for the first time. -# See comments in the Makefile. -# -# XXX BUG return arrays generate wrong code -# XXX need to change error returns into gotos to free mallocked arrays - - -import string -import sys - - -# Function to print to stderr -# -def err(*args): - savestdout = sys.stdout - try: - sys.stdout = sys.stderr - for i in args: - print i, - print - finally: - sys.stdout = savestdout - - -# The set of digits that form a number -# -digits = '0123456789' - - -# Function to extract a string of digits from the front of the string. -# Returns the leading string of digits and the remaining string. -# If no number is found, returns '' and the original string. -# -def getnum(s): - n = '' - while s and s[0] in digits: - n = n + s[0] - s = s[1:] - return n, s - - -# Function to check if a string is a number -# -def isnum(s): - if not s: return False - for c in s: - if not c in digits: return False - return True - - -# Allowed function return types -# -return_types = ['void', 'short', 'long'] - - -# Allowed function argument types -# -arg_types = ['char', 'string', 'short', 'u_short', 'float', 'long', 'double'] - - -# Need to classify arguments as follows -# simple input variable -# simple output variable -# input array -# output array -# input giving size of some array -# -# Array dimensions can be specified as follows -# constant -# argN -# constant * argN -# retval -# constant * retval -# -# The dimensions given as constants * something are really -# arrays of points where points are 2- 3- or 4-tuples -# -# We have to consider three lists: -# python input arguments -# C stub arguments (in & out) -# python output arguments (really return values) -# -# There is a mapping from python input arguments to the input arguments -# of the C stub, and a further mapping from C stub arguments to the -# python return values - - -# Exception raised by checkarg() and generate() -# -arg_error = 'bad arg' - - -# Function to check one argument. -# Arguments: the type and the arg "name" (really mode plus subscript). -# Raises arg_error if something's wrong. -# Return type, mode, factor, rest of subscript; factor and rest may be empty. -# -def checkarg(type, arg): - # - # Turn "char *x" into "string x". - # - if type == 'char' and arg[0] == '*': - type = 'string' - arg = arg[1:] - # - # Check that the type is supported. - # - if type not in arg_types: - raise arg_error, ('bad type', type) - if type[:2] == 'u_': - type = 'unsigned ' + type[2:] - # - # Split it in the mode (first character) and the rest. - # - mode, rest = arg[:1], arg[1:] - # - # The mode must be 's' for send (= input) or 'r' for return argument. - # - if mode not in ('r', 's'): - raise arg_error, ('bad arg mode', mode) - # - # Is it a simple argument: if so, we are done. - # - if not rest: - return type, mode, '', '' - # - # Not a simple argument; must be an array. - # The 'rest' must be a subscript enclosed in [ and ]. - # The subscript must be one of the following forms, - # otherwise we don't handle it (where N is a number): - # N - # argN - # retval - # N*argN - # N*retval - # - if rest[:1] != '[' or rest[-1:] != ']': - raise arg_error, ('subscript expected', rest) - sub = rest[1:-1] - # - # Is there a leading number? - # - num, sub = getnum(sub) - if num: - # There is a leading number - if not sub: - # The subscript is just a number - return type, mode, num, '' - if sub[:1] == '*': - # There is a factor prefix - sub = sub[1:] - else: - raise arg_error, ('\'*\' expected', sub) - if sub == 'retval': - # size is retval -- must be a reply argument - if mode != 'r': - raise arg_error, ('non-r mode with [retval]', mode) - elif not isnum(sub) and (sub[:3] != 'arg' or not isnum(sub[3:])): - raise arg_error, ('bad subscript', sub) - # - return type, mode, num, sub - - -# List of functions for which we have generated stubs -# -functions = [] - - -# Generate the stub for the given function, using the database of argument -# information build by successive calls to checkarg() -# -def generate(type, func, database): - # - # Check that we can handle this case: - # no variable size reply arrays yet - # - n_in_args = 0 - n_out_args = 0 - # - for a_type, a_mode, a_factor, a_sub in database: - if a_mode == 's': - n_in_args = n_in_args + 1 - elif a_mode == 'r': - n_out_args = n_out_args + 1 - else: - # Can't happen - raise arg_error, ('bad a_mode', a_mode) - if (a_mode == 'r' and a_sub) or a_sub == 'retval': - err('Function', func, 'too complicated:', - a_type, a_mode, a_factor, a_sub) - print '/* XXX Too complicated to generate code for */' - return - # - functions.append(func) - # - # Stub header - # - print - print 'static PyObject *' - print 'gl_' + func + '(self, args)' - print '\tPyObject *self;' - print '\tPyObject *args;' - print '{' - # - # Declare return value if any - # - if type != 'void': - print '\t' + type, 'retval;' - # - # Declare arguments - # - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - print '\t' + a_type, - brac = ket = '' - if a_sub and not isnum(a_sub): - if a_factor: - brac = '(' - ket = ')' - print brac + '*', - print 'arg' + repr(i+1) + ket, - if a_sub and isnum(a_sub): - print '[', a_sub, ']', - if a_factor: - print '[', a_factor, ']', - print ';' - # - # Find input arguments derived from array sizes - # - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 's' and a_sub[:3] == 'arg' and isnum(a_sub[3:]): - # Sending a variable-length array - n = eval(a_sub[3:]) - if 1 <= n <= len(database): - b_type, b_mode, b_factor, b_sub = database[n-1] - if b_mode == 's': - database[n-1] = b_type, 'i', a_factor, repr(i) - n_in_args = n_in_args - 1 - # - # Assign argument positions in the Python argument list - # - in_pos = [] - i_in = 0 - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 's': - in_pos.append(i_in) - i_in = i_in + 1 - else: - in_pos.append(-1) - # - # Get input arguments - # - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_type[:9] == 'unsigned ': - xtype = a_type[9:] - else: - xtype = a_type - if a_mode == 'i': - # - # Implicit argument; - # a_factor is divisor if present, - # a_sub indicates which arg (`database index`) - # - j = eval(a_sub) - print '\tif', - print '(!geti' + xtype + 'arraysize(args,', - print repr(n_in_args) + ',', - print repr(in_pos[j]) + ',', - if xtype != a_type: - print '('+xtype+' *)', - print '&arg' + repr(i+1) + '))' - print '\t\treturn NULL;' - if a_factor: - print '\targ' + repr(i+1), - print '= arg' + repr(i+1), - print '/', a_factor + ';' - elif a_mode == 's': - if a_sub and not isnum(a_sub): - # Allocate memory for varsize array - print '\tif ((arg' + repr(i+1), '=', - if a_factor: - print '('+a_type+'(*)['+a_factor+'])', - print 'PyMem_NEW(' + a_type, ',', - if a_factor: - print a_factor, '*', - print a_sub, ')) == NULL)' - print '\t\treturn PyErr_NoMemory();' - print '\tif', - if a_factor or a_sub: # Get a fixed-size array array - print '(!geti' + xtype + 'array(args,', - print repr(n_in_args) + ',', - print repr(in_pos[i]) + ',', - if a_factor: print a_factor, - if a_factor and a_sub: print '*', - if a_sub: print a_sub, - print ',', - if (a_sub and a_factor) or xtype != a_type: - print '('+xtype+' *)', - print 'arg' + repr(i+1) + '))' - else: # Get a simple variable - print '(!geti' + xtype + 'arg(args,', - print repr(n_in_args) + ',', - print repr(in_pos[i]) + ',', - if xtype != a_type: - print '('+xtype+' *)', - print '&arg' + repr(i+1) + '))' - print '\t\treturn NULL;' - # - # Begin of function call - # - if type != 'void': - print '\tretval =', func + '(', - else: - print '\t' + func + '(', - # - # Argument list - # - for i in range(len(database)): - if i > 0: print ',', - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 'r' and not a_factor: - print '&', - print 'arg' + repr(i+1), - # - # End of function call - # - print ');' - # - # Free varsize arrays - # - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 's' and a_sub and not isnum(a_sub): - print '\tPyMem_DEL(arg' + repr(i+1) + ');' - # - # Return - # - if n_out_args: - # - # Multiple return values -- construct a tuple - # - if type != 'void': - n_out_args = n_out_args + 1 - if n_out_args == 1: - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 'r': - break - else: - raise arg_error, 'expected r arg not found' - print '\treturn', - print mkobject(a_type, 'arg' + repr(i+1)) + ';' - else: - print '\t{ PyObject *v = PyTuple_New(', - print n_out_args, ');' - print '\t if (v == NULL) return NULL;' - i_out = 0 - if type != 'void': - print '\t PyTuple_SetItem(v,', - print repr(i_out) + ',', - print mkobject(type, 'retval') + ');' - i_out = i_out + 1 - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 'r': - print '\t PyTuple_SetItem(v,', - print repr(i_out) + ',', - s = mkobject(a_type, 'arg' + repr(i+1)) - print s + ');' - i_out = i_out + 1 - print '\t return v;' - print '\t}' - else: - # - # Simple function return - # Return None or return value - # - if type == 'void': - print '\tPy_INCREF(Py_None);' - print '\treturn Py_None;' - else: - print '\treturn', mkobject(type, 'retval') + ';' - # - # Stub body closing brace - # - print '}' - - -# Subroutine to return a function call to mknewobject() -# -def mkobject(type, arg): - if type[:9] == 'unsigned ': - type = type[9:] - return 'mknew' + type + 'object((' + type + ') ' + arg + ')' - return 'mknew' + type + 'object(' + arg + ')' - - -defined_archs = [] - -# usage: cgen [ -Dmach ... ] [ file ] -for arg in sys.argv[1:]: - if arg[:2] == '-D': - defined_archs.append(arg[2:]) - else: - # Open optional file argument - sys.stdin = open(arg, 'r') - - -# Input line number -lno = 0 - - -# Input is divided in two parts, separated by a line containing '%%'. -# -- literally copied to stdout -# -- stub definitions - -# Variable indicating the current input part. -# -part = 1 - -# Main loop over the input -# -while 1: - try: - line = raw_input() - except EOFError: - break - # - lno = lno+1 - words = string.split(line) - # - if part == 1: - # - # In part 1, copy everything literally - # except look for a line of just '%%' - # - if words == ['%%']: - part = part + 1 - else: - # - # Look for names of manually written - # stubs: a single percent followed by the name - # of the function in Python. - # The stub name is derived by prefixing 'gl_'. - # - if words and words[0][0] == '%': - func = words[0][1:] - if (not func) and words[1:]: - func = words[1] - if func: - functions.append(func) - else: - print line - continue - if not words: - continue # skip empty line - elif words[0] == 'if': - # if XXX rest - # if !XXX rest - if words[1][0] == '!': - if words[1][1:] in defined_archs: - continue - elif words[1] not in defined_archs: - continue - words = words[2:] - if words[0] == '#include': - print line - elif words[0][:1] == '#': - pass # ignore comment - elif words[0] not in return_types: - err('Line', lno, ': bad return type :', words[0]) - elif len(words) < 2: - err('Line', lno, ': no funcname :', line) - else: - if len(words) % 2 != 0: - err('Line', lno, ': odd argument list :', words[2:]) - else: - database = [] - try: - for i in range(2, len(words), 2): - x = checkarg(words[i], words[i+1]) - database.append(x) - print - print '/*', - for w in words: print w, - print '*/' - generate(words[0], words[1], database) - except arg_error, msg: - err('Line', lno, ':', msg) - - -print -print 'static struct PyMethodDef gl_methods[] = {' -for func in functions: - print '\t{"' + func + '", gl_' + func + '},' -print '\t{NULL, NULL} /* Sentinel */' -print '};' -print -print 'void' -print 'initgl()' -print '{' -print '\t(void) Py_InitModule("gl", gl_methods);' -print '}' diff --git a/Modules/cgensupport.c b/Modules/cgensupport.c deleted file mode 100644 index 7e7d0ff..0000000 --- a/Modules/cgensupport.c +++ /dev/null @@ -1,310 +0,0 @@ - -/* Functions used by cgen output */ - -#include "Python.h" -#include "cgensupport.h" - - -/* Functions to extract arguments. - These needs to know the total number of arguments supplied, - since the argument list is a tuple only of there is more than - one argument. */ - -int -PyArg_GetObject(register PyObject *args, int nargs, int i, PyObject **p_arg) -{ - if (nargs != 1) { - if (args == NULL || !PyTuple_Check(args) || - nargs != PyTuple_Size(args) || - i < 0 || i >= nargs) { - return PyErr_BadArgument(); - } - else { - args = PyTuple_GetItem(args, i); - } - } - if (args == NULL) { - return PyErr_BadArgument(); - } - *p_arg = args; - return 1; -} - -int -PyArg_GetLong(register PyObject *args, int nargs, int i, long *p_arg) -{ - if (nargs != 1) { - if (args == NULL || !PyTuple_Check(args) || - nargs != PyTuple_Size(args) || - i < 0 || i >= nargs) { - return PyErr_BadArgument(); - } - args = PyTuple_GetItem(args, i); - } - if (args == NULL || !PyInt_Check(args)) { - return PyErr_BadArgument(); - } - *p_arg = PyInt_AsLong(args); - return 1; -} - -int -PyArg_GetShort(register PyObject *args, int nargs, int i, short *p_arg) -{ - long x; - if (!PyArg_GetLong(args, nargs, i, &x)) - return 0; - *p_arg = (short) x; - return 1; -} - -static int -extractdouble(register PyObject *v, double *p_arg) -{ - if (v == NULL) { - /* Fall through to error return at end of function */ - } - else if (PyFloat_Check(v)) { - *p_arg = PyFloat_AS_DOUBLE((PyFloatObject *)v); - return 1; - } - else if (PyInt_Check(v)) { - *p_arg = PyInt_AS_LONG((PyIntObject *)v); - return 1; - } - else if (PyLong_Check(v)) { - *p_arg = PyLong_AsDouble(v); - return 1; - } - return PyErr_BadArgument(); -} - -static int -extractfloat(register PyObject *v, float *p_arg) -{ - if (v == NULL) { - /* Fall through to error return at end of function */ - } - else if (PyFloat_Check(v)) { - *p_arg = (float) PyFloat_AS_DOUBLE((PyFloatObject *)v); - return 1; - } - else if (PyInt_Check(v)) { - *p_arg = (float) PyInt_AS_LONG((PyIntObject *)v); - return 1; - } - else if (PyLong_Check(v)) { - *p_arg = (float) PyLong_AsDouble(v); - return 1; - } - return PyErr_BadArgument(); -} - -int -PyArg_GetFloat(register PyObject *args, int nargs, int i, float *p_arg) -{ - PyObject *v; - float x; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (!extractfloat(v, &x)) - return 0; - *p_arg = x; - return 1; -} - -int -PyArg_GetString(PyObject *args, int nargs, int i, string *p_arg) -{ - PyObject *v; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (!PyString_Check(v)) { - return PyErr_BadArgument(); - } - *p_arg = PyString_AsString(v); - return 1; -} - -int -PyArg_GetChar(PyObject *args, int nargs, int i, char *p_arg) -{ - string x; - if (!PyArg_GetString(args, nargs, i, &x)) - return 0; - if (x[0] == '\0' || x[1] != '\0') { - /* Not exactly one char */ - return PyErr_BadArgument(); - } - *p_arg = x[0]; - return 1; -} - -int -PyArg_GetLongArraySize(PyObject *args, int nargs, int i, long *p_arg) -{ - PyObject *v; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - *p_arg = PyTuple_Size(v); - return 1; - } - if (PyList_Check(v)) { - *p_arg = PyList_Size(v); - return 1; - } - return PyErr_BadArgument(); -} - -int -PyArg_GetShortArraySize(PyObject *args, int nargs, int i, short *p_arg) -{ - long x; - if (!PyArg_GetLongArraySize(args, nargs, i, &x)) - return 0; - *p_arg = (short) x; - return 1; -} - -/* XXX The following four are too similar. Should share more code. */ - -int -PyArg_GetLongArray(PyObject *args, int nargs, int i, int n, long *p_arg) -{ - PyObject *v, *w; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - if (PyTuple_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyTuple_GetItem(v, i); - if (!PyInt_Check(w)) { - return PyErr_BadArgument(); - } - p_arg[i] = PyInt_AsLong(w); - } - return 1; - } - else if (PyList_Check(v)) { - if (PyList_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyList_GetItem(v, i); - if (!PyInt_Check(w)) { - return PyErr_BadArgument(); - } - p_arg[i] = PyInt_AsLong(w); - } - return 1; - } - else { - return PyErr_BadArgument(); - } -} - -int -PyArg_GetShortArray(PyObject *args, int nargs, int i, int n, short *p_arg) -{ - PyObject *v, *w; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - if (PyTuple_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyTuple_GetItem(v, i); - if (!PyInt_Check(w)) { - return PyErr_BadArgument(); - } - p_arg[i] = (short) PyInt_AsLong(w); - } - return 1; - } - else if (PyList_Check(v)) { - if (PyList_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyList_GetItem(v, i); - if (!PyInt_Check(w)) { - return PyErr_BadArgument(); - } - p_arg[i] = (short) PyInt_AsLong(w); - } - return 1; - } - else { - return PyErr_BadArgument(); - } -} - -int -PyArg_GetDoubleArray(PyObject *args, int nargs, int i, int n, double *p_arg) -{ - PyObject *v, *w; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - if (PyTuple_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyTuple_GetItem(v, i); - if (!extractdouble(w, &p_arg[i])) - return 0; - } - return 1; - } - else if (PyList_Check(v)) { - if (PyList_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyList_GetItem(v, i); - if (!extractdouble(w, &p_arg[i])) - return 0; - } - return 1; - } - else { - return PyErr_BadArgument(); - } -} - -int -PyArg_GetFloatArray(PyObject *args, int nargs, int i, int n, float *p_arg) -{ - PyObject *v, *w; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - if (PyTuple_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyTuple_GetItem(v, i); - if (!extractfloat(w, &p_arg[i])) - return 0; - } - return 1; - } - else if (PyList_Check(v)) { - if (PyList_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyList_GetItem(v, i); - if (!extractfloat(w, &p_arg[i])) - return 0; - } - return 1; - } - else { - return PyErr_BadArgument(); - } -} diff --git a/Modules/cgensupport.h b/Modules/cgensupport.h deleted file mode 100644 index bc901f6..0000000 --- a/Modules/cgensupport.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef Py_CGENSUPPORT_H -#define Py_CGENSUPPORT_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Definitions used by cgen output */ - -/* XXX This file is obsolete. It is *only* used by glmodule.c. */ - -typedef char *string; - -#define mknewlongobject(x) PyInt_FromLong(x) -#define mknewshortobject(x) PyInt_FromLong((long)x) -#define mknewfloatobject(x) PyFloat_FromDouble(x) -#define mknewcharobject(ch) Py_BuildValue("c", ch) - -#define getichararg PyArg_GetChar -#define getidoublearray PyArg_GetDoubleArray -#define getifloatarg PyArg_GetFloat -#define getifloatarray PyArg_GetFloatArray -#define getilongarg PyArg_GetLong -#define getilongarray PyArg_GetLongArray -#define getilongarraysize PyArg_GetLongArraySize -#define getiobjectarg PyArg_GetObject -#define getishortarg PyArg_GetShort -#define getishortarray PyArg_GetShortArray -#define getishortarraysize PyArg_GetShortArraySize -#define getistringarg PyArg_GetString - -extern int PyArg_GetObject(PyObject *args, int nargs, - int i, PyObject **p_a); -extern int PyArg_GetLong(PyObject *args, int nargs, - int i, long *p_a); -extern int PyArg_GetShort(PyObject *args, int nargs, - int i, short *p_a); -extern int PyArg_GetFloat(PyObject *args, int nargs, - int i, float *p_a); -extern int PyArg_GetString(PyObject *args, int nargs, - int i, string *p_a); -extern int PyArg_GetChar(PyObject *args, int nargs, - int i, char *p_a); -extern int PyArg_GetLongArray(PyObject *args, int nargs, - int i, int n, long *p_a); -extern int PyArg_GetShortArray(PyObject *args, int nargs, - int i, int n, short *p_a); -extern int PyArg_GetDoubleArray(PyObject *args, int nargs, - int i, int n, double *p_a); -extern int PyArg_GetFloatArray(PyObject *args, int nargs, - int i, int n, float *p_a); -extern int PyArg_GetLongArraySize(PyObject *args, int nargs, - int i, long *p_a); -extern int PyArg_GetShortArraySize(PyObject *args, int nargs, - int i, short *p_a); -extern int PyArg_GetDoubleArraySize(PyObject *args, int nargs, - int i, double *p_a); -extern int PyArg_GetFloatArraySize(PyObject *args, int nargs, - int i, float *p_a); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_CGENSUPPORT_H */ diff --git a/Modules/clmodule.c b/Modules/clmodule.c deleted file mode 100644 index a535e03..0000000 --- a/Modules/clmodule.c +++ /dev/null @@ -1,2559 +0,0 @@ - - -/* Cl objects */ - -#define CLDEBUG - -#include -#include -#if defined(CL_JPEG_SOFTWARE) && !defined(CL_JPEG_COSMO) -#include -#endif -#include "Python.h" - -typedef struct { - PyObject_HEAD - int ob_isCompressor; /* Compressor or Decompressor */ - CL_Handle ob_compressorHdl; - int *ob_paramtypes; - int ob_nparams; -} clobject; - -static PyObject *ClError; /* exception cl.error */ - -static int error_handler_called = 0; - -/* - * We want to use the function prototypes that are available in the C - * compiler on the SGI. Because of that, we need to declare the first - * argument of the compressor and decompressor methods as "object *", - * even though they are really "clobject *". Therefore we cast the - * argument to the proper type using this macro. - */ -#define SELF ((clobject *) self) - -/******************************************************************** - Utility routines. -********************************************************************/ -static void -cl_ErrorHandler(CL_Handle handle, int code, const char *fmt, ...) -{ - va_list ap; - char errbuf[BUFSIZ]; /* hopefully big enough */ - char *p; - - if (PyErr_Occurred()) /* don't change existing error */ - return; - error_handler_called = 1; - va_start(ap, fmt); - vsprintf(errbuf, fmt, ap); - va_end(ap); - p = &errbuf[strlen(errbuf) - 1]; /* swat the line feed */ - if (*p == '\n') - *p = 0; - PyErr_SetString(ClError, errbuf); -} - -/* - * This assumes that params are always in the range 0 to some maximum. - */ -static int -param_type_is_float(clobject *self, int param) -{ - int bufferlength; - - if (self->ob_paramtypes == NULL) { - error_handler_called = 0; - bufferlength = clQueryParams(self->ob_compressorHdl, 0, 0); - if (error_handler_called) - return -1; - - self->ob_paramtypes = PyMem_NEW(int, bufferlength); - if (self->ob_paramtypes == NULL) - return -1; - self->ob_nparams = bufferlength / 2; - - (void) clQueryParams(self->ob_compressorHdl, - self->ob_paramtypes, bufferlength); - if (error_handler_called) { - PyMem_DEL(self->ob_paramtypes); - self->ob_paramtypes = NULL; - return -1; - } - } - - if (param < 0 || param >= self->ob_nparams) - return -1; - - if (self->ob_paramtypes[param*2 + 1] == CL_FLOATING_ENUM_VALUE || - self->ob_paramtypes[param*2 + 1] == CL_FLOATING_RANGE_VALUE) - return 1; - else - return 0; -} - -/******************************************************************** - Single image compression/decompression. -********************************************************************/ -static PyObject * -cl_CompressImage(PyObject *self, PyObject *args) -{ - int compressionScheme, width, height, originalFormat; - float compressionRatio; - int frameBufferSize, compressedBufferSize; - char *frameBuffer; - PyObject *compressedBuffer; - - if (!PyArg_ParseTuple(args, "iiiifs#", &compressionScheme, - &width, &height, - &originalFormat, &compressionRatio, &frameBuffer, - &frameBufferSize)) - return NULL; - - retry: - compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); - if (compressedBuffer == NULL) - return NULL; - - compressedBufferSize = frameBufferSize; - error_handler_called = 0; - if (clCompressImage(compressionScheme, width, height, originalFormat, - compressionRatio, (void *) frameBuffer, - &compressedBufferSize, - (void *) PyString_AsString(compressedBuffer)) - == FAILURE || error_handler_called) { - Py_DECREF(compressedBuffer); - if (!error_handler_called) - PyErr_SetString(ClError, "clCompressImage failed"); - return NULL; - } - - if (compressedBufferSize > frameBufferSize) { - frameBufferSize = compressedBufferSize; - Py_DECREF(compressedBuffer); - goto retry; - } - - if (compressedBufferSize < frameBufferSize) - _PyString_Resize(&compressedBuffer, compressedBufferSize); - - return compressedBuffer; -} - -static PyObject * -cl_DecompressImage(PyObject *self, PyObject *args) -{ - int compressionScheme, width, height, originalFormat; - char *compressedBuffer; - int compressedBufferSize, frameBufferSize; - PyObject *frameBuffer; - - if (!PyArg_ParseTuple(args, "iiiis#", &compressionScheme, &width, &height, - &originalFormat, &compressedBuffer, - &compressedBufferSize)) - return NULL; - - frameBufferSize = width * height * CL_BytesPerPixel(originalFormat); - - frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); - if (frameBuffer == NULL) - return NULL; - - error_handler_called = 0; - if (clDecompressImage(compressionScheme, width, height, originalFormat, - compressedBufferSize, compressedBuffer, - (void *) PyString_AsString(frameBuffer)) - == FAILURE || error_handler_called) { - Py_DECREF(frameBuffer); - if (!error_handler_called) - PyErr_SetString(ClError, "clDecompressImage failed"); - return NULL; - } - - return frameBuffer; -} - -/******************************************************************** - Sequential compression/decompression. -********************************************************************/ -#define CheckCompressor(self) if ((self)->ob_compressorHdl == NULL) { \ - PyErr_SetString(PyExc_RuntimeError, "(de)compressor not active"); \ - return NULL; \ -} - -static PyObject * -doClose(clobject *self, int (*close_func)(CL_Handle)) -{ - CheckCompressor(self); - - error_handler_called = 0; - if ((*close_func)(self->ob_compressorHdl) == FAILURE || - error_handler_called) { - if (!error_handler_called) - PyErr_SetString(ClError, "close failed"); - return NULL; - } - - self->ob_compressorHdl = NULL; - - if (self->ob_paramtypes) - PyMem_DEL(self->ob_paramtypes); - self->ob_paramtypes = NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -clm_CloseCompressor(PyObject *self) -{ - return doClose(SELF, clCloseCompressor); -} - -static PyObject * -clm_CloseDecompressor(PyObject *self) -{ - return doClose(SELF, clCloseDecompressor); -} - -static PyObject * -clm_Compress(PyObject *self, PyObject *args) -{ - int numberOfFrames; - int frameBufferSize, compressedBufferSize, size; - char *frameBuffer; - PyObject *data; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "(is#)", &numberOfFrames, - &frameBuffer, &frameBufferSize)) - return NULL; - - error_handler_called = 0; - size = clGetParam(SELF->ob_compressorHdl, CL_COMPRESSED_BUFFER_SIZE); - compressedBufferSize = size; - if (error_handler_called) - return NULL; - - data = PyString_FromStringAndSize(NULL, size); - if (data == NULL) - return NULL; - - error_handler_called = 0; - if (clCompress(SELF->ob_compressorHdl, numberOfFrames, - (void *) frameBuffer, &compressedBufferSize, - (void *) PyString_AsString(data)) == FAILURE || - error_handler_called) { - Py_DECREF(data); - if (!error_handler_called) - PyErr_SetString(ClError, "compress failed"); - return NULL; - } - - if (compressedBufferSize < size) - if (_PyString_Resize(&data, compressedBufferSize)) - return NULL; - - if (compressedBufferSize > size) { - /* we didn't get all "compressed" data */ - Py_DECREF(data); - PyErr_SetString(ClError, - "compressed data is more than fitted"); - return NULL; - } - - return data; -} - -static PyObject * -clm_Decompress(PyObject *self, PyObject *args) -{ - PyObject *data; - int numberOfFrames; - char *compressedData; - int compressedDataSize, dataSize; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "(is#)", &numberOfFrames, &compressedData, - &compressedDataSize)) - return NULL; - - error_handler_called = 0; - dataSize = clGetParam(SELF->ob_compressorHdl, CL_FRAME_BUFFER_SIZE); - if (error_handler_called) - return NULL; - - data = PyString_FromStringAndSize(NULL, dataSize); - if (data == NULL) - return NULL; - - error_handler_called = 0; - if (clDecompress(SELF->ob_compressorHdl, numberOfFrames, - compressedDataSize, (void *) compressedData, - (void *) PyString_AsString(data)) == FAILURE || - error_handler_called) { - Py_DECREF(data); - if (!error_handler_called) - PyErr_SetString(ClError, "decompress failed"); - return NULL; - } - - return data; -} - -static PyObject * -doParams(clobject *self, PyObject *args, int (*func)(CL_Handle, int *, int), - int modified) -{ - PyObject *list, *v; - int *PVbuffer; - int length; - int i; - float number; - - CheckCompressor(self); - - if (!PyArg_Parse(args, "O", &list)) - return NULL; - if (!PyList_Check(list)) { - PyErr_BadArgument(); - return NULL; - } - length = PyList_Size(list); - PVbuffer = PyMem_NEW(int, length); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - for (i = 0; i < length; i++) { - v = PyList_GetItem(list, i); - if (PyFloat_Check(v)) { - number = PyFloat_AsDouble(v); - PVbuffer[i] = CL_TypeIsInt(number); - } else if (PyInt_Check(v)) { - PVbuffer[i] = PyInt_AsLong(v); - if ((i & 1) && - param_type_is_float(self, PVbuffer[i-1]) > 0) { - number = PVbuffer[i]; - PVbuffer[i] = CL_TypeIsInt(number); - } - } else { - PyMem_DEL(PVbuffer); - PyErr_BadArgument(); - return NULL; - } - } - - error_handler_called = 0; - (*func)(self->ob_compressorHdl, PVbuffer, length); - if (error_handler_called) { - PyMem_DEL(PVbuffer); - return NULL; - } - - if (modified) { - for (i = 0; i < length; i++) { - if ((i & 1) && - param_type_is_float(self, PVbuffer[i-1]) > 0) { - number = CL_TypeIsFloat(PVbuffer[i]); - v = PyFloat_FromDouble(number); - } else - v = PyInt_FromLong(PVbuffer[i]); - PyList_SetItem(list, i, v); - } - } - - PyMem_DEL(PVbuffer); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -clm_GetParams(PyObject *self, PyObject *args) -{ - return doParams(SELF, args, clGetParams, 1); -} - -static PyObject * -clm_SetParams(PyObject *self, PyObject *args) -{ - return doParams(SELF, args, clSetParams, 0); -} - -static PyObject * -do_get(clobject *self, PyObject *args, int (*func)(CL_Handle, int)) -{ - int paramID, value; - float fvalue; - - CheckCompressor(self); - - if (!PyArg_Parse(args, "i", ¶mID)) - return NULL; - - error_handler_called = 0; - value = (*func)(self->ob_compressorHdl, paramID); - if (error_handler_called) - return NULL; - - if (param_type_is_float(self, paramID) > 0) { - fvalue = CL_TypeIsFloat(value); - return PyFloat_FromDouble(fvalue); - } - - return PyInt_FromLong(value); -} - -static PyObject * -clm_GetParam(PyObject *self, PyObject *args) -{ - return do_get(SELF, args, clGetParam); -} - -static PyObject * -clm_GetDefault(PyObject *self, PyObject *args) -{ - return do_get(SELF, args, clGetDefault); -} - -static PyObject * -clm_SetParam(PyObject *self, PyObject *args) -{ - int paramID, value; - float fvalue; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "(ii)", ¶mID, &value)) { - PyErr_Clear(); - if (!PyArg_Parse(args, "(if)", ¶mID, &fvalue)) { - PyErr_Clear(); - PyErr_SetString(PyExc_TypeError, - "bad argument list (format '(ii)' or '(if)')"); - return NULL; - } - value = CL_TypeIsInt(fvalue); - } else { - if (param_type_is_float(SELF, paramID) > 0) { - fvalue = value; - value = CL_TypeIsInt(fvalue); - } - } - - error_handler_called = 0; - value = clSetParam(SELF->ob_compressorHdl, paramID, value); - if (error_handler_called) - return NULL; - - if (param_type_is_float(SELF, paramID) > 0) - return PyFloat_FromDouble(CL_TypeIsFloat(value)); - else - return PyInt_FromLong(value); -} - -static PyObject * -clm_GetParamID(PyObject *self, PyObject *args) -{ - char *name; - int value; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "s", &name)) - return NULL; - - error_handler_called = 0; - value = clGetParamID(SELF->ob_compressorHdl, name); - if (value == FAILURE || error_handler_called) { - if (!error_handler_called) - PyErr_SetString(ClError, "getparamid failed"); - return NULL; - } - - return PyInt_FromLong(value); -} - -static PyObject * -clm_QueryParams(PyObject *self) -{ - int bufferlength; - int *PVbuffer; - PyObject *list; - int i; - - CheckCompressor(SELF); - - error_handler_called = 0; - bufferlength = clQueryParams(SELF->ob_compressorHdl, 0, 0); - if (error_handler_called) - return NULL; - - PVbuffer = PyMem_NEW(int, bufferlength); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - - bufferlength = clQueryParams(SELF->ob_compressorHdl, PVbuffer, - bufferlength); - if (error_handler_called) { - PyMem_DEL(PVbuffer); - return NULL; - } - - list = PyList_New(bufferlength); - if (list == NULL) { - PyMem_DEL(PVbuffer); - return NULL; - } - - for (i = 0; i < bufferlength; i++) { - if (i & 1) - PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); - else if (PVbuffer[i] == 0) { - Py_INCREF(Py_None); - PyList_SetItem(list, i, Py_None); - } else - PyList_SetItem(list, i, - PyString_FromString((char *) PVbuffer[i])); - } - - PyMem_DEL(PVbuffer); - - return list; -} - -static PyObject * -clm_GetMinMax(PyObject *self, PyObject *args) -{ - int param, min, max; - float fmin, fmax; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "i", ¶m)) - return NULL; - - clGetMinMax(SELF->ob_compressorHdl, param, &min, &max); - - if (param_type_is_float(SELF, param) > 0) { - fmin = CL_TypeIsFloat(min); - fmax = CL_TypeIsFloat(max); - return Py_BuildValue("(ff)", fmin, fmax); - } - - return Py_BuildValue("(ii)", min, max); -} - -static PyObject * -clm_GetName(PyObject *self, PyObject *args) -{ - int param; - char *name; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "i", ¶m)) - return NULL; - - error_handler_called = 0; - name = clGetName(SELF->ob_compressorHdl, param); - if (name == NULL || error_handler_called) { - if (!error_handler_called) - PyErr_SetString(ClError, "getname failed"); - return NULL; - } - - return PyString_FromString(name); -} - -static PyObject * -clm_QuerySchemeFromHandle(PyObject *self) -{ - CheckCompressor(SELF); - return PyInt_FromLong(clQuerySchemeFromHandle(SELF->ob_compressorHdl)); -} - -static PyObject * -clm_ReadHeader(PyObject *self, PyObject *args) -{ - char *header; - int headerSize; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "s#", &header, &headerSize)) - return NULL; - - return PyInt_FromLong(clReadHeader(SELF->ob_compressorHdl, - headerSize, header)); -} - -static PyMethodDef compressor_methods[] = { - {"close", clm_CloseCompressor, METH_NOARGS}, /* alias */ - {"CloseCompressor", clm_CloseCompressor, METH_NOARGS}, - {"Compress", clm_Compress, METH_OLDARGS}, - {"GetDefault", clm_GetDefault, METH_OLDARGS}, - {"GetMinMax", clm_GetMinMax, METH_OLDARGS}, - {"GetName", clm_GetName, METH_OLDARGS}, - {"GetParam", clm_GetParam, METH_OLDARGS}, - {"GetParamID", clm_GetParamID, METH_OLDARGS}, - {"GetParams", clm_GetParams, METH_OLDARGS}, - {"QueryParams", clm_QueryParams, METH_NOARGS}, - {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_NOARGS}, - {"SetParam", clm_SetParam, METH_OLDARGS}, - {"SetParams", clm_SetParams, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyMethodDef decompressor_methods[] = { - {"close", clm_CloseDecompressor, METH_NOARGS}, /* alias */ - {"CloseDecompressor", clm_CloseDecompressor, METH_NOARGS}, - {"Decompress", clm_Decompress, METH_OLDARGS}, - {"GetDefault", clm_GetDefault, METH_OLDARGS}, - {"GetMinMax", clm_GetMinMax, METH_OLDARGS}, - {"GetName", clm_GetName, METH_OLDARGS}, - {"GetParam", clm_GetParam, METH_OLDARGS}, - {"GetParamID", clm_GetParamID, METH_OLDARGS}, - {"GetParams", clm_GetParams, METH_OLDARGS}, - {"ReadHeader", clm_ReadHeader, METH_OLDARGS}, - {"QueryParams", clm_QueryParams, METH_NOARGS}, - {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_NOARGS}, - {"SetParam", clm_SetParam, METH_OLDARGS}, - {"SetParams", clm_SetParams, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -cl_dealloc(PyObject *self) -{ - if (SELF->ob_compressorHdl) { - if (SELF->ob_isCompressor) - clCloseCompressor(SELF->ob_compressorHdl); - else - clCloseDecompressor(SELF->ob_compressorHdl); - } - PyObject_Del(self); -} - -static PyObject * -cl_getattr(PyObject *self, char *name) -{ - if (SELF->ob_isCompressor) - return Py_FindMethod(compressor_methods, self, name); - else - return Py_FindMethod(decompressor_methods, self, name); -} - -static PyTypeObject Cltype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "cl.cl", /*tp_name*/ - sizeof(clobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cl_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)cl_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ -}; - -static PyObject * -doOpen(PyObject *self, PyObject *args, int (*open_func)(int, CL_Handle *), - int iscompressor) -{ - int scheme; - clobject *new; - - if (!PyArg_ParseTuple(args, "i", &scheme)) - return NULL; - - new = PyObject_New(clobject, &Cltype); - if (new == NULL) - return NULL; - - new->ob_compressorHdl = NULL; - new->ob_isCompressor = iscompressor; - new->ob_paramtypes = NULL; - - error_handler_called = 0; - if ((*open_func)(scheme, &new->ob_compressorHdl) == FAILURE || - error_handler_called) { - Py_DECREF(new); - if (!error_handler_called) - PyErr_SetString(ClError, "Open(De)Compressor failed"); - return NULL; - } - return (PyObject *)new; -} - -static PyObject * -cl_OpenCompressor(PyObject *self, PyObject *args) -{ - return doOpen(self, args, clOpenCompressor, 1); -} - -static PyObject * -cl_OpenDecompressor(PyObject *self, PyObject *args) -{ - return doOpen(self, args, clOpenDecompressor, 0); -} - -static PyObject * -cl_QueryScheme(PyObject *self, PyObject *args) -{ - char *header; - int headerlen; - int scheme; - - if (!PyArg_ParseTuple(args, "s#", &header, &headerlen)) - return NULL; - - scheme = clQueryScheme(header); - if (scheme < 0) { - PyErr_SetString(ClError, "unknown compression scheme"); - return NULL; - } - - return PyInt_FromLong(scheme); -} - -static PyObject * -cl_QueryMaxHeaderSize(PyObject *self, PyObject *args) -{ - int scheme; - - if (!PyArg_ParseTuple(args, "i", &scheme)) - return NULL; - - return PyInt_FromLong(clQueryMaxHeaderSize(scheme)); -} - -static PyObject * -cl_QueryAlgorithms(PyObject *self, PyObject *args) -{ - int algorithmMediaType; - int bufferlength; - int *PVbuffer; - PyObject *list; - int i; - - if (!PyArg_ParseTuple(args, "i", &algorithmMediaType)) - return NULL; - - error_handler_called = 0; - bufferlength = clQueryAlgorithms(algorithmMediaType, 0, 0); - if (error_handler_called) - return NULL; - - PVbuffer = PyMem_NEW(int, bufferlength); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - - bufferlength = clQueryAlgorithms(algorithmMediaType, PVbuffer, - bufferlength); - if (error_handler_called) { - PyMem_DEL(PVbuffer); - return NULL; - } - - list = PyList_New(bufferlength); - if (list == NULL) { - PyMem_DEL(PVbuffer); - return NULL; - } - - for (i = 0; i < bufferlength; i++) { - if (i & 1) - PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); - else if (PVbuffer[i] == 0) { - Py_INCREF(Py_None); - PyList_SetItem(list, i, Py_None); - } else - PyList_SetItem(list, i, - PyString_FromString((char *) PVbuffer[i])); - } - - PyMem_DEL(PVbuffer); - - return list; -} - -static PyObject * -cl_QuerySchemeFromName(PyObject *self, PyObject *args) -{ - int algorithmMediaType; - char *name; - int scheme; - - if (!PyArg_ParseTuple(args, "is", &algorithmMediaType, &name)) - return NULL; - - error_handler_called = 0; - scheme = clQuerySchemeFromName(algorithmMediaType, name); - if (error_handler_called) { - PyErr_SetString(ClError, "unknown compression scheme"); - return NULL; - } - - return PyInt_FromLong(scheme); -} - -static PyObject * -cl_GetAlgorithmName(PyObject *self, PyObject *args) -{ - int scheme; - char *name; - - if (!PyArg_ParseTuple(args, "i", &scheme)) - return NULL; - - name = clGetAlgorithmName(scheme); - if (name == 0) { - PyErr_SetString(ClError, "unknown compression scheme"); - return NULL; - } - - return PyString_FromString(name); -} - -static PyObject * -do_set(PyObject *self, PyObject *args, int (*func)(int, int, int)) -{ - int scheme, paramID, value; - float fvalue; - int is_float = 0; - - if (!PyArg_ParseTuple(args, "iii", &scheme, ¶mID, &value)) { - PyErr_Clear(); - if (!PyArg_ParseTuple(args, "iif", &scheme, ¶mID, &fvalue)) { - PyErr_Clear(); - PyErr_SetString(PyExc_TypeError, - "bad argument list (format '(iii)' or '(iif)')"); - return NULL; - } - value = CL_TypeIsInt(fvalue); - is_float = 1; - } else { - /* check some parameters which we know to be floats */ - switch (scheme) { - case CL_COMPRESSION_RATIO: - case CL_SPEED: - fvalue = value; - value = CL_TypeIsInt(fvalue); - is_float = 1; - break; - } - } - - error_handler_called = 0; - value = (*func)(scheme, paramID, value); - if (error_handler_called) - return NULL; - - if (is_float) - return PyFloat_FromDouble(CL_TypeIsFloat(value)); - else - return PyInt_FromLong(value); -} - -static PyObject * -cl_SetDefault(PyObject *self, PyObject *args) -{ - return do_set(self, args, clSetDefault); -} - -static PyObject * -cl_SetMin(PyObject *self, PyObject *args) -{ - return do_set(self, args, clSetMin); -} - -static PyObject * -cl_SetMax(PyObject *self, PyObject *args) -{ - return do_set(self, args, clSetMax); -} - -#define func(name, handler) \ -static PyObject *cl_##name(PyObject *self, PyObject *args) \ -{ \ - int x; \ - if (!PyArg_ParseTuple(args, "i", &x)) return NULL; \ - return Py##handler(CL_##name(x)); \ -} - -#define func2(name, handler) \ -static PyObject *cl_##name(PyObject *self, PyObject *args) \ -{ \ - int a1, a2; \ - if (!PyArg_ParseTuple(args, "ii", &a1, &a2)) return NULL; \ - return Py##handler(CL_##name(a1, a2)); \ -} - -func(BytesPerSample, Int_FromLong) -func(BytesPerPixel, Int_FromLong) -func(AudioFormatName, String_FromString) -func(VideoFormatName, String_FromString) -func(AlgorithmNumber, Int_FromLong) -func(AlgorithmType, Int_FromLong) -func2(Algorithm, Int_FromLong) -func(ParamNumber, Int_FromLong) -func(ParamType, Int_FromLong) -func2(ParamID, Int_FromLong) - -#ifdef CLDEBUG - static PyObject * -cvt_type(PyObject *self, PyObject *args) -{ - int number; - float fnumber; - - if (PyArg_Parse(args, "i", &number)) - return PyFloat_FromDouble(CL_TypeIsFloat(number)); - else { - PyErr_Clear(); - if (PyArg_Parse(args, "f", &fnumber)) - return PyInt_FromLong(CL_TypeIsInt(fnumber)); - return NULL; - } -} -#endif - -static PyMethodDef cl_methods[] = { - {"CompressImage", cl_CompressImage, METH_VARARGS}, - {"DecompressImage", cl_DecompressImage, METH_VARARGS}, - {"GetAlgorithmName", cl_GetAlgorithmName, METH_VARARGS}, - {"OpenCompressor", cl_OpenCompressor, METH_VARARGS}, - {"OpenDecompressor", cl_OpenDecompressor, METH_VARARGS}, - {"QueryAlgorithms", cl_QueryAlgorithms, METH_VARARGS}, - {"QueryMaxHeaderSize", cl_QueryMaxHeaderSize, METH_VARARGS}, - {"QueryScheme", cl_QueryScheme, METH_VARARGS}, - {"QuerySchemeFromName", cl_QuerySchemeFromName, METH_VARARGS}, - {"SetDefault", cl_SetDefault, METH_VARARGS}, - {"SetMax", cl_SetMax, METH_VARARGS}, - {"SetMin", cl_SetMin, METH_VARARGS}, - {"BytesPerSample", cl_BytesPerSample, METH_VARARGS}, - {"BytesPerPixel", cl_BytesPerPixel, METH_VARARGS}, - {"AudioFormatName", cl_AudioFormatName, METH_VARARGS}, - {"VideoFormatName", cl_VideoFormatName, METH_VARARGS}, - {"AlgorithmNumber", cl_AlgorithmNumber, METH_VARARGS}, - {"AlgorithmType", cl_AlgorithmType, METH_VARARGS}, - {"Algorithm", cl_Algorithm, METH_VARARGS}, - {"ParamNumber", cl_ParamNumber, METH_VARARGS}, - {"ParamType", cl_ParamType, METH_VARARGS}, - {"ParamID", cl_ParamID, METH_VARARGS}, -#ifdef CLDEBUG - {"cvt_type", cvt_type, METH_VARARGS}, -#endif - {NULL, NULL} /* Sentinel */ -}; - -#ifdef CL_JPEG_SOFTWARE -#define IRIX_5_3_LIBRARY -#endif - -void -initcl(void) -{ - PyObject *m, *d, *x; - - m = Py_InitModule("cl", cl_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - - ClError = PyErr_NewException("cl.error", NULL, NULL); - (void) PyDict_SetItemString(d, "error", ClError); - -#ifdef CL_ADDED_ALGORITHM_ERROR - x = PyInt_FromLong(CL_ADDED_ALGORITHM_ERROR); - if (x == NULL || PyDict_SetItemString(d, "ADDED_ALGORITHM_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALAW - x = PyInt_FromLong(CL_ALAW); - if (x == NULL || PyDict_SetItemString(d, "ALAW", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALGORITHM_ID - x = PyInt_FromLong(CL_ALGORITHM_ID); - if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_ID", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALGORITHM_TABLE_FULL - x = PyInt_FromLong(CL_ALGORITHM_TABLE_FULL); - if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_TABLE_FULL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALGORITHM_VERSION - x = PyInt_FromLong(CL_ALGORITHM_VERSION); - if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_VERSION", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALG_AUDIO - x = PyInt_FromLong(CL_ALG_AUDIO); - if (x == NULL || PyDict_SetItemString(d, "ALG_AUDIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALG_VIDEO - x = PyInt_FromLong(CL_ALG_VIDEO); - if (x == NULL || PyDict_SetItemString(d, "ALG_VIDEO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AUDIO - x = PyInt_FromLong(CL_AUDIO); - if (x == NULL || PyDict_SetItemString(d, "AUDIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_BITRATE_POLICY - x = PyInt_FromLong(CL_AWARE_BITRATE_POLICY); - if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_POLICY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_BITRATE_TARGET - x = PyInt_FromLong(CL_AWARE_BITRATE_TARGET); - if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_TARGET", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_CHANNEL_POLICY - x = PyInt_FromLong(CL_AWARE_CHANNEL_POLICY); - if (x == NULL || PyDict_SetItemString(d, "AWARE_CHANNEL_POLICY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_CONST_QUAL - x = PyInt_FromLong(CL_AWARE_CONST_QUAL); - if (x == NULL || PyDict_SetItemString(d, "AWARE_CONST_QUAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_ERROR - x = PyInt_FromLong(CL_AWARE_ERROR); - if (x == NULL || PyDict_SetItemString(d, "AWARE_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_FIXED_RATE - x = PyInt_FromLong(CL_AWARE_FIXED_RATE); - if (x == NULL || PyDict_SetItemString(d, "AWARE_FIXED_RATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_INDEPENDENT - x = PyInt_FromLong(CL_AWARE_INDEPENDENT); - if (x == NULL || PyDict_SetItemString(d, "AWARE_INDEPENDENT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_JOINT_STEREO - x = PyInt_FromLong(CL_AWARE_JOINT_STEREO); - if (x == NULL || PyDict_SetItemString(d, "AWARE_JOINT_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_LAYER - x = PyInt_FromLong(CL_AWARE_LAYER); - if (x == NULL || PyDict_SetItemString(d, "AWARE_LAYER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_LOSSLESS - x = PyInt_FromLong(CL_AWARE_LOSSLESS); - if (x == NULL || PyDict_SetItemString(d, "AWARE_LOSSLESS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_MPEG_AUDIO - x = PyInt_FromLong(CL_AWARE_MPEG_AUDIO); - if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_AUDIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_MPEG_LAYER_I - x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_I); - if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_I", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_MPEG_LAYER_II - x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_II); - if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_II", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_MULTIRATE - x = PyInt_FromLong(CL_AWARE_MULTIRATE); - if (x == NULL || PyDict_SetItemString(d, "AWARE_MULTIRATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_NOISE_MARGIN - x = PyInt_FromLong(CL_AWARE_NOISE_MARGIN); - if (x == NULL || PyDict_SetItemString(d, "AWARE_NOISE_MARGIN", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_STEREO - x = PyInt_FromLong(CL_AWARE_STEREO); - if (x == NULL || PyDict_SetItemString(d, "AWARE_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_ALGORITHM_NAME - x = PyInt_FromLong(CL_BAD_ALGORITHM_NAME); - if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_NAME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_ALGORITHM_TYPE - x = PyInt_FromLong(CL_BAD_ALGORITHM_TYPE); - if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_TYPE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BLOCK_SIZE - x = PyInt_FromLong(CL_BAD_BLOCK_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BLOCK_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BOARD - x = PyInt_FromLong(CL_BAD_BOARD); - if (x == NULL || PyDict_SetItemString(d, "BAD_BOARD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFERING - x = PyInt_FromLong(CL_BAD_BUFFERING); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERING", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFERLENGTH_NEG - x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_NEG); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFERLENGTH_ODD - x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_ODD); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_EXISTS - x = PyInt_FromLong(CL_BAD_BUFFER_EXISTS); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_EXISTS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_HANDLE - x = PyInt_FromLong(CL_BAD_BUFFER_HANDLE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_HANDLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_POINTER - x = PyInt_FromLong(CL_BAD_BUFFER_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_QUERY_SIZE - x = PyInt_FromLong(CL_BAD_BUFFER_QUERY_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_QUERY_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_SIZE - x = PyInt_FromLong(CL_BAD_BUFFER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_SIZE_POINTER - x = PyInt_FromLong(CL_BAD_BUFFER_SIZE_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_TYPE - x = PyInt_FromLong(CL_BAD_BUFFER_TYPE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_TYPE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_COMPRESSION_SCHEME - x = PyInt_FromLong(CL_BAD_COMPRESSION_SCHEME); - if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSION_SCHEME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_COMPRESSOR_HANDLE - x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE); - if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_COMPRESSOR_HANDLE_POINTER - x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_FRAME_SIZE - x = PyInt_FromLong(CL_BAD_FRAME_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_FRAME_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_FUNCTIONALITY - x = PyInt_FromLong(CL_BAD_FUNCTIONALITY); - if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTIONALITY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_FUNCTION_POINTER - x = PyInt_FromLong(CL_BAD_FUNCTION_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTION_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_HEADER_SIZE - x = PyInt_FromLong(CL_BAD_HEADER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_HEADER_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_INITIAL_VALUE - x = PyInt_FromLong(CL_BAD_INITIAL_VALUE); - if (x == NULL || PyDict_SetItemString(d, "BAD_INITIAL_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_INTERNAL_FORMAT - x = PyInt_FromLong(CL_BAD_INTERNAL_FORMAT); - if (x == NULL || PyDict_SetItemString(d, "BAD_INTERNAL_FORMAT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_LICENSE - x = PyInt_FromLong(CL_BAD_LICENSE); - if (x == NULL || PyDict_SetItemString(d, "BAD_LICENSE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_MIN_GT_MAX - x = PyInt_FromLong(CL_BAD_MIN_GT_MAX); - if (x == NULL || PyDict_SetItemString(d, "BAD_MIN_GT_MAX", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_NO_BUFFERSPACE - x = PyInt_FromLong(CL_BAD_NO_BUFFERSPACE); - if (x == NULL || PyDict_SetItemString(d, "BAD_NO_BUFFERSPACE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_NUMBER_OF_BLOCKS - x = PyInt_FromLong(CL_BAD_NUMBER_OF_BLOCKS); - if (x == NULL || PyDict_SetItemString(d, "BAD_NUMBER_OF_BLOCKS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_PARAM - x = PyInt_FromLong(CL_BAD_PARAM); - if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_PARAM_ID_POINTER - x = PyInt_FromLong(CL_BAD_PARAM_ID_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_ID_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_PARAM_TYPE - x = PyInt_FromLong(CL_BAD_PARAM_TYPE); - if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_TYPE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_POINTER - x = PyInt_FromLong(CL_BAD_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_PVBUFFER - x = PyInt_FromLong(CL_BAD_PVBUFFER); - if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_SCHEME_POINTER - x = PyInt_FromLong(CL_BAD_SCHEME_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_SCHEME_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_STREAM_HEADER - x = PyInt_FromLong(CL_BAD_STREAM_HEADER); - if (x == NULL || PyDict_SetItemString(d, "BAD_STREAM_HEADER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_STRING_POINTER - x = PyInt_FromLong(CL_BAD_STRING_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_STRING_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_TEXT_STRING_PTR - x = PyInt_FromLong(CL_BAD_TEXT_STRING_PTR); - if (x == NULL || PyDict_SetItemString(d, "BAD_TEXT_STRING_PTR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BEST_FIT - x = PyInt_FromLong(CL_BEST_FIT); - if (x == NULL || PyDict_SetItemString(d, "BEST_FIT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BIDIRECTIONAL - x = PyInt_FromLong(CL_BIDIRECTIONAL); - if (x == NULL || PyDict_SetItemString(d, "BIDIRECTIONAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BITRATE - x = PyInt_FromLong(CL_BITRATE); - if (x == NULL || PyDict_SetItemString(d, "BITRATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BITRATE_POLICY - x = PyInt_FromLong(CL_BITRATE_POLICY); - if (x == NULL || PyDict_SetItemString(d, "BITRATE_POLICY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BITRATE_TARGET - x = PyInt_FromLong(CL_BITRATE_TARGET); - if (x == NULL || PyDict_SetItemString(d, "BITRATE_TARGET", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BITS_PER_COMPONENT - x = PyInt_FromLong(CL_BITS_PER_COMPONENT); - if (x == NULL || PyDict_SetItemString(d, "BITS_PER_COMPONENT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BLENDING - x = PyInt_FromLong(CL_BLENDING); - if (x == NULL || PyDict_SetItemString(d, "BLENDING", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BLOCK_SIZE - x = PyInt_FromLong(CL_BLOCK_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BLOCK_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BOTTOM_UP - x = PyInt_FromLong(CL_BOTTOM_UP); - if (x == NULL || PyDict_SetItemString(d, "BOTTOM_UP", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BUFFER_NOT_CREATED - x = PyInt_FromLong(CL_BUFFER_NOT_CREATED); - if (x == NULL || PyDict_SetItemString(d, "BUFFER_NOT_CREATED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BUF_COMPRESSED - x = PyInt_FromLong(CL_BUF_COMPRESSED); - if (x == NULL || PyDict_SetItemString(d, "BUF_COMPRESSED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BUF_DATA - x = PyInt_FromLong(CL_BUF_DATA); - if (x == NULL || PyDict_SetItemString(d, "BUF_DATA", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BUF_FRAME - x = PyInt_FromLong(CL_BUF_FRAME); - if (x == NULL || PyDict_SetItemString(d, "BUF_FRAME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CHANNEL_POLICY - x = PyInt_FromLong(CL_CHANNEL_POLICY); - if (x == NULL || PyDict_SetItemString(d, "CHANNEL_POLICY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CHROMA_THRESHOLD - x = PyInt_FromLong(CL_CHROMA_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "CHROMA_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CODEC - x = PyInt_FromLong(CL_CODEC); - if (x == NULL || PyDict_SetItemString(d, "CODEC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COMPONENTS - x = PyInt_FromLong(CL_COMPONENTS); - if (x == NULL || PyDict_SetItemString(d, "COMPONENTS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COMPRESSED_BUFFER_SIZE - x = PyInt_FromLong(CL_COMPRESSED_BUFFER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "COMPRESSED_BUFFER_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COMPRESSION_RATIO - x = PyInt_FromLong(CL_COMPRESSION_RATIO); - if (x == NULL || PyDict_SetItemString(d, "COMPRESSION_RATIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COMPRESSOR - x = PyInt_FromLong(CL_COMPRESSOR); - if (x == NULL || PyDict_SetItemString(d, "COMPRESSOR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CONTINUOUS_BLOCK - x = PyInt_FromLong(CL_CONTINUOUS_BLOCK); - if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_BLOCK", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CONTINUOUS_NONBLOCK - x = PyInt_FromLong(CL_CONTINUOUS_NONBLOCK); - if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_NONBLOCK", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_CODEC_CONTROL - x = PyInt_FromLong(CL_COSMO_CODEC_CONTROL); - if (x == NULL || PyDict_SetItemString(d, "COSMO_CODEC_CONTROL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_NUM_PARAMS - x = PyInt_FromLong(CL_COSMO_NUM_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "COSMO_NUM_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_VALUE_BASE - x = PyInt_FromLong(CL_COSMO_VALUE_BASE); - if (x == NULL || PyDict_SetItemString(d, "COSMO_VALUE_BASE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_VIDEO_MANUAL_CONTROL - x = PyInt_FromLong(CL_COSMO_VIDEO_MANUAL_CONTROL); - if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_MANUAL_CONTROL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_VIDEO_TRANSFER_MODE - x = PyInt_FromLong(CL_COSMO_VIDEO_TRANSFER_MODE); - if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_TRANSFER_MODE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_DATA - x = PyInt_FromLong(CL_DATA); - if (x == NULL || PyDict_SetItemString(d, "DATA", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_DECOMPRESSOR - x = PyInt_FromLong(CL_DECOMPRESSOR); - if (x == NULL || PyDict_SetItemString(d, "DECOMPRESSOR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_DSO_ERROR - x = PyInt_FromLong(CL_DSO_ERROR); - if (x == NULL || PyDict_SetItemString(d, "DSO_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_EDGE_THRESHOLD - x = PyInt_FromLong(CL_EDGE_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "EDGE_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ENABLE_IMAGEINFO - x = PyInt_FromLong(CL_ENABLE_IMAGEINFO); - if (x == NULL || PyDict_SetItemString(d, "ENABLE_IMAGEINFO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_END_OF_SEQUENCE - x = PyInt_FromLong(CL_END_OF_SEQUENCE); - if (x == NULL || PyDict_SetItemString(d, "END_OF_SEQUENCE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ENUM_VALUE - x = PyInt_FromLong(CL_ENUM_VALUE); - if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_EXACT_COMPRESSION_RATIO - x = PyInt_FromLong(CL_EXACT_COMPRESSION_RATIO); - if (x == NULL || PyDict_SetItemString(d, "EXACT_COMPRESSION_RATIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_EXTERNAL_DEVICE - x = PyInt_FromLong((long) CL_EXTERNAL_DEVICE); - if (x == NULL || PyDict_SetItemString(d, "EXTERNAL_DEVICE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FLOATING_ENUM_VALUE - x = PyInt_FromLong(CL_FLOATING_ENUM_VALUE); - if (x == NULL || PyDict_SetItemString(d, "FLOATING_ENUM_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FLOATING_RANGE_VALUE - x = PyInt_FromLong(CL_FLOATING_RANGE_VALUE); - if (x == NULL || PyDict_SetItemString(d, "FLOATING_RANGE_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT - x = PyInt_FromLong(CL_FORMAT); - if (x == NULL || PyDict_SetItemString(d, "FORMAT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_ABGR - x = PyInt_FromLong(CL_FORMAT_ABGR); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_ABGR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_BGR - x = PyInt_FromLong(CL_FORMAT_BGR); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_BGR233 - x = PyInt_FromLong(CL_FORMAT_BGR233); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR233", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_GRAYSCALE - x = PyInt_FromLong(CL_FORMAT_GRAYSCALE); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_GRAYSCALE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_MONO - x = PyInt_FromLong(CL_FORMAT_MONO); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_MONO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_RBG323 - x = PyInt_FromLong(CL_FORMAT_RBG323); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_RBG323", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_STEREO_INTERLEAVED - x = PyInt_FromLong(CL_FORMAT_STEREO_INTERLEAVED); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_STEREO_INTERLEAVED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_XBGR - x = PyInt_FromLong(CL_FORMAT_XBGR); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_XBGR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_YCbCr - x = PyInt_FromLong(CL_FORMAT_YCbCr); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_YCbCr422 - x = PyInt_FromLong(CL_FORMAT_YCbCr422); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_YCbCr422DC - x = PyInt_FromLong(CL_FORMAT_YCbCr422DC); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422DC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME - x = PyInt_FromLong(CL_FRAME); - if (x == NULL || PyDict_SetItemString(d, "FRAME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAMES_PER_CHUNK - x = PyInt_FromLong(CL_FRAMES_PER_CHUNK); - if (x == NULL || PyDict_SetItemString(d, "FRAMES_PER_CHUNK", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_BUFFER_SIZE - x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_BUFFER_SIZE_ZERO - x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE_ZERO); - if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE_ZERO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_INDEX - x = PyInt_FromLong(CL_FRAME_INDEX); - if (x == NULL || PyDict_SetItemString(d, "FRAME_INDEX", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_RATE - x = PyInt_FromLong(CL_FRAME_RATE); - if (x == NULL || PyDict_SetItemString(d, "FRAME_RATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_SIZE - x = PyInt_FromLong(CL_FRAME_SIZE); - if (x == NULL || PyDict_SetItemString(d, "FRAME_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_TYPE - x = PyInt_FromLong(CL_FRAME_TYPE); - if (x == NULL || PyDict_SetItemString(d, "FRAME_TYPE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_G711_ALAW - x = PyInt_FromLong(CL_G711_ALAW); - if (x == NULL || PyDict_SetItemString(d, "G711_ALAW", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_G711_ALAW_SOFTWARE - x = PyInt_FromLong(CL_G711_ALAW_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "G711_ALAW_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_G711_ULAW - x = PyInt_FromLong(CL_G711_ULAW); - if (x == NULL || PyDict_SetItemString(d, "G711_ULAW", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_G711_ULAW_SOFTWARE - x = PyInt_FromLong(CL_G711_ULAW_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "G711_ULAW_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_GRAYSCALE - x = PyInt_FromLong(CL_GRAYSCALE); - if (x == NULL || PyDict_SetItemString(d, "GRAYSCALE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HDCC - x = PyInt_FromLong(CL_HDCC); - if (x == NULL || PyDict_SetItemString(d, "HDCC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HDCC_SAMPLES_PER_TILE - x = PyInt_FromLong(CL_HDCC_SAMPLES_PER_TILE); - if (x == NULL || PyDict_SetItemString(d, "HDCC_SAMPLES_PER_TILE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HDCC_SOFTWARE - x = PyInt_FromLong(CL_HDCC_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "HDCC_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HDCC_TILE_THRESHOLD - x = PyInt_FromLong(CL_HDCC_TILE_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "HDCC_TILE_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HEADER_START_CODE - x = PyInt_FromLong(CL_HEADER_START_CODE); - if (x == NULL || PyDict_SetItemString(d, "HEADER_START_CODE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGEINFO_FIELDMASK - x = PyInt_FromLong(CL_IMAGEINFO_FIELDMASK); - if (x == NULL || PyDict_SetItemString(d, "IMAGEINFO_FIELDMASK", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_CROP_BOTTOM - x = PyInt_FromLong(CL_IMAGE_CROP_BOTTOM); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_BOTTOM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_CROP_LEFT - x = PyInt_FromLong(CL_IMAGE_CROP_LEFT); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_LEFT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_CROP_RIGHT - x = PyInt_FromLong(CL_IMAGE_CROP_RIGHT); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_RIGHT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_CROP_TOP - x = PyInt_FromLong(CL_IMAGE_CROP_TOP); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_TOP", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_HEIGHT - x = PyInt_FromLong(CL_IMAGE_HEIGHT); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_HEIGHT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_WIDTH - x = PyInt_FromLong(CL_IMAGE_WIDTH); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_WIDTH", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMPACT_CODEC_CONTROL - x = PyInt_FromLong(CL_IMPACT_CODEC_CONTROL); - if (x == NULL || PyDict_SetItemString(d, "IMPACT_CODEC_CONTROL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMPACT_FRAME_INTERLEAVE - x = PyInt_FromLong(CL_IMPACT_FRAME_INTERLEAVE); - if (x == NULL || PyDict_SetItemString(d, "IMPACT_FRAME_INTERLEAVE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMPACT_NUM_PARAMS - x = PyInt_FromLong(CL_IMPACT_NUM_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "IMPACT_NUM_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_INTERNAL_FORMAT - x = PyInt_FromLong(CL_INTERNAL_FORMAT); - if (x == NULL || PyDict_SetItemString(d, "INTERNAL_FORMAT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_INTERNAL_IMAGE_HEIGHT - x = PyInt_FromLong(CL_INTERNAL_IMAGE_HEIGHT); - if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_HEIGHT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_INTERNAL_IMAGE_WIDTH - x = PyInt_FromLong(CL_INTERNAL_IMAGE_WIDTH); - if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_WIDTH", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_INTRA - x = PyInt_FromLong(CL_INTRA); - if (x == NULL || PyDict_SetItemString(d, "INTRA", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG - x = PyInt_FromLong(CL_JPEG); - if (x == NULL || PyDict_SetItemString(d, "JPEG", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_COSMO - x = PyInt_FromLong(CL_JPEG_COSMO); - if (x == NULL || PyDict_SetItemString(d, "JPEG_COSMO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_ERROR - x = PyInt_FromLong(CL_JPEG_ERROR); - if (x == NULL || PyDict_SetItemString(d, "JPEG_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_IMPACT - x = PyInt_FromLong(CL_JPEG_IMPACT); - if (x == NULL || PyDict_SetItemString(d, "JPEG_IMPACT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_NUM_PARAMS - x = PyInt_FromLong(CL_JPEG_NUM_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "JPEG_NUM_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_QUALITY_FACTOR - x = PyInt_FromLong(CL_JPEG_QUALITY_FACTOR); - if (x == NULL || PyDict_SetItemString(d, "JPEG_QUALITY_FACTOR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_QUANTIZATION_TABLES - x = PyInt_FromLong(CL_JPEG_QUANTIZATION_TABLES); - if (x == NULL || PyDict_SetItemString(d, "JPEG_QUANTIZATION_TABLES", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_SOFTWARE - x = PyInt_FromLong(CL_JPEG_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "JPEG_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_STREAM_HEADERS - x = PyInt_FromLong(CL_JPEG_STREAM_HEADERS); - if (x == NULL || PyDict_SetItemString(d, "JPEG_STREAM_HEADERS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_KEYFRAME - x = PyInt_FromLong(CL_KEYFRAME); - if (x == NULL || PyDict_SetItemString(d, "KEYFRAME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_KEYFRAME_DISTANCE - x = PyInt_FromLong(CL_KEYFRAME_DISTANCE); - if (x == NULL || PyDict_SetItemString(d, "KEYFRAME_DISTANCE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_LAST_FRAME_INDEX - x = PyInt_FromLong(CL_LAST_FRAME_INDEX); - if (x == NULL || PyDict_SetItemString(d, "LAST_FRAME_INDEX", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_LAYER - x = PyInt_FromLong(CL_LAYER); - if (x == NULL || PyDict_SetItemString(d, "LAYER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_LUMA_THRESHOLD - x = PyInt_FromLong(CL_LUMA_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "LUMA_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_AUDIO_ALGORITHMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_FORMATS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_FORMATS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_FORMATS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_ORIGINAL_FORMATS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_ORIGINAL_FORMATS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_ORIGINAL_FORMATS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_PARAMS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_VIDEO_ALGORITHMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MONO - x = PyInt_FromLong(CL_MONO); - if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_AWARE - x = PyInt_FromLong(CL_MPEG1_AUDIO_AWARE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_AWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_LAYER - x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_LAYER_I - x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_I); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_I", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_LAYER_II - x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_II); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_II", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE_DUAL - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_DUAL); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_DUAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE_JOINT - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_JOINT); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_JOINT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE_SINGLE - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_SINGLE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_SINGLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE_STEREO - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_STEREO); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_SOFTWARE - x = PyInt_FromLong(CL_MPEG1_AUDIO_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_END_OF_STREAM - x = PyInt_FromLong(CL_MPEG1_END_OF_STREAM); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_END_OF_STREAM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_ERROR - x = PyInt_FromLong(CL_MPEG1_ERROR); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_NUM_PARAMS - x = PyInt_FromLong(CL_MPEG1_NUM_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_NUM_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_M - x = PyInt_FromLong(CL_MPEG1_VIDEO_M); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_M", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X - x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y - x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X - x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y - x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_N - x = PyInt_FromLong(CL_MPEG1_VIDEO_N); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_N", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTNESS - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MAXIMUM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTNESS_MEDIUM - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MEDIUM); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MEDIUM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTNESS_NONE - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_NONE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_NONE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTWARE - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG_VIDEO - x = PyInt_FromLong(CL_MPEG_VIDEO); - if (x == NULL || PyDict_SetItemString(d, "MPEG_VIDEO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MULTIRATE_AWARE - x = PyInt_FromLong(CL_MULTIRATE_AWARE); - if (x == NULL || PyDict_SetItemString(d, "MULTIRATE_AWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC1 - x = PyInt_FromLong(CL_MVC1); - if (x == NULL || PyDict_SetItemString(d, "MVC1", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC1_SOFTWARE - x = PyInt_FromLong(CL_MVC1_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MVC1_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2 - x = PyInt_FromLong(CL_MVC2); - if (x == NULL || PyDict_SetItemString(d, "MVC2", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_BLENDING - x = PyInt_FromLong(CL_MVC2_BLENDING); - if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_BLENDING_OFF - x = PyInt_FromLong(CL_MVC2_BLENDING_OFF); - if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_OFF", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_BLENDING_ON - x = PyInt_FromLong(CL_MVC2_BLENDING_ON); - if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_ON", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_CHROMA_THRESHOLD - x = PyInt_FromLong(CL_MVC2_CHROMA_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "MVC2_CHROMA_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_EDGE_THRESHOLD - x = PyInt_FromLong(CL_MVC2_EDGE_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "MVC2_EDGE_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_ERROR - x = PyInt_FromLong(CL_MVC2_ERROR); - if (x == NULL || PyDict_SetItemString(d, "MVC2_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_LUMA_THRESHOLD - x = PyInt_FromLong(CL_MVC2_LUMA_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "MVC2_LUMA_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_SOFTWARE - x = PyInt_FromLong(CL_MVC2_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MVC2_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC3_QUALITY_LEVEL - x = PyInt_FromLong(CL_MVC3_QUALITY_LEVEL); - if (x == NULL || PyDict_SetItemString(d, "MVC3_QUALITY_LEVEL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC3_SOFTWARE - x = PyInt_FromLong(CL_MVC3_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MVC3_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NEXT_NOT_AVAILABLE - x = PyInt_FromLong(CL_NEXT_NOT_AVAILABLE); - if (x == NULL || PyDict_SetItemString(d, "NEXT_NOT_AVAILABLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NOISE_MARGIN - x = PyInt_FromLong(CL_NOISE_MARGIN); - if (x == NULL || PyDict_SetItemString(d, "NOISE_MARGIN", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NONE - x = PyInt_FromLong(CL_NONE); - if (x == NULL || PyDict_SetItemString(d, "NONE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_FORMATS - x = PyInt_FromLong(CL_NUMBER_OF_FORMATS); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FORMATS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_FRAMES - x = PyInt_FromLong(CL_NUMBER_OF_FRAMES); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FRAMES", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_PARAMS - x = PyInt_FromLong(CL_NUMBER_OF_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_PARAMS_FREEZE - x = PyInt_FromLong(CL_NUMBER_OF_PARAMS_FREEZE); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS_FREEZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_VIDEO_FORMATS - x = PyInt_FromLong(CL_NUMBER_OF_VIDEO_FORMATS); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_VIDEO_FORMATS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ORIENTATION - x = PyInt_FromLong(CL_ORIENTATION); - if (x == NULL || PyDict_SetItemString(d, "ORIENTATION", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ORIGINAL_FORMAT - x = PyInt_FromLong(CL_ORIGINAL_FORMAT); - if (x == NULL || PyDict_SetItemString(d, "ORIGINAL_FORMAT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_PARAM_OUT_OF_RANGE - x = PyInt_FromLong(CL_PARAM_OUT_OF_RANGE); - if (x == NULL || PyDict_SetItemString(d, "PARAM_OUT_OF_RANGE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_PIXEL_ASPECT - x = PyInt_FromLong(CL_PIXEL_ASPECT); - if (x == NULL || PyDict_SetItemString(d, "PIXEL_ASPECT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_PREDICTED - x = PyInt_FromLong(CL_PREDICTED); - if (x == NULL || PyDict_SetItemString(d, "PREDICTED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_PREROLL - x = PyInt_FromLong(CL_PREROLL); - if (x == NULL || PyDict_SetItemString(d, "PREROLL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUALITY_FACTOR - x = PyInt_FromLong(CL_QUALITY_FACTOR); - if (x == NULL || PyDict_SetItemString(d, "QUALITY_FACTOR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUALITY_LEVEL - x = PyInt_FromLong(CL_QUALITY_LEVEL); - if (x == NULL || PyDict_SetItemString(d, "QUALITY_LEVEL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUALITY_SPATIAL - x = PyInt_FromLong(CL_QUALITY_SPATIAL); - if (x == NULL || PyDict_SetItemString(d, "QUALITY_SPATIAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUALITY_TEMPORAL - x = PyInt_FromLong(CL_QUALITY_TEMPORAL); - if (x == NULL || PyDict_SetItemString(d, "QUALITY_TEMPORAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUANTIZATION_TABLES - x = PyInt_FromLong(CL_QUANTIZATION_TABLES); - if (x == NULL || PyDict_SetItemString(d, "QUANTIZATION_TABLES", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RANGE_VALUE - x = PyInt_FromLong(CL_RANGE_VALUE); - if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGB - x = PyInt_FromLong(CL_RGB); - if (x == NULL || PyDict_SetItemString(d, "RGB", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGB332 - x = PyInt_FromLong(CL_RGB332); - if (x == NULL || PyDict_SetItemString(d, "RGB332", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGB8 - x = PyInt_FromLong(CL_RGB8); - if (x == NULL || PyDict_SetItemString(d, "RGB8", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGBA - x = PyInt_FromLong(CL_RGBA); - if (x == NULL || PyDict_SetItemString(d, "RGBA", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGBX - x = PyInt_FromLong(CL_RGBX); - if (x == NULL || PyDict_SetItemString(d, "RGBX", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RLE - x = PyInt_FromLong(CL_RLE); - if (x == NULL || PyDict_SetItemString(d, "RLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RLE24 - x = PyInt_FromLong(CL_RLE24); - if (x == NULL || PyDict_SetItemString(d, "RLE24", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RLE24_SOFTWARE - x = PyInt_FromLong(CL_RLE24_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "RLE24_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RLE_SOFTWARE - x = PyInt_FromLong(CL_RLE_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "RLE_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RTR - x = PyInt_FromLong(CL_RTR); - if (x == NULL || PyDict_SetItemString(d, "RTR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RTR1 - x = PyInt_FromLong(CL_RTR1); - if (x == NULL || PyDict_SetItemString(d, "RTR1", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RTR_QUALITY_LEVEL - x = PyInt_FromLong(CL_RTR_QUALITY_LEVEL); - if (x == NULL || PyDict_SetItemString(d, "RTR_QUALITY_LEVEL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_SAMPLES_PER_TILE - x = PyInt_FromLong(CL_SAMPLES_PER_TILE); - if (x == NULL || PyDict_SetItemString(d, "SAMPLES_PER_TILE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_SCHEME_BUSY - x = PyInt_FromLong(CL_SCHEME_BUSY); - if (x == NULL || PyDict_SetItemString(d, "SCHEME_BUSY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_SCHEME_NOT_AVAILABLE - x = PyInt_FromLong(CL_SCHEME_NOT_AVAILABLE); - if (x == NULL || PyDict_SetItemString(d, "SCHEME_NOT_AVAILABLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_SPEED - x = PyInt_FromLong(CL_SPEED); - if (x == NULL || PyDict_SetItemString(d, "SPEED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_STEREO_INTERLEAVED - x = PyInt_FromLong(CL_STEREO_INTERLEAVED); - if (x == NULL || PyDict_SetItemString(d, "STEREO_INTERLEAVED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_STREAM_HEADERS - x = PyInt_FromLong(CL_STREAM_HEADERS); - if (x == NULL || PyDict_SetItemString(d, "STREAM_HEADERS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_TILE_THRESHOLD - x = PyInt_FromLong(CL_TILE_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "TILE_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_TOP_DOWN - x = PyInt_FromLong(CL_TOP_DOWN); - if (x == NULL || PyDict_SetItemString(d, "TOP_DOWN", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ULAW - x = PyInt_FromLong(CL_ULAW); - if (x == NULL || PyDict_SetItemString(d, "ULAW", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_UNCOMPRESSED - x = PyInt_FromLong(CL_UNCOMPRESSED); - if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_UNCOMPRESSED_AUDIO - x = PyInt_FromLong(CL_UNCOMPRESSED_AUDIO); - if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_AUDIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_UNCOMPRESSED_VIDEO - x = PyInt_FromLong(CL_UNCOMPRESSED_VIDEO); - if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_VIDEO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_UNKNOWN_SCHEME - x = PyInt_FromLong(CL_UNKNOWN_SCHEME); - if (x == NULL || PyDict_SetItemString(d, "UNKNOWN_SCHEME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_VIDEO - x = PyInt_FromLong(CL_VIDEO); - if (x == NULL || PyDict_SetItemString(d, "VIDEO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_Y - x = PyInt_FromLong(CL_Y); - if (x == NULL || PyDict_SetItemString(d, "Y", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YCbCr - x = PyInt_FromLong(CL_YCbCr); - if (x == NULL || PyDict_SetItemString(d, "YCbCr", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YCbCr422 - x = PyInt_FromLong(CL_YCbCr422); - if (x == NULL || PyDict_SetItemString(d, "YCbCr422", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YCbCr422DC - x = PyInt_FromLong(CL_YCbCr422DC); - if (x == NULL || PyDict_SetItemString(d, "YCbCr422DC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YCbCr422HC - x = PyInt_FromLong(CL_YCbCr422HC); - if (x == NULL || PyDict_SetItemString(d, "YCbCr422HC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YUV - x = PyInt_FromLong(CL_YUV); - if (x == NULL || PyDict_SetItemString(d, "YUV", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YUV422 - x = PyInt_FromLong(CL_YUV422); - if (x == NULL || PyDict_SetItemString(d, "YUV422", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YUV422DC - x = PyInt_FromLong(CL_YUV422DC); - if (x == NULL || PyDict_SetItemString(d, "YUV422DC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YUV422HC - x = PyInt_FromLong(CL_YUV422HC); - if (x == NULL || PyDict_SetItemString(d, "YUV422HC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_STEREO - x = PyInt_FromLong(AWCMP_STEREO); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_JOINT_STEREO - x = PyInt_FromLong(AWCMP_JOINT_STEREO); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_JOINT_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_INDEPENDENT - x = PyInt_FromLong(AWCMP_INDEPENDENT); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_INDEPENDENT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_FIXED_RATE - x = PyInt_FromLong(AWCMP_FIXED_RATE); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_FIXED_RATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_CONST_QUAL - x = PyInt_FromLong(AWCMP_CONST_QUAL); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_CONST_QUAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_LOSSLESS - x = PyInt_FromLong(AWCMP_LOSSLESS); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_LOSSLESS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_MPEG_LAYER_I - x = PyInt_FromLong(AWCMP_MPEG_LAYER_I); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_I", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_MPEG_LAYER_II - x = PyInt_FromLong(AWCMP_MPEG_LAYER_II); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_II", x) < 0) - return; - Py_DECREF(x); -#endif - - (void) clSetErrorHandler(cl_ErrorHandler); -} diff --git a/Modules/flmodule.c b/Modules/flmodule.c deleted file mode 100644 index e507c9f..0000000 --- a/Modules/flmodule.c +++ /dev/null @@ -1,2139 +0,0 @@ -/* FL module -- interface to Mark Overmars' FORMS Library. */ - -/* This code works with FORMS version 2.2 (if you defined - OBSOLETE_FORMS_CALLS), and 2.3. - FORMS can be ftp'ed from ftp.cs.ruu.nl (131.211.80.17), directory - /pub/SGI/FORMS. */ - -/* A half-hearted attempt has been made to allow programs using this - * module to exploit parallelism (through the threads module). No provisions - * have been made for multiple threads to use this module at the same time, - * though. So, a program with a forms thread and a non-forms thread will work - * fine but a program with two threads using forms will probably crash (unless - * the program takes precaution to ensure that only one thread can be in - * this module at any time). This will have to be fixed some time. - * (A fix will probably also have to synchronize with the gl module). - */ - -#include "Python.h" -#include "forms.h" -#include "structmember.h" - -/* Generic Forms Objects */ - -typedef struct { - PyObject_HEAD - FL_OBJECT *ob_generic; - PyMethodDef *ob_methods; - PyObject *ob_callback; - PyObject *ob_callback_arg; -} genericobject; - -static PyTypeObject GenericObjecttype; - -#define is_genericobject(g) ((g)->ob_type == &GenericObjecttype) - -/* List of all objects (XXX this should be a hash table on address...) */ - -static PyObject *allgenerics = NULL; -static int nfreeslots = 0; - -/* Add an object to the list of known objects */ - -static void -knowgeneric(genericobject *g) -{ - int i, n; - /* Create the list if it doesn't already exist */ - if (allgenerics == NULL) { - allgenerics = PyList_New(0); - if (allgenerics == NULL) { - PyErr_Clear(); - return; /* Too bad, live without allgenerics... */ - } - } - if (nfreeslots > 0) { - /* Search the list for reusable slots (NULL items) */ - /* XXX This can be made faster! */ - n = PyList_Size(allgenerics); - for (i = 0; i < n; i++) { - if (PyList_GetItem(allgenerics, i) == NULL) { - Py_INCREF(g); - PyList_SetItem(allgenerics, i, (PyObject *)g); - nfreeslots--; - return; - } - } - /* Strange... no free slots found... */ - nfreeslots = 0; - } - /* No free entries, append new item to the end */ - PyList_Append(allgenerics, (PyObject *)g); -} - -/* Find an object in the list of known objects */ - -static genericobject * -findgeneric(FL_OBJECT *generic) -{ - int i, n; - genericobject *g; - - if (allgenerics == NULL) - return NULL; /* No objects known yet */ - n = PyList_Size(allgenerics); - for (i = 0; i < n; i++) { - g = (genericobject *)PyList_GetItem(allgenerics, i); - if (g != NULL && g->ob_generic == generic) - return g; - } - return NULL; /* Unknown object */ -} - -/* Remove an object from the list of known objects */ - -static void -forgetgeneric(genericobject *g) -{ - int i, n; - - Py_XDECREF(g->ob_callback); - g->ob_callback = NULL; - Py_XDECREF(g->ob_callback_arg); - g->ob_callback_arg = NULL; - if (allgenerics == NULL) - return; /* No objects known yet */ - n = PyList_Size(allgenerics); - for (i = 0; i < n; i++) { - if (g == (genericobject *)PyList_GetItem(allgenerics, i)) { - PyList_SetItem(allgenerics, i, (PyObject *)NULL); - nfreeslots++; - break; - } - } -} - -/* Called when a form is about to be freed -- - remove all the objects that we know about from it. */ - -static void -releaseobjects(FL_FORM *form) -{ - int i, n; - genericobject *g; - - if (allgenerics == NULL) - return; /* No objects known yet */ - n = PyList_Size(allgenerics); - for (i = 0; i < n; i++) { - g = (genericobject *)PyList_GetItem(allgenerics, i); - if (g != NULL && g->ob_generic->form == form) { - fl_delete_object(g->ob_generic); - /* The object is now unreachable for - do_forms and check_forms, so - delete it from the list of known objects */ - Py_XDECREF(g->ob_callback); - g->ob_callback = NULL; - Py_XDECREF(g->ob_callback_arg); - g->ob_callback_arg = NULL; - PyList_SetItem(allgenerics, i, (PyObject *)NULL); - nfreeslots++; - } - } -} - - -/* Methods of generic objects */ - -static PyObject * -generic_set_call_back(genericobject *g, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) { - Py_XDECREF(g->ob_callback); - Py_XDECREF(g->ob_callback_arg); - g->ob_callback = NULL; - g->ob_callback_arg = NULL; - } - else { - PyObject *a, *b; - if (!PyArg_UnpackTuple(args, "set_call_back", 2, 2, &a, &b) - return NULL; - Py_XDECREF(g->ob_callback); - Py_XDECREF(g->ob_callback_arg); - g->ob_callback = a; - Py_INCREF(g->ob_callback); - g->ob_callback_arg = b; - Py_INCREF(g->ob_callback_arg); - } - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -generic_call(genericobject *g, void (*func)(FL_OBJECT *)) -{ - (*func)(g->ob_generic); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -generic_delete_object(genericobject *g) -{ - PyObject *res; - res = generic_call(g, fl_delete_object); - if (res != NULL) - forgetgeneric(g); - return res; -} - -static PyObject * -generic_show_object(genericobject *g) -{ - return generic_call(g, fl_show_object); -} - -static PyObject * -generic_hide_object(genericobject *g) -{ - return generic_call(g, fl_hide_object); -} - -static PyObject * -generic_redraw_object(genericobject *g) -{ - return generic_call(g, fl_redraw_object); -} - -#ifdef OBSOLETE_FORMS_CALLS - - /* (un)freeze_object() are obsolete in FORMS 2.2 and unsupported - in 2.3. Since there's no foolproof way to tell which version we're - using, we omit them unconditionally. */ - -static PyObject * -generic_freeze_object(genericobject *g) -{ - return generic_call(g, fl_freeze_object); -} - -static PyObject * -generic_unfreeze_object(genericobject *g) -{ - return generic_call(g, fl_unfreeze_object); -} - -#endif /* OBSOLETE_FORMS_CALLS */ - -static PyObject * -generic_activate_object(genericobject *g) -{ - return generic_call(g, fl_activate_object); -} - -static PyObject * -generic_deactivate_object(genericobject *g) -{ - return generic_call(g, fl_deactivate_object); -} - -static PyObject * -generic_set_object_shortcut(genericobject *g, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s:set_object_shortcut", &str)) - return NULL; - fl_set_object_shortcut(g->ob_generic, str); - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef generic_methods[] = { - {"set_call_back", (PyCFunction)generic_set_call_back, METH_VARARGS}, - {"delete_object", (PyCFunction)generic_delete_object, METH_NOARGS}, - {"show_object", (PyCFunction)generic_show_object, METH_NOARGS}, - {"hide_object", (PyCFunction)generic_hide_object, METH_NOARGS}, - {"redraw_object", (PyCFunction)generic_redraw_object, METH_NOARGS}, -#ifdef OBSOLETE_FORMS_CALLS - {"freeze_object", (PyCFunction)generic_freeze_object, METH_NOARGS}, - {"unfreeze_object", (PyCFunction)generic_unfreeze_object, METH_NOARGS}, -#endif - {"activate_object", (PyCFunction)generic_activate_object, METH_NOARGS}, - {"deactivate_object", (PyCFunction)generic_deactivate_object, METH_NOARGS}, - {"set_object_shortcut", (PyCFunction)generic_set_object_shortcut, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -generic_dealloc(genericobject *g) -{ - fl_free_object(g->ob_generic); - Py_XDECREF(g->ob_callback); - Py_XDECREF(g->ob_callback_arg); - PyObject_Del(g); -} - -#define OFF(x) offsetof(FL_OBJECT, x) - -static struct memberlist generic_memberlist[] = { - {"objclass", T_INT, OFF(objclass), RO}, - {"type", T_INT, OFF(type), RO}, - {"boxtype", T_INT, OFF(boxtype)}, - {"x", T_FLOAT, OFF(x)}, - {"y", T_FLOAT, OFF(y)}, - {"w", T_FLOAT, OFF(w)}, - {"h", T_FLOAT, OFF(h)}, - {"col1", T_INT, OFF(col1)}, - {"col2", T_INT, OFF(col2)}, - {"align", T_INT, OFF(align)}, - {"lcol", T_INT, OFF(lcol)}, - {"lsize", T_FLOAT, OFF(lsize)}, - /* "label" is treated specially! */ - {"lstyle", T_INT, OFF(lstyle)}, - {"pushed", T_INT, OFF(pushed), RO}, - {"focus", T_INT, OFF(focus), RO}, - {"belowmouse", T_INT, OFF(belowmouse),RO}, -/* {"frozen", T_INT, OFF(frozen), RO}, */ - {"active", T_INT, OFF(active)}, - {"input", T_INT, OFF(input)}, - {"visible", T_INT, OFF(visible), RO}, - {"radio", T_INT, OFF(radio)}, - {"automatic", T_INT, OFF(automatic)}, - {NULL} /* Sentinel */ -}; - -#undef OFF - -static PyObject * -generic_getattr(genericobject *g, char *name) -{ - PyObject *meth; - - /* XXX Ought to special-case name "__methods__" */ - if (g-> ob_methods) { - meth = Py_FindMethod(g->ob_methods, (PyObject *)g, name); - if (meth != NULL) return meth; - PyErr_Clear(); - } - - meth = Py_FindMethod(generic_methods, (PyObject *)g, name); - if (meth != NULL) - return meth; - PyErr_Clear(); - - /* "label" is an exception, getmember only works for char pointers, - not for char arrays */ - if (strcmp(name, "label") == 0) - return PyString_FromString(g->ob_generic->label); - - return PyMember_Get((char *)g->ob_generic, generic_memberlist, name); -} - -static int -generic_setattr(genericobject *g, char *name, PyObject *v) -{ - int ret; - - if (v == NULL) { - PyErr_SetString(PyExc_TypeError, - "can't delete forms object attributes"); - return -1; - } - - /* "label" is an exception: setmember doesn't set strings; - and FORMS wants you to call a function to set the label */ - if (strcmp(name, "label") == 0) { - if (!PyString_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "label attr must be string"); - return -1; - } - fl_set_object_label(g->ob_generic, PyString_AsString(v)); - return 0; - } - - ret = PyMember_Set((char *)g->ob_generic, generic_memberlist, name, v); - - /* Rather than calling all the various set_object_* functions, - we call fl_redraw_object here. This is sometimes redundant - but I doubt that's a big problem */ - if (ret == 0) - fl_redraw_object(g->ob_generic); - - return ret; -} - -static PyObject * -generic_repr(genericobject *g) -{ - char buf[100]; - PyOS_snprintf(buf, sizeof(buf), "", - g, g->ob_generic->objclass); - return PyString_FromString(buf); -} - -static PyTypeObject GenericObjecttype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "fl.FORMS_object", /*tp_name*/ - sizeof(genericobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)generic_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)generic_getattr, /*tp_getattr*/ - (setattrfunc)generic_setattr, /*tp_setattr*/ - 0, /*tp_compare*/ - (reprfunc)generic_repr, /*tp_repr*/ -}; - -static PyObject * -newgenericobject(FL_OBJECT *generic, PyMethodDef *methods) -{ - genericobject *g; - g = PyObject_New(genericobject, &GenericObjecttype); - if (g == NULL) - return NULL; - g-> ob_generic = generic; - g->ob_methods = methods; - g->ob_callback = NULL; - g->ob_callback_arg = NULL; - knowgeneric(g); - return (PyObject *)g; -} - -/**********************************************************************/ -/* Some common calling sequences */ - -/* void func (object, float) */ -static PyObject * -call_forms_INf (void (*func)(FL_OBJECT *, float), FL_OBJECT *obj, PyObject *args) -{ - float parameter; - - if (!PyArg_Parse(args, "f", ¶meter)) return NULL; - - (*func) (obj, parameter); - - Py_INCREF(Py_None); - return Py_None; -} - -/* void func (object, float) */ -static PyObject * -call_forms_INfINf (void (*func)(FL_OBJECT *, float, float), FL_OBJECT *obj, PyObject *args) -{ - float par1, par2; - - if (!PyArg_Parse(args, "(ff)", &par1, &par2)) return NULL; - - (*func) (obj, par1, par2); - - Py_INCREF(Py_None); - return Py_None; -} - -/* void func (object, int) */ -static PyObject * -call_forms_INi (void (*func)(FL_OBJECT *, int), FL_OBJECT *obj, PyObject *args) -{ - int parameter; - - if (!PyArg_Parse(args, "i", ¶meter)) return NULL; - - (*func) (obj, parameter); - - Py_INCREF(Py_None); - return Py_None; -} - -/* void func (object, char) */ -static PyObject * -call_forms_INc (void (*func)(FL_OBJECT *, int), FL_OBJECT *obj, PyObject *args) -{ - char *a; - - if (!PyArg_Parse(args, "s", &a)) return NULL; - - (*func) (obj, a[0]); - - Py_INCREF(Py_None); - return Py_None; -} - -/* void func (object, string) */ -static PyObject * -call_forms_INstr (void (*func)(FL_OBJECT *, char *), FL_OBJECT *obj, PyObject *args) -{ - char *a; - - if (!PyArg_Parse(args, "s", &a)) return NULL; - - (*func) (obj, a); - - Py_INCREF(Py_None); - return Py_None; -} - - -/* void func (object, int, string) */ -static PyObject * -call_forms_INiINstr (void (*func)(FL_OBJECT *, int, char *), FL_OBJECT *obj, PyObject *args) -{ - char *b; - int a; - - if (!PyArg_Parse(args, "(is)", &a, &b)) return NULL; - - (*func) (obj, a, b); - - Py_INCREF(Py_None); - return Py_None; -} - -#ifdef UNUSED -/* void func (object, int, int) */ -static PyObject * -call_forms_INiINi (void (*func)(FL_OBJECT *, int, int), FL_OBJECT *obj, PyObject *args) -{ - int par1, par2; - - if (!PyArg_Parse(args, "(ii)", &par1, &par2)) return NULL; - - (*func) (obj, par1, par2); - - Py_INCREF(Py_None); - return Py_None; -} -#endif - -/* int func (object) */ -static PyObject * -call_forms_Ri (int (*func)(FL_OBJECT *), FL_OBJECT *obj) -{ - int retval; - - retval = (*func) (obj); - - return PyInt_FromLong ((long) retval); -} - -/* char * func (object) */ -static PyObject * -call_forms_Rstr (char * (*func)(FL_OBJECT *), FL_OBJECT *obj) -{ - char *str; - - str = (*func) (obj); - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString (str); -} - -/* int func (object) */ -static PyObject * -call_forms_Rf (float (*func)(FL_OBJECT *), FL_OBJECT *obj) -{ - float retval; - - retval = (*func) (obj); - - return PyFloat_FromDouble (retval); -} - -static PyObject * -call_forms_OUTfOUTf (void (*func)(FL_OBJECT *, float *, float *), FL_OBJECT *obj) -{ - float f1, f2; - - (*func) (obj, &f1, &f2); - - return Py_BuildValue("(ff)", f1, f2); -} - -#ifdef UNUSED -static PyObject * -call_forms_OUTf (void (*func)(FL_OBJECT *, float *), FL_OBJECT *obj) -{ - float f; - - (*func) (obj, &f); - - return PyFloat_FromDouble (f); -} -#endif - -/**********************************************************************/ -/* Class : browser */ - -static PyObject * -set_browser_topline(genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_browser_topline, g-> ob_generic, args); -} - -static PyObject * -clear_browser(genericobject *g) -{ - return generic_call (g, fl_clear_browser); -} - -static PyObject * -add_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_add_browser_line, g-> ob_generic, args); -} - -static PyObject * -addto_browser (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_addto_browser, g-> ob_generic, args); -} - -static PyObject * -insert_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INiINstr (fl_insert_browser_line, - g-> ob_generic, args); -} - -static PyObject * -delete_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_delete_browser_line, g-> ob_generic, args); -} - -static PyObject * -replace_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INiINstr (fl_replace_browser_line, - g-> ob_generic, args); -} - -static PyObject * -get_browser_line(genericobject *g, PyObject *args) -{ - int i; - char *str; - - if (!PyArg_Parse(args, "i", &i)) - return NULL; - - str = fl_get_browser_line (g->ob_generic, i); - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString (str); -} - -static PyObject * -load_browser (genericobject *g, PyObject *args) -{ - /* XXX strictly speaking this is wrong since fl_load_browser - XXX returns int, not void */ - return call_forms_INstr (fl_load_browser, g-> ob_generic, args); -} - -static PyObject * -get_browser_maxline(genericobject *g) -{ - return call_forms_Ri (fl_get_browser_maxline, g-> ob_generic); -} - -static PyObject * -select_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_select_browser_line, g-> ob_generic, args); -} - -static PyObject * -deselect_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_deselect_browser_line, g-> ob_generic, args); -} - -static PyObject * -deselect_browser (genericobject *g) -{ - return generic_call (g, fl_deselect_browser); -} - -static PyObject * -isselected_browser_line (genericobject *g, PyObject *args) -{ - int i, j; - - if (!PyArg_Parse(args, "i", &i)) - return NULL; - - j = fl_isselected_browser_line (g->ob_generic, i); - - return PyInt_FromLong (j); -} - -static PyObject * -get_browser (genericobject *g) -{ - return call_forms_Ri (fl_get_browser, g-> ob_generic); -} - -static PyObject * -set_browser_fontsize (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_browser_fontsize, g-> ob_generic, args); -} - -static PyObject * -set_browser_fontstyle (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_browser_fontstyle, g-> ob_generic, args); -} - -static PyObject * -set_browser_specialkey (genericobject *g, PyObject *args) -{ - return call_forms_INc(fl_set_browser_specialkey, g-> ob_generic, args); -} - -static PyMethodDef browser_methods[] = { - {"set_browser_topline", (PyCFunction)set_browser_topline, - METH_OLDARGS}, - {"clear_browser", (PyCFunction)clear_browser, - METH_NOARGS}, - {"add_browser_line", (PyCFunction)add_browser_line, - METH_OLDARGS}, - {"addto_browser", (PyCFunction)addto_browser, - METH_OLDARGS}, - {"insert_browser_line", (PyCFunction)insert_browser_line, - METH_OLDARGS}, - {"delete_browser_line", (PyCFunction)delete_browser_line, - METH_OLDARGS}, - {"replace_browser_line", (PyCFunction)replace_browser_line, - METH_OLDARGS}, - {"get_browser_line", (PyCFunction)get_browser_line, - METH_OLDARGS}, - {"load_browser", (PyCFunction)load_browser, - METH_OLDARGS}, - {"get_browser_maxline", (PyCFunction)get_browser_maxline, - METH_NOARGS,} - {"select_browser_line", (PyCFunction)select_browser_line, - METH_OLDARGS}, - {"deselect_browser_line", (PyCFunction)deselect_browser_line, - METH_OLDARGS}, - {"deselect_browser", (PyCFunction)deselect_browser, - METH_NOARGS,} - {"isselected_browser_line", (PyCFunction)isselected_browser_line, - METH_OLDARGS}, - {"get_browser", (PyCFunction)get_browser, - METH_NOARGS,} - {"set_browser_fontsize", (PyCFunction)set_browser_fontsize, - METH_OLDARGS}, - {"set_browser_fontstyle", (PyCFunction)set_browser_fontstyle, - METH_OLDARGS}, - {"set_browser_specialkey", (PyCFunction)set_browser_specialkey, - METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class: button */ - -static PyObject * -set_button(genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_button, g-> ob_generic, args); -} - -static PyObject * -get_button(genericobject *g) -{ - return call_forms_Ri (fl_get_button, g-> ob_generic); -} - -static PyObject * -get_button_numb(genericobject *g) -{ - return call_forms_Ri (fl_get_button_numb, g-> ob_generic); -} - -static PyObject * -set_button_shortcut(genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_set_button_shortcut, g-> ob_generic, args); -} - -static PyMethodDef button_methods[] = { - {"set_button", (PyCFunction)set_button, METH_OLDARGS}, - {"get_button", (PyCFunction)get_button, METH_NOARGS}, - {"get_button_numb", (PyCFunction)get_button_numb, METH_NOARGS}, - {"set_button_shortcut", (PyCFunction)set_button_shortcut, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class: choice */ - -static PyObject * -set_choice(genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_choice, g-> ob_generic, args); -} - -static PyObject * -get_choice(genericobject *g) -{ - return call_forms_Ri (fl_get_choice, g-> ob_generic); -} - -static PyObject * -clear_choice (genericobject *g) -{ - return generic_call (g, fl_clear_choice); -} - -static PyObject * -addto_choice (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_addto_choice, g-> ob_generic, args); -} - -static PyObject * -replace_choice (genericobject *g, PyObject *args) -{ - return call_forms_INiINstr (fl_replace_choice, g-> ob_generic, args); -} - -static PyObject * -delete_choice (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_delete_choice, g-> ob_generic, args); -} - -static PyObject * -get_choice_text (genericobject *g) -{ - return call_forms_Rstr (fl_get_choice_text, g-> ob_generic); -} - -static PyObject * -set_choice_fontsize (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_choice_fontsize, g-> ob_generic, args); -} - -static PyObject * -set_choice_fontstyle (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_choice_fontstyle, g-> ob_generic, args); -} - -static PyMethodDef choice_methods[] = { - {"set_choice", (PyCFunction)set_choice, METH_OLDARGS}, - {"get_choice", (PyCFunction)get_choice, METH_NOARGS}, - {"clear_choice", (PyCFunction)clear_choice, METH_NOARGS}, - {"addto_choice", (PyCFunction)addto_choice, METH_OLDARGS}, - {"replace_choice", (PyCFunction)replace_choice, METH_OLDARGS}, - {"delete_choice", (PyCFunction)delete_choice, METH_OLDARGS}, - {"get_choice_text", (PyCFunction)get_choice_text, METH_NOARGS}, - {"set_choice_fontsize", (PyCFunction)set_choice_fontsize, METH_OLDARGS}, - {"set_choice_fontstyle",(PyCFunction)set_choice_fontstyle, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class : Clock */ - -static PyObject * -get_clock(genericobject *g) -{ - int i0, i1, i2; - - fl_get_clock (g->ob_generic, &i0, &i1, &i2); - - return Py_BuildValue("(iii)", i0, i1, i2); -} - -static PyMethodDef clock_methods[] = { - {"get_clock", (PyCFunction)get_clock, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* CLass : Counters */ - -static PyObject * -get_counter_value(genericobject *g) -{ - return call_forms_Rf (fl_get_counter_value, g-> ob_generic); -} - -static PyObject * -set_counter_value (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_counter_value, g-> ob_generic, args); -} - -static PyObject * -set_counter_precision (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_counter_precision, g-> ob_generic, args); -} - -static PyObject * -set_counter_bounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_counter_bounds, g-> ob_generic, args); -} - -static PyObject * -set_counter_step (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_counter_step, g-> ob_generic, args); -} - -static PyObject * -set_counter_return (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_counter_return, g-> ob_generic, args); -} - -static PyMethodDef counter_methods[] = { - {"set_counter_value", (PyCFunction)set_counter_value, - METH_OLDARGS}, - {"get_counter_value", (PyCFunction)get_counter_value, - METH_NOARGS}, - {"set_counter_bounds", (PyCFunction)set_counter_bounds, - METH_OLDARGS}, - {"set_counter_step", (PyCFunction)set_counter_step, - METH_OLDARGS}, - {"set_counter_precision", (PyCFunction)set_counter_precision, - METH_OLDARGS}, - {"set_counter_return", (PyCFunction)set_counter_return, - METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - - -/* Class: Dials */ - -static PyObject * -get_dial_value(genericobject *g) -{ - return call_forms_Rf (fl_get_dial_value, g-> ob_generic); -} - -static PyObject * -set_dial_value (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_dial_value, g-> ob_generic, args); -} - -static PyObject * -set_dial_bounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_dial_bounds, g-> ob_generic, args); -} - -static PyObject * -get_dial_bounds (genericobject *g) -{ - return call_forms_OUTfOUTf (fl_get_dial_bounds, g-> ob_generic); -} - -static PyObject * -set_dial_step (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_dial_step, g-> ob_generic, args); -} - -static PyMethodDef dial_methods[] = { - {"set_dial_value", (PyCFunction)set_dial_value, METH_OLDARGS}, - {"get_dial_value", (PyCFunction)get_dial_value, METH_NOARGS}, - {"set_dial_bounds", (PyCFunction)set_dial_bounds, METH_OLDARGS}, - {"get_dial_bounds", (PyCFunction)get_dial_bounds, METH_NOARGS}, - {"set_dial_step", (PyCFunction)set_dial_step, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class : Input */ - -static PyObject * -set_input (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_set_input, g-> ob_generic, args); -} - -static PyObject * -get_input (genericobject *g) -{ - return call_forms_Rstr (fl_get_input, g-> ob_generic); -} - -static PyObject * -set_input_color (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_input_color, g-> ob_generic, args); -} - -static PyObject * -set_input_return (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_input_return, g-> ob_generic, args); -} - -static PyMethodDef input_methods[] = { - {"set_input", (PyCFunction)set_input, METH_OLDARGS}, - {"get_input", (PyCFunction)get_input, METH_NOARGS}, - {"set_input_color", (PyCFunction)set_input_color, METH_OLDARGS}, - {"set_input_return", (PyCFunction)set_input_return, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - - -/* Class : Menu */ - -static PyObject * -set_menu (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_set_menu, g-> ob_generic, args); -} - -static PyObject * -get_menu (genericobject *g) -{ - /* XXX strictly speaking this is wrong since fl_get_menu - XXX returns long, not int */ - return call_forms_Ri (fl_get_menu, g-> ob_generic); -} - -static PyObject * -get_menu_text (genericobject *g) -{ - return call_forms_Rstr (fl_get_menu_text, g-> ob_generic); -} - -static PyObject * -addto_menu (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_addto_menu, g-> ob_generic, args); -} - -static PyMethodDef menu_methods[] = { - {"set_menu", (PyCFunction)set_menu, METH_OLDARGS}, - {"get_menu", (PyCFunction)get_menu, METH_NOARGS}, - {"get_menu_text", (PyCFunction)get_menu_text, METH_NOARGS}, - {"addto_menu", (PyCFunction)addto_menu, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - - -/* Class: Sliders */ - -static PyObject * -get_slider_value(genericobject *g) -{ - return call_forms_Rf (fl_get_slider_value, g-> ob_generic); -} - -static PyObject * -set_slider_value (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_slider_value, g-> ob_generic, args); -} - -static PyObject * -set_slider_bounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_slider_bounds, g-> ob_generic, args); -} - -static PyObject * -get_slider_bounds (genericobject *g) -{ - return call_forms_OUTfOUTf(fl_get_slider_bounds, g-> ob_generic); -} - -static PyObject * -set_slider_return (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_slider_return, g-> ob_generic, args); -} - -static PyObject * -set_slider_size (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_slider_size, g-> ob_generic, args); -} - -static PyObject * -set_slider_precision (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_slider_precision, g-> ob_generic, args); -} - -static PyObject * -set_slider_step (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_slider_step, g-> ob_generic, args); -} - - -static PyMethodDef slider_methods[] = { - {"set_slider_value", (PyCFunction)set_slider_value, METH_OLDARGS}, - {"get_slider_value", (PyCFunction)get_slider_value, METH_NOARGS}, - {"set_slider_bounds", (PyCFunction)set_slider_bounds, METH_OLDARGS}, - {"get_slider_bounds", (PyCFunction)get_slider_bounds, METH_NOARGS}, - {"set_slider_return", (PyCFunction)set_slider_return, METH_OLDARGS}, - {"set_slider_size", (PyCFunction)set_slider_size, METH_OLDARGS}, - {"set_slider_precision",(PyCFunction)set_slider_precision, METH_OLDARGS}, - {"set_slider_step", (PyCFunction)set_slider_step, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -set_positioner_xvalue (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_positioner_xvalue, g-> ob_generic, args); -} - -static PyObject * -set_positioner_xbounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_positioner_xbounds, - g-> ob_generic, args); -} - -static PyObject * -set_positioner_yvalue (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_positioner_yvalue, g-> ob_generic, args); -} - -static PyObject * -set_positioner_ybounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_positioner_ybounds, - g-> ob_generic, args); -} - -static PyObject * -get_positioner_xvalue (genericobject *g) -{ - return call_forms_Rf (fl_get_positioner_xvalue, g-> ob_generic); -} - -static PyObject * -get_positioner_xbounds (genericobject *g) -{ - return call_forms_OUTfOUTf (fl_get_positioner_xbounds, g-> ob_generic); -} - -static PyObject * -get_positioner_yvalue (genericobject *g) -{ - return call_forms_Rf (fl_get_positioner_yvalue, g-> ob_generic); -} - -static PyObject * -get_positioner_ybounds (genericobject *g) -{ - return call_forms_OUTfOUTf (fl_get_positioner_ybounds, g-> ob_generic); -} - -static PyMethodDef positioner_methods[] = { - {"set_positioner_xvalue", (PyCFunction)set_positioner_xvalue, - METH_OLDARGS}, - {"set_positioner_yvalue", (PyCFunction)set_positioner_yvalue, - METH_OLDARGS}, - {"set_positioner_xbounds", (PyCFunction)set_positioner_xbounds, - METH_OLDARGS}, - {"set_positioner_ybounds", (PyCFunction)set_positioner_ybounds, - METH_OLDARGS}, - {"get_positioner_xvalue", (PyCFunction)get_positioner_xvalue, - METH_NOARGS}, - {"get_positioner_yvalue", (PyCFunction)get_positioner_yvalue, - METH_NOARGS}, - {"get_positioner_xbounds", (PyCFunction)get_positioner_xbounds, - METH_NOARGS}, - {"get_positioner_ybounds", (PyCFunction)get_positioner_ybounds, - METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class timer */ - -static PyObject * -set_timer (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_timer, g-> ob_generic, args); -} - -static PyObject * -get_timer (genericobject *g) -{ - return call_forms_Rf (fl_get_timer, g-> ob_generic); -} - -static PyMethodDef timer_methods[] = { - {"set_timer", (PyCFunction)set_timer, METH_OLDARGS}, - {"get_timer", (PyCFunction)get_timer, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Form objects */ - -typedef struct { - PyObject_HEAD - FL_FORM *ob_form; -} formobject; - -static PyTypeObject Formtype; - -#define is_formobject(v) ((v)->ob_type == &Formtype) - -static PyObject * -form_show_form(formobject *f, PyObject *args) -{ - int place, border; - char *name; - if (!PyArg_Parse(args, "(iis)", &place, &border, &name)) - return NULL; - fl_show_form(f->ob_form, place, border, name); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -form_call(void (*func)(FL_FORM *), FL_FORM *f) -{ - (*func)(f); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -form_call_INiINi(void (*func)(FL_FORM *, int, int), FL_FORM *f, PyObject *args) -{ - int a, b; - - if (!PyArg_Parse(args, "(ii)", &a, &b)) return NULL; - - (*func)(f, a, b); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -form_call_INfINf(void (*func)(FL_FORM *, float, float), FL_FORM *f, PyObject *args) -{ - float a, b; - - if (!PyArg_Parse(args, "(ff)", &a, &b)) return NULL; - - (*func)(f, a, b); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -form_hide_form(formobject *f) -{ - return form_call(fl_hide_form, f-> ob_form); -} - -static PyObject * -form_redraw_form(formobject *f) -{ - return form_call(fl_redraw_form, f-> ob_form); -} - -static PyObject * -form_set_form_position(formobject *f, PyObject *args) -{ - return form_call_INiINi(fl_set_form_position, f-> ob_form, args); -} - -static PyObject * -form_set_form_size(formobject *f, PyObject *args) -{ - return form_call_INiINi(fl_set_form_size, f-> ob_form, args); -} - -static PyObject * -form_scale_form(formobject *f, PyObject *args) -{ - return form_call_INfINf(fl_scale_form, f-> ob_form, args); -} - -static PyObject * -generic_add_object(formobject *f, PyObject *args, FL_OBJECT *(*func)(int, float, float, float, float, char*), PyMethodDef *internal_methods) -{ - int type; - float x, y, w, h; - char *name; - FL_OBJECT *obj; - - if (!PyArg_Parse(args,"(iffffs)", &type,&x,&y,&w,&h,&name)) - return NULL; - - fl_addto_form (f-> ob_form); - - obj = (*func) (type, x, y, w, h, name); - - fl_end_form(); - - if (obj == NULL) { - PyErr_NoMemory(); - return NULL; - } - - return newgenericobject (obj, internal_methods); -} - -static PyObject * -form_add_button(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_button, button_methods); -} - -static PyObject * -form_add_lightbutton(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_lightbutton, button_methods); -} - -static PyObject * -form_add_roundbutton(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_roundbutton, button_methods); -} - -static PyObject * -form_add_menu (formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_menu, menu_methods); -} - -static PyObject * -form_add_slider(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_slider, slider_methods); -} - -static PyObject * -form_add_valslider(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_valslider, slider_methods); -} - -static PyObject * -form_add_dial(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_dial, dial_methods); -} - -static PyObject * -form_add_counter(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_counter, counter_methods); -} - -static PyObject * -form_add_clock(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_clock, clock_methods); -} - -static PyObject * -form_add_box(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_box, - (PyMethodDef *)NULL); -} - -static PyObject * -form_add_choice(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_choice, choice_methods); -} - -static PyObject * -form_add_browser(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_browser, browser_methods); -} - -static PyObject * -form_add_positioner(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_positioner, - positioner_methods); -} - -static PyObject * -form_add_input(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_input, input_methods); -} - -static PyObject * -form_add_text(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_text, - (PyMethodDef *)NULL); -} - -static PyObject * -form_add_timer(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_timer, timer_methods); -} - -static PyObject * -form_freeze_form(formobject *f) -{ - return form_call(fl_freeze_form, f-> ob_form); -} - -static PyObject * -form_unfreeze_form(formobject *f) -{ - return form_call(fl_unfreeze_form, f-> ob_form); -} - -static PyObject * -form_activate_form(formobject *f) -{ - return form_call(fl_activate_form, f-> ob_form); -} - -static PyObject * -form_deactivate_form(formobject *f) -{ - return form_call(fl_deactivate_form, f-> ob_form); -} - -static PyObject * -form_bgn_group(formobject *f, PyObject *args) -{ - FL_OBJECT *obj; - - fl_addto_form(f-> ob_form); - obj = fl_bgn_group(); - fl_end_form(); - - if (obj == NULL) { - PyErr_NoMemory(); - return NULL; - } - - return newgenericobject (obj, (PyMethodDef *) NULL); -} - -static PyObject * -form_end_group(formobject *f, PyObject *args) -{ - fl_addto_form(f-> ob_form); - fl_end_group(); - fl_end_form(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_find_first_or_last(FL_OBJECT *(*func)(FL_FORM *, int, float, float), formobject *f, PyObject *args) -{ - int type; - float mx, my; - FL_OBJECT *generic; - genericobject *g; - - if (!PyArg_Parse(args, "(iff)", &type, &mx, &my)) return NULL; - - generic = (*func) (f-> ob_form, type, mx, my); - - if (generic == NULL) - { - Py_INCREF(Py_None); - return Py_None; - } - - g = findgeneric(generic); - if (g == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "forms_find_{first|last} returns unknown object"); - return NULL; - } - Py_INCREF(g); - return (PyObject *) g; -} - -static PyObject * -form_find_first(formobject *f, PyObject *args) -{ - return forms_find_first_or_last(fl_find_first, f, args); -} - -static PyObject * -form_find_last(formobject *f, PyObject *args) -{ - return forms_find_first_or_last(fl_find_last, f, args); -} - -static PyObject * -form_set_object_focus(formobject *f, PyObject *args) -{ - genericobject *g; - if (args == NULL || !is_genericobject(args)) { - PyErr_BadArgument(); - return NULL; - } - g = (genericobject *)args; - fl_set_object_focus(f->ob_form, g->ob_generic); - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef form_methods[] = { -/* adm */ - {"show_form", (PyCFunction)form_show_form, METH_OLDARGS}, - {"hide_form", (PyCFunction)form_hide_form, METH_NOARGS}, - {"redraw_form", (PyCFunction)form_redraw_form, METH_NOARGS}, - {"set_form_position", (PyCFunction)form_set_form_position, METH_OLDARGS}, - {"set_form_size", (PyCFunction)form_set_form_size, METH_OLDARGS}, - {"scale_form", (PyCFunction)form_scale_form, METH_OLDARGS}, - {"freeze_form", (PyCFunction)form_freeze_form, METH_NOARGS}, - {"unfreeze_form", (PyCFunction)form_unfreeze_form, METH_NOARGS}, - {"activate_form", (PyCFunction)form_activate_form, METH_NOARGS}, - {"deactivate_form", (PyCFunction)form_deactivate_form, METH_NOARGS}, - {"bgn_group", (PyCFunction)form_bgn_group, METH_OLDARGS}, - {"end_group", (PyCFunction)form_end_group, METH_OLDARGS}, - {"find_first", (PyCFunction)form_find_first, METH_OLDARGS}, - {"find_last", (PyCFunction)form_find_last, METH_OLDARGS}, - {"set_object_focus", (PyCFunction)form_set_object_focus, METH_OLDARGS}, - -/* basic objects */ - {"add_button", (PyCFunction)form_add_button, METH_OLDARGS}, -/* {"add_bitmap", (method)form_add_bitmap, METH_OLDARGS}, */ - {"add_lightbutton", (PyCFunction)form_add_lightbutton, METH_OLDARGS}, - {"add_roundbutton", (PyCFunction)form_add_roundbutton, METH_OLDARGS}, - {"add_menu", (PyCFunction)form_add_menu, METH_OLDARGS}, - {"add_slider", (PyCFunction)form_add_slider, METH_OLDARGS}, - {"add_positioner", (PyCFunction)form_add_positioner, METH_OLDARGS}, - {"add_valslider", (PyCFunction)form_add_valslider, METH_OLDARGS}, - {"add_dial", (PyCFunction)form_add_dial, METH_OLDARGS}, - {"add_counter", (PyCFunction)form_add_counter, METH_OLDARGS}, - {"add_box", (PyCFunction)form_add_box, METH_OLDARGS}, - {"add_clock", (PyCFunction)form_add_clock, METH_OLDARGS}, - {"add_choice", (PyCFunction)form_add_choice, METH_OLDARGS}, - {"add_browser", (PyCFunction)form_add_browser, METH_OLDARGS}, - {"add_input", (PyCFunction)form_add_input, METH_OLDARGS}, - {"add_timer", (PyCFunction)form_add_timer, METH_OLDARGS}, - {"add_text", (PyCFunction)form_add_text, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -form_dealloc(formobject *f) -{ - releaseobjects(f->ob_form); - if (f->ob_form->visible) - fl_hide_form(f->ob_form); - fl_free_form(f->ob_form); - PyObject_Del(f); -} - -#define OFF(x) offsetof(FL_FORM, x) - -static struct memberlist form_memberlist[] = { - {"window", T_LONG, OFF(window), RO}, - {"w", T_FLOAT, OFF(w)}, - {"h", T_FLOAT, OFF(h)}, - {"x", T_FLOAT, OFF(x), RO}, - {"y", T_FLOAT, OFF(y), RO}, - {"deactivated", T_INT, OFF(deactivated)}, - {"visible", T_INT, OFF(visible), RO}, - {"frozen", T_INT, OFF(frozen), RO}, - {"doublebuf", T_INT, OFF(doublebuf)}, - {NULL} /* Sentinel */ -}; - -#undef OFF - -static PyObject * -form_getattr(formobject *f, char *name) -{ - PyObject *meth; - - meth = Py_FindMethod(form_methods, (PyObject *)f, name); - if (meth != NULL) - return meth; - PyErr_Clear(); - return PyMember_Get((char *)f->ob_form, form_memberlist, name); -} - -static int -form_setattr(formobject *f, char *name, PyObject *v) -{ - if (v == NULL) { - PyErr_SetString(PyExc_TypeError, - "can't delete form attributes"); - return -1; - } - - return PyMember_Set((char *)f->ob_form, form_memberlist, name, v); -} - -static PyObject * -form_repr(formobject *f) -{ - char buf[100]; - PyOS_snprintf(buf, sizeof(buf), "", - f, f->ob_form->window); - return PyString_FromString(buf); -} - -static PyTypeObject Formtype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "fl.FORMS_form", /*tp_name*/ - sizeof(formobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)form_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)form_getattr, /*tp_getattr*/ - (setattrfunc)form_setattr, /*tp_setattr*/ - 0, /*tp_compare*/ - (reprfunc)form_repr, /*tp_repr*/ -}; - -static PyObject * -newformobject(FL_FORM *form) -{ - formobject *f; - f = PyObject_New(formobject, &Formtype); - if (f == NULL) - return NULL; - f->ob_form = form; - return (PyObject *)f; -} - - -/* The "fl" module */ - -static PyObject * -forms_make_form(PyObject *dummy, PyObject *args) -{ - int type; - float w, h; - FL_FORM *form; - if (!PyArg_Parse(args, "(iff)", &type, &w, &h)) - return NULL; - form = fl_bgn_form(type, w, h); - if (form == NULL) { - /* XXX Actually, cannot happen! */ - PyErr_NoMemory(); - return NULL; - } - fl_end_form(); - return newformobject(form); -} - -static PyObject * -forms_activate_all_forms(PyObject *f, PyObject *args) -{ - fl_activate_all_forms(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_deactivate_all_forms(PyObject *f, PyObject *args) -{ - fl_deactivate_all_forms(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject *my_event_callback = NULL; - -static PyObject * -forms_set_event_call_back(PyObject *dummy, PyObject *args) -{ - if (args == Py_None) - args = NULL; - my_event_callback = args; - Py_XINCREF(args); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_do_or_check_forms(PyObject *dummy, FL_OBJECT *(*func)(void)) -{ - FL_OBJECT *generic; - genericobject *g; - PyObject *arg, *res; - - for (;;) { - Py_BEGIN_ALLOW_THREADS - generic = (*func)(); - Py_END_ALLOW_THREADS - if (generic == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - if (generic == FL_EVENT) { - int dev; - short val; - if (my_event_callback == NULL) - return PyInt_FromLong(-1L); - dev = fl_qread(&val); - arg = Py_BuildValue("(ih)", dev, val); - if (arg == NULL) - return NULL; - res = PyEval_CallObject(my_event_callback, arg); - Py_XDECREF(res); - Py_DECREF(arg); - if (res == NULL) - return NULL; /* Callback raised exception */ - continue; - } - g = findgeneric(generic); - if (g == NULL) { - /* Object not known to us (some dialogs cause this) */ - continue; /* Ignore it */ - } - if (g->ob_callback == NULL) { - Py_INCREF(g); - return ((PyObject *) g); - } - arg = PyTuple_Pack(2, (PyObject *)g, g->ob_callback_arg); - if (arg == NULL) - return NULL; - res = PyEval_CallObject(g->ob_callback, arg); - Py_XDECREF(res); - Py_DECREF(arg); - if (res == NULL) - return NULL; /* Callback raised exception */ - } -} - -static PyObject * -forms_do_forms(PyObject *dummy) -{ - return forms_do_or_check_forms(dummy, fl_do_forms); -} - -static PyObject * -forms_check_forms(PyObject *dummy) -{ - return forms_do_or_check_forms(dummy, fl_check_forms); -} - -static PyObject * -forms_do_only_forms(PyObject *dummy) -{ - return forms_do_or_check_forms(dummy, fl_do_only_forms); -} - -static PyObject * -forms_check_only_forms(PyObject *dummy) -{ - return forms_do_or_check_forms(dummy, fl_check_only_forms); -} - -#ifdef UNUSED -static PyObject * -fl_call(void (*func)(void)) -{ - (*func)(); - Py_INCREF(Py_None); - return Py_None; -} -#endif - -static PyObject * -forms_set_graphics_mode(PyObject *dummy, PyObject *args) -{ - int rgbmode, doublebuf; - - if (!PyArg_Parse(args, "(ii)", &rgbmode, &doublebuf)) - return NULL; - fl_set_graphics_mode(rgbmode,doublebuf); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_get_rgbmode(PyObject *dummy, PyObject *args) -{ - extern int fl_rgbmode; - - if (args != NULL) { - PyErr_BadArgument(); - return NULL; - } - return PyInt_FromLong((long)fl_rgbmode); -} - -static PyObject * -forms_show_errors(PyObject *dummy, PyObject *args) -{ - int show; - if (!PyArg_Parse(args, "i", &show)) - return NULL; - fl_show_errors(show); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_set_font_name(PyObject *dummy, PyObject *args) -{ - int numb; - char *name; - if (!PyArg_Parse(args, "(is)", &numb, &name)) - return NULL; - fl_set_font_name(numb, name); - Py_INCREF(Py_None); - return Py_None; -} - - -static PyObject * -forms_qdevice(PyObject *self, PyObject *args) -{ - short arg1; - if (!PyArg_Parse(args, "h", &arg1)) - return NULL; - fl_qdevice(arg1); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_unqdevice(PyObject *self, PyObject *args) -{ - short arg1; - if (!PyArg_Parse(args, "h", &arg1)) - return NULL; - fl_unqdevice(arg1); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_isqueued(PyObject *self, PyObject *args) -{ - long retval; - short arg1; - if (!PyArg_Parse(args, "h", &arg1)) - return NULL; - retval = fl_isqueued(arg1); - - return PyInt_FromLong(retval); -} - -static PyObject * -forms_qtest(PyObject *self, PyObject *args) -{ - long retval; - retval = fl_qtest(); - return PyInt_FromLong(retval); -} - - -static PyObject * -forms_qread(PyObject *self, PyObject *args) -{ - int dev; - short val; - Py_BEGIN_ALLOW_THREADS - dev = fl_qread(&val); - Py_END_ALLOW_THREADS - return Py_BuildValue("(ih)", dev, val); -} - -static PyObject * -forms_qreset(PyObject *self) -{ - fl_qreset(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_qenter(PyObject *self, PyObject *args) -{ - short arg1, arg2; - if (!PyArg_Parse(args, "(hh)", &arg1, &arg2)) - return NULL; - fl_qenter(arg1, arg2); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_color(PyObject *self, PyObject *args) -{ - int arg; - - if (!PyArg_Parse(args, "i", &arg)) return NULL; - - fl_color((short) arg); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_mapcolor(PyObject *self, PyObject *args) -{ - int arg0, arg1, arg2, arg3; - - if (!PyArg_Parse(args, "(iiii)", &arg0, &arg1, &arg2, &arg3)) - return NULL; - - fl_mapcolor(arg0, (short) arg1, (short) arg2, (short) arg3); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_getmcolor(PyObject *self, PyObject *args) -{ - int arg; - short r, g, b; - - if (!PyArg_Parse(args, "i", &arg)) return NULL; - - fl_getmcolor(arg, &r, &g, &b); - - return Py_BuildValue("(hhh)", r, g, b); -} - -static PyObject * -forms_get_mouse(PyObject *self) -{ - float x, y; - - fl_get_mouse(&x, &y); - - return Py_BuildValue("(ff)", x, y); -} - -static PyObject * -forms_tie(PyObject *self, PyObject *args) -{ - short arg1, arg2, arg3; - if (!PyArg_Parse(args, "(hhh)", &arg1, &arg2, &arg3)) - return NULL; - fl_tie(arg1, arg2, arg3); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_show_message(PyObject *f, PyObject *args) -{ - char *a, *b, *c; - - if (!PyArg_Parse(args, "(sss)", &a, &b, &c)) return NULL; - - Py_BEGIN_ALLOW_THREADS - fl_show_message(a, b, c); - Py_END_ALLOW_THREADS - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_show_choice(PyObject *f, PyObject *args) -{ - char *m1, *m2, *m3, *b1, *b2, *b3; - int nb; - char *format; - long rv; - - if (args == NULL || !PyTuple_Check(args)) { - PyErr_BadArgument(); - return NULL; - } - nb = PyTuple_Size(args) - 3; - if (nb <= 0) { - PyErr_SetString(PyExc_TypeError, - "need at least one button label"); - return NULL; - } - if (PyInt_Check(PyTuple_GetItem(args, 3))) { - PyErr_SetString(PyExc_TypeError, - "'number-of-buttons' argument not needed"); - return NULL; - } - switch (nb) { - case 1: format = "(ssss)"; break; - case 2: format = "(sssss)"; break; - case 3: format = "(ssssss)"; break; - default: - PyErr_SetString(PyExc_TypeError, "too many button labels"); - return NULL; - } - - if (!PyArg_Parse(args, format, &m1, &m2, &m3, &b1, &b2, &b3)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - rv = fl_show_choice(m1, m2, m3, nb, b1, b2, b3); - Py_END_ALLOW_THREADS - return PyInt_FromLong(rv); -} - -static PyObject * -forms_show_question(PyObject *f, PyObject *args) -{ - int ret; - char *a, *b, *c; - - if (!PyArg_Parse(args, "(sss)", &a, &b, &c)) return NULL; - - Py_BEGIN_ALLOW_THREADS - ret = fl_show_question(a, b, c); - Py_END_ALLOW_THREADS - - return PyInt_FromLong((long) ret); -} - -static PyObject * -forms_show_input(PyObject *f, PyObject *args) -{ - char *str; - char *a, *b; - - if (!PyArg_Parse(args, "(ss)", &a, &b)) return NULL; - - Py_BEGIN_ALLOW_THREADS - str = fl_show_input(a, b); - Py_END_ALLOW_THREADS - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(str); -} - -static PyObject * -forms_file_selector(PyObject *f, PyObject *args) -{ - char *str; - char *a, *b, *c, *d; - - if (!PyArg_Parse(args, "(ssss)", &a, &b, &c, &d)) return NULL; - - Py_BEGIN_ALLOW_THREADS - str = fl_show_file_selector(a, b, c, d); - Py_END_ALLOW_THREADS - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(str); -} - - -static PyObject * -forms_file_selector_func(PyObject *args, char *(*func)(void)) -{ - char *str; - - str = (*func) (); - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(str); -} - -static PyObject * -forms_get_directory(PyObject *f, PyObject *args) -{ - return forms_file_selector_func(args, fl_get_directory); -} - -static PyObject * -forms_get_pattern(PyObject *f, PyObject *args) -{ - return forms_file_selector_func(args, fl_get_pattern); -} - -static PyObject * -forms_get_filename(PyObject *f, PyObject *args) -{ - return forms_file_selector_func(args, fl_get_filename); -} - -static PyMethodDef forms_methods[] = { -/* adm */ - {"make_form", forms_make_form, METH_OLDARGS}, - {"activate_all_forms", forms_activate_all_forms, METH_OLDARGS}, - {"deactivate_all_forms",forms_deactivate_all_forms, METH_OLDARGS}, -/* gl support wrappers */ - {"qdevice", forms_qdevice, METH_OLDARGS}, - {"unqdevice", forms_unqdevice, METH_OLDARGS}, - {"isqueued", forms_isqueued, METH_OLDARGS}, - {"qtest", forms_qtest, METH_OLDARGS}, - {"qread", forms_qread, METH_OLDARGS}, -/* {"blkqread", forms_blkqread, METH_OLDARGS}, */ - {"qreset", forms_qreset, METH_NOARGS}, - {"qenter", forms_qenter, METH_OLDARGS}, - {"get_mouse", forms_get_mouse, METH_NOARGS}, - {"tie", forms_tie, METH_OLDARGS}, -/* {"new_events", forms_new_events, METH_OLDARGS}, */ - {"color", forms_color, METH_OLDARGS}, - {"mapcolor", forms_mapcolor, METH_OLDARGS}, - {"getmcolor", forms_getmcolor, METH_OLDARGS}, -/* interaction */ - {"do_forms", forms_do_forms, METH_NOARGS}, - {"do_only_forms", forms_do_only_forms, METH_NOARGS}, - {"check_forms", forms_check_forms, METH_NOARGS}, - {"check_only_forms", forms_check_only_forms, METH_NOARGS}, - {"set_event_call_back", forms_set_event_call_back, METH_OLDARGS}, -/* goodies */ - {"show_message", forms_show_message, METH_OLDARGS}, - {"show_question", forms_show_question, METH_OLDARGS}, - {"show_choice", forms_show_choice, METH_OLDARGS}, - {"show_input", forms_show_input, METH_OLDARGS}, - {"show_file_selector", forms_file_selector, METH_OLDARGS}, - {"file_selector", forms_file_selector, METH_OLDARGS}, /* BW compat */ - {"get_directory", forms_get_directory, METH_OLDARGS}, - {"get_pattern", forms_get_pattern, METH_OLDARGS}, - {"get_filename", forms_get_filename, METH_OLDARGS}, - {"set_graphics_mode", forms_set_graphics_mode, METH_OLDARGS}, - {"get_rgbmode", forms_get_rgbmode, METH_OLDARGS}, - {"show_errors", forms_show_errors, METH_OLDARGS}, - {"set_font_name", forms_set_font_name, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -PyMODINIT_FUNC -initfl(void) -{ - Py_InitModule("fl", forms_methods); - if (m == NULL) - return; - foreground(); - fl_init(); -} - - - diff --git a/Modules/fmmodule.c b/Modules/fmmodule.c deleted file mode 100644 index 1f7edb6..0000000 --- a/Modules/fmmodule.c +++ /dev/null @@ -1,264 +0,0 @@ - -/* Font Manager module */ - -#include "Python.h" - -#include -#include -#include - - -/* Font Handle object implementation */ - -typedef struct { - PyObject_HEAD - fmfonthandle fh_fh; -} fhobject; - -static PyTypeObject Fhtype; - -#define is_fhobject(v) ((v)->ob_type == &Fhtype) - -static PyObject * -newfhobject(fmfonthandle fh) -{ - fhobject *fhp; - if (fh == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "error creating new font handle"); - return NULL; - } - fhp = PyObject_New(fhobject, &Fhtype); - if (fhp == NULL) - return NULL; - fhp->fh_fh = fh; - return (PyObject *)fhp; -} - -/* Font Handle methods */ - -static PyObject * -fh_scalefont(fhobject *self, PyObject *args) -{ - double size; - if (!PyArg_ParseTuple(args, "d", &size)) - return NULL; - return newfhobject(fmscalefont(self->fh_fh, size)); -} - -/* XXX fmmakefont */ - -static PyObject * -fh_setfont(fhobject *self) -{ - fmsetfont(self->fh_fh); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -fh_getfontname(fhobject *self) -{ - char fontname[256]; - int len; - len = fmgetfontname(self->fh_fh, sizeof fontname, fontname); - if (len < 0) { - PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname"); - return NULL; - } - return PyString_FromStringAndSize(fontname, len); -} - -static PyObject * -fh_getcomment(fhobject *self) -{ - char comment[256]; - int len; - len = fmgetcomment(self->fh_fh, sizeof comment, comment); - if (len < 0) { - PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment"); - return NULL; - } - return PyString_FromStringAndSize(comment, len); -} - -static PyObject * -fh_getfontinfo(fhobject *self) -{ - fmfontinfo info; - if (fmgetfontinfo(self->fh_fh, &info) < 0) { - PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontinfo"); - return NULL; - } - return Py_BuildValue("(llllllll)", - info.printermatched, - info.fixed_width, - info.xorig, - info.yorig, - info.xsize, - info.ysize, - info.height, - info.nglyphs); -} - -#if 0 -static PyObject * -fh_getwholemetrics(fhobject *self, PyObject *args) -{ -} -#endif - -static PyObject * -fh_getstrwidth(fhobject *self, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s", &str)) - return NULL; - return PyInt_FromLong(fmgetstrwidth(self->fh_fh, str)); -} - -static PyMethodDef fh_methods[] = { - {"scalefont", (PyCFunction)fh_scalefont, METH_VARARGS}, - {"setfont", (PyCFunction)fh_setfont, METH_NOARGS}, - {"getfontname", (PyCFunction)fh_getfontname, METH_NOARGS}, - {"getcomment", (PyCFunction)fh_getcomment, METH_NOARGS}, - {"getfontinfo", (PyCFunction)fh_getfontinfo, METH_NOARGS}, -#if 0 - {"getwholemetrics", (PyCFunction)fh_getwholemetrics, METH_VARARGS}, -#endif - {"getstrwidth", (PyCFunction)fh_getstrwidth, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -fh_getattr(fhobject *fhp, char *name) -{ - return Py_FindMethod(fh_methods, (PyObject *)fhp, name); -} - -static void -fh_dealloc(fhobject *fhp) -{ - fmfreefont(fhp->fh_fh); - PyObject_Del(fhp); -} - -static PyTypeObject Fhtype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "fm.font handle", /*tp_name*/ - sizeof(fhobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)fh_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)fh_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - - -/* Font Manager functions */ - -static PyObject * -fm_init(PyObject *self) -{ - fminit(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -fm_findfont(PyObject *self, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s", &str)) - return NULL; - return newfhobject(fmfindfont(str)); -} - -static PyObject * -fm_prstr(PyObject *self, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s", &str)) - return NULL; - fmprstr(str); - Py_INCREF(Py_None); - return Py_None; -} - -/* XXX This uses a global variable as temporary! Not re-entrant! */ - -static PyObject *fontlist; - -static void -clientproc(char *fontname) -{ - int err; - PyObject *v; - if (fontlist == NULL) - return; - v = PyString_FromString(fontname); - if (v == NULL) - err = -1; - else { - err = PyList_Append(fontlist, v); - Py_DECREF(v); - } - if (err != 0) { - Py_DECREF(fontlist); - fontlist = NULL; - } -} - -static PyObject * -fm_enumerate(PyObject *self) -{ - PyObject *res; - fontlist = PyList_New(0); - if (fontlist == NULL) - return NULL; - fmenumerate(clientproc); - res = fontlist; - fontlist = NULL; - return res; -} - -static PyObject * -fm_setpath(PyObject *self, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s", &str)) - return NULL; - fmsetpath(str); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -fm_fontpath(PyObject *self) -{ - return PyString_FromString(fmfontpath()); -} - -static PyMethodDef fm_methods[] = { - {"init", fm_init, METH_NOARGS}, - {"findfont", fm_findfont, METH_VARARGS}, - {"enumerate", fm_enumerate, METH_NOARGS}, - {"prstr", fm_prstr, METH_VARARGS}, - {"setpath", fm_setpath, METH_VARARGS}, - {"fontpath", fm_fontpath, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - - -void -initfm(void) -{ - Py_InitModule("fm", fm_methods); - if (m == NULL) - return; - fminit(); -} diff --git a/Modules/glmodule.c b/Modules/glmodule.c deleted file mode 100644 index 6590704..0000000 --- a/Modules/glmodule.c +++ /dev/null @@ -1,7628 +0,0 @@ - -/* -Input used to generate the Python module "glmodule.c". -The stub generator is a Python script called "cgen.py". - -Each definition must be contained on one line: - - - - can be: void, short, long (XXX maybe others?) - - can be: char, string, short, float, long, or double - string indicates a null terminated string; - if is char and begins with a *, the * is stripped - and is changed into string - - has the form or [] - where can be - s: arg is sent - r: arg is received (arg is a pointer) - and can be (N and I are numbers): - N - argI - retval - N*argI - N*I - N*retval - In the case where the subscript consists of two parts - separated by *, the first part is the width of the matrix, and - the second part is the length of the matrix. This order is - opposite from the order used in C to declare a two-dimensional - matrix. -*/ - -/* - * An attempt has been made to make this module switch threads on qread - * calls. It is far from safe, though. - */ - -#include -#include - -#ifdef __sgi -extern int devport(); -extern int textwritemask(); -extern int pagewritemask(); -extern int gewrite(); -extern int gettp(); -#endif - -#include "Python.h" -#include "cgensupport.h" - -/* -Some stubs are too complicated for the stub generator. -We can include manually written versions of them here. -A line starting with '%' gives the name of the function so the stub -generator can include it in the table of functions. -*/ - - -static PyObject * -gl_qread(PyObject *self, PyObject *args) -{ - long retval; - short arg1 ; - Py_BEGIN_ALLOW_THREADS - retval = qread( & arg1 ); - Py_END_ALLOW_THREADS - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewlongobject(retval)); - PyTuple_SetItem(v, 1, mknewshortobject(arg1)); - return v; - } -} - - -/* -varray -- an array of v.. calls. -The argument is an array (maybe list or tuple) of points. -Each point must be a tuple or list of coordinates (x, y, z). -The points may be 2- or 3-dimensional but must all have the -same dimension. Float and int values may be mixed however. -The points are always converted to 3D double precision points -by assuming z=0.0 if necessary (as indicated in the man page), -and for each point v3d() is called. -*/ - - -static PyObject * -gl_varray(PyObject *self, PyObject *args) -{ - PyObject *v, *w=NULL; - int i, n, width; - double vec[3]; - PyObject * (*getitem)(PyObject *, int); - - if (!PyArg_GetObject(args, 1, 0, &v)) - return NULL; - - if (PyList_Check(v)) { - n = PyList_Size(v); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(v)) { - n = PyTuple_Size(v); - getitem = PyTuple_GetItem; - } - else { - PyErr_BadArgument(); - return NULL; - } - - if (n == 0) { - Py_INCREF(Py_None); - return Py_None; - } - if (n > 0) - w = (*getitem)(v, 0); - - width = 0; - if (w == NULL) { - } - else if (PyList_Check(w)) { - width = PyList_Size(w); - } - else if (PyTuple_Check(w)) { - width = PyTuple_Size(w); - } - - switch (width) { - case 2: - vec[2] = 0.0; - /* Fall through */ - case 3: - break; - default: - PyErr_BadArgument(); - return NULL; - } - - for (i = 0; i < n; i++) { - w = (*getitem)(v, i); - if (!PyArg_GetDoubleArray(w, 1, 0, width, vec)) - return NULL; - v3d(vec); - } - - Py_INCREF(Py_None); - return Py_None; -} - -/* -vnarray, nvarray -- an array of n3f and v3f calls. -The argument is an array (list or tuple) of pairs of points and normals. -Each pair is a tuple (NOT a list) of a point and a normal for that point. -Each point or normal must be a tuple (NOT a list) of coordinates (x, y, z). -Three coordinates must be given. Float and int values may be mixed. -For each pair, n3f() is called for the normal, and then v3f() is called -for the vector. - -vnarray and nvarray differ only in the order of the vector and normal in -the pair: vnarray expects (v, n) while nvarray expects (n, v). -*/ - -static PyObject *gen_nvarray(); /* Forward */ - - -static PyObject * -gl_nvarray(PyObject *self, PyObject *args) -{ - return gen_nvarray(args, 0); -} - - -static PyObject * -gl_vnarray(PyObject *self, PyObject *args) -{ - return gen_nvarray(args, 1); -} - -/* Generic, internal version of {nv,nv}array: inorm indicates the - argument order, 0: normal first, 1: vector first. */ - -static PyObject * -gen_nvarray(PyObject *args, int inorm) -{ - PyObject *v, *w, *wnorm, *wvec; - int i, n; - float norm[3], vec[3]; - PyObject * (*getitem)(PyObject *, int); - - if (!PyArg_GetObject(args, 1, 0, &v)) - return NULL; - - if (PyList_Check(v)) { - n = PyList_Size(v); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(v)) { - n = PyTuple_Size(v); - getitem = PyTuple_GetItem; - } - else { - PyErr_BadArgument(); - return NULL; - } - - for (i = 0; i < n; i++) { - w = (*getitem)(v, i); - if (!PyTuple_Check(w) || PyTuple_Size(w) != 2) { - PyErr_BadArgument(); - return NULL; - } - wnorm = PyTuple_GetItem(w, inorm); - wvec = PyTuple_GetItem(w, 1 - inorm); - if (!PyArg_GetFloatArray(wnorm, 1, 0, 3, norm) || - !PyArg_GetFloatArray(wvec, 1, 0, 3, vec)) - return NULL; - n3f(norm); - v3f(vec); - } - - Py_INCREF(Py_None); - return Py_None; -} - -/* nurbssurface(s_knots[], t_knots[], ctl[][], s_order, t_order, type). - The dimensions of ctl[] are computed as follows: - [len(s_knots) - s_order], [len(t_knots) - t_order] -*/ - - -static PyObject * -gl_nurbssurface(PyObject *self, PyObject *args) -{ - long arg1 ; - double * arg2 ; - long arg3 ; - double * arg4 ; - double *arg5 ; - long arg6 ; - long arg7 ; - long arg8 ; - long ncoords; - long s_byte_stride, t_byte_stride; - long s_nctl, t_nctl; - long s, t; - PyObject *v, *w, *pt; - double *pnext; - if (!PyArg_GetLongArraySize(args, 6, 0, &arg1)) - return NULL; - if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) { - return PyErr_NoMemory(); - } - if (!PyArg_GetDoubleArray(args, 6, 0, arg1 , arg2)) - return NULL; - if (!PyArg_GetLongArraySize(args, 6, 1, &arg3)) - return NULL; - if ((arg4 = PyMem_NEW(double, arg3 )) == NULL) { - return PyErr_NoMemory(); - } - if (!PyArg_GetDoubleArray(args, 6, 1, arg3 , arg4)) - return NULL; - if (!PyArg_GetLong(args, 6, 3, &arg6)) - return NULL; - if (!PyArg_GetLong(args, 6, 4, &arg7)) - return NULL; - if (!PyArg_GetLong(args, 6, 5, &arg8)) - return NULL; - if (arg8 == N_XYZ) - ncoords = 3; - else if (arg8 == N_XYZW) - ncoords = 4; - else { - PyErr_BadArgument(); - return NULL; - } - s_nctl = arg1 - arg6; - t_nctl = arg3 - arg7; - if (!PyArg_GetObject(args, 6, 2, &v)) - return NULL; - if (!PyList_Check(v) || PyList_Size(v) != s_nctl) { - PyErr_BadArgument(); - return NULL; - } - if ((arg5 = PyMem_NEW(double, s_nctl*t_nctl*ncoords )) == NULL) { - return PyErr_NoMemory(); - } - pnext = arg5; - for (s = 0; s < s_nctl; s++) { - w = PyList_GetItem(v, s); - if (w == NULL || !PyList_Check(w) || - PyList_Size(w) != t_nctl) { - PyErr_BadArgument(); - return NULL; - } - for (t = 0; t < t_nctl; t++) { - pt = PyList_GetItem(w, t); - if (!PyArg_GetDoubleArray(pt, 1, 0, ncoords, pnext)) - return NULL; - pnext += ncoords; - } - } - s_byte_stride = sizeof(double) * ncoords; - t_byte_stride = s_byte_stride * s_nctl; - nurbssurface( arg1 , arg2 , arg3 , arg4 , - s_byte_stride , t_byte_stride , arg5 , arg6 , arg7 , arg8 ); - PyMem_DEL(arg2); - PyMem_DEL(arg4); - PyMem_DEL(arg5); - Py_INCREF(Py_None); - return Py_None; -} - -/* nurbscurve(knots, ctlpoints, order, type). - The length of ctlpoints is len(knots)-order. */ - - -static PyObject * -gl_nurbscurve(PyObject *self, PyObject *args) -{ - long arg1 ; - double * arg2 ; - long arg3 ; - double * arg4 ; - long arg5 ; - long arg6 ; - int ncoords, npoints; - int i; - PyObject *v; - double *pnext; - if (!PyArg_GetLongArraySize(args, 4, 0, &arg1)) - return NULL; - if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) { - return PyErr_NoMemory(); - } - if (!PyArg_GetDoubleArray(args, 4, 0, arg1 , arg2)) - return NULL; - if (!PyArg_GetLong(args, 4, 2, &arg5)) - return NULL; - if (!PyArg_GetLong(args, 4, 3, &arg6)) - return NULL; - if (arg6 == N_ST) - ncoords = 2; - else if (arg6 == N_STW) - ncoords = 3; - else { - PyErr_BadArgument(); - return NULL; - } - npoints = arg1 - arg5; - if (!PyArg_GetObject(args, 4, 1, &v)) - return NULL; - if (!PyList_Check(v) || PyList_Size(v) != npoints) { - PyErr_BadArgument(); - return NULL; - } - if ((arg4 = PyMem_NEW(double, npoints*ncoords )) == NULL) { - return PyErr_NoMemory(); - } - pnext = arg4; - for (i = 0; i < npoints; i++) { - if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext)) - return NULL; - pnext += ncoords; - } - arg3 = (sizeof(double)) * ncoords; - nurbscurve( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - PyMem_DEL(arg2); - PyMem_DEL(arg4); - Py_INCREF(Py_None); - return Py_None; -} - -/* pwlcurve(points, type). - Points is a list of points. Type must be N_ST. */ - - -static PyObject * -gl_pwlcurve(PyObject *self, PyObject *args) -{ - PyObject *v; - long type; - double *data, *pnext; - long npoints, ncoords; - int i; - if (!PyArg_GetObject(args, 2, 0, &v)) - return NULL; - if (!PyArg_GetLong(args, 2, 1, &type)) - return NULL; - if (!PyList_Check(v)) { - PyErr_BadArgument(); - return NULL; - } - npoints = PyList_Size(v); - if (type == N_ST) - ncoords = 2; - else { - PyErr_BadArgument(); - return NULL; - } - if ((data = PyMem_NEW(double, npoints*ncoords)) == NULL) { - return PyErr_NoMemory(); - } - pnext = data; - for (i = 0; i < npoints; i++) { - if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext)) - return NULL; - pnext += ncoords; - } - pwlcurve(npoints, data, sizeof(double)*ncoords, type); - PyMem_DEL(data); - Py_INCREF(Py_None); - return Py_None; -} - - -/* Picking and Selecting */ - -static short *pickbuffer = NULL; -static long pickbuffersize; - -static PyObject * -pick_select(PyObject *args, void (*func)()) -{ - if (!PyArg_GetLong(args, 1, 0, &pickbuffersize)) - return NULL; - if (pickbuffer != NULL) { - PyErr_SetString(PyExc_RuntimeError, - "pick/gselect: already picking/selecting"); - return NULL; - } - if ((pickbuffer = PyMem_NEW(short, pickbuffersize)) == NULL) { - return PyErr_NoMemory(); - } - (*func)(pickbuffer, pickbuffersize); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -endpick_select(long (*func)()) -{ - PyObject *v, *w; - int i, nhits, n; - if (pickbuffer == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "endpick/endselect: not in pick/select mode"); - return NULL; - } - nhits = (*func)(pickbuffer); - if (nhits < 0) { - nhits = -nhits; /* How to report buffer overflow otherwise? */ - } - /* Scan the buffer to see how many integers */ - n = 0; - for (; nhits > 0; nhits--) { - n += 1 + pickbuffer[n]; - } - v = PyList_New(n); - if (v == NULL) - return NULL; - /* XXX Could do it nicer and interpret the data structure here, - returning a list of lists. But this can be done in Python... */ - for (i = 0; i < n; i++) { - w = PyInt_FromLong((long)pickbuffer[i]); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(v, i, w); - } - PyMem_DEL(pickbuffer); - pickbuffer = NULL; - return v; -} - -extern void pick(), gselect(); -extern long endpick(), endselect(); - -static PyObject *gl_pick(PyObject *self, PyObject *args) -{ - return pick_select(args, pick); -} - -static PyObject *gl_endpick(PyObject *self) -{ - return endpick_select(endpick); -} - -static PyObject *gl_gselect(PyObject *self, PyObject *args) -{ - return pick_select(args, gselect); -} - -static PyObject *gl_endselect(PyObject *self) -{ - return endpick_select(endselect); -} - - -/* XXX The generator botches this one. Here's a quick hack to fix it. */ - -/* XXX The generator botches this one. Here's a quick hack to fix it. */ - - -static PyObject * -gl_getmatrix(PyObject *self, PyObject *args) -{ - Matrix arg1; - PyObject *v, *w; - int i, j; - getmatrix( arg1 ); - v = PyList_New(16); - if (v == NULL) { - return PyErr_NoMemory(); - } - for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) { - w = mknewfloatobject(arg1[i][j]); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(v, i*4+j, w); - } - return v; -} - -/* Here's an alternate version that returns a 4x4 matrix instead of - a vector. Unfortunately it is incompatible with loadmatrix and - multmatrix... */ - - -static PyObject * -gl_altgetmatrix(PyObject *self, PyObject *args) -{ - Matrix arg1; - PyObject *v, *w; - int i, j; - getmatrix( arg1 ); - v = PyList_New(4); - if (v == NULL) { - return NULL; - } - for (i = 0; i < 4; i++) { - w = PyList_New(4); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(v, i, w); - } - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - w = mknewfloatobject(arg1[i][j]); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(PyList_GetItem(v, i), j, w); - } - } - return v; -} - - -static PyObject * -gl_lrectwrite(PyObject *self, PyObject *args) -{ - short x1 ; - short y1 ; - short x2 ; - short y2 ; - string parray ; - PyObject *s; -#if 0 - int pixcount; -#endif - if (!PyArg_GetShort(args, 5, 0, &x1)) - return NULL; - if (!PyArg_GetShort(args, 5, 1, &y1)) - return NULL; - if (!PyArg_GetShort(args, 5, 2, &x2)) - return NULL; - if (!PyArg_GetShort(args, 5, 3, &y2)) - return NULL; - if (!PyArg_GetString(args, 5, 4, &parray)) - return NULL; - if (!PyArg_GetObject(args, 5, 4, &s)) - return NULL; -#if 0 -/* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */ - pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) { - PyErr_SetString(PyExc_RuntimeError, - "string arg to lrectwrite has wrong size"); - return NULL; - } -#endif - lrectwrite( x1 , y1 , x2 , y2 , (unsigned long *) parray ); - Py_INCREF(Py_None); - return Py_None; -} - - -static PyObject * -gl_lrectread(PyObject *self, PyObject *args) -{ - short x1 ; - short y1 ; - short x2 ; - short y2 ; - PyObject *parray; - int pixcount; - if (!PyArg_GetShort(args, 4, 0, &x1)) - return NULL; - if (!PyArg_GetShort(args, 4, 1, &y1)) - return NULL; - if (!PyArg_GetShort(args, 4, 2, &x2)) - return NULL; - if (!PyArg_GetShort(args, 4, 3, &y2)) - return NULL; - pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); - if (parray == NULL) - return NULL; /* No memory */ - lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray)); - return parray; -} - - -static PyObject * -gl_readdisplay(PyObject *self, PyObject *args) -{ - short x1, y1, x2, y2; - unsigned long *parray, hints; - long size, size_ret; - PyObject *rv; - - if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) ) - return 0; - size = (long)(x2+1-x1) * (long)(y2+1-y1); - rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long)); - if ( rv == NULL ) - return NULL; - parray = (unsigned long *)PyString_AsString(rv); - size_ret = readdisplay(x1, y1, x2, y2, parray, hints); - if ( size_ret != size ) { - printf("gl_readdisplay: got %ld pixels, expected %ld\n", - size_ret, size); - PyErr_SetString(PyExc_RuntimeError, "readdisplay returned unexpected length"); - return NULL; - } - return rv; -} - -/* Desperately needed, here are tools to compress and decompress - the data manipulated by lrectread/lrectwrite. - - gl.packrect(width, height, packfactor, bigdata) --> smalldata - makes 'bigdata' 4*(packfactor**2) times smaller by: - - turning it into B/W (a factor 4) - - replacing squares of size pacfactor by one - representative - - gl.unpackrect(width, height, packfactor, smalldata) --> bigdata - is the inverse; the numeric arguments must be *the same*. - - Both work best if width and height are multiples of packfactor - (in fact unpackrect will leave garbage bytes). -*/ - - -static PyObject * -gl_packrect(PyObject *self, PyObject *args) -{ - long width, height, packfactor; - char *s; - PyObject *unpacked, *packed; - int pixcount, packedcount, x, y, r, g, b; - unsigned long pixel; - unsigned char *p; - unsigned long *parray; - if (!PyArg_GetLong(args, 4, 0, &width)) - return NULL; - if (!PyArg_GetLong(args, 4, 1, &height)) - return NULL; - if (!PyArg_GetLong(args, 4, 2, &packfactor)) - return NULL; - if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */ - return NULL; - if (!PyArg_GetObject(args, 4, 3, &unpacked)) - return NULL; - if (width <= 0 || height <= 0 || packfactor <= 0) { - PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0"); - return NULL; - } - pixcount = width*height; - packedcount = ((width+packfactor-1)/packfactor) * - ((height+packfactor-1)/packfactor); - if (PyString_Size(unpacked) != pixcount*sizeof(long)) { - PyErr_SetString(PyExc_RuntimeError, - "string arg to packrect has wrong size"); - return NULL; - } - packed = PyString_FromStringAndSize((char *)NULL, packedcount); - if (packed == NULL) - return NULL; - parray = (unsigned long *) PyString_AsString(unpacked); - p = (unsigned char *) PyString_AsString(packed); - for (y = 0; y < height; y += packfactor, parray += packfactor*width) { - for (x = 0; x < width; x += packfactor) { - pixel = parray[x]; - r = pixel & 0xff; - g = (pixel >> 8) & 0xff; - b = (pixel >> 16) & 0xff; - *p++ = (30*r+59*g+11*b) / 100; - } - } - return packed; -} - - -static unsigned long unpacktab[256]; -static int unpacktab_inited = 0; - -static PyObject * -gl_unpackrect(PyObject *self, PyObject *args) -{ - long width, height, packfactor; - char *s; - PyObject *unpacked, *packed; - int pixcount, packedcount; - register unsigned char *p; - register unsigned long *parray; - if (!unpacktab_inited) { - register int white; - for (white = 256; --white >= 0; ) - unpacktab[white] = white * 0x010101L; - unpacktab_inited++; - } - if (!PyArg_GetLong(args, 4, 0, &width)) - return NULL; - if (!PyArg_GetLong(args, 4, 1, &height)) - return NULL; - if (!PyArg_GetLong(args, 4, 2, &packfactor)) - return NULL; - if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */ - return NULL; - if (!PyArg_GetObject(args, 4, 3, &packed)) - return NULL; - if (width <= 0 || height <= 0 || packfactor <= 0) { - PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0"); - return NULL; - } - pixcount = width*height; - packedcount = ((width+packfactor-1)/packfactor) * - ((height+packfactor-1)/packfactor); - if (PyString_Size(packed) != packedcount) { - PyErr_SetString(PyExc_RuntimeError, - "string arg to unpackrect has wrong size"); - return NULL; - } - unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); - if (unpacked == NULL) - return NULL; - parray = (unsigned long *) PyString_AsString(unpacked); - p = (unsigned char *) PyString_AsString(packed); - if (packfactor == 1 && width*height > 0) { - /* Just expand bytes to longs */ - register int x = width * height; - do { - *parray++ = unpacktab[*p++]; - } while (--x >= 0); - } - else { - register int y; - for (y = 0; y < height-packfactor+1; - y += packfactor, parray += packfactor*width) { - register int x; - for (x = 0; x < width-packfactor+1; x += packfactor) { - register unsigned long pixel = unpacktab[*p++]; - register int i; - for (i = packfactor*width; (i-=width) >= 0;) { - register int j; - for (j = packfactor; --j >= 0; ) - parray[i+x+j] = pixel; - } - } - } - } - return unpacked; -} - -static PyObject * -gl_gversion(PyObject *self, PyObject *args) -{ - char buf[20]; - gversion(buf); - return PyString_FromString(buf); -} - - -/* void clear - Manual because of clash with termcap */ -static PyObject * -gl_clear(PyObject *self, PyObject *args) -{ - __GLclear( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* End of manually written stubs */ - - -/* long getshade */ - -static PyObject * -gl_getshade(PyObject *self, PyObject *args) -{ - long retval; - retval = getshade( ); - return mknewlongobject(retval); -} - -/* void devport short s long s */ - -static PyObject * -gl_devport(PyObject *self, PyObject *args) -{ - short arg1 ; - long arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - devport( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdr2i long s long s */ - -static PyObject * -gl_rdr2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - rdr2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectfs short s short s short s short s */ - -static PyObject * -gl_rectfs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - rectfs( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rects short s short s short s short s */ - -static PyObject * -gl_rects(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - rects( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmv2i long s long s */ - -static PyObject * -gl_rmv2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - rmv2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void noport */ - -static PyObject * -gl_noport(PyObject *self, PyObject *args) -{ - noport( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void popviewport */ - -static PyObject * -gl_popviewport(PyObject *self, PyObject *args) -{ - popviewport( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void clearhitcode */ - -static PyObject * -gl_clearhitcode(PyObject *self, PyObject *args) -{ - clearhitcode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void closeobj */ - -static PyObject * -gl_closeobj(PyObject *self, PyObject *args) -{ - closeobj( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cursoff */ - -static PyObject * -gl_cursoff(PyObject *self, PyObject *args) -{ - cursoff( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curson */ - -static PyObject * -gl_curson(PyObject *self, PyObject *args) -{ - curson( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void doublebuffer */ - -static PyObject * -gl_doublebuffer(PyObject *self, PyObject *args) -{ - doublebuffer( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void finish */ - -static PyObject * -gl_finish(PyObject *self, PyObject *args) -{ - finish( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gconfig */ - -static PyObject * -gl_gconfig(PyObject *self, PyObject *args) -{ - gconfig( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void ginit */ - -static PyObject * -gl_ginit(PyObject *self, PyObject *args) -{ - ginit( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void greset */ - -static PyObject * -gl_greset(PyObject *self, PyObject *args) -{ - greset( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void multimap */ - -static PyObject * -gl_multimap(PyObject *self, PyObject *args) -{ - multimap( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void onemap */ - -static PyObject * -gl_onemap(PyObject *self, PyObject *args) -{ - onemap( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void popattributes */ - -static PyObject * -gl_popattributes(PyObject *self, PyObject *args) -{ - popattributes( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void popmatrix */ - -static PyObject * -gl_popmatrix(PyObject *self, PyObject *args) -{ - popmatrix( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pushattributes */ - -static PyObject * -gl_pushattributes(PyObject *self, PyObject *args) -{ - pushattributes( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pushmatrix */ - -static PyObject * -gl_pushmatrix(PyObject *self, PyObject *args) -{ - pushmatrix( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pushviewport */ - -static PyObject * -gl_pushviewport(PyObject *self, PyObject *args) -{ - pushviewport( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void qreset */ - -static PyObject * -gl_qreset(PyObject *self, PyObject *args) -{ - qreset( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBmode */ - -static PyObject * -gl_RGBmode(PyObject *self, PyObject *args) -{ - RGBmode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void singlebuffer */ - -static PyObject * -gl_singlebuffer(PyObject *self, PyObject *args) -{ - singlebuffer( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void swapbuffers */ - -static PyObject * -gl_swapbuffers(PyObject *self, PyObject *args) -{ - swapbuffers( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gsync */ - -static PyObject * -gl_gsync(PyObject *self, PyObject *args) -{ - gsync( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gflush */ - -static PyObject * -gl_gflush(PyObject *self, PyObject *args) -{ - gflush( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void tpon */ - -static PyObject * -gl_tpon(PyObject *self, PyObject *args) -{ - tpon( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void tpoff */ - -static PyObject * -gl_tpoff(PyObject *self, PyObject *args) -{ - tpoff( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void clkon */ - -static PyObject * -gl_clkon(PyObject *self, PyObject *args) -{ - clkon( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void clkoff */ - -static PyObject * -gl_clkoff(PyObject *self, PyObject *args) -{ - clkoff( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void ringbell */ - -static PyObject * -gl_ringbell(PyObject *self, PyObject *args) -{ - ringbell( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gbegin */ - -static PyObject * -gl_gbegin(PyObject *self, PyObject *args) -{ - gbegin( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void textinit */ - -static PyObject * -gl_textinit(PyObject *self, PyObject *args) -{ - textinit( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void initnames */ - -static PyObject * -gl_initnames(PyObject *self, PyObject *args) -{ - initnames( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pclos */ - -static PyObject * -gl_pclos(PyObject *self, PyObject *args) -{ - pclos( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void popname */ - -static PyObject * -gl_popname(PyObject *self, PyObject *args) -{ - popname( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void spclos */ - -static PyObject * -gl_spclos(PyObject *self, PyObject *args) -{ - spclos( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zclear */ - -static PyObject * -gl_zclear(PyObject *self, PyObject *args) -{ - zclear( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void screenspace */ - -static PyObject * -gl_screenspace(PyObject *self, PyObject *args) -{ - screenspace( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void reshapeviewport */ - -static PyObject * -gl_reshapeviewport(PyObject *self, PyObject *args) -{ - reshapeviewport( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winpush */ - -static PyObject * -gl_winpush(PyObject *self, PyObject *args) -{ - winpush( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winpop */ - -static PyObject * -gl_winpop(PyObject *self, PyObject *args) -{ - winpop( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void foreground */ - -static PyObject * -gl_foreground(PyObject *self, PyObject *args) -{ - foreground( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endfullscrn */ - -static PyObject * -gl_endfullscrn(PyObject *self, PyObject *args) -{ - endfullscrn( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endpupmode */ - -static PyObject * -gl_endpupmode(PyObject *self, PyObject *args) -{ - endpupmode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void fullscrn */ - -static PyObject * -gl_fullscrn(PyObject *self, PyObject *args) -{ - fullscrn( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pupmode */ - -static PyObject * -gl_pupmode(PyObject *self, PyObject *args) -{ - pupmode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winconstraints */ - -static PyObject * -gl_winconstraints(PyObject *self, PyObject *args) -{ - winconstraints( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pagecolor short s */ - -static PyObject * -gl_pagecolor(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - pagecolor( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void textcolor short s */ - -static PyObject * -gl_textcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - textcolor( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void color short s */ - -static PyObject * -gl_color(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - color( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curveit short s */ - -static PyObject * -gl_curveit(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - curveit( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void font short s */ - -static PyObject * -gl_font(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - font( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void linewidth short s */ - -static PyObject * -gl_linewidth(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - linewidth( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setlinestyle short s */ - -static PyObject * -gl_setlinestyle(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setlinestyle( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setmap short s */ - -static PyObject * -gl_setmap(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setmap( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void swapinterval short s */ - -static PyObject * -gl_swapinterval(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - swapinterval( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void writemask short s */ - -static PyObject * -gl_writemask(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - writemask( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void textwritemask short s */ - -static PyObject * -gl_textwritemask(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - textwritemask( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void qdevice short s */ - -static PyObject * -gl_qdevice(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - qdevice( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void unqdevice short s */ - -static PyObject * -gl_unqdevice(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - unqdevice( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curvebasis short s */ - -static PyObject * -gl_curvebasis(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - curvebasis( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curveprecision short s */ - -static PyObject * -gl_curveprecision(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - curveprecision( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void loadname short s */ - -static PyObject * -gl_loadname(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - loadname( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void passthrough short s */ - -static PyObject * -gl_passthrough(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - passthrough( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pushname short s */ - -static PyObject * -gl_pushname(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - pushname( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setmonitor short s */ - -static PyObject * -gl_setmonitor(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setmonitor( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setshade short s */ - -static PyObject * -gl_setshade(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setshade( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setpattern short s */ - -static PyObject * -gl_setpattern(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setpattern( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pagewritemask short s */ - -static PyObject * -gl_pagewritemask(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - pagewritemask( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void callobj long s */ - -static PyObject * -gl_callobj(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - callobj( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void delobj long s */ - -static PyObject * -gl_delobj(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - delobj( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void editobj long s */ - -static PyObject * -gl_editobj(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - editobj( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void makeobj long s */ - -static PyObject * -gl_makeobj(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - makeobj( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void maketag long s */ - -static PyObject * -gl_maketag(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - maketag( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void chunksize long s */ - -static PyObject * -gl_chunksize(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - chunksize( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void compactify long s */ - -static PyObject * -gl_compactify(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - compactify( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void deltag long s */ - -static PyObject * -gl_deltag(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - deltag( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lsrepeat long s */ - -static PyObject * -gl_lsrepeat(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lsrepeat( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void objinsert long s */ - -static PyObject * -gl_objinsert(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - objinsert( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void objreplace long s */ - -static PyObject * -gl_objreplace(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - objreplace( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winclose long s */ - -static PyObject * -gl_winclose(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - winclose( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void blanktime long s */ - -static PyObject * -gl_blanktime(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - blanktime( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void freepup long s */ - -static PyObject * -gl_freepup(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - freepup( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void backbuffer long s */ - -static PyObject * -gl_backbuffer(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - backbuffer( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void frontbuffer long s */ - -static PyObject * -gl_frontbuffer(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - frontbuffer( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lsbackup long s */ - -static PyObject * -gl_lsbackup(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lsbackup( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void resetls long s */ - -static PyObject * -gl_resetls(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - resetls( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lampon long s */ - -static PyObject * -gl_lampon(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lampon( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lampoff long s */ - -static PyObject * -gl_lampoff(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lampoff( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setbell long s */ - -static PyObject * -gl_setbell(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - setbell( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void blankscreen long s */ - -static PyObject * -gl_blankscreen(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - blankscreen( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void depthcue long s */ - -static PyObject * -gl_depthcue(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - depthcue( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zbuffer long s */ - -static PyObject * -gl_zbuffer(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zbuffer( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void backface long s */ - -static PyObject * -gl_backface(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - backface( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmov2i long s long s */ - -static PyObject * -gl_cmov2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - cmov2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draw2i long s long s */ - -static PyObject * -gl_draw2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - draw2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void move2i long s long s */ - -static PyObject * -gl_move2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - move2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnt2i long s long s */ - -static PyObject * -gl_pnt2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - pnt2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void patchbasis long s long s */ - -static PyObject * -gl_patchbasis(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - patchbasis( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void patchprecision long s long s */ - -static PyObject * -gl_patchprecision(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - patchprecision( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdr2i long s long s */ - -static PyObject * -gl_pdr2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - pdr2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmv2i long s long s */ - -static PyObject * -gl_pmv2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - pmv2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdr2i long s long s */ - -static PyObject * -gl_rpdr2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - rpdr2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmv2i long s long s */ - -static PyObject * -gl_rpmv2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - rpmv2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt2i long s long s */ - -static PyObject * -gl_xfpt2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - xfpt2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void objdelete long s long s */ - -static PyObject * -gl_objdelete(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - objdelete( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void patchcurves long s long s */ - -static PyObject * -gl_patchcurves(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - patchcurves( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void minsize long s long s */ - -static PyObject * -gl_minsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - minsize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void maxsize long s long s */ - -static PyObject * -gl_maxsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - maxsize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void keepaspect long s long s */ - -static PyObject * -gl_keepaspect(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - keepaspect( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void prefsize long s long s */ - -static PyObject * -gl_prefsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - prefsize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void stepunit long s long s */ - -static PyObject * -gl_stepunit(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - stepunit( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void fudge long s long s */ - -static PyObject * -gl_fudge(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - fudge( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winmove long s long s */ - -static PyObject * -gl_winmove(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - winmove( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void attachcursor short s short s */ - -static PyObject * -gl_attachcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - attachcursor( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void deflinestyle short s short s */ - -static PyObject * -gl_deflinestyle(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - deflinestyle( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void noise short s short s */ - -static PyObject * -gl_noise(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - noise( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void picksize short s short s */ - -static PyObject * -gl_picksize(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - picksize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void qenter short s short s */ - -static PyObject * -gl_qenter(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - qenter( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setdepth short s short s */ - -static PyObject * -gl_setdepth(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - setdepth( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmov2s short s short s */ - -static PyObject * -gl_cmov2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - cmov2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draw2s short s short s */ - -static PyObject * -gl_draw2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - draw2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void move2s short s short s */ - -static PyObject * -gl_move2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - move2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdr2s short s short s */ - -static PyObject * -gl_pdr2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - pdr2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmv2s short s short s */ - -static PyObject * -gl_pmv2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - pmv2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnt2s short s short s */ - -static PyObject * -gl_pnt2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - pnt2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdr2s short s short s */ - -static PyObject * -gl_rdr2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - rdr2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmv2s short s short s */ - -static PyObject * -gl_rmv2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - rmv2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdr2s short s short s */ - -static PyObject * -gl_rpdr2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - rpdr2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmv2s short s short s */ - -static PyObject * -gl_rpmv2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - rpmv2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt2s short s short s */ - -static PyObject * -gl_xfpt2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - xfpt2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmov2 float s float s */ - -static PyObject * -gl_cmov2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - cmov2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draw2 float s float s */ - -static PyObject * -gl_draw2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - draw2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void move2 float s float s */ - -static PyObject * -gl_move2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - move2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnt2 float s float s */ - -static PyObject * -gl_pnt2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - pnt2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdr2 float s float s */ - -static PyObject * -gl_pdr2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - pdr2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmv2 float s float s */ - -static PyObject * -gl_pmv2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - pmv2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdr2 float s float s */ - -static PyObject * -gl_rdr2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rdr2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmv2 float s float s */ - -static PyObject * -gl_rmv2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rmv2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdr2 float s float s */ - -static PyObject * -gl_rpdr2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rpdr2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmv2 float s float s */ - -static PyObject * -gl_rpmv2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rpmv2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt2 float s float s */ - -static PyObject * -gl_xfpt2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - xfpt2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void loadmatrix float s[4*4] */ - -static PyObject * -gl_loadmatrix(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 * 4 , (float *) arg1)) - return NULL; - loadmatrix( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void multmatrix float s[4*4] */ - -static PyObject * -gl_multmatrix(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 * 4 , (float *) arg1)) - return NULL; - multmatrix( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void crv float s[3*4] */ - -static PyObject * -gl_crv(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 * 4 , (float *) arg1)) - return NULL; - crv( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rcrv float s[4*4] */ - -static PyObject * -gl_rcrv(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 * 4 , (float *) arg1)) - return NULL; - rcrv( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void addtopup long s char *s long s */ - -static PyObject * -gl_addtopup(PyObject *self, PyObject *args) -{ - long arg1 ; - string arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getistringarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - addtopup( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void charstr char *s */ - -static PyObject * -gl_charstr(PyObject *self, PyObject *args) -{ - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - charstr( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void getport char *s */ - -static PyObject * -gl_getport(PyObject *self, PyObject *args) -{ - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - getport( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long strwidth char *s */ - -static PyObject * -gl_strwidth(PyObject *self, PyObject *args) -{ - long retval; - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - retval = strwidth( arg1 ); - return mknewlongobject(retval); -} - -/* long winopen char *s */ - -static PyObject * -gl_winopen(PyObject *self, PyObject *args) -{ - long retval; - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - retval = winopen( arg1 ); - return mknewlongobject(retval); -} - -/* void wintitle char *s */ - -static PyObject * -gl_wintitle(PyObject *self, PyObject *args) -{ - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - wintitle( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polf long s float s[3*arg1] */ - -static PyObject * -gl_polf(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (float(*)[3]) PyMem_NEW(float , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 3 * arg1 , (float *) arg2)) - return NULL; - polf( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polf2 long s float s[2*arg1] */ - -static PyObject * -gl_polf2(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (float(*)[2]) PyMem_NEW(float , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 2 * arg1 , (float *) arg2)) - return NULL; - polf2( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void poly long s float s[3*arg1] */ - -static PyObject * -gl_poly(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (float(*)[3]) PyMem_NEW(float , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 3 * arg1 , (float *) arg2)) - return NULL; - poly( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void poly2 long s float s[2*arg1] */ - -static PyObject * -gl_poly2(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (float(*)[2]) PyMem_NEW(float , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 2 * arg1 , (float *) arg2)) - return NULL; - poly2( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void crvn long s float s[3*arg1] */ - -static PyObject * -gl_crvn(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (float(*)[3]) PyMem_NEW(float , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 3 * arg1 , (float *) arg2)) - return NULL; - crvn( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rcrvn long s float s[4*arg1] */ - -static PyObject * -gl_rcrvn(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 4 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 4; - if ((arg2 = (float(*)[4]) PyMem_NEW(float , 4 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 4 * arg1 , (float *) arg2)) - return NULL; - rcrvn( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polf2i long s long s[2*arg1] */ - -static PyObject * -gl_polf2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (long(*)[2]) PyMem_NEW(long , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 1, 0, 2 * arg1 , (long *) arg2)) - return NULL; - polf2i( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polfi long s long s[3*arg1] */ - -static PyObject * -gl_polfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (long(*)[3]) PyMem_NEW(long , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 1, 0, 3 * arg1 , (long *) arg2)) - return NULL; - polfi( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void poly2i long s long s[2*arg1] */ - -static PyObject * -gl_poly2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (long(*)[2]) PyMem_NEW(long , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 1, 0, 2 * arg1 , (long *) arg2)) - return NULL; - poly2i( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polyi long s long s[3*arg1] */ - -static PyObject * -gl_polyi(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (long(*)[3]) PyMem_NEW(long , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 1, 0, 3 * arg1 , (long *) arg2)) - return NULL; - polyi( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polf2s long s short s[2*arg1] */ - -static PyObject * -gl_polf2s(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (short(*)[2]) PyMem_NEW(short , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, 2 * arg1 , (short *) arg2)) - return NULL; - polf2s( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polfs long s short s[3*arg1] */ - -static PyObject * -gl_polfs(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (short(*)[3]) PyMem_NEW(short , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, 3 * arg1 , (short *) arg2)) - return NULL; - polfs( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polys long s short s[3*arg1] */ - -static PyObject * -gl_polys(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (short(*)[3]) PyMem_NEW(short , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, 3 * arg1 , (short *) arg2)) - return NULL; - polys( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void poly2s long s short s[2*arg1] */ - -static PyObject * -gl_poly2s(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (short(*)[2]) PyMem_NEW(short , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, 2 * arg1 , (short *) arg2)) - return NULL; - poly2s( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void defcursor short s u_short s[128] */ - -static PyObject * -gl_defcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - unsigned short arg2 [ 128 ] ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarray(args, 2, 1, 128 , (short *) arg2)) - return NULL; - defcursor( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void writepixels short s u_short s[arg1] */ - -static PyObject * -gl_writepixels(PyObject *self, PyObject *args) -{ - short arg1 ; - unsigned short * arg2 ; - if (!getishortarraysize(args, 1, 0, &arg1)) - return NULL; - if ((arg2 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, arg1 , (short *) arg2)) - return NULL; - writepixels( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void defbasis long s float s[4*4] */ - -static PyObject * -gl_defbasis(PyObject *self, PyObject *args) -{ - long arg1 ; - float arg2 [ 4 ] [ 4 ] ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarray(args, 2, 1, 4 * 4 , (float *) arg2)) - return NULL; - defbasis( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gewrite short s short s[arg1] */ - -static PyObject * -gl_gewrite(PyObject *self, PyObject *args) -{ - short arg1 ; - short * arg2 ; - if (!getishortarraysize(args, 1, 0, &arg1)) - return NULL; - if ((arg2 = PyMem_NEW(short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, arg1 , arg2)) - return NULL; - gewrite( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rotate short s char s */ - -static PyObject * -gl_rotate(PyObject *self, PyObject *args) -{ - short arg1 ; - char arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getichararg(args, 2, 1, &arg2)) - return NULL; - rotate( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rot float s char s */ - -static PyObject * -gl_rot(PyObject *self, PyObject *args) -{ - float arg1 ; - char arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getichararg(args, 2, 1, &arg2)) - return NULL; - rot( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circfi long s long s long s */ - -static PyObject * -gl_circfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - circfi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circi long s long s long s */ - -static PyObject * -gl_circi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - circi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmovi long s long s long s */ - -static PyObject * -gl_cmovi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - cmovi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void drawi long s long s long s */ - -static PyObject * -gl_drawi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - drawi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void movei long s long s long s */ - -static PyObject * -gl_movei(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - movei( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnti long s long s long s */ - -static PyObject * -gl_pnti(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - pnti( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void newtag long s long s long s */ - -static PyObject * -gl_newtag(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - newtag( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdri long s long s long s */ - -static PyObject * -gl_pdri(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - pdri( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmvi long s long s long s */ - -static PyObject * -gl_pmvi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - pmvi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdri long s long s long s */ - -static PyObject * -gl_rdri(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - rdri( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmvi long s long s long s */ - -static PyObject * -gl_rmvi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - rmvi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdri long s long s long s */ - -static PyObject * -gl_rpdri(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - rpdri( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmvi long s long s long s */ - -static PyObject * -gl_rpmvi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - rpmvi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpti long s long s long s */ - -static PyObject * -gl_xfpti(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - xfpti( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circ float s float s float s */ - -static PyObject * -gl_circ(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - circ( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circf float s float s float s */ - -static PyObject * -gl_circf(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - circf( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmov float s float s float s */ - -static PyObject * -gl_cmov(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - cmov( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draw float s float s float s */ - -static PyObject * -gl_draw(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - draw( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void move float s float s float s */ - -static PyObject * -gl_move(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - move( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnt float s float s float s */ - -static PyObject * -gl_pnt(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - pnt( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void scale float s float s float s */ - -static PyObject * -gl_scale(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - scale( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void translate float s float s float s */ - -static PyObject * -gl_translate(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - translate( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdr float s float s float s */ - -static PyObject * -gl_pdr(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - pdr( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmv float s float s float s */ - -static PyObject * -gl_pmv(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - pmv( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdr float s float s float s */ - -static PyObject * -gl_rdr(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - rdr( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmv float s float s float s */ - -static PyObject * -gl_rmv(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - rmv( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdr float s float s float s */ - -static PyObject * -gl_rpdr(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - rpdr( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmv float s float s float s */ - -static PyObject * -gl_rpmv(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - rpmv( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt float s float s float s */ - -static PyObject * -gl_xfpt(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - xfpt( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBcolor short s short s short s */ - -static PyObject * -gl_RGBcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - RGBcolor( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBwritemask short s short s short s */ - -static PyObject * -gl_RGBwritemask(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - RGBwritemask( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setcursor short s short s short s */ - -static PyObject * -gl_setcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - setcursor( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void tie short s short s short s */ - -static PyObject * -gl_tie(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - tie( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circfs short s short s short s */ - -static PyObject * -gl_circfs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - circfs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circs short s short s short s */ - -static PyObject * -gl_circs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - circs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmovs short s short s short s */ - -static PyObject * -gl_cmovs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - cmovs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draws short s short s short s */ - -static PyObject * -gl_draws(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - draws( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void moves short s short s short s */ - -static PyObject * -gl_moves(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - moves( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdrs short s short s short s */ - -static PyObject * -gl_pdrs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - pdrs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmvs short s short s short s */ - -static PyObject * -gl_pmvs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - pmvs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnts short s short s short s */ - -static PyObject * -gl_pnts(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - pnts( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdrs short s short s short s */ - -static PyObject * -gl_rdrs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - rdrs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmvs short s short s short s */ - -static PyObject * -gl_rmvs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - rmvs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdrs short s short s short s */ - -static PyObject * -gl_rpdrs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - rpdrs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmvs short s short s short s */ - -static PyObject * -gl_rpmvs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - rpmvs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpts short s short s short s */ - -static PyObject * -gl_xfpts(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - xfpts( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curorigin short s short s short s */ - -static PyObject * -gl_curorigin(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - curorigin( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cyclemap short s short s short s */ - -static PyObject * -gl_cyclemap(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - cyclemap( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void patch float s[4*4] float s[4*4] float s[4*4] */ - -static PyObject * -gl_patch(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - float arg2 [ 4 ] [ 4 ] ; - float arg3 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 3, 0, 4 * 4 , (float *) arg1)) - return NULL; - if (!getifloatarray(args, 3, 1, 4 * 4 , (float *) arg2)) - return NULL; - if (!getifloatarray(args, 3, 2, 4 * 4 , (float *) arg3)) - return NULL; - patch( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splf long s float s[3*arg1] u_short s[arg1] */ - -static PyObject * -gl_splf(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 3 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (float(*)[3]) PyMem_NEW(float , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 2, 0, 3 * arg1 , (float *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splf( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splf2 long s float s[2*arg1] u_short s[arg1] */ - -static PyObject * -gl_splf2(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 2 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (float(*)[2]) PyMem_NEW(float , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 2, 0, 2 * arg1 , (float *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splf2( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splfi long s long s[3*arg1] u_short s[arg1] */ - -static PyObject * -gl_splfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 3 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (long(*)[3]) PyMem_NEW(long , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 2, 0, 3 * arg1 , (long *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splfi( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splf2i long s long s[2*arg1] u_short s[arg1] */ - -static PyObject * -gl_splf2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 2 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (long(*)[2]) PyMem_NEW(long , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 2, 0, 2 * arg1 , (long *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splf2i( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splfs long s short s[3*arg1] u_short s[arg1] */ - -static PyObject * -gl_splfs(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 3 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (short(*)[3]) PyMem_NEW(short , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 0, 3 * arg1 , (short *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splfs( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splf2s long s short s[2*arg1] u_short s[arg1] */ - -static PyObject * -gl_splf2s(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 2 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (short(*)[2]) PyMem_NEW(short , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 0, 2 * arg1 , (short *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splf2s( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpatch float s[4*4] float s[4*4] float s[4*4] float s[4*4] */ - -static PyObject * -gl_rpatch(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - float arg2 [ 4 ] [ 4 ] ; - float arg3 [ 4 ] [ 4 ] ; - float arg4 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 4, 0, 4 * 4 , (float *) arg1)) - return NULL; - if (!getifloatarray(args, 4, 1, 4 * 4 , (float *) arg2)) - return NULL; - if (!getifloatarray(args, 4, 2, 4 * 4 , (float *) arg3)) - return NULL; - if (!getifloatarray(args, 4, 3, 4 * 4 , (float *) arg4)) - return NULL; - rpatch( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void ortho2 float s float s float s float s */ - -static PyObject * -gl_ortho2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - ortho2( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rect float s float s float s float s */ - -static PyObject * -gl_rect(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - rect( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectf float s float s float s float s */ - -static PyObject * -gl_rectf(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - rectf( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt4 float s float s float s float s */ - -static PyObject * -gl_xfpt4(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - xfpt4( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void textport short s short s short s short s */ - -static PyObject * -gl_textport(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - textport( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void mapcolor short s short s short s short s */ - -static PyObject * -gl_mapcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - mapcolor( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void scrmask short s short s short s short s */ - -static PyObject * -gl_scrmask(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - scrmask( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setvaluator short s short s short s short s */ - -static PyObject * -gl_setvaluator(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - setvaluator( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void viewport short s short s short s short s */ - -static PyObject * -gl_viewport(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - viewport( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void shaderange short s short s short s short s */ - -static PyObject * -gl_shaderange(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - shaderange( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt4s short s short s short s short s */ - -static PyObject * -gl_xfpt4s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - xfpt4s( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectfi long s long s long s long s */ - -static PyObject * -gl_rectfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - rectfi( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void recti long s long s long s long s */ - -static PyObject * -gl_recti(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - recti( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt4i long s long s long s long s */ - -static PyObject * -gl_xfpt4i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - xfpt4i( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void prefposition long s long s long s long s */ - -static PyObject * -gl_prefposition(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - prefposition( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arc float s float s float s short s short s */ - -static PyObject * -gl_arc(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - short arg4 ; - short arg5 ; - if (!getifloatarg(args, 5, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 5, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arc( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arcf float s float s float s short s short s */ - -static PyObject * -gl_arcf(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - short arg4 ; - short arg5 ; - if (!getifloatarg(args, 5, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 5, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arcf( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arcfi long s long s long s short s short s */ - -static PyObject * -gl_arcfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - short arg4 ; - short arg5 ; - if (!getilongarg(args, 5, 0, &arg1)) - return NULL; - if (!getilongarg(args, 5, 1, &arg2)) - return NULL; - if (!getilongarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arcfi( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arci long s long s long s short s short s */ - -static PyObject * -gl_arci(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - short arg4 ; - short arg5 ; - if (!getilongarg(args, 5, 0, &arg1)) - return NULL; - if (!getilongarg(args, 5, 1, &arg2)) - return NULL; - if (!getilongarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arci( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bbox2 short s short s float s float s float s float s */ - -static PyObject * -gl_bbox2(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - float arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - if (!getishortarg(args, 6, 0, &arg1)) - return NULL; - if (!getishortarg(args, 6, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 6, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 6, 3, &arg4)) - return NULL; - if (!getifloatarg(args, 6, 4, &arg5)) - return NULL; - if (!getifloatarg(args, 6, 5, &arg6)) - return NULL; - bbox2( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bbox2i short s short s long s long s long s long s */ - -static PyObject * -gl_bbox2i(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - long arg3 ; - long arg4 ; - long arg5 ; - long arg6 ; - if (!getishortarg(args, 6, 0, &arg1)) - return NULL; - if (!getishortarg(args, 6, 1, &arg2)) - return NULL; - if (!getilongarg(args, 6, 2, &arg3)) - return NULL; - if (!getilongarg(args, 6, 3, &arg4)) - return NULL; - if (!getilongarg(args, 6, 4, &arg5)) - return NULL; - if (!getilongarg(args, 6, 5, &arg6)) - return NULL; - bbox2i( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bbox2s short s short s short s short s short s short s */ - -static PyObject * -gl_bbox2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - if (!getishortarg(args, 6, 0, &arg1)) - return NULL; - if (!getishortarg(args, 6, 1, &arg2)) - return NULL; - if (!getishortarg(args, 6, 2, &arg3)) - return NULL; - if (!getishortarg(args, 6, 3, &arg4)) - return NULL; - if (!getishortarg(args, 6, 4, &arg5)) - return NULL; - if (!getishortarg(args, 6, 5, &arg6)) - return NULL; - bbox2s( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void blink short s short s short s short s short s */ - -static PyObject * -gl_blink(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - if (!getishortarg(args, 5, 0, &arg1)) - return NULL; - if (!getishortarg(args, 5, 1, &arg2)) - return NULL; - if (!getishortarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - blink( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void ortho float s float s float s float s float s float s */ - -static PyObject * -gl_ortho(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - if (!getifloatarg(args, 6, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 6, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 6, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 6, 3, &arg4)) - return NULL; - if (!getifloatarg(args, 6, 4, &arg5)) - return NULL; - if (!getifloatarg(args, 6, 5, &arg6)) - return NULL; - ortho( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void window float s float s float s float s float s float s */ - -static PyObject * -gl_window(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - if (!getifloatarg(args, 6, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 6, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 6, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 6, 3, &arg4)) - return NULL; - if (!getifloatarg(args, 6, 4, &arg5)) - return NULL; - if (!getifloatarg(args, 6, 5, &arg6)) - return NULL; - window( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lookat float s float s float s float s float s float s short s */ - -static PyObject * -gl_lookat(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - short arg7 ; - if (!getifloatarg(args, 7, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 7, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 7, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 7, 3, &arg4)) - return NULL; - if (!getifloatarg(args, 7, 4, &arg5)) - return NULL; - if (!getifloatarg(args, 7, 5, &arg6)) - return NULL; - if (!getishortarg(args, 7, 6, &arg7)) - return NULL; - lookat( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void perspective short s float s float s float s */ - -static PyObject * -gl_perspective(PyObject *self, PyObject *args) -{ - short arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - perspective( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polarview float s short s short s short s */ - -static PyObject * -gl_polarview(PyObject *self, PyObject *args) -{ - float arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - polarview( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arcfs short s short s short s short s short s */ - -static PyObject * -gl_arcfs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - if (!getishortarg(args, 5, 0, &arg1)) - return NULL; - if (!getishortarg(args, 5, 1, &arg2)) - return NULL; - if (!getishortarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arcfs( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arcs short s short s short s short s short s */ - -static PyObject * -gl_arcs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - if (!getishortarg(args, 5, 0, &arg1)) - return NULL; - if (!getishortarg(args, 5, 1, &arg2)) - return NULL; - if (!getishortarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arcs( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectcopy short s short s short s short s short s short s */ - -static PyObject * -gl_rectcopy(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - if (!getishortarg(args, 6, 0, &arg1)) - return NULL; - if (!getishortarg(args, 6, 1, &arg2)) - return NULL; - if (!getishortarg(args, 6, 2, &arg3)) - return NULL; - if (!getishortarg(args, 6, 3, &arg4)) - return NULL; - if (!getishortarg(args, 6, 4, &arg5)) - return NULL; - if (!getishortarg(args, 6, 5, &arg6)) - return NULL; - rectcopy( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBcursor short s short s short s short s short s short s short s */ - -static PyObject * -gl_RGBcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - short arg7 ; - if (!getishortarg(args, 7, 0, &arg1)) - return NULL; - if (!getishortarg(args, 7, 1, &arg2)) - return NULL; - if (!getishortarg(args, 7, 2, &arg3)) - return NULL; - if (!getishortarg(args, 7, 3, &arg4)) - return NULL; - if (!getishortarg(args, 7, 4, &arg5)) - return NULL; - if (!getishortarg(args, 7, 5, &arg6)) - return NULL; - if (!getishortarg(args, 7, 6, &arg7)) - return NULL; - RGBcursor( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long getbutton short s */ - -static PyObject * -gl_getbutton(PyObject *self, PyObject *args) -{ - long retval; - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - retval = getbutton( arg1 ); - return mknewlongobject(retval); -} - -/* long getcmmode */ - -static PyObject * -gl_getcmmode(PyObject *self, PyObject *args) -{ - long retval; - retval = getcmmode( ); - return mknewlongobject(retval); -} - -/* long getlsbackup */ - -static PyObject * -gl_getlsbackup(PyObject *self, PyObject *args) -{ - long retval; - retval = getlsbackup( ); - return mknewlongobject(retval); -} - -/* long getresetls */ - -static PyObject * -gl_getresetls(PyObject *self, PyObject *args) -{ - long retval; - retval = getresetls( ); - return mknewlongobject(retval); -} - -/* long getdcm */ - -static PyObject * -gl_getdcm(PyObject *self, PyObject *args) -{ - long retval; - retval = getdcm( ); - return mknewlongobject(retval); -} - -/* long getzbuffer */ - -static PyObject * -gl_getzbuffer(PyObject *self, PyObject *args) -{ - long retval; - retval = getzbuffer( ); - return mknewlongobject(retval); -} - -/* long ismex */ - -static PyObject * -gl_ismex(PyObject *self, PyObject *args) -{ - long retval; - retval = ismex( ); - return mknewlongobject(retval); -} - -/* long isobj long s */ - -static PyObject * -gl_isobj(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = isobj( arg1 ); - return mknewlongobject(retval); -} - -/* long isqueued short s */ - -static PyObject * -gl_isqueued(PyObject *self, PyObject *args) -{ - long retval; - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - retval = isqueued( arg1 ); - return mknewlongobject(retval); -} - -/* long istag long s */ - -static PyObject * -gl_istag(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = istag( arg1 ); - return mknewlongobject(retval); -} - -/* long genobj */ - -static PyObject * -gl_genobj(PyObject *self, PyObject *args) -{ - long retval; - retval = genobj( ); - return mknewlongobject(retval); -} - -/* long gentag */ - -static PyObject * -gl_gentag(PyObject *self, PyObject *args) -{ - long retval; - retval = gentag( ); - return mknewlongobject(retval); -} - -/* long getbuffer */ - -static PyObject * -gl_getbuffer(PyObject *self, PyObject *args) -{ - long retval; - retval = getbuffer( ); - return mknewlongobject(retval); -} - -/* long getcolor */ - -static PyObject * -gl_getcolor(PyObject *self, PyObject *args) -{ - long retval; - retval = getcolor( ); - return mknewlongobject(retval); -} - -/* long getdisplaymode */ - -static PyObject * -gl_getdisplaymode(PyObject *self, PyObject *args) -{ - long retval; - retval = getdisplaymode( ); - return mknewlongobject(retval); -} - -/* long getfont */ - -static PyObject * -gl_getfont(PyObject *self, PyObject *args) -{ - long retval; - retval = getfont( ); - return mknewlongobject(retval); -} - -/* long getheight */ - -static PyObject * -gl_getheight(PyObject *self, PyObject *args) -{ - long retval; - retval = getheight( ); - return mknewlongobject(retval); -} - -/* long gethitcode */ - -static PyObject * -gl_gethitcode(PyObject *self, PyObject *args) -{ - long retval; - retval = gethitcode( ); - return mknewlongobject(retval); -} - -/* long getlstyle */ - -static PyObject * -gl_getlstyle(PyObject *self, PyObject *args) -{ - long retval; - retval = getlstyle( ); - return mknewlongobject(retval); -} - -/* long getlwidth */ - -static PyObject * -gl_getlwidth(PyObject *self, PyObject *args) -{ - long retval; - retval = getlwidth( ); - return mknewlongobject(retval); -} - -/* long getmap */ - -static PyObject * -gl_getmap(PyObject *self, PyObject *args) -{ - long retval; - retval = getmap( ); - return mknewlongobject(retval); -} - -/* long getplanes */ - -static PyObject * -gl_getplanes(PyObject *self, PyObject *args) -{ - long retval; - retval = getplanes( ); - return mknewlongobject(retval); -} - -/* long getwritemask */ - -static PyObject * -gl_getwritemask(PyObject *self, PyObject *args) -{ - long retval; - retval = getwritemask( ); - return mknewlongobject(retval); -} - -/* long qtest */ - -static PyObject * -gl_qtest(PyObject *self, PyObject *args) -{ - long retval; - retval = qtest( ); - return mknewlongobject(retval); -} - -/* long getlsrepeat */ - -static PyObject * -gl_getlsrepeat(PyObject *self, PyObject *args) -{ - long retval; - retval = getlsrepeat( ); - return mknewlongobject(retval); -} - -/* long getmonitor */ - -static PyObject * -gl_getmonitor(PyObject *self, PyObject *args) -{ - long retval; - retval = getmonitor( ); - return mknewlongobject(retval); -} - -/* long getopenobj */ - -static PyObject * -gl_getopenobj(PyObject *self, PyObject *args) -{ - long retval; - retval = getopenobj( ); - return mknewlongobject(retval); -} - -/* long getpattern */ - -static PyObject * -gl_getpattern(PyObject *self, PyObject *args) -{ - long retval; - retval = getpattern( ); - return mknewlongobject(retval); -} - -/* long winget */ - -static PyObject * -gl_winget(PyObject *self, PyObject *args) -{ - long retval; - retval = winget( ); - return mknewlongobject(retval); -} - -/* long winattach */ - -static PyObject * -gl_winattach(PyObject *self, PyObject *args) -{ - long retval; - retval = winattach( ); - return mknewlongobject(retval); -} - -/* long getothermonitor */ - -static PyObject * -gl_getothermonitor(PyObject *self, PyObject *args) -{ - long retval; - retval = getothermonitor( ); - return mknewlongobject(retval); -} - -/* long newpup */ - -static PyObject * -gl_newpup(PyObject *self, PyObject *args) -{ - long retval; - retval = newpup( ); - return mknewlongobject(retval); -} - -/* long getvaluator short s */ - -static PyObject * -gl_getvaluator(PyObject *self, PyObject *args) -{ - long retval; - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - retval = getvaluator( arg1 ); - return mknewlongobject(retval); -} - -/* void winset long s */ - -static PyObject * -gl_winset(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - winset( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long dopup long s */ - -static PyObject * -gl_dopup(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = dopup( arg1 ); - return mknewlongobject(retval); -} - -/* void getdepth short r short r */ - -static PyObject * -gl_getdepth(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - getdepth( & arg1 , & arg2 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - return v; - } -} - -/* void getcpos short r short r */ - -static PyObject * -gl_getcpos(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - getcpos( & arg1 , & arg2 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - return v; - } -} - -/* void getsize long r long r */ - -static PyObject * -gl_getsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - getsize( & arg1 , & arg2 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewlongobject(arg1)); - PyTuple_SetItem(v, 1, mknewlongobject(arg2)); - return v; - } -} - -/* void getorigin long r long r */ - -static PyObject * -gl_getorigin(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - getorigin( & arg1 , & arg2 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewlongobject(arg1)); - PyTuple_SetItem(v, 1, mknewlongobject(arg2)); - return v; - } -} - -/* void getviewport short r short r short r short r */ - -static PyObject * -gl_getviewport(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - getviewport( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - PyTuple_SetItem(v, 3, mknewshortobject(arg4)); - return v; - } -} - -/* void gettp short r short r short r short r */ - -static PyObject * -gl_gettp(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - gettp( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - PyTuple_SetItem(v, 3, mknewshortobject(arg4)); - return v; - } -} - -/* void getgpos float r float r float r float r */ - -static PyObject * -gl_getgpos(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - getgpos( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewfloatobject(arg1)); - PyTuple_SetItem(v, 1, mknewfloatobject(arg2)); - PyTuple_SetItem(v, 2, mknewfloatobject(arg3)); - PyTuple_SetItem(v, 3, mknewfloatobject(arg4)); - return v; - } -} - -/* void winposition long s long s long s long s */ - -static PyObject * -gl_winposition(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - winposition( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gRGBcolor short r short r short r */ - -static PyObject * -gl_gRGBcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - gRGBcolor( & arg1 , & arg2 , & arg3 ); - { PyObject *v = PyTuple_New( 3 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - return v; - } -} - -/* void gRGBmask short r short r short r */ - -static PyObject * -gl_gRGBmask(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - gRGBmask( & arg1 , & arg2 , & arg3 ); - { PyObject *v = PyTuple_New( 3 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - return v; - } -} - -/* void getscrmask short r short r short r short r */ - -static PyObject * -gl_getscrmask(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - getscrmask( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - PyTuple_SetItem(v, 3, mknewshortobject(arg4)); - return v; - } -} - -/* void getmcolor short s short r short r short r */ - -static PyObject * -gl_getmcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - getmcolor( arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 3 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg2)); - PyTuple_SetItem(v, 1, mknewshortobject(arg3)); - PyTuple_SetItem(v, 2, mknewshortobject(arg4)); - return v; - } -} - -/* void mapw long s short s short s float r float r float r float r float r float r */ - -static PyObject * -gl_mapw(PyObject *self, PyObject *args) -{ - long arg1 ; - short arg2 ; - short arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - float arg7 ; - float arg8 ; - float arg9 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - mapw( arg1 , arg2 , arg3 , & arg4 , & arg5 , & arg6 , & arg7 , & arg8 , & arg9 ); - { PyObject *v = PyTuple_New( 6 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewfloatobject(arg4)); - PyTuple_SetItem(v, 1, mknewfloatobject(arg5)); - PyTuple_SetItem(v, 2, mknewfloatobject(arg6)); - PyTuple_SetItem(v, 3, mknewfloatobject(arg7)); - PyTuple_SetItem(v, 4, mknewfloatobject(arg8)); - PyTuple_SetItem(v, 5, mknewfloatobject(arg9)); - return v; - } -} - -/* void mapw2 long s short s short s float r float r */ - -static PyObject * -gl_mapw2(PyObject *self, PyObject *args) -{ - long arg1 ; - short arg2 ; - short arg3 ; - float arg4 ; - float arg5 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - mapw2( arg1 , arg2 , arg3 , & arg4 , & arg5 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewfloatobject(arg4)); - PyTuple_SetItem(v, 1, mknewfloatobject(arg5)); - return v; - } -} - -/* void getcursor short r u_short r u_short r long r */ - -static PyObject * -gl_getcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - unsigned short arg2 ; - unsigned short arg3 ; - long arg4 ; - getcursor( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject((short) arg2)); - PyTuple_SetItem(v, 2, mknewshortobject((short) arg3)); - PyTuple_SetItem(v, 3, mknewlongobject(arg4)); - return v; - } -} - -/* void cmode */ - -static PyObject * -gl_cmode(PyObject *self, PyObject *args) -{ - cmode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void concave long s */ - -static PyObject * -gl_concave(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - concave( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curstype long s */ - -static PyObject * -gl_curstype(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - curstype( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void drawmode long s */ - -static PyObject * -gl_drawmode(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - drawmode( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gammaramp short s[256] short s[256] short s[256] */ - -static PyObject * -gl_gammaramp(PyObject *self, PyObject *args) -{ - short arg1 [ 256 ] ; - short arg2 [ 256 ] ; - short arg3 [ 256 ] ; - if (!getishortarray(args, 3, 0, 256 , arg1)) - return NULL; - if (!getishortarray(args, 3, 1, 256 , arg2)) - return NULL; - if (!getishortarray(args, 3, 2, 256 , arg3)) - return NULL; - gammaramp( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long getbackface */ - -static PyObject * -gl_getbackface(PyObject *self, PyObject *args) -{ - long retval; - retval = getbackface( ); - return mknewlongobject(retval); -} - -/* long getdescender */ - -static PyObject * -gl_getdescender(PyObject *self, PyObject *args) -{ - long retval; - retval = getdescender( ); - return mknewlongobject(retval); -} - -/* long getdrawmode */ - -static PyObject * -gl_getdrawmode(PyObject *self, PyObject *args) -{ - long retval; - retval = getdrawmode( ); - return mknewlongobject(retval); -} - -/* long getmmode */ - -static PyObject * -gl_getmmode(PyObject *self, PyObject *args) -{ - long retval; - retval = getmmode( ); - return mknewlongobject(retval); -} - -/* long getsm */ - -static PyObject * -gl_getsm(PyObject *self, PyObject *args) -{ - long retval; - retval = getsm( ); - return mknewlongobject(retval); -} - -/* long getvideo long s */ - -static PyObject * -gl_getvideo(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = getvideo( arg1 ); - return mknewlongobject(retval); -} - -/* void imakebackground */ - -static PyObject * -gl_imakebackground(PyObject *self, PyObject *args) -{ - imakebackground( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lmbind short s short s */ - -static PyObject * -gl_lmbind(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - lmbind( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lmdef long s long s long s float s[arg3] */ - -static PyObject * -gl_lmdef(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - float * arg4 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarraysize(args, 3, 2, &arg3)) - return NULL; - if ((arg4 = PyMem_NEW(float , arg3 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 3, 2, arg3 , arg4)) - return NULL; - lmdef( arg1 , arg2 , arg3 , arg4 ); - PyMem_DEL(arg4); - Py_INCREF(Py_None); - return Py_None; -} - -/* void mmode long s */ - -static PyObject * -gl_mmode(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - mmode( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void normal float s[3] */ - -static PyObject * -gl_normal(PyObject *self, PyObject *args) -{ - float arg1 [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 , arg1)) - return NULL; - normal( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void overlay long s */ - -static PyObject * -gl_overlay(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - overlay( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBrange short s short s short s short s short s short s short s short s */ - -static PyObject * -gl_RGBrange(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - short arg7 ; - short arg8 ; - if (!getishortarg(args, 8, 0, &arg1)) - return NULL; - if (!getishortarg(args, 8, 1, &arg2)) - return NULL; - if (!getishortarg(args, 8, 2, &arg3)) - return NULL; - if (!getishortarg(args, 8, 3, &arg4)) - return NULL; - if (!getishortarg(args, 8, 4, &arg5)) - return NULL; - if (!getishortarg(args, 8, 5, &arg6)) - return NULL; - if (!getishortarg(args, 8, 6, &arg7)) - return NULL; - if (!getishortarg(args, 8, 7, &arg8)) - return NULL; - RGBrange( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setvideo long s long s */ - -static PyObject * -gl_setvideo(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - setvideo( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void shademodel long s */ - -static PyObject * -gl_shademodel(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - shademodel( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void underlay long s */ - -static PyObject * -gl_underlay(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - underlay( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnclosedline */ - -static PyObject * -gl_bgnclosedline(PyObject *self, PyObject *args) -{ - bgnclosedline( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnline */ - -static PyObject * -gl_bgnline(PyObject *self, PyObject *args) -{ - bgnline( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnpoint */ - -static PyObject * -gl_bgnpoint(PyObject *self, PyObject *args) -{ - bgnpoint( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnpolygon */ - -static PyObject * -gl_bgnpolygon(PyObject *self, PyObject *args) -{ - bgnpolygon( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnsurface */ - -static PyObject * -gl_bgnsurface(PyObject *self, PyObject *args) -{ - bgnsurface( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgntmesh */ - -static PyObject * -gl_bgntmesh(PyObject *self, PyObject *args) -{ - bgntmesh( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgntrim */ - -static PyObject * -gl_bgntrim(PyObject *self, PyObject *args) -{ - bgntrim( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endclosedline */ - -static PyObject * -gl_endclosedline(PyObject *self, PyObject *args) -{ - endclosedline( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endline */ - -static PyObject * -gl_endline(PyObject *self, PyObject *args) -{ - endline( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endpoint */ - -static PyObject * -gl_endpoint(PyObject *self, PyObject *args) -{ - endpoint( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endpolygon */ - -static PyObject * -gl_endpolygon(PyObject *self, PyObject *args) -{ - endpolygon( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endsurface */ - -static PyObject * -gl_endsurface(PyObject *self, PyObject *args) -{ - endsurface( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endtmesh */ - -static PyObject * -gl_endtmesh(PyObject *self, PyObject *args) -{ - endtmesh( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endtrim */ - -static PyObject * -gl_endtrim(PyObject *self, PyObject *args) -{ - endtrim( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void blendfunction long s long s */ - -static PyObject * -gl_blendfunction(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - blendfunction( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c3f float s[3] */ - -static PyObject * -gl_c3f(PyObject *self, PyObject *args) -{ - float arg1 [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 , arg1)) - return NULL; - c3f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c3i long s[3] */ - -static PyObject * -gl_c3i(PyObject *self, PyObject *args) -{ - long arg1 [ 3 ] ; - if (!getilongarray(args, 1, 0, 3 , arg1)) - return NULL; - c3i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c3s short s[3] */ - -static PyObject * -gl_c3s(PyObject *self, PyObject *args) -{ - short arg1 [ 3 ] ; - if (!getishortarray(args, 1, 0, 3 , arg1)) - return NULL; - c3s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c4f float s[4] */ - -static PyObject * -gl_c4f(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 , arg1)) - return NULL; - c4f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c4i long s[4] */ - -static PyObject * -gl_c4i(PyObject *self, PyObject *args) -{ - long arg1 [ 4 ] ; - if (!getilongarray(args, 1, 0, 4 , arg1)) - return NULL; - c4i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c4s short s[4] */ - -static PyObject * -gl_c4s(PyObject *self, PyObject *args) -{ - short arg1 [ 4 ] ; - if (!getishortarray(args, 1, 0, 4 , arg1)) - return NULL; - c4s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void colorf float s */ - -static PyObject * -gl_colorf(PyObject *self, PyObject *args) -{ - float arg1 ; - if (!getifloatarg(args, 1, 0, &arg1)) - return NULL; - colorf( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cpack long s */ - -static PyObject * -gl_cpack(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - cpack( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void czclear long s long s */ - -static PyObject * -gl_czclear(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - czclear( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void dglclose long s */ - -static PyObject * -gl_dglclose(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - dglclose( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long dglopen char *s long s */ - -static PyObject * -gl_dglopen(PyObject *self, PyObject *args) -{ - long retval; - string arg1 ; - long arg2 ; - if (!getistringarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - retval = dglopen( arg1 , arg2 ); - return mknewlongobject(retval); -} - -/* long getgdesc long s */ - -static PyObject * -gl_getgdesc(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = getgdesc( arg1 ); - return mknewlongobject(retval); -} - -/* void getnurbsproperty long s float r */ - -static PyObject * -gl_getnurbsproperty(PyObject *self, PyObject *args) -{ - long arg1 ; - float arg2 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - getnurbsproperty( arg1 , & arg2 ); - return mknewfloatobject(arg2); -} - -/* void glcompat long s long s */ - -static PyObject * -gl_glcompat(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - glcompat( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void iconsize long s long s */ - -static PyObject * -gl_iconsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - iconsize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void icontitle char *s */ - -static PyObject * -gl_icontitle(PyObject *self, PyObject *args) -{ - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - icontitle( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lRGBrange short s short s short s short s short s short s long s long s */ - -static PyObject * -gl_lRGBrange(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - long arg7 ; - long arg8 ; - if (!getishortarg(args, 8, 0, &arg1)) - return NULL; - if (!getishortarg(args, 8, 1, &arg2)) - return NULL; - if (!getishortarg(args, 8, 2, &arg3)) - return NULL; - if (!getishortarg(args, 8, 3, &arg4)) - return NULL; - if (!getishortarg(args, 8, 4, &arg5)) - return NULL; - if (!getishortarg(args, 8, 5, &arg6)) - return NULL; - if (!getilongarg(args, 8, 6, &arg7)) - return NULL; - if (!getilongarg(args, 8, 7, &arg8)) - return NULL; - lRGBrange( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void linesmooth long s */ - -static PyObject * -gl_linesmooth(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - linesmooth( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lmcolor long s */ - -static PyObject * -gl_lmcolor(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lmcolor( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void logicop long s */ - -static PyObject * -gl_logicop(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - logicop( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lsetdepth long s long s */ - -static PyObject * -gl_lsetdepth(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - lsetdepth( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lshaderange short s short s long s long s */ - -static PyObject * -gl_lshaderange(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - long arg3 ; - long arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - lshaderange( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void n3f float s[3] */ - -static PyObject * -gl_n3f(PyObject *self, PyObject *args) -{ - float arg1 [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 , arg1)) - return NULL; - n3f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void noborder */ - -static PyObject * -gl_noborder(PyObject *self, PyObject *args) -{ - noborder( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pntsmooth long s */ - -static PyObject * -gl_pntsmooth(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - pntsmooth( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void readsource long s */ - -static PyObject * -gl_readsource(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - readsource( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectzoom float s float s */ - -static PyObject * -gl_rectzoom(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rectzoom( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sbox float s float s float s float s */ - -static PyObject * -gl_sbox(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - sbox( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxi long s long s long s long s */ - -static PyObject * -gl_sboxi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - sboxi( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxs short s short s short s short s */ - -static PyObject * -gl_sboxs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - sboxs( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxf float s float s float s float s */ - -static PyObject * -gl_sboxf(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - sboxf( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxfi long s long s long s long s */ - -static PyObject * -gl_sboxfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - sboxfi( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxfs short s short s short s short s */ - -static PyObject * -gl_sboxfs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - sboxfs( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setnurbsproperty long s float s */ - -static PyObject * -gl_setnurbsproperty(PyObject *self, PyObject *args) -{ - long arg1 ; - float arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - setnurbsproperty( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setpup long s long s long s */ - -static PyObject * -gl_setpup(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - setpup( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void smoothline long s */ - -static PyObject * -gl_smoothline(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - smoothline( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void subpixel long s */ - -static PyObject * -gl_subpixel(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - subpixel( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void swaptmesh */ - -static PyObject * -gl_swaptmesh(PyObject *self, PyObject *args) -{ - swaptmesh( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long swinopen long s */ - -static PyObject * -gl_swinopen(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = swinopen( arg1 ); - return mknewlongobject(retval); -} - -/* void v2f float s[2] */ - -static PyObject * -gl_v2f(PyObject *self, PyObject *args) -{ - float arg1 [ 2 ] ; - if (!getifloatarray(args, 1, 0, 2 , arg1)) - return NULL; - v2f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v2i long s[2] */ - -static PyObject * -gl_v2i(PyObject *self, PyObject *args) -{ - long arg1 [ 2 ] ; - if (!getilongarray(args, 1, 0, 2 , arg1)) - return NULL; - v2i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v2s short s[2] */ - -static PyObject * -gl_v2s(PyObject *self, PyObject *args) -{ - short arg1 [ 2 ] ; - if (!getishortarray(args, 1, 0, 2 , arg1)) - return NULL; - v2s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v3f float s[3] */ - -static PyObject * -gl_v3f(PyObject *self, PyObject *args) -{ - float arg1 [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 , arg1)) - return NULL; - v3f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v3i long s[3] */ - -static PyObject * -gl_v3i(PyObject *self, PyObject *args) -{ - long arg1 [ 3 ] ; - if (!getilongarray(args, 1, 0, 3 , arg1)) - return NULL; - v3i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v3s short s[3] */ - -static PyObject * -gl_v3s(PyObject *self, PyObject *args) -{ - short arg1 [ 3 ] ; - if (!getishortarray(args, 1, 0, 3 , arg1)) - return NULL; - v3s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v4f float s[4] */ - -static PyObject * -gl_v4f(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 , arg1)) - return NULL; - v4f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v4i long s[4] */ - -static PyObject * -gl_v4i(PyObject *self, PyObject *args) -{ - long arg1 [ 4 ] ; - if (!getilongarray(args, 1, 0, 4 , arg1)) - return NULL; - v4i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v4s short s[4] */ - -static PyObject * -gl_v4s(PyObject *self, PyObject *args) -{ - short arg1 [ 4 ] ; - if (!getishortarray(args, 1, 0, 4 , arg1)) - return NULL; - v4s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void videocmd long s */ - -static PyObject * -gl_videocmd(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - videocmd( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long windepth long s */ - -static PyObject * -gl_windepth(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = windepth( arg1 ); - return mknewlongobject(retval); -} - -/* void wmpack long s */ - -static PyObject * -gl_wmpack(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - wmpack( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zdraw long s */ - -static PyObject * -gl_zdraw(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zdraw( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zfunction long s */ - -static PyObject * -gl_zfunction(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zfunction( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zsource long s */ - -static PyObject * -gl_zsource(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zsource( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zwritemask long s */ - -static PyObject * -gl_zwritemask(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zwritemask( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v2d double s[2] */ - -static PyObject * -gl_v2d(PyObject *self, PyObject *args) -{ - double arg1 [ 2 ] ; - if (!getidoublearray(args, 1, 0, 2 , arg1)) - return NULL; - v2d( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v3d double s[3] */ - -static PyObject * -gl_v3d(PyObject *self, PyObject *args) -{ - double arg1 [ 3 ] ; - if (!getidoublearray(args, 1, 0, 3 , arg1)) - return NULL; - v3d( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v4d double s[4] */ - -static PyObject * -gl_v4d(PyObject *self, PyObject *args) -{ - double arg1 [ 4 ] ; - if (!getidoublearray(args, 1, 0, 4 , arg1)) - return NULL; - v4d( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pixmode long s long s */ - -static PyObject * -gl_pixmode(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - pixmode( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long qgetfd */ - -static PyObject * -gl_qgetfd(PyObject *self, PyObject *args) -{ - long retval; - retval = qgetfd( ); - return mknewlongobject(retval); -} - -/* void dither long s */ - -static PyObject * -gl_dither(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - dither( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -static struct PyMethodDef gl_methods[] = { - {"qread", gl_qread, METH_OLDARGS}, - {"varray", gl_varray, METH_OLDARGS}, - {"nvarray", gl_nvarray, METH_OLDARGS}, - {"vnarray", gl_vnarray, METH_OLDARGS}, - {"nurbssurface", gl_nurbssurface, METH_OLDARGS}, - {"nurbscurve", gl_nurbscurve, METH_OLDARGS}, - {"pwlcurve", gl_pwlcurve, METH_OLDARGS}, - {"pick", gl_pick, METH_OLDARGS}, - {"endpick", gl_endpick, METH_NOARGS}, - {"gselect", gl_gselect, METH_OLDARGS}, - {"endselect", gl_endselect, METH_NOARGS}, - {"getmatrix", gl_getmatrix, METH_OLDARGS}, - {"altgetmatrix", gl_altgetmatrix, METH_OLDARGS}, - {"lrectwrite", gl_lrectwrite, METH_OLDARGS}, - {"lrectread", gl_lrectread, METH_OLDARGS}, - {"readdisplay", gl_readdisplay, METH_OLDARGS}, - {"packrect", gl_packrect, METH_OLDARGS}, - {"unpackrect", gl_unpackrect, METH_OLDARGS}, - {"gversion", gl_gversion, METH_OLDARGS}, - {"clear", gl_clear, METH_OLDARGS}, - {"getshade", gl_getshade, METH_OLDARGS}, - {"devport", gl_devport, METH_OLDARGS}, - {"rdr2i", gl_rdr2i, METH_OLDARGS}, - {"rectfs", gl_rectfs, METH_OLDARGS}, - {"rects", gl_rects, METH_OLDARGS}, - {"rmv2i", gl_rmv2i, METH_OLDARGS}, - {"noport", gl_noport, METH_OLDARGS}, - {"popviewport", gl_popviewport, METH_OLDARGS}, - {"clearhitcode", gl_clearhitcode, METH_OLDARGS}, - {"closeobj", gl_closeobj, METH_OLDARGS}, - {"cursoff", gl_cursoff, METH_OLDARGS}, - {"curson", gl_curson, METH_OLDARGS}, - {"doublebuffer", gl_doublebuffer, METH_OLDARGS}, - {"finish", gl_finish, METH_OLDARGS}, - {"gconfig", gl_gconfig, METH_OLDARGS}, - {"ginit", gl_ginit, METH_OLDARGS}, - {"greset", gl_greset, METH_OLDARGS}, - {"multimap", gl_multimap, METH_OLDARGS}, - {"onemap", gl_onemap, METH_OLDARGS}, - {"popattributes", gl_popattributes, METH_OLDARGS}, - {"popmatrix", gl_popmatrix, METH_OLDARGS}, - {"pushattributes", gl_pushattributes,METH_OLDARGS}, - {"pushmatrix", gl_pushmatrix, METH_OLDARGS}, - {"pushviewport", gl_pushviewport, METH_OLDARGS}, - {"qreset", gl_qreset, METH_OLDARGS}, - {"RGBmode", gl_RGBmode, METH_OLDARGS}, - {"singlebuffer", gl_singlebuffer, METH_OLDARGS}, - {"swapbuffers", gl_swapbuffers, METH_OLDARGS}, - {"gsync", gl_gsync, METH_OLDARGS}, - {"gflush", gl_gflush, METH_OLDARGS}, - {"tpon", gl_tpon, METH_OLDARGS}, - {"tpoff", gl_tpoff, METH_OLDARGS}, - {"clkon", gl_clkon, METH_OLDARGS}, - {"clkoff", gl_clkoff, METH_OLDARGS}, - {"ringbell", gl_ringbell, METH_OLDARGS}, - {"gbegin", gl_gbegin, METH_OLDARGS}, - {"textinit", gl_textinit, METH_OLDARGS}, - {"initnames", gl_initnames, METH_OLDARGS}, - {"pclos", gl_pclos, METH_OLDARGS}, - {"popname", gl_popname, METH_OLDARGS}, - {"spclos", gl_spclos, METH_OLDARGS}, - {"zclear", gl_zclear, METH_OLDARGS}, - {"screenspace", gl_screenspace, METH_OLDARGS}, - {"reshapeviewport", gl_reshapeviewport, METH_OLDARGS}, - {"winpush", gl_winpush, METH_OLDARGS}, - {"winpop", gl_winpop, METH_OLDARGS}, - {"foreground", gl_foreground, METH_OLDARGS}, - {"endfullscrn", gl_endfullscrn, METH_OLDARGS}, - {"endpupmode", gl_endpupmode, METH_OLDARGS}, - {"fullscrn", gl_fullscrn, METH_OLDARGS}, - {"pupmode", gl_pupmode, METH_OLDARGS}, - {"winconstraints", gl_winconstraints, METH_OLDARGS}, - {"pagecolor", gl_pagecolor, METH_OLDARGS}, - {"textcolor", gl_textcolor, METH_OLDARGS}, - {"color", gl_color, METH_OLDARGS}, - {"curveit", gl_curveit, METH_OLDARGS}, - {"font", gl_font, METH_OLDARGS}, - {"linewidth", gl_linewidth, METH_OLDARGS}, - {"setlinestyle", gl_setlinestyle, METH_OLDARGS}, - {"setmap", gl_setmap, METH_OLDARGS}, - {"swapinterval", gl_swapinterval, METH_OLDARGS}, - {"writemask", gl_writemask, METH_OLDARGS}, - {"textwritemask", gl_textwritemask, METH_OLDARGS}, - {"qdevice", gl_qdevice, METH_OLDARGS}, - {"unqdevice", gl_unqdevice, METH_OLDARGS}, - {"curvebasis", gl_curvebasis, METH_OLDARGS}, - {"curveprecision", gl_curveprecision,METH_OLDARGS}, - {"loadname", gl_loadname, METH_OLDARGS}, - {"passthrough", gl_passthrough, METH_OLDARGS}, - {"pushname", gl_pushname, METH_OLDARGS}, - {"setmonitor", gl_setmonitor, METH_OLDARGS}, - {"setshade", gl_setshade, METH_OLDARGS}, - {"setpattern", gl_setpattern, METH_OLDARGS}, - {"pagewritemask", gl_pagewritemask, METH_OLDARGS}, - {"callobj", gl_callobj, METH_OLDARGS}, - {"delobj", gl_delobj, METH_OLDARGS}, - {"editobj", gl_editobj, METH_OLDARGS}, - {"makeobj", gl_makeobj, METH_OLDARGS}, - {"maketag", gl_maketag, METH_OLDARGS}, - {"chunksize", gl_chunksize, METH_OLDARGS}, - {"compactify", gl_compactify, METH_OLDARGS}, - {"deltag", gl_deltag, METH_OLDARGS}, - {"lsrepeat", gl_lsrepeat, METH_OLDARGS}, - {"objinsert", gl_objinsert, METH_OLDARGS}, - {"objreplace", gl_objreplace, METH_OLDARGS}, - {"winclose", gl_winclose, METH_OLDARGS}, - {"blanktime", gl_blanktime, METH_OLDARGS}, - {"freepup", gl_freepup, METH_OLDARGS}, - {"backbuffer", gl_backbuffer, METH_OLDARGS}, - {"frontbuffer", gl_frontbuffer, METH_OLDARGS}, - {"lsbackup", gl_lsbackup, METH_OLDARGS}, - {"resetls", gl_resetls, METH_OLDARGS}, - {"lampon", gl_lampon, METH_OLDARGS}, - {"lampoff", gl_lampoff, METH_OLDARGS}, - {"setbell", gl_setbell, METH_OLDARGS}, - {"blankscreen", gl_blankscreen, METH_OLDARGS}, - {"depthcue", gl_depthcue, METH_OLDARGS}, - {"zbuffer", gl_zbuffer, METH_OLDARGS}, - {"backface", gl_backface, METH_OLDARGS}, - {"cmov2i", gl_cmov2i, METH_OLDARGS}, - {"draw2i", gl_draw2i, METH_OLDARGS}, - {"move2i", gl_move2i, METH_OLDARGS}, - {"pnt2i", gl_pnt2i, METH_OLDARGS}, - {"patchbasis", gl_patchbasis, METH_OLDARGS}, - {"patchprecision", gl_patchprecision, METH_OLDARGS}, - {"pdr2i", gl_pdr2i, METH_OLDARGS}, - {"pmv2i", gl_pmv2i, METH_OLDARGS}, - {"rpdr2i", gl_rpdr2i, METH_OLDARGS}, - {"rpmv2i", gl_rpmv2i, METH_OLDARGS}, - {"xfpt2i", gl_xfpt2i, METH_OLDARGS}, - {"objdelete", gl_objdelete, METH_OLDARGS}, - {"patchcurves", gl_patchcurves, METH_OLDARGS}, - {"minsize", gl_minsize, METH_OLDARGS}, - {"maxsize", gl_maxsize, METH_OLDARGS}, - {"keepaspect", gl_keepaspect, METH_OLDARGS}, - {"prefsize", gl_prefsize, METH_OLDARGS}, - {"stepunit", gl_stepunit, METH_OLDARGS}, - {"fudge", gl_fudge, METH_OLDARGS}, - {"winmove", gl_winmove, METH_OLDARGS}, - {"attachcursor", gl_attachcursor, METH_OLDARGS}, - {"deflinestyle", gl_deflinestyle, METH_OLDARGS}, - {"noise", gl_noise, METH_OLDARGS}, - {"picksize", gl_picksize, METH_OLDARGS}, - {"qenter", gl_qenter, METH_OLDARGS}, - {"setdepth", gl_setdepth, METH_OLDARGS}, - {"cmov2s", gl_cmov2s, METH_OLDARGS}, - {"draw2s", gl_draw2s, METH_OLDARGS}, - {"move2s", gl_move2s, METH_OLDARGS}, - {"pdr2s", gl_pdr2s, METH_OLDARGS}, - {"pmv2s", gl_pmv2s, METH_OLDARGS}, - {"pnt2s", gl_pnt2s, METH_OLDARGS}, - {"rdr2s", gl_rdr2s, METH_OLDARGS}, - {"rmv2s", gl_rmv2s, METH_OLDARGS}, - {"rpdr2s", gl_rpdr2s, METH_OLDARGS}, - {"rpmv2s", gl_rpmv2s, METH_OLDARGS}, - {"xfpt2s", gl_xfpt2s, METH_OLDARGS}, - {"cmov2", gl_cmov2, METH_OLDARGS}, - {"draw2", gl_draw2, METH_OLDARGS}, - {"move2", gl_move2, METH_OLDARGS}, - {"pnt2", gl_pnt2, METH_OLDARGS}, - {"pdr2", gl_pdr2, METH_OLDARGS}, - {"pmv2", gl_pmv2, METH_OLDARGS}, - {"rdr2", gl_rdr2, METH_OLDARGS}, - {"rmv2", gl_rmv2, METH_OLDARGS}, - {"rpdr2", gl_rpdr2, METH_OLDARGS}, - {"rpmv2", gl_rpmv2, METH_OLDARGS}, - {"xfpt2", gl_xfpt2, METH_OLDARGS}, - {"loadmatrix", gl_loadmatrix, METH_OLDARGS}, - {"multmatrix", gl_multmatrix, METH_OLDARGS}, - {"crv", gl_crv, METH_OLDARGS}, - {"rcrv", gl_rcrv, METH_OLDARGS}, - {"addtopup", gl_addtopup, METH_OLDARGS}, - {"charstr", gl_charstr, METH_OLDARGS}, - {"getport", gl_getport, METH_OLDARGS}, - {"strwidth", gl_strwidth, METH_OLDARGS}, - {"winopen", gl_winopen, METH_OLDARGS}, - {"wintitle", gl_wintitle, METH_OLDARGS}, - {"polf", gl_polf, METH_OLDARGS}, - {"polf2", gl_polf2, METH_OLDARGS}, - {"poly", gl_poly, METH_OLDARGS}, - {"poly2", gl_poly2, METH_OLDARGS}, - {"crvn", gl_crvn, METH_OLDARGS}, - {"rcrvn", gl_rcrvn, METH_OLDARGS}, - {"polf2i", gl_polf2i, METH_OLDARGS}, - {"polfi", gl_polfi, METH_OLDARGS}, - {"poly2i", gl_poly2i, METH_OLDARGS}, - {"polyi", gl_polyi, METH_OLDARGS}, - {"polf2s", gl_polf2s, METH_OLDARGS}, - {"polfs", gl_polfs, METH_OLDARGS}, - {"polys", gl_polys, METH_OLDARGS}, - {"poly2s", gl_poly2s, METH_OLDARGS}, - {"defcursor", gl_defcursor, METH_OLDARGS}, - {"writepixels", gl_writepixels, METH_OLDARGS}, - {"defbasis", gl_defbasis, METH_OLDARGS}, - {"gewrite", gl_gewrite, METH_OLDARGS}, - {"rotate", gl_rotate, METH_OLDARGS}, - {"rot", gl_rot, METH_OLDARGS}, - {"circfi", gl_circfi, METH_OLDARGS}, - {"circi", gl_circi, METH_OLDARGS}, - {"cmovi", gl_cmovi, METH_OLDARGS}, - {"drawi", gl_drawi, METH_OLDARGS}, - {"movei", gl_movei, METH_OLDARGS}, - {"pnti", gl_pnti, METH_OLDARGS}, - {"newtag", gl_newtag, METH_OLDARGS}, - {"pdri", gl_pdri, METH_OLDARGS}, - {"pmvi", gl_pmvi, METH_OLDARGS}, - {"rdri", gl_rdri, METH_OLDARGS}, - {"rmvi", gl_rmvi, METH_OLDARGS}, - {"rpdri", gl_rpdri, METH_OLDARGS}, - {"rpmvi", gl_rpmvi, METH_OLDARGS}, - {"xfpti", gl_xfpti, METH_OLDARGS}, - {"circ", gl_circ, METH_OLDARGS}, - {"circf", gl_circf, METH_OLDARGS}, - {"cmov", gl_cmov, METH_OLDARGS}, - {"draw", gl_draw, METH_OLDARGS}, - {"move", gl_move, METH_OLDARGS}, - {"pnt", gl_pnt, METH_OLDARGS}, - {"scale", gl_scale, METH_OLDARGS}, - {"translate", gl_translate, METH_OLDARGS}, - {"pdr", gl_pdr, METH_OLDARGS}, - {"pmv", gl_pmv, METH_OLDARGS}, - {"rdr", gl_rdr, METH_OLDARGS}, - {"rmv", gl_rmv, METH_OLDARGS}, - {"rpdr", gl_rpdr, METH_OLDARGS}, - {"rpmv", gl_rpmv, METH_OLDARGS}, - {"xfpt", gl_xfpt, METH_OLDARGS}, - {"RGBcolor", gl_RGBcolor, METH_OLDARGS}, - {"RGBwritemask", gl_RGBwritemask, METH_OLDARGS}, - {"setcursor", gl_setcursor, METH_OLDARGS}, - {"tie", gl_tie, METH_OLDARGS}, - {"circfs", gl_circfs, METH_OLDARGS}, - {"circs", gl_circs, METH_OLDARGS}, - {"cmovs", gl_cmovs, METH_OLDARGS}, - {"draws", gl_draws, METH_OLDARGS}, - {"moves", gl_moves, METH_OLDARGS}, - {"pdrs", gl_pdrs, METH_OLDARGS}, - {"pmvs", gl_pmvs, METH_OLDARGS}, - {"pnts", gl_pnts, METH_OLDARGS}, - {"rdrs", gl_rdrs, METH_OLDARGS}, - {"rmvs", gl_rmvs, METH_OLDARGS}, - {"rpdrs", gl_rpdrs, METH_OLDARGS}, - {"rpmvs", gl_rpmvs, METH_OLDARGS}, - {"xfpts", gl_xfpts, METH_OLDARGS}, - {"curorigin", gl_curorigin, METH_OLDARGS}, - {"cyclemap", gl_cyclemap, METH_OLDARGS}, - {"patch", gl_patch, METH_OLDARGS}, - {"splf", gl_splf, METH_OLDARGS}, - {"splf2", gl_splf2, METH_OLDARGS}, - {"splfi", gl_splfi, METH_OLDARGS}, - {"splf2i", gl_splf2i, METH_OLDARGS}, - {"splfs", gl_splfs, METH_OLDARGS}, - {"splf2s", gl_splf2s, METH_OLDARGS}, - {"rpatch", gl_rpatch, METH_OLDARGS}, - {"ortho2", gl_ortho2, METH_OLDARGS}, - {"rect", gl_rect, METH_OLDARGS}, - {"rectf", gl_rectf, METH_OLDARGS}, - {"xfpt4", gl_xfpt4, METH_OLDARGS}, - {"textport", gl_textport, METH_OLDARGS}, - {"mapcolor", gl_mapcolor, METH_OLDARGS}, - {"scrmask", gl_scrmask, METH_OLDARGS}, - {"setvaluator", gl_setvaluator, METH_OLDARGS}, - {"viewport", gl_viewport, METH_OLDARGS}, - {"shaderange", gl_shaderange, METH_OLDARGS}, - {"xfpt4s", gl_xfpt4s, METH_OLDARGS}, - {"rectfi", gl_rectfi, METH_OLDARGS}, - {"recti", gl_recti, METH_OLDARGS}, - {"xfpt4i", gl_xfpt4i, METH_OLDARGS}, - {"prefposition", gl_prefposition, METH_OLDARGS}, - {"arc", gl_arc, METH_OLDARGS}, - {"arcf", gl_arcf, METH_OLDARGS}, - {"arcfi", gl_arcfi, METH_OLDARGS}, - {"arci", gl_arci, METH_OLDARGS}, - {"bbox2", gl_bbox2, METH_OLDARGS}, - {"bbox2i", gl_bbox2i, METH_OLDARGS}, - {"bbox2s", gl_bbox2s, METH_OLDARGS}, - {"blink", gl_blink, METH_OLDARGS}, - {"ortho", gl_ortho, METH_OLDARGS}, - {"window", gl_window, METH_OLDARGS}, - {"lookat", gl_lookat, METH_OLDARGS}, - {"perspective", gl_perspective, METH_OLDARGS}, - {"polarview", gl_polarview, METH_OLDARGS}, - {"arcfs", gl_arcfs, METH_OLDARGS}, - {"arcs", gl_arcs, METH_OLDARGS}, - {"rectcopy", gl_rectcopy, METH_OLDARGS}, - {"RGBcursor", gl_RGBcursor, METH_OLDARGS}, - {"getbutton", gl_getbutton, METH_OLDARGS}, - {"getcmmode", gl_getcmmode, METH_OLDARGS}, - {"getlsbackup", gl_getlsbackup, METH_OLDARGS}, - {"getresetls", gl_getresetls, METH_OLDARGS}, - {"getdcm", gl_getdcm, METH_OLDARGS}, - {"getzbuffer", gl_getzbuffer, METH_OLDARGS}, - {"ismex", gl_ismex, METH_OLDARGS}, - {"isobj", gl_isobj, METH_OLDARGS}, - {"isqueued", gl_isqueued, METH_OLDARGS}, - {"istag", gl_istag, METH_OLDARGS}, - {"genobj", gl_genobj, METH_OLDARGS}, - {"gentag", gl_gentag, METH_OLDARGS}, - {"getbuffer", gl_getbuffer, METH_OLDARGS}, - {"getcolor", gl_getcolor, METH_OLDARGS}, - {"getdisplaymode", gl_getdisplaymode, METH_OLDARGS}, - {"getfont", gl_getfont, METH_OLDARGS}, - {"getheight", gl_getheight, METH_OLDARGS}, - {"gethitcode", gl_gethitcode, METH_OLDARGS}, - {"getlstyle", gl_getlstyle, METH_OLDARGS}, - {"getlwidth", gl_getlwidth, METH_OLDARGS}, - {"getmap", gl_getmap, METH_OLDARGS}, - {"getplanes", gl_getplanes, METH_OLDARGS}, - {"getwritemask", gl_getwritemask, METH_OLDARGS}, - {"qtest", gl_qtest, METH_OLDARGS}, - {"getlsrepeat", gl_getlsrepeat, METH_OLDARGS}, - {"getmonitor", gl_getmonitor, METH_OLDARGS}, - {"getopenobj", gl_getopenobj, METH_OLDARGS}, - {"getpattern", gl_getpattern, METH_OLDARGS}, - {"winget", gl_winget, METH_OLDARGS}, - {"winattach", gl_winattach, METH_OLDARGS}, - {"getothermonitor", gl_getothermonitor, METH_OLDARGS}, - {"newpup", gl_newpup, METH_OLDARGS}, - {"getvaluator", gl_getvaluator, METH_OLDARGS}, - {"winset", gl_winset, METH_OLDARGS}, - {"dopup", gl_dopup, METH_OLDARGS}, - {"getdepth", gl_getdepth, METH_OLDARGS}, - {"getcpos", gl_getcpos, METH_OLDARGS}, - {"getsize", gl_getsize, METH_OLDARGS}, - {"getorigin", gl_getorigin, METH_OLDARGS}, - {"getviewport", gl_getviewport, METH_OLDARGS}, - {"gettp", gl_gettp, METH_OLDARGS}, - {"getgpos", gl_getgpos, METH_OLDARGS}, - {"winposition", gl_winposition, METH_OLDARGS}, - {"gRGBcolor", gl_gRGBcolor, METH_OLDARGS}, - {"gRGBmask", gl_gRGBmask, METH_OLDARGS}, - {"getscrmask", gl_getscrmask, METH_OLDARGS}, - {"getmcolor", gl_getmcolor, METH_OLDARGS}, - {"mapw", gl_mapw, METH_OLDARGS}, - {"mapw2", gl_mapw2, METH_OLDARGS}, - {"getcursor", gl_getcursor, METH_OLDARGS}, - {"cmode", gl_cmode, METH_OLDARGS}, - {"concave", gl_concave, METH_OLDARGS}, - {"curstype", gl_curstype, METH_OLDARGS}, - {"drawmode", gl_drawmode, METH_OLDARGS}, - {"gammaramp", gl_gammaramp, METH_OLDARGS}, - {"getbackface", gl_getbackface, METH_OLDARGS}, - {"getdescender", gl_getdescender, METH_OLDARGS}, - {"getdrawmode", gl_getdrawmode, METH_OLDARGS}, - {"getmmode", gl_getmmode, METH_OLDARGS}, - {"getsm", gl_getsm, METH_OLDARGS}, - {"getvideo", gl_getvideo, METH_OLDARGS}, - {"imakebackground", gl_imakebackground, METH_OLDARGS}, - {"lmbind", gl_lmbind, METH_OLDARGS}, - {"lmdef", gl_lmdef, METH_OLDARGS}, - {"mmode", gl_mmode, METH_OLDARGS}, - {"normal", gl_normal, METH_OLDARGS}, - {"overlay", gl_overlay, METH_OLDARGS}, - {"RGBrange", gl_RGBrange, METH_OLDARGS}, - {"setvideo", gl_setvideo, METH_OLDARGS}, - {"shademodel", gl_shademodel, METH_OLDARGS}, - {"underlay", gl_underlay, METH_OLDARGS}, - {"bgnclosedline", gl_bgnclosedline, METH_OLDARGS}, - {"bgnline", gl_bgnline, METH_OLDARGS}, - {"bgnpoint", gl_bgnpoint, METH_OLDARGS}, - {"bgnpolygon", gl_bgnpolygon, METH_OLDARGS}, - {"bgnsurface", gl_bgnsurface, METH_OLDARGS}, - {"bgntmesh", gl_bgntmesh, METH_OLDARGS}, - {"bgntrim", gl_bgntrim, METH_OLDARGS}, - {"endclosedline", gl_endclosedline, METH_OLDARGS}, - {"endline", gl_endline, METH_OLDARGS}, - {"endpoint", gl_endpoint, METH_OLDARGS}, - {"endpolygon", gl_endpolygon, METH_OLDARGS}, - {"endsurface", gl_endsurface, METH_OLDARGS}, - {"endtmesh", gl_endtmesh, METH_OLDARGS}, - {"endtrim", gl_endtrim, METH_OLDARGS}, - {"blendfunction", gl_blendfunction, METH_OLDARGS}, - {"c3f", gl_c3f, METH_OLDARGS}, - {"c3i", gl_c3i, METH_OLDARGS}, - {"c3s", gl_c3s, METH_OLDARGS}, - {"c4f", gl_c4f, METH_OLDARGS}, - {"c4i", gl_c4i, METH_OLDARGS}, - {"c4s", gl_c4s, METH_OLDARGS}, - {"colorf", gl_colorf, METH_OLDARGS}, - {"cpack", gl_cpack, METH_OLDARGS}, - {"czclear", gl_czclear, METH_OLDARGS}, - {"dglclose", gl_dglclose, METH_OLDARGS}, - {"dglopen", gl_dglopen, METH_OLDARGS}, - {"getgdesc", gl_getgdesc, METH_OLDARGS}, - {"getnurbsproperty", gl_getnurbsproperty, METH_OLDARGS}, - {"glcompat", gl_glcompat, METH_OLDARGS}, - {"iconsize", gl_iconsize, METH_OLDARGS}, - {"icontitle", gl_icontitle, METH_OLDARGS}, - {"lRGBrange", gl_lRGBrange, METH_OLDARGS}, - {"linesmooth", gl_linesmooth, METH_OLDARGS}, - {"lmcolor", gl_lmcolor, METH_OLDARGS}, - {"logicop", gl_logicop, METH_OLDARGS}, - {"lsetdepth", gl_lsetdepth, METH_OLDARGS}, - {"lshaderange", gl_lshaderange, METH_OLDARGS}, - {"n3f", gl_n3f, METH_OLDARGS}, - {"noborder", gl_noborder, METH_OLDARGS}, - {"pntsmooth", gl_pntsmooth, METH_OLDARGS}, - {"readsource", gl_readsource, METH_OLDARGS}, - {"rectzoom", gl_rectzoom, METH_OLDARGS}, - {"sbox", gl_sbox, METH_OLDARGS}, - {"sboxi", gl_sboxi, METH_OLDARGS}, - {"sboxs", gl_sboxs, METH_OLDARGS}, - {"sboxf", gl_sboxf, METH_OLDARGS}, - {"sboxfi", gl_sboxfi, METH_OLDARGS}, - {"sboxfs", gl_sboxfs, METH_OLDARGS}, - {"setnurbsproperty", gl_setnurbsproperty, METH_OLDARGS}, - {"setpup", gl_setpup, METH_OLDARGS}, - {"smoothline", gl_smoothline, METH_OLDARGS}, - {"subpixel", gl_subpixel, METH_OLDARGS}, - {"swaptmesh", gl_swaptmesh, METH_OLDARGS}, - {"swinopen", gl_swinopen, METH_OLDARGS}, - {"v2f", gl_v2f, METH_OLDARGS}, - {"v2i", gl_v2i, METH_OLDARGS}, - {"v2s", gl_v2s, METH_OLDARGS}, - {"v3f", gl_v3f, METH_OLDARGS}, - {"v3i", gl_v3i, METH_OLDARGS}, - {"v3s", gl_v3s, METH_OLDARGS}, - {"v4f", gl_v4f, METH_OLDARGS}, - {"v4i", gl_v4i, METH_OLDARGS}, - {"v4s", gl_v4s, METH_OLDARGS}, - {"videocmd", gl_videocmd, METH_OLDARGS}, - {"windepth", gl_windepth, METH_OLDARGS}, - {"wmpack", gl_wmpack, METH_OLDARGS}, - {"zdraw", gl_zdraw, METH_OLDARGS}, - {"zfunction", gl_zfunction, METH_OLDARGS}, - {"zsource", gl_zsource, METH_OLDARGS}, - {"zwritemask", gl_zwritemask, METH_OLDARGS}, - {"v2d", gl_v2d, METH_OLDARGS}, - {"v3d", gl_v3d, METH_OLDARGS}, - {"v4d", gl_v4d, METH_OLDARGS}, - {"pixmode", gl_pixmode, METH_OLDARGS}, - {"qgetfd", gl_qgetfd, METH_OLDARGS}, - {"dither", gl_dither, METH_OLDARGS}, - {NULL, NULL} /* Sentinel */ -}; - -void -initgl(void) -{ - (void) Py_InitModule("gl", gl_methods); -} diff --git a/Modules/imgfile.c b/Modules/imgfile.c deleted file mode 100644 index bb85a78..0000000 --- a/Modules/imgfile.c +++ /dev/null @@ -1,504 +0,0 @@ - -/* IMGFILE module - Interface to sgi libimage */ - -/* XXX This module should be done better at some point. It should return -** an object of image file class, and have routines to manipulate these -** image files in a neater way (so you can get rgb images off a greyscale -** file, for instance, or do a straight display without having to get the -** image bits into python, etc). -** -** Warning: this module is very non-reentrant (esp. the readscaled stuff) -*/ - -#include "Python.h" - -#include - -#include "/usr/people/4Dgifts/iristools/include/izoom.h" - -/* Bunch of missing extern decls; keep gcc -Wall happy... */ -extern void i_seterror(); -extern void iclose(); -extern void filterzoom(); -extern void putrow(); -extern void getrow(); - -static PyObject * ImgfileError; /* Exception we raise for various trouble */ - -static int top_to_bottom; /* True if we want top-to-bottom images */ - -/* The image library does not always call the error hander :-(, - therefore we have a global variable indicating that it was called. - It is cleared by imgfile_open(). */ - -static int error_called; - - -/* The error handler */ - -static void -imgfile_error(char *str) -{ - PyErr_SetString(ImgfileError, str); - error_called = 1; - return; /* To imglib, which will return a failure indicator */ -} - - -/* Open an image file and return a pointer to it. - Make sure we raise an exception if we fail. */ - -static IMAGE * -imgfile_open(char *fname) -{ - IMAGE *image; - i_seterror(imgfile_error); - error_called = 0; - errno = 0; - if ( (image = iopen(fname, "r")) == NULL ) { - /* Error may already be set by imgfile_error */ - if ( !error_called ) { - if (errno) - PyErr_SetFromErrno(ImgfileError); - else - PyErr_SetString(ImgfileError, - "Can't open image file"); - } - return NULL; - } - return image; -} - -static PyObject * -imgfile_ttob(PyObject *self, PyObject *args) -{ - int newval; - PyObject *rv; - - if (!PyArg_ParseTuple(args, "i:ttob", &newval)) - return NULL; - rv = PyInt_FromLong(top_to_bottom); - top_to_bottom = newval; - return rv; -} - -static PyObject * -imgfile_read(PyObject *self, PyObject *args) -{ - char *fname; - PyObject *rv; - int xsize, ysize, zsize; - char *cdatap; - long *idatap; - static short rs[8192], gs[8192], bs[8192]; - int x, y; - IMAGE *image; - int yfirst, ylast, ystep; - - if ( !PyArg_ParseTuple(args, "s:read", &fname) ) - return NULL; - - if ( (image = imgfile_open(fname)) == NULL ) - return NULL; - - if ( image->colormap != CM_NORMAL ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can only handle CM_NORMAL images"); - return NULL; - } - if ( BPP(image->type) != 1 ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can't handle imgfiles with bpp!=1"); - return NULL; - } - xsize = image->xsize; - ysize = image->ysize; - zsize = image->zsize; - if ( zsize != 1 && zsize != 3) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can only handle 1 or 3 byte pixels"); - return NULL; - } - if ( xsize > 8192 ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can't handle image with > 8192 columns"); - return NULL; - } - - if ( zsize == 3 ) zsize = 4; - rv = PyString_FromStringAndSize((char *)NULL, xsize*ysize*zsize); - if ( rv == NULL ) { - iclose(image); - return NULL; - } - cdatap = PyString_AsString(rv); - idatap = (long *)cdatap; - - if (top_to_bottom) { - yfirst = ysize-1; - ylast = -1; - ystep = -1; - } else { - yfirst = 0; - ylast = ysize; - ystep = 1; - } - for ( y=yfirst; y != ylast && !error_called; y += ystep ) { - if ( zsize == 1 ) { - getrow(image, rs, y, 0); - for(x=0; x= 4; - if ( !PyArg_ParseTuple(args, "sii|sd", - &fname, &xwtd, &ywtd, &filter, &blur) ) - return NULL; - - /* - ** Check parameters, open file and check type, rows, etc. - */ - if ( extended ) { - if ( strcmp(filter, "impulse") == 0 ) - fmode = IMPULSE; - else if ( strcmp( filter, "box") == 0 ) - fmode = BOX; - else if ( strcmp( filter, "triangle") == 0 ) - fmode = TRIANGLE; - else if ( strcmp( filter, "quadratic") == 0 ) - fmode = QUADRATIC; - else if ( strcmp( filter, "gaussian") == 0 ) - fmode = GAUSSIAN; - else { - PyErr_SetString(ImgfileError, "Unknown filter type"); - return NULL; - } - } - - if ( (image = imgfile_open(fname)) == NULL ) - return NULL; - - if ( image->colormap != CM_NORMAL ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can only handle CM_NORMAL images"); - return NULL; - } - if ( BPP(image->type) != 1 ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can't handle imgfiles with bpp!=1"); - return NULL; - } - xsize = image->xsize; - ysize = image->ysize; - zsize = image->zsize; - if ( zsize != 1 && zsize != 3) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can only handle 1 or 3 byte pixels"); - return NULL; - } - if ( xsize > 8192 ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can't handle image with > 8192 columns"); - return NULL; - } - - if ( zsize == 3 ) zsize = 4; - rv = PyString_FromStringAndSize(NULL, xwtd*ywtd*zsize); - if ( rv == NULL ) { - iclose(image); - return NULL; - } - PyFPE_START_PROTECT("readscaled", return 0) - xfac = (float)xsize/(float)xwtd; - yfac = (float)ysize/(float)ywtd; - PyFPE_END_PROTECT(yfac) - cdatap = PyString_AsString(rv); - idatap = (long *)cdatap; - - if ( extended ) { - xscale(image, xsize, ysize, zsize, - idatap, xwtd, ywtd, fmode, blur); - } else { - if (top_to_bottom) { - yfirst = ywtd-1; - ylast = -1; - ystep = -1; - } else { - yfirst = 0; - ylast = ywtd; - ystep = 1; - } - for ( y=yfirst; y != ylast && !error_called; y += ystep ) { - yorig = (int)(y*yfac); - if ( zsize == 1 ) { - getrow(image, rs, yorig, 0); - for(x=0; xxsize, image->ysize, image->zsize); - iclose(image); - return rv; -} - -static PyObject * -imgfile_write(PyObject *self, PyObject *args) -{ - IMAGE *image; - char *fname; - int xsize, ysize, zsize, len; - char *cdatap; - long *idatap; - short rs[8192], gs[8192], bs[8192]; - short r, g, b; - long rgb; - int x, y; - int yfirst, ylast, ystep; - - - if ( !PyArg_ParseTuple(args, "ss#iii:write", - &fname, &cdatap, &len, &xsize, &ysize, &zsize) ) - return NULL; - - if ( zsize != 1 && zsize != 3 ) { - PyErr_SetString(ImgfileError, - "Can only handle 1 or 3 byte pixels"); - return NULL; - } - if ( len != xsize * ysize * (zsize == 1 ? 1 : 4) ) { - PyErr_SetString(ImgfileError, "Data does not match sizes"); - return NULL; - } - if ( xsize > 8192 ) { - PyErr_SetString(ImgfileError, - "Can't handle image with > 8192 columns"); - return NULL; - } - - error_called = 0; - errno = 0; - image =iopen(fname, "w", RLE(1), 3, xsize, ysize, zsize); - if ( image == 0 ) { - if ( ! error_called ) { - if (errno) - PyErr_SetFromErrno(ImgfileError); - else - PyErr_SetString(ImgfileError, - "Can't create image file"); - } - return NULL; - } - - idatap = (long *)cdatap; - - if (top_to_bottom) { - yfirst = ysize-1; - ylast = -1; - ystep = -1; - } else { - yfirst = 0; - ylast = ysize; - ystep = 1; - } - for ( y=yfirst; y != ylast && !error_called; y += ystep ) { - if ( zsize == 1 ) { - for( x=0; x> 8 ) & 0xff; - b = (rgb >> 16 ) & 0xff; - rs[x] = r; - gs[x] = g; - bs[x] = b; - } - putrow(image, rs, y, 0); - putrow(image, gs, y, 1); - putrow(image, bs, y, 2); - } - } - iclose(image); - if ( error_called ) - return NULL; - Py_INCREF(Py_None); - return Py_None; - -} - - -static PyMethodDef imgfile_methods[] = { - { "getsizes", imgfile_getsizes, METH_VARARGS }, - { "read", imgfile_read, METH_VARARGS }, - { "readscaled", imgfile_readscaled, METH_VARARGS}, - { "write", imgfile_write, METH_VARARGS }, - { "ttob", imgfile_ttob, METH_VARARGS }, - { NULL, NULL } /* Sentinel */ -}; - - -void -initimgfile(void) -{ - PyObject *m, *d; - m = Py_InitModule("imgfile", imgfile_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - ImgfileError = PyErr_NewException("imgfile.error", NULL, NULL); - if (ImgfileError != NULL) - PyDict_SetItemString(d, "error", ImgfileError); -} - - - diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 249fc1a..f170c51 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -867,7 +867,8 @@ VALIDATER(while); VALIDATER(for); VALIDATER(try); VALIDATER(except_clause); VALIDATER(test); VALIDATER(and_test); VALIDATER(not_test); VALIDATER(comparison); -VALIDATER(comp_op); VALIDATER(expr); +VALIDATER(comp_op); +VALIDATER(star_expr); VALIDATER(expr); VALIDATER(xor_expr); VALIDATER(and_expr); VALIDATER(shift_expr); VALIDATER(arith_expr); VALIDATER(term); VALIDATER(factor); @@ -2094,11 +2095,11 @@ validate_comparison(node *tree) int nch = NCH(tree); int res = (validate_ntype(tree, comparison) && is_odd(nch) - && validate_expr(CHILD(tree, 0))); + && validate_star_expr(CHILD(tree, 0))); for (pos = 1; res && (pos < nch); pos += 2) res = (validate_comp_op(CHILD(tree, pos)) - && validate_expr(CHILD(tree, pos + 1))); + && validate_star_expr(CHILD(tree, pos + 1))); return (res); } @@ -2156,6 +2157,20 @@ validate_comp_op(node *tree) static int +validate_star_expr(node *tree) +{ + int res = validate_ntype(tree, star_expr); + if (!res) return res; + if (NCH(tree) == 2) { + return validate_ntype(CHILD(tree, 0), STAR) && \ + validate_expr(CHILD(tree, 1)); + } else { + return validate_expr(CHILD(tree, 0)); + } +} + + +static int validate_expr(node *tree) { int j; @@ -2745,7 +2760,7 @@ static int validate_exprlist(node *tree) { return (validate_repeating_list(tree, exprlist, - validate_expr, "exprlist")); + validate_star_expr, "exprlist")); } diff --git a/Modules/sgimodule.c b/Modules/sgimodule.c deleted file mode 100644 index f7e1263..0000000 --- a/Modules/sgimodule.c +++ /dev/null @@ -1,55 +0,0 @@ - -/* SGI module -- random SGI-specific things */ - -#include "Python.h" - -#include -#include -#include - -static PyObject * -sgi_nap(PyObject *self, PyObject *args) -{ - long ticks; - if (!PyArg_ParseTuple(args, "l:nap", &ticks)) - return NULL; - Py_BEGIN_ALLOW_THREADS - sginap(ticks); - Py_END_ALLOW_THREADS - Py_INCREF(Py_None); - return Py_None; -} - -extern char *_getpty(int *, int, mode_t, int); - -static PyObject * -sgi__getpty(PyObject *self, PyObject *args) -{ - int oflag; - int mode; - int nofork; - char *name; - int fildes; - if (!PyArg_ParseTuple(args, "iii:_getpty", &oflag, &mode, &nofork)) - return NULL; - errno = 0; - name = _getpty(&fildes, oflag, (mode_t)mode, nofork); - if (name == NULL) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - return Py_BuildValue("(si)", name, fildes); -} - -static PyMethodDef sgi_methods[] = { - {"nap", sgi_nap, METH_VARARGS}, - {"_getpty", sgi__getpty, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - - -void -initsgi(void) -{ - Py_InitModule("sgi", sgi_methods); -} diff --git a/Modules/svmodule.c b/Modules/svmodule.c deleted file mode 100644 index fb58f19..0000000 --- a/Modules/svmodule.c +++ /dev/null @@ -1,966 +0,0 @@ -/* SV module -- interface to the Indigo video board */ - -/* WARNING! This module is for hardware that we don't have any more, - so it hasn't been tested. It has been converted to the new coding - style, and it is possible that this conversion has broken something - -- user beware! */ - -#include -#include -#include "Python.h" -#include "compile.h" -#include "yuv.h" /* for YUV conversion functions */ - -typedef struct { - PyObject_HEAD - SV_nodeP ob_svideo; - svCaptureInfo ob_info; -} svobject; - -typedef struct { - PyObject_HEAD - void *ob_capture; - int ob_mustunlock; - svCaptureInfo ob_info; - svobject *ob_svideo; -} captureobject; - -static PyObject *SvError; /* exception sv.error */ - -static PyObject *newcaptureobject(svobject *, void *, int); - -/* Set a SV-specific error from svideo_errno and return NULL */ -static PyObject * -sv_error(void) -{ - PyErr_SetString(SvError, svStrerror(svideo_errno)); - return NULL; -} - -static PyObject * -svc_conversion(captureobject *self, PyObject *args, void (*function)(), float factor) -{ - PyObject *output; - int invert; - char* outstr; - - if (!PyArg_Parse(args, "i", &invert)) - return NULL; - - if (!(output = PyString_FromStringAndSize( - NULL, - (int)(self->ob_info.width * self->ob_info.height * factor)))) - { - return NULL; - } - if (!(outstr = PyString_AsString(output))) { - Py_DECREF(output); - return NULL; - } - - (*function)((boolean)invert, self->ob_capture, - outstr, - self->ob_info.width, self->ob_info.height); - - return output; -} - -/* - * 3 functions to convert from Starter Video YUV 4:1:1 format to - * Compression Library 4:2:2 Duplicate Chroma format. - */ -static PyObject * -svc_YUVtoYUV422DC(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_YUV411_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, yuv_sv411_to_cl422dc, 2.0); -} - -static PyObject * -svc_YUVtoYUV422DC_quarter(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_YUV411_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, - yuv_sv411_to_cl422dc_quartersize, 0.5); -} - -static PyObject * -svc_YUVtoYUV422DC_sixteenth(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_YUV411_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, - yuv_sv411_to_cl422dc_sixteenthsize, 0.125); -} - -static PyObject * -svc_YUVtoRGB(captureobject *self, PyObject *args) -{ - switch (self->ob_info.format) { - case SV_YUV411_FRAMES: - case SV_YUV411_FRAMES_AND_BLANKING_BUFFER: - break; - default: - PyErr_SetString(SvError, "data had bad format"); - return NULL; - } - return svc_conversion(self, args, svYUVtoRGB, (float) sizeof(long)); -} - -static PyObject * -svc_RGB8toRGB32(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_RGB8_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, svRGB8toRGB32, (float) sizeof(long)); -} - -static PyObject * -svc_InterleaveFields(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_RGB8_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, svInterleaveFields, 1.0); -} - -static PyObject * -svc_GetFields(captureobject *self, PyObject *args) -{ - PyObject *f1 = NULL; - PyObject *f2 = NULL; - PyObject *ret = NULL; - int fieldsize; - char* obcapture; - - if (self->ob_info.format != SV_RGB8_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - - fieldsize = self->ob_info.width * self->ob_info.height / 2; - obcapture = (char*)self->ob_capture; - - if (!(f1 = PyString_FromStringAndSize(obcapture, fieldsize))) - goto finally; - if (!(f2 = PyString_FromStringAndSize(obcapture + fieldsize, - fieldsize))) - goto finally; - ret = PyTuple_Pack(2, f1, f2); - - finally: - Py_XDECREF(f1); - Py_XDECREF(f2); - return ret; -} - -static PyObject * -svc_UnlockCaptureData(captureobject *self, PyObject *args) -{ - if (!PyArg_Parse(args, "")) - return NULL; - - if (!self->ob_mustunlock) { - PyErr_SetString(SvError, "buffer should not be unlocked"); - return NULL; - } - - if (svUnlockCaptureData(self->ob_svideo->ob_svideo, self->ob_capture)) - return sv_error(); - - self->ob_mustunlock = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -#ifdef USE_GL -#include - -static PyObject * -svc_lrectwrite(captureobject *self, PyObject *args) -{ - Screencoord x1, x2, y1, y2; - - if (!PyArg_Parse(args, "(hhhh)", &x1, &x2, &y1, &y2)) - return NULL; - - lrectwrite(x1, x2, y1, y2, (unsigned long *) self->ob_capture); - - Py_INCREF(Py_None); - return Py_None; -} -#endif - -static PyObject * -svc_writefile(captureobject *self, PyObject *args) -{ - PyObject *file; - int size; - FILE* fp; - - if (!PyArg_Parse(args, "O", &file)) - return NULL; - - if (!PyFile_Check(file)) { - PyErr_SetString(SvError, "not a file object"); - return NULL; - } - - if (!(fp = PyFile_AsFile(file))) - return NULL; - - size = self->ob_info.width * self->ob_info.height; - - if (fwrite(self->ob_capture, sizeof(long), size, fp) != size) { - PyErr_SetString(SvError, "writing failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -svc_FindVisibleRegion(captureobject *self, PyObject *args) -{ - void *visible; - int width; - - if (!PyArg_Parse(args, "")) - return NULL; - - if (svFindVisibleRegion(self->ob_svideo->ob_svideo, - self->ob_capture, &visible, - self->ob_info.width)) - return sv_error(); - - if (visible == NULL) { - PyErr_SetString(SvError, "data in wrong format"); - return NULL; - } - - return newcaptureobject(self->ob_svideo, visible, 0); -} - -static PyMethodDef capture_methods[] = { - {"YUVtoRGB", (PyCFunction)svc_YUVtoRGB, METH_OLDARGS}, - {"RGB8toRGB32", (PyCFunction)svc_RGB8toRGB32, METH_OLDARGS}, - {"InterleaveFields", (PyCFunction)svc_InterleaveFields, METH_OLDARGS}, - {"UnlockCaptureData", (PyCFunction)svc_UnlockCaptureData, METH_OLDARGS}, - {"FindVisibleRegion", (PyCFunction)svc_FindVisibleRegion, METH_OLDARGS}, - {"GetFields", (PyCFunction)svc_GetFields, METH_OLDARGS}, - {"YUVtoYUV422DC", (PyCFunction)svc_YUVtoYUV422DC, METH_OLDARGS}, - {"YUVtoYUV422DC_quarter",(PyCFunction)svc_YUVtoYUV422DC_quarter, METH_OLDARGS}, - {"YUVtoYUV422DC_sixteenth",(PyCFunction)svc_YUVtoYUV422DC_sixteenth, METH_OLDARGS}, -#ifdef USE_GL - {"lrectwrite", (PyCFunction)svc_lrectwrite, METH_OLDARGS}, -#endif - {"writefile", (PyCFunction)svc_writefile, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -capture_dealloc(captureobject *self) -{ - if (self->ob_capture != NULL) { - if (self->ob_mustunlock) - (void)svUnlockCaptureData(self->ob_svideo->ob_svideo, - self->ob_capture); - self->ob_capture = NULL; - Py_DECREF(self->ob_svideo); - self->ob_svideo = NULL; - } - PyObject_Del(self); -} - -static PyObject * -capture_getattr(svobject *self, char *name) -{ - return Py_FindMethod(capture_methods, (PyObject *)self, name); -} - -PyTypeObject Capturetype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "sv.capture", /*tp_name*/ - sizeof(captureobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)capture_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)capture_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - -static PyObject * -newcaptureobject(svobject *self, void *ptr, int mustunlock) -{ - captureobject *p; - - p = PyObject_New(captureobject, &Capturetype); - if (p == NULL) - return NULL; - p->ob_svideo = self; - Py_INCREF(self); - p->ob_capture = ptr; - p->ob_mustunlock = mustunlock; - p->ob_info = self->ob_info; - return (PyObject *) p; -} - -static PyObject * -sv_GetCaptureData(svobject *self, PyObject *args) -{ - void *ptr; - long fieldID; - PyObject *res, *c; - - if (!PyArg_Parse(args, "")) - return NULL; - - if (svGetCaptureData(self->ob_svideo, &ptr, &fieldID)) - return sv_error(); - - if (ptr == NULL) { - PyErr_SetString(SvError, "no data available"); - return NULL; - } - - c = newcaptureobject(self, ptr, 1); - if (c == NULL) - return NULL; - res = Py_BuildValue("(Oi)", c, fieldID); - Py_DECREF(c); - return res; -} - -static PyObject * -sv_BindGLWindow(svobject *self, PyObject *args) -{ - long wid; - int mode; - - if (!PyArg_Parse(args, "(ii)", &wid, &mode)) - return NULL; - - if (svBindGLWindow(self->ob_svideo, wid, mode)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_EndContinuousCapture(svobject *self, PyObject *args) -{ - - if (!PyArg_Parse(args, "")) - return NULL; - - if (svEndContinuousCapture(self->ob_svideo)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_IsVideoDisplayed(svobject *self, PyObject *args) -{ - int v; - - if (!PyArg_Parse(args, "")) - return NULL; - - v = svIsVideoDisplayed(self->ob_svideo); - if (v == -1) - return sv_error(); - - return PyInt_FromLong((long) v); -} - -static PyObject * -sv_OutputOffset(svobject *self, PyObject *args) -{ - int x_offset; - int y_offset; - - if (!PyArg_Parse(args, "(ii)", &x_offset, &y_offset)) - return NULL; - - if (svOutputOffset(self->ob_svideo, x_offset, y_offset)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_PutFrame(svobject *self, PyObject *args) -{ - char *buffer; - - if (!PyArg_Parse(args, "s", &buffer)) - return NULL; - - if (svPutFrame(self->ob_svideo, buffer)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_QuerySize(svobject *self, PyObject *args) -{ - int w; - int h; - int rw; - int rh; - - if (!PyArg_Parse(args, "(ii)", &w, &h)) - return NULL; - - if (svQuerySize(self->ob_svideo, w, h, &rw, &rh)) - return sv_error(); - - return Py_BuildValue("(ii)", (long) rw, (long) rh); -} - -static PyObject * -sv_SetSize(svobject *self, PyObject *args) -{ - int w; - int h; - - if (!PyArg_Parse(args, "(ii)", &w, &h)) - return NULL; - - if (svSetSize(self->ob_svideo, w, h)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_SetStdDefaults(svobject *self, PyObject *args) -{ - - if (!PyArg_Parse(args, "")) - return NULL; - - if (svSetStdDefaults(self->ob_svideo)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_UseExclusive(svobject *self, PyObject *args) -{ - boolean onoff; - int mode; - - if (!PyArg_Parse(args, "(ii)", &onoff, &mode)) - return NULL; - - if (svUseExclusive(self->ob_svideo, onoff, mode)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_WindowOffset(svobject *self, PyObject *args) -{ - int x_offset; - int y_offset; - - if (!PyArg_Parse(args, "(ii)", &x_offset, &y_offset)) - return NULL; - - if (svWindowOffset(self->ob_svideo, x_offset, y_offset)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_CaptureBurst(svobject *self, PyObject *args) -{ - int bytes, i; - svCaptureInfo info; - void *bitvector = NULL; - PyObject *videodata = NULL; - PyObject *bitvecobj = NULL; - PyObject *res = NULL; - static PyObject *evenitem, *odditem; - - if (!PyArg_Parse(args, "(iiiii)", &info.format, - &info.width, &info.height, - &info.size, &info.samplingrate)) - return NULL; - - switch (info.format) { - case SV_RGB8_FRAMES: - bitvector = malloc(SV_BITVEC_SIZE(info.size)); - break; - case SV_YUV411_FRAMES_AND_BLANKING_BUFFER: - break; - default: - PyErr_SetString(SvError, "illegal format specified"); - return NULL; - } - - if (svQueryCaptureBufferSize(self->ob_svideo, &info, &bytes)) { - res = sv_error(); - goto finally; - } - - if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) - goto finally; - - /* XXX -- need to do something about the bitvector */ - { - char* str = PyString_AsString(videodata); - if (!str) - goto finally; - - if (svCaptureBurst(self->ob_svideo, &info, str, bitvector)) { - res = sv_error(); - goto finally; - } - } - - if (bitvector) { - if (evenitem == NULL) { - if (!(evenitem = PyInt_FromLong(0))) - goto finally; - } - if (odditem == NULL) { - if (!(odditem = PyInt_FromLong(1))) - goto finally; - } - if (!(bitvecobj = PyTuple_New(2 * info.size))) - goto finally; - - for (i = 0; i < 2 * info.size; i++) { - int sts; - - if (SV_GET_FIELD(bitvector, i) == SV_EVEN_FIELD) { - Py_INCREF(evenitem); - sts = PyTuple_SetItem(bitvecobj, i, evenitem); - } else { - Py_INCREF(odditem); - sts = PyTuple_SetItem(bitvecobj, i, odditem); - } - if (sts < 0) - goto finally; - } - } else { - bitvecobj = Py_None; - Py_INCREF(Py_None); - } - - res = Py_BuildValue("((iiiii)OO)", info.format, - info.width, info.height, - info.size, info.samplingrate, - videodata, bitvecobj); - - finally: - if (bitvector) - free(bitvector); - - Py_XDECREF(videodata); - Py_XDECREF(bitvecobj); - return res; -} - -static PyObject * -sv_CaptureOneFrame(svobject *self, PyObject *args) -{ - svCaptureInfo info; - int format, width, height; - int bytes; - PyObject *videodata = NULL; - PyObject *res = NULL; - char *str; - - if (!PyArg_Parse(args, "(iii)", &format, &width, &height)) - return NULL; - - info.format = format; - info.width = width; - info.height = height; - info.size = 0; - info.samplingrate = 0; - if (svQueryCaptureBufferSize(self->ob_svideo, &info, &bytes)) - return sv_error(); - - if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) - return NULL; - - str = PyString_AsString(videodata); - if (!str) - goto finally; - - if (svCaptureOneFrame(self->ob_svideo, format, &width, &height, str)) { - res = sv_error(); - goto finally; - } - - res = Py_BuildValue("(iiO)", width, height, videodata); - - finally: - Py_XDECREF(videodata); - return res; -} - -static PyObject * -sv_InitContinuousCapture(svobject *self, PyObject *args) -{ - svCaptureInfo info; - - if (!PyArg_Parse(args, "(iiiii)", &info.format, - &info.width, &info.height, - &info.size, &info.samplingrate)) - return NULL; - - if (svInitContinuousCapture(self->ob_svideo, &info)) - return sv_error(); - - self->ob_info = info; - - return Py_BuildValue("(iiiii)", info.format, info.width, info.height, - info.size, info.samplingrate); -} - -static PyObject * -sv_LoadMap(svobject *self, PyObject *args) -{ - PyObject *rgb; - PyObject *res = NULL; - rgb_tuple *mapp = NULL; - int maptype; - int i, j; /* indices */ - - if (!PyArg_Parse(args, "(iO)", &maptype, &rgb)) - return NULL; - - if (!PyList_Check(rgb) || PyList_Size(rgb) != 256) { - PyErr_BadArgument(); - return NULL; - } - - if (!(mapp = PyMem_NEW(rgb_tuple, 256))) - return PyErr_NoMemory(); - - for (i = 0; i < 256; i++) { - PyObject* v = PyList_GetItem(rgb, i); - if (!v) - goto finally; - - if (!PyTuple_Check(v) || PyTuple_Size(v) != 3) { - PyErr_BadArgument(); - goto finally; - } - for (j = 0; j < 3; j++) { - PyObject* cell = PyTuple_GetItem(v, j); - if (!cell) - goto finally; - - if (!PyInt_Check(cell)) { - PyErr_BadArgument(); - goto finally; - } - switch (j) { - case 0: mapp[i].red = PyInt_AsLong(cell); break; - case 1: mapp[i].blue = PyInt_AsLong(cell); break; - case 2: mapp[i].green = PyInt_AsLong(cell); break; - } - if (PyErr_Occurred()) - goto finally; - } - } - - if (svLoadMap(self->ob_svideo, maptype, mapp)) { - res = sv_error(); - goto finally; - } - - Py_INCREF(Py_None); - res = Py_None; - - finally: - PyMem_DEL(mapp); - return res; -} - -static PyObject * -sv_CloseVideo(svobject *self, PyObject *args) -{ - if (!PyArg_Parse(args, "")) - return NULL; - - if (svCloseVideo(self->ob_svideo)) - return sv_error(); - - self->ob_svideo = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -doParams(svobject *self, PyObject *args, - int (*func)(SV_nodeP, long *, int), int modified) -{ - PyObject *list; - PyObject *res = NULL; - long *PVbuffer = NULL; - long length; - int i; - - if (!PyArg_Parse(args, "O", &list)) - return NULL; - - if (!PyList_Check(list)) { - PyErr_BadArgument(); - return NULL; - } - - if ((length = PyList_Size(list)) < 0) - return NULL; - - PVbuffer = PyMem_NEW(long, length); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - - for (i = 0; i < length; i++) { - PyObject *v = PyList_GetItem(list, i); - if (!v) - goto finally; - - if (!PyInt_Check(v)) { - PyErr_BadArgument(); - goto finally; - } - PVbuffer[i] = PyInt_AsLong(v); - /* can't just test the return value, because what if the - value was -1?! - */ - if (PVbuffer[i] == -1 && PyErr_Occurred()) - goto finally; - } - - if ((*func)(self->ob_svideo, PVbuffer, length)) { - res = sv_error(); - goto finally; - } - - if (modified) { - for (i = 0; i < length; i++) { - PyObject* v = PyInt_FromLong(PVbuffer[i]); - if (!v || PyList_SetItem(list, i, v) < 0) - goto finally; - } - } - - Py_INCREF(Py_None); - res = Py_None; - - finally: - PyMem_DEL(PVbuffer); - return res; -} - -static PyObject * -sv_GetParam(PyObject *self, PyObject *args) -{ - return doParams(self, args, svGetParam, 1); -} - -static PyObject * -sv_GetParamRange(PyObject *self, PyObject *args) -{ - return doParams(self, args, svGetParamRange, 1); -} - -static PyObject * -sv_SetParam(PyObject *self, PyObject *args) -{ - return doParams(self, args, svSetParam, 0); -} - -static PyMethodDef svideo_methods[] = { - {"BindGLWindow", (PyCFunction)sv_BindGLWindow, METH_OLDARGS}, - {"EndContinuousCapture",(PyCFunction)sv_EndContinuousCapture, METH_OLDARGS}, - {"IsVideoDisplayed", (PyCFunction)sv_IsVideoDisplayed, METH_OLDARGS}, - {"OutputOffset", (PyCFunction)sv_OutputOffset, METH_OLDARGS}, - {"PutFrame", (PyCFunction)sv_PutFrame, METH_OLDARGS}, - {"QuerySize", (PyCFunction)sv_QuerySize, METH_OLDARGS}, - {"SetSize", (PyCFunction)sv_SetSize, METH_OLDARGS}, - {"SetStdDefaults", (PyCFunction)sv_SetStdDefaults, METH_OLDARGS}, - {"UseExclusive", (PyCFunction)sv_UseExclusive, METH_OLDARGS}, - {"WindowOffset", (PyCFunction)sv_WindowOffset, METH_OLDARGS}, - {"InitContinuousCapture",(PyCFunction)sv_InitContinuousCapture, METH_OLDARGS}, - {"CaptureBurst", (PyCFunction)sv_CaptureBurst, METH_OLDARGS}, - {"CaptureOneFrame", (PyCFunction)sv_CaptureOneFrame, METH_OLDARGS}, - {"GetCaptureData", (PyCFunction)sv_GetCaptureData, METH_OLDARGS}, - {"CloseVideo", (PyCFunction)sv_CloseVideo, METH_OLDARGS}, - {"LoadMap", (PyCFunction)sv_LoadMap, METH_OLDARGS}, - {"GetParam", (PyCFunction)sv_GetParam, METH_OLDARGS}, - {"GetParamRange", (PyCFunction)sv_GetParamRange, METH_OLDARGS}, - {"SetParam", (PyCFunction)sv_SetParam, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -sv_conversion(PyObject *self, PyObject *args, void (*function)(), - int inputfactor, float factor) -{ - int invert, width, height, inputlength; - char *input, *str; - PyObject *output; - - if (!PyArg_Parse(args, "(is#ii)", &invert, - &input, &inputlength, &width, &height)) - return NULL; - - if (width * height * inputfactor > inputlength) { - PyErr_SetString(SvError, "input buffer not long enough"); - return NULL; - } - - if (!(output = PyString_FromStringAndSize(NULL, - (int)(width * height * factor)))) - return NULL; - - str = PyString_AsString(output); - if (!str) { - Py_DECREF(output); - return NULL; - } - (*function)(invert, input, str, width, height); - - return output; -} - -static PyObject * -sv_InterleaveFields(PyObject *self, PyObject *args) -{ - return sv_conversion(self, args, svInterleaveFields, 1, 1.0); -} - -static PyObject * -sv_RGB8toRGB32(PyObject *self, PyObject *args) -{ - return sv_conversion(self, args, svRGB8toRGB32, 1, (float) sizeof(long)); -} - -static PyObject * -sv_YUVtoRGB(PyObject *self, PyObject *args) -{ - return sv_conversion(self, args, svYUVtoRGB, 2, (float) sizeof(long)); -} - -static void -svideo_dealloc(svobject *self) -{ - if (self->ob_svideo != NULL) - (void) svCloseVideo(self->ob_svideo); - PyObject_Del(self); -} - -static PyObject * -svideo_getattr(svobject *self, char *name) -{ - return Py_FindMethod(svideo_methods, (PyObject *)self, name); -} - -PyTypeObject Svtype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "sv.sv", /*tp_name*/ - sizeof(svobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)svideo_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)svideo_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - -static PyObject * -newsvobject(SV_nodeP svp) -{ - svobject *p; - - p = PyObject_New(svobject, &Svtype); - if (p == NULL) - return NULL; - p->ob_svideo = svp; - p->ob_info.format = 0; - p->ob_info.size = 0; - p->ob_info.width = 0; - p->ob_info.height = 0; - p->ob_info.samplingrate = 0; - return (PyObject *) p; -} - -static PyObject * -sv_OpenVideo(PyObject *self, PyObject *args) -{ - SV_nodeP svp; - - if (!PyArg_Parse(args, "")) - return NULL; - - svp = svOpenVideo(); - if (svp == NULL) - return sv_error(); - - return newsvobject(svp); -} - -static PyMethodDef sv_methods[] = { - {"InterleaveFields", (PyCFunction)sv_InterleaveFields, METH_OLDARGS}, - {"RGB8toRGB32", (PyCFunction)sv_RGB8toRGB32, METH_OLDARGS}, - {"YUVtoRGB", (PyCFunction)sv_YUVtoRGB, METH_OLDARGS}, - {"OpenVideo", (PyCFunction)sv_OpenVideo, METH_OLDARGS}, - {NULL, NULL} /* Sentinel */ -}; - -void -initsv(void) -{ - PyObject *m, *d; - - m = Py_InitModule("sv", sv_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - - SvError = PyErr_NewException("sv.error", NULL, NULL); - if (SvError == NULL || PyDict_SetItemString(d, "error", SvError) != 0) - return; -} diff --git a/PC/os2emx/Makefile b/PC/os2emx/Makefile index 833f3ab..25b88bb 100644 --- a/PC/os2emx/Makefile +++ b/PC/os2emx/Makefile @@ -268,7 +268,6 @@ DESCRIPTION.zlib$(MODULE.EXT)= Python Extension DLL for accessing the InfoZip c DESCRIPTION.crypt$(MODULE.EXT)= Python Extension DLL implementing the crypt$(BRO)$(BRC) function DESCRIPTION._tkinter$(MODULE.EXT)= Python Extension DLL for access to Tcl/Tk Environment DESCRIPTION.readline$(MODULE.EXT)= Python Extension DLL for access to GNU ReadLine library -DESCRIPTION.bsddb185$(MODULE.EXT)= Python Extension DLL for access to BSD DB (v1.85) library DESCRIPTION._curses$(MODLIB.EXT)= Python Extension DLL for access to ncurses library DESCRIPTION.pyexpat$(MODULE.EXT)= Python Extension DLL for access to expat library DESCRIPTION.bz2$(MODULE.EXT)= Python Extension DLL for accessing the bz2 compression library @@ -471,9 +470,6 @@ endif ifeq ($(HAVE_GREADLINE),yes) HARDEXTMODULES+= readline endif -ifeq ($(HAVE_BSDDB),yes) - HARDEXTMODULES+= bsddb185 -endif ifeq ($(HAVE_NCURSES),yes) LIBEXTMODULES+= _curses HARDEXTMODULES+= _curses_ @@ -600,10 +596,6 @@ unicodedata$(MODULE.EXT): $(OUT)unicodedata$O $(OUT)unicodedata_m.def $(PYTHON.I unicoded$(MODULE.EXT): unicodedata$(MODULE.EXT) cp $^ $@ -# - optional modules (requiring other software to be installed) -bsddb185$(MODULE.EXT): $(OUT)bsddbmodule$O $(OUT)bsddb185_m.def $(PYTHON.IMPLIB) - $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) -ldb $(LIBS) - crypt$(MODULE.EXT): $(OUT)cryptmodule$O $(OUT)crypt_m.def $(PYTHON.IMPLIB) $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) -lufc $(LIBS) diff --git a/PC/os2emx/config.c b/PC/os2emx/config.c index 07c1783..b6d3fd6 100644 --- a/PC/os2emx/config.c +++ b/PC/os2emx/config.c @@ -81,7 +81,6 @@ extern void init_curses(); extern void init_curses_panel(); extern void init_hotshot(); extern void init_testcapi(); -extern void initbsddb185(); extern void initbz2(); extern void initfpectl(); extern void initfpetest(); @@ -147,7 +146,6 @@ struct _inittab _PyImport_Inittab[] = { {"_curses_panel", init_curses_panel}, {"_hotshot", init_hotshot}, {"_testcapi", init_testcapi}, - {"bsddb185", initbsddb185}, {"bz2", initbz2}, {"fpectl", initfpectl}, {"fpetest", initfpetest}, diff --git a/Parser/Python.asdl b/Parser/Python.asdl index 342fd2f..96d0022 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -74,6 +74,7 @@ module Python version "$Revision$" -- the following expression can appear in assignment context | Attribute(expr value, identifier attr, expr_context ctx) | Subscript(expr value, slice slice, expr_context ctx) + | Starred(expr value, expr_context ctx) | Name(identifier id, expr_context ctx) | List(expr* elts, expr_context ctx) | Tuple(expr* elts, expr_context ctx) diff --git a/Python/Python-ast.c b/Python/Python-ast.c index e57b6a9..3644945 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -245,6 +245,11 @@ static char *Subscript_fields[]={ "slice", "ctx", }; +static PyTypeObject *Starred_type; +static char *Starred_fields[]={ + "value", + "ctx", +}; static PyTypeObject *Name_type; static char *Name_fields[]={ "id", @@ -571,6 +576,8 @@ static int init_types(void) if (!Attribute_type) return 0; Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3); if (!Subscript_type) return 0; + Starred_type = make_type("Starred", expr_type, Starred_fields, 2); + if (!Starred_type) return 0; Name_type = make_type("Name", expr_type, Name_fields, 2); if (!Name_type) return 0; List_type = make_type("List", expr_type, List_fields, 2); @@ -1662,6 +1669,32 @@ Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int } expr_ty +Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, PyArena + *arena) +{ + expr_ty p; + if (!value) { + PyErr_SetString(PyExc_ValueError, + "field value is required for Starred"); + return NULL; + } + if (!ctx) { + PyErr_SetString(PyExc_ValueError, + "field ctx is required for Starred"); + return NULL; + } + p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) + return NULL; + p->kind = Starred_kind; + p->v.Starred.value = value; + p->v.Starred.ctx = ctx; + p->lineno = lineno; + p->col_offset = col_offset; + return p; +} + +expr_ty Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena) { @@ -2606,6 +2639,20 @@ ast2obj_expr(void* _o) goto failed; Py_DECREF(value); break; + case Starred_kind: + result = PyType_GenericNew(Starred_type, NULL, NULL); + if (!result) goto failed; + value = ast2obj_expr(o->v.Starred.value); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "value", value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_expr_context(o->v.Starred.ctx); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "ctx", value) == -1) + goto failed; + Py_DECREF(value); + break; case Name_kind: result = PyType_GenericNew(Name_type, NULL, NULL); if (!result) goto failed; @@ -3180,6 +3227,8 @@ init_ast(void) 0) return; if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) < 0) return; + if (PyDict_SetItemString(d, "Starred", (PyObject*)Starred_type) < 0) + return; if (PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return; if (PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return; if (PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return; diff --git a/Python/ast.c b/Python/ast.c index a0c1812..6f62b6c 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -355,6 +355,11 @@ set_context(expr_ty e, expr_context_ty ctx, const node *n) case Subscript_kind: e->v.Subscript.ctx = ctx; break; + case Starred_kind: + e->v.Starred.ctx = ctx; + if (!set_context(e->v.Starred.value, ctx, n)) + return 0; + break; case Name_kind: if (ctx == Store && !strcmp(PyString_AS_STRING(e->v.Name.id), "None")) { @@ -392,6 +397,9 @@ set_context(expr_ty e, expr_context_ty ctx, const node *n) case ListComp_kind: expr_name = "list comprehension"; break; + case SetComp_kind: + expr_name = "set comprehension"; + break; case Dict_kind: case Set_kind: case Num_kind: @@ -1661,6 +1669,21 @@ ast_for_power(struct compiling *c, const node *n) return e; } +static expr_ty +ast_for_starred(struct compiling *c, const node *n) +{ + expr_ty tmp; + REQ(n, star_expr); + + tmp = ast_for_expr(c, CHILD(n, 1)); + if (!tmp) + return NULL; + + /* The Load context is changed later. */ + return Starred(tmp, Load, LINENO(n), n->n_col_offset, c->c_arena); +} + + /* Do not name a variable 'expr'! Will cause a compile error. */ @@ -1772,6 +1795,11 @@ ast_for_expr(struct compiling *c, const node *n) } break; + case star_expr: + if (TYPE(CHILD(n, 0)) == STAR) { + return ast_for_starred(c, n); + } + /* Fallthrough */ /* The next five cases all handle BinOps. The main body of code is the same in each case, but the switch turned inside out to reuse the code for each type of operator. diff --git a/Python/ceval.c b/Python/ceval.c index 00fc050..73e7ea9 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -477,7 +477,7 @@ enum why_code { }; static enum why_code do_raise(PyObject *, PyObject *, PyObject *); -static int unpack_iterable(PyObject *, int, PyObject **); +static int unpack_iterable(PyObject *, int, int, PyObject **); /* for manipulating the thread switch and periodic "stuff" - used to be per thread, now just a pair o' globals */ @@ -1656,7 +1656,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) Py_INCREF(w); PUSH(w); } - } else if (unpack_iterable(v, oparg, + } else if (unpack_iterable(v, oparg, -1, stack_pointer + oparg)) { stack_pointer += oparg; } else { @@ -1666,6 +1666,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) Py_DECREF(v); break; + case UNPACK_EX: + { + int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); + v = POP(); + + if (unpack_iterable(v, oparg & 0xFF, oparg >> 8, + stack_pointer + totalargs)) { + stack_pointer += totalargs; + } else { + why = WHY_EXCEPTION; + } + Py_DECREF(v); + break; + } + case STORE_ATTR: w = GETITEM(names, oparg); v = TOP(); @@ -3077,14 +3092,20 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) } /* Iterate v argcnt times and store the results on the stack (via decreasing - sp). Return 1 for success, 0 if error. */ + sp). Return 1 for success, 0 if error. + + If argcntafter == -1, do a simple unpack. If it is >= 0, do an unpack + with a variable target. +*/ static int -unpack_iterable(PyObject *v, int argcnt, PyObject **sp) +unpack_iterable(PyObject *v, int argcnt, int argcntafter, PyObject **sp) { - int i = 0; + int i = 0, j = 0; + Py_ssize_t ll = 0; PyObject *it; /* iter(v) */ PyObject *w; + PyObject *l = NULL; /* variable list */ assert(v != NULL); @@ -3106,17 +3127,42 @@ unpack_iterable(PyObject *v, int argcnt, PyObject **sp) *--sp = w; } - /* We better have exhausted the iterator now. */ - w = PyIter_Next(it); - if (w == NULL) { - if (PyErr_Occurred()) - goto Error; - Py_DECREF(it); - return 1; + if (argcntafter == -1) { + /* We better have exhausted the iterator now. */ + w = PyIter_Next(it); + if (w == NULL) { + if (PyErr_Occurred()) + goto Error; + Py_DECREF(it); + return 1; + } + Py_DECREF(w); + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); + goto Error; } - Py_DECREF(w); - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); - /* fall through */ + + l = PySequence_List(it); + if (l == NULL) + goto Error; + *--sp = l; + i++; + + ll = PyList_GET_SIZE(l); + if (ll < argcntafter) { + PyErr_Format(PyExc_ValueError, "need more than %zd values to unpack", + argcnt + ll); + goto Error; + } + + /* Pop the "after-variable" args off the list. */ + for (j = argcntafter; j > 0; j--, i++) { + *--sp = PyList_GET_ITEM(l, ll - j); + } + /* Resize the list. */ + ((PyListObject *)l)->ob_size = ll - argcntafter; + Py_DECREF(it); + return 1; + Error: for (; i > 0; i--, sp++) Py_DECREF(*sp); diff --git a/Python/compile.c b/Python/compile.c index ebb19f5..1ddec2c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -786,6 +786,8 @@ opcode_stack_effect(int opcode, int oparg) return 0; case UNPACK_SEQUENCE: return oparg-1; + case UNPACK_EX: + return (oparg&0xFF) + (oparg>>8); case FOR_ITER: return 1; @@ -2617,7 +2619,21 @@ compiler_list(struct compiler *c, expr_ty e) { int n = asdl_seq_LEN(e->v.List.elts); if (e->v.List.ctx == Store) { - ADDOP_I(c, UNPACK_SEQUENCE, n); + int i, seen_star = 0; + for (i = 0; i < n; i++) { + expr_ty elt = asdl_seq_GET(e->v.List.elts, i); + if (elt->kind == Starred_kind && !seen_star) { + ADDOP_I(c, UNPACK_EX, (i + ((n-i-1) << 8))); + seen_star = 1; + asdl_seq_SET(e->v.List.elts, i, elt->v.Starred.value); + } else if (elt->kind == Starred_kind) { + return compiler_error(c, + "two starred expressions in assignment"); + } + } + if (!seen_star) { + ADDOP_I(c, UNPACK_SEQUENCE, n); + } } VISIT_SEQ(c, expr, e->v.List.elts); if (e->v.List.ctx == Load) { @@ -2631,7 +2647,21 @@ compiler_tuple(struct compiler *c, expr_ty e) { int n = asdl_seq_LEN(e->v.Tuple.elts); if (e->v.Tuple.ctx == Store) { - ADDOP_I(c, UNPACK_SEQUENCE, n); + int i, seen_star = 0; + for (i = 0; i < n; i++) { + expr_ty elt = asdl_seq_GET(e->v.Tuple.elts, i); + if (elt->kind == Starred_kind && !seen_star) { + ADDOP_I(c, UNPACK_EX, (i + ((n-i-1) << 8))); + seen_star = 1; + asdl_seq_SET(e->v.Tuple.elts, i, elt->v.Starred.value); + } else if (elt->kind == Starred_kind) { + return compiler_error(c, + "two starred expressions in assignment"); + } + } + if (!seen_star) { + ADDOP_I(c, UNPACK_SEQUENCE, n); + } } VISIT_SEQ(c, expr, e->v.Tuple.elts); if (e->v.Tuple.ctx == Load) { @@ -3257,6 +3287,18 @@ compiler_visit_expr(struct compiler *c, expr_ty e) return 0; } break; + case Starred_kind: + switch (e->v.Starred.ctx) { + case Store: + /* In all legitimate cases, the Starred node was already replaced + * by compiler_list/compiler_tuple. XXX: is that okay? */ + return compiler_error(c, + "starred assignment target must be in a list or tuple"); + default: + return compiler_error(c, + "can use starred expression only as assignment target"); + } + break; case Name_kind: return compiler_nameop(c, e->v.Name.id, e->v.Name.ctx); /* child nodes of List and Tuple will have expr_context set */ diff --git a/Python/graminit.c b/Python/graminit.c index df35d51..bb62d0c 100644 --- a/Python/graminit.c +++ b/Python/graminit.c @@ -1184,10 +1184,10 @@ static state states_54[3] = { {1, arcs_54_2}, }; static arc arcs_55_0[1] = { - {104, 1}, + {119, 1}, }; static arc arcs_55_1[2] = { - {119, 0}, + {120, 0}, {0, 1}, }; static state states_55[2] = { @@ -1195,15 +1195,15 @@ static state states_55[2] = { {2, arcs_55_1}, }; static arc arcs_56_0[9] = { - {120, 1}, {121, 1}, {122, 1}, {123, 1}, {124, 1}, {125, 1}, + {126, 1}, {98, 1}, {117, 2}, - {126, 3}, + {127, 3}, }; static arc arcs_56_1[1] = { {0, 1}, @@ -1221,22 +1221,26 @@ static state states_56[4] = { {1, arcs_56_2}, {2, arcs_56_3}, }; -static arc arcs_57_0[1] = { - {127, 1}, +static arc arcs_57_0[2] = { + {29, 1}, + {104, 2}, }; -static arc arcs_57_1[2] = { - {128, 0}, - {0, 1}, +static arc arcs_57_1[1] = { + {104, 2}, }; -static state states_57[2] = { - {1, arcs_57_0}, - {2, arcs_57_1}, +static arc arcs_57_2[1] = { + {0, 2}, +}; +static state states_57[3] = { + {2, arcs_57_0}, + {1, arcs_57_1}, + {1, arcs_57_2}, }; static arc arcs_58_0[1] = { - {129, 1}, + {128, 1}, }; static arc arcs_58_1[2] = { - {130, 0}, + {129, 0}, {0, 1}, }; static state states_58[2] = { @@ -1244,10 +1248,10 @@ static state states_58[2] = { {2, arcs_58_1}, }; static arc arcs_59_0[1] = { - {131, 1}, + {130, 1}, }; static arc arcs_59_1[2] = { - {132, 0}, + {131, 0}, {0, 1}, }; static state states_59[2] = { @@ -1255,23 +1259,22 @@ static state states_59[2] = { {2, arcs_59_1}, }; static arc arcs_60_0[1] = { - {133, 1}, + {132, 1}, }; -static arc arcs_60_1[3] = { - {134, 0}, - {135, 0}, +static arc arcs_60_1[2] = { + {133, 0}, {0, 1}, }; static state states_60[2] = { {1, arcs_60_0}, - {3, arcs_60_1}, + {2, arcs_60_1}, }; static arc arcs_61_0[1] = { - {136, 1}, + {134, 1}, }; static arc arcs_61_1[3] = { - {137, 0}, - {138, 0}, + {135, 0}, + {136, 0}, {0, 1}, }; static state states_61[2] = { @@ -1279,247 +1282,243 @@ static state states_61[2] = { {3, arcs_61_1}, }; static arc arcs_62_0[1] = { - {139, 1}, + {137, 1}, +}; +static arc arcs_62_1[3] = { + {138, 0}, + {139, 0}, + {0, 1}, +}; +static state states_62[2] = { + {1, arcs_62_0}, + {3, arcs_62_1}, +}; +static arc arcs_63_0[1] = { + {140, 1}, }; -static arc arcs_62_1[5] = { +static arc arcs_63_1[5] = { {29, 0}, - {140, 0}, {141, 0}, {142, 0}, + {143, 0}, {0, 1}, }; -static state states_62[2] = { - {1, arcs_62_0}, - {5, arcs_62_1}, +static state states_63[2] = { + {1, arcs_63_0}, + {5, arcs_63_1}, }; -static arc arcs_63_0[4] = { - {137, 1}, +static arc arcs_64_0[4] = { {138, 1}, - {143, 1}, - {144, 2}, + {139, 1}, + {144, 1}, + {145, 2}, }; -static arc arcs_63_1[1] = { - {139, 2}, +static arc arcs_64_1[1] = { + {140, 2}, }; -static arc arcs_63_2[1] = { +static arc arcs_64_2[1] = { {0, 2}, }; -static state states_63[3] = { - {4, arcs_63_0}, - {1, arcs_63_1}, - {1, arcs_63_2}, -}; -static arc arcs_64_0[1] = { - {145, 1}, +static state states_64[3] = { + {4, arcs_64_0}, + {1, arcs_64_1}, + {1, arcs_64_2}, }; -static arc arcs_64_1[3] = { +static arc arcs_65_0[1] = { {146, 1}, +}; +static arc arcs_65_1[3] = { + {147, 1}, {31, 2}, {0, 1}, }; -static arc arcs_64_2[1] = { - {139, 3}, +static arc arcs_65_2[1] = { + {140, 3}, }; -static arc arcs_64_3[1] = { +static arc arcs_65_3[1] = { {0, 3}, }; -static state states_64[4] = { - {1, arcs_64_0}, - {3, arcs_64_1}, - {1, arcs_64_2}, - {1, arcs_64_3}, +static state states_65[4] = { + {1, arcs_65_0}, + {3, arcs_65_1}, + {1, arcs_65_2}, + {1, arcs_65_3}, }; -static arc arcs_65_0[7] = { +static arc arcs_66_0[7] = { {13, 1}, - {148, 2}, - {150, 3}, + {149, 2}, + {151, 3}, {19, 4}, - {153, 4}, - {154, 5}, + {154, 4}, + {155, 5}, {79, 4}, }; -static arc arcs_65_1[3] = { +static arc arcs_66_1[3] = { {48, 6}, - {147, 6}, + {148, 6}, {15, 4}, }; -static arc arcs_65_2[2] = { - {147, 7}, - {149, 4}, +static arc arcs_66_2[2] = { + {148, 7}, + {150, 4}, }; -static arc arcs_65_3[2] = { - {151, 8}, - {152, 4}, +static arc arcs_66_3[2] = { + {152, 8}, + {153, 4}, }; -static arc arcs_65_4[1] = { +static arc arcs_66_4[1] = { {0, 4}, }; -static arc arcs_65_5[2] = { - {154, 5}, +static arc arcs_66_5[2] = { + {155, 5}, {0, 5}, }; -static arc arcs_65_6[1] = { +static arc arcs_66_6[1] = { {15, 4}, }; -static arc arcs_65_7[1] = { - {149, 4}, +static arc arcs_66_7[1] = { + {150, 4}, }; -static arc arcs_65_8[1] = { - {152, 4}, +static arc arcs_66_8[1] = { + {153, 4}, }; -static state states_65[9] = { - {7, arcs_65_0}, - {3, arcs_65_1}, - {2, arcs_65_2}, - {2, arcs_65_3}, - {1, arcs_65_4}, - {2, arcs_65_5}, - {1, arcs_65_6}, - {1, arcs_65_7}, - {1, arcs_65_8}, -}; -static arc arcs_66_0[1] = { +static state states_66[9] = { + {7, arcs_66_0}, + {3, arcs_66_1}, + {2, arcs_66_2}, + {2, arcs_66_3}, + {1, arcs_66_4}, + {2, arcs_66_5}, + {1, arcs_66_6}, + {1, arcs_66_7}, + {1, arcs_66_8}, +}; +static arc arcs_67_0[1] = { {22, 1}, }; -static arc arcs_66_1[3] = { - {155, 2}, +static arc arcs_67_1[3] = { + {156, 2}, {28, 3}, {0, 1}, }; -static arc arcs_66_2[1] = { +static arc arcs_67_2[1] = { {0, 2}, }; -static arc arcs_66_3[2] = { +static arc arcs_67_3[2] = { {22, 4}, {0, 3}, }; -static arc arcs_66_4[2] = { +static arc arcs_67_4[2] = { {28, 3}, {0, 4}, }; -static state states_66[5] = { - {1, arcs_66_0}, - {3, arcs_66_1}, - {1, arcs_66_2}, - {2, arcs_66_3}, - {2, arcs_66_4}, +static state states_67[5] = { + {1, arcs_67_0}, + {3, arcs_67_1}, + {1, arcs_67_2}, + {2, arcs_67_3}, + {2, arcs_67_4}, }; -static arc arcs_67_0[3] = { +static arc arcs_68_0[3] = { {13, 1}, - {148, 2}, + {149, 2}, {78, 3}, }; -static arc arcs_67_1[2] = { +static arc arcs_68_1[2] = { {14, 4}, {15, 5}, }; -static arc arcs_67_2[1] = { - {156, 6}, +static arc arcs_68_2[1] = { + {157, 6}, }; -static arc arcs_67_3[1] = { +static arc arcs_68_3[1] = { {19, 5}, }; -static arc arcs_67_4[1] = { +static arc arcs_68_4[1] = { {15, 5}, }; -static arc arcs_67_5[1] = { +static arc arcs_68_5[1] = { {0, 5}, }; -static arc arcs_67_6[1] = { - {149, 5}, +static arc arcs_68_6[1] = { + {150, 5}, }; -static state states_67[7] = { - {3, arcs_67_0}, - {2, arcs_67_1}, - {1, arcs_67_2}, - {1, arcs_67_3}, - {1, arcs_67_4}, - {1, arcs_67_5}, - {1, arcs_67_6}, +static state states_68[7] = { + {3, arcs_68_0}, + {2, arcs_68_1}, + {1, arcs_68_2}, + {1, arcs_68_3}, + {1, arcs_68_4}, + {1, arcs_68_5}, + {1, arcs_68_6}, }; -static arc arcs_68_0[1] = { - {157, 1}, +static arc arcs_69_0[1] = { + {158, 1}, }; -static arc arcs_68_1[2] = { +static arc arcs_69_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_68_2[2] = { - {157, 1}, +static arc arcs_69_2[2] = { + {158, 1}, {0, 2}, }; -static state states_68[3] = { - {1, arcs_68_0}, - {2, arcs_68_1}, - {2, arcs_68_2}, +static state states_69[3] = { + {1, arcs_69_0}, + {2, arcs_69_1}, + {2, arcs_69_2}, }; -static arc arcs_69_0[2] = { +static arc arcs_70_0[2] = { {22, 1}, {23, 2}, }; -static arc arcs_69_1[2] = { +static arc arcs_70_1[2] = { {23, 2}, {0, 1}, }; -static arc arcs_69_2[3] = { +static arc arcs_70_2[3] = { {22, 3}, - {158, 4}, + {159, 4}, {0, 2}, }; -static arc arcs_69_3[2] = { - {158, 4}, +static arc arcs_70_3[2] = { + {159, 4}, {0, 3}, }; -static arc arcs_69_4[1] = { +static arc arcs_70_4[1] = { {0, 4}, }; -static state states_69[5] = { - {2, arcs_69_0}, - {2, arcs_69_1}, - {3, arcs_69_2}, - {2, arcs_69_3}, - {1, arcs_69_4}, -}; -static arc arcs_70_0[1] = { - {23, 1}, -}; -static arc arcs_70_1[2] = { - {22, 2}, - {0, 1}, -}; -static arc arcs_70_2[1] = { - {0, 2}, -}; -static state states_70[3] = { - {1, arcs_70_0}, +static state states_70[5] = { + {2, arcs_70_0}, {2, arcs_70_1}, - {1, arcs_70_2}, + {3, arcs_70_2}, + {2, arcs_70_3}, + {1, arcs_70_4}, }; static arc arcs_71_0[1] = { - {104, 1}, + {23, 1}, }; static arc arcs_71_1[2] = { - {28, 2}, + {22, 2}, {0, 1}, }; -static arc arcs_71_2[2] = { - {104, 1}, +static arc arcs_71_2[1] = { {0, 2}, }; static state states_71[3] = { {1, arcs_71_0}, {2, arcs_71_1}, - {2, arcs_71_2}, + {1, arcs_71_2}, }; static arc arcs_72_0[1] = { - {22, 1}, + {119, 1}, }; static arc arcs_72_1[2] = { {28, 2}, {0, 1}, }; static arc arcs_72_2[2] = { - {22, 1}, + {119, 1}, {0, 2}, }; static state states_72[3] = { @@ -1530,245 +1529,261 @@ static state states_72[3] = { static arc arcs_73_0[1] = { {22, 1}, }; -static arc arcs_73_1[4] = { +static arc arcs_73_1[2] = { + {28, 2}, + {0, 1}, +}; +static arc arcs_73_2[2] = { + {22, 1}, + {0, 2}, +}; +static state states_73[3] = { + {1, arcs_73_0}, + {2, arcs_73_1}, + {2, arcs_73_2}, +}; +static arc arcs_74_0[1] = { + {22, 1}, +}; +static arc arcs_74_1[4] = { {23, 2}, - {155, 3}, + {156, 3}, {28, 4}, {0, 1}, }; -static arc arcs_73_2[1] = { +static arc arcs_74_2[1] = { {22, 5}, }; -static arc arcs_73_3[1] = { +static arc arcs_74_3[1] = { {0, 3}, }; -static arc arcs_73_4[2] = { +static arc arcs_74_4[2] = { {22, 6}, {0, 4}, }; -static arc arcs_73_5[2] = { +static arc arcs_74_5[2] = { {28, 7}, {0, 5}, }; -static arc arcs_73_6[2] = { +static arc arcs_74_6[2] = { {28, 4}, {0, 6}, }; -static arc arcs_73_7[2] = { +static arc arcs_74_7[2] = { {22, 8}, {0, 7}, }; -static arc arcs_73_8[1] = { +static arc arcs_74_8[1] = { {23, 2}, }; -static state states_73[9] = { - {1, arcs_73_0}, - {4, arcs_73_1}, - {1, arcs_73_2}, - {1, arcs_73_3}, - {2, arcs_73_4}, - {2, arcs_73_5}, - {2, arcs_73_6}, - {2, arcs_73_7}, - {1, arcs_73_8}, -}; -static arc arcs_74_0[1] = { - {159, 1}, +static state states_74[9] = { + {1, arcs_74_0}, + {4, arcs_74_1}, + {1, arcs_74_2}, + {1, arcs_74_3}, + {2, arcs_74_4}, + {2, arcs_74_5}, + {2, arcs_74_6}, + {2, arcs_74_7}, + {1, arcs_74_8}, +}; +static arc arcs_75_0[1] = { + {160, 1}, }; -static arc arcs_74_1[1] = { +static arc arcs_75_1[1] = { {19, 2}, }; -static arc arcs_74_2[2] = { +static arc arcs_75_2[2] = { {13, 3}, {23, 4}, }; -static arc arcs_74_3[2] = { +static arc arcs_75_3[2] = { {14, 5}, {15, 6}, }; -static arc arcs_74_4[1] = { +static arc arcs_75_4[1] = { {24, 7}, }; -static arc arcs_74_5[1] = { +static arc arcs_75_5[1] = { {15, 6}, }; -static arc arcs_74_6[1] = { +static arc arcs_75_6[1] = { {23, 4}, }; -static arc arcs_74_7[1] = { +static arc arcs_75_7[1] = { {0, 7}, }; -static state states_74[8] = { - {1, arcs_74_0}, - {1, arcs_74_1}, - {2, arcs_74_2}, - {2, arcs_74_3}, - {1, arcs_74_4}, - {1, arcs_74_5}, - {1, arcs_74_6}, - {1, arcs_74_7}, -}; -static arc arcs_75_0[3] = { - {160, 1}, +static state states_75[8] = { + {1, arcs_75_0}, + {1, arcs_75_1}, + {2, arcs_75_2}, + {2, arcs_75_3}, + {1, arcs_75_4}, + {1, arcs_75_5}, + {1, arcs_75_6}, + {1, arcs_75_7}, +}; +static arc arcs_76_0[3] = { + {161, 1}, {29, 2}, {31, 3}, }; -static arc arcs_75_1[2] = { +static arc arcs_76_1[2] = { {28, 4}, {0, 1}, }; -static arc arcs_75_2[1] = { +static arc arcs_76_2[1] = { {22, 5}, }; -static arc arcs_75_3[1] = { +static arc arcs_76_3[1] = { {22, 6}, }; -static arc arcs_75_4[4] = { - {160, 1}, +static arc arcs_76_4[4] = { + {161, 1}, {29, 2}, {31, 3}, {0, 4}, }; -static arc arcs_75_5[2] = { +static arc arcs_76_5[2] = { {28, 7}, {0, 5}, }; -static arc arcs_75_6[1] = { +static arc arcs_76_6[1] = { {0, 6}, }; -static arc arcs_75_7[1] = { +static arc arcs_76_7[1] = { {31, 3}, }; -static state states_75[8] = { - {3, arcs_75_0}, - {2, arcs_75_1}, - {1, arcs_75_2}, - {1, arcs_75_3}, - {4, arcs_75_4}, - {2, arcs_75_5}, - {1, arcs_75_6}, - {1, arcs_75_7}, +static state states_76[8] = { + {3, arcs_76_0}, + {2, arcs_76_1}, + {1, arcs_76_2}, + {1, arcs_76_3}, + {4, arcs_76_4}, + {2, arcs_76_5}, + {1, arcs_76_6}, + {1, arcs_76_7}, }; -static arc arcs_76_0[1] = { +static arc arcs_77_0[1] = { {22, 1}, }; -static arc arcs_76_1[3] = { - {155, 2}, +static arc arcs_77_1[3] = { + {156, 2}, {27, 3}, {0, 1}, }; -static arc arcs_76_2[1] = { +static arc arcs_77_2[1] = { {0, 2}, }; -static arc arcs_76_3[1] = { +static arc arcs_77_3[1] = { {22, 2}, }; -static state states_76[4] = { - {1, arcs_76_0}, - {3, arcs_76_1}, - {1, arcs_76_2}, - {1, arcs_76_3}, +static state states_77[4] = { + {1, arcs_77_0}, + {3, arcs_77_1}, + {1, arcs_77_2}, + {1, arcs_77_3}, }; -static arc arcs_77_0[2] = { - {155, 1}, - {162, 1}, +static arc arcs_78_0[2] = { + {156, 1}, + {163, 1}, }; -static arc arcs_77_1[1] = { +static arc arcs_78_1[1] = { {0, 1}, }; -static state states_77[2] = { - {2, arcs_77_0}, - {1, arcs_77_1}, +static state states_78[2] = { + {2, arcs_78_0}, + {1, arcs_78_1}, }; -static arc arcs_78_0[1] = { +static arc arcs_79_0[1] = { {97, 1}, }; -static arc arcs_78_1[1] = { +static arc arcs_79_1[1] = { {62, 2}, }; -static arc arcs_78_2[1] = { +static arc arcs_79_2[1] = { {98, 3}, }; -static arc arcs_78_3[1] = { +static arc arcs_79_3[1] = { {108, 4}, }; -static arc arcs_78_4[2] = { - {161, 5}, +static arc arcs_79_4[2] = { + {162, 5}, {0, 4}, }; -static arc arcs_78_5[1] = { +static arc arcs_79_5[1] = { {0, 5}, }; -static state states_78[6] = { - {1, arcs_78_0}, - {1, arcs_78_1}, - {1, arcs_78_2}, - {1, arcs_78_3}, - {2, arcs_78_4}, - {1, arcs_78_5}, +static state states_79[6] = { + {1, arcs_79_0}, + {1, arcs_79_1}, + {1, arcs_79_2}, + {1, arcs_79_3}, + {2, arcs_79_4}, + {1, arcs_79_5}, }; -static arc arcs_79_0[1] = { +static arc arcs_80_0[1] = { {93, 1}, }; -static arc arcs_79_1[1] = { +static arc arcs_80_1[1] = { {110, 2}, }; -static arc arcs_79_2[2] = { - {161, 3}, +static arc arcs_80_2[2] = { + {162, 3}, {0, 2}, }; -static arc arcs_79_3[1] = { +static arc arcs_80_3[1] = { {0, 3}, }; -static state states_79[4] = { - {1, arcs_79_0}, - {1, arcs_79_1}, - {2, arcs_79_2}, - {1, arcs_79_3}, +static state states_80[4] = { + {1, arcs_80_0}, + {1, arcs_80_1}, + {2, arcs_80_2}, + {1, arcs_80_3}, }; -static arc arcs_80_0[1] = { +static arc arcs_81_0[1] = { {22, 1}, }; -static arc arcs_80_1[2] = { +static arc arcs_81_1[2] = { {28, 0}, {0, 1}, }; -static state states_80[2] = { - {1, arcs_80_0}, - {2, arcs_80_1}, +static state states_81[2] = { + {1, arcs_81_0}, + {2, arcs_81_1}, }; -static arc arcs_81_0[1] = { +static arc arcs_82_0[1] = { {19, 1}, }; -static arc arcs_81_1[1] = { +static arc arcs_82_1[1] = { {0, 1}, }; -static state states_81[2] = { - {1, arcs_81_0}, - {1, arcs_81_1}, +static state states_82[2] = { + {1, arcs_82_0}, + {1, arcs_82_1}, }; -static arc arcs_82_0[1] = { - {165, 1}, +static arc arcs_83_0[1] = { + {166, 1}, }; -static arc arcs_82_1[2] = { +static arc arcs_83_1[2] = { {9, 2}, {0, 1}, }; -static arc arcs_82_2[1] = { +static arc arcs_83_2[1] = { {0, 2}, }; -static state states_82[3] = { - {1, arcs_82_0}, - {2, arcs_82_1}, - {1, arcs_82_2}, +static state states_83[3] = { + {1, arcs_83_0}, + {2, arcs_83_1}, + {1, arcs_83_2}, }; -static dfa dfas[83] = { +static dfa dfas[84] = { {256, "single_input", 0, 3, states_0, - "\004\050\014\000\000\000\000\240\340\251\160\040\113\000\041\000\000\206\120\206\040"}, + "\004\050\014\040\000\000\000\240\340\251\160\040\113\000\041\000\000\014\241\014\101"}, {257, "file_input", 0, 2, states_1, - "\204\050\014\000\000\000\000\240\340\251\160\040\113\000\041\000\000\206\120\206\040"}, + "\204\050\014\040\000\000\000\240\340\251\160\040\113\000\041\000\000\014\241\014\101"}, {258, "eval_input", 0, 3, states_2, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, {259, "decorator", 0, 7, states_3, "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "decorators", 0, 2, states_4, @@ -1794,13 +1809,13 @@ static dfa dfas[83] = { {270, "vfplist", 0, 3, states_14, "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {271, "stmt", 0, 2, states_15, - "\000\050\014\000\000\000\000\240\340\251\160\040\113\000\041\000\000\206\120\206\040"}, + "\000\050\014\040\000\000\000\240\340\251\160\040\113\000\041\000\000\014\241\014\101"}, {272, "simple_stmt", 0, 4, states_16, - "\000\040\010\000\000\000\000\240\340\251\160\000\000\000\041\000\000\206\120\006\040"}, + "\000\040\010\040\000\000\000\240\340\251\160\000\000\000\041\000\000\014\241\014\100"}, {273, "small_stmt", 0, 2, states_17, - "\000\040\010\000\000\000\000\240\340\251\160\000\000\000\041\000\000\206\120\006\040"}, + "\000\040\010\040\000\000\000\240\340\251\160\000\000\000\041\000\000\014\241\014\100"}, {274, "expr_stmt", 0, 6, states_18, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, {275, "augassign", 0, 2, states_19, "\000\000\000\000\000\000\376\037\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {276, "del_stmt", 0, 3, states_20, @@ -1808,7 +1823,7 @@ static dfa dfas[83] = { {277, "pass_stmt", 0, 2, states_21, "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {278, "flow_stmt", 0, 2, states_22, - "\000\000\000\000\000\000\000\000\340\001\000\000\000\000\000\000\000\000\000\000\040"}, + "\000\000\000\000\000\000\000\000\340\001\000\000\000\000\000\000\000\000\000\000\100"}, {279, "break_stmt", 0, 2, states_23, "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, {280, "continue_stmt", 0, 2, states_24, @@ -1816,7 +1831,7 @@ static dfa dfas[83] = { {281, "return_stmt", 0, 3, states_25, "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000"}, {282, "yield_stmt", 0, 2, states_26, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100"}, {283, "raise_stmt", 0, 7, states_27, "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000"}, {284, "import_stmt", 0, 2, states_28, @@ -1842,7 +1857,7 @@ static dfa dfas[83] = { {294, "assert_stmt", 0, 5, states_38, "\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000"}, {295, "compound_stmt", 0, 2, states_39, - "\000\010\004\000\000\000\000\000\000\000\000\040\113\000\000\000\000\000\000\200\000"}, + "\000\010\004\000\000\000\000\000\000\000\000\040\113\000\000\000\000\000\000\000\001"}, {296, "if_stmt", 0, 8, states_40, "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, {297, "while_stmt", 0, 8, states_41, @@ -1858,79 +1873,81 @@ static dfa dfas[83] = { {302, "except_clause", 0, 5, states_46, "\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000"}, {303, "suite", 0, 5, states_47, - "\004\040\010\000\000\000\000\240\340\251\160\000\000\000\041\000\000\206\120\006\040"}, + "\004\040\010\040\000\000\000\240\340\251\160\000\000\000\041\000\000\014\241\014\100"}, {304, "test", 0, 6, states_48, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, {305, "test_nocond", 0, 2, states_49, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, {306, "lambdef", 0, 5, states_50, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000"}, {307, "lambdef_nocond", 0, 5, states_51, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000"}, {308, "or_test", 0, 2, states_52, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\040\000\000\206\120\006\000"}, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\040\000\000\014\241\014\000"}, {309, "and_test", 0, 2, states_53, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\040\000\000\206\120\006\000"}, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\040\000\000\014\241\014\000"}, {310, "not_test", 0, 3, states_54, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\040\000\000\206\120\006\000"}, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\040\000\000\014\241\014\000"}, {311, "comparison", 0, 2, states_55, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, {312, "comp_op", 0, 4, states_56, - "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\040\177\000\000\000\000\000"}, - {313, "expr", 0, 2, states_57, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, - {314, "xor_expr", 0, 2, states_58, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, - {315, "and_expr", 0, 2, states_59, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, - {316, "shift_expr", 0, 2, states_60, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, - {317, "arith_expr", 0, 2, states_61, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, - {318, "term", 0, 2, states_62, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, - {319, "factor", 0, 3, states_63, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, - {320, "power", 0, 4, states_64, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\006\000"}, - {321, "atom", 0, 9, states_65, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\006\000"}, - {322, "testlist_comp", 0, 5, states_66, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, - {323, "trailer", 0, 7, states_67, - "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\020\000\000"}, - {324, "subscriptlist", 0, 3, states_68, - "\000\040\210\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, - {325, "subscript", 0, 5, states_69, - "\000\040\210\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, - {326, "sliceop", 0, 3, states_70, + "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\040\376\000\000\000\000\000"}, + {313, "star_expr", 0, 3, states_57, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {314, "expr", 0, 2, states_58, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {315, "xor_expr", 0, 2, states_59, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {316, "and_expr", 0, 2, states_60, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {317, "shift_expr", 0, 2, states_61, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {318, "arith_expr", 0, 2, states_62, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {319, "term", 0, 2, states_63, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {320, "factor", 0, 3, states_64, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {321, "power", 0, 4, states_65, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\240\014\000"}, + {322, "atom", 0, 9, states_66, + "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\240\014\000"}, + {323, "testlist_comp", 0, 5, states_67, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + {324, "trailer", 0, 7, states_68, + "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\040\000\000"}, + {325, "subscriptlist", 0, 3, states_69, + "\000\040\210\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + {326, "subscript", 0, 5, states_70, + "\000\040\210\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + {327, "sliceop", 0, 3, states_71, "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {327, "exprlist", 0, 3, states_71, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\006\000"}, - {328, "testlist", 0, 3, states_72, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, - {329, "dictorsetmaker", 0, 9, states_73, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, - {330, "classdef", 0, 8, states_74, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, - {331, "arglist", 0, 8, states_75, - "\000\040\010\240\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, - {332, "argument", 0, 4, states_76, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, - {333, "comp_iter", 0, 2, states_77, + {328, "exprlist", 0, 3, states_72, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, + {329, "testlist", 0, 3, states_73, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + {330, "dictorsetmaker", 0, 9, states_74, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + {331, "classdef", 0, 8, states_75, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"}, + {332, "arglist", 0, 8, states_76, + "\000\040\010\240\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + {333, "argument", 0, 4, states_77, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + {334, "comp_iter", 0, 2, states_78, "\000\000\000\000\000\000\000\000\000\000\000\040\002\000\000\000\000\000\000\000\000"}, - {334, "comp_for", 0, 6, states_78, + {335, "comp_for", 0, 6, states_79, "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"}, - {335, "comp_if", 0, 4, states_79, + {336, "comp_if", 0, 4, states_80, "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, - {336, "testlist1", 0, 2, states_80, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\041\000\000\206\120\006\000"}, - {337, "encoding_decl", 0, 2, states_81, + {337, "testlist1", 0, 2, states_81, + "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + {338, "encoding_decl", 0, 2, states_82, "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {338, "yield_expr", 0, 3, states_82, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040"}, + {339, "yield_expr", 0, 3, states_83, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100"}, }; -static label labels[166] = { +static label labels[167] = { {0, "EMPTY"}, {256, 0}, {4, 0}, @@ -1940,12 +1957,12 @@ static label labels[166] = { {271, 0}, {0, 0}, {258, 0}, - {328, 0}, + {329, 0}, {259, 0}, {50, 0}, {291, 0}, {7, 0}, - {331, 0}, + {332, 0}, {8, 0}, {260, 0}, {261, 0}, @@ -1979,7 +1996,7 @@ static label labels[166] = { {293, 0}, {294, 0}, {275, 0}, - {338, 0}, + {339, 0}, {37, 0}, {38, 0}, {39, 0}, @@ -1993,7 +2010,7 @@ static label labels[166] = { {47, 0}, {49, 0}, {1, "del"}, - {327, 0}, + {328, 0}, {1, "pass"}, {279, 0}, {280, 0}, @@ -2023,7 +2040,7 @@ static label labels[166] = { {298, 0}, {299, 0}, {300, 0}, - {330, 0}, + {331, 0}, {1, "if"}, {1, "elif"}, {1, "else"}, @@ -2035,7 +2052,7 @@ static label labels[166] = { {1, "finally"}, {1, "with"}, {301, 0}, - {313, 0}, + {314, 0}, {1, "except"}, {5, 0}, {6, 0}, @@ -2050,6 +2067,7 @@ static label labels[166] = { {1, "and"}, {1, "not"}, {311, 0}, + {313, 0}, {312, 0}, {20, 0}, {21, 0}, @@ -2058,49 +2076,49 @@ static label labels[166] = { {30, 0}, {29, 0}, {1, "is"}, - {314, 0}, - {18, 0}, {315, 0}, - {33, 0}, + {18, 0}, {316, 0}, - {19, 0}, + {33, 0}, {317, 0}, + {19, 0}, + {318, 0}, {34, 0}, {35, 0}, - {318, 0}, + {319, 0}, {14, 0}, {15, 0}, - {319, 0}, + {320, 0}, {17, 0}, {24, 0}, {48, 0}, {32, 0}, - {320, 0}, {321, 0}, - {323, 0}, {322, 0}, + {324, 0}, + {323, 0}, {9, 0}, {10, 0}, {26, 0}, - {329, 0}, + {330, 0}, {27, 0}, {2, 0}, {3, 0}, - {334, 0}, - {324, 0}, + {335, 0}, {325, 0}, {326, 0}, + {327, 0}, {1, "class"}, - {332, 0}, {333, 0}, - {335, 0}, + {334, 0}, {336, 0}, {337, 0}, + {338, 0}, {1, "yield"}, }; grammar _PyParser_Grammar = { - 83, + 84, dfas, - {166, labels}, + {167, labels}, 256 }; diff --git a/Python/symtable.c b/Python/symtable.c index ca7d502..1e03069 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1294,6 +1294,9 @@ symtable_visit_expr(struct symtable *st, expr_ty e) VISIT(st, expr, e->v.Subscript.value); VISIT(st, slice, e->v.Subscript.slice); break; + case Starred_kind: + VISIT(st, expr, e->v.Starred.value); + break; case Name_kind: if (!symtable_add_def(st, e->v.Name.id, e->v.Name.ctx == Load ? USE : DEF_LOCAL)) diff --git a/README b/README index ad3d5a7..e54f1bb 100644 --- a/README +++ b/README @@ -290,16 +290,6 @@ on these platforms without the special directions mentioned here, submit a documentation bug report to SourceForge (see Bug Reports above) so we can remove them!) -Unix platforms: If your vendor still ships (and you still use) Berkeley DB - 1.85 you will need to edit Modules/Setup to build the bsddb185 - module and add a line to sitecustomize.py which makes it the - default. In Modules/Setup a line like - - bsddb185 bsddbmodule.c - - should work. (You may need to add -I, -L or -l flags to direct the - compiler and linker to your include files and libraries.) - XXX I think this next bit is out of date: 64-bit platforms: The modules audioop, imageop and rgbimg don't work. @@ -752,9 +742,7 @@ Beginning with Python version 2.3, the PyBsddb package exposing a set of package-level functions which provide backwards-compatible behavior. Only versions 3.3 through 4.4 of Sleepycat's libraries provide the necessary API, so older versions -aren't supported through this interface. The old bsddb module has -been retained as bsddb185, though it is not built by default. Users -wishing to use it will have to tweak Modules/Setup to build it. The +aren't supported through this interface. The dbm module will still be built against the Sleepycat libraries if other preferred alternatives (ndbm, gdbm) are not found. diff --git a/setup.py b/setup.py index 75280bb..87f8c97 100644 --- a/setup.py +++ b/setup.py @@ -896,32 +896,6 @@ class PyBuildExt(build_ext): else: missing.append('_sqlite3') - # Look for Berkeley db 1.85. Note that it is built as a different - # module name so it can be included even when later versions are - # available. A very restrictive search is performed to avoid - # accidentally building this module with a later version of the - # underlying db library. May BSD-ish Unixes incorporate db 1.85 - # symbols into libc and place the include file in /usr/include. - f = "/usr/include/db.h" - if os.path.exists(f): - data = open(f).read() - m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) - if m is not None: - # bingo - old version used hash file format version 2 - ### XXX this should be fixed to not be platform-dependent - ### but I don't have direct access to an osf1 platform and - ### seemed to be muffing the search somehow - libraries = platform == "osf1" and ['db'] or None - if libraries is not None: - exts.append(Extension('bsddb185', ['bsddbmodule.c'], - libraries=libraries)) - else: - exts.append(Extension('bsddb185', ['bsddbmodule.c'])) - else: - missing.append('bsddb185') - else: - missing.append('bsddb185') - # The standard Unix dbm module: if platform not in ['cygwin']: if find_file("ndbm.h", inc_dirs, []) is not None: -- cgit v0.12