📄 mined1.c
字号:
voidmodify_int (name, var, min, max) char * name; int * var; int min, max;{ int number; build_string (text_buffer, "%s (%d), new value (Enter for current column):", name, * var); if (get_number (text_buffer, '0', & number) == ERRORS) return; if (number == 0) number = x + 1; if (number < min) { error ("Value too small", NIL_PTR); return; } if (number > max) { error ("Value too large", NIL_PTR); return; } * var = number;}voidADJLM (){ left_margin ++; modify_int ("left margin", & left_margin, 1, right_margin - 2); left_margin --;}voidADJRM (){ right_margin --; modify_int ("right margin", & right_margin, left_margin + 2, 1000); right_margin ++;}/* ================================================================== * * Miscellaneous * * ================================================================== *//* * Redraw the screen */voidRD (){ reverse_off (); clear_screen ();/* display page */ display (0, top_line, last_y, y);/* clear/redraw last line */ set_cursor (0, YMAX); clear_lastline (); move_y (y); if (stat_visible == TRUE) rd_bottom_line ();}voidRD_y (y_pos) int y_pos;{ reverse_off (); clear_screen ();/* display page */ display (0, top_line, last_y, y_pos);/* clear/redraw last line */ set_cursor (0, YMAX); clear_lastline (); if (stat_visible == TRUE) rd_bottom_line ();}/* * Adjust current window size after WINCH signal */voidRDwin (){ register LINE * current_line; winchg = FALSE; getwinsize (); current_line = cur_line; reset (top_line, y);/* move_y (find_y_w_o_RD (current_line)); */ move_address (cur_text, find_y_w_o_RD (current_line)); RD (); flush ();}voidchange_screen_size (sb, keep_columns) FLAG sb, keep_columns;{ int index, mode1, mode2;/* Experimental area: *//* set_screen_mode (mode1); any available mode number *//* set_video_lines (mode1); 0/1/2: 200/350/400 lines */ /* does not seem to have any effect *//* set_textmode_height (mode1); 0/1/2: font height 8/14/16 *//* set_grafmode_height (mode1, mode2); 0/1/2: font height 8/14/16 1/2/3/n: 14/25/43/n lines *//* set_fontbank (f); 0..7 *//**/ if (hop_flag > 0) {#ifdef msdos if (keep_columns == TRUE) { if (sb == BIGGER) { index = get_number ("Switch to font bank (0..7) ", '\0', & mode1); if (index == ERRORS) return; set_fontbank (mode1); } else { index = get_number ("Set character height (<= 32 pixels) ", '\0', & mode1); if (index == ERRORS) return; set_font_height (mode1); } } else { if (sb == BIGGER) {#endif index = get_number ("Select video mode ", '\0', & mode1); if (index == ERRORS) return; set_screen_mode (mode1);#ifdef msdos } else { index = get_number ("Select graf font (0/1/2: font height 8/14/16) ", '\0', & mode1); if (index == ERRORS) return; index = get_number ("Select line number (1/2/3/n: 14/25/43/n) ", '\0', & mode2); if (index == ERRORS) return; set_grafmode_height (mode1, mode2); /* 0/1/2: font height 8/14/16 */ /* 1/2/3/n: 14/25/43/n lines */ } }#endif } else { resize_screen (sb, keep_columns); } RDwin ();}voidLNCI (){ switch_textmode_height (TRUE); RDwin ();}voidLNSW (){ switch_textmode_height (FALSE); RDwin ();}/* * Ignore this keystroke. */voidI (){}/* * Fortifying 'HOP' key. */voidHOP (){ hop_flag = 2; if (! char_ready_within (500)) status_msg ("Continue HOP command (next command fortified) ...");}/* * Cancel prefix function. */voidCANCEL (){ hop_flag = 0; clear_status ();}/* * Call proc associated with function key. */voidFUNKEY (){ (* keyproc) ('\0'); keyproc = I;}/* * Toggle insert/overwrite mode. */voidTOGINS (){ if (insert_mode == TRUE) insert_mode = FALSE; else insert_mode = TRUE;}#define cmd_char(c) (c < '\040' ? c + '\100' : (c >= '\140' ? c - '\040' : c))/* * Interpret control-Q commands. Most can be implemented with the Hop function. */voidctrlQ (){ uchar c; void (* func) (); if (! char_ready_within (500)) status_msg ("^Q: Save Done eXit Quit Read Log / block: B/K mark Cop Ydel moV Wr..."); if (quit == TRUE) return; c = readchar (); if (quit == TRUE) return; clear_status (); if ('0' <= c && c <= '9') {GOMAn (c); return;} if (c == '\033' || c == QUITCHAR) {CANCEL (); return;} switch (cmd_char (c)) { case 'B' : {GOMA () ; return;} case 'K' : { ; return;} /* not exactly WS function */ case 'P' : { ; return;} /* not exactly WS function */ case 'V' : { ; return;} /* not exactly WS function */ case 'W' : /* not exactly WS function */ case 'Z' : /* not exactly WS function */ case 'Y' : case '\177' : { func = key_map [c]; hop_flag = 1; (* func) (c); return; } case 'F' : {if (hop_flag > 0) SRV (); else SFW (); return; } case 'A' : {if (hop_flag > 0) REPL (); else GR (); return; } case 'Q' : {REPT (' '); return;} /* not exactly WS function */ case 'L' : /* not exactly WS function *//*^Q: B/K top/bottom block P last position W/Z continuous scroll V last find or block Y/DEL delete line right/left 0-9 marker F find A replace Q repeat next key/command L find misspelling*/ default : { func = key_map [c]; if ((c < ' ') || ((voidfunc) func == (voidfunc) FUNKEY)) { /* (voidfunc) is an identity cast here. It seems to be required for the sake of the apparently totally rotten microvax C compiler */ hop_flag = 1; (* func) (c); } else BAD (c); return; } }}/* * Interpret control-K commands. */voidctrlK (){ uchar c; if (! char_ready_within (500)) status_msg ("^K: Save Done eXit Quit Read Log / block: B/K mark Cop Ydel moV Wr..."); if (quit == TRUE) return; c = readchar (); if (quit == TRUE) return; clear_status (); if ('0' <= c && c <= '9') {MARKn (c); return;} if (c == '\033' || c == QUITCHAR) {CANCEL (); return;} switch (cmd_char (c)) { case 'S' : {WTU (); return;} case 'D' : {EXFILE (); return;} case 'X' : {EXMINED (); return;} case 'Q' : {QUED (); return;} case 'B' : {MARK () ; return;} case 'K' : {YA () ; return;} /* not exactly WS function */ case 'H' : { ; return;} /* not exactly WS function */ case 'C' : {PT () ; return;} /* not exactly WS function */ case 'Y' : {DT () ; return;} /* not exactly WS function */ case 'V' : {PT (); return;} /* not exactly WS function */ case 'W' : {WB (); return;} /* not exactly WS function */ case 'N' : { ; return;} /* not exactly WS function */ case 'R' : {INSFILE (); return;} case 'L' : {CHDI (); return;}/*^K 0-9 set/hide marker B/K block begin/end H block hide C/Y/V/W block copy/delete/move/write N column block*/ default : { BAD (c); return; } }}/* * Interpret control-O commands. */voidctrlO (){ uchar c; if (! char_ready_within (500)) status_msg ("^O: L/R left/right margins..."); if (quit == TRUE) return; c = readchar (); if (quit == TRUE) return; clear_status (); if ('0' <= c && c <= '9') {return;} if (c == '\033' || c == QUITCHAR) {CANCEL (); return;} switch (cmd_char (c)) { case 'L' : {ADJLM (); return;} case 'R' : {ADJRM (); return;}/*^O L/R/M set left/right margin /release I/N set/clear tab G paragraph tab F ruler from line C center line S set line spacing W toggle word wrap T toggle ruler line J toggle justify V vari-tabs H hyph-help E soft hyph D print display P page break*/ default : { BAD (c); return; } }}/* * Interpret Escape commands. */voidESCAPE (){ uchar c; void (* func) (); if (! char_ready_within (500)) status_msg ("ESC(exit) q(uit w(rite e(dit /\\(search) r(eplace d(irectory h(elp ..."); if (quit == TRUE) return; c = readchar (); if (quit == TRUE) return; clear_status (); if ('0' <= c && c <= '9') {REPT (c); return;} switch (c) { case '\033' : {EXED (); return;} case 'q' : {QUED (); return;} case '/' : {SFW (); return;} case '\\' : {SRV (); return;} case 's' : {GR (); return;} case 'R' : {LR (); return;} case 'r' : {REPL (); return;} case 'w' : {WT (); return;} case 'W' : {WTU (); return;} case 'e' : {EDIT (); return;} case 'v' : {VIEW (); return;} case 'g' : {GOTO (); return;} case 'h' : {HELP (); return;} case '?' : {FS (); return;} case '.' : {RDwin (); return;} case 'i' : {INSFILE (); return;} case 'b' : {WB (); return;} case '=' : {REPT (' '); return;} case 'z' : {SUSP (); return;} case 'd' : {CHDI (); return;} case '!' : {SH (); return;} case ']' : {GOMA (); return;} case 'n' : {NN (); return;} case 'p' : {PBUF (); return;} case 'c' : {CMD (); return;} case ' ' : return; case 'X' : {changetocode (16); return;} case 'O' : {changetocode (8); return;} case 'D' : {changetocode (10); return;} case '+' : {NXTFILE (); return;} case '-' : {PRVFILE (); return;} case '#' : {NTHFILE (); return;}#ifdef msdos case 'm' : {change_screen_size (SMALLER, FALSE); return;} case 'M' : {change_screen_size (BIGGER, FALSE); return;} case 'l' : {change_screen_size (SMALLER, TRUE); return;} case 'L' : {change_screen_size (BIGGER, TRUE); return;}#endif case 'j' : {JUS (); return;} case '<' : {ADJLM (); return;} case '>' : {ADJRM (); return;} case QUITCHAR : {CANCEL (); return;} default : { func = key_map [c]; if ((c < ' ') || ((voidfunc) func == (voidfunc) FUNKEY)) { /* (voidfunc) is an identity cast here. It seems to be required for the sake of the apparently totally rotten microvax C compiler */ hop_flag = 1; (* func) (c); } else BAD (c); return; } }}/* * DIRECT () reads in a direct cursor movement input sequence and moves. */voidDIRECT (){ uchar c; int xpos, ypos; c = get_digits (& ypos); /* c should be ';' */ c = get_digits (& xpos); ypos = ypos - 1; xpos = xpos - 1; if (ypos > last_y) ypos = last_y; move_to (xpos, ypos); if (c == 'm') MARK (); /* middle mouse button */ if (c == 'r') YA (); /* right mouse button */}/* * REPT () prompts for a count and wants a command after that. It repeats the * command count times. If a ^\ is given during repeating, stop looping and * return to main loop. */voidREPT (firstdigit) char firstdigit;{ register int count; register void (* func) (); int index, number; hop_flag = 0; if (firstdigit >= '0' && firstdigit <= '9') index = get_number ("Please continue repeat count...", firstdigit, & number); else index = get_number ("Please enter repeat count...", '\0', & number); if (index == ERRORS) return; func = key_map [index]; if ((voidfunc) func == (voidfunc) I) { /* Function assigned? */ /* (voidfunc) is an identity cast here. It seems to be required for the sake of the apparently totally rotten microvax C compiler */ clear_status (); return; } if ((voidfunc) func == (voidfunc) FUNKEY) { /* (voidfunc) is an identity cast here. It seems to be required for the sake of the apparently totally rotten microvax C compiler */ func = * keyproc; keyproc = I; index = '\0'; } count = number; while (count -- > 0 && quit == FALSE) { if (stat_visible == TRUE) clear_status (); (* func) (index); flush (); } if (quit == TRUE) /* Abort has been given */ error ("Repeat aborted", NIL_PTR); else clear_status ();}/* * Complains to illegal commands and eats up illegal escape sequences. */voidBAD (c) uchar c;{ static char message2 [] = "'**' - type a blank";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -