Skip to content

Commit

Permalink
Refactoring. Renamed dmgraph to dmplot.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Mar 1, 2024
1 parent 7a18ee2 commit 6e27e98
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 152 deletions.
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ DMDBCTL = $(DISTDIR)/dmdbctl
DMEXPORT = $(DISTDIR)/dmexport
DMFEED = $(DISTDIR)/dmfeed
DMFS = $(DISTDIR)/dmfs
DMGRAPH = $(DISTDIR)/dmgraph
DMIMPORT = $(DISTDIR)/dmimport
DMINFO = $(DISTDIR)/dminfo
DMINIT = $(DISTDIR)/dminit
DMLOG = $(DISTDIR)/dmlog
DMLOGGER = $(DISTDIR)/dmlogger
DMLUA = $(DISTDIR)/dmlua
DMPIPE = $(DISTDIR)/dmpipe
DMPLOT = $(DISTDIR)/dmplot
DMRECV = $(DISTDIR)/dmrecv
DMREPORT = $(DISTDIR)/dmreport
DMSEND = $(DISTDIR)/dmsend
Expand Down Expand Up @@ -260,8 +260,8 @@ all: $(TARGET) $(SHARED) test app

# Apps target.
app: $(DMAPI) $(DMBACKUP) $(DMBEAT) $(DMDB) $(DMDBCTL) $(DMEXPORT) $(DMFEED) \
$(DMFS) $(DMGRAPH) $(DMINFO) $(DMIMPORT) $(DMINIT) $(DMLOG) $(DMLOGGER) \
$(DMLUA) $(DMPIPE) $(DMRECV) $(DMREPORT) $(DMSEND) $(DMSERIAL) $(DMSYNC) \
$(DMFS) $(DMINFO) $(DMIMPORT) $(DMINIT) $(DMLOG) $(DMLOGGER) $(DMLUA) \
$(DMPIPE) $(DMPLOT) $(DMRECV) $(DMREPORT) $(DMSEND) $(DMSERIAL) $(DMSYNC) \
$(DMUUID) $(DMWEB)

# Tests target.
Expand Down Expand Up @@ -594,9 +594,6 @@ $(DMFEED): app/dmfeed.f90 $(TARGET)
$(DMFS): app/dmfs.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMFS) app/dmfs.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBPCRE2) $(LIBRT)

$(DMGRAPH): app/dmgraph.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMGRAPH) app/dmgraph.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBSQLITE3)

$(DMIMPORT): app/dmimport.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMIMPORT) app/dmimport.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)

Expand All @@ -618,6 +615,9 @@ $(DMLUA): app/dmlua.f90 $(TARGET)
$(DMPIPE): app/dmpipe.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMPIPE) app/dmpipe.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBPCRE2) $(LIBRT)

$(DMPLOT): app/dmplot.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMPLOT) app/dmplot.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBSQLITE3)

$(DMRECV): app/dmrecv.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMRECV) app/dmrecv.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBRT)

Expand Down Expand Up @@ -687,7 +687,7 @@ install:
install -m 755 $(DMEXPORT) $(IBINDIR)/
install -m 755 $(DMFEED) $(IBINDIR)/
install -m 755 $(DMFS) $(IBINDIR)/
install -m 755 $(DMGRAPH) $(IBINDIR)/
install -m 755 $(DMPLOT) $(IBINDIR)/
install -m 755 $(DMIMPORT) $(IBINDIR)/
install -m 755 $(DMINFO) $(IBINDIR)/
install -m 755 $(DMINIT) $(IBINDIR)/
Expand Down Expand Up @@ -722,7 +722,7 @@ install:
$(GZIP) -9 < $(MANDIR)/dmexport.1 > $(IMANDIR)/dmexport.1.gz
$(GZIP) -9 < $(MANDIR)/dmfeed.1 > $(IMANDIR)/dmfeed.1.gz
$(GZIP) -9 < $(MANDIR)/dmfs.1 > $(IMANDIR)/dmfs.1.gz
$(GZIP) -9 < $(MANDIR)/dmgraph.1 > $(IMANDIR)/dmgraph.1.gz
$(GZIP) -9 < $(MANDIR)/dmplot.1 > $(IMANDIR)/dmplot.1.gz
$(GZIP) -9 < $(MANDIR)/dmimport.1 > $(IMANDIR)/dmimport.1.gz
$(GZIP) -9 < $(MANDIR)/dminfo.1 > $(IMANDIR)/dminfo.1.gz
$(GZIP) -9 < $(MANDIR)/dminit.1 > $(IMANDIR)/dminit.1.gz
Expand Down Expand Up @@ -759,7 +759,7 @@ deinstall:
$(RM) -f $(IBINDIR)/dmexport
$(RM) -f $(IBINDIR)/dmfeed
$(RM) -f $(IBINDIR)/dmfs
$(RM) -f $(IBINDIR)/dmgraph
$(RM) -f $(IBINDIR)/dmplot
$(RM) -f $(IBINDIR)/dmimport
$(RM) -f $(IBINDIR)/dminfo
$(RM) -f $(IBINDIR)/dminit
Expand All @@ -782,14 +782,14 @@ deinstall:
$(RM) -f $(IMANDIR)/dmexport.1.gz
$(RM) -f $(IMANDIR)/dmfeed.1.gz
$(RM) -f $(IMANDIR)/dmfs.1.gz
$(RM) -f $(IMANDIR)/dmgraph.1.gz
$(RM) -f $(IMANDIR)/dmimport.1.gz
$(RM) -f $(IMANDIR)/dminfo.1.gz
$(RM) -f $(IMANDIR)/dminit.1.gz
$(RM) -f $(IMANDIR)/dmlog.1.gz
$(RM) -f $(IMANDIR)/dmlogger.1.gz
$(RM) -f $(IMANDIR)/dmlua.1.gz
$(RM) -f $(IMANDIR)/dmpipe.1.gz
$(RM) -f $(IMANDIR)/dmplot.1.gz
$(RM) -f $(IMANDIR)/dmrecv.1.gz
$(RM) -f $(IMANDIR)/dmreport.1.gz
$(RM) -f $(IMANDIR)/dmsend.1.gz
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ The following programs are based on the DMPACK library.
| [dmexport](adoc/dmexport.adoc) | Exports database records to file. |
| [dmfeed](adoc/dmfeed.adoc) | Creates Atom feeds in XML format from log messages. |
| [dmfs](adoc/dmfs.adoc) | Reads sensor values from file system (file, named pipe, OWFS). |
| [dmgraph](adoc/dmgraph.adoc) | Generates plots from observations in database. |
| [dmimport](adoc/dmimport.adoc) | Imports CSV file into database. |
| [dminfo](adoc/dminfo.adoc) | Prints system and database information as key-value pairs. |
| [dminit](adoc/dminit.adoc) | Creates and initialises DMPACK databases. |
| [dmlog](adoc/dmlog.adoc) | Sends log messages to logger via message queue. |
| [dmlogger](adoc/dmlogger.adoc) | Stores log messages received from message queue in database. |
| [dmlua](adoc/dmlua.adoc) | Runs Lua script to handle observations received from message queue. |
| [dmpipe](adoc/dmpipe.adoc) | Reads sensor values from sub-process. |
| [dmplot](adoc/dmplot.adoc) | Generates plots from observations in database. |
| [dmrecv](adoc/dmrecv.adoc) | Receives logs and observations from message queue. |
| [dmreport](adoc/dmreport.adoc) | Creates HTML reports of plots and/or log messages. |
| [dmsend](adoc/dmsend.adoc) | Sends observations and logs to message queue. |
Expand Down
6 changes: 3 additions & 3 deletions adoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ man:
$(ADOC) -b manpage -D $(MANDIR) $(ADOCDIR)/dmexport.adoc
$(ADOC) -b manpage -D $(MANDIR) $(ADOCDIR)/dmfeed.adoc
$(ADOC) -b manpage -D $(MANDIR) $(ADOCDIR)/dmfs.adoc
$(ADOC) -b manpage -D $(MANDIR) $(ADOCDIR)/dmgraph.adoc
$(ADOC) -b manpage -D $(MANDIR) $(ADOCDIR)/dmplot.adoc
$(ADOC) -b manpage -D $(MANDIR) $(ADOCDIR)/dmimport.adoc
$(ADOC) -b manpage -D $(MANDIR) $(ADOCDIR)/dminfo.adoc
$(ADOC) -b manpage -D $(MANDIR) $(ADOCDIR)/dminit.adoc
Expand All @@ -51,7 +51,7 @@ pdf: man
$(MAN) -t $(MANDIR)/dmexport.1 | $(PS2PDF) - $(PDFDIR)/dmexport.pdf
$(MAN) -t $(MANDIR)/dmfeed.1 | $(PS2PDF) - $(PDFDIR)/dmfeed.pdf
$(MAN) -t $(MANDIR)/dmfs.1 | $(PS2PDF) - $(PDFDIR)/dmfs.pdf
$(MAN) -t $(MANDIR)/dmgraph.1 | $(PS2PDF) - $(PDFDIR)/dmgraph.pdf
$(MAN) -t $(MANDIR)/dmplot.1 | $(PS2PDF) - $(PDFDIR)/dmplot.pdf
$(MAN) -t $(MANDIR)/dmimport.1 | $(PS2PDF) - $(PDFDIR)/dmimport.pdf
$(MAN) -t $(MANDIR)/dminfo.1 | $(PS2PDF) - $(PDFDIR)/dminfo.pdf
$(MAN) -t $(MANDIR)/dminit.1 | $(PS2PDF) - $(PDFDIR)/dminit.pdf
Expand All @@ -77,14 +77,14 @@ html: man
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmexport.1 > $(HTMLDIR)/dmexport.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmfeed.1 > $(HTMLDIR)/dmfeed.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmfs.1 > $(HTMLDIR)/dmfs.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmgraph.1 > $(HTMLDIR)/dmgraph.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmimport.1 > $(HTMLDIR)/dmimport.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dminfo.1 > $(HTMLDIR)/dminfo.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dminit.1 > $(HTMLDIR)/dminit.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmlog.1 > $(HTMLDIR)/dmlog.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmlogger.1 > $(HTMLDIR)/dmlogger.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmlua.1 > $(HTMLDIR)/dmlua.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmpipe.1 > $(HTMLDIR)/dmpipe.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmplot.1 > $(HTMLDIR)/dmplot.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmrecv.1 > $(HTMLDIR)/dmrecv.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmreport.1 > $(HTMLDIR)/dmreport.html
$(MANDOC) -Ostyle=mandoc.css -Thtml $(MANDIR)/dmsend.1 > $(HTMLDIR)/dmsend.html
Expand Down
22 changes: 11 additions & 11 deletions adoc/dmgraph.adoc → adoc/dmplot.adoc
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
= dmgraph(1)
= dmplot(1)
Philipp Engel
v1.0.0
:doctype: manpage
:manmanual: User Commands
:mansource: DMGRAPH
:mansource: DMPLOT

== NAME

dmgraph - creates plots from observations in database
dmplot - creates plots from observations in database

== SYNOPSIS

*dmgraph* --help
*dmplot* --help

*dmgraph* --version
*dmplot* --version

*dmgraph* --*database* _file_ --*node* _id_ --*sensor* _id_ --*target* _id_
*dmplot* --*database* _file_ --*node* _id_ --*sensor* _id_ --*target* _id_
--*response* _name_ --*from* _timestamp_ --*to* _timestamp_
--*terminal* _terminal_ [--*output* _file_] [--*background* _color_]
[--*foreground* _color_] [--*font* _name_] [--*title* _title_] [--*width* _n_]
[--*height* _n_]

*dmgraph* --*config* _file_ [--*name* _name_]
*dmplot* --*config* _file_ [--*name* _name_]

== DESCRIPTION

The *dmgraph* program is a front-end to _gnuplot(1)_ that creates plots of
The *dmplot* program is a front-end to _gnuplot(1)_ that creates plots of
observations read from database. Plots are either written to file or displayed
in terminal or X11 window.

Expand Down Expand Up @@ -66,7 +66,7 @@ configuration file.
Output available command-line arguments and quit.

*--name*, *-n* _name_::
Name of program instance and configuration (default is `dmgraph`).
Name of program instance and configuration (default is `dmplot`).

*--node*, *-N* _id_::
Node id.
Expand Down Expand Up @@ -117,15 +117,15 @@ Create a plot of observations selected from database `observ.sqlite` in PNG
terminal, and write the file to `/tmp/plot.png`:

....
$ dmgraph --node dummy-node --sensor dummy-sensor --target dummy-target \
$ dmplot --node dummy-node --sensor dummy-sensor --target dummy-target \
--response dummy --from 2020 --to 2021 --database observ.sqlite \
--terminal pngcairo --output /tmp/plot.png
....

Output the plot directly to terminal, with the configuration loaded from file:

....
$ dmgraph --name dmgraph --config dmgraph.conf --terminal sixelgd
$ dmplot --name dmplot --config dmplot.conf --terminal sixelgd
....

Output in `sixelgd` format requires a terminal emulator with Sixel support.
Expand Down
8 changes: 4 additions & 4 deletions app/dmgraph.f90 → app/dmplot.f90
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
! dmgraph.f90
! dmplot.f90
!
! Author: Philipp Engel
! Licence: ISC
program dmgraph
program dmplot
!! Creates plots from time series.
use :: dmpack
implicit none (type, external)

character(len=*), parameter :: APP_NAME = 'dmgraph'
character(len=*), parameter :: APP_NAME = 'dmplot'
integer, parameter :: APP_MAJOR = 0
integer, parameter :: APP_MINOR = 9
integer, parameter :: APP_PATCH = 0
Expand Down Expand Up @@ -313,4 +313,4 @@ integer function read_data_points(dps, database, node, sensor, target, response,

rc = max(dm_db_close(db), rc)
end function read_data_points
end program dmgraph
end program dmplot
6 changes: 3 additions & 3 deletions config/dmgraph.conf.sample → config/dmplot.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--
-- Example configuration file for dmgraph.
-- Example configuration file for dmplot.
--
-- Rename table "dmgraph" to the instance name (parameter `--name`).
-- Rename table "dmplot" to the instance name (parameter `--name`).
--
-- Settings:
--
Expand All @@ -22,7 +22,7 @@
-- width - Plot width.
--

dmgraph = {
dmplot = {
node = "dummy-node",
sensor = "dummy-sensor",
target = "dummy-target",
Expand Down
10 changes: 5 additions & 5 deletions fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ name = "dmfs"
main = "dmfs.f90"
link = [ "lua-5.4", "pcre2-8", "rt" ]

[[executable]]
name = "dmgraph"
main = "dmgraph.f90"
link = [ "lua-5.4", "sqlite3" ]

[[executable]]
name = "dmimport"
main = "dmimport.f90"
Expand Down Expand Up @@ -107,6 +102,11 @@ name = "dmpipe"
main = "dmpipe.f90"
link = [ "lua-5.4", "pcre2-8", "rt" ]

[[executable]]
name = "dmplot"
main = "dmplot.f90"
link = [ "lua-5.4", "sqlite3" ]

[[executable]]
name = "dmrecv"
main = "dmrecv.f90"
Expand Down
Loading

0 comments on commit 6e27e98

Please sign in to comment.