mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
docs
This commit is contained in:
43
docs/gen_server_doc.py.in
Normal file
43
docs/gen_server_doc.py.in
Normal 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)
|
||||
|
Reference in New Issue
Block a user