codemirror-lang-liquidsoap 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +8 -8
- package/dist/index.js +7 -7
- package/package.json +1 -1
- package/src/liquidsoap.grammar +10 -4
- package/src/parser.js +6 -6
- package/tests/liquidsoap/.codespellignore +1 -0
- package/tests/liquidsoap/.github/ISSUE_TEMPLATE/bug_report.yml +16 -0
- package/tests/liquidsoap/.github/docker/alpine.dockerfile +20 -0
- package/tests/liquidsoap/.github/docker/debian.dockerfile +55 -0
- package/tests/liquidsoap/.github/opam/{liquidsoap-core-windows.opam → liquidsoap-windows.opam} +8 -5
- package/tests/liquidsoap/.github/renovate.json +23 -0
- package/tests/liquidsoap/.github/scripts/add-local-opam-packages.sh +5 -3
- package/tests/liquidsoap/.github/scripts/build-apk.sh +10 -19
- package/tests/liquidsoap/.github/scripts/build-deb.sh +6 -15
- package/tests/liquidsoap/.github/scripts/build-details.sh +15 -4
- package/tests/liquidsoap/.github/scripts/build-posix.sh +11 -20
- package/tests/liquidsoap/.github/scripts/build-website.sh +1 -1
- package/tests/liquidsoap/.github/scripts/build-win32.sh +6 -2
- package/tests/liquidsoap/.github/scripts/push-docker.sh +13 -15
- package/tests/liquidsoap/.github/workflows/ci.yml +291 -185
- package/tests/liquidsoap/.ocamlformat +1 -1
- package/tests/liquidsoap/.pre-commit-config.yaml +2 -2
- package/tests/liquidsoap/CHANGES.md +112 -3
- package/tests/liquidsoap/README.md +10 -9
- package/tests/liquidsoap/ROADMAP.md +14 -8
- package/tests/liquidsoap/bin/liquidsoap-macos-instruments +7 -0
- package/tests/liquidsoap/doc/content/build.md +0 -1
- package/tests/liquidsoap/doc/content/faq.md +2 -4
- package/tests/liquidsoap/doc/content/icy_metadata.md +2 -2
- package/tests/liquidsoap/doc/content/install.md +13 -2
- package/tests/liquidsoap/doc/content/json.md +1 -1
- package/tests/liquidsoap/doc/content/language.md +4 -4
- package/tests/liquidsoap/doc/content/liq/beets-protocol.liq +1 -1
- package/tests/liquidsoap/doc/content/liq/crossfade.liq +1 -1
- package/tests/liquidsoap/doc/content/liq/harbor-simple.liq +1 -1
- package/tests/liquidsoap/doc/content/liq/radiopi.liq +10 -9
- package/tests/liquidsoap/doc/content/liq/request.dynamic.liq +1 -1
- package/tests/liquidsoap/doc/content/migrating.md +25 -3
- package/tests/liquidsoap/doc/content/playlist_parsers.md +46 -1
- package/tests/liquidsoap/doc/content/script_loading.md +3 -0
- package/tests/liquidsoap/doc/content/xml.md +160 -0
- package/tests/liquidsoap/doc/dune.inc +129 -0
- package/tests/liquidsoap/dune-project +29 -49
- package/tests/liquidsoap/liquidsoap +1 -1
- package/tests/liquidsoap/{liquidsoap-js.opam → opam/liquidsoap-js.opam} +3 -2
- package/tests/liquidsoap/{liquidsoap-lang.opam → opam/liquidsoap-lang.opam} +4 -3
- package/tests/liquidsoap/{liquidsoap-mode.opam → opam/liquidsoap-mode.opam} +3 -2
- package/tests/liquidsoap/{liquidsoap-core.opam → opam/liquidsoap.opam} +46 -17
- package/tests/liquidsoap/{prometheus-liquidsoap.opam → opam/prometheus-liquidsoap.opam} +2 -1
- package/tests/liquidsoap/{sdl-liquidsoap.opam → opam/sdl-liquidsoap.opam} +2 -1
- package/tests/liquidsoap/{tls-liquidsoap.opam → opam/tls-liquidsoap.opam} +2 -1
- package/tests/liquidsoap/src/bin/dune +1 -1
- package/tests/liquidsoap/src/config/xmlplaylist_option.disabled.ml +2 -0
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_decoder.ml +22 -22
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_encoder.ml +4 -4
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_filters.ml +37 -41
- package/tests/liquidsoap/src/core/builtins/builtins_files.ml +3 -1
- package/tests/liquidsoap/src/core/builtins/builtins_optionals.ml +0 -1
- package/tests/liquidsoap/src/core/builtins/builtins_process.ml +15 -7
- package/tests/liquidsoap/src/core/builtins/builtins_resolvers.ml +16 -0
- package/tests/liquidsoap/src/core/builtins/builtins_socket.ml +7 -5
- package/tests/liquidsoap/src/core/builtins/builtins_source.ml +3 -3
- package/tests/liquidsoap/src/core/builtins/builtins_srt.ml +84 -8
- package/tests/liquidsoap/src/core/builtins/builtins_string_extra.ml +13 -0
- package/tests/liquidsoap/src/core/builtins/builtins_sys.ml +6 -6
- package/tests/liquidsoap/src/core/builtins/builtins_thread.ml +2 -2
- package/tests/liquidsoap/src/core/builtins/builtins_time.ml +5 -3
- package/tests/liquidsoap/src/core/builtins/builtins_tls.ml +1 -1
- package/tests/liquidsoap/src/core/clock.ml +105 -38
- package/tests/liquidsoap/src/core/clock.mli +1 -0
- package/tests/liquidsoap/src/core/clock_base.ml +2 -2
- package/tests/liquidsoap/src/core/conversions/stereo.ml +6 -8
- package/tests/liquidsoap/src/core/converters/audio_converter.mli +5 -5
- package/tests/liquidsoap/src/core/converters/video_converter.ml +2 -2
- package/tests/liquidsoap/src/core/converters/video_converter.mli +3 -3
- package/tests/liquidsoap/src/core/decoder/decoder.ml +14 -17
- package/tests/liquidsoap/src/core/decoder/decoder.mli +11 -11
- package/tests/liquidsoap/src/core/decoder/decoder_utils.ml +12 -13
- package/tests/liquidsoap/src/core/decoder/decoder_utils.mli +2 -3
- package/tests/liquidsoap/src/core/decoder/external_decoder.ml +9 -13
- package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder.ml +57 -53
- package/tests/liquidsoap/src/core/decoder/ffmpeg_raw_decoder.ml +28 -9
- package/tests/liquidsoap/src/core/decoder/flac_metadata_plug.ml +15 -2
- package/tests/liquidsoap/src/core/decoder/image_decoder.ml +33 -19
- package/tests/liquidsoap/src/core/decoder/liq_flac_decoder.ml +22 -23
- package/tests/liquidsoap/src/core/decoder/liq_ogg_decoder.ml +5 -5
- package/tests/liquidsoap/src/core/decoder/mad_decoder.ml +2 -2
- package/tests/liquidsoap/src/core/decoder/midi_decoder.ml +1 -2
- package/tests/liquidsoap/src/core/decoder/ogg_flac_duration.ml +3 -11
- package/tests/liquidsoap/src/core/decoder/ogg_metadata_plug.ml +15 -2
- package/tests/liquidsoap/src/core/decoder/raw_audio_decoder.ml +8 -7
- package/tests/liquidsoap/src/core/decoder/wav_aiff_decoder.ml +3 -3
- package/tests/liquidsoap/src/core/dune +2 -15
- package/tests/liquidsoap/src/core/encoder/encoder.ml +18 -23
- package/tests/liquidsoap/src/core/encoder/encoder.mli +12 -17
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder.ml +13 -27
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder_common.ml +1 -1
- package/tests/liquidsoap/src/core/encoder/encoders/flac_encoder.ml +3 -4
- package/tests/liquidsoap/src/core/encoder/encoders/ndi_encoder.ml +2 -1
- package/tests/liquidsoap/src/core/encoder/encoders/ogg_encoder.ml +1 -2
- package/tests/liquidsoap/src/core/encoder/lang/lang_external_encoder.ml +2 -2
- package/tests/liquidsoap/src/core/encoder/lang/lang_fdkaac.ml +1 -1
- package/tests/liquidsoap/src/core/encoder/lang/lang_ffmpeg.ml +46 -39
- package/tests/liquidsoap/src/core/encoder/lang/lang_flac.ml +1 -1
- package/tests/liquidsoap/src/core/encoder/lang/lang_shine.ml +2 -2
- package/tests/liquidsoap/src/core/encoder/lang/lang_vorbis.ml +1 -1
- package/tests/liquidsoap/src/core/encoder/lang/lang_wav.ml +1 -1
- package/tests/liquidsoap/src/core/file_watcher.inotify.ml +8 -13
- package/tests/liquidsoap/src/core/harbor/harbor.ml +22 -24
- package/tests/liquidsoap/src/core/io/ffmpeg_filter_io.ml +4 -3
- package/tests/liquidsoap/src/core/io/oss_io.ml +3 -4
- package/tests/liquidsoap/src/core/io/portaudio_io.ml +1 -1
- package/tests/liquidsoap/src/core/io/pulseaudio_io.ml +3 -4
- package/tests/liquidsoap/src/core/io/srt_io.ml +316 -120
- package/tests/liquidsoap/src/core/io/udp_io.ml +14 -12
- package/tests/liquidsoap/src/core/lang.mli +10 -12
- package/tests/liquidsoap/src/core/lang_source.ml +25 -39
- package/tests/liquidsoap/src/core/lang_string.ml +30 -0
- package/tests/liquidsoap/src/core/lang_string.mli +3 -0
- package/tests/liquidsoap/src/core/ogg_formats/ogg_flac_encoder.ml +6 -6
- package/tests/liquidsoap/src/core/ogg_formats/ogg_muxer.ml +17 -27
- package/tests/liquidsoap/src/core/ogg_formats/ogg_muxer.mli +44 -53
- package/tests/liquidsoap/src/core/ogg_formats/opus_encoder.ml +1 -1
- package/tests/liquidsoap/src/core/ogg_formats/vorbis_encoder.ml +1 -2
- package/tests/liquidsoap/src/core/operators/add.ml +2 -2
- package/tests/liquidsoap/src/core/operators/cross.ml +2 -2
- package/tests/liquidsoap/src/core/operators/delay.ml +23 -6
- package/tests/liquidsoap/src/core/operators/dtmf.ml +3 -2
- package/tests/liquidsoap/src/core/operators/dyn_op.ml +2 -2
- package/tests/liquidsoap/src/core/operators/fir_filter.ml +2 -1
- package/tests/liquidsoap/src/core/operators/iir_filter.ml +1 -1
- package/tests/liquidsoap/src/core/operators/insert_metadata.ml +1 -1
- package/tests/liquidsoap/src/core/operators/lilv_op.ml +1 -1
- package/tests/liquidsoap/src/core/operators/lufs.ml +136 -89
- package/tests/liquidsoap/src/core/operators/lufs_c.c +105 -0
- package/tests/liquidsoap/src/core/operators/map_metadata.ml +33 -9
- package/tests/liquidsoap/src/core/operators/max_duration.ml +3 -4
- package/tests/liquidsoap/src/core/operators/muxer.ml +2 -1
- package/tests/liquidsoap/src/core/operators/noblank.ml +6 -6
- package/tests/liquidsoap/src/core/operators/sequence.ml +5 -5
- package/tests/liquidsoap/src/core/operators/switch.ml +10 -11
- package/tests/liquidsoap/src/core/operators/time_warp.ml +14 -11
- package/tests/liquidsoap/src/core/operators/video_fade.ml +2 -3
- package/tests/liquidsoap/src/core/outputs/ao_out.ml +1 -1
- package/tests/liquidsoap/src/core/outputs/bjack_out.ml +1 -1
- package/tests/liquidsoap/src/core/outputs/graphics_out.ml +6 -2
- package/tests/liquidsoap/src/core/outputs/harbor_output.ml +12 -10
- package/tests/liquidsoap/src/core/outputs/hls_output.ml +19 -14
- package/tests/liquidsoap/src/core/outputs/icecast2.ml +85 -52
- package/tests/liquidsoap/src/core/outputs/ndi_out.ml +1 -1
- package/tests/liquidsoap/src/core/outputs/output.ml +8 -9
- package/tests/liquidsoap/src/core/outputs/output.mli +61 -61
- package/tests/liquidsoap/src/core/outputs/pipe_output.ml +8 -6
- package/tests/liquidsoap/src/core/outputs/sdl_out.ml +5 -2
- package/tests/liquidsoap/src/core/playlist_parser.ml +6 -7
- package/tests/liquidsoap/src/core/playlists/playlist_basic.ml +0 -180
- package/tests/liquidsoap/src/core/protocols/annotate.ml +3 -3
- package/tests/liquidsoap/src/core/request.ml +16 -17
- package/tests/liquidsoap/src/core/request.mli +27 -28
- package/tests/liquidsoap/src/core/shebang.ml +3 -2
- package/tests/liquidsoap/src/core/source.ml +104 -63
- package/tests/liquidsoap/src/core/source.mli +249 -247
- package/tests/liquidsoap/src/core/sources/generated.ml +2 -2
- package/tests/liquidsoap/src/core/sources/request_dynamic.ml +2 -2
- package/tests/liquidsoap/src/core/sources/synthesized.ml +2 -2
- package/tests/liquidsoap/src/core/stream/aFrame.mli +7 -9
- package/tests/liquidsoap/src/core/stream/content.mli +4 -13
- package/tests/liquidsoap/src/core/stream/content_base.ml +2 -19
- package/tests/liquidsoap/src/core/stream/content_video.ml +9 -10
- package/tests/liquidsoap/src/core/stream/ffmpeg_copy_content.ml +19 -15
- package/tests/liquidsoap/src/core/stream/ffmpeg_raw_content.ml +26 -9
- package/tests/liquidsoap/src/core/stream/frame.ml +4 -4
- package/tests/liquidsoap/src/core/stream/frame.mli +13 -15
- package/tests/liquidsoap/src/core/stream/frame_base.ml +1 -2
- package/tests/liquidsoap/src/core/stream/frame_settings.ml +14 -14
- package/tests/liquidsoap/src/core/stream/generator.mli +14 -17
- package/tests/liquidsoap/src/core/stream/mFrame.mli +2 -2
- package/tests/liquidsoap/src/core/tools/charset.ml +28 -18
- package/tests/liquidsoap/src/core/tools/charset_base.ml +5 -0
- package/tests/liquidsoap/src/core/tools/child_support.ml +2 -2
- package/tests/liquidsoap/src/core/tools/ffmpeg_avfilter_utils.ml +139 -0
- package/tests/liquidsoap/src/core/tools/ffmpeg_avfilter_utils.mli +22 -0
- package/tests/liquidsoap/src/core/tools/ffmpeg_utils.ml +2 -1
- package/tests/liquidsoap/src/core/tools/lifecycle.mli +4 -4
- package/tests/liquidsoap/src/core/tools/liq_http.ml +44 -19
- package/tests/liquidsoap/src/core/tools/liq_http.mli +1 -1
- package/tests/liquidsoap/src/core/tools/log.ml +3 -8
- package/tests/liquidsoap/src/core/tools/log.mli +1 -1
- package/tests/liquidsoap/src/core/tools/mutex_utils.ml +1 -1
- package/tests/liquidsoap/src/core/tools/pool.ml +2 -2
- package/tests/liquidsoap/src/core/tools/process_handler.mli +30 -27
- package/tests/liquidsoap/src/core/tools/producer_consumer.ml +10 -9
- package/tests/liquidsoap/src/{lang → core/tools}/queues.ml +58 -64
- package/tests/liquidsoap/src/{lang → core/tools}/queues.mli +10 -0
- package/tests/liquidsoap/src/core/tools/sdl_utils.ml +2 -0
- package/tests/liquidsoap/src/core/tools/server.mli +8 -8
- package/tests/liquidsoap/src/core/tools/sha1.ml +2 -1
- package/tests/liquidsoap/src/core/tools/start_stop.ml +2 -1
- package/tests/liquidsoap/src/core/tools/strings.mli +5 -4
- package/tests/liquidsoap/src/core/tools/tutils.ml +7 -7
- package/tests/liquidsoap/src/core/tools/tutils.mli +14 -18
- package/tests/liquidsoap/src/core/tools/unix_c.c +16 -5
- package/tests/liquidsoap/src/core/tools/utils.ml +83 -25
- package/tests/liquidsoap/src/core/tools/wav_aiff.ml +3 -3
- package/tests/liquidsoap/src/core/tools/wav_aiff.mli +7 -7
- package/tests/liquidsoap/src/core/types/format_type.ml +6 -6
- package/tests/liquidsoap/src/js/index.html +1 -154
- package/tests/liquidsoap/src/js/interactive_js.ml +7 -3
- package/tests/liquidsoap/src/js/stdlib_js.liq +6 -0
- package/tests/liquidsoap/src/lang/builtins_lang.ml +8 -0
- package/tests/liquidsoap/src/lang/builtins_null.ml +1 -1
- package/tests/liquidsoap/src/lang/builtins_string.ml +2 -11
- package/tests/liquidsoap/src/lang/builtins_xml.ml +204 -0
- package/tests/liquidsoap/src/lang/cache.ml +7 -2
- package/tests/liquidsoap/src/lang/dune +5 -2
- package/tests/liquidsoap/src/lang/flags.ml +2 -2
- package/tests/liquidsoap/src/lang/lang.mli +10 -12
- package/tests/liquidsoap/src/lang/lang_core.ml +24 -24
- package/tests/liquidsoap/src/lang/lang_eval.ml +1 -1
- package/tests/liquidsoap/src/lang/lang_string.ml +7 -13
- package/tests/liquidsoap/src/lang/lang_string.mli +0 -1
- package/tests/liquidsoap/src/lang/lexer.ml +3 -0
- package/tests/liquidsoap/src/lang/parser.mly +7 -4
- package/tests/liquidsoap/src/lang/parser_helper.ml +9 -77
- package/tests/liquidsoap/src/lang/parser_helper.mli +1 -1
- package/tests/liquidsoap/src/lang/pos.ml +4 -4
- package/tests/liquidsoap/src/lang/pos.mli +55 -0
- package/tests/liquidsoap/src/lang/preprocessor.ml +12 -5
- package/tests/liquidsoap/src/lang/repr.ml +6 -6
- package/tests/liquidsoap/src/lang/runtime.ml +55 -48
- package/tests/liquidsoap/src/lang/runtime.mli +8 -3
- package/tests/liquidsoap/src/lang/term/parsed_term.ml +33 -33
- package/tests/liquidsoap/src/lang/term/term_base.ml +14 -10
- package/tests/liquidsoap/src/lang/term/term_preprocessor.ml +28 -1
- package/tests/liquidsoap/src/lang/term/term_reducer.ml +244 -132
- package/tests/liquidsoap/src/lang/term/term_reducer.mli +10 -2
- package/tests/liquidsoap/src/lang/term/term_stdlib.ml +14 -13
- package/tests/liquidsoap/src/lang/term.mli +3 -1
- package/tests/liquidsoap/src/lang/typechecking.ml +16 -16
- package/tests/liquidsoap/src/lang/typechecking.mli +5 -1
- package/tests/liquidsoap/src/lang/types/type_base.ml +16 -17
- package/tests/liquidsoap/src/lang/typing.ml +13 -12
- package/tests/liquidsoap/src/lang/typing.mli +2 -1
- package/tests/liquidsoap/src/lang/value.ml +20 -14
- package/tests/liquidsoap/src/libs/audio.liq +53 -18
- package/tests/liquidsoap/src/libs/autocue.liq +8 -8
- package/tests/liquidsoap/src/libs/clock.liq +3 -3
- package/tests/liquidsoap/src/libs/dune +2 -2
- package/tests/liquidsoap/src/libs/extra/audio.liq +4 -4
- package/tests/liquidsoap/src/libs/extra/audioscrobbler.liq +487 -0
- package/tests/liquidsoap/src/libs/extra/deprecations.liq +11 -11
- package/tests/liquidsoap/src/libs/extra/externals.liq +9 -9
- package/tests/liquidsoap/src/libs/extra/fades.liq +2 -2
- package/tests/liquidsoap/src/libs/extra/file.liq +1 -1
- package/tests/liquidsoap/src/libs/extra/http.liq +4 -4
- package/tests/liquidsoap/src/libs/extra/interactive.liq +1 -1
- package/tests/liquidsoap/src/libs/extra/metadata.liq +3 -3
- package/tests/liquidsoap/src/libs/extra/native.liq +6 -6
- package/tests/liquidsoap/src/libs/extra/server.liq +2 -2
- package/tests/liquidsoap/src/libs/extra/source.liq +10 -10
- package/tests/liquidsoap/src/libs/extra/spinitron.liq +11 -11
- package/tests/liquidsoap/src/libs/extra/telnet.liq +51 -0
- package/tests/liquidsoap/src/libs/extra/video.liq +2 -2
- package/tests/liquidsoap/src/libs/fades.liq +70 -57
- package/tests/liquidsoap/src/libs/ffmpeg.liq +50 -33
- package/tests/liquidsoap/src/libs/file.liq +8 -8
- package/tests/liquidsoap/src/libs/hls.liq +5 -5
- package/tests/liquidsoap/src/libs/http.liq +64 -37
- package/tests/liquidsoap/src/libs/icecast.liq +1 -1
- package/tests/liquidsoap/src/libs/io.liq +6 -6
- package/tests/liquidsoap/src/libs/medialib.liq +46 -45
- package/tests/liquidsoap/src/libs/metadata.liq +4 -4
- package/tests/liquidsoap/src/libs/null.liq +3 -3
- package/tests/liquidsoap/src/libs/playlist.liq +547 -22
- package/tests/liquidsoap/src/libs/protocols.liq +14 -14
- package/tests/liquidsoap/src/libs/replaygain.liq +11 -11
- package/tests/liquidsoap/src/libs/request.liq +27 -29
- package/tests/liquidsoap/src/libs/runtime.liq +2 -0
- package/tests/liquidsoap/src/libs/source.liq +15 -15
- package/tests/liquidsoap/src/libs/sqlite.liq +1 -1
- package/tests/liquidsoap/src/libs/stdlib.liq +1 -1
- package/tests/liquidsoap/src/libs/string.liq +6 -6
- package/tests/liquidsoap/src/libs/switches.liq +3 -3
- package/tests/liquidsoap/src/libs/thread.liq +3 -9
- package/tests/liquidsoap/src/libs/tracks.liq +23 -9
- package/tests/liquidsoap/src/libs/video.liq +32 -32
- package/tests/liquidsoap/src/modules/dtools/README.md +58 -0
- package/tests/liquidsoap/src/modules/dtools/dtools.ml +19 -0
- package/tests/liquidsoap/src/modules/dtools/dtools.mli +284 -0
- package/tests/liquidsoap/src/modules/dtools/dtools_impl.ml +860 -0
- package/tests/liquidsoap/src/modules/dtools/dtools_syslog.impl.ml +45 -0
- package/tests/liquidsoap/src/modules/dtools/dtools_syslog.noop.ml +1 -0
- package/tests/liquidsoap/src/modules/dtools/dune +12 -0
- package/tests/liquidsoap/src/modules/duppy/.merlin +4 -0
- package/tests/liquidsoap/src/modules/duppy/README.md +47 -0
- package/tests/liquidsoap/src/modules/duppy/dune +7 -0
- package/tests/liquidsoap/src/modules/duppy/duppy.ml +1097 -0
- package/tests/liquidsoap/src/modules/duppy/duppy.mli +494 -0
- package/tests/liquidsoap/src/modules/duppy/duppy_stubs.c +176 -0
- package/tests/liquidsoap/src/modules/duppy/examples/dune +9 -0
- package/tests/liquidsoap/src/modules/duppy/examples/http.ml +560 -0
- package/tests/liquidsoap/src/modules/duppy/examples/index.html +1 -0
- package/tests/liquidsoap/src/modules/duppy/examples/telnet.ml +150 -0
- package/tests/liquidsoap/src/modules/xmlplaylist/dune +5 -0
- package/tests/liquidsoap/src/modules/xmlplaylist/xmlplaylist.ml +185 -0
- package/tests/liquidsoap/src/modules/xmlplaylist/xmlplaylist.mli +56 -0
- package/tests/liquidsoap/src/ndi/ndi.mli +2 -3
- package/tests/liquidsoap/src/runtime/build_config.ml +0 -1
- package/tests/liquidsoap/src/runtime/main.ml +4 -23
- package/tests/liquidsoap/src/stereotool/stereotool.mli +3 -3
- package/tests/liquidsoap/src/tooling/parsed_json.ml +6 -4
- package/tests/liquidsoap/tests/core/content_test.ml +2 -39
- package/tests/liquidsoap/tests/core/dune +13 -0
- package/tests/liquidsoap/tests/core/dune.inc +1 -1
- package/tests/liquidsoap/tests/core/gen_dune.ml +4 -1
- package/tests/liquidsoap/tests/core/json_test.ml +10 -0
- package/tests/liquidsoap/tests/core/more_types.ml +32 -28
- package/tests/liquidsoap/tests/core/output_encoded_test.ml +2 -0
- package/tests/liquidsoap/tests/core/string_test.ml +4 -0
- package/tests/liquidsoap/tests/core/types.ml +1 -1
- package/tests/liquidsoap/tests/harbor/http.liq +1 -1
- package/tests/liquidsoap/tests/harbor/http2.liq +1 -1
- package/tests/liquidsoap/tests/language/cue_test.liq +3993 -0
- package/tests/liquidsoap/tests/language/dune.inc +24 -0
- package/tests/liquidsoap/tests/language/error.liq +1 -1
- package/tests/liquidsoap/tests/language/json.liq +11 -11
- package/tests/liquidsoap/tests/language/list.liq +1 -1
- package/tests/liquidsoap/tests/language/metadata.liq +1 -1
- package/tests/liquidsoap/tests/language/null.liq +9 -9
- package/tests/liquidsoap/tests/language/record.liq +23 -23
- package/tests/liquidsoap/tests/language/replaygain.liq +8 -8
- package/tests/liquidsoap/tests/language/sqlite.liq +1 -1
- package/tests/liquidsoap/tests/language/string.liq +1 -1
- package/tests/liquidsoap/tests/language/type_errors.liq +2 -2
- package/tests/liquidsoap/tests/language/typing.liq +2 -2
- package/tests/liquidsoap/tests/language/various.liq +1 -0
- package/tests/liquidsoap/tests/language/xml_test.liq +132 -0
- package/tests/liquidsoap/tests/media/dune +74 -0
- package/tests/liquidsoap/tests/media/dune.inc +63 -0
- package/tests/liquidsoap/tests/media/ffmpeg_add_text.liq +42 -56
- package/tests/liquidsoap/tests/media/ffmpeg_copy_concat.liq +5 -2
- package/tests/liquidsoap/tests/media/ffmpeg_distributed_hls.liq +2 -4
- package/tests/liquidsoap/tests/media/ffmpeg_filter_changing_rate.liq +1 -1
- package/tests/liquidsoap/tests/media/ffmpeg_inline_encode_decode_audio.liq +1 -5
- package/tests/liquidsoap/tests/media/ffmpeg_inline_encode_decode_video.liq +1 -3
- package/tests/liquidsoap/tests/media/ffmpeg_raw_and_encode_decoder.liq +1 -3
- package/tests/liquidsoap/tests/media/ffmpeg_raw_hls.liq +2 -4
- package/tests/liquidsoap/tests/media/ffmpeg_raw_implicit_conversion.liq +63 -0
- package/tests/liquidsoap/tests/media/gen_dune.ml +1 -0
- package/tests/liquidsoap/tests/media/image_decoder_duration.liq +15 -0
- package/tests/liquidsoap/tests/media/lufs_integrated.liq +17 -0
- package/tests/liquidsoap/tests/regression/AC5109.liq +2 -2
- package/tests/liquidsoap/tests/regression/GH1129.liq +3 -3
- package/tests/liquidsoap/tests/regression/GH1279.liq +2 -2
- package/tests/liquidsoap/tests/regression/GH1327.liq +3 -3
- package/tests/liquidsoap/tests/regression/GH2585.liq +0 -2
- package/tests/liquidsoap/tests/regression/GH2756-2.liq +3 -3
- package/tests/liquidsoap/tests/regression/GH2756.liq +2 -2
- package/tests/liquidsoap/tests/regression/GH3134.liq +2 -2
- package/tests/liquidsoap/tests/regression/GH3303.liq +2 -2
- package/tests/liquidsoap/tests/regression/GH4163.liq +14 -3
- package/tests/liquidsoap/tests/regression/GH4281-2.liq +29 -0
- package/tests/liquidsoap/tests/regression/GH4281.liq +29 -0
- package/tests/liquidsoap/tests/regression/GH4395.liq +27 -0
- package/tests/liquidsoap/tests/regression/LS354-1.liq +1 -1
- package/tests/liquidsoap/tests/regression/LS354-2.liq +1 -1
- package/tests/liquidsoap/tests/regression/append-merge.liq +3 -1
- package/tests/liquidsoap/tests/regression/dune.inc +64 -0
- package/tests/liquidsoap/tests/regression/fallible_ogg.liq +9 -0
- package/tests/liquidsoap/tests/regression/init-error.liq +2 -0
- package/tests/liquidsoap/tests/regression/seek_track_map.liq +1 -1
- package/tests/liquidsoap/tests/regression/source_dynamic.liq +2 -2
- package/tests/liquidsoap/tests/run_test.ml +53 -60
- package/tests/liquidsoap/tests/streams/cross-override-end.liq +9 -2
- package/tests/liquidsoap/tests/streams/cross-override-start.liq +9 -2
- package/tests/liquidsoap/tests/streams/cross-override.liq +9 -2
- package/tests/liquidsoap/tests/streams/cross-persist-end-override.liq +9 -2
- package/tests/liquidsoap/tests/streams/cross-persist-override.liq +9 -2
- package/tests/liquidsoap/tests/streams/cross-persist-start-override.liq +9 -2
- package/tests/liquidsoap/tests/streams/cross.liq +8 -2
- package/tests/liquidsoap/tests/streams/crossfade-plot.liq +11 -8
- package/tests/liquidsoap/tests/streams/crossfade-plot.new.txt +148 -248
- package/tests/liquidsoap/tests/streams/crossfade-plot.old.txt +50 -150
- package/tests/liquidsoap/tests/streams/crossfade.liq +8 -2
- package/tests/liquidsoap/tests/streams/ctype2.liq +1 -1
- package/tests/liquidsoap/tests/streams/dune.inc +31 -0
- package/tests/liquidsoap/tests/streams/fades-overrides.liq +9 -2
- package/tests/liquidsoap/tests/streams/fades-persistent-override.liq +9 -2
- package/tests/liquidsoap/tests/streams/harbor_metadata_3.liq +1 -1
- package/tests/liquidsoap/tests/streams/hls_id3v2.liq +11 -7
- package/tests/liquidsoap/tests/streams/icecast_last_meta.liq +47 -0
- package/tests/liquidsoap/tests/streams/icecast_ssl.liq +3 -0
- package/tests/liquidsoap/tests/streams/icecast_ssl_tls.liq +3 -3
- package/tests/liquidsoap/tests/streams/icecast_tls.liq +1 -0
- package/tests/liquidsoap/tests/streams/icecast_tls_ssl.liq +5 -0
- package/tests/liquidsoap/tests/streams/no-cue-cut.liq +2 -2
- package/tests/liquidsoap/tests/streams/random.liq +2 -2
- package/tests/liquidsoap/tests/streams/replaygain.liq +10 -10
- package/tests/liquidsoap/tests/streams/rotate.liq +6 -1
- package/tests/liquidsoap/tests/streams/say.liq +2 -2
- package/tests/liquidsoap/tests/streams/srt_listen_callback.liq +1 -0
- package/tests/liquidsoap/tests/streams/srt_multiple_outputs.liq +1 -0
- package/tests/liquidsoap/tests/streams/srt_passphrase.liq +1 -0
- package/tests/liquidsoap/tests/streams/srt_raw_pcm.liq +1 -0
- package/tests/liquidsoap/tests/test.liq +4 -5
- package/tests/liquidsoap/.github/docker/Dockerfile.production +0 -37
- package/tests/liquidsoap/.github/docker/Dockerfile.production-alpine +0 -18
- package/tests/liquidsoap/.github/opam/packages/metadata/metadata.0.3.0/opam +0 -33
- package/tests/liquidsoap/.github/scripts/build-docker-alpine.sh +0 -31
- package/tests/liquidsoap/.github/scripts/build-docker.sh +0 -35
- package/tests/liquidsoap/liquidsoap-libs-extra.opam +0 -32
- package/tests/liquidsoap/liquidsoap-libs.opam +0 -31
- package/tests/liquidsoap/liquidsoap.opam +0 -63
- package/tests/liquidsoap/src/core/builtins/builtins_lastfm.ml +0 -110
- package/tests/liquidsoap/src/core/tools/liqfm.ml +0 -244
- package/tests/liquidsoap/src/libs/extra/lastfm.liq +0 -185
- /package/tests/liquidsoap/.github/docker/{Dockerfile.website → website.dockerfile} +0 -0
- /package/tests/liquidsoap/.github/opam/packages/ffmpeg-av-windows/{ffmpeg-av-windows.1.2.0 → ffmpeg-av-windows.1.2.5}/opam +0 -0
- /package/tests/liquidsoap/.github/opam/packages/ffmpeg-avcodec-windows/{ffmpeg-avcodec-windows.1.2.0 → ffmpeg-avcodec-windows.1.2.5}/opam +0 -0
- /package/tests/liquidsoap/.github/opam/packages/ffmpeg-avdevice-windows/{ffmpeg-avdevice-windows.1.2.0 → ffmpeg-avdevice-windows.1.2.5}/opam +0 -0
- /package/tests/liquidsoap/.github/opam/packages/ffmpeg-avfilter-windows/{ffmpeg-avfilter-windows.1.2.0 → ffmpeg-avfilter-windows.1.2.5}/opam +0 -0
- /package/tests/liquidsoap/.github/opam/packages/ffmpeg-avutil-windows/{ffmpeg-avutil-windows.1.2.0 → ffmpeg-avutil-windows.1.2.5}/opam +0 -0
- /package/tests/liquidsoap/.github/opam/packages/ffmpeg-swresample-windows/{ffmpeg-swresample-windows.1.2.0 → ffmpeg-swresample-windows.1.2.5}/opam +0 -0
- /package/tests/liquidsoap/.github/opam/packages/ffmpeg-swscale-windows/{ffmpeg-swscale-windows.1.2.0 → ffmpeg-swscale-windows.1.2.5}/opam +0 -0
- /package/tests/liquidsoap/.github/opam/packages/ffmpeg-windows/{ffmpeg-windows.1.2.0 → ffmpeg-windows.1.2.5}/opam +0 -0
- /package/tests/liquidsoap/{liquidsoap-mode.opam.template → opam/liquidsoap-mode.opam.template} +0 -0
- /package/tests/liquidsoap/{liquidsoap.opam.template → opam/liquidsoap.opam.template} +0 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
(*****************************************************************************
|
|
2
|
+
|
|
3
|
+
Duppy, a task scheduler for OCaml.
|
|
4
|
+
Copyright 2003-2010 Savonet team
|
|
5
|
+
|
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation; either version 2 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details, fully stated in the COPYING
|
|
15
|
+
file at the root of the liquidsoap distribution.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program; if not, write to the Free Software
|
|
19
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20
|
+
|
|
21
|
+
*****************************************************************************)
|
|
22
|
+
|
|
23
|
+
(** Advanced scheduler and monad for server-oriented programming. *)
|
|
24
|
+
|
|
25
|
+
(**
|
|
26
|
+
* {R {i {v
|
|
27
|
+
* The bars could not hold me;
|
|
28
|
+
* Force could not control me now.
|
|
29
|
+
* They try to keep me down, yeah!
|
|
30
|
+
* But Jah put I around.
|
|
31
|
+
* (...)
|
|
32
|
+
* Let me tell you this -
|
|
33
|
+
* I'm a duppy conqueror !
|
|
34
|
+
* v} } }
|
|
35
|
+
* {R {b Lee "Scratch" Perry & Bob Marley - Duppy conqueror }}
|
|
36
|
+
*
|
|
37
|
+
* {2 Duppy task scheduler for OCaml.}
|
|
38
|
+
*
|
|
39
|
+
* {!Duppy} is a task scheduler for ocaml. It implements a wrapper
|
|
40
|
+
* around [Unix.select].
|
|
41
|
+
*
|
|
42
|
+
* Using {!Duppy.Task}, the programmer can easily submit tasks that need to wait
|
|
43
|
+
* on a socket even, or for a given timeout (possibly zero).
|
|
44
|
+
*
|
|
45
|
+
* With {!Duppy.Async}, one can use a scheduler to submit asynchronous tasks.
|
|
46
|
+
*
|
|
47
|
+
* {!Duppy.Io} implements recursive easy reading and writing to a [Unix.file_descr]
|
|
48
|
+
*
|
|
49
|
+
* Finally, {!Duppy.Monad} and {!Duppy.Monad.Io} provide a monadic interface to
|
|
50
|
+
* program server code that with an implicit return/reply execution flow.
|
|
51
|
+
*
|
|
52
|
+
* The scheduler can use several queues running concurrently, each queue
|
|
53
|
+
* processing ready tasks. Of course, a queue should run in its own thread.*)
|
|
54
|
+
|
|
55
|
+
(** A scheduler is a device for processing tasks. Several queues might run in *
|
|
56
|
+
different threads, processing one scheduler's tasks. * * ['a] is the type of
|
|
57
|
+
objects used for priorities. *)
|
|
58
|
+
type 'a scheduler
|
|
59
|
+
|
|
60
|
+
(** Initiate a new scheduler
|
|
61
|
+
* @param compare the comparison function used to sort tasks according to priorities.
|
|
62
|
+
* Works as in [List.sort] *)
|
|
63
|
+
val create :
|
|
64
|
+
?on_error:(exn -> Printexc.raw_backtrace -> unit) ->
|
|
65
|
+
?compare:('a -> 'a -> int) ->
|
|
66
|
+
unit ->
|
|
67
|
+
'a scheduler
|
|
68
|
+
|
|
69
|
+
(** Internal polling function. Uses `Unix.select` on windows and `poll`
|
|
70
|
+
otherwise. *)
|
|
71
|
+
val poll :
|
|
72
|
+
Unix.file_descr list ->
|
|
73
|
+
Unix.file_descr list ->
|
|
74
|
+
Unix.file_descr list ->
|
|
75
|
+
float ->
|
|
76
|
+
Unix.file_descr list * Unix.file_descr list * Unix.file_descr list
|
|
77
|
+
|
|
78
|
+
(** [queue ~log ~priorities s name]
|
|
79
|
+
* starts a queue, on the scheduler [s] only processing priorities [p]
|
|
80
|
+
* for which [priorities p] returns [true].
|
|
81
|
+
*
|
|
82
|
+
* Several queues can be run concurrently against [s].
|
|
83
|
+
* @param log Logging function. Default: [Printf.printf "queue %s: %s\n" name]
|
|
84
|
+
* @param priorities Predicate specifying which priority to process. Default: [fun _ -> _ -> true]
|
|
85
|
+
*
|
|
86
|
+
* An exception is raised from this call when duppy's event loops has
|
|
87
|
+
* crashed. This exception should be considered a MAJOR FAILURE. All current
|
|
88
|
+
* non-ready tasks registered for the calling scheduler are dropped. You may
|
|
89
|
+
* restart Duppy's queues after it is raised but it should only be used to terminate
|
|
90
|
+
* the process diligently!! *)
|
|
91
|
+
val queue :
|
|
92
|
+
?log:(string -> unit) ->
|
|
93
|
+
?priorities:('a -> bool) ->
|
|
94
|
+
'a scheduler ->
|
|
95
|
+
string ->
|
|
96
|
+
unit
|
|
97
|
+
|
|
98
|
+
(** Stop all queues running on that scheduler and wait for them to return. *)
|
|
99
|
+
val stop : 'a scheduler -> unit
|
|
100
|
+
|
|
101
|
+
(** Core task registration. * * A task will be a set of events to watch, and a
|
|
102
|
+
corresponding function to * execute when one of the events is triggered. * *
|
|
103
|
+
The executed function may then return a list of new tasks to schedule. *)
|
|
104
|
+
module Task : sig
|
|
105
|
+
(** A task is a list of events awaited, * and a function to process events
|
|
106
|
+
that have occurred. * * The ['a] parameter is the type of priorities, ['b]
|
|
107
|
+
will be a subset of possible * events. *)
|
|
108
|
+
type ('a, 'b) task = {
|
|
109
|
+
priority : 'a;
|
|
110
|
+
events : 'b list;
|
|
111
|
+
handler : 'b list -> ('a, 'b) task list;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
(** Type for possible events. * * Please not that currently, under win32, all
|
|
115
|
+
socket used in ocaml-duppy * are expected to be in blocking mode only! *)
|
|
116
|
+
type event =
|
|
117
|
+
[ `Delay of float
|
|
118
|
+
| `Write of Unix.file_descr
|
|
119
|
+
| `Read of Unix.file_descr
|
|
120
|
+
| `Exception of Unix.file_descr ]
|
|
121
|
+
|
|
122
|
+
(** Schedule a task. *)
|
|
123
|
+
val add : 'a scheduler -> ('a, [< event ]) task -> unit
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
(** Asynchronous task module * * This module implements an asynchronous API to
|
|
127
|
+
{!Duppy.scheduler} * It allows to create a task that will run and then go to
|
|
128
|
+
sleep. *)
|
|
129
|
+
module Async : sig
|
|
130
|
+
type t
|
|
131
|
+
|
|
132
|
+
(** Exception raised when trying to wake_up a task * that has been previously
|
|
133
|
+
stopped *)
|
|
134
|
+
exception Stopped
|
|
135
|
+
|
|
136
|
+
(** [add ~priority s f] creates an asynchronous task in [s] with * priority
|
|
137
|
+
[priority]. * * The task executes the function [f]. * If the task returns
|
|
138
|
+
a positive float, the function will be executed * again after this delay.
|
|
139
|
+
Otherwise it goes to sleep, and * you can use [wake_up] to resume the task
|
|
140
|
+
and execute [f] again. * Only a single call to [f] is done at each time. *
|
|
141
|
+
Multiple [wake_up] while previous task has not * finished will result in
|
|
142
|
+
sequentialized calls to [f]. *)
|
|
143
|
+
val add : priority:'a -> 'a scheduler -> (unit -> float) -> t
|
|
144
|
+
|
|
145
|
+
(** Wake up an asynchronous task. * Raises [Stopped] if the task has been
|
|
146
|
+
stopped. *)
|
|
147
|
+
val wake_up : t -> unit
|
|
148
|
+
|
|
149
|
+
(** Stop and remove the asynchronous task. Doesn't quit a running task. *
|
|
150
|
+
Raises [Stopped] if the task has been stopped. *)
|
|
151
|
+
val stop : t -> unit
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
(** Module type for Io functor. *)
|
|
155
|
+
module type Transport_t = sig
|
|
156
|
+
type t
|
|
157
|
+
|
|
158
|
+
type bigarray =
|
|
159
|
+
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
|
|
160
|
+
|
|
161
|
+
val sock : t -> Unix.file_descr
|
|
162
|
+
val read : t -> Bytes.t -> int -> int -> int
|
|
163
|
+
val write : t -> Bytes.t -> int -> int -> int
|
|
164
|
+
val ba_write : t -> bigarray -> int -> int -> int
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
(** Easy parsing of [Unix.file_descr]. * * With {!Duppy.Io.read}, you can pass a
|
|
168
|
+
file descriptor to the scheduler, * along with a marker, and have it run the
|
|
169
|
+
associated function when the * marker is found. * * With {!Duppy.Io.write},
|
|
170
|
+
the schdeduler will try to write recursively to the file descriptor * the
|
|
171
|
+
given string. *)
|
|
172
|
+
module type Io_t = sig
|
|
173
|
+
type socket
|
|
174
|
+
|
|
175
|
+
(** Type for markers. * * [Split s] recognizes all regexp allowed by the *
|
|
176
|
+
[Pcre] module. *)
|
|
177
|
+
type marker = Length of int | Split of string
|
|
178
|
+
|
|
179
|
+
(** Type of [Bigarray] used here. *)
|
|
180
|
+
type bigarray =
|
|
181
|
+
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
|
|
182
|
+
|
|
183
|
+
(** Different types of failure. * * [Io_error] is raised when reading or
|
|
184
|
+
writing * returned 0. This usually means that the socket * was closed. *)
|
|
185
|
+
type failure =
|
|
186
|
+
| Io_error
|
|
187
|
+
| Unix of Unix.error * string * string
|
|
188
|
+
| Unknown of exn
|
|
189
|
+
| Timeout
|
|
190
|
+
|
|
191
|
+
(** Wrapper to perform a read on a socket and trigger a function when
|
|
192
|
+
* a marker has been detected, or enough data has been read.
|
|
193
|
+
* It reads recursively on a socket, splitting into strings separated
|
|
194
|
+
* by the marker (if any) and calls the given function on the list of strings.
|
|
195
|
+
*
|
|
196
|
+
* Can be used recursively or not, depending on the way you process strings.
|
|
197
|
+
* Because of Unix's semantic, it is not possible to stop reading
|
|
198
|
+
* at first marker, so there can be a remaining string. If not used
|
|
199
|
+
* recursively, the second optional argument may contain a remaining
|
|
200
|
+
* string. You should then initiate the next read with this value.
|
|
201
|
+
*
|
|
202
|
+
* The [on_error] function is used when reading failed on the socket.
|
|
203
|
+
* Depending on your usage, it can be a hard failure, or simply a lost client.
|
|
204
|
+
* The string passed to [on_error] contains data read before error
|
|
205
|
+
* occurred.
|
|
206
|
+
* @param recursive recursively read and process, default: [true]
|
|
207
|
+
* @param init initial string for reading, default: [""]
|
|
208
|
+
* @param on_error function used when read failed, default: [fun _ -> ()]
|
|
209
|
+
* @param timeout Terminate with [Timeout] failure if nothing has been read
|
|
210
|
+
* after the given amount of time in seconds. More precisely,
|
|
211
|
+
* the exception is raised when no character have been read
|
|
212
|
+
* and the socket was not close while waiting. Default: wait
|
|
213
|
+
* forever. *)
|
|
214
|
+
val read :
|
|
215
|
+
?recursive:bool ->
|
|
216
|
+
?init:string ->
|
|
217
|
+
?on_error:(string * failure -> unit) ->
|
|
218
|
+
?timeout:float ->
|
|
219
|
+
priority:'a ->
|
|
220
|
+
'a scheduler ->
|
|
221
|
+
socket ->
|
|
222
|
+
marker ->
|
|
223
|
+
(string * string option -> unit) ->
|
|
224
|
+
unit
|
|
225
|
+
|
|
226
|
+
(** Similar to [read] but less complex.
|
|
227
|
+
* [write ?exec ?on_error ?string ?bigarray ~priority scheduler socket]
|
|
228
|
+
* write data from [string], or from [bigarray] if no string is given,
|
|
229
|
+
* to [socket], and executes [exec] or [on_error] if errors occurred.
|
|
230
|
+
*
|
|
231
|
+
* Caveat: on Win32, all file descriptors are expected to be in blocking
|
|
232
|
+
* mode before being passed to this call due to limitations in the emulation
|
|
233
|
+
* of the unix/posix API. See code comments for more details.
|
|
234
|
+
*
|
|
235
|
+
* @param exec function to execute after writing, default: [fun () -> ()]
|
|
236
|
+
* @param on_error function to execute when an error occurred, default: [fun _ -> ()]
|
|
237
|
+
* @param string write data from this string
|
|
238
|
+
* @param bigarray write data from this bigarray, if no [string] is given
|
|
239
|
+
* @param timeout Terminate with [Timeout] failure if nothing has been written
|
|
240
|
+
* after the given amount of time in seconds. More precisely,
|
|
241
|
+
* the exception is raised when no character have been written
|
|
242
|
+
* and the socket was not close while waiting. Default: wait
|
|
243
|
+
* forever. *)
|
|
244
|
+
val write :
|
|
245
|
+
?exec:(unit -> unit) ->
|
|
246
|
+
?on_error:(failure -> unit) ->
|
|
247
|
+
?bigarray:bigarray ->
|
|
248
|
+
?offset:int ->
|
|
249
|
+
?length:int ->
|
|
250
|
+
?string:Bytes.t ->
|
|
251
|
+
?timeout:float ->
|
|
252
|
+
priority:'a ->
|
|
253
|
+
'a scheduler ->
|
|
254
|
+
socket ->
|
|
255
|
+
unit
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
module MakeIo (Transport : Transport_t) : Io_t with type socket = Transport.t
|
|
259
|
+
module Io : Io_t with type socket = Unix.file_descr
|
|
260
|
+
|
|
261
|
+
(** Monadic interface to {!Duppy.Io}. * * This module can be used to write code
|
|
262
|
+
* that runs in various Duppy's tasks and * raise values in a completely
|
|
263
|
+
transparent way. * * You can see examples of its use * in the [examples/]
|
|
264
|
+
directory of the * source code and in the files *
|
|
265
|
+
[src/tools/{harbor.camlp4,server.camlp4}] * in liquidsoap's code. * * When a
|
|
266
|
+
server communicates * with a client, it performs several * computations and,
|
|
267
|
+
eventually, terminates. * A computation can either return a new * value or
|
|
268
|
+
terminate. For instance: * * - Client connects. * - Server tries to
|
|
269
|
+
authenticate the client. * - If authentication is ok, proceed with the next
|
|
270
|
+
step. * - Otherwise terminate. * * The purpose of the monad is to embed *
|
|
271
|
+
computations which can either return * a new value or raise a value that is
|
|
272
|
+
used * to terminate. *)
|
|
273
|
+
module Monad : sig
|
|
274
|
+
(** Type representing a computation * which returns a value of type ['a] * or
|
|
275
|
+
raises a value of type ['b] *)
|
|
276
|
+
type ('a, 'b) t
|
|
277
|
+
|
|
278
|
+
(** [return x] create a computation that * returns value [x]. *)
|
|
279
|
+
val return : 'a -> ('a, 'b) t
|
|
280
|
+
|
|
281
|
+
(** [raise x] create a computation that raises * value [x]. *)
|
|
282
|
+
val raise : 'b -> ('a, 'b) t
|
|
283
|
+
|
|
284
|
+
(** Compose two computations. * [bind f g] is equivalent to: *
|
|
285
|
+
[let x = f in g x] where [x] * has f's return type. *)
|
|
286
|
+
val bind : ('a, 'b) t -> ('a -> ('c, 'b) t) -> ('c, 'b) t
|
|
287
|
+
|
|
288
|
+
(** [>>=] is an alternative notation * for [bind] *)
|
|
289
|
+
val ( >>= ) : ('a, 'b) t -> ('a -> ('c, 'b) t) -> ('c, 'b) t
|
|
290
|
+
|
|
291
|
+
(** [run f ~return ~raise ()] executes [f] and process * returned values with
|
|
292
|
+
[return] or raised values * with [raise]. *)
|
|
293
|
+
val run : return:('a -> unit) -> raise:('b -> unit) -> ('a, 'b) t -> unit
|
|
294
|
+
|
|
295
|
+
(** [catch f g] redirects values [x] raised during * [f]'s execution to [g].
|
|
296
|
+
The name suggests the * usual [try .. with ..] exception catching. *)
|
|
297
|
+
val catch : ('a, 'b) t -> ('b -> ('a, 'c) t) -> ('a, 'c) t
|
|
298
|
+
|
|
299
|
+
(** [=<<] is an alternative notation for catch. *)
|
|
300
|
+
val ( =<< ) : ('b -> ('a, 'c) t) -> ('a, 'b) t -> ('a, 'c) t
|
|
301
|
+
|
|
302
|
+
(** [fold_left f a [b1; b2; ..]] returns computation *
|
|
303
|
+
[ (f a b1) >>= (fun a -> f a b2) >>= ...] *)
|
|
304
|
+
val fold_left : ('a -> 'b -> ('a, 'c) t) -> 'a -> 'b list -> ('a, 'c) t
|
|
305
|
+
|
|
306
|
+
(** [iter f [x1; x2; ..]] returns computation *
|
|
307
|
+
[f x1 >>= (fun () -> f x2) >>= ...] *)
|
|
308
|
+
val iter : ('a -> (unit, 'b) t) -> 'a list -> (unit, 'b) t
|
|
309
|
+
|
|
310
|
+
(** This module implements monadic * mutex computations. They can be used * to
|
|
311
|
+
write blocking code that is compatible * with duppy's tasks, i.e.
|
|
312
|
+
[Mutex.lock m] blocks * the calling computation and not the calling
|
|
313
|
+
thread. *)
|
|
314
|
+
module Mutex : sig
|
|
315
|
+
(** Information used to initialize a Mutex module. * [priority] and
|
|
316
|
+
[scheduler] are used to initialize a task * which treat mutexes as well
|
|
317
|
+
as conditions from the below * [Condition] module. *)
|
|
318
|
+
module type Mutex_control = sig
|
|
319
|
+
type priority
|
|
320
|
+
|
|
321
|
+
val scheduler : priority scheduler
|
|
322
|
+
val priority : priority
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
module type Mutex_t = sig
|
|
326
|
+
(** Type for a mutex. *)
|
|
327
|
+
type mutex
|
|
328
|
+
|
|
329
|
+
module Control : Mutex_control
|
|
330
|
+
|
|
331
|
+
(** [create ()] creates a mutex. *)
|
|
332
|
+
val create : unit -> mutex
|
|
333
|
+
|
|
334
|
+
(** A computation that locks a mutex * and returns [unit] afterwards.
|
|
335
|
+
Computation * will be blocked until the mutex is successfully locked.
|
|
336
|
+
*)
|
|
337
|
+
val lock : mutex -> (unit, 'a) t
|
|
338
|
+
|
|
339
|
+
(** A computation that tries to lock a mutex. * Returns immediately [true]
|
|
340
|
+
if the mutex was successfully locked * or [false] otherwise. *)
|
|
341
|
+
val try_lock : mutex -> (bool, 'a) t
|
|
342
|
+
|
|
343
|
+
(** A computation that unlocks a mutex. * Should return immediately. *)
|
|
344
|
+
val unlock : mutex -> (unit, 'a) t
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
module Factory (_ : Mutex_control) : Mutex_t
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
(** This module implements monadic * condition computations. They can be used
|
|
351
|
+
* to write waiting code that is compatible * with duppy's tasks, i.e.
|
|
352
|
+
[Condition.wait c m] blocks * the calling computation and not the calling
|
|
353
|
+
thread * until [Condition.signal c] or [Condition.broadcast c] has * been
|
|
354
|
+
called. *)
|
|
355
|
+
module Condition : sig
|
|
356
|
+
module Factory (Mutex : Mutex.Mutex_t) : sig
|
|
357
|
+
(** Type of a condition, used in [wait] and [broadcast] *)
|
|
358
|
+
type condition
|
|
359
|
+
|
|
360
|
+
(** Create a condition. Implementation-wise, * a duppy task is created
|
|
361
|
+
that will be used to select a * waiting computation, and resume it. *
|
|
362
|
+
Thus, [priority] and [s] represents, resp., the priority * and
|
|
363
|
+
scheduler used when running calling process' computation. *)
|
|
364
|
+
val create : unit -> condition
|
|
365
|
+
|
|
366
|
+
(** [wait h m] is a computation that:
|
|
367
|
+
* {ul
|
|
368
|
+
* {- Unlock mutex [m]}
|
|
369
|
+
* {- Wait until [Condition.signal c] or [Condition.broadcast c]
|
|
370
|
+
has been called}
|
|
371
|
+
* {- Locks mutex [m]}
|
|
372
|
+
* {- Returns [unit]}} *)
|
|
373
|
+
val wait : condition -> Mutex.mutex -> (unit, 'a) t
|
|
374
|
+
|
|
375
|
+
(** [broadcast c] is a computation that * resumes all computations waiting
|
|
376
|
+
on [c]. It should * return immediately. *)
|
|
377
|
+
val broadcast : condition -> (unit, 'a) t
|
|
378
|
+
|
|
379
|
+
(** [signal c] is a computation that resumes one * computation waiting on
|
|
380
|
+
[c]. It should return * immediately. *)
|
|
381
|
+
val signal : condition -> (unit, 'a) t
|
|
382
|
+
end
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
(** This module implements monadic computations * using [Duppy.Io]. It can be
|
|
386
|
+
used to create * computations that read or write from a socket, * and also
|
|
387
|
+
to redirect a computation in a different * queue with a new priority. *)
|
|
388
|
+
module type Monad_io_t = sig
|
|
389
|
+
type socket
|
|
390
|
+
|
|
391
|
+
module Io : Io_t with type socket = socket
|
|
392
|
+
|
|
393
|
+
(** {2 Type} *)
|
|
394
|
+
|
|
395
|
+
(** A handler for this module * is a record that contains the * required
|
|
396
|
+
elements. In particular, * [on_error] is a function that transforms * an
|
|
397
|
+
error raised by [Duppy.Io] to a reply * used to terminate the
|
|
398
|
+
computation. * [data] is an internal data buffer. It should * be
|
|
399
|
+
initialized with [""]. It contains the * remaining data that was
|
|
400
|
+
received when * using [read]. If an error occurred, * [data] contain
|
|
401
|
+
data read before the * error. *)
|
|
402
|
+
type ('a, 'b) handler = {
|
|
403
|
+
scheduler : 'a scheduler;
|
|
404
|
+
socket : Io.socket;
|
|
405
|
+
mutable data : string;
|
|
406
|
+
on_error : Io.failure -> 'b;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
(** {2 Execution flow} *)
|
|
410
|
+
|
|
411
|
+
(** [exec ?delay ~priority h f] redirects computation * [f] into a new queue
|
|
412
|
+
with priority [priority] and * delay [delay] ([0.] by default). * It can
|
|
413
|
+
be used to redirect a computation that * has to run under a different
|
|
414
|
+
priority. For instance, * a computation that reads from a socket is
|
|
415
|
+
generally * not blocking because the function is executed * only when
|
|
416
|
+
some data is available for reading. * However, if the data that is read
|
|
417
|
+
needs to be processed * by a computation that can be blocking, then one
|
|
418
|
+
may * use [exec] to redirect this computation into an * appropriate
|
|
419
|
+
queue. *)
|
|
420
|
+
val exec :
|
|
421
|
+
?delay:float ->
|
|
422
|
+
priority:'a ->
|
|
423
|
+
('a, 'b) handler ->
|
|
424
|
+
('c, 'b) t ->
|
|
425
|
+
('c, 'b) t
|
|
426
|
+
|
|
427
|
+
(** [delay ~priority h d] creates a computation that returns * [unit] after
|
|
428
|
+
delay [d] in seconds. *)
|
|
429
|
+
val delay : priority:'a -> ('a, 'b) handler -> float -> (unit, 'b) t
|
|
430
|
+
|
|
431
|
+
(** {2 Read/write} *)
|
|
432
|
+
|
|
433
|
+
(** [read ?timeout ~priority ~marker h] creates a * computation that reads
|
|
434
|
+
from [h.socket] * and returns the first string split * according to
|
|
435
|
+
[marker]. This function * can be used to create a computation that *
|
|
436
|
+
reads data from a socket. [timeout] parameter * forces the computation
|
|
437
|
+
to return an error if * nothing has been read for more than [timeout] *
|
|
438
|
+
seconds. Default: wait forever. *)
|
|
439
|
+
val read :
|
|
440
|
+
?timeout:float ->
|
|
441
|
+
priority:'a ->
|
|
442
|
+
marker:Io.marker ->
|
|
443
|
+
('a, 'b) handler ->
|
|
444
|
+
(string, 'b) t
|
|
445
|
+
|
|
446
|
+
(** [read_all ?timeout ~priority s sock] creates a * computation that reads
|
|
447
|
+
all data from [sock] * and returns it. Raised value contains data * read
|
|
448
|
+
before an error occurred. *)
|
|
449
|
+
val read_all :
|
|
450
|
+
?timeout:float ->
|
|
451
|
+
priority:'a ->
|
|
452
|
+
'a scheduler ->
|
|
453
|
+
Io.socket ->
|
|
454
|
+
(string, string * Io.failure) t
|
|
455
|
+
|
|
456
|
+
(** [write ?timeout ~priority h s] creates a computation * that writes
|
|
457
|
+
string [s] to [h.socket]. This * function can be used to create a
|
|
458
|
+
computation * that sends data to a socket. [timeout] parameter * forces
|
|
459
|
+
the computation to return an error if * nothing has been written for
|
|
460
|
+
more than [timeout] * seconds. Default: wait forever. *)
|
|
461
|
+
val write :
|
|
462
|
+
?timeout:float ->
|
|
463
|
+
priority:'a ->
|
|
464
|
+
('a, 'b) handler ->
|
|
465
|
+
?offset:int ->
|
|
466
|
+
?length:int ->
|
|
467
|
+
Bytes.t ->
|
|
468
|
+
(unit, 'b) t
|
|
469
|
+
|
|
470
|
+
(** [write_bigarray ?timeout ~priority h ba] creates a computation * that
|
|
471
|
+
writes data from [ba] to [h.socket]. This function * can to create a
|
|
472
|
+
computation that writes data to a socket. *)
|
|
473
|
+
val write_bigarray :
|
|
474
|
+
?timeout:float ->
|
|
475
|
+
priority:'a ->
|
|
476
|
+
('a, 'b) handler ->
|
|
477
|
+
Io.bigarray ->
|
|
478
|
+
(unit, 'b) t
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
module MakeIo (Io : Io_t) :
|
|
482
|
+
Monad_io_t with type socket = Io.socket and module Io = Io
|
|
483
|
+
|
|
484
|
+
module Io : Monad_io_t with type socket = Unix.file_descr and module Io = Io
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
(** {2 Some culture..}
|
|
488
|
+
* {e Duppy is a Caribbean patois word of West African origin meaning ghost or spirit.
|
|
489
|
+
* Much of Caribbean folklore revolves around duppies.
|
|
490
|
+
* Duppies are generally regarded as malevolent spirits.
|
|
491
|
+
* They are said to come out and haunt people at night mostly,
|
|
492
|
+
* and people from the islands claim to have seen them.
|
|
493
|
+
* The 'Rolling Calf', 'Three footed horse' or 'Old Higue' are examples of the more malicious spirits. }
|
|
494
|
+
* {R {{:http://en.wikipedia.org/wiki/Duppy} http://en.wikipedia.org/wiki/Duppy}}*)
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2010 Savonet team
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Ocaml-duppy.
|
|
5
|
+
*
|
|
6
|
+
* Ocaml-duppy is free software; you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation; either version 2 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Ocaml-duppy is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with Ocaml-duppy; if not, write to the Free Software
|
|
18
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#include <caml/alloc.h>
|
|
23
|
+
#include <caml/signals.h>
|
|
24
|
+
#include <caml/unixsupport.h>
|
|
25
|
+
#include <caml/memory.h>
|
|
26
|
+
#include <caml/bigarray.h>
|
|
27
|
+
#include <caml/fail.h>
|
|
28
|
+
#include <caml/threads.h>
|
|
29
|
+
|
|
30
|
+
#include <errno.h>
|
|
31
|
+
#include <math.h>
|
|
32
|
+
|
|
33
|
+
/* On native Windows platforms, many macros are not defined. */
|
|
34
|
+
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
|
35
|
+
|
|
36
|
+
#ifndef EWOULDBLOCK
|
|
37
|
+
#define EWOULDBLOCK EAGAIN
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
#ifdef WIN32
|
|
43
|
+
#define Fd_val(fd) win_CRT_fd_of_filedescr(fd)
|
|
44
|
+
#define Val_fd(fd) caml_failwith("Val_fd")
|
|
45
|
+
#else
|
|
46
|
+
#define Fd_val(fd) Int_val(fd)
|
|
47
|
+
#define Val_fd(fd) Val_int(fd)
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#ifndef WIN32
|
|
51
|
+
#include <poll.h>
|
|
52
|
+
|
|
53
|
+
CAMLprim value caml_poll(value _read, value _write, value _err, value _timeout) {
|
|
54
|
+
CAMLparam3(_read, _write, _err);
|
|
55
|
+
CAMLlocal4(_pread, _pwrite, _perr, _ret);
|
|
56
|
+
|
|
57
|
+
struct pollfd *fds;
|
|
58
|
+
nfds_t nfds = 0;
|
|
59
|
+
nfds_t nread = 0;
|
|
60
|
+
nfds_t nwrite = 0;
|
|
61
|
+
nfds_t nerr = 0;
|
|
62
|
+
int timeout;
|
|
63
|
+
size_t last = 0;
|
|
64
|
+
int n, ret;
|
|
65
|
+
|
|
66
|
+
if (Double_val(_timeout) == -1)
|
|
67
|
+
timeout = -1;
|
|
68
|
+
else
|
|
69
|
+
timeout = ceil(Double_val(_timeout) * 1000);
|
|
70
|
+
|
|
71
|
+
nfds += Wosize_val(_read);
|
|
72
|
+
nfds += Wosize_val(_write);
|
|
73
|
+
nfds += Wosize_val(_err);
|
|
74
|
+
|
|
75
|
+
fds = calloc(nfds,sizeof(struct pollfd));
|
|
76
|
+
if (fds == NULL) caml_raise_out_of_memory();
|
|
77
|
+
|
|
78
|
+
for (n = 0; n < Wosize_val(_read); n++) {
|
|
79
|
+
fds[last+n].fd = Fd_val(Field(_read,n));
|
|
80
|
+
fds[last+n].events = POLLIN;
|
|
81
|
+
}
|
|
82
|
+
last += Wosize_val(_read);
|
|
83
|
+
|
|
84
|
+
for (n = 0; n < Wosize_val(_write); n++) {
|
|
85
|
+
fds[last+n].fd = Fd_val(Field(_write,n));
|
|
86
|
+
fds[last+n].events = POLLOUT;
|
|
87
|
+
}
|
|
88
|
+
last += Wosize_val(_write);
|
|
89
|
+
|
|
90
|
+
for (n = 0; n < Wosize_val(_err); n++) {
|
|
91
|
+
fds[last+n].fd = Fd_val(Field(_err,n));
|
|
92
|
+
fds[last+n].events = POLLERR;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
caml_release_runtime_system();
|
|
96
|
+
ret = poll(fds, nfds, timeout);
|
|
97
|
+
caml_acquire_runtime_system();
|
|
98
|
+
|
|
99
|
+
if (ret == -1) {
|
|
100
|
+
free(fds);
|
|
101
|
+
uerror("poll", Nothing);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (n = 0; n < nfds; n++) {
|
|
105
|
+
if (fds[n].revents & POLLIN)
|
|
106
|
+
nread++;
|
|
107
|
+
if (fds[n].revents & POLLOUT)
|
|
108
|
+
nwrite++;
|
|
109
|
+
if (fds[n].revents & POLLERR)
|
|
110
|
+
nerr++;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
_pread = caml_alloc_tuple(nread);
|
|
114
|
+
nread = 0;
|
|
115
|
+
|
|
116
|
+
_pwrite = caml_alloc_tuple(nwrite);
|
|
117
|
+
nwrite = 0;
|
|
118
|
+
|
|
119
|
+
_perr = caml_alloc_tuple(nerr);
|
|
120
|
+
nerr = 0;
|
|
121
|
+
|
|
122
|
+
for (n = 0; n < nfds; n++) {
|
|
123
|
+
if (fds[n].revents & POLLIN) {
|
|
124
|
+
Store_field(_pread, nread, Val_fd(fds[n].fd));
|
|
125
|
+
nread++;
|
|
126
|
+
}
|
|
127
|
+
if (fds[n].revents & POLLOUT) {
|
|
128
|
+
Store_field(_pwrite, nwrite, Val_fd(fds[n].fd));
|
|
129
|
+
nwrite++;
|
|
130
|
+
}
|
|
131
|
+
if (fds[n].revents & POLLERR) {
|
|
132
|
+
Store_field(_perr, nerr, Val_fd(fds[n].fd));
|
|
133
|
+
nerr++;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
free(fds);
|
|
138
|
+
|
|
139
|
+
_ret = caml_alloc_tuple(3);
|
|
140
|
+
Store_field(_ret, 0, _pread);
|
|
141
|
+
Store_field(_ret, 1, _pwrite);
|
|
142
|
+
Store_field(_ret, 2, _perr);
|
|
143
|
+
|
|
144
|
+
CAMLreturn(_ret);
|
|
145
|
+
}
|
|
146
|
+
#else
|
|
147
|
+
CAMLprim value caml_poll(value _read, value _write, value _err, value _timeout) {
|
|
148
|
+
caml_failwith("caml_poll");
|
|
149
|
+
}
|
|
150
|
+
#endif
|
|
151
|
+
|
|
152
|
+
CAMLprim value ocaml_duppy_write_ba(value _fd, value ba, value _ofs, value _len)
|
|
153
|
+
{
|
|
154
|
+
CAMLparam2(ba,_fd) ;
|
|
155
|
+
int fd = Fd_val(_fd);
|
|
156
|
+
long ofs = Long_val(_ofs);
|
|
157
|
+
long len = Long_val(_len);
|
|
158
|
+
void *buf = Caml_ba_data_val(ba);
|
|
159
|
+
int ret;
|
|
160
|
+
|
|
161
|
+
int written = 0;
|
|
162
|
+
while (len > 0) {
|
|
163
|
+
caml_enter_blocking_section();
|
|
164
|
+
ret = write(fd, buf+ofs, len);
|
|
165
|
+
caml_leave_blocking_section();
|
|
166
|
+
if (ret == -1) {
|
|
167
|
+
if ((errno == EAGAIN || errno == EWOULDBLOCK) && written > 0) break;
|
|
168
|
+
uerror("write", Nothing);
|
|
169
|
+
}
|
|
170
|
+
written += ret;
|
|
171
|
+
ofs += ret;
|
|
172
|
+
len -= ret;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
CAMLreturn(Val_long(written));
|
|
176
|
+
}
|