@@ -22,6 +22,7 @@ ctl Controls
2222dlg Dialogs
2323evt Events
2424menu Menus
25+ list Lists
2526qd QuickDraw
2627res Resources
2728snd Sound
@@ -64,6 +65,12 @@ aetools.py Conversions between AE and Python data type
6465echo.py Dummy AE server, echoes all data back
6566tell.py Primitive AE client
6667aete.py Decode 'aete' and 'aeut' resources (incomplete)
68+ gensuitemodule.py
69+ Read aete/aeut resources and turn them into python
70+ modules. The *_Suite.py modules have been generated
71+ with this.
72+ AEservertest.py A simple AE server, similar to echo but different.
73+
6774
6875In res:
6976
@@ -77,3 +84,72 @@ playaiff.py Play an AIFF file
7784morse.py Turn text into Morse code
7885audiodev.py The standard audiodev.py extended with Mac support
7986Audio_mac.py The Mac support for audiodev.py
87+
88+
89+ Creating new Macintosh interfaces
90+ ---------------------------------
91+
92+ These instructions were written up by Jack while he was building the
93+ interface to Lists.h, the macintosh list manager. they may or may not
94+ have a more global scope than exactly that.
95+
96+ First, start by copying ...scan.py and ...support.py from another,
97+ preferrably similar type. I started with evt, but that was a mistake
98+ since evt has no "own" object. Ctl or Dlg would probably have been a
99+ better idea.
100+
101+ Now, the first thing to do is to comment out the blacklisted types and
102+ functions and the transformation rules for arguments, we'll fill those
103+ in lateron. Also, change the various definitions at the top, so that
104+ the right include file is parsed, and the .py files are generated with
105+ the correct name. If your manager has a type that will be implemented
106+ as a python object you may as well now change the destination() method
107+ to recognize that. (List was funny in this respect, since it has the
108+ list as the last argument in stead of the first).
109+
110+ Now run your scanner. This will probably go fine until it tries to
111+ execute the generated code in the ...gen.py module. Look at that file,
112+ it will have formalized "definitions" of all the functions and methods
113+ that will be generated. Look at them all (with the documentation of the
114+ manager you're implementing in hand). Now you'll have to fix the
115+ blacklists and the repair instructions. This is sort of a black art,
116+ but a few guidelines may be handy here:
117+ - If there are argument types you cannot implement (or want to leave for
118+ the moment) put them in blacklisttypes. Complex structures come to
119+ mind, or routine pointers/UPP's. You will probably also want to
120+ blacklist the routine that disposes of your object (since you'll do
121+ that in the python destruction routine).
122+ - Various types of buffers are available in bgenBuffer, bgenHeapBuffer
123+ and macsupport in the bgen directory. These'll let you handle all
124+ sorts of input and output parameters. You can put instructions in the
125+ repair list to let the C-arguments be handled by the correct type
126+ of buffer. Check the other bgen-generated modules for using this for
127+ passing raw structures and input and output buffers.
128+ - It appears that the parser usually guesses correctly whether a parameter
129+ is meant for input or output. But, check the routines to be sure.
130+ - Some types are pretty hard to handle but you need the functionality
131+ the a routine that uses them anyway. Various routines expecting ProcPtrs
132+ or RegionHandles come to mind. Often, you can use the FakeType class
133+ to provide a sensible default (i.e. NULL or a pointer to a routine you
134+ coded in C, or a region specifying "the whole window"). This way, python
135+ programmers won't get the full functionality but at least they'll get the
136+ common case. You put the FakeType stuff in ...support.py.
137+
138+ Next you'll probably have to write the code to implement your object.
139+ This will probably be a subclass of GlobalObjectDefinition. This goes
140+ into ...support.py. Also, some types used by the manager may look
141+ enough like standard types that you can equate them here (there are a
142+ lot of 2-integer structures that look remarkably like a Point, for
143+ instance).
144+
145+ You'll also have to define the Function() and Method() classes. The
146+ OSErrFunctionGenerator and its method-counterpart are particularly
147+ handy for a lot of mac managers.
148+
149+ Finally, you'll have to try and compile your resulting C-source, and go
150+ through the steps above until it works. For tlist.py, the test program
151+ for list, I started with the application framework. This is probably a
152+ good idea for any manager that does something to the display, since
153+ ApplicationFramework takes care of all the intricacies of event
154+ handling and decoding (up to a point).
155+
0 commit comments