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
master
David Lawrence Ramsey 2005-11-02 15:44:01 +00:00
parent 305c6459e9
commit 00cc565ddd
4 changed files with 60 additions and 59 deletions

View File

@ -11,13 +11,14 @@ CVS code -
nanoget_repaint(), nanogetstr(), and statusq(). (DLR)
- Since the statusbar prompt code needs at least 4 columns in
order to work properly, make that the minimum number of
columns nano requires to run, and remove assertions and code
that make use of a smaller number. Changes to window_init(),
nanoget_repaint(), titlebar(), statusbar(), and
get_page_start(). (DLR)
columns that nano requires in order to run, and remove
assertions and code that make use of a smaller number of
columns. Changes to window_init(), nanoget_repaint(),
titlebar(), statusbar(), and get_page_start(). (DLR)
- Move get_page_start(), xplustabs(), actual_x(), strnlenpt(),
and strlenpt() from winio.c to utils.c, as they're really
utility functions. (DLR)
strlenpt(), check_linenumbers(), dump_buffer(), and
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)
- Move functions specific to the statusbar prompt to their own
source file, adjust related variables accordingly, and rename

View File

@ -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);
#endif
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. */
#ifndef NANO_SMALL
@ -689,13 +696,6 @@ void display_main_list(void);
void do_cursorpos(bool constant);
void do_cursorpos_void(void);
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
void do_credits(void);
#endif

View File

@ -561,3 +561,49 @@ size_t get_totsize(const filestruct *begin, const filestruct *end)
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 */

View File

@ -3090,52 +3090,6 @@ void do_replace_highlight(bool highlight, const char *word)
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
#define CREDIT_LEN 54
#define XLCREDIT_LEN 8