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