Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b8368eeb
Commit
b8368eeb
authored
Mar 02, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RISCOS changes by dschwertberger.
parent
27696cdd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
257 additions
and
107 deletions
+257
-107
Modules/socketmodule.c
Modules/socketmodule.c
+177
-106
Modules/timemodule.c
Modules/timemodule.c
+5
-1
Parser/intrcheck.c
Parser/intrcheck.c
+4
-0
Parser/myreadline.c
Parser/myreadline.c
+13
-0
Python/import.c
Python/import.c
+58
-0
No files found.
Modules/socketmodule.c
View file @
b8368eeb
...
@@ -123,6 +123,21 @@ Socket methods:
...
@@ -123,6 +123,21 @@ Socket methods:
#include <os2.h>
#include <os2.h>
#endif
#endif
#ifdef RISCOS
#define NO_DUP
#undef off_t
#undef uid_t
#undef gid_t
#undef errno
#include <signal.h>
#include "socklib.h"
#include "inetlib.h"
#include "netdb.h"
#include "unixlib.h"
#include "netinet/in.h"
#include "sys/ioctl.h"
#else
/*RISCOS*/
#include <sys/types.h>
#include <sys/types.h>
#include <signal.h>
#include <signal.h>
...
@@ -148,6 +163,9 @@ Socket methods:
...
@@ -148,6 +163,9 @@ Socket methods:
#include <winsock.h>
#include <winsock.h>
#include <fcntl.h>
#include <fcntl.h>
#endif
#endif
#endif
/*RISCOS*/
#ifdef HAVE_SYS_UN_H
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#include <sys/un.h>
#else
#else
...
@@ -218,6 +236,12 @@ static PyObject *SSLErrorObject;
...
@@ -218,6 +236,12 @@ static PyObject *SSLErrorObject;
#endif
/* USE_SSL */
#endif
/* USE_SSL */
#ifdef RISCOS
/* Global variable which is !=0 if Python is running in a RISC OS taskwindow */
static
int
taskwindow
;
#endif
/* Convenience function to raise an error according to errno
/* Convenience function to raise an error according to errno
and return a NULL pointer from a function. */
and return a NULL pointer from a function. */
...
@@ -406,6 +430,9 @@ staticforward PyTypeObject PySocketSock_Type;
...
@@ -406,6 +430,9 @@ staticforward PyTypeObject PySocketSock_Type;
static
PySocketSockObject
*
static
PySocketSockObject
*
PySocketSock_New
(
SOCKET_T
fd
,
int
family
,
int
type
,
int
proto
)
PySocketSock_New
(
SOCKET_T
fd
,
int
family
,
int
type
,
int
proto
)
{
{
#ifdef RISCOS
int
block
=
1
;
#endif
PySocketSockObject
*
s
;
PySocketSockObject
*
s
;
PySocketSock_Type
.
ob_type
=
&
PyType_Type
;
PySocketSock_Type
.
ob_type
=
&
PyType_Type
;
s
=
PyObject_New
(
PySocketSockObject
,
&
PySocketSock_Type
);
s
=
PyObject_New
(
PySocketSockObject
,
&
PySocketSock_Type
);
...
@@ -414,6 +441,11 @@ PySocketSock_New(SOCKET_T fd, int family, int type, int proto)
...
@@ -414,6 +441,11 @@ PySocketSock_New(SOCKET_T fd, int family, int type, int proto)
s
->
sock_family
=
family
;
s
->
sock_family
=
family
;
s
->
sock_type
=
type
;
s
->
sock_type
=
type
;
s
->
sock_proto
=
proto
;
s
->
sock_proto
=
proto
;
#ifdef RISCOS
if
(
taskwindow
)
{
socketioctl
(
s
->
sock_fd
,
0x80046679
,
(
u_long
*
)
&
block
);
}
#endif
}
}
return
s
;
return
s
;
}
}
...
@@ -805,8 +837,10 @@ static PyObject *
...
@@ -805,8 +837,10 @@ static PyObject *
PySocketSock_setblocking
(
PySocketSockObject
*
s
,
PyObject
*
args
)
PySocketSock_setblocking
(
PySocketSockObject
*
s
,
PyObject
*
args
)
{
{
int
block
;
int
block
;
#ifndef RISCOS
#ifndef MS_WINDOWS
#ifndef MS_WINDOWS
int
delay_flag
;
int
delay_flag
;
#endif
#endif
#endif
if
(
!
PyArg_ParseTuple
(
args
,
"i:setblocking"
,
&
block
))
if
(
!
PyArg_ParseTuple
(
args
,
"i:setblocking"
,
&
block
))
return
NULL
;
return
NULL
;
...
@@ -816,6 +850,7 @@ PySocketSock_setblocking(PySocketSockObject *s, PyObject *args)
...
@@ -816,6 +850,7 @@ PySocketSock_setblocking(PySocketSockObject *s, PyObject *args)
setsockopt
(
s
->
sock_fd
,
SOL_SOCKET
,
SO_NONBLOCK
,
setsockopt
(
s
->
sock_fd
,
SOL_SOCKET
,
SO_NONBLOCK
,
(
void
*
)(
&
block
),
sizeof
(
int
)
);
(
void
*
)(
&
block
),
sizeof
(
int
)
);
#else
#else
#ifndef RISCOS
#ifndef MS_WINDOWS
#ifndef MS_WINDOWS
#ifdef PYOS_OS2
#ifdef PYOS_OS2
block
=
!
block
;
block
=
!
block
;
...
@@ -833,6 +868,7 @@ PySocketSock_setblocking(PySocketSockObject *s, PyObject *args)
...
@@ -833,6 +868,7 @@ PySocketSock_setblocking(PySocketSockObject *s, PyObject *args)
ioctlsocket
(
s
->
sock_fd
,
FIONBIO
,
(
u_long
*
)
&
block
);
ioctlsocket
(
s
->
sock_fd
,
FIONBIO
,
(
u_long
*
)
&
block
);
#endif
/* MS_WINDOWS */
#endif
/* MS_WINDOWS */
#endif
/* __BEOS__ */
#endif
/* __BEOS__ */
#endif
/* RISCOS */
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
@@ -846,6 +882,30 @@ Set the socket to blocking (flag is true) or non-blocking (false).\n\
...
@@ -846,6 +882,30 @@ Set the socket to blocking (flag is true) or non-blocking (false).\n\
This uses the FIONBIO ioctl with the O_NDELAY flag."
;
This uses the FIONBIO ioctl with the O_NDELAY flag."
;
#ifdef RISCOS
/* s.sleeptaskw(1 | 0) method */
static
PyObject
*
PySocketSock_sleeptaskw
(
PySocketSockObject
*
s
,
PyObject
*
args
)
{
int
block
;
int
delay_flag
;
if
(
!
PyArg_GetInt
(
args
,
&
block
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
socketioctl
(
s
->
sock_fd
,
0x80046679
,
(
u_long
*
)
&
block
);
Py_END_ALLOW_THREADS
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
char
sleeptaskw_doc
[]
=
"sleeptaskw(flag)
\n
\
\n
\
Allow sleeps in taskwindows."
;
#endif
/* s.setsockopt() method.
/* s.setsockopt() method.
With an integer third argument, sets an integer option.
With an integer third argument, sets an integer option.
With a string third argument, sets an option from a buffer;
With a string third argument, sets an option from a buffer;
...
@@ -1464,6 +1524,10 @@ static PyMethodDef PySocketSock_methods[] = {
...
@@ -1464,6 +1524,10 @@ static PyMethodDef PySocketSock_methods[] = {
setsockopt_doc
},
setsockopt_doc
},
{
"shutdown"
,
(
PyCFunction
)
PySocketSock_shutdown
,
METH_VARARGS
,
{
"shutdown"
,
(
PyCFunction
)
PySocketSock_shutdown
,
METH_VARARGS
,
shutdown_doc
},
shutdown_doc
},
#ifdef RISCOS
{
"sleeptaskw"
,
(
PyCFunction
)
PySocketSock_sleeptaskw
,
METH_VARARGS
,
sleeptaskw_doc
},
#endif
{
NULL
,
NULL
}
/* sentinel */
{
NULL
,
NULL
}
/* sentinel */
};
};
...
@@ -2445,6 +2509,12 @@ DL_EXPORT(void)
...
@@ -2445,6 +2509,12 @@ DL_EXPORT(void)
init_socket
(
void
)
init_socket
(
void
)
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
#ifdef RISCOS
_kernel_swi_regs
r
;
r
.
r
[
0
]
=
0
;
_kernel_swi
(
0x43380
,
&
r
,
&
r
);
taskwindow
=
r
.
r
[
0
];
#else
#ifdef MS_WINDOWS
#ifdef MS_WINDOWS
if
(
!
NTinit
())
if
(
!
NTinit
())
return
;
return
;
...
@@ -2454,6 +2524,7 @@ init_socket(void)
...
@@ -2454,6 +2524,7 @@ init_socket(void)
return
;
return
;
#endif
/* __TOS_OS2__ */
#endif
/* __TOS_OS2__ */
#endif
/* MS_WINDOWS */
#endif
/* MS_WINDOWS */
#endif
/* RISCOS */
#ifdef USE_SSL
#ifdef USE_SSL
SSL_Type
.
ob_type
=
&
PyType_Type
;
SSL_Type
.
ob_type
=
&
PyType_Type
;
#endif
#endif
...
...
Modules/timemodule.c
View file @
b8368eeb
...
@@ -16,7 +16,9 @@
...
@@ -16,7 +16,9 @@
#define GUSI_TO_MSL_EPOCH (4*365*24*60*60)
#define GUSI_TO_MSL_EPOCH (4*365*24*60*60)
#endif
/* USE_GUSI2 */
#endif
/* USE_GUSI2 */
#else
#else
#ifndef RISCOS
#include <sys/types.h>
#include <sys/types.h>
#endif
/* RISCOS */
#endif
#endif
#ifdef QUICKWIN
#ifdef QUICKWIN
...
@@ -38,7 +40,7 @@ extern int ftime(struct timeb *);
...
@@ -38,7 +40,7 @@ extern int ftime(struct timeb *);
#include <i86.h>
#include <i86.h>
#else
#else
#ifdef MS_WINDOWS
#ifdef MS_WINDOWS
#
include <windows.h>
include
<
windows
.
h
>
#ifdef MS_WIN16
#ifdef MS_WIN16
/* These overrides not needed for Win32 */
/* These overrides not needed for Win32 */
#define timezone _timezone
#define timezone _timezone
...
@@ -747,7 +749,9 @@ floatsleep(double secs)
...
@@ -747,7 +749,9 @@ floatsleep(double secs)
#if defined(__WATCOMC__) && !defined(__QNX__)
#if defined(__WATCOMC__) && !defined(__QNX__)
/* XXX Can't interrupt this sleep */
/* XXX Can't interrupt this sleep */
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
#ifndef RISCOS
delay
((
int
)(
secs
*
1000
+
0
.
5
));
/* delay() uses milliseconds */
delay
((
int
)(
secs
*
1000
+
0
.
5
));
/* delay() uses milliseconds */
#endif
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
#else
/* !__WATCOMC__ || __QNX__ */
#else
/* !__WATCOMC__ || __QNX__ */
#ifdef MSDOS
#ifdef MSDOS
...
...
Parser/intrcheck.c
View file @
b8368eeb
...
@@ -137,7 +137,11 @@ intcatcher(int sig)
...
@@ -137,7 +137,11 @@ intcatcher(int sig)
case
0
:
case
0
:
break
;
break
;
case
1
:
case
1
:
#ifdef RISCOS
fprintf
(
stderr
,
message
);
#else
write
(
2
,
message
,
strlen
(
message
));
write
(
2
,
message
,
strlen
(
message
));
#endif
break
;
break
;
case
2
:
case
2
:
interrupted
=
0
;
interrupted
=
0
;
...
...
Parser/myreadline.c
View file @
b8368eeb
...
@@ -13,6 +13,10 @@
...
@@ -13,6 +13,10 @@
int
(
*
PyOS_InputHook
)(
void
)
=
NULL
;
int
(
*
PyOS_InputHook
)(
void
)
=
NULL
;
#ifdef RISCOS
int
Py_RISCOSWimpFlag
;
#endif
/* This function restarts a fgets() after an EINTR error occurred
/* This function restarts a fgets() after an EINTR error occurred
except if PyOS_InterruptOccurred() returns true. */
except if PyOS_InterruptOccurred() returns true. */
...
@@ -58,8 +62,17 @@ PyOS_StdioReadline(char *prompt)
...
@@ -58,8 +62,17 @@ PyOS_StdioReadline(char *prompt)
if
((
p
=
PyMem_MALLOC
(
n
))
==
NULL
)
if
((
p
=
PyMem_MALLOC
(
n
))
==
NULL
)
return
NULL
;
return
NULL
;
fflush
(
stdout
);
fflush
(
stdout
);
#ifndef RISCOS
if
(
prompt
)
if
(
prompt
)
fprintf
(
stderr
,
"%s"
,
prompt
);
fprintf
(
stderr
,
"%s"
,
prompt
);
#else
if
(
prompt
)
{
if
(
Py_RISCOSWimpFlag
)
fprintf
(
stderr
,
"
\x0c
r%s
\x0c
"
,
prompt
);
else
fprintf
(
stderr
,
"%s"
,
prompt
);
}
#endif
fflush
(
stderr
);
fflush
(
stderr
);
switch
(
my_fgets
(
p
,
(
int
)
n
,
stdin
))
{
switch
(
my_fgets
(
p
,
(
int
)
n
,
stdin
))
{
case
0
:
/* Normal case */
case
0
:
/* Normal case */
...
...
Python/import.c
View file @
b8368eeb
...
@@ -60,11 +60,20 @@ struct _inittab *PyImport_Inittab = _PyImport_Inittab;
...
@@ -60,11 +60,20 @@ struct _inittab *PyImport_Inittab = _PyImport_Inittab;
/* these tables define the module suffixes that Python recognizes */
/* these tables define the module suffixes that Python recognizes */
struct
filedescr
*
_PyImport_Filetab
=
NULL
;
struct
filedescr
*
_PyImport_Filetab
=
NULL
;
#ifdef RISCOS
static
const
struct
filedescr
_PyImport_StandardFiletab
[]
=
{
{
"/py"
,
"r"
,
PY_SOURCE
},
{
"/pyc"
,
"rb"
,
PY_COMPILED
},
{
0
,
0
}
};
#else
static
const
struct
filedescr
_PyImport_StandardFiletab
[]
=
{
static
const
struct
filedescr
_PyImport_StandardFiletab
[]
=
{
{
".py"
,
"r"
,
PY_SOURCE
},
{
".py"
,
"r"
,
PY_SOURCE
},
{
".pyc"
,
"rb"
,
PY_COMPILED
},
{
".pyc"
,
"rb"
,
PY_COMPILED
},
{
0
,
0
}
{
0
,
0
}
};
};
#endif
/* Initialize things */
/* Initialize things */
...
@@ -95,8 +104,13 @@ _PyImport_Init(void)
...
@@ -95,8 +104,13 @@ _PyImport_Init(void)
if
(
Py_OptimizeFlag
)
{
if
(
Py_OptimizeFlag
)
{
/* Replace ".pyc" with ".pyo" in _PyImport_Filetab */
/* Replace ".pyc" with ".pyo" in _PyImport_Filetab */
for
(;
filetab
->
suffix
!=
NULL
;
filetab
++
)
{
for
(;
filetab
->
suffix
!=
NULL
;
filetab
++
)
{
#ifndef RISCOS
if
(
strcmp
(
filetab
->
suffix
,
".pyc"
)
==
0
)
if
(
strcmp
(
filetab
->
suffix
,
".pyc"
)
==
0
)
filetab
->
suffix
=
".pyo"
;
filetab
->
suffix
=
".pyo"
;
#else
if
(
strcmp
(
filetab
->
suffix
,
"/pyc"
)
==
0
)
filetab
->
suffix
=
"/pyo"
;
#endif
}
}
}
}
...
@@ -842,7 +856,9 @@ find_module(char *realname, PyObject *path, char *buf, size_t buflen,
...
@@ -842,7 +856,9 @@ find_module(char *realname, PyObject *path, char *buf, size_t buflen,
struct
_frozen
*
f
;
struct
_frozen
*
f
;
struct
filedescr
*
fdp
=
NULL
;
struct
filedescr
*
fdp
=
NULL
;
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
#ifndef RISCOS
struct
stat
statbuf
;
struct
stat
statbuf
;
#endif
static
struct
filedescr
fd_frozen
=
{
""
,
""
,
PY_FROZEN
};
static
struct
filedescr
fd_frozen
=
{
""
,
""
,
PY_FROZEN
};
static
struct
filedescr
fd_builtin
=
{
""
,
""
,
C_BUILTIN
};
static
struct
filedescr
fd_builtin
=
{
""
,
""
,
C_BUILTIN
};
static
struct
filedescr
fd_package
=
{
""
,
""
,
PKG_DIRECTORY
};
static
struct
filedescr
fd_package
=
{
""
,
""
,
PKG_DIRECTORY
};
...
@@ -951,6 +967,15 @@ find_module(char *realname, PyObject *path, char *buf, size_t buflen,
...
@@ -951,6 +967,15 @@ find_module(char *realname, PyObject *path, char *buf, size_t buflen,
}
}
#else
#else
/* XXX How are you going to test for directories? */
/* XXX How are you going to test for directories? */
#ifdef RISCOS
{
static
struct
filedescr
fd
=
{
""
,
""
,
PKG_DIRECTORY
};
if
(
isdir
(
buf
))
{
if
(
find_init_module
(
buf
))
return
&
fd
;
}
}
#endif
#endif
#endif
#ifdef macintosh
#ifdef macintosh
fdp
=
PyMac_FindModuleExtension
(
buf
,
&
len
,
name
);
fdp
=
PyMac_FindModuleExtension
(
buf
,
&
len
,
name
);
...
@@ -1196,6 +1221,39 @@ find_init_module(char *buf)
...
@@ -1196,6 +1221,39 @@ find_init_module(char *buf)
buf
[
save_len
]
=
'\0'
;
buf
[
save_len
]
=
'\0'
;
return
0
;
return
0
;
}
}
#else
#ifdef RISCOS
static
int
find_init_module
(
buf
)
char
*
buf
;
{
int
save_len
=
strlen
(
buf
);
int
i
=
save_len
;
if
(
save_len
+
13
>=
MAXPATHLEN
)
return
0
;
buf
[
i
++
]
=
SEP
;
strcpy
(
buf
+
i
,
"__init__/py"
);
if
(
isfile
(
buf
))
{
buf
[
save_len
]
=
'\0'
;
return
1
;
}
if
(
Py_OptimizeFlag
)
strcpy
(
buf
+
i
,
"o"
);
else
strcpy
(
buf
+
i
,
"c"
);
if
(
isfile
(
buf
))
{
buf
[
save_len
]
=
'\0'
;
return
1
;
}
buf
[
save_len
]
=
'\0'
;
return
0
;
}
#endif
/*RISCOS*/
#endif
/* HAVE_STAT */
#endif
/* HAVE_STAT */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment