comparison Resources/GenerateErrorCodes.py @ 1580:bf502300c52e

force the size of the enumerations in the plugin SDK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 15:59:07 +0200
parents 09715095fc53
children bd1889029cbb
comparison
equal deleted inserted replaced
1579:b93c398f934d 1580:bf502300c52e
77 path = os.path.join(BASE, 'Plugins', 'Include', 'orthanc', 'OrthancCPlugin.h') 77 path = os.path.join(BASE, 'Plugins', 'Include', 'orthanc', 'OrthancCPlugin.h')
78 with open(path, 'r') as f: 78 with open(path, 'r') as f:
79 a = f.read() 79 a = f.read()
80 80
81 s = ',\n'.join(map(lambda x: ' OrthancPluginErrorCode_%s = %d /*!< %s */' % (x['Name'], int(x['Code']), x['Description']), ERRORS)) 81 s = ',\n'.join(map(lambda x: ' OrthancPluginErrorCode_%s = %d /*!< %s */' % (x['Name'], int(x['Code']), x['Description']), ERRORS))
82 a = re.sub('(typedef enum\s*{)[^}]*?(\s*} OrthancPluginErrorCode;)', r'\1\n%s\2' % s, a, re.DOTALL) 82 s += ',\n\n _OrthancPluginErrorCode_INTERNAL = 0x7fffffff\n '
83 a = re.sub('(typedef enum\s*{)[^}]*?(} OrthancPluginErrorCode;)', r'\1\n%s\2' % s, a, re.DOTALL)
83 84
84 with open(path, 'w') as f: 85 with open(path, 'w') as f:
85 f.write(a) 86 f.write(a)
86 87
87 88