| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
import sys |
| 7 |
from bgenlocations import TOOLBOXDIR, BGENDIR |
| 8 |
sys.path.append(BGENDIR) |
| 9 |
from scantools import Scanner |
| 10 |
|
| 11 |
LONG = "Scrap" |
| 12 |
SHORT = "scrap" |
| 13 |
|
| 14 |
def main(): |
| 15 |
input = "Scrap.h" |
| 16 |
output = SHORT + "gen.py" |
| 17 |
defsoutput = "@Scrap.py" |
| 18 |
scanner = MyScanner(input, output, defsoutput) |
| 19 |
scanner.scan() |
| 20 |
scanner.close() |
| 21 |
|
| 22 |
|
| 23 |
print "=== Done scanning and generating, now importing the generated code... ===" |
| 24 |
exec "import " + SHORT + "support" |
| 25 |
print "=== Done. It's up to you to compile it now! ===" |
| 26 |
|
| 27 |
class MyScanner(Scanner): |
| 28 |
|
| 29 |
def destination(self, type, name, arglist): |
| 30 |
classname = "Function" |
| 31 |
listname = "functions" |
| 32 |
if arglist: |
| 33 |
t, n, m = arglist[0] |
| 34 |
if t == 'ScrapRef' and m == "InMode": |
| 35 |
classname = "Method" |
| 36 |
listname = "methods" |
| 37 |
return classname, listname |
| 38 |
|
| 39 |
def makeblacklistnames(self): |
| 40 |
return [ |
| 41 |
"GetScrapFlavorInfoList", |
| 42 |
'InfoScrap', |
| 43 |
'GetScrap', |
| 44 |
'ZeroScrap', |
| 45 |
'PutScrap', |
| 46 |
] |
| 47 |
|
| 48 |
def makeblacklisttypes(self): |
| 49 |
return [ |
| 50 |
'ScrapPromiseKeeperUPP', |
| 51 |
] |
| 52 |
|
| 53 |
def makerepairinstructions(self): |
| 54 |
return [ |
| 55 |
([('void', '*', 'OutMode')], [('putscrapbuffer', '*', 'InMode')]), |
| 56 |
([('void_ptr', '*', 'InMode')], [('putscrapbuffer', '*', 'InMode')]), |
| 57 |
] |
| 58 |
|
| 59 |
if __name__ == "__main__": |
| 60 |
main() |