package xenstore
Xenstore protocol in pure OCam
Install
Dune Dependency
github.com
Readme
Changelog
LGPL-2.1-only WITH OCaml-LGPL-linking-exception License
Edit opam file
Versions (2)
Authors
Maintainers
Sources
xenstore-2.4.0.tbz
sha256=11b63bb2a5a8bc487d36f36ecb195b2a2135aa13ab401cbc73da67505c08faa4
sha512=b921aa4265503677f4984007efee6865461a18031dc49583be040781307cc6cbfcd84bc11e9ebc0a23e9b0cf281bd94528c475624bc30471ad8ff70607e0732f
doc/src/xenstore.server/symbol.ml.html
Source file symbol.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 65 66 67 68 69
(* * Copyright (C) Citrix Systems Inc. * * 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; version 2.1 only. with the special * exception on linking described in file LICENSE. * * 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. *) type t = int type 'a record = { data : 'a; mutable garbage : bool } let int_string_tbl : (int, string record) Hashtbl.t = Hashtbl.create 1024 let string_int_tbl : (string, int) Hashtbl.t = Hashtbl.create 1024 let created_counter = ref 0 let used_counter = ref 0 let count = ref 0 let rec fresh () = if Hashtbl.mem int_string_tbl !count then ( incr count; fresh ()) else !count let new_record v = { data = v; garbage = false } let of_string name = if Hashtbl.mem string_int_tbl name then ( incr used_counter; Hashtbl.find string_int_tbl name) else let i = fresh () in incr created_counter; Hashtbl.add string_int_tbl name i; Hashtbl.add int_string_tbl i (new_record name); i let to_string i = (Hashtbl.find int_string_tbl i).data let mark_all_as_unused () = Hashtbl.iter (fun _ v -> v.garbage <- true) int_string_tbl let mark_as_used symb = let record1 = Hashtbl.find int_string_tbl symb in record1.garbage <- false let garbage () = let records = Hashtbl.fold (fun symb record accu -> if record.garbage then (symb, record.data) :: accu else accu) int_string_tbl [] in let remove (int, string) = Hashtbl.remove int_string_tbl int; Hashtbl.remove string_int_tbl string in created_counter := 0; used_counter := 0; List.iter remove records let stats () = Hashtbl.length string_int_tbl let created () = !created_counter let used () = !used_counter
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>