Sun, 04 Oct 2015 13:19:45 +0300
Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | #!/usr/bin/env python |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | # coding: utf-8 |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | # |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | # Copyright 2015 Teemu Piippo |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | # All rights reserved. |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | # |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | # Redistribution and use in source and binary forms, with or without |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | # modification, are permitted provided that the following conditions |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | # are met: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | # |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | # 1. Redistributions of source code must retain the above copyright |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | # notice, this list of conditions and the following disclaimer. |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | # 2. Redistributions in binary form must reproduce the above copyright |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | # notice, this list of conditions and the following disclaimer in the |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | # documentation and/or other materials provided with the distribution. |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | # 3. Neither the name of the copyright holder nor the names of its |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | # contributors may be used to endorse or promote products derived from |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | # this software without specific prior written permission. |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | # |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | # |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | import argparse |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | import caseconversions |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | import collections |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | import outputfile |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | import re |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | from pprint import pprint |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | passbyvalue = {'int', 'bool', 'float', 'double' } |
982
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
41 | variantconversions = { |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
42 | 'QString': 'toString', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
43 | 'bool': 'toBool', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
44 | 'int': 'toInt', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
45 | 'float': 'toFloat', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
46 | 'double': 'toDouble', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
47 | 'QChar': 'toChar', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
48 | 'QBitArray': 'toBitArray', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
49 | 'QDate': 'toDate', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
50 | 'QDateTime': 'toDateTime', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
51 | 'uint': 'toUInt', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
52 | 'unsigned int': 'toUInt', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
53 | 'QUrl': 'toUrl', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
54 | 'QTime': 'toTime', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
55 | 'QPoint': 'toPoint', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
56 | 'QPointF': 'toPointF', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
57 | 'QSize': 'toSize', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
58 | 'QSizeF': 'toSizeF', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
59 | 'qreal': 'toReal', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
60 | 'QRect': 'toRect', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
61 | 'QRectF': 'toRectF', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
62 | 'QLine': 'toLine', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
63 | 'QLineF': 'toLineF', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
64 | 'QEasingCurve': 'toEasingCurve', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
65 | 'qlonglong': 'toLongLong', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
66 | 'qulonglong': 'toULongLong', |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
67 | } |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | class ConfigCollector (object): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | def __init__ (self, args): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | self.pattern = re.compile (r'\s*ConfigOption\s*\((.+)\)\s*') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | self.declpattern = re.compile (r'^([A-Za-z0-9,<>\[\]\(\)\{\}\s]+)\s+(\w+)(\s*=\s*(.+))?$') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | self.decls = [] |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | self.qttypes = set() |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | self.args = args |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | def collect (self, filenames): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | for filename in filenames: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | with open (filename, 'r') as fp: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | lines = fp.read().splitlines() |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | for line in lines: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | matches = self.pattern.findall (line) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | for match in matches: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | match = match.strip() |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | declarations = self.declpattern.findall (match) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | for decl in declarations: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | self.add_config_declaration (decl) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | self.decls.sort (key=lambda x: x['name'].upper()) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | def add_config_declaration (self, decl): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | decltype, declname, junk, decldefault = decl |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | if not decldefault: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | if decltype == 'int': |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | decldefault = '0' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | elif decltype == 'float': |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | decldefault = '0.0f' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | elif decltype == 'double': |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | decldefault = '0.0' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | elif decltype == 'bool': |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | raise TypeError ('bool entries must provide a default value') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | else: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | decldefault = decltype + '()' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | self.decls.append (dict (name=declname, type=decltype, default=decldefault)) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | # Take note of any Qt types we may want to #include in our source file (we'll need to #include them). |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | self.qttypes.update (re.findall (r'(Q[A-Za-z]+)', decltype)) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | def make_config_key_type (self, basetype): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | result = 'ConfigTypeKey_' + basetype |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | result = re.sub (r'[^\w]+', '_', result) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | return result |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | def make_enums (self): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | self.enums = collections.OrderedDict() |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | for decl in self.decls: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | enumname = self.make_config_key_type (decl['type']) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | decl['enumerator'] = caseconversions.convert_case (decl['name'], style='upper') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | decl['enumname'] = enumname |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | decl['getter'] = caseconversions.convert_case (decl['name'], style='java') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | decl['varname'] = 'm_' + decl['getter'] |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | decl['setter'] = 'set' + caseconversions.convert_case (decl['name'], style='camel') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | decl['typecref'] = 'const %s&' % decl['type'] if decl['type'] not in passbyvalue else decl['type'] |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | |
982
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
128 | try: |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
129 | decl['valuefunc'] = variantconversions[decl['type']] |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
130 | except KeyError: |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
131 | decl['valuefunc'] = 'value<' + decl['type'] + '>' |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
132 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | if enumname not in self.enums: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | self.enums[enumname] = dict ( |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | name = enumname, |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | typename = decl['type'], |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | values = [], |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | numvalues = 0, |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | highestkey = -1) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | self.enums[enumname]['values'].append (decl) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | self.enums[enumname]['numvalues'] += 1 |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | self.enums[enumname]['highestkey'] += 1 |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | self.enums = collections.OrderedDict (sorted (self.enums.items(), key=lambda x: x[0].upper())) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | for name, enum in self.enums.items(): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | for i, value in enumerate (enum['values']): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | value['index'] = i |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | def write_header (self, fp): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | fp.write ('#pragma once\n') |
972
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
153 | fp.write ('#include <QMap>\n') |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | for qttype in sorted (self.qttypes): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | fp.write ('#include <%s>\n' % qttype) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | formatargs = {} |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | write = lambda value: fp.write (value) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | write ('class ConfigurationValueBag\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | write ('{\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | write ('public:\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | write ('\tConfigurationValueBag (class MainWindow* window);\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | write ('\t~ConfigurationValueBag();\n') |
972
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
163 | write ('\tbool existsEntry (const QString& name);\n') |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | write ('\tQVariant defaultValueByName (const QString& name);\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
166 | for decl in self.decls: |
982
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
167 | write ('\t{type} {getter}() const;\n'.format (**decl)) |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | for decl in self.decls: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | write ('\tvoid {setter} ({typecref} value);\n'.format (**decl)) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | write ('\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | write ('private:\n') |
972
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
173 | write ('\tQMap<QString, QVariant> m_defaults;\n') |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | write ('\tclass QSettings* m_settings;\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | write ('};\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
177 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | def write_source (self, fp, headername): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | fp.write ('#include <QSet>\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | fp.write ('#include <QSettings>\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | fp.write ('#include <QVariant>\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | fp.write ('#include "%s/mainwindow.h"\n' % (self.args.sourcedir)) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | fp.write ('#include "%s"\n' % headername) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
184 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
185 | fp.write ( |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
186 | '\n' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
187 | 'ConfigurationValueBag::ConfigurationValueBag (MainWindow* window) :\n' |
972
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
188 | '\tm_settings (window->makeSettings (nullptr))\n' |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
189 | '{\n') |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
190 | |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
191 | for decl in self.decls: |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
192 | fp.write ('\tm_defaults["{name}"] = QVariant::fromValue<{type}> ({default});\n'.format (**decl)) |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
193 | |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
194 | fp.write ('}\n' |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | '\n' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
196 | 'ConfigurationValueBag::~ConfigurationValueBag()\n' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
197 | '{\n' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
198 | '\tm_settings->deleteLater();\n' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
199 | '}\n' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | '\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
202 | maptype = 'QMap<QString, QVariant>' |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
203 | fp.write ('QVariant ConfigurationValueBag::defaultValueByName (const QString& name)\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | fp.write ('{\n') |
972
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
205 | fp.write ('\t%s::iterator it = m_defaults.find (name);\n' % maptype) |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
206 | fp.write ('\tif (it != m_defaults.end())\n') |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | fp.write ('\t\treturn *it;\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | fp.write ('\treturn QVariant();\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | fp.write ('}\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | fp.write ('\n') |
972
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
211 | fp.write ('bool ConfigurationValueBag::existsEntry (const QString& name)\n') |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
212 | fp.write ('{\n') |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
213 | fp.write ('\treturn m_defaults.find (name) != m_defaults.end();\n') |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
214 | fp.write ('}\n') |
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
215 | fp.write ('\n') |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
216 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | for decl in self.decls: |
982
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
218 | fp.write ('{type} ConfigurationValueBag::{getter}() const\n'.format (**decl)) |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | fp.write ('{\n') |
982
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
220 | fp.write ('\tstatic const QVariant defaultvalue = QVariant::fromValue<{type}> ({default});\n'.format (**decl)) |
a3a2e62a581b
Optimize QVariant in ConfigurationValueBag
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
221 | fp.write ('\treturn m_settings->value ("{name}", defaultvalue).{valuefunc}();\n'.format (**decl)) |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
222 | fp.write ('}\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | fp.write ('\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | for decl in self.decls: |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | fp.write ('void ConfigurationValueBag::{setter} ({typecref} value)\n'.format (**decl)) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | fp.write ('{\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | fp.write ('\tif (value != {default})\n'.format (**decl)) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | fp.write ('\t\tm_settings->setValue ("{name}", QVariant::fromValue<{type}> (value));\n'.format (**decl)) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | fp.write ('\telse\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | fp.write ('\t\tm_settings->remove ("{name}");\n'.format (**decl)) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | fp.write ('}\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
233 | fp.write ('\n') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
234 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
235 | def main(): |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | parser = argparse.ArgumentParser (description='Collects a list of configuration objects') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | parser.add_argument ('inputs', nargs='+') |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | parser.add_argument ('--header', required=True) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | parser.add_argument ('--source', required=True) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
240 | parser.add_argument ('--sourcedir', required=True) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
241 | args = parser.parse_args() |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
242 | collector = ConfigCollector (args) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
243 | collector.collect (args.inputs) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
244 | collector.make_enums() |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
245 | header = outputfile.OutputFile (args.header) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
246 | source = outputfile.OutputFile (args.source) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
247 | collector.write_source (source, headername=args.header) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
248 | collector.write_header (header) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
249 | header.save (verbose = True) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
250 | source.save (verbose = True) |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
251 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
252 | if __name__ == '__main__': |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
253 | main() |