OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # | 3 # |
4 # Copyright 2012 the V8 project authors. All rights reserved. | 4 # Copyright 2012 the V8 project authors. All rights reserved. |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 fields.append(parse_field(current)); | 427 fields.append(parse_field(current)); |
428 current = ''; | 428 current = ''; |
429 | 429 |
430 for body in extras_accessors: | 430 for body in extras_accessors: |
431 fields.append(parse_field('ACCESSORS(%s)' % body)); | 431 fields.append(parse_field('ACCESSORS(%s)' % body)); |
432 | 432 |
433 # | 433 # |
434 # Emit a block of constants. | 434 # Emit a block of constants. |
435 # | 435 # |
436 def emit_set(out, consts): | 436 def emit_set(out, consts): |
437 for ii in range(0, len(consts)): | 437 # Fix up overzealous parses. This could be done inside the |
438 out.write('int v8dbg_%s = %s;\n' % | 438 # parsers but as there are several, it's easiest to do it here. |
439 (consts[ii]['name'], consts[ii]['value'])); | 439 ws = re.compile('\s+') |
| 440 for const in consts: |
| 441 name = ws.sub('', const['name']) |
| 442 value = ws.sub('', str(const['value'])) # Can be a number. |
| 443 out.write('int v8dbg_%s = %s;\n' % (name, value)) |
440 out.write('\n'); | 444 out.write('\n'); |
441 | 445 |
442 # | 446 # |
443 # Emit the whole output file. | 447 # Emit the whole output file. |
444 # | 448 # |
445 def emit_config(): | 449 def emit_config(): |
446 out = file(sys.argv[1], 'w'); | 450 out = file(sys.argv[1], 'w'); |
447 | 451 |
448 out.write(header); | 452 out.write(header); |
449 | 453 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 488 |
485 out.write(footer); | 489 out.write(footer); |
486 | 490 |
487 if (len(sys.argv) < 4): | 491 if (len(sys.argv) < 4): |
488 print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]); | 492 print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]); |
489 sys.exit(2); | 493 sys.exit(2); |
490 | 494 |
491 load_objects(); | 495 load_objects(); |
492 load_fields(); | 496 load_fields(); |
493 emit_config(); | 497 emit_config(); |
OLD | NEW |