Move sparkle_ functions into separate source file

Leave the demo code in demo.c