Refactor the ndarray adaptor and expose the array flags

This uses a cleaner pattern in the C implementation, instead of computing all pointers by hand.
Is there an API for users to get the llarray? Or do they hack it around?