@@ -3,34 +3,34 @@ export read_traceheader
3
3
"""
4
4
# Info
5
5
6
- Use: fileheader = read_fileheader(s::IO; bigendian ::Bool = true )
6
+ Use: fileheader = read_fileheader(s::IO; swap_bytes ::Bool)
7
7
8
8
9
9
Returns a binary trace header formed from the current position in the stream 's'.
10
10
"""
11
- function read_traceheader (s:: IO , th_byte2sample:: Dict{String,Int32} ; bigendian :: Bool = true , th= zeros (UInt8, 240 ))
12
- return read_traceheader (s, collect (keys (th_byte2sample)), th_byte2sample; bigendian = bigendian , th= th)
11
+ function read_traceheader (s:: IO , th_byte2sample:: Dict{String,Int32} ; swap_bytes :: Bool , th= zeros (UInt8, 240 ))
12
+ return read_traceheader (s, collect (keys (th_byte2sample)), th_byte2sample; swap_bytes = swap_bytes , th= th)
13
13
end
14
14
15
15
"""
16
- Use: fileheader = read_traceheader(s::IO, keys = Array{String,1}; bigendian ::Bool = true )
16
+ Use: fileheader = read_traceheader(s::IO, keys = Array{String,1}; swap_bytes ::Bool)
17
17
18
18
Returns a binary trace header formed from the current position in the stream 's', only reading
19
19
header values denoted in 'keys'.
20
20
"""
21
21
function read_traceheader (s:: IO , keys:: Array{String,1} , th_byte2sample:: Dict{String, Int32} ;
22
- bigendian :: Bool = true , th= zeros (UInt8, 240 ))
22
+ swap_bytes :: Bool , th= zeros (UInt8, 240 ))
23
23
24
24
# Initialize binary file header
25
25
traceheader = BinaryTraceHeader ()
26
26
27
- read_traceheader! (s, keys, th_byte2sample, traceheader; bigendian = bigendian , th= th)
27
+ read_traceheader! (s, keys, th_byte2sample, traceheader; swap_bytes = swap_bytes , th= th)
28
28
return traceheader
29
29
end
30
30
31
31
function read_traceheader! (s:: IO , keys:: Array{String,1} , th_byte2sample:: Dict{String, Int32} , hdr:: BinaryTraceHeader ;
32
- bigendian :: Bool = true , th= zeros (UInt8, 240 ))
33
-
32
+ swap_bytes :: Bool , th= zeros (UInt8, 240 ))
33
+
34
34
# read full trace header then split
35
35
read! (s, th)
36
36
@@ -40,11 +40,11 @@ function read_traceheader!(s::IO, keys::Array{String,1}, th_byte2sample::Dict{St
40
40
nb = sizeof (getfield (hdr, sym)) - 1
41
41
bst = th_byte2sample[k]+ 1
42
42
val = reinterpret (typeof (getfield (hdr, sym)), th[bst: bst+ nb])[1 ]
43
- bigendian && (val = bswap (val))
43
+ swap_bytes && (val = bswap (val))
44
44
setfield! (hdr, sym, val)
45
45
end
46
46
nothing
47
47
end
48
48
49
- read_traceheader! (s:: IO , thb:: Dict{String, Int32} , hdr:: BinaryTraceHeader ; be :: Bool = true , th= zeros (UInt8, 240 )) =
50
- read_traceheader! (s, collect (keys (thb)), thb, hdr; be = be , th= th)
49
+ read_traceheader! (s:: IO , thb:: Dict{String, Int32} , hdr:: BinaryTraceHeader ; swap_bytes :: Bool , th= zeros (UInt8, 240 )) =
50
+ read_traceheader! (s, collect (keys (thb)), thb, hdr; swap_bytes = swap_bytes , th= th)
0 commit comments