10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-23 04:43:32 +01:00
QCaml/qcaml/README.org

90 lines
2.0 KiB
Org Mode
Raw Normal View History

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