package ppx_cstubs
Preprocessor for easier stub generation with ctypes
Install
Dune Dependency
Authors
Maintainers
Sources
0.7.0.tar.gz
md5=3bbe998f6cff3bff1ae0e7de991a9f93
sha512=b803284fe79da0b9bdd3e82d1ef113382a8de387d70d81f7ac0c9c8c7bcf5c6f5054075e64f2b10ae07e7dd8c57bb0f1de9d7140fff89cf26dc8efeec98fd944
doc/src/ppx_cstubs.internal/ppxc__script.ml.html
Source file ppxc__script.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
(* This file is part of ppx_cstubs (https://github.com/fdopen/ppx_cstubs) * Copyright (c) 2018-2019 fdopen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) open Std.Result let real_init top = Main.init top include Ppxc__script_real let _init top = let top = match top with | Some t -> t | None -> object method eval expr = let p1 = Merlin_state.to_child () in let s = Marshal.to_string (p1, expr) [] in let b = Buffer.create 8192 in let prog = if Sys.win32 then "ppx_cstubs.exe" else "ppx_cstubs" in let args = [ "--run-merlin-top" ] in let eb = Buffer.create 128 in let ec = match Run.run ~stdin:(`String s) ~stdout:(`Buffer b) ~stderr:(`Buffer eb) prog args with | exception (Unix.Unix_error _ as e) -> Std.Util.error "failed to call ppx_cstubs: %s\n" (Printexc.to_string e) | x -> x in if ec <> 0 then Buffer.contents eb |> Std.Util.error "ipc error: child exit with %d (%S)" ec; let s = Buffer.contents b in match Marshal.from_string s 0 with | exception ((Failure _ | Invalid_argument _) as e) -> Std.Util.error "ipc error: marshaling from ppx_cstubs failed: %s" (Printexc.to_string e) | Ok s -> Merlin_state.from_child s | Error e -> Merlin_state.raise_error e method init ~nopervasives:_ ~pkgs:_ ~use_threads:_ ~cma_files:_ () = () method is_merlin_ppx = true end in real_init top
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>