Class: FortranSequential
- Inherits:
-
Object
show all
- Defined in:
- ext/fortio/lib/fortio/fortran_sequential.rb
Defined Under Namespace
Classes: Record
Constant Summary
collapse
- ENDIAN =
"big"
- FMT_VAX =
{
"f" => "e", "F" => "e", "e" => "e", "g" => "g",
"d" => "E", "D" => "E", "E" => "E", "G" => "G",
"s" => "v", "v" => "v", "n" => "n",
"l" => "V", "V" => "V", "N" => "N",
"a" => "a"
}
- FMT_NET =
{
"f" => "g", "F" => "g", "e" => "e", "g" => "g",
"d" => "G", "D" => "G", "E" => "E", "G" => "G",
"s" => "n", "v" => "v", "n" => "n",
"l" => "N", "V" => "V", "N" => "N",
"a" => "a"
}
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.open(file, mode = "r", opt = {:endian=>nil}) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'ext/fortio/lib/fortio/fortran_sequential.rb', line 62
def self.open (file, mode="r", opt={:endian=>nil})
io = Kernel::open(file, mode)
if mode =~ /r/
fs = FortranSequentialReader.new(io, opt)
else
fs = FortranSequentialWriter.new(io, opt)
end
if block_given?
begin
yield(fs)
ensure
fs.close
end
else
return fs
end
end
|
Instance Method Details
#eof? ⇒ Boolean
242
243
244
|
# File 'ext/fortio/lib/fortio/fortran_sequential.rb', line 242
def eof?
return @io.eof?
end
|
#get_pack_fmt(endian) ⇒ Object
80
81
82
83
84
85
86
87
88
89
|
# File 'ext/fortio/lib/fortio/fortran_sequential.rb', line 80
def get_pack_fmt (endian)
case endian
when "big"
return FMT_NET
when "little"
return FMT_VAX
else
raise "unknown endian '#{endian}'"
end
end
|