Package: abcm2ps
Version: 8.14.11
Severity: wishlist
Tags: patch

Hello.
The attached patches update abcm2ps to version 8.14.12.
The first one can be regenerated by uscan and gbp.
Please upload them to the archive.
From: Nicolas Boulenguez <nico...@debian.org>
Subject: [PATCH 1/2] Import abcm2ps_8.14.12.orig.tar.gz

--- a/abcparse.c
+++ b/abcparse.c
@@ -3,7 +3,7 @@
  *
  * This file is part of abcm2ps.
  *
- * Copyright (C) 1998-2020 Jean-François Moine (http://moinejf.free.fr)
+ * Copyright (C) 1998-2021 Jean-François Moine (http://moinejf.free.fr)
  * Adapted from abc2ps, Copyright (C) 1996-1998 Michael Methfessel
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -2040,10 +2040,10 @@
 		case CHAR_NOTE:
 			p = parse_note(p - 1, flags);
 			flags &= ABC_F_GRACE;
-			parse.last_sym->u.note.slur_st = slur;
-			slur = 0;
-			if (parse.last_sym->u.note.notes[0].len > 0) /* if not space */
-				curvoice->last_note = parse.last_sym;
+			if (slur && parse.last_sym->u.note.notes[0].len) {
+				parse.last_sym->u.note.slur_st = slur;
+				slur = 0;
+			}
 			break;
 		case CHAR_SLASH:		/* '/' */
 			if (flags & ABC_F_GRACE)
@@ -2078,9 +2078,10 @@
 			if (p[1] != ':') {
 				p = parse_note(p - 1, flags); /* chord */
 				flags &= ABC_F_GRACE;
-				parse.last_sym->u.note.slur_st = slur;
-				slur = 0;
-				curvoice->last_note = parse.last_sym;
+				if (slur && parse.last_sym->u.note.notes[0].len) {
+					parse.last_sym->u.note.slur_st = slur;
+					slur = 0;
+				}
 				break;
 			}
 
@@ -2271,7 +2272,6 @@
 			}
 			if (p[-1] == '<')
 				i = -i;
-			broken_rhythm(curvoice->last_note, i);
 			curvoice->last_note->u.note.brhythm = i;
 			break;
 		case CHAR_IGN:			/* '*' & '`' */
@@ -2496,8 +2496,11 @@
 
 do_brhythm:
 	if (curvoice->last_note
-	 && curvoice->last_note->u.note.brhythm != 0)
+	 && curvoice->last_note->u.note.brhythm != 0) {
+		broken_rhythm(curvoice->last_note,
+				curvoice->last_note->u.note.brhythm);
 		broken_rhythm(s, -curvoice->last_note->u.note.brhythm);
+	}
 add_deco:
 	if (dc.n > 0) {
 		memcpy(s->abc_type != ABC_T_MREST ? &s->u.note.dc
@@ -2511,6 +2514,8 @@
 		syntax("Not a note in grace note sequence", p);
 		goto err;
 	}
+	if (s->u.note.notes[0].len > 0) /* if not space */
+		curvoice->last_note = s;
 	return p;
 
 err:
--- a/buffer.c
+++ b/buffer.c
@@ -29,7 +29,7 @@
 static float ln_scale[BUFFLN];	/* scale of buffered lines */
 static signed char ln_font[BUFFLN];	/* font of buffered lines */
 static float cur_lmarg = 0;	/* current left margin */
-static float min_lmarg, max_rmarg;	/* margins for -E/-g */
+static float max_rmarg;		/* margins for -E/-g */
 static float cur_scale = 1.0;	/* current scale */
 static float maxy;		/* usable vertical space in page */
 static float remy;		/* remaining vertical space in page */
@@ -129,8 +129,7 @@
 /* (used only with eps -E and svg -g) */
 void marg_init(void)
 {
-	min_lmarg = cfmt.pagewidth;
-	max_rmarg = cfmt.pagewidth;
+	cur_lmarg = max_rmarg = 0;
 }
 
 /* -- initialize the postscript file (PS or EPS) -- */
@@ -141,11 +140,10 @@
 	char version[] = "/creator [(abcm2ps) " VERSION "] def";
 
 	if (epsf) {
-		cur_lmarg = min_lmarg - 10;
 		fprintf(fout, "%%!PS-Adobe-2.0 EPSF-2.0\n"
 			"%%%%BoundingBox: 0 0 %.0f %.0f\n",
 			((p_fmt->landscape ? p_fmt->pageheight : p_fmt->pagewidth)
-				- cur_lmarg - max_rmarg + 10) * PPI_96_72,
+				- cur_lmarg - max_rmarg) * PPI_96_72,
 			-bposy * PPI_96_72);
 		marg_init();
 	} else {
@@ -233,7 +231,6 @@
 /* -- initialize the svg file (option '-g') -- */
 static void init_svg(char *str)
 {
-	cur_lmarg = min_lmarg - 10;
 	output = svg_output;
 #if 1 //fixme:test
 	if (file_initialized > 0)
@@ -241,7 +238,7 @@
 #endif
 	define_svg_symbols(str, nepsf,
 		(p_fmt->landscape ? p_fmt->pageheight : p_fmt->pagewidth)
-				- cur_lmarg - max_rmarg + 10,
+				- cur_lmarg - max_rmarg,
 		-bposy);
 	file_initialized = 1;
 	user_ps_write();
@@ -732,7 +729,6 @@
 		close_fout();
 	else
 		file_initialized = 0;
-	cur_lmarg = 0;
 	cur_scale = 1.0;
 }
 
@@ -937,12 +933,6 @@
 	ln_buf[ln_num] = mbf;
 	ln_pos[ln_num] = multicol_start == 0 ? bposy : 1;
 	ln_lmarg[ln_num] = cfmt.leftmargin;
-	if (epsf) {
-		if (cfmt.leftmargin < min_lmarg)
-			min_lmarg = cfmt.leftmargin;
-		if (cfmt.rightmargin < max_rmarg)
-			max_rmarg = cfmt.rightmargin;
-	}
 	ln_scale[ln_num] = cfmt.scale;
 	ln_font[ln_num] = outft;
 	ln_num++;
--- a/configure
+++ b/configure
@@ -1,17 +1,17 @@
 #! /bin/sh
 
 # (automatic update)
-VERSION=8.14.11
-VDATE=2020-12-05
+VERSION=8.14.12
+VDATE=2021-07-14
 
-CC=gcc
-PKG_CONFIG=pkg-config
-CFLAGS="-g -O2 -Wall -pipe"
+: "${CC:=gcc}"
+: "${PKG_CONFIG:=pkg-config}"
+CFLAGS="-g -O2 -Wall -pipe $CFLAGS"
 
 srcdir=.
-prefix=/usr/local
+: "${prefix=/usr/local}"
 
-INSTALL="/usr/bin/install -c"
+: "${INSTALL:=/usr/bin/install -c}"
 
 if test -f ./custom; then
 	. ./custom
@@ -58,19 +58,13 @@
 	DEFAULT_FDIR="$prefix/share/abcm2ps"
 fi
 
-if which $PKG_CONFIG > /dev/null ; then
-	if $PKG_CONFIG --exists freetype2 ; then
-		if $PKG_CONFIG --exists pangocairo ; then
-			CPPFLAGS="$CPPFLAGS -DHAVE_PANGO=1 `$PKG_CONFIG pango cairo freetype2 --cflags`"
-			LDLIBS="$LDLIBS `$PKG_CONFIG pangocairo pangoft2 freetype2 --libs`"
-		else
-			echo "pangocairo not found - no pango support"
-		fi
-	else
-		echo "freetype2 not found - no pango support"
-	fi
+if ! $PKG_CONFIG --exists freetype2 ; then
+	echo "pkg-config/freetype2 not found - no pango support"
+elif ! $PKG_CONFIG --exists pangocairo ; then
+	echo "pangocairo not found - no pango support"
 else
-	echo "pkg-config not found - no pango support"
+	CPPFLAGS="$CPPFLAGS -DHAVE_PANGO=1 `$PKG_CONFIG pango cairo freetype2 --cflags`"
+	LDLIBS="`$PKG_CONFIG pangocairo pangoft2 freetype2 --libs` $LDLIBS"
 fi
 
 CPPFLAGS="$CPPFLAGS -I."
--- a/deco.c
+++ b/deco.c
@@ -3,7 +3,7 @@
  *
  * This file is part of abcm2ps.
  *
- * Copyright (C) 2000-2019 Jean-François Moine (http://moinejf.free.fr)
+ * Copyright (C) 2000-2021 Jean-François Moine (http://moinejf.free.fr)
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -1182,7 +1182,8 @@
 		case 34:		/* trem1..trem4 */
 			if (s->abc_type != ABC_T_NOTE
 			 || !prev
-			 || prev->abc_type != ABC_T_NOTE) {
+			 || prev->abc_type != ABC_T_NOTE
+			 || s->dur != prev->dur) {
 				error(1, s,
 					"!%s! must be on the last of a couple of notes",
 					dd->name);
--- a/draw.c
+++ b/draw.c
@@ -4389,7 +4389,8 @@
 	y = 0;
 	if (staff > nstaff) {
 		staff--;			/* one staff, empty */
-	} else {
+//	} else {
+	} {
 		for (i = 0; i < YSTEP; i++) {
 			v = staff_tb[staff].top[i];
 			if (y < v)
@@ -4400,9 +4401,6 @@
 	/* draw the parts and tempo indications if any */
 	y += draw_partempo(staff, y);
 
-	if (empty[staff])
-		return y;
-
 	y *= staff_tb[staff].staffscale;
 	staffsep = cfmt.staffsep * 0.5 +
 			staff_tb[staff].topbar * staff_tb[staff].staffscale;
--- a/format.c
+++ b/format.c
@@ -1140,6 +1140,8 @@
 			f = strtod(p, &q);
 			if (*q != '\0' && *q != ' ')
 				goto bad;
+			if (f < .1 || f > 10.)
+				goto bad;
 			cfmt.scale = f / 0.75;		// old -> new scale
 			return;
 		}
--- a/front.c
+++ b/front.c
@@ -582,13 +582,14 @@
 					goto next_eol;
 				}
 			}
-			if (strncmp("ps", (char *) begin_end, end_len) == 0) {
-				if (*s == '%')
-					goto ignore;		/* comment */
-			} else {
-				if (*s == '%' && strchr(prefix, s[1])) {
-					s += 2;
-					l -= 2;
+
+			// ignore '%' or '%%' at start of line
+			if (*s == '%') {
+				s++;
+				l--;
+				if (*s == '%') {
+					s++;
+					l--;
 				}
 			}
 			goto next;
--- a/music.c
+++ b/music.c
@@ -3,7 +3,7 @@
  *
  * This file is part of abcm2ps.
  *
- * Copyright (C) 1998-2019 Jean-François Moine (http://moinejf.free.fr)
+ * Copyright (C) 1998-2021 Jean-François Moine (http://moinejf.free.fr)
  * Adapted from abc2ps, Copyright (C) 1996-1998 Michael Methfessel
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -1975,7 +1975,7 @@
 				break;
 			goto cut_here;
 		}
-		if (s->extra) {
+		if (s->extra && s->type != GRACE) {
 			if (!extra)
 				extra = s;
 			else
@@ -2917,7 +2917,8 @@
 			if (u->ymn < stb[staff].st[i].ymn)
 				stb[staff].st[i].ymn = u->ymn;
 			if (u->sflags & S_XSTEM) {
-				if (u->ts_prev->staff != staff - 1
+				if (!u->ts_prev
+				 || u->ts_prev->staff != staff - 1
 				 || u->ts_prev->abc_type != ABC_T_NOTE) {
 					error(1, s, "Bad !xstem!");
 					u->sflags &= ~S_XSTEM;
--- a/parse.c
+++ b/parse.c
@@ -3,7 +3,7 @@
  *
  * This file is part of abcm2ps.
  *
- * Copyright (C) 1998-2020 Jean-François Moine (http://moinejf.free.fr)
+ * Copyright (C) 1998-2021 Jean-François Moine (http://moinejf.free.fr)
  * Adapted from abc2ps, Copyright (C) 1996-1998 Michael Methfessel
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -214,7 +214,7 @@
 	struct SYMBOL *s, *prev, *s2;
 	struct VOICE_S *p_voice;
 	int fl, voice, time, w, wmin, multi, mrest_time;
-	int nb, r, set_sy, new_sy;	// nv
+	int nb, r, r2, v2, set_sy, new_sy;	// nv
 	struct SYMBOL *vtb[MAXVOICE];
 	signed char vn[MAXVOICE];	/* voice indexed by range */
 
@@ -233,8 +233,7 @@
 	for (;;) {
 		if (set_sy) {
 		    fl = 1;			// start a new sequence
-//		    if (!new_sy) {
-		    if (1) {
+		    if (!new_sy) {
 			set_sy = 0;
 			multi = -1;
 			memset(vn, -1, sizeof vn);
@@ -354,7 +353,6 @@
 			 || w_tb[s->type] != wmin)
 				continue;
 			if (s->type == STAVES) {	// change STAVES to a flag
-				sy = sy->next;
 				set_sy = new_sy = 1;
 				if (s->prev)
 					s->prev->next = s->next;
@@ -362,6 +360,20 @@
 					voice_tb[voice].sym = s->next;
 				if (s->next)
 					s->next->prev = s->prev;
+
+				// set all voices of previous and next staff systems
+				// as reachable
+				for (r2 = 0; r2 < MAXVOICE; r2++) {
+					if (vn[r2] < 0)
+						break;
+				}
+				for (v2 = 0; v2 < MAXVOICE; v2++) {
+					if (sy->next->voice[v2].range < 0
+					 || sy->voice[v2].range >= 0)
+						continue;
+					vn[r2++] = v2;
+				}
+				sy = sy->next;		// new staff system
 			} else {
 				if (fl) {
 					fl = 0;
@@ -468,25 +480,6 @@
 				}
 				break;
 #endif
-			case FMTCHG:
-				s2 = s->extra;
-				if (s2) {	/* dummy format */
-					if (!ns)
-						ns = s2;
-					if (s->prev) {
-						s->prev->next = s2;
-						s2->prev = s->prev;
-					}
-					if (!s->next) {
-						ns = NULL;
-						break;
-					}
-					while (s2->next)
-						s2 = s2->next;
-					s->next->prev = s2;
-					s2->next = s->next;
-				}
-				/* fall thru */
 			case TEMPO:
 			case PART:
 			case TUPLET:
@@ -554,8 +547,11 @@
 			}
 			if (!ns)
 				continue;
+			s2 = s->extra;			// old compression
 			s->extra = ns;
-			s->prev->next = NULL;
+			s->prev->next = s2;
+			if (s2)
+				s2->prev = s->prev;
 			s->prev = ns->prev;
 			if (s->prev)
 				s->prev->next = s;
@@ -717,6 +713,8 @@
 			 && s2->time != 0)
 				break;
 		}
+		if (!s2)
+			return s2;
 		if (s2->time < voice_tb[cursys->top_voice].meter.wmeasure)
 			s = s2;
 		goto chk_time;
@@ -913,6 +911,8 @@
 				break;
 
 			/* move the clef */
+			if (!s->next)
+				break;
 			s->next->prev = s->prev;
 			s->prev->next = s->next;
 			s->ts_next->ts_prev = s->ts_prev;
@@ -2011,9 +2011,12 @@
 			error(1, s, "Erroneous end of voice overlap");
 			return;
 		}
-		if (p_voice->time != over_mxtime)
-			error(1, s, tx_wrong_dur);
 		curvoice = &voice_tb[over_voice];
+		if (p_voice->time != over_mxtime) {
+			error(1, s, tx_wrong_dur);
+			if (p_voice->time > over_mxtime)
+				curvoice->time = p_voice->time;
+		}
 		over_mxtime = 0;
 		over_voice = -1;
 		over_time = -1;
@@ -2115,8 +2118,12 @@
 	} else {
 		if (over_mxtime == 0)
 			over_mxtime = p_voice->time;
-		else if (p_voice->time != over_mxtime)
+		else if (p_voice->time != over_mxtime) {
 			error(1, s, tx_wrong_dur);
+			if (p_voice->time > over_mxtime)
+				voice_tb[over_voice].time =
+					over_mxtime = p_voice->time;
+		}
 	}
 	p_voice2->time = over_time;
 	curvoice = p_voice2;
@@ -2339,8 +2346,7 @@
 		if (p_voice->sym)
 			flags = 1;
 	}
-	if (flags == 0			/* if first %%staves */
-	 || (maxtime == 0 && staves_found < 0)) {
+	if (flags == 0) {			/* if first %%staves */
 		for (voice = 0; voice < MAXVOICE; voice++)
 			parsys->voice[voice].range = -1;
 	} else {
@@ -3061,7 +3067,8 @@
 		s = get_global_def(s);
 		break;
 	case 'U':
-		deco[s->u.user.symbol] = parse.deco_tb[s->u.user.value - 128];
+		if (s->u.user.value)	// if no error
+			deco[s->u.user.symbol] = parse.deco_tb[s->u.user.value - 128];
 		break;
 	case 'u':
 		break;
@@ -3623,6 +3630,8 @@
 			continue;
 		case ABC_T_TUPLET:
 			set_tuplet(s);
+			if (!s->type && (s->flags & ABC_F_GR_END))
+				curvoice->last_sym->flags |= ABC_F_GR_END;
 			break;
 		default:
 			continue;
@@ -6156,6 +6165,13 @@
 
 	r = t->u.tuplet.r_plet;
 	grace = t->flags & ABC_F_GRACE;
+	if (t->flags & ABC_F_GR_END) {
+		if (r != 1) {
+			error(1, t, "Empty tuplet");
+			return;
+		}
+		grace = 0;
+	}
 
 	l = 0;
 	for (s = t->abc_next; s; s = s->abc_next) {
@@ -6217,13 +6233,22 @@
 		}
 		if (s->u.note.notes[0].len == 0)	/* space ('y') */
 			continue;
-		if (grace ^ (s->flags & ABC_F_GRACE))
-			continue;
+		if (grace) {
+			if (!(s->flags & ABC_F_GRACE)) {
+				error(1, t, "End of tuplet before end of grace sequence");
+				return;
+			}
+		} else if (s->flags & ABC_F_GRACE)
+			continue;		// skip the grace note
 		s1 = s;
 		l += s->dur;
 		if (--r <= 0)
 			break;
 	}
+	if (!l) {
+		error(1, t, "No note in the tuplet");
+		return;
+	}
 	if (!s) {
 		error(1, t, "End of tune found inside a tuplet");
 		return;
--- a/svg.c
+++ b/svg.c
@@ -1148,7 +1148,7 @@
 		"<style type=\"text/css\">\n"
 		".fill {fill: currentColor}\n"
 		".stroke {stroke: currentColor; fill: none}\n"
-		"text{white-space: pre}\n";
+		"text{white-space:pre; fill:currentColor}\n";
 	static const char svg_font_style[] =
 		".music {font:24px %s;\n"
 		"	fill: currentColor}\n";
@@ -1203,7 +1203,6 @@
 			fprintf(fout,
 				"}\n"
 				"\t@page {margin: 0}\n"
-				"\ttext {white-space: pre; fill:currentColor}\n"
 				"\tsvg {display: block}\n"
 				"</style>\n"
 				"<title>%s</title>\n"

From: Nicolas Boulenguez <nico...@debian.org>
Subject: [PATCH 2/2] Update packaging for 8.14.12, style issues

* Standards-Version: 4.6.0.
* Only force build system for the affected debhelper command.
* It is now possible to let debhelper configure the build via the
  environment, without help by debian/rules.
* Remove obsolete Homepage fromt upstream metadata.

--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+abcm2ps (8.14.12-0.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * New upstream release.
+  * Standards-Version: 4.6.0.
+  * Only force build system for the affected debhelper command.
+  * It is now possible to let debhelper configure the build via the
+    environment, without help by debian/rules.
+  * Remove obsolete Homepage fromt upstream metadata.
+
+ -- Nicolas Boulenguez <nico...@debian.org>  Sat, 18 Sep 2021 14:30:55 +0000
+
 abcm2ps (8.14.11-0.1) unstable; urgency=medium
 
   * Non-maintainer upload.
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@
  libpango1.0-dev,
  pkg-config,
  python3-docutils,
-Standards-Version: 4.5.1
+Standards-Version: 4.6.0
 Rules-Requires-Root: no
 Homepage: http://moinejf.free.fr/
 
--- a/debian/copyright
+++ b/debian/copyright
@@ -4,7 +4,7 @@
 Source: http://moinejf.free.fr/
 
 Files: *
-Copyright: 1998-2020 Jean-François Moine (http://moinejf.free.fr)
+Copyright: 1998-2021 Jean-François Moine (http://moinejf.free.fr)
            1996-1998 Michael Methfessel <m...@ihp-ffo.de>
 License: GPL-3+
  This program is free software: you can redistribute it and/or modify
@@ -23,7 +23,7 @@
 
 Files: debian/*
 Copyright: 2004-2018 Anselm Lingnau <ling...@debian.org>
-           2018-2020 Nicolas Boulenguez <nico...@debian.org»
+           2018-2021 Nicolas Boulenguez <nico...@debian.org»
 License: GPL-2+
  This program is free software; you can redistribute it
  and/or modify it under the terms of the GNU General Public
--- a/debian/rules
+++ b/debian/rules
@@ -1,14 +1,10 @@
 #!/usr/bin/make -f
 
-DEB_BUILD_MAINT_OPTIONS := hardening=+all
-DEB_CFLAGS_MAINT_APPEND := -Wall
-include /usr/share/dpkg/buildtools.mk
-include /usr/share/dpkg/buildflags.mk
+export DEB_BUILD_MAINT_OPTIONS := hardening=+all
 
 %:
-	dh $@ --buildsystem=autoconf
+	dh $@
 
 .PHONY: override_dh_auto_configure
 override_dh_auto_configure:
-	dh_auto_configure -- \
-	  $(foreach v,CC PKG_CONFIG CFLAGS CPPFLAGS LDFLAGS,'--$(v)=$($(v))')
+	dh_auto_configure --buildsystem=autoconf
--- a/debian/upstream/metadata
+++ b/debian/upstream/metadata
@@ -1,6 +1,5 @@
 Contact: moin...@free.fr
 Name: abcm2ps
-Homepage: http://moinejf.free.fr/
 Repository: https://github.com/leesavide/abcm2ps.git
 Repository-Browse: https://github.com/leesavide/abcm2ps/
 Bug-Submit: https://github.com/leesavide/abcm2ps/issues

Reply via email to