module Io = Eio
module StringMap = Map.Make(String)

module Compiler_libs__Topdirs = Topdirs

module Oar =
struct
module Libname = struct end
end

module Oar_kit =
struct
include Fpath
module Topdirs = Topdirs
module Firebase = struct end
end

type libname = { libname_name : string }

let unit_ls = Hashtbl.create 1

let lib_to_unit = ref StringMap.empty

let unit_to_doc = ref StringMap.empty

let mk_unit_name ~scope libname =
match scope with
| [] -> libname
| xs -> (String.concat "." @@ List.rev xs) ^ "." ^ libname

(** FIXME *)
let remove_cwd =
Re.replace ~f:(fun _ -> "") Re.(compile @@ seq [bol; str @@ Sys.getcwd (); char '/'])
(* [@@deprecated "stop using absolute paths"] *)

let%include [@in (module Oar_kit.Firebase)]
libname libname_name = { libname_name }

let scope__current = ref []

let scope__push scopename =
let open Stdlib in
let current = scope__current in
current := scopename :: !current

let scope__pop scopename =
let open Stdlib in
match !scope__current with
| [] -> failwith "there's no scope to pop"
| x :: xs when String.equal x scopename ->
scope__current := xs
| x :: _xs ->
failwith @@
Printf.sprintf "scope mismatch: trying to target '%s' but in stack found '%s'"
scopename x