From 1ae67a2e0c9d41831abaad6fb8e9d062c265b62c Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 2 Feb 2001 05:24:11 +0000 Subject: [PATCH] improved docmaker slightly (better indexing, support for "" marker in section blocks, see "fttypes.h") --- ChangeLog | 6 +++ docs/docmaker.py | 93 ++++++++++++++++++++++++++++++++++++-- include/freetype/fttypes.h | 17 +++++++ 3 files changed, 112 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6df5fa023..145fda324 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-02-01 David Turner + + * docs/docmaker.py: improved the index sorting routine to place capital + letters before small ones. added the "" marker to section blocks + in order to give the order of blocks + 2001-01-24 Tom Kacvinsky * src/cff/t1load.c (parse_font_matrix): Added heuristic to get diff --git a/docs/docmaker.py b/docs/docmaker.py index ac1c2d7b5..f02bdc0b9 100644 --- a/docs/docmaker.py +++ b/docs/docmaker.py @@ -42,8 +42,8 @@ code_footer = "" para_header = "

" para_footer = "

" -block_header = "

" -block_footer = "
" +block_header = "
" +block_footer = "

" description_header = "
" description_footer = "

" @@ -59,6 +59,41 @@ source_footer = "
" current_section = None +# this function is used to sort the index. it's a simple lexicographical +# sort, except that it places capital letters before small ones +# +def index_sort( s1, s2 ): + + if not s1: + return -1 + + if not s2: + return 1 + + l1 = len(s1) + l2 = len(s2) + m1 = string.lower(s1) + m2 = string.lower(s2) + + for i in range(l1): + if i >= l2 or m1[i] > m2[i]: + return 1 + + if m1[i] < m2[i]: + return -1 + + if s1[i] < s2[i]: + return -1 + + if s1[i] > s2[i]: + return 1 + + if l2 > l1: + return -1 + + return 0 + + # The FreeType 2 reference is extracted from the source files. These contain # various comment blocks that follow one of the following formats: # @@ -239,6 +274,10 @@ class DocParagraph: return "UNKNOWN_PARA_IDENTIFIER!" + def get_words( self ): + return self.words[:] + + def dump( self, identifiers = None ): max_width = 50 cursor = 0 @@ -882,6 +921,50 @@ class DocSectionList: else: section.title = "UNKNOWN_SECTION_TITLE!" + # sort section elements according to the marker when + # available + for section in self.sections.values(): + order = section.block.find_content( "order" ) + if order: + #sys.stderr.write( " found at "+section.block.location()+'\n' ) + order_list = [] + for item in order.items: + for element in item[1]: + words = None + try: + words = element.get_words() + except: + sys.stderr.write( "WARNING:" + + section.block.location() + + ": invalid content in marker\n" ) + if words: + for word in words: + block = self.identifiers.get( word ) + if block: + if block.section == section: + order_list.append( word ) + else: + sys.stderr.write( "WARNING:" + + section.block.location() + + ": invalid reference to '"+word+"' defined in other section\n" ) + else: + sys.stderr.write( "WARNING:" + + section.block.location() + + ": invalid reference to '"+word+"'\n" ) + + # now sort the list of blocks according to the order list + # + new_list = [] + old_list = section.list + for id in order_list: + new_list.append( section.elements[id] ) + + for block in old_list: + if not block.name in order_list: + new_list.append( block ) + + section.list = new_list + # compute section filenames # for section in self.sections.values(): @@ -893,7 +976,7 @@ class DocSectionList: # compute the sorted list of identifiers for the index # self.index = self.identifiers.keys() - self.index.sort() + self.index.sort( index_sort ) def dump_html_toc( self ): @@ -972,6 +1055,8 @@ class DocSectionList: sys.stdout = old_stdout + + # Filter a given list of DocBlocks. Returns a new list # of DocBlock objects that only contains element whose # "type" (i.e. first marker) is in the "types" parameter. @@ -1046,7 +1131,7 @@ def make_block_list(): """parse a file and extract comments blocks from it""" file_list = [] - sys.stderr.write( repr( sys.argv[1:] ) + '\n' ) + #sys.stderr.write( repr( sys.argv[1:] ) + '\n' ) for pathname in sys.argv[1:]: if string.find( pathname, '*' ) >= 0: diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h index a31c00f2b..9dbf3382e 100644 --- a/include/freetype/fttypes.h +++ b/include/freetype/fttypes.h @@ -45,6 +45,23 @@ FT_BEGIN_HEADER /* This section contains the basic data types defined by FreeType 2, */ /* ranging from simple scalar types to font specific ones. */ /* */ + /* */ + /* FT_Byte FT_Char FT_Int FT_UInt FT_Short FT_UShort FT_Long */ + /* FT_ULong FT_Fixed FT_Pointer FT_Vector FT_Matrix FT_BBox */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* */ /*************************************************************************/