OLD | NEW |
1 #!/usr/local/bin/python | 1 #!/usr/local/bin/python |
2 # coding: utf-8 | 2 # coding: utf-8 |
3 | 3 |
4 import sys | 4 import sys |
5 import re | 5 import re |
6 from sets import Set | |
7 | 6 |
8 # TODO(edisonn): put processed part of file in a new file | 7 # TODO(edisonn): put processed part of file in a new file |
9 # put unprocessed part, in a new file, so we see what we miss | 8 # put unprocessed part, in a new file, so we see what we miss |
10 # keep blank lines, and generate a version without the blank lines | 9 # keep blank lines, and generate a version without the blank lines |
11 | 10 |
12 #TODO (edisonn): deal manually with tables that don't have "KEY TYPE VALUE' head
er, e.g. | 11 #TODO (edisonn): deal manually with tables that don't have "KEY TYPE VALUE' head
er, e.g. |
13 # TABLE 7.11 Restrictions on the entries in a soft-mask image dictionary | 12 # TABLE 7.11 Restrictions on the entries in a soft-mask image dictionary |
14 #KEY RESTRICTION | 13 #KEY RESTRICTION |
15 | 14 |
16 | 15 |
17 | 16 |
18 lines = 0 | 17 lines = 0 |
19 table = '' | 18 table = '' |
20 tableHeaderFound = False | 19 tableHeaderFound = False |
21 tableLine = 0 | 20 tableLine = 0 |
22 tableRow = 0 | 21 tableRow = 0 |
23 columnWidth = [] | 22 columnWidth = [] |
24 columnValues = None | 23 columnValues = None |
25 mustFollowTableHeader = False | 24 mustFollowTableHeader = False |
26 emitedDitionaryName = '' | 25 emitedDitionaryName = '' |
27 | 26 |
28 knownTypes = Set([ | 27 knownTypes = set([ |
29 '(any)', | 28 '(any)', |
30 unicode('undefined', 'utf8'), | 29 unicode('undefined', 'utf8'), |
31 '(undefined)', | 30 '(undefined)', |
32 '(various)', | 31 '(various)', |
33 'array', | 32 'array', |
34 'or', | 33 'or', |
35 'boolean', | 34 'boolean', |
36 'date', | 35 'date', |
37 'dictionary', | 36 'dictionary', |
38 'function', | 37 'function', |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 #TODO(edisonn): build this map | 630 #TODO(edisonn): build this map |
632 | 631 |
633 fspecPy.write(' knowTypes[\'' + tableToClassName[e][0] + '\'] = [\'SkPdf' +
tableToClassName[e][0] + '*\', \'(SkPdf' + tableToClassName[e][0] + '*)ret\', d
atatypes.CppNull(), \'ret->isDictionary() && ((SkPdf' + tableToClassName[e][0] +
'*)ret)->valid()\', \'A_DICTIONARY\']\n') | 632 fspecPy.write(' knowTypes[\'' + tableToClassName[e][0] + '\'] = [\'SkPdf' +
tableToClassName[e][0] + '*\', \'(SkPdf' + tableToClassName[e][0] + '*)ret\', d
atatypes.CppNull(), \'ret->isDictionary() && ((SkPdf' + tableToClassName[e][0] +
'*)ret)->valid()\', \'A_DICTIONARY\']\n') |
634 fspecPy.write('\n') | 633 fspecPy.write('\n') |
635 | 634 |
636 #print lines | 635 #print lines |
637 #fnewspec.close() | 636 #fnewspec.close() |
638 | 637 |
639 if '__main__' == __name__: | 638 if '__main__' == __name__: |
640 sys.exit(generateDef()) | 639 sys.exit(generateDef()) |
OLD | NEW |