10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 04:13:33 +01:00

Removed org-mode

This commit is contained in:
Anthony Scemama 2024-06-20 15:38:37 +02:00
parent 7eba47e0a4
commit 5c0b356b6c
24 changed files with 46 additions and 1194 deletions

View File

@ -1,20 +0,0 @@
#+TITLE: Developper's instructions
* General
The developper writes org-mode files, and the OCaml files are produced
by running the ~make~ command. Then, the OCaml files are compiled
using ~dune~.
In each directory, the =README.org= file is the entry point. It
contains the script to generate the dune files, which should be
created by executing ~Ctrl-C Ctrl-C~ in the appropriate code block.
If necessary, some pure OCaml files can be added in the =lib=
directory.
* Basis
- =Basis_poly= is a polymorphic basis
- =Basis_gaussian= contains the basis and integrals
- =Gaussian.Basis= is the actual Gaussian basis

View File

@ -4,27 +4,25 @@
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:
DIRS=$(shell ls */README.org | sed "s|/README.org||g")
DOCS=$(patsubst %, docs/%.html, $(DIRS)) docs/index.html
.PHONY: default build install uninstall test clean
.PHONY: default build install uninstall test clean doc
default: build
default: doc build
docs/%.html: %/*.org %/lib/*.ml %/lib/*.mli %/test/*.ml
- ./bin/tangle.sh $*
docs/top.html: */*.org */lib/*.ml */lib/*.mli
- ./bin/tangle.sh top
doc: $(DOCS)
build: doc
build:
top/install_printers.sh > top/lib/install_printers.ml
dune build
build-prof:
top/install_printers.sh > top/lib/install_printers.ml
dune build --workspace=dune-workspace.profile
test:
dune runtest -f
test-prof:
dune runtest -f --workspace=dune-workspace.profile
install:
dune install

View File

@ -33,7 +33,7 @@ How to build the project
Run `make` to compile the libraries and executables that are
meant to be installed.
```
$ make -j
$ make
```
How to run tests
@ -83,3 +83,11 @@ For more information on `opam pin`, please consult the opam documentation.
The advantage of the opam-based method is that other opam packages can
depend on this one, and opam will recompile them automatically as
necessary.
Profiling
---------
The Landmarks memory profiler can be used.

View File

@ -1,94 +0,0 @@
#+TITLE: Atomic Orbitals
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Atomic basis set"
#+end_src
#+RESULTS: synopsis
: Atomic basis set
This modules contains the data structures used to characterize the
atomic basis set.
* 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
trexio
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
qcaml.common
qcaml.particles
qcaml.gaussian
qcaml.gaussian_integrals
qcaml.operators
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
(modules_without_implementation ao_dim)
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
#+end_src

View File

@ -1,10 +1,7 @@
(library
(name ao)
(public_name qcaml.ao)
(synopsis
"Atomic basis set"
)
(synopsis "Atomic basis set")
(libraries
qcaml.common
qcaml.particles

View File

@ -1,4 +1,3 @@
(library
(name test_ao)
(synopsis "Test for ao library")

View File

@ -1,95 +0,0 @@
#+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

View File

@ -11,17 +11,17 @@ external gamma_float : float -> float
external popcnt : int64 -> int32 = "popcnt_bytecode" "popcnt"
[@@unboxed] [@@noalloc]
let popcnt i = (popcnt [@inlined] ) i |> Int32.to_int
let[@inline] popcnt i = Int32.to_int (popcnt i)
external trailz : int64 -> int32 = "trailz_bytecode" "trailz" "int"
[@@unboxed] [@@noalloc]
let trailz i = trailz i |> Int32.to_int
let[@inline] trailz i = Int32.to_int (trailz i)
external leadz : int64 -> int32 = "leadz_bytecode" "leadz" "int"
[@@unboxed] [@@noalloc]
let leadz i = leadz i |> Int32.to_int
let[@inline] leadz i = Int32.to_int (leadz i)

View File

@ -8,7 +8,7 @@
(homepage "https://gitlab.com/scemama/qcaml")
(documentation "https://gitlab.com/scemama/qcaml")
(license "LGPL-2.1+ with OCaml linking exception")
(license "LGPL-2.1-or-later")
(maintainers
"Anthony Scemama <scemama@irsamc.ups-tlse.fr>"
@ -34,7 +34,7 @@ in quantum chemistry.")
zarith
alcotest
domainslib
(landmarks-ppx (and :dev (>= 1.4)))
; (landmarks-ppx (and :dev (>= 1.4)))
)
)

14
dune-workspace.profile Normal file
View File

@ -0,0 +1,14 @@
(lang dune 2.9)
(context default)
(context
(default
(name profiling)
(instrument_with landmarks)
(env
(_ (env-vars ("OCAML_LANDMARKS" "auto")))
)
)
)

View File

@ -1,88 +0,0 @@
#+TITLE: Gaussian
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Gaussian basis sets"
#+end_src
#+RESULTS: synopsis
: Gaussian basis sets
* 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
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
(instrumentation (backend landmarks))
#+name: dependencies
#+begin_src elisp
(libraries
qcaml.common
qcaml.particles
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
#+end_src

View File

@ -1,93 +0,0 @@
#+TITLE: Gaussian integrals
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Integrals on the Gaussian basis sets"
#+end_src
#+RESULTS: synopsis
: Integrals on the Gaussian basis sets
* 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
trexio
domainslib
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
qcaml.common
qcaml.linear_algebra
qcaml.gaussian
qcaml.operators
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
(modules_without_implementation matrix_on_basis)
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
#+end_src

View File

@ -1,87 +0,0 @@
#+TITLE: Linear Algebra
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Linear algebra utilities of QCaml libraries"
#+end_src
#+RESULTS: synopsis
: Linear algebra utilities of QCaml libraries
* 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
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
qcaml.common
lacaml
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
#+end_src

View File

@ -1,86 +0,0 @@
#+TITLE: Molecular orbitals
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Molecular orbitals"
#+end_src
#+RESULTS: synopsis
: Parameteried operators, such as F12 and range-separation
* 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
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
qcaml.simulation
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
#+end_src

View File

@ -1,86 +0,0 @@
#+TITLE: Operators
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Parameteried operators, such as F12 and range-separation"
#+end_src
#+RESULTS: synopsis
: Parameteried operators, such as F12 and range-separation
* 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
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
qcaml.common
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
#+end_src

View File

@ -1,99 +0,0 @@
#+TITLE: Common
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Information relative to particles (electrons and nuclei)"
#+end_src
#+RESULTS: synopsis
: Information relative to particles (electrons and nuclei)
* 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
trexio
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
trexio
qcaml.common
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
(modules_without_implementation
xyz_ast
)
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
(ocamllex
(modules
nuclei_lexer
))
(ocamlyacc
(modules
xyz_parser
))
#+end_src

View File

@ -1,87 +0,0 @@
#+TITLE: Perturbation
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Perturbation theory"
#+end_src
#+RESULTS: synopsis
: Perturbation theory
* 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
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
qcaml.simulation
qcaml.mo
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
#+end_src

View File

@ -6,7 +6,7 @@ QCaml provides a programming framewrok work wave function methods
in quantum chemistry."""
maintainer: ["Anthony Scemama <scemama@irsamc.ups-tlse.fr>"]
authors: ["Anthony Scemama <scemama@irsamc.ups-tlse.fr>"]
license: "LGPL-2.1+ with OCaml linking exception"
license: "LGPL-2.1-or-later"
homepage: "https://gitlab.com/scemama/qcaml"
doc: "https://gitlab.com/scemama/qcaml"
bug-reports: "https://gitlab.com/scemama/qcaml/issues"
@ -20,7 +20,6 @@ depends: [
"zarith"
"alcotest"
"domainslib"
"landmarks-ppx" {dev & >= "1.4"}
"odoc" {with-doc}
]
build: [

View File

@ -1,92 +0,0 @@
#+TITLE: QCaml
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"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 = """
<<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}
)
(instrumentation (backend landmarks))
<<noimplementation>>
<<c-files>>
)
<<lex-yacc>>
""")
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 |

View File

@ -1,91 +0,0 @@
#+TITLE: Simulation
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Data describing a simulation (AOs, operators, nuclear coordinate,...)"
#+end_src
#+RESULTS: synopsis
: Data describing a simulation (AOs, operators, nuclear coordinate,...)
* 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
qcaml.{name}
)
)
""")
#+end_src
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
qcaml.common
qcaml.particles
qcaml.gaussian
qcaml.gaussian_integrals
qcaml.operators
qcaml.ao
)
(instrumentation (backend landmarks))
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
#+end_src
** Extra C files
#+begin_src elisp
#+end_src
** Parser files
#+name: lex-yacc
#+begin_src elisp
#+end_src

View File

@ -1,43 +0,0 @@
#+TITLE: Top-level
#+SETUPFILE: ../docs/theme.setup
* Summary
#+name: synopsis
#+begin_src ocaml :exports none :results value
"Installs pretty printers for top-level"
#+end_src
#+RESULTS: synopsis
: Installs pretty printers for top-level
* 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)
#+begin_src python :exports none :results output none
name = name.split('/')[-2]
synopsis = """
<<synopsis>>
"""
with open("lib/dune",'w') as f:
f.write(f"""
(library
(name {name})
(public_name qcaml.{name})
(synopsis {synopsis} )
(modes byte)
(libraries
compiler-libs.toplevel
qcaml
)
(instrumentation (backend landmarks))
)
""")
#+end_src

View File

@ -1,73 +0,0 @@
#+begin_src elisp tangle: no :results none :exports none
(setq pwd (file-name-directory buffer-file-name))
(setq name (file-name-nondirectory (substring buffer-file-name 0 -4)))
(setq lib (concat pwd "lib/"))
(setq testdir (concat pwd "test/"))
(setq mli (concat lib name ".mli"))
(setq ml (concat lib name ".ml"))
(setq test-ml (concat testdir name ".ml"))
(org-babel-tangle)
#+end_src
* Intall printers :noexport:
:PROPERTIES:
:header-args: :noweb yes :comments both
:END:
Installs printers in the top-level environment.
All printers are fetched automatically.
#+NAME: raw_printers
#+begin_src sh :results output raw :exports none
grep "val pp " ../*/lib/*.mli \
| cut -d ":" -f 1 \
| sed 's|^../||' \
| sed 's|.mli||' \
| sed 's|/lib/| |' \
| sed 's/[^ ]*/\u&/g' \
| sed 's| |.|' \
| grep -v Top.Install_printers
#+end_src
#+NAME: printers
#+begin_src python :results output raw :var p=raw_printers :exports none
result = []
for l in p.split():
dir, module = l.split('.')
if dir == module:
e = f'"{module}.pp" ;'
else:
e = f'"{dir}.{module}.pp" ;'
result.append(e)
result = '\n'.join(result)
print(result)
#+end_src
#+begin_src ocaml :tangle (eval ml) :exports none
let printers =
[
<<printers()>>
]
let eval_exn str =
let lexbuf = Lexing.from_string str in
let phrase = !Toploop.parse_toplevel_phrase lexbuf in
Toploop.execute_phrase false Format.err_formatter phrase
let rec install_printers = function
| [] -> eval_exn "#require \"lacaml.top\";;"
| printer :: printers ->
let cmd = Printf.sprintf "#install_printer %s;;" printer in
eval_exn cmd && install_printers printers
let () =
if not (install_printers printers) then
Format.eprintf "Problem installing QCaml-printers@."
#+end_src

View File

@ -3,11 +3,12 @@
(name top)
(public_name qcaml.top)
(synopsis
"Installs pretty printers for top-level."
"Installs pretty printers for top-level"
)
(modes byte)
(libraries
compiler-libs.toplevel
qcaml
)
(instrumentation (backend landmarks))
)

View File

@ -1,35 +1,5 @@
(* [[file:~/QCaml/top/install_printers.org::*Intall printers][Intall printers:3]] *)
let printers =
[
"Ao.Basis.pp" ;
"Ao.Basis_gaussian.pp" ;
"Common.Angular_momentum.pp" ;
"Common.Bitstring.pp" ;
"Common.Charge.pp" ;
"Common.Coordinate.pp" ;
"Common.Powers.pp" ;
"Common.Range.pp" ;
"Common.Spin.pp" ;
"Common.Zkey.pp" ;
"Gaussian.Atomic_shell.pp" ;
"Gaussian.Atomic_shell_pair.pp" ;
"Gaussian.Atomic_shell_pair_couple.pp" ;
"Gaussian.Basis.pp" ;
"Gaussian.Contracted_shell.pp" ;
"Gaussian.General_basis.pp" ;
"Linear_algebra.Matrix.pp" ;
"Mo.Basis.pp" ;
"Mo.Class.pp" ;
"Mo.Fock.pp" ;
"Mo.Frozen_core.pp" ;
"Mo.Hartree_fock.pp" ;
"Mo.Localization.pp" ;
"Particles.Electrons.pp" ;
"Particles.Element.pp" ;
"Particles.Nuclei.pp" ;
"Particles.Zmatrix.pp" ;
"Perturbation.Mp2.pp" ;
"Simulation.pp" ;
]
@ -48,4 +18,4 @@ let rec install_printers = function
let () =
if not (install_printers printers) then
Format.eprintf "Problem installing QCaml-printers@."
(* Intall printers:3 ends here *)