1*7f2fe78bSCy Schubert''' 2*7f2fe78bSCy Schubert Copyright 2011 by the Massachusetts 3*7f2fe78bSCy Schubert Institute of Technology. All Rights Reserved. 4*7f2fe78bSCy Schubert 5*7f2fe78bSCy Schubert Export of this software from the United States of America may 6*7f2fe78bSCy Schubert require a specific license from the United States Government. 7*7f2fe78bSCy Schubert It is the responsibility of any person or organization contemplating 8*7f2fe78bSCy Schubert export to obtain such a license before exporting. 9*7f2fe78bSCy Schubert 10*7f2fe78bSCy Schubert WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 11*7f2fe78bSCy Schubert distribute this software and its documentation for any purpose and 12*7f2fe78bSCy Schubert without fee is hereby granted, provided that the above copyright 13*7f2fe78bSCy Schubert notice appear in all copies and that both that copyright notice and 14*7f2fe78bSCy Schubert this permission notice appear in supporting documentation, and that 15*7f2fe78bSCy Schubert the name of M.I.T. not be used in advertising or publicity pertaining 16*7f2fe78bSCy Schubert to distribution of the software without specific, written prior 17*7f2fe78bSCy Schubert permission. Furthermore if you modify this software you must label 18*7f2fe78bSCy Schubert your software as modified software and not distribute it in such a 19*7f2fe78bSCy Schubert fashion that it might be confused with the original M.I.T. software. 20*7f2fe78bSCy Schubert M.I.T. makes no representations about the suitability of 21*7f2fe78bSCy Schubert this software for any purpose. It is provided "as is" without express 22*7f2fe78bSCy Schubert or implied warranty. 23*7f2fe78bSCy Schubert''' 24*7f2fe78bSCy Schubertimport sys 25*7f2fe78bSCy Schubertimport os 26*7f2fe78bSCy Schubertimport re 27*7f2fe78bSCy Schubertfrom optparse import OptionParser 28*7f2fe78bSCy Schubert 29*7f2fe78bSCy Schubert 30*7f2fe78bSCy Schubertfrom doxybuilder_types import * 31*7f2fe78bSCy Schubertfrom doxybuilder_funcs import * 32*7f2fe78bSCy Schubert 33*7f2fe78bSCy Schubert 34*7f2fe78bSCy Schubertdef processOptions(): 35*7f2fe78bSCy Schubert usage = "\n\t\t%prog -t type -i in_dir -o out_dir" 36*7f2fe78bSCy Schubert description = "Description:\n\tProcess doxygen output for c-types and/or functions" 37*7f2fe78bSCy Schubert parser = OptionParser(usage=usage, description=description) 38*7f2fe78bSCy Schubert 39*7f2fe78bSCy Schubert parser.add_option("-t", "--type", type="string", dest="action_type", help="process typedef and/or function. Possible choices: typedef, func, all. Default: all.", default="all") 40*7f2fe78bSCy Schubert parser.add_option("-i", "--in", type="string", dest="in_dir", help="input directory") 41*7f2fe78bSCy Schubert parser.add_option("-o", "--out", type="string", dest= "out_dir", help="output directory. Note: The subdirectory ./types will be created for typedef") 42*7f2fe78bSCy Schubert 43*7f2fe78bSCy Schubert (options, args) = parser.parse_args() 44*7f2fe78bSCy Schubert action = options.action_type 45*7f2fe78bSCy Schubert in_dir = options.in_dir 46*7f2fe78bSCy Schubert out_dir = options.out_dir 47*7f2fe78bSCy Schubert 48*7f2fe78bSCy Schubert 49*7f2fe78bSCy Schubert if in_dir is None or out_dir is None: 50*7f2fe78bSCy Schubert parser.error("Input and output directories are required") 51*7f2fe78bSCy Schubert 52*7f2fe78bSCy Schubert if action == "all" or action == "typedef": 53*7f2fe78bSCy Schubert builder = DoxyBuilderTypes(in_dir, out_dir) 54*7f2fe78bSCy Schubert builder.run_all() 55*7f2fe78bSCy Schubert 56*7f2fe78bSCy Schubert if action == "all" or action == "func" or action == "function": 57*7f2fe78bSCy Schubert builder = DoxyBuilderFuncs(in_dir, out_dir) 58*7f2fe78bSCy Schubert builder.run_all() 59*7f2fe78bSCy Schubert 60*7f2fe78bSCy Schubert 61*7f2fe78bSCy Schubertif __name__ == '__main__': 62*7f2fe78bSCy Schubert parser = processOptions() 63*7f2fe78bSCy Schubert 64*7f2fe78bSCy Schubert 65