Converting #ifdef ENABLE_COLOR to #ifndef DISABLE_COLOR.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4719 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-04-04 11:59:03 +00:00
parent 61bba1de8e
commit 00389928d4
14 changed files with 88 additions and 88 deletions

View File

@ -5,6 +5,8 @@
* src/rcfile.c (check_vitals_mapped): Do not allow 'set quiet' * src/rcfile.c (check_vitals_mapped): Do not allow 'set quiet'
to suppress a fatal-error message, make sure the user sees it. to suppress a fatal-error message, make sure the user sees it.
* src/color.c: Comment tweaks. * src/color.c: Comment tweaks.
* src/{*.h,*.c}, configure.ac:Convert all occurrences of
#ifdef ENABLE_COLOR to #ifndef DISABLE_COLOR.⏎
2014-04-03 Benno Schulenberg <bensberg@justemail.net> 2014-04-03 Benno Schulenberg <bensberg@justemail.net>
* configure.ac: Remove unused '*_support' variables. * configure.ac: Remove unused '*_support' variables.

View File

@ -96,20 +96,21 @@ if test "x$enable_nanorc" = xno; then
if test "x$enable_color" = xyes; then if test "x$enable_color" = xyes; then
AC_MSG_ERROR([--enable-color cannot work with --disable-nanorc]) AC_MSG_ERROR([--enable-color cannot work with --disable-nanorc])
else else
# Disabling nanorc silently disables color support.
enable_color=no enable_color=no
fi fi
fi fi
if test "x$enable_color" != xno; then if test "x$enable_color" = xno; then
if test x$ac_cv_header_regex_h = xyes; then AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.])
enable_nanorc=yes else
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) if test x$ac_cv_header_regex_h != xyes; then
color_support=yes
elif test "x$enable_color" = xyes; then
AC_MSG_ERROR([ AC_MSG_ERROR([
*** The header file regex.h was not found. If you wish to use color *** The header file regex.h was not found. If you wish to have
*** support this header file is required. Please either install C *** color support, this header file is required. Please either
*** libraries that include the regex.h file or call the configure *** install C libraries that include the regex.h file, or call
*** script with --disable-color.]) *** the configure script with --disable-color.])
else
color_support=yes
fi fi
fi fi

View File

@ -31,7 +31,7 @@
#include <magic.h> #include <magic.h>
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* For each syntax list entry, go through the list of colors and assign /* For each syntax list entry, go through the list of colors and assign
* the color pairs. */ * the color pairs. */
@ -421,4 +421,5 @@ void reset_multis(filestruct *fileptr, bool force)
reset_multis_for_id(fileptr, tmpcolor->id); reset_multis_for_id(fileptr, tmpcolor->id);
} }
} }
#endif /* ENABLE_COLOR */
#endif /* !DISABLE_COLOR */

View File

@ -216,7 +216,7 @@ void do_cut_text(
/* Update the screen. */ /* Update the screen. */
edit_refresh_needed = TRUE; edit_refresh_needed = TRUE;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
reset_multis(openfile->current, FALSE); reset_multis(openfile->current, FALSE);
#endif #endif
@ -281,7 +281,7 @@ void do_uncut_text(void)
/* Update the screen. */ /* Update the screen. */
edit_refresh_needed = TRUE; edit_refresh_needed = TRUE;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
reset_multis(openfile->current, FALSE); reset_multis(openfile->current, FALSE);
#endif #endif

View File

@ -80,7 +80,7 @@ void initialize_buffer(void)
openfile->current_undo = NULL; openfile->current_undo = NULL;
openfile->lock_filename = NULL; openfile->lock_filename = NULL;
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
openfile->colorstrings = NULL; openfile->colorstrings = NULL;
#endif #endif
} }
@ -98,7 +98,7 @@ void initialize_buffer_text(void)
openfile->edittop = openfile->fileage; openfile->edittop = openfile->fileage;
openfile->current = openfile->fileage; openfile->current = openfile->fileage;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
openfile->fileage->multidata = NULL; openfile->fileage->multidata = NULL;
#endif #endif
@ -367,7 +367,7 @@ void open_buffer(const char *filename, bool undoable)
openfile->placewewant = 0; openfile->placewewant = 0;
} }
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* If we're loading into a new buffer, update the colors to account /* If we're loading into a new buffer, update the colors to account
* for it, if applicable. */ * for it, if applicable. */
if (new_buffer) if (new_buffer)
@ -414,7 +414,7 @@ void display_buffer(void)
/* Update the titlebar, since the filename may have changed. */ /* Update the titlebar, since the filename may have changed. */
titlebar(NULL); titlebar(NULL);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* Make sure we're using the buffer's associated colors, if /* Make sure we're using the buffer's associated colors, if
* applicable. */ * applicable. */
color_init(); color_init();
@ -564,7 +564,7 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
fileptr->data[buf_len - 1] = '\0'; fileptr->data[buf_len - 1] = '\0';
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
fileptr->multidata = NULL; fileptr->multidata = NULL;
#endif #endif
@ -2123,7 +2123,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
if (!nonamechange) { if (!nonamechange) {
openfile->filename = mallocstrcpy(openfile->filename, openfile->filename = mallocstrcpy(openfile->filename,
realname); realname);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* We might have changed the filename, so update the colors /* We might have changed the filename, so update the colors
* to account for it, and then make sure we're using * to account for it, and then make sure we're using
* them. */ * them. */

View File

@ -149,7 +149,7 @@ char *alt_speller = NULL;
/* The command to use for the alternate spell checker. */ /* The command to use for the alternate spell checker. */
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
syntaxtype *syntaxes = NULL; syntaxtype *syntaxes = NULL;
/* The global list of color syntaxes. */ /* The global list of color syntaxes. */
char *syntaxstr = NULL; char *syntaxstr = NULL;
@ -580,7 +580,7 @@ void shortcut_init(bool unjustify)
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
const char *spell_msg = N_("To Spell"); const char *spell_msg = N_("To Spell");
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
const char *lint_msg = N_("To Linter"); const char *lint_msg = N_("To Linter");
const char *prev_lint_msg = N_("Prev Lint Msg"); const char *prev_lint_msg = N_("Prev Lint Msg");
const char *next_lint_msg = N_("Next Lint Msg"); const char *next_lint_msg = N_("Next Lint Msg");
@ -736,7 +736,7 @@ void shortcut_init(bool unjustify)
const char *nano_backfile_msg = N_("Go to the previous file in the list"); const char *nano_backfile_msg = N_("Go to the previous file in the list");
const char *nano_gotodir_msg = N_("Go to directory"); const char *nano_gotodir_msg = N_("Go to directory");
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
const char *nano_lint_msg = N_("Invoke the linter, if available"); const char *nano_lint_msg = N_("Invoke the linter, if available");
const char *nano_prevlint_msg = N_("Go to previous linter msg"); const char *nano_prevlint_msg = N_("Go to previous linter msg");
const char *nano_nextlint_msg = N_("Go to next linter msg"); const char *nano_nextlint_msg = N_("Go to next linter msg");
@ -814,7 +814,7 @@ void shortcut_init(bool unjustify)
add_to_funcs(do_page_down, MMAIN|MHELP|MBROWSER, add_to_funcs(do_page_down, MMAIN|MHELP|MBROWSER,
next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW); next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
add_to_funcs(do_page_up, MLINTER, add_to_funcs(do_page_up, MLINTER,
prev_lint_msg, IFSCHELP(nano_prevlint_msg), FALSE, VIEW); prev_lint_msg, IFSCHELP(nano_prevlint_msg), FALSE, VIEW);
add_to_funcs(do_page_down, MLINTER, add_to_funcs(do_page_down, MLINTER,
@ -849,7 +849,7 @@ void shortcut_init(bool unjustify)
TRUE, NOVIEW); TRUE, NOVIEW);
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
add_to_funcs(do_linter, MMAIN, lint_msg, IFSCHELP(nano_lint_msg), add_to_funcs(do_linter, MMAIN, lint_msg, IFSCHELP(nano_lint_msg),
TRUE, NOVIEW); TRUE, NOVIEW);
#endif #endif
@ -1287,7 +1287,7 @@ void shortcut_init(bool unjustify)
#endif #endif
} }
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
void set_lint_shortcuts(void) void set_lint_shortcuts(void)
{ {
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
@ -1702,7 +1702,7 @@ void thanks_for_all_the_fish(void)
/* Free the memory associated with each open file buffer. */ /* Free the memory associated with each open file buffer. */
if (openfile != NULL) if (openfile != NULL)
free_openfilestruct(openfile); free_openfilestruct(openfile);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
if (syntaxstr != NULL) if (syntaxstr != NULL)
free(syntaxstr); free(syntaxstr);
while (syntaxes != NULL) { while (syntaxes != NULL) {
@ -1740,7 +1740,7 @@ void thanks_for_all_the_fish(void)
syntaxes = syntaxes->next; syntaxes = syntaxes->next;
free(bill); free(bill);
} }
#endif /* ENABLE_COLOR */ #endif /* !DISABLE_COLOR */
#ifndef NANO_TINY #ifndef NANO_TINY
/* Free the search and replace history lists. */ /* Free the search and replace history lists. */
if (searchage != NULL) if (searchage != NULL)

View File

@ -68,7 +68,7 @@ filestruct *make_new_node(filestruct *prevnode)
newnode->next = NULL; newnode->next = NULL;
newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1; newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
newnode->multidata = NULL; newnode->multidata = NULL;
#endif #endif
@ -88,7 +88,7 @@ filestruct *copy_node(const filestruct *src)
dst->next = src->next; dst->next = src->next;
dst->prev = src->prev; dst->prev = src->prev;
dst->lineno = src->lineno; dst->lineno = src->lineno;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
dst->multidata = NULL; dst->multidata = NULL;
#endif #endif
@ -127,7 +127,7 @@ void delete_node(filestruct *fileptr)
if (fileptr->data != NULL) if (fileptr->data != NULL)
free(fileptr->data); free(fileptr->data);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
if (fileptr->multidata) if (fileptr->multidata)
free(fileptr->multidata); free(fileptr->multidata);
#endif #endif
@ -372,7 +372,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
openfile->fileage->data = mallocstrcpy(NULL, ""); openfile->fileage->data = mallocstrcpy(NULL, "");
openfile->filebot = openfile->fileage; openfile->filebot = openfile->fileage;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
openfile->fileage->multidata = NULL; openfile->fileage->multidata = NULL;
#endif #endif
@ -899,7 +899,7 @@ void usage(void)
print_opt("-W", "--wordbounds", print_opt("-W", "--wordbounds",
N_("Detect word boundaries more accurately")); N_("Detect word boundaries more accurately"));
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
print_opt(_("-Y <str>"), _("--syntax=<str>"), print_opt(_("-Y <str>"), _("--syntax=<str>"),
N_("Syntax definition to use for coloring")); N_("Syntax definition to use for coloring"));
#endif #endif
@ -1004,7 +1004,7 @@ void version(void)
#ifdef DISABLE_ROOTWRAPPING #ifdef DISABLE_ROOTWRAPPING
printf(" --disable-wrapping-as-root"); printf(" --disable-wrapping-as-root");
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
printf(" --enable-color"); printf(" --enable-color");
#endif #endif
#ifdef DEBUG #ifdef DEBUG
@ -1391,7 +1391,7 @@ void do_toggle(int flag)
edit_refresh(); edit_refresh();
break; break;
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
case NO_COLOR_SYNTAX: case NO_COLOR_SYNTAX:
edit_refresh(); edit_refresh();
break; break;
@ -1407,7 +1407,7 @@ void do_toggle(int flag)
#ifndef DISABLE_WRAPPING #ifndef DISABLE_WRAPPING
|| flag == NO_WRAP || flag == NO_WRAP
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
|| flag == NO_COLOR_SYNTAX || flag == NO_COLOR_SYNTAX
#endif #endif
) )
@ -1674,7 +1674,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
{ {
#endif #endif
s->scfunc(); s->scfunc();
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
if (f && !f->viewok && openfile->syntax != NULL if (f && !f->viewok && openfile->syntax != NULL
&& openfile->syntax->nmultis > 0) { && openfile->syntax->nmultis > 0) {
reset_multis(openfile->current, FALSE); reset_multis(openfile->current, FALSE);
@ -1797,7 +1797,7 @@ int do_mouse(void)
} }
#endif /* !DISABLE_MOUSE */ #endif /* !DISABLE_MOUSE */
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
void alloc_multidata_if_needed(filestruct *fileptr) void alloc_multidata_if_needed(filestruct *fileptr)
{ {
if (!fileptr->multidata) if (!fileptr->multidata)
@ -1931,7 +1931,7 @@ void precalc_multicolorinfo(void)
precalc_cleanup: precalc_cleanup:
nodelay(edit, FALSE); nodelay(edit, FALSE);
} }
#endif /* ENABLE_COLOR */ #endif /* !DISABLE_COLOR */
/* The user typed output_len multibyte characters. Add them to the edit /* The user typed output_len multibyte characters. Add them to the edit
* buffer, filtering out all ASCII control characters if allow_cntrls is * buffer, filtering out all ASCII control characters if allow_cntrls is
@ -2015,7 +2015,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
edit_refresh_needed = TRUE; edit_refresh_needed = TRUE;
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* If color syntaxes are available and turned on, we need to /* If color syntaxes are available and turned on, we need to
* call edit_refresh(). */ * call edit_refresh(). */
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
@ -2033,7 +2033,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
reset_multis(openfile->current, FALSE); reset_multis(openfile->current, FALSE);
#endif #endif
if (edit_refresh_needed == TRUE) { if (edit_refresh_needed == TRUE) {
@ -2078,7 +2078,7 @@ int main(int argc, char **argv)
{"restricted", 0, NULL, 'R'}, {"restricted", 0, NULL, 'R'},
{"tabsize", 1, NULL, 'T'}, {"tabsize", 1, NULL, 'T'},
{"version", 0, NULL, 'V'}, {"version", 0, NULL, 'V'},
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
{"syntax", 1, NULL, 'Y'}, {"syntax", 1, NULL, 'Y'},
#endif #endif
{"const", 0, NULL, 'c'}, {"const", 0, NULL, 'c'},
@ -2264,7 +2264,7 @@ int main(int argc, char **argv)
SET(WORD_BOUNDS); SET(WORD_BOUNDS);
break; break;
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
case 'Y': case 'Y':
syntaxstr = mallocstrcpy(syntaxstr, optarg); syntaxstr = mallocstrcpy(syntaxstr, optarg);
break; break;
@ -2695,7 +2695,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Main: top and bottom win\n"); fprintf(stderr, "Main: top and bottom win\n");
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
if (openfile->syntax) if (openfile->syntax)
if (openfile->syntax->nmultis > 0) if (openfile->syntax->nmultis > 0)
precalc_multicolorinfo(); precalc_multicolorinfo();

View File

@ -191,7 +191,7 @@ typedef enum {
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, ENTER, INSERT, OTHER ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, ENTER, INSERT, OTHER
} undo_type; } undo_type;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
typedef struct colortype { typedef struct colortype {
short fg; short fg;
/* This syntax's foreground color. */ /* This syntax's foreground color. */
@ -275,7 +275,7 @@ typedef struct lintstruct {
#define CWTF (1<<6) #define CWTF (1<<6)
/* Something else */ /* Something else */
#endif /* ENABLE_COLOR */ #endif /* !DISABLE_COLOR */
/* Structure types. */ /* Structure types. */
@ -288,7 +288,7 @@ typedef struct filestruct {
/* Next node. */ /* Next node. */
struct filestruct *prev; struct filestruct *prev;
/* Previous node. */ /* Previous node. */
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
short *multidata; /* Array of which multi-line regexes apply to this line */ short *multidata; /* Array of which multi-line regexes apply to this line */
#endif #endif
} filestruct; } filestruct;
@ -396,7 +396,7 @@ typedef struct openfilestruct {
const char *lock_filename; const char *lock_filename;
/* The path of the lockfile, if we created one */ /* The path of the lockfile, if we created one */
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
syntaxtype *syntax; syntaxtype *syntax;
/* The syntax struct for this file, if any */ /* The syntax struct for this file, if any */
colortype *colorstrings; colortype *colorstrings;

View File

@ -99,7 +99,7 @@ extern char *alt_speller;
extern sc *sclist; extern sc *sclist;
extern subnfunc *allfuncs; extern subnfunc *allfuncs;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
extern syntaxtype *syntaxes; extern syntaxtype *syntaxes;
extern char *syntaxstr; extern char *syntaxstr;
#endif #endif
@ -230,7 +230,7 @@ bool is_valid_mbstring(const char *s);
#endif #endif
/* All functions in color.c. */ /* All functions in color.c. */
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
void set_colorpairs(void); void set_colorpairs(void);
void color_init(void); void color_init(void);
void color_update(void); void color_update(void);
@ -332,7 +332,7 @@ void load_poshistory(void);
void save_poshistory(void); void save_poshistory(void);
int check_poshistory(const char *file, ssize_t *line, ssize_t *column); int check_poshistory(const char *file, ssize_t *line, ssize_t *column);
#endif #endif
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
void do_linter(void); void do_linter(void);
void set_lint_shortcuts(void); void set_lint_shortcuts(void);
void set_spell_shortcuts(void); void set_spell_shortcuts(void);
@ -552,7 +552,7 @@ int do_yesno_prompt(bool all, const char *msg);
void rcfile_error(const char *msg, ...); void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr); char *parse_next_word(char *ptr);
char *parse_argument(char *ptr); char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
char *parse_next_regex(char *ptr); char *parse_next_regex(char *ptr);
bool nregcomp(const char *regex, int eflags); bool nregcomp(const char *regex, int eflags);
void parse_syntax(char *ptr); void parse_syntax(char *ptr);
@ -564,7 +564,7 @@ void reset_multis(filestruct *fileptr, bool force);
void alloc_multidata_if_needed(filestruct *fileptr); void alloc_multidata_if_needed(filestruct *fileptr);
#endif #endif
void parse_rcfile(FILE *rcstream void parse_rcfile(FILE *rcstream
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
, bool syntax_only , bool syntax_only
#endif #endif
); );

View File

@ -109,14 +109,13 @@ static size_t lineno = 0;
/* If we did, the line number where the last error occurred. */ /* If we did, the line number where the last error occurred. */
static char *nanorc = NULL; static char *nanorc = NULL;
/* The path to the rcfile we're parsing. */ /* The path to the rcfile we're parsing. */
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
static syntaxtype *endsyntax = NULL; static syntaxtype *endsyntax = NULL;
/* The end of the list of syntaxes. */ /* The end of the list of syntaxes. */
static exttype *endheader = NULL; static exttype *endheader = NULL;
/* End of header list */ /* End of header list */
static colortype *endcolor = NULL; static colortype *endcolor = NULL;
/* The end of the color list for the current syntax. */ /* The end of the color list for the current syntax. */
#endif #endif
/* We have an error in some part of the rcfile. Print the error message /* We have an error in some part of the rcfile. Print the error message
@ -198,7 +197,7 @@ char *parse_argument(char *ptr)
return ptr; return ptr;
} }
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* Parse the next regex string from the line at ptr, and return it. */ /* Parse the next regex string from the line at ptr, and return it. */
char *parse_next_regex(char *ptr) char *parse_next_regex(char *ptr)
{ {
@ -376,7 +375,6 @@ void parse_syntax(char *ptr)
} else } else
free(newext); free(newext);
} }
} }
@ -447,7 +445,7 @@ void parse_magictype(char *ptr)
} }
#endif /* HAVE_LIBMAGIC */ #endif /* HAVE_LIBMAGIC */
} }
#endif /* ENABLE_COLOR */ #endif /* !DISABLE_COLOR */
int check_bad_binding(sc *s) int check_bad_binding(sc *s)
@ -619,7 +617,7 @@ void parse_unbinding(char *ptr)
} }
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* Read and parse additional syntax files. */ /* Read and parse additional syntax files. */
static void _parse_include(char *file) static void _parse_include(char *file)
{ {
@ -656,7 +654,7 @@ static void _parse_include(char *file)
#endif #endif
parse_rcfile(rcstream parse_rcfile(rcstream
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
, TRUE , TRUE
#endif #endif
); );
@ -952,7 +950,6 @@ void parse_headers(char *ptr)
endheader = newheader; endheader = newheader;
} else } else
free(newheader); free(newheader);
} }
} }
@ -982,12 +979,11 @@ void parse_linter(char *ptr)
else else
endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr); endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
} }
#endif /* ENABLE_COLOR */ #endif /* !DISABLE_COLOR */
/* Check whether the user has unmapped every shortcut for a /* Check whether the user has unmapped every shortcut for a
sequence we consider 'vital', like the exit function */ * sequence we consider 'vital', like the exit function. */
static void check_vitals_mapped(void) static void check_vitals_mapped(void)
{ {
subnfunc *f; subnfunc *f;
@ -1017,7 +1013,7 @@ static void check_vitals_mapped(void)
* and close it afterwards. If syntax_only is TRUE, only allow the file * and close it afterwards. If syntax_only is TRUE, only allow the file
* to contain color syntax commands: syntax, color, and icolor. */ * to contain color syntax commands: syntax, color, and icolor. */
void parse_rcfile(FILE *rcstream void parse_rcfile(FILE *rcstream
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
, bool syntax_only , bool syntax_only
#endif #endif
) )
@ -1025,7 +1021,7 @@ void parse_rcfile(FILE *rcstream
char *buf = NULL; char *buf = NULL;
ssize_t len; ssize_t len;
size_t n = 0; size_t n = 0;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
syntaxtype *end_syn_save = NULL; syntaxtype *end_syn_save = NULL;
#endif #endif
@ -1053,7 +1049,7 @@ void parse_rcfile(FILE *rcstream
ptr = parse_next_word(ptr); ptr = parse_next_word(ptr);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* Handle extending first... */ /* Handle extending first... */
if (strcasecmp(keyword, "extendsyntax") == 0) { if (strcasecmp(keyword, "extendsyntax") == 0) {
char *syntaxname = ptr; char *syntaxname = ptr;
@ -1078,7 +1074,7 @@ void parse_rcfile(FILE *rcstream
/* Try to parse the keyword. */ /* Try to parse the keyword. */
if (strcasecmp(keyword, "set") == 0) { if (strcasecmp(keyword, "set") == 0) {
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
if (syntax_only) if (syntax_only)
rcfile_error( rcfile_error(
N_("Command \"%s\" not allowed in included file"), N_("Command \"%s\" not allowed in included file"),
@ -1087,7 +1083,7 @@ void parse_rcfile(FILE *rcstream
#endif #endif
set = 1; set = 1;
} else if (strcasecmp(keyword, "unset") == 0) { } else if (strcasecmp(keyword, "unset") == 0) {
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
if (syntax_only) if (syntax_only)
rcfile_error( rcfile_error(
N_("Command \"%s\" not allowed in included file"), N_("Command \"%s\" not allowed in included file"),
@ -1096,7 +1092,7 @@ void parse_rcfile(FILE *rcstream
#endif #endif
set = -1; set = -1;
} }
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
else if (strcasecmp(keyword, "include") == 0) { else if (strcasecmp(keyword, "include") == 0) {
if (syntax_only) if (syntax_only)
rcfile_error( rcfile_error(
@ -1120,7 +1116,7 @@ void parse_rcfile(FILE *rcstream
parse_colors(ptr, TRUE); parse_colors(ptr, TRUE);
else if (strcasecmp(keyword, "linter") == 0) else if (strcasecmp(keyword, "linter") == 0)
parse_linter(ptr); parse_linter(ptr);
#endif /* ENABLE_COLOR */ #endif /* !DISABLE_COLOR */
else if (strcasecmp(keyword, "bind") == 0) else if (strcasecmp(keyword, "bind") == 0)
parse_keybinding(ptr); parse_keybinding(ptr);
else if (strcasecmp(keyword, "unbind") == 0) else if (strcasecmp(keyword, "unbind") == 0)
@ -1128,9 +1124,9 @@ void parse_rcfile(FILE *rcstream
else else
rcfile_error(N_("Command \"%s\" not understood"), keyword); rcfile_error(N_("Command \"%s\" not understood"), keyword);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* If we temporarily reset emdsyntax to allow extending, reset /* If we temporarily reset endsyntax to allow extending,
the value here */ * restore the value here. */
if (end_syn_save != NULL) { if (end_syn_save != NULL) {
endsyntax = end_syn_save; endsyntax = end_syn_save;
end_syn_save = NULL; end_syn_save = NULL;
@ -1295,7 +1291,7 @@ void parse_rcfile(FILE *rcstream
rcfile_error(N_("Unknown flag \"%s\""), option); rcfile_error(N_("Unknown flag \"%s\""), option);
} }
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
if (endsyntax != NULL && endcolor == NULL) if (endsyntax != NULL && endcolor == NULL)
rcfile_error(N_("Syntax \"%s\" has no color commands"), rcfile_error(N_("Syntax \"%s\" has no color commands"),
endsyntax->desc); endsyntax->desc);
@ -1335,7 +1331,7 @@ void do_rcfile(void)
rcstream = fopen(nanorc, "rb"); rcstream = fopen(nanorc, "rb");
if (rcstream != NULL) if (rcstream != NULL)
parse_rcfile(rcstream parse_rcfile(rcstream
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
, FALSE , FALSE
#endif #endif
); );
@ -1377,7 +1373,7 @@ void do_rcfile(void)
strerror(errno)); strerror(errno));
} else } else
parse_rcfile(rcstream parse_rcfile(rcstream
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
, FALSE , FALSE
#endif #endif
); );
@ -1394,7 +1390,7 @@ void do_rcfile(void)
; ;
} }
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
set_colorpairs(); set_colorpairs();
#endif #endif
} }

View File

@ -719,7 +719,7 @@ ssize_t do_replace_loop(
filepart = partition_filestruct(top, top_x, bot, bot_x); filepart = partition_filestruct(top, top_x, bot, bot_x);
openfile->edittop = openfile->fileage; openfile->edittop = openfile->fileage;
openfile->mark_set = FALSE; openfile->mark_set = FALSE;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
reset_multis(openfile->current, TRUE); reset_multis(openfile->current, TRUE);
#endif #endif
edit_refresh(); edit_refresh();
@ -866,12 +866,12 @@ ssize_t do_replace_loop(
free(openfile->current->data); free(openfile->current->data);
openfile->current->data = copy; openfile->current->data = copy;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
reset_multis(openfile->current, TRUE); reset_multis(openfile->current, TRUE);
#endif #endif
edit_refresh(); edit_refresh();
if (!replaceall) { if (!replaceall) {
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* If color syntaxes are available and turned on, we /* If color syntaxes are available and turned on, we
* need to call edit_refresh(). */ * need to call edit_refresh(). */
if (openfile->colorstrings != NULL && if (openfile->colorstrings != NULL &&

View File

@ -2976,7 +2976,7 @@ void do_spell(void)
} }
#endif /* !DISABLE_SPELLER */ #endif /* !DISABLE_SPELLER */
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* Run linter. Based on alt-speller code. Return NULL for normal /* Run linter. Based on alt-speller code. Return NULL for normal
* termination, and the error string otherwise. */ * termination, and the error string otherwise. */
void do_linter(void) void do_linter(void)
@ -3272,7 +3272,7 @@ void do_linter(void)
currmenu = MMAIN; currmenu = MMAIN;
display_main_list(); display_main_list();
} }
#endif /* ENABLE_COLOR */ #endif /* !DISABLE_COLOR */
#ifndef NANO_TINY #ifndef NANO_TINY
/* Our own version of "wc". Note that its character counts are in /* Our own version of "wc". Note that its character counts are in

View File

@ -546,7 +546,7 @@ void new_magicline(void)
openfile->filebot->next->prev = openfile->filebot; openfile->filebot->next->prev = openfile->filebot;
openfile->filebot->next->next = NULL; openfile->filebot->next->next = NULL;
openfile->filebot->next->lineno = openfile->filebot->lineno + 1; openfile->filebot->next->lineno = openfile->filebot->lineno + 1;
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
openfile->filebot->next->multidata = NULL; openfile->filebot->next->multidata = NULL;
#endif #endif
openfile->filebot = openfile->filebot->next; openfile->filebot = openfile->filebot->next;

View File

@ -2479,7 +2479,7 @@ void reset_cursor(void)
void edit_draw(filestruct *fileptr, const char *converted, int void edit_draw(filestruct *fileptr, const char *converted, int
line, size_t start) line, size_t start)
{ {
#if !defined(NANO_TINY) || defined(ENABLE_COLOR) #if !defined(NANO_TINY) || !defined(DISABLE_COLOR)
size_t startpos = actual_x(fileptr->data, start); size_t startpos = actual_x(fileptr->data, start);
/* The position in fileptr->data of the leftmost character /* The position in fileptr->data of the leftmost character
* that displays at least partially on the window. */ * that displays at least partially on the window. */
@ -2498,7 +2498,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
* just the text that needs it). */ * just the text that needs it). */
mvwaddstr(edit, line, 0, converted); mvwaddstr(edit, line, 0, converted);
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
/* If color syntaxes are available and turned on, we need to display /* If color syntaxes are available and turned on, we need to display
* them. */ * them. */
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) { if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
@ -2763,7 +2763,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
wattroff(edit, COLOR_PAIR(tmpcolor->pairnum)); wattroff(edit, COLOR_PAIR(tmpcolor->pairnum));
} }
} }
#endif /* ENABLE_COLOR */ #endif /* !DISABLE_COLOR */
#ifndef NANO_TINY #ifndef NANO_TINY
/* If the mark is on, we need to display it. */ /* If the mark is on, we need to display it. */
@ -3296,7 +3296,7 @@ void total_refresh(void)
* portion of the window. */ * portion of the window. */
void display_main_list(void) void display_main_list(void)
{ {
#ifdef ENABLE_COLOR #ifndef DISABLE_COLOR
if (openfile->syntax && openfile->syntax->linter) if (openfile->syntax && openfile->syntax->linter)
set_lint_shortcuts(); set_lint_shortcuts();
else else