Commit 00cc565d authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

move check_linenumbers(), dump_buffer(), and dump_buffer_reverse() from

winio.c to utils.c too


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3076 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 60 additions and 59 deletions
+60 -59
...@@ -11,13 +11,14 @@ CVS code - ...@@ -11,13 +11,14 @@ CVS code -
nanoget_repaint(), nanogetstr(), and statusq(). (DLR) nanoget_repaint(), nanogetstr(), and statusq(). (DLR)
- Since the statusbar prompt code needs at least 4 columns in - Since the statusbar prompt code needs at least 4 columns in
order to work properly, make that the minimum number of order to work properly, make that the minimum number of
columns nano requires to run, and remove assertions and code columns that nano requires in order to run, and remove
that make use of a smaller number. Changes to window_init(), assertions and code that make use of a smaller number of
nanoget_repaint(), titlebar(), statusbar(), and columns. Changes to window_init(), nanoget_repaint(),
get_page_start(). (DLR) titlebar(), statusbar(), and get_page_start(). (DLR)
- Move get_page_start(), xplustabs(), actual_x(), strnlenpt(), - Move get_page_start(), xplustabs(), actual_x(), strnlenpt(),
and strlenpt() from winio.c to utils.c, as they're really strlenpt(), check_linenumbers(), dump_buffer(), and
utility functions. (DLR) dump_buffer_reverse() from winio.c to utils.c, as they're
really utility functions. (DLR)
- Add missing stdio.h #include to winio.c. (DLR) - Add missing stdio.h #include to winio.c. (DLR)
- Move functions specific to the statusbar prompt to their own - Move functions specific to the statusbar prompt to their own
source file, adjust related variables accordingly, and rename source file, adjust related variables accordingly, and rename
......
...@@ -617,6 +617,13 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct ...@@ -617,6 +617,13 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up); **bot, size_t *bot_x, bool *right_side_up);
#endif #endif
size_t get_totsize(const filestruct *begin, const filestruct *end); size_t get_totsize(const filestruct *begin, const filestruct *end);
#ifndef NDEBUG
int check_linenumbers(const filestruct *fileptr);
#endif
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
/* Public functions in winio.c. */ /* Public functions in winio.c. */
#ifndef NANO_SMALL #ifndef NANO_SMALL
...@@ -689,13 +696,6 @@ void display_main_list(void); ...@@ -689,13 +696,6 @@ void display_main_list(void);
void do_cursorpos(bool constant); void do_cursorpos(bool constant);
void do_cursorpos_void(void); void do_cursorpos_void(void);
void do_replace_highlight(bool highlight, const char *word); void do_replace_highlight(bool highlight, const char *word);
#ifndef NDEBUG
int check_linenumbers(const filestruct *fileptr);
#endif
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
#ifdef NANO_EXTRA #ifdef NANO_EXTRA
void do_credits(void); void do_credits(void);
#endif #endif
......
...@@ -561,3 +561,49 @@ size_t get_totsize(const filestruct *begin, const filestruct *end) ...@@ -561,3 +561,49 @@ size_t get_totsize(const filestruct *begin, const filestruct *end)
return totsize; return totsize;
} }
#ifndef NDEBUG
/* Return what the current line number should be, starting at edittop
* and ending at fileptr. */
int check_linenumbers(const filestruct *fileptr)
{
int check_line = 0;
const filestruct *filetmp;
for (filetmp = openfile->edittop; filetmp != fileptr;
filetmp = filetmp->next)
check_line++;
return check_line;
}
#endif /* !NDEBUG */
#ifdef DEBUG
/* Dump the filestruct inptr to stderr. */
void dump_filestruct(const filestruct *inptr)
{
if (inptr == openfile->fileage)
fprintf(stderr, "Dumping file buffer to stderr...\n");
else if (inptr == cutbuffer)
fprintf(stderr, "Dumping cutbuffer to stderr...\n");
else
fprintf(stderr, "Dumping a buffer to stderr...\n");
while (inptr != NULL) {
fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data);
inptr = inptr->next;
}
}
/* Dump the current buffer's filestruct to stderr in reverse. */
void dump_filestruct_reverse(void)
{
const filestruct *fileptr = openfile->filebot;
while (fileptr != NULL) {
fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno,
fileptr->data);
fileptr = fileptr->prev;
}
}
#endif /* DEBUG */
...@@ -3090,52 +3090,6 @@ void do_replace_highlight(bool highlight, const char *word) ...@@ -3090,52 +3090,6 @@ void do_replace_highlight(bool highlight, const char *word)
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
} }
#ifndef NDEBUG
/* Return what the current line number should be, starting at edittop
* and ending at fileptr. */
int check_linenumbers(const filestruct *fileptr)
{
int check_line = 0;
const filestruct *filetmp;
for (filetmp = openfile->edittop; filetmp != fileptr;
filetmp = filetmp->next)
check_line++;
return check_line;
}
#endif /* !NDEBUG */
#ifdef DEBUG
/* Dump the filestruct inptr to stderr. */
void dump_filestruct(const filestruct *inptr)
{
if (inptr == openfile->fileage)
fprintf(stderr, "Dumping file buffer to stderr...\n");
else if (inptr == cutbuffer)
fprintf(stderr, "Dumping cutbuffer to stderr...\n");
else
fprintf(stderr, "Dumping a buffer to stderr...\n");
while (inptr != NULL) {
fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data);
inptr = inptr->next;
}
}
/* Dump the current buffer's filestruct to stderr in reverse. */
void dump_filestruct_reverse(void)
{
const filestruct *fileptr = openfile->filebot;
while (fileptr != NULL) {
fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno,
fileptr->data);
fileptr = fileptr->prev;
}
}
#endif /* DEBUG */
#ifdef NANO_EXTRA #ifdef NANO_EXTRA
#define CREDIT_LEN 54 #define CREDIT_LEN 54
#define XLCREDIT_LEN 8 #define XLCREDIT_LEN 8
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment