summaryrefslogtreecommitdiff
path: root/metapost/context/base/mp-core.mp
diff options
context:
space:
mode:
Diffstat (limited to 'metapost/context/base/mp-core.mp')
-rw-r--r--metapost/context/base/mp-core.mp716
1 files changed, 435 insertions, 281 deletions
diff --git a/metapost/context/base/mp-core.mp b/metapost/context/base/mp-core.mp
index 72347734f..64ac0dfff 100644
--- a/metapost/context/base/mp-core.mp
+++ b/metapost/context/base/mp-core.mp
@@ -39,10 +39,10 @@ def initialize_box_pos (expr pos,n,x,y,w,h,d) =
pxy := llxy--lrxy--urxy--ulxy--cycle ;
cxy := center pxy ;
nxy := n ;
- freeze_box(pos) ;
+ freeze_box(pos) ;
enddef ;
-def freeze_box (expr pos) =
+def freeze_box (expr pos) =
lxy[pos] := lxy ;
llxy[pos] := llxy ;
lrxy[pos] := lrxy ;
@@ -55,7 +55,7 @@ def freeze_box (expr pos) =
pxy[pos] := pxy ;
cxy[pos] := cxy ;
nxy[pos] := nxy ;
-enddef ;
+enddef ;
def initialize_box (expr n,x,y,w,h,d) =
@@ -88,13 +88,13 @@ def do_initialize_area (expr fpos, tpos) =
enddef ;
def set_par_line_height (expr ph, pd) =
- par_strut_height :=
- if ph>0 : ph elseif StrutHeight>0 : StrutHeight else : 8pt fi ;
+ par_strut_height :=
+ if ph>0 : ph elseif StrutHeight>0 : StrutHeight else : 8pt fi ;
par_strut_depth :=
- if pd>0 : pd elseif StrutDepth >0 : StrutDepth else : 3pt fi ;
- par_line_height :=
+ if pd>0 : pd elseif StrutDepth >0 : StrutDepth else : 3pt fi ;
+ par_line_height :=
par_strut_height + par_strut_depth ;
-enddef ;
+enddef ;
def initialize_par (expr fn,fx,fy,fw,fh,fd,
tn,tx,ty,tw,th,td,
@@ -109,7 +109,7 @@ def initialize_par (expr fn,fx,fy,fw,fh,fd,
numeric par_strut_height, par_strut_depth, par_line_height ;
- set_par_line_height (ph, pd) ;
+ set_par_line_height (ph, pd) ;
do_initialize_area (fpos, tpos) ;
do_initialize_par (fpos, tpos, mpos, ppos, rw,rl,rr,rh,ra,ri) ;
@@ -126,14 +126,14 @@ def initialize_area_par (expr fn,fx,fy,fw,fh,fd,
numeric par_strut_height, par_strut_depth, par_line_height ;
- set_par_line_height (wh, wd) ;
+ set_par_line_height (wh, wd) ;
numeric ffpos ; ffpos := 4 ; initialize_box_pos(ffpos,wn,wx,fy,0,wh,wd) ;
numeric ttpos ; ttpos := 5 ; initialize_box_pos(ttpos,wn,wx+ww,ty,0,wh,wd) ;
- do_initialize_area (ffpos, ttpos) ;
+ do_initialize_area (ffpos, ttpos) ;
- numeric mpos ; mpos := 6 ; freeze_box(mpos) ;
+ numeric mpos ; mpos := 6 ; freeze_box(mpos) ;
% do_initialize_area (fpos, tpos) ;
do_initialize_par (fpos, tpos, mpos, ffpos, 0,0,0,0,0,0) ;
@@ -142,92 +142,92 @@ enddef ;
def do_initialize_par (expr fpos, tpos, mpos, ppos, rw,rl,rr,rh,ra,ri) =
- pair lref, rref, pref, lhref, rhref ;
+ pair lref, rref, pref, lhref, rhref ;
% clip the page area to the left and right skips
- llxy[mpos] := llxy[mpos] shifted (+rl,0) ;
- lrxy[mpos] := lrxy[mpos] shifted (-rr,0) ;
- urxy[mpos] := urxy[mpos] shifted (-rr,0) ;
- ulxy[mpos] := ulxy[mpos] shifted (+rl,0) ;
+ llxy[mpos] := llxy[mpos] shifted (+rl,0) ;
+ lrxy[mpos] := lrxy[mpos] shifted (-rr,0) ;
+ urxy[mpos] := urxy[mpos] shifted (-rr,0) ;
+ ulxy[mpos] := ulxy[mpos] shifted (+rl,0) ;
% fixate the leftskip, rightskip and hanging indentation
-
- lref := (xpart llxy[mpos],ypart ulxy[ppos]) ; lhref := lref shifted (rh,0) ;
- rref := (xpart lrxy[mpos],ypart urxy[ppos]) ; rhref := rref shifted (rh,0) ;
-
- pref := lxy[ppos] ;
-
- if nxy[tpos] > nxy[fpos] :
- if nxy[fpos] = nxy[mpos] :
- % first of multiple pages
- llxy[tpos] := llxy[mpos] ;
- lrxy[tpos] := lrxy[mpos] ;
- urxy[tpos] := lrxy[mpos] shifted (0,par_line_height) ;
- ulxy[tpos] := llxy[mpos] shifted (0,par_line_height) ;
- boxgriddirection := down ;
- elseif nxy[tpos] = nxy[mpos] :
- % last of multiple pages
- llxy[fpos] := ulxy[mpos] shifted (0,-par_line_height) ;
- lrxy[fpos] := urxy[mpos] shifted (0,-par_line_height) ;
- urxy[fpos] := urxy[mpos] ;
- ulxy[fpos] := ulxy[mpos] ;
- boxgriddirection := up ;
- else :
- % middle of multiple pages
- llxy[fpos] := ulxy[mpos] shifted (0,-par_line_height) ;
- lrxy[fpos] := urxy[mpos] shifted (0,-par_line_height) ;
- urxy[fpos] := urxy[mpos] ;
- ulxy[fpos] := ulxy[mpos] ;
- llxy[tpos] := llxy[mpos] ;
- lrxy[tpos] := lrxy[mpos] ;
- urxy[tpos] := lrxy[mpos] shifted (0,par_line_height) ;
- ulxy[tpos] := llxy[mpos] shifted (0,par_line_height) ;
- boxgriddirection := up ;
+
+ lref := (xpart llxy[mpos],ypart ulxy[ppos]) ; lhref := lref shifted (rh,0) ;
+ rref := (xpart lrxy[mpos],ypart urxy[ppos]) ; rhref := rref shifted (rh,0) ;
+
+ pref := lxy[ppos] ;
+
+ if nxy[tpos] > nxy[fpos] :
+ if nxy[fpos] = nxy[mpos] :
+ % first of multiple pages
+ llxy[tpos] := llxy[mpos] ;
+ lrxy[tpos] := lrxy[mpos] ;
+ urxy[tpos] := lrxy[mpos] shifted (0,par_line_height) ;
+ ulxy[tpos] := llxy[mpos] shifted (0,par_line_height) ;
+ boxgriddirection := down ;
+ elseif nxy[tpos] = nxy[mpos] :
+ % last of multiple pages
+ llxy[fpos] := ulxy[mpos] shifted (0,-par_line_height) ;
+ lrxy[fpos] := urxy[mpos] shifted (0,-par_line_height) ;
+ urxy[fpos] := urxy[mpos] ;
+ ulxy[fpos] := ulxy[mpos] ;
+ boxgriddirection := up ;
+ else :
+ % middle of multiple pages
+ llxy[fpos] := ulxy[mpos] shifted (0,-par_line_height) ;
+ lrxy[fpos] := urxy[mpos] shifted (0,-par_line_height) ;
+ urxy[fpos] := urxy[mpos] ;
+ ulxy[fpos] := ulxy[mpos] ;
+ llxy[tpos] := llxy[mpos] ;
+ lrxy[tpos] := lrxy[mpos] ;
+ urxy[tpos] := lrxy[mpos] shifted (0,par_line_height) ;
+ ulxy[tpos] := llxy[mpos] shifted (0,par_line_height) ;
+ boxgriddirection := up ;
fi ;
- else :
- % just one page
- boxgriddirection := up ;
- fi ;
+ else :
+ % just one page
+ boxgriddirection := up ;
+ fi ;
- path txy, bxy, pxy, mxy ;
+ path txy, bxy, pxy, mxy ;
- txy := originpath ; % top
- bxy := originpath ; % bottom
+ txy := originpath ; % top
+ bxy := originpath ; % bottom
pxy := originpath ; % composed
- boolean lefthang, righthang, somehang ;
+ boolean lefthang, righthang, somehang ;
- % we only hang on the first of a multiple page background
+ % we only hang on the first of a multiple page background
- if nxy[mpos] > nxy[fpos] :
- lefthang := righthang := somehang := false ;
- else :
- lefthang := (rh>0) ; righthang := (rh<0) ; somehang := false ;
- fi ;
+ if nxy[mpos] > nxy[fpos] :
+ lefthang := righthang := somehang := false ;
+ else :
+ lefthang := (rh>0) ; righthang := (rh<0) ; somehang := false ;
+ fi ;
if lefthang :
- mxy := boundingbox (lref -- lref shifted (rh,ra*par_line_height)) ;
- elseif righthang :
- mxy := boundingbox (rref -- rref shifted (rh,ra*par_line_height)) ;
+ mxy := boundingbox (lref -- lref shifted (rh,ra*par_line_height)) ;
+ elseif righthang :
+ mxy := boundingbox (rref -- rref shifted (rh,ra*par_line_height)) ;
else :
- mxy := originpath ;
+ mxy := originpath ;
fi ;
- if round(ypart llxy[fpos]) = round(ypart llxy[tpos]) :
+ if round(ypart llxy[fpos]) = round(ypart llxy[tpos]) :
% We have a one-liner. Watch how er use the bottom pos for
% determining the height.
- llxy[fpos] := (xpart llxy[fpos], ypart llxy[tpos]) ;
- ulxy[fpos] := (xpart ulxy[fpos], ypart ulxy[tpos]) ;
+ llxy[fpos] := (xpart llxy[fpos], ypart llxy[tpos]) ;
+ ulxy[fpos] := (xpart ulxy[fpos], ypart ulxy[tpos]) ;
- else :
+ else :
- % We have a multi-liner. For convenience we now correct the
- % begin and end points for indentation.
+ % We have a multi-liner. For convenience we now correct the
+ % begin and end points for indentation.
- if lefthang and (round(ypart llxy[tpos]) >= round(ypart lrcorner mxy)) :
+ if lefthang and (round(ypart llxy[tpos]) >= round(ypart lrcorner mxy)) :
llxy[tpos] := (xpart lhref, ypart llxy[tpos]) ;
ulxy[tpos] := (xpart lhref, ypart ulxy[tpos]) ;
else :
@@ -240,26 +240,26 @@ def do_initialize_par (expr fpos, tpos, mpos, ppos, rw,rl,rr,rh,ra,ri) =
urxy[fpos] := (xpart rhref, ypart urxy[fpos]) ;
else :
lrxy[fpos] := (xpart rref, ypart lrxy[fpos]) ;
- urxy[fpos] := (xpart rref, ypart urxy[fpos]) ;
+ urxy[fpos] := (xpart rref, ypart urxy[fpos]) ;
fi ;
- fi ;
+ fi ;
- somehang := (ypart ulxy[fpos]>ypart llcorner mxy) and
+ somehang := (ypart ulxy[fpos]>ypart llcorner mxy) and
(ypart llxy[tpos]<ypart llcorner mxy) ;
- if round(ypart llxy[fpos]) = round(ypart llxy[tpos]) :
+ if round(ypart llxy[fpos]) = round(ypart llxy[tpos]) :
- % A (short) one-liner goes into the top box.
+ % A (short) one-liner goes into the top box.
txy := llxy[fpos] -- lrxy[tpos] -- urxy[tpos] -- ulxy[fpos] -- cycle ;
elseif (round(ypart llxy[fpos]) = round(ypart ulxy[tpos])) and
(round(xpart lrxy[tpos]) < round(xpart llxy[fpos])) :
- % We have a sentence that spans two lines but with only end
- % of line and begin of line segments. We need to take care of
- % indentation.
+ % We have a sentence that spans two lines but with only end
+ % of line and begin of line segments. We need to take care of
+ % indentation.
txy := llxy[fpos] -- lrxy[fpos] -- urxy[fpos] -- ulxy[fpos] -- cycle ;
bxy := llxy[tpos] -- lrxy[tpos] -- urxy[tpos] -- ulxy[tpos] -- cycle ;
@@ -271,92 +271,92 @@ def do_initialize_par (expr fpos, tpos, mpos, ppos, rw,rl,rr,rh,ra,ri) =
pxy := llxy[tpos] -- lrxy[tpos] -- urxy[tpos] -- lrxy[fpos] --
urxy[fpos] -- ulxy[fpos] -- llxy[fpos] -- ulxy[tpos] -- cycle ;
- elseif lefthang and somehang :
+ elseif lefthang and somehang :
- % We have a sentence that spans more than two lines with
- % left hanging indentation.
+ % We have a sentence that spans more than two lines with
+ % left hanging indentation.
- pxy := llxy[tpos] -- lrxy[tpos] -- urxy[tpos] --
+ pxy := llxy[tpos] -- lrxy[tpos] -- urxy[tpos] --
(xpart urxy[fpos],ypart urxy[tpos]) --
- urxy[fpos] -- ulxy[fpos] -- llxy[fpos] --
- if round(ypart urxy[tpos]) < round(ypart llcorner mxy) :
- (xpart lrcorner mxy,ypart llxy[fpos]) --
- lrcorner mxy --
- (xpart llxy[tpos],ypart llcorner mxy) --
- else :
- (xpart llxy[tpos],ypart llxy[fpos]) --
- fi
+ urxy[fpos] -- ulxy[fpos] -- llxy[fpos] --
+ if round(ypart urxy[tpos]) < round(ypart llcorner mxy) :
+ (xpart lrcorner mxy,ypart llxy[fpos]) --
+ lrcorner mxy --
+ (xpart llxy[tpos],ypart llcorner mxy) --
+ else :
+ (xpart llxy[tpos],ypart llxy[fpos]) --
+ fi
cycle ;
elseif righthang and somehang :
- % We have a sentence that spans more than two lines with
- % right hanging indentation.
+ % We have a sentence that spans more than two lines with
+ % right hanging indentation.
- pxy := llxy[tpos] -- lrxy[tpos] -- urxy[tpos] --
- if round(ypart urxy[tpos]) < round(ypart llcorner mxy) :
+ pxy := llxy[tpos] -- lrxy[tpos] -- urxy[tpos] --
+ if round(ypart urxy[tpos]) < round(ypart llcorner mxy) :
(xpart lrcorner mxy,ypart urxy[tpos]) --
lrcorner mxy -- llcorner mxy --
- else :
+ else :
(xpart urxy[fpos],ypart urxy[tpos]) --
- fi
- urxy[fpos] -- ulxy[fpos] -- llxy[fpos] --
- (xpart llxy[tpos],ypart llxy[fpos]) --
+ fi
+ urxy[fpos] -- ulxy[fpos] -- llxy[fpos] --
+ (xpart llxy[tpos],ypart llxy[fpos]) --
cycle ;
- else :
+ else :
- % We have a sentence that spans more than two lines with
- % no hanging indentation.
+ % We have a sentence that spans more than two lines with
+ % no hanging indentation.
- pxy := llxy[tpos] -- lrxy[tpos] -- urxy[tpos] --
+ pxy := llxy[tpos] -- lrxy[tpos] -- urxy[tpos] --
(xpart urxy[fpos],ypart urxy[tpos]) --
- urxy[fpos] -- ulxy[fpos] -- llxy[fpos] --
+ urxy[fpos] -- ulxy[fpos] -- llxy[fpos] --
(xpart llxy[tpos],ypart llxy[fpos]) -- cycle ;
fi ;
- pxy := simplified pxy ;
- pxy := unspiked pxy ;
+ pxy := simplified pxy ;
+ pxy := unspiked pxy ;
enddef ;
-TopSkip := 0 ; % will move
-StrutHeight := 0 ; % will move
-
-pair last_multi_par_shift ; last_multi_par_shift := origin ;
+TopSkip := 0 ; % will move
+StrutHeight := 0 ; % will move
+
+pair last_multi_par_shift ; last_multi_par_shift := origin ;
-def relocate_multipars (expr xy) =
- last_multi_par_shift := xy ;
- for i=1 upto nofmultipars :
+def relocate_multipars (expr xy) =
+ last_multi_par_shift := xy ;
+ for i=1 upto nofmultipars :
multipars[i] := multipars[i] shifted last_multi_par_shift ;
- endfor ;
-enddef ;
-
-boolean compensate_multi_par_topskip ;
-boolean span_multi_column_pars ;
-boolean auto_multi_par_hsize ;
+ endfor ;
+enddef ;
+
+boolean compensate_multi_par_topskip ;
+boolean span_multi_column_pars ;
+boolean auto_multi_par_hsize ;
boolean enable_multi_par_fallback ;
-compensate_multi_par_topskip := true ;
+compensate_multi_par_topskip := true ;
span_multi_column_pars := false ;
auto_multi_par_hsize := false ; % true ;
enable_multi_par_fallback := true ;
-vardef multi_par_at_top (expr i) =
- (round (ypart ulcorner multipars[i]) = round (ypart ulcorner
+vardef multi_par_at_top (expr i) =
+ (round (ypart ulcorner multipars[i]) = round (ypart ulcorner
(TextAreas[multirefs[i]] shifted last_multi_par_shift)))
-enddef ;
+enddef ;
-numeric nofmultipars ; nofmultipars := 0 ;
+numeric nofmultipars ; nofmultipars := 0 ;
boolean obey_multi_par_hang ; obey_multi_par_hang := true ;
boolean obey_multi_par_more ; obey_multi_par_more := true ;
boolean snap_multi_par_tops ; snap_multi_par_tops := true ;
-boolean local_multi_par_area ; local_multi_par_area := false ;
-boolean ignore_multi_par_page ; ignore_multi_par_page := false ;
+boolean local_multi_par_area ; local_multi_par_area := false ;
+boolean ignore_multi_par_page ; ignore_multi_par_page := false ;
-boolean one_piece_multi_par ; one_piece_multi_par := false ;
+boolean one_piece_multi_par ; one_piece_multi_par := false ;
def simplify_multi_pars = % boundingbox ipv shape als optie
for i := 1 upto nofmultipars :
@@ -387,30 +387,30 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
NOfTextAreas := NOfTextColumns ;
fi ;
- last_multi_par_shift := origin ;
+ last_multi_par_shift := origin ;
numeric fpos ; fpos := 1 ; initialize_box_pos(fpos,fn,fx,fy,fw,fh,fd) ;
numeric tpos ; tpos := 2 ; initialize_box_pos(tpos,tn,tx,ty,tw,th,td) ;
numeric wpos ; wpos := 3 ; initialize_box_pos(wpos,wn,wx,wy,ww,wh,wd) ;
numeric ppos ; ppos := 4 ; initialize_box_pos(ppos,pn,px,py,pw,ph,pd) ;
- if local_multi_par_area :
- RealPageNumber := fn ;
- NOfTextAreas := 1 ;
- NOfSavedTextAreas := 0 ;
+ if local_multi_par_area :
+ RealPageNumber := fn ;
+ NOfTextAreas := 1 ;
+ NOfSavedTextAreas := 0 ;
TextAreas[1] := TextAreas[0] ;
TextColumns[1] := TextColumns[0] ;
- nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ;
+ nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ;
% draw TextColumns[1] withcolor green ;
% draw TextAreas[1] withcolor green ;
elseif ignore_multi_par_page :
- RealPageNumber := fn ;
- nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ;
- fi ;
+ RealPageNumber := fn ;
+ nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ;
+ fi ;
numeric par_strut_height, par_strut_depth, par_line_height ;
- set_par_line_height (ph, pd) ;
+ set_par_line_height (ph, pd) ;
numeric par_hang_indent, par_hang_after, par_indent, par_left_skip ;
@@ -423,8 +423,8 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
% par_start_pos := llxy[fpos] if par_indent<0: shifted (-par_indent,0) fi ;
- par_start_pos := llxy[fpos]
- if par_indent <0: shifted (-par_indent, 0) fi
+ par_start_pos := llxy[fpos]
+ if par_indent <0: shifted (-par_indent, 0) fi
if par_left_skip<0: shifted (-par_left_skip,0) fi ;
if wxy[wpos]>0 :
@@ -439,28 +439,28 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
numeric multiref, multirefs[] ;
numeric multiloc, multilocs[] ; % 1=begin 2=between 3=end
- numeric multi_par_pages ; multi_par_pages := nxy[tpos]-nxy[fpos]+1 ;
+ numeric multi_par_pages ; multi_par_pages := nxy[tpos]-nxy[fpos]+1 ;
ii := 0 ; nn := NOfTextAreas+1 ; nofmultipars := 0 ;
vardef snapped_multi_pos (expr p) =
if snap_multi_par_tops :
if abs(ypart p - ypart ulcorner multipar) < par_line_height :
- (xpart p,ypart ulcorner multipar)
- else :
- p
- fi
+ (xpart p,ypart ulcorner multipar)
+ else :
+ p
+ fi
else :
- p
- fi
- enddef ;
+ p
+ fi
+ enddef ;
% def set_multipar (expr i) =
% ((TextAreas[i] leftenlarged -left_skip) rightenlarged -right_skip)
% enddef ;
vardef set_multipar (expr i) =
- ( (TextAreas[i] leftenlarged -left_skip) rightenlarged (-right_skip
+ ( (TextAreas[i] leftenlarged -left_skip) rightenlarged (-right_skip
if auto_multi_par_hsize : + rw - bbwidth(TextAreas[i]) fi) )
enddef ;
@@ -518,7 +518,7 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
par_hang_after := ra + estimated_par_lines(py-fy) ;
if (par_hang_indent>0) and (par_hang_after<0) and obey_multi_par_hang :
- pair _ul_ ; _ul_ := (xpart ulcorner multipar, ypart snapped_multi_pos(ulxy[fpos]));
+ pair _ul_ ; _ul_ := (xpart ulcorner multipar, ypart snapped_multi_pos(ulxy[fpos]));
pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ;
_pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ;
if same_area :
@@ -660,11 +660,7 @@ fi ;
vardef x_left_bottom_hang (expr i, t) =
pair _ll_, _sa_, _pa_ ;
-if t :
- _sa_ := llxy[tpos] ;
-else :
- _sa_ := llcorner multipar ;
-fi ;
+ _sa_ := if t : llxy[tpos] else : llcorner multipar fi ;
if (par_hang_indent>0) and (ra>0) :
par_hang_after := max(0,ra - estimated_multi_par_height(i,t)) ;
_ll_ := ulcorner multipar ;
@@ -684,11 +680,7 @@ fi ;
vardef x_right_bottom_hang (expr i, t) =
pair _lr_, _sa_, _pa_ ;
-if t :
- _sa_ := snapped_multi_pos(ulxy[tpos]) ;
-else :
- _sa_ := llcorner multipar ;
-fi ;
+ _sa_ := if t : snapped_multi_pos(ulxy[tpos]) else : llcorner multipar fi ;
if (par_hang_indent<0) and (ra>0) :
par_hang_after := max(0,ra - estimated_multi_par_height(i, t)) ;
_lr_ := urcorner multipar ;
@@ -707,36 +699,37 @@ fi ;
enddef ;
def test_multipar =
- multipar :=
- llcorner multipar --
- urcorner multipar --
- lrcorner multipar --
- ulcorner multipar --
- cycle ;
+% multipar :=
+% llcorner multipar --
+% urcorner multipar --
+% lrcorner multipar --
+% ulcorner multipar --
+% cycle ;
+ multipar := boundingbox multipar ;
enddef ;
- % first loop
+ % first loop
+
+ if enable_multi_par_fallback and
+ (nxy[fpos]=RealPageNumber) and
+ (nxy[tpos]=RealPageNumber) and not
+ (InsideSomeTextArea(lxy[fpos]) and
+ InsideSomeTextArea(rxy[tpos])) :
- if enable_multi_par_fallback and
- (nxy[fpos]=RealPageNumber) and
- (nxy[tpos]=RealPageNumber) and not
- (InsideSomeTextArea(lxy[fpos]) and
- InsideSomeTextArea(rxy[tpos])) :
+ % fallback
- % fallback
+ multipar :=
- multipar :=
-
- llxy[fpos] --
- lrxy[tpos] --
- urxy[tpos] --
+ llxy[fpos] --
+ lrxy[tpos] --
+ urxy[tpos] --
ulxy[fpos] -- cycle ;
-
+
save_multipar (1,1,multipar) ;
else :
- % normal
+ % normal
for i=1 upto NOfTextAreas :
@@ -779,23 +772,23 @@ fi ;
llxy[fpos] --
lrxy[tpos] --
%urxy[tpos] --
- snapped_multi_pos(urxy[tpos]) --
+ snapped_multi_pos(urxy[tpos]) --
%ulxy[fpos] --
- snapped_multi_pos(ulxy[fpos]) --
+ snapped_multi_pos(ulxy[fpos]) --
cycle ;
save_multipar (i,1,multipar) ;
- elseif (ypart llxy[fpos] = ypart ulxy[tpos]) and
+ elseif (ypart llxy[fpos] = ypart ulxy[tpos]) and
(xpart llxy[tpos] < xpart llxy[fpos]) :
- % two loners
+ % two loners
multipar := if obey_multi_par_hang :
right_bottom_hang(true) --
right_top_hang(true) --
- snapped_multi_pos(urxy[fpos]) --
+ snapped_multi_pos(urxy[fpos]) --
lrxy[fpos] --
else :
@@ -803,7 +796,7 @@ fi ;
llxy[fpos] --
(xpart urcorner multipar, ypart llxy[fpos]) --
(xpart urcorner multipar, ypart ulxy[fpos]) --
- snapped_multi_pos(ulxy[fpos]) --
+ snapped_multi_pos(ulxy[fpos]) --
fi cycle ;
@@ -815,14 +808,14 @@ fi ;
left_bottom_hang(true) --
llxy[tpos] --
- snapped_multi_pos(ulxy[tpos]) --
+ snapped_multi_pos(ulxy[tpos]) --
left_top_hang(true) --
else :
(xpart llcorner multipar, ypart llxy[tpos]) --
llxy[tpos] --
- snapped_multi_pos(ulxy[tpos]) --
+ snapped_multi_pos(ulxy[tpos]) --
(xpart llcorner multipar, ypart ulxy[tpos]) --
fi cycle ;
@@ -836,11 +829,11 @@ fi ;
left_bottom_hang(true) --
llxy[tpos] --
%ulxy[tpos] --
- snapped_multi_pos(ulxy[tpos]) --
+ snapped_multi_pos(ulxy[tpos]) --
right_bottom_hang(true) --
right_top_hang(true) --
%urxy[fpos] --
- snapped_multi_pos(urxy[fpos]) --
+ snapped_multi_pos(urxy[fpos]) --
lrxy[fpos] --
left_top_hang(true) --
@@ -848,19 +841,19 @@ fi ;
(xpart llcorner multipar, ypart llxy[tpos]) --
llxy[tpos] --
- %ulxy[tpos] --
- snapped_multi_pos(ulxy[tpos]) --
+ %ulxy[tpos] --
+ snapped_multi_pos(ulxy[tpos]) --
(xpart lrcorner multipar, ypart ulxy[tpos]) --
(xpart urcorner multipar, ypart urxy[fpos]) --
%urxy[fpos] --
- snapped_multi_pos(urxy[fpos]) --
+ snapped_multi_pos(urxy[fpos]) --
lrxy[fpos] --
(xpart ulcorner multipar, ypart lrxy[fpos]) --
fi cycle ;
save_multipar (i,1,multipar) ;
-
+
fi ;
else :
@@ -871,7 +864,7 @@ fi ;
right_bottom_hang(false) --
right_top_hang(false) --
%urxy[fpos] --
- snapped_multi_pos(urxy[fpos]) --
+ snapped_multi_pos(urxy[fpos]) --
lrxy[fpos] --
left_top_hang(false) --
@@ -881,7 +874,7 @@ fi ;
lrcorner multipar --
(xpart urcorner multipar, ypart urxy[fpos]) --
%urxy[fpos] --
- snapped_multi_pos(urxy[fpos]) --
+ snapped_multi_pos(urxy[fpos]) --
lrxy[fpos] --
(xpart ulcorner multipar, ypart lrxy[fpos]) --
@@ -904,7 +897,7 @@ fi ;
x_right_top_hang(i,true) --
x_right_bottom_hang(i,true) --
% ulxy[tpos] --
-snapped_multi_pos(ulxy[tpos]) --
+snapped_multi_pos(ulxy[tpos]) --
llxy[tpos] --
x_left_bottom_hang(i,true) --
cycle ;
@@ -916,7 +909,7 @@ snapped_multi_pos(ulxy[tpos]) --
urcorner multipar --
(xpart lrcorner multipar, ypart urxy[tpos]) --
% ulxy[tpos] --
-snapped_multi_pos(ulxy[tpos]) --
+snapped_multi_pos(ulxy[tpos]) --
llxy[tpos] --
(xpart llcorner multipar, ypart llxy[tpos]) --
cycle ;
@@ -925,15 +918,15 @@ snapped_multi_pos(ulxy[tpos]) --
save_multipar (i,3,multipar) ;
- else :
+ else :
+
+ % handled later
- % handled later
-
fi ;
endfor ;
- % second loop
+ % second loop
for i=ii+1 upto nn-1 :
@@ -956,19 +949,19 @@ snapped_multi_pos(ulxy[tpos]) --
save_multipar(i,2,multipar) ;
-%fi ;
+%fi ;
endfor ;
- % end of normal/fallback
+ % end of normal/fallback
-fi ;
+fi ;
if span_multi_column_pars :
endgroup ;
fi ;
- % quick hack for gb:
+ % quick hack for gb:
one_piece_multi_par := (nofmultipars=1) and (pn=tn) ;
@@ -983,8 +976,8 @@ numeric boxfilltype ; boxfilltype := 1 ;
pair boxgriddirection ; boxgriddirection := up ;
numeric boxgridwidth ; boxgridwidth := 1pt ;
numeric boxlinewidth ; boxlinewidth := 1pt ;
-numeric boxlineradius ; boxlineradius := 0pt ;
-numeric boxfilloffset ; boxfilloffset := 0pt ;
+numeric boxlineradius ; boxlineradius := 0pt ;
+numeric boxfilloffset ; boxfilloffset := 0pt ;
numeric boxgriddistance ; boxgriddistance := .5cm ;
def draw_box =
@@ -992,19 +985,19 @@ def draw_box =
draw lxy -- rxy withcolor boxlinecolor withpen pencircle scaled boxgridwidth ;
enddef ;
-def draw_par = % 1 2 3 11 12
+def draw_par = % 1 2 3 11 12
do_draw_par(pxy) ; do_draw_par(txy) ; do_draw_par(bxy) ;
for i = pxy, txy, bxy :
if boxgridtype= 1 :
- boxgriddirection := origin ;
+ boxgriddirection := origin ;
draw baseline_grid (i,boxgriddirection,true ) withcolor boxgridcolor ;
elseif boxgridtype= 2 :
- boxgriddirection := origin ;
+ boxgriddirection := origin ;
draw baseline_grid (i,boxgriddirection,false) withcolor boxgridcolor ;
elseif boxgridtype= 3 :
- boxgriddirection := origin ;
+ boxgriddirection := origin ;
draw baseline_grid (i,boxgriddirection,true ) withcolor boxgridcolor ;
- draw baseline_grid (i,boxgriddirection,true )
+ draw baseline_grid (i,boxgriddirection,true )
shifted (0,ExHeight) withcolor boxgridcolor ;
elseif boxgridtype=11 :
draw graphic_grid(i,boxgriddistance,boxgriddistance,boxgriddistance/2,boxgriddistance/2) ;
@@ -1016,50 +1009,50 @@ enddef ;
def do_show_par (expr p, r, c) =
if length(p) > 2 : for i=0 upto length(p) :
- draw fullcircle scaled r shifted point i of p
+ draw fullcircle scaled r shifted point i of p
withpen pencircle scaled .5pt withcolor c ;
endfor ; fi ;
draw p withpen pencircle scaled .5pt withcolor c ;
-enddef ;
+enddef ;
def show_par =
- if length(mxy) > 2 :
- draw mxy dashed evenly
- withpen pencircle scaled .5pt withcolor .5white ;
- fi ;
+ if length(mxy) > 2 :
+ draw mxy dashed evenly
+ withpen pencircle scaled .5pt withcolor .5white ;
+ fi ;
do_show_par(txy, 4pt, .5green) ;
do_show_par(bxy, 6pt, .5blue ) ;
do_show_par(pxy, 8pt, .5red ) ;
- draw pref withpen pencircle scaled 2pt ;
+ draw pref withpen pencircle scaled 2pt ;
enddef ;
-def sort_multi_pars =
+def sort_multi_pars =
if nofmultipars>1 :
- begingroup ; save _p_, _n_ ; path _p_ ; numeric _n_ ;
- for i := 1 upto nofmultipars :
- if multilocs[i] = 3 :
+ begingroup ; save _p_, _n_ ; path _p_ ; numeric _n_ ;
+ for i := 1 upto nofmultipars :
+ if multilocs[i] = 3 :
_p_ := multipars[nofmultipars] ;
- multipars[nofmultipars] := multipars[i] ;
- multipars[i] := _p_ ;
+ multipars[nofmultipars] := multipars[i] ;
+ multipars[i] := _p_ ;
_n_ := multirefs[nofmultipars] ;
- multirefs[nofmultipars] := multirefs[i] ;
- multirefs[i] := _n_ ;
+ multirefs[nofmultipars] := multirefs[i] ;
+ multirefs[i] := _n_ ;
_n_ := multilocs[nofmultipars] ;
- multilocs[nofmultipars] := multilocs[i] ;
- multilocs[i] := _n_ ;
- fi ;
+ multilocs[nofmultipars] := multilocs[i] ;
+ multilocs[i] := _n_ ;
+ fi ;
endfor ;
- endgroup ;
- fi ;
-enddef ;
+ endgroup ;
+ fi ;
+enddef ;
-% This collapses successive areas (possibly interrupted by
-% floats. First we need to sort the areas, since they are
-% normally in de order start, end, inbetween.
+% This collapses successive areas (possibly interrupted by
+% floats. First we need to sort the areas, since they are
+% normally in de order start, end, inbetween.
-def collapse_multi_pars =
+def collapse_multi_pars =
if nofmultipars>1 :
- begingroup ; save _nofmultipars_ ; numeric _nofmultipars_ ;
+ begingroup ; save _nofmultipars_ ; numeric _nofmultipars_ ;
_nofmultipars_ := 1 ;
sort_multi_pars ; % block not in order: 1, 3, 2....
for i:=1 upto nofmultipars-1 :
@@ -1068,9 +1061,9 @@ def collapse_multi_pars =
multilocs[_nofmultipars_] := multilocs[i+1] ;
multirefs[_nofmultipars_] := multirefs[i+1] ;
multipars[_nofmultipars_] :=
- ulcorner multipars[_nofmultipars_] --
- urcorner multipars[_nofmultipars_] --
- lrcorner multipars[i+1] --
+ ulcorner multipars[_nofmultipars_] --
+ urcorner multipars[_nofmultipars_] --
+ lrcorner multipars[i+1] --
llcorner multipars[i+1] -- cycle ;
else :
_nofmultipars_ := _nofmultipars_ + 1 ;
@@ -1080,83 +1073,83 @@ multirefs[_nofmultipars_] := multirefs[i+1] ;
fi ;
endfor ;
nofmultipars := _nofmultipars_ ;
- endgroup ;
- fi ;
+ endgroup ;
+ fi ;
enddef ;
-def draw_multi_pars =
- for i=1 upto nofmultipars :
- do_draw_par(multipars[i]) ;
+def draw_multi_pars =
+ for i=1 upto nofmultipars :
+ do_draw_par(multipars[i]) ;
if boxgridtype= 1 :
draw baseline_grid (multipars[i],up,true ) withcolor boxgridcolor ;
elseif boxgridtype= 2 :
draw baseline_grid (multipars[i],up,false) withcolor boxgridcolor ;
elseif boxgridtype= 3 :
draw baseline_grid (multipars[i],up,true ) withcolor boxgridcolor ;
- draw baseline_grid (multipars[i],up,true )
+ draw baseline_grid (multipars[i],up,true )
shifted (0,ExHeight) withcolor boxgridcolor ;
elseif boxgridtype=11 :
draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,boxgriddistance/2,boxgriddistance/2) ;
elseif boxgridtype=12 :
draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,0,0) ;
fi ;
- endfor ;
-enddef ;
+ endfor ;
+enddef ;
-def show_multi_pars =
- for i=1 upto nofmultipars :
+def show_multi_pars =
+ for i=1 upto nofmultipars :
do_show_par(multipars[i], 6pt, .5blue) ;
- endfor ;
-enddef ;
+ endfor ;
+enddef ;
vardef do_draw_par (expr p) =
if (length p>2) and (bbwidth(p)>1) and (bbheight(p)>1) :
- save pp ; path pp ;
- if (boxlineradius>0) and (boxlinetype=2) :
- pp := p cornered boxlineradius ;
- else :
- pp := p ;
- fi ;
+ save pp ; path pp ;
+ if (boxlineradius>0) and (boxlinetype=2) :
+ pp := p cornered boxlineradius ;
+ else :
+ pp := p ;
+ fi ;
if boxfilltype>0 :
if boxfilloffset>0 :
% temporary hack
- begingroup ; interim linejoin := mitered ;
+ begingroup ; interim linejoin := mitered ;
filldraw pp withcolor boxfillcolor withpen pencircle scaled (2*boxfilloffset) ;
- endgroup ;
-else :
- fill pp withcolor boxfillcolor ;
-fi ;
+ endgroup ;
+else :
+ fill pp withcolor boxfillcolor ;
+fi ;
fi ;
if boxlinetype>0 :
- draw pp withcolor boxlinecolor withpen pencircle scaled boxlinewidth ;
- fi ;
+ draw pp withcolor boxlinecolor withpen pencircle scaled boxlinewidth ;
+ fi ;
fi ;
enddef ;
vardef baseline_grid (expr pxy, pdir, at_baseline) =
if (par_line_height>0) and (bbheight(pxy)>1) and (bbwidth(pxy)>1) and (boxgridwidth>0) :
save i, grid ; picture grid ; pair start ;
- def _do_ (expr start) =
- draw start -- start shifted (bbwidth(pxy),0)
- withpen pencircle scaled boxgridwidth
+ def _do_ (expr start) =
+ draw start -- start shifted (bbwidth(pxy),0)
+ withpen pencircle scaled boxgridwidth
withcolor boxgridcolor ;
- enddef ;
+ enddef ;
grid := image
( %fails with inlinespace
%
if pdir=up :
for i = if at_baseline : par_strut_depth else : 0 fi
- step par_line_height
+ step par_line_height
until max(bbheight(pxy),par_line_height) :
_do_ (llcorner pxy shifted (0,+i)) ;
endfor ;
else :
for i = if at_baseline : par_strut_height else : 0 fi
- step par_line_height
+ step par_line_height
until bbheight(pxy) :
_do_ (ulcorner pxy shifted (0,-i)) ;
endfor ;
- fi ;
+ fi ;
) ;
clip grid to pxy ;
grid
@@ -1170,12 +1163,12 @@ vardef graphic_grid (expr pxy, dx, dy, x, y) =
save grid ; picture grid ;
grid := image
( for i = xpart llcorner pxy step dx until xpart lrcorner pxy :
- draw (i,ypart llcorner pxy) -- (i,ypart ulcorner pxy)
- withpen pencircle scaled boxgridwidth ;
+ draw (i,ypart llcorner pxy) -- (i,ypart ulcorner pxy)
+ withpen pencircle scaled boxgridwidth ;
endfor ;
for i = ypart llcorner pxy step dy until ypart ulcorner pxy :
- draw (xpart llcorner pxy,i) -- (xpart lrcorner pxy,i)
- withpen pencircle scaled boxgridwidth ;
+ draw (xpart llcorner pxy,i) -- (xpart lrcorner pxy,i)
+ withpen pencircle scaled boxgridwidth ;
endfor ) shifted (x,y) ;
clip grid to pxy ;
grid
@@ -1192,4 +1185,165 @@ let draw_area = draw_box ;
let anchor_area = anchor_box ;
let anchor_par = anchor_box ;
-endinput ;
+% new and experimental and yet undocumented
+
+numeric sync_n[], sync_p[][], sync_w[][], sync_h[][], sync_d[][], sync_t[][] ;
+pair sync_xy[][] ; color sync_c[][] ;
+
+def ResetSyncTasks =
+ path SyncPaths[] ; numeric SyncTasks[], NOfSyncPaths, CurrentSyncClass ;
+ NOfSyncPaths := CurrentSyncClass := 0 ;
+ if unknown SyncLeftOffset : numeric SyncLeftOffset ; SyncLeftOffset := 0 ; fi ;
+ if unknown SyncWidth : numeric SyncWidth ; SyncWidth := 0 ; fi ;
+ if unknown SyncThreshold : numeric SyncThreshold ; SyncThreshold := LineHeight ; fi ;
+ if unknown SyncColor : color SyncColor ; SyncColor := .5white ; fi ;
+ if (SyncLeftOffset = 0) and (SyncWidth = 0) :
+ SyncWidth := if known TextWidth : TextWidth else : -1cm fi ;
+ fi ;
+enddef ;
+
+ResetSyncTasks ;
+
+vardef SyncBox(expr n, i, leftoffset, width, topoffset, bottomoffset) =
+ save o ; pair o ; o := (xpart llcorner PlainTextArea,ypart sync_xy[n][i]) ;
+ o shifted (leftoffset,sync_h[n][i]+topoffset) --
+ o shifted (width+leftoffset,sync_h[n][i]+topoffset) --
+ o shifted (width+leftoffset,bottomoffset) --
+ o shifted (leftoffset,bottomoffset) -- cycle
+enddef ;
+
+def SetSyncColor(expr n, i, c) =
+ sync_c[n][i] := c ;
+enddef ;
+
+def SetSyncThreshold(expr n, i, th) =
+ sync_th[n][i] := th ;
+enddef ;
+
+vardef TheSyncColor(expr n, i) =
+ if known sync_c[n][i] : sync_c[n][i] else : SyncColor fi
+enddef ;
+
+vardef TheSyncThreshold(expr n, i) =
+ if known sync_th[n][i] : sync_th[n][i] else : SyncThreshold fi
+enddef ;
+
+vardef PrepareSyncTasks(expr n, collapse, extendtop, prestartnext) =
+ ResetSyncTasks ;
+ if known sync_n[n] :
+ CurrentSyncClass := n ;
+ save ok, l, d ; boolean ok ; ok := false ; NOfSyncPaths := l := 0 ;
+ for i=1 upto sync_n[n] :
+ if RealPageNumber > sync_p[n][i] :
+ l := i ;
+ elseif RealPageNumber = sync_p[n][i] :
+ NOfSyncPaths := NOfSyncPaths + 1 ;
+ if not ok :
+ if i>1 :
+ if sync_t[n][i-1] = sync_t[n][i] :
+ SyncPaths[NOfSyncPaths] := SyncBox(n, i, SyncLeftOffset, SyncWidth, PaperHeight, -PaperHeight) ;
+ SyncTasks[NOfSyncPaths] := i ;
+ else :
+ SyncPaths[NOfSyncPaths] := SyncBox(n, i-1, SyncLeftOffset, SyncWidth, PaperHeight, -PaperHeight) ;
+ SyncTasks[NOfSyncPaths] := i-1 ;
+ NOfSyncPaths := NOfSyncPaths + 1 ;
+ SyncPaths[NOfSyncPaths] := SyncBox(n, i, SyncLeftOffset, SyncWidth, 0, -PaperHeight) ;
+ SyncTasks[NOfSyncPaths] := i ;
+ fi ;
+ else :
+ SyncPaths[NOfSyncPaths] := SyncBox(n, i, SyncLeftOffset, SyncWidth, 0, -PaperHeight) ;
+ SyncTasks[NOfSyncPaths] := i ;
+ fi ;
+ else :
+ SyncPaths[NOfSyncPaths] := SyncBox(n, i, SyncLeftOffset, SyncWidth, 0, -PaperHeight) ;
+ SyncTasks[NOfSyncPaths] := i ;
+ fi ;
+ ok := true ;
+ fi ;
+ endfor ;
+ if (NOfSyncPaths = 0) and (l > 0) :
+ NOfSyncPaths := 1 ;
+ SyncPaths[NOfSyncPaths] := SyncBox(n, l, SyncLeftOffset, SyncWidth, PaperHeight, -PaperHeight) ;
+ SyncTasks[NOfSyncPaths] := l ;
+ fi ;
+ if NOfSyncPaths > 0 :
+ for i = 1 upto NOfSyncPaths-1 :
+ SyncPaths[i] := topboundary SyncPaths[i] -- reverse topboundary SyncPaths[i+1] -- cycle ;
+ endfor ;
+ if unknown SyncThresholdMethod :
+ numeric SyncThresholdMethod ; SyncThresholdMethod := 2 ;
+ fi ;
+ if extendtop :
+ if SyncThresholdMethod = 1 :
+ if NOfSyncPaths>1 :
+ d := ypart (ulcorner PlainTextArea - sync_xy[n][SyncTasks[2]]) ;
+ if (SyncTasks[2]>1) and (d > 0pt) and (d <= TheSyncThreshold(n,sync_t[n][SyncTasks[2]])) and (sync_p[n][SyncTasks[2]] = RealPageNumber) :
+ SyncPaths[2] := SyncPaths[2] topenlarged PaperHeight ;
+ fi ;
+ fi ;
+ else :
+ for i = 1 upto NOfSyncPaths :
+ d := ypart (ulcorner PlainTextArea - sync_xy[n][SyncTasks[i]]) ;
+ if (d > 0) and (d <= TheSyncThreshold(n,sync_t[n][SyncTasks[i]])) and (sync_p[n][SyncTasks[i]] = RealPageNumber) :
+ SyncPaths[i] := SyncPaths[i] topenlarged PaperHeight ;
+ fi ;
+ endfor ;
+ fi ;
+ fi ;
+ if prestartnext :
+ if NOfSyncPaths>1 :
+ if SyncTasks[NOfSyncPaths] < sync_n[n] : % there is a next one
+ d := ypart (ulcorner PlainTextArea - sync_xy[n][SyncTasks[NOfSyncPaths]+1]) ;
+ if (d > 0) and (d <= TheSyncThreshold(n, sync_t[n][SyncTasks[i]])) and (sync_p[n][SyncTasks[NOfSyncPaths]+1] = RealPageNumber+1) :
+ SyncPaths[NOfSyncPaths+1] :=
+ (xpart ulcorner SyncPaths[NOfSyncPaths],ypart llcorner PlainTextArea) --
+ (xpart urcorner SyncPaths[NOfSyncPaths],ypart llcorner PlainTextArea) --
+ lrcorner SyncPaths[NOfSyncPaths] --
+ llcorner SyncPaths[NOfSyncPaths] -- cycle ;
+ SyncTasks[NOfSyncPaths+1] := SyncTasks[NOfSyncPaths]+1 ;
+ NOfSyncPaths := NOfSyncPaths + 1 ;
+ fi ;
+ fi ;
+ fi ;
+ else :
+ if NOfSyncPaths>1 :
+ d := ypart (sync_xy[n][SyncTasks[NOfSyncPaths]] - llcorner PlainTextArea) ;
+ if (d < TheSyncThreshold(n, SyncTasks[NOfSyncPaths])) :
+ NOfSyncPaths := NOfSyncPaths - 1 ;
+ SyncPaths[NOfSyncPaths] := SyncPaths[NOfSyncPaths] bottomenlarged PaperHeight ;
+ fi ;
+ fi ;
+ fi ;
+ if (NOfSyncPaths>1) and collapse :
+ save j ; numeric j ; j := 1 ;
+ for i = 2 upto NOfSyncPaths :
+ if sync_t[n][SyncTasks[i]] = sync_t[n][SyncTasks[j]] :
+ SyncPaths[j] := boundingbox image (draw SyncPaths[i] ; draw SyncPaths[j] ; ) ;
+ SyncTasks[j] := SyncTasks[i] ;
+ else :
+ j := j + 1 ;
+ SyncPaths[j] := SyncPaths[i] ;
+ SyncTasks[j] := SyncTasks[i] ;
+ fi ;
+ endfor ;
+ NOfSyncPaths := j ;
+ fi ;
+ fi ;
+ fi ;
+enddef ;
+
+def SyncTask(expr n) =
+ if known SyncTasks[n] : SyncTasks[n] else : 0 fi
+enddef ;
+
+def FlushSyncTasks =
+ for i = 1 upto NOfSyncPaths :
+ ProcessSyncTask(SyncPaths[i], TheSyncColor(CurrentSyncClass,sync_t[CurrentSyncClass][SyncTasks[i]])) ;
+ endfor ;
+enddef ;
+
+def ProcessSyncTask(expr p, c) =
+ fill p withcolor c ;
+enddef ;
+
+endinput ; \ No newline at end of file