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
e7834444
Commit
e7834444
authored
Aug 26, 1994
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Intermediate version of changes after porting to MPW 3.2
parent
f0171a16
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
53 deletions
+132
-53
Mac/Compat/macstat.c
Mac/Compat/macstat.c
+57
-0
Mac/Compat/macstat.h
Mac/Compat/macstat.h
+25
-0
Mac/Modules/macmodule.c
Mac/Modules/macmodule.c
+4
-4
Mac/Python/macmain.c
Mac/Python/macmain.c
+0
-3
Mac/README
Mac/README
+23
-23
Mac/Relnotes-1.2
Mac/Relnotes-1.2
+23
-23
No files found.
Mac/Compat/macstat.c
0 → 100644
View file @
e7834444
/* Minimal 'stat' emulation: tells directories from files and
gives length and mtime.
Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
*/
#include "stat.h"
#include "macdefs.h"
/* Bits in ioFlAttrib: */
#define LOCKBIT (1<<0)
/* File locked */
#define DIRBIT (1<<4)
/* It's a directory */
int
stat
(
path
,
buf
)
char
*
path
;
struct
stat
*
buf
;
{
union
{
DirInfo
d
;
FileParam
f
;
HFileInfo
hf
;
}
pb
;
char
name
[
256
];
short
err
;
pb
.
d
.
ioNamePtr
=
(
unsigned
char
*
)
c2pstr
(
strcpy
(
name
,
path
));
pb
.
d
.
ioVRefNum
=
0
;
pb
.
d
.
ioFDirIndex
=
0
;
pb
.
d
.
ioDrDirID
=
0
;
pb
.
f
.
ioFVersNum
=
0
;
/* Fix found by Timo! See Tech Note 102 */
if
(
hfsrunning
())
err
=
PBGetCatInfo
((
CInfoPBPtr
)
&
pb
,
FALSE
);
else
err
=
PBGetFInfo
((
ParmBlkPtr
)
&
pb
,
FALSE
);
if
(
err
!=
noErr
)
{
errno
=
ENOENT
;
return
-
1
;
}
if
(
pb
.
d
.
ioFlAttrib
&
LOCKBIT
)
buf
->
st_mode
=
0444
;
else
buf
->
st_mode
=
0666
;
if
(
pb
.
d
.
ioFlAttrib
&
DIRBIT
)
{
buf
->
st_mode
|=
0111
|
S_IFDIR
;
buf
->
st_size
=
pb
.
d
.
ioDrNmFls
;
buf
->
st_rsize
=
0
;
}
else
{
buf
->
st_mode
|=
S_IFREG
;
if
(
pb
.
f
.
ioFlFndrInfo
.
fdType
==
'
APPL
'
)
buf
->
st_mode
|=
0111
;
buf
->
st_size
=
pb
.
f
.
ioFlLgLen
;
buf
->
st_rsize
=
pb
.
f
.
ioFlRLgLen
;
}
buf
->
st_mtime
=
pb
.
f
.
ioFlMdDat
-
TIMEDIFF
;
return
0
;
}
Mac/Compat/macstat.h
0 → 100644
View file @
e7834444
/* Include file belonging to stat emulator.
Public domain by Guido van Rossum, CWI, Amsterdam (July 1987). */
struct
stat
{
unsigned
short
st_mode
;
unsigned
long
st_size
;
unsigned
long
st_rsize
;
/* Resource size -- nonstandard */
unsigned
long
st_mtime
;
};
#ifdef UNIX_COMPAT
#define S_IFMT 0170000L
#define S_IFDIR 0040000L
#define S_IFREG 0100000L
#define S_IREAD 0400
#define S_IWRITE 0200
#define S_IEXEC 0100
#else
#define S_IFMT 0xFFFF
#define S_IFDIR 0x0000
#define S_IFREG 0x0003
#define S_IREAD 0400
#define S_IWRITE 0200
#define S_IEXEC 0100
#endif
Mac/Modules/macmodule.c
View file @
e7834444
...
...
@@ -170,6 +170,8 @@ mac_dup(self, args)
return
newintobject
((
long
)
fd
);
}
#endif
/* MPW */
static
object
*
mac_fdopen
(
self
,
args
)
object
*
self
;
...
...
@@ -189,8 +191,6 @@ mac_fdopen(self, args)
return
newopenfileobject
(
fp
,
"(fdopen)"
,
mode
,
fclose
);
}
#endif
/* MPW */
static
object
*
mac_getbootvol
(
self
,
args
)
object
*
self
;
...
...
@@ -369,7 +369,7 @@ mac_stat(self, args)
return
mac_error
();
return
mkvalue
(
"(llllllllll)"
,
(
long
)
st
.
st_mode
,
(
long
)
st
.
st_i
to
,
/* XXX st_ino -- typo in THINK C <stat.h>? */
(
long
)
st
.
st_i
no
,
(
long
)
st
.
st_dev
,
(
long
)
st
.
st_nlink
,
(
long
)
st
.
st_uid
,
...
...
@@ -427,8 +427,8 @@ static struct methodlist mac_methods[] = {
{
"close"
,
mac_close
},
#ifdef MPW
{
"dup"
,
mac_dup
},
{
"fdopen"
,
mac_fdopen
},
#endif
{
"fdopen"
,
mac_fdopen
},
{
"getbootvol"
,
mac_getbootvol
},
/* non-standard */
{
"getcwd"
,
mac_getcwd
},
{
"listdir"
,
mac_listdir
},
...
...
Mac/Python/macmain.c
View file @
e7834444
...
...
@@ -28,9 +28,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "config.h"
#endif
/* Comment this out if you're not interested in STDWIN */
#define USE_STDWIN
#ifdef THINK_C
#define CONSOLE_IO
#endif
...
...
Mac/README
View file @
e7834444
...
...
@@ -5,10 +5,8 @@ Python can be built on the Mac using either THINK C 6.0 or MPW 3.2.
In the past it has been compiled with earlier versions of these
compilers, but no guarantees are made that the source is still
compatible with those versions. Likewise, new compiler versions may
effectively change the language accepted (or the library!) and thus
cause problems.
[[MPW version and procedure must still be checked]]
effectively change the language accepted (or the library provided!)
and thus cause problems.
1. Using Think C 6.0
...
...
@@ -102,21 +100,14 @@ arbitrarily because of the 32000 bytes restriction.
macmodule.c in the Mac subdirectory, so it should already have
been added in a previous step.) Note that for most modules,
the source file is called <name>module.c, but for a few long
module names it is just <module>.c.
module names it is just <module>.c. Don't add stdwinmodule.c
yet,
The following THINK C libraries must be added: from Standard
Libraries, ANSI and unix; from Mac Libraries, MacTraps. I put each
library in a separate segment. Also see my earlier remark on 4-byte
ints.
1.3 Living without STDWIN
-------------------------
Although STDWIN is really neat on the Mac, it's easier to begin
building Python without it, so you can concentrate on the Python
build. To this end, you have to comment out the lines defining the
symbol USE_STDWIN in macmain.c and config.c.
1.4 Adding STDWIN
-----------------
...
...
@@ -127,9 +118,10 @@ the same general source setup (in a sister directory of the toplevel
Python directory). Put all sources in the same segment. To
stdwin.pi, also add Tools/strdup.c and Gen/wtextbreak.c.
The two projects can now be added as libraries to the Python project,
and the two lines commented out to live without STDWIN should be
reinstated.
The two projects can now be added as libraries to the Python project.
You must also add stdwinmodule.c and add "#define USE_STDWIN" to the
Prefix in the compiler options dialog (this only affects macmain.c and
config.c).
Note that stdwinmodule.c contains an #include statement that
references "stdwin.h" by relative path name -- if the stdwin toplevel
...
...
@@ -147,13 +139,21 @@ copies resources into the application file from a file
<projectname>.rsrc.
2. Using MPW
============
See the subdirectory MPW. I haven't tried this recently. You're
supposed to merge the directory tree found here with the UNIX source
tree. I think this is intended for use with MPW 3.2. The dynload
stuff in not recommended.
2. Using MPW 3.2
================
The subdirectory MPW contains a README.MPW file, a buildall script and
several Makefiles (in respective subdirectories), kindly contributed
by Richard Walker of Island Software. Move these files to the
corresponding locations relative to the Python root directory, and run
the buildall script. The README.MPW file contains more instructions
and caveats (I've added some remarks of my own at the end). I haven't
tried building STDWIN with MPW recently (there is MPW specific code
all over the STDWIN source but it is for a much older version of the
compiler and library). The MPW and THINK C ports share all source
files, including config.c and config.h -- all differentiation is done
based on #ifdef THINK_C or #ifdef MPW (#ifdef macintosh is used for
code that should be seen by all Mac compilers).
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
...
...
Mac/Relnotes-1.2
View file @
e7834444
...
...
@@ -5,10 +5,8 @@ Python can be built on the Mac using either THINK C 6.0 or MPW 3.2.
In the past it has been compiled with earlier versions of these
compilers, but no guarantees are made that the source is still
compatible with those versions. Likewise, new compiler versions may
effectively change the language accepted (or the library!) and thus
cause problems.
[[MPW version and procedure must still be checked]]
effectively change the language accepted (or the library provided!)
and thus cause problems.
1. Using Think C 6.0
...
...
@@ -102,21 +100,14 @@ arbitrarily because of the 32000 bytes restriction.
macmodule.c in the Mac subdirectory, so it should already have
been added in a previous step.) Note that for most modules,
the source file is called <name>module.c, but for a few long
module names it is just <module>.c.
module names it is just <module>.c. Don't add stdwinmodule.c
yet,
The following THINK C libraries must be added: from Standard
Libraries, ANSI and unix; from Mac Libraries, MacTraps. I put each
library in a separate segment. Also see my earlier remark on 4-byte
ints.
1.3 Living without STDWIN
-------------------------
Although STDWIN is really neat on the Mac, it's easier to begin
building Python without it, so you can concentrate on the Python
build. To this end, you have to comment out the lines defining the
symbol USE_STDWIN in macmain.c and config.c.
1.4 Adding STDWIN
-----------------
...
...
@@ -127,9 +118,10 @@ the same general source setup (in a sister directory of the toplevel
Python directory). Put all sources in the same segment. To
stdwin.pi, also add Tools/strdup.c and Gen/wtextbreak.c.
The two projects can now be added as libraries to the Python project,
and the two lines commented out to live without STDWIN should be
reinstated.
The two projects can now be added as libraries to the Python project.
You must also add stdwinmodule.c and add "#define USE_STDWIN" to the
Prefix in the compiler options dialog (this only affects macmain.c and
config.c).
Note that stdwinmodule.c contains an #include statement that
references "stdwin.h" by relative path name -- if the stdwin toplevel
...
...
@@ -147,13 +139,21 @@ copies resources into the application file from a file
<projectname>.rsrc.
2. Using MPW
============
See the subdirectory MPW. I haven't tried this recently. You're
supposed to merge the directory tree found here with the UNIX source
tree. I think this is intended for use with MPW 3.2. The dynload
stuff in not recommended.
2. Using MPW 3.2
================
The subdirectory MPW contains a README.MPW file, a buildall script and
several Makefiles (in respective subdirectories), kindly contributed
by Richard Walker of Island Software. Move these files to the
corresponding locations relative to the Python root directory, and run
the buildall script. The README.MPW file contains more instructions
and caveats (I've added some remarks of my own at the end). I haven't
tried building STDWIN with MPW recently (there is MPW specific code
all over the STDWIN source but it is for a much older version of the
compiler and library). The MPW and THINK C ports share all source
files, including config.c and config.h -- all differentiation is done
based on #ifdef THINK_C or #ifdef MPW (#ifdef macintosh is used for
code that should be seen by all Mac compilers).
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
...
...
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