bool convert_entire_line = false;
/* If nonzero, the size of all tab stops. If zero, use 'tab_list' instead. */
-static uintmax_t tab_size = 0;
+static colno tab_size = 0;
/* If nonzero, the size of all tab stops after the last specified. */
-static uintmax_t extend_size = 0;
+static colno extend_size = 0;
/* If nonzero, an increment for additional tab stops after the last specified.*/
-static uintmax_t increment_size = 0;
+static colno increment_size = 0;
/* The maximum distance between tab stops. */
idx_t max_column_width;
/* Array of the explicit column numbers of the tab stops;
after 'tab_list' is exhausted, each additional tab is replaced
by a space. The first column is column 0. */
-static uintmax_t *tab_list = nullptr;
+static colno *tab_list = nullptr;
/* The number of allocated entries in 'tab_list'. */
static idx_t n_tabs_allocated = 0;
/* Add tab stop TABVAL to the end of 'tab_list'. */
extern void
-add_tab_stop (uintmax_t tabval)
+add_tab_stop (colno tabval)
{
- uintmax_t prev_column = first_free_tab ? tab_list[first_free_tab - 1] : 0;
- uintmax_t column_width = prev_column <= tabval ? tabval - prev_column : 0;
+ colno prev_column = first_free_tab ? tab_list[first_free_tab - 1] : 0;
+ colno column_width = prev_column <= tabval ? tabval - prev_column : 0;
if (first_free_tab == n_tabs_allocated)
tab_list = xpalloc (tab_list, &n_tabs_allocated, 1, -1, sizeof *tab_list);
}
static bool
-set_extend_size (uintmax_t tabval)
+set_extend_size (colno tabval)
{
bool ok = true;
}
static bool
-set_increment_size (uintmax_t tabval)
+set_increment_size (colno tabval)
{
bool ok = true;
parse_tab_stops (char const *stops)
{
bool have_tabval = false;
- uintmax_t tabval = 0;
+ colno tabval = 0;
bool extend_tabval = false;
bool increment_tabval = false;
char const *num_start = nullptr;
contains only nonzero, ascending values. */
static void
-validate_tab_stops (uintmax_t const *tabs, idx_t entries)
+validate_tab_stops (colno const *tabs, idx_t entries)
{
- uintmax_t prev_tab = 0;
+ colno prev_tab = 0;
for (idx_t i = 0; i < entries; i++)
{
}
-extern uintmax_t
-get_next_tab_column (const uintmax_t column, idx_t *tab_index,
+extern colno
+get_next_tab_column (const colno column, idx_t *tab_index,
bool *last_tab)
{
*last_tab = false;
the current input column. */
for ( ; *tab_index < first_free_tab ; (*tab_index)++ )
{
- uintmax_t tab = tab_list[*tab_index];
+ colno tab = tab_list[*tab_index];
if (column < tab)
return tab;
}
/* incremental last tab - add increment_size to the previous tab stop */
if (increment_size)
{
- uintmax_t end_tab = tab_list[first_free_tab - 1];
+ colno end_tab = tab_list[first_free_tab - 1];
return column + (increment_size - ((column - end_tab) % increment_size));
}
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+/* Column numbers are nonnegative, with the leftmost column being zero. */
+typedef uintmax_t colno;
+
/* If true, convert blanks even after nonblank characters have been
read on the line. */
extern bool convert_entire_line;
/* Add tab stop TABVAL to the end of 'tab_list'. */
extern void
-add_tab_stop (uintmax_t tabval);
+add_tab_stop (colno tabval);
/* Add the comma or blank separated list of tab stops STOPS
to the list of tab stops. */
parse_tab_stops (char const *stops) _GL_ATTRIBUTE_NONNULL ();
/* TODO: Document */
-extern uintmax_t
-get_next_tab_column (const uintmax_t column, idx_t *tab_index,
+extern colno
+get_next_tab_column (const colno column, idx_t *tab_index,
bool *last_tab)
_GL_ATTRIBUTE_NONNULL ((3));
is true: */
/* Column of next input character. */
- uintmax_t column = 0;
+ colno column = 0;
/* Column the next input tab stop is on. */
- uintmax_t next_tab_column = 0;
+ colno next_tab_column = 0;
/* Index in TAB_LIST of next tab stop to examine. */
idx_t tab_index = 0;
main (int argc, char **argv)
{
bool have_tabval = false;
- uintmax_t tabval IF_LINT ( = 0);
+ colno tabval IF_LINT ( = 0);
int c;
/* If true, cancel the effect of any -a (explicit or implicit in -t),