Mercurial > hg > orthanc
comparison Resources/GenerateErrorCodes.py @ 1733:e1f5ab395297
PrintErrors
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 21 Oct 2015 14:10:55 +0200 |
parents | da799f767e5d |
children | e2675b37eb01 |
comparison
equal
deleted
inserted
replaced
1732:5cdea1cd2071 | 1733:e1f5ab395297 |
---|---|
139 a = re.sub('(EnumerationToString\(ErrorCode.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)', | 139 a = re.sub('(EnumerationToString\(ErrorCode.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)', |
140 r'\1\n%s\2' % s, a, re.DOTALL) | 140 r'\1\n%s\2' % s, a, re.DOTALL) |
141 | 141 |
142 with open(path, 'w') as f: | 142 with open(path, 'w') as f: |
143 f.write(a) | 143 f.write(a) |
144 | |
145 | |
146 | |
147 ## | |
148 ## Generate the "PrintErrors" function in "main.cpp" | |
149 ## | |
150 | |
151 path = os.path.join(BASE, 'OrthancServer', 'main.cpp') | |
152 with open(path, 'r') as f: | |
153 a = f.read() | |
154 | |
155 s = '\n'.join(map(lambda x: ' PrintError(%d, "%s");' % (x['Code'], x['Name']), ERRORS)) | |
156 | |
157 print s | |
158 | |
159 #with open(path, 'w') as f: | |
160 # f.write(a) |