10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-06-16 10:15:19 +02:00
QCaml/common/README.org

96 lines
1.7 KiB
Org Mode

#+TITLE: Common
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Utility functions used by all the other directories"
#+end_src
#+RESULTS: synopsis
: Utility functions used by all the other directories
* Dune files :noexport:
** Generate dune files
Use [C-c C-c] on the code below to create the output for the dune files
#+header: :noweb strip-export
#+header: :var name=(file-name-directory buffer-file-name)
#+header: :var dune="lib/dune"
#+header: :var dunetest="test/dune"
#+begin_src python :exports none :results output none
name = name.split('/')[-2]
synopsis = """
<<synopsis>>
"""
with open(dune,'w') as f:
f.write(f"""
(library
(name {name})
(public_name qcaml.{name})
(synopsis {synopsis} )
<<dependencies>>
<<noimplementation>>
<<c-files>>
)
<<lex-yacc>>
""")
with open(dunetest,'w') as f:
f.write(f"""
(library
(name test_{name})
(synopsis "Test for {name} library")
(libraries
alcotest
unix
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
str
zarith
getopt
unix
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
#+end_src
** Extra C files
The ~util.c~ file contains small C snippets to add missing
functionalities to OCaml, such as support for the ~popcnt~ instruction.
#+name: c-files
#+begin_src elisp
(c_names
util
)
(c_flags (:standard)
-Ofast -march=native -fPIC
)
#+end_src
** Parser
#+name: lex-yacc
#+begin_src elisp
#+end_src