NO

Author Topic: Option /P: Preprocessed output -> UNIX-Style-Textfiles  (Read 2345 times)

fuerst

  • Guest
Option /P: Preprocessed output -> UNIX-Style-Textfiles
« on: April 30, 2014, 09:43:56 PM »
Assume following C-Source simple.c
Code: [Select]
#define RETVAL 0
int main( void )
{
  return RETVAL;
}

Generating preprocessoroutput from simple.c with option /P
Quote
pocc /P simple.c
generates the file simple.i, which has no CR/LF-Ending. If you open such a file in Windows-Notepad, you see _one_ long line. Below hexdump-Output.

Quote
  Addr.   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  0123456789ABCDEF
 ------------------------------------------------------------------------
 00000  23 6c 69 6e 65 20 31 20 22 73 69 6d 70 6c 65 2e  #line 1 "simple.
 00010  63 22 0a 0a 69 6e 74 20 6d 61 69 6e 28 20 76 6f  c"..int main( vo
 00020  69 64 20 29 0a 7b 0a 20 20 72 65 74 75 72 6e 20  id ).{.  return
 00030  30 3b 0a 7d 0a                                   0;.}.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Option /P: Preprocessed output -> UNIX-Style-Textfiles
« Reply #1 on: April 30, 2014, 09:57:46 PM »
Assume following C-Source simple.c
Code: [Select]
#define RETVAL 0
int main( void )
{
  return RETVAL;
}

Generating preprocessoroutput from simple.c with option /P
Quote
pocc /P simple.c
generates the file simple.i, which has no CR/LF-Ending. If you open such a file in Windows-Notepad, you see _one_ long line. Below hexdump-Output.

Quote
  Addr.   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  0123456789ABCDEF
 ------------------------------------------------------------------------
 00000  23 6c 69 6e 65 20 31 20 22 73 69 6d 70 6c 65 2e  #line 1 "simple.
 00010  63 22 0a 0a 69 6e 74 20 6d 61 69 6e 28 20 76 6f  c"..int main( vo
 00020  69 64 20 29 0a 7b 0a 20 20 72 65 74 75 72 6e 20  id ).{.  return
 00030  30 3b 0a 7d 0a                                   0;.}.
Just use a proper editor that doesn't choke on the line endings. The dump shows that the file has *ix style LF-only file endings, pretty much any other file editor BUT Notepad will open those just fine... (Hint: Try PSPad)

Ralf

fuerst

  • Guest
Re: Option /P: Preprocessed output -> UNIX-Style-Textfiles
« Reply #2 on: May 01, 2014, 03:06:31 PM »
My intention is not to discuss about texteditors but to give the hint, that the outputfile has a unusual format.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Option /P: Preprocessed output -> UNIX-Style-Textfiles
« Reply #3 on: May 03, 2014, 01:32:03 AM »
My intention is not to discuss about texteditors but to give the hint, that the outputfile has a unusual format.
Well, my intention was to point out that the format is anything but unusual...  ;)

Ralf