hal: make 'save comp' order match original 'loadrt' order

Originally I chose to reverse the order in the linked list, but this
caused problems on unload due to the need to remove modules in the reverse
order (a problem which is seen in kernel-based builds only).

This time, reverse the list in save_comps in a way that uses O(n) extra
space and traverses the list twice.
tests: save.0: use expected result as hal script too

.. this makes is all the more certain that halcmd save is doing
the right thing, since it doesn't allow it to introduce any differences.
DONT PUSH!! debug linuxcnc shutdown