bgen-generators now drop the python definition file straight in the

Lib:toolbox folder.
This commit is contained in:
Jack Jansen 1996-04-12 16:29:23 +00:00
parent 819fa1a794
commit 46d9e79de6
33 changed files with 114 additions and 29 deletions

View File

@ -40,6 +40,9 @@ extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *PMObj_New(PixMapHandle);
extern int PMObj_Convert(PyObject *, PixMapHandle *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <AppleEvents.h>

View File

@ -1,4 +1,4 @@
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:AppleEvents.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:AppleEvents.h'
f = AEFunction(OSErr, 'AECreateDesc',
(DescType, 'typeCode', InMode),

View File

@ -10,6 +10,7 @@ import string
import regex
import regsub
import MacOS
from bgenlocations import TOOLBOXDIR
from scantools import Scanner
@ -17,7 +18,7 @@ def main():
print "=== Scanning AERegistry.h for defines ==="
input = "AERegistry.h"
output = "@dummy-registry.py"
defsoutput = "AERegistry.py"
defsoutput = TOOLBOXDIR + "AERegistry.py"
scanner = AppleEventsScanner(input, output, defsoutput)
scanner.scan()
scanner.close()
@ -27,14 +28,14 @@ def main():
# once we start writing servers in python.
input = "AEObjects.h"
output = "@dummy-objects.py"
defsoutput = "AEObjects.py"
defsoutput = TOOLBOXDIR + "AEObjects.py"
scanner = AppleEventsScanner(input, output, defsoutput)
scanner.scan()
scanner.close()
print "=== Scanning AppleEvents.py ==="
input = "AppleEvents.h"
output = "aegen.py"
defsoutput = "AppleEvents.py"
defsoutput = TOOLBOXDIR + "AppleEvents.py"
scanner = AppleEventsScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -1,4 +1,4 @@
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Components.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Components.h'
f = Function(Component, 'RegisterComponentResource',
(ComponentResourceHandle, 'tr', InMode),

View File

@ -40,6 +40,9 @@ extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *PMObj_New(PixMapHandle);
extern int PMObj_Convert(PyObject *, PixMapHandle *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <Components.h>

View File

@ -3,6 +3,7 @@
import addpack
addpack.addpack(':tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "Components"
SHORT = "Cm"
@ -10,7 +11,7 @@ SHORT = "Cm"
def main():
input = "Components.h"
output = SHORT + "gen.py"
defsoutput = LONG + ".py"
defsoutput = TOOLBOXDIR + LONG + ".py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -1,4 +1,4 @@
# Generated from 'flap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Dialogs.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Dialogs.h'
f = Function(DialogRef, 'NewDialog',
(NullStorage, 'wStorage', InMode),

View File

@ -4,6 +4,7 @@ import addpack
addpack.addpack(':Tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "Dialogs"
SHORT = "dlg"
@ -12,7 +13,7 @@ OBJECT = "DialogPtr"
def main():
input = LONG + ".h"
output = SHORT + "gen.py"
defsoutput = LONG + ".py"
defsoutput = TOOLBOXDIR + LONG + ".py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -1,4 +1,4 @@
# Generated from 'flap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Events.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Events.h'
f = Function(UInt32, 'GetCaretTime',
)

View File

@ -3,6 +3,7 @@
import addpack
addpack.addpack(':tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "Events"
SHORT = "evt"
@ -11,7 +12,7 @@ OBJECT = "NOTUSED"
def main():
input = LONG + ".h"
output = SHORT + "gen.py"
defsoutput = LONG + ".py"
defsoutput = TOOLBOXDIR + LONG + ".py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -1,4 +1,4 @@
# Generated from 'flap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Fonts.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Fonts.h'
f = Function(void, 'InitFonts',
)

View File

@ -3,6 +3,7 @@
import addpack
addpack.addpack(':tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "Fonts"
SHORT = "Fm"
@ -10,7 +11,7 @@ SHORT = "Fm"
def main():
input = "Fonts.h"
output = SHORT + "gen.py"
defsoutput = LONG + ".py"
defsoutput = TOOLBOXDIR + LONG + ".py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -1,4 +1,4 @@
# Generated from 'flap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Lists.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Lists.h'
f = Function(ListRef, 'LNew',
(Rect_ptr, 'rView', InMode),

View File

@ -3,6 +3,7 @@
import addpack
addpack.addpack(':tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "Lists"
SHORT = "list"
@ -11,7 +12,7 @@ OBJECT = "ListRef"
def main():
input = LONG + ".h"
output = SHORT + "gen.py"
defsoutput = LONG + ".py"
defsoutput = TOOLBOXDIR + LONG + ".py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -1,4 +1,4 @@
# Generated from 'flap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Menus.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Menus.h'
f = Function(short, 'GetMBarHeight',
)

View File

@ -3,11 +3,12 @@ import addpack
addpack.addpack(':Tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
def main():
input = "Menus.h"
output = "menugen.py"
defsoutput = "Menus.py"
defsoutput = TOOLBOXDIR + "Menus.py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -1,4 +1,4 @@
# Generated from 'flap:CodeWarrior:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
f = Function(void, 'SetPort',
(GrafPtr, 'port', InMode),
@ -926,7 +926,7 @@ f = Function(void, 'GetIndPattern',
)
functions.append(f)
# Generated from 'flap:CodeWarrior:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
f = Function(void, 'TextFont',
(short, 'font', InMode),

View File

@ -4,11 +4,12 @@ import addpack
addpack.addpack(':Tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
def main():
input = "QuickDraw.h"
output = "qdgen.py"
defsoutput = "QuickDraw.py"
defsoutput = TOOLBOXDIR + "QuickDraw.py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()
@ -33,7 +34,7 @@ def main():
ifp.close()
ofp.close()
ifp = open("@QuickDrawText.py")
ofp = open("QuickDraw.py", "a")
ofp = open(TOOLBOXDIR + "QuickDraw.py", "a")
ofp.write(ifp.read())
ifp.close()
ofp.close()

View File

@ -40,6 +40,9 @@ extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *PMObj_New(PixMapHandle);
extern int PMObj_Convert(PyObject *, PixMapHandle *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <Movies.h>

View File

@ -1,4 +1,4 @@
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Movies.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Movies.h'
f = Function(OSErr, 'EnterMovies',
)

View File

@ -3,6 +3,7 @@
import addpack
addpack.addpack(':tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "QuickTime"
SHORT = "qt"
@ -11,7 +12,7 @@ OBJECTS = ("Movie", "Track", "Media", "UserData", "TimeBase", "MovieController")
def main():
input = "Movies.h"
output = SHORT + "gen.py"
defsoutput = LONG + ".py"
defsoutput = TOOLBOXDIR + LONG + ".py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -40,6 +40,9 @@ extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *PMObj_New(PixMapHandle);
extern int PMObj_Convert(PyObject *, PixMapHandle *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <Resources.h>

View File

@ -1,4 +1,4 @@
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Resources.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Resources.h'
f = ResFunction(short, 'InitResources',
)

View File

@ -10,13 +10,14 @@ import regsub
import MacOS
import addpack
addpack.addpack(':Tools:bgen:bgen')
from bgenlocations import TOOLBOXDIR
from scantools import Scanner
def main():
input = "Resources.h"
output = "resgen.py"
defsoutput = "Resources.py"
defsoutput = TOOLBOXDIR + "Resources.py"
scanner = ResourcesScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -40,6 +40,9 @@ extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *PMObj_New(PixMapHandle);
extern int PMObj_Convert(PyObject *, PixMapHandle *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <Sound.h>

View File

@ -1,4 +1,4 @@
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Sound.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Sound.h'
f = SndFunction(void, 'SetSoundVol',
(short, 'level', InMode),

View File

@ -4,13 +4,14 @@
import addpack
addpack.addpack(':Tools:bgen:bgen')
from bgenlocations import TOOLBOXDIR
from scantools import Scanner
def main():
input = "Sound.h"
output = "sndgen.py"
defsoutput = "Sound.py"
defsoutput = TOOLBOXDIR + "Sound.py"
scanner = SoundScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -805,6 +805,32 @@ static PyObject *TEObj_getattr(self, name)
TEObject *self;
char *name;
{
if( strcmp(name, "destRect") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect,
(*self->ob_itself)->destRect);
if( strcmp(name, "viewRect") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect,
(*self->ob_itself)->viewRect);
if( strcmp(name, "selRect") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect,
(*self->ob_itself)->selRect);
if( strcmp(name, "lineHeight") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->lineHeight);
if( strcmp(name, "fontAscent") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->fontAscent);
if( strcmp(name, "selPoint") == 0 )
return Py_BuildValue("O&", PyMac_BuildPoint,
(*self->ob_itself)->selPoint);
if( strcmp(name, "selStart") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->selStart);
if( strcmp(name, "selEnd") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->selEnd);
if( strcmp(name, "active") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->active);
if( strcmp(name, "teLength") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->teLength);
return Py_FindMethodInChain(&TEObj_chain, (PyObject *)self, name);
}

View File

@ -3,6 +3,7 @@
import addpack
addpack.addpack(':tools:bgen:bgen')
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
LONG = "TextEdit"
SHORT = "te"
@ -11,7 +12,7 @@ OBJECT = "TEHandle"
def main():
input = LONG + ".h"
output = SHORT + "gen.py"
defsoutput = LONG + ".py"
defsoutput = TOOLBOXDIR + LONG + ".py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()

View File

@ -86,6 +86,34 @@ class MyObjectDefinition(GlobalObjectDefinition):
}""")
def outputFreeIt(self, itselfname):
Output("TEDispose(%s);", itselfname)
def outputGetattrHook(self):
Output("""
if( strcmp(name, "destRect") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect,
(*self->ob_itself)->destRect);
if( strcmp(name, "viewRect") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect,
(*self->ob_itself)->viewRect);
if( strcmp(name, "selRect") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect,
(*self->ob_itself)->selRect);
if( strcmp(name, "lineHeight") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->lineHeight);
if( strcmp(name, "fontAscent") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->fontAscent);
if( strcmp(name, "selPoint") == 0 )
return Py_BuildValue("O&", PyMac_BuildPoint,
(*self->ob_itself)->selPoint);
if( strcmp(name, "selStart") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->selStart);
if( strcmp(name, "selEnd") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->selEnd);
if( strcmp(name, "active") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->active);
if( strcmp(name, "teLength") == 0 )
return Py_BuildValue("h", (*self->ob_itself)->teLength);
""")
# From here on it's basically all boiler plate...

View File

@ -40,6 +40,9 @@ extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *PMObj_New(PixMapHandle);
extern int PMObj_Convert(PyObject *, PixMapHandle *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <Windows.h>

View File

@ -1,4 +1,4 @@
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Windows.h'
# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Windows.h'
f = Function(RgnHandle, 'GetGrayRgn',
)

View File

@ -1,13 +1,14 @@
# Scan an Apple header file, generating a Python file of generator calls.
import addpack
addpack.addpack(':Tools:bgen:bgen')
from bgenlocations import TOOLBOXDIR
from scantools import Scanner
def main():
input = "Windows.h"
output = "wingen.py"
defsoutput = "Windows.py"
defsoutput = TOOLBOXDIR + "Windows.py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()