Mercurial > cpython-lru_cache-weakref
annotate Mac/Modules/cm/cmscan.py @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | bd708fe1934b |
| children | 3740ff2ee053 |
| rev | line source |
|---|---|
| 3282 | 1 # Scan an Apple header file, generating a Python file of generator calls. |
| 2 | |
| 3 import addpack | |
| 4 addpack.addpack(':tools:bgen:bgen') | |
| 5 from scantools import Scanner | |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3282
diff
changeset
|
6 from bgenlocations import TOOLBOXDIR |
| 3282 | 7 |
| 8 LONG = "Components" | |
| 9 SHORT = "Cm" | |
| 10 | |
| 11 def main(): | |
| 12 input = "Components.h" | |
| 13 output = SHORT + "gen.py" | |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3282
diff
changeset
|
14 defsoutput = TOOLBOXDIR + LONG + ".py" |
| 3282 | 15 scanner = MyScanner(input, output, defsoutput) |
| 16 scanner.scan() | |
| 17 scanner.close() | |
| 18 print "=== Done scanning and generating, now importing the generated code... ===" | |
| 19 exec "import " + SHORT + "support" | |
| 20 print "=== Done. It's up to you to compile it now! ===" | |
| 21 | |
| 22 class MyScanner(Scanner): | |
| 23 | |
| 24 def destination(self, type, name, arglist): | |
| 25 classname = "Function" | |
| 26 listname = "functions" | |
| 27 if arglist: | |
| 28 t, n, m = arglist[0] | |
| 29 # | |
| 30 # FindNextComponent is a special case, since it call also be called | |
| 31 # with None as the argument. Hence, we make it a function | |
| 32 # | |
| 33 if t == "Component" and m == "InMode" and name != "FindNextComponent": | |
| 34 classname = "Method" | |
| 35 listname = "c_methods" | |
| 36 elif t == "ComponentInstance" and m == "InMode": | |
| 37 classname = "Method" | |
| 38 listname = "ci_methods" | |
| 39 return classname, listname | |
| 40 | |
| 41 def makeblacklistnames(self): | |
| 42 return [ | |
|
5152
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
43 "OpenADefaultComponent", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
44 "GetComponentTypeModSeed", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
45 "OpenAComponentResFile", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
46 "CallComponentUnregister", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
47 "CallComponentTarget", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
48 "CallComponentRegister", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
49 "CallComponentVersion", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
50 "CallComponentCanDo", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
51 "CallComponentClose", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
52 "CallComponentOpen", |
|
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
53 "OpenAComponent", |
| 3282 | 54 ] |
| 55 | |
| 56 def makeblacklisttypes(self): | |
| 57 return [ | |
| 58 "ResourceSpec", | |
| 59 "ComponentResource", | |
| 60 "ComponentPlatformInfo", | |
| 61 "ComponentResourceExtension", | |
| 62 "ComponentPlatformInfoArray", | |
| 63 "ExtComponentResource", | |
| 64 "ComponentParameters", | |
| 65 | |
| 66 "ComponentRoutineUPP", | |
|
5152
bd708fe1934b
- Changed GestaltEqu.h to Gestalt.h
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
67 "ComponentMPWorkFunctionUPP", |
| 3282 | 68 ] |
| 69 | |
| 70 def makerepairinstructions(self): | |
| 71 return [ | |
| 72 ([('ComponentDescription', 'looking', 'OutMode')], | |
| 73 [('ComponentDescription', '*', 'InMode')]), | |
| 74 ] | |
| 75 | |
| 76 if __name__ == "__main__": | |
| 77 main() |
