summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2011-10-20 11:44:00 +0200
committerHans Hagen <pragma@wxs.nl>2011-10-20 11:44:00 +0200
commit7c430e2d6554f060df047a829d1fea0a5023ad3a (patch)
tree4bb329759f4a64e42fd20368b0e09c5b5f7d1aae /metapost
parentee5f041e32f7411573495533cbe316fbd4b5aec8 (diff)
downloadcontext-7c430e2d6554f060df047a829d1fea0a5023ad3a.tar.gz
beta 2011.10.20 11:44
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-char.mpiv346
-rw-r--r--metapost/context/base/mp-tool.mpiv2
2 files changed, 202 insertions, 146 deletions
diff --git a/metapost/context/base/mp-char.mpiv b/metapost/context/base/mp-char.mpiv
index 83fa20155..91d50b912 100644
--- a/metapost/context/base/mp-char.mpiv
+++ b/metapost/context/base/mp-char.mpiv
@@ -11,7 +11,10 @@
%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
%C details.
-%D This is ancient code .. but I see no need to rewrite it.
+%D This is ancient code .. but I see no need to rewrite it. This is
+%D already a partial rewrite but more could be delegated to \LUA\
+%D when used in \CONTEXT\ but it does not pay off now to look into
+%D that.
if unknown context_shap : input "mp-shap.mpiv" ; fi ;
if known context_flow : endinput ; fi ;
@@ -119,38 +122,41 @@ def flow_new_chart =
flow_dash_pattern := nullpicture ;
- numeric flow_xypoint ; flow_xypoint := 0 ;
- numeric flow_cpath ; flow_cpath := 0 ;
-
- pair flow_xypoints [] ;
- boolean flow_xyfree [][] ;
- path flow_xypath [][] ;
- numeric flow_xysx [][] ;
- numeric flow_xysy [][] ;
- color flow_xyfill [][] ;
- color flow_xydraw [][] ;
- numeric flow_xyline [][] ;
- boolean flow_xypeep [][] ;
- picture flow_xytext [][] ;
- picture flow_xylabel_l[][] ;
- picture flow_xylabel_r[][] ;
- picture flow_xylabel_t[][] ;
- picture flow_xylabel_b[][] ;
- picture flow_xyexit_l [][] ;
- picture flow_xyexit_r [][] ;
- picture flow_xyexit_t [][] ;
- picture flow_xyexit_b [][] ;
- path flow_cpaths [] ;
- numeric flow_cline [] ;
- color flow_ccolor [] ;
- boolean flow_carrow [] ;
- boolean flow_cdash [] ;
- boolean flow_ccross [] ;
-
- picture flow_tpicture[][] ;
- picture flow_bpicture[][] ;
- picture flow_lpicture[][] ;
- picture flow_rpicture[][] ;
+ numeric flow_xypoint ; flow_xypoint := 0 ;
+ numeric flow_cpath ; flow_cpath := 0 ;
+
+ pair flow_xypoints [] ;
+ boolean flow_xyfree [][] ;
+ path flow_xypath [][] ;
+ numeric flow_xysx [][] ;
+ numeric flow_xysy [][] ;
+ color flow_xyfill [][] ;
+ color flow_xydraw [][] ;
+ numeric flow_xyline [][] ;
+ boolean flow_xypeep [][] ;
+ picture flow_xytext [][] ;
+ picture flow_xylabel_l [][] ;
+ picture flow_xylabel_r [][] ;
+ picture flow_xylabel_t [][] ;
+ picture flow_xylabel_b [][] ;
+ picture flow_xyexit_l [][] ;
+ picture flow_xyexit_r [][] ;
+ picture flow_xyexit_t [][] ;
+ picture flow_xyexit_b [][] ;
+ picture flow_xycomment_txt[][][][] ;
+ string flow_xycomment_loc[][][][] ;
+ numeric flow_xycomment_len[][][][] ;
+ path flow_cpaths [] ;
+ numeric flow_cline [] ;
+ color flow_ccolor [] ;
+ boolean flow_carrow [] ;
+ boolean flow_cdash [] ;
+ boolean flow_ccross [] ;
+ picture flow_tpicture [][] ;
+ picture flow_bpicture [][] ;
+ picture flow_lpicture [][] ;
+ picture flow_rpicture [][] ;
+ path flow_centers [][][] ;
predefined_shapes[61] := (fullcircle scaled (1.5*predefined_shapes_yradius) xscaled (flow_grid_height/flow_grid_width)) ;
predefined_shapes[62] := (fullcircle scaled (2.0*predefined_shapes_yradius) xscaled (flow_grid_height/flow_grid_width)) ;
@@ -160,11 +166,11 @@ enddef ;
flow_new_chart ;
def flow_y_pos(expr y) =
- if flow_reverse_y :
+% if flow_reverse_y :
flow_max_y + 1 - y
- else :
- y
- fi
+% else :
+% y
+% fi
enddef ;
def flow_initialize_grid(expr maxx, maxy) =
@@ -381,17 +387,22 @@ vardef flow_connection_path =
flow_xypoints[flow_xypoint])
enddef ;
-def flow_draw_connection =
+def flow_draw_connection(expr i,xfrom,yfrom,xto,yto) = % 'i' is a comment reference
if flow_xypoint > 0 :
flow_collapse_points ;
flow_trim_points ;
- flow_cpath := flow_cpath + 1 ;
+ flow_cpath := flow_cpath + 1 ; % maybe also store as x,y
flow_cpaths[flow_cpath] := flow_connection_path flow_scaled_to_grid ;
flow_cline[flow_cpath] := flow_connection_line_width ;
flow_ccolor[flow_cpath] := flow_connection_line_color ;
flow_carrow[flow_cpath] := flow_arrowtip ;
flow_cdash[flow_cpath] := flow_dashline ;
flow_ccross[flow_cpath] := flow_showcrossing ;
+ if flow_reverse_connection :
+ flow_centers[xto] [yto] [i] := flow_cpaths[flow_cpath] ;
+ else :
+ flow_centers[xfrom][yfrom][i] := flow_cpaths[flow_cpath] ;
+ fi ;
else :
message("no connection defined") ;
fi ;
@@ -450,46 +461,85 @@ def flow_draw_midpoint (expr n) =
endgroup ;
enddef ;
-def flow_flush_picture(expr x, yy) =
- begingroup ; save y ; numeric y ;
+def flow_flush_picture(expr x, yy) = % more in lua
+ begingroup ;
+ save y ; numeric y ;
y := flow_y_pos(yy) ;
- if known flow_xytext[x][y] :
+ if known flow_xytext[x][y] : % maybe test on path for comments
begingroup ;
% flow_xypath[x][y]
save p, offset ; path p ; pair offset ;
offset := flow_xy_offset((x+0.5)*flow_grid_width,(flow_max_y-y+1.5)*flow_grid_height) ;
offset := offset shifted (-flow_xyline[x][y]/4,-flow_xyline[x][y]/4) ; % terrible hack (some compensation)
- p := fullsquare
- xscaled flow_grid_width
- yscaled flow_grid_height
- shifted offset ;
- if known flow_xytext[x][y]:
- draw flow_xytext[x][y] shifted offset ;
+ p := fullsquare xscaled flow_grid_width yscaled flow_grid_height shifted offset ;
+ %
+ save loc ; string loc ;
+ save len ; numeric len ;
+ save txt ; picture txt ;
+ save cen ; path cen ;
+ %
+ txt := flow_xytext[x][y] ; if known txt :
+ draw txt shifted offset ;
fi ;
- if known flow_xylabel_t[x][y] :
- label.urt(flow_xylabel_t[x][y],0.5[ulcorner p,urcorner p]) ;
+ % is simple comment (sort of obsolete)
+ txt := flow_xylabel_t[x][y] ; if known txt :
+ label.urt(txt,0.5[ulcorner p,urcorner p]) ;
fi ;
- if known flow_xylabel_b[x][y] :
- label.lrt(flow_xylabel_b[x][y],0.5[llcorner p,lrcorner p]) ;
+ txt := flow_xylabel_b[x][y] ; if known txt :
+ label.lrt(txt,0.5[llcorner p,lrcorner p]) ;
fi ;
- if known flow_xylabel_l[x][y] :
- label.ulft(flow_xylabel_l[x][y],0.5[ulcorner p,llcorner p]) ;
+ txt := flow_xylabel_l[x][y] ; if known txt :
+ label.ulft(txt,0.5[ulcorner p,llcorner p]) ;
fi ;
- if known flow_xylabel_r[x][y] :
- label.urt (flow_xylabel_r[x][y],0.5[urcorner p,lrcorner p]) ;
+ txt := flow_xylabel_r[x][y] ; if known txt :
+ label.urt (txt,0.5[urcorner p,lrcorner p]) ;
fi ;
- if known flow_xyexit_t[x][y] :
- label.top(flow_xyexit_t[x][y],0.5[ulcorner p,urcorner p] shifted (0, flow_grid_height/2)) ;
+ % is shifted comment
+ txt := flow_xyexit_t[x][y] ; if known txt :
+ label.top(txt,0.5[ulcorner p,urcorner p] shifted (0, flow_grid_height/2)) ;
fi ;
- if known flow_xyexit_b[x][y] :
- label.bot(flow_xyexit_b[x][y],0.5[llcorner p,lrcorner p] shifted (0,-flow_grid_height/2)) ;
+ txt := flow_xyexit_b[x][y] ; if known txt :
+ label.bot(txt,0.5[llcorner p,lrcorner p] shifted (0,-flow_grid_height/2)) ;
fi ;
- if known flow_xyexit_l[x][y] :
- label.lft(flow_xyexit_l[x][y],0.5[ulcorner p,llcorner p] shifted (-flow_grid_width/2,0)) ;
+ txt := flow_xyexit_l[x][y] ; if known txt :
+ label.lft(txt,0.5[ulcorner p,llcorner p] shifted (-flow_grid_width/2,0)) ;
fi ;
- if known flow_xyexit_r[x][y] :
- label.rt (flow_xyexit_r[x][y],0.5[urcorner p,lrcorner p] shifted ( flow_grid_width/2,0)) ;
+ txt := flow_xyexit_r[x][y] ; if known txt :
+ label.rt (txt,0.5[urcorner p,lrcorner p] shifted ( flow_grid_width/2,0)) ;
fi ;
+ % along the path or anchored
+ for i=1 upto infinity :
+ cen := flow_centers[x][y][i] ;
+ if unknown cen :
+ break ;
+ else :
+ for j=1 upto infinity :
+ txt := flow_xycomment_txt[x][y][i][j] ;
+ if unknown txt :
+ break ;
+ else : % todo: see how we can store suffix
+ loc := flow_xycomment_loc[x][y][i][j] ;
+ len := flow_xycomment_len[x][y][i][j] ;
+ pair a ;
+ if len <> 0 :
+ a := point len along cen ;
+ fi ;
+ if loc = "tl" : label.ulft(txt,if len = 0 : 0.5[ulcorner p,urcorner p] else : a fi) ;
+ elseif loc = "t" : label.top (txt,if len = 0 : 0.5[ulcorner p,urcorner p] else : a fi) ;
+ elseif loc = "tr" : label.urt (txt,if len = 0 : 0.5[ulcorner p,urcorner p] else : a fi) ;
+ elseif loc = "bl" : label.llft(txt,if len = 0 : 0.5[llcorner p,lrcorner p] else : a fi) ;
+ elseif loc = "b" : label.bot (txt,if len = 0 : 0.5[llcorner p,lrcorner p] else : a fi) ;
+ elseif loc = "br" : label.lrt (txt,if len = 0 : 0.5[llcorner p,lrcorner p] else : a fi) ;
+ elseif loc = "lt" : label.ulft(txt,if len = 0 : 0.5[ulcorner p,llcorner p] else : a fi) ;
+ elseif loc = "l" : label.lft (txt,if len = 0 : 0.5[ulcorner p,llcorner p] else : a fi) ;
+ elseif loc = "lb" : label.lrt (txt,if len = 0 : 0.5[ulcorner p,llcorner p] else : a fi) ;
+ elseif loc = "rt" : label.urt (txt,if len = 0 : 0.5[urcorner p,lrcorner p] else : a fi) ;
+ elseif loc = "r" : label.rt (txt,if len = 0 : 0.5[urcorner p,lrcorner p] else : a fi) ;
+ elseif loc = "rb" : label.lrt (txt,if len = 0 : 0.5[urcorner p,lrcorner p] else : a fi) ; fi ;
+ fi ;
+ endfor ;
+ fi ;
+ endfor ;
endgroup ;
fi ;
endgroup ;
@@ -499,15 +549,21 @@ def flow_chart_draw_text(expr x, y, p) =
flow_xytext[x][y] := p ;
enddef ;
-def flow_chart_draw_label_t(expr x, y, p) = flow_xylabel_t[x][y] := p ; enddef ;
-def flow_chart_draw_label_b(expr x, y, p) = flow_xylabel_b[x][y] := p ; enddef ;
-def flow_chart_draw_label_l(expr x, y, p) = flow_xylabel_l[x][y] := p ; enddef ;
-def flow_chart_draw_label_r(expr x, y, p) = flow_xylabel_r[x][y] := p ; enddef ;
+def flow_chart_draw_label_t (expr x, y, p) = flow_xylabel_t [x][y] := p ; enddef ;
+def flow_chart_draw_label_b (expr x, y, p) = flow_xylabel_b [x][y] := p ; enddef ;
+def flow_chart_draw_label_l (expr x, y, p) = flow_xylabel_l [x][y] := p ; enddef ;
+def flow_chart_draw_label_r (expr x, y, p) = flow_xylabel_r [x][y] := p ; enddef ;
-def flow_chart_draw_exit_t (expr x, y, p) = flow_xyexit_t [x][y] := p ; enddef ;
-def flow_chart_draw_exit_b (expr x, y, p) = flow_xyexit_b [x][y] := p ; enddef ;
-def flow_chart_draw_exit_l (expr x, y, p) = flow_xyexit_l [x][y] := p ; enddef ;
-def flow_chart_draw_exit_r (expr x, y, p) = flow_xyexit_r [x][y] := p ; enddef ;
+def flow_chart_draw_exit_t (expr x, y, p) = flow_xyexit_t [x][y] := p ; enddef ;
+def flow_chart_draw_exit_b (expr x, y, p) = flow_xyexit_b [x][y] := p ; enddef ;
+def flow_chart_draw_exit_l (expr x, y, p) = flow_xyexit_l [x][y] := p ; enddef ;
+def flow_chart_draw_exit_r (expr x, y, p) = flow_xyexit_r [x][y] := p ; enddef ;
+
+def flow_chart_draw_comment (expr x, y, i, j, p, l, n) =
+ flow_xycomment_txt[x][y][i][j] := p ;
+ flow_xycomment_loc[x][y][i][j] := l ;
+ flow_xycomment_len[x][y][i][j] := n ;
+enddef ;
boolean flow_reverse_connection ; flow_reverse_connection := false ;
@@ -613,7 +669,7 @@ vardef flow_valid_connection (expr xfrom, yfrom, xto, yto) =
endgroup
enddef ;
-def flow_connect_top_bottom (expr xfrom, yyfrom, zfrom) (expr xto, yyto, zto) =
+def flow_connect_top_bottom (expr n) (expr xfrom, yyfrom, zfrom) (expr xto, yyto, zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,6) :
@@ -638,11 +694,11 @@ def flow_connect_top_bottom (expr xfrom, yyfrom, zfrom) (expr xto, yyto, zto) =
flow_xypoints[5] := flow_xypoints[5] shifted (0,flow_dsp_y) ;
fi
%%%% end experiment
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_left_right (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_left_right (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,6) :
@@ -662,11 +718,11 @@ def flow_connect_left_right (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
flow_xypoints[4] := flow_xypoints[4] shifted (0,-flow_dsp_y) ;
fi ;
%%%% end experiment
- flow_draw_connection ;
- fi ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
+ fi ;
enddef ;
-def flow_connect_left_top (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_left_top (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,5) :
@@ -678,11 +734,11 @@ def flow_connect_left_top (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
if not flow_valid_connection(xfrom,yfrom,xto,yto) :
flow_xypoints[3] := flow_xy_on_grid(2,4) ;
fi ;
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_left_bottom (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_left_bottom (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,5) :
@@ -694,11 +750,11 @@ def flow_connect_left_bottom (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
if not flow_valid_connection(xfrom,yfrom,xto,yto) :
flow_xypoints[3] := flow_xy_on_grid(2,4) ;
fi ;
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_right_top (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_right_top (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,5) :
@@ -710,11 +766,11 @@ def flow_connect_right_top (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
if not flow_valid_connection(xfrom,yfrom,xto,yto) :
flow_xypoints[3] := flow_xy_on_grid(2,4) ;
fi ;
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_right_bottom (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_right_bottom (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,5) :
@@ -737,11 +793,11 @@ def flow_connect_right_bottom (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
flow_xypoints[4] := flow_xypoints[4] shifted (0,flow_dsp_y) ;
fi
%%%% end experiment
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_left_left (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_left_left (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,6) :
@@ -755,11 +811,11 @@ def flow_connect_left_left (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
flow_xypoints[3] := flow_y_on_grid(2,yfrom,yto,zfrom) ;
flow_xypoints[4] := flow_xy_on_grid(5,3) ;
fi ;
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_right_right (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_right_right (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,6) :
@@ -773,11 +829,11 @@ def flow_connect_right_right (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
flow_xypoints[3] := flow_y_on_grid(2,yfrom,yto,zfrom) ;
flow_xypoints[4] := flow_xy_on_grid(5,3) ;
fi ;
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_top_top (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_top_top (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,6) :
@@ -799,11 +855,11 @@ def flow_connect_top_top (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
flow_xypoints[5] := flow_xypoints[5] shifted (0,flow_dsp_y) ;
fi ;
%%%% end experiment
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_bottom_bottom (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
+def flow_connect_bottom_bottom (expr n) (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
yfrom := flow_y_pos(yyfrom) ;
yto := flow_y_pos(yyto) ;
if flow_points_initialized(xfrom,yfrom,xto,yto,6) :
@@ -828,38 +884,38 @@ def flow_connect_bottom_bottom (expr xfrom,yyfrom,zfrom) (expr xto,yyto,zto) =
flow_xypoints[5] := flow_xypoints[5] shifted (0,flow_dsp_y) ;
fi
%%%% end experiment
- flow_draw_connection ;
+ flow_draw_connection(n,xfrom,yyfrom,xto,yyto) ;
fi ;
enddef ;
-def flow_connect_bottom_top (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
+def flow_connect_bottom_top (expr n) (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
flow_reverse_connection := true ;
- flow_connect_top_bottom (xto,yto,zto) (xfrom,yfrom,zfrom) ;
+ flow_connect_top_bottom (n) (xto,yto,zto) (xfrom,yfrom,zfrom) ;
enddef ;
-def flow_connect_right_left (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
+def flow_connect_right_left (expr n) (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
flow_reverse_connection := true ;
- flow_connect_left_right (xto,yto,zto) (xfrom,yfrom,zfrom) ;
+ flow_connect_left_right (n) (xto,yto,zto) (xfrom,yfrom,zfrom) ;
enddef ;
-def flow_connect_top_left (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
+def flow_connect_top_left (expr n) (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
flow_reverse_connection := true ;
- flow_connect_left_top(xto,yto,zto) (xfrom,yfrom,zfrom) ;
+ flow_connect_left_top (n) (xto,yto,zto) (xfrom,yfrom,zfrom) ;
enddef ;
-def flow_connect_bottom_left (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
+def flow_connect_bottom_left (expr n) (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
flow_reverse_connection := true ;
- flow_connect_left_bottom (xto,yto,zto) (xfrom,yfrom,zfrom) ;
+ flow_connect_left_bottom (n) (xto,yto,zto) (xfrom,yfrom,zfrom) ;
enddef ;
-def flow_connect_top_right (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
+def flow_connect_top_right (expr n) (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
flow_reverse_connection := true ;
- flow_connect_right_top (xto,yto,zto) (xfrom,yfrom,zfrom) ;
+ flow_connect_right_top (n) (xto,yto,zto) (xfrom,yfrom,zfrom) ;
enddef ;
-def flow_connect_bottom_right (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
+def flow_connect_bottom_right (expr n) (expr xfrom,yfrom,zfrom) (expr xto,yto,zto) =
flow_reverse_connection := true ;
- flow_connect_right_bottom (xto,yto,zto) (xfrom,yfrom,zfrom) ;
+ flow_connect_right_bottom (n) (xto,yto,zto) (xfrom,yfrom,zfrom) ;
enddef ;
def flow_draw_test_shape(expr x, y) =
@@ -895,55 +951,55 @@ def flow_show_connection(expr n, m) =
flow_draw_test_shape(6,2) ; flow_draw_test_shape(4,6) ;
if (m=1) :
- flow_connect_top_bottom (2,2,0) (4,5,0) ;
- flow_connect_top_bottom (3,3,0) (5,1,0) ;
- flow_connect_top_bottom (2,5,0) (1,3,0) ;
- flow_connect_top_bottom (6,2,0) (4,6,0) ;
+ flow_connect_top_bottom (0) (2,2,0) (4,5,0) ;
+ flow_connect_top_bottom (0) (3,3,0) (5,1,0) ;
+ flow_connect_top_bottom (0) (2,5,0) (1,3,0) ;
+ flow_connect_top_bottom (0) (6,2,0) (4,6,0) ;
elseif (m=2) :
- flow_connect_top_top (2,2,0) (4,5,0) ;
- flow_connect_top_top (3,3,0) (5,1,0) ;
- flow_connect_top_top (2,5,0) (1,3,0) ;
- flow_connect_top_top (6,2,0) (4,6,0) ;
+ flow_connect_top_top (0) (2,2,0) (4,5,0) ;
+ flow_connect_top_top (0) (3,3,0) (5,1,0) ;
+ flow_connect_top_top (0) (2,5,0) (1,3,0) ;
+ flow_connect_top_top (0) (6,2,0) (4,6,0) ;
elseif (m=3) :
- flow_connect_bottom_bottom (2,2,0) (4,5,0) ;
- flow_connect_bottom_bottom (3,3,0) (5,1,0) ;
- flow_connect_bottom_bottom (2,5,0) (1,3,0) ;
- flow_connect_bottom_bottom (6,2,0) (4,6,0) ;
+ flow_connect_bottom_bottom (0) (2,2,0) (4,5,0) ;
+ flow_connect_bottom_bottom (0) (3,3,0) (5,1,0) ;
+ flow_connect_bottom_bottom (0) (2,5,0) (1,3,0) ;
+ flow_connect_bottom_bottom (0) (6,2,0) (4,6,0) ;
elseif (m=4) :
- flow_connect_left_right (2,2,0) (4,5,0) ;
- flow_connect_left_right (3,3,0) (5,1,0) ;
- flow_connect_left_right (2,5,0) (1,3,0) ;
- flow_connect_left_right (6,2,0) (4,6,0) ;
+ flow_connect_left_right (0) (2,2,0) (4,5,0) ;
+ flow_connect_left_right (0) (3,3,0) (5,1,0) ;
+ flow_connect_left_right (0) (2,5,0) (1,3,0) ;
+ flow_connect_left_right (0) (6,2,0) (4,6,0) ;
elseif (m=5) :
- flow_connect_left_left (2,2,0) (4,5,0) ;
- flow_connect_left_left (3,3,0) (5,1,0) ;
- flow_connect_left_left (2,5,0) (1,3,0) ;
- flow_connect_left_left (6,2,0) (4,6,0) ;
+ flow_connect_left_left (0) (2,2,0) (4,5,0) ;
+ flow_connect_left_left (0) (3,3,0) (5,1,0) ;
+ flow_connect_left_left (0) (2,5,0) (1,3,0) ;
+ flow_connect_left_left (0) (6,2,0) (4,6,0) ;
elseif (m=6) :
- flow_connect_right_right (2,2,0) (4,5,0) ;
- flow_connect_right_right (3,3,0) (5,1,0) ;
- flow_connect_right_right (2,5,0) (1,3,0) ;
- flow_connect_right_right (6,2,0) (4,6,0) ;
+ flow_connect_right_right (0) (2,2,0) (4,5,0) ;
+ flow_connect_right_right (0) (3,3,0) (5,1,0) ;
+ flow_connect_right_right (0) (2,5,0) (1,3,0) ;
+ flow_connect_right_right (0) (6,2,0) (4,6,0) ;
elseif (m=7) :
- flow_connect_left_top (2,2,0) (4,5,0) ;
- flow_connect_left_top (3,3,0) (5,1,0) ;
- flow_connect_left_top (2,5,0) (1,3,0) ;
- flow_connect_left_top (6,2,0) (4,6,0) ;
+ flow_connect_left_top (0) (2,2,0) (4,5,0) ;
+ flow_connect_left_top (0) (3,3,0) (5,1,0) ;
+ flow_connect_left_top (0) (2,5,0) (1,3,0) ;
+ flow_connect_left_top (0) (6,2,0) (4,6,0) ;
elseif (m=8) :
- flow_connect_left_bottom (2,2,0) (4,5,0) ;
- flow_connect_left_bottom (3,3,0) (5,1,0) ;
- flow_connect_left_bottom (2,5,0) (1,3,0) ;
- flow_connect_left_bottom (6,2,0) (4,6,0) ;
+ flow_connect_left_bottom (0) (2,2,0) (4,5,0) ;
+ flow_connect_left_bottom (0) (3,3,0) (5,1,0) ;
+ flow_connect_left_bottom (0) (2,5,0) (1,3,0) ;
+ flow_connect_left_bottom (0) (6,2,0) (4,6,0) ;
elseif (m=9) :
- flow_connect_right_top (2,2,0) (4,5,0) ;
- flow_connect_right_top (3,3,0) (5,1,0) ;
- flow_connect_right_top (2,5,0) (1,3,0) ;
- flow_connect_right_top (6,2,0) (4,6,0) ;
+ flow_connect_right_top (0) (2,2,0) (4,5,0) ;
+ flow_connect_right_top (0) (3,3,0) (5,1,0) ;
+ flow_connect_right_top (0) (2,5,0) (1,3,0) ;
+ flow_connect_right_top (0) (6,2,0) (4,6,0) ;
else :
- flow_connect_right_bottom (2,2,0) (4,5,0) ;
- flow_connect_right_bottom (3,3,0) (5,1,0) ;
- flow_connect_right_bottom (2,5,0) (1,3,0) ;
- flow_connect_right_bottom (6,2,0) (4,6,0) ;
+ flow_connect_right_bottom (0) (2,2,0) (4,5,0) ;
+ flow_connect_right_bottom (0) (3,3,0) (5,1,0) ;
+ flow_connect_right_bottom (0) (2,5,0) (1,3,0) ;
+ flow_connect_right_bottom (0) (6,2,0) (4,6,0) ;
fi ;
flow_end_chart ;
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv
index 79110e752..65a76f8fa 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mp-tool.mpiv
@@ -1190,7 +1190,7 @@ primarydef pct along pat = % also negative
enddef ;
primarydef len on pat =
- (arctime if len>0 : len else : (arclength(pat)+len) fi of pat) of pat
+ ((arctime if len>0 : len else : (arclength(pat)+len) fi of pat) of pat)
enddef ;
% this cuts of a piece from both ends