Initial release of Maemo 5 port of gnuplot
[gnuplot] / demo / macros.dem
diff --git a/demo/macros.dem b/demo/macros.dem
new file mode 100644 (file)
index 0000000..4569d4a
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Experimental option GP_MACROS
+#
+
+if ((GPVAL_VERSION == 4.1 || GPVAL_VERSION == 4.2) \
+&&  (!strstrt(GPVAL_COMPILE_OPTIONS,"+MACROS"))) \
+    print ">>> Skipping demo <<<\n" ; \
+    print "This copy of gnuplot was built without support for macro substitution\n" ; \
+    exit ;
+
+set macros
+title = "Test of command line macro substitution"
+style1 = "points"
+style2 = "lines lw 2"
+plot1 = "'1.dat' using 1:2 with @style1"
+plot2 = "'1.dat' using 1:($2+1) with @style2"
+plot3 = '@plot2'
+plot4 = '@plot3'
+plot5 = '@plot4'
+plot6 = '@plot5'
+#
+set title title
+plot @plot1 title 'plot1', \
+     @plot2 title 'plot2'
+show var
+#
+pause -1 "<cr> to test recursion depth"
+#
+plot @plot1 title 'plot1', @plot3 lt 3 title 'Recursion depth 3'
+pause 1
+plot @plot1 title 'plot1', @plot4 lt 4 title 'Recursion depth 4'
+pause 1
+plot @plot1 title 'plot1', @plot5 lt 5 title 'Recursion depth 5'
+pause 1
+plot @plot1 title 'plot1', @plot6 lt 6 title 'Recursion depth 6'
+pause 1
+#
+pause -1
+