Skip to content

Commit

Permalink
* Added gmtime/localtime/mktime and SYSV timezone globals to timemodu…
Browse files Browse the repository at this point in the history
…le.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().
  • Loading branch information
gvanrossum committed Jun 17, 1993
1 parent 6a0e228 commit 234f942
Show file tree
Hide file tree
Showing 33 changed files with 299 additions and 124 deletions.
3 changes: 1 addition & 2 deletions Include/cgensupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ typedef char *string;
#define mknewlongobject(x) newintobject(x)
#define mknewshortobject(x) newintobject((long)x)
#define mknewfloatobject(x) newfloatobject(x)

extern object *mknewcharobject PROTO((int c));
#define mknewcharobject(c) mkvalue("c", c)

extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a));
extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a));
Expand Down
2 changes: 2 additions & 0 deletions Include/listobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ extern object *getlistitem PROTO((object *, int));
extern int setlistitem PROTO((object *, int, object *));
extern int inslistitem PROTO((object *, int, object *));
extern int addlistitem PROTO((object *, object *));
extern object *getlistslice PROTO((object *, int, int));
extern int setlistslice PROTO((object *, int, int, object *));
extern int sortlist PROTO((object *));

/* Macro, trading safety for speed */
Expand Down
23 changes: 1 addition & 22 deletions Include/modsupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,8 @@ extern int vgetargs PROTO((object *, char *, va_list));
extern object *mkvalue PROTO((char *, ...));
extern object *vmkvalue PROTO((char *, va_list));

/* The following are obsolete -- use getargs directly! */
#define getnoarg(v) getargs(v, "")
#define getintarg(v, a) getargs(v, "i", a)
#define getintintarg(v, a, b) getargs(v, "(ii)", a, b)
#define getintintintarg(v, a, b, c) getargs(v, "(iii)", a, b, c)
#define getlongarg(v, a) getargs(v, "l", a)
#define getlonglongarg(v, a, b) getargs(v, "(ll)", a, b)
#define getlonglongobjectarg(v, a, b, c) getargs(v, "(llO)", a, b, c)
#define getStrarg(v, a) getargs(v, "S", a)
#define getstrarg(v, a) getargs(v, "s", a)
#define getstrstrarg(v, a, b) getargs(v, "(ss)", a, b)
#define getStrStrarg(v, a, b) getargs(v, "(SS)", a, b)
#define getstrstrintarg(v, a, b, c) getargs(v, "(ssi)", a, b, c)
#define getStrintarg(v, a, b) getargs(v, "(Si)", a, b)
#define getstrintarg(v, a, b) getargs(v, "(si)", a, b)
#define getintstrarg(v, a, b) getargs(v, "(is)", a, b)
#define getpointarg(v, a) getargs(v, "(ii)", a, (a)+1)
#define get3pointarg(v, a) getargs(v, "((ii)(ii)(ii))", \
a, a+1, a+2, a+3, a+4, a+5)
#define getrectarg(v, a) getargs(v, "((ii)(ii))", a, a+1, a+2, a+3)
#define getrectintarg(v, a) getargs(v, "(((ii)(ii))i)", a, a+1, a+2, a+3, a+4)
#define getpointintarg(v, a) getargs(v, "((ii)i)", a, a+1, a+2)
#define getpointstrarg(v, a, b) getargs(v, "((ii)s)", a, a+1, b)
#define getrectpointarg(v, a) getargs(v, "(((ii)(ii))(ii))", \
a, a+1, a+2, a+3, a+4, a+5)
#define getdoublearg(v, a) getargs(v, "d", a)
#define get2doublearg(v, a, b) getargs(v, "(dd)", a, b)
1 change: 1 addition & 0 deletions Include/pythonrun.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void initall PROTO((void));

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

int run_command PROTO((char *));
int run_script PROTO((FILE *, char *));
int run_tty_1 PROTO((FILE *, char *));
int run_tty_loop PROTO((FILE *, char *));
Expand Down
2 changes: 1 addition & 1 deletion Modules/almodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ al_openport (self, args)
}
size = gettuplesize(args);
if (size == 2) {
if (!getstrstrarg (args, &name, &dir))
if (!getargs (args, "(ss)", &name, &dir))
return NULL;
}
else if (size == 3) {
Expand Down
2 changes: 1 addition & 1 deletion Modules/arraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ d_setitem(ap, i, v)
}

/* Description of types */
struct arraydescr descriptors[] = {
static struct arraydescr descriptors[] = {
{'c', sizeof(char), c_getitem, c_setitem},
{'b', sizeof(char), b_getitem, b_setitem},
{'h', sizeof(short), h_getitem, h_setitem},
Expand Down
12 changes: 6 additions & 6 deletions Modules/cdmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,12 +725,12 @@ CD_addcallback(self, args)
object *args;
{
int type;
object *funcobject, *funcargobject;
object *func, *funcarg;

CheckParser(self);

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

if (type < 0 || type >= NCALLBACKS) {
Expand All @@ -744,11 +744,11 @@ CD_addcallback(self, args)
CDsetcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, (void *) self);
#endif
XDECREF(self->ob_cdcallbacks[type].ob_cdcallback);
INCREF(funcobject);
self->ob_cdcallbacks[type].ob_cdcallback = funcobject;
INCREF(func);
self->ob_cdcallbacks[type].ob_cdcallback = func;
XDECREF(self->ob_cdcallbacks[type].ob_cdcallbackarg);
INCREF(funcargobject);
self->ob_cdcallbacks[type].ob_cdcallbackarg = funcargobject;
INCREF(funcarg);
self->ob_cdcallbacks[type].ob_cdcallbackarg = funcarg;

INCREF(None);
return None;
Expand Down
11 changes: 0 additions & 11 deletions Modules/cgensupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "cgensupport.h"


/* Functions to construct return values */

object *
mknewcharobject(c)
int c;
{
char ch[1];
ch[0] = c;
return newsizedstringobject(ch, 1);
}

/* Functions to extract arguments.
These needs to know the total number of arguments supplied,
since the argument list is a tuple only of there is more than
Expand Down
3 changes: 1 addition & 2 deletions Modules/cgensupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ typedef char *string;
#define mknewlongobject(x) newintobject(x)
#define mknewshortobject(x) newintobject((long)x)
#define mknewfloatobject(x) newfloatobject(x)

extern object *mknewcharobject PROTO((int c));
#define mknewcharobject(c) mkvalue("c", c)

extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a));
extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a));
Expand Down
12 changes: 6 additions & 6 deletions Modules/flmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ call_forms_INiINstr (func, obj, args)
char *b;
int a;

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

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

Expand All @@ -546,7 +546,7 @@ call_forms_INiINi (func, obj, args)
{
int par1, par2;

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

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

Expand Down Expand Up @@ -1048,7 +1048,7 @@ get_default(g, args)

c = fl_get_default (g->ob_generic);

return ((object *) mknewcharobject (c)); /* in cgensupport.c */
return mkvalue("c", c);
}

static struct methodlist default_methods[] = {
Expand Down Expand Up @@ -1479,7 +1479,7 @@ form_call_INiINi(func, f, args)
{
int a, b;

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

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

Expand Down Expand Up @@ -2144,7 +2144,7 @@ forms_set_graphics_mode(dummy, args)
{
int rgbmode, doublebuf;

if (!getintintarg(args, &rgbmode, &doublebuf))
if (!getargs(args, "(ii)", &rgbmode, &doublebuf))
return NULL;
fl_set_graphics_mode(rgbmode,doublebuf);
INCREF(None);
Expand Down Expand Up @@ -2441,7 +2441,7 @@ forms_show_input(f, args)
char *str;
char *a, *b;

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

BGN_SAVE
str = fl_show_input(a, b);
Expand Down
2 changes: 1 addition & 1 deletion Modules/fmmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fh_scalefont(self, args)
object *args;
{
double size;
if (!getdoublearg(args, &size))
if (!getargs(args, "d", &size))
return NULL;
return newfhobject(fmscalefont(self->fh_fh, size));
}
Expand Down
6 changes: 3 additions & 3 deletions Modules/imgfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ imgfile_read(self, args)
return rv;
}

IMAGE *glob_image;
long *glob_datap;
int glob_width, glob_z;
static IMAGE *glob_image;
static long *glob_datap;
static int glob_width, glob_z;

static
xs_get(buf, y)
Expand Down
3 changes: 3 additions & 0 deletions Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ extern int errno;

#include "modsupport.h"

#define getdoublearg(v, a) getargs(v, "d", a)
#define get2doublearg(v, a, b) getargs(v, "(dd)", a, b)

#include <math.h>

#ifdef i860
Expand Down
2 changes: 1 addition & 1 deletion Modules/nismodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ nis_match (self, args)
int err;
object *res;

if (!getstrstrarg(args, &key, &map))
if (!getargs(args, "(ss)", &key, &map))
return NULL;
if ((err = yp_get_default_domain(&domain)) != 0)
return nis_error(err);
Expand Down
24 changes: 12 additions & 12 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ posix_2str(args, func)
{
char *path1, *path2;
int res;
if (!getstrstrarg(args, &path1, &path2))
if (!getargs(args, "(ss)", &path1, &path2))
return NULL;
BGN_SAVE
res = (*func)(path1, path2);
Expand All @@ -185,7 +185,7 @@ posix_strint(args, func)
char *path;
int i;
int res;
if (!getstrintarg(args, &path, &i))
if (!getargs(args, "(si)", &path, &i))
return NULL;
BGN_SAVE
res = (*func)(path, i);
Expand Down Expand Up @@ -691,7 +691,7 @@ posix_kill(self, args)
object *args;
{
int pid, sig;
if (!getintintarg(args, &pid, &sig))
if (!getargs(args, "(ii)", &pid, &sig))
return NULL;
if (kill(pid, sig) == -1)
return posix_error();
Expand Down Expand Up @@ -891,7 +891,7 @@ posix_tcsetpgrp(self, args)

/* Functions acting on file descriptors */

object *
static object *
posix_open(self, args)
object *self;
object *args;
Expand All @@ -913,7 +913,7 @@ posix_open(self, args)
return newintobject((long)fd);
}

object *
static object *
posix_close(self, args)
object *self;
object *args;
Expand All @@ -930,7 +930,7 @@ posix_close(self, args)
return None;
}

object *
static object *
posix_dup(self, args)
object *self;
object *args;
Expand All @@ -946,7 +946,7 @@ posix_dup(self, args)
return newintobject((long)fd);
}

object *
static object *
posix_dup2(self, args)
object *self;
object *args;
Expand All @@ -963,7 +963,7 @@ posix_dup2(self, args)
return None;
}

object *
static object *
posix_lseek(self, args)
object *self;
object *args;
Expand All @@ -988,7 +988,7 @@ posix_lseek(self, args)
return newintobject(res);
}

object *
static object *
posix_read(self, args)
object *self;
object *args;
Expand All @@ -1011,7 +1011,7 @@ posix_read(self, args)
return buffer;
}

object *
static object *
posix_write(self, args)
object *self;
object *args;
Expand All @@ -1028,7 +1028,7 @@ posix_write(self, args)
return newintobject((long)size);
}

object *
static object *
posix_fstat(self, args)
object *self;
object *args;
Expand Down Expand Up @@ -1079,7 +1079,7 @@ posix_fdopen(self, args)
}

#ifndef MSDOS
object *
static object *
posix_pipe(self, args)
object *self;
object *args;
Expand Down
6 changes: 4 additions & 2 deletions Modules/rotormodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,10 @@ static typeobject Rotortype = {
};


object *rotor_rotor(self, args)
object *args;
static object *
rotor_rotor(self, args)
object *self;
object *args;
{
char *string;
rotorobject *r;
Expand Down
2 changes: 1 addition & 1 deletion Modules/sgimodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ initsgi()
initmodule("sgi", sgi_methods);
}

int dummy; /* $%#@!& dl wants at least a byte of bss */
static int dummy; /* $%#@!& dl wants at least a byte of bss */
4 changes: 2 additions & 2 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,9 @@ sock_send(s, args)
char *buf;
int len, n, flags;
flags = 0;
if (!getargs(args, "(s#)", &buf, &len)) {
if (!getargs(args, "s#", &buf, &len)) {
err_clear();
if (!getargs(args, "s#", &buf, &len, &flags))
if (!getargs(args, "(s#i)", &buf, &len, &flags))
return NULL;
}
BGN_SAVE
Expand Down
Loading

0 comments on commit 234f942

Please sign in to comment.