comparison CodeAnalysis/ParseOrthancSDK.py @ 170:b49eeb36cd0d

removed generation of code model, now part of orthanc-java
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 Jun 2024 14:26:59 +0200
parents 6fada29b6759
children 46a81ed6e843
comparison
equal deleted inserted replaced
169:fcce093788a8 170:b49eeb36cd0d
550 sortedGlobalFunctions = sorted(globalFunctions, key = lambda x: x['c_function']) 550 sortedGlobalFunctions = sorted(globalFunctions, key = lambda x: x['c_function'])
551 551
552 with open(os.path.join(ROOT, 'GlobalFunctions.mustache'), 'r') as f: 552 with open(os.path.join(ROOT, 'GlobalFunctions.mustache'), 'r') as f:
553 with open(os.path.join(TARGET, 'sdk_GlobalFunctions.impl.h'), 'w') as h: 553 with open(os.path.join(TARGET, 'sdk_GlobalFunctions.impl.h'), 'w') as h:
554 h.write(renderer.render(f.read(), { 554 h.write(renderer.render(f.read(), {
555 'global_functions' : globalFunctions, 555 'global_functions' : sortedGlobalFunctions,
556 })) 556 }))
557 557
558 with open(os.path.join(ROOT, 'sdk.cpp.mustache'), 'r') as f: 558 with open(os.path.join(ROOT, 'sdk.cpp.mustache'), 'r') as f:
559 with open(os.path.join(TARGET, 'sdk.cpp'), 'w') as h: 559 with open(os.path.join(TARGET, 'sdk.cpp'), 'w') as h:
560 h.write(renderer.render(f.read(), { 560 h.write(renderer.render(f.read(), {
561 'classes' : sortedClasses, 561 'classes' : sortedClasses,
562 'enumerations' : sortedEnumerations, 562 'enumerations' : sortedEnumerations,
563 'global_functions' : globalFunctions, 563 'global_functions' : sortedGlobalFunctions,
564 })) 564 }))
565 565
566 with open(os.path.join(ROOT, 'sdk.h.mustache'), 'r') as f: 566 with open(os.path.join(ROOT, 'sdk.h.mustache'), 'r') as f:
567 with open(os.path.join(TARGET, 'sdk.h'), 'w') as h: 567 with open(os.path.join(TARGET, 'sdk.h'), 'w') as h:
568 h.write(renderer.render(f.read(), { 568 h.write(renderer.render(f.read(), {
569 'classes' : sortedClasses, 569 'classes' : sortedClasses,
570 })) 570 }))
571 571
572 572
573 with open(os.path.join(TARGET, 'CodeModel.json'), 'w') as f:
574 f.write(json.dumps({
575 'global_functions' : globalFunctions,
576 'classes' : sortedClasses,
577 'enumerations' : sortedEnumerations,
578 }, ensure_ascii = True, indent = 4, sort_keys = True))
579
580
581 print('') 573 print('')
582 print('Total functions in the SDK: %d' % countAllFunctions) 574 print('Total functions in the SDK: %d' % countAllFunctions)
583 print('Total supported functions: %d' % countSupportedFunctions) 575 print('Total supported functions: %d' % countSupportedFunctions)
584 print('Coverage: %.0f%%' % (float(countSupportedFunctions) / 576 print('Coverage: %.0f%%' % (float(countSupportedFunctions) /
585 float(countAllFunctions) * 100.0)) 577 float(countAllFunctions) * 100.0))