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
c6e8f996
Commit
c6e8f996
authored
Feb 23, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patches from Jack for new Apple headers
parent
029d2b27
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
6 deletions
+36
-6
Tools/bgen/bgen/bgenlocations.py
Tools/bgen/bgen/bgenlocations.py
+2
-2
Tools/bgen/bgen/macsupport.py
Tools/bgen/bgen/macsupport.py
+4
-0
Tools/bgen/bgen/scantools.py
Tools/bgen/bgen/scantools.py
+30
-4
No files found.
Tools/bgen/bgen/bgenlocations.py
View file @
c6e8f996
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
#
#
# Where to find the Universal Header include files:
# Where to find the Universal Header include files:
MWERKSDIR
=
"
Moes
:Metrowerks:Metrowerks CodeWarrior:"
MWERKSDIR
=
"
flap
:Metrowerks:Metrowerks CodeWarrior:"
INCLUDEDIR
=
MWERKSDIR
+
"MacOS Support:Headers:Universal Headers:"
INCLUDEDIR
=
MWERKSDIR
+
"MacOS Support:Headers:Universal Headers:"
# Where to put the python definitions file:
# Where to put the python definitions file:
TOOLBOXDIR
=
"
Moes:Development:Jack:Python:Mac:Lib:
toolbox:"
TOOLBOXDIR
=
"
flap:Jack:Python:Mac:Lib:lib-
toolbox:"
# Creator for C files:
# Creator for C files:
CREATOR
=
"CWIE"
CREATOR
=
"CWIE"
Tools/bgen/bgen/macsupport.py
View file @
c6e8f996
...
@@ -15,6 +15,9 @@ SignedByte = Type("SignedByte", "b")
...
@@ -15,6 +15,9 @@ SignedByte = Type("SignedByte", "b")
ScriptCode
=
Type
(
"ScriptCode"
,
"h"
)
ScriptCode
=
Type
(
"ScriptCode"
,
"h"
)
Size
=
Type
(
"Size"
,
"l"
)
Size
=
Type
(
"Size"
,
"l"
)
Style
=
Type
(
"Style"
,
"b"
)
Style
=
Type
(
"Style"
,
"b"
)
StyleParameter
=
Type
(
"Style"
,
"h"
)
CharParameter
=
Type
(
"CharParameter"
,
"h"
)
TextEncoding
=
Type
(
"TextEncoding"
,
"l"
)
UInt8
=
Type
(
"UInt8"
,
"b"
)
UInt8
=
Type
(
"UInt8"
,
"b"
)
SInt8
=
Type
(
"SInt8"
,
"b"
)
SInt8
=
Type
(
"SInt8"
,
"b"
)
...
@@ -75,6 +78,7 @@ class OSErrType(Type):
...
@@ -75,6 +78,7 @@ class OSErrType(Type):
Output
(
"if (%s != noErr) return PyMac_Error(%s);"
,
name
,
name
)
Output
(
"if (%s != noErr) return PyMac_Error(%s);"
,
name
,
name
)
self
.
used
=
1
self
.
used
=
1
OSErr
=
OSErrType
(
"OSErr"
,
'h'
)
OSErr
=
OSErrType
(
"OSErr"
,
'h'
)
OSStatus
=
OSErrType
(
"OSStatus"
,
'l'
)
# Various buffer types
# Various buffer types
...
...
Tools/bgen/bgen/scantools.py
View file @
c6e8f996
...
@@ -93,6 +93,9 @@ if missing: raise "Missing Types"
...
@@ -93,6 +93,9 @@ if missing: raise "Missing Types"
if
not
self
.
silent
:
if
not
self
.
silent
:
print
format
%
args
print
format
%
args
def
writeinitialdefs
(
self
):
pass
def
initblacklists
(
self
):
def
initblacklists
(
self
):
self
.
blacklistnames
=
self
.
makeblacklistnames
()
self
.
blacklistnames
=
self
.
makeblacklistnames
()
self
.
blacklisttypes
=
[
"unknown"
,
"-"
]
+
self
.
makeblacklisttypes
()
self
.
blacklisttypes
=
[
"unknown"
,
"-"
]
+
self
.
makeblacklisttypes
()
...
@@ -219,14 +222,21 @@ if missing: raise "Missing Types"
...
@@ -219,14 +222,21 @@ if missing: raise "Missing Types"
self
.
includepath
=
[
':'
,
INCLUDEDIR
]
self
.
includepath
=
[
':'
,
INCLUDEDIR
]
def
initpatterns
(
self
):
def
initpatterns
(
self
):
self
.
head_pat
=
"^extern pascal[
\
t
]+"
# XXX Mac specific!
# self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific!
self
.
head_pat
=
"^EXTERN_API[^_]"
self
.
tail_pat
=
"[;={}]"
self
.
tail_pat
=
"[;={}]"
self
.
type_pat
=
"pascal[
\
t
\
n
]+
\
(<
t
ype>[a-zA-Z0-9_
\
t
]*[a-zA-Z0-9_]
\
)[
\
t
\
n
]+"
# self.type_pat = "pascal[ \t\n]+\(<type>[a-zA-Z0-9_ \t]*[a-zA-Z0-9_]\)[ \t\n]+"
self
.
type_pat
=
"EXTERN_API"
+
\
"[
\
t
\
n
]*([
\
t
\
n
]*"
+
\
"
\
(<
t
ype>[a-zA-Z0-9_
\
t
]*[a-zA-Z0-9_]
\
)
"
+
\
"
[
\
t
\
n
]
*
)[
\
t
\
n
]
*
"
self.name_pat = "
\
(
<
name
>
[
a
-
zA
-
Z0
-
9
_
]
+
\
)[
\
t
\
n
]
*
"
self.name_pat = "
\
(
<
name
>
[
a
-
zA
-
Z0
-
9
_
]
+
\
)[
\
t
\
n
]
*
"
self.args_pat = "
(
\
(
<
args
>
\
([
^
(;
=
)]
+
\
|
([
^
(;
=
)]
*
)
\
)
*
\
))
"
self.args_pat = "
(
\
(
<
args
>
\
([
^
(;
=
)]
+
\
|
([
^
(;
=
)]
*
)
\
)
*
\
))
"
self.whole_pat = self.type_pat + self.name_pat + self.args_pat
self.whole_pat = self.type_pat + self.name_pat + self.args_pat
# self.sym_pat = "
^
[
\
t
]
*
\
(
<
name
>
[
a
-
zA
-
Z0
-
9
_
]
+
\
)[
\
t
]
*=
" +
\
# "
[
\
t
]
*
\
(
<
defn
>
[
-
0
-
9
'
\
"
][^
\
t
\
n
,;}]*
\
),?
"
self.sym_pat = "^[
\
t
]*
\
(<
n
ame>[a-zA-Z0-9_]+
\
)[
\
t]*=" +
\
self.sym_pat = "^[
\
t
]*
\
(<
n
ame>[a-zA-Z0-9_]+
\
)[
\
t]*=" +
\
"[
\
t
]*
\
(<de
f
n>[-0-9'
\
"
][^
\
t
\
n
,;}]*
\
),?
"
"[
\
t
]*
\
(<de
f
n>[-0-9
_a-zA-Z
'
\
"][^
\
t
\
n
,;}]*
\
),?
"
self.asplit_pat = "
^
\
(
<
type
>
.
*
[
^
a
-
zA
-
Z0
-
9
_
]
\
)
\
(
<
name
>
[
a
-
zA
-
Z0
-
9
_
]
+
\
)
$
"
self.asplit_pat = "
^
\
(
<
type
>
.
*
[
^
a
-
zA
-
Z0
-
9
_
]
\
)
\
(
<
name
>
[
a
-
zA
-
Z0
-
9
_
]
+
\
)
$
"
def compilepatterns(self):
def compilepatterns(self):
...
@@ -356,6 +366,7 @@ if missing: raise "Missing Types"
...
@@ -356,6 +366,7 @@ if missing: raise "Missing Types"
else
:
else
:
self
.
report
(
"defsfile = %s"
,
`self.defsfile.name`
)
self
.
report
(
"defsfile = %s"
,
`self.defsfile.name`
)
self
.
defsfile
.
write
(
"# Generated from %s
\
n
\
n
"
%
`inputname`
)
self
.
defsfile
.
write
(
"# Generated from %s
\
n
\
n
"
%
`inputname`
)
self
.
writeinitialdefs
()
self
.
alreadydone
=
[]
self
.
alreadydone
=
[]
try
:
try
:
while
1
:
while
1
:
...
@@ -373,7 +384,8 @@ if missing: raise "Missing Types"
...
@@ -373,7 +384,8 @@ if missing: raise "Missing Types"
def
dosymdef
(
self
):
def
dosymdef
(
self
):
name
,
defn
=
self
.
sym
.
group
(
'name'
,
'defn'
)
name
,
defn
=
self
.
sym
.
group
(
'name'
,
'defn'
)
self
.
defsfile
.
write
(
"%s = %s
\
n
"
%
(
name
,
defn
))
if
not
name
in
self
.
blacklistnames
:
self
.
defsfile
.
write
(
"%s = %s
\
n
"
%
(
name
,
defn
))
def
dofuncspec
(
self
):
def
dofuncspec
(
self
):
raw
=
self
.
line
raw
=
self
.
line
...
@@ -519,6 +531,20 @@ if missing: raise "Missing Types"
...
@@ -519,6 +531,20 @@ if missing: raise "Missing Types"
return 1
return 1
return 0
return 0
class Scanner_PreUH3(Scanner):
"""Scanner for Universal Headers before release 3"""
def initpatterns(self):
self.head_pat = "
^
extern
pascal
[
\
t
]
+
" # XXX Mac specific!
self.tail_pat = "
[;
=
{}]
"
self.type_pat = "
pascal
[
\
t
\
n
]
+
\
(
<
type
>
[
a
-
zA
-
Z0
-
9
_
\
t
]
*
[
a
-
zA
-
Z0
-
9
_
]
\
)[
\
t
\
n
]
+
"
self.name_pat = "
\
(
<
name
>
[
a
-
zA
-
Z0
-
9
_
]
+
\
)[
\
t
\
n
]
*
"
self.args_pat = "
(
\
(
<
args
>
\
([
^
(;
=
)]
+
\
|
([
^
(;
=
)]
*
)
\
)
*
\
))
"
self.whole_pat = self.type_pat + self.name_pat + self.args_pat
self.sym_pat = "
^
[
\
t
]
*
\
(
<
name
>
[
a
-
zA
-
Z0
-
9
_
]
+
\
)[
\
t
]
*=
" +
\
"
[
\
t
]
*
\
(
<
defn
>
[
-
0
-
9
'
\
"
][^
\
t
\
n
,;}]*
\
),?
"
self.asplit_pat = "^
\
(<
t
ype>.*[^a-zA-Z0-9_]
\
)
\
(<name>[a-zA-Z0-9_]+
\
)$
"
def test():
def test():
input = "D:Development:THINK C:Mac #includes:Apple #includes:AppleEvents.h"
input = "D:Development:THINK C:Mac #includes:Apple #includes:AppleEvents.h"
output = "@aespecs.py"
output = "@aespecs.py"
...
...
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