10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-18 20:12:26 +01:00
QCaml/common/README.org

92 lines
1.6 KiB
Org Mode
Raw Normal View History

2020-12-26 01:47:55 +01:00
#+TITLE: Common
2021-01-01 17:05:25 +01:00
#+SETUPFILE: ../docs/org-html-themes/org/theme-readtheorg.setup
2020-12-26 01:47:55 +01:00
2020-12-28 12:03:13 +01:00
#+name: synopsis
#+begin_src ocaml :export output raw
"Utility functions used by all the other directories."
#+end_src
#+RESULTS: synopsis
: Utility functions used by all the other directories.
2020-12-26 01:47:55 +01:00
2020-12-27 16:36:25 +01:00
* Dune files :noexport:
2020-12-26 01:47:55 +01:00
2020-12-28 12:03:13 +01:00
** 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"""
2020-12-26 01:47:55 +01:00
(library
2020-12-28 12:03:13 +01:00
(name {name})
(public_name qcaml.{name})
(synopsis {synopsis} )
<<dependencies>>
<<noimplementation>>
<<c-files>>
)
<<lex-yacc>>
""")
2020-12-26 01:47:55 +01:00
2020-12-28 12:03:13 +01:00
with open(dunetest,'w') as f:
f.write(f"""
(library
(name test_{name})
(synopsis "Test for {name} library")
2020-12-26 01:47:55 +01:00
(libraries
2020-12-28 12:03:13 +01:00
alcotest
qcaml.{name}
2020-12-26 01:47:55 +01:00
)
2020-12-28 12:03:13 +01:00
)
""")
#+end_src
2020-12-26 01:47:55 +01:00
2020-12-28 12:03:13 +01:00
** Dependencies
#+name: dependencies
#+begin_src elisp
(libraries
str
zarith
getopt
2020-12-26 01:47:55 +01:00
)
2020-12-28 12:03:13 +01:00
#+end_src
** Modules without implementation
#+name: noimplementation
#+begin_src elisp
#+end_src
2020-12-27 16:36:25 +01:00
2020-12-28 12:03:13 +01:00
** Extra C files
2020-12-26 01:47:55 +01:00
2020-12-28 12:03:13 +01:00
The ~util.c~ file contains small C snippets to add missing
functionalities to OCaml, such as support for the ~popcnt~ instruction.
2020-12-26 01:47:55 +01:00
2020-12-28 12:03:13 +01:00
#+name: c-files
#+begin_src elisp
2020-12-26 01:47:55 +01:00
(c_names
2020-12-28 01:08:55 +01:00
util
2020-12-26 01:47:55 +01:00
)
(c_flags (:standard)
-Ofast -march=native -fPIC
)
#+end_src
2020-12-28 12:03:13 +01:00
** Parser
2020-12-26 01:47:55 +01:00
2020-12-28 12:03:13 +01:00
#+name: lex-yacc
#+begin_src elisp
#+end_src