-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathvars.save.fmfn
More file actions
39 lines (35 loc) · 1.22 KB
/
vars.save.fmfn
File metadata and controls
39 lines (35 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* =====================================================
* vars.save( valuelist )
* RETURNS: (string) Return delimted list of valid variable declarations
* DEPENDENCIES: none
* NOTES: see var.define for how/where variables are saved
* =====================================================
*
*/
Let ( [
//$$var.test = "example data";
//valuelist = "one¶two¶three"; // used for testing
var.topmost_value = GetValue ( valuelist ; 1 );
var.remaining_values = If ( ValueCount ( valuelist ) = 1 ; "" ;
// Stupid xValues functions return a \r
Substitute( RightValues ( valuelist ; ValueCount ( valuelist ) - 1 ) & ¶ ; "¶¶" ; "" )
);
var.value = Evaluate ( "$$" & var.topmost_value );
var.value = If ( var.value ≠ "?" ; var.value ; "ERROR" );
var.string = "$$" & var.topmost_value & " = " & Quote ( var.value );
$variables.save = List ( $variables.save ; var.string )
];
If ( isempty ( var.remaining_values ) ; $variables.save ; vars.save ( var.remaining_values ) )
)
/*
// Testing code
Let( [
$variables.save = "";
$$one = 1;
$$two = 2;
$$three = 3
];
vars.save ( List ( "one" ; "two" ; "three" ) )
)
*/