mirror of
https://github.com/wader/fq.git
synced 2024-12-24 22:05:31 +03:00
Merge pull request #425 from wader/wasm-doc
wasm: Add some documentation
This commit is contained in:
commit
88009ee9a3
@ -128,7 +128,7 @@ vp8_frame,
|
||||
vp9_cfm,
|
||||
vp9_frame,
|
||||
vpx_ccr,
|
||||
wasm,
|
||||
[wasm](doc/formats.md#wasm),
|
||||
wav,
|
||||
webp,
|
||||
xing,
|
||||
|
@ -104,7 +104,7 @@
|
||||
|`vp9_cfm` |VP9 Codec Feature Metadata |<sub></sub>|
|
||||
|`vp9_frame` |VP9 frame |<sub></sub>|
|
||||
|`vpx_ccr` |VPX Codec Configuration Record |<sub></sub>|
|
||||
|`wasm` |WebAssembly Binary Format |<sub></sub>|
|
||||
|[`wasm`](#wasm) |WebAssembly Binary Format |<sub></sub>|
|
||||
|`wav` |WAV file |<sub>`id3v2` `id3v1` `id3v11`</sub>|
|
||||
|`webp` |WebP image |<sub>`vp8_frame`</sub>|
|
||||
|`xing` |Xing header |<sub></sub>|
|
||||
@ -506,6 +506,26 @@ Current only supports plain RTMP (not RTMPT or encrypted variants etc) with AMF0
|
||||
- https://rtmp.veriskope.com/docs/spec/
|
||||
- https://rtmp.veriskope.com/pdf/video_file_format_spec_v10.pdf
|
||||
|
||||
## wasm
|
||||
|
||||
### Count opcode usage
|
||||
```sh
|
||||
$ fq '.sections[] | select(.id == "code_section") | [.. | .opcode? // empty] | count | map({key: .[0], value: .[1]}) | from_entries' file.wasm
|
||||
```
|
||||
|
||||
### List exports and imports
|
||||
```sh
|
||||
$ fq '.sections | {import: map(select(.id == "import_section").content.im.x[].nm.b), export: map(select(.id == "export_section").content.ex.x[].nm.b)}' file.wasm
|
||||
```
|
||||
|
||||
### Authors
|
||||
- Takashi Oguma
|
||||
[@bitbears-dev](https://github.com/bitbears-dev)
|
||||
[@0xb17bea125](https://twitter.com/0xb17bea125)
|
||||
|
||||
### References
|
||||
- https://webassembly.github.io/spec/core/
|
||||
|
||||
## xml
|
||||
|
||||
### Options
|
||||
|
452
doc/formats.svg
452
doc/formats.svg
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 133 KiB |
@ -1209,6 +1209,20 @@ out $ fq -d wasm . file
|
||||
out # Decode value as wasm
|
||||
out ... | wasm
|
||||
out
|
||||
out # Count opcode usage
|
||||
out
|
||||
out $ fq '.sections[] | select(.id == "code_section") | [.. | .opcode? // empty] | count | map({key: .[0], value: .[1]}) | from_entries' file.wasm
|
||||
out
|
||||
out # List exports and imports
|
||||
out
|
||||
out $ fq '.sections | {import: map(select(.id == "import_section").content.im.x[].nm.b), export: map(select(.id == "export_section").content.ex.x[].nm.b)}' file.wasm
|
||||
out
|
||||
out # Authors
|
||||
out - Takashi Oguma @bitbears-dev (https://github.com/bitbears-dev) @0xb17bea125 (https://twitter.com/0xb17bea125)
|
||||
out
|
||||
out # References
|
||||
out - https://webassembly.github.io/spec/core/
|
||||
out
|
||||
"help(wav)"
|
||||
out wav: WAV file decoder
|
||||
out
|
||||
|
@ -3,6 +3,7 @@ package wasm
|
||||
// https://webassembly.github.io/spec/core/
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"math"
|
||||
"sync"
|
||||
|
||||
@ -12,6 +13,9 @@ import (
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
//go:embed wasm.md
|
||||
var wasmFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(decode.Format{
|
||||
Name: format.WASM,
|
||||
@ -19,6 +23,7 @@ func init() {
|
||||
DecodeFn: decodeWASM,
|
||||
Groups: []string{format.PROBE},
|
||||
})
|
||||
interp.RegisterFS(wasmFS)
|
||||
}
|
||||
|
||||
const (
|
||||
|
17
format/wasm/wasm.md
Normal file
17
format/wasm/wasm.md
Normal file
@ -0,0 +1,17 @@
|
||||
### Count opcode usage
|
||||
```sh
|
||||
$ fq '.sections[] | select(.id == "code_section") | [.. | .opcode? // empty] | count | map({key: .[0], value: .[1]}) | from_entries' file.wasm
|
||||
```
|
||||
|
||||
### List exports and imports
|
||||
```sh
|
||||
$ fq '.sections | {import: map(select(.id == "import_section").content.im.x[].nm.b), export: map(select(.id == "export_section").content.ex.x[].nm.b)}' file.wasm
|
||||
```
|
||||
|
||||
### Authors
|
||||
- Takashi Oguma
|
||||
[@bitbears-dev](https://github.com/bitbears-dev)
|
||||
[@0xb17bea125](https://twitter.com/0xb17bea125)
|
||||
|
||||
### References
|
||||
- https://webassembly.github.io/spec/core/
|
Loading…
Reference in New Issue
Block a user