From b622a9440fee9aea6d85592f49595ad0b9f0a09f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Mon, 17 Mar 2014 17:18:25 +0100
Subject: [PATCH] graphics: revised g3, adapted wups11a to facilitate
 concatenation

---
 pub/CHANGELOG        |  2 ++
 pub/share/g3.ps      | 21 ++++++++++-----------
 pub/share/wups11a.ps | 40 +++++++++++++++++++++++++++++++++++++++-
 3 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/pub/CHANGELOG b/pub/CHANGELOG
index 45ee0361..f948f379 100644
--- a/pub/CHANGELOG
+++ b/pub/CHANGELOG
@@ -3,6 +3,8 @@ Release
 - bugfix:
   - little bug found thanks to first Clang compilation
 - Doxygen update
+- graphics:
+  - revised g3, adapted wups11a to facilitate concatenation
 
 Release 2.1.8f of 23jan14:
 
diff --git a/pub/share/g3.ps b/pub/share/g3.ps
index 9c233e7e..305910c5 100644
--- a/pub/share/g3.ps
+++ b/pub/share/g3.ps
@@ -1,27 +1,26 @@
 WuGdict11a begin
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%  Customizable plot setup, copied from g3.ps (edit�r: use latin-1)         %%
+%%  Customizable plot setup, copied from g3.ps (edit�r: use latin-1)
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %%  Position and scale:
 
+iFrame 0 eq
+{
 originUpperLeft_A4   
 10 dup autolabel defsiz
 1 dup geld stdred
-2. -11 offset
+2 -11 setnewpage newpage
+1 1 11 13 setpagegrid
 
-%%  Various presets:
+2 8 24 abcset % usage: {(text)} abc
+/EndFrame { nextFrame end } def
 
 1 1 language
 1 1 InfSet % plot fnam, info
 1 dup 2 SymGSet % srad slin serr(2=from pset) : graph symbols, global preset
 % /setboxbackgroundcolor { 0.93 setgray } def % default is white
-2 8 24 abcset % usage: {(text)} abc
-/next{ 12 0 offset } def
-/EndFrame { showpage end } def
-
-%%  Symbols and curve styles:
 
 F /pcol x def % black&white on/off
 { 8 aCol5 iColA } /ipCol x bind def % number of colours and colour style
@@ -31,13 +30,11 @@ F /pcol x def % black&white on/off
 { pcol {  2 1 0 1. 1. pset } { 13 1 0 1. 1. pset  2 ipCol } ifelse }
 { pcol {  2 0 0 1. 1. pset } {  1 0 0 1. 1. pset  3 ipCol } ifelse }
 { pcol {  3 1 0 1. 1. pset } {  1 1 0 .7 1. pset  4 ipCol } ifelse }
-
 { pcol {  3 0 0 1. 1. pset } {  3 0 0 1. 1. pset  5 ipCol } ifelse }
 { pcol {  4 1 0 1. 1. pset } {  3 1 0 .7 1. pset  6 ipCol } ifelse }
 { pcol {  4 0 0 1. 1. pset } {  4 0 0 1. 1. pset  7 ipCol } ifelse }
 { pcol {  5 1 0 1. 1. pset } {  4 1 0 .7 1. pset  0 ipCol } ifelse }
 { pcol {  5 0 0 1. 1. pset } {  5 0 0 1. 1. pset  1 ipCol } ifelse }
-
 { pcol {  5 0 0 1. 1. pset } {  5 1 0 .7 1. pset  2 ipCol } ifelse }
 { pcol {  3 0 0 1. 1. pset } {  2 0 0 1. 1. pset  3 ipCol } ifelse }
 { pcol {  4 1 0 1. 1. pset } {  2 1 0 .7 1. pset  4 ipCol } ifelse }
@@ -49,11 +46,13 @@ T /ccol x def % black&white on/off
 { ccol { 1. [          ] lset } { 1. [] lset  0 icCol } ifelse }
 ] def
 
+} if % iFrame==0
+
 %%  Clear frame:
 
 Resets
 BoxBackground
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%  Mark "ecu", end of the customization section                             %%
+%%  Mark "ecu", end of the customization section
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/pub/share/wups11a.ps b/pub/share/wups11a.ps
index 3d757a5c..e2e64600 100644
--- a/pub/share/wups11a.ps
+++ b/pub/share/wups11a.ps
@@ -82,13 +82,21 @@ WuGdict11a begin
 /cmtranslate { % x y cmtranslate | - 
    cm x cm x translate } bind def
 /originUpperLeft_A4{ .7 28.3 cmtranslate } bind def
+/goffsetA4 { ungscale originUpperLeft_A4 gscale } def
 /EdgeLeftDIN{ originUpperLeft_A4 } bind def % OBSOLETE since 11a
 
 % set absolute global scale and relative symbol size
 /defsiz { % size(cm) symbolsize(rel) | - 
    /ftot x def
-   cm 10 div dup scale % within 'size', coordinates run from 0 to 10
+   /gsiz x cm 10 div def
+   gscale % within 'size', coordinates run from 0 to 10
    } def
+/gscale {
+   gsiz dup scale
+} def
+/ungscale {
+   1 gsiz div dup scale
+} def
 
 % symbol (and label?) size as sublinear function of figure size
 /autolabel { % size(cm) | symbolsize(rel)
@@ -646,6 +654,36 @@ WuGdict11a begin
 
 %%  Some more presets for g3.ps:
 
+/iFrame 0 def
+
+/setnewpage { % xoff yoff
+  /yoffnewpage x def
+  /xoffnewpage x def
+} def
+/newpage {
+  goffsetA4
+  xoffnewpage yoffnewpage offset
+} def
+/setpagegrid { % ncol nrow xoffnewframe yoffnewframe
+  /yoffnewframe x def
+  /xoffnewframe x def
+  /nrowpage x def
+  /ncolpage x def
+} def
+/nextFrame {
+  /iFrame iFrame 1 add def
+  iFrame nrowpage ncolpage mul mod 0 eq {
+    showpage gscale newpage
+  } {
+    iFrame ncolpage mod 0 eq {
+      xoffnewframe ncolpage 1 sub neg mul yoffnewframe offset
+    } {
+      xoffnewframe 0 offset
+    } ifelse
+  } ifelse
+} def
+
+
 /zValues { pop pop } def 
 /plotafter {} def
 /whiteframe { 1 0 0 10 10 graybox } def 
-- 
GitLab