Doxygen work. How the heck can one enforce a consistent device

documentation? (nw)
master
couriersud 2017-02-03 01:00:14 +01:00
parent f61e1f2123
commit 6a770d7086
6 changed files with 122 additions and 232 deletions

View File

@ -16,6 +16,14 @@ NETLIST_START(ne555_astable)
*
*/
/*!
*
* abc | def
* ghj | ddd
* iop | xyz
*
*
*/
/* Standard stuff */
SOLVER(Solver, 48000)

View File

@ -771,7 +771,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = .. ../analog ../documentation ../devices
INPUT = .. ../analog ../documentation ../devices
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -844,7 +844,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).
EXAMPLE_PATH = ../../../../nl_examples
EXAMPLE_PATH = ../../../../nl_examples ../documentation
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and

View File

@ -9,9 +9,14 @@
#
###########################################################################
OBJ = obj
SRC = ..
ifeq ($(subst Windows_NT,windows,$(OS)),windows)
OBJ = obj/mingw
else
OBJ = obj/nix
endif
#-fuse-ld=gold -Wpedantic -march=native -march=native
# LTO = -flto=4 -fuse-linker-plugin -flto-partition=balanced -Wodr
@ -187,7 +192,8 @@ mingw:
#
doc:
doc: nltool
./nltool -c docheader > ../documentation/devsyn.dox.h
$(DOXYGEN) doxygen.conf
#-------------------------------------------------
@ -195,15 +201,11 @@ doc:
#-------------------------------------------------
.depend: $(SOURCES)
ifeq ($(OS),windows)
@echo using existing .depend
else
@echo creating .depend
@rm -f ./.depend
@for i in $(SOURCES); do \
$(CC) $(CFLAGS) -MM $$i -MT `echo $$i | sed -e 's/$(SRC)/$(OBJ)/' -e 's/.cpp/.o/' ` >>./.depend; \
$(CC) $(CFLAGS) -MM $$i -MT `echo $$i | sed -e 's+$(SRC)+$(OBJ)+' -e 's+.cpp+.o+' ` >>./.depend; \
done
endif
depend: .depend
@ -232,3 +234,4 @@ $(OBJ)/%.a:
@echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $^

View File

@ -9,10 +9,13 @@
*
* \section ne555_1 Synopsis
*
* \code
* NE555(name)
* NE555_DIP(name)
* \endcode
* \snippet devsyn.dox.h NE555 synopsis
* \snippet devsyn.dox.h NE555_DIP synopsis
* \section ne555_11 "C" Synopsis
*
* \snippet devsyn.dox.h NE555 csynopsis
* \snippet devsyn.dox.h NE555_DIP csynopsis
*
* For the \c NE555 use verbose pin assignments like \c name.TRIG or \c name.OUT.
* For the \c NE555_DIP use pin numbers like \c name.1.
@ -32,12 +35,7 @@
*
* \section ne555_3 Function Table
*
* | CLR | CLK | D | Q | QQ |
* |-----|-----|---|:-:|:---:|
* | 0 | X | X | 0 | 1 |
* | 1 | R | 1 | 1 | 0 |
* | 1 | R | 0 | 0 | 1 |
* | 1 | 0 | X | Q0| Q0Q |
* Please refer to the datasheet.
*
* \section ne555_4 Limitations
*

View File

@ -3,202 +3,6 @@
*/
/*!
* \defgroup devices Devices
*
*/
/*!
* \page devices Devices
*
* Below is a list of all the devices currently supported ...
*
* - \subpage AFUNC
* - \subpage ANALOG_INPUT
* - \subpage CAP
* - \subpage CCCS
* - \subpage CD4001_DIP
* - \subpage CD4001_NOR
* - \subpage CD4016_DIP
* - \subpage CD4020_DIP
* - \subpage CD4020
* - \subpage CD4020_WI
* - \subpage CD4066_DIP
* - \subpage CD4066_GATE
* - \subpage CD4316_DIP
* - \subpage CD4316_GATE
* - \subpage CD4538_DIP
* - \subpage CLOCK
* - \subpage CS
* - \subpage DIODE
* - \subpage DUMMY_INPUT
* - \subpage EPROM_2716_DIP
* - \subpage EPROM_2716
* - \subpage EXTCLOCK
* - \subpage FRONTIER_DEV
* - \subpage GND
* - \subpage IND
* - \subpage LM324_DIP
* - \subpage LM358_DIP
* - \subpage LM3900
* - \subpage LM747A_DIP
* - \subpage LM747_DIP
* - \subpage LOGD
* - \subpage LOGIC_INPUT
* - \subpage LOG
* - \subpage LVCCS
* - \subpage MAINCLOCK
* - \subpage MB3614_DIP
* - \subpage MC14584B_DIP
* - \subpage MC14584B_GATE
* - \subpage MM5837_DIP
* - \subpage NE555_DIP
* - \subpage NE555
* - \subpage NETDEV_DELAY
* - \subpage NETDEV_RSFF
* - \subpage OPAMP
* - \subpage opamp_layout_1_11_6
* - \subpage opamp_layout_1_7_4
* - \subpage opamp_layout_1_8_5
* - \subpage opamp_layout_2_13_9_4
* - \subpage opamp_layout_2_8_4
* - \subpage opamp_layout_4_4_11
* - \subpage PARAMETER
* - \subpage POT2
* - \subpage POT
* - \subpage PROM_82S115_DIP
* - \subpage PROM_82S115
* - \subpage PROM_82S123_DIP
* - \subpage PROM_82S123
* - \subpage PROM_82S126_DIP
* - \subpage PROM_82S126
* - \subpage QBJT_EB
* - \subpage QBJT_SW
* - \subpage R2R_DAC
* - \subpage RAM_2102A_DIP
* - \subpage RAM_2102A
* - \subpage RES
* - \subpage RES_SWITCH
* - \subpage SN74LS629_DIP
* - \subpage SN74LS629
* - \subpage SOLVER
* - \subpage SWITCH2
* - \subpage SWITCH
* - \subpage TTL_7400_DIP
* - \subpage TTL_7400_GATE
* - \subpage TTL_7400_NAND
* - \subpage TTL_7402_DIP
* - \subpage TTL_7402_GATE
* - \subpage TTL_7402_NOR
* - \subpage TTL_7404_DIP
* - \subpage TTL_7404_GATE
* - \subpage TTL_7404_INVERT
* - \subpage TTL_7408_AND
* - \subpage TTL_7408_DIP
* - \subpage TTL_7408_GATE
* - \subpage TTL_74107A
* - \subpage TTL_74107_DIP
* - \subpage TTL_74107
* - \subpage TTL_7410_DIP
* - \subpage TTL_7410_GATE
* - \subpage TTL_7410_NAND
* - \subpage TTL_7411_AND
* - \subpage TTL_7411_DIP
* - \subpage TTL_7411_GATE
* - \subpage TTL_74123_DIP
* - \subpage TTL_74123
* - \subpage TTL_74153_DIP
* - \subpage TTL_74153
* - \subpage TTL_74161_DIP
* - \subpage TTL_74161
* - \subpage TTL_74165_DIP
* - \subpage TTL_74165
* - \subpage TTL_74166_DIP
* - \subpage TTL_74166
* - \subpage TTL_7416_DIP
* - \subpage TTL_7416_GATE
* - \subpage TTL_74174_DIP
* - \subpage TTL_74174
* - \subpage TTL_74175_DIP
* - \subpage TTL_74175
* - \subpage TTL_74192_DIP
* - \subpage TTL_74192
* - \subpage TTL_74193_DIP
* - \subpage TTL_74193
* - \subpage TTL_74194_DIP
* - \subpage TTL_74194
* - \subpage TTL_7420_DIP
* - \subpage TTL_7420_GATE
* - \subpage TTL_7420_NAND
* - \subpage TTL_7425_DIP
* - \subpage TTL_7425_GATE
* - \subpage TTL_7425_NOR
* - \subpage TTL_74260_DIP
* - \subpage TTL_74260_GATE
* - \subpage TTL_74260_NOR
* - \subpage TTL_74279_DIP
* - \subpage TTL_7427_DIP
* - \subpage TTL_7427_GATE
* - \subpage TTL_7427_NOR
* - \subpage TTL_7430_DIP
* - \subpage TTL_7430_GATE
* - \subpage TTL_7430_NAND
* - \subpage TTL_7432_DIP
* - \subpage TTL_7432_GATE
* - \subpage TTL_7432_OR
* - \subpage TTL_74365_DIP
* - \subpage TTL_74365
* - \subpage TTL_7437_DIP
* - \subpage TTL_7437_GATE
* - \subpage TTL_7437_NAND
* - \subpage TTL_7448_DIP
* - \subpage TTL_7448
* - \subpage TTL_7450_ANDORINVERT
* - \subpage TTL_7450_DIP
* - \subpage TTL_7473A_DIP
* - \subpage TTL_7473A
* - \subpage TTL_7473_DIP
* - \subpage TTL_7473
* - \subpage TTL_7474_DIP
* - \subpage TTL_7474
* - \subpage TTL_7475_DIP
* - \subpage TTL_7475
* - \subpage TTL_7477_DIP
* - \subpage TTL_7477
* - \subpage TTL_7483_DIP
* - \subpage TTL_7483
* - \subpage TTL_7485_DIP
* - \subpage TTL_7485
* - \subpage TTL_7486_DIP
* - \subpage TTL_7486_GATE
* - \subpage TTL_7486_XOR
* - \subpage TTL_7490_DIP
* - \subpage TTL_7490
* - \subpage TTL_7493_DIP
* - \subpage TTL_7493
* - \subpage TTL_82S16_DIP
* - \subpage TTL_82S16
* - \subpage TTL_9310_DIP
* - \subpage TTL_9310
* - \subpage TTL_9312_DIP
* - \subpage TTL_9312
* - \subpage TTL_9316_DIP
* - \subpage TTL_9316
* - \subpage TTL_9322_DIP
* - \subpage TTL_9322
* - \subpage TTL_9334_DIP
* - \subpage TTL_9334
* - \subpage TTL_9602_DIP
* - \subpage TTL_AM2847_DIP
* - \subpage TTL_AM2847
* - \subpage TTL_INPUT
* - \subpage TTL_TRISTATE3
* - \subpage TTL_TRISTATE
* - \subpage UA741_DIP10
* - \subpage UA741_DIP14
* - \subpage UA741_DIP8
* - \subpage VCCS
* - \subpage VCVS
* - \subpage VS
*
* \mainpage Netlist

View File

@ -21,7 +21,7 @@ public:
tool_options_t() :
plib::options(),
opt_grp1(*this, "General options", "The following options apply to all commands."),
opt_cmd (*this, "c", "cmd", "run", "run:convert:listdevices:static:header", "run|convert|listdevices|static|header"),
opt_cmd (*this, "c", "cmd", "run", "run:convert:listdevices:static:header:docheader", "run|convert|listdevices|static|header"),
opt_file(*this, "f", "file", "-", "file to process (default is stdin)"),
opt_defines(*this, "D", "define", "predefine value as macro, e.g. -Dname=value. If '=value' is omitted predefine it as 1. This option may be specified repeatedly."),
opt_rfolders(*this, "r", "rom", "where to look for files"),
@ -339,6 +339,50 @@ static void mac_out(const pstring s, const bool cont = true)
pout("{1}\n", s);
}
static void cmac(const netlist::factory::element_t *e)
{
auto v = plib::psplit(e->param_desc(), ",");
pstring vs;
for (auto s : v)
vs += ", p" + s.replace("+","").replace(".","_");
mac_out("#define " + e->name() + "(name" + vs + ")");
mac_out("\tNET_REGISTER_DEV(" + e->name() +", name)");
for (auto s : v)
{
pstring r(s.replace("+","").replace(".","_"));
if (s.startsWith("+"))
mac_out("\tNET_CONNECT(name, " + r + ", p" + r + ")");
else
mac_out("\tNETDEV_PARAMI(name, " + r + ", p" + r + ")");
}
mac_out("", false);
}
static void mac(const netlist::factory::element_t *e)
{
auto v = plib::psplit(e->param_desc(), ",");
pstring vs;
for (auto s : v)
{
vs += ", " + s.replace("+","").replace(".","_");
}
pout("{1}(name{2})\n", e->name(), vs);
if (v.size() > 0)
{
pout("/*\n");
for (auto s : v)
{
pstring r(s.replace("+","").replace(".","_"));
if (s.startsWith("+"))
pout("{1:10}: Terminal\n",r);
else
pout("{1:10}: Parameter\n", r);
}
pout("*/\n");
}
}
static void create_header(tool_options_t &opts)
{
netlist_tool_t nt("netlist");
@ -376,22 +420,7 @@ static void create_header(tool_options_t &opts)
pout("{1}\n", pstring("// Source: ").cat(e->sourcefile().replace("../","")));
pout("{1}\n", pstring("// ").rpad("-", 72));
}
auto v = plib::psplit(e->param_desc(), ",");
pstring vs;
for (auto s : v)
vs += ", p" + s.replace("+","").replace(".","_");
mac_out("#define " + e->name() + "(name" + vs + ")");
mac_out("\tNET_REGISTER_DEV(" + e->name() +", name)"); \
for (auto s : v)
{
pstring r(s.replace("+","").replace(".","_"));
if (s.startsWith("+"))
mac_out("\tNET_CONNECT(name, " + r + ", p" + r + ")");
else
mac_out("\tNETDEV_PARAMI(name, " + r + ", p" + r + ")");
}
mac_out("", false);
cmac(e.get());
}
pout("#endif // __PLIB_PREPROCESSOR__\n");
pout("#endif\n");
@ -399,6 +428,52 @@ static void create_header(tool_options_t &opts)
}
static void create_docheader(tool_options_t &opts)
{
netlist_tool_t nt("netlist");
nt.init();
nt.log().verbose.set_enabled(false);
nt.log().warning.set_enabled(false);
nt.setup().register_source(plib::make_unique_base<netlist::source_t,
netlist::source_proc_t>(nt.setup(), "dummy", &netlist_dummy));
nt.setup().include("dummy");
std::vector<pstring> devs;
for (auto &e : nt.setup().factory())
devs.push_back(e->name());
std::sort(devs.begin(), devs.end(), [&](pstring &a, pstring &b) { return a < b; });
pout("// license:GPL-2.0+\n");
pout("// copyright-holders:Couriersud\n");
pout("/* ----------------------------------------------------------------------------\n");
pout(" * Automatically created file. DO NOT MODIFY.\n");
pout(" * ---------------------------------------------------------------------------*/\n");
pout("/*!\n");
pout(" * \\page devices Devices\n");
pout(" *\n");
pout(" * Below is a list of all the devices currently known to the system ...\n");
pout(" *\n");
for (auto &s : devs)
pout(" * - \\subpage {1}\n", s);
pout(" *\n");
for (auto &e : nt.setup().factory())
{
pout("//! [{1} csynopsis]\n", e->name());
cmac(e.get());
pout("//! [{1} csynopsis]\n", e->name());
pout("//! [{1} synopsis]\n", e->name());
mac(e.get());
pout("//! [{1} synopsis]\n", e->name());
}
nt.stop();
}
/*-------------------------------------------------
listdevices - list all known devices
@ -549,6 +624,8 @@ int main(int argc, char *argv[])
static_compile(opts);
else if (cmd == "header")
create_header(opts);
else if (cmd == "docheader")
create_docheader(opts);
else if (cmd == "convert")
{
pstring contents;