📄 eeedit.c
字号:
case TAB: continue; case LF: /* Normally drop thru to return 1 as for EOF */#if FX_EOLMODE if(eolcrlf(cur_buf)) { e_rgetc(); if((c = e_rgetc()) != EOF) /* Get prev char */ e_getc(); e_getc(); if(c != CR) /* Now examine */ continue; /* Not CR-LF, go on */ } /* Else drop thru to return win */#endif case EOF: return(1); default: return(0); } /* Never drops out */}e_insn(ch, cnt)int ch;int cnt;{ register int i; if((i = cnt) > 0) do { e_putc(ch); } while(--i);}e_sputz(acp)char *acp;{ register SBBUF *sb; register char *cp; register int c; if(cp = acp) { sb = CURSBB; while(c = *cp++) sb_putc(sb,c); }}/* BOLEQ - Returns TRUE if 2 dots are on the same line * (i.e. have the same Beg-Of-Line) */boleq(dot1,dot2)chroff dot1,dot2;{ return( (ex_boldot(CURSBB,dot1) == ex_boldot(CURSBB,dot2)));}char *dottoa(str,val)char *str;chroff val;{ register char *s; s = str; if(val < 0) { *s++ = '-'; val = -val; } if(val >= 10) s = dottoa(s, val/10); *s++ = '0' + (int)(val%10); *s = 0; return(s);}/* Paragraph utilities */#if FX_FPARA || FX_BPARA || FX_MRKPARA || FX_FILLPARA#if FX_SFPREFextern char *fill_prefix; /* Defined in eefill.c for now */extern int fill_plen; /* Ditto */#endif /*FX_SFPREF*/#if ICONOGRAPHICSint para_mode = PARABLOCK; /* eexcmd.c only other file that refs this */#endif /*ICONOGRAPHICS*//* Go to beginning of paragraph */e_gobpa(){ register int c; chroff savdot; savdot = e_dot(); e_bwsp(); while((c = e_rgetc()) != EOF) if(c == LF) /* Went past line? */ { e_getc(); /* Back up and check */#if FX_SFPREF if(fill_plen) if(tstfillp(fill_plen)) { e_igoff(-(fill_plen+1)); continue; } else break;#endif /*FX_SFPREF*/#if ICONOGRAPHICS c = e_peekc (); if (para_mode == PARABLOCK) if (c == LF) break; if (para_mode == PARALINE) if (c_wsp (c)) break;#else if(c_pwsp(e_peekc())) /* Check 1st chr for wsp */ break; /* If wsp, done */#endif /*ICONOGRAPHICS*/ e_rgetc(); /* Nope, continue */ } if((c = e_peekc()) == '.' || c == '-') { e_gonl(); if(e_dot() >= savdot) e_gopl(); }}/* Go to end of paragraph */e_goepa(){ register int c; e_gobol(); /* First go to beg of cur line */ e_fwsp(); while((c = e_getc()) != EOF) if (c == LF) {#if FX_SFPREF if(fill_plen) /* If Fill Prefix is defined */ if(tstfillp(fill_plen)) /* then must start with it */ continue; else break; /* or else we're done */#endif /*FX_SFPREF*/#if ICONOGRAPHICS if (para_mode == PARABLOCK) if (e_peekc () == LF) break; if (para_mode == PARALINE) if (c_wsp (e_peekc ())) break;#else if(c_pwsp(e_peekc())) break;#endif /*-ICONOGRAPHICS*/ }}exp_do(rpos, rneg)int (*rpos)(), (*rneg)();{ register int e; register int (*rtn)(); if((e = exp) == 0) return; rtn = rpos; if(e < 0) { rtn = rneg; e = -e; } do { (*rtn)(); } while(--e);}e_fwsp(){ register int c; while(c_wsp(c = e_getc())); if(c != EOF) e_backc();}e_bwsp(){ register int c; while(c_wsp(c = e_rgetc())); if(c != EOF) e_getc();}c_wsp(ch)int ch;{ register int c; c = ch; if(c == SP || c == TAB || c == LF || c == FF) return(1); return(0);}c_pwsp(ch)int ch;{ register int c; c = ch; if(c == '.' || c == '-') return(1); return(c_wsp(c));}#endif /* FX_FPARA || FX_BPARA || FX_MRKPARA || FX_FILLPARA *//* Word function auxiliaries *//* Returns true if this character is a delimiter. */delimp(c)int c;{ static int delim_tab[] = { 0177777, 0177777, /* All controls */ 0177777, 0176000, /* All punct but 0-9 */ 0000001, 0074000, /* All punct but A-Z and _ */ 0000001, 0174000 /* All punct but a-z */ }; return (delim_tab[c >> 4] & (1 << (c & 017)));}e_wding(adot,n)register chroff *adot;int n;{ chroff savdot; savdot = e_dot(); e_gowd(n); *adot = e_dot(); e_go(savdot); if(*adot == savdot) { ring_bell(); return(0); } return(1);}chroffe_wdot(dot,n)chroff dot;int n;{ chroff savdot, retdot; savdot = e_dot(); e_go(dot); e_gowd(n); retdot = e_dot(); e_go(savdot); return(retdot);}e_gowd(n)int n;{ register int (*gch)(), c, cnt; int e_getc(), e_rgetc(); chroff ret_dot; if((cnt = n) == 0) return; if(cnt > 0) gch = e_getc; /* Forward routine */ else { gch = e_rgetc; /* Backward routine */ cnt = -cnt; } do { ret_dot = e_dot(); /* Remember dot for last word found */ while((c = (*gch)()) != EOF && delimp(c)); if(c == EOF) { e_go(ret_dot); /* Use last word found */ break; } while((c = (*gch)()) != EOF && !delimp(c)); if(c == EOF) break; if(n < 0) e_getc(); else e_backc(); } while(--cnt);}/* Searching */e_search(mstr,mlen,backwards)char *mstr;int mlen;int backwards;{ register SBBUF *sb; register char *cp; register int c; char *savcp; int cnt, scnt;#if IMAGEN register int c1; register int caseless = (cur_buf->b_flags & B_TEXTMODE);#endif /*IMAGEN*/ sb = (SBBUF *) cur_buf; if (!backwards) { /* Search forwards */ sfwd: cp = mstr; while((c = sb_getc(sb)) != EOF) {#if IMAGEN if((!caseless && c != *cp) || (caseless && upcase(c) != upcase(*cp))) continue;#else if(c != *cp) continue;#endif /*-IMAGEN*/ cp++; cnt = mlen; while(--cnt > 0) {#if IMAGEN c1 = *cp++; c = e_getc(); if ((!caseless && c1 != c) || (caseless && upcase(c1) != upcase(c)))#else if(*cp++ != (c = e_getc()))#endif /*-IMAGEN*/ { if(c == EOF) return(0); sb_seek(sb,(chroff)(cnt-mlen),1); goto sfwd; } } return(1); } } else { /* Search backwards */ scnt = mlen - 1; savcp = mstr + scnt; /* Point to end of string */ sbck: cp = savcp; while((c = sb_rgetc(sb)) != EOF) {#if IMAGEN if((!caseless && c != *cp) || (caseless && upcase(c) != upcase(*cp))) continue;#else if(c != *cp) continue;#endif /*-IMAGEN*/ cp--; if((cnt = scnt) == 0) return(1); do {#if IMAGEN c1 = *cp--; c = e_rgetc(); if ((!caseless && c1 != c) || (caseless && upcase(c1) != upcase(c)))#else if(*cp-- != (c = e_rgetc()))#endif /*-IMAGEN*/ { if(c == EOF) return(0); sb_seek(sb,(chroff)(mlen-cnt),1); goto sbck; } } while(--cnt); return(1); } } return(0); /* Failed */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -