chore: clean up

This commit is contained in:
CismonX 2023-04-11 10:08:18 +08:00
parent 592bb717d6
commit e7402d8749
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
5 changed files with 32 additions and 28 deletions

View File

@ -250,12 +250,12 @@
#define CTLSEQS_SU(n) CTLSEQS_CSI n "S" #define CTLSEQS_SU(n) CTLSEQS_CSI n "S"
// Set or request graphics attribute // Set or request graphics attribute
#define CTLSEQS_XTSMGRAPHICS(i1, i2, is) \ #define CTLSEQS_XTSMGRAPHICS(i1, i2, is) \
CTLSEQS_CSI "?" i1 ";" i2 ";" is "S" CTLSEQS_CSI "?" i1 ";" i2 ";" is "S"
// Scroll Down $n Line(s) // Scroll Down $n Line(s)
#define CTLSEQS_SD(n) CTLSEQS_CSI n "T" #define CTLSEQS_SD(n) CTLSEQS_CSI n "T"
// Initiate highlight mouse tracking // Initiate highlight mouse tracking
#define CTLSEQS_XTHIMOUSE(f, x, y, fr, lr) \ #define CTLSEQS_XTHIMOUSE(f, x, y, fr, lr) \
CTLSEQS_CSI f ";" x ";" y ";" fr ";" lr "T" CTLSEQS_CSI f ";" x ";" y ";" fr ";" lr "T"
// Reset title mode features to default value // Reset title mode features to default value
#define CTLSEQS_XTRMTITLE(is) CTLSEQS_CSI ">" is "T" #define CTLSEQS_XTRMTITLE(is) CTLSEQS_CSI ">" is "T"
// Erase $n Character(s) // Erase $n Character(s)
@ -328,7 +328,7 @@
#define CTLSEQS_XTRESTORE(is) CTLSEQS_CSI "?" is "r" #define CTLSEQS_XTRESTORE(is) CTLSEQS_CSI "?" is "r"
// Change Attributes in Rectangular Area // Change Attributes in Rectangular Area
#define CTLSEQS_DECCARA(t, l, b, r, is) \ #define CTLSEQS_DECCARA(t, l, b, r, is) \
CTLSEQS_CSI t ";" l ";" b ";" r ";" is "$r" CTLSEQS_CSI t ";" l ";" b ";" r ";" is "$r"
// Save cursor // Save cursor
#define CTLSEQS_SCOSC() CTLSEQS_CSI "s" #define CTLSEQS_SCOSC() CTLSEQS_CSI "s"
// Set left and right margins // Set left and right margins
@ -343,46 +343,46 @@
#define CTLSEQS_DECSWBV(i) CTLSEQS_CSI i " t" #define CTLSEQS_DECSWBV(i) CTLSEQS_CSI i " t"
// Reverse Attributes in Rectangular Area // Reverse Attributes in Rectangular Area
#define CTLSEQS_DECRARA(t, l, b, r, is) \ #define CTLSEQS_DECRARA(t, l, b, r, is) \
CTLSEQS_CSI t ";" l ";" b ";" r ";" is "$t" CTLSEQS_CSI t ";" l ";" b ";" r ";" is "$t"
// Restore cursor // Restore cursor
#define CTLSEQS_SCORC() CTLSEQS_CSI "u" #define CTLSEQS_SCORC() CTLSEQS_CSI "u"
// Set margin-bell volume // Set margin-bell volume
#define CTLSEQS_DECSMBV(i) CTLSEQS_CSI i " u" #define CTLSEQS_DECSMBV(i) CTLSEQS_CSI i " u"
// Copy Rectangular Area // Copy Rectangular Area
#define CTLSEQS_DECCRA(t, l, b, r, sp, dt, dl, dp) \ #define CTLSEQS_DECCRA(t, l, b, r, sp, dt, dl, dp) \
CTLSEQS_CSI t ";" l ";" b ";" r ";" sp ";" dt ";" dl ";" dp "$v" CTLSEQS_CSI t ";" l ";" b ";" r ";" sp ";" dt ";" dl ";" dp "$v"
// Request presentation state report // Request presentation state report
#define CTLSEQS_DECRQPSR(i) CTLSEQS_CSI i "$w" #define CTLSEQS_DECRQPSR(i) CTLSEQS_CSI i "$w"
// Enable Filter Rectangle // Enable Filter Rectangle
#define CTLSEQS_DECEFR(t, l, b, r) \ #define CTLSEQS_DECEFR(t, l, b, r) \
CTLSEQS_CSI t ";" l ";" b ";" r "'w" CTLSEQS_CSI t ";" l ";" b ";" r "'w"
// Request Terminal Parameters // Request Terminal Parameters
#define CTLSEQS_DECREQTPARM(i) CTLSEQS_CSI i "x" #define CTLSEQS_DECREQTPARM(i) CTLSEQS_CSI i "x"
// Select Attribute Change Extent // Select Attribute Change Extent
#define CTLSEQS_DECSACE(i) CTLSEQS_CSI i "*x" #define CTLSEQS_DECSACE(i) CTLSEQS_CSI i "*x"
// Fill Rectangular Area // Fill Rectangular Area
#define CTLSEQS_DECFRA(c, t, l, b, r) \ #define CTLSEQS_DECFRA(c, t, l, b, r) \
CTLSEQS_CSI c ";" t ";" l ";" b ";" r "$x" CTLSEQS_CSI c ";" t ";" l ";" b ";" r "$x"
// Select checksum extension // Select checksum extension
#define CTLSEQS_XTCHECKSUM(i) CTLSEQS_CSI i "#y" #define CTLSEQS_XTCHECKSUM(i) CTLSEQS_CSI i "#y"
// Request Checksum of Rectangular Area // Request Checksum of Rectangular Area
#define CTLSEQS_DECRQCRA(id, p, t, l, b, r) \ #define CTLSEQS_DECRQCRA(id, p, t, l, b, r) \
CTLSEQS_CSI id ";" p ";" t ";" l ";" b ";" r "*y" CTLSEQS_CSI id ";" p ";" t ";" l ";" b ";" r "*y"
// Enable Locator Reporting // Enable Locator Reporting
#define CTLSEQS_DECELR(i1, i2) CTLSEQS_CSI i1 ";" i2 "'z" #define CTLSEQS_DECELR(i1, i2) CTLSEQS_CSI i1 ";" i2 "'z"
// Erase Rectangular Area // Erase Rectangular Area
#define CTLSEQS_DECERA(t, l, b, r) \ #define CTLSEQS_DECERA(t, l, b, r) \
CTLSEQS_CSI t ";" l ";" b ";" r "$z" CTLSEQS_CSI t ";" l ";" b ";" r "$z"
// Select Locator Events // Select Locator Events
#define CTLSEQS_DECSLE(is) CTLSEQS_CSI is "'{" #define CTLSEQS_DECSLE(is) CTLSEQS_CSI is "'{"
// Push video attributes onto stack // Push video attributes onto stack
#define CTLSEQS_XTPUSHSGR(is) CTLSEQS_CSI is "#{" #define CTLSEQS_XTPUSHSGR(is) CTLSEQS_CSI is "#{"
// Selective Erase Rectangular Area // Selective Erase Rectangular Area
#define CTLSEQS_DECSERA(t, l, b, r) \ #define CTLSEQS_DECSERA(t, l, b, r) \
CTLSEQS_CSI t ";" l ";" b ";" r "${" CTLSEQS_CSI t ";" l ";" b ";" r "${"
// Report selected graphic rendition // Report selected graphic rendition
#define CTLSEQS_XTREPORTSGR(t, l, b, r) \ #define CTLSEQS_XTREPORTSGR(t, l, b, r) \
CTLSEQS_CSI t ";" l ";" b ";" r "$|" CTLSEQS_CSI t ";" l ";" b ";" r "$|"
// Select columns per page // Select columns per page
#define CTLSEQS_DECSCPP(i) CTLSEQS_CSI i "$|" #define CTLSEQS_DECSCPP(i) CTLSEQS_CSI i "$|"
// Request Locator Position // Request Locator Position
@ -413,7 +413,7 @@
#define CTLSEQS_RESP_PRIMARY_DA(ns) CTLSEQS_CSI "?" ns "c" #define CTLSEQS_RESP_PRIMARY_DA(ns) CTLSEQS_CSI "?" ns "c"
// Secondary DA response message // Secondary DA response message
#define CTLSEQS_RESP_SECONDARY_DA(n1, n2, n3) \ #define CTLSEQS_RESP_SECONDARY_DA(n1, n2, n3) \
CTLSEQS_CSI ">" n1 ";" n2 ";" n3 "c" CTLSEQS_CSI ">" n1 ";" n2 ";" n3 "c"
// DECLRP response message // DECLRP response message
#define CTLSEQS_RESP_DECXCPR(n1, n2) CTLSEQS_CSI "?" n1 ";" n2 "R" #define CTLSEQS_RESP_DECXCPR(n1, n2) CTLSEQS_CSI "?" n1 ";" n2 "R"
// DSR response message // DSR response message
@ -432,10 +432,10 @@
#define CTLSEQS_RESP_DECRQCRA(n, s) CTLSEQS_DCS n "!~" s CTLSEQS_ST #define CTLSEQS_RESP_DECRQCRA(n, s) CTLSEQS_DCS n "!~" s CTLSEQS_ST
// DECRQLP response message // DECRQLP response message
#define CTLSEQS_RESP_DECRQLP(e, b, row, col, p) \ #define CTLSEQS_RESP_DECRQLP(e, b, row, col, p) \
CTLSEQS_CSI e ";" b ";" row ";" col ";" p "&w" CTLSEQS_CSI e ";" b ";" row ";" col ";" p "&w"
// Mouse response in SGR mouse mode // Mouse response in SGR mouse mode
#define CTLSEQS_RESP_SGR_MOUSE(n, col, row, c) \ #define CTLSEQS_RESP_SGR_MOUSE(n, col, row, c) \
CTLSEQS_CSI "<" n ";" col ";" row c CTLSEQS_CSI "<" n ";" col ";" row c
/// PC-Style Function Keys /// PC-Style Function Keys

View File

@ -1,4 +1,4 @@
.TH CTLSEQS_MATCHER_FREE 3 "Sep 01, 2020" 0.1.0 ctlseqs .TH CTLSEQS_READER_FREE 3 "Sep 01, 2020" 0.1.0 ctlseqs
. .
.SH NAME .SH NAME
ctlseqs_reader_free - free control sequence reader ctlseqs_reader_free - free control sequence reader

View File

@ -158,7 +158,7 @@ struct ctlseqs_reader {
bool save_matched; bool save_matched;
}; };
ctlseqs_hot static inline int static inline int ctlseqs_hot
ctlseqs_poll( ctlseqs_poll(
struct pollfd *pollfd, struct pollfd *pollfd,
int timeout int timeout
@ -184,7 +184,7 @@ ctlseqs_poll(
} }
} }
ctlseqs_hot static inline int static inline int ctlseqs_hot
ctlseqs_do_read( ctlseqs_do_read(
struct ctlseqs_reader *reader struct ctlseqs_reader *reader
) { ) {
@ -211,7 +211,7 @@ ctlseqs_do_read(
} }
} }
ctlseqs_hot static enum ctlseqs_state static enum ctlseqs_state ctlseqs_hot
ctlseqs_state_transition( ctlseqs_state_transition(
enum ctlseqs_state state, enum ctlseqs_state state,
char ch char ch
@ -294,7 +294,7 @@ ctlseqs_state_transition(
} }
} }
ctlseqs_hot static char const * static char const * ctlseqs_hot
ctlseqs_fetch_value( ctlseqs_fetch_value(
char const *seq, char const *seq,
int type, int type,
@ -342,7 +342,7 @@ ctlseqs_fetch_value(
} }
} }
ctlseqs_hot static ssize_t static ssize_t ctlseqs_hot
ctlseqs_match_pattern( ctlseqs_match_pattern(
struct ctlseqs_matcher const *matcher, struct ctlseqs_matcher const *matcher,
struct ctlseqs_match_args const *args struct ctlseqs_match_args const *args
@ -399,7 +399,7 @@ ctlseqs_match_pattern(
return CTLSEQS_NOMATCH; return CTLSEQS_NOMATCH;
} }
ctlseqs_hot static inline ssize_t static inline ssize_t ctlseqs_hot
ctlseqs_do_match( ctlseqs_do_match(
struct ctlseqs_matcher const *matcher, struct ctlseqs_matcher const *matcher,
struct ctlseqs_match_args *args struct ctlseqs_match_args *args
@ -435,7 +435,7 @@ ctlseqs_do_match(
return retval; return retval;
} }
ctlseqs_hot static ssize_t static ssize_t ctlseqs_hot
ctlseqs_reader_match( ctlseqs_reader_match(
struct ctlseqs_reader *reader, struct ctlseqs_reader *reader,
struct ctlseqs_matcher const *matcher struct ctlseqs_matcher const *matcher
@ -634,7 +634,7 @@ ctlseqs_reader_config(
return CTLSEQS_ERROR; return CTLSEQS_ERROR;
} }
char *rbuf = realloc(reader->rbuf, readlen); char *rbuf = realloc(reader->rbuf, readlen);
if (rbuf == NULL) { if (ctlseqs_unlikely(rbuf == NULL)) {
return CTLSEQS_NOMEM; return CTLSEQS_NOMEM;
} }
reader->readlen = readlen; reader->readlen = readlen;
@ -698,7 +698,7 @@ ctlseqs_purge(
reader->state = ctlseqs_state_none; reader->state = ctlseqs_state_none;
} }
ctlseqs_cold void void ctlseqs_cold
ctlseqs_reader_free( ctlseqs_reader_free(
struct ctlseqs_reader *reader struct ctlseqs_reader *reader
) { ) {

View File

@ -7,12 +7,16 @@
# #
AUTOMAKE_OPTIONS = dejagnu AUTOMAKE_OPTIONS = dejagnu
EXTRA_DIST = ctlseqs/*.exp init.exp EXTRA_DIST = lib/ctlseqs.exp \
ctlseqs/8bitchar.exp \
ctlseqs/match.exp \
ctlseqs/nomem.exp \
ctlseqs/partial.exp \
ctlseqs/timeout.exp
noinst_PROGRAMS = tcsgrep check_PROGRAMS = tcsgrep
tcsgrep_CPPFLAGS = -I$(top_srcdir)/include tcsgrep_CPPFLAGS = -I$(top_srcdir)/include
tcsgrep_SOURCES = tcsgrep.c tcsgrep_SOURCES = tcsgrep.c
tcsgrep_LDADD = $(top_builddir)/src/libctlseqs.la tcsgrep_LDADD = $(top_builddir)/src/libctlseqs.la
RUNTESTFLAGS = TCSGREP_BIN=$(builddir)/tcsgrep RUNTESTFLAGS = TCSGREP_BIN=$(builddir)/tcsgrep
EXTRA_DEJAGNU_SITE_CONFIG = $(srcdir)/init.exp