Lines Matching refs:ep
124 #define editb (*ep->ed)
146 #define location ep->_location
185 register Emacs_t *ep = ed->e_emacs; in ed_emacsread() local
191 if(!ep) in ed_emacsread()
193 ep = ed->e_emacs = newof(0,Emacs_t,1,0); in ed_emacsread()
194 ep->ed = ed; in ed_emacsread()
195 ep->prevdirection = 1; in ed_emacsread()
199 ep->screen = Screen; in ed_emacsread()
200 ep->lastdraw = FINAL; in ed_emacsread()
208 ed_setup(ep->ed,fd,reedit); in ed_emacsread()
233 ep->in_mult = hloff; /* save pos in last command */ in ed_emacsread()
238 if(ep->ed->e_multiline) in ed_emacsread()
241 draw(ep,FINAL); in ed_emacsread()
242 ed_flush(ep->ed); in ed_emacsread()
254 ep->mark = 0; in ed_emacsread()
256 draw(ep,reedit?REFRESH:FIRST); in ed_emacsread()
259 if (ep->CntrlO) in ed_emacsread()
262 ed_ungetchar(ep->ed,cntl('N')); in ed_emacsread()
273 ed_ungetchar(ep->ed,cntl('Y')); in ed_emacsread()
277 ep->CntrlO = 0; in ed_emacsread()
278 while ((c = ed_getchar(ep->ed,0)) != (-1)) in ed_emacsread()
290 draw(ep,APPEND); in ed_emacsread()
322 c = ed_getchar(ep->ed,2); in ed_emacsread()
325 show_info(ep,fmtident(e_version)); in ed_emacsread()
328 ep->mark = i; in ed_emacsread()
331 xcommands(ep,count); in ed_emacsread()
334 ed_flush(ep->ed); in ed_emacsread()
343 if(cur>0 && ep->ed->sh->nextprompt) in ed_emacsread()
345 if(ep->ed->e_tabcount==0) in ed_emacsread()
347 ep->ed->e_tabcount=1; in ed_emacsread()
348 ed_ungetchar(ep->ed,ESC); in ed_emacsread()
351 else if(ep->ed->e_tabcount==1) in ed_emacsread()
353 ed_ungetchar(ep->ed,'='); in ed_emacsread()
356 ep->ed->e_tabcount = 0; in ed_emacsread()
363 ed_ungetchar(ep->ed,c); /* save character for next line */ in ed_emacsread()
370 draw(ep,APPEND); in ed_emacsread()
380 ep->mark = i; in ed_emacsread()
386 draw(ep,UPDATE); in ed_emacsread()
424 ep->mark = i; in ed_emacsread()
430 if (ep->mark > eol ) in ed_emacsread()
431 ep->mark = eol; in ed_emacsread()
432 if (ep->mark == i) in ed_emacsread()
434 if (ep->mark > i) in ed_emacsread()
436 adjust = ep->mark - i; in ed_emacsread()
437 ed_ungetchar(ep->ed,cntl('D')); in ed_emacsread()
440 adjust = i - ep->mark; in ed_emacsread()
441 ed_ungetchar(ep->ed,usrerase); in ed_emacsread()
444 ep->mark = i; in ed_emacsread()
492 c = ed_getchar(ep->ed,1); in ed_emacsread()
516 draw(ep,UPDATE); in ed_emacsread()
559 ep->mark = count; in ed_emacsread()
560 ed_ungetchar(ep->ed,cntl('W')); in ed_emacsread()
565 ep->mark = i; in ed_emacsread()
576 draw(ep,UPDATE); in ed_emacsread()
579 if (ep->terminal == PAPER) in ed_emacsread()
581 putchar(ep->ed,'\n'); in ed_emacsread()
582 putstring(ep,Prompt); in ed_emacsread()
584 c = ed_getchar(ep->ed,0); in ed_emacsread()
587 ed_ungetchar(ep->ed,c); in ed_emacsread()
590 if (ep->terminal == PAPER) in ed_emacsread()
591 ep->terminal = CRT; in ed_emacsread()
594 ep->terminal = PAPER; in ed_emacsread()
595 putchar(ep->ed,'\n'); in ed_emacsread()
596 putstring(ep,Prompt); in ed_emacsread()
601 if(!ep->ed->e_nocrnl) in ed_emacsread()
602 ed_crlf(ep->ed); in ed_emacsread()
603 draw(ep,REFRESH); in ed_emacsread()
604 ep->ed->e_nocrnl = 0; in ed_emacsread()
608 adjust = escape(ep,out,oadjust); in ed_emacsread()
611 search(ep,out,count); in ed_emacsread()
638 ep->CntrlO = 1; in ed_emacsread()
652 location.hist_line = ep->in_mult; in ed_emacsread()
665 draw(ep,UPDATE); in ed_emacsread()
673 draw(ep,UPDATE); in ed_emacsread()
687 draw(ep,FINAL); in ed_emacsread()
698 ed_crlf(ep->ed); in ed_emacsread()
709 static void show_info(Emacs_t *ep,const char *str) in show_info() argument
724 draw(ep,UPDATE); in show_info()
725 c = ed_getchar(ep->ed,0); in show_info()
727 ed_ungetchar(ep->ed,c); in show_info()
731 draw(ep,UPDATE); in show_info()
734 static void putstring(Emacs_t* ep,register char *sp) in putstring() argument
738 putchar(ep->ed,c); in putstring()
742 static int escape(register Emacs_t* ep,register genchar *out,int count) in escape() argument
748 while ((i=ed_getchar(ep->ed,0)),isdigit(i)) in escape()
756 ed_ungetchar(ep->ed,i) ; in escape()
768 show_info(ep,fmtident(e_version)); in escape()
771 ep->mark = cur; in escape()
781 ed_ungetchar(ep->ed,cntl('Y')); in escape()
782 ed_ungetchar(ep->ed,cntl('W')); in escape()
818 draw(ep,UPDATE); in escape()
826 ed_ungetchar(ep->ed,cntl('C')); in escape()
833 ed_ungetchar(ep->ed,cntl('D')); in escape()
863 ed_ungetchar(ep->ed,usrerase); in escape()
872 ed_ungetchar(ep->ed,cntl('N')); in escape()
874 if (ep->in_mult) in escape()
877 location.hist_line = ep->in_mult - 1; in escape()
891 ed_ungetchar(ep->ed,cntl('P')); in escape()
902 ed_ungetchar(ep->ed,'\n'); in escape()
903 ed_ungetchar(ep->ed,(out[0]=='#')?cntl('D'):'#'); in escape()
904 ed_ungetchar(ep->ed,cntl('A')); in escape()
923 ep->mark = cur; in escape()
931 draw(ep,UPDATE); in escape()
941 ep->mark = cur; in escape()
942 if(ed_expand(ep->ed,(char*)out,&cur,&eol,i,count) < 0) in escape()
944 if(ep->ed->e_tabcount==1) in escape()
946 ep->ed->e_tabcount=2; in escape()
947 ed_ungetchar(ep->ed,cntl('\t')); in escape()
954 draw(ep,REFRESH); in escape()
956 ep->ed->e_tabcount=0; in escape()
959 i=ed_getchar(ep->ed,0); in escape()
960 ed_ungetchar(ep->ed,i); in escape()
962 ed_ungetchar(ep->ed,ESC); in escape()
967 if(i=='\\' && cur>ep->mark && (out[cur-1]=='/' || out[cur-1]==' ')) in escape()
968 ep->ed->e_tabcount=0; in escape()
969 draw(ep,UPDATE); in escape()
976 int c = ed_getchar(ep->ed,1); in escape()
1002 draw(ep,UPDATE); in escape()
1008 draw(ep,REFRESH); in escape()
1012 switch(i=ed_getchar(ep->ed,1)) in escape()
1015 if(cur>0 && eol==cur && (cur<(SEARCHSIZE-2) || ep->prevdirection == -2)) in escape()
1017 if(ep->lastdraw==APPEND && ep->prevdirection != -2) in escape()
1025 ep->prevdirection = -2; in escape()
1029 ed_ungetchar(ep->ed,'\r'); in escape()
1030 ed_ungetchar(ep->ed,cntl('R')); in escape()
1035 ed_ungetchar(ep->ed,cntl('P')); in escape()
1038 ed_ungetchar(ep->ed,cntl('N')); in escape()
1041 ed_ungetchar(ep->ed,cntl('F')); in escape()
1044 ed_ungetchar(ep->ed,cntl('B')); in escape()
1047 ed_ungetchar(ep->ed,cntl('A')); in escape()
1050 ed_ungetchar(ep->ed,cntl('E')); in escape()
1053 ed_ungetchar(ep->ed,i); in escape()
1059 if(ed_macro(ep->ed,i)) in escape()
1068 draw(ep,UPDATE); in escape()
1084 static void xcommands(register Emacs_t *ep,int count) in xcommands() argument
1086 register int i = ed_getchar(ep->ed,0); in xcommands()
1091 if (ep->mark > eol) in xcommands()
1092 ep->mark = eol; in xcommands()
1093 i = ep->mark; in xcommands()
1094 ep->mark = cur; in xcommands()
1096 draw(ep,UPDATE); in xcommands()
1102 if(ed_fulledit(ep->ed)==-1) in xcommands()
1109 ed_ungetchar(ep->ed,'\n'); in xcommands()
1139 show_info(ep,hbuf); in xcommands()
1160 show_info(ep,debugbuf); in xcommands()
1173 static void search(Emacs_t* ep,genchar *out,int direction) in search() argument
1189 draw(ep,UPDATE); in search()
1190 while ((i = ed_getchar(ep->ed,1))&&(i != '\r')&&(i != '\n')) in search()
1198 draw(ep,UPDATE); in search()
1214 draw(ep,APPEND); in search()
1215 i = ed_getchar(ep->ed,1); in search()
1221 draw(ep,APPEND); in search()
1225 if(ep->prevdirection == -2 && i!=2 || direction!=1) in search()
1226 ep->prevdirection = -1; in search()
1229 ep->prevdirection = -ep->prevdirection; in search()
1240 ep->prevdirection = direction; in search()
1243 direction = ep->prevdirection ; in search()
1282 static void draw(register Emacs_t *ep,Draw_t option) in draw() argument
1302 ep->lastdraw = option; in draw()
1306 ep->overflow = NORMAL; in draw()
1307 ep->cursor = ep->screen; in draw()
1308 ep->offset = 0; in draw()
1309 ep->cr_ok = crallowed; in draw()
1312 ep->scvalid = 1; in draw()
1315 *ep->cursor = '\0'; in draw()
1316 putstring(ep,Prompt); /* start with prompt */ in draw()
1326 ep->scvalid = 0; /* Screen is out of date, APPEND will not work */ in draw()
1341 if ((option == APPEND)&&(ep->scvalid)&&(*logcursor == '\0')&& in draw()
1342 print(i)&&((ep->cursor-ep->screen)<(w_size-1))) in draw()
1344 putchar(ep->ed,i); in draw()
1345 *ep->cursor++ = i; in draw()
1346 *ep->cursor = '\0'; in draw()
1351 ncursor = nptr + ed_virt_to_phys(ep->ed,sptr,nptr,cur,0,0); in draw()
1365 if ((ep->offset && i<=ep->offset)||(i >= (ep->offset+w_size))) in draw()
1368 ep->offset = i - (w_size>>1); in draw()
1369 if (--ep->offset < 0) in draw()
1370 ep->offset = 0; in draw()
1379 nptr = &nscreen[ep->offset]; in draw()
1380 sptr = ep->screen; in draw()
1403 setcursor(ep,sptr-ep->screen,*nptr); in draw()
1412 ep->cursor++; in draw()
1416 if(ep->ed->e_multiline && option == REFRESH && ep->ed->e_nocrnl==0) in draw()
1417 ed_setcursor(ep->ed, ep->screen, ep->cursor-ep->screen, ep->ed->e_peol, -1); in draw()
1426 if (nscend >= &nscreen[ep->offset+w_size]) in draw()
1428 if (ep->offset > 0) in draw()
1435 if (ep->offset > 0) in draw()
1441 if (longline != ep->overflow) in draw()
1443 setcursor(ep,w_size,longline); in draw()
1444 ep->overflow = longline; in draw()
1446 i = (ncursor-nscreen) - ep->offset; in draw()
1447 setcursor(ep,i,0); in draw()
1448 if(option==FINAL && ep->ed->e_multiline) in draw()
1449 setcursor(ep,nscend+1-nscreen,0); in draw()
1450 ep->scvalid = 1; in draw()
1460 static void setcursor(register Emacs_t *ep,register int newp,int c) in setcursor() argument
1462 register int oldp = ep->cursor - ep->screen; in setcursor()
1463 newp = ed_setcursor(ep->ed, ep->screen, oldp, newp, 0); in setcursor()
1466 putchar(ep->ed,c); in setcursor()
1469 ep->cursor = ep->screen+newp; in setcursor()