| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 """ genpyx.py - parse c declarations | 2 """ genpyx.py - parse c declarations |
| 3 | 3 |
| 4 (c) 2002, 2003, 2004, 2005 Simon Burton <simon@arrowtheory.com> | 4 (c) 2002, 2003, 2004, 2005 Simon Burton <simon@arrowtheory.com> |
| 5 Released under GNU LGPL license. | 5 Released under GNU LGPL license. |
| 6 | 6 |
| 7 version 0.xx | 7 version 0.xx |
| 8 | 8 |
| 9 This is a module of mixin classes for ir.py . | 9 This is a module of mixin classes for ir.py . |
| 10 | 10 |
| 11 Towards the end of ir.py our global class definitions | 11 Towards the end of ir.py our global class definitions |
| 12 are remapped to point to the class definitions in ir.py . | 12 are remapped to point to the class definitions in ir.py . |
| 13 So, for example, when we refer to Node we get ir.Node . | 13 So, for example, when we refer to Node we get ir.Node . |
| 14 | 14 |
| 15 """ | 15 """ |
| 16 | 16 |
| 17 import sys | 17 import sys |
| 18 from datetime import datetime | 18 from datetime import datetime |
| 19 from sets import Set | |
| 20 | 19 |
| 21 # XX use this Context class instead of all those kw dicts !! XX | 20 # XX use this Context class instead of all those kw dicts !! XX |
| 22 class Context(object): | 21 class Context(object): |
| 23 " just a record (struct) " | 22 " just a record (struct) " |
| 24 def __init__( self, **kw ): | 23 def __init__( self, **kw ): |
| 25 for key, value in kw.items(): | 24 for key, value in kw.items(): |
| 26 setattr( self, key, value ) | 25 setattr( self, key, value ) |
| 27 def __getattr__( self, name ): | 26 def __getattr__( self, name ): |
| 28 return None # ? | 27 return None # ? |
| 29 def __getitem__( self, name ): | 28 def __getitem__( self, name ): |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 return ostream.join() | 521 return ostream.join() |
| 523 | 522 |
| 524 # XX warn when we find a python keyword XX | 523 # XX warn when we find a python keyword XX |
| 525 python_kws = """ | 524 python_kws = """ |
| 526 break continue del def except exec finally pass print raise | 525 break continue del def except exec finally pass print raise |
| 527 return try global assert lambda yield | 526 return try global assert lambda yield |
| 528 for while if elif else and in is not or import from """.split() | 527 for while if elif else and in is not or import from """.split() |
| 529 python_kws = dict( zip( python_kws, (None,)*len(python_kws) ) ) | 528 python_kws = dict( zip( python_kws, (None,)*len(python_kws) ) ) |
| 530 | 529 |
| 531 | 530 |
| OLD | NEW |