| OLD | NEW |
| 1 | 1 |
| 2 | 2 |
| 3 import os | 3 import os |
| 4 import sys | 4 import sys |
| 5 | 5 |
| 6 import datatypes | 6 import datatypes |
| 7 from pdfspec_autogen import * | 7 from pdfspec_autogen import * |
| 8 | 8 |
| 9 # TODO(edisonn): date and some other types are in fact strings, with a custom fo
rmat!!! | 9 # TODO(edisonn): date and some other types are in fact strings, with a custom fo
rmat!!! |
| 10 # TODO(edisonn): refer to page 99 (PDF data types) | 10 # TODO(edisonn): refer to page 99 (PDF data types) |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 emitedRet = False | 511 emitedRet = False |
| 512 for field in cls.fFields: | 512 for field in cls.fFields: |
| 513 prop = field.fProp | 513 prop = field.fProp |
| 514 if prop.fHasMust: | 514 if prop.fHasMust: |
| 515 if emitedRet == False: | 515 if emitedRet == False: |
| 516 fileMapperNativeCpp.write(' const SkPdfObject* ret = NULL;\n') | 516 fileMapperNativeCpp.write(' const SkPdfObject* ret = NULL;\n') |
| 517 emitedRet = True | 517 emitedRet = True |
| 518 cntMust = cntMust + 1 | 518 cntMust = cntMust + 1 |
| 519 fileMapperNativeCpp.write(' if (!nativeObj->isDictionary()) return
false;\n') | 519 fileMapperNativeCpp.write(' if (!nativeObj->isDictionary()) return
false;\n') |
| 520 fileMapperNativeCpp.write(' ret = nativeObj->get(\"' + prop.fName +
'\", \"' + prop.fAbr + '\");\n') | 520 fileMapperNativeCpp.write(' ret = nativeObj->get(\"' + prop.fName +
'\", \"' + prop.fAbr + '\");\n') |
| 521 fileMapperNativeCpp.write(' if (ret == NULL) return false;\n') | 521 fileMapperNativeCpp.write(' if (ret == NULL || !' + knowTypes[prop.
fTypes.strip()][3] + ') return false;\n') |
| 522 | 522 |
| 523 eval = ''; | 523 eval = ''; |
| 524 # TODO(edisonn): this could get out of hand, and could have poor per
formance if continued on this path | 524 # TODO(edisonn): this could get out of hand, and could have poor per
formance if continued on this path |
| 525 # but if we would write our parser, then best thing would be to crea
te a map of (key, value) -> to bits | 525 # but if we would write our parser, then best thing would be to crea
te a map of (key, value) -> to bits |
| 526 # and at each (key, value) we do an and with the bits existent, then
we check what bits are left, which would tell the posible types of this diction
ary | 526 # and at each (key, value) we do an and with the bits existent, then
we check what bits are left, which would tell the posible types of this diction
ary |
| 527 # and for non unique posinilities (if any) based on context, or the
requester of dictionry we can determine fast the dictionary type | 527 # and for non unique posinilities (if any) based on context, or the
requester of dictionry we can determine fast the dictionary type |
| 528 mustBe = self.determineAllMustBe(cls, field, enumToCls) | 528 mustBe = self.determineAllMustBe(cls, field, enumToCls) |
| 529 if len(mustBe) > 0: | 529 if len(mustBe) > 0: |
| 530 for cnd in mustBe: | 530 for cnd in mustBe: |
| 531 if eval == '': | 531 if eval == '': |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 fileHeadersNative.write('#endif // __DEFINED__SkPdfHeaders\n') | 623 fileHeadersNative.write('#endif // __DEFINED__SkPdfHeaders\n') |
| 624 | 624 |
| 625 fileHeadersNative.close() | 625 fileHeadersNative.close() |
| 626 fileHeadersNativeCpp.close() | 626 fileHeadersNativeCpp.close() |
| 627 | 627 |
| 628 if '__main__' == __name__: | 628 if '__main__' == __name__: |
| 629 #print sys.argv | 629 #print sys.argv |
| 630 sys.exit(generateCode()) | 630 sys.exit(generateCode()) |
| 631 | 631 |
| OLD | NEW |