move magic constants to #defines.
move non-ruby C code out into it's own files.