ReactOS
0.4.16-dev-822-gbcedb53
strip_comments.cpp
Go to the documentation of this file.
1
// strip_comments.cpp
2
3
#ifdef _MSC_VER
4
#pragma warning ( disable : 4786 )
5
#endif
//_MSC_VER
6
7
#include "
strip_comments.h
"
8
9
void
strip_comments
( std::string&
s
,
bool
strip_lf )
10
{
11
char
*
src
= &
s
[0];
12
char
*
dst
=
src
;
13
while
( *
src
)
14
{
15
if
(
src
[0] ==
'/'
&&
src
[1] ==
'/'
)
16
{
17
src
+= 2;
18
while
( *
src
&& *
src
!=
'\n'
)
19
src
++;
20
if
( *
src
)
21
src
++;
// skip newline
22
}
23
else
if
(
src
[0] ==
'/'
&&
src
[1] ==
'*'
)
24
{
25
src
+= 2;
26
char
* newsrc =
strstr
(
src
,
"*/"
);
27
if
( !newsrc )
28
break
;
29
src
= newsrc;
30
//while ( *src && ( src[0] != '*' || src[1] != '/' ) )
31
// src++;
32
if
( *
src
)
src
++;
33
if
( *
src
)
src
++;
34
}
35
else
if
(
src
[0] ==
'\r'
&& strip_lf )
36
src
++;
37
else
38
*
dst
++ = *
src
++;
39
}
40
*
dst
=
'\0'
;
41
42
s
.resize (
dst
-&
s
[0] );
43
}
strstr
char * strstr(char *String1, char *String2)
Definition:
utclib.c:653
s
GLdouble s
Definition:
gl.h:2039
src
GLenum src
Definition:
glext.h:6340
dst
GLenum GLenum dst
Definition:
glext.h:6340
strip_comments
void strip_comments(std::string &s, bool strip_lf)
Definition:
strip_comments.cpp:9
strip_comments.h
modules
rosapps
applications
sysutils
utils
sdkparse
strip_comments.cpp
Generated on Mon Mar 17 2025 06:06:50 for ReactOS by
1.9.6