Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
1194a41c
Commit
1194a41c
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: scrap a bunch of debugging lines -- they obscure the logic
parent
eba470a8
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/color.c
+7
-39
src/color.c
with
7 additions
and
39 deletions
+7
-39
src/color.c
View file @
1194a41c
...
...
@@ -404,23 +404,18 @@ void precalc_multicolorinfo(void)
return
;
#ifdef DEBUG
fprintf
(
stderr
,
"
Entering p
recalculati
on of
multiline color info
\n
"
);
fprintf
(
stderr
,
"
P
recalculati
ng the
multiline color info
...
\n
"
);
#endif
for
(
ink
=
openfile
->
colorstrings
;
ink
!=
NULL
;
ink
=
ink
->
next
)
{
/* If this is not a multi-line regex, skip it. */
if
(
ink
->
end
==
NULL
)
continue
;
#ifdef DEBUG
fprintf
(
stderr
,
"Starting work on color id %d
\n
"
,
ink
->
id
);
#endif
for
(
fileptr
=
openfile
->
fileage
;
fileptr
!=
NULL
;
fileptr
=
fileptr
->
next
)
{
int
startx
=
0
,
nostart
=
0
;
int
linelen
=
strlen
(
fileptr
->
data
);
#ifdef DEBUG
fprintf
(
stderr
,
"working on lineno %ld... "
,
(
long
)
fileptr
->
lineno
);
#endif
alloc_multidata_if_needed
(
fileptr
);
while
((
nostart
=
regexec
(
ink
->
start
,
&
fileptr
->
data
[
startx
],
1
,
...
...
@@ -431,9 +426,7 @@ void precalc_multicolorinfo(void)
if
(
startx
>
linelen
)
break
;
#ifdef DEBUG
fprintf
(
stderr
,
"start found at pos %lu... "
,
(
unsigned
long
)
startx
);
#endif
/* Look first on this line for an end. */
if
(
regexec
(
ink
->
end
,
&
fileptr
->
data
[
startx
],
1
,
&
endmatch
,
(
startx
==
0
)
?
0
:
REG_NOTBOL
)
==
0
)
{
...
...
@@ -443,60 +436,35 @@ void precalc_multicolorinfo(void)
endmatch
.
rm_so
==
endmatch
.
rm_eo
)
startx
+=
1
;
fileptr
->
multidata
[
ink
->
id
]
=
CSTARTENDHERE
;
#ifdef DEBUG
fprintf
(
stderr
,
"end found on this line
\n
"
);
#endif
continue
;
}
/* Nice, we didn't find the end regex on this line. Let's start looking for it. */
for
(
endptr
=
fileptr
->
next
;
endptr
!=
NULL
;
endptr
=
endptr
->
next
)
{
#ifdef DEBUG
fprintf
(
stderr
,
"
\n
advancing to line %ld to find end... "
,
(
long
)
endptr
->
lineno
);
#endif
if
(
regexec
(
ink
->
end
,
endptr
->
data
,
1
,
&
endmatch
,
0
)
==
0
)
break
;
}
if
(
endptr
==
NULL
)
{
#ifdef DEBUG
fprintf
(
stderr
,
"no end found, breaking out
\n
"
);
#endif
if
(
endptr
==
NULL
)
break
;
}
#ifdef DEBUG
fprintf
(
stderr
,
"end found
\n
"
);
#endif
/* We found it, we found it, la la la la la. Mark all
* the lines in between and the end properly. */
fileptr
->
multidata
[
ink
->
id
]
=
CENDAFTER
;
#ifdef DEBUG
fprintf
(
stderr
,
"marking line %ld as CENDAFTER
\n
"
,
(
long
)
fileptr
->
lineno
);
#endif
for
(
fileptr
=
fileptr
->
next
;
fileptr
!=
endptr
;
fileptr
=
fileptr
->
next
)
{
alloc_multidata_if_needed
(
fileptr
);
fileptr
->
multidata
[
ink
->
id
]
=
CWHOLELINE
;
#ifdef DEBUG
fprintf
(
stderr
,
"marking intermediary line %ld as CWHOLELINE
\n
"
,
(
long
)
fileptr
->
lineno
);
#endif
}
alloc_multidata_if_needed
(
endptr
);
fileptr
->
multidata
[
ink
->
id
]
=
CBEGINBEFORE
;
#ifdef DEBUG
fprintf
(
stderr
,
"marking line %ld as CBEGINBEFORE
\n
"
,
(
long
)
fileptr
->
lineno
);
#endif
/* Skip to the end point of the match. */
startx
=
endmatch
.
rm_eo
;
#ifdef DEBUG
fprintf
(
stderr
,
"jumping to line %ld pos %lu to continue
\n
"
,
(
long
)
fileptr
->
lineno
,
(
unsigned
long
)
startx
);
#endif
}
if
(
nostart
&&
startx
==
0
)
{
#ifdef DEBUG
fprintf
(
stderr
,
"no match
\n
"
);
#endif
fileptr
->
multidata
[
ink
->
id
]
=
CNONE
;
continue
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help