Commit 812fbeef authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[TASK] (stuploxx): take description from text files

The usage and help information provided by stuploxx is incoherent with the
actual code. This branch is dedicated to the effort to synchronize the
description with the actual status of the program.
parent 81918dd2
......@@ -63,12 +63,34 @@ LDFLAGS=$(addprefix -L,$(LOCLIBDIR) $(subst :, ,$(SERVERLIBDIR))) $(STATIC)
CPPFLAGS=$(addprefix -I,$(LOCINCLUDEDIR) $(subst :, ,$(SERVERINCLUDEDIR))) \
$(FLAGS)
SRC=$(wildcard *.cc)
DESCRIPTIONTXT= \
description_text.txt \
examples_text.txt \
help_text.txt \
interactive_text.txt \
usage_text.txt
SRC= \
constants.cc \
constantskeys.cc \
constantsoptions.cc \
datafile.cc \
datatrace.cc \
functions.cc \
globalsettings.cc \
label.cc \
panel.cc \
scaling.cc \
screen.cc \
stuploxx.cc \
utilitystructures.cc \
windowpanel.cc \
$(patsubst %.txt,%.cc,$(DESCRIPTIONTXT))
OBJ=$(patsubst %.cc,%.o,$(SRC))
#----------------------------------------------------------------------
# standard edit targets
flist: Makefile $(wildcard *.cc *.h) README doxydoc.cfg COPYING \
flist: Makefile $(filter-out %_text.cc %_text.h,$(wildcard *.cc *.h)) \
$(wildcard *.txt) README doxydoc.cfg COPYING \
$(filter-out %.bak, $(wildcard README.*))
echo $^ | tr ' ' '\n' | sort > $@
echo '----' >> $@
......@@ -93,7 +115,25 @@ clean: ;
> $@; \
[ -s $@ ] || rm -f $@'
-include $(patsubst %.cc,%.d,$(SRC))
include $(patsubst %.txt,%.d,$(DESCRIPTIONTXT))
include $(patsubst %.cc,%.d,$(SRC))
#======================================================================
# description and online texts
# ----------------------------
%.cc %.h: %.txt
echo "// DO NOT EDIT: this file is automatically derived from $<" \
> $(patsubst %.txt,%.h,$<)
echo "extern char $(patsubst %.txt,%,$<)[];" >> $(patsubst %.txt,%.h,$<)
echo "// DO NOT EDIT: this file is automatically derived from $<" \
> $(patsubst %.txt,%.cc,$<)
echo "#include \"$(patsubst %.txt,%.h,$<)\"" >> $(patsubst %.txt,%.cc,$<)
echo "char $(patsubst %.txt,%,$<)[]=" >> $(patsubst %.txt,%.cc,$<)
echo "{" >> $(patsubst %.txt,%.cc,$<)
cat $< | egrep -v '^#' | sed -e 's/"/\\"/g' \
| sed -e 's/$$/\\n"/' | sed -e 's/^/ "/'\
>> $(patsubst %.txt,%.cc,$<)
echo "};" >> $(patsubst %.txt,%.cc,$<)
#======================================================================
......
......@@ -47,15 +47,6 @@ namespace stuplo {
/*----------------------------------------------------------------------*/
// constants
//! define usage information
extern const char* const usage_text;
//! define full help text
extern const char* const help_text;
//! define control keys help text
extern const char* const control_help_text;
//! define commandline options
extern tfxx::cmdline::Declare options[];
......
/*! \file constantshelp.cc
* \brief help text (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 13/02/2008
*
* help text (implementation)
*
* Copyright (c) 2008 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 13/02/2008 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define STUPLO_CONSTANTSHELP_CC_VERSION \
"STUPLO_CONSTANTSHELP_CC V1.0 "
#define STUPLO_CONSTANTSHELP_CC_CVSID \
"$Id$"
#include "constants.h"
namespace stuplo {
// define usage information
const char* const usage_text=
{
"usage: stuploxx [-v] [-D] [-interactive] [-device dev]" "\n"
" [-repeat[=i]] [-repcmd c]" "\n"
" file [t:n] [file [t:n]...]" "\n"
" or: stuploxx --help" "\n"
" or: stuploxx --keys" "\n"
};
// define full help text
const char* const help_text=
{
" " "\n"
"-v be verbose" "\n"
"-D debug mode" "\n"
"-interactive interactive mode" "\n"
"-repeat[=i] repeat plot with new data every i seconds." "\n"
"-repcmd c issue command string c in repeat more prior to each"
" repetition" "\n"
" this command will also be issued before re-reading data" "\n"
" in interactive mode" "\n"
"\n"
"-device dev use PGPLOT device dev" "\n"
"-hdevice dev use PGPLOT device dev for hardcopies" "\n"
"-hcommand c issue command string c after hardcopy" "\n"
"\n"
"-title n set title for plot to \"n\"" "\n"
"-tstitle set text scaling factor for title" "\n"
"\n"
"-lwts l set line width of time scale" "\n"
"-chts h set character height of time scale" "\n"
"-lwtg l set line width of time scale grid lines" "\n"
" no time scale grid is plotted if option is not set" "\n"
"\n"
"-spp p set panel separation as a fraction of total plot height" "\n"
"-lwpb l set line width of panel boxes" "\n"
" no panel boxes are plotted if option is not set" "\n"
"\n"
"-chy h set character height of ordinate scale" "\n"
" no ordinate scale is plotted if option is not set" "\n"
"-lyd d set separation of ordinate unit label from graph box edge" "\n"
"\n"
"-lwyg l set line width for ordinate grid lines" "\n"
" no ordinate grid lines are plotted if option is not set" "\n"
"-lwys l set line width ordinate scale" "\n"
"\n"
"-npanels n plot at least n panels" "\n"
"-labu underline graph label with appropriate line style" "\n"
"-labc print graph label in appropriate colour" "\n"
"-labe erase background of graph label" "\n"
"-labh h set height of graph label as a fraction of panel height" "\n"
"-labr reserve space for graph label; if plot range is set" "\n"
" approrpiately, graph and label will not be overlapping;;" "\n"
" this is useful together with chart stepping in" "\n"
" particular" "\n"
"\n"
"-datesep s use s as separator between day, month, and year" "\n"
" " "\n"
"file SFF waveform data file name" "\n"
"t:n can be used to select traces from file" "\n"
"p:n places file data in panel n" "\n"
"ci:i use color index i" "\n"
"lw:w set line width to w" "\n"
"ls:s set line style to s" "\n"
"n:n set label to n" "\n"
" the label may contain patterns that will be replaced" "\n"
" (see below)" "\n"
"r:r,g,b set color in rgb mode" "\n"
"h:h,l,s set color in hls mode" "\n"
"f:format select file format" "\n"
"s:min,max set fixed limits for ordinate scale" "\n"
"sf:f set limits for ordinate scale range to fraction f of the" "\n"
" dataset's amplitude" "\n"
"cs:v activate chart stepper function and step at fraction v" "\n"
" of full plot range" "\n"
"ch:h set chart stepping hysteresis as a fraction of range" "\n"
"u:units set label for ordinate scale" "\n"
"a:a additional annotation to graph; this will be appended" "\n"
" to the graph label in ordinary line style; duplicate" "\n"
" identical annotations will be discarded" "\n"
"A:a additional annotation to graph; this will be prepended" "\n"
" to the graph label in ordinary line style; duplicate" "\n"
" identical annotations will be discarded" "\n"
"\n"
"Patterns that may be used in data trace labels are:" "\n"
"%F file name" "\n"
"%NF number of file on command line" "\n"
"%NT number of trace in file" "\n"
"%D date of first sample" "\n"
"%T time of first sample" "\n"
"%UT time of first sample including microsecond" "\n"
"%S station identifier" "\n"
"%C channel identifier" "\n"
"%A auxiliary identifier" "\n"
"%I instrument identifier" "\n"
"%% will be replaced by a literal \'%\'" "\n"
"\n"
"Monitor plots are supported in two different modes:" "\n"
"1. Interactive mode allows rereading of data files by pressing 'r'." "\n"
"2. Repeat mode supports automatic update of data." "\n"
};
// define control keys help text
const char* const control_help_text=
{
"Interactive mode control keys are:" "\n"
"<a>+<b> means: first press <a> then press <b>" "\n"
"\n"
"<X> or <x> exit" "\n"
"<Q> or <q> exit" "\n"
"<h> produce hardcopy and issue hcommand if requested" "\n"
"<r> re-read data after issueing repcmd if set" "\n"
"In chart stepper plot mode:" "\n"
"<i> re-initialize scaling" "\n"
"<t>+<i> re-initialize time scale" "\n"
"<t>+<z> zoom time scale" "\n"
};
} // namespace stuplo
/* ----- END OF constantshelp.cc ----- */
# this is <description_text.txt>
# ============================================================================
# program description
# -------------------
#
# ----- END OF description_text.txt -----
# this is <examples_text.txt>
# ============================================================================
# program application examples
# ----------------------------
#
# ----- END OF examples_text.txt -----
# this is <help_text.txt>
# ============================================================================
# parameter and options
# ---------------------
-v be verbose
-D debug mode
-interactive interactive mode
-repeat[=i] repeat plot with new data every i seconds.
-repcmd c issue command string c in repeat more prior to each repetition
this command will also be issued before re-reading data
in interactive mode
-device dev use PGPLOT device dev
-hdevice dev use PGPLOT device dev for hardcopies
-hcommand c issue command string c after hardcopy
-title n set title for plot to 'n'
-tstitle set text scaling factor for title
-lwts l set line width of time scale
-chts h set character height of time scale
-lwtg l set line width of time scale grid lines
no time scale grid is plotted if option is not set
-spp p set panel separation as a fraction of total plot height
-lwpb l set line width of panel boxes
no panel boxes are plotted if option is not set
-chy h set character height of ordinate scale
no ordinate scale is plotted if option is not set
-lyd d set separation of ordinate unit label from graph box edge
-lwyg l set line width for ordinate grid lines
no ordinate grid lines are plotted if option is not set
-lwys l set line width ordinate scale
-npanels n plot at least n panels
-labu underline graph label with appropriate line style
-labc print graph label in appropriate colour
-labe erase background of graph label
-labh h set height of graph label as a fraction of panel height
-labr reserve space for graph label; if plot range is set
approrpiately, graph and label will not be overlapping;;
this is useful together with chart stepping in
particular
-datesep s use s as separator between day, month, and year
file SFF waveform data file name
t:n can be used to select traces from file
p:n places file data in panel n
ci:i use color index i
lw:w set line width to w
ls:s set line style to s
n:n set label to n
the label may contain patterns that will be replaced
(see below)
r:r,g,b set color in rgb mode
h:h,l,s set color in hls mode
f:format select file format
s:min,max set fixed limits for ordinate scale
sf:f set limits for ordinate scale range to fraction f of the
dataset's amplitude
cs:v activate chart stepper function and step at fraction v
of full plot range
ch:h set chart stepping hysteresis as a fraction of range
u:units set label for ordinate scale
a:a additional annotation to graph; this will be appended
to the graph label in ordinary line style; duplicate
identical annotations will be discarded
A:a additional annotation to graph; this will be prepended
to the graph label in ordinary line style; duplicate
identical annotations will be discarded
Patterns that may be used in data trace labels are:
%F file name
%NF number of file on command line
%NT number of trace in file
%D date of first sample
%T time of first sample
%UT time of first sample including microsecond
%S station identifier
%C channel identifier
%A auxiliary identifier
%I instrument identifier
%% will be replaced by a literal '%'
Monitor plots are supported in two different modes:
1. Interactive mode allows rereading of data files by pressing 'r'.
2. Repeat mode supports automatic update of data.
#
# ----- END OF help_text.txt -----
# this is <interactive_text.txt>
# ============================================================================
# description of control keys
# ---------------------------
Interactive mode control keys are:
<a>+<b> means: first press <a> then press <b>
<X> or <x> exit
<Q> or <q> exit
<h> produce hardcopy and issue hcommand if requested
<r> re-read data after issueing repcmd if set
In chart stepper plot mode:
<i> re-initialize scaling
<t>+<i> re-initialize time scale
<t>+<z> zoom time scale
#
# ----- END OF interactive_text.txt -----
......@@ -30,13 +30,14 @@
* REVISIONS and CHANGES
* - 30/01/2007 V1.0 Thomas Forbriger
* - 23/10/2009 V1.1 introduced prepend annotations
* - 05/03/2015 V1.2 take description texts from text files
*
* ============================================================================
*/
#define STUPLOXX_VERSION \
"STUPLOXX V1.1 Plot SFF waveform data"
"STUPLOXX V1.2 Plot SFF waveform data"
#define STUPLOXX_CVSID \
"$Id$"
"2015-03-05"
#include <unistd.h>
#include <stdlib.h>
......@@ -57,6 +58,12 @@
#include "panel.h"
#include "screen.h"
#include "usage_text.h"
#include "help_text.h"
#include "interactive_text.h"
#include "description_text.h"
#include "examples_text.h"
using std::cout;
using std::cerr;
using std::endl;
......@@ -79,7 +86,7 @@ int main(int iargc, char* argv[])
{
cerr << STUPLOXX_VERSION << endl;
cerr << STUPLOXX_CVSID << endl;
cerr << stuplo::usage_text << endl;
cerr << usage_text << endl;
exit(0);
}
......@@ -91,9 +98,9 @@ int main(int iargc, char* argv[])
{
cerr << STUPLOXX_VERSION << endl;
cerr << STUPLOXX_CVSID << endl;
cerr << stuplo::usage_text << endl;
cerr << stuplo::help_text << endl;
cerr << stuplo::control_help_text << endl;
cerr << usage_text << endl;
cerr << help_text << endl;
cerr << interactive_text << endl;
pgplot::basic_device::ldev();
cerr << endl;
cerr << libtime::usage_time_format_string << endl;
......@@ -105,7 +112,7 @@ int main(int iargc, char* argv[])
{
cerr << STUPLOXX_VERSION << endl;
cerr << STUPLOXX_CVSID << endl;
cerr << stuplo::control_help_text << endl;
cerr << interactive_text << endl;
exit(0);
}
......
# this is <usage_text.txt>
# ============================================================================
# usage information
# -----------------
usage: stuploxx [-v] [-D] [-interactive] [-device dev]
[-repeat[=i]] [-repcmd c]
file [t:n] [file [t:n]...]
or: stuploxx --help
or: stuploxx --keys
#
# ----- END OF usage_text.txt -----
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment