[BACK]Return to libmandoc.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

File: [local] / src / usr.bin / mandoc / libmandoc.h (download)

Revision 1.5, Wed May 26 02:39:58 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.4: +2 -1 lines

When a word does not fully fit onto the output line, but it contains
at least one hyphen, we already had support for breaking the line a the
last fitting hyphen.  This patch improves this functionality by only
breaking at hyphens in free-form text, and by not breaking at hyphens
* at the beginning or end of a word   or
* immediately preceded or followed by another hyphen   or
* escaped by a preceding backslash.

Before this patch, differences in break-at-hyphen support were one
of the major sources of noise in automatic comparisons to mdoc(7)
groff output.  Now, the remaining differences are hard to find among
the noise coming from other sources.

Where there are still differences, what we do seems to be better than
what groff does, see e.g. the chio(1) exchange and position commands
for one of the now rare examples.

idea and coding by kristaps@

Besides, this was the last substantial code difference left
between bsd.lv and openbsd.org.  We are now in full sync.

/*	$Id: libmandoc.h,v 1.5 2010/05/26 02:39:58 schwarze Exp $ */
/*
 * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
#ifndef LIBMANDOC_H
#define LIBMANDOC_H

__BEGIN_DECLS

int		 mandoc_special(const char *);
void		*mandoc_calloc(size_t, size_t);
char		*mandoc_strdup(const char *);
void		*mandoc_malloc(size_t);
void		*mandoc_realloc(void *, size_t);
time_t		 mandoc_a2time(int, const char *);
#define		 MTIME_CANONICAL	(1 << 0)
#define		 MTIME_REDUCED		(1 << 1)
#define		 MTIME_MDOCDATE		(1 << 2)
#define		 MTIME_ISO_8601		(1 << 3)
int		 mandoc_eos(const char *, size_t);
int		 mandoc_hyph(const char *, const char *);

__END_DECLS

#endif /*!LIBMANDOC_H*/