summaryrefslogtreecommitdiff
path: root/Windows/spice/examples/control_structs/new-check-4.sp
blob: 7c241f23e4f1e6e213bff7adcbd9b96c8f5e2620 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
demonstrate < etc in ft_getpnames

* (compile (concat "tmp-1/ng-spice-rework/src/ngspice " buffer-file-name) t)

VIN  1 0  DC=0

.control

dc VIN 0 10 5

let checks = 0

let const0 = 0
let const5 = 5
let const6 = 6

* check some relational operators, which are in danger to mixed up
*   with csh semantic, that is IO redirection

if const5 < const6
  let checks = checks + 1
else
  echo "ERROR:"
end

if const6 > const5
  let checks = checks + 1
else
  echo "ERROR:"
end

if const5 >= const5
  let checks = checks + 1
else
  echo "ERROR:"
end

if const5 <= const5
  let checks = checks + 1
else
  echo "ERROR:"
end

if const5 = const5
  let checks = checks + 1
else
  echo "ERROR:"
end

* check some wired non-equality operators
*   note: there are some awkward tranformations ahead of the ft_getpnames lexer
*     transforming "><" into "> <"
*     and          "<>" into "< >"
*   note: "!=" would have been in serious danger to be fooled up within
*     csh history mechanism

if const6 <> const5
  let checks = checks + 1
else
  echo "ERROR:"
end

if const6 >< const5
  let checks = checks + 1
else
  echo "ERROR:"
end


* check some boolean operators, which are in danger to be mixed up
*   with csh semantic, `&' background '|' pipe  '~' homedirectory

if const5 & const5
  let checks = checks + 1
else
  echo "ERROR:"
end

if const0 | const5
  let checks = checks + 1
else
  echo "ERROR:"
end

if ~ const0
  let checks = checks + 1
else
  echo "ERROR:"
end

* note:
*   "!=" would be in danger, '!' triggers the csh history mechanism
*if const5 != const6
*  echo "just trying"
*end


* Note: csh semantics swallows the '>' and '<' operators
*   on most of the com lines
* witnessed by
let tmp = const5 > unwanted_output_file_1
define foo(a,b) a > unwanted_output_file_2
print const0 > unwanted_output_file_3

if checks eq 10
  echo "INFO: ok"
end

.endc

.end