summaryrefslogtreecommitdiff
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
parentee5f041e32f7411573495533cbe316fbd4b5aec8 (diff)
downloadcontext-7c430e2d6554f060df047a829d1fea0a5023ad3a.tar.gz
beta 2011.10.20 11:44
-rw-r--r--metapost/context/base/mp-char.mpiv346
-rw-r--r--metapost/context/base/mp-tool.mpiv2
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4105 -> 4112 bytes
-rw-r--r--tex/context/base/context-version.pngbin105305 -> 105750 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/m-chart.lua77
-rw-r--r--tex/context/base/status-files.pdfbin24095 -> 24113 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin163918 -> 163916 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
12 files changed, 269 insertions, 166 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
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 184b572cc..9ac76e424 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.10.19 23:10}
+\newcontextversion{2011.10.20 11:44}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 1e045568d..438df663c 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.10.19 23:10}
+\newcontextversion{2011.10.20 11:44}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 3753826da..86bb8863b 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index f031c57fb..6463ff5a7 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 98ee11df7..03e9469dd 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.10.19 23:10}
+\edef\contextversion{2011.10.20 11:44}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 49ca9eec4..d5e4549ec 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.10.19 23:10}
+\edef\contextversion{2011.10.20 11:44}
%D For those who want to use this:
diff --git a/tex/context/base/m-chart.lua b/tex/context/base/m-chart.lua
index 1d76e9845..2b1761558 100644
--- a/tex/context/base/m-chart.lua
+++ b/tex/context/base/m-chart.lua
@@ -101,10 +101,29 @@ local validshapes = {
}
local validlabellocations = {
- l = "l", left = "l",
- r = "r", right = "r",
- t = "t", top = "t",
- b = "b", bottom = "b",
+ l = "l", left = "l",
+ r = "r", right = "r",
+ t = "t", top = "t",
+ b = "b", bottom = "b",
+ lt = "lt",
+ rt = "rt",
+ lb = "lb",
+ rb = "rb",
+}
+
+local validcommentlocations = {
+ l = "l", left = "l",
+ r = "r", right = "r",
+ t = "t", top = "t",
+ b = "b", bottom = "b",
+ lt = "lt",
+ rt = "rt",
+ lb = "lb",
+ rb = "rb",
+ tl = "lt",
+ tr = "rt",
+ bl = "lb",
+ br = "rb",
}
setmetatableindex(validshapes,function(t,k)
@@ -180,7 +199,6 @@ end
function commands.flow_start_cell(settings)
temp = {
labels = { },
- comments = { },
exits = { },
connections = { },
settings = settings,
@@ -231,11 +249,20 @@ function commands.flow_set_label(location,text)
}
end
-function commands.flow_set_comment(name,str)
- temp.comments[#temp.comments+1] = {
- location = location,
- text = text,
- }
+function commands.flow_set_comment(location,text)
+ local connections = temp.connections
+ if connections then
+ local connection = connections[#connections]
+ if connection then
+ local comments = connection.comments
+ if comments then
+ comments[#comments+1] = {
+ location = location,
+ text = text,
+ }
+ end
+ end
+ end
end
function commands.flow_set_exit(location,text)
@@ -408,6 +435,7 @@ function commands.flow_set_connection(location,displacement,name)
dx = dx or 0,
dy = dy or 0,
name = name,
+ comments = { },
}
end
@@ -453,7 +481,6 @@ local function process_cells(chart,xoffset,yoffset)
context("flow_shape_line_width := %s ; " , points(shapesettings.rulethickness))
end
context("flow_peepshape := false ;") -- todo
--- context("flow_new_shape(%s,%s,%s) ;",cell.x+xoffset,cell.y+yoffset,shapedata.number)
context("flow_new_shape(%s,%s,%s) ;",cell.x+xoffset,cell.y+yoffset,shapedata.number)
context("flow_end_sub_chart ;")
end
@@ -523,7 +550,7 @@ local function process_connections(chart,xoffset,yoffset)
context("flow_dsp_x := %s ; flow_dsp_y := %s ;",connection.dx or 0, connection.dy or 0)
context("flow_connection_line_color := \\MPcolor{%s} ;",linesettings.color)
context("flow_connection_line_width := 2pt ;",points(linesettings.rulethickness))
- context("flow_connect_%s_%s(%s,%s,%s) (%s,%s,%s) ;",where_cell,where_other,cellx,celly,what_cell,otherx,othery,what_other)
+ context("flow_connect_%s_%s (%s) (%s,%s,%s) (%s,%s,%s) ;",where_cell,where_other,j,cellx,celly,what_cell,otherx,othery,what_other)
context("flow_dsp_x := 0 ; flow_dsp_y := 0 ;")
end
end
@@ -535,6 +562,8 @@ end
local texttemplate = "\\setvariables[flowcell:text][x=%s,y=%s,text={%s},align={%s},figure={%s},destination={%s}]"
+local splitter = lpeg.splitat(":")
+
local function process_texts(chart,xoffset,yoffset)
local data = chart.data
local hash = chart.hash
@@ -577,9 +606,24 @@ local function process_texts(chart,xoffset,yoffset)
end
end
end
- local comments = cell.comments
- for i=1,#comments do
- -- invisible
+ local connections = cell.connections
+ for i=1,#connections do
+ local comments = connections[i].comments
+ for j=1,#comments do
+ local comment = comments[j]
+ local text = comment.text
+ local location = comment.location or ""
+ local length = 0
+ local loc, len = lpegmatch(splitter,location)
+ if loc then
+ location = loc
+ length = tonumber(len) or 0
+ end
+ location = validcommentlocations[location]
+ if text and location then
+ context('flow_chart_draw_comment(%s,%s,%s,%s,textext("%s"),"%s",%s) ;',x,y,i,j,text,location,length)
+ end
+ end
end
end
end
@@ -702,10 +746,13 @@ local function makechart(chart)
local gridwidth = shapewidth + 2*settings.chart.dx
local shapeheight = settings.chart.height
local gridheight = shapeheight + 2*settings.chart.dy
+ local chartoffset = settings.chart.offset
+
context("flow_grid_width := %s ;", points(gridwidth))
context("flow_grid_height := %s ;", points(gridheight))
context("flow_shape_width := %s ;", points(shapewidth))
context("flow_shape_height := %s ;", points(shapeheight))
+ context("flow_chart_offset := %s ;", points(chartoffset))
--
local radius = settings.line.radius
local rulethickness = settings.line.rulethickness
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index d299bfc1a..f73987ff8 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index ec6a091ca..1022b300b 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 4f82f9b8f..1a110f706 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 10/19/11 23:10:36
+-- merge date : 10/20/11 11:44:39
do -- begin closure to overcome local limits and interference