tweaks: transform the token DISABLE_JUSTIFY to ENABLE_JUSTIFY

master
Benno Schulenberg 2017-10-31 17:34:07 +01:00
parent c4d2a92d4c
commit db0b849f9b
9 changed files with 62 additions and 60 deletions

View File

@ -144,8 +144,13 @@ fi
AC_ARG_ENABLE(justify,
AS_HELP_STRING([--disable-justify], [Disable the justify/unjustify functions]))
if test "x$enable_justify" = xno; then
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_justify" != xyes; then
enable_justify=no
fi
fi
if test "x$enable_justify" != xno; then
AC_DEFINE(ENABLE_JUSTIFY, 1, [Define this to have the routines for justifying.])
fi
AC_ARG_ENABLE(libmagic,
@ -277,9 +282,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_extra" != xyes; then
AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
fi
if test "x$enable_justify" != xyes; then
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
fi
if test "x$enable_libmagic" != xyes; then
enable_libmagic=no
fi

View File

@ -579,7 +579,7 @@ size_t mbstrnlen(const char *s, size_t maxlen)
return strnlen(s, maxlen);
}
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
/* This function is equivalent to strchr() for multibyte strings. */
char *mbstrchr(const char *s, const char *c)
{
@ -620,7 +620,7 @@ char *mbstrchr(const char *s, const char *c)
#endif
return (char *) strchr(s, *c);
}
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
#endif /* !NANO_TINY || ENABLE_JUSTIFY */
#ifndef NANO_TINY
/* This function is equivalent to strpbrk() for multibyte strings. */
@ -686,7 +686,7 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer)
}
#endif /* !NANO_TINY */
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
/* Return TRUE if the string s contains one or more blank characters,
* and FALSE otherwise. */
bool has_blank_chars(const char *s)
@ -719,7 +719,7 @@ bool has_blank_mbchars(const char *s)
#endif
return has_blank_chars(s);
}
#endif /* ENABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
#endif /* ENABLE_NANORC && (!NANO_TINY || ENABLE_JUSTIFY) */
#ifdef ENABLE_UTF8
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */

View File

@ -135,7 +135,7 @@ int whitespace_len[2];
/* The length in bytes of these characters. */
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
char *punct = NULL;
/* The closing punctuation that can end sentences. */
char *brackets = NULL;
@ -149,7 +149,7 @@ int quoterc;
/* Whether it was compiled successfully. */
char *quoteerr = NULL;
/* The error message, if it didn't. */
#endif /* !DISABLE_JUSTIFY */
#endif
char *word_chars = NULL;
/* Nonalphanumeric characters that also form words. */
@ -493,7 +493,7 @@ void print_sclist(void)
const char *exit_tag = N_("Exit");
const char *close_tag = N_("Close");
const char *uncut_tag = N_("Uncut Text");
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
const char *unjust_tag = N_("Unjustify");
#endif
@ -508,7 +508,7 @@ void shortcut_init(void)
const char *nextline_tag = N_("Next Line");
const char *prevpage_tag = N_("Prev Page");
const char *nextpage_tag = N_("Next Page");
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
const char *justify_tag = N_("Justify");
const char *fulljustify_tag = N_("FullJstify");
#endif
@ -578,7 +578,7 @@ void shortcut_init(void)
const char *end_gist = N_("Go to end of current line");
const char *prevblock_gist = N_("Go to previous block of text");
const char *nextblock_gist = N_("Go to next block of text");
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
const char *parabegin_gist =
N_("Go to beginning of paragraph; then of previous paragraph");
const char *paraend_gist =
@ -611,7 +611,7 @@ void shortcut_init(void)
const char *cuttilleof_gist =
N_("Cut from the cursor position to the end of the file");
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
const char *justify_gist = N_("Justify the current paragraph");
const char *fulljustify_gist = N_("Justify the entire file");
#endif
@ -708,7 +708,7 @@ void shortcut_init(void)
add_to_funcs(do_writeout_void, MMAIN,
N_("Write Out"), WITHORSANS(writeout_gist), TOGETHER, NOVIEW);
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
if (!ISSET(RESTRICTED)) {
#else
/* If we can't replace Insert with Justify, show Insert anyway, to
@ -725,7 +725,7 @@ void shortcut_init(void)
NOVIEW);
#endif
} else {
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_funcs(do_justify_void, MMAIN,
justify_tag, WITHORSANS(justify_gist), BLANKAFTER, NOVIEW);
#endif
@ -770,7 +770,7 @@ void shortcut_init(void)
uncutfunc = tailfunc;
if (!ISSET(RESTRICTED)) {
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_funcs(do_justify_void, MMAIN,
justify_tag, WITHORSANS(justify_gist), TOGETHER, NOVIEW);
#endif
@ -792,8 +792,8 @@ void shortcut_init(void)
add_to_funcs(do_cursorpos_void, MMAIN,
N_("Cur Pos"), WITHORSANS(cursorpos_gist), TOGETHER, VIEW);
#if (!defined(DISABLE_JUSTIFY) && (!defined(DISABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
defined(DISABLE_JUSTIFY) && defined(DISABLE_SPELLER) && defined(DISABLE_COLOR))
#if (defined(ENABLE_JUSTIFY) && (!defined(DISABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
!defined(ENABLE_JUSTIFY) && defined(DISABLE_SPELLER) && defined(DISABLE_COLOR))
/* Conditionally placing this one here or further on, to keep the
* help items nicely paired in most conditions. */
add_to_funcs(do_gotolinecolumn_void, MMAIN,
@ -825,7 +825,7 @@ void shortcut_init(void)
add_to_funcs(flip_replace, MREPLACE,
N_("No Replace"), WITHORSANS(whereis_gist), BLANKAFTER, VIEW);
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_funcs(do_full_justify, MWHEREIS,
fulljustify_tag, WITHORSANS(fulljustify_gist), TOGETHER, NOVIEW);
@ -882,7 +882,7 @@ void shortcut_init(void)
N_("Prev Block"), WITHORSANS(prevblock_gist), TOGETHER, VIEW);
add_to_funcs(do_next_block, MMAIN,
N_("Next Block"), WITHORSANS(nextblock_gist), TOGETHER, VIEW);
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_funcs(do_para_begin_void, MMAIN|MWHEREIS,
N_("Beg of Par"), WITHORSANS(parabegin_gist), TOGETHER, VIEW);
add_to_funcs(do_para_end_void, MMAIN|MWHEREIS,
@ -906,8 +906,8 @@ void shortcut_init(void)
N_("Next File"), WITHORSANS(nextfile_gist), BLANKAFTER, VIEW);
#endif
#if (defined(DISABLE_JUSTIFY) && (!defined(DISABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
!defined(DISABLE_JUSTIFY) && defined(DISABLE_SPELLER) && defined(DISABLE_COLOR))
#if (!defined(ENABLE_JUSTIFY) && (!defined(DISABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
defined(ENABLE_JUSTIFY) && defined(DISABLE_SPELLER) && defined(DISABLE_COLOR))
add_to_funcs(do_gotolinecolumn_void, MMAIN,
gotoline_tag, WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
#endif
@ -944,7 +944,7 @@ void shortcut_init(void)
N_("CutTillEnd"), WITHORSANS(cuttilleof_gist), BLANKAFTER, NOVIEW);
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_funcs(do_full_justify, MMAIN,
fulljustify_tag, WITHORSANS(fulljustify_gist), TOGETHER, NOVIEW);
#endif
@ -999,7 +999,7 @@ void shortcut_init(void)
N_("NextHstory"), WITHORSANS(nexthistory_gist), BLANKAFTER, VIEW);
#endif
#ifdef DISABLE_JUSTIFY
#ifndef ENABLE_JUSTIFY
add_to_funcs(do_gotolinecolumn_void, MWHEREIS,
gotoline_tag, WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
#endif
@ -1102,7 +1102,7 @@ void shortcut_init(void)
add_to_sclist(MMOST, "F9", 0, do_cut_text_void, 0);
add_to_sclist(MMOST, "^U", 0, do_uncut_text, 0);
add_to_sclist(MMOST, "F10", 0, do_uncut_text, 0);
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_sclist(MMAIN, "^J", 0, do_justify_void, 0);
add_to_sclist(MMAIN, "F4", 0, do_justify_void, 0);
#endif
@ -1204,7 +1204,7 @@ void shortcut_init(void)
}
add_to_sclist(MMAIN, "M-7", 0, do_prev_block, 0);
add_to_sclist(MMAIN, "M-8", 0, do_next_block, 0);
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_sclist(MMAIN, "M-(", 0, do_para_begin_void, 0);
add_to_sclist(MMAIN, "M-9", 0, do_para_begin_void, 0);
add_to_sclist(MMAIN, "M-)", 0, do_para_end_void, 0);
@ -1227,7 +1227,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-T", 0, do_cut_till_eof, 0);
add_to_sclist(MMAIN, "M-D", 0, do_wordlinechar_count, 0);
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_sclist(MMAIN|MWHEREIS, "M-J", 0, do_full_justify, 0);
#endif
add_to_sclist(MMAIN|MHELP, "^L", 0, total_refresh, 0);
@ -1277,7 +1277,7 @@ void shortcut_init(void)
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MFINDINHELP, "^Y", 0, do_first_line, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MFINDINHELP, "^V", 0, do_last_line, 0);
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^W", 0, do_para_begin_void, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^O", 0, do_para_end_void, 0);
#endif
@ -1516,7 +1516,7 @@ sc *strtosc(const char *input)
s->scfunc = do_cursorpos_void;
else if (!strcasecmp(input, "gotoline"))
s->scfunc = do_gotolinecolumn_void;
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
else if (!strcasecmp(input, "justify"))
s->scfunc = do_justify_void;
else if (!strcasecmp(input, "fulljustify"))
@ -1777,7 +1777,7 @@ void thanks_for_all_the_fish(void)
delwin(bottomwin);
free(word_chars);
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
free(quotestr);
regfree(&quotereg);
free(quoteerr);

View File

@ -169,7 +169,7 @@ void do_page_down(void)
refresh_needed = TRUE;
}
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
/* Move to the beginning of the last beginning-of-paragraph line before the
* current line. If update_screen is TRUE, update the screen afterwards. */
void do_para_begin(bool update_screen)
@ -229,7 +229,7 @@ void do_para_end_void(void)
{
do_para_end(TRUE);
}
#endif /* !DISABLE_JUSTIFY */
#endif /* ENABLE_JUSTIFY */
/* Move to the preceding block of text. */
void do_prev_block(void)

View File

@ -830,7 +830,7 @@ void usage(void)
print_opt("-P", "--positionlog",
N_("Log & read location of cursor position"));
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
print_opt(_("-Q <str>"), _("--quotestr=<str>"), N_("Quoting string"));
#endif
if (!ISSET(RESTRICTED))
@ -942,7 +942,7 @@ void version(void)
#ifdef ENABLE_HISTORIES
printf(" --enable-histories");
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
printf(" --enable-justify");
#endif
#ifdef HAVE_LIBMAGIC
@ -991,7 +991,7 @@ void version(void)
#ifndef ENABLE_HISTORIES
printf(" --disable-histories");
#endif
#ifdef DISABLE_JUSTIFY
#ifndef ENABLE_JUSTIFY
printf(" --disable-justify");
#endif
#ifndef HAVE_LIBMAGIC
@ -1917,7 +1917,7 @@ int main(int argc, char **argv)
{"rebindkeypad", 0, NULL, 'K'},
{"nonewlines", 0, NULL, 'L'},
{"morespace", 0, NULL, 'O'},
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
{"quotestr", 1, NULL, 'Q'},
#endif
{"restricted", 0, NULL, 'R'},
@ -2088,7 +2088,7 @@ int main(int argc, char **argv)
SET(POS_HISTORY);
break;
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
case 'Q':
quotestr = mallocstrcpy(quotestr, optarg);
break;
@ -2262,7 +2262,7 @@ int main(int argc, char **argv)
char *backup_dir_cpy = backup_dir;
char *word_chars_cpy = word_chars;
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
char *quotestr_cpy = quotestr;
#endif
#ifndef DISABLE_SPELLER
@ -2281,7 +2281,7 @@ int main(int argc, char **argv)
backup_dir = NULL;
word_chars = NULL;
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
quotestr = NULL;
#endif
#ifndef DISABLE_SPELLER
@ -2316,7 +2316,7 @@ int main(int argc, char **argv)
word_chars = word_chars_cpy;
}
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
if (quotestr_cpy != NULL) {
free(quotestr);
quotestr = quotestr_cpy;
@ -2390,7 +2390,7 @@ int main(int argc, char **argv)
init_operating_dir();
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
/* If punct wasn't specified, set its default value. */
if (punct == NULL)
punct = mallocstrcpy(NULL, "!.?");
@ -2414,7 +2414,7 @@ int main(int argc, char **argv)
quoteerr = charalloc(size);
regerror(quoterc, &quotereg, quoteerr, size);
}
#endif /* !DISABLE_JUSTIFY */
#endif /* ENABLE_JUSTIFY */
#ifndef DISABLE_SPELLER
/* If we don't have an alternative spell checker after reading the

View File

@ -128,7 +128,7 @@
#undef ENABLE_MOUSE
#endif
#if !defined(ENABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#if !defined(ENABLE_WRAPPING) && !defined(ENABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
#endif

View File

@ -116,7 +116,7 @@ extern int whitespace_len[2];
extern const char *exit_tag;
extern const char *close_tag;
extern const char *uncut_tag;
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
extern const char *unjust_tag;
extern char *punct;
extern char *brackets;
@ -124,7 +124,7 @@ extern char *quotestr;
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
#endif /* !DISABLE_JUSTIFY */
#endif /* !ENABLE_JUSTIFY */
extern char *word_chars;
@ -226,7 +226,7 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
const char *index);
size_t mbstrlen(const char *s);
size_t mbstrnlen(const char *s, size_t maxlen);
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
char *mbstrchr(const char *s, const char *c);
#endif
#ifndef NANO_TINY
@ -234,7 +234,7 @@ char *mbstrpbrk(const char *s, const char *accept);
char *revstrpbrk(const char *head, const char *accept, const char *index);
char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
#endif
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
bool has_blank_mbchars(const char *s);
#endif
#ifdef ENABLE_UTF8
@ -378,7 +378,7 @@ void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
void do_para_begin(bool update_screen);
void do_para_end(bool update_screen);
void do_para_begin_void(void);
@ -554,10 +554,10 @@ bool do_wrap(filestruct *line);
#if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
#endif
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
size_t indent_length(const char *line);
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
void justify_format(filestruct *paragraph, size_t skip);
bool begpar(const filestruct *const foo);
bool inpar(const filestruct *const foo);

View File

@ -39,7 +39,7 @@ static const rcoption rcopts[] = {
#ifdef ENABLE_LINENUMBERS
{"linenumbers", LINE_NUMBERS},
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
{"brackets", 0},
#endif
{"const", CONSTANT_SHOW}, /* deprecated form, remove in 2018 */
@ -71,7 +71,7 @@ static const rcoption rcopts[] = {
{"positionlog", POS_HISTORY},
#endif
{"preserve", PRESERVE},
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
{"punct", 0},
{"quotestr", 0},
#endif
@ -1138,7 +1138,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
}
} else
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
if (strcasecmp(rcopts[i].name, "punct") == 0) {
punct = option;
if (has_blank_mbchars(punct)) {

View File

@ -39,7 +39,7 @@ static pid_t pid = -1;
static bool prepend_wrap = FALSE;
/* Should we prepend wrapped text to the next line? */
#endif
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
static filestruct *jusbuffer = NULL;
/* The buffer where we store unjustified text. */
static filestruct *jusbottom = NULL;
@ -1742,7 +1742,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
}
#endif /* ENABLE_HELP || !DISABLE_WRAPJUSTIFY */
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
/* The "indentation" of a line is the whitespace between the quote part
* and the non-whitespace of the line. */
size_t indent_length(const char *line)
@ -1763,9 +1763,9 @@ size_t indent_length(const char *line)
return len;
}
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
#endif /* !NANO_TINY || ENABLE_JUSTIFY */
#ifndef DISABLE_JUSTIFY
#ifdef ENABLE_JUSTIFY
/* justify_format() replaces blanks with spaces and multiple spaces by 1
* (except it maintains up to 2 after a character in punct optionally
* followed by a character in brackets, and removes all from the end).
@ -2556,7 +2556,7 @@ void do_full_justify(void)
{
do_justify(TRUE);
}
#endif /* !DISABLE_JUSTIFY */
#endif /* ENABLE_JUSTIFY */
#ifndef DISABLE_SPELLER
/* A word is misspelled in the file. Let the user replace it. We