Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2054)

Unified Diff: experimental/PdfViewer/spec2def.py

Issue 17286007: few steps in the direction of to encapsulating podofo, so the client is not aware podofo is used. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/PdfViewer/pdfspec_autogen.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/spec2def.py
===================================================================
--- experimental/PdfViewer/spec2def.py (revision 9625)
+++ experimental/PdfViewer/spec2def.py (working copy)
@@ -80,6 +80,7 @@
'TABLE 3.33': ['EmbeddedFileStreamDictionary', 'Additional entries in an embedded file stream dictionary'],
'TABLE 3.34': ['EmbeddedFileParameterDictionary', 'Entries in an embedded file parameter dictionary'],
'TABLE 3.35': ['MacOsFileInformationDictionary', 'Entries in a Mac OS file information dictionary'],
+'TABLE 4.8': ['GraphicsStateDictionary', 'Entries in a graphics state parameter dictionary'],
'TABLE 4.13': ['CalgrayColorSpaceDictionary', 'Entries in a CalGray color space dictionary'],
'TABLE 4.14': ['CalrgbColorSpaceDictionary', 'Entries in a CalRGB color space dictionary'],
'TABLE 4.15': ['LabColorSpaceDictionary', 'Entries in a Lab color space dictionary'],
@@ -417,8 +418,10 @@
global knownTypes
global columnWidth
- words = line.split()
+ line2 = line.replace(',', ' , ')
+ words = line2.split()
+
if len(words) < 3:
return False
@@ -457,7 +460,7 @@
def killTable():
return
-def processLine(line):
+def processLineCore(line):
global lines
global tableLine
global tableRow
@@ -465,6 +468,8 @@
global columnValues
global mustFollowTableHeader
+ global fnewspec
+
lines = lines + 1
line = unicode(line, 'utf8')
@@ -474,31 +479,32 @@
words = line.split()
if len(words) == 0:
stopTable()
- return
+ return False
isTableHeader = re.search('^[\s]*(TABLE [0-9].[0-9][0-9]?)', striped)
if isTableHeader:
stopTable()
tableDescriptionFound(striped)
mustFollowTableHeader = True
- return
+ return False
if mustFollowTableHeader:
mustFollowTableHeader = False
if len(words) != 3:
killTable()
+ return False
# TODO(edisonn): support for generic table!
if words[0] != 'KEY' or words[1] != 'TYPE' or words[2] != 'VALUE':
killTable()
- return
+ return False
tableHasHeader()
columnWidth = [0, 0, 0]
columnWidth[0] = striped.index('TYPE')
columnWidth[1] = striped.index('VALUE') - striped.index('TYPE')
columnWidth[2] = 0
- return
+ return True
if inTable():
tableLine = tableLine + 1
@@ -506,16 +512,13 @@
second = striped[columnWidth[0] : columnWidth[0] + columnWidth[1]]
third = striped[columnWidth[0] + columnWidth[1] :]
-
-
-
if tableLine == 1:
if third[0] != '(':
killTable()
- return
+ return False
newRow(first, second, third)
- return
+ return True
if rebaseTable(striped):
first = striped[0 : columnWidth[0]]
@@ -528,44 +531,66 @@
if first == '' and second == '' and third != '':
appendRow(second, third)
- return
+ return True
if len(first.split()) > 1:
stopTable()
- return
+ return False
if first != '' and first[0] == ' ':
stopTable()
- return
+ return False
if first != '' and second != '' and third == '':
stopTable()
- return
+ return False
if first == '' and second != '' and second[0] != ' ':
if acceptType(second):
appendRow(second, third)
+ return True
else:
stopTable()
- return
+ return False
if first != '' and second != '' and third[0] != '(':
stopTable()
- return
+ return False
if first == '' and second != '' and second[0] == ' ':
stopTable()
- return
+ return False
if first != '' and second != '' and third[0] == '(':
commitRow()
newRow(first, second, third)
- return
+ return True
+
+ return False
+ return False
+def processLine(line):
+ global fnewspec
+
+ inSpec = processLineCore(line)
+
+ #just return, use the next lines if you wish to rewrite spec
+ return
+
+ if inSpec:
+ #resize colum with types
+ line = line[:columnWidth[0] + columnWidth[1]] + (' ' * (60 - columnWidth[1])) + line[columnWidth[0] + columnWidth[1]:]
+ line = line[:columnWidth[0]] + (' ' * (40 - columnWidth[0])) + line[columnWidth[0]:]
+
+ fnewspec.write(line)
+
def generateDef():
global lines
+ global fnewspec
+ #fnewspec = open('PdfReference-okular-2.txt', 'w')
+
print 'import datatypes'
print
@@ -580,6 +605,7 @@
print
#print lines
+ #fnewspec.close()
if '__main__' == __name__:
sys.exit(generateDef())
« no previous file with comments | « experimental/PdfViewer/pdfspec_autogen.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698