Add an Xcode project, try to fix some warnings

gosh this code is horrible... the bracketing and whitespace are each so
inconsistent...
accidentally removed main.c, put it back

(should have gone in previous commit)