groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff-commit] [groff] 01/01: Add glilypond detection to grog.pl


From: Bernd Warken
Subject: [Groff-commit] [groff] 01/01: Add glilypond detection to grog.pl
Date: Fri, 14 Feb 2014 13:06:26 +0000

bwarken pushed a commit to branch master
in repository groff.

commit c82e9a5ae45ca06ea95fa22b0f7fd37ad0e64be6
Author: Bernd Warken <address@hidden>
Date:   Fri Feb 14 14:06:10 2014 +0100

    Add glilypond detection to grog.pl
---
 ChangeLog                                |    6 +++
 contrib/glilypond/ChangeLog              |    5 ++
 contrib/glilypond/examples/example.groff |   18 +++++++++
 src/roff/grog/grog.pl                    |   60 +++++++++++++++++++++++++++---
 4 files changed, 83 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d472a9..9c2c775 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-14  Bernd Warken  <address@hidden>
+
+       * src/roff/grog/grog.pl: Add detection of glilypond-parts in groff
+       files.  For example `grog example.groff' from the glilypond source
+       gets `glilypond example.groff | groff'.
+
 2014-02-12  Bernd Warken  <address@hidden>
 
        * src/roff/grog/grog.pl: With the former bugfix of 2014-02-12,
diff --git a/contrib/glilypond/ChangeLog b/contrib/glilypond/ChangeLog
index e7495fa..c0a34fa 100644
--- a/contrib/glilypond/ChangeLog
+++ b/contrib/glilypond/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-14  Bernd Warken  <address@hidden>
+
+       * contrib/glilypond/examples/example.groff: Add this directory and
+       this file.
+
 2014-01-06  Bernd Warken  <address@hidden>
 
        Remove archive address@hidden:RUNOFF/groff_lilypond.git
diff --git a/contrib/glilypond/examples/example.groff 
b/contrib/glilypond/examples/example.groff
new file mode 100644
index 0000000..dff84d2
--- /dev/null
+++ b/contrib/glilypond/examples/example.groff
@@ -0,0 +1,18 @@
+before
+.lilypond start
+\version "2.14.2"
+\relative c'' {
+  \key c \minor
+  g(
+  <ees c'>)
+  <d f gis b>-.
+  <ees g bes>-.
+}
+\paper {
+   oddHeaderMarkup = #f
+   evenHeaderMarkup = #f
+   oddFooterMarkup = #f
+   evenFooterMarkup = #f
+}
+.lilypond end
+after
diff --git a/src/roff/grog/grog.pl b/src/roff/grog/grog.pl
index 12aaace..0c39e6a 100644
--- a/src/roff/grog/grog.pl
+++ b/src/roff/grog/grog.pl
@@ -6,7 +6,8 @@
 # Source file position: <groff-source>/src/roff/grog/grog.pl
 # Installed position: <prefix>/bin/grog
 
-# Copyright (C) 1993, 2006, 2009, 2011-2012, 2014 Free Software Foundation, 
Inc.
+# Copyright (C) 1993, 2006, 2009, 2011-2012, 2014
+#               Free Software Foundation, Inc.
 # Written by James Clark, maintained by Werner Lemberg.
 # Rewritten and put under GPL by Bernd Warken <address@hidden>.
 
@@ -14,7 +15,7 @@
 
 # `groff' is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License (GPL) as published
-# by the Free Software Foundation, either version 3 of the License, or
+# by the Free Software Foundation, either version 2 of the License, or
 # (at your option) any later version.
 
 # `groff' is distributed in the hope that it will be useful, but
@@ -26,7 +27,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 ########################################################################
-my $Last_Update = '12 Feb 2014';
+my $Last_Update = '14 Feb 2014';
 ########################################################################
 
 require v5.6;
@@ -46,7 +47,34 @@ my $Sp = qr([\s\n]);
 
 my @Command;                   # stores the final output
 my @Mparams;                   # stores the options -m*
-my %Groff;
+my %Groff = (
+            'chem' => 0,
+            'eqn' => 0,
+            'grap' => 0,
+            'grn' => 0,
+            'lilypond' => 0,
+            'mdoc' => 0,
+            'mdoc_old' => 0,
+            'me' => 0,
+            'mm' => 0,
+            'mom' => 0,
+            'ILP' => 0,
+            'LP' => 0,
+            'NH' => 0,
+            'Oo' => 0,
+            'P' => 0,
+            'PP' => 0,
+            'SH' => 0,
+            'TL' => 0,
+            'TH' => 0,
+            'TL' => 0,
+            'pic' => 0,
+            'refer' => 0,
+            'refer_open' => 0,
+            'refer_close' => 0,
+            'soelim' => 0,
+            'tbl' => 0,
+);
 
 {
   my @filespec = ();
@@ -146,7 +174,10 @@ sub process {
     }
 
 
-    if (/^(.cstart)|(begin\s+chem)$/) {
+    if (/^\.lilypond/) {
+      $Groff{'lilypond'}++;
+      $Groff{'soelim'}++ if $level;
+    } elsif (/^(\.cstart)|(begin\s+chem)$/) {
       $Groff{'chem'}++;
       $Groff{'soelim'}++ if $level;
     } elsif (/^\.TS$Sp/) {
@@ -317,6 +348,11 @@ sub version {
   my $is_man = 0;
   my $is_mm = 0;
   my $is_mom = 0;
+  my @preprograms = ();
+
+  if ( $Groff{'lilypond'} ) {
+    push @preprograms, 'glilypond';
+  }
 
   $Groff{'refer'} ||= $Groff{'refer_open'} && $Groff{'refer_close'};
 
@@ -368,7 +404,19 @@ sub version {
   }
 
   unshift @Command, 'groff';
-  push(@Command, @ARGV);
+  if ( @preprograms ) {
+    my @progs;
+    $progs[0] = shift @preprograms;
+    push(@progs, @ARGV);
+    for ( @preprograms ) {
+      push @progs, '|';
+      push @progs, $_;
+    }
+    push @progs, '|';
+    unshift @Command, @progs;
+  } else {
+    push(@Command, @ARGV);
+  }
 
   foreach (@Command) {
     next unless /\s/;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]