This commit is contained in:
Erik Frojdh
2020-09-11 15:09:44 +02:00
parent 3b071cc43f
commit 8ae0659478
7 changed files with 113 additions and 4 deletions

View File

@ -38,6 +38,7 @@ set(SPHINX_SOURCE_FILES
src/pydetector.rst
src/pyenums.rst
src/pyexamples.rst
src/servers.rst
src/receiver.rst
src/result.rst
src/type_traits.rst
@ -57,6 +58,11 @@ configure_file(
"${SPHINX_BUILD}/conf.py"
@ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/gen_server_doc.py.in"
"${SPHINX_BUILD}/gen_server_doc.py"
@ONLY)
add_custom_target(docs
gendoc
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
@ -74,3 +80,6 @@ add_custom_target(rst
${SPHINX_BUILD}/src
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")
add_custom_target(hej
python gen_server_doc.py)

43
docs/gen_server_doc.py.in Normal file
View File

@ -0,0 +1,43 @@
import os
import re
from pathlib import Path
# @CMAKE_CURRENT_BINARY_DIR@
src = Path('@CMAKE_SOURCE_DIR@')/'slsDetectorServers/'
detectors = ['Mythen3', 'Gotthard2', 'Eiger', 'Jungfrau', 'Moench', 'Gotthard']
for det in detectors:
with open(src/f'{det.lower()}DetectorServer/slsDetectorServer_defs.h') as f:
lines = f.read().replace('\\\n', '')
lines = lines.splitlines(keepends = True)
lines = [l.strip('#define').strip(' ') for l in lines if l.startswith('#define')]
output = []
signals = []
fields = ['Name,', 'Value', 'Comment']
excluded = ['DAC_NAMES', 'DEFAULT_DAC_VALS', 'CLK_NAMES', 'ONCHIP_DAC_NAMES']
header = f'{fields[0]:35}{fields[1]:35}\n'
output.append(header)
signals.append(header)
for line in lines:
name, *parts = line.split()
arg = ' '.join(parts)
value, *comments = arg.split('//')
value = value.strip('() ')
# value = value.replace(', ', ' ')
value = value.replace('\"', '')
if name not in excluded:
name += ','
if name.startswith('SIGNAL_'):
signals.append(f'{name:35}{value}\n')
else:
output.append(f'{name:35}\"{value}\"\n')
rstpath = Path('@CMAKE_SOURCE_DIR@')/'docs/src/'
with open(f'src/{det.lower()}.csv', 'w') as f:
f.writelines(output)

View File

@ -50,6 +50,11 @@ Welcome to slsDetectorPackage's documentation!
type_traits
ToString
.. toctree::
:caption: Servers
servers
.. Indices and tables
.. ==================

52
docs/src/servers.rst Normal file
View File

@ -0,0 +1,52 @@
Detector Servers
==============================================
Some general intro
Mythen3
-------------
.. csv-table:: Default values
:file: mythen3.csv
:widths: 35, 35
:header-rows: 1
Gotthard2
-------------
.. csv-table:: Default values
:file: gotthard2.csv
:widths: 35, 35
:header-rows: 1
Moench
-------------
.. csv-table:: Default values
:file: moech.csv
:widths: 35, 35
:header-rows: 1
Eiger
-------------
.. csv-table:: Default values
:file: eiger.csv
:widths: 35, 35
:header-rows: 1
Jungfrau
-------------
.. csv-table:: Default values
:file: jungfrau.csv
:widths: 35, 35
:header-rows: 1
Gotthard
-------------
.. csv-table:: Default values
:file: gotthard.csv
:widths: 35, 35
:header-rows: 1