Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 557f446

Browse files
committed
Patches from Jack for new Apple headers
1 parent a705da7 commit 557f446

3 files changed

Lines changed: 36 additions & 6 deletions

File tree

Tools/bgen/bgen/bgenlocations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#
44

55
# Where to find the Universal Header include files:
6-
MWERKSDIR="Moes:Metrowerks:Metrowerks CodeWarrior:"
6+
MWERKSDIR="flap:Metrowerks:Metrowerks CodeWarrior:"
77
INCLUDEDIR=MWERKSDIR + "MacOS Support:Headers:Universal Headers:"
88

99
# Where to put the python definitions file:
10-
TOOLBOXDIR="Moes:Development:Jack:Python:Mac:Lib:toolbox:"
10+
TOOLBOXDIR="flap:Jack:Python:Mac:Lib:lib-toolbox:"
1111

1212
# Creator for C files:
1313
CREATOR="CWIE"

Tools/bgen/bgen/macsupport.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
ScriptCode = Type("ScriptCode", "h")
1616
Size = Type("Size", "l")
1717
Style = Type("Style", "b")
18+
StyleParameter = Type("Style", "h")
19+
CharParameter = Type("CharParameter", "h")
20+
TextEncoding = Type("TextEncoding", "l")
1821

1922
UInt8 = Type("UInt8", "b")
2023
SInt8 = Type("SInt8", "b")
@@ -75,6 +78,7 @@ def errorCheck(self, name):
7578
Output("if (%s != noErr) return PyMac_Error(%s);", name, name)
7679
self.used = 1
7780
OSErr = OSErrType("OSErr", 'h')
81+
OSStatus = OSErrType("OSStatus", 'l')
7882

7983

8084
# Various buffer types

Tools/bgen/bgen/scantools.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ def report(self, format, *args):
9393
if not self.silent:
9494
print format%args
9595

96+
def writeinitialdefs(self):
97+
pass
98+
9699
def initblacklists(self):
97100
self.blacklistnames = self.makeblacklistnames()
98101
self.blacklisttypes = ["unknown", "-"] + self.makeblacklisttypes()
@@ -219,14 +222,21 @@ def initpaths(self):
219222
self.includepath = [':', INCLUDEDIR]
220223

221224
def initpatterns(self):
222-
self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific!
225+
# self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific!
226+
self.head_pat = "^EXTERN_API[^_]"
223227
self.tail_pat = "[;={}]"
224-
self.type_pat = "pascal[ \t\n]+\(<type>[a-zA-Z0-9_ \t]*[a-zA-Z0-9_]\)[ \t\n]+"
228+
# self.type_pat = "pascal[ \t\n]+\(<type>[a-zA-Z0-9_ \t]*[a-zA-Z0-9_]\)[ \t\n]+"
229+
self.type_pat = "EXTERN_API" + \
230+
"[ \t\n]*([ \t\n]*" + \
231+
"\(<type>[a-zA-Z0-9_ \t]*[a-zA-Z0-9_]\)" + \
232+
"[ \t\n]*)[ \t\n]*"
225233
self.name_pat = "\(<name>[a-zA-Z0-9_]+\)[ \t\n]*"
226234
self.args_pat = "(\(<args>\([^(;=)]+\|([^(;=)]*)\)*\))"
227235
self.whole_pat = self.type_pat + self.name_pat + self.args_pat
236+
# self.sym_pat = "^[ \t]*\(<name>[a-zA-Z0-9_]+\)[ \t]*=" + \
237+
# "[ \t]*\(<defn>[-0-9'\"][^\t\n,;}]*\),?"
228238
self.sym_pat = "^[ \t]*\(<name>[a-zA-Z0-9_]+\)[ \t]*=" + \
229-
"[ \t]*\(<defn>[-0-9'\"][^\t\n,;}]*\),?"
239+
"[ \t]*\(<defn>[-0-9_a-zA-Z'\"][^\t\n,;}]*\),?"
230240
self.asplit_pat = "^\(<type>.*[^a-zA-Z0-9_]\)\(<name>[a-zA-Z0-9_]+\)$"
231241

232242
def compilepatterns(self):
@@ -356,6 +366,7 @@ def scan(self):
356366
else:
357367
self.report("defsfile = %s", `self.defsfile.name`)
358368
self.defsfile.write("# Generated from %s\n\n" % `inputname`)
369+
self.writeinitialdefs()
359370
self.alreadydone = []
360371
try:
361372
while 1:
@@ -373,7 +384,8 @@ def scan(self):
373384

374385
def dosymdef(self):
375386
name, defn = self.sym.group('name', 'defn')
376-
self.defsfile.write("%s = %s\n" % (name, defn))
387+
if not name in self.blacklistnames:
388+
self.defsfile.write("%s = %s\n" % (name, defn))
377389

378390
def dofuncspec(self):
379391
raw = self.line
@@ -519,6 +531,20 @@ def unmanageable(self, type, name, arglist):
519531
return 1
520532
return 0
521533

534+
class Scanner_PreUH3(Scanner):
535+
"""Scanner for Universal Headers before release 3"""
536+
def initpatterns(self):
537+
self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific!
538+
self.tail_pat = "[;={}]"
539+
self.type_pat = "pascal[ \t\n]+\(<type>[a-zA-Z0-9_ \t]*[a-zA-Z0-9_]\)[ \t\n]+"
540+
self.name_pat = "\(<name>[a-zA-Z0-9_]+\)[ \t\n]*"
541+
self.args_pat = "(\(<args>\([^(;=)]+\|([^(;=)]*)\)*\))"
542+
self.whole_pat = self.type_pat + self.name_pat + self.args_pat
543+
self.sym_pat = "^[ \t]*\(<name>[a-zA-Z0-9_]+\)[ \t]*=" + \
544+
"[ \t]*\(<defn>[-0-9'\"][^\t\n,;}]*\),?"
545+
self.asplit_pat = "^\(<type>.*[^a-zA-Z0-9_]\)\(<name>[a-zA-Z0-9_]+\)$"
546+
547+
522548
def test():
523549
input = "D:Development:THINK C:Mac #includes:Apple #includes:AppleEvents.h"
524550
output = "@aespecs.py"

0 commit comments

Comments
 (0)