1/* $Id: proto.h,v 1.372 2007/01/11 21:36:29 dolorous Exp $ */ 2/************************************************************************** 3 * proto.h * 4 * * 5 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta * 6 * Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey * 7 * This program is free software; you can redistribute it and/or modify * 8 * it under the terms of the GNU General Public License as published by * 9 * the Free Software Foundation; either version 2, or (at your option) * 10 * any later version. * 11 * * 12 * This program is distributed in the hope that it will be useful, but * 13 * WITHOUT ANY WARRANTY; without even the implied warranty of * 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 15 * General Public License for more details. * 16 * * 17 * You should have received a copy of the GNU General Public License * 18 * along with this program; if not, write to the Free Software * 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 20 * 02110-1301, USA. * 21 * * 22 **************************************************************************/ 23 24#ifndef PROTO_H 25#define PROTO_H 1 26 27#include "nano.h" 28 29/* All external variables. See global.c for their descriptions. */ 30#ifndef NANO_TINY 31extern sigjmp_buf jump_buf; 32extern bool jump_buf_main; 33#endif 34 35#ifndef DISABLE_WRAPJUSTIFY 36extern ssize_t fill; 37extern ssize_t wrap_at; 38#endif 39 40extern char *last_search; 41extern char *last_replace; 42 43extern long flags; 44extern WINDOW *topwin; 45extern WINDOW *edit; 46extern WINDOW *bottomwin; 47extern int editwinrows; 48 49extern filestruct *cutbuffer; 50#ifndef DISABLE_JUSTIFY 51extern filestruct *jusbuffer; 52#endif 53extern partition *filepart; 54extern openfilestruct *openfile; 55 56#ifndef NANO_TINY 57extern char *matchbrackets; 58#endif 59 60#if !defined(NANO_TINY) && defined(ENABLE_NANORC) 61extern char *whitespace; 62extern int whitespace_len[2]; 63#endif 64 65#ifndef DISABLE_JUSTIFY 66extern char *punct; 67extern char *brackets; 68extern char *quotestr; 69#ifdef HAVE_REGEX_H 70extern regex_t quotereg; 71extern int quoterc; 72extern char *quoteerr; 73#else 74extern size_t quotelen; 75#endif 76#endif 77 78extern char *answer; 79 80extern ssize_t tabsize; 81 82#ifndef NANO_TINY 83extern char *backup_dir; 84#endif 85#ifndef DISABLE_OPERATINGDIR 86extern char *operating_dir; 87extern char *full_operating_dir; 88#endif 89 90#ifndef DISABLE_SPELLER 91extern char *alt_speller; 92#endif 93 94extern shortcut *main_list; 95extern shortcut *whereis_list; 96extern shortcut *replace_list; 97extern shortcut *replace_list_2; 98extern shortcut *gotoline_list; 99extern shortcut *writefile_list; 100extern shortcut *insertfile_list; 101#ifndef NANO_TINY 102extern shortcut *extcmd_list; 103#endif 104#ifndef DISABLE_HELP 105extern shortcut *help_list; 106#endif 107#ifndef DISABLE_SPELLER 108extern shortcut *spell_list; 109#endif 110#ifndef DISABLE_BROWSER 111extern shortcut *browser_list; 112extern shortcut *whereis_file_list; 113extern shortcut *gotodir_list; 114#endif 115 116#ifdef ENABLE_COLOR 117extern syntaxtype *syntaxes; 118extern char *syntaxstr; 119#endif 120 121extern const shortcut *currshortcut; 122#ifndef NANO_TINY 123extern toggle *toggles; 124#endif 125 126#ifndef NANO_TINY 127extern filestruct *search_history; 128extern filestruct *searchage; 129extern filestruct *searchbot; 130extern filestruct *replace_history; 131extern filestruct *replaceage; 132extern filestruct *replacebot; 133#endif 134 135#ifdef HAVE_REGEX_H 136extern regex_t search_regexp; 137extern regmatch_t regmatches[10]; 138#endif 139 140extern int reverse_attr; 141 142extern char *homedir; 143 144/* All functions in browser.c. */ 145#ifndef DISABLE_BROWSER 146char *do_browser(char *path, DIR *dir); 147char *do_browse_from(const char *inpath); 148void browser_init(const char *path, DIR *dir); 149void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key); 150void browser_refresh(void); 151bool browser_select_filename(const char *needle); 152int filesearch_init(void); 153bool findnextfile(bool no_sameline, size_t begin, const char *needle); 154void findnextfile_wrap_reset(void); 155void filesearch_abort(void); 156void do_filesearch(void); 157void do_fileresearch(void); 158void do_first_file(void); 159void do_last_file(void); 160char *striponedir(const char *path); 161#endif 162 163/* All functions in chars.c. */ 164#ifdef ENABLE_UTF8 165void utf8_init(void); 166bool using_utf8(void); 167#endif 168#ifndef HAVE_ISBLANK 169bool nisblank(int c); 170#endif 171#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8) 172bool niswblank(wchar_t wc); 173#endif 174bool is_byte(int c); 175bool is_alnum_mbchar(const char *c); 176bool is_blank_mbchar(const char *c); 177bool is_ascii_cntrl_char(int c); 178bool is_cntrl_char(int c); 179#ifdef ENABLE_UTF8 180bool is_cntrl_wchar(wchar_t wc); 181#endif 182bool is_cntrl_mbchar(const char *c); 183bool is_punct_mbchar(const char *c); 184bool is_word_mbchar(const char *c, bool allow_punct); 185char control_rep(char c); 186#ifdef ENABLE_UTF8 187wchar_t control_wrep(wchar_t c); 188#endif 189char *control_mbrep(const char *c, char *crep, int *crep_len); 190char *mbrep(const char *c, char *crep, int *crep_len); 191int mbwidth(const char *c); 192int mb_cur_max(void); 193char *make_mbchar(long chr, int *chr_mb_len); 194int parse_mbchar(const char *buf, char *chr, size_t *col); 195size_t move_mbleft(const char *buf, size_t pos); 196size_t move_mbright(const char *buf, size_t pos); 197#ifndef HAVE_STRCASECMP 198int nstrcasecmp(const char *s1, const char *s2); 199#endif 200int mbstrcasecmp(const char *s1, const char *s2); 201#ifndef HAVE_STRNCASECMP 202int nstrncasecmp(const char *s1, const char *s2, size_t n); 203#endif 204int mbstrncasecmp(const char *s1, const char *s2, size_t n); 205#ifndef HAVE_STRCASESTR 206const char *nstrcasestr(const char *haystack, const char *needle); 207#endif 208const char *mbstrcasestr(const char *haystack, const char *needle); 209#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP) 210const char *revstrstr(const char *haystack, const char *needle, const 211 char *rev_start); 212#endif 213#ifndef NANO_TINY 214const char *revstrcasestr(const char *haystack, const char *needle, 215 const char *rev_start); 216const char *mbrevstrcasestr(const char *haystack, const char *needle, 217 const char *rev_start); 218#endif 219size_t mbstrlen(const char *s); 220#ifndef HAVE_STRNLEN 221size_t nstrnlen(const char *s, size_t maxlen); 222#endif 223size_t mbstrnlen(const char *s, size_t maxlen); 224#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) 225char *mbstrchr(const char *s, const char *c); 226#endif 227#ifndef NANO_TINY 228char *mbstrpbrk(const char *s, const char *accept); 229char *revstrpbrk(const char *s, const char *accept, const char 230 *rev_start); 231char *mbrevstrpbrk(const char *s, const char *accept, const char 232 *rev_start); 233#endif 234#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)) 235bool has_blank_chars(const char *s); 236bool has_blank_mbchars(const char *s); 237#endif 238#ifdef ENABLE_UTF8 239bool is_valid_unicode(wchar_t wc); 240#endif 241#ifdef ENABLE_NANORC 242bool is_valid_mbstring(const char *s); 243#endif 244 245/* All functions in color.c. */ 246#ifdef ENABLE_COLOR 247void set_colorpairs(void); 248void color_init(void); 249void color_update(void); 250#endif 251 252/* All functions in cut.c. */ 253void cutbuffer_reset(void); 254void cut_line(void); 255#ifndef NANO_TINY 256void cut_marked(void); 257void cut_to_eol(void); 258void cut_to_eof(void); 259#endif 260void do_cut_text( 261#ifndef NANO_TINY 262 bool copy_text, bool cut_till_end 263#else 264 void 265#endif 266 ); 267void do_cut_text_void(void); 268#ifndef NANO_TINY 269void do_copy_text(void); 270void do_cut_till_end(void); 271#endif 272void do_uncut_text(void); 273 274/* All functions in files.c. */ 275void make_new_buffer(void); 276void initialize_buffer(void); 277void initialize_buffer_text(void); 278void open_buffer(const char *filename); 279#ifndef DISABLE_SPELLER 280void replace_buffer(const char *filename); 281#endif 282void display_buffer(void); 283#ifdef ENABLE_MULTIBUFFER 284void switch_to_prevnext_buffer(bool next); 285void switch_to_prev_buffer_void(void); 286void switch_to_next_buffer_void(void); 287bool close_buffer(void); 288#endif 289filestruct *read_line(char *buf, filestruct *prevnode, bool 290 *first_line_ins, size_t buf_len); 291void read_file(FILE *f, const char *filename); 292int open_file(const char *filename, bool newfie, FILE **f); 293char *get_next_filename(const char *name, const char *suffix); 294void do_insertfile( 295#ifndef NANO_TINY 296 bool execute 297#else 298 void 299#endif 300 ); 301void do_insertfile_void(void); 302char *get_full_path(const char *origpath); 303char *check_writable_directory(const char *path); 304char *safe_tempfile(FILE **f); 305#ifndef DISABLE_OPERATINGDIR 306void init_operating_dir(void); 307bool check_operating_dir(const char *currpath, bool allow_tabcomp); 308#endif 309#ifndef NANO_TINY 310void init_backup_dir(void); 311#endif 312int copy_file(FILE *inn, FILE *out); 313bool write_file(const char *name, FILE *f_open, bool tmp, append_type 314 append, bool nonamechange); 315#ifndef NANO_TINY 316bool write_marked_file(const char *name, FILE *f_open, bool tmp, 317 append_type append); 318#endif 319bool do_writeout(bool exiting); 320void do_writeout_void(void); 321char *real_dir_from_tilde(const char *buf); 322#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER) 323int diralphasort(const void *va, const void *vb); 324void free_chararray(char **array, size_t len); 325#endif 326#ifndef DISABLE_TABCOMP 327bool is_dir(const char *buf); 328char **username_tab_completion(const char *buf, size_t *num_matches, 329 size_t buflen); 330char **cwd_tab_completion(const char *buf, bool allow_files, size_t 331 *num_matches, size_t buflen); 332char *input_tab(char *buf, bool allow_files, size_t *place, bool 333 *lastwastab, void (*refresh_func)(void), bool *list); 334#endif 335const char *tail(const char *foo); 336#if !defined(NANO_TINY) && defined(ENABLE_NANORC) 337char *histfilename(void); 338void load_history(void); 339bool writehist(FILE *hist, filestruct *histhead); 340void save_history(void); 341#endif 342 343/* All functions in global.c. */ 344size_t length_of_list(const shortcut *s); 345#ifndef NANO_TINY 346void toggle_init_one(int val 347#ifndef DISABLE_HELP 348 , const char *desc, bool blank_after 349#endif 350 , long flag); 351void toggle_init(void); 352#endif 353void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc 354#ifndef DISABLE_HELP 355 , const char *help, bool blank_after 356#endif 357 , int metaval, int funcval, int miscval, bool view, void 358 (*func)(void)); 359void shortcut_init(bool unjustify); 360void free_shortcutage(shortcut **shortcutage); 361#ifdef DEBUG 362void thanks_for_all_the_fish(void); 363#endif 364 365/* All functions in help.c. */ 366#ifndef DISABLE_HELP 367void do_help(void (*refresh_func)(void)); 368void do_help_void(void); 369#ifndef DISABLE_BROWSER 370void do_browser_help(void); 371#endif 372void help_init(void); 373void parse_help_input(int *kbinput, bool *meta_key, bool *func_key); 374size_t help_line_len(const char *ptr); 375#endif 376 377/* All functions in move.c. */ 378void do_first_line(void); 379void do_last_line(void); 380void do_page_up(void); 381void do_page_down(void); 382#ifndef DISABLE_JUSTIFY 383void do_para_begin(bool allow_update); 384void do_para_begin_void(void); 385void do_para_end(bool allow_update); 386void do_para_end_void(void); 387#endif 388#ifndef NANO_TINY 389bool do_next_word(bool allow_punct, bool allow_update); 390void do_next_word_void(void); 391bool do_prev_word(bool allow_punct, bool allow_update); 392void do_prev_word_void(void); 393#endif 394void do_home(void); 395void do_end(void); 396void do_up( 397#ifndef NANO_TINY 398 bool scroll_only 399#else 400 void 401#endif 402 ); 403void do_up_void(void); 404#ifndef NANO_TINY 405void do_scroll_up(void); 406#endif 407void do_down( 408#ifndef NANO_TINY 409 bool scroll_only 410#else 411 void 412#endif 413 ); 414void do_down_void(void); 415#ifndef NANO_TINY 416void do_scroll_down(void); 417#endif 418void do_left(void); 419void do_right(void); 420 421/* All functions in nano.c. */ 422filestruct *make_new_node(filestruct *prevnode); 423filestruct *copy_node(const filestruct *src); 424void splice_node(filestruct *begin, filestruct *newnode, filestruct 425 *end); 426void unlink_node(const filestruct *fileptr); 427void delete_node(filestruct *fileptr); 428filestruct *copy_filestruct(const filestruct *src); 429void free_filestruct(filestruct *src); 430void renumber(filestruct *fileptr); 431partition *partition_filestruct(filestruct *top, size_t top_x, 432 filestruct *bot, size_t bot_x); 433void unpartition_filestruct(partition **p); 434void move_to_filestruct(filestruct **file_top, filestruct **file_bot, 435 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x); 436void copy_from_filestruct(filestruct *file_top, filestruct *file_bot); 437openfilestruct *make_new_opennode(void); 438void splice_opennode(openfilestruct *begin, openfilestruct *newnode, 439 openfilestruct *end); 440void unlink_opennode(openfilestruct *fileptr); 441void delete_opennode(openfilestruct *fileptr); 442#ifdef DEBUG 443void free_openfilestruct(openfilestruct *src); 444#endif 445void print_view_warning(void); 446void finish(void); 447void die(const char *msg, ...); 448void die_save_file(const char *die_filename); 449void window_init(void); 450#ifndef DISABLE_MOUSE 451void disable_mouse_support(void); 452void enable_mouse_support(void); 453void mouse_init(void); 454#endif 455void print_opt_full(const char *shortflag 456#ifdef HAVE_GETOPT_LONG 457 , const char *longflag 458#endif 459 , const char *desc); 460void usage(void); 461void version(void); 462int no_more_space(void); 463int no_help(void); 464void nano_disabled_msg(void); 465void do_exit(void); 466void signal_init(void); 467RETSIGTYPE handle_hupterm(int signal); 468RETSIGTYPE do_suspend(int signal); 469RETSIGTYPE do_continue(int signal); 470#ifndef NANO_TINY 471RETSIGTYPE handle_sigwinch(int signal); 472void allow_pending_sigwinch(bool allow); 473#endif 474#ifndef NANO_TINY 475void do_toggle(const toggle *which); 476#endif 477void disable_extended_io(void); 478void disable_signals(void); 479#ifndef NANO_TINY 480void enable_signals(void); 481#endif 482void disable_flow_control(void); 483void enable_flow_control(void); 484void terminal_init(void); 485int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool 486 *ran_func, bool *finished, bool allow_funcs); 487#ifndef DISABLE_MOUSE 488bool do_mouse(void); 489#endif 490void do_output(char *output, size_t output_len, bool allow_cntrls); 491 492/* All functions in prompt.c. */ 493int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t, 494 bool *ran_func, bool *finished, bool allow_funcs, void 495 (*refresh_func)(void)); 496#ifndef DISABLE_MOUSE 497bool do_statusbar_mouse(void); 498#endif 499void do_statusbar_output(char *output, size_t output_len, bool 500 *got_enter, bool allow_cntrls); 501void do_statusbar_home(void); 502void do_statusbar_end(void); 503void do_statusbar_left(void); 504void do_statusbar_right(void); 505void do_statusbar_backspace(void); 506void do_statusbar_delete(void); 507void do_statusbar_cut_text(void); 508#ifndef NANO_TINY 509bool do_statusbar_next_word(bool allow_punct); 510bool do_statusbar_prev_word(bool allow_punct); 511#endif 512void do_statusbar_verbatim_input(bool *got_enter); 513#ifndef NANO_TINY 514bool find_statusbar_bracket_match(bool reverse, const char 515 *bracket_set); 516void do_statusbar_find_bracket(void); 517#endif 518size_t statusbar_xplustabs(void); 519size_t get_statusbar_page_start(size_t start_col, size_t column); 520void reset_statusbar_cursor(void); 521void update_statusbar_line(const char *curranswer, size_t index); 522bool need_statusbar_horizontal_update(size_t pww_save); 523void total_statusbar_refresh(void (*refresh_func)(void)); 524int get_prompt_string(bool allow_tabs, 525#ifndef DISABLE_TABCOMP 526 bool allow_files, 527#endif 528 const char *curranswer, 529#ifndef NANO_TINY 530 filestruct **history_list, 531#endif 532 void (*refresh_func)(void), const shortcut *s 533#ifndef DISABLE_TABCOMP 534 , bool *list 535#endif 536 ); 537int do_prompt(bool allow_tabs, 538#ifndef DISABLE_TABCOMP 539 bool allow_files, 540#endif 541 const shortcut *s, const char *curranswer, 542#ifndef NANO_TINY 543 filestruct **history_list, 544#endif 545 void (*refresh_func)(void), const char *msg, ...); 546void do_prompt_abort(void); 547int do_yesno_prompt(bool all, const char *msg); 548 549/* All functions in rcfile.c. */ 550#ifdef ENABLE_NANORC 551void rcfile_error(const char *msg, ...); 552char *parse_next_word(char *ptr); 553char *parse_argument(char *ptr); 554#ifdef ENABLE_COLOR 555char *parse_next_regex(char *ptr); 556bool nregcomp(const char *regex, int eflags); 557void parse_syntax(char *ptr); 558void parse_include(char *ptr); 559short color_to_short(const char *colorname, bool *bright); 560void parse_colors(char *ptr, bool icase); 561#endif 562void parse_rcfile(FILE *rcstream 563#ifdef ENABLE_COLOR 564 , bool syntax_only 565#endif 566 ); 567void do_rcfile(void); 568#endif 569 570/* All functions in search.c. */ 571#ifdef HAVE_REGEX_H 572bool regexp_init(const char *regexp); 573void regexp_cleanup(void); 574#endif 575void not_found_msg(const char *str); 576void search_replace_abort(void); 577void search_init_globals(void); 578int search_init(bool replacing, bool use_answer); 579bool findnextstr( 580#ifndef DISABLE_SPELLER 581 bool whole_word, 582#endif 583 bool no_sameline, const filestruct *begin, size_t begin_x, const 584 char *needle, size_t *needle_len); 585void findnextstr_wrap_reset(void); 586void do_search(void); 587#ifndef NANO_TINY 588void do_research(void); 589#endif 590#ifdef HAVE_REGEX_H 591int replace_regexp(char *string, bool create); 592#endif 593char *replace_line(const char *needle); 594ssize_t do_replace_loop( 595#ifndef DISABLE_SPELLER 596 bool whole_word, 597#endif 598 bool *canceled, const filestruct *real_current, size_t 599 *real_current_x, const char *needle); 600void do_replace(void); 601void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, 602 bool interactive, bool save_pos, bool allow_update); 603void do_gotolinecolumn_void(void); 604#ifndef DISABLE_SPELLER 605void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t 606 pos_pww); 607#endif 608#ifndef NANO_TINY 609bool find_bracket_match(bool reverse, const char *bracket_set); 610void do_find_bracket(void); 611#ifdef ENABLE_NANORC 612bool history_has_changed(void); 613#endif 614void history_init(void); 615void history_reset(const filestruct *h); 616filestruct *find_history(const filestruct *h_start, const filestruct 617 *h_end, const char *s, size_t len); 618void update_history(filestruct **h, const char *s); 619char *get_history_older(filestruct **h); 620char *get_history_newer(filestruct **h); 621#ifndef DISABLE_TABCOMP 622char *get_history_completion(filestruct **h, const char *s, size_t len); 623#endif 624#endif 625 626/* All functions in text.c. */ 627#ifndef NANO_TINY 628void do_mark(void); 629#endif 630void do_delete(void); 631void do_backspace(void); 632void do_tab(void); 633#ifndef NANO_TINY 634void do_indent(ssize_t cols); 635void do_indent_void(void); 636void do_unindent(void); 637#endif 638void do_enter(void); 639#ifndef NANO_TINY 640RETSIGTYPE cancel_command(int signal); 641bool execute_command(const char *command); 642#endif 643#ifndef DISABLE_WRAPPING 644void wrap_reset(void); 645bool do_wrap(filestruct *line); 646#endif 647#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY) 648ssize_t break_line(const char *line, ssize_t goal 649#ifndef DISABLE_HELP 650 , bool newline 651#endif 652 ); 653#endif 654#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) 655size_t indent_length(const char *line); 656#endif 657#ifndef DISABLE_JUSTIFY 658void justify_format(filestruct *paragraph, size_t skip); 659size_t quote_length(const char *line); 660bool quotes_match(const char *a_line, size_t a_quote, const char 661 *b_line); 662bool indents_match(const char *a_line, size_t a_indent, const char 663 *b_line, size_t b_indent); 664bool begpar(const filestruct *const foo); 665bool inpar(const filestruct *const foo); 666void backup_lines(filestruct *first_line, size_t par_len); 667bool find_paragraph(size_t *const quote, size_t *const par); 668void do_justify(bool full_justify); 669void do_justify_void(void); 670void do_full_justify(void); 671#endif 672#ifndef DISABLE_SPELLER 673bool do_int_spell_fix(const char *word); 674const char *do_int_speller(const char *tempfile_name); 675const char *do_alt_speller(char *tempfile_name); 676void do_spell(void); 677#endif 678#ifndef NANO_TINY 679void do_wordlinechar_count(void); 680#endif 681void do_verbatim_input(void); 682 683/* All functions in utils.c. */ 684int digits(size_t n); 685void get_homedir(void); 686bool parse_num(const char *str, ssize_t *val); 687bool parse_line_column(const char *str, ssize_t *line, ssize_t *column); 688void align(char **str); 689void null_at(char **data, size_t index); 690void unsunder(char *str, size_t true_len); 691void sunder(char *str); 692#if !defined(NANO_TINY) && defined(ENABLE_NANORC) 693#ifndef HAVE_GETLINE 694ssize_t ngetline(char **lineptr, size_t *n, FILE *stream); 695#endif 696#ifndef HAVE_GETDELIM 697ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream); 698#endif 699#endif 700#ifdef HAVE_REGEX_H 701bool regexp_bol_or_eol(const regex_t *preg, const char *string); 702#endif 703#ifndef DISABLE_SPELLER 704bool is_whole_word(size_t pos, const char *buf, const char *word); 705#endif 706const char *strstrwrapper(const char *haystack, const char *needle, 707 const char *start); 708void nperror(const char *s); 709void *nmalloc(size_t howmuch); 710void *nrealloc(void *ptr, size_t howmuch); 711char *mallocstrncpy(char *dest, const char *src, size_t n); 712char *mallocstrcpy(char *dest, const char *src); 713char *mallocstrassn(char *dest, char *src); 714size_t get_page_start(size_t column); 715size_t xplustabs(void); 716size_t actual_x(const char *s, size_t column); 717size_t strnlenpt(const char *s, size_t maxlen); 718size_t strlenpt(const char *s); 719void new_magicline(void); 720#ifndef NANO_TINY 721void remove_magicline(void); 722void mark_order(const filestruct **top, size_t *top_x, const filestruct 723 **bot, size_t *bot_x, bool *right_side_up); 724#endif 725size_t get_totsize(const filestruct *begin, const filestruct *end); 726#ifdef DEBUG 727void dump_filestruct(const filestruct *inptr); 728void dump_filestruct_reverse(void); 729#endif 730 731/* All functions in winio.c. */ 732void get_key_buffer(WINDOW *win); 733size_t get_key_buffer_len(void); 734void unget_input(int *input, size_t input_len); 735void unget_kbinput(int kbinput, bool meta_key, bool func_key); 736int *get_input(WINDOW *win, size_t input_len); 737int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key); 738int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key); 739int get_escape_seq_kbinput(const int *seq, size_t seq_len); 740int get_escape_seq_abcd(int kbinput); 741int parse_escape_seq_kbinput(WINDOW *win, int kbinput); 742int get_byte_kbinput(int kbinput); 743#ifdef ENABLE_UTF8 744long add_unicode_digit(int kbinput, long factor, long *uni); 745long get_unicode_kbinput(int kbinput); 746#endif 747int get_control_kbinput(int kbinput); 748void unparse_kbinput(char *output, size_t output_len); 749int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); 750int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); 751#ifndef DISABLE_MOUSE 752bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts); 753#endif 754const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool 755 *meta_key, bool *func_key); 756#ifndef NANO_TINY 757const toggle *get_toggle(int kbinput, bool meta_key); 758#endif 759void blank_line(WINDOW *win, int y, int x, int n); 760void blank_titlebar(void); 761void blank_topbar(void); 762void blank_edit(void); 763void blank_statusbar(void); 764void blank_bottombars(void); 765void check_statusblank(void); 766char *display_string(const char *buf, size_t start_col, size_t len, bool 767 dollars); 768void titlebar(const char *path); 769void set_modified(void); 770void statusbar(const char *msg, ...); 771void bottombars(const shortcut *s); 772void onekey(const char *keystroke, const char *desc, size_t len); 773void reset_cursor(void); 774void edit_draw(const filestruct *fileptr, const char *converted, int 775 line, size_t start); 776void update_line(const filestruct *fileptr, size_t index); 777bool need_horizontal_update(size_t pww_save); 778bool need_vertical_update(size_t pww_save); 779void edit_scroll(scroll_dir direction, ssize_t nlines); 780void edit_redraw(const filestruct *old_current, size_t pww_save); 781void edit_refresh(void); 782void edit_update(update_type location); 783void total_redraw(void); 784void total_refresh(void); 785void display_main_list(void); 786void do_cursorpos(bool constant); 787void do_cursorpos_void(void); 788void do_replace_highlight(bool highlight, const char *word); 789#ifdef NANO_EXTRA 790void do_credits(void); 791#endif 792 793#endif /* !PROTO_H */ 794