Skip to content

Commit

Permalink
use dune sites to install asl files
Browse files Browse the repository at this point in the history
  • Loading branch information
ailrst committed Feb 7, 2024
1 parent fc60f76 commit 4b8faf8
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 6 deletions.
6 changes: 4 additions & 2 deletions asli.opam
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ license: "BSD-3-Clause"
homepage: "https://github.com/alastairreid/asl-interpreter"
bug-reports: "https://github.com/alastairreid/asl-interpreter/issues"
depends: [
"dune" {>= "2.5"}
"dune" {>= "2.8"}
"ocaml" {>= "4.09"}
"menhir" {build}
"ott" {build & >= "0.31"}
Expand All @@ -26,9 +26,11 @@ depends: [
"z3" {>= "4.8.7"}
"pcre"
"alcotest" {with-test}
"dune-site"
"odoc" {with-doc}
]
build: [
["dune" "subst"] {pinned}
["dune" "subst"] {dev}
[
"dune"
"build"
Expand Down
21 changes: 20 additions & 1 deletion bin/asli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,25 @@ module TC = Tcheck
module PP = Asl_parser_pp
module AST = Asl_ast

let opt_prelude : string ref = ref "prelude.asl"
let opt_prelude : string ref = ref ""
let opt_filenames : string list ref = ref []
let opt_print_version = ref false
let opt_verbose = ref false

let opt_debug_level = ref 0


let file_load_order = ["mra_tools/arch/regs.asl"; "mra_tools/types.asl"; "mra_tools/arch/arch.asl"; "mra_tools/arch/arch_instrs.asl";
"mra_tools/arch/arch_decode.asl"; "mra_tools/support/aes.asl";"mra_tools/support/barriers.asl";"mra_tools/support/debug.asl";
"mra_tools/support/feature.asl"; "mra_tools/support/hints.asl";"mra_tools/support/interrupts.asl"; "mra_tools/support/memory.asl";
"mra_tools/support/stubs.asl"; "mra_tools/support/fetchdecode.asl"; "tests/override.asl";"tests/override.prj"]


let default_asl_files : string option = match (Res.Sites.aslfiles) with
| hd :: _ -> Some hd
| _ -> None


let () = Printexc.register_printer
(function
| Value.EvalError (loc, msg) ->
Expand Down Expand Up @@ -315,6 +327,13 @@ let _ =
let main () =
if !opt_print_version then Printf.printf "%s\n" version
else begin
if (List.length !opt_filenames) == 0 then
(opt_filenames := match default_asl_files with
| Some s -> List.map (fun file -> (s) ^ "/" ^ (file)) file_load_order
| None -> []);
if (!opt_prelude == "") then opt_prelude := (match default_asl_files with
| Some s -> s ^ "/"
| None -> "") ^ "prelude.asl";
if !opt_verbose then List.iter print_endline banner;
if !opt_verbose then print_endline "\nType :? for help";
let t = LoadASL.read_file !opt_prelude true !opt_verbose in
Expand Down
10 changes: 8 additions & 2 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

(executable
(name asli)
(public_name asli)
(modes exe byte)
(modules asli)
(modules asli res)
(flags (-cclib -lstdc++))
(libraries libASL linenoise pprint pcre))
(libraries libASL linenoise pprint pcre dune-site)
)

(executable
(name testlexer)
Expand All @@ -21,3 +23,7 @@
(modules processops)
(flags (-cclib -lstdc++))
(libraries libASL unix))

(generate_sites_module
(module res)
(sites asli))
22 changes: 22 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(install
(files
(prelude.asl as prelude.asl )
(mra_tools/arch/arch.asl as mra_tools/arch/arch.asl )
(mra_tools/arch/arch_decode.asl as mra_tools/arch/arch_decode.asl )
(mra_tools/arch/arch_instrs.asl as mra_tools/arch/arch_instrs.asl )
(mra_tools/arch/regs.asl as mra_tools/arch/regs.asl )
(mra_tools/support/aes.asl as mra_tools/support/aes.asl )
(mra_tools/support/barriers.asl as mra_tools/support/barriers.asl )
(mra_tools/support/debug.asl as mra_tools/support/debug.asl )
(mra_tools/support/feature.asl as mra_tools/support/feature.asl )
(mra_tools/support/fetchdecode.asl as mra_tools/support/fetchdecode.asl)
(mra_tools/support/hints.asl as mra_tools/support/hints.asl )
(mra_tools/support/interrupts.asl as mra_tools/support/interrupts.asl )
(mra_tools/support/memory.asl as mra_tools/support/memory.asl )
(mra_tools/support/stubs.asl as mra_tools/support/stubs.asl )
(mra_tools/types.asl as mra_tools/types.asl )
(tests/override.asl as tests/override.asl )
(tests/override.prj as tests/override.prj )
)
(section (site (asli aslfiles)))
)
5 changes: 4 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(lang dune 2.5)
(lang dune 2.8)
(name asli)
(version 0.2.0)

(using dune_site 0.1)
(using menhir 2.0)

(package
Expand All @@ -24,7 +25,9 @@
("z3" (>= "4.8.7"))
"pcre"
("alcotest" :with-test)
"dune-site"
)
(sites (share aslfiles))
)

(license BSD-3-Clause)
Expand Down

0 comments on commit 4b8faf8

Please sign in to comment.