#588 "Here document" data blocks

closed-accepted
nobody
None
5
2012-06-26
2012-06-12
Ethan Merritt
No

This patch adds support for the definition and use of in-line data blocks using here document syntax:
$Mydata << EOD
11 22 33 data line 1
44 55 66 data line 2
# comments, etc, as with a normal data file
77 88 99
EOD

stats $Mydata using 3
plot $Mydata with filledcurves

Notes:
- A datablock name must begin with $. This allows us to use the existing code for tracking and manipulating user defined variables while insuring that datablocks can not be mixed in normal variables in expressions, functions, etc.
- No attempt is made to parse the contents of the data block at the time it is defined. The lines are simply stored for later use.
- All the usual options for 'using' 'every' etc apply to data blocks just as they do for input from a file.

Discussion

  • Ethan Merritt
    Ethan Merritt
    2012-06-13

    Updated patch works for "fit", plugs a memory leak if datablocks are cleared using "undefine $*", and safely traps attempts to define a datablock inside an "eval" statement or curly-brace clause.

     
  • Ethan Merritt
    Ethan Merritt
    2012-06-19

    fix memory leak; final version?

     
  • Ethan Merritt
    Ethan Merritt
    2012-06-26

    • status: open --> closed-accepted