C Implementation of UML State Machines and Activity Diagrams for Safety-Critical, Real-Time and Embedded Applications.