summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-07-19 12:00:13 +0300
committerMarius <mariausol@gmail.com>2011-07-19 12:00:13 +0300
commitd2b92bb7de0e604d78557c52618d090863d4224c (patch)
treebd470fc88e304ae44df08c52a1b14f838aa4a3da /metapost
parenta8d0a863d99794b231e58c0e8945448c19bd6215 (diff)
downloadcontext-d2b92bb7de0e604d78557c52618d090863d4224c.tar.gz
beta 2011.07.19 10:35
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-grph.mp24
1 files changed, 20 insertions, 4 deletions
diff --git a/metapost/context/base/mp-grph.mp b/metapost/context/base/mp-grph.mp
index 3cd9f2cfb..48776a09f 100644
--- a/metapost/context/base/mp-grph.mp
+++ b/metapost/context/base/mp-grph.mp
@@ -22,13 +22,29 @@ string CRLF ; CRLF := char 10 & char 13 ;
picture _currentpicture_ ;
+numeric _fig_nesting_ ; _fig_nesting_ := 0 ;
+
def beginfig (expr c) =
- begingroup
- charcode := c ;
- resetfig ;
- scantokens extra_beginfig ;
+ _fig_nesting_ := _fig_nesting_ + 1 ;
+ if _fig_nesting_ = 1 :
+ begingroup
+ charcode := c ;
+ resetfig ;
+ scantokens extra_beginfig ;
+ fi ;
enddef ;
+def endfig =
+ ; % safeguard
+ if _fig_nesting_ = 1 :
+ scantokens extra_endfig;
+ shipit ;
+ endgroup ;
+ fi ;
+ _fig_nesting_ := _fig_nesting_ - 1 ;
+enddef;
+
+
def resetfig =
clearxy ;
clearit ;