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
For some reason, my reply seems to have appeared as a separate thread:
http://www.keil.com/forum/docs/thread10235.asp
i don't understand very well but if you see my source lines maybe you can advice me what to do?
This in fact a song stored in the µc flash: This is part of the file.h
// *** Hex-value of : Gong_DeLijn_2Sec.mp3 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, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}; code char MyArray2 [352] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xFF, 0xFB, 0x18, 0x00, 0xE9, 0x00, 0x02, 0x32, 0x22, 0xCC, 0x06, 0x4F, 0x60, 0x00, 0x46, 0x44, 0x59, 0x91, 0xC9, 0x6C, 0x00, .... , 0xAA, 0xAA, 0xAA, 0x A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}; unsigned int nbrArr = 2; unsigned char MyArray3[1] = 0; unsigned char MyArray4[1] = 0; unsigned char MyArray5[1] = 0; unsigned char MyArray6[1] = 0; unsigned char MyArray7[1] = 0;
Must I only use the slash for avoiding this lines wrapped message?
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.
"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...