2016-03-29

Add Syntax Highlighting

Sometimes, it is necessary to share code on this website, so I add syntax highlighting capability by using SyntaxHighlighter. SyntaxHighlighter is capable of dealing with lots of programming languages, including my favourites C and C++.

Here is an example of C++ code snippet with line 27 highlighted.
#include &ltpos.h>

typedef enum
{
    S_SLEEP = 0,
    S_POWER,    // Normal POWER METER mode
    S_ENGINEER, // Engineering mode
    S_FACTORY,  // Engineering FACTORY mode
    S_AGENCY,   // Engineering AGENCY mode
    S_REPORT    // Engineering REPORT mode
}state_t;

class State: public pos::Task
{
private:
    state_t _state;
    state_t _toState;

    void gotoSleep(void);

public:
    int  idle_timer;

    static bool create();
    State();
    ~State() {}
    void run();
    state_t getState() { return _state; }
    void toState(state_t s) { _toState = s; }
};