Rename configuration functions.
This commit is contained in:
parent
510fae5b0a
commit
823544151e
|
@ -148,11 +148,11 @@ sixdraw_init(struct sixdraw_ctx *ctx, int argc, char **argv)
|
|||
CTLSEQS_RESP_PRIMARY_DA(CTLSEQS_PH_NUMS),
|
||||
CTLSEQS_RESP_DECRQM(CTLSEQS_PH_NUM, CTLSEQS_PH_NUM)
|
||||
};
|
||||
struct ctlseqs_matcher_opts options = {
|
||||
struct ctlseqs_matcher_options matcher_options = {
|
||||
.patterns = patterns,
|
||||
.npatterns = sizeof(patterns) / sizeof(char const *),
|
||||
};
|
||||
if (ctlseqs_matcher_setopt(ctx->matcher, &options) != 0) {
|
||||
if (ctlseqs_matcher_config(ctx->matcher, &matcher_options) != 0) {
|
||||
sixdraw_print_error(ctx, "failed to set matcher options");
|
||||
return false;
|
||||
}
|
||||
|
@ -163,12 +163,12 @@ sixdraw_init(struct sixdraw_ctx *ctx, int argc, char **argv)
|
|||
sixdraw_print_error(ctx, "failed to initialize reader");
|
||||
return false;
|
||||
}
|
||||
struct ctlseqs_reader_opts reader_opts = {
|
||||
struct ctlseqs_reader_options reader_options = {
|
||||
.buffer = ctx->buffer,
|
||||
.fd = ctx->in_fd,
|
||||
.maxlen = 32,
|
||||
};
|
||||
if (ctlseqs_reader_setopt(ctx->reader, &reader_opts) != CTLSEQS_OK) {
|
||||
if (ctlseqs_reader_config(ctx->reader, &reader_options) != CTLSEQS_OK) {
|
||||
sixdraw_print_error(ctx, "failed to set reader options");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
dist_man3_MANS = \
|
||||
ctlseqs_matcher_init.3 \
|
||||
ctlseqs_matcher_setopt.3 \
|
||||
ctlseqs_matcher_config.3 \
|
||||
ctlseqs_matcher_free.3 \
|
||||
ctlseqs_reader_init.3 \
|
||||
ctlseqs_reader_setopt.3 \
|
||||
ctlseqs_reader_config.3 \
|
||||
ctlseqs_read.3 \
|
||||
ctlseqs_purge.3 \
|
||||
ctlseqs_reader_free.3
|
||||
|
|
|
@ -47,11 +47,11 @@ C1 (8-bit) control characters are not supported.
|
|||
.BR ncurses (3X)
|
||||
.PP
|
||||
.BR ctlseqs_matcher_init (3),
|
||||
.BR ctlseqs_matcher_setopt (3),
|
||||
.BR ctlseqs_matcher_config (3),
|
||||
.BR ctlseqs_matcher_free (3)
|
||||
.PP
|
||||
.BR ctlseqs_reader_init (3),
|
||||
.BR ctlseqs_reader_setopt (3),
|
||||
.BR ctlseqs_reader_config (3),
|
||||
.BR ctlseqs_reader_free (3)
|
||||
.PP
|
||||
.BR ctlseqs_read (3)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
.TH CTLSEQS_MATCHER_SETOPT 3 "Sep 01, 2020" 0.1.0 "Ctlseqs Library Manual"
|
||||
.TH CTLSEQS_MATCHER_CONFIG 3 "Sep 01, 2020" 0.1.0 "Ctlseqs Library Manual"
|
||||
.
|
||||
.SH NAME
|
||||
ctlseqs_matcher_setopt - set control sequence matcher options
|
||||
ctlseqs_matcher_config - configure control sequence matcher
|
||||
.
|
||||
.SH SYNOPSYS
|
||||
.nf
|
||||
.B #include <ctlseqs.h>
|
||||
.PP
|
||||
.BI "int ctlseqs_matcher_setopt(struct ctlseqs_matcher *" matcher ,
|
||||
.BI " struct ctlseqs_matcher_opts const *" options );
|
||||
.BI "int ctlseqs_matcher_config(struct ctlseqs_matcher *" matcher ,
|
||||
.BI " struct ctlseqs_matcher_options const *" options );
|
||||
.fi
|
||||
.
|
||||
.SH DESCRIPTION
|
||||
|
@ -18,13 +18,13 @@ Changes the properties of the given
|
|||
The
|
||||
.I options
|
||||
argument is a pointer to a
|
||||
.BR "struct ctlseqs_matcher_opts" ,
|
||||
.BR "struct ctlseqs_matcher_options" ,
|
||||
whose definition is shown below:
|
||||
.PP
|
||||
.nf
|
||||
.in +4n
|
||||
.EX
|
||||
struct ctlseqs_matcher_opts {
|
||||
struct ctlseqs_matcher_options {
|
||||
char const *const *patterns;
|
||||
size_t npatterns;
|
||||
};
|
|
@ -12,7 +12,7 @@ ctlseqs_matcher_init - initialize control sequence matcher
|
|||
.
|
||||
.SH DESCRIPTION
|
||||
Creates a control sequence matcher, which can be configured with
|
||||
.BR ctlseqs_matcher_setopt ().
|
||||
.BR ctlseqs_matcher_config ().
|
||||
.PP
|
||||
Instance of a control sequence matcher should be freed with
|
||||
.BR ctlseqs_matcher_free ().
|
||||
|
@ -25,7 +25,7 @@ holding the matcher instance.
|
|||
If the function fails to allocate sufficient memory, returns NULL.
|
||||
.
|
||||
.SH SEE ALSO
|
||||
.BR ctlseqs_matcher_setopt (3),
|
||||
.BR ctlseqs_matcher_config (3),
|
||||
.BR ctlseqs_matcher_free (3)
|
||||
.
|
||||
.SH COPYRIGHT
|
||||
|
|
|
@ -17,12 +17,12 @@ Attempts to read a terminal control sequence, and extract values according to gi
|
|||
The
|
||||
.I reader
|
||||
argument specifies the behaviour of the read operation, which can be configured with
|
||||
.BR ctlseqs_reader_setopt ().
|
||||
.BR ctlseqs_reader_config ().
|
||||
.PP
|
||||
The
|
||||
.I matcher
|
||||
argument specifies the expected patterns of control sequences to be matched upon after a successful read, which can be configured with
|
||||
.BR ctlseqs_matcher_setopt ().
|
||||
.BR ctlseqs_matcher_config ().
|
||||
A NULL
|
||||
.I matcher
|
||||
is allowed, acting as if
|
||||
|
@ -95,8 +95,8 @@ The byte following a single-shift should be a printable character.
|
|||
.B SOS [chrstr] ST
|
||||
Character string can be any bit combination which does not represent SOS or ST.
|
||||
.SH SEE ALSO
|
||||
.BR ctlseqs_matcher_setopt (3),
|
||||
.BR ctlseqs_reader_setopt (3)
|
||||
.BR ctlseqs_matcher_config (3),
|
||||
.BR ctlseqs_reader_config (3)
|
||||
.
|
||||
.SH COPYRIGHT
|
||||
Copyright (c) 2020 CismonX <admin@cismon.net>
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
.TH CTLSEQS_READER_SETOPT 3 "Sep 01, 2020" 0.1.0 "Ctlseqs Library Manual"
|
||||
.TH CTLSEQS_READER_CONFIG 3 "Sep 01, 2020" 0.1.0 "Ctlseqs Library Manual"
|
||||
.
|
||||
.SH NAME
|
||||
ctlseqs_reader_setopt - set control sequence reader options
|
||||
ctlseqs_reader_config - configure control sequence reader
|
||||
.
|
||||
.SH SYNOPSYS
|
||||
.nf
|
||||
.B #include <ctlseqs.h>
|
||||
.PP
|
||||
.BI "int ctlseqs_reader_setopt(struct ctlseqs_reader *" reader ,
|
||||
.BI " struct ctlseqs_reader_opts const *" options );
|
||||
.BI "int ctlseqs_reader_config(struct ctlseqs_reader *" reader ,
|
||||
.BI " struct ctlseqs_reader_options const *" options );
|
||||
.fi
|
||||
.
|
||||
.SH DESCRIPTION
|
||||
Function
|
||||
.BR ctlseqs_reader_setopt ()
|
||||
.BR ctlseqs_reader_config ()
|
||||
changes the properties of the given
|
||||
.IR reader .
|
||||
.PP
|
||||
The
|
||||
.I options
|
||||
argument is a pointer to a
|
||||
.BR "struct ctlseqs_reader_opts" ,
|
||||
.BR "struct ctlseqs_reader_options" ,
|
||||
as shown below:
|
||||
.PP
|
||||
.nf
|
||||
.in +4n
|
||||
.EX
|
||||
struct ctlseqs_reader_opts {
|
||||
struct ctlseqs_reader_options {
|
||||
union ctlseqs_value *buffer;
|
||||
size_t maxlen;
|
||||
int fd;
|
|
@ -12,7 +12,7 @@ ctlseqs_reader_init - initialize control sequence reader
|
|||
.
|
||||
.SH DESCRIPTION
|
||||
Creates a control sequence reader, which can be configured with
|
||||
.BR ctlseqs_reader_setopt ().
|
||||
.BR ctlseqs_reader_config ().
|
||||
.PP
|
||||
Instance of a control sequence reader should be freed with
|
||||
.BR ctlseqs_reader_free ().
|
||||
|
@ -25,7 +25,7 @@ holding the reader instance.
|
|||
If the function fails to allocate sufficient memory, returns NULL.
|
||||
.
|
||||
.SH SEE ALSO
|
||||
.BR ctlseqs_reader_setopt (3),
|
||||
.BR ctlseqs_reader_config (3),
|
||||
.BR ctlseqs_reader_free (3)
|
||||
.
|
||||
.SH COPYRIGHT
|
||||
|
|
|
@ -389,7 +389,7 @@ ctlseqs_matcher_init()
|
|||
}
|
||||
|
||||
int
|
||||
ctlseqs_matcher_setopt(struct ctlseqs_matcher *matcher, struct ctlseqs_matcher_opts const *options)
|
||||
ctlseqs_matcher_config(struct ctlseqs_matcher *matcher, struct ctlseqs_matcher_options const *options)
|
||||
{
|
||||
size_t node_pool_idx = 0, max_format_size = 0;
|
||||
if (matcher->node_pool == NULL) {
|
||||
|
@ -470,7 +470,7 @@ ctlseqs_reader_init()
|
|||
}
|
||||
|
||||
int
|
||||
ctlseqs_reader_setopt(struct ctlseqs_reader *reader, struct ctlseqs_reader_opts const *options)
|
||||
ctlseqs_reader_config(struct ctlseqs_reader *reader, struct ctlseqs_reader_options const *options)
|
||||
{
|
||||
size_t readlen = options->maxlen;
|
||||
if (reader->readlen != readlen) {
|
||||
|
|
|
@ -367,12 +367,12 @@ struct ctlseqs_matcher;
|
|||
|
||||
struct ctlseqs_reader;
|
||||
|
||||
struct ctlseqs_matcher_opts {
|
||||
struct ctlseqs_matcher_options {
|
||||
char const *const *patterns;
|
||||
size_t npatterns;
|
||||
};
|
||||
|
||||
struct ctlseqs_reader_opts {
|
||||
struct ctlseqs_reader_options {
|
||||
union ctlseqs_value *buffer;
|
||||
size_t maxlen;
|
||||
int fd;
|
||||
|
@ -394,7 +394,7 @@ struct ctlseqs_matcher *
|
|||
ctlseqs_matcher_init();
|
||||
|
||||
int
|
||||
ctlseqs_matcher_setopt(struct ctlseqs_matcher *matcher, struct ctlseqs_matcher_opts const *options);
|
||||
ctlseqs_matcher_config(struct ctlseqs_matcher *matcher, struct ctlseqs_matcher_options const *options);
|
||||
|
||||
void
|
||||
ctlseqs_matcher_free(struct ctlseqs_matcher *matcher);
|
||||
|
@ -403,7 +403,7 @@ struct ctlseqs_reader *
|
|||
ctlseqs_reader_init();
|
||||
|
||||
int
|
||||
ctlseqs_reader_setopt(struct ctlseqs_reader *reader, struct ctlseqs_reader_opts const *options);
|
||||
ctlseqs_reader_config(struct ctlseqs_reader *reader, struct ctlseqs_reader_options const *options);
|
||||
|
||||
ssize_t
|
||||
ctlseqs_read(struct ctlseqs_reader *reader, struct ctlseqs_matcher const *matcher, int timeout);
|
||||
|
|
|
@ -325,11 +325,11 @@ main(int argc, char **argv)
|
|||
for (size_t idx = 0; idx < npatterns; ++idx) {
|
||||
patterns[idx] = seqs[idx].pattern;
|
||||
}
|
||||
struct ctlseqs_matcher_opts matcher_opts = {
|
||||
struct ctlseqs_matcher_options matcher_options = {
|
||||
.patterns = patterns,
|
||||
.npatterns = npatterns,
|
||||
};
|
||||
if (ctlseqs_matcher_setopt(matcher, &matcher_opts) != CTLSEQS_OK) {
|
||||
if (ctlseqs_matcher_config(matcher, &matcher_options) != CTLSEQS_OK) {
|
||||
print_error(&ctx, "matcher setopt failed");
|
||||
return 1;
|
||||
}
|
||||
|
@ -339,12 +339,12 @@ main(int argc, char **argv)
|
|||
print_error(&ctx, "failed to initialize reader");
|
||||
}
|
||||
union ctlseqs_value buffer[16];
|
||||
struct ctlseqs_reader_opts reader_opts = {
|
||||
struct ctlseqs_reader_options reader_options = {
|
||||
.fd = STDIN_FILENO,
|
||||
.maxlen = ctx.limit,
|
||||
.buffer = buffer
|
||||
};
|
||||
if (ctlseqs_reader_setopt(reader, &reader_opts) != CTLSEQS_OK) {
|
||||
if (ctlseqs_reader_config(reader, &reader_options) != CTLSEQS_OK) {
|
||||
print_error(&ctx, "reader setopt failed");
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue