Skip to content

Commit 8e6b433

Browse files
committed
Merge pull request #51 from JuliaIO/sd/documentation
add a readable version of the registry
2 parents 69adfa1 + 8d9cd93 commit 8e6b433

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ high-level support for formatted files (in contrast with julia's
1111
low-level `read` and `write`). To avoid name conflicts, packages that
1212
provide support for standard file formats through functions named
1313
`load` and `save` are encouraged to extend the definitions here.
14+
[Supported Files](docs/registry.md)
1415

1516
## Installation
1617

docs/make_docs.jl

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using FileIO, Compat
2+
import FileIO: LOAD, SAVE, OSX, OS
3+
const fs = open(Pkg.dir("FileIO", "docs", "registry.md"), "w")
4+
5+
function pkg_url(pkgname)
6+
result = readchomp(Pkg.dir("METADATA", string(pkgname), "url"))
7+
g = "git://"
8+
if startswith(result, g)
9+
return string("http://", result[length(g):end])
10+
end
11+
result
12+
end
13+
library2string(x) = "[$(x)]($(pkg_url(x)))"
14+
15+
extension2string(x) = join(map(string, x), ", ")
16+
extension2string(x::AbstractString) = x
17+
18+
os2string(x::Vector) = isempty(x) ? "**all** platforms " : join(map(os2string, x), ", ")
19+
os2string{O <: OS}(os::Type{O}) = "**$(O.name.name)**"
20+
21+
magic2string(x::Function) = "has detection function"
22+
magic2string(x::Tuple) = isempty(x) ? "only extension": string(x)
23+
magic2string(x) = string(x)
24+
function loadsave2string(load_save_libraries)
25+
io = IOBuffer()
26+
loader_str, saver_str = " ", " "
27+
for predicates in load_save_libraries
28+
library = shift!(predicates)
29+
30+
os, loadsave = FileIO.split_predicates(predicates)
31+
if isempty(loadsave)
32+
print(io, "loads and saves on **all** platforms with ", library2string(library), " ")
33+
elseif (LOAD in loadsave)
34+
print(io, "loads with ", library2string(library), " on: ", os2string(os), " ")
35+
elseif (SAVE in loadsave)
36+
print(io, "loads with ", library2string(library), " on: ", os2string(os), " ")
37+
end
38+
end
39+
takebuf_string(io)
40+
end
41+
function add_format{Sym}(::Type{DataFormat{Sym}}, magic, extension, io_libs...)
42+
println(fs, "| $(Sym) | $(extension2string(extension)) | $(loadsave2string(io_libs)) | $(magic2string(magic)) |")
43+
end
44+
45+
46+
function add_format{sym}(fmt::Type{DataFormat{sym}}, magic::@compat(Union{Tuple,AbstractVector,ByteString}), extension)
47+
println(sym)
48+
end
49+
50+
# for multiple magic bytes
51+
function add_format{sym, T <: Vector{UInt8}, N}(fmt::Type{DataFormat{sym}}, magics::NTuple{N, T}, extension)
52+
println(sym)
53+
end
54+
55+
# For when "magic" is supplied as a function (see the HDF5 example in
56+
# registry.jl)
57+
function add_format{sym}(fmt::Type{DataFormat{sym}}, magic, extension)
58+
println(sym)
59+
end
60+
61+
62+
println(fs, """
63+
| Format Name | extensions | IO library | detection or magic number |
64+
| ----------- | ---------- | ---------- | ---------- |""")
65+
include(Pkg.dir("FileIO", "src", "registry.jl"))
66+
67+
close(fs)

docs/registry.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
| Format Name | extensions | IO library | detection or magic number |
2+
| ----------- | ---------- | ---------- | ---------- |
3+
| JLD | .jld | loads and saves on **all** platforms with [JLD](http:///github.com/JuliaLang/JLD.jl.git) | Julia data file (HDF5) |
4+
| PBMBinary | .pbm | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x50,0x34] |
5+
| PGMBinary | .pgm | loads and saves on **all** platforms with [Netpbm](http:///github.com/JuliaIO/Netpbm.jl.git) | UInt8[0x50,0x35] |
6+
| PPMBinary | .ppm | loads and saves on **all** platforms with [Netpbm](http:///github.com/JuliaIO/Netpbm.jl.git) | UInt8[0x50,0x36] |
7+
| PBMText | .pbm | loads with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) on: **all** platforms | UInt8[0x50,0x31] |
8+
| PGMText | .pgm | loads with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) on: **all** platforms | UInt8[0x50,0x32] |
9+
| PPMText | .ppm | loads with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) on: **all** platforms | UInt8[0x50,0x33] |
10+
| NRRD | .nrrd, .nhdr | loads and saves on **all** platforms with [NRRD](http:///github.com/JuliaIO/NRRD.jl.git) | NRRD |
11+
| AndorSIF | .sif | loads with [AndorSIF](http:///github.com/JuliaIO/AndorSIF.jl.git) on: **all** platforms | Andor Technology Multi-Channel File |
12+
| CRW | .crw | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x49,0x49,0x1a,0x00,0x00,0x00,0x48,0x45] |
13+
| CUR | .cur | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x00,0x00,0x02,0x00] |
14+
| DCX | .dcx | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0xb1,0x68,0xde,0x3a] |
15+
| DOT | .dot | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1] |
16+
| EPS | .eps | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x25,0x21,0x50,0x53,0x2d,0x41,0x64,0x6f] |
17+
| HDR | .hdr | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x23,0x3f,0x52,0x41,0x44,0x49,0x41,0x4e] |
18+
| ICO | .ico | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x00,0x00,0x01,0x00] |
19+
| INFO | .info | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x7a,0x62,0x65,0x78] |
20+
| JP2 | .jp2 | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x00,0x00,0x00,0x0c,0x6a,0x50,0x20,0x20] |
21+
| PCX | .pcx | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x0a,0x05,0x01,0x01] |
22+
| PDB | .pdb | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x73,0x7a,0x65,0x7a] |
23+
| PDF | .pdf | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x25,0x50,0x44,0x46] |
24+
| PGM | .pgm | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x50,0x35,0x0a] |
25+
| PSD | .psd | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x38,0x42,0x50,0x53] |
26+
| RGB | .rgb | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x01,0xda,0x01,0x01,0x00,0x03] |
27+
| WMF | .wmf | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0xd7,0xcd,0xc6,0x9a] |
28+
| WPG | .wpg | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0xff,0x57,0x50,0x43] |
29+
| Imagine | .imagine | loads and saves on **all** platforms with [ImagineFormat](http:///github.com/timholy/ImagineFormat.jl.git) | IMAGINE |
30+
| TGA | .tga | loads and saves on **all** platforms with [QuartzImageIO](http:///github.com/JuliaIO/QuartzImageIO.jl.git) loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | only extension |
31+
| GIF | .gif | loads and saves on **all** platforms with [QuartzImageIO](http:///github.com/JuliaIO/QuartzImageIO.jl.git) loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x47,0x49,0x46,0x38] |
32+
| PNG | .png | loads and saves on **all** platforms with [QuartzImageIO](http:///github.com/JuliaIO/QuartzImageIO.jl.git) loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a] |
33+
| TIFF | .tiff, .tif | loads and saves on **all** platforms with [QuartzImageIO](http:///github.com/JuliaIO/QuartzImageIO.jl.git) loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | (UInt8[0x4d,0x4d,0x00,0x2a],UInt8[0x4d,0x4d,0x00,0x2b],UInt8[0x49,0x49,0x2a,0x00]) |
34+
| JPEG | .jpeg, .jpg, .JPG | loads and saves on **all** platforms with [QuartzImageIO](http:///github.com/JuliaIO/QuartzImageIO.jl.git) loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0xff,0xd8,0xff] |
35+
| BMP | .bmp | loads and saves on **all** platforms with [QuartzImageIO](http:///github.com/JuliaIO/QuartzImageIO.jl.git) loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | UInt8[0x42,0x4d] |
36+
| GLSLShader | .frag, .vert, .geom, .comp | loads and saves on **all** platforms with [GLAbstraction](http:///github.com/JuliaGL/GLAbstraction.jl.git) | only extension |
37+
| OBJ | .obj | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | only extension |
38+
| PLY_ASCII | .ply | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | ply
39+
format ascii 1.0 |
40+
| PLY_BINARY | .ply | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | ply
41+
format binary_little_endian 1.0 |
42+
| 2DM | .2dm | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | MESH2D |
43+
| OFF | .off | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | OFF |
44+
| AVI | .avi | loads and saves on **all** platforms with [ImageMagick](http:///github.com/JuliaIO/ImageMagick.jl.git) | has detection function |
45+
| HDF5 | .h5, .hdf5 | loads and saves on **all** platforms with [HDF5](http:///github.com/JuliaLang/HDF5.jl.git) | has detection function |
46+
| STL_ASCII | .stl, .STL | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | has detection function |
47+
| STL_BINARY | .stl, .STL | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | has detection function |

0 commit comments

Comments
 (0)