* Grammar: corrected old typo (class instead of 'class')
* dosmodule.c: MSDOS specific stuff from posixmodule.c. * posixmodule.c: removed all MSDOS specific stuff. * tokenizer.h, parsetok.h: in prototypes, don't mix named and unnamed parameters (MSC doesn't like this).
This commit is contained in:
parent
455b87d457
commit
248a50c168
|
@ -143,4 +143,4 @@ exprlist: expr (',' expr)* [',']
|
||||||
testlist: test (',' test)* [',']
|
testlist: test (',' test)* [',']
|
||||||
dictmaker: test ':' test (',' test ':' test)* [',']
|
dictmaker: test ':' test (',' test ':' test)* [',']
|
||||||
|
|
||||||
classdef: class NAME ['(' testlist ')'] ':' suite
|
classdef: 'class' NAME ['(' testlist ')'] ':' suite
|
||||||
|
|
|
@ -30,9 +30,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
/* Parser-tokenizer link interface */
|
/* Parser-tokenizer link interface */
|
||||||
|
|
||||||
extern int parsestring PROTO((char *, grammar *, int start, node **n_ret));
|
extern int parsestring PROTO((char *, grammar *, int, node **_ret));
|
||||||
extern int parsefile PROTO((FILE *, char *, grammar *, int start,
|
extern int parsefile PROTO((FILE *, char *, grammar *, int,
|
||||||
char *ps1, char *ps2, node **n_ret));
|
char *, char *, node **));
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#define SYSV
|
#define SYSV
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MSDOS
|
|
||||||
#define NO_LSTAT
|
|
||||||
#define NO_UNAME
|
|
||||||
#include <dos.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __sgi
|
#ifdef __sgi
|
||||||
#define DO_PG
|
#define DO_PG
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,9 +61,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#else /* !SYSV */
|
#else /* !SYSV */
|
||||||
|
|
||||||
#ifndef MSDOS
|
|
||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !SYSV */
|
#endif /* !SYSV */
|
||||||
|
|
||||||
|
@ -90,14 +82,12 @@ extern int chdir PROTO((const char *));
|
||||||
extern int rmdir PROTO((const char *));
|
extern int rmdir PROTO((const char *));
|
||||||
extern int chmod PROTO((const char *, mode_t));
|
extern int chmod PROTO((const char *, mode_t));
|
||||||
extern char *getcwd(); /* No PROTO((char *, int)) -- non portable */
|
extern char *getcwd(); /* No PROTO((char *, int)) -- non portable */
|
||||||
#ifndef MSDOS
|
|
||||||
extern char *strerror PROTO((int));
|
extern char *strerror PROTO((int));
|
||||||
extern int link PROTO((const char *, const char *));
|
extern int link PROTO((const char *, const char *));
|
||||||
extern int rename PROTO((const char *, const char *));
|
extern int rename PROTO((const char *, const char *));
|
||||||
extern int stat PROTO((const char *, struct stat *));
|
extern int stat PROTO((const char *, struct stat *));
|
||||||
extern int unlink PROTO((const char *));
|
extern int unlink PROTO((const char *));
|
||||||
extern int pclose PROTO((FILE *));
|
extern int pclose PROTO((FILE *));
|
||||||
#endif /* !MSDOS */
|
|
||||||
#endif /* !_SEQUENT_ */
|
#endif /* !_SEQUENT_ */
|
||||||
#ifdef NO_LSTAT
|
#ifdef NO_LSTAT
|
||||||
#define lstat stat
|
#define lstat stat
|
||||||
|
@ -269,7 +259,6 @@ posix_getcwd(self, args)
|
||||||
return newstringobject(buf);
|
return newstringobject(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MSDOS
|
|
||||||
static object *
|
static object *
|
||||||
posix_link(self, args)
|
posix_link(self, args)
|
||||||
object *self;
|
object *self;
|
||||||
|
@ -277,7 +266,6 @@ posix_link(self, args)
|
||||||
{
|
{
|
||||||
return posix_2str(args, link);
|
return posix_2str(args, link);
|
||||||
}
|
}
|
||||||
#endif /* !MSDOS */
|
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
posix_listdir(self, args)
|
posix_listdir(self, args)
|
||||||
|
@ -286,83 +274,6 @@ posix_listdir(self, args)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
object *d, *v;
|
object *d, *v;
|
||||||
|
|
||||||
#ifdef TURBO_C
|
|
||||||
struct ffblk ep;
|
|
||||||
int rv;
|
|
||||||
if (!getargs(args, "s", &name))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (findfirst(name, &ep, 0) == -1)
|
|
||||||
return posix_error();
|
|
||||||
if ((d = newlistobject(0)) == NULL)
|
|
||||||
return NULL;
|
|
||||||
do {
|
|
||||||
v = newstringobject(ep.ff_name);
|
|
||||||
if (v == NULL) {
|
|
||||||
DECREF(d);
|
|
||||||
d = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (addlistitem(d, v) != 0) {
|
|
||||||
DECREF(v);
|
|
||||||
DECREF(d);
|
|
||||||
d = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DECREF(v);
|
|
||||||
} while ((rv = findnext(&ep)) == 0);
|
|
||||||
#endif /* TURBO_C */
|
|
||||||
#ifdef MSDOS
|
|
||||||
struct find_t ep;
|
|
||||||
int rv;
|
|
||||||
char _name[100];
|
|
||||||
int attrib;
|
|
||||||
int num= 0;
|
|
||||||
|
|
||||||
if (!getargs(args, "s", &name))
|
|
||||||
return NULL;
|
|
||||||
strcpy( _name, name );
|
|
||||||
|
|
||||||
again:
|
|
||||||
if ((d = newlistobject(0)) == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if( _name[strlen( _name )-1]=='/' )
|
|
||||||
strcat( _name, "*.*" );
|
|
||||||
|
|
||||||
if (_dos_findfirst(_name, _A_NORMAL|_A_SUBDIR, &ep) == -1)
|
|
||||||
return posix_error();
|
|
||||||
attrib= ep.attrib;
|
|
||||||
do {
|
|
||||||
v = newstringobject(ep.name);
|
|
||||||
if (v == NULL) {
|
|
||||||
DECREF(d);
|
|
||||||
d = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (addlistitem(d, v) != 0) {
|
|
||||||
DECREF(v);
|
|
||||||
DECREF(d);
|
|
||||||
d = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
num++;
|
|
||||||
DECREF(v);
|
|
||||||
} while ((rv = _dos_findnext(&ep)) == 0);
|
|
||||||
|
|
||||||
if( attrib&_A_SUBDIR && num==1 )
|
|
||||||
{
|
|
||||||
DECREF( d );
|
|
||||||
strcat( _name, "/*.*" );
|
|
||||||
/* This comment is here to help the DEC alpha OSF/1 cpp
|
|
||||||
(which scans for comments but not for strings in
|
|
||||||
code that is #ifdef'ed out...) */
|
|
||||||
goto again;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* MSDOS */
|
|
||||||
#ifdef unix
|
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct direct *ep;
|
struct direct *ep;
|
||||||
if (!getargs(args, "s", &name))
|
if (!getargs(args, "s", &name))
|
||||||
|
@ -394,7 +305,6 @@ again:
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
END_SAVE
|
END_SAVE
|
||||||
#endif /* unix */
|
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +317,6 @@ posix_mkdir(self, args)
|
||||||
return posix_strint(args, mkdir);
|
return posix_strint(args, mkdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MSDOS
|
|
||||||
static object *
|
static object *
|
||||||
posix_nice(self, args)
|
posix_nice(self, args)
|
||||||
object *self;
|
object *self;
|
||||||
|
@ -422,7 +331,6 @@ posix_nice(self, args)
|
||||||
return posix_error();
|
return posix_error();
|
||||||
return newintobject((long) value);
|
return newintobject((long) value);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if i386 && ! _SEQUENT_
|
#if i386 && ! _SEQUENT_
|
||||||
int
|
int
|
||||||
|
@ -478,7 +386,6 @@ posix_system(self, args)
|
||||||
return newintobject(sts);
|
return newintobject(sts);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MSDOS
|
|
||||||
static object *
|
static object *
|
||||||
posix_umask(self, args)
|
posix_umask(self, args)
|
||||||
object *self;
|
object *self;
|
||||||
|
@ -492,7 +399,6 @@ posix_umask(self, args)
|
||||||
return posix_error();
|
return posix_error();
|
||||||
return newintobject((long)i);
|
return newintobject((long)i);
|
||||||
}
|
}
|
||||||
#endif /* !MSDOS */
|
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
posix_unlink(self, args)
|
posix_unlink(self, args)
|
||||||
|
@ -571,8 +477,6 @@ posix_utime(self, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef MSDOS
|
|
||||||
|
|
||||||
/* Process operations */
|
/* Process operations */
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
|
@ -933,8 +837,6 @@ posix_wait(self, args)
|
||||||
return mkvalue("ii", pid, sts);
|
return mkvalue("ii", pid, sts);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MSDOS */
|
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
posix_lstat(self, args)
|
posix_lstat(self, args)
|
||||||
object *self;
|
object *self;
|
||||||
|
@ -1252,7 +1154,6 @@ posix_fdopen(self, args)
|
||||||
return newopenfileobject(fp, "(fdopen)", mode, fclose);
|
return newopenfileobject(fp, "(fdopen)", mode, fclose);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MSDOS
|
|
||||||
static object *
|
static object *
|
||||||
posix_pipe(self, args)
|
posix_pipe(self, args)
|
||||||
object *self;
|
object *self;
|
||||||
|
@ -1269,30 +1170,23 @@ posix_pipe(self, args)
|
||||||
return posix_error();
|
return posix_error();
|
||||||
return mkvalue("(ii)", fds[0], fds[1]);
|
return mkvalue("(ii)", fds[0], fds[1]);
|
||||||
}
|
}
|
||||||
#endif /* MSDOS */
|
|
||||||
|
|
||||||
static struct methodlist posix_methods[] = {
|
static struct methodlist posix_methods[] = {
|
||||||
{"chdir", posix_chdir},
|
{"chdir", posix_chdir},
|
||||||
{"chmod", posix_chmod},
|
{"chmod", posix_chmod},
|
||||||
{"getcwd", posix_getcwd},
|
{"getcwd", posix_getcwd},
|
||||||
#ifndef MSDOS
|
|
||||||
{"link", posix_link},
|
{"link", posix_link},
|
||||||
#endif
|
|
||||||
{"listdir", posix_listdir},
|
{"listdir", posix_listdir},
|
||||||
{"lstat", posix_lstat},
|
{"lstat", posix_lstat},
|
||||||
{"mkdir", posix_mkdir},
|
{"mkdir", posix_mkdir},
|
||||||
#ifndef MSDOS
|
|
||||||
{"nice", posix_nice},
|
{"nice", posix_nice},
|
||||||
#endif
|
|
||||||
{"readlink", posix_readlink},
|
{"readlink", posix_readlink},
|
||||||
{"rename", posix_rename},
|
{"rename", posix_rename},
|
||||||
{"rmdir", posix_rmdir},
|
{"rmdir", posix_rmdir},
|
||||||
{"stat", posix_stat},
|
{"stat", posix_stat},
|
||||||
{"symlink", posix_symlink},
|
{"symlink", posix_symlink},
|
||||||
{"system", posix_system},
|
{"system", posix_system},
|
||||||
#ifndef MSDOS
|
|
||||||
{"umask", posix_umask},
|
{"umask", posix_umask},
|
||||||
#endif
|
|
||||||
#ifndef NO_UNAME
|
#ifndef NO_UNAME
|
||||||
{"uname", posix_uname},
|
{"uname", posix_uname},
|
||||||
#endif
|
#endif
|
||||||
|
@ -1301,8 +1195,6 @@ static struct methodlist posix_methods[] = {
|
||||||
#ifdef DO_TIMES
|
#ifdef DO_TIMES
|
||||||
{"times", posix_times},
|
{"times", posix_times},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MSDOS
|
|
||||||
{"_exit", posix__exit},
|
{"_exit", posix__exit},
|
||||||
{"execv", posix_execv},
|
{"execv", posix_execv},
|
||||||
{"execve", posix_execve},
|
{"execve", posix_execve},
|
||||||
|
@ -1321,15 +1213,12 @@ static struct methodlist posix_methods[] = {
|
||||||
{"setpgrp", posix_setpgrp},
|
{"setpgrp", posix_setpgrp},
|
||||||
{"wait", posix_wait},
|
{"wait", posix_wait},
|
||||||
{"waitpid", posix_waitpid},
|
{"waitpid", posix_waitpid},
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DO_PG
|
#ifdef DO_PG
|
||||||
{"setsid", posix_setsid},
|
{"setsid", posix_setsid},
|
||||||
{"setpgid", posix_setpgid},
|
{"setpgid", posix_setpgid},
|
||||||
{"tcgetpgrp", posix_tcgetpgrp},
|
{"tcgetpgrp", posix_tcgetpgrp},
|
||||||
{"tcsetpgrp", posix_tcsetpgrp},
|
{"tcsetpgrp", posix_tcsetpgrp},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{"open", posix_open},
|
{"open", posix_open},
|
||||||
{"close", posix_close},
|
{"close", posix_close},
|
||||||
{"dup", posix_dup},
|
{"dup", posix_dup},
|
||||||
|
@ -1339,9 +1228,7 @@ static struct methodlist posix_methods[] = {
|
||||||
{"write", posix_write},
|
{"write", posix_write},
|
||||||
{"fstat", posix_fstat},
|
{"fstat", posix_fstat},
|
||||||
{"fdopen", posix_fdopen},
|
{"fdopen", posix_fdopen},
|
||||||
#ifndef MSDOS
|
|
||||||
{"pipe", posix_pipe},
|
{"pipe", posix_pipe},
|
||||||
#endif
|
|
||||||
|
|
||||||
{NULL, NULL} /* Sentinel */
|
{NULL, NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
@ -1380,48 +1267,3 @@ getmtime(path)
|
||||||
else
|
else
|
||||||
return st.st_mtime;
|
return st.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef TURBO_C
|
|
||||||
|
|
||||||
/* A small "compatibility library" for TurboC under MS-DOS */
|
|
||||||
|
|
||||||
//#include <sir.h>
|
|
||||||
#include <io.h>
|
|
||||||
#include <dos.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
chmod(path, mode)
|
|
||||||
char *path;
|
|
||||||
int mode;
|
|
||||||
{
|
|
||||||
return _chmod(path, 1, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
utime(path, times)
|
|
||||||
char *path;
|
|
||||||
time_t times[2];
|
|
||||||
{
|
|
||||||
struct date dt;
|
|
||||||
struct time tm;
|
|
||||||
struct ftime dft;
|
|
||||||
int fh;
|
|
||||||
unixtodos(tv[0].tv_sec,&dt,&tm);
|
|
||||||
dft.ft_tsec = tm.ti_sec; dft.ft_min = tm.ti_min;
|
|
||||||
dft.ft_hour = tm.ti_hour; dft.ft_day = dt.da_day;
|
|
||||||
dft.ft_month = dt.da_mon;
|
|
||||||
dft.ft_year = (dt.da_year - 1980); /* this is for TC library */
|
|
||||||
|
|
||||||
if ((fh = open(path,O_RDWR)) < 0)
|
|
||||||
return posix_error(); /* can't open file to set time */
|
|
||||||
if (setftime(fh,&dft) < 0)
|
|
||||||
{
|
|
||||||
close(fh);
|
|
||||||
return posix_error();
|
|
||||||
}
|
|
||||||
close(fh); /* close the temp handle */
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* TURBO_C */
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct tok_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct tok_state *tok_setups PROTO((char *));
|
extern struct tok_state *tok_setups PROTO((char *));
|
||||||
extern struct tok_state *tok_setupf PROTO((FILE *, char *ps1, char *ps2));
|
extern struct tok_state *tok_setupf PROTO((FILE *, char *, char *));
|
||||||
extern void tok_free PROTO((struct tok_state *));
|
extern void tok_free PROTO((struct tok_state *));
|
||||||
extern int tok_get PROTO((struct tok_state *, char **, char **));
|
extern int tok_get PROTO((struct tok_state *, char **, char **));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue