[FFmpeg-devel] [GASPP PATCH 1/2] Handle line continuations within gas-preprocessor
Martin Storsjö
martin at martin.st
Wed Sep 23 09:39:16 EEST 2020
If preprocessing with cl.exe, the preprocessor doesn't take care of
concatenating continued lines.
---
gas-preprocessor.pl | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 126ee50..e9baeba 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -295,12 +295,11 @@ while (<INPUT>) {
s/\r$//;
foreach my $subline (split(";", $_)) {
- # Add newlines at the end of lines that don't already have one
chomp $subline;
- $subline .= "\n";
- parse_line($subline);
+ parse_line_continued($subline);
}
}
+parse_line_continued("");
sub eval_expr {
my $expr = $_[0];
@@ -383,6 +382,20 @@ sub parse_if_line {
return 0;
}
+my $last_line = "";
+sub parse_line_continued {
+ my $line = $_[0];
+ $last_line .= $line;
+ if ($last_line =~ /\\$/) {
+ $last_line =~ s/\\$//;
+ } else {
+ # Add newlines at the end of lines after concatenation.
+ $last_line .= "\n";
+ parse_line($last_line);
+ $last_line = "";
+ }
+}
+
sub parse_line {
my $line = $_[0];
--
2.17.1
More information about the ffmpeg-devel
mailing list