alinebee / Boxer

The DOS game emulator that's fit for your Mac.
http://boxerapp.com/
770 stars 139 forks source link

Use Typed Enums #48

Closed MaddTheSane closed 9 years ago

MaddTheSane commented 9 years ago

This pull request changes many C-style enums to use NS_ENUM or NS_OPTIONS. This is type-safe and compatible with Swift, should Boxer ever migrate to 64-bit.

I forgot when they were introduced, but they should be buildable to any version of OS X, provided NS_ENUM and NS_OPTIONS are defined.

alinebee commented 9 years ago

Thanks for this! I actually only found out about NS_ENUM and NS_OPTIONS this weekend while I was digging into Swift development. I was planning to migrate my old code to them, so you've saved me a bunch of work.

Kentzo commented 9 years ago

I believe NS_ENUM and NS_OPTIONS were introduced in 10.8

alinebee commented 9 years ago

Yup, seems that way according to mattt: http://nshipster.com/ns_enum-ns_options/

MaddTheSane commented 9 years ago

There are some enums I didn't do, particularly those in the DOSBox app proper. I also only did a few of the enums in the printer source files, as I wasn't 100% sure about the size (if any) the values were supposed to be. I also skipped over the JoypadCocoa headers because the source isn't being compiled, and thus the size might be different then that being linked.

alinebee commented 9 years ago

Yeah, I prefer to keep Boxer's modification of external sources (including DOSBox's) to a minimum, as that makes diffing and merging that much less harrowing when the time comes to update those sources.