mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:45:50 +00:00
- Tree cleanups proposed on the mailing list. Move all non-Core OS modules to rosapps. Tests were already moved by Fireball to rostests.
svn path=/trunk/; revision=26033
This commit is contained in:
parent
ad07a1e58f
commit
1e3d5d70e9
420 changed files with 78215 additions and 0 deletions
43
rosapps/sysutils/utils/sdkparse/strip_comments.cpp
Normal file
43
rosapps/sysutils/utils/sdkparse/strip_comments.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
// strip_comments.cpp
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 )
|
||||
#endif//_MSC_VER
|
||||
|
||||
#include "strip_comments.h"
|
||||
|
||||
void strip_comments ( std::string& s, bool strip_lf )
|
||||
{
|
||||
char* src = &s[0];
|
||||
char* dst = src;
|
||||
while ( *src )
|
||||
{
|
||||
if ( src[0] == '/' && src[1] == '/' )
|
||||
{
|
||||
src += 2;
|
||||
while ( *src && *src != '\n' )
|
||||
src++;
|
||||
if ( *src )
|
||||
src++; // skip newline
|
||||
}
|
||||
else if ( src[0] == '/' && src[1] == '*' )
|
||||
{
|
||||
src += 2;
|
||||
char* newsrc = strstr ( src, "*/" );
|
||||
if ( !newsrc )
|
||||
break;
|
||||
src = newsrc;
|
||||
//while ( *src && ( src[0] != '*' || src[1] != '/' ) )
|
||||
// src++;
|
||||
if ( *src ) src++;
|
||||
if ( *src ) src++;
|
||||
}
|
||||
else if ( src[0] == '\r' && strip_lf )
|
||||
src++;
|
||||
else
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst = '\0';
|
||||
|
||||
s.resize ( dst-&s[0] );
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue