1 /***************************************************************************\ 2 mined text editor main include file 3 \***************************************************************************/ 4 5 #include "_proto.h" 6 7 #define _FLAG_H 8 9 10 /***************************************************************************\ 11 system environment configuration 12 \***************************************************************************/ 13 14 /* MSDOS basic configuration */ 15 #ifdef __MSDOS__ 16 17 #undef unix /* needed for djgcc! */ 18 #define msdos 19 #define pc 20 #define pc_term 21 22 # ifndef __TURBOC__ 23 # define __GCC__ 24 25 # ifdef __strange__ 26 # undef msdos /* in this weird case, a more specific distinction */ 27 # define unix /* has to be made everywhere according to the 'pc' flag */ 28 # endif 29 # endif 30 #endif 31 32 33 /* system options */ 34 #ifdef _AIX 35 #define _XOPEN_SOURCE_EXTENDED 1 36 #define _POSIX_SOURCE 37 #include <sys/access.h> 38 #endif 39 40 #ifdef __QNX__ 41 /* prototypes getpwuid, ttyname */ 42 #define _POSIX_SOURCE 43 #endif 44 45 #ifdef __minix 46 #define stat _stat 47 #define fstat _fstat 48 #define errprintf(msg, par) {char errbuf [maxMSGlen]; sprintf (errbuf, msg, par); write (2, errbuf, strlen (errbuf));} 49 #else 50 #define errprintf(msg, par) fprintf (stderr, msg, par) 51 #endif 52 53 54 /* common includes */ 55 #include <stdlib.h> 56 #include <stdio.h> 57 #include <string.h> 58 #if defined (__TURBOC__) || defined (VAXC) 59 # ifdef __TURBOC__ 60 # define off_t long 61 # endif 62 #else 63 #define __USE_XOPEN_EXTENDED 64 #include <unistd.h> 65 #endif 66 67 68 /* PC includes and declarations */ 69 #ifdef __MINGW32__ 70 #warning [41m mined does not compile with the MinGW compiler - use the MSYS compiler instead [0m 71 #warning [41m see COMPILE.DOC for details [0m 72 #endif 73 74 #ifdef __MINGW32__ 75 /*#define sleep _sleep - this is __MINGW_ATTRIB_DEPRECATED*/ 76 #define sleep(n) usleep ((unsigned long) n * 1000000) 77 #endif 78 79 #ifdef __MINGW32__ 80 #define mkdir__ mkdir 81 #define mkdir(f, m) mkdir__(f) 82 #endif 83 84 #ifdef msdos 85 extern void delay (); 86 extern void exit (); 87 88 #include <io.h> /* this is not "io.h" */ 89 # undef putchar 90 # include <fcntl.h> 91 92 extern char * getenv (); 93 extern char * getcwd (); 94 95 #ifdef __TURBOC__ 96 extern int setdisk (); 97 extern void sleep (); 98 #define time_t unsigned long 99 #endif 100 101 #endif /* msdos */ 102 103 104 /* VMS includes and declarations */ 105 #ifdef vms 106 # include <unixio.h> 107 # include <file.h> /* for the O_... attributes to open () */ 108 # include <unixlib.h> 109 # undef putchar 110 # undef FALSE 111 # undef TRUE 112 # define use_usleep 113 #endif 114 115 116 /* Unix and terminal I/O defines */ 117 #ifdef TERMIO 118 #ifndef sysV 119 # define sysV 120 #endif 121 #endif 122 123 #ifdef sysV 124 #ifndef unix 125 # define unix 126 #endif 127 /* # define TERMIO ? */ 128 #endif 129 130 131 /* Unix includes and defines */ 132 #ifdef unix 133 134 # include <fcntl.h> 135 # undef putchar 136 137 # ifdef sysV 138 extern char * getcwd (); 139 # else 140 extern char * getwd (); 141 # endif 142 143 extern void exit (); 144 extern char * getenv (); 145 /*extern int printf ();*/ 146 147 #ifdef __GCC__ 148 #include <sys/types.h> 149 #endif 150 151 #ifdef _CLASSIC_ID_TYPES 152 /* HP, AIX, IRIX */ 153 #define pid_t int 154 #endif 155 156 #ifdef __sgi 157 /* IRIX: no vfork */ 158 #define FORK 159 #endif 160 161 #ifdef DEFVFORK 162 /* already declared in <unistd.h> */ 163 extern pid_t vfork (); 164 #endif 165 166 #ifdef __CYGWIN__ 167 extern pid_t vfork (); 168 #endif 169 170 extern pid_t wait (); 171 172 extern int select (); 173 #ifndef __MINGW32__ 174 extern unsigned int sleep (); 175 #endif 176 #ifdef use_usleep 177 extern unsigned int usleep (); 178 #endif 179 180 #endif /* unix */ 181 182 183 /* PC-specific defines */ 184 #ifdef __CYGWIN__ 185 #define __pcgcc__ 186 #undef pc_term 187 #endif 188 #ifdef __MSDOS__ 189 #define __pcgcc__ 190 #endif 191 #ifdef __pcgcc__ 192 #define PROT int 193 #endif 194 195 196 #ifndef PROT 197 #define PROT unsigned int 198 #endif 199 200 201 /* this is again unused since it broke compilation on SunOS 5.10 */ 202 #ifdef __GNUC__ 203 #define __unused__ __attribute__((unused)) 204 #else 205 #define __unused__ 206 #endif 207 208 209 /* missing definitions */ 210 #ifndef O_BINARY 211 #define O_BINARY 0 212 #endif 213 214 #ifndef F_OK 215 #define F_OK 0 216 #endif 217 #ifndef X_OK 218 #define X_OK 1 219 #endif 220 #ifndef W_OK 221 #define W_OK 2 222 #endif 223 224 225 /***************************************************************************\ 226 declaration of system functions 227 \***************************************************************************/ 228 229 #ifdef define_read_write /* don't define to be compatible */ 230 extern int write (); 231 extern int read (); 232 extern ssize_t write (); /* but how do I find out if */ 233 extern ssize_t read (); /* ssize_t is defined on a system? */ 234 #endif 235 extern int access (); 236 /*extern int open ();*/ 237 extern int close (); 238 /*extern int creat ();*/ 239 /*extern int chdir ();*/ 240 extern int system (); 241 extern int isatty (); 242 #ifndef strcmp 243 extern int strcmp (); 244 #endif 245 246 247 /***************************************************************************\ 248 declaration of types, basic macros, and constants 249 \***************************************************************************/ 250 251 #define arrlen(arr) (sizeof (arr) / sizeof (* arr)) 252 253 typedef unsigned char character; 254 255 256 /* Screen size and display definitions. Coordinates start at 0, 0 */ 257 extern int YMAX; 258 extern int XMAX; 259 extern short MENU; 260 #define SCREENMAX (YMAX - 1) /* last line displayed (first is 0) */ 261 #define XBREAK (XMAX - scrollbar_width) /* Shift line display at this column */ 262 #define XBREAK_bottom (XMAX - 1) 263 #define SHIFT_SIZE (tab8 (XMAX / 4 + 1)) /* Number of chars to shift */ 264 265 /* Adjust buffer sizes, align with typical max screen width 266 screen size 1600x1200 267 font size 5x7: 172 x 319 268 font size 4x6: 200 x 399 269 screen size 2560x1600 (WQXGA+) 270 font size 4x6: 267 x 639 271 Restrain to reasonable size assumption (esp. @ reasonable font size), 272 so prompt line buffer stays @ reasonable size < maxLINElen, 273 so let maxXMAX < maxLINElen / 3 274 */ 275 #define maxXMAX 638 276 #define maxPROMPTlen (maxXMAX + 1) /* limit prompt to max screen width */ 277 #define maxFILENAMElen maxPROMPTlen 278 #define maxCMDlen 2 * maxPROMPTlen + 9 279 280 #define maxLINElen 1024 /* max chars on one line of text */ 281 #define maxMSGlen maxLINElen 282 283 /* pseudo x coordinates to indicate positioning to start/end of line */ 284 /* LINE_START must be rounded up to the lowest SHIFT_SIZE */ 285 #define LINE_START (((-maxLINElen - 1) / SHIFT_SIZE) * SHIFT_SIZE - SHIFT_SIZE) 286 /* LINE_END must be larger than highest x-coordinate for line; 287 considering wide characters ands TABs */ 288 #define LINE_END (maxLINElen * 8) 289 290 291 /* Return values of functions */ 292 #define ERRORS -1 293 #define NO_LINE (ERRORS - 1) /* Must be < 0 */ 294 #define NUL_LINE (ERRORS - 2) /* Must be < 0 */ 295 #define SPLIT_LINE (ERRORS - 3) /* Must be < 0 */ 296 #define FINE 0 297 #define NO_INPUT (FINE + 1) 298 299 #define STD_IN 0 /* Input file # */ 300 #define STD_OUT 1 /* Terminal output file # */ 301 #define STD_ERR 2 302 303 #define REPORT_CHANGED_LINES 1 /* Report change of lines on # lines */ 304 305 /* 306 * mouse button selection 307 */ 308 typedef enum { 309 releasebutton, 310 leftbutton, middlebutton, rightbutton, 311 movebutton, 312 wheelup, wheeldown, 313 focusout, focusin 314 } mousebutton_type; 315 316 #define shift_button 4 317 #define alt_button 8 318 #define control_button 16 319 320 /* 321 * Common enum type for all flags used in mined. 322 */ 323 typedef enum { 324 /* General flags */ 325 False, 326 True, 327 328 /* yank_status and other */ 329 NOT_VALID, 330 VALID, 331 332 /* expression flags */ 333 FORWARD, 334 REVERSE, 335 336 /* yank flags */ 337 SMALLER, 338 BIGGER, 339 SAME, 340 NO_DELETE, 341 DELETE, 342 READ, 343 WRITE, 344 345 /* smart quotes state */ 346 UNSURE, 347 OPEN 348 } FLAG; 349 350 typedef enum {LEFTDOUBLE, RIGHTDOUBLE, LEFTSINGLE, RIGHTSINGLE} quoteposition_type; 351 352 #ifdef VAXC 353 /* prevent %CC-E-INVOPERAND */ 354 #define FLAG unsigned char 355 #endif 356 357 /* 358 line end definitions 359 */ 360 typedef unsigned char lineend_type; 361 #define lineend_NUL '\0' 362 #define lineend_NONE ' ' 363 #define lineend_LF '\n' 364 #define lineend_CRLF '\r' 365 #define lineend_CR 'R' 366 #define lineend_NL1 'n' /* ISO 8859 NEXT LINE byte 0x85 */ 367 #define lineend_NL2 'N' /* Unicode NEXT LINE U+0085 */ 368 #define lineend_LS 'L' /* Unicode line separator U+2028 */ 369 #define lineend_PS 'P' /* Unicode paragraph separator U+2029 */ 370 371 /* 372 * The Line structure. Each line entry contains a pointer to the next line, 373 * a pointer to the previous line, a pointer to the text and an unsigned char 374 * telling at which offset of the line printing should start (usually 0). 375 */ 376 struct Line { 377 struct Line * next; 378 struct Line * prev; 379 char * text; 380 char * sel_begin; /* beginning pos of selection, or NIL if none */ 381 char * sel_end; /* end pos of selection, or NIL if beyond line */ 382 unsigned short shift_count; /* horizontal display shifting */ 383 lineend_type return_type; 384 character syntax_mask; /* bitmask composed of display flags below */ 385 FLAG dirty; /* flag that display attributes have changed */ 386 FLAG allocated; 387 }; 388 /* display flags for struct Line */ 389 #define syntax_unknown 0xFF 390 #define syntax_none 0x00 391 #define syntax_HTML 0x01 392 #define syntax_JSP 0x02 393 #define syntax_PHP 0x04 394 #define syntax_scripting (syntax_JSP | syntax_PHP) 395 #define syntax_comment 0x08 396 #define syntax_attrib 0x10 397 #define syntax_value 0x20 398 399 typedef struct Line LINE; 400 401 /* 402 * For casting functions with int/void results 403 */ 404 typedef void (* voidfunc) (); 405 typedef int (* intfunc) (); 406 407 /* NULL definitions */ 408 #define NIL_PTR ((char *) 0) 409 #define NIL_LINE ((LINE *) 0) 410 411 412 #define dont_use_ebcdic_text /* use ebcdic_file with transformation */ 413 414 415 /***************************************************************************\ 416 variable declarations 417 \***************************************************************************/ 418 419 extern char * debug_mined; /* Debug indicator and optional flags */ 420 421 extern int total_lines; /* Number of lines in file */ 422 extern long total_chars; /* Number of characters in file */ 423 extern LINE * header; /* Head of line list */ 424 extern LINE * tail; /* Last line in line list */ 425 extern LINE * top_line; /* First line of screen */ 426 extern LINE * bot_line; /* Last line of screen */ 427 extern LINE * cur_line; /* Current line in use */ 428 extern char * cur_text; /* Pointer to char on current line in use */ 429 extern int last_y; /* Last y of screen, usually SCREENMAX */ 430 extern int line_number; /* current line # determined by file_status */ 431 extern int lines_per_page; /* assumption for file_status */ 432 433 extern int x, y; /* x, y coordinates on screen */ 434 435 extern FLAG use_file_tabs; 436 #define viewonly (viewonly_mode || viewonly_locked || viewonly_err) 437 extern FLAG viewonly_mode; /* Set when view only mode is selected */ 438 extern FLAG viewonly_locked; /* Enforced view only status */ 439 extern FLAG viewonly_err; /* Error view only status */ 440 extern FLAG modified; /* Set when file is modified */ 441 extern FLAG restricted; /* Set when restricted mode is selected */ 442 extern FLAG quit; /* Set on SIGQUIT or quit character typed */ 443 extern FLAG winchg; /* Set when the window size changes */ 444 extern FLAG interrupted; /* Set when a signal interrupts */ 445 extern FLAG waitingforinput; /* Set while waiting for the next command key */ 446 extern FLAG isscreenmode; /* Set when screen mode is on */ 447 extern char text_buffer [maxLINElen]; /* Buffer for modifying text */ 448 449 extern char * minedprog; /* store argv [0] for help invocation */ 450 extern char file_name []; /* name of file being edited */ 451 extern FLAG writable; /* Set if file cannot be written */ 452 extern FLAG file_is_dir; /* Tried to open a directory as file? */ 453 extern FLAG file_is_dev; /* Tried to open a char/block device file? */ 454 extern FLAG file_is_fifo; /* Read from a named pipe? */ 455 extern FLAG reading_pipe; /* Set if file should be read from stdin */ 456 extern FLAG writing_pipe; /* Set if file should be written to stdout */ 457 458 extern PROT xprot; /* actual prot. mask representing +x option */ 459 extern PROT fprot0; /* default prot. mode for new files */ 460 extern PROT fprot1; /* prot. mode for new file being edited */ 461 extern PROT bufprot; /* prot. mode for paste buffer file */ 462 463 #if defined (unix) || defined (ANSI) 464 extern char * title_string_pattern; 465 #endif 466 467 extern char yank_file []; /* Temp. file for buffer */ 468 extern char yankie_file []; /* Temp. file for inter-window buffer */ 469 extern char spool_file []; /* Temp. file for printing */ 470 extern char html_file []; /* Temp. file for HTML embedding buffer */ 471 extern char panic_file []; /* file for panic-write-back */ 472 extern FLAG yank_status; /* Status of yank_file */ 473 extern FLAG redraw_pending; /* was a redraw suppressed in find_y ? */ 474 extern long chars_saved; /* # of chars saved in paste buffer */ 475 extern long bytes_saved; /* # of bytes saved in paste buffer */ 476 extern int lines_saved; /* # of lines saved in paste buffer */ 477 478 extern int hop_flag; /* set to 2 by HOP key function */ 479 extern int hop_flag_displayed; 480 extern int buffer_open_flag; /* counter flag for the collective buffer */ 481 extern int JUSlevel; /* keep justified while typing? */ 482 extern int JUSmode; /* 1: paragraphs end at empty line */ 483 extern FLAG autoindent; /* auto indent on input of Enter? */ 484 extern FLAG autonumber; /* Auto numbering on input of Enter? */ 485 extern FLAG backnumber; /* Auto-undent numbering on input of BS? */ 486 extern FLAG backincrem; /* Auto-increment numbering on input of BS? */ 487 extern FLAG lowcapstrop; /* capitalize letter symbols on input? */ 488 extern FLAG dispunstrop; /* display stropped letters in bold? */ 489 extern FLAG strop_selected; /* was stropping explictly selected? */ 490 extern char strop_style; /* bold/underline? */ 491 extern FLAG mark_HTML; /* display HTML marked ? */ 492 extern FLAG mark_JSP; /* Display JSP marked ? */ 493 extern FLAG viewing_help; 494 495 /* emulation and keyboard assignment flags */ 496 extern char emulation; /* 'w' for WordStar, 'e' for emacs */ 497 extern char keypad_mode; /* 'm'ined, 'S'hift-select, 'w'indows */ 498 extern FLAG shift_selection; /* selection highlighting on shift-cursor */ 499 #define apply_shift_selection (shift_selection && (shift_selection == True || (keyshift & shift_mask))) 500 extern FLAG mined_keypad; /* Apply mined keypad assignments */ 501 extern FLAG home_selection; /* numeric keypad Home/End forced to Mark/Copy */ 502 extern FLAG small_home_selection; /* small keypad Home/End: Mark/Copy */ 503 extern FLAG emacs_buffer; /* enable emacs buffer fct for ^K/^T */ 504 extern FLAG paste_stay_left; /* cursor stays before pasted region */ 505 extern FLAG tab_left; /* should moving up/down on TAB go left? */ 506 extern FLAG tab_right; /* should moving up/down on TAB go right? */ 507 extern FLAG plain_BS; /* prefer BS to perform plain rather than smart? */ 508 509 extern FLAG append_flag; /* Set when buffer should be appended to */ 510 extern FLAG pastebuf_utf8; /* Paste buffer always treated as UTF-8? */ 511 extern FLAG rectangular_paste_flag; /* Copy/Paste rectangular area? */ 512 extern FLAG visselect_key; /* Visual selection on unmodified cursor key? */ 513 extern FLAG visselect_anymouse; /* Visual selection on any mouse move? */ 514 extern FLAG visselect_keeponsearch; /* Keep visual selection on search ? */ 515 extern FLAG visselect_setonfind; /* Select search result? */ 516 extern FLAG visselect_autocopy; /* Auto-copy selection? */ 517 extern FLAG visselect_copydeselect; /* Deselect on copy? */ 518 extern FLAG visselect_autodelete; /* Delete selection on insert? */ 519 520 extern FLAG insert_mode; /* insert or overwrite */ 521 522 extern char backup_mode; /* none, simple, numbered (e/v), automatic */ 523 extern char * backup_directory; /* directory name for backup files */ 524 extern char * recover_directory; /* directory name for recovery files */ 525 extern character erase_char; /* effective (configured) char for erase left */ 526 extern FLAG prefer_comspec; /* for ESC ! command */ 527 extern character quit_char; /* ^\/^G character to cancel command */ 528 extern FLAG smart_quotes; /* replace " with typographic quote ? */ 529 530 extern FLAG suppress_unknown_cjk; /* on CJK terminal if no Unicode mapping */ 531 extern FLAG suppress_extended_cjk; /* on CJK terminal if in extended code range */ 532 extern FLAG suppress_invalid_cjk; /* on CJK terminal if invalid CJK code */ 533 extern FLAG suppress_surrogates; /* suppress display of single Unicode surrogates */ 534 extern FLAG suppress_non_BMP; /* suppress display of non-BMP range */ 535 extern FLAG suppress_EF; /* suppress display of 0x*FFFE/F codes */ 536 extern FLAG suppress_non_Unicode; /* suppress display of non-Unicode codes */ 537 538 extern FLAG utf_cjk_wide_padding; /* always display CJK on UTF double-width ? */ 539 540 extern FLAG dark_term; /* dark colour terminal ? */ 541 extern FLAG darkness_detected; /* could background colour be queried ? */ 542 extern FLAG fg_yellowish; /* foreground colour near yellow ? */ 543 extern FLAG bright_term; /* need to improved contrast ? */ 544 extern FLAG bw_term; /* black/white terminal ? */ 545 extern FLAG suppress_colour; /* don't use ANSI color settings */ 546 547 extern FLAG configure_xterm_keyboard; /* deleteIsDEL, metaSendsEscape */ 548 549 /* from mined1.c */ 550 extern FLAG auto_detect; /* Auto detect character encoding from file ? */ 551 extern char * detect_encodings; /* List of encodings to detect */ 552 extern char language_tag; 553 554 extern FLAG cjk_text; /* text in CJK encoding ? */ 555 extern FLAG utf8_text; /* text in UTF-8 representation ? */ 556 extern FLAG utf16_file; /* file encoded in UTF-16 ? */ 557 extern FLAG utf16_little_endian; /* UTF-16 file encoded little endian ? */ 558 extern FLAG mapped_text; /* text in 8 bit, non-Latin-1 representation ? */ 559 extern FLAG ebcdic_text; 560 extern FLAG ebcdic_file; 561 extern FLAG utf8_lineends; /* support UTF-8 LS and PS line ends ? */ 562 extern FLAG poormansbidi; /* poor man's bidirectional support ? */ 563 564 extern FLAG combining_mode; /* UTF-8 combining character support ? */ 565 extern FLAG separate_isolated_combinings; /* separated display of comb. at line beg./after TAB ? */ 566 extern FLAG apply_joining; /* apply LAM/ALEF joining ? */ 567 568 extern FLAG disp_scrollbar; /* shall scrollbar be displayed ? */ 569 extern FLAG fine_scrollbar; /* fine-grained UTF-8 scrollbar ? */ 570 extern FLAG old_scrollbar_clickmode; /* old left/right click semantics ? */ 571 extern int scrollbar_width; 572 extern FLAG update_scrollbar_lazy; /* partial scrollbar refresh as needed ? */ 573 574 extern FLAG loading; /* Loading a file? Init True for error handling */ 575 extern FLAG only_detect_text_encoding; 576 extern FLAG wordnonblank; /* handle all non-blank sequences as words */ 577 extern FLAG proportional; /* Enable support for proportional fonts? */ 578 extern FLAG show_vt100_graph; /* Display letters as VT100 block graphics ? */ 579 extern FLAG hide_passwords; /* Hide passwords in display */ 580 extern FLAG filtering_read; /* Use filter for reading file ? */ 581 extern char * filter_read; /* Filter for reading file */ 582 extern FLAG filtering_write; /* Use filter for writing file ? */ 583 extern char * filter_write; /* Filter for writing file */ 584 extern FLAG translate_output; /* Transform output diacritics to strings */ 585 extern int translen; /* length of " */ 586 extern char * transout; /* Output transformation table */ 587 extern FLAG controlQS; /* must respect ^Q/^S handshake ? */ 588 extern int display_delay; /* delay between display lines */ 589 extern FLAG paradisp; /* Shall paragraph end be distinguished? */ 590 591 extern char UNI_marker; /* Char to be shown in place of Unicode char */ 592 593 extern char TAB_marker; /* Char to be shown in place of tab chars */ 594 extern char TAB0_marker; /* Char to be shown at start of tab chars */ 595 extern char TAB2_marker; /* Char to be shown at end of tab chars */ 596 extern char TABmid_marker; /* Char to be shown in middle of tab chars */ 597 extern unsigned long CJK_TAB_marker; /* Char to be shown in place of tab */ 598 extern char RET_marker; /* Char indicating end of line (LF) */ 599 extern char DOSRET_marker; /* Char indicating DOS end of line (CRLF) */ 600 extern char MACRET_marker; /* Char indicating Mac end of line (CR) */ 601 extern char PARA_marker; /* Char indicating end of paragraph */ 602 extern char RETfill_marker; /* Char to fill the end of line with */ 603 extern char RETfini_marker; /* Char to fill last position of line with */ 604 extern char SHIFT_marker; /* Char indicating that line continues */ 605 extern char SHIFT_BEG_marker; /* Char indicating that line continues left */ 606 extern char MENU_marker; /* Char to mark selected item */ 607 extern char * UTF_TAB_marker; /* Char to be shown in place of tab chars */ 608 extern char * UTF_TAB0_marker; /* Char to be shown at start of tab chars */ 609 extern char * UTF_TAB2_marker; /* Char to be shown at end of tab chars */ 610 extern char * UTF_TABmid_marker; /* Char to be shown in middle of tab chars */ 611 extern char * UTF_RET_marker; /* Char indicating end of line */ 612 extern char * UTF_DOSRET_marker; /* Char indicating DOS end of line */ 613 extern char * UTF_MACRET_marker; /* Char indicating Mac end of line */ 614 extern char * UTF_PARA_marker; /* Char indicating end of paragraph */ 615 extern char * UTF_RETfill_marker; /* Char to fill the end of line with */ 616 extern char * UTF_RETfini_marker; /* Char to fill last position of line with */ 617 extern char * UTF_SHIFT_marker; /* Char indicating that line continues */ 618 extern char * UTF_SHIFT_BEG_marker; /* Char indicating that line continues left */ 619 extern char * UTF_MENU_marker; /* Char to mark selected item */ 620 extern char * submenu_marker; /* Char to mark submenu entry */ 621 extern char * menu_cont_marker; /* Char to mark menu border continuation */ 622 extern char * menu_cont_fatmarker; /* Char to mark menu border continuation */ 623 624 extern FLAG stat_visible; /* Set if status line is visible */ 625 extern FLAG top_line_dirty; /* Was menu line cleared? */ 626 extern FLAG text_screen_dirty; /* Was text display position affected? */ 627 628 extern FLAG page_scroll; /* use scroll for page up/down */ 629 extern FLAG page_stay; /* stay at edge of page after page up/down */ 630 631 /* from justify.c */ 632 extern int first_left_margin; 633 extern int next_left_margin; 634 extern int right_margin; 635 636 /* from keyboard.c */ 637 extern long last_delta_readchar; /* delay between last 2 characters */ 638 extern long average_delta_readchar; /* average delay between last characters */ 639 640 641 /***************************************************************************\ 642 declaration of mined functions 643 \***************************************************************************/ 644 645 /* text buffer navigation */ 646 /* from textbuf.c */ 647 extern LINE * proceed _((LINE *, int)); 648 extern void reset _((LINE * scr_top, int y)); 649 extern void move_y _((int y)); 650 extern void move_to _((int x, int y)); 651 extern void move_address _((char *, int y)); 652 extern void move_address_w_o_RD _((char *, int y)); 653 extern int find_x _((LINE * line, char * address)); 654 extern int get_cur_pos _((void)); 655 extern int get_cur_col _((void)); 656 extern int find_y _((LINE * line)); 657 extern int find_y_w_o_RD _((LINE * line)); 658 659 /* text buffer status handling */ 660 /* from mined1.c */ 661 extern void set_modified _((void)); 662 /* from textbuf.c */ 663 extern void file_status _((char * message, long bytecount, long charcount, 664 char * filename, int lines, FLAG textstat, 665 FLAG writefl, FLAG changed, FLAG viewing)); 666 extern void recount_chars _((void)); 667 668 /* from edit.c */ 669 extern char syntax_state _((char prev_mask, char old_mask, char * spoi, char * sbeg)); 670 extern void update_syntax_state _((LINE *)); 671 672 /* from pastebuf.c */ 673 extern void delete_yank_files _((void)); 674 extern int yankfile _((FLAG read_write, FLAG append)); 675 extern void yank_HTML _((FLAG remove)); 676 extern void paste_HTML _((void)); 677 extern FLAG checkmark _((LINE *, char *)); 678 extern void delete_text_buf _((LINE * start_line, char * start_textp, LINE * end_line, char * end_textp)); 679 680 /* selection highlighting */ 681 /* from pastebuf.c */ 682 extern void start_highlight_selection _((void)); 683 extern void continue_highlight_selection _((int pos_x)); 684 extern void update_selection_marks _((int pos_x)); 685 extern void clear_highlight_selection _((void)); 686 extern FLAG has_active_selection _((void)); 687 extern void trigger_highlight_selection _((void)); 688 extern void adjust_rectangular_mode _((FLAG alt_mouse)); 689 690 /* editing functions */ 691 /* from edit.c */ 692 extern int delete_text _((LINE * startl, char * start, LINE * endl, char * end)); 693 extern int delete_text_only _((LINE * startl, char * start, LINE * endl, char * end)); 694 extern int insert_text _((LINE *, char * location, char * string)); 695 extern LINE * line_insert_after _((LINE *, char *, int, lineend_type)); 696 697 /* character input handling */ 698 struct prefixspec { 699 voidfunc prefunc; 700 unsigned int preshift; 701 char * accentname; 702 char * accentsymbol; 703 char * pat1; 704 char * pat2; 705 char * pat3; 706 }; 707 708 /* from compose.c */ 709 extern char * mnemos _((int ucs)); 710 extern unsigned long compose_chars _((unsigned long, unsigned long)); 711 extern unsigned long compose_mnemonic _((char *)); 712 extern struct prefixspec * lookup_prefix _((voidfunc prefunc, unsigned int shift)); 713 extern struct prefixspec * lookup_prefix_char _((unsigned long c)); 714 extern unsigned long compose_patterns _((unsigned long base, struct prefixspec * ps, struct prefixspec * ps2, struct prefixspec * ps3)); 715 716 /* from edit.c */ 717 extern void COMPOSE _((void)); 718 extern void key_0 _((void)); 719 extern void key_1 _((void)); 720 extern void key_2 _((void)); 721 extern void key_3 _((void)); 722 extern void key_4 _((void)); 723 extern void key_5 _((void)); 724 extern void key_6 _((void)); 725 extern void key_7 _((void)); 726 extern void key_8 _((void)); 727 extern void key_9 _((void)); 728 extern unsigned long CTRLGET _((FLAG check_prefix)); 729 730 731 /* status line handling */ 732 /* from prompt.c */ 733 extern void rd_bottom_line _((void)); 734 extern void redraw_prompt _((void)); 735 extern void clear_lastline _((void)); 736 /* file chooser */ 737 extern int wildcard _((char * pat, char * s)); 738 extern int get_filename _((char * message, char * filename, FLAG directory)); 739 extern FLAG sort_by_extension; 740 extern FLAG sort_dirs_first; 741 742 743 /* 744 * Convert cnt to nearest tab position 745 */ 746 extern int tabsize; /* Width of tab positions, 2 or 4 or 8 */ 747 extern FLAG tabsize_selected; /* Tab width selected by explicit option? */ 748 extern FLAG expand_tabs; /* Expand TABs to Spaces? */ 749 #define tab(cnt) (((cnt) + tabsize) & ~(tabsize - 1)) 750 #define tab8(cnt) (((cnt) + 8) & ~07) 751 /* 752 * Word definitions 753 */ 754 #ifdef use_ebcdic_text 755 #define white_space(c) ((c) == code_SPACE || (c) == code_TAB) 756 #define alpha(c) ((c) != code_SPACE && (c) != code_TAB && (c) != '\n') 757 #else 758 #define white_space(c) ((c) == ' ' || (c) == '\t') 759 #define alpha(c) ((c) != ' ' && (c) != '\t' && (c) != '\n') 760 #endif 761 762 /* from edit.c */ 763 extern int ishex _((character)); 764 extern unsigned int hexval _((character)); 765 extern character hexdig _((unsigned int)); 766 extern int get_idf _((char * idf_buf, char * text, char * start_line)); 767 extern FLAG iscombined_unichar _((unsigned long ucs, char * charpos, char * linebegin)); 768 769 /* from search.c */ 770 extern void search_for _((char *, FLAG direction, FLAG case_ignore)); 771 extern FLAG search_ini _((char *, FLAG direction, FLAG case_ignore)); 772 extern void search_expr _((char *, FLAG direction, FLAG case_ignore)); 773 extern void search_corresponding _((char *, FLAG, char *)); 774 775 /* from mined1.c */ 776 extern void splash_logo _((void)); 777 extern void switchAltScreen _((void)); 778 extern void KEYREC _((void)); 779 780 extern void emul_emacs _((void)); 781 extern void emul_WordStar _((void)); 782 extern void emul_pico _((void)); 783 extern void emul_Windows _((void)); 784 extern void emul_mined _((void)); 785 extern void set_keypad_mined _((void)); 786 extern void set_keypad_shift_selection _((void)); 787 extern void set_keypad_windows _((void)); 788 789 extern void handle_locale_quotes _((char * lang, FLAG alt)); 790 extern void configure_preferences _((FLAG applycommon)); 791 792 extern void viewonlyerr _((void)); 793 extern void restrictederr _((void)); 794 795 extern void convlineend_cur_LF _((void)); 796 extern void convlineend_cur_CRLF _((void)); 797 extern void convlineend_all_LF _((void)); 798 extern void convlineend_all_CRLF _((void)); 799 800 801 /* special stuff */ 802 /* from minedaux.c */ 803 extern void debuglog _((char * tag, char * l1, char * l2)); 804 extern char * envvar _((char * name)); 805 extern char * envstr _((char * name)); 806 extern char * getbasename _((char * s)); 807 extern int is_absolute_path _((char * filename)); 808 extern char * getusername _((void)); 809 extern char * get_cwd _((char * dirbuf)); 810 extern char * gethomedir _((void)); 811 extern void sethomedir _((char *)); 812 extern int systemcall _((char * msg, char * cmd, int delay)); 813 #ifndef msdos 814 extern int progcallpp _((char * msg, int delay, char * binprepath [], 815 char * dir, char * prog, char * p1, char * p2, char * p3, char * p4)); 816 #endif 817 #if defined (msdos) || defined (__MINGW32__) 818 extern int is_Windows _((void)); 819 #endif 820 extern void panic _((char *, char *)); 821 extern void panicio _((char * message, char * err)); 822 extern char * scan_int _((char *, int *)); 823 extern char * dec_out _((long)); 824 extern int delete_file _((char *)); 825 extern FLAG copyfile _((char * from_file, char * to_file)); 826 extern char * unnull _((char *)); 827 extern void strip_trailingslash _((char *)); 828 extern char * num_out _((long number, long radix)); 829 extern void copy_string _((char * to, char * from)); 830 /* from legacy.c */ 831 extern char * serror _((void)); 832 extern char * serrorof _((int)); 833 extern int geterrno _((void)); 834 extern int portable_getpgrp _((int mypid)); 835 836 /* memory allocation */ 837 /* from minedaux.c */ 838 extern void * alloc _((int bytes)); 839 extern void free_space _((void *)); 840 extern LINE * alloc_header _((void)); 841 extern void free_header _((LINE *)); 842 843 844 /* prompt line */ 845 /* from prompt.c */ 846 extern FLAG char_on_status_line; /* is output active on status line ? */ 847 extern FLAG input_active; 848 extern int lpos; 849 extern long get_number _((char * message, char firstdigit, int * result)); 850 extern int prompt_num_char _((unsigned long * result, unsigned long maxvalue)); 851 852 853 /* scrollbar handling */ 854 /* from output.c */ 855 extern FLAG display_scrollbar _((FLAG update)); 856 extern void scrollbar_scroll_up _((int from)); 857 extern void scrollbar_scroll_down _((int from)); 858 extern int check_scrollbar_pos _((void)); 859 860 /* from mined1.c */ 861 extern void RDwin _((void)); 862 extern void RDwinchg _((void)); 863 extern void RD_window_title _((void)); 864 extern void clear_window_title _((void)); 865 extern void RD_y _((int y_pos)); 866 /* from output.c */ 867 extern void display _((int y, LINE *, int count, int new_pos)); 868 extern void display_flush _((void)); 869 /* from output.c */ 870 extern void putmark _((char mark, char * utfmark)); 871 extern FLAG marker_defined _((character marker, char * utfmarker)); 872 extern void put_blanks _((int endpos)); 873 extern void set_cursor_xy _((void)); 874 extern void put_line _((int scr_y, LINE *, int offset, FLAG clear, FLAG prop_pos)); 875 extern void print_line _((int scr_y, LINE *)); 876 /* put character values */ 877 #define putchar(c) __putchar ((character) c) 878 extern void putcharacter _((character)); 879 extern void put_unichar _((unsigned long)); 880 extern int put_cjkchar _((unsigned long)); 881 882 /* character handling */ 883 /* from minedaux.c */ 884 extern int length_of _((char *)); 885 extern char * dupstr _((char * s)); 886 extern char * nextutf8 _((char *s)); 887 extern int stringcompare_ _((char * s1, char * s2)); 888 extern int stringprefix_ _((char * s1, char * s2)); 889 /* from textfile.c */ 890 extern int UTF8_len _((char)); 891 extern int CJK_len _((character *)); 892 extern int char_count _((char *)); 893 extern int col_count _((char *)); 894 extern void utf8_info _((char *, int *, unsigned long *)); 895 extern int isjoined _((unsigned long, char *, char *)); 896 extern int iscombined _((unsigned long, char *, char *)); 897 #define multichar(c) ((character) c >= 0x80 && (cjk_text == False || (text_encoding_tag != 'S' && text_encoding_tag != 'x') || (character) c < 0xA1 || (character) c > 0xDF)) 898 extern int iscombining _((unsigned long ucs)); 899 extern int iswide _((unsigned long ucs)); 900 extern int uniscrwidth _((unsigned long, char *, char *)); 901 extern int cjkscrwidth _((unsigned long, char *, char *)); 902 extern char * charbegin _((char *, char *)); 903 extern void advance_utf8_scr _((char * *, int *, char *)); 904 extern void advance_utf8 _((char * *)); 905 extern void advance_char_scr _((char * *, int *, char *)); 906 extern void advance_char _((char * *)); 907 extern void precede_char _((char * *, char *)); 908 extern unsigned long utf8value _((character *)); 909 extern unsigned long charvalue _((character *)); 910 extern unsigned long unicodevalue _((character *)); 911 extern unsigned long unicode _((unsigned long)); 912 extern unsigned long precedingchar _((char *, char *)); 913 extern FLAG opensquote _((unsigned long prevchar)); 914 /* from mined1.c */ 915 extern int isglyph_uni _((unsigned long)); 916 917 /* character mapping handling */ 918 #define CHAR_UNKNOWN (unsigned long) -2 /* unknown mnemonic */ 919 #define CHAR_INVALID (unsigned long) -1 /* not mappable to encoding */ 920 921 #define FUNcmd (unsigned long) -7 /* indicates function key */ 922 923 /* information display preferences */ 924 extern FLAG always_disp_fstat; /* Permanent file status display on status line? */ 925 extern FLAG always_disp_help; /* Permanent F2... help display on status line? */ 926 extern FLAG always_disp_code; /* Permanent char code display on status line? */ 927 extern FLAG disp_scriptname; /* display Unicode script range? */ 928 extern FLAG disp_charname; /* display Unicode character name? */ 929 extern FLAG disp_charseqname; /* display Unicode named sequences? */ 930 extern FLAG disp_decomposition; /* display Unicode character decomposition? */ 931 extern FLAG disp_mnemos; /* display mined input mnemos? */ 932 extern FLAG always_disp_Han; /* Permanent Han character description display on status line? */ 933 extern FLAG disp_Han_Mandarin; /* display this Han pronunciation ? */ 934 extern FLAG disp_Han_Cantonese; /* display this Han pronunciation ? */ 935 extern FLAG disp_Han_Japanese; /* display this Han pronunciation ? */ 936 extern FLAG disp_Han_Sino_Japanese; /* display this Han pronunciation ? */ 937 extern FLAG disp_Han_Hangul; /* display this Han pronunciation ? */ 938 extern FLAG disp_Han_Korean; /* display this Han pronunciation ? */ 939 extern FLAG disp_Han_Vietnamese; /* display this Han pronunciation ? */ 940 extern FLAG disp_Han_HanyuPinlu; /* display this Han pronunciation ? */ 941 extern FLAG disp_Han_HanyuPinyin; /* display this Han pronunciation ? */ 942 extern FLAG disp_Han_XHCHanyuPinyin; /* display this Han pronunciation ? */ 943 extern FLAG disp_Han_Tang; /* display this Han pronunciation ? */ 944 extern FLAG disp_Han_description; /* display Han description ? */ 945 extern FLAG disp_Han_full; /* display full popup Han description ? */ 946 947 struct raw_hanentry { 948 unsigned long unicode; 949 char * text; 950 }; 951 952 extern struct raw_hanentry hantable []; 953 extern unsigned int hantable_len; 954 955 956 /* various keyboard options */ 957 extern FLAG detect_esc_alt; /* Enable detection of Alt key by ESC prefix? */ 958 959 /* keyboard mapping setup functions (keymaps.c) */ 960 extern void toggleKEYMAP _((void)); 961 extern void setupKEYMAP _((void)); 962 extern FLAG setKEYMAP _((char *)); 963 extern char * keyboard_mapping; 964 extern char * last_keyboard_mapping; 965 966 /* keyboard mapping (keymaps.c) */ 967 extern int map_key _((char * str, int matchmode, char * * found, char * * mapped)); 968 extern int keyboard_mapping_active _((void)); 969 970 /* keyboard mapping menu handling */ 971 extern char selection_space; 972 extern FLAG enforce_keymap; /* enable keyboard mapping even on non-suitable terminal */ 973 #define allow_keymap ((utf8_input && (utf8_text || cjk_text || mapped_text)) || cjk_term || enforce_keymap) 974 #define SPACE_NEXT 'n' 975 #define SPACE_NEXTROW 'r' 976 #define SPACE_SELECT 's' 977 978 /* menu handling */ 979 typedef void (* _menufunc) (); 980 typedef int (* _flagfunc) (); 981 typedef struct { 982 char * itemname; 983 _menufunc itemfu; 984 char * hopitemname; 985 _flagfunc itemon; 986 char * extratag; 987 } menuitemtype; 988 typedef void (* menufunc) _((menuitemtype *, int)); 989 typedef int (* flagfunc) _((menuitemtype *, int)); 990 991 extern FLAG flags_changed; /* Should flag menu area be redrawn? */ 992 /* from mousemen.c */ 993 extern void fill_menuitem _((menuitemtype * item, char * s1, char * s2)); 994 extern void openmenuat _((int col)); 995 extern int popup_menu _((menuitemtype *, int menulen, int column, int line, 996 char * title, 997 FLAG is_flag_menu, FLAG disp_only, char * select_keys)); 998 extern void clean_menus _((void)); 999 extern int is_menu_open _((void)); 1000 extern void displaymenuline _((FLAG show_filelist)); 1001 extern void redrawmenu _((void)); 1002 extern void displayflags _((void)); 1003 extern void toggle_append _((void)); 1004 extern void handleKeymapmenu _((void)); 1005 extern void handleQuotemenu _((void)); 1006 extern void handleEncodingmenu _((void)); 1007 1008 /* from edit.c */ 1009 extern int quote_type; 1010 extern int prev_quote_type; 1011 extern int default_quote_type; 1012 extern void set_quote_type _((int)); 1013 extern void set_quote_style _((char *)); 1014 extern void reset_smart_replacement _((void)); 1015 /* from mousemen.c */ 1016 extern int count_quote_types _((void)); 1017 extern FLAG spacing_quote_type _((int qt)); 1018 extern char * quote_mark _((int, quoteposition_type)); 1019 extern void set_quote_menu _((void)); 1020 extern int lookup_quotes _((char *)); 1021 extern menuitemtype * lookup_Keymap_menuitem _((char * hopitem)); 1022 1023 1024 /* main editing functions */ 1025 extern voidfunc command _((unsigned long)); 1026 extern void invoke_key_function _((unsigned long)); 1027 1028 extern void QUICKMENU _((void)), FILEMENU _((void)), EDITMENU _((void)); 1029 extern void SEARCHMENU _((void)), PARAMENU _((void)), OPTIONSMENU _((void)); 1030 extern void handleFlagmenus _((void)); 1031 extern void MOUSEfunction _((void)), FOCUSout _((void)), FOCUSin _((void)); 1032 extern void AMBIGnarrow _((void)), AMBIGwide _((void)); 1033 extern void ANSIseq _((void)); 1034 extern void OSC _((void)); 1035 extern void MOVUP _((void)), MOVDN _((void)), MOVLF _((void)), MOVRT _((void)); 1036 extern void SD _((void)), SU _((void)), MOVPD _((void)), MOVPU _((void)); 1037 extern void BFILE _((void)), EFILE _((void)); 1038 extern void BLINEORUP _((void)), ELINEORDN _((void)), MOVLBEG _((void)), MOVLEND _((void)); 1039 extern void HIGH _((void)), LOW _((void)); 1040 extern void MNW _((void)), MPW _((void)), BSEN _((void)), ESEN _((void)); 1041 extern void MPPARA _((void)), MNPARA _((void)); 1042 extern void DPC _((void)), DCC _((void)), DLN _((void)), DNW _((void)), DPW _((void)); 1043 extern void DCC0 _((void)), DPC0 _((void)); 1044 extern void CTRLINS _((void)), DLINE _((void)), TOGINS _((void)), ctrlQ _((void)), ctrlK _((void)), ctrlO _((void)); 1045 extern void search_wrong_enc _((void)); 1046 extern void JUS _((void)), JUSclever _((void)), JUSandreturn _((void)); 1047 extern void QUED _((void)), WT _((void)), WTU _((void)), SAVEAS _((void)), EDIT _((void)), NN _((void)); 1048 extern void RECOVER _((void)); 1049 extern void SAVPOS _((void)), GROOM_INFO _((void)); 1050 extern void RD _((void)), RDwin _((void)), RDwin_nomenu _((void)); 1051 extern void RDcenter _((void)), I _((void)); 1052 extern void EXED _((void)), VIEW _((void)); 1053 extern void HOP _((void)), CANCEL _((void)), ESCAPE _((void)); 1054 extern void EMAX _((void)), META _((void)), UNDO _((void)); 1055 extern void CHDI _((void)); 1056 extern void PRINT _((void)), CMD _((void)), SH _((void)), SUSP _((void)); 1057 extern void LNCI _((void)), LNSW _((void)); 1058 extern void LOWCAP _((void)), LOWER _((void)), UPPER _((void)); 1059 extern void CAPWORD _((void)), LOWCAPWORD _((void)); 1060 extern void HTML _((void)), MARKER _((void)), GOMARKER _((void)); 1061 extern void EDITmode _((void)), VIEWmode _((void)), toggle_VIEWmode _((void)); 1062 extern void NXTFILE _((void)), PRVFILE _((void)), SELECTFILE _((void)), CLOSEFILE _((void)); 1063 extern void EXFILE _((void)), EXMINED _((void)); 1064 extern void ADJLM _((void)), ADJFLM _((void)), ADJNLM _((void)), ADJRM _((void)), ADJPAGELEN _((void)); 1065 extern void toggle_tabsize _((void)), toggle_tab_expansion _((void)); 1066 extern void changeuni _((void)), changehex _((void)), changeoct _((void)), changedec _((void)); 1067 extern void screensmaller _((void)), screenlesslines _((void)), screenlesscols _((void)); 1068 extern void screenbigger _((void)), screenmorelines _((void)), screenmorecols _((void)); 1069 extern void fontsmaller _((void)), fontbigger _((void)), fontdefault _((void)); 1070 1071 extern void SFW _((void)), SRV _((void)), RES _((void)), RESreverse _((void)); 1072 extern void LR _((void)), GR _((void)), REPL _((void)); 1073 extern void SIDFW _((void)), SIDRV _((void)); 1074 extern void Stag _((void)); 1075 extern void AltX _((void)); 1076 1077 extern void toggleKEYMAP _((void)), setupKEYMAP _((void)); 1078 extern void toggle_encoding _((void)); 1079 extern void change_encoding _((char * new_text_encoding)); 1080 1081 extern void S0 _((character)), Scharacter _((unsigned long)); 1082 extern FLAG insert_unichar _((unsigned long)); 1083 extern void SNL _((void)), STAB _((void)), SSPACE _((void)); 1084 extern void APPNL _((void)), Underline _((void)); 1085 extern void Sdoublequote _((void)), Ssinglequote _((void)), Sdash _((void)), Sacute _((void)), Sgrave _((void)); 1086 extern void SCURCHARFW _((void)), SCURCHARRV _((void)); 1087 1088 extern void goline _((int)), goproz _((int)); 1089 1090 extern void MARK _((void)), COPY _((void)), CUT _((void)); 1091 extern void setMARK _((FLAG set_only)), toggleMARK _((void)); 1092 extern void toggle_rectangular_paste_mode _((void)), SELECTION _((void)); 1093 extern void Pushmark _((void)), Popmark _((void)), Upmark _((void)); 1094 extern void GOTO _((void)), GOHOP _((void)), GOMA _((void)); 1095 extern void MARKn _((int)), GOMAn _((int)), mark_n _((int)); 1096 extern void PASTE _((void)), PASTEEXT _((void)), PASTEstay _((void)), YANKRING _((void)); 1097 extern void WB _((void)), INSFILE _((void)); 1098 1099 extern void SIDF _((FLAG)), SCURCHAR _((FLAG)); 1100 extern void UML _((char)), REPT _((char)); 1101 extern FLAG CONV _((void)); 1102 extern void BADch _((unsigned long cmd)); 1103 extern void SCORR _((FLAG pref_direction)); 1104 1105 extern void checkout _((void)), checkin _((void)); 1106 extern void SPELL _((void)); 1107 1108 extern void FS _((void)), FSTATUS _((void)); 1109 extern void display_code _((void)), display_the_code _((void)); 1110 extern void display_Han _((char * cpoi, FLAG force_utf8)); 1111 extern void display_FHELP _((void)); 1112 extern void ABOUT _((void)); 1113 extern void HELP _((void)), HELP_topics _((void)), HELP_Fn _((void)), HELP_accents _((void)), toggle_FHELP _((void)); 1114 1115 extern void FHELP _((voidfunc)); 1116 1117 extern void check_file_modified _((void)); 1118 1119 /* function keys */ 1120 extern void LFkey _((void)), RTkey _((void)), UPkey _((void)), DNkey _((void)); 1121 extern void PGUPkey _((void)), PGDNkey _((void)); 1122 extern void HOMEkey _((void)), ENDkey _((void)), smallHOMEkey _((void)), smallENDkey _((void)); 1123 extern void INSkey _((void)), DELkey _((void)), smallINSkey _((void)), smallDELkey _((void)); 1124 extern void KP_plus _((void)), KP_minus _((void)); 1125 extern void DELchar _((void)); 1126 extern void FIND _((void)), AGAIN _((void)); 1127 extern void F1 _((void)), F2 _((void)), F3 _((void)), F4 _((void)), F5 _((void)), F6 _((void)), F7 _((void)), F8 _((void)), F9 _((void)), F10 _((void)), F11 _((void)), F12 _((void)); 1128 1129 1130 /* 1131 * String functions 1132 */ 1133 #define streq(s1, s2) (strcmp (s1, s2) == 0) 1134 #define strisprefix(p, s) (strncmp (s, p, strlen (p)) == 0) 1135 #define strcontains(s, c) (strstr (s, c)) 1136 #define strappend(s, a, s_size) strncat (s, a, s_size - strlen (s) - 1) 1137 1138 /* 1139 * Functions handling status_line. 1140 */ 1141 extern int bottom_line _((FLAG attrib, char *, char *, char * inbuf, FLAG statfl, char * term_input)); 1142 extern void status_uni _((char * msg)); 1143 extern character status2_prompt _((char * term, char * msg1, char * msg2)); 1144 extern character prompt _((char * term)); 1145 #define status_msg(str) status_line (str, NIL_PTR) 1146 #define status_line(str1, str2) \ 1147 (void) bottom_line (True, (str1), (str2), NIL_PTR, False, "") 1148 #define status_fmt2(str1, str2) \ 1149 (void) bottom_line (VALID, str1, str2, NIL_PTR, False, ""); 1150 #define status_fmt(str1, str2) \ 1151 (void) bottom_line (SAME, str1, str2, NIL_PTR, False, ""); 1152 #define status_beg(str) \ 1153 (void) bottom_line (True, (str), NIL_PTR, NIL_PTR, True, "") 1154 #define error(str1) \ 1155 (void) bottom_line (True, (str1), NIL_PTR, NIL_PTR, False, "") 1156 #define error2(str1, str2) \ 1157 (void) bottom_line (True, (str1), (str2), NIL_PTR, False, "") 1158 #define clear_status() \ 1159 (void) bottom_line (False, NIL_PTR, NIL_PTR, NIL_PTR, False, "") 1160 #define get_string(str1, str2, fl, term_chars) \ 1161 bottom_line (True, (str1), NIL_PTR, (str2), fl, term_chars) 1162 extern int get_string_uni _((char * str1, char * str2, FLAG fl, char * term_chars)); 1163 1164 1165 /* 1166 * Print info about current file and buffer. 1167 */ 1168 #define fstatus(mess, bytes, chars) \ 1169 file_status ((mess), (bytes), (chars), file_name, total_lines, True, writable, modified, viewonly) 1170 1171 /* 1172 * Build formatted string. 1173 */ 1174 #define build_string sprintf 1175 1176 1177 /***************************************************************************\ 1178 end 1179 \***************************************************************************/ 1180