diff --git a/src/Abstract/DynamicLink.jl b/src/Abstract/DynamicLink.jl index c60e7d2..dd1d940 100644 --- a/src/Abstract/DynamicLink.jl +++ b/src/Abstract/DynamicLink.jl @@ -1,6 +1,6 @@ # Export DynamicLinks API export DynamicLinks, - getindex, endof, length, iterate, lastindex, eltype, + getindex, length, iterate, lastindex, eltype, handle, header # Export Dynamic Link API diff --git a/src/Abstract/ObjectHandle.jl b/src/Abstract/ObjectHandle.jl index 230e45d..80316ad 100644 --- a/src/Abstract/ObjectHandle.jl +++ b/src/Abstract/ObjectHandle.jl @@ -1,7 +1,7 @@ # Export ObjectHandle API export ObjectHandle, readmeta, - seek, seekstart, skip, start, iostream, position, read, readuntil, eof, + seek, seekstart, skip, iostream, position, read, readuntil, eof, endianness, is64bit, isrelocatable, isexecutable, islibrary, isdynamic, mangle_section_name, mangle_symbol_name, handle, header, format_string, section_header_offset, section_header_size, section_header_type, @@ -12,7 +12,7 @@ export ObjectHandle, export MagicMismatch # Import methods for extension -import Base: seek, seekstart, skip, start, position, read, readuntil, eof, +import Base: seek, seekstart, skip, position, read, readuntil, eof, getindex import StructIO: unpack diff --git a/src/Abstract/Section.jl b/src/Abstract/Section.jl index ebf44c1..151e7ee 100644 --- a/src/Abstract/Section.jl +++ b/src/Abstract/Section.jl @@ -1,7 +1,7 @@ # Export Sections API export Sections, - getindex, endof, length, lastindex, iterate, eltype, - find, findfirst, + getindex, length, lastindex, iterate, eltype, + findall, findfirst, handle, header, format_string # Export Section API @@ -14,7 +14,7 @@ export SectionRef, read, seekstart, seek, eof, section_number # Import Base methods for extension -import Base: read, seek, seekstart, eof, length, eltype, find, +import Base: read, seek, seekstart, eof, length, eltype, findall, findfirst, iterate, lastindex """ @@ -38,7 +38,7 @@ in emphasis: - eltype() ### Search - - find() + - findall() - findfirst() ### Misc. @@ -66,20 +66,20 @@ function getindex(sections::Sections, idx) end """ - find(sections::Sections, name::String) + findall(sections::Sections, name::String) Return a list of sections that match the given `name`. """ -function find(sections::Sections, name::AbstractString) - return find(sections, [name]) +function findall(sections::Sections, name::AbstractString) + return findall(sections, [name]) end """ - find(sections::Sections, name::String) + findall(sections::Sections, name::String) Return a list of sections that match one of the given `names`. """ -function find(sections::Sections, names::Vector{S}) where {S <: AbstractString} +function findall(sections::Sections, names::Vector{S}) where {S <: AbstractString} return [s for s in sections if section_name(s) in names] end @@ -98,7 +98,7 @@ end Return the first section that matches on of the given `names`. """ function findfirst(sections::Sections, names::Vector{String}) - results = find(sections, names) + results = findall(sections, names) if isempty(results) error("Could not find any sections that match $(names)") end diff --git a/src/Abstract/Segment.jl b/src/Abstract/Segment.jl index 8920dea..4589f72 100644 --- a/src/Abstract/Segment.jl +++ b/src/Abstract/Segment.jl @@ -8,7 +8,7 @@ export Segment, deref, segment_name, segment_offset, segment_file_size, export SegmentRef, segment_number # Import Base stuff for extension -import Base: getindex, length, eltype, find, findfirst, iterate, lastindex +import Base: getindex, length, eltype, findfirst, findall, iterate, lastindex """ Segments @@ -31,7 +31,7 @@ in emphasis: - eltype() ### Search - - find() + - findall() - findfirst() ### Misc. diff --git a/src/Abstract/Symbol.jl b/src/Abstract/Symbol.jl index 1f9b2dc..f872992 100644 --- a/src/Abstract/Symbol.jl +++ b/src/Abstract/Symbol.jl @@ -4,7 +4,7 @@ # Export Symbols API export Symbols, - getindex, endof, length, iterate, lastindex, eltype, + getindex, length, iterate, lastindex, eltype, handle, header # Export SymtabEntry API diff --git a/src/COFF/COFF.jl b/src/COFF/COFF.jl index 652ed5e..dc382ae 100644 --- a/src/COFF/COFF.jl +++ b/src/COFF/COFF.jl @@ -6,14 +6,14 @@ using StructIO using ObjectFile import ObjectFile: DynamicLink, DynamicLinks, RPath, ObjectHandle, Section, Sections, SectionRef, Segment, Segments, SegmentRef, StrTab, Symbols, SymtabEntry, SymbolRef, - getindex, endof, length, lastindex, iterate, eltype, handle, header, path, + getindex, length, lastindex, iterate, eltype, handle, header, path, rpaths, canonical_rpaths, find_library, readmeta, seek, seekstart, skip, iostream, position, read, readuntil, eof, endianness, is64bit, isrelocatable, isexecutable, islibrary, isdynamic, mangle_section_name, mangle_symbol_name, format_string, section_header_offset, section_header_size, section_header_type, - segment_header_offset, segment_header_size, segment_header_type, start, + segment_header_offset, segment_header_size, segment_header_type, startaddr, symtab_entry_offset, symtab_entry_size, symtab_entry_type, find_libraries, - find, findfirst, deref, contents, section_name, section_size, + findfirst, deref, contents, section_name, section_size, section_offset, section_address, section_number, segment_name, segment_offset, segment_file_size, segment_memory_size, segment_address, strtab_lookup, symbol_name, symbol_value, isundef, isglobal, islocal, isweak, symbol_number diff --git a/src/COFF/COFFHandle.jl b/src/COFF/COFFHandle.jl index 2295291..8f5c756 100644 --- a/src/COFF/COFFHandle.jl +++ b/src/COFF/COFFHandle.jl @@ -78,7 +78,7 @@ is64bit(oh::COFFHandle) = coff_header_is64bit(header(oh)) isrelocatable(oh::COFFHandle) = isrelocatable(header(oh)) isexecutable(oh::COFFHandle) = isexecutable(header(oh)) islibrary(oh::COFFHandle) = islibrary(header(oh)) -isdynamic(oh::COFFHandle) = !isempty(find(Sections(oh), [".idata"])) +isdynamic(oh::COFFHandle) = !isempty(findall(Sections(oh), [".idata"])) mangle_section_name(oh::COFFHandle, name::AbstractString) = string(".", name) function mangle_symbol_name(oh::COFFHandle, name::AbstractString) # sob diff --git a/src/ELF/ELF.jl b/src/ELF/ELF.jl index 355696c..6c95c0b 100644 --- a/src/ELF/ELF.jl +++ b/src/ELF/ELF.jl @@ -6,14 +6,14 @@ using StructIO using ObjectFile import ObjectFile: DynamicLink, DynamicLinks, RPath, ObjectHandle, Section, Sections, SectionRef, Segment, Segments, SegmentRef, StrTab, Symbols, SymtabEntry, SymbolRef, - getindex, endof, length, iterate, lastindex, eltype, handle, header, path, + getindex, length, iterate, lastindex, eltype, handle, header, path, rpaths, canonical_rpaths, find_library, readmeta, seek, seekstart, skip, iostream, position, read, readuntil, eof, endianness, is64bit, isrelocatable, isexecutable, islibrary, isdynamic, mangle_section_name, mangle_symbol_name, format_string, section_header_offset, section_header_size, section_header_type, - segment_header_offset, segment_header_size, segment_header_type, start, + segment_header_offset, segment_header_size, segment_header_type, startaddr, symtab_entry_offset, symtab_entry_size, symtab_entry_type, find_libraries, - find, findfirst, deref, contents, section_name, section_size, + findfirst, deref, contents, section_name, section_size, section_offset, section_address, section_number, segment_name, segment_offset, segment_file_size, segment_memory_size, segment_address, strtab_lookup, symbol_name, symbol_value, isundef, isglobal, islocal, isweak, symbol_number diff --git a/src/ELF/ELFHandle.jl b/src/ELF/ELFHandle.jl index c1b6cfe..97fd3a0 100644 --- a/src/ELF/ELFHandle.jl +++ b/src/ELF/ELFHandle.jl @@ -2,7 +2,7 @@ export ELFHandle # Import Base methods -import Base: start, getindex +import Base: getindex """ @@ -72,7 +72,7 @@ is64bit(oh::ELFHandle) = elf_internal_is64bit(oh.ei) isrelocatable(oh::ELFHandle) = header(oh).e_type == ET_REL isexecutable(oh::ELFHandle) = header(oh).e_type == ET_EXEC islibrary(oh::ELFHandle) = header(oh).e_type == ET_DYN -isdynamic(oh::ELFHandle) = !isempty(find(Sections(oh), ".dynamic")) +isdynamic(oh::ELFHandle) = !isempty(findall(Sections(oh), ".dynamic")) mangle_section_name(oh::ELFHandle, name::AbstractString) = string(".", name) mangle_symbol_name(oh::ELFHandle, name::AbstractString) = name format_string(::Type{H}) where {H <: ELFHandle} = "ELF" diff --git a/src/ELF/ELFRelocation.jl b/src/ELF/ELFRelocation.jl index 05b195e..dde6ea0 100644 --- a/src/ELF/ELFRelocation.jl +++ b/src/ELF/ELFRelocation.jl @@ -42,7 +42,7 @@ end deref(x::RelocationRef) = x.reloc entrysize{T}(s::Relocations{T}) = sizeof(T) -endof{T}(s::Relocations{T}) = div(s.sec.header.sh_size,entrysize(s)) +lastindex{T}(s::Relocations{T}) = div(s.sec.header.sh_size,entrysize(s)) length(r::Relocations) = lastindex(r) function getindex{T}(s::Relocations{T},n) if n < 1 || n > length(s) diff --git a/src/ELF/ELFSymbol.jl b/src/ELF/ELFSymbol.jl index f25e036..0b20f7e 100644 --- a/src/ELF/ELFSymbol.jl +++ b/src/ELF/ELFSymbol.jl @@ -23,12 +23,12 @@ function Symbols(oh::H) where {H <: ELFHandle} sections = Sections(oh) # First, try to load `.symtab`. If we can't load that guy, we'll fall back # to `.dynsym` which has less information, but is more likely to exist. - dyn_sections = find(sections, ".symtab") + dyn_sections = findall(sections, ".symtab") if !isempty(dyn_sections) return ELFSymbols(first(dyn_sections)) end - dyn_sections = find(sections, ".dynsym") + dyn_sections = findall(sections, ".dynsym") if !isempty(dyn_sections) return ELFSymbols(first(dyn_sections)) end diff --git a/src/MachO/MachO.jl b/src/MachO/MachO.jl index c1e05e0..aa4cef5 100644 --- a/src/MachO/MachO.jl +++ b/src/MachO/MachO.jl @@ -6,14 +6,14 @@ using StructIO using ObjectFile import ObjectFile: DynamicLink, DynamicLinks, RPath, ObjectHandle, Section, Sections, SectionRef, Segment, Segments, SegmentRef, StrTab, Symbols, SymtabEntry, SymbolRef, - getindex, endof, length, iterate, lastindex, eltype, handle, header, path, + getindex, length, iterate, lastindex, eltype, handle, header, path, rpaths, canonical_rpaths, find_library, readmeta, seek, seekstart, skip, iostream, position, read, readuntil, eof, endianness, is64bit, isrelocatable, isexecutable, islibrary, isdynamic, mangle_section_name, mangle_symbol_name, format_string, section_header_offset, section_header_size, section_header_type, - segment_header_offset, segment_header_size, segment_header_type, start, + segment_header_offset, segment_header_size, segment_header_type, startaddr, symtab_entry_offset, symtab_entry_size, symtab_entry_type, find_libraries, - find, findfirst, deref, contents, section_name, section_size, + findfirst, deref, contents, section_name, section_size, section_offset, section_address, section_number, segment_name, segment_offset, segment_file_size, segment_memory_size, segment_address, strtab_lookup, symbol_name, symbol_value, isundef, isglobal, islocal, isweak, symbol_number diff --git a/src/MachO/MachODynamicLink.jl b/src/MachO/MachODynamicLink.jl index 1506ab9..769c9ac 100644 --- a/src/MachO/MachODynamicLink.jl +++ b/src/MachO/MachODynamicLink.jl @@ -6,7 +6,7 @@ struct MachODynamicLinks{H <: MachOHandle, C <: MachOLoadCmdRef{H,MachOLoadDylib end function MachODynamicLinks(lcs::MachOLoadCmds) - ld_cmds = find(lcs, [MachOLoadDylibCmd]) + ld_cmds = findall(lcs, [MachOLoadDylibCmd]) return MachODynamicLinks(handle(lcs), ld_cmds) end MachODynamicLinks(oh::MachOHandle) = MachODynamicLinks(MachOLoadCmds(oh)) @@ -44,7 +44,7 @@ struct MachORPath{H <: MachOHandle} <: RPath{H} end function MachORPath(lcs::MachOLoadCmds) - cmds = find(lcs, [MachORPathCmd]) + cmds = findall(lcs, [MachORPathCmd]) return MachORPath(handle(lcs), cmds) end diff --git a/src/MachO/MachOHandle.jl b/src/MachO/MachOHandle.jl index e22856e..448d739 100644 --- a/src/MachO/MachOHandle.jl +++ b/src/MachO/MachOHandle.jl @@ -45,7 +45,7 @@ is64bit(oh::MachOHandle) = macho_is64bit(header(oh).magic) isrelocatable(oh::MachOHandle) = header(oh).filetype == MH_OBJECT isexecutable(oh::MachOHandle) = header(oh).filetype == MH_EXECUTE islibrary(oh::MachOHandle) = header(oh).filetype == MH_DYLIB -isdynamic(oh::MachOHandle) = !isempty(find(MachOLoadCmds(oh), [MachOLoadDylibCmd])) +isdynamic(oh::MachOHandle) = !isempty(findall(MachOLoadCmds(oh), [MachOLoadDylibCmd])) mangle_section_names(oh::MachOHandle, name) = string("__", name) mangle_symbol_name(oh::MachOHandle, name::AbstractString) = string("_", name) format_string(::Type{H}) where {H <: MachOHandle} = "MachO" diff --git a/src/MachO/MachOLoadCmd.jl b/src/MachO/MachOLoadCmd.jl index 6910111..964d383 100644 --- a/src/MachO/MachOLoadCmd.jl +++ b/src/MachO/MachOLoadCmd.jl @@ -154,16 +154,16 @@ end # Searching """ - find(lcs::MachOLoadCmds, lc_types::Vector{Type}) + findall(lcs::MachOLoadCmds, lc_types::Vector{Type}) Given a list of `Type`s, filter out all load commands within `lcs` that are not of that type. This method returns a `Vector` of `MachOLoadCmdRef` objects, containing only load commands that are of the requested types. For example, to find all segments within a file: - find(MachOLoadCmds(oh), [MachOSegmentCmd]) + findall(MachOLoadCmds(oh), [MachOSegmentCmd]) """ -function find(lcs::MachOLoadCmds, lc_types::Vector{T}) where {T <: Type} +function findall(lcs::MachOLoadCmds, lc_types::Vector{T}) where {T <: Type} indices = Integer[] for idx in 1:length(lcs.cmds) if any(typeof(lcs.cmds[idx]) <: lct for lct in lc_types) @@ -174,7 +174,7 @@ function find(lcs::MachOLoadCmds, lc_types::Vector{T}) where {T <: Type} # Return a new MachOLoadCmds object, that has those headers defined within it return [lcs[idx] for idx in indices] end -find(lcs::MachOLoadCmds, lc_type::T) where {T <: Type} = find(lcs, [lc_type]) +findall(lcs::MachOLoadCmds, lc_type::T) where {T <: Type} = findall(lcs, [lc_type]) function load_cmd_type(header::MachOLoadCmdHeader{H}) where {H <: MachOHandle} diff --git a/src/MachO/MachOSegment.jl b/src/MachO/MachOSegment.jl index 8725d32..0b8b65e 100644 --- a/src/MachO/MachOSegment.jl +++ b/src/MachO/MachOSegment.jl @@ -12,7 +12,7 @@ struct MachOSegments{H <: MachOHandle, S <: MachOLoadCmdRef} <: Segments{H} end function Segments(lcs::MachOLoadCmds) - return MachOSegments(handle(lcs), find(lcs, [MachOSegmentCmd])) + return MachOSegments(handle(lcs), findall(lcs, [MachOSegmentCmd])) end function Segments(oh::MachOHandle) # Sub out to our MachOLoadCmds-based constructor diff --git a/src/MachO/MachOStrTab.jl b/src/MachO/MachOStrTab.jl index 40b3f3d..948e44f 100644 --- a/src/MachO/MachOStrTab.jl +++ b/src/MachO/MachOStrTab.jl @@ -6,7 +6,7 @@ function StrTab(cmd::MachOLoadCmdRef{H,MachOSymtabCmd{H}}) where {H <: MachOHand return MachOStrTab(cmd) end function StrTab(oh::MachOHandle) - cmds = find(MachOLoadCmds(oh), [MachOSymtabCmd]) + cmds = findall(MachOLoadCmds(oh), [MachOSymtabCmd]) if isempty(cmds) error("Mach-O file does not contain Symtab load commands") end diff --git a/src/MachO/MachOSymbol.jl b/src/MachO/MachOSymbol.jl index 935fb5a..0416798 100644 --- a/src/MachO/MachOSymbol.jl +++ b/src/MachO/MachOSymbol.jl @@ -54,7 +54,7 @@ struct MachOSymbols{H <: MachOHandle} <: Symbols{H} end function MachOSymbols(oh::MachOHandle) - cmds = find(MachOLoadCmds(oh), [MachOSymtabCmd]) + cmds = findall(MachOLoadCmds(oh), [MachOSymtabCmd]) if isempty(cmds) error("Mach-O file does not contain Symtab load commands") end