Menu

Test with VS2010 compiler, patch, patch proposal

2012-06-28
2012-07-13
  • Eugene Ryabtsev

    Eugene Ryabtsev - 2012-06-28

    Tested building on Windows with Qt Creator and Microsoft VS2010 compiler without MinGW. The code generally works, but I had to make the following changes so far:

    1. Microsoft compilers do not like zero-sized arrays in the middle of a struct, so rewritten:

    struct iec_stcd {
    union {
    unsigned short st;
    struct {
    unsigned char st1 :1;
    unsigned char st2 :1;
    unsigned char st3 :1;
    unsigned char st4 :1;
    unsigned char st5 :1;
    unsigned char st6 :1;
    unsigned char st7 :1;
    unsigned char st8 :1;
    unsigned char st9 :1;
    unsigned char st10 :1;
    unsigned char st11 :1;
    unsigned char st12 :1;
    unsigned char st13 :1;
    unsigned char st14 :1;
    unsigned char st15 :1;
    unsigned char st16 :1;
    };
    };
    union {
    unsigned short cd;
    struct {
    unsigned char cd1 :1;
    unsigned char cd2 :1;
    unsigned char cd3 :1;
    unsigned char cd4 :1;
    unsigned char cd5 :1;
    unsigned char cd6 :1;
    unsigned char cd7 :1;
    unsigned char cd8 :1;
    unsigned char cd9 :1;
    unsigned char cd10 :1;
    unsigned char cd11 :1;
    unsigned char cd12 :1;
    unsigned char cd13 :1;
    unsigned char cd14 :1;
    unsigned char cd15 :1;
    unsigned char cd16 :1;
    };
    };
    };

    1. Had to change

    class iec104_class
    {
    ...
    private:
    ...
    unsigned char masterAddress; // master link address
    unsigned char slaveAddress; // slave link address

    to

    private:
    ...
    unsigned char masterAddress; // master link address
    unsigned short slaveAddress; // slave link address

    because otherwise was getting

    --> ASDU WITH UNEXPECTED ORIGIN! Ignoring...

    with the cause of that rooted to

    papdu->asduh.ca = 888; slaveAddress = 120

    (that is, after tweaking the ui part into even allowing to enter such an address)

    Given that

    struct iec_obj {
    ...
    unsigned short ca; // common addres of asdu

    I find the "slave link address" text counterintuitive, and limiting whatever is being compared with a short to size of a byte not well-founded.

    Also, can you please detabify everything and use spaces only? That would make it easier to view and use your code as-is without reformatting and thus also easier to submit any patches.

    Otherwise, great job! Thank you very much!

     
  • ricardolo

    ricardolo - 2012-06-28

    Those are very nice suggestions, all accepted.
    Thank you Mr. Ryabtsev

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.