Compatibility and Debug fixes

Hi,

I have made a number of changes to the code to give wider compatibility and usability. These include:
* Moving loop variable declarations out of "for loop" statements - gives errors with some compiler settings
* Consolidated debug printing so it can all be switched mpconfigport.h
* Ensure headers are only parsed once (I used "pragma once" but this could be done with ifdef instead)
* Make headers able to stand alone - i.e. each header has includes for all types it uses, so the header can be used by an external program as a single include.
* Add breaks at end of switch statements ( or add comments that tell eclipse static analyzer that it is an intentional fall-through. (Some were after asserts, and assert action depends on the platform and build)
* Cast printf arguments to match types - (some gcc options seem to give warnings even if "%d" uses a type that is typedef'd to int. (This might be better done with macros defined in mpconfigport.h)

Regards,

Evan