]> git.saurik.com Git - wxWidgets.git/blame - misc/scripts/update_doc_utils.py
Removing more CodeWarrior project files.
[wxWidgets.git] / misc / scripts / update_doc_utils.py
CommitLineData
eaa78507
VZ
1##############################################################################\r
2# Name: misc/scripts/update_doc_utils.py\r
3# Purpose: base utilities for others update_doc_*.py scripts\r
4# Created: 2007-08-1\r
5# RCS-ID: $Id: makeunixtags.sh 46320 2007-06-04 11:02:29Z VZ $\r
6# Copyright: (c) 2007 Francesco Montorsi\r
7# Licence: wxWindows licence\r
8##############################################################################\r
9\r
10import sys, os, glob, distutils.file_util\r
11\r
12DOCS_PATH="../../docs/latex/wx"\r
13\r
14# Calls the given callback with the name of a documented class, its .tex related file,\r
15# the content of that .tex file and the number of the line of the relative \class tag,\r
16# for all documented class in DOCS_PATH. If the callback returns false the processing is stopped.\r
17# Returns the number of .tex files processed.\r
18def scanTexFiles(callback):\r
19 count = 0\r
20 for f in glob.glob(DOCS_PATH + '/*.tex'):\r
21 file = open(f, "r")\r
22 if not file:\r
23 print "could not open %s" % f\r
24 continue\r
25 print "opened file %s" % f\r
26 count = count + 1\r
27\r
28 # search \class tags\r
29 content = file.readlines()\r
30 classdecl = 0\r
31 for i in range(len(content)):\r
32 line = content[i]\r
33 if "\class{" in line:\r
34 classdecl = classdecl + 1\r
35\r
36 # polish the class name\r
37 classname = line\r
38 classname = classname[classname.find("\class{"):]\r
39 classname = classname[classname.find("{")+1:classname.find("}")]\r
40 print " the class declared is named '%s'" % classname\r
41\r
42 # process this \class\r
43 if not callback(classname, f, content, i):\r
44 return count\r
45\r
46 print " file %s contains %d class declarations" % (f, classdecl)\r
47\r
48 return count\r
49\r