forked from ChrisBeaumont/beaumont-idl-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shift.pro
66 lines (64 loc) · 999 Bytes
/
shift.pro
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
;+
; PURPOSE:
; Shift the values associated by up to 5 variables
;
; CATEGORIES:
; utilities
;
; CALLING SEQUENCE:
; shift, a, b, [c, d, e]
;
; INPUTS:
; a: The first variable
; b: The second variable
;
; OPTIONAL INPUTS:
; c: The third variable
; d: The fourth variable
; e: The fifth variable
;
; OUTPUTS:
; The value of a is shifted to b. The value of b is shifted to c, and
; so on. The value of the final supplied variable is shifted to a.
;
; MODIFICATION HISTORY:
; June 2009: Written by Chris Beaumont
;-
pro shift, a, b, c, d, e
compile_opt idl2
on_error, 2
narg = n_params()
case narg of
2: begin
temp = b
b = a
a = temp
return
end
3: begin
temp = c
c = b
b = a
a = temp
return
end
4: begin
temp = d
d = c
c = b
b = a
a = temp
return
end
5: begin
temp = e
e = d
d = c
c = b
b = a
a = temp
return
end
endcase
return
end