From f5d34ea1f66a13dc1fc28a459ac503ce02b565f0 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 15 Jul 2019 00:57:29 -0400 Subject: scripts/gen-mplus-patch.pl: Improve REs --- diff --git a/scripts/gen-mplus-patch.pl b/scripts/gen-mplus-patch.pl index 1d0650c..290cb1d 100755 --- a/scripts/gen-mplus-patch.pl +++ b/scripts/gen-mplus-patch.pl @@ -38,10 +38,10 @@ sub header next; } $version = $entry->string(); - $version =~ s{\AVersion\s1[.]}{}msx; + $version =~ s{\AVersion\s1[.]}{}msxa; } - ($header = <<" EOF") =~ s{^\t\t}{}msxg; + ($header = <<" EOF") =~ s{^\t\t}{}msxag; Author: Patrick McDermott Subject: Add M+ fonts @@ -82,14 +82,14 @@ sub patch_font_h $new = $old = extract('include/linux/font.h'); # Inject "#define"s. - ($i) = $old =~ m{.*^[#]\s*define\s+[A-Za-x0-9_]+_IDX\s+(\d+)\s*$}msx; + ($i) = $old =~ m{.*^[#]\s*define\s+[A-Za-x0-9_]+_IDX\s+(\d+)\s*$}msxa; $inject = ''; foreach my $font (@FONTS) { ($face, $weight, $width, $height) = @$font; $inject .= sprintf("#define MPLUS_%s_%s_%dx%d_IDX\t%d\n", uc($face), uc($weight), $width, $height, ++$i); } $new =~ s{\A(.*^[#]\s*define\s+[A-Za-z0-9_]+_IDX\s+\d+\s*$)} - {$1$inject}msx; + {$1$inject}msxa; # Inject "struct font_desc" declarations. $inject = ''; @@ -97,7 +97,7 @@ sub patch_font_h $inject .= sprintf(",\n\t\t\tfont_mplus_%s_%s_%dx%d", $face, $weight, $width, $height); } - $new =~ s{(extern\sconst\sstruct\sfont_desc[^;]+);}{$1$inject;}msx; + $new =~ s{(extern\sconst\sstruct\sfont_desc[^;]+);}{$1$inject;}msxa; return make_patch('include/linux/font.h', $old, $new); } @@ -126,7 +126,8 @@ sub patch_kconfig "sophisticated and relaxed design that\n\t balances " . "natural letterform and high legibility.\n\n"; } - $new =~ s{^(\s*config\s+FONT_AUTOSELECT\s*)$}{$inject$1}msx; + $new =~ s{ ^ ( [ \t]* config [ \t]+ FONT_AUTOSELECT [ \t]* ) $ } + {$inject$1}msxa; $inject = ''; foreach my $font (@FONTS) { ($face, $weight, $width, $height) = @$font; @@ -134,7 +135,7 @@ sub patch_kconfig uc($face), uc($weight), $width, $height); } $new =~ s{ ^ ( \s* select \s+ FONT_[A-Za-z0-9_]+ \s* ) $ } - {$inject$1}msx; + {$inject$1}msxa; return make_patch('lib/fonts/Kconfig', $old, $new); } @@ -175,7 +176,7 @@ sub patch_makefile font-objs-\$[(]CONFIG_FONT_[A-Za-z0-9_]+[)] \s* [+]= \s* font_[a-z0-9_]+[.]o \s* - $ ) }{$1$inject}msx; + $ ) }{$1$inject}msxa; return make_patch('lib/fonts/Makefile', $old, $new); } @@ -203,7 +204,7 @@ sub patch_fonts_c $new =~ s< ( \s* static \s* const \s* struct \s* font_desc \s* [*] \s* fonts\[\] \s* = \s* { [^}]+ ) } - ><$1$inject}>msx; + ><$1$inject}>msxa; return make_patch('lib/fonts/fonts.c', $old, $new); } -- cgit v0.9.1