tingraldi/SwiftScripting

Problem in Generating Microsoft Word

udaygire opened this issue · 1 comments

Hi

Getting this error from ./sbhc.py Word.h

Traceback (most recent call last):
File "./sbhc.py", line 263, in
main(sys.argv[1])
File "./sbhc.py", line 259, in main
header_processor.emit_swift()
File "./sbhc.py", line 245, in emit_swift
self.emit_enums(enums)
File "./sbhc.py", line 164, in emit_enums
repr(struct.pack('!I', decl.enum_value))))
struct.error: integer out of range for 'I' format code

Thank you for filing this issue.

The problem here was that a negative enum value could not be packed as an unsigned integer. I've corrected the enum-generating code such that it packs values as signed integers. The change has been pushed to master.

Also, be aware that the sdef file for Word is likely to contain some errors that will cause Apple's sdp tool to fail. You'll need to manually edit the sdef file to comment-out or remove the problematic lines that sdp can't handle.

To make editing the sdef file easier, I suggest that you format it first using xmllint as follows.

xmllint --format Word.sdef > tmp; mv tmp Word.sdef

The issues that I saw with Word 2011 were malformed enumeration members. If you are using a different version of Word, you may not see these issues.