This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

more than 2048 characters in lines are wrapped and no solutions?

Hi,

So I have lines sources which are more than
2048 characters and why those are wrapped.

So I have seen at this link: http://www.keil.com/support/docs/2911.htm
the answer to my problem so I used a backslash (\) character to concatenate two source lines with the C preprocessor.

Example: long source line \ continues here

But it still wrapped lines there is still problem, I don't understand why ?

Can you help me please?

Thank you

Sems

Parents
  • LOL

    If you read my post again, I said that you shouldn't make your example lines too long, to make sure that we can view this tread :)

    You don't need to use the continuation character. You can break the line by inserting a newline character before or after any of the comma characters, i.e.

    code char MyArray1 [8000] = {
      0xFF, 0xFB, 0x18, 0x00, 0x00, 0x00, 0x00, 0xC2,
      0x1D, 0x4C, 0x06, 0x1C, 0xE0, 0x02, 0x16, 0xA2,
      0xE9, 0x90, 0xC1, 0x14, 0x00, 0x02, 0xEC, 0x45,
      0x62, 0xBC, 0x17, 0x80, 0x08, 0x5F, 0x08, 0xAC,
      0x57, 0x82, 0xF0, 0x01, 0xF0, 0x76, 0x26, 0xF1,
      0x20, 0x4B, 0xF2, 0x6F, 0xE2, 0x40, 0x2C, 0xFC,
      0x24, 0x12, 0xD3, 0xFC, 0xC0, 0x7E, 0x0F, 0xC9,
      0xFF, 0xF9, 0x39, 0xC3, 0xFC, 0xA2, 0xFC, 0x9F,
      0xB7, 0x90, 0x04, 0xFC, 0x08, 0x82, 0x1F, 0xE2,
      0x80, 0x18, 0x06, 0x2F, 0xFA, 0x60, 0xFB, 0xFF,
      0x94, 0x70, 0x3F, 0x00, 0x00, 0x07, 0xFF, 0xFE,
      0x38, 0x94, 0xA7, 0xCC, 0x37, 0xF1, 0xEF, 0x04,
      0x95, 0x8F, 0xF4, 0x42, 0x81, 0x58, 0xC8, 0x23,
      0xC0, 0x00, 0x20, 0x00, 0x00, 0x8F, 0xFF, 0xF8,
      0xE2, 0x52, 0x9F, 0x30, 0xDF, 0xC7, 0xBC, 0x12,
      0x56, 0x49, 0xD4, 0x8A, 0x05, 0x63, 0x20, 0x8F,
      0x00, 0x00, 0x9E, 0x96, 0x95, 0xE4, 0xD1, 0x52,
      0x4D, 0x56, 0x01, 0xCD, 0x25, 0x4C, 0x41, 0x13,
      0xFF, 0xFB, 0x18, 0x00, 0x07, 0x0F, 0xF0, 0xD3,
      0x14, 0x58, 0x80, 0x08, 0xCA, 0xB2, 0x1B, 0xC2,
      0x8B, 0x10, 0x05, 0x19, 0x64, 0x43,
      ...
      0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA};
    

    Modify the application that generates your data to emit no more than 8 hex bytes / line as above. That should be faster than to manually insert 1000 newline characters.

    The continuation character '\' is normally only used in a long #define, since a preprocessor directive may not span multiple lines. Everything but the preprocessor directives may be split wherever white space may be placed - i.e. between any two tokens.

Reply
  • LOL

    If you read my post again, I said that you shouldn't make your example lines too long, to make sure that we can view this tread :)

    You don't need to use the continuation character. You can break the line by inserting a newline character before or after any of the comma characters, i.e.

    code char MyArray1 [8000] = {
      0xFF, 0xFB, 0x18, 0x00, 0x00, 0x00, 0x00, 0xC2,
      0x1D, 0x4C, 0x06, 0x1C, 0xE0, 0x02, 0x16, 0xA2,
      0xE9, 0x90, 0xC1, 0x14, 0x00, 0x02, 0xEC, 0x45,
      0x62, 0xBC, 0x17, 0x80, 0x08, 0x5F, 0x08, 0xAC,
      0x57, 0x82, 0xF0, 0x01, 0xF0, 0x76, 0x26, 0xF1,
      0x20, 0x4B, 0xF2, 0x6F, 0xE2, 0x40, 0x2C, 0xFC,
      0x24, 0x12, 0xD3, 0xFC, 0xC0, 0x7E, 0x0F, 0xC9,
      0xFF, 0xF9, 0x39, 0xC3, 0xFC, 0xA2, 0xFC, 0x9F,
      0xB7, 0x90, 0x04, 0xFC, 0x08, 0x82, 0x1F, 0xE2,
      0x80, 0x18, 0x06, 0x2F, 0xFA, 0x60, 0xFB, 0xFF,
      0x94, 0x70, 0x3F, 0x00, 0x00, 0x07, 0xFF, 0xFE,
      0x38, 0x94, 0xA7, 0xCC, 0x37, 0xF1, 0xEF, 0x04,
      0x95, 0x8F, 0xF4, 0x42, 0x81, 0x58, 0xC8, 0x23,
      0xC0, 0x00, 0x20, 0x00, 0x00, 0x8F, 0xFF, 0xF8,
      0xE2, 0x52, 0x9F, 0x30, 0xDF, 0xC7, 0xBC, 0x12,
      0x56, 0x49, 0xD4, 0x8A, 0x05, 0x63, 0x20, 0x8F,
      0x00, 0x00, 0x9E, 0x96, 0x95, 0xE4, 0xD1, 0x52,
      0x4D, 0x56, 0x01, 0xCD, 0x25, 0x4C, 0x41, 0x13,
      0xFF, 0xFB, 0x18, 0x00, 0x07, 0x0F, 0xF0, 0xD3,
      0x14, 0x58, 0x80, 0x08, 0xCA, 0xB2, 0x1B, 0xC2,
      0x8B, 0x10, 0x05, 0x19, 0x64, 0x43,
      ...
      0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA};
    

    Modify the application that generates your data to emit no more than 8 hex bytes / line as above. That should be faster than to manually insert 1000 newline characters.

    The continuation character '\' is normally only used in a long #define, since a preprocessor directive may not span multiple lines. Everything but the preprocessor directives may be split wherever white space may be placed - i.e. between any two tokens.

Children
  • "Everything but the preprocessor directives may be split wherever white space may be placed - i.e. between any two tokens."

    Absolutely!
    In the 'C' language, "Whitespace" is any sequence of spaces, TABs, and/or newlines - so anywhere you can put a single space, you can equally put a newline.

    For example you could, if you wanted, write your definition as:

    code
    char
    MyArray1
    [
    8000
    ]
    =
    {
     0xFF
     ,
     0xFB
     ,
     0x18
     ,
     0x00
     ,
     0x00
     ,
     :
     :
     0xAA
    }
    ;
    


    and then you'd have absolutely no problems whatsoever with excessively long lines.

    You might, however, consider the excessively large number of excessively short lines to be a problem...