mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
Lance has converted his modules to the new naming conventions, and
contributed a curses interface. Setup.in uses .c instead of .o now.
This commit is contained in:
parent
0c4071e69f
commit
f6971e2958
101
Modules/Setup.in
101
Modules/Setup.in
@ -15,9 +15,9 @@
|
|||||||
# Comment out lines to suppress modules.
|
# Comment out lines to suppress modules.
|
||||||
# Lines have the following structure:
|
# Lines have the following structure:
|
||||||
#
|
#
|
||||||
# <module> ... [<objectfile> ...] [<cpparg> ...] [<library> ...]
|
# <module> ... [<sourcefile> ...] [<cpparg> ...] [<library> ...]
|
||||||
#
|
#
|
||||||
# <objectfile> is anything ending in .o
|
# <sourcefile> is anything ending in .c (.C, .cc, .c++ are C++ files)
|
||||||
# <cpparg> is anything starting with -I, -D, -U or -C
|
# <cpparg> is anything starting with -I, -D, -U or -C
|
||||||
# <library> is anything ending in .a or beginning with -l or -L
|
# <library> is anything ending in .a or beginning with -l or -L
|
||||||
# <module> is anything else but should be a valid Python
|
# <module> is anything else but should be a valid Python
|
||||||
@ -61,41 +61,42 @@ PYTHONPATH=.:$(DESTLIB)$(TESTPATH)$(ARCHPATH)$(STDWINPATH)
|
|||||||
|
|
||||||
# Modules that should always be present (non UNIX dependent)
|
# Modules that should always be present (non UNIX dependent)
|
||||||
|
|
||||||
array arraymodule.o # array objects
|
array arraymodule.c # array objects
|
||||||
math mathmodule.o # math library functions, e.g. sin()
|
math mathmodule.c # math library functions, e.g. sin()
|
||||||
parser parsermodule.o # raw interface to the Python parser
|
parser parsermodule.c # raw interface to the Python parser
|
||||||
posix posixmodule.o # posix (UNIX) system calls
|
posix posixmodule.c # posix (UNIX) system calls
|
||||||
regex regexmodule.o regexpr.o # Regular expressions, GNU Emacs style
|
regex regexmodule.c regexpr.c # Regular expressions, GNU Emacs style
|
||||||
strop stropmodule.o # fast string operations implemented in C
|
strop stropmodule.c # fast string operations implemented in C
|
||||||
struct structmodule.o # binary structure packing/unpacking
|
struct structmodule.c # binary structure packing/unpacking
|
||||||
time timemodule.o # time operations and variables
|
time timemodule.c # time operations and variables
|
||||||
|
|
||||||
|
|
||||||
# Modules with some UNIX dependencies -- on by default.
|
# Modules with some UNIX dependencies -- on by default.
|
||||||
# (If you have a really backward UNIX, select and socket may not be
|
# (If you have a really backward UNIX, select and socket may not be
|
||||||
# supported...)
|
# supported...)
|
||||||
|
|
||||||
fcntl fcntlmodule.o # fcntl(2) and ioctl(2)
|
fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
|
||||||
pwd pwdmodule.o # pwd(3)
|
pwd pwdmodule.c # pwd(3)
|
||||||
grp grpmodule.o # grp(3)
|
grp grpmodule.c # grp(3)
|
||||||
crypt cryptmodule.o # crypt(3)
|
crypt cryptmodule.c # crypt(3)
|
||||||
select selectmodule.o # select(2); not on ancient System V
|
select selectmodule.c # select(2); not on ancient System V
|
||||||
socket socketmodule.o # socket(2); not on ancient System V
|
socket socketmodule.c # socket(2); not on ancient System V
|
||||||
|
signal signalmodule.c # signal(2)
|
||||||
|
|
||||||
|
|
||||||
# Some more UNIX dependent modules -- off by default, since these
|
# Some more UNIX dependent modules -- off by default, since these
|
||||||
# are not supported by all UNIX systems.
|
# are not supported by all UNIX systems.
|
||||||
|
|
||||||
#dbm dbmmodule.o # dbm(3) may require -lndbm or similar
|
#dbm dbmmodule.c # dbm(3) may require -lndbm or similar
|
||||||
#nis nismodule.o # Sun yellow pages -- not everywhere
|
#nis nismodule.c # Sun yellow pages -- not everywhere
|
||||||
|
|
||||||
|
|
||||||
# Multimedia modules -- on by default.
|
# Multimedia modules -- on by default.
|
||||||
# These represent audio samples or images as strings
|
# These represent audio samples or images as strings
|
||||||
|
|
||||||
audioop audioop.o # Operations on audio samples
|
audioop audioop.c # Operations on audio samples
|
||||||
imageop imageop.o # Operations on images
|
imageop imageop.c # Operations on images
|
||||||
rgbimg rgbimgmodule.o # Read SGI RGB image files (but coded portably)
|
rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably)
|
||||||
|
|
||||||
|
|
||||||
# The stdwin module provides a simple, portable (between X11 and Mac)
|
# The stdwin module provides a simple, portable (between X11 and Mac)
|
||||||
@ -108,14 +109,14 @@ rgbimg rgbimgmodule.o # Read SGI RGB image files (but coded portably)
|
|||||||
|
|
||||||
#STDWIN=/ufs/guido/src/stdwin
|
#STDWIN=/ufs/guido/src/stdwin
|
||||||
#ARCH=???
|
#ARCH=???
|
||||||
#stdwin stdwinmodule.o -I$(STDWIN)/H $(STDWIN)/Build/$(ARCH)/x11/lib/lib.a -lX11
|
#stdwin stdwinmodule.c -I$(STDWIN)/H $(STDWIN)/Build/$(ARCH)/x11/lib/lib.a -lX11
|
||||||
|
|
||||||
|
|
||||||
# The md5 module implements the RSA Data Security, Inc. MD5
|
# The md5 module implements the RSA Data Security, Inc. MD5
|
||||||
# Message-Digest Algorithm, described in RFC 1321. The necessary files
|
# Message-Digest Algorithm, described in RFC 1321. The necessary files
|
||||||
# md5c.c and md5.h are included here.
|
# md5c.c and md5.h are included here.
|
||||||
|
|
||||||
md5 md5module.o md5c.o
|
md5 md5module.c md5c.c
|
||||||
|
|
||||||
|
|
||||||
# The mpz module interfaces to the GNU Multiple Precision library.
|
# The mpz module interfaces to the GNU Multiple Precision library.
|
||||||
@ -127,13 +128,7 @@ md5 md5module.o md5c.o
|
|||||||
# it).
|
# it).
|
||||||
|
|
||||||
#GMP=/ufs/guido/src/gmp
|
#GMP=/ufs/guido/src/gmp
|
||||||
#mpz mpzmodule.o -I$(GMP) $(GMP)/libgmp.a
|
#mpz mpzmodule.c -I$(GMP) $(GMP)/libgmp.a
|
||||||
|
|
||||||
|
|
||||||
# The rotor module (contributed by Lance Ellinghouse) implements a
|
|
||||||
# rotor-based encryption algorithm. It is self-contained.
|
|
||||||
|
|
||||||
rotor rotormodule.o
|
|
||||||
|
|
||||||
|
|
||||||
# SGI IRIX specific modules -- off by default.
|
# SGI IRIX specific modules -- off by default.
|
||||||
@ -143,14 +138,14 @@ rotor rotormodule.o
|
|||||||
# (Font Manager and Graphics Library).
|
# (Font Manager and Graphics Library).
|
||||||
|
|
||||||
# # ADD THESE FOR IRIX5:
|
# # ADD THESE FOR IRIX5:
|
||||||
#al almodule.o -laudio
|
#al almodule.c -laudio
|
||||||
#cd cdmodule.o -lcdaudio -lds # -lmediad
|
#cd cdmodule.c -lcdaudio -lds # -lmediad
|
||||||
#cl clmodule.o -lcl # -lawareaudio
|
#cl clmodule.c -lcl # -lawareaudio
|
||||||
#fm fmmodule.o -lfm_s -lgl_s
|
#fm fmmodule.c -lfm_s -lgl_s
|
||||||
#gl glmodule.o -lgl_s -lX11_s
|
#gl glmodule.c -lgl_s -lX11_s
|
||||||
#imgfile imgfile.o -limage -lgutil
|
#imgfile imgfile.c -limage -lgutil
|
||||||
#sgi sgimodule.o
|
#sgi sgimodule.c
|
||||||
#sv svmodule.o yuvconvert.o -lsvideo -lXext -lX11_s
|
#sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11_s
|
||||||
|
|
||||||
# The FORMS library, by Mark Overmars, implements user interface
|
# The FORMS library, by Mark Overmars, implements user interface
|
||||||
# components such as dialogs and buttons using SGI's GL and FM
|
# components such as dialogs and buttons using SGI's GL and FM
|
||||||
@ -160,53 +155,51 @@ rotor rotormodule.o
|
|||||||
# toplevel directory.
|
# toplevel directory.
|
||||||
|
|
||||||
#FORMS=/ufs/guido/src/forms/FORMS
|
#FORMS=/ufs/guido/src/forms/FORMS
|
||||||
#fl flmodule.o -I$(FORMS) $(FORMS)/libforms.a
|
#fl flmodule.c -I$(FORMS) $(FORMS)/libforms.a
|
||||||
|
|
||||||
|
|
||||||
# SunOS specific modules -- off by default
|
# SunOS specific modules -- off by default
|
||||||
|
|
||||||
# sunaudiodev sunaudiodev.o
|
# sunaudiodev sunaudiodev.c
|
||||||
|
|
||||||
|
|
||||||
# Thread module -- works on SGI IRIX and on SunOS 5.x (SOLARIS) only.
|
# Thread module -- works on SGI IRIX and on SunOS 5.x (SOLARIS) only.
|
||||||
# Note that you must have configured (and built!) Python with the
|
# Note that you must have configured (and built!) Python with the
|
||||||
# --with-thread option passed to the configure script for this to work.
|
# --with-thread option passed to the configure script for this to work.
|
||||||
|
|
||||||
# thread threadmodule.o
|
# thread threadmodule.c
|
||||||
|
|
||||||
|
|
||||||
# GNN's timing module
|
# GNN's timing module
|
||||||
# timing timingmodule.o
|
# timing timingmodule.c
|
||||||
|
|
||||||
|
|
||||||
# Lance Ellinghouse's signal module
|
# Lance Ellinghouse's modules
|
||||||
# signal signalmodule.o
|
rotor rotormodule.c # enigma-inspired en-, decryption
|
||||||
|
# syslog syslogmodule.c # syslog daemon interface
|
||||||
|
# curses cursesmodule.c -lcurses -ltermcap # guess what?
|
||||||
|
|
||||||
|
|
||||||
# Tommy Burnette's 'new' module (creates new empty objects of certain kinds)
|
# Tommy Burnette's 'new' module (creates new empty objects of certain kinds)
|
||||||
# new newmodule.o
|
# new newmodule.c
|
||||||
|
|
||||||
|
|
||||||
# John Redford's sybase module
|
# John Redford's sybase module
|
||||||
# sybase sybasemodule.o
|
# sybase sybasemodule.c
|
||||||
|
|
||||||
|
|
||||||
# Generic (SunOS / SVR4) dynamic loading module
|
# Generic (SunOS / SVR4) dynamic loading module
|
||||||
# dl dlmodule.o
|
# dl dlmodule.c
|
||||||
|
|
||||||
|
|
||||||
# Jack Jansen's imgformat module
|
# Jack Jansen's imgformat module
|
||||||
# imgformat imgformat.o
|
# imgformat imgformat.c
|
||||||
|
|
||||||
|
|
||||||
# Lance Ellinghouse's syslog module
|
|
||||||
# syslog syslogmodule.o
|
|
||||||
|
|
||||||
|
|
||||||
# Anthony Baxter's gdbm module (derived from Jack's dbm module)
|
# Anthony Baxter's gdbm module (derived from Jack's dbm module)
|
||||||
# GNU dbm(3) will require -lgdbm
|
# GNU dbm(3) will require -lgdbm
|
||||||
# gdbm gdbmmodule.o -I/usr/local/include -L/usr/local/lib -lgdbm
|
# gdbm gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm
|
||||||
|
|
||||||
|
|
||||||
# Example -- included for reference only
|
# Example -- included for reference only
|
||||||
# xx xxmodule.o
|
# xx xxmodule.c
|
||||||
|
1298
Modules/_cursesmodule.c
Normal file
1298
Modules/_cursesmodule.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1994 by Lance Ellinghouse,
|
||||||
Amsterdam, The Netherlands.
|
Cathedral City, California Republic, United States of America.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
@ -8,31 +8,18 @@ Permission to use, copy, modify, and distribute this software and its
|
|||||||
documentation for any purpose and without fee is hereby granted,
|
documentation for any purpose and without fee is hereby granted,
|
||||||
provided that the above copyright notice appear in all copies and that
|
provided that the above copyright notice appear in all copies and that
|
||||||
both that copyright notice and this permission notice appear in
|
both that copyright notice and this permission notice appear in
|
||||||
supporting documentation, and that the names of Stichting Mathematisch
|
supporting documentation, and that the name of Lance Ellinghouse
|
||||||
Centrum or CWI not be used in advertising or publicity pertaining to
|
not be used in advertising or publicity pertaining to distribution
|
||||||
distribution of the software without specific, written prior permission.
|
of the software without specific, written prior permission.
|
||||||
|
|
||||||
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||||
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE BE LIABLE FOR ANY SPECIAL,
|
||||||
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||||
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/******************************************************************
|
|
||||||
Copyright 1992 by Lance Ellinghouse (lance@markv.com)
|
|
||||||
|
|
||||||
All Rights Reserved
|
|
||||||
|
|
||||||
Permission to use, copy, distribute for any purpose and without fee
|
|
||||||
is hereby granted, provided that this copyright notice appear in
|
|
||||||
all copies and that both this copyright notice and this permission
|
|
||||||
notice appear in supporting documentation.
|
|
||||||
Permission to make any changes is granted on the basis that all
|
|
||||||
changes and improvements are also forwarded to Lance Ellinghouse
|
|
||||||
before distribution.
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
/* This creates an encryption and decryption engine I am calling
|
/* This creates an encryption and decryption engine I am calling
|
||||||
@ -641,14 +628,14 @@ PyRotor_Dealloc(xp)
|
|||||||
PyMem_DEL(xp);
|
PyMem_DEL(xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyRotor_Encrypt(self, args)
|
PyRotor_Encrypt(self, args)
|
||||||
PyRotorObject *self;
|
PyRotorObject *self;
|
||||||
PyObject *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
char *string = (char *)NULL;
|
char *string = (char *)NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
PyObject *rtn = (PyObject *)NULL;
|
PyObject * rtn = (PyObject * )NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (!PyArg_Parse(args,"s#",&string, &len))
|
if (!PyArg_Parse(args,"s#",&string, &len))
|
||||||
@ -665,14 +652,14 @@ PyRotor_Encrypt(self, args)
|
|||||||
return(rtn);
|
return(rtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyRotor_EncryptMore(self, args)
|
PyRotor_EncryptMore(self, args)
|
||||||
PyRotorObject *self;
|
PyRotorObject *self;
|
||||||
PyObject *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
char *string = (char *)NULL;
|
char *string = (char *)NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
PyObject *rtn = (PyObject *)NULL;
|
PyObject * rtn = (PyObject * )NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (!PyArg_Parse(args,"s#",&string, &len))
|
if (!PyArg_Parse(args,"s#",&string, &len))
|
||||||
@ -689,14 +676,14 @@ PyRotor_EncryptMore(self, args)
|
|||||||
return(rtn);
|
return(rtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyRotor_Decrypt(self, args)
|
PyRotor_Decrypt(self, args)
|
||||||
PyRotorObject *self;
|
PyRotorObject *self;
|
||||||
PyObject *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
char *string = (char *)NULL;
|
char *string = (char *)NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
PyObject *rtn = (PyObject *)NULL;
|
PyObject * rtn = (PyObject * )NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (!PyArg_Parse(args,"s#",&string, &len))
|
if (!PyArg_Parse(args,"s#",&string, &len))
|
||||||
@ -713,14 +700,14 @@ PyRotor_Decrypt(self, args)
|
|||||||
return(rtn);
|
return(rtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyRotor_DecryptMore(self, args)
|
PyRotor_DecryptMore(self, args)
|
||||||
PyRotorObject *self;
|
PyRotorObject *self;
|
||||||
PyObject *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
char *string = (char *)NULL;
|
char *string = (char *)NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
PyObject *rtn = (PyObject *)NULL;
|
PyObject * rtn = (PyObject * )NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (!PyArg_Parse(args,"s#",&string, &len))
|
if (!PyArg_Parse(args,"s#",&string, &len))
|
||||||
@ -737,21 +724,21 @@ PyRotor_DecryptMore(self, args)
|
|||||||
return(rtn);
|
return(rtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyRotor_SetKey(self, args)
|
PyRotor_SetKey(self, args)
|
||||||
PyRotorObject *self;
|
PyRotorObject *self;
|
||||||
PyObject *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
char *key;
|
char *key;
|
||||||
char *string;
|
char *string;
|
||||||
|
|
||||||
if (PyArg_Parse(args,"s",&string))
|
if (PyArg_Parse(args,"s",&string))
|
||||||
set_key(self,string);
|
set_key(self,string);
|
||||||
Py_INCREF(None);
|
Py_INCREF(Py_None);
|
||||||
return None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef PyRotor_Methods[] = {
|
static struct methodlist PyRotor_Methods[] = {
|
||||||
{"encrypt", (PyCFunction)PyRotor_Encrypt},
|
{"encrypt", (PyCFunction)PyRotor_Encrypt},
|
||||||
{"encryptmore", (PyCFunction)PyRotor_EncryptMore},
|
{"encryptmore", (PyCFunction)PyRotor_EncryptMore},
|
||||||
{"decrypt", (PyCFunction)PyRotor_Decrypt},
|
{"decrypt", (PyCFunction)PyRotor_Decrypt},
|
||||||
@ -762,12 +749,12 @@ static PyMethodDef PyRotor_Methods[] = {
|
|||||||
|
|
||||||
|
|
||||||
/* Return a rotor object's named attribute. */
|
/* Return a rotor object's named attribute. */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyRotor_GetAttr(s, name)
|
PyRotor_GetAttr(s, name)
|
||||||
PyRotorObject *s;
|
PyRotorObject *s;
|
||||||
char *name;
|
char *name;
|
||||||
{
|
{
|
||||||
return Py_FindMethod(PyRotor_Methods, (PyObject *) s, name);
|
return Py_FindMethod(PyRotor_Methods, (PyObject * ) s, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyTypeObject PyRotor_Type = {
|
static PyTypeObject PyRotor_Type = {
|
||||||
@ -787,10 +774,10 @@ static PyTypeObject PyRotor_Type = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyRotor_Rotor(self, args)
|
PyRotor_Rotor(self, args)
|
||||||
PyObject *self;
|
PyObject * self;
|
||||||
PyObject *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
char *string;
|
char *string;
|
||||||
PyRotorObject *r;
|
PyRotorObject *r;
|
||||||
@ -805,10 +792,10 @@ PyRotor_Rotor(self, args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
r = PyRotor_New(num_rotors, string);
|
r = PyRotor_New(num_rotors, string);
|
||||||
return (PyObject *)r;
|
return (PyObject * )r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef PyRotor_Rotor_Methods[] = {
|
static struct methodlist PyRotor_Rotor_Methods[] = {
|
||||||
{"newrotor", (PyCFunction)PyRotor_Rotor},
|
{"newrotor", (PyCFunction)PyRotor_Rotor},
|
||||||
{NULL, NULL} /* Sentinel */
|
{NULL, NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
@ -822,7 +809,7 @@ static PyMethodDef PyRotor_Rotor_Methods[] = {
|
|||||||
void
|
void
|
||||||
initrotor()
|
initrotor()
|
||||||
{
|
{
|
||||||
PyObject *m;
|
PyObject * m;
|
||||||
|
|
||||||
m = Py_InitModule("rotor", PyRotor_Rotor_Methods);
|
m = Py_InitModule("rotor", PyRotor_Rotor_Methods);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1994 by Lance Ellinghouse,
|
||||||
Amsterdam, The Netherlands.
|
Cathedral City, California Republic, United States of America.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
@ -8,125 +8,126 @@ Permission to use, copy, modify, and distribute this software and its
|
|||||||
documentation for any purpose and without fee is hereby granted,
|
documentation for any purpose and without fee is hereby granted,
|
||||||
provided that the above copyright notice appear in all copies and that
|
provided that the above copyright notice appear in all copies and that
|
||||||
both that copyright notice and this permission notice appear in
|
both that copyright notice and this permission notice appear in
|
||||||
supporting documentation, and that the names of Stichting Mathematisch
|
supporting documentation, and that the name of Lance Ellinghouse
|
||||||
Centrum or CWI not be used in advertising or publicity pertaining to
|
not be used in advertising or publicity pertaining to distribution
|
||||||
distribution of the software without specific, written prior permission.
|
of the software without specific, written prior permission.
|
||||||
|
|
||||||
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||||
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE BE LIABLE FOR ANY SPECIAL,
|
||||||
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||||
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
/* syslog module */
|
/* syslog module */
|
||||||
/* (By Lance Ellinghouse) */
|
|
||||||
|
|
||||||
#include "allobjects.h"
|
#include "allobjects.h"
|
||||||
#include "modsupport.h"
|
#include "modsupport.h"
|
||||||
|
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
static object *
|
#include "rename1.h"
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
syslog_openlog(self, args)
|
syslog_openlog(self, args)
|
||||||
object *self;
|
PyObject * self;
|
||||||
object *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
char *ident = "";
|
char *ident = "";
|
||||||
object *ident_o;
|
PyObject * ident_o;
|
||||||
long logopt = LOG_PID;
|
long logopt = LOG_PID;
|
||||||
long facility = LOG_USER;
|
long facility = LOG_USER;
|
||||||
if (!getargs(args, "(Sll);ident string, logoption, facility", &ident_o, &logopt, &facility))
|
if (!PyArg_Parse(args, "(Sll);ident string, logoption, facility", &ident_o, &logopt, &facility))
|
||||||
if (!getargs(args, "(Sl);ident string, logoption", &ident_o, &logopt))
|
if (!PyArg_Parse(args, "(Sl);ident string, logoption", &ident_o, &logopt))
|
||||||
if (!getargs(args, "S;ident string", &ident_o))
|
if (!PyArg_Parse(args, "S;ident string", &ident_o))
|
||||||
return NULL;
|
return NULL;
|
||||||
INCREF(ident_o); /* This is needed because openlog() does NOT make a copy
|
Py_INCREF(ident_o); /* This is needed because openlog() does NOT make a copy
|
||||||
and syslog() later uses it.. cannot trash it. */
|
and syslog() later uses it.. cannot trash it. */
|
||||||
ident = getstringvalue(ident_o);
|
ident = PyString_AsString(ident_o);
|
||||||
openlog(ident,logopt,facility);
|
openlog(ident,logopt,facility);
|
||||||
INCREF(None);
|
Py_INCREF(Py_None);
|
||||||
return None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
syslog_syslog(self, args)
|
syslog_syslog(self, args)
|
||||||
object *self;
|
PyObject * self;
|
||||||
object *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
int priority = LOG_INFO;
|
int priority = LOG_INFO;
|
||||||
char *message;
|
char *message;
|
||||||
|
|
||||||
if (!getargs(args,"(is);priority, message string",&priority,&message))
|
if (!PyArg_Parse(args,"(is);priority, message string",&priority,&message))
|
||||||
if (!getargs(args,"s;message string",&message))
|
if (!PyArg_Parse(args,"s;message string",&message))
|
||||||
return NULL;
|
return NULL;
|
||||||
syslog(priority, message);
|
syslog(priority, message);
|
||||||
INCREF(None);
|
Py_INCREF(Py_None);
|
||||||
return None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
syslog_closelog(self, args)
|
syslog_closelog(self, args)
|
||||||
object *self;
|
PyObject * self;
|
||||||
object *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
if (!getnoarg(args))
|
if (!PyArg_NoArgs(args))
|
||||||
return NULL;
|
return NULL;
|
||||||
closelog();
|
closelog();
|
||||||
INCREF(None);
|
Py_INCREF(Py_None);
|
||||||
return None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
syslog_setlogmask(self, args)
|
syslog_setlogmask(self, args)
|
||||||
object *self;
|
PyObject * self;
|
||||||
object *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
long maskpri;
|
long maskpri;
|
||||||
if (!getargs(args,"l;mask for priority",&maskpri))
|
if (!PyArg_Parse(args,"l;mask for priority",&maskpri))
|
||||||
return NULL;
|
return NULL;
|
||||||
setlogmask(maskpri);
|
setlogmask(maskpri);
|
||||||
INCREF(None);
|
Py_INCREF(Py_None);
|
||||||
return None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
syslog_log_mask(self, args)
|
syslog_log_mask(self, args)
|
||||||
object *self;
|
PyObject * self;
|
||||||
object *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
long mask;
|
long mask;
|
||||||
long pri;
|
long pri;
|
||||||
if (!getargs(args,"l",&pri))
|
if (!PyArg_Parse(args,"l",&pri))
|
||||||
return NULL;
|
return NULL;
|
||||||
mask = LOG_MASK(pri);
|
mask = LOG_MASK(pri);
|
||||||
return newintobject(mask);
|
return PyInt_FromLong(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static object *
|
static PyObject *
|
||||||
syslog_log_upto(self, args)
|
syslog_log_upto(self, args)
|
||||||
object *self;
|
PyObject * self;
|
||||||
object *args;
|
PyObject * args;
|
||||||
{
|
{
|
||||||
long mask;
|
long mask;
|
||||||
long pri;
|
long pri;
|
||||||
if (!getargs(args,"l",&pri))
|
if (!PyArg_Parse(args,"l",&pri))
|
||||||
return NULL;
|
return NULL;
|
||||||
mask = LOG_UPTO(pri);
|
mask = LOG_UPTO(pri);
|
||||||
return newintobject(mask);
|
return PyInt_FromLong(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* List of functions defined in the module */
|
/* List of functions defined in the module */
|
||||||
|
|
||||||
static struct methodlist syslog_methods[] = {
|
static PyMethodDef syslog_methods[] = {
|
||||||
{"openlog", syslog_openlog},
|
{"openlog", (PyCFunction)syslog_openlog},
|
||||||
{"closelog", syslog_closelog},
|
{"closelog", (PyCFunction)syslog_closelog},
|
||||||
{"syslog", syslog_syslog},
|
{"syslog", (PyCFunction)syslog_syslog},
|
||||||
{"setlogmask", syslog_setlogmask},
|
{"setlogmask", (PyCFunction)syslog_setlogmask},
|
||||||
{"LOG_MASK", syslog_log_mask},
|
{"LOG_MASK", (PyCFunction)syslog_log_mask},
|
||||||
{"LOG_UPTO", syslog_log_upto},
|
{"LOG_UPTO", (PyCFunction)syslog_log_upto},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -135,65 +136,65 @@ static struct methodlist syslog_methods[] = {
|
|||||||
void
|
void
|
||||||
initsyslog()
|
initsyslog()
|
||||||
{
|
{
|
||||||
object *m, *d, *x;
|
PyObject *m, *d, *x;
|
||||||
|
|
||||||
/* Create the module and add the functions */
|
/* Create the module and add the functions */
|
||||||
m = initmodule("syslog", syslog_methods);
|
m = Py_InitModule("syslog", syslog_methods);
|
||||||
|
|
||||||
/* Add some symbolic constants to the module */
|
/* Add some symbolic constants to the module */
|
||||||
d = getmoduledict(m);
|
d = PyModule_GetDict(m);
|
||||||
x = newintobject(LOG_EMERG);
|
x = PyInt_FromLong(LOG_EMERG);
|
||||||
dictinsert(d, "LOG_EMERG", x);
|
PyDict_SetItemString(d, "LOG_EMERG", x);
|
||||||
x = newintobject(LOG_ALERT);
|
x = PyInt_FromLong(LOG_ALERT);
|
||||||
dictinsert(d, "LOG_ALERT", x);
|
PyDict_SetItemString(d, "LOG_ALERT", x);
|
||||||
x = newintobject(LOG_CRIT);
|
x = PyInt_FromLong(LOG_CRIT);
|
||||||
dictinsert(d, "LOG_CRIT", x);
|
PyDict_SetItemString(d, "LOG_CRIT", x);
|
||||||
x = newintobject(LOG_ERR);
|
x = PyInt_FromLong(LOG_ERR);
|
||||||
dictinsert(d, "LOG_ERR", x);
|
PyDict_SetItemString(d, "LOG_ERR", x);
|
||||||
x = newintobject(LOG_WARNING);
|
x = PyInt_FromLong(LOG_WARNING);
|
||||||
dictinsert(d, "LOG_WARNING", x);
|
PyDict_SetItemString(d, "LOG_WARNING", x);
|
||||||
x = newintobject(LOG_NOTICE);
|
x = PyInt_FromLong(LOG_NOTICE);
|
||||||
dictinsert(d, "LOG_NOTICE", x);
|
PyDict_SetItemString(d, "LOG_NOTICE", x);
|
||||||
x = newintobject(LOG_INFO);
|
x = PyInt_FromLong(LOG_INFO);
|
||||||
dictinsert(d, "LOG_INFO", x);
|
PyDict_SetItemString(d, "LOG_INFO", x);
|
||||||
x = newintobject(LOG_DEBUG);
|
x = PyInt_FromLong(LOG_DEBUG);
|
||||||
dictinsert(d, "LOG_DEBUG", x);
|
PyDict_SetItemString(d, "LOG_DEBUG", x);
|
||||||
x = newintobject(LOG_PID);
|
x = PyInt_FromLong(LOG_PID);
|
||||||
dictinsert(d, "LOG_PID", x);
|
PyDict_SetItemString(d, "LOG_PID", x);
|
||||||
x = newintobject(LOG_CONS);
|
x = PyInt_FromLong(LOG_CONS);
|
||||||
dictinsert(d, "LOG_CONS", x);
|
PyDict_SetItemString(d, "LOG_CONS", x);
|
||||||
x = newintobject(LOG_NDELAY);
|
x = PyInt_FromLong(LOG_NDELAY);
|
||||||
dictinsert(d, "LOG_NDELAY", x);
|
PyDict_SetItemString(d, "LOG_NDELAY", x);
|
||||||
x = newintobject(LOG_NOWAIT);
|
x = PyInt_FromLong(LOG_NOWAIT);
|
||||||
dictinsert(d, "LOG_NOWAIT", x);
|
PyDict_SetItemString(d, "LOG_NOWAIT", x);
|
||||||
x = newintobject(LOG_KERN);
|
x = PyInt_FromLong(LOG_KERN);
|
||||||
dictinsert(d, "LOG_KERN", x);
|
PyDict_SetItemString(d, "LOG_KERN", x);
|
||||||
x = newintobject(LOG_USER);
|
x = PyInt_FromLong(LOG_USER);
|
||||||
dictinsert(d, "LOG_USER", x);
|
PyDict_SetItemString(d, "LOG_USER", x);
|
||||||
x = newintobject(LOG_MAIL);
|
x = PyInt_FromLong(LOG_MAIL);
|
||||||
dictinsert(d, "LOG_MAIL", x);
|
PyDict_SetItemString(d, "LOG_MAIL", x);
|
||||||
x = newintobject(LOG_DAEMON);
|
x = PyInt_FromLong(LOG_DAEMON);
|
||||||
dictinsert(d, "LOG_DAEMON", x);
|
PyDict_SetItemString(d, "LOG_DAEMON", x);
|
||||||
x = newintobject(LOG_LPR);
|
x = PyInt_FromLong(LOG_LPR);
|
||||||
dictinsert(d, "LOG_LPR", x);
|
PyDict_SetItemString(d, "LOG_LPR", x);
|
||||||
x = newintobject(LOG_LOCAL0);
|
x = PyInt_FromLong(LOG_LOCAL0);
|
||||||
dictinsert(d, "LOG_LOCAL0", x);
|
PyDict_SetItemString(d, "LOG_LOCAL0", x);
|
||||||
x = newintobject(LOG_LOCAL1);
|
x = PyInt_FromLong(LOG_LOCAL1);
|
||||||
dictinsert(d, "LOG_LOCAL1", x);
|
PyDict_SetItemString(d, "LOG_LOCAL1", x);
|
||||||
x = newintobject(LOG_LOCAL2);
|
x = PyInt_FromLong(LOG_LOCAL2);
|
||||||
dictinsert(d, "LOG_LOCAL2", x);
|
PyDict_SetItemString(d, "LOG_LOCAL2", x);
|
||||||
x = newintobject(LOG_LOCAL3);
|
x = PyInt_FromLong(LOG_LOCAL3);
|
||||||
dictinsert(d, "LOG_LOCAL3", x);
|
PyDict_SetItemString(d, "LOG_LOCAL3", x);
|
||||||
x = newintobject(LOG_LOCAL4);
|
x = PyInt_FromLong(LOG_LOCAL4);
|
||||||
dictinsert(d, "LOG_LOCAL4", x);
|
PyDict_SetItemString(d, "LOG_LOCAL4", x);
|
||||||
x = newintobject(LOG_LOCAL5);
|
x = PyInt_FromLong(LOG_LOCAL5);
|
||||||
dictinsert(d, "LOG_LOCAL5", x);
|
PyDict_SetItemString(d, "LOG_LOCAL5", x);
|
||||||
x = newintobject(LOG_LOCAL6);
|
x = PyInt_FromLong(LOG_LOCAL6);
|
||||||
dictinsert(d, "LOG_LOCAL6", x);
|
PyDict_SetItemString(d, "LOG_LOCAL6", x);
|
||||||
x = newintobject(LOG_LOCAL7);
|
x = PyInt_FromLong(LOG_LOCAL7);
|
||||||
dictinsert(d, "LOG_LOCAL7", x);
|
PyDict_SetItemString(d, "LOG_LOCAL7", x);
|
||||||
|
|
||||||
/* Check for errors */
|
/* Check for errors */
|
||||||
if (err_occurred())
|
if (PyErr_Occurred())
|
||||||
fatal("can't initialize module syslog");
|
Py_FatalError("can't initialize module syslog");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user