#+TITLE: QCaml
#+SETUPFILE: ../docs/org-html-themes/org/theme-readtheorg.setup
#+name: synopsis
#+begin_src ocaml :export output raw
"Main QCaml entry point"
#+end_src
#+RESULTS: synopsis
: Main QCaml entry point
* File generation :noexport:
Use [C-c C-c] on the code below. This will create the dune files
and the =qcaml.ml= file.
#+header: :noweb yes
#+header: :var name=(file-name-directory buffer-file-name)
#+header: :var dune="lib/dune"
#+header: :var mlfile="lib/qcaml.ml"
#+header: :var dunetest="test/dune"
#+header: :var dependencies=dependencies
#+begin_src python :exports none :results output none
name = name.split('/')[-2]
synopsis = """
<>
"""
excluded_modules = [ "top" ]
dependencies = '\n '.join([x[0] for x in dependencies if x[0].replace("qcaml.","") not in excluded_modules])
with open(dune,'w') as f:
f.write(f"""
(library
(name qcaml)
(public_name qcaml)
(synopsis {synopsis} )
(libraries
{dependencies}
)
<>
<>
)
<>
""")
with open(dunetest,'w') as f:
f.write(f"""
(library
(name test_qcaml)
(synopsis "Test for qcaml library")
(libraries
alcotest
qcaml
)
)
""")
with open(mlfile,'w') as f:
s = dependencies.split()
s = [x.replace("qcaml.","") for x in s ]
s = [x.capitalize() for x in s]
s = [ f"module {x} = {x}\n" for x in s ]
s = ''.join(s)
f.write("(* Auto-generated by qcaml/README.org *)\n")
f.write(s)
#+end_src
#+name: dependencies
#+begin_src sh :output value
grep "public_name" ../*/lib/dune | grep -v "qcaml)" | cut -d ' ' -f 3 | tr ')' ' '
#+end_src
#+RESULTS: dependencies
| qcaml.ao |
| qcaml.common |
| qcaml.gaussian |
| qcaml.gaussian_integrals |
| qcaml.linear_algebra |
| qcaml.mo |
| qcaml.operators |
| qcaml.particles |
| qcaml.perturbation |
| qcaml.simulation |
| qcaml.top |