1999-06-23 13:19:30 +02:00
|
|
|
/*
|
2019-02-15 21:24:31 +01:00
|
|
|
* boxes - Command line filter to draw/remove ASCII boxes around text
|
2021-02-11 22:11:16 +01:00
|
|
|
* Copyright (c) 1999-2021 Thomas Jensen and the boxes contributors
|
1999-07-20 20:56:15 +02:00
|
|
|
*
|
2019-02-15 21:24:31 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License, version 2, as published
|
|
|
|
* by the Free Software Foundation.
|
2021-01-27 17:13:17 +01:00
|
|
|
*
|
2019-02-15 21:24:31 +01:00
|
|
|
* 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.
|
2021-01-27 17:13:17 +01:00
|
|
|
*
|
2019-02-15 21:24:31 +01:00
|
|
|
* 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1999-06-23 13:19:30 +02:00
|
|
|
*
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
*/
|
|
|
|
|
2019-02-20 11:04:09 +01:00
|
|
|
/*
|
2021-01-30 21:10:05 +01:00
|
|
|
* Tool functions for error reporting and some string handling and other needful things
|
2019-02-20 11:04:09 +01:00
|
|
|
*/
|
2019-02-15 21:24:31 +01:00
|
|
|
|
1999-06-23 13:19:30 +02:00
|
|
|
#ifndef TOOLS_H
|
|
|
|
#define TOOLS_H
|
|
|
|
|
2021-01-30 21:10:05 +01:00
|
|
|
#include <unitypes.h>
|
|
|
|
|
2021-02-05 11:01:38 +01:00
|
|
|
#include "boxes.h"
|
|
|
|
|
1999-06-23 13:19:30 +02:00
|
|
|
|
2021-02-06 18:17:00 +01:00
|
|
|
#define BMAX(a, b) ({ /* return the larger value */ \
|
|
|
|
__typeof__ (a) _a = (a); \
|
|
|
|
__typeof__ (b) _b = (b); \
|
|
|
|
_a > _b ? _a : _b; \
|
|
|
|
})
|
1999-06-23 13:19:30 +02:00
|
|
|
|
|
|
|
#define BFREE(p) { /* free memory and clear pointer */ \
|
2021-02-05 11:01:38 +01:00
|
|
|
if (p) { \
|
|
|
|
free((void *) p); \
|
|
|
|
(p) = NULL; \
|
|
|
|
} \
|
1999-06-23 13:19:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-27 17:13:17 +01:00
|
|
|
int yyerror(const char *fmt, ...);
|
|
|
|
|
|
|
|
void regerror(char *msg);
|
|
|
|
|
|
|
|
int empty_line(const line_t *line);
|
|
|
|
|
2021-01-28 21:37:23 +01:00
|
|
|
size_t expand_tabs_into(const uint32_t *input_buffer, const int tabstop, uint32_t **text,
|
|
|
|
size_t **tabpos, size_t *tabpos_len);
|
2021-01-27 17:13:17 +01:00
|
|
|
|
|
|
|
void btrim(char *text, size_t *len);
|
|
|
|
|
2021-01-28 21:37:23 +01:00
|
|
|
void btrim32(uint32_t *text, size_t *len);
|
|
|
|
|
2021-01-27 17:13:17 +01:00
|
|
|
char *my_strnrstr(const char *s1, const char *s2, const size_t s2_len,
|
|
|
|
int skip);
|
|
|
|
|
|
|
|
int strisyes(const char *s);
|
|
|
|
|
|
|
|
int strisno(const char *s);
|
|
|
|
|
|
|
|
void concat_strings(char *dst, int max_len, int count, ...);
|
1999-06-23 13:19:30 +02:00
|
|
|
|
2021-01-27 17:13:17 +01:00
|
|
|
char *tabbify_indent(const size_t lineno, char *indentspc, const size_t indentspc_len);
|
1999-08-31 17:38:42 +02:00
|
|
|
|
2021-01-30 21:10:05 +01:00
|
|
|
char *nspaces(const size_t n);
|
|
|
|
|
2021-02-06 18:17:00 +01:00
|
|
|
void print_input_lines(const char *heading);
|
|
|
|
|
|
|
|
void analyze_line_ascii(line_t *line);
|
|
|
|
|
2006-07-22 21:11:07 +02:00
|
|
|
|
1999-06-23 13:19:30 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*EOF*/ /* vim: set cindent sw=4: */
|