|
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
40
41
42
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
<h3>Techniques to Extract Values</h3>
Extracting multiple values from a line and calling separate programs on each:
In your logpro file create a hook and either an expect (can be any of error, warning, ignore or required).
<verbatim>
(hook:add "quadval" "echo \"Value1: #{m1}\";echo \"Value2: #{m2}\";echo \"Value3: #{m3}\";echo \"Value4: #{m4}\"")
;; Use expect:required to extract some values
(expect:required in "LogFileBody" = 1 "Quad values" #/First:\s+(\d+)\s+Second:\s+(\d+)\s+Third:\s+(\d+)\s+Fourth:\s+(\d+)/ hook: "quadval")
</verbatim>
If the logfile for this example contains this line:
<verbatim>
// A case where we are capturing multiple values on a single line and exectuting
// multiple calls to load them
First: 1 Second: 2 Third: 3 Fourth: 4
</verbatim>
Then the output will show the calls to echo in the hook:add line:
<verbatim>
LOGPRO Required: Quad values = 1 in section LogFileBody on line 40
NONERR HOOK CALLED: echo "Value1: 1";echo "Value2: 2";echo "Value3: 3";echo "Value4: 4"
Value1: 1
Value2: 2
Value3: 3
Value4: 4
First: 1 Second: 2 Third: 3 Fourth: 4
</verbatim>
If you are using megatest to capture results and roll them up you could use a hook specification like this:
megatest -set-values :value #{m1} :expected_value 0 :tol 1 :category extents :variable ll :units km
(hook:add "qualval" (conc
"megatest -set-values :value #{m1} :expected_value 0 :tol 1 :category extents :variable ll :units km;"
"megatest -set-values :value #{m2} :expected_value 0 :tol 1 :category extents :variable ll :units km;"
"megatest -set-values :value #{m3} :expected_value 0 :tol 1 :category extents :variable ll :units km;"
"megatest -set-values :value #{m4} :expected_value 0 :tol 1 :category extents :variable ll :units km"))
</verbatim>
Note: "conc" is the string concatenation operator in Chicken Scheme.
|