1991-08-07 08:32:58 -03:00
|
|
|
/* FL module -- interface to Mark Overmars' FORMS Library. */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
/* This code works with FORMS version 2.2 (if you defined
|
|
|
|
OBSOLETE_FORMS_CALLS), and 2.3.
|
1993-07-05 07:31:29 -03:00
|
|
|
FORMS can be ftp'ed from ftp.cs.ruu.nl (131.211.80.17), directory
|
|
|
|
/pub/SGI/FORMS. */
|
1991-12-10 09:56:42 -04:00
|
|
|
|
1992-08-13 11:13:11 -03:00
|
|
|
/* 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.
|
2000-07-16 09:04:32 -03:00
|
|
|
* (A fix will probably also have to synchronize with the gl module).
|
1992-08-13 11:13:11 -03:00
|
|
|
*/
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
#include "Python.h"
|
1991-08-07 08:32:58 -03:00
|
|
|
#include "forms.h"
|
|
|
|
#include "structmember.h"
|
|
|
|
|
|
|
|
/* Generic Forms Objects */
|
|
|
|
|
|
|
|
typedef struct {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyObject_HEAD
|
1991-08-07 08:32:58 -03:00
|
|
|
FL_OBJECT *ob_generic;
|
1997-01-03 18:17:11 -04:00
|
|
|
PyMethodDef *ob_methods;
|
|
|
|
PyObject *ob_callback;
|
|
|
|
PyObject *ob_callback_arg;
|
1991-08-07 08:32:58 -03:00
|
|
|
} genericobject;
|
|
|
|
|
2002-07-17 13:30:39 -03:00
|
|
|
static PyTypeObject GenericObjecttype;
|
1991-10-20 17:18:26 -03:00
|
|
|
|
|
|
|
#define is_genericobject(g) ((g)->ob_type == &GenericObjecttype)
|
|
|
|
|
|
|
|
/* List of all objects (XXX this should be a hash table on address...) */
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *allgenerics = NULL;
|
1991-10-20 17:18:26 -03:00
|
|
|
static int nfreeslots = 0;
|
|
|
|
|
|
|
|
/* Add an object to the list of known objects */
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
static void
|
2000-07-10 14:04:33 -03:00
|
|
|
knowgeneric(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
int i, n;
|
|
|
|
/* Create the list if it doesn't already exist */
|
1991-08-07 08:32:58 -03:00
|
|
|
if (allgenerics == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
allgenerics = PyList_New(0);
|
1991-08-07 08:32:58 -03:00
|
|
|
if (allgenerics == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_Clear();
|
1991-10-20 17:18:26 -03:00
|
|
|
return; /* Too bad, live without allgenerics... */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (nfreeslots > 0) {
|
|
|
|
/* Search the list for reusable slots (NULL items) */
|
|
|
|
/* XXX This can be made faster! */
|
1997-01-03 18:17:11 -04:00
|
|
|
n = PyList_Size(allgenerics);
|
1991-10-20 17:18:26 -03:00
|
|
|
for (i = 0; i < n; i++) {
|
1997-01-03 18:17:11 -04:00
|
|
|
if (PyList_GetItem(allgenerics, i) == NULL) {
|
|
|
|
Py_INCREF(g);
|
|
|
|
PyList_SetItem(allgenerics, i, (PyObject *)g);
|
1991-10-20 17:18:26 -03:00
|
|
|
nfreeslots--;
|
|
|
|
return;
|
|
|
|
}
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1991-10-20 17:18:26 -03:00
|
|
|
/* Strange... no free slots found... */
|
|
|
|
nfreeslots = 0;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1991-10-20 17:18:26 -03:00
|
|
|
/* No free entries, append new item to the end */
|
1997-01-03 18:17:11 -04:00
|
|
|
PyList_Append(allgenerics, (PyObject *)g);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
/* Find an object in the list of known objects */
|
|
|
|
|
1991-08-07 08:32:58 -03:00
|
|
|
static genericobject *
|
2000-07-10 14:04:33 -03:00
|
|
|
findgeneric(FL_OBJECT *generic)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int i, n;
|
|
|
|
genericobject *g;
|
|
|
|
|
|
|
|
if (allgenerics == NULL)
|
1991-10-20 17:18:26 -03:00
|
|
|
return NULL; /* No objects known yet */
|
1997-01-03 18:17:11 -04:00
|
|
|
n = PyList_Size(allgenerics);
|
1991-08-07 08:32:58 -03:00
|
|
|
for (i = 0; i < n; i++) {
|
1997-01-03 18:17:11 -04:00
|
|
|
g = (genericobject *)PyList_GetItem(allgenerics, i);
|
1991-10-20 17:18:26 -03:00
|
|
|
if (g != NULL && g->ob_generic == generic)
|
1991-08-07 08:32:58 -03:00
|
|
|
return g;
|
|
|
|
}
|
|
|
|
return NULL; /* Unknown object */
|
|
|
|
}
|
|
|
|
|
1992-09-03 17:37:02 -03:00
|
|
|
/* Remove an object from the list of known objects */
|
|
|
|
|
|
|
|
static void
|
2000-07-10 14:04:33 -03:00
|
|
|
forgetgeneric(genericobject *g)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
|
|
|
int i, n;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_XDECREF(g->ob_callback);
|
1992-09-03 17:37:02 -03:00
|
|
|
g->ob_callback = NULL;
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_XDECREF(g->ob_callback_arg);
|
1992-09-03 17:37:02 -03:00
|
|
|
g->ob_callback_arg = NULL;
|
|
|
|
if (allgenerics == NULL)
|
|
|
|
return; /* No objects known yet */
|
1997-01-03 18:17:11 -04:00
|
|
|
n = PyList_Size(allgenerics);
|
1992-09-03 17:37:02 -03:00
|
|
|
for (i = 0; i < n; i++) {
|
1997-01-03 18:17:11 -04:00
|
|
|
if (g == (genericobject *)PyList_GetItem(allgenerics, i)) {
|
|
|
|
PyList_SetItem(allgenerics, i, (PyObject *)NULL);
|
1992-09-03 17:37:02 -03:00
|
|
|
nfreeslots++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
/* Called when a form is about to be freed --
|
|
|
|
remove all the objects that we know about from it. */
|
|
|
|
|
|
|
|
static void
|
2000-07-10 14:04:33 -03:00
|
|
|
releaseobjects(FL_FORM *form)
|
1991-10-20 17:18:26 -03:00
|
|
|
{
|
|
|
|
int i, n;
|
|
|
|
genericobject *g;
|
|
|
|
|
|
|
|
if (allgenerics == NULL)
|
|
|
|
return; /* No objects known yet */
|
1997-01-03 18:17:11 -04:00
|
|
|
n = PyList_Size(allgenerics);
|
1991-10-20 17:18:26 -03:00
|
|
|
for (i = 0; i < n; i++) {
|
1997-01-03 18:17:11 -04:00
|
|
|
g = (genericobject *)PyList_GetItem(allgenerics, i);
|
1991-10-20 17:18:26 -03:00
|
|
|
if (g != NULL && g->ob_generic->form == form) {
|
|
|
|
fl_delete_object(g->ob_generic);
|
1992-09-03 17:37:02 -03:00
|
|
|
/* The object is now unreachable for
|
|
|
|
do_forms and check_forms, so
|
|
|
|
delete it from the list of known objects */
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_XDECREF(g->ob_callback);
|
1992-09-03 17:37:02 -03:00
|
|
|
g->ob_callback = NULL;
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_XDECREF(g->ob_callback_arg);
|
1992-09-03 17:37:02 -03:00
|
|
|
g->ob_callback_arg = NULL;
|
1997-01-03 18:17:11 -04:00
|
|
|
PyList_SetItem(allgenerics, i, (PyObject *)NULL);
|
1992-09-03 17:37:02 -03:00
|
|
|
nfreeslots++;
|
1991-10-20 17:18:26 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
/* Methods of generic objects */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
generic_set_call_back(genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
Partially merge trunk into p3yk. The removal of Mac/Tools is confusing svn
merge in bad ways, so I'll have to merge that extra-carefully (probably manually.)
Merged revisions 46495-46605 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r46495 | tim.peters | 2006-05-28 03:52:38 +0200 (Sun, 28 May 2006) | 2 lines
Added missing svn:eol-style property to text files.
........
r46497 | tim.peters | 2006-05-28 12:41:29 +0200 (Sun, 28 May 2006) | 3 lines
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
........
r46499 | fredrik.lundh | 2006-05-28 14:06:46 +0200 (Sun, 28 May 2006) | 5 lines
needforspeed: added Py_MEMCPY macro (currently tuned for Visual C only),
and use it for string copy operations. this gives a 20% speedup on some
string benchmarks.
........
r46501 | michael.hudson | 2006-05-28 17:51:40 +0200 (Sun, 28 May 2006) | 26 lines
Quality control, meet exceptions.c.
Fix a number of problems with the need for speed code:
One is doing this sort of thing:
Py_DECREF(self->field);
self->field = newval;
Py_INCREF(self->field);
without being very sure that self->field doesn't start with a
value that has a __del__, because that almost certainly can lead
to segfaults.
As self->args is constrained to be an exact tuple we may as well
exploit this fact consistently. This leads to quite a lot of
simplification (and, hey, probably better performance).
Add some error checking in places lacking it.
Fix some rather strange indentation in the Unicode code.
Delete some trailing whitespace.
More to come, I haven't fixed all the reference leaks yet...
........
r46502 | george.yoshida | 2006-05-28 18:39:09 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
........
r46503 | martin.v.loewis | 2006-05-28 18:57:38 +0200 (Sun, 28 May 2006) | 4 lines
Rest of patch #1490384: Commit icon source, remove
claim that Erik von Blokland is the author of the
installer picture.
........
r46504 | michael.hudson | 2006-05-28 19:40:29 +0200 (Sun, 28 May 2006) | 16 lines
Quality control, meet exceptions.c, round two.
Make some functions that should have been static static.
Fix a bunch of refleaks by fixing the definition of
MiddlingExtendsException.
Remove all the __new__ implementations apart from
BaseException_new. Rewrite most code that needs it to cope with
NULL fields (such code could get excercised anyway, the
__new__-removal just makes it more likely). This involved
editing the code for WindowsError, which I can't test.
This fixes all the refleaks in at least the start of a regrtest
-R :: run.
........
r46505 | marc-andre.lemburg | 2006-05-28 19:46:58 +0200 (Sun, 28 May 2006) | 10 lines
Initial version of systimes - a module to provide platform dependent
performance measurements.
The module is currently just a proof-of-concept implementation, but
will integrated into pybench once it is stable enough.
License: pybench license.
Author: Marc-Andre Lemburg.
........
r46507 | armin.rigo | 2006-05-28 21:13:17 +0200 (Sun, 28 May 2006) | 15 lines
("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.
Remaining open issues:
* test_extcall is an output test, messy to make robust
* tarfile.py has a potential bug here, but I'm not familiar
enough with this code. Filed in as SF bug #1496501.
* urllib2.HTTPPasswordMgr() returns a random result if there is more
than one matching root path. I'm asking python-dev for
clarification...
........
r46508 | georg.brandl | 2006-05-28 22:11:45 +0200 (Sun, 28 May 2006) | 4 lines
The empty string is a valid import path.
(fixes #1496539)
........
r46509 | georg.brandl | 2006-05-28 22:23:12 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1496206: urllib2 PasswordMgr ./. default ports
........
r46510 | georg.brandl | 2006-05-28 22:57:09 +0200 (Sun, 28 May 2006) | 3 lines
Fix refleaks in UnicodeError get and set methods.
........
r46511 | michael.hudson | 2006-05-28 23:19:03 +0200 (Sun, 28 May 2006) | 3 lines
use the UnicodeError traversal and clearing functions in UnicodeError
subclasses.
........
r46512 | thomas.wouters | 2006-05-28 23:32:12 +0200 (Sun, 28 May 2006) | 4 lines
Make last patch valid C89 so Windows compilers can deal with it.
........
r46513 | georg.brandl | 2006-05-28 23:42:54 +0200 (Sun, 28 May 2006) | 3 lines
Fix ref-antileak in _struct.c which eventually lead to deallocating None.
........
r46514 | georg.brandl | 2006-05-28 23:57:35 +0200 (Sun, 28 May 2006) | 4 lines
Correct None refcount issue in Mac modules. (Are they
still used?)
........
r46515 | armin.rigo | 2006-05-29 00:07:08 +0200 (Mon, 29 May 2006) | 3 lines
A clearer error message when passing -R to regrtest.py with
release builds of Python.
........
r46516 | georg.brandl | 2006-05-29 00:14:04 +0200 (Mon, 29 May 2006) | 3 lines
Fix C function calling conventions in _sre module.
........
r46517 | georg.brandl | 2006-05-29 00:34:51 +0200 (Mon, 29 May 2006) | 3 lines
Convert audioop over to METH_VARARGS.
........
r46518 | georg.brandl | 2006-05-29 00:38:57 +0200 (Mon, 29 May 2006) | 3 lines
METH_NOARGS functions do get called with two args.
........
r46519 | georg.brandl | 2006-05-29 11:46:51 +0200 (Mon, 29 May 2006) | 4 lines
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.
........
r46520 | nick.coghlan | 2006-05-29 14:43:05 +0200 (Mon, 29 May 2006) | 7 lines
Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
........
r46522 | georg.brandl | 2006-05-29 15:53:16 +0200 (Mon, 29 May 2006) | 3 lines
Convert fmmodule to METH_VARARGS.
........
r46523 | georg.brandl | 2006-05-29 16:13:21 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494605.
........
r46524 | georg.brandl | 2006-05-29 16:28:05 +0200 (Mon, 29 May 2006) | 3 lines
Handle PyMem_Malloc failure in pystrtod.c. Closes #1494671.
........
r46525 | georg.brandl | 2006-05-29 16:33:55 +0200 (Mon, 29 May 2006) | 3 lines
Fix compiler warning.
........
r46526 | georg.brandl | 2006-05-29 16:39:00 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494787 (pyclbr counts whitespace as superclass name)
........
r46527 | bob.ippolito | 2006-05-29 17:47:29 +0200 (Mon, 29 May 2006) | 1 line
simplify the struct code a bit (no functional changes)
........
r46528 | armin.rigo | 2006-05-29 19:59:47 +0200 (Mon, 29 May 2006) | 2 lines
Silence a warning.
........
r46529 | georg.brandl | 2006-05-29 21:39:45 +0200 (Mon, 29 May 2006) | 3 lines
Correct some value converting strangenesses.
........
r46530 | nick.coghlan | 2006-05-29 22:27:44 +0200 (Mon, 29 May 2006) | 1 line
When adding a module like functools, it helps to let SVN know about the file.
........
r46531 | georg.brandl | 2006-05-29 22:52:54 +0200 (Mon, 29 May 2006) | 4 lines
Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
........
r46532 | georg.brandl | 2006-05-29 22:57:01 +0200 (Mon, 29 May 2006) | 3 lines
Add News entry for last commit.
........
r46533 | georg.brandl | 2006-05-29 23:04:52 +0200 (Mon, 29 May 2006) | 4 lines
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
........
r46534 | georg.brandl | 2006-05-29 23:58:42 +0200 (Mon, 29 May 2006) | 3 lines
Convert more modules to METH_VARARGS.
........
r46535 | georg.brandl | 2006-05-30 00:00:30 +0200 (Tue, 30 May 2006) | 3 lines
Whoops.
........
r46536 | fredrik.lundh | 2006-05-30 00:42:07 +0200 (Tue, 30 May 2006) | 4 lines
fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
........
r46537 | bob.ippolito | 2006-05-30 00:55:48 +0200 (Tue, 30 May 2006) | 1 line
struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly)
........
r46539 | bob.ippolito | 2006-05-30 02:26:01 +0200 (Tue, 30 May 2006) | 1 line
Add a length check to aifc to ensure it doesn't write a bogus file
........
r46540 | tim.peters | 2006-05-30 04:25:25 +0200 (Tue, 30 May 2006) | 10 lines
deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:
test_genexps (or any other doctest-based test)
test_struct
test_doctest
The `warnings` module needs an advertised way to save/restore
its internal filter list.
........
r46541 | tim.peters | 2006-05-30 04:26:46 +0200 (Tue, 30 May 2006) | 2 lines
Whitespace normalization.
........
r46542 | tim.peters | 2006-05-30 04:30:30 +0200 (Tue, 30 May 2006) | 2 lines
Set a binary svn:mime-type property on this UTF-8 encoded file.
........
r46543 | neal.norwitz | 2006-05-30 05:18:50 +0200 (Tue, 30 May 2006) | 1 line
Simplify further by using AddStringConstant
........
r46544 | tim.peters | 2006-05-30 06:16:25 +0200 (Tue, 30 May 2006) | 6 lines
Convert relevant dict internals to Py_ssize_t.
I don't have a box with nearly enough RAM, or an OS,
that could get close to tickling this, though (requires
a dict w/ at least 2**31 entries).
........
r46545 | neal.norwitz | 2006-05-30 06:19:21 +0200 (Tue, 30 May 2006) | 1 line
Remove stray | in comment
........
r46546 | neal.norwitz | 2006-05-30 06:25:05 +0200 (Tue, 30 May 2006) | 1 line
Use Py_SAFE_DOWNCAST for safety. Fix format strings. Remove 2 more stray | in comment
........
r46547 | neal.norwitz | 2006-05-30 06:43:23 +0200 (Tue, 30 May 2006) | 1 line
No DOWNCAST is required since sizeof(Py_ssize_t) >= sizeof(int) and Py_ReprEntr returns an int
........
r46548 | tim.peters | 2006-05-30 07:04:59 +0200 (Tue, 30 May 2006) | 3 lines
dict_print(): Explicitly narrow the return value
from a (possibly) wider variable.
........
r46549 | tim.peters | 2006-05-30 07:23:59 +0200 (Tue, 30 May 2006) | 5 lines
dict_print(): So that Neal & I don't spend the rest of
our lives taking turns rewriting code that works ;-),
get rid of casting illusions by declaring a new variable
with the obvious type.
........
r46550 | georg.brandl | 2006-05-30 09:04:55 +0200 (Tue, 30 May 2006) | 3 lines
Restore exception pickle support. #1497319.
........
r46551 | georg.brandl | 2006-05-30 09:13:29 +0200 (Tue, 30 May 2006) | 3 lines
Add a test case for exception pickling. args is never NULL.
........
r46552 | neal.norwitz | 2006-05-30 09:21:10 +0200 (Tue, 30 May 2006) | 1 line
Don't fail if the (sub)pkgname already exist.
........
r46553 | georg.brandl | 2006-05-30 09:34:45 +0200 (Tue, 30 May 2006) | 3 lines
Disallow keyword args for exceptions.
........
r46554 | neal.norwitz | 2006-05-30 09:36:54 +0200 (Tue, 30 May 2006) | 5 lines
I'm impatient. I think this will fix a few more problems with the buildbots.
I'm not sure this is the best approach, but I can't think of anything better.
If this creates problems, feel free to revert, but I think it's safe and
should make things a little better.
........
r46555 | georg.brandl | 2006-05-30 10:17:00 +0200 (Tue, 30 May 2006) | 4 lines
Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
........
r46556 | georg.brandl | 2006-05-30 10:47:19 +0200 (Tue, 30 May 2006) | 3 lines
Convert test_exceptions to unittest.
........
r46557 | andrew.kuchling | 2006-05-30 14:52:01 +0200 (Tue, 30 May 2006) | 1 line
Add SoC name, and reorganize this section a bit
........
r46559 | tim.peters | 2006-05-30 17:53:34 +0200 (Tue, 30 May 2006) | 11 lines
PyLong_FromString(): Continued fraction analysis (explained in
a new comment) suggests there are almost certainly large input
integers in all non-binary input bases for which one Python digit
too few is initally allocated to hold the final result. Instead
of assert-failing when that happens, allocate more space. Alas,
I estimate it would take a few days to find a specific such case,
so this isn't backed up by a new test (not to mention that such
a case may take hours to run, since conversion time is quadratic
in the number of digits, and preliminary attempts suggested that
the smallest such inputs contain at least a million digits).
........
r46560 | fredrik.lundh | 2006-05-30 19:11:48 +0200 (Tue, 30 May 2006) | 3 lines
changed find/rfind to return -1 for matches outside the source string
........
r46561 | bob.ippolito | 2006-05-30 19:37:54 +0200 (Tue, 30 May 2006) | 1 line
Change wrapping terminology to overflow masking
........
r46562 | fredrik.lundh | 2006-05-30 19:39:58 +0200 (Tue, 30 May 2006) | 3 lines
changed count to return 0 for slices outside the source string
........
r46568 | tim.peters | 2006-05-31 01:28:02 +0200 (Wed, 31 May 2006) | 2 lines
Whitespace normalization.
........
r46569 | brett.cannon | 2006-05-31 04:19:54 +0200 (Wed, 31 May 2006) | 5 lines
Clarify wording on default values for strptime(); defaults are used when better
values cannot be inferred.
Closes bug #1496315.
........
r46572 | neal.norwitz | 2006-05-31 09:43:27 +0200 (Wed, 31 May 2006) | 1 line
Calculate smallest properly (it was off by one) and use proper ssize_t types for Win64
........
r46573 | neal.norwitz | 2006-05-31 10:01:08 +0200 (Wed, 31 May 2006) | 1 line
Revert last checkin, it is better to do make distclean
........
r46574 | neal.norwitz | 2006-05-31 11:02:44 +0200 (Wed, 31 May 2006) | 3 lines
On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
........
r46575 | thomas.heller | 2006-05-31 13:37:58 +0200 (Wed, 31 May 2006) | 3 lines
PyTuple_Pack is not available in Python 2.3, but ctypes must stay
compatible with that.
........
r46576 | andrew.kuchling | 2006-05-31 15:18:56 +0200 (Wed, 31 May 2006) | 1 line
'functional' module was renamed to 'functools'
........
r46577 | kristjan.jonsson | 2006-05-31 15:35:41 +0200 (Wed, 31 May 2006) | 1 line
Fixup the PCBuild8 project directory. exceptions.c have moved to Objects, and the functionalmodule.c has been replaced with _functoolsmodule.c. Other minor changes to .vcproj files and .sln to fix compilation
........
r46578 | andrew.kuchling | 2006-05-31 16:08:48 +0200 (Wed, 31 May 2006) | 15 lines
[Bug #1473048]
SimpleXMLRPCServer and DocXMLRPCServer don't look at
the path of the HTTP request at all; you can POST or
GET from / or /RPC2 or /blahblahblah with the same results.
Security scanners that look for /cgi-bin/phf will therefore report
lots of vulnerabilities.
Fix: add a .rpc_paths attribute to the SimpleXMLRPCServer class,
and report a 404 error if the path isn't on the allowed list.
Possibly-controversial aspect of this change: the default makes only
'/' and '/RPC2' legal. Maybe this will break people's applications
(though I doubt it). We could just set the default to an empty tuple,
which would exactly match the current behaviour.
........
r46579 | andrew.kuchling | 2006-05-31 16:12:47 +0200 (Wed, 31 May 2006) | 1 line
Mention SimpleXMLRPCServer change
........
r46580 | tim.peters | 2006-05-31 16:28:07 +0200 (Wed, 31 May 2006) | 2 lines
Trimmed trailing whitespace.
........
r46581 | tim.peters | 2006-05-31 17:33:22 +0200 (Wed, 31 May 2006) | 4 lines
_range_error(): Speed and simplify (there's no real need for
loops here). Assert that size_t is actually big enough, and
that f->size is at least one. Wrap a long line.
........
r46582 | tim.peters | 2006-05-31 17:34:37 +0200 (Wed, 31 May 2006) | 2 lines
Repaired error in new comment.
........
r46584 | neal.norwitz | 2006-06-01 07:32:49 +0200 (Thu, 01 Jun 2006) | 4 lines
Remove ; at end of macro. There was a compiler recently that warned
about extra semi-colons. It may have been the HP C compiler.
This file will trigger a bunch of those warnings now.
........
r46585 | georg.brandl | 2006-06-01 08:39:19 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly unpickle 2.4 exceptions via __setstate__ (patch #1498571)
........
r46586 | georg.brandl | 2006-06-01 10:27:32 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly allocate complex types with tp_alloc. (bug #1498638)
........
r46587 | georg.brandl | 2006-06-01 14:30:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Correctly dispatch Faults in loads (patch #1498627)
........
r46588 | georg.brandl | 2006-06-01 15:00:49 +0200 (Thu, 01 Jun 2006) | 3 lines
Some code style tweaks, and remove apply.
........
r46589 | armin.rigo | 2006-06-01 15:19:12 +0200 (Thu, 01 Jun 2006) | 5 lines
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
........
r46590 | tim.peters | 2006-06-01 15:41:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Whitespace normalization.
........
r46591 | tim.peters | 2006-06-01 15:49:23 +0200 (Thu, 01 Jun 2006) | 2 lines
Record bugs 1275608 and 1456209 as being fixed.
........
r46592 | tim.peters | 2006-06-01 15:56:26 +0200 (Thu, 01 Jun 2006) | 5 lines
Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results. The implementations were repaired later during the
sprint, but the new test remained disabled.
........
r46594 | tim.peters | 2006-06-01 17:50:44 +0200 (Thu, 01 Jun 2006) | 7 lines
Armin committed his patch while I was reviewing it (I'm sure
he didn't know this), so merged in some changes I made during
review. Nothing material apart from changing a new `mask` local
from int to Py_ssize_t. Mostly this is repairing comments that
were made incorrect, and adding new comments. Also a few
minor code rewrites for clarity or helpful succinctness.
........
r46599 | neal.norwitz | 2006-06-02 06:45:53 +0200 (Fri, 02 Jun 2006) | 1 line
Convert docstrings to comments so regrtest -v prints method names
........
r46600 | neal.norwitz | 2006-06-02 06:50:49 +0200 (Fri, 02 Jun 2006) | 2 lines
Fix memory leak found by valgrind.
........
r46601 | neal.norwitz | 2006-06-02 06:54:52 +0200 (Fri, 02 Jun 2006) | 1 line
More memory leaks from valgrind
........
r46602 | neal.norwitz | 2006-06-02 08:23:00 +0200 (Fri, 02 Jun 2006) | 11 lines
Patch #1357836:
Prevent an invalid memory read from test_coding in case the done flag is set.
In that case, the loop isn't entered. I wonder if rather than setting
the done flag in the cases before the loop, if they should just exit early.
This code looks like it should be refactored.
Backport candidate (also the early break above if decoding_fgets fails)
........
r46603 | martin.blais | 2006-06-02 15:03:43 +0200 (Fri, 02 Jun 2006) | 1 line
Fixed struct test to not use unittest.
........
r46605 | tim.peters | 2006-06-03 01:22:51 +0200 (Sat, 03 Jun 2006) | 10 lines
pprint functions used to sort a dict (by key) if and only if
the output required more than one line. "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__). None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.
This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
........
2006-06-08 11:42:34 -03:00
|
|
|
if (PyTuple_GET_SIZE(args) == 0) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_XDECREF(g->ob_callback);
|
|
|
|
Py_XDECREF(g->ob_callback_arg);
|
1991-08-07 08:32:58 -03:00
|
|
|
g->ob_callback = NULL;
|
|
|
|
g->ob_callback_arg = NULL;
|
|
|
|
}
|
|
|
|
else {
|
Partially merge trunk into p3yk. The removal of Mac/Tools is confusing svn
merge in bad ways, so I'll have to merge that extra-carefully (probably manually.)
Merged revisions 46495-46605 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r46495 | tim.peters | 2006-05-28 03:52:38 +0200 (Sun, 28 May 2006) | 2 lines
Added missing svn:eol-style property to text files.
........
r46497 | tim.peters | 2006-05-28 12:41:29 +0200 (Sun, 28 May 2006) | 3 lines
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
........
r46499 | fredrik.lundh | 2006-05-28 14:06:46 +0200 (Sun, 28 May 2006) | 5 lines
needforspeed: added Py_MEMCPY macro (currently tuned for Visual C only),
and use it for string copy operations. this gives a 20% speedup on some
string benchmarks.
........
r46501 | michael.hudson | 2006-05-28 17:51:40 +0200 (Sun, 28 May 2006) | 26 lines
Quality control, meet exceptions.c.
Fix a number of problems with the need for speed code:
One is doing this sort of thing:
Py_DECREF(self->field);
self->field = newval;
Py_INCREF(self->field);
without being very sure that self->field doesn't start with a
value that has a __del__, because that almost certainly can lead
to segfaults.
As self->args is constrained to be an exact tuple we may as well
exploit this fact consistently. This leads to quite a lot of
simplification (and, hey, probably better performance).
Add some error checking in places lacking it.
Fix some rather strange indentation in the Unicode code.
Delete some trailing whitespace.
More to come, I haven't fixed all the reference leaks yet...
........
r46502 | george.yoshida | 2006-05-28 18:39:09 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
........
r46503 | martin.v.loewis | 2006-05-28 18:57:38 +0200 (Sun, 28 May 2006) | 4 lines
Rest of patch #1490384: Commit icon source, remove
claim that Erik von Blokland is the author of the
installer picture.
........
r46504 | michael.hudson | 2006-05-28 19:40:29 +0200 (Sun, 28 May 2006) | 16 lines
Quality control, meet exceptions.c, round two.
Make some functions that should have been static static.
Fix a bunch of refleaks by fixing the definition of
MiddlingExtendsException.
Remove all the __new__ implementations apart from
BaseException_new. Rewrite most code that needs it to cope with
NULL fields (such code could get excercised anyway, the
__new__-removal just makes it more likely). This involved
editing the code for WindowsError, which I can't test.
This fixes all the refleaks in at least the start of a regrtest
-R :: run.
........
r46505 | marc-andre.lemburg | 2006-05-28 19:46:58 +0200 (Sun, 28 May 2006) | 10 lines
Initial version of systimes - a module to provide platform dependent
performance measurements.
The module is currently just a proof-of-concept implementation, but
will integrated into pybench once it is stable enough.
License: pybench license.
Author: Marc-Andre Lemburg.
........
r46507 | armin.rigo | 2006-05-28 21:13:17 +0200 (Sun, 28 May 2006) | 15 lines
("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.
Remaining open issues:
* test_extcall is an output test, messy to make robust
* tarfile.py has a potential bug here, but I'm not familiar
enough with this code. Filed in as SF bug #1496501.
* urllib2.HTTPPasswordMgr() returns a random result if there is more
than one matching root path. I'm asking python-dev for
clarification...
........
r46508 | georg.brandl | 2006-05-28 22:11:45 +0200 (Sun, 28 May 2006) | 4 lines
The empty string is a valid import path.
(fixes #1496539)
........
r46509 | georg.brandl | 2006-05-28 22:23:12 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1496206: urllib2 PasswordMgr ./. default ports
........
r46510 | georg.brandl | 2006-05-28 22:57:09 +0200 (Sun, 28 May 2006) | 3 lines
Fix refleaks in UnicodeError get and set methods.
........
r46511 | michael.hudson | 2006-05-28 23:19:03 +0200 (Sun, 28 May 2006) | 3 lines
use the UnicodeError traversal and clearing functions in UnicodeError
subclasses.
........
r46512 | thomas.wouters | 2006-05-28 23:32:12 +0200 (Sun, 28 May 2006) | 4 lines
Make last patch valid C89 so Windows compilers can deal with it.
........
r46513 | georg.brandl | 2006-05-28 23:42:54 +0200 (Sun, 28 May 2006) | 3 lines
Fix ref-antileak in _struct.c which eventually lead to deallocating None.
........
r46514 | georg.brandl | 2006-05-28 23:57:35 +0200 (Sun, 28 May 2006) | 4 lines
Correct None refcount issue in Mac modules. (Are they
still used?)
........
r46515 | armin.rigo | 2006-05-29 00:07:08 +0200 (Mon, 29 May 2006) | 3 lines
A clearer error message when passing -R to regrtest.py with
release builds of Python.
........
r46516 | georg.brandl | 2006-05-29 00:14:04 +0200 (Mon, 29 May 2006) | 3 lines
Fix C function calling conventions in _sre module.
........
r46517 | georg.brandl | 2006-05-29 00:34:51 +0200 (Mon, 29 May 2006) | 3 lines
Convert audioop over to METH_VARARGS.
........
r46518 | georg.brandl | 2006-05-29 00:38:57 +0200 (Mon, 29 May 2006) | 3 lines
METH_NOARGS functions do get called with two args.
........
r46519 | georg.brandl | 2006-05-29 11:46:51 +0200 (Mon, 29 May 2006) | 4 lines
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.
........
r46520 | nick.coghlan | 2006-05-29 14:43:05 +0200 (Mon, 29 May 2006) | 7 lines
Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
........
r46522 | georg.brandl | 2006-05-29 15:53:16 +0200 (Mon, 29 May 2006) | 3 lines
Convert fmmodule to METH_VARARGS.
........
r46523 | georg.brandl | 2006-05-29 16:13:21 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494605.
........
r46524 | georg.brandl | 2006-05-29 16:28:05 +0200 (Mon, 29 May 2006) | 3 lines
Handle PyMem_Malloc failure in pystrtod.c. Closes #1494671.
........
r46525 | georg.brandl | 2006-05-29 16:33:55 +0200 (Mon, 29 May 2006) | 3 lines
Fix compiler warning.
........
r46526 | georg.brandl | 2006-05-29 16:39:00 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494787 (pyclbr counts whitespace as superclass name)
........
r46527 | bob.ippolito | 2006-05-29 17:47:29 +0200 (Mon, 29 May 2006) | 1 line
simplify the struct code a bit (no functional changes)
........
r46528 | armin.rigo | 2006-05-29 19:59:47 +0200 (Mon, 29 May 2006) | 2 lines
Silence a warning.
........
r46529 | georg.brandl | 2006-05-29 21:39:45 +0200 (Mon, 29 May 2006) | 3 lines
Correct some value converting strangenesses.
........
r46530 | nick.coghlan | 2006-05-29 22:27:44 +0200 (Mon, 29 May 2006) | 1 line
When adding a module like functools, it helps to let SVN know about the file.
........
r46531 | georg.brandl | 2006-05-29 22:52:54 +0200 (Mon, 29 May 2006) | 4 lines
Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
........
r46532 | georg.brandl | 2006-05-29 22:57:01 +0200 (Mon, 29 May 2006) | 3 lines
Add News entry for last commit.
........
r46533 | georg.brandl | 2006-05-29 23:04:52 +0200 (Mon, 29 May 2006) | 4 lines
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
........
r46534 | georg.brandl | 2006-05-29 23:58:42 +0200 (Mon, 29 May 2006) | 3 lines
Convert more modules to METH_VARARGS.
........
r46535 | georg.brandl | 2006-05-30 00:00:30 +0200 (Tue, 30 May 2006) | 3 lines
Whoops.
........
r46536 | fredrik.lundh | 2006-05-30 00:42:07 +0200 (Tue, 30 May 2006) | 4 lines
fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
........
r46537 | bob.ippolito | 2006-05-30 00:55:48 +0200 (Tue, 30 May 2006) | 1 line
struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly)
........
r46539 | bob.ippolito | 2006-05-30 02:26:01 +0200 (Tue, 30 May 2006) | 1 line
Add a length check to aifc to ensure it doesn't write a bogus file
........
r46540 | tim.peters | 2006-05-30 04:25:25 +0200 (Tue, 30 May 2006) | 10 lines
deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:
test_genexps (or any other doctest-based test)
test_struct
test_doctest
The `warnings` module needs an advertised way to save/restore
its internal filter list.
........
r46541 | tim.peters | 2006-05-30 04:26:46 +0200 (Tue, 30 May 2006) | 2 lines
Whitespace normalization.
........
r46542 | tim.peters | 2006-05-30 04:30:30 +0200 (Tue, 30 May 2006) | 2 lines
Set a binary svn:mime-type property on this UTF-8 encoded file.
........
r46543 | neal.norwitz | 2006-05-30 05:18:50 +0200 (Tue, 30 May 2006) | 1 line
Simplify further by using AddStringConstant
........
r46544 | tim.peters | 2006-05-30 06:16:25 +0200 (Tue, 30 May 2006) | 6 lines
Convert relevant dict internals to Py_ssize_t.
I don't have a box with nearly enough RAM, or an OS,
that could get close to tickling this, though (requires
a dict w/ at least 2**31 entries).
........
r46545 | neal.norwitz | 2006-05-30 06:19:21 +0200 (Tue, 30 May 2006) | 1 line
Remove stray | in comment
........
r46546 | neal.norwitz | 2006-05-30 06:25:05 +0200 (Tue, 30 May 2006) | 1 line
Use Py_SAFE_DOWNCAST for safety. Fix format strings. Remove 2 more stray | in comment
........
r46547 | neal.norwitz | 2006-05-30 06:43:23 +0200 (Tue, 30 May 2006) | 1 line
No DOWNCAST is required since sizeof(Py_ssize_t) >= sizeof(int) and Py_ReprEntr returns an int
........
r46548 | tim.peters | 2006-05-30 07:04:59 +0200 (Tue, 30 May 2006) | 3 lines
dict_print(): Explicitly narrow the return value
from a (possibly) wider variable.
........
r46549 | tim.peters | 2006-05-30 07:23:59 +0200 (Tue, 30 May 2006) | 5 lines
dict_print(): So that Neal & I don't spend the rest of
our lives taking turns rewriting code that works ;-),
get rid of casting illusions by declaring a new variable
with the obvious type.
........
r46550 | georg.brandl | 2006-05-30 09:04:55 +0200 (Tue, 30 May 2006) | 3 lines
Restore exception pickle support. #1497319.
........
r46551 | georg.brandl | 2006-05-30 09:13:29 +0200 (Tue, 30 May 2006) | 3 lines
Add a test case for exception pickling. args is never NULL.
........
r46552 | neal.norwitz | 2006-05-30 09:21:10 +0200 (Tue, 30 May 2006) | 1 line
Don't fail if the (sub)pkgname already exist.
........
r46553 | georg.brandl | 2006-05-30 09:34:45 +0200 (Tue, 30 May 2006) | 3 lines
Disallow keyword args for exceptions.
........
r46554 | neal.norwitz | 2006-05-30 09:36:54 +0200 (Tue, 30 May 2006) | 5 lines
I'm impatient. I think this will fix a few more problems with the buildbots.
I'm not sure this is the best approach, but I can't think of anything better.
If this creates problems, feel free to revert, but I think it's safe and
should make things a little better.
........
r46555 | georg.brandl | 2006-05-30 10:17:00 +0200 (Tue, 30 May 2006) | 4 lines
Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
........
r46556 | georg.brandl | 2006-05-30 10:47:19 +0200 (Tue, 30 May 2006) | 3 lines
Convert test_exceptions to unittest.
........
r46557 | andrew.kuchling | 2006-05-30 14:52:01 +0200 (Tue, 30 May 2006) | 1 line
Add SoC name, and reorganize this section a bit
........
r46559 | tim.peters | 2006-05-30 17:53:34 +0200 (Tue, 30 May 2006) | 11 lines
PyLong_FromString(): Continued fraction analysis (explained in
a new comment) suggests there are almost certainly large input
integers in all non-binary input bases for which one Python digit
too few is initally allocated to hold the final result. Instead
of assert-failing when that happens, allocate more space. Alas,
I estimate it would take a few days to find a specific such case,
so this isn't backed up by a new test (not to mention that such
a case may take hours to run, since conversion time is quadratic
in the number of digits, and preliminary attempts suggested that
the smallest such inputs contain at least a million digits).
........
r46560 | fredrik.lundh | 2006-05-30 19:11:48 +0200 (Tue, 30 May 2006) | 3 lines
changed find/rfind to return -1 for matches outside the source string
........
r46561 | bob.ippolito | 2006-05-30 19:37:54 +0200 (Tue, 30 May 2006) | 1 line
Change wrapping terminology to overflow masking
........
r46562 | fredrik.lundh | 2006-05-30 19:39:58 +0200 (Tue, 30 May 2006) | 3 lines
changed count to return 0 for slices outside the source string
........
r46568 | tim.peters | 2006-05-31 01:28:02 +0200 (Wed, 31 May 2006) | 2 lines
Whitespace normalization.
........
r46569 | brett.cannon | 2006-05-31 04:19:54 +0200 (Wed, 31 May 2006) | 5 lines
Clarify wording on default values for strptime(); defaults are used when better
values cannot be inferred.
Closes bug #1496315.
........
r46572 | neal.norwitz | 2006-05-31 09:43:27 +0200 (Wed, 31 May 2006) | 1 line
Calculate smallest properly (it was off by one) and use proper ssize_t types for Win64
........
r46573 | neal.norwitz | 2006-05-31 10:01:08 +0200 (Wed, 31 May 2006) | 1 line
Revert last checkin, it is better to do make distclean
........
r46574 | neal.norwitz | 2006-05-31 11:02:44 +0200 (Wed, 31 May 2006) | 3 lines
On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
........
r46575 | thomas.heller | 2006-05-31 13:37:58 +0200 (Wed, 31 May 2006) | 3 lines
PyTuple_Pack is not available in Python 2.3, but ctypes must stay
compatible with that.
........
r46576 | andrew.kuchling | 2006-05-31 15:18:56 +0200 (Wed, 31 May 2006) | 1 line
'functional' module was renamed to 'functools'
........
r46577 | kristjan.jonsson | 2006-05-31 15:35:41 +0200 (Wed, 31 May 2006) | 1 line
Fixup the PCBuild8 project directory. exceptions.c have moved to Objects, and the functionalmodule.c has been replaced with _functoolsmodule.c. Other minor changes to .vcproj files and .sln to fix compilation
........
r46578 | andrew.kuchling | 2006-05-31 16:08:48 +0200 (Wed, 31 May 2006) | 15 lines
[Bug #1473048]
SimpleXMLRPCServer and DocXMLRPCServer don't look at
the path of the HTTP request at all; you can POST or
GET from / or /RPC2 or /blahblahblah with the same results.
Security scanners that look for /cgi-bin/phf will therefore report
lots of vulnerabilities.
Fix: add a .rpc_paths attribute to the SimpleXMLRPCServer class,
and report a 404 error if the path isn't on the allowed list.
Possibly-controversial aspect of this change: the default makes only
'/' and '/RPC2' legal. Maybe this will break people's applications
(though I doubt it). We could just set the default to an empty tuple,
which would exactly match the current behaviour.
........
r46579 | andrew.kuchling | 2006-05-31 16:12:47 +0200 (Wed, 31 May 2006) | 1 line
Mention SimpleXMLRPCServer change
........
r46580 | tim.peters | 2006-05-31 16:28:07 +0200 (Wed, 31 May 2006) | 2 lines
Trimmed trailing whitespace.
........
r46581 | tim.peters | 2006-05-31 17:33:22 +0200 (Wed, 31 May 2006) | 4 lines
_range_error(): Speed and simplify (there's no real need for
loops here). Assert that size_t is actually big enough, and
that f->size is at least one. Wrap a long line.
........
r46582 | tim.peters | 2006-05-31 17:34:37 +0200 (Wed, 31 May 2006) | 2 lines
Repaired error in new comment.
........
r46584 | neal.norwitz | 2006-06-01 07:32:49 +0200 (Thu, 01 Jun 2006) | 4 lines
Remove ; at end of macro. There was a compiler recently that warned
about extra semi-colons. It may have been the HP C compiler.
This file will trigger a bunch of those warnings now.
........
r46585 | georg.brandl | 2006-06-01 08:39:19 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly unpickle 2.4 exceptions via __setstate__ (patch #1498571)
........
r46586 | georg.brandl | 2006-06-01 10:27:32 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly allocate complex types with tp_alloc. (bug #1498638)
........
r46587 | georg.brandl | 2006-06-01 14:30:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Correctly dispatch Faults in loads (patch #1498627)
........
r46588 | georg.brandl | 2006-06-01 15:00:49 +0200 (Thu, 01 Jun 2006) | 3 lines
Some code style tweaks, and remove apply.
........
r46589 | armin.rigo | 2006-06-01 15:19:12 +0200 (Thu, 01 Jun 2006) | 5 lines
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
........
r46590 | tim.peters | 2006-06-01 15:41:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Whitespace normalization.
........
r46591 | tim.peters | 2006-06-01 15:49:23 +0200 (Thu, 01 Jun 2006) | 2 lines
Record bugs 1275608 and 1456209 as being fixed.
........
r46592 | tim.peters | 2006-06-01 15:56:26 +0200 (Thu, 01 Jun 2006) | 5 lines
Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results. The implementations were repaired later during the
sprint, but the new test remained disabled.
........
r46594 | tim.peters | 2006-06-01 17:50:44 +0200 (Thu, 01 Jun 2006) | 7 lines
Armin committed his patch while I was reviewing it (I'm sure
he didn't know this), so merged in some changes I made during
review. Nothing material apart from changing a new `mask` local
from int to Py_ssize_t. Mostly this is repairing comments that
were made incorrect, and adding new comments. Also a few
minor code rewrites for clarity or helpful succinctness.
........
r46599 | neal.norwitz | 2006-06-02 06:45:53 +0200 (Fri, 02 Jun 2006) | 1 line
Convert docstrings to comments so regrtest -v prints method names
........
r46600 | neal.norwitz | 2006-06-02 06:50:49 +0200 (Fri, 02 Jun 2006) | 2 lines
Fix memory leak found by valgrind.
........
r46601 | neal.norwitz | 2006-06-02 06:54:52 +0200 (Fri, 02 Jun 2006) | 1 line
More memory leaks from valgrind
........
r46602 | neal.norwitz | 2006-06-02 08:23:00 +0200 (Fri, 02 Jun 2006) | 11 lines
Patch #1357836:
Prevent an invalid memory read from test_coding in case the done flag is set.
In that case, the loop isn't entered. I wonder if rather than setting
the done flag in the cases before the loop, if they should just exit early.
This code looks like it should be refactored.
Backport candidate (also the early break above if decoding_fgets fails)
........
r46603 | martin.blais | 2006-06-02 15:03:43 +0200 (Fri, 02 Jun 2006) | 1 line
Fixed struct test to not use unittest.
........
r46605 | tim.peters | 2006-06-03 01:22:51 +0200 (Sat, 03 Jun 2006) | 10 lines
pprint functions used to sort a dict (by key) if and only if
the output required more than one line. "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__). None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.
This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
........
2006-06-08 11:42:34 -03:00
|
|
|
PyObject *a, *b;
|
|
|
|
if (!PyArg_UnpackTuple(args, "set_call_back", 2, 2, &a, &b)
|
|
|
|
return NULL;
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_XDECREF(g->ob_callback);
|
|
|
|
Py_XDECREF(g->ob_callback_arg);
|
Partially merge trunk into p3yk. The removal of Mac/Tools is confusing svn
merge in bad ways, so I'll have to merge that extra-carefully (probably manually.)
Merged revisions 46495-46605 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r46495 | tim.peters | 2006-05-28 03:52:38 +0200 (Sun, 28 May 2006) | 2 lines
Added missing svn:eol-style property to text files.
........
r46497 | tim.peters | 2006-05-28 12:41:29 +0200 (Sun, 28 May 2006) | 3 lines
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
........
r46499 | fredrik.lundh | 2006-05-28 14:06:46 +0200 (Sun, 28 May 2006) | 5 lines
needforspeed: added Py_MEMCPY macro (currently tuned for Visual C only),
and use it for string copy operations. this gives a 20% speedup on some
string benchmarks.
........
r46501 | michael.hudson | 2006-05-28 17:51:40 +0200 (Sun, 28 May 2006) | 26 lines
Quality control, meet exceptions.c.
Fix a number of problems with the need for speed code:
One is doing this sort of thing:
Py_DECREF(self->field);
self->field = newval;
Py_INCREF(self->field);
without being very sure that self->field doesn't start with a
value that has a __del__, because that almost certainly can lead
to segfaults.
As self->args is constrained to be an exact tuple we may as well
exploit this fact consistently. This leads to quite a lot of
simplification (and, hey, probably better performance).
Add some error checking in places lacking it.
Fix some rather strange indentation in the Unicode code.
Delete some trailing whitespace.
More to come, I haven't fixed all the reference leaks yet...
........
r46502 | george.yoshida | 2006-05-28 18:39:09 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
........
r46503 | martin.v.loewis | 2006-05-28 18:57:38 +0200 (Sun, 28 May 2006) | 4 lines
Rest of patch #1490384: Commit icon source, remove
claim that Erik von Blokland is the author of the
installer picture.
........
r46504 | michael.hudson | 2006-05-28 19:40:29 +0200 (Sun, 28 May 2006) | 16 lines
Quality control, meet exceptions.c, round two.
Make some functions that should have been static static.
Fix a bunch of refleaks by fixing the definition of
MiddlingExtendsException.
Remove all the __new__ implementations apart from
BaseException_new. Rewrite most code that needs it to cope with
NULL fields (such code could get excercised anyway, the
__new__-removal just makes it more likely). This involved
editing the code for WindowsError, which I can't test.
This fixes all the refleaks in at least the start of a regrtest
-R :: run.
........
r46505 | marc-andre.lemburg | 2006-05-28 19:46:58 +0200 (Sun, 28 May 2006) | 10 lines
Initial version of systimes - a module to provide platform dependent
performance measurements.
The module is currently just a proof-of-concept implementation, but
will integrated into pybench once it is stable enough.
License: pybench license.
Author: Marc-Andre Lemburg.
........
r46507 | armin.rigo | 2006-05-28 21:13:17 +0200 (Sun, 28 May 2006) | 15 lines
("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.
Remaining open issues:
* test_extcall is an output test, messy to make robust
* tarfile.py has a potential bug here, but I'm not familiar
enough with this code. Filed in as SF bug #1496501.
* urllib2.HTTPPasswordMgr() returns a random result if there is more
than one matching root path. I'm asking python-dev for
clarification...
........
r46508 | georg.brandl | 2006-05-28 22:11:45 +0200 (Sun, 28 May 2006) | 4 lines
The empty string is a valid import path.
(fixes #1496539)
........
r46509 | georg.brandl | 2006-05-28 22:23:12 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1496206: urllib2 PasswordMgr ./. default ports
........
r46510 | georg.brandl | 2006-05-28 22:57:09 +0200 (Sun, 28 May 2006) | 3 lines
Fix refleaks in UnicodeError get and set methods.
........
r46511 | michael.hudson | 2006-05-28 23:19:03 +0200 (Sun, 28 May 2006) | 3 lines
use the UnicodeError traversal and clearing functions in UnicodeError
subclasses.
........
r46512 | thomas.wouters | 2006-05-28 23:32:12 +0200 (Sun, 28 May 2006) | 4 lines
Make last patch valid C89 so Windows compilers can deal with it.
........
r46513 | georg.brandl | 2006-05-28 23:42:54 +0200 (Sun, 28 May 2006) | 3 lines
Fix ref-antileak in _struct.c which eventually lead to deallocating None.
........
r46514 | georg.brandl | 2006-05-28 23:57:35 +0200 (Sun, 28 May 2006) | 4 lines
Correct None refcount issue in Mac modules. (Are they
still used?)
........
r46515 | armin.rigo | 2006-05-29 00:07:08 +0200 (Mon, 29 May 2006) | 3 lines
A clearer error message when passing -R to regrtest.py with
release builds of Python.
........
r46516 | georg.brandl | 2006-05-29 00:14:04 +0200 (Mon, 29 May 2006) | 3 lines
Fix C function calling conventions in _sre module.
........
r46517 | georg.brandl | 2006-05-29 00:34:51 +0200 (Mon, 29 May 2006) | 3 lines
Convert audioop over to METH_VARARGS.
........
r46518 | georg.brandl | 2006-05-29 00:38:57 +0200 (Mon, 29 May 2006) | 3 lines
METH_NOARGS functions do get called with two args.
........
r46519 | georg.brandl | 2006-05-29 11:46:51 +0200 (Mon, 29 May 2006) | 4 lines
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.
........
r46520 | nick.coghlan | 2006-05-29 14:43:05 +0200 (Mon, 29 May 2006) | 7 lines
Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
........
r46522 | georg.brandl | 2006-05-29 15:53:16 +0200 (Mon, 29 May 2006) | 3 lines
Convert fmmodule to METH_VARARGS.
........
r46523 | georg.brandl | 2006-05-29 16:13:21 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494605.
........
r46524 | georg.brandl | 2006-05-29 16:28:05 +0200 (Mon, 29 May 2006) | 3 lines
Handle PyMem_Malloc failure in pystrtod.c. Closes #1494671.
........
r46525 | georg.brandl | 2006-05-29 16:33:55 +0200 (Mon, 29 May 2006) | 3 lines
Fix compiler warning.
........
r46526 | georg.brandl | 2006-05-29 16:39:00 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494787 (pyclbr counts whitespace as superclass name)
........
r46527 | bob.ippolito | 2006-05-29 17:47:29 +0200 (Mon, 29 May 2006) | 1 line
simplify the struct code a bit (no functional changes)
........
r46528 | armin.rigo | 2006-05-29 19:59:47 +0200 (Mon, 29 May 2006) | 2 lines
Silence a warning.
........
r46529 | georg.brandl | 2006-05-29 21:39:45 +0200 (Mon, 29 May 2006) | 3 lines
Correct some value converting strangenesses.
........
r46530 | nick.coghlan | 2006-05-29 22:27:44 +0200 (Mon, 29 May 2006) | 1 line
When adding a module like functools, it helps to let SVN know about the file.
........
r46531 | georg.brandl | 2006-05-29 22:52:54 +0200 (Mon, 29 May 2006) | 4 lines
Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
........
r46532 | georg.brandl | 2006-05-29 22:57:01 +0200 (Mon, 29 May 2006) | 3 lines
Add News entry for last commit.
........
r46533 | georg.brandl | 2006-05-29 23:04:52 +0200 (Mon, 29 May 2006) | 4 lines
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
........
r46534 | georg.brandl | 2006-05-29 23:58:42 +0200 (Mon, 29 May 2006) | 3 lines
Convert more modules to METH_VARARGS.
........
r46535 | georg.brandl | 2006-05-30 00:00:30 +0200 (Tue, 30 May 2006) | 3 lines
Whoops.
........
r46536 | fredrik.lundh | 2006-05-30 00:42:07 +0200 (Tue, 30 May 2006) | 4 lines
fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
........
r46537 | bob.ippolito | 2006-05-30 00:55:48 +0200 (Tue, 30 May 2006) | 1 line
struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly)
........
r46539 | bob.ippolito | 2006-05-30 02:26:01 +0200 (Tue, 30 May 2006) | 1 line
Add a length check to aifc to ensure it doesn't write a bogus file
........
r46540 | tim.peters | 2006-05-30 04:25:25 +0200 (Tue, 30 May 2006) | 10 lines
deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:
test_genexps (or any other doctest-based test)
test_struct
test_doctest
The `warnings` module needs an advertised way to save/restore
its internal filter list.
........
r46541 | tim.peters | 2006-05-30 04:26:46 +0200 (Tue, 30 May 2006) | 2 lines
Whitespace normalization.
........
r46542 | tim.peters | 2006-05-30 04:30:30 +0200 (Tue, 30 May 2006) | 2 lines
Set a binary svn:mime-type property on this UTF-8 encoded file.
........
r46543 | neal.norwitz | 2006-05-30 05:18:50 +0200 (Tue, 30 May 2006) | 1 line
Simplify further by using AddStringConstant
........
r46544 | tim.peters | 2006-05-30 06:16:25 +0200 (Tue, 30 May 2006) | 6 lines
Convert relevant dict internals to Py_ssize_t.
I don't have a box with nearly enough RAM, or an OS,
that could get close to tickling this, though (requires
a dict w/ at least 2**31 entries).
........
r46545 | neal.norwitz | 2006-05-30 06:19:21 +0200 (Tue, 30 May 2006) | 1 line
Remove stray | in comment
........
r46546 | neal.norwitz | 2006-05-30 06:25:05 +0200 (Tue, 30 May 2006) | 1 line
Use Py_SAFE_DOWNCAST for safety. Fix format strings. Remove 2 more stray | in comment
........
r46547 | neal.norwitz | 2006-05-30 06:43:23 +0200 (Tue, 30 May 2006) | 1 line
No DOWNCAST is required since sizeof(Py_ssize_t) >= sizeof(int) and Py_ReprEntr returns an int
........
r46548 | tim.peters | 2006-05-30 07:04:59 +0200 (Tue, 30 May 2006) | 3 lines
dict_print(): Explicitly narrow the return value
from a (possibly) wider variable.
........
r46549 | tim.peters | 2006-05-30 07:23:59 +0200 (Tue, 30 May 2006) | 5 lines
dict_print(): So that Neal & I don't spend the rest of
our lives taking turns rewriting code that works ;-),
get rid of casting illusions by declaring a new variable
with the obvious type.
........
r46550 | georg.brandl | 2006-05-30 09:04:55 +0200 (Tue, 30 May 2006) | 3 lines
Restore exception pickle support. #1497319.
........
r46551 | georg.brandl | 2006-05-30 09:13:29 +0200 (Tue, 30 May 2006) | 3 lines
Add a test case for exception pickling. args is never NULL.
........
r46552 | neal.norwitz | 2006-05-30 09:21:10 +0200 (Tue, 30 May 2006) | 1 line
Don't fail if the (sub)pkgname already exist.
........
r46553 | georg.brandl | 2006-05-30 09:34:45 +0200 (Tue, 30 May 2006) | 3 lines
Disallow keyword args for exceptions.
........
r46554 | neal.norwitz | 2006-05-30 09:36:54 +0200 (Tue, 30 May 2006) | 5 lines
I'm impatient. I think this will fix a few more problems with the buildbots.
I'm not sure this is the best approach, but I can't think of anything better.
If this creates problems, feel free to revert, but I think it's safe and
should make things a little better.
........
r46555 | georg.brandl | 2006-05-30 10:17:00 +0200 (Tue, 30 May 2006) | 4 lines
Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
........
r46556 | georg.brandl | 2006-05-30 10:47:19 +0200 (Tue, 30 May 2006) | 3 lines
Convert test_exceptions to unittest.
........
r46557 | andrew.kuchling | 2006-05-30 14:52:01 +0200 (Tue, 30 May 2006) | 1 line
Add SoC name, and reorganize this section a bit
........
r46559 | tim.peters | 2006-05-30 17:53:34 +0200 (Tue, 30 May 2006) | 11 lines
PyLong_FromString(): Continued fraction analysis (explained in
a new comment) suggests there are almost certainly large input
integers in all non-binary input bases for which one Python digit
too few is initally allocated to hold the final result. Instead
of assert-failing when that happens, allocate more space. Alas,
I estimate it would take a few days to find a specific such case,
so this isn't backed up by a new test (not to mention that such
a case may take hours to run, since conversion time is quadratic
in the number of digits, and preliminary attempts suggested that
the smallest such inputs contain at least a million digits).
........
r46560 | fredrik.lundh | 2006-05-30 19:11:48 +0200 (Tue, 30 May 2006) | 3 lines
changed find/rfind to return -1 for matches outside the source string
........
r46561 | bob.ippolito | 2006-05-30 19:37:54 +0200 (Tue, 30 May 2006) | 1 line
Change wrapping terminology to overflow masking
........
r46562 | fredrik.lundh | 2006-05-30 19:39:58 +0200 (Tue, 30 May 2006) | 3 lines
changed count to return 0 for slices outside the source string
........
r46568 | tim.peters | 2006-05-31 01:28:02 +0200 (Wed, 31 May 2006) | 2 lines
Whitespace normalization.
........
r46569 | brett.cannon | 2006-05-31 04:19:54 +0200 (Wed, 31 May 2006) | 5 lines
Clarify wording on default values for strptime(); defaults are used when better
values cannot be inferred.
Closes bug #1496315.
........
r46572 | neal.norwitz | 2006-05-31 09:43:27 +0200 (Wed, 31 May 2006) | 1 line
Calculate smallest properly (it was off by one) and use proper ssize_t types for Win64
........
r46573 | neal.norwitz | 2006-05-31 10:01:08 +0200 (Wed, 31 May 2006) | 1 line
Revert last checkin, it is better to do make distclean
........
r46574 | neal.norwitz | 2006-05-31 11:02:44 +0200 (Wed, 31 May 2006) | 3 lines
On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
........
r46575 | thomas.heller | 2006-05-31 13:37:58 +0200 (Wed, 31 May 2006) | 3 lines
PyTuple_Pack is not available in Python 2.3, but ctypes must stay
compatible with that.
........
r46576 | andrew.kuchling | 2006-05-31 15:18:56 +0200 (Wed, 31 May 2006) | 1 line
'functional' module was renamed to 'functools'
........
r46577 | kristjan.jonsson | 2006-05-31 15:35:41 +0200 (Wed, 31 May 2006) | 1 line
Fixup the PCBuild8 project directory. exceptions.c have moved to Objects, and the functionalmodule.c has been replaced with _functoolsmodule.c. Other minor changes to .vcproj files and .sln to fix compilation
........
r46578 | andrew.kuchling | 2006-05-31 16:08:48 +0200 (Wed, 31 May 2006) | 15 lines
[Bug #1473048]
SimpleXMLRPCServer and DocXMLRPCServer don't look at
the path of the HTTP request at all; you can POST or
GET from / or /RPC2 or /blahblahblah with the same results.
Security scanners that look for /cgi-bin/phf will therefore report
lots of vulnerabilities.
Fix: add a .rpc_paths attribute to the SimpleXMLRPCServer class,
and report a 404 error if the path isn't on the allowed list.
Possibly-controversial aspect of this change: the default makes only
'/' and '/RPC2' legal. Maybe this will break people's applications
(though I doubt it). We could just set the default to an empty tuple,
which would exactly match the current behaviour.
........
r46579 | andrew.kuchling | 2006-05-31 16:12:47 +0200 (Wed, 31 May 2006) | 1 line
Mention SimpleXMLRPCServer change
........
r46580 | tim.peters | 2006-05-31 16:28:07 +0200 (Wed, 31 May 2006) | 2 lines
Trimmed trailing whitespace.
........
r46581 | tim.peters | 2006-05-31 17:33:22 +0200 (Wed, 31 May 2006) | 4 lines
_range_error(): Speed and simplify (there's no real need for
loops here). Assert that size_t is actually big enough, and
that f->size is at least one. Wrap a long line.
........
r46582 | tim.peters | 2006-05-31 17:34:37 +0200 (Wed, 31 May 2006) | 2 lines
Repaired error in new comment.
........
r46584 | neal.norwitz | 2006-06-01 07:32:49 +0200 (Thu, 01 Jun 2006) | 4 lines
Remove ; at end of macro. There was a compiler recently that warned
about extra semi-colons. It may have been the HP C compiler.
This file will trigger a bunch of those warnings now.
........
r46585 | georg.brandl | 2006-06-01 08:39:19 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly unpickle 2.4 exceptions via __setstate__ (patch #1498571)
........
r46586 | georg.brandl | 2006-06-01 10:27:32 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly allocate complex types with tp_alloc. (bug #1498638)
........
r46587 | georg.brandl | 2006-06-01 14:30:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Correctly dispatch Faults in loads (patch #1498627)
........
r46588 | georg.brandl | 2006-06-01 15:00:49 +0200 (Thu, 01 Jun 2006) | 3 lines
Some code style tweaks, and remove apply.
........
r46589 | armin.rigo | 2006-06-01 15:19:12 +0200 (Thu, 01 Jun 2006) | 5 lines
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
........
r46590 | tim.peters | 2006-06-01 15:41:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Whitespace normalization.
........
r46591 | tim.peters | 2006-06-01 15:49:23 +0200 (Thu, 01 Jun 2006) | 2 lines
Record bugs 1275608 and 1456209 as being fixed.
........
r46592 | tim.peters | 2006-06-01 15:56:26 +0200 (Thu, 01 Jun 2006) | 5 lines
Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results. The implementations were repaired later during the
sprint, but the new test remained disabled.
........
r46594 | tim.peters | 2006-06-01 17:50:44 +0200 (Thu, 01 Jun 2006) | 7 lines
Armin committed his patch while I was reviewing it (I'm sure
he didn't know this), so merged in some changes I made during
review. Nothing material apart from changing a new `mask` local
from int to Py_ssize_t. Mostly this is repairing comments that
were made incorrect, and adding new comments. Also a few
minor code rewrites for clarity or helpful succinctness.
........
r46599 | neal.norwitz | 2006-06-02 06:45:53 +0200 (Fri, 02 Jun 2006) | 1 line
Convert docstrings to comments so regrtest -v prints method names
........
r46600 | neal.norwitz | 2006-06-02 06:50:49 +0200 (Fri, 02 Jun 2006) | 2 lines
Fix memory leak found by valgrind.
........
r46601 | neal.norwitz | 2006-06-02 06:54:52 +0200 (Fri, 02 Jun 2006) | 1 line
More memory leaks from valgrind
........
r46602 | neal.norwitz | 2006-06-02 08:23:00 +0200 (Fri, 02 Jun 2006) | 11 lines
Patch #1357836:
Prevent an invalid memory read from test_coding in case the done flag is set.
In that case, the loop isn't entered. I wonder if rather than setting
the done flag in the cases before the loop, if they should just exit early.
This code looks like it should be refactored.
Backport candidate (also the early break above if decoding_fgets fails)
........
r46603 | martin.blais | 2006-06-02 15:03:43 +0200 (Fri, 02 Jun 2006) | 1 line
Fixed struct test to not use unittest.
........
r46605 | tim.peters | 2006-06-03 01:22:51 +0200 (Sat, 03 Jun 2006) | 10 lines
pprint functions used to sort a dict (by key) if and only if
the output required more than one line. "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__). None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.
This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
........
2006-06-08 11:42:34 -03:00
|
|
|
g->ob_callback = a;
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(g->ob_callback);
|
Partially merge trunk into p3yk. The removal of Mac/Tools is confusing svn
merge in bad ways, so I'll have to merge that extra-carefully (probably manually.)
Merged revisions 46495-46605 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r46495 | tim.peters | 2006-05-28 03:52:38 +0200 (Sun, 28 May 2006) | 2 lines
Added missing svn:eol-style property to text files.
........
r46497 | tim.peters | 2006-05-28 12:41:29 +0200 (Sun, 28 May 2006) | 3 lines
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
........
r46499 | fredrik.lundh | 2006-05-28 14:06:46 +0200 (Sun, 28 May 2006) | 5 lines
needforspeed: added Py_MEMCPY macro (currently tuned for Visual C only),
and use it for string copy operations. this gives a 20% speedup on some
string benchmarks.
........
r46501 | michael.hudson | 2006-05-28 17:51:40 +0200 (Sun, 28 May 2006) | 26 lines
Quality control, meet exceptions.c.
Fix a number of problems with the need for speed code:
One is doing this sort of thing:
Py_DECREF(self->field);
self->field = newval;
Py_INCREF(self->field);
without being very sure that self->field doesn't start with a
value that has a __del__, because that almost certainly can lead
to segfaults.
As self->args is constrained to be an exact tuple we may as well
exploit this fact consistently. This leads to quite a lot of
simplification (and, hey, probably better performance).
Add some error checking in places lacking it.
Fix some rather strange indentation in the Unicode code.
Delete some trailing whitespace.
More to come, I haven't fixed all the reference leaks yet...
........
r46502 | george.yoshida | 2006-05-28 18:39:09 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
........
r46503 | martin.v.loewis | 2006-05-28 18:57:38 +0200 (Sun, 28 May 2006) | 4 lines
Rest of patch #1490384: Commit icon source, remove
claim that Erik von Blokland is the author of the
installer picture.
........
r46504 | michael.hudson | 2006-05-28 19:40:29 +0200 (Sun, 28 May 2006) | 16 lines
Quality control, meet exceptions.c, round two.
Make some functions that should have been static static.
Fix a bunch of refleaks by fixing the definition of
MiddlingExtendsException.
Remove all the __new__ implementations apart from
BaseException_new. Rewrite most code that needs it to cope with
NULL fields (such code could get excercised anyway, the
__new__-removal just makes it more likely). This involved
editing the code for WindowsError, which I can't test.
This fixes all the refleaks in at least the start of a regrtest
-R :: run.
........
r46505 | marc-andre.lemburg | 2006-05-28 19:46:58 +0200 (Sun, 28 May 2006) | 10 lines
Initial version of systimes - a module to provide platform dependent
performance measurements.
The module is currently just a proof-of-concept implementation, but
will integrated into pybench once it is stable enough.
License: pybench license.
Author: Marc-Andre Lemburg.
........
r46507 | armin.rigo | 2006-05-28 21:13:17 +0200 (Sun, 28 May 2006) | 15 lines
("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.
Remaining open issues:
* test_extcall is an output test, messy to make robust
* tarfile.py has a potential bug here, but I'm not familiar
enough with this code. Filed in as SF bug #1496501.
* urllib2.HTTPPasswordMgr() returns a random result if there is more
than one matching root path. I'm asking python-dev for
clarification...
........
r46508 | georg.brandl | 2006-05-28 22:11:45 +0200 (Sun, 28 May 2006) | 4 lines
The empty string is a valid import path.
(fixes #1496539)
........
r46509 | georg.brandl | 2006-05-28 22:23:12 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1496206: urllib2 PasswordMgr ./. default ports
........
r46510 | georg.brandl | 2006-05-28 22:57:09 +0200 (Sun, 28 May 2006) | 3 lines
Fix refleaks in UnicodeError get and set methods.
........
r46511 | michael.hudson | 2006-05-28 23:19:03 +0200 (Sun, 28 May 2006) | 3 lines
use the UnicodeError traversal and clearing functions in UnicodeError
subclasses.
........
r46512 | thomas.wouters | 2006-05-28 23:32:12 +0200 (Sun, 28 May 2006) | 4 lines
Make last patch valid C89 so Windows compilers can deal with it.
........
r46513 | georg.brandl | 2006-05-28 23:42:54 +0200 (Sun, 28 May 2006) | 3 lines
Fix ref-antileak in _struct.c which eventually lead to deallocating None.
........
r46514 | georg.brandl | 2006-05-28 23:57:35 +0200 (Sun, 28 May 2006) | 4 lines
Correct None refcount issue in Mac modules. (Are they
still used?)
........
r46515 | armin.rigo | 2006-05-29 00:07:08 +0200 (Mon, 29 May 2006) | 3 lines
A clearer error message when passing -R to regrtest.py with
release builds of Python.
........
r46516 | georg.brandl | 2006-05-29 00:14:04 +0200 (Mon, 29 May 2006) | 3 lines
Fix C function calling conventions in _sre module.
........
r46517 | georg.brandl | 2006-05-29 00:34:51 +0200 (Mon, 29 May 2006) | 3 lines
Convert audioop over to METH_VARARGS.
........
r46518 | georg.brandl | 2006-05-29 00:38:57 +0200 (Mon, 29 May 2006) | 3 lines
METH_NOARGS functions do get called with two args.
........
r46519 | georg.brandl | 2006-05-29 11:46:51 +0200 (Mon, 29 May 2006) | 4 lines
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.
........
r46520 | nick.coghlan | 2006-05-29 14:43:05 +0200 (Mon, 29 May 2006) | 7 lines
Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
........
r46522 | georg.brandl | 2006-05-29 15:53:16 +0200 (Mon, 29 May 2006) | 3 lines
Convert fmmodule to METH_VARARGS.
........
r46523 | georg.brandl | 2006-05-29 16:13:21 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494605.
........
r46524 | georg.brandl | 2006-05-29 16:28:05 +0200 (Mon, 29 May 2006) | 3 lines
Handle PyMem_Malloc failure in pystrtod.c. Closes #1494671.
........
r46525 | georg.brandl | 2006-05-29 16:33:55 +0200 (Mon, 29 May 2006) | 3 lines
Fix compiler warning.
........
r46526 | georg.brandl | 2006-05-29 16:39:00 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494787 (pyclbr counts whitespace as superclass name)
........
r46527 | bob.ippolito | 2006-05-29 17:47:29 +0200 (Mon, 29 May 2006) | 1 line
simplify the struct code a bit (no functional changes)
........
r46528 | armin.rigo | 2006-05-29 19:59:47 +0200 (Mon, 29 May 2006) | 2 lines
Silence a warning.
........
r46529 | georg.brandl | 2006-05-29 21:39:45 +0200 (Mon, 29 May 2006) | 3 lines
Correct some value converting strangenesses.
........
r46530 | nick.coghlan | 2006-05-29 22:27:44 +0200 (Mon, 29 May 2006) | 1 line
When adding a module like functools, it helps to let SVN know about the file.
........
r46531 | georg.brandl | 2006-05-29 22:52:54 +0200 (Mon, 29 May 2006) | 4 lines
Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
........
r46532 | georg.brandl | 2006-05-29 22:57:01 +0200 (Mon, 29 May 2006) | 3 lines
Add News entry for last commit.
........
r46533 | georg.brandl | 2006-05-29 23:04:52 +0200 (Mon, 29 May 2006) | 4 lines
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
........
r46534 | georg.brandl | 2006-05-29 23:58:42 +0200 (Mon, 29 May 2006) | 3 lines
Convert more modules to METH_VARARGS.
........
r46535 | georg.brandl | 2006-05-30 00:00:30 +0200 (Tue, 30 May 2006) | 3 lines
Whoops.
........
r46536 | fredrik.lundh | 2006-05-30 00:42:07 +0200 (Tue, 30 May 2006) | 4 lines
fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
........
r46537 | bob.ippolito | 2006-05-30 00:55:48 +0200 (Tue, 30 May 2006) | 1 line
struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly)
........
r46539 | bob.ippolito | 2006-05-30 02:26:01 +0200 (Tue, 30 May 2006) | 1 line
Add a length check to aifc to ensure it doesn't write a bogus file
........
r46540 | tim.peters | 2006-05-30 04:25:25 +0200 (Tue, 30 May 2006) | 10 lines
deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:
test_genexps (or any other doctest-based test)
test_struct
test_doctest
The `warnings` module needs an advertised way to save/restore
its internal filter list.
........
r46541 | tim.peters | 2006-05-30 04:26:46 +0200 (Tue, 30 May 2006) | 2 lines
Whitespace normalization.
........
r46542 | tim.peters | 2006-05-30 04:30:30 +0200 (Tue, 30 May 2006) | 2 lines
Set a binary svn:mime-type property on this UTF-8 encoded file.
........
r46543 | neal.norwitz | 2006-05-30 05:18:50 +0200 (Tue, 30 May 2006) | 1 line
Simplify further by using AddStringConstant
........
r46544 | tim.peters | 2006-05-30 06:16:25 +0200 (Tue, 30 May 2006) | 6 lines
Convert relevant dict internals to Py_ssize_t.
I don't have a box with nearly enough RAM, or an OS,
that could get close to tickling this, though (requires
a dict w/ at least 2**31 entries).
........
r46545 | neal.norwitz | 2006-05-30 06:19:21 +0200 (Tue, 30 May 2006) | 1 line
Remove stray | in comment
........
r46546 | neal.norwitz | 2006-05-30 06:25:05 +0200 (Tue, 30 May 2006) | 1 line
Use Py_SAFE_DOWNCAST for safety. Fix format strings. Remove 2 more stray | in comment
........
r46547 | neal.norwitz | 2006-05-30 06:43:23 +0200 (Tue, 30 May 2006) | 1 line
No DOWNCAST is required since sizeof(Py_ssize_t) >= sizeof(int) and Py_ReprEntr returns an int
........
r46548 | tim.peters | 2006-05-30 07:04:59 +0200 (Tue, 30 May 2006) | 3 lines
dict_print(): Explicitly narrow the return value
from a (possibly) wider variable.
........
r46549 | tim.peters | 2006-05-30 07:23:59 +0200 (Tue, 30 May 2006) | 5 lines
dict_print(): So that Neal & I don't spend the rest of
our lives taking turns rewriting code that works ;-),
get rid of casting illusions by declaring a new variable
with the obvious type.
........
r46550 | georg.brandl | 2006-05-30 09:04:55 +0200 (Tue, 30 May 2006) | 3 lines
Restore exception pickle support. #1497319.
........
r46551 | georg.brandl | 2006-05-30 09:13:29 +0200 (Tue, 30 May 2006) | 3 lines
Add a test case for exception pickling. args is never NULL.
........
r46552 | neal.norwitz | 2006-05-30 09:21:10 +0200 (Tue, 30 May 2006) | 1 line
Don't fail if the (sub)pkgname already exist.
........
r46553 | georg.brandl | 2006-05-30 09:34:45 +0200 (Tue, 30 May 2006) | 3 lines
Disallow keyword args for exceptions.
........
r46554 | neal.norwitz | 2006-05-30 09:36:54 +0200 (Tue, 30 May 2006) | 5 lines
I'm impatient. I think this will fix a few more problems with the buildbots.
I'm not sure this is the best approach, but I can't think of anything better.
If this creates problems, feel free to revert, but I think it's safe and
should make things a little better.
........
r46555 | georg.brandl | 2006-05-30 10:17:00 +0200 (Tue, 30 May 2006) | 4 lines
Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
........
r46556 | georg.brandl | 2006-05-30 10:47:19 +0200 (Tue, 30 May 2006) | 3 lines
Convert test_exceptions to unittest.
........
r46557 | andrew.kuchling | 2006-05-30 14:52:01 +0200 (Tue, 30 May 2006) | 1 line
Add SoC name, and reorganize this section a bit
........
r46559 | tim.peters | 2006-05-30 17:53:34 +0200 (Tue, 30 May 2006) | 11 lines
PyLong_FromString(): Continued fraction analysis (explained in
a new comment) suggests there are almost certainly large input
integers in all non-binary input bases for which one Python digit
too few is initally allocated to hold the final result. Instead
of assert-failing when that happens, allocate more space. Alas,
I estimate it would take a few days to find a specific such case,
so this isn't backed up by a new test (not to mention that such
a case may take hours to run, since conversion time is quadratic
in the number of digits, and preliminary attempts suggested that
the smallest such inputs contain at least a million digits).
........
r46560 | fredrik.lundh | 2006-05-30 19:11:48 +0200 (Tue, 30 May 2006) | 3 lines
changed find/rfind to return -1 for matches outside the source string
........
r46561 | bob.ippolito | 2006-05-30 19:37:54 +0200 (Tue, 30 May 2006) | 1 line
Change wrapping terminology to overflow masking
........
r46562 | fredrik.lundh | 2006-05-30 19:39:58 +0200 (Tue, 30 May 2006) | 3 lines
changed count to return 0 for slices outside the source string
........
r46568 | tim.peters | 2006-05-31 01:28:02 +0200 (Wed, 31 May 2006) | 2 lines
Whitespace normalization.
........
r46569 | brett.cannon | 2006-05-31 04:19:54 +0200 (Wed, 31 May 2006) | 5 lines
Clarify wording on default values for strptime(); defaults are used when better
values cannot be inferred.
Closes bug #1496315.
........
r46572 | neal.norwitz | 2006-05-31 09:43:27 +0200 (Wed, 31 May 2006) | 1 line
Calculate smallest properly (it was off by one) and use proper ssize_t types for Win64
........
r46573 | neal.norwitz | 2006-05-31 10:01:08 +0200 (Wed, 31 May 2006) | 1 line
Revert last checkin, it is better to do make distclean
........
r46574 | neal.norwitz | 2006-05-31 11:02:44 +0200 (Wed, 31 May 2006) | 3 lines
On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
........
r46575 | thomas.heller | 2006-05-31 13:37:58 +0200 (Wed, 31 May 2006) | 3 lines
PyTuple_Pack is not available in Python 2.3, but ctypes must stay
compatible with that.
........
r46576 | andrew.kuchling | 2006-05-31 15:18:56 +0200 (Wed, 31 May 2006) | 1 line
'functional' module was renamed to 'functools'
........
r46577 | kristjan.jonsson | 2006-05-31 15:35:41 +0200 (Wed, 31 May 2006) | 1 line
Fixup the PCBuild8 project directory. exceptions.c have moved to Objects, and the functionalmodule.c has been replaced with _functoolsmodule.c. Other minor changes to .vcproj files and .sln to fix compilation
........
r46578 | andrew.kuchling | 2006-05-31 16:08:48 +0200 (Wed, 31 May 2006) | 15 lines
[Bug #1473048]
SimpleXMLRPCServer and DocXMLRPCServer don't look at
the path of the HTTP request at all; you can POST or
GET from / or /RPC2 or /blahblahblah with the same results.
Security scanners that look for /cgi-bin/phf will therefore report
lots of vulnerabilities.
Fix: add a .rpc_paths attribute to the SimpleXMLRPCServer class,
and report a 404 error if the path isn't on the allowed list.
Possibly-controversial aspect of this change: the default makes only
'/' and '/RPC2' legal. Maybe this will break people's applications
(though I doubt it). We could just set the default to an empty tuple,
which would exactly match the current behaviour.
........
r46579 | andrew.kuchling | 2006-05-31 16:12:47 +0200 (Wed, 31 May 2006) | 1 line
Mention SimpleXMLRPCServer change
........
r46580 | tim.peters | 2006-05-31 16:28:07 +0200 (Wed, 31 May 2006) | 2 lines
Trimmed trailing whitespace.
........
r46581 | tim.peters | 2006-05-31 17:33:22 +0200 (Wed, 31 May 2006) | 4 lines
_range_error(): Speed and simplify (there's no real need for
loops here). Assert that size_t is actually big enough, and
that f->size is at least one. Wrap a long line.
........
r46582 | tim.peters | 2006-05-31 17:34:37 +0200 (Wed, 31 May 2006) | 2 lines
Repaired error in new comment.
........
r46584 | neal.norwitz | 2006-06-01 07:32:49 +0200 (Thu, 01 Jun 2006) | 4 lines
Remove ; at end of macro. There was a compiler recently that warned
about extra semi-colons. It may have been the HP C compiler.
This file will trigger a bunch of those warnings now.
........
r46585 | georg.brandl | 2006-06-01 08:39:19 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly unpickle 2.4 exceptions via __setstate__ (patch #1498571)
........
r46586 | georg.brandl | 2006-06-01 10:27:32 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly allocate complex types with tp_alloc. (bug #1498638)
........
r46587 | georg.brandl | 2006-06-01 14:30:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Correctly dispatch Faults in loads (patch #1498627)
........
r46588 | georg.brandl | 2006-06-01 15:00:49 +0200 (Thu, 01 Jun 2006) | 3 lines
Some code style tweaks, and remove apply.
........
r46589 | armin.rigo | 2006-06-01 15:19:12 +0200 (Thu, 01 Jun 2006) | 5 lines
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
........
r46590 | tim.peters | 2006-06-01 15:41:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Whitespace normalization.
........
r46591 | tim.peters | 2006-06-01 15:49:23 +0200 (Thu, 01 Jun 2006) | 2 lines
Record bugs 1275608 and 1456209 as being fixed.
........
r46592 | tim.peters | 2006-06-01 15:56:26 +0200 (Thu, 01 Jun 2006) | 5 lines
Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results. The implementations were repaired later during the
sprint, but the new test remained disabled.
........
r46594 | tim.peters | 2006-06-01 17:50:44 +0200 (Thu, 01 Jun 2006) | 7 lines
Armin committed his patch while I was reviewing it (I'm sure
he didn't know this), so merged in some changes I made during
review. Nothing material apart from changing a new `mask` local
from int to Py_ssize_t. Mostly this is repairing comments that
were made incorrect, and adding new comments. Also a few
minor code rewrites for clarity or helpful succinctness.
........
r46599 | neal.norwitz | 2006-06-02 06:45:53 +0200 (Fri, 02 Jun 2006) | 1 line
Convert docstrings to comments so regrtest -v prints method names
........
r46600 | neal.norwitz | 2006-06-02 06:50:49 +0200 (Fri, 02 Jun 2006) | 2 lines
Fix memory leak found by valgrind.
........
r46601 | neal.norwitz | 2006-06-02 06:54:52 +0200 (Fri, 02 Jun 2006) | 1 line
More memory leaks from valgrind
........
r46602 | neal.norwitz | 2006-06-02 08:23:00 +0200 (Fri, 02 Jun 2006) | 11 lines
Patch #1357836:
Prevent an invalid memory read from test_coding in case the done flag is set.
In that case, the loop isn't entered. I wonder if rather than setting
the done flag in the cases before the loop, if they should just exit early.
This code looks like it should be refactored.
Backport candidate (also the early break above if decoding_fgets fails)
........
r46603 | martin.blais | 2006-06-02 15:03:43 +0200 (Fri, 02 Jun 2006) | 1 line
Fixed struct test to not use unittest.
........
r46605 | tim.peters | 2006-06-03 01:22:51 +0200 (Sat, 03 Jun 2006) | 10 lines
pprint functions used to sort a dict (by key) if and only if
the output required more than one line. "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__). None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.
This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
........
2006-06-08 11:42:34 -03:00
|
|
|
g->ob_callback_arg = b;
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(g->ob_callback_arg);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_call(genericobject *g, void (*func)(FL_OBJECT *))
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
(*func)(g->ob_generic);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_delete_object(genericobject *g)
|
1991-10-20 17:18:26 -03:00
|
|
|
{
|
1997-01-03 18:17:11 -04:00
|
|
|
PyObject *res;
|
2002-03-31 11:56:56 -04:00
|
|
|
res = generic_call(g, fl_delete_object);
|
1992-09-03 17:37:02 -03:00
|
|
|
if (res != NULL)
|
|
|
|
forgetgeneric(g);
|
1991-10-20 17:18:26 -03:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_show_object(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call(g, fl_show_object);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_hide_object(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call(g, fl_hide_object);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_redraw_object(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call(g, fl_redraw_object);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
#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 *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_freeze_object(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call(g, fl_freeze_object);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_unfreeze_object(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call(g, fl_unfreeze_object);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
#endif /* OBSOLETE_FORMS_CALLS */
|
|
|
|
|
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_activate_object(genericobject *g)
|
1993-07-05 07:31:29 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call(g, fl_activate_object);
|
1993-07-05 07:31:29 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
generic_deactivate_object(genericobject *g)
|
1993-07-05 07:31:29 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call(g, fl_deactivate_object);
|
1993-07-05 07:31:29 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
generic_set_object_shortcut(genericobject *g, PyObject *args)
|
1993-07-05 07:31:29 -03:00
|
|
|
{
|
|
|
|
char *str;
|
2002-03-31 11:56:56 -04:00
|
|
|
if (!PyArg_ParseTuple(args, "s:set_object_shortcut", &str))
|
1993-07-05 07:31:29 -03:00
|
|
|
return NULL;
|
|
|
|
fl_set_object_shortcut(g->ob_generic, str);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyMethodDef generic_methods[] = {
|
Partially merge trunk into p3yk. The removal of Mac/Tools is confusing svn
merge in bad ways, so I'll have to merge that extra-carefully (probably manually.)
Merged revisions 46495-46605 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r46495 | tim.peters | 2006-05-28 03:52:38 +0200 (Sun, 28 May 2006) | 2 lines
Added missing svn:eol-style property to text files.
........
r46497 | tim.peters | 2006-05-28 12:41:29 +0200 (Sun, 28 May 2006) | 3 lines
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
........
r46499 | fredrik.lundh | 2006-05-28 14:06:46 +0200 (Sun, 28 May 2006) | 5 lines
needforspeed: added Py_MEMCPY macro (currently tuned for Visual C only),
and use it for string copy operations. this gives a 20% speedup on some
string benchmarks.
........
r46501 | michael.hudson | 2006-05-28 17:51:40 +0200 (Sun, 28 May 2006) | 26 lines
Quality control, meet exceptions.c.
Fix a number of problems with the need for speed code:
One is doing this sort of thing:
Py_DECREF(self->field);
self->field = newval;
Py_INCREF(self->field);
without being very sure that self->field doesn't start with a
value that has a __del__, because that almost certainly can lead
to segfaults.
As self->args is constrained to be an exact tuple we may as well
exploit this fact consistently. This leads to quite a lot of
simplification (and, hey, probably better performance).
Add some error checking in places lacking it.
Fix some rather strange indentation in the Unicode code.
Delete some trailing whitespace.
More to come, I haven't fixed all the reference leaks yet...
........
r46502 | george.yoshida | 2006-05-28 18:39:09 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
........
r46503 | martin.v.loewis | 2006-05-28 18:57:38 +0200 (Sun, 28 May 2006) | 4 lines
Rest of patch #1490384: Commit icon source, remove
claim that Erik von Blokland is the author of the
installer picture.
........
r46504 | michael.hudson | 2006-05-28 19:40:29 +0200 (Sun, 28 May 2006) | 16 lines
Quality control, meet exceptions.c, round two.
Make some functions that should have been static static.
Fix a bunch of refleaks by fixing the definition of
MiddlingExtendsException.
Remove all the __new__ implementations apart from
BaseException_new. Rewrite most code that needs it to cope with
NULL fields (such code could get excercised anyway, the
__new__-removal just makes it more likely). This involved
editing the code for WindowsError, which I can't test.
This fixes all the refleaks in at least the start of a regrtest
-R :: run.
........
r46505 | marc-andre.lemburg | 2006-05-28 19:46:58 +0200 (Sun, 28 May 2006) | 10 lines
Initial version of systimes - a module to provide platform dependent
performance measurements.
The module is currently just a proof-of-concept implementation, but
will integrated into pybench once it is stable enough.
License: pybench license.
Author: Marc-Andre Lemburg.
........
r46507 | armin.rigo | 2006-05-28 21:13:17 +0200 (Sun, 28 May 2006) | 15 lines
("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.
Remaining open issues:
* test_extcall is an output test, messy to make robust
* tarfile.py has a potential bug here, but I'm not familiar
enough with this code. Filed in as SF bug #1496501.
* urllib2.HTTPPasswordMgr() returns a random result if there is more
than one matching root path. I'm asking python-dev for
clarification...
........
r46508 | georg.brandl | 2006-05-28 22:11:45 +0200 (Sun, 28 May 2006) | 4 lines
The empty string is a valid import path.
(fixes #1496539)
........
r46509 | georg.brandl | 2006-05-28 22:23:12 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1496206: urllib2 PasswordMgr ./. default ports
........
r46510 | georg.brandl | 2006-05-28 22:57:09 +0200 (Sun, 28 May 2006) | 3 lines
Fix refleaks in UnicodeError get and set methods.
........
r46511 | michael.hudson | 2006-05-28 23:19:03 +0200 (Sun, 28 May 2006) | 3 lines
use the UnicodeError traversal and clearing functions in UnicodeError
subclasses.
........
r46512 | thomas.wouters | 2006-05-28 23:32:12 +0200 (Sun, 28 May 2006) | 4 lines
Make last patch valid C89 so Windows compilers can deal with it.
........
r46513 | georg.brandl | 2006-05-28 23:42:54 +0200 (Sun, 28 May 2006) | 3 lines
Fix ref-antileak in _struct.c which eventually lead to deallocating None.
........
r46514 | georg.brandl | 2006-05-28 23:57:35 +0200 (Sun, 28 May 2006) | 4 lines
Correct None refcount issue in Mac modules. (Are they
still used?)
........
r46515 | armin.rigo | 2006-05-29 00:07:08 +0200 (Mon, 29 May 2006) | 3 lines
A clearer error message when passing -R to regrtest.py with
release builds of Python.
........
r46516 | georg.brandl | 2006-05-29 00:14:04 +0200 (Mon, 29 May 2006) | 3 lines
Fix C function calling conventions in _sre module.
........
r46517 | georg.brandl | 2006-05-29 00:34:51 +0200 (Mon, 29 May 2006) | 3 lines
Convert audioop over to METH_VARARGS.
........
r46518 | georg.brandl | 2006-05-29 00:38:57 +0200 (Mon, 29 May 2006) | 3 lines
METH_NOARGS functions do get called with two args.
........
r46519 | georg.brandl | 2006-05-29 11:46:51 +0200 (Mon, 29 May 2006) | 4 lines
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.
........
r46520 | nick.coghlan | 2006-05-29 14:43:05 +0200 (Mon, 29 May 2006) | 7 lines
Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
........
r46522 | georg.brandl | 2006-05-29 15:53:16 +0200 (Mon, 29 May 2006) | 3 lines
Convert fmmodule to METH_VARARGS.
........
r46523 | georg.brandl | 2006-05-29 16:13:21 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494605.
........
r46524 | georg.brandl | 2006-05-29 16:28:05 +0200 (Mon, 29 May 2006) | 3 lines
Handle PyMem_Malloc failure in pystrtod.c. Closes #1494671.
........
r46525 | georg.brandl | 2006-05-29 16:33:55 +0200 (Mon, 29 May 2006) | 3 lines
Fix compiler warning.
........
r46526 | georg.brandl | 2006-05-29 16:39:00 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494787 (pyclbr counts whitespace as superclass name)
........
r46527 | bob.ippolito | 2006-05-29 17:47:29 +0200 (Mon, 29 May 2006) | 1 line
simplify the struct code a bit (no functional changes)
........
r46528 | armin.rigo | 2006-05-29 19:59:47 +0200 (Mon, 29 May 2006) | 2 lines
Silence a warning.
........
r46529 | georg.brandl | 2006-05-29 21:39:45 +0200 (Mon, 29 May 2006) | 3 lines
Correct some value converting strangenesses.
........
r46530 | nick.coghlan | 2006-05-29 22:27:44 +0200 (Mon, 29 May 2006) | 1 line
When adding a module like functools, it helps to let SVN know about the file.
........
r46531 | georg.brandl | 2006-05-29 22:52:54 +0200 (Mon, 29 May 2006) | 4 lines
Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
........
r46532 | georg.brandl | 2006-05-29 22:57:01 +0200 (Mon, 29 May 2006) | 3 lines
Add News entry for last commit.
........
r46533 | georg.brandl | 2006-05-29 23:04:52 +0200 (Mon, 29 May 2006) | 4 lines
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
........
r46534 | georg.brandl | 2006-05-29 23:58:42 +0200 (Mon, 29 May 2006) | 3 lines
Convert more modules to METH_VARARGS.
........
r46535 | georg.brandl | 2006-05-30 00:00:30 +0200 (Tue, 30 May 2006) | 3 lines
Whoops.
........
r46536 | fredrik.lundh | 2006-05-30 00:42:07 +0200 (Tue, 30 May 2006) | 4 lines
fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
........
r46537 | bob.ippolito | 2006-05-30 00:55:48 +0200 (Tue, 30 May 2006) | 1 line
struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly)
........
r46539 | bob.ippolito | 2006-05-30 02:26:01 +0200 (Tue, 30 May 2006) | 1 line
Add a length check to aifc to ensure it doesn't write a bogus file
........
r46540 | tim.peters | 2006-05-30 04:25:25 +0200 (Tue, 30 May 2006) | 10 lines
deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:
test_genexps (or any other doctest-based test)
test_struct
test_doctest
The `warnings` module needs an advertised way to save/restore
its internal filter list.
........
r46541 | tim.peters | 2006-05-30 04:26:46 +0200 (Tue, 30 May 2006) | 2 lines
Whitespace normalization.
........
r46542 | tim.peters | 2006-05-30 04:30:30 +0200 (Tue, 30 May 2006) | 2 lines
Set a binary svn:mime-type property on this UTF-8 encoded file.
........
r46543 | neal.norwitz | 2006-05-30 05:18:50 +0200 (Tue, 30 May 2006) | 1 line
Simplify further by using AddStringConstant
........
r46544 | tim.peters | 2006-05-30 06:16:25 +0200 (Tue, 30 May 2006) | 6 lines
Convert relevant dict internals to Py_ssize_t.
I don't have a box with nearly enough RAM, or an OS,
that could get close to tickling this, though (requires
a dict w/ at least 2**31 entries).
........
r46545 | neal.norwitz | 2006-05-30 06:19:21 +0200 (Tue, 30 May 2006) | 1 line
Remove stray | in comment
........
r46546 | neal.norwitz | 2006-05-30 06:25:05 +0200 (Tue, 30 May 2006) | 1 line
Use Py_SAFE_DOWNCAST for safety. Fix format strings. Remove 2 more stray | in comment
........
r46547 | neal.norwitz | 2006-05-30 06:43:23 +0200 (Tue, 30 May 2006) | 1 line
No DOWNCAST is required since sizeof(Py_ssize_t) >= sizeof(int) and Py_ReprEntr returns an int
........
r46548 | tim.peters | 2006-05-30 07:04:59 +0200 (Tue, 30 May 2006) | 3 lines
dict_print(): Explicitly narrow the return value
from a (possibly) wider variable.
........
r46549 | tim.peters | 2006-05-30 07:23:59 +0200 (Tue, 30 May 2006) | 5 lines
dict_print(): So that Neal & I don't spend the rest of
our lives taking turns rewriting code that works ;-),
get rid of casting illusions by declaring a new variable
with the obvious type.
........
r46550 | georg.brandl | 2006-05-30 09:04:55 +0200 (Tue, 30 May 2006) | 3 lines
Restore exception pickle support. #1497319.
........
r46551 | georg.brandl | 2006-05-30 09:13:29 +0200 (Tue, 30 May 2006) | 3 lines
Add a test case for exception pickling. args is never NULL.
........
r46552 | neal.norwitz | 2006-05-30 09:21:10 +0200 (Tue, 30 May 2006) | 1 line
Don't fail if the (sub)pkgname already exist.
........
r46553 | georg.brandl | 2006-05-30 09:34:45 +0200 (Tue, 30 May 2006) | 3 lines
Disallow keyword args for exceptions.
........
r46554 | neal.norwitz | 2006-05-30 09:36:54 +0200 (Tue, 30 May 2006) | 5 lines
I'm impatient. I think this will fix a few more problems with the buildbots.
I'm not sure this is the best approach, but I can't think of anything better.
If this creates problems, feel free to revert, but I think it's safe and
should make things a little better.
........
r46555 | georg.brandl | 2006-05-30 10:17:00 +0200 (Tue, 30 May 2006) | 4 lines
Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
........
r46556 | georg.brandl | 2006-05-30 10:47:19 +0200 (Tue, 30 May 2006) | 3 lines
Convert test_exceptions to unittest.
........
r46557 | andrew.kuchling | 2006-05-30 14:52:01 +0200 (Tue, 30 May 2006) | 1 line
Add SoC name, and reorganize this section a bit
........
r46559 | tim.peters | 2006-05-30 17:53:34 +0200 (Tue, 30 May 2006) | 11 lines
PyLong_FromString(): Continued fraction analysis (explained in
a new comment) suggests there are almost certainly large input
integers in all non-binary input bases for which one Python digit
too few is initally allocated to hold the final result. Instead
of assert-failing when that happens, allocate more space. Alas,
I estimate it would take a few days to find a specific such case,
so this isn't backed up by a new test (not to mention that such
a case may take hours to run, since conversion time is quadratic
in the number of digits, and preliminary attempts suggested that
the smallest such inputs contain at least a million digits).
........
r46560 | fredrik.lundh | 2006-05-30 19:11:48 +0200 (Tue, 30 May 2006) | 3 lines
changed find/rfind to return -1 for matches outside the source string
........
r46561 | bob.ippolito | 2006-05-30 19:37:54 +0200 (Tue, 30 May 2006) | 1 line
Change wrapping terminology to overflow masking
........
r46562 | fredrik.lundh | 2006-05-30 19:39:58 +0200 (Tue, 30 May 2006) | 3 lines
changed count to return 0 for slices outside the source string
........
r46568 | tim.peters | 2006-05-31 01:28:02 +0200 (Wed, 31 May 2006) | 2 lines
Whitespace normalization.
........
r46569 | brett.cannon | 2006-05-31 04:19:54 +0200 (Wed, 31 May 2006) | 5 lines
Clarify wording on default values for strptime(); defaults are used when better
values cannot be inferred.
Closes bug #1496315.
........
r46572 | neal.norwitz | 2006-05-31 09:43:27 +0200 (Wed, 31 May 2006) | 1 line
Calculate smallest properly (it was off by one) and use proper ssize_t types for Win64
........
r46573 | neal.norwitz | 2006-05-31 10:01:08 +0200 (Wed, 31 May 2006) | 1 line
Revert last checkin, it is better to do make distclean
........
r46574 | neal.norwitz | 2006-05-31 11:02:44 +0200 (Wed, 31 May 2006) | 3 lines
On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
........
r46575 | thomas.heller | 2006-05-31 13:37:58 +0200 (Wed, 31 May 2006) | 3 lines
PyTuple_Pack is not available in Python 2.3, but ctypes must stay
compatible with that.
........
r46576 | andrew.kuchling | 2006-05-31 15:18:56 +0200 (Wed, 31 May 2006) | 1 line
'functional' module was renamed to 'functools'
........
r46577 | kristjan.jonsson | 2006-05-31 15:35:41 +0200 (Wed, 31 May 2006) | 1 line
Fixup the PCBuild8 project directory. exceptions.c have moved to Objects, and the functionalmodule.c has been replaced with _functoolsmodule.c. Other minor changes to .vcproj files and .sln to fix compilation
........
r46578 | andrew.kuchling | 2006-05-31 16:08:48 +0200 (Wed, 31 May 2006) | 15 lines
[Bug #1473048]
SimpleXMLRPCServer and DocXMLRPCServer don't look at
the path of the HTTP request at all; you can POST or
GET from / or /RPC2 or /blahblahblah with the same results.
Security scanners that look for /cgi-bin/phf will therefore report
lots of vulnerabilities.
Fix: add a .rpc_paths attribute to the SimpleXMLRPCServer class,
and report a 404 error if the path isn't on the allowed list.
Possibly-controversial aspect of this change: the default makes only
'/' and '/RPC2' legal. Maybe this will break people's applications
(though I doubt it). We could just set the default to an empty tuple,
which would exactly match the current behaviour.
........
r46579 | andrew.kuchling | 2006-05-31 16:12:47 +0200 (Wed, 31 May 2006) | 1 line
Mention SimpleXMLRPCServer change
........
r46580 | tim.peters | 2006-05-31 16:28:07 +0200 (Wed, 31 May 2006) | 2 lines
Trimmed trailing whitespace.
........
r46581 | tim.peters | 2006-05-31 17:33:22 +0200 (Wed, 31 May 2006) | 4 lines
_range_error(): Speed and simplify (there's no real need for
loops here). Assert that size_t is actually big enough, and
that f->size is at least one. Wrap a long line.
........
r46582 | tim.peters | 2006-05-31 17:34:37 +0200 (Wed, 31 May 2006) | 2 lines
Repaired error in new comment.
........
r46584 | neal.norwitz | 2006-06-01 07:32:49 +0200 (Thu, 01 Jun 2006) | 4 lines
Remove ; at end of macro. There was a compiler recently that warned
about extra semi-colons. It may have been the HP C compiler.
This file will trigger a bunch of those warnings now.
........
r46585 | georg.brandl | 2006-06-01 08:39:19 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly unpickle 2.4 exceptions via __setstate__ (patch #1498571)
........
r46586 | georg.brandl | 2006-06-01 10:27:32 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly allocate complex types with tp_alloc. (bug #1498638)
........
r46587 | georg.brandl | 2006-06-01 14:30:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Correctly dispatch Faults in loads (patch #1498627)
........
r46588 | georg.brandl | 2006-06-01 15:00:49 +0200 (Thu, 01 Jun 2006) | 3 lines
Some code style tweaks, and remove apply.
........
r46589 | armin.rigo | 2006-06-01 15:19:12 +0200 (Thu, 01 Jun 2006) | 5 lines
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
........
r46590 | tim.peters | 2006-06-01 15:41:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Whitespace normalization.
........
r46591 | tim.peters | 2006-06-01 15:49:23 +0200 (Thu, 01 Jun 2006) | 2 lines
Record bugs 1275608 and 1456209 as being fixed.
........
r46592 | tim.peters | 2006-06-01 15:56:26 +0200 (Thu, 01 Jun 2006) | 5 lines
Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results. The implementations were repaired later during the
sprint, but the new test remained disabled.
........
r46594 | tim.peters | 2006-06-01 17:50:44 +0200 (Thu, 01 Jun 2006) | 7 lines
Armin committed his patch while I was reviewing it (I'm sure
he didn't know this), so merged in some changes I made during
review. Nothing material apart from changing a new `mask` local
from int to Py_ssize_t. Mostly this is repairing comments that
were made incorrect, and adding new comments. Also a few
minor code rewrites for clarity or helpful succinctness.
........
r46599 | neal.norwitz | 2006-06-02 06:45:53 +0200 (Fri, 02 Jun 2006) | 1 line
Convert docstrings to comments so regrtest -v prints method names
........
r46600 | neal.norwitz | 2006-06-02 06:50:49 +0200 (Fri, 02 Jun 2006) | 2 lines
Fix memory leak found by valgrind.
........
r46601 | neal.norwitz | 2006-06-02 06:54:52 +0200 (Fri, 02 Jun 2006) | 1 line
More memory leaks from valgrind
........
r46602 | neal.norwitz | 2006-06-02 08:23:00 +0200 (Fri, 02 Jun 2006) | 11 lines
Patch #1357836:
Prevent an invalid memory read from test_coding in case the done flag is set.
In that case, the loop isn't entered. I wonder if rather than setting
the done flag in the cases before the loop, if they should just exit early.
This code looks like it should be refactored.
Backport candidate (also the early break above if decoding_fgets fails)
........
r46603 | martin.blais | 2006-06-02 15:03:43 +0200 (Fri, 02 Jun 2006) | 1 line
Fixed struct test to not use unittest.
........
r46605 | tim.peters | 2006-06-03 01:22:51 +0200 (Sat, 03 Jun 2006) | 10 lines
pprint functions used to sort a dict (by key) if and only if
the output required more than one line. "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__). None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.
This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
........
2006-06-08 11:42:34 -03:00
|
|
|
{"set_call_back", (PyCFunction)generic_set_call_back, METH_VARARGS},
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1997-01-03 18:17:11 -04:00
|
|
|
#ifdef OBSOLETE_FORMS_CALLS
|
2002-03-31 11:56:56 -04:00
|
|
|
{"freeze_object", (PyCFunction)generic_freeze_object, METH_NOARGS},
|
|
|
|
{"unfreeze_object", (PyCFunction)generic_unfreeze_object, METH_NOARGS},
|
1997-01-03 18:17:11 -04:00
|
|
|
#endif
|
2002-03-31 11:56:56 -04:00
|
|
|
{"activate_object", (PyCFunction)generic_activate_object, METH_NOARGS},
|
|
|
|
{"deactivate_object", (PyCFunction)generic_deactivate_object, METH_NOARGS},
|
Partially merge trunk into p3yk. The removal of Mac/Tools is confusing svn
merge in bad ways, so I'll have to merge that extra-carefully (probably manually.)
Merged revisions 46495-46605 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r46495 | tim.peters | 2006-05-28 03:52:38 +0200 (Sun, 28 May 2006) | 2 lines
Added missing svn:eol-style property to text files.
........
r46497 | tim.peters | 2006-05-28 12:41:29 +0200 (Sun, 28 May 2006) | 3 lines
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
........
r46499 | fredrik.lundh | 2006-05-28 14:06:46 +0200 (Sun, 28 May 2006) | 5 lines
needforspeed: added Py_MEMCPY macro (currently tuned for Visual C only),
and use it for string copy operations. this gives a 20% speedup on some
string benchmarks.
........
r46501 | michael.hudson | 2006-05-28 17:51:40 +0200 (Sun, 28 May 2006) | 26 lines
Quality control, meet exceptions.c.
Fix a number of problems with the need for speed code:
One is doing this sort of thing:
Py_DECREF(self->field);
self->field = newval;
Py_INCREF(self->field);
without being very sure that self->field doesn't start with a
value that has a __del__, because that almost certainly can lead
to segfaults.
As self->args is constrained to be an exact tuple we may as well
exploit this fact consistently. This leads to quite a lot of
simplification (and, hey, probably better performance).
Add some error checking in places lacking it.
Fix some rather strange indentation in the Unicode code.
Delete some trailing whitespace.
More to come, I haven't fixed all the reference leaks yet...
........
r46502 | george.yoshida | 2006-05-28 18:39:09 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
........
r46503 | martin.v.loewis | 2006-05-28 18:57:38 +0200 (Sun, 28 May 2006) | 4 lines
Rest of patch #1490384: Commit icon source, remove
claim that Erik von Blokland is the author of the
installer picture.
........
r46504 | michael.hudson | 2006-05-28 19:40:29 +0200 (Sun, 28 May 2006) | 16 lines
Quality control, meet exceptions.c, round two.
Make some functions that should have been static static.
Fix a bunch of refleaks by fixing the definition of
MiddlingExtendsException.
Remove all the __new__ implementations apart from
BaseException_new. Rewrite most code that needs it to cope with
NULL fields (such code could get excercised anyway, the
__new__-removal just makes it more likely). This involved
editing the code for WindowsError, which I can't test.
This fixes all the refleaks in at least the start of a regrtest
-R :: run.
........
r46505 | marc-andre.lemburg | 2006-05-28 19:46:58 +0200 (Sun, 28 May 2006) | 10 lines
Initial version of systimes - a module to provide platform dependent
performance measurements.
The module is currently just a proof-of-concept implementation, but
will integrated into pybench once it is stable enough.
License: pybench license.
Author: Marc-Andre Lemburg.
........
r46507 | armin.rigo | 2006-05-28 21:13:17 +0200 (Sun, 28 May 2006) | 15 lines
("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.
Remaining open issues:
* test_extcall is an output test, messy to make robust
* tarfile.py has a potential bug here, but I'm not familiar
enough with this code. Filed in as SF bug #1496501.
* urllib2.HTTPPasswordMgr() returns a random result if there is more
than one matching root path. I'm asking python-dev for
clarification...
........
r46508 | georg.brandl | 2006-05-28 22:11:45 +0200 (Sun, 28 May 2006) | 4 lines
The empty string is a valid import path.
(fixes #1496539)
........
r46509 | georg.brandl | 2006-05-28 22:23:12 +0200 (Sun, 28 May 2006) | 3 lines
Patch #1496206: urllib2 PasswordMgr ./. default ports
........
r46510 | georg.brandl | 2006-05-28 22:57:09 +0200 (Sun, 28 May 2006) | 3 lines
Fix refleaks in UnicodeError get and set methods.
........
r46511 | michael.hudson | 2006-05-28 23:19:03 +0200 (Sun, 28 May 2006) | 3 lines
use the UnicodeError traversal and clearing functions in UnicodeError
subclasses.
........
r46512 | thomas.wouters | 2006-05-28 23:32:12 +0200 (Sun, 28 May 2006) | 4 lines
Make last patch valid C89 so Windows compilers can deal with it.
........
r46513 | georg.brandl | 2006-05-28 23:42:54 +0200 (Sun, 28 May 2006) | 3 lines
Fix ref-antileak in _struct.c which eventually lead to deallocating None.
........
r46514 | georg.brandl | 2006-05-28 23:57:35 +0200 (Sun, 28 May 2006) | 4 lines
Correct None refcount issue in Mac modules. (Are they
still used?)
........
r46515 | armin.rigo | 2006-05-29 00:07:08 +0200 (Mon, 29 May 2006) | 3 lines
A clearer error message when passing -R to regrtest.py with
release builds of Python.
........
r46516 | georg.brandl | 2006-05-29 00:14:04 +0200 (Mon, 29 May 2006) | 3 lines
Fix C function calling conventions in _sre module.
........
r46517 | georg.brandl | 2006-05-29 00:34:51 +0200 (Mon, 29 May 2006) | 3 lines
Convert audioop over to METH_VARARGS.
........
r46518 | georg.brandl | 2006-05-29 00:38:57 +0200 (Mon, 29 May 2006) | 3 lines
METH_NOARGS functions do get called with two args.
........
r46519 | georg.brandl | 2006-05-29 11:46:51 +0200 (Mon, 29 May 2006) | 4 lines
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.
........
r46520 | nick.coghlan | 2006-05-29 14:43:05 +0200 (Mon, 29 May 2006) | 7 lines
Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
........
r46522 | georg.brandl | 2006-05-29 15:53:16 +0200 (Mon, 29 May 2006) | 3 lines
Convert fmmodule to METH_VARARGS.
........
r46523 | georg.brandl | 2006-05-29 16:13:21 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494605.
........
r46524 | georg.brandl | 2006-05-29 16:28:05 +0200 (Mon, 29 May 2006) | 3 lines
Handle PyMem_Malloc failure in pystrtod.c. Closes #1494671.
........
r46525 | georg.brandl | 2006-05-29 16:33:55 +0200 (Mon, 29 May 2006) | 3 lines
Fix compiler warning.
........
r46526 | georg.brandl | 2006-05-29 16:39:00 +0200 (Mon, 29 May 2006) | 3 lines
Fix #1494787 (pyclbr counts whitespace as superclass name)
........
r46527 | bob.ippolito | 2006-05-29 17:47:29 +0200 (Mon, 29 May 2006) | 1 line
simplify the struct code a bit (no functional changes)
........
r46528 | armin.rigo | 2006-05-29 19:59:47 +0200 (Mon, 29 May 2006) | 2 lines
Silence a warning.
........
r46529 | georg.brandl | 2006-05-29 21:39:45 +0200 (Mon, 29 May 2006) | 3 lines
Correct some value converting strangenesses.
........
r46530 | nick.coghlan | 2006-05-29 22:27:44 +0200 (Mon, 29 May 2006) | 1 line
When adding a module like functools, it helps to let SVN know about the file.
........
r46531 | georg.brandl | 2006-05-29 22:52:54 +0200 (Mon, 29 May 2006) | 4 lines
Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
........
r46532 | georg.brandl | 2006-05-29 22:57:01 +0200 (Mon, 29 May 2006) | 3 lines
Add News entry for last commit.
........
r46533 | georg.brandl | 2006-05-29 23:04:52 +0200 (Mon, 29 May 2006) | 4 lines
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
........
r46534 | georg.brandl | 2006-05-29 23:58:42 +0200 (Mon, 29 May 2006) | 3 lines
Convert more modules to METH_VARARGS.
........
r46535 | georg.brandl | 2006-05-30 00:00:30 +0200 (Tue, 30 May 2006) | 3 lines
Whoops.
........
r46536 | fredrik.lundh | 2006-05-30 00:42:07 +0200 (Tue, 30 May 2006) | 4 lines
fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
........
r46537 | bob.ippolito | 2006-05-30 00:55:48 +0200 (Tue, 30 May 2006) | 1 line
struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly)
........
r46539 | bob.ippolito | 2006-05-30 02:26:01 +0200 (Tue, 30 May 2006) | 1 line
Add a length check to aifc to ensure it doesn't write a bogus file
........
r46540 | tim.peters | 2006-05-30 04:25:25 +0200 (Tue, 30 May 2006) | 10 lines
deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:
test_genexps (or any other doctest-based test)
test_struct
test_doctest
The `warnings` module needs an advertised way to save/restore
its internal filter list.
........
r46541 | tim.peters | 2006-05-30 04:26:46 +0200 (Tue, 30 May 2006) | 2 lines
Whitespace normalization.
........
r46542 | tim.peters | 2006-05-30 04:30:30 +0200 (Tue, 30 May 2006) | 2 lines
Set a binary svn:mime-type property on this UTF-8 encoded file.
........
r46543 | neal.norwitz | 2006-05-30 05:18:50 +0200 (Tue, 30 May 2006) | 1 line
Simplify further by using AddStringConstant
........
r46544 | tim.peters | 2006-05-30 06:16:25 +0200 (Tue, 30 May 2006) | 6 lines
Convert relevant dict internals to Py_ssize_t.
I don't have a box with nearly enough RAM, or an OS,
that could get close to tickling this, though (requires
a dict w/ at least 2**31 entries).
........
r46545 | neal.norwitz | 2006-05-30 06:19:21 +0200 (Tue, 30 May 2006) | 1 line
Remove stray | in comment
........
r46546 | neal.norwitz | 2006-05-30 06:25:05 +0200 (Tue, 30 May 2006) | 1 line
Use Py_SAFE_DOWNCAST for safety. Fix format strings. Remove 2 more stray | in comment
........
r46547 | neal.norwitz | 2006-05-30 06:43:23 +0200 (Tue, 30 May 2006) | 1 line
No DOWNCAST is required since sizeof(Py_ssize_t) >= sizeof(int) and Py_ReprEntr returns an int
........
r46548 | tim.peters | 2006-05-30 07:04:59 +0200 (Tue, 30 May 2006) | 3 lines
dict_print(): Explicitly narrow the return value
from a (possibly) wider variable.
........
r46549 | tim.peters | 2006-05-30 07:23:59 +0200 (Tue, 30 May 2006) | 5 lines
dict_print(): So that Neal & I don't spend the rest of
our lives taking turns rewriting code that works ;-),
get rid of casting illusions by declaring a new variable
with the obvious type.
........
r46550 | georg.brandl | 2006-05-30 09:04:55 +0200 (Tue, 30 May 2006) | 3 lines
Restore exception pickle support. #1497319.
........
r46551 | georg.brandl | 2006-05-30 09:13:29 +0200 (Tue, 30 May 2006) | 3 lines
Add a test case for exception pickling. args is never NULL.
........
r46552 | neal.norwitz | 2006-05-30 09:21:10 +0200 (Tue, 30 May 2006) | 1 line
Don't fail if the (sub)pkgname already exist.
........
r46553 | georg.brandl | 2006-05-30 09:34:45 +0200 (Tue, 30 May 2006) | 3 lines
Disallow keyword args for exceptions.
........
r46554 | neal.norwitz | 2006-05-30 09:36:54 +0200 (Tue, 30 May 2006) | 5 lines
I'm impatient. I think this will fix a few more problems with the buildbots.
I'm not sure this is the best approach, but I can't think of anything better.
If this creates problems, feel free to revert, but I think it's safe and
should make things a little better.
........
r46555 | georg.brandl | 2006-05-30 10:17:00 +0200 (Tue, 30 May 2006) | 4 lines
Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
........
r46556 | georg.brandl | 2006-05-30 10:47:19 +0200 (Tue, 30 May 2006) | 3 lines
Convert test_exceptions to unittest.
........
r46557 | andrew.kuchling | 2006-05-30 14:52:01 +0200 (Tue, 30 May 2006) | 1 line
Add SoC name, and reorganize this section a bit
........
r46559 | tim.peters | 2006-05-30 17:53:34 +0200 (Tue, 30 May 2006) | 11 lines
PyLong_FromString(): Continued fraction analysis (explained in
a new comment) suggests there are almost certainly large input
integers in all non-binary input bases for which one Python digit
too few is initally allocated to hold the final result. Instead
of assert-failing when that happens, allocate more space. Alas,
I estimate it would take a few days to find a specific such case,
so this isn't backed up by a new test (not to mention that such
a case may take hours to run, since conversion time is quadratic
in the number of digits, and preliminary attempts suggested that
the smallest such inputs contain at least a million digits).
........
r46560 | fredrik.lundh | 2006-05-30 19:11:48 +0200 (Tue, 30 May 2006) | 3 lines
changed find/rfind to return -1 for matches outside the source string
........
r46561 | bob.ippolito | 2006-05-30 19:37:54 +0200 (Tue, 30 May 2006) | 1 line
Change wrapping terminology to overflow masking
........
r46562 | fredrik.lundh | 2006-05-30 19:39:58 +0200 (Tue, 30 May 2006) | 3 lines
changed count to return 0 for slices outside the source string
........
r46568 | tim.peters | 2006-05-31 01:28:02 +0200 (Wed, 31 May 2006) | 2 lines
Whitespace normalization.
........
r46569 | brett.cannon | 2006-05-31 04:19:54 +0200 (Wed, 31 May 2006) | 5 lines
Clarify wording on default values for strptime(); defaults are used when better
values cannot be inferred.
Closes bug #1496315.
........
r46572 | neal.norwitz | 2006-05-31 09:43:27 +0200 (Wed, 31 May 2006) | 1 line
Calculate smallest properly (it was off by one) and use proper ssize_t types for Win64
........
r46573 | neal.norwitz | 2006-05-31 10:01:08 +0200 (Wed, 31 May 2006) | 1 line
Revert last checkin, it is better to do make distclean
........
r46574 | neal.norwitz | 2006-05-31 11:02:44 +0200 (Wed, 31 May 2006) | 3 lines
On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
........
r46575 | thomas.heller | 2006-05-31 13:37:58 +0200 (Wed, 31 May 2006) | 3 lines
PyTuple_Pack is not available in Python 2.3, but ctypes must stay
compatible with that.
........
r46576 | andrew.kuchling | 2006-05-31 15:18:56 +0200 (Wed, 31 May 2006) | 1 line
'functional' module was renamed to 'functools'
........
r46577 | kristjan.jonsson | 2006-05-31 15:35:41 +0200 (Wed, 31 May 2006) | 1 line
Fixup the PCBuild8 project directory. exceptions.c have moved to Objects, and the functionalmodule.c has been replaced with _functoolsmodule.c. Other minor changes to .vcproj files and .sln to fix compilation
........
r46578 | andrew.kuchling | 2006-05-31 16:08:48 +0200 (Wed, 31 May 2006) | 15 lines
[Bug #1473048]
SimpleXMLRPCServer and DocXMLRPCServer don't look at
the path of the HTTP request at all; you can POST or
GET from / or /RPC2 or /blahblahblah with the same results.
Security scanners that look for /cgi-bin/phf will therefore report
lots of vulnerabilities.
Fix: add a .rpc_paths attribute to the SimpleXMLRPCServer class,
and report a 404 error if the path isn't on the allowed list.
Possibly-controversial aspect of this change: the default makes only
'/' and '/RPC2' legal. Maybe this will break people's applications
(though I doubt it). We could just set the default to an empty tuple,
which would exactly match the current behaviour.
........
r46579 | andrew.kuchling | 2006-05-31 16:12:47 +0200 (Wed, 31 May 2006) | 1 line
Mention SimpleXMLRPCServer change
........
r46580 | tim.peters | 2006-05-31 16:28:07 +0200 (Wed, 31 May 2006) | 2 lines
Trimmed trailing whitespace.
........
r46581 | tim.peters | 2006-05-31 17:33:22 +0200 (Wed, 31 May 2006) | 4 lines
_range_error(): Speed and simplify (there's no real need for
loops here). Assert that size_t is actually big enough, and
that f->size is at least one. Wrap a long line.
........
r46582 | tim.peters | 2006-05-31 17:34:37 +0200 (Wed, 31 May 2006) | 2 lines
Repaired error in new comment.
........
r46584 | neal.norwitz | 2006-06-01 07:32:49 +0200 (Thu, 01 Jun 2006) | 4 lines
Remove ; at end of macro. There was a compiler recently that warned
about extra semi-colons. It may have been the HP C compiler.
This file will trigger a bunch of those warnings now.
........
r46585 | georg.brandl | 2006-06-01 08:39:19 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly unpickle 2.4 exceptions via __setstate__ (patch #1498571)
........
r46586 | georg.brandl | 2006-06-01 10:27:32 +0200 (Thu, 01 Jun 2006) | 3 lines
Correctly allocate complex types with tp_alloc. (bug #1498638)
........
r46587 | georg.brandl | 2006-06-01 14:30:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Correctly dispatch Faults in loads (patch #1498627)
........
r46588 | georg.brandl | 2006-06-01 15:00:49 +0200 (Thu, 01 Jun 2006) | 3 lines
Some code style tweaks, and remove apply.
........
r46589 | armin.rigo | 2006-06-01 15:19:12 +0200 (Thu, 01 Jun 2006) | 5 lines
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
........
r46590 | tim.peters | 2006-06-01 15:41:46 +0200 (Thu, 01 Jun 2006) | 2 lines
Whitespace normalization.
........
r46591 | tim.peters | 2006-06-01 15:49:23 +0200 (Thu, 01 Jun 2006) | 2 lines
Record bugs 1275608 and 1456209 as being fixed.
........
r46592 | tim.peters | 2006-06-01 15:56:26 +0200 (Thu, 01 Jun 2006) | 5 lines
Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results. The implementations were repaired later during the
sprint, but the new test remained disabled.
........
r46594 | tim.peters | 2006-06-01 17:50:44 +0200 (Thu, 01 Jun 2006) | 7 lines
Armin committed his patch while I was reviewing it (I'm sure
he didn't know this), so merged in some changes I made during
review. Nothing material apart from changing a new `mask` local
from int to Py_ssize_t. Mostly this is repairing comments that
were made incorrect, and adding new comments. Also a few
minor code rewrites for clarity or helpful succinctness.
........
r46599 | neal.norwitz | 2006-06-02 06:45:53 +0200 (Fri, 02 Jun 2006) | 1 line
Convert docstrings to comments so regrtest -v prints method names
........
r46600 | neal.norwitz | 2006-06-02 06:50:49 +0200 (Fri, 02 Jun 2006) | 2 lines
Fix memory leak found by valgrind.
........
r46601 | neal.norwitz | 2006-06-02 06:54:52 +0200 (Fri, 02 Jun 2006) | 1 line
More memory leaks from valgrind
........
r46602 | neal.norwitz | 2006-06-02 08:23:00 +0200 (Fri, 02 Jun 2006) | 11 lines
Patch #1357836:
Prevent an invalid memory read from test_coding in case the done flag is set.
In that case, the loop isn't entered. I wonder if rather than setting
the done flag in the cases before the loop, if they should just exit early.
This code looks like it should be refactored.
Backport candidate (also the early break above if decoding_fgets fails)
........
r46603 | martin.blais | 2006-06-02 15:03:43 +0200 (Fri, 02 Jun 2006) | 1 line
Fixed struct test to not use unittest.
........
r46605 | tim.peters | 2006-06-03 01:22:51 +0200 (Sat, 03 Jun 2006) | 10 lines
pprint functions used to sort a dict (by key) if and only if
the output required more than one line. "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__). None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.
This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
........
2006-06-08 11:42:34 -03:00
|
|
|
{"set_object_shortcut", (PyCFunction)generic_set_object_shortcut, METH_VARARGS},
|
1991-08-08 09:10:01 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
1991-08-07 08:32:58 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2000-07-10 14:04:33 -03:00
|
|
|
generic_dealloc(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_free_object(g->ob_generic);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_XDECREF(g->ob_callback);
|
|
|
|
Py_XDECREF(g->ob_callback_arg);
|
2000-05-03 20:44:39 -03:00
|
|
|
PyObject_Del(g);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#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},
|
1993-07-05 07:31:29 -03:00
|
|
|
/* {"frozen", T_INT, OFF(frozen), RO}, */
|
1992-09-17 14:54:56 -03:00
|
|
|
{"active", T_INT, OFF(active)},
|
|
|
|
{"input", T_INT, OFF(input)},
|
1991-08-07 08:32:58 -03:00
|
|
|
{"visible", T_INT, OFF(visible), RO},
|
1992-09-17 14:54:56 -03:00
|
|
|
{"radio", T_INT, OFF(radio)},
|
|
|
|
{"automatic", T_INT, OFF(automatic)},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL} /* Sentinel */
|
|
|
|
};
|
|
|
|
|
1991-11-19 16:26:28 -04:00
|
|
|
#undef OFF
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
generic_getattr(genericobject *g, char *name)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1997-01-03 18:17:11 -04:00
|
|
|
PyObject *meth;
|
1991-10-20 17:18:26 -03:00
|
|
|
|
|
|
|
/* XXX Ought to special-case name "__methods__" */
|
1991-08-07 08:32:58 -03:00
|
|
|
if (g-> ob_methods) {
|
1997-01-03 18:17:11 -04:00
|
|
|
meth = Py_FindMethod(g->ob_methods, (PyObject *)g, name);
|
1991-08-08 09:10:01 -03:00
|
|
|
if (meth != NULL) return meth;
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_Clear();
|
1992-09-03 17:37:02 -03:00
|
|
|
}
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
meth = Py_FindMethod(generic_methods, (PyObject *)g, name);
|
1991-08-07 08:32:58 -03:00
|
|
|
if (meth != NULL)
|
|
|
|
return meth;
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_Clear();
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
/* "label" is an exception, getmember only works for char pointers,
|
|
|
|
not for char arrays */
|
|
|
|
if (strcmp(name, "label") == 0)
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyString_FromString(g->ob_generic->label);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyMember_Get((char *)g->ob_generic, generic_memberlist, name);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2000-07-12 07:43:11 -03:00
|
|
|
generic_setattr(genericobject *g, char *name, PyObject *v)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (v == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
"can't delete forms object attributes");
|
1992-06-03 14:07:49 -03:00
|
|
|
return -1;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* "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) {
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyString_Check(v)) {
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
"label attr must be string");
|
1992-06-03 14:07:49 -03:00
|
|
|
return -1;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
fl_set_object_label(g->ob_generic, PyString_AsString(v));
|
1991-08-07 08:32:58 -03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
ret = PyMember_Set((char *)g->ob_generic, generic_memberlist, name, v);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
generic_repr(genericobject *g)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
|
|
|
char buf[100];
|
2001-11-28 16:27:42 -04:00
|
|
|
PyOS_snprintf(buf, sizeof(buf), "<FORMS_object at %p, objclass=%d>",
|
|
|
|
g, g->ob_generic->objclass);
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyString_FromString(buf);
|
1992-09-03 17:37:02 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyTypeObject GenericObjecttype = {
|
|
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
1994-08-01 08:34:53 -03:00
|
|
|
0, /*ob_size*/
|
2001-12-08 14:02:58 -04:00
|
|
|
"fl.FORMS_object", /*tp_name*/
|
1994-08-01 08:34:53 -03:00
|
|
|
sizeof(genericobject), /*tp_size*/
|
|
|
|
0, /*tp_itemsize*/
|
1991-08-07 08:32:58 -03:00
|
|
|
/* methods */
|
1994-08-01 08:34:53 -03:00
|
|
|
(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*/
|
1991-08-07 08:32:58 -03:00
|
|
|
};
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
newgenericobject(FL_OBJECT *generic, PyMethodDef *methods)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
genericobject *g;
|
2000-05-03 20:44:39 -03:00
|
|
|
g = PyObject_New(genericobject, &GenericObjecttype);
|
1991-08-07 08:32:58 -03:00
|
|
|
if (g == NULL)
|
|
|
|
return NULL;
|
|
|
|
g-> ob_generic = generic;
|
|
|
|
g->ob_methods = methods;
|
|
|
|
g->ob_callback = NULL;
|
|
|
|
g->ob_callback_arg = NULL;
|
|
|
|
knowgeneric(g);
|
1997-01-03 18:17:11 -04:00
|
|
|
return (PyObject *)g;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Some common calling sequences */
|
|
|
|
|
|
|
|
/* void func (object, float) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
call_forms_INf (void (*func)(FL_OBJECT *, float), FL_OBJECT *obj, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
float parameter;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "f", ¶meter)) return NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
(*func) (obj, parameter);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* void func (object, float) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
call_forms_INfINf (void (*func)(FL_OBJECT *, float, float), FL_OBJECT *obj, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
float par1, par2;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(ff)", &par1, &par2)) return NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
(*func) (obj, par1, par2);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* void func (object, int) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
call_forms_INi (void (*func)(FL_OBJECT *, int), FL_OBJECT *obj, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
int parameter;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "i", ¶meter)) return NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
(*func) (obj, parameter);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1991-12-10 09:56:42 -04:00
|
|
|
/* void func (object, char) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
call_forms_INc (void (*func)(FL_OBJECT *, int), FL_OBJECT *obj, PyObject *args)
|
1991-12-10 09:56:42 -04:00
|
|
|
{
|
1992-01-27 12:45:55 -04:00
|
|
|
char *a;
|
1991-12-10 09:56:42 -04:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "s", &a)) return NULL;
|
1991-12-10 09:56:42 -04:00
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
(*func) (obj, a[0]);
|
1991-12-10 09:56:42 -04:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-12-10 09:56:42 -04:00
|
|
|
}
|
|
|
|
|
1991-08-07 08:32:58 -03:00
|
|
|
/* void func (object, string) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
call_forms_INstr (void (*func)(FL_OBJECT *, char *), FL_OBJECT *obj, PyObject *args)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
1992-01-27 12:45:55 -04:00
|
|
|
char *a;
|
1992-09-03 17:37:02 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "s", &a)) return NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
(*func) (obj, a);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1993-07-05 07:31:29 -03:00
|
|
|
/* void func (object, int, string) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
call_forms_INiINstr (void (*func)(FL_OBJECT *, int, char *), FL_OBJECT *obj, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-01-27 12:45:55 -04:00
|
|
|
char *b;
|
|
|
|
int a;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(is)", &a, &b)) return NULL;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
(*func) (obj, a, b);
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
#ifdef UNUSED
|
1993-07-05 07:31:29 -03:00
|
|
|
/* void func (object, int, int) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
call_forms_INiINi (void (*func)(FL_OBJECT *, int, int), FL_OBJECT *obj, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
int par1, par2;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(ii)", &par1, &par2)) return NULL;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
|
|
|
(*func) (obj, par1, par2);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1991-08-08 09:10:01 -03:00
|
|
|
#endif
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
/* int func (object) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
call_forms_Ri (int (*func)(FL_OBJECT *), FL_OBJECT *obj)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
int retval;
|
2002-03-31 11:56:56 -04:00
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
retval = (*func) (obj);
|
2002-03-31 11:56:56 -04:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyInt_FromLong ((long) retval);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* char * func (object) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
call_forms_Rstr (char * (*func)(FL_OBJECT *), FL_OBJECT *obj)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
char *str;
|
2002-03-31 11:56:56 -04:00
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
str = (*func) (obj);
|
2002-03-31 11:56:56 -04:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
if (str == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-10-20 17:18:26 -03:00
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyString_FromString (str);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* int func (object) */
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
call_forms_Rf (float (*func)(FL_OBJECT *), FL_OBJECT *obj)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
float retval;
|
2002-03-31 11:56:56 -04:00
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
retval = (*func) (obj);
|
2002-03-31 11:56:56 -04:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyFloat_FromDouble (retval);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
call_forms_OUTfOUTf (void (*func)(FL_OBJECT *, float *, float *), FL_OBJECT *obj)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
float f1, f2;
|
2002-03-31 11:56:56 -04:00
|
|
|
|
1991-08-07 08:32:58 -03:00
|
|
|
(*func) (obj, &f1, &f2);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return Py_BuildValue("(ff)", f1, f2);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
#ifdef UNUSED
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
call_forms_OUTf (void (*func)(FL_OBJECT *, float *), FL_OBJECT *obj)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
float f;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
(*func) (obj, &f);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyFloat_FromDouble (f);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1991-08-08 09:10:01 -03:00
|
|
|
#endif
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Class : browser */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_browser_topline(genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_set_browser_topline, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
clear_browser(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call (g, fl_clear_browser);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
add_browser_line (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INstr (fl_add_browser_line, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
addto_browser (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INstr (fl_addto_browser, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
insert_browser_line (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INiINstr (fl_insert_browser_line,
|
|
|
|
g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
delete_browser_line (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_delete_browser_line, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
replace_browser_line (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INiINstr (fl_replace_browser_line,
|
|
|
|
g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
get_browser_line(genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char *str;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &i))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
str = fl_get_browser_line (g->ob_generic, i);
|
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
if (str == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-10-20 17:18:26 -03:00
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyString_FromString (str);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
load_browser (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:34:44 -03:00
|
|
|
/* XXX strictly speaking this is wrong since fl_load_browser
|
|
|
|
XXX returns int, not void */
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INstr (fl_load_browser, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_browser_maxline(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Ri (fl_get_browser_maxline, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
select_browser_line (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_select_browser_line, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
deselect_browser_line (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_deselect_browser_line, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
deselect_browser (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call (g, fl_deselect_browser);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
isselected_browser_line (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int i, j;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &i))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1991-08-07 08:32:58 -03:00
|
|
|
j = fl_isselected_browser_line (g->ob_generic, i);
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyInt_FromLong (j);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_browser (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Ri (fl_get_browser, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_browser_fontsize (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INf (fl_set_browser_fontsize, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_browser_fontstyle (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_set_browser_fontstyle, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_browser_specialkey (genericobject *g, PyObject *args)
|
1991-12-10 09:56:42 -04:00
|
|
|
{
|
|
|
|
return call_forms_INc(fl_set_browser_specialkey, g-> ob_generic, args);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef browser_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-12-10 09:56:42 -04:00
|
|
|
{NULL, NULL} /* sentinel */
|
1991-08-07 08:32:58 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Class: button */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_button(genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_set_button, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_button(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Ri (fl_get_button, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1993-07-05 07:31:29 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_button_numb(genericobject *g)
|
1993-07-05 07:31:29 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Ri (fl_get_button_numb, g-> ob_generic);
|
1993-07-05 07:31:29 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_button_shortcut(genericobject *g, PyObject *args)
|
1991-12-10 09:56:42 -04:00
|
|
|
{
|
|
|
|
return call_forms_INstr (fl_set_button_shortcut, g-> ob_generic, args);
|
|
|
|
}
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef button_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Class: choice */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_choice(genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_set_choice, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_choice(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Ri (fl_get_choice, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
clear_choice (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return generic_call (g, fl_clear_choice);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
addto_choice (genericobject *g, PyObject *args)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INstr (fl_addto_choice, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
replace_choice (genericobject *g, PyObject *args)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INiINstr (fl_replace_choice, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
delete_choice (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_delete_choice, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_choice_text (genericobject *g)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rstr (fl_get_choice_text, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_choice_fontsize (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INf (fl_set_choice_fontsize, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_choice_fontstyle (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_set_choice_fontstyle, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef choice_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Class : Clock */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_clock(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int i0, i1, i2;
|
|
|
|
|
|
|
|
fl_get_clock (g->ob_generic, &i0, &i1, &i2);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return Py_BuildValue("(iii)", i0, i1, i2);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef clock_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"get_clock", (PyCFunction)get_clock, METH_NOARGS},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* CLass : Counters */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_counter_value(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rf (fl_get_counter_value, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_counter_value (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_counter_value, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_counter_precision (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INi (fl_set_counter_precision, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_counter_bounds (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INfINf (fl_set_counter_bounds, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_counter_step (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INfINf (fl_set_counter_step, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_counter_return (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return call_forms_INi (fl_set_counter_return, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef counter_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-12-10 09:56:42 -04:00
|
|
|
{NULL, NULL} /* sentinel */
|
1991-08-07 08:32:58 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Class: Dials */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_dial_value(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rf (fl_get_dial_value, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_dial_value (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_dial_value, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_dial_bounds (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INfINf (fl_set_dial_bounds, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_dial_bounds (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_OUTfOUTf (fl_get_dial_bounds, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_dial_step (genericobject *g, PyObject *args)
|
1991-12-10 09:56:42 -04:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_dial_step, g-> ob_generic, args);
|
1991-12-10 09:56:42 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef dial_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Class : Input */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_input (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INstr (fl_set_input, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_input (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rstr (fl_get_input, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_input_color (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INfINf (fl_set_input_color, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_input_return (genericobject *g, PyObject *args)
|
1991-12-10 09:56:42 -04:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INi (fl_set_input_return, g-> ob_generic, args);
|
1991-12-10 09:56:42 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef input_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Class : Menu */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_menu (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:34:44 -03:00
|
|
|
return call_forms_INstr (fl_set_menu, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_menu (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:34:44 -03:00
|
|
|
/* XXX strictly speaking this is wrong since fl_get_menu
|
|
|
|
XXX returns long, not int */
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Ri (fl_get_menu, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_menu_text (genericobject *g)
|
1993-03-30 09:18:41 -04:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rstr (fl_get_menu_text, g-> ob_generic);
|
1993-03-30 09:18:41 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
addto_menu (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:34:44 -03:00
|
|
|
return call_forms_INstr (fl_addto_menu, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef menu_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Class: Sliders */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_slider_value(genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rf (fl_get_slider_value, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_slider_value (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_slider_value, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_slider_bounds (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INfINf (fl_set_slider_bounds, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_slider_bounds (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_OUTfOUTf(fl_get_slider_bounds, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_slider_return (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_slider_return, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_slider_size (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_slider_size, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_slider_precision (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INi (fl_set_slider_precision, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_slider_step (genericobject *g, PyObject *args)
|
1991-12-10 09:56:42 -04:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_slider_step, g-> ob_generic, args);
|
1991-12-10 09:56:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef slider_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_positioner_xvalue (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_positioner_xvalue, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_positioner_xbounds (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INfINf (fl_set_positioner_xbounds,
|
|
|
|
g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_positioner_yvalue (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_positioner_yvalue, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_positioner_ybounds (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INfINf (fl_set_positioner_ybounds,
|
|
|
|
g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_positioner_xvalue (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rf (fl_get_positioner_xvalue, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_positioner_xbounds (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_OUTfOUTf (fl_get_positioner_xbounds, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_positioner_yvalue (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rf (fl_get_positioner_yvalue, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_positioner_ybounds (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_OUTfOUTf (fl_get_positioner_ybounds, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef positioner_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Class timer */
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
set_timer (genericobject *g, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
return call_forms_INf (fl_set_timer, g-> ob_generic, args);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
get_timer (genericobject *g)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return call_forms_Rf (fl_get_timer, g-> ob_generic);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef timer_methods[] = {
|
2002-03-31 11:56:56 -04:00
|
|
|
{"set_timer", (PyCFunction)set_timer, METH_OLDARGS},
|
|
|
|
{"get_timer", (PyCFunction)get_timer, METH_NOARGS},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Form objects */
|
|
|
|
|
|
|
|
typedef struct {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyObject_HEAD
|
1991-08-07 08:32:58 -03:00
|
|
|
FL_FORM *ob_form;
|
|
|
|
} formobject;
|
|
|
|
|
2002-07-17 13:30:39 -03:00
|
|
|
static PyTypeObject Formtype;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
#define is_formobject(v) ((v)->ob_type == &Formtype)
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_show_form(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int place, border;
|
1992-01-27 12:45:55 -04:00
|
|
|
char *name;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(iis)", &place, &border, &name))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
1992-01-27 12:45:55 -04:00
|
|
|
fl_show_form(f->ob_form, place, border, name);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
form_call(void (*func)(FL_FORM *), FL_FORM *f)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
(*func)(f);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_call_INiINi(void (*func)(FL_FORM *, int, int), FL_FORM *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
int a, b;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(ii)", &a, &b)) return NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
(*func)(f, a, b);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_call_INfINf(void (*func)(FL_FORM *, float, float), FL_FORM *f, PyObject *args)
|
1993-07-05 07:31:29 -03:00
|
|
|
{
|
|
|
|
float a, b;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(ff)", &a, &b)) return NULL;
|
1993-07-05 07:31:29 -03:00
|
|
|
|
|
|
|
(*func)(f, a, b);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1993-07-05 07:31:29 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
form_hide_form(formobject *f)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return form_call(fl_hide_form, f-> ob_form);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
form_redraw_form(formobject *f)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return form_call(fl_redraw_form, f-> ob_form);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_set_form_position(formobject *f, PyObject *args)
|
1991-10-20 17:18:26 -03:00
|
|
|
{
|
|
|
|
return form_call_INiINi(fl_set_form_position, f-> ob_form, args);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_set_form_size(formobject *f, PyObject *args)
|
1993-07-05 07:31:29 -03:00
|
|
|
{
|
|
|
|
return form_call_INiINi(fl_set_form_size, f-> ob_form, args);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_scale_form(formobject *f, PyObject *args)
|
1993-07-05 07:31:29 -03:00
|
|
|
{
|
|
|
|
return form_call_INfINf(fl_scale_form, f-> ob_form, args);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
generic_add_object(formobject *f, PyObject *args, FL_OBJECT *(*func)(int, float, float, float, float, char*), PyMethodDef *internal_methods)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
int type;
|
|
|
|
float x, y, w, h;
|
1992-01-27 12:45:55 -04:00
|
|
|
char *name;
|
1991-10-20 17:18:26 -03:00
|
|
|
FL_OBJECT *obj;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args,"(iffffs)", &type,&x,&y,&w,&h,&name))
|
1991-10-20 17:18:26 -03:00
|
|
|
return NULL;
|
1992-09-03 17:37:02 -03:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_addto_form (f-> ob_form);
|
1992-09-03 17:37:02 -03:00
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
obj = (*func) (type, x, y, w, h, name);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_end_form();
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
if (obj == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_NoMemory();
|
1991-10-20 17:18:26 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
return newgenericobject (obj, internal_methods);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_button(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_button, button_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_lightbutton(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_lightbutton, button_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_roundbutton(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_roundbutton, button_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_menu (formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_menu, menu_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_slider(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_slider, slider_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_valslider(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_valslider, slider_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_dial(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_dial, dial_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_counter(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_counter, counter_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_clock(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_clock, clock_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_box(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return generic_add_object(f, args, fl_add_box,
|
1997-01-03 18:17:11 -04:00
|
|
|
(PyMethodDef *)NULL);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_choice(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_choice, choice_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_browser(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_browser, browser_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_positioner(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1997-01-03 18:17:11 -04:00
|
|
|
return generic_add_object(f, args, fl_add_positioner,
|
|
|
|
positioner_methods);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_input(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_input, input_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_text(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
return generic_add_object(f, args, fl_add_text,
|
1997-01-03 18:17:11 -04:00
|
|
|
(PyMethodDef *)NULL);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_add_timer(formobject *f, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
return generic_add_object(f, args, fl_add_timer, timer_methods);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
form_freeze_form(formobject *f)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return form_call(fl_freeze_form, f-> ob_form);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
form_unfreeze_form(formobject *f)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return form_call(fl_unfreeze_form, f-> ob_form);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
form_activate_form(formobject *f)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return form_call(fl_activate_form, f-> ob_form);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
form_deactivate_form(formobject *f)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return form_call(fl_deactivate_form, f-> ob_form);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_bgn_group(formobject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
FL_OBJECT *obj;
|
|
|
|
|
|
|
|
fl_addto_form(f-> ob_form);
|
|
|
|
obj = fl_bgn_group();
|
|
|
|
fl_end_form();
|
|
|
|
|
|
|
|
if (obj == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_NoMemory();
|
1991-10-20 17:18:26 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return newgenericobject (obj, (PyMethodDef *) NULL);
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_end_group(formobject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_addto_form(f-> ob_form);
|
1991-08-08 09:10:01 -03:00
|
|
|
fl_end_group();
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_end_form();
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_find_first_or_last(FL_OBJECT *(*func)(FL_FORM *, int, float, float), formobject *f, PyObject *args)
|
1991-08-08 09:07:45 -03:00
|
|
|
{
|
|
|
|
int type;
|
|
|
|
float mx, my;
|
|
|
|
FL_OBJECT *generic;
|
|
|
|
genericobject *g;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(iff)", &type, &mx, &my)) return NULL;
|
1991-08-08 09:07:45 -03:00
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
generic = (*func) (f-> ob_form, type, mx, my);
|
1991-08-08 09:07:45 -03:00
|
|
|
|
|
|
|
if (generic == NULL)
|
|
|
|
{
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-08 09:07:45 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
g = findgeneric(generic);
|
|
|
|
if (g == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
1991-10-20 17:18:26 -03:00
|
|
|
"forms_find_{first|last} returns unknown object");
|
1991-08-08 09:07:45 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(g);
|
|
|
|
return (PyObject *) g;
|
1991-08-08 09:07:45 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_find_first(formobject *f, PyObject *args)
|
1991-08-08 09:07:45 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
return forms_find_first_or_last(fl_find_first, f, args);
|
1991-08-08 09:07:45 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_find_last(formobject *f, PyObject *args)
|
1991-08-08 09:07:45 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
return forms_find_first_or_last(fl_find_last, f, args);
|
1991-08-08 09:07:45 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_set_object_focus(formobject *f, PyObject *args)
|
1992-09-17 14:54:56 -03:00
|
|
|
{
|
|
|
|
genericobject *g;
|
|
|
|
if (args == NULL || !is_genericobject(args)) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_BadArgument();
|
1992-09-17 14:54:56 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
g = (genericobject *)args;
|
|
|
|
fl_set_object_focus(f->ob_form, g->ob_generic);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1992-09-17 14:54:56 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef form_methods[] = {
|
1991-08-07 08:32:58 -03:00
|
|
|
/* adm */
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
/* basic objects */
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2000-07-10 14:04:33 -03:00
|
|
|
form_dealloc(formobject *f)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
releaseobjects(f->ob_form);
|
1992-04-08 08:16:25 -03:00
|
|
|
if (f->ob_form->visible)
|
|
|
|
fl_hide_form(f->ob_form);
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_free_form(f->ob_form);
|
2000-05-03 20:44:39 -03:00
|
|
|
PyObject_Del(f);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1991-11-19 16:26:28 -04:00
|
|
|
#define OFF(x) offsetof(FL_FORM, x)
|
|
|
|
|
1991-11-12 11:43:18 -04:00
|
|
|
static struct memberlist form_memberlist[] = {
|
|
|
|
{"window", T_LONG, OFF(window), RO},
|
|
|
|
{"w", T_FLOAT, OFF(w)},
|
|
|
|
{"h", T_FLOAT, OFF(h)},
|
1992-09-17 14:54:56 -03:00
|
|
|
{"x", T_FLOAT, OFF(x), RO},
|
|
|
|
{"y", T_FLOAT, OFF(y), RO},
|
1991-11-12 11:43:18 -04:00
|
|
|
{"deactivated", T_INT, OFF(deactivated)},
|
1992-09-17 14:54:56 -03:00
|
|
|
{"visible", T_INT, OFF(visible), RO},
|
|
|
|
{"frozen", T_INT, OFF(frozen), RO},
|
1991-11-12 11:43:18 -04:00
|
|
|
{"doublebuf", T_INT, OFF(doublebuf)},
|
|
|
|
{NULL} /* Sentinel */
|
|
|
|
};
|
|
|
|
|
1991-11-19 16:26:28 -04:00
|
|
|
#undef OFF
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_getattr(formobject *f, char *name)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1997-01-03 18:17:11 -04:00
|
|
|
PyObject *meth;
|
1991-11-12 11:43:18 -04:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
meth = Py_FindMethod(form_methods, (PyObject *)f, name);
|
1991-11-12 11:43:18 -04:00
|
|
|
if (meth != NULL)
|
|
|
|
return meth;
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_Clear();
|
|
|
|
return PyMember_Get((char *)f->ob_form, form_memberlist, name);
|
1991-11-12 11:43:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2000-07-10 14:04:33 -03:00
|
|
|
form_setattr(formobject *f, char *name, PyObject *v)
|
1991-11-12 11:43:18 -04:00
|
|
|
{
|
|
|
|
if (v == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
"can't delete form attributes");
|
1996-09-11 20:31:07 -03:00
|
|
|
return -1;
|
1991-11-12 11:43:18 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyMember_Set((char *)f->ob_form, form_memberlist, name, v);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
form_repr(formobject *f)
|
1992-09-03 17:37:02 -03:00
|
|
|
{
|
|
|
|
char buf[100];
|
2001-11-28 16:27:42 -04:00
|
|
|
PyOS_snprintf(buf, sizeof(buf), "<FORMS_form at %p, window=%ld>",
|
|
|
|
f, f->ob_form->window);
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyString_FromString(buf);
|
1992-09-03 17:37:02 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyTypeObject Formtype = {
|
|
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
1994-08-01 08:34:53 -03:00
|
|
|
0, /*ob_size*/
|
2001-12-08 14:02:58 -04:00
|
|
|
"fl.FORMS_form", /*tp_name*/
|
1994-08-01 08:34:53 -03:00
|
|
|
sizeof(formobject), /*tp_size*/
|
|
|
|
0, /*tp_itemsize*/
|
1991-08-07 08:32:58 -03:00
|
|
|
/* methods */
|
1994-08-01 08:34:53 -03:00
|
|
|
(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*/
|
1991-08-07 08:32:58 -03:00
|
|
|
};
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
newformobject(FL_FORM *form)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
formobject *f;
|
2000-05-03 20:44:39 -03:00
|
|
|
f = PyObject_New(formobject, &Formtype);
|
1991-08-07 08:32:58 -03:00
|
|
|
if (f == NULL)
|
|
|
|
return NULL;
|
|
|
|
f->ob_form = form;
|
1997-01-03 18:17:11 -04:00
|
|
|
return (PyObject *)f;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
|
1991-08-07 08:32:58 -03:00
|
|
|
/* The "fl" module */
|
1991-10-20 17:18:26 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_make_form(PyObject *dummy, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int type;
|
|
|
|
float w, h;
|
|
|
|
FL_FORM *form;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(iff)", &type, &w, &h))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
|
|
|
form = fl_bgn_form(type, w, h);
|
|
|
|
if (form == NULL) {
|
|
|
|
/* XXX Actually, cannot happen! */
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_NoMemory();
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
fl_end_form();
|
|
|
|
return newformobject(form);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_activate_all_forms(PyObject *f, PyObject *args)
|
1992-03-27 13:20:21 -04:00
|
|
|
{
|
|
|
|
fl_activate_all_forms();
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1992-03-27 13:20:21 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_deactivate_all_forms(PyObject *f, PyObject *args)
|
1992-03-27 13:20:21 -04:00
|
|
|
{
|
|
|
|
fl_deactivate_all_forms();
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1992-03-27 13:20:21 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *my_event_callback = NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_set_event_call_back(PyObject *dummy, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1997-01-03 18:17:11 -04:00
|
|
|
if (args == Py_None)
|
1993-07-26 12:24:57 -03:00
|
|
|
args = NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
my_event_callback = args;
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_XINCREF(args);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
forms_do_or_check_forms(PyObject *dummy, FL_OBJECT *(*func)(void))
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
FL_OBJECT *generic;
|
|
|
|
genericobject *g;
|
1997-01-03 18:17:11 -04:00
|
|
|
PyObject *arg, *res;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
for (;;) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1991-08-07 08:32:58 -03:00
|
|
|
generic = (*func)();
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_END_ALLOW_THREADS
|
1991-08-07 08:32:58 -03:00
|
|
|
if (generic == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
if (generic == FL_EVENT) {
|
|
|
|
int dev;
|
|
|
|
short val;
|
|
|
|
if (my_event_callback == NULL)
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyInt_FromLong(-1L);
|
1991-08-07 08:32:58 -03:00
|
|
|
dev = fl_qread(&val);
|
1997-01-03 18:17:11 -04:00
|
|
|
arg = Py_BuildValue("(ih)", dev, val);
|
1991-08-07 08:32:58 -03:00
|
|
|
if (arg == NULL)
|
|
|
|
return NULL;
|
1997-01-03 18:17:11 -04:00
|
|
|
res = PyEval_CallObject(my_event_callback, arg);
|
|
|
|
Py_XDECREF(res);
|
|
|
|
Py_DECREF(arg);
|
1991-08-07 08:32:58 -03:00
|
|
|
if (res == NULL)
|
|
|
|
return NULL; /* Callback raised exception */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
g = findgeneric(generic);
|
|
|
|
if (g == NULL) {
|
1992-10-18 15:53:57 -03:00
|
|
|
/* Object not known to us (some dialogs cause this) */
|
1992-03-23 14:20:54 -04:00
|
|
|
continue; /* Ignore it */
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
if (g->ob_callback == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(g);
|
|
|
|
return ((PyObject *) g);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
2003-10-12 16:09:37 -03:00
|
|
|
arg = PyTuple_Pack(2, (PyObject *)g, g->ob_callback_arg);
|
1993-03-16 08:15:04 -04:00
|
|
|
if (arg == NULL)
|
|
|
|
return NULL;
|
1997-01-03 18:17:11 -04:00
|
|
|
res = PyEval_CallObject(g->ob_callback, arg);
|
|
|
|
Py_XDECREF(res);
|
|
|
|
Py_DECREF(arg);
|
1991-08-07 08:32:58 -03:00
|
|
|
if (res == NULL)
|
|
|
|
return NULL; /* Callback raised exception */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
forms_do_forms(PyObject *dummy)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return forms_do_or_check_forms(dummy, fl_do_forms);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
forms_check_forms(PyObject *dummy)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return forms_do_or_check_forms(dummy, fl_check_forms);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
forms_do_only_forms(PyObject *dummy)
|
1992-09-17 14:54:56 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return forms_do_or_check_forms(dummy, fl_do_only_forms);
|
1992-09-17 14:54:56 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
forms_check_only_forms(PyObject *dummy)
|
1992-09-17 14:54:56 -03:00
|
|
|
{
|
2002-03-31 11:56:56 -04:00
|
|
|
return forms_do_or_check_forms(dummy, fl_check_only_forms);
|
1992-09-17 14:54:56 -03:00
|
|
|
}
|
|
|
|
|
1991-08-08 09:10:01 -03:00
|
|
|
#ifdef UNUSED
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
fl_call(void (*func)(void))
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
(*func)();
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1991-08-08 09:10:01 -03:00
|
|
|
#endif
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_set_graphics_mode(PyObject *dummy, PyObject *args)
|
1991-12-10 09:56:42 -04:00
|
|
|
{
|
|
|
|
int rgbmode, doublebuf;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(ii)", &rgbmode, &doublebuf))
|
1991-12-10 09:56:42 -04:00
|
|
|
return NULL;
|
|
|
|
fl_set_graphics_mode(rgbmode,doublebuf);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-12-10 09:56:42 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_get_rgbmode(PyObject *dummy, PyObject *args)
|
1991-12-10 09:56:42 -04:00
|
|
|
{
|
1992-09-17 14:54:56 -03:00
|
|
|
extern int fl_rgbmode;
|
1991-12-10 09:56:42 -04:00
|
|
|
|
|
|
|
if (args != NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_BadArgument();
|
1991-12-10 09:56:42 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyInt_FromLong((long)fl_rgbmode);
|
1991-12-10 09:56:42 -04:00
|
|
|
}
|
1992-09-17 14:54:56 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_show_errors(PyObject *dummy, PyObject *args)
|
1992-09-17 14:54:56 -03:00
|
|
|
{
|
|
|
|
int show;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &show))
|
1992-09-17 14:54:56 -03:00
|
|
|
return NULL;
|
|
|
|
fl_show_errors(show);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1992-09-17 14:54:56 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_set_font_name(PyObject *dummy, PyObject *args)
|
1992-09-17 14:54:56 -03:00
|
|
|
{
|
|
|
|
int numb;
|
|
|
|
char *name;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(is)", &numb, &name))
|
1992-09-17 14:54:56 -03:00
|
|
|
return NULL;
|
|
|
|
fl_set_font_name(numb, name);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1992-09-17 14:54:56 -03:00
|
|
|
}
|
|
|
|
|
1991-12-10 09:56:42 -04:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_qdevice(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
short arg1;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "h", &arg1))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_qdevice(arg1);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_unqdevice(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
short arg1;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "h", &arg1))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_unqdevice(arg1);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_isqueued(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
long retval;
|
1992-09-03 17:37:02 -03:00
|
|
|
short arg1;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "h", &arg1))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
1991-10-20 17:18:26 -03:00
|
|
|
retval = fl_isqueued(arg1);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyInt_FromLong(retval);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_qtest(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
long retval;
|
1991-10-20 17:18:26 -03:00
|
|
|
retval = fl_qtest();
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyInt_FromLong(retval);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_qread(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1993-03-16 08:15:04 -04:00
|
|
|
int dev;
|
|
|
|
short val;
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1993-03-16 08:15:04 -04:00
|
|
|
dev = fl_qread(&val);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_END_ALLOW_THREADS
|
|
|
|
return Py_BuildValue("(ih)", dev, val);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
forms_qreset(PyObject *self)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
fl_qreset();
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_qenter(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
short arg1, arg2;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(hh)", &arg1, &arg2))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_qenter(arg1, arg2);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_color(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int arg;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &arg)) return NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
fl_color((short) arg);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_mapcolor(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
|
|
|
int arg0, arg1, arg2, arg3;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(iiii)", &arg0, &arg1, &arg2, &arg3))
|
1992-09-03 17:37:02 -03:00
|
|
|
return NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
|
|
|
fl_mapcolor(arg0, (short) arg1, (short) arg2, (short) arg3);
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_getmcolor(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1991-08-08 09:10:01 -03:00
|
|
|
int arg;
|
|
|
|
short r, g, b;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "i", &arg)) return NULL;
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_getmcolor(arg, &r, &g, &b);
|
1991-08-07 08:32:58 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return Py_BuildValue("(hhh)", r, g, b);
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2002-03-31 11:56:56 -04:00
|
|
|
forms_get_mouse(PyObject *self)
|
1991-08-08 09:07:45 -03:00
|
|
|
{
|
1993-03-16 08:15:04 -04:00
|
|
|
float x, y;
|
1991-08-08 09:07:45 -03:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_get_mouse(&x, &y);
|
1991-08-08 09:07:45 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return Py_BuildValue("(ff)", x, y);
|
1991-08-08 09:07:45 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_tie(PyObject *self, PyObject *args)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
short arg1, arg2, arg3;
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(hhh)", &arg1, &arg2, &arg3))
|
1991-08-07 08:32:58 -03:00
|
|
|
return NULL;
|
1991-10-20 17:18:26 -03:00
|
|
|
fl_tie(arg1, arg2, arg3);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_show_message(PyObject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1992-01-27 12:45:55 -04:00
|
|
|
char *a, *b, *c;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(sss)", &a, &b, &c)) return NULL;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1992-01-27 12:45:55 -04:00
|
|
|
fl_show_message(a, b, c);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_END_ALLOW_THREADS
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_show_choice(PyObject *f, PyObject *args)
|
1992-03-23 14:20:54 -04:00
|
|
|
{
|
|
|
|
char *m1, *m2, *m3, *b1, *b2, *b3;
|
|
|
|
int nb;
|
|
|
|
char *format;
|
1992-09-17 14:54:56 -03:00
|
|
|
long rv;
|
1992-03-23 14:20:54 -04:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (args == NULL || !PyTuple_Check(args)) {
|
|
|
|
PyErr_BadArgument();
|
1992-03-23 14:20:54 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
nb = PyTuple_Size(args) - 3;
|
1992-03-23 14:20:54 -04:00
|
|
|
if (nb <= 0) {
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
"need at least one button label");
|
1992-03-23 14:20:54 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
if (PyInt_Check(PyTuple_GetItem(args, 3))) {
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
1992-03-23 14:20:54 -04:00
|
|
|
"'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:
|
1997-01-03 18:17:11 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError, "too many button labels");
|
1992-03-23 14:20:54 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, format, &m1, &m2, &m3, &b1, &b2, &b3))
|
1992-03-23 14:20:54 -04:00
|
|
|
return NULL;
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1992-08-13 11:13:11 -03:00
|
|
|
rv = fl_show_choice(m1, m2, m3, nb, b1, b2, b3);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_END_ALLOW_THREADS
|
|
|
|
return PyInt_FromLong(rv);
|
1992-03-23 14:20:54 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_show_question(PyObject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1992-01-27 12:45:55 -04:00
|
|
|
int ret;
|
|
|
|
char *a, *b, *c;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(sss)", &a, &b, &c)) return NULL;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1992-01-27 12:45:55 -04:00
|
|
|
ret = fl_show_question(a, b, c);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_END_ALLOW_THREADS
|
1992-09-03 17:37:02 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyInt_FromLong((long) ret);
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_show_input(PyObject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
char *str;
|
1992-01-27 12:45:55 -04:00
|
|
|
char *a, *b;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(ss)", &a, &b)) return NULL;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1992-01-27 12:45:55 -04:00
|
|
|
str = fl_show_input(a, b);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_END_ALLOW_THREADS
|
1991-10-20 17:18:26 -03:00
|
|
|
|
|
|
|
if (str == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-10-20 17:18:26 -03:00
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyString_FromString(str);
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_file_selector(PyObject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1992-09-03 17:37:02 -03:00
|
|
|
char *str;
|
1992-01-27 12:45:55 -04:00
|
|
|
char *a, *b, *c, *d;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
if (!PyArg_Parse(args, "(ssss)", &a, &b, &c, &d)) return NULL;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1992-01-27 12:45:55 -04:00
|
|
|
str = fl_show_file_selector(a, b, c, d);
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_END_ALLOW_THREADS
|
1992-09-03 17:37:02 -03:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
if (str == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-10-20 17:18:26 -03:00
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyString_FromString(str);
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-22 20:57:55 -03:00
|
|
|
forms_file_selector_func(PyObject *args, char *(*func)(void))
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
char *str;
|
1991-08-08 09:10:01 -03:00
|
|
|
|
1991-10-20 17:18:26 -03:00
|
|
|
str = (*func) ();
|
|
|
|
|
|
|
|
if (str == NULL) {
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-10-20 17:18:26 -03:00
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
return PyString_FromString(str);
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_get_directory(PyObject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
return forms_file_selector_func(args, fl_get_directory);
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_get_pattern(PyObject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
return forms_file_selector_func(args, fl_get_pattern);
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyObject *
|
2000-07-10 14:04:33 -03:00
|
|
|
forms_get_filename(PyObject *f, PyObject *args)
|
1991-08-08 09:10:01 -03:00
|
|
|
{
|
1991-10-20 17:18:26 -03:00
|
|
|
return forms_file_selector_func(args, fl_get_filename);
|
1991-08-08 09:10:01 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:17:11 -04:00
|
|
|
static PyMethodDef forms_methods[] = {
|
1991-08-07 08:32:58 -03:00
|
|
|
/* adm */
|
2002-01-17 19:15:58 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
/* gl support wrappers */
|
2002-01-17 19:15:58 -04:00
|
|
|
{"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}, */
|
2002-03-31 11:56:56 -04:00
|
|
|
{"qreset", forms_qreset, METH_NOARGS},
|
2002-01-17 19:15:58 -04:00
|
|
|
{"qenter", forms_qenter, METH_OLDARGS},
|
2002-03-31 11:56:56 -04:00
|
|
|
{"get_mouse", forms_get_mouse, METH_NOARGS},
|
2002-01-17 19:15:58 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
/* interaction */
|
2002-03-31 11:56:56 -04:00
|
|
|
{"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},
|
2002-01-17 19:15:58 -04:00
|
|
|
{"set_event_call_back", forms_set_event_call_back, METH_OLDARGS},
|
1991-08-07 08:32:58 -03:00
|
|
|
/* goodies */
|
2002-01-17 19:15:58 -04:00
|
|
|
{"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},
|
1991-08-07 08:32:58 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
2002-08-01 23:27:13 -03:00
|
|
|
PyMODINIT_FUNC
|
2000-07-21 03:00:07 -03:00
|
|
|
initfl(void)
|
1991-08-07 08:32:58 -03:00
|
|
|
{
|
1997-01-03 18:17:11 -04:00
|
|
|
Py_InitModule("fl", forms_methods);
|
2006-01-19 02:09:39 -04:00
|
|
|
if (m == NULL)
|
|
|
|
return;
|
1991-10-20 17:18:26 -03:00
|
|
|
foreground();
|
1991-12-10 09:56:42 -04:00
|
|
|
fl_init();
|
1991-08-07 08:32:58 -03:00
|
|
|
}
|
1997-01-03 18:17:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
|