Skip to content

Commit 234f942

Browse files
committed
* Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Added $(SYSDEF) to its build rule in Makefile. * cgensupport.[ch], modsupport.[ch]: removed some old stuff. Also changed files that still used it... And made several things static that weren't but should have been... And other minor cleanups... * listobject.[ch]: add external interfaces {set,get}listslice * socketmodule.c: fix bugs in new send() argument parsing. * sunaudiodevmodule.c: added flush() and close().
1 parent 6a0e228 commit 234f942

33 files changed

+299
-124
lines changed

Include/cgensupport.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ typedef char *string;
2929
#define mknewlongobject(x) newintobject(x)
3030
#define mknewshortobject(x) newintobject((long)x)
3131
#define mknewfloatobject(x) newfloatobject(x)
32-
33-
extern object *mknewcharobject PROTO((int c));
32+
#define mknewcharobject(c) mkvalue("c", c)
3433

3534
extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a));
3635
extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a));

Include/listobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ extern object *getlistitem PROTO((object *, int));
5353
extern int setlistitem PROTO((object *, int, object *));
5454
extern int inslistitem PROTO((object *, int, object *));
5555
extern int addlistitem PROTO((object *, object *));
56+
extern object *getlistslice PROTO((object *, int, int));
57+
extern int setlistslice PROTO((object *, int, int, object *));
5658
extern int sortlist PROTO((object *));
5759

5860
/* Macro, trading safety for speed */

Include/modsupport.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,8 @@ extern int vgetargs PROTO((object *, char *, va_list));
4040
extern object *mkvalue PROTO((char *, ...));
4141
extern object *vmkvalue PROTO((char *, va_list));
4242

43+
/* The following are obsolete -- use getargs directly! */
4344
#define getnoarg(v) getargs(v, "")
4445
#define getintarg(v, a) getargs(v, "i", a)
45-
#define getintintarg(v, a, b) getargs(v, "(ii)", a, b)
46-
#define getintintintarg(v, a, b, c) getargs(v, "(iii)", a, b, c)
4746
#define getlongarg(v, a) getargs(v, "l", a)
48-
#define getlonglongarg(v, a, b) getargs(v, "(ll)", a, b)
49-
#define getlonglongobjectarg(v, a, b, c) getargs(v, "(llO)", a, b, c)
50-
#define getStrarg(v, a) getargs(v, "S", a)
5147
#define getstrarg(v, a) getargs(v, "s", a)
52-
#define getstrstrarg(v, a, b) getargs(v, "(ss)", a, b)
53-
#define getStrStrarg(v, a, b) getargs(v, "(SS)", a, b)
54-
#define getstrstrintarg(v, a, b, c) getargs(v, "(ssi)", a, b, c)
55-
#define getStrintarg(v, a, b) getargs(v, "(Si)", a, b)
56-
#define getstrintarg(v, a, b) getargs(v, "(si)", a, b)
57-
#define getintstrarg(v, a, b) getargs(v, "(is)", a, b)
58-
#define getpointarg(v, a) getargs(v, "(ii)", a, (a)+1)
59-
#define get3pointarg(v, a) getargs(v, "((ii)(ii)(ii))", \
60-
a, a+1, a+2, a+3, a+4, a+5)
61-
#define getrectarg(v, a) getargs(v, "((ii)(ii))", a, a+1, a+2, a+3)
62-
#define getrectintarg(v, a) getargs(v, "(((ii)(ii))i)", a, a+1, a+2, a+3, a+4)
63-
#define getpointintarg(v, a) getargs(v, "((ii)i)", a, a+1, a+2)
64-
#define getpointstrarg(v, a, b) getargs(v, "((ii)s)", a, a+1, b)
65-
#define getrectpointarg(v, a) getargs(v, "(((ii)(ii))(ii))", \
66-
a, a+1, a+2, a+3, a+4, a+5)
67-
#define getdoublearg(v, a) getargs(v, "d", a)
68-
#define get2doublearg(v, a, b) getargs(v, "(dd)", a, b)

Include/pythonrun.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void initall PROTO((void));
2828

2929
int run PROTO((FILE *, char *));
3030

31+
int run_command PROTO((char *));
3132
int run_script PROTO((FILE *, char *));
3233
int run_tty_1 PROTO((FILE *, char *));
3334
int run_tty_loop PROTO((FILE *, char *));

Modules/almodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ al_openport (self, args)
568568
}
569569
size = gettuplesize(args);
570570
if (size == 2) {
571-
if (!getstrstrarg (args, &name, &dir))
571+
if (!getargs (args, "(ss)", &name, &dir))
572572
return NULL;
573573
}
574574
else if (size == 3) {

Modules/arraymodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ d_setitem(ap, i, v)
209209
}
210210

211211
/* Description of types */
212-
struct arraydescr descriptors[] = {
212+
static struct arraydescr descriptors[] = {
213213
{'c', sizeof(char), c_getitem, c_setitem},
214214
{'b', sizeof(char), b_getitem, b_setitem},
215215
{'h', sizeof(short), h_getitem, h_setitem},

Modules/cdmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,12 @@ CD_addcallback(self, args)
725725
object *args;
726726
{
727727
int type;
728-
object *funcobject, *funcargobject;
728+
object *func, *funcarg;
729729

730730
CheckParser(self);
731731

732732
/* XXX - more work here */
733-
if (!getargs(args, "(iOO)", &type, &funcobject, &funcargobject))
733+
if (!getargs(args, "(iOO)", &type, &func, &funcarg))
734734
return NULL;
735735

736736
if (type < 0 || type >= NCALLBACKS) {
@@ -744,11 +744,11 @@ CD_addcallback(self, args)
744744
CDsetcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, (void *) self);
745745
#endif
746746
XDECREF(self->ob_cdcallbacks[type].ob_cdcallback);
747-
INCREF(funcobject);
748-
self->ob_cdcallbacks[type].ob_cdcallback = funcobject;
747+
INCREF(func);
748+
self->ob_cdcallbacks[type].ob_cdcallback = func;
749749
XDECREF(self->ob_cdcallbacks[type].ob_cdcallbackarg);
750-
INCREF(funcargobject);
751-
self->ob_cdcallbacks[type].ob_cdcallbackarg = funcargobject;
750+
INCREF(funcarg);
751+
self->ob_cdcallbacks[type].ob_cdcallbackarg = funcarg;
752752

753753
INCREF(None);
754754
return None;

Modules/cgensupport.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2828
#include "cgensupport.h"
2929

3030

31-
/* Functions to construct return values */
32-
33-
object *
34-
mknewcharobject(c)
35-
int c;
36-
{
37-
char ch[1];
38-
ch[0] = c;
39-
return newsizedstringobject(ch, 1);
40-
}
41-
4231
/* Functions to extract arguments.
4332
These needs to know the total number of arguments supplied,
4433
since the argument list is a tuple only of there is more than

Modules/cgensupport.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ typedef char *string;
2929
#define mknewlongobject(x) newintobject(x)
3030
#define mknewshortobject(x) newintobject((long)x)
3131
#define mknewfloatobject(x) newfloatobject(x)
32-
33-
extern object *mknewcharobject PROTO((int c));
32+
#define mknewcharobject(c) mkvalue("c", c)
3433

3534
extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a));
3635
extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a));

Modules/flmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ call_forms_INiINstr (func, obj, args)
528528
char *b;
529529
int a;
530530

531-
if (!getintstrarg(args, &a, &b)) return NULL;
531+
if (!getargs(args, "(is)", &a, &b)) return NULL;
532532

533533
(*func) (obj, a, b);
534534

@@ -546,7 +546,7 @@ call_forms_INiINi (func, obj, args)
546546
{
547547
int par1, par2;
548548

549-
if (!getintintarg(args, &par1, &par2)) return NULL;
549+
if (!getargs(args, "(ii)", &par1, &par2)) return NULL;
550550

551551
(*func) (obj, par1, par2);
552552

@@ -1048,7 +1048,7 @@ get_default(g, args)
10481048

10491049
c = fl_get_default (g->ob_generic);
10501050

1051-
return ((object *) mknewcharobject (c)); /* in cgensupport.c */
1051+
return mkvalue("c", c);
10521052
}
10531053

10541054
static struct methodlist default_methods[] = {
@@ -1479,7 +1479,7 @@ form_call_INiINi(func, f, args)
14791479
{
14801480
int a, b;
14811481

1482-
if (!getintintarg(args, &a, &b)) return NULL;
1482+
if (!getargs(args, "(ii)", &a, &b)) return NULL;
14831483

14841484
(*func)(f, a, b);
14851485

@@ -2144,7 +2144,7 @@ forms_set_graphics_mode(dummy, args)
21442144
{
21452145
int rgbmode, doublebuf;
21462146

2147-
if (!getintintarg(args, &rgbmode, &doublebuf))
2147+
if (!getargs(args, "(ii)", &rgbmode, &doublebuf))
21482148
return NULL;
21492149
fl_set_graphics_mode(rgbmode,doublebuf);
21502150
INCREF(None);
@@ -2441,7 +2441,7 @@ forms_show_input(f, args)
24412441
char *str;
24422442
char *a, *b;
24432443

2444-
if (!getstrstrarg(args, &a, &b)) return NULL;
2444+
if (!getargs(args, "(ss)", &a, &b)) return NULL;
24452445

24462446
BGN_SAVE
24472447
str = fl_show_input(a, b);

0 commit comments

Comments
 (0)