home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-09-15 | 48.9 KB | 2,356 lines |
- diff -c ojove/jove.h jove/jove.h
- *** ojove/jove.h Thu Jul 16 09:14:38 1987
- --- jove/jove.h Fri Jul 10 09:25:51 1987
- ***************
- *** 57,71 ****
- #define FORWARD 1
- #define BACKWARD -1
-
- ! #define CTL(c) ('c' & 037)
- ! #define META(c) ('c' | 0200)
- #define RUBOUT '\177'
- ! #define LF CTL(J)
- ! #define CR CTL(M)
- ! #define BS CTL(H)
- #define ESC '\033'
-
- - #define DoTimes(f, n) exp_p = YES, exp = n, f
- #define HALF(wp) ((wp->w_height - 1) / 2)
- #define IsModified(b) (b->b_modified)
- #define SIZE(wp) (wp->w_height - 1)
- --- 57,70 ----
- #define FORWARD 1
- #define BACKWARD -1
-
- ! #define CTL(c) (c & 037)
- ! #define META(c) (c | 0200)
- #define RUBOUT '\177'
- ! #define LF CTL('J')
- ! #define CR CTL('M')
- ! #define BS CTL('H')
- #define ESC '\033'
-
- #define HALF(wp) ((wp->w_height - 1) / 2)
- #define IsModified(b) (b->b_modified)
- #define SIZE(wp) (wp->w_height - 1)
- ***************
- *** 81,86 ****
- --- 80,86 ----
- #define lastp(line) (line == curbuf->b_last)
- #define makedirty(line) line->l_dline |= DIRTY
- #define one_windp() (fwind->w_next == fwind)
- + #define CharUpcase(c) (CaseEquiv[c])
-
- extern int OkayAbort, /* okay to abort redisplay */
- BufSize;
- ***************
- *** 121,126 ****
- --- 121,127 ----
- #define SetMajor(x) ((curbuf->b_major = x), UpdModLine++)
-
- extern char CharTable[NMAJORS][128];
- + extern char CaseEquiv[128];
-
- /* setjmp/longjmp args for DoKeys() mainjmp */
- #define FIRSTCALL 0
- ***************
- *** 192,213 ****
- Process *p_next;
- #ifdef PIPEPROCS
- int p_toproc, /* read p_fromproc and write p_toproc */
- ! p_portpid, /* Pid of child (the portsrv) */
- ! p_pid; /* Pid of real child i.e. not portsrv */
- #else
- ! int p_fd, /* File descriptor of ptyp? opened r/w */
- p_pid; /* pid of child (the shell) */
- #endif
- ! Buffer *p_buffer; /* Add output to end of this buffer */
- char *p_name; /* ... */
- char p_state, /* State */
- p_howdied, /* Killed? or Exited? */
- ! p_reason, /* If signaled, p_reason is the signal; else
- it is the the exit code */
- ! p_eof; /* Received EOF, so can be free'd up */
- ! Mark *p_mark; /* Where output left us. */
- data_obj
- ! *p_cmd; /* Command to call when process dies */
- };
- #endif IPROCS
-
- --- 193,213 ----
- Process *p_next;
- #ifdef PIPEPROCS
- int p_toproc, /* read p_fromproc and write p_toproc */
- ! p_portpid, /* pid of child (the portsrv) */
- ! p_pid; /* pid of real child i.e. not portsrv */
- #else
- ! int p_fd, /* file descriptor of pty? opened r/w */
- p_pid; /* pid of child (the shell) */
- #endif
- ! Buffer *p_buffer; /* add output to end of this buffer */
- char *p_name; /* ... */
- char p_state, /* State */
- p_howdied, /* Killed? or Exited? */
- ! p_reason; /* If signaled, p_reason is the signal; else
- it is the the exit code */
- ! Mark *p_mark; /* where output left us */
- data_obj
- ! *p_cmd; /* command to call when process dies */
- };
- #endif IPROCS
-
- ***************
- *** 242,249 ****
- Line *m_line;
- int m_char;
- Mark *m_next; /* list of marks */
- ! #define FLOATER 1
- ! char m_floater; /* FLOATERing mark? */
- };
-
- struct buffer {
- --- 242,251 ----
- Line *m_line;
- int m_char;
- Mark *m_next; /* list of marks */
- ! #define M_FIXED 00
- ! #define M_FLOATER 01
- ! #define M_BIG_DELETE 02
- ! char m_flags; /* FLOATERing mark? */
- };
-
- struct buffer {
- ***************
- *** 380,387 ****
- ScrollStep, /* how should we scroll */
- WtOnMk, /* write files on compile-it command */
- EndWNewline, /* end files with a blank line */
- ! MarkThresh, /* moves greater than MarkThresh
- ! will SetMark */
- PDelay, /* paren flash delay in tenths of a second */
- CIndIncrmt, /* how much each indentation level pushes
- over in C mode */
- --- 382,388 ----
- ScrollStep, /* how should we scroll */
- WtOnMk, /* write files on compile-it command */
- EndWNewline, /* end files with a blank line */
- ! MarkThresh, /* moves greater than MarkThresh will SetMark */
- PDelay, /* paren flash delay in tenths of a second */
- CIndIncrmt, /* how much each indentation level pushes
- over in C mode */
- ***************
- *** 408,413 ****
- --- 409,415 ----
- SExitChar, /* type this to stop i-search */
- #endif
- IntChar, /* ttysets this to generate QUIT */
- + DoEVexpand, /* treat $foo as environment variable */
- EWSize; /* size to make the error window */
-
- extern char
- ***************
- *** 427,435 ****
- Shell[128]; /* shell to use */
-
- extern int
- - exp, /* argument count */
- - exp_p, /* argument count is supplied */
- -
- TOabort, /* flag set by Typeout() */
- io, /* file descriptor for reading and writing files */
- errormsg, /* last message was an error message
- --- 429,434 ----
- ***************
- *** 539,544 ****
- --- 538,546 ----
- *tgoto(),
- *pr_name(),
- *sprint(),
- + #ifdef IPROCS
- + *pstate(),
- + #endif
- *StrIndex();
-
- extern Bufpos
- diff -c ojove/keymaps.txt jove/keymaps.txt
- *** ojove/keymaps.txt Thu Jul 16 09:14:39 1987
- --- jove/keymaps.txt Thu Jun 11 15:43:50 1987
- ***************
- *** 34,40 ****
- "search-reverse", /* ^R */
- "search-forward", /* ^S */
- "transpose-characters", /* ^T */
- ! "quadruple-numeric-argument", /* ^U */
- "next-page", /* ^V */
- "kill-region", /* ^W */
- "prefix-2", /* ^X */
- --- 34,40 ----
- "search-reverse", /* ^R */
- "search-forward", /* ^S */
- "transpose-characters", /* ^T */
- ! "gather-numeric-argument", /* ^U */
- "next-page", /* ^V */
- "kill-region", /* ^W */
- "prefix-2", /* ^X */
- diff -c ojove/macros.c jove/macros.c
- *** ojove/macros.c Thu Jul 16 09:14:41 1987
- --- jove/macros.c Fri Jun 19 16:01:00 1987
- ***************
- *** 8,14 ****
- #include "jove.h"
-
- struct macro *macros = 0; /* Macros */
- - data_obj *LastCmd;
-
- private
- add_mac(new)
- --- 8,13 ----
- ***************
- *** 84,90 ****
- complain("[Too many macros at once!]");
- macstack[stackp] = mac;
- mac->m_offset = 0;
- ! mac->m_ntimes = exp;
- mac->m_flags |= EXECUTE;
- }
-
- --- 83,89 ----
- complain("[Too many macros at once!]");
- macstack[stackp] = mac;
- mac->m_offset = 0;
- ! mac->m_ntimes = arg_value();
- mac->m_flags |= EXECUTE;
- }
-
- ***************
- *** 362,368 ****
- if (!InJoverc) {
- TOstart("Warning", TRUE);
- Typeout("Warning: your macros file is in the old format.");
- ! Typeout("Do you want me to convert \"%s\" to the new", pr_name(file));
- Typeout("format?");
- f_mess(msg);
- TOstop();
- --- 361,367 ----
- if (!InJoverc) {
- TOstart("Warning", TRUE);
- Typeout("Warning: your macros file is in the old format.");
- ! Typeout("Do you want me to convert \"%s\" to the new", pr_name(file, YES));
- Typeout("format?");
- f_mess(msg);
- TOstop();
- diff -c ojove/marks.c jove/marks.c
- *** ojove/marks.c Thu Jul 16 09:14:42 1987
- --- jove/marks.c Wed Jun 24 13:22:48 1987
- ***************
- *** 17,23 ****
-
- MarkSet(newmark, line, column);
- newmark->m_next = curbuf->b_marks;
- ! newmark->m_floater = type;
- curbuf->b_marks = newmark;
- return newmark;
- }
- --- 17,23 ----
-
- MarkSet(newmark, line, column);
- newmark->m_next = curbuf->b_marks;
- ! newmark->m_flags = type;
- curbuf->b_marks = newmark;
- return newmark;
- }
- ***************
- *** 70,76 ****
- pmark = NMARKS - 1;
- } while (curbuf->b_markring[pmark] != 0);
-
- ! curbuf->b_markring[pmark] = MakeMark(curline, curchar, MarksShouldFloat);
- ToMark(curmark);
- DelMark(curmark);
- curmark = 0;
- --- 70,76 ----
- pmark = NMARKS - 1;
- } while (curbuf->b_markring[pmark] != 0);
-
- ! curbuf->b_markring[pmark] = MakeMark(curline, curchar, MarksShouldFloat ? M_FLOATER : M_FIXED);
- ToMark(curmark);
- DelMark(curmark);
- curmark = 0;
- ***************
- *** 85,102 ****
-
- SetMark()
- {
- ! if (exp_p)
- PopMark();
- else
- ! DoSetMark(curline, curchar);
- }
-
- ! DoSetMark(l, c)
- Line *l;
- {
- curbuf->b_themark = (curbuf->b_themark + 1) % NMARKS;
- if (curmark == 0)
- ! curmark = MakeMark(l, c, MarksShouldFloat);
- else
- MarkSet(curmark, l, c);
- s_mess("[Point pushed]");
- --- 85,107 ----
-
- SetMark()
- {
- ! if (is_an_arg())
- PopMark();
- else
- ! set_mark();
- }
-
- ! set_mark()
- ! {
- ! do_set_mark(curline, curchar);
- ! }
- !
- ! do_set_mark(l, c)
- Line *l;
- {
- curbuf->b_themark = (curbuf->b_themark + 1) % NMARKS;
- if (curmark == 0)
- ! curmark = MakeMark(l, c, MarksShouldFloat ? M_FLOATER : M_FIXED);
- else
- MarkSet(curmark, l, c);
- s_mess("[Point pushed]");
- ***************
- *** 151,167 ****
- if (curbuf->b_marks == 0)
- return;
- while (lp != line2->l_next) {
- ! for (m = curbuf->b_marks; m != 0; m = m->m_next) {
- ! /* if (!m->m_floater)
- ! continue; */
- if (m->m_line == lp)
- m->m_char |= (1 << 15);
- - }
- lp = lp->l_next;
- }
- for (m = curbuf->b_marks; m; m = m->m_next) {
- - /* if (!m->m_floater)
- - continue; */
- if ((m->m_char & (1 << 15)) == 0)
- continue; /* Not effected */
- m->m_char &= ~(1 << 15);
- --- 156,167 ----
- if (curbuf->b_marks == 0)
- return;
- while (lp != line2->l_next) {
- ! for (m = curbuf->b_marks; m != 0; m = m->m_next)
- if (m->m_line == lp)
- m->m_char |= (1 << 15);
- lp = lp->l_next;
- }
- for (m = curbuf->b_marks; m; m = m->m_next) {
- if ((m->m_char & (1 << 15)) == 0)
- continue; /* Not effected */
- m->m_char &= ~(1 << 15);
- ***************
- *** 178,187 ****
- --- 178,189 ----
- m->m_char = char1 + (m->m_char - char2);
- else
- m->m_char = char1;
- + m->m_flags |= M_BIG_DELETE;
- m->m_line = line1;
- } else {
- m->m_char = char1;
- m->m_line = line1;
- + m->m_flags |= M_BIG_DELETE;
- }
- }
- }
- ***************
- *** 196,202 ****
- register Mark *m;
-
- for (m = curbuf->b_marks; m != 0; m = m->m_next) {
- ! if (!m->m_floater)
- continue;
- if (m->m_line == line1) {
- if (m->m_char > char1) {
- --- 198,204 ----
- register Mark *m;
-
- for (m = curbuf->b_marks; m != 0; m = m->m_next) {
- ! if ((m->m_flags & M_FLOATER) == 0)
- continue;
- if (m->m_line == line1) {
- if (m->m_char > char1) {
- diff -c ojove/misc.c jove/misc.c
- *** ojove/misc.c Thu Jul 16 09:14:43 1987
- --- jove/misc.c Fri Jul 10 09:25:50 1987
- ***************
- *** 12,161 ****
- #include "termcap.h"
- #endif
-
- - Digit()
- - {
- - GetExp(LastKeyStruck);
- - }
- -
- - Digit0()
- - {
- - GetExp('0');
- - }
- -
- - Digit1()
- - {
- - GetExp('1');
- - }
- -
- - Digit2()
- - {
- - GetExp('2');
- - }
- -
- - Digit3()
- - {
- - GetExp('3');
- - }
- -
- - Digit4()
- - {
- - GetExp('4');
- - }
- -
- - Digit5()
- - {
- - GetExp('5');
- - }
- -
- - Digit6()
- - {
- - GetExp('6');
- - }
- -
- - Digit7()
- - {
- - GetExp('7');
- - }
- -
- - Digit8()
- - {
- - GetExp('8');
- - }
- -
- - Digit9()
- - {
- - GetExp('9');
- - }
- -
- prCTIME()
- {
- s_mess(": %f %s", get_time((time_t *) 0, (char *) 0, 0, -1));
- }
-
- - extern int alarmed;
- -
- - FourTime()
- - {
- - int oldc = LastKeyStruck,
- - newc;
- - int nexp;
- -
- - alarmed = 0;
- - exp_p = YES;
- - this_cmd = ARG_CMD;
- - do {
- - if ((nexp = exp * 4) != 0)
- - exp = nexp;
- - if (!alarmed)
- - newc = waitchar();
- - else
- - newc = getch();
- - if (alarmed)
- - message(key_strokes);
- - } while (newc == oldc);
- - Ungetc(newc);
- - }
- -
- - int exp_p,
- - exp;
- -
- - GetExp(c)
- - {
- - int sign = 0;
- - static int digited;
- -
- - if (!isdigit(c) && c != '-')
- - complain((char *) 0);
- - if (exp_p == NO) { /* if we just got here */
- - exp = 0; /* start over */
- - digited = NO;
- - } else if (exp_p == YES_NODIGIT) {
- - sign = (exp < 0) ? -1 : 1;
- - exp = 0;
- - }
- -
- - if (!sign)
- - sign = (exp < 0) ? -1 : 1;
- - if (sign == -1)
- - exp = -exp;
- - if (c == '-') {
- - sign = -sign;
- - goto goread;
- - }
- - for (;;) {
- - if (alarmed)
- - message(key_strokes);
- - if (isdigit(c)) {
- - exp = (exp * 10) + (c - '0');
- - digited++;
- - } else {
- - if (digited)
- - exp_p = YES;
- - else {
- - exp = 1;
- - if (exp_p == NO)
- - exp_p = YES_NODIGIT;
- - }
- - exp *= sign;
- - this_cmd = ARG_CMD;
- - Ungetc(c);
- - return;
- - }
- - goread: if (!alarmed)
- - c = waitchar();
- - else {
- - add_mess(NullStr);
- - c = getch();
- - }
- - }
- - }
- -
- ChrToOct()
- {
- ! int c;
-
- ! c = waitchar();
- ! if (alarmed)
- message(key_strokes);
- ins_str(sprint("\\%03o", c), NO);
- }
- --- 12,29 ----
- #include "termcap.h"
- #endif
-
- prCTIME()
- {
- s_mess(": %f %s", get_time((time_t *) 0, (char *) 0, 0, -1));
- }
-
- ChrToOct()
- {
- ! int c,
- ! slow;
-
- ! c = waitchar(&slow);
- ! if (slow)
- message(key_strokes);
- ins_str(sprint("\\%03o", c), NO);
- }
- ***************
- *** 197,209 ****
-
- if (curchar == 0 || (eolp() && curchar == 1))
- complain((char *) 0); /* BEEP */
- - exp = 1;
- if (eolp())
- ! BackChar();
- before = linebuf[curchar - 1];
- ! DelPChar();
- ! ForChar();
- ! Insert(before);
- }
-
- /* Switch current line with previous one */
- --- 65,76 ----
-
- if (curchar == 0 || (eolp() && curchar == 1))
- complain((char *) 0); /* BEEP */
- if (eolp())
- ! b_char(1);
- before = linebuf[curchar - 1];
- ! del_char(BACKWARD, 1);
- ! f_char(1);
- ! insert_c(before, 1);
- }
-
- /* Switch current line with previous one */
- ***************
- *** 214,220 ****
-
- if (firstp(curline))
- return;
- - exp = 1;
- lsave();
- old_prev = curline->l_prev->l_dline;
- curline->l_prev->l_dline = curline->l_dline;
- --- 81,86 ----
- ***************
- *** 221,227 ****
- curline->l_dline = old_prev;
- getDOT();
- if (!lastp(curline))
- ! line_move(FORWARD, NO);
- modify();
- }
-
- --- 87,93 ----
- curline->l_dline = old_prev;
- getDOT();
- if (!lastp(curline))
- ! line_move(FORWARD, 1, NO);
- modify();
- }
-
- ***************
- *** 239,252 ****
- {
- Line *line2;
- int char2;
-
- ! if (exp_p) {
- ! if (exp == 0) { /* Kill to beginning of line */
- line2 = curline;
- char2 = 0;
- } else {
- ! line2 = next_line(curline, exp);
- ! if ((LineDist(curline, line2) < exp) || (line2 == curline))
- char2 = length(line2);
- else
- char2 = 0;
- --- 105,119 ----
- {
- Line *line2;
- int char2;
- + int num = arg_value();
-
- ! if (is_an_arg()) {
- ! if (num == 0) { /* Kill to beginning of line */
- line2 = curline;
- char2 = 0;
- } else {
- ! line2 = next_line(curline, num);
- ! if ((LineDist(curline, line2) < num) || (line2 == curline))
- char2 = length(line2);
- else
- char2 = 0;
- ***************
- *** 264,274 ****
- reg_kill(line2, char2, 0);
- }
-
- ! /* Kill to beginning of sentence */
-
- KillBos()
- {
- ! exp = -exp;
- KillEos();
- }
-
- --- 131,141 ----
- reg_kill(line2, char2, 0);
- }
-
- ! /* kill to beginning of sentence */
-
- KillBos()
- {
- ! negate_arg_value();
- KillEos();
- }
-
- ***************
- *** 316,330 ****
- {
- register data_obj *cp;
- register int c;
-
- ! c = waitchar();
- ! if (c == CTL(G)) {
- message("[Aborted]");
- rbell();
- return;
- }
-
- ! if (alarmed)
- message(key_strokes);
-
- cp = map[c];
- --- 183,198 ----
- {
- register data_obj *cp;
- register int c;
- + int slow;
-
- ! c = waitchar(&slow);
- ! if (c == CTL('G')) {
- message("[Aborted]");
- rbell();
- return;
- }
-
- ! if (slow)
- message(key_strokes);
-
- cp = map[c];
- ***************
- *** 348,354 ****
- line = killbuf[killptr];
- lp = lastline(line);
- dot = DoYank(line, 0, lp, length(lp), curline, curchar, curbuf);
- ! SetMark();
- SetDot(dot);
- }
-
- --- 216,222 ----
- line = killbuf[killptr];
- lp = lastline(line);
- dot = DoYank(line, 0, lp, length(lp), curline, curchar, curbuf);
- ! set_mark();
- SetDot(dot);
- }
-
- ***************
- *** 357,363 ****
- if (!ModBufs(NO))
- message("[No buffers need saving]");
- else
- ! put_bufs(exp_p);
- }
-
- put_bufs(askp)
- --- 225,231 ----
- if (!ModBufs(NO))
- message("[No buffers need saving]");
- else
- ! put_bufs(is_an_arg());
- }
-
- put_bufs(askp)
- ***************
- *** 403,418 ****
- Line *newline;
-
- #ifndef ANSICODES
- ! if (exp_p == NO)
- return;
- #else
- ! if (exp_p == NO || exp <= 0) {
- if (SP)
- putpad(SP, 1); /* Ask for cursor position */
- return;
- }
- #endif
- ! newline = next_line(curbuf->b_first, exp - 1);
- PushPntp(newline);
- SetLine(newline);
- }
- --- 271,286 ----
- Line *newline;
-
- #ifndef ANSICODES
- ! if (!is_an_arg())
- return;
- #else
- ! if (!is_an_arg() || arg_value() <= 0) {
- if (SP)
- putpad(SP, 1); /* Ask for cursor position */
- return;
- }
- #endif
- ! newline = next_line(curbuf->b_first, arg_value() - 1);
- PushPntp(newline);
- SetLine(newline);
- }
- ***************
- *** 440,452 ****
- static char *unsupported = "[Unsupported ANSI code received]";
-
- while (isdigit(c = getch()))
- ! num1 = (num1*10) + (c - '0');
-
- switch (c) {
- case ';':
- num2 = 0;
- while (isdigit(c = getch()))
- ! num2 = (num2*10) + (c - '0');
- switch (c) {
- case 'R':
- MoveToCursor(--num1, --num2);
- --- 308,320 ----
- static char *unsupported = "[Unsupported ANSI code received]";
-
- while (isdigit(c = getch()))
- ! num1 = (num1 * 10) + (c - '0');
-
- switch (c) {
- case ';':
- num2 = 0;
- while (isdigit(c = getch()))
- ! num2 = (num2 * 10) + (c - '0');
- switch (c) {
- case 'R':
- MoveToCursor(--num1, --num2);
- ***************
- *** 459,468 ****
- }
- break;
- case 'A':
- ! line_move(BACKWARD, YES);
- break;
- case 'B':
- ! line_move(FORWARD, YES);
- break;
- case 'C':
- ForChar();
- --- 327,336 ----
- }
- break;
- case 'A':
- ! PrevLine();
- break;
- case 'B':
- ! NextLine();
- break;
- case 'C':
- ForChar();
- ***************
- *** 479,484 ****
- --- 347,369 ----
- break;
- }
- /* FALL THROUGH */
- +
- + case 'P':
- + PrevPage();
- + break;
- +
- + case 'Q':
- + NextPage();
- + break;
- +
- + case 'R':
- + UpScroll();
- + break;
- +
- + case 'S':
- + DownScroll();
- + break;
- +
- default:
- complain(unsupported);
- }
- diff -c ojove/move.c jove/move.c
- *** ojove/move.c Thu Jul 16 09:14:44 1987
- --- jove/move.c Fri Jun 12 11:53:33 1987
- ***************
- *** 10,26 ****
-
- static int line_pos;
-
- ! ForChar()
- {
- - register int num = exp;
-
- ! if (exp < 0) {
- ! exp = -exp;
- ! BackChar();
- return;
- }
- ! exp = 1;
- ! while (--num >= 0) {
- if (eolp()) { /* Go to the next Line */
- if (curline->l_next == 0)
- break;
- --- 10,24 ----
-
- static int line_pos;
-
- ! f_char(n)
- ! register int n;
- {
-
- ! if (n < 0) {
- ! b_char(-n);
- return;
- }
- ! while (--n >= 0) {
- if (eolp()) { /* Go to the next Line */
- if (curline->l_next == 0)
- break;
- ***************
- *** 30,46 ****
- }
- }
-
- ! BackChar()
- {
- - register int num = exp;
-
- ! if (exp < 0) {
- ! exp = -exp;
- ! ForChar();
- return;
- }
- ! exp = 1;
- ! while (--num >= 0) {
- if (bolp()) {
- if (curline->l_prev == 0)
- break;
- --- 28,42 ----
- }
- }
-
- ! b_char(n)
- ! register int n;
- {
-
- ! if (n < 0) {
- ! f_char(-n);
- return;
- }
- ! while (--n >= 0) {
- if (bolp()) {
- if (curline->l_prev == 0)
- break;
- ***************
- *** 51,61 ****
- }
- }
-
- NextLine()
- {
- if ((curline == curbuf->b_last) && eolp())
- complain(NullStr);
- ! line_move(FORWARD, YES);
- }
-
- PrevLine()
- --- 47,67 ----
- }
- }
-
- + ForChar()
- + {
- + f_char(arg_value());
- + }
- +
- + BackChar()
- + {
- + b_char(arg_value());
- + }
- +
- NextLine()
- {
- if ((curline == curbuf->b_last) && eolp())
- complain(NullStr);
- ! line_move(FORWARD, arg_value(), YES);
- }
-
- PrevLine()
- ***************
- *** 62,68 ****
- {
- if ((curline == curbuf->b_first) && bolp())
- complain(NullStr);
- ! line_move(BACKWARD, YES);
- }
-
- /* moves to a different line in DIR; LINE_CMD says whether this is
- --- 68,74 ----
- {
- if ((curline == curbuf->b_first) && bolp())
- complain(NullStr);
- ! line_move(BACKWARD, arg_value(), YES);
- }
-
- /* moves to a different line in DIR; LINE_CMD says whether this is
- ***************
- *** 69,80 ****
- being called from NextLine() or PrevLine(), in which case it tries
- to line up the column with the column of the current line */
-
- ! line_move(dir, line_cmd)
- {
- Line *(*proc)() = (dir == FORWARD) ? next_line : prev_line;
- Line *line;
-
- ! line = (*proc)(curline, exp);
- if (line == curline) {
- (dir == FORWARD) ? Eol() : Bol();
- return;
- --- 75,86 ----
- being called from NextLine() or PrevLine(), in which case it tries
- to line up the column with the column of the current line */
-
- ! line_move(dir, n, line_cmd)
- {
- Line *(*proc)() = (dir == FORWARD) ? next_line : prev_line;
- Line *line;
-
- ! line = (*proc)(curline, n);
- if (line == curline) {
- (dir == FORWARD) ? Eol() : Bol();
- return;
- ***************
- *** 142,147 ****
- --- 148,154 ----
- with all the kludgery involved with paragraphs, and moving backwards
- is particularly yucky. */
-
- + private
- to_sent(dir)
- {
- Bufpos *new,
- ***************
- *** 152,158 ****
-
- new = dosearch("^[ \t]*$\\|[?.!]", dir, 1);
- if (new == 0) {
- ! (dir < 0) ? ToFirst() : ToLast();
- return;
- }
- SetDot(new);
- --- 159,165 ----
-
- new = dosearch("^[ \t]*$\\|[?.!]", dir, 1);
- if (new == 0) {
- ! (dir == BACKWARD) ? ToFirst() : ToLast();
- return;
- }
- SetDot(new);
- ***************
- *** 168,174 ****
- }
- if (blnkp(linebuf)) {
- Bol();
- ! BackChar();
- if (old.p_line == curline && old.p_char >= curchar) {
- to_word(1); /* Oh brother this is painful */
- to_sent(1);
- --- 175,181 ----
- }
- if (blnkp(linebuf)) {
- Bol();
- ! b_char(1);
- if (old.p_line == curline && old.p_char >= curchar) {
- to_word(1); /* Oh brother this is painful */
- to_sent(1);
- ***************
- *** 186,201 ****
-
- Bos()
- {
- ! int num = exp;
-
- ! if (exp < 0) {
- ! exp = -exp;
- Eos();
- return;
- }
-
- - exp = 1;
- -
- while (--num >= 0) {
- to_sent(-1);
- if (bobp())
- --- 193,206 ----
-
- Bos()
- {
- ! register int num = arg_value();
-
- ! if (num < 0) {
- ! negate_arg_value();
- Eos();
- return;
- }
-
- while (--num >= 0) {
- to_sent(-1);
- if (bobp())
- ***************
- *** 205,220 ****
-
- Eos()
- {
- ! int num = exp;
-
- ! if (exp < 0) {
- ! exp = -exp;
- Bos();
- return;
- }
-
- - exp = 1;
- -
- while (--num >= 0) {
- to_sent(1);
- if (eobp())
- --- 210,223 ----
-
- Eos()
- {
- ! register int num = arg_value();
-
- ! if (num < 0) {
- ! negate_arg_value();
- Bos();
- return;
- }
-
- while (--num >= 0) {
- to_sent(1);
- if (eobp())
- ***************
- *** 222,240 ****
- }
- }
-
- ! ForWord()
- {
- register char c;
- - register int num = exp;
-
- ! if (exp < 0) {
- ! exp = -exp;
- ! BackWord();
- return;
- }
- - exp = 1;
- while (--num >= 0) {
- ! to_word(1);
- while ((c = linebuf[curchar]) != 0 && isword(c))
- curchar++;
- if (eobp())
- --- 225,241 ----
- }
- }
-
- ! f_word(num)
- ! register int num;
- {
- register char c;
-
- ! if (num < 0) {
- ! b_word(-num);
- return;
- }
- while (--num >= 0) {
- ! to_word(FORWARD);
- while ((c = linebuf[curchar]) != 0 && isword(c))
- curchar++;
- if (eobp())
- ***************
- *** 243,261 ****
- this_cmd = 0; /* Semi kludge to stop some unfavorable behavior */
- }
-
- ! BackWord()
- {
- - register int num = exp;
- register char c;
-
- ! if (exp < 0) {
- ! exp = -exp;
- ! ForWord();
- return;
- }
- - exp = 1;
- while (--num >= 0) {
- ! to_word(-1);
- while (!bolp() && (c = linebuf[curchar - 1], isword(c)))
- --curchar;
- if (bobp())
- --- 244,260 ----
- this_cmd = 0; /* Semi kludge to stop some unfavorable behavior */
- }
-
- ! b_word(num)
- ! register int num;
- {
- register char c;
-
- ! if (num < 0) {
- ! f_word(-num);
- return;
- }
- while (--num >= 0) {
- ! to_word(BACKWARD);
- while (!bolp() && (c = linebuf[curchar - 1], isword(c)))
- --curchar;
- if (bobp())
- ***************
- *** 263,265 ****
- --- 262,275 ----
- }
- this_cmd = 0;
- }
- +
- + ForWord()
- + {
- + f_word(arg_value());
- + }
- +
- + BackWord()
- + {
- + b_word(arg_value());
- + }
- +
- diff -c ojove/paragraph.c jove/paragraph.c
- *** ojove/paragraph.c Thu Jul 16 09:14:45 1987
- --- jove/paragraph.c Wed Jun 24 12:43:24 1987
- ***************
- *** 204,210 ****
- int this_indent;
- Bufpos orig; /* remember where we were when we started */
-
- - exp = 1;
- DOTsave(&orig);
- strt:
- this = curline;
- --- 204,209 ----
- ***************
- *** 218,224 ****
- if (firstp(curline))
- complain((char *) 0);
- else
- ! line_move(BACKWARD, NO);
- goto strt;
- } else {
- while (i_blank(curline))
- --- 217,223 ----
- if (firstp(curline))
- complain((char *) 0);
- else
- ! line_move(BACKWARD, 1, NO);
- goto strt;
- } else {
- while (i_blank(curline))
- ***************
- *** 225,231 ****
- if (lastp(curline))
- complain((char *) 0);
- else
- ! line_move(FORWARD, NO);
- head = curline;
- next = curline->l_next;
- if (!i_bsblank(next))
- --- 224,230 ----
- if (lastp(curline))
- complain((char *) 0);
- else
- ! line_move(FORWARD, 1, NO);
- head = curline;
- next = curline->l_next;
- if (!i_bsblank(next))
- ***************
- *** 302,308 ****
-
- Justify()
- {
- ! use_lmargin = (exp_p != NO);
- find_para(BACKWARD);
- DoJustify(para_head, 0, para_tail, length(para_tail), NO,
- use_lmargin ? LMargin : body_indent);
- --- 301,307 ----
-
- Justify()
- {
- ! use_lmargin = is_an_arg();
- find_para(BACKWARD);
- DoJustify(para_head, 0, para_tail, length(para_tail), NO,
- use_lmargin ? LMargin : body_indent);
- ***************
- *** 339,345 ****
- Line *rl1,
- *rl2;
-
- ! use_lmargin = (exp_p != NO);
- (void) fixorder(&l1, &c1, &l2, &c2);
- do {
- DotTo(l1, c1);
- --- 338,344 ----
- Line *rl1,
- *rl2;
-
- ! use_lmargin = is_an_arg();
- (void) fixorder(&l1, &c1, &l2, &c2);
- do {
- DotTo(l1, c1);
- ***************
- *** 346,352 ****
- find_para(FORWARD);
- rl1 = max_line(l1, para_head);
- rl2 = min_line(l2, para_tail);
- ! tailmark = MakeMark(para_tail, 0, FLOATER);
- DoJustify(rl1, (rl1 == l1) ? c1 : 0, rl2,
- (rl2 == l2) ? c2 : length(rl2),
- NO, use_lmargin ? LMargin : body_indent);
- --- 345,351 ----
- find_para(FORWARD);
- rl1 = max_line(l1, para_head);
- rl2 = min_line(l2, para_tail);
- ! tailmark = MakeMark(para_tail, 0, M_FLOATER);
- DoJustify(rl1, (rl1 == l1) ? c1 : 0, rl2,
- (rl2 == l2) ? c2 : length(rl2),
- NO, use_lmargin ? LMargin : body_indent);
- ***************
- *** 356,362 ****
- } while (l1 != 0 && l2 != rl2);
- }
-
- ! do_rfill()
- {
- Mark *mp = CurMark();
- Line *l1 = curline,
- --- 355,361 ----
- } while (l1 != 0 && l2 != rl2);
- }
-
- ! do_rfill(ulm)
- {
- Mark *mp = CurMark();
- Line *l1 = curline,
- ***************
- *** 364,370 ****
- int c1 = curchar,
- c2 = mp->m_char;
-
- ! use_lmargin = (exp_p != NO);
- (void) fixorder(&l1, &c1, &l2, &c2);
- DoJustify(l1, c1, l2, c2, NO, use_lmargin ? LMargin : 0);
- }
- --- 363,369 ----
- int c1 = curchar,
- c2 = mp->m_char;
-
- ! use_lmargin = ulm;
- (void) fixorder(&l1, &c1, &l2, &c2);
- DoJustify(l1, c1, l2, c2, NO, use_lmargin ? LMargin : 0);
- }
- ***************
- *** 403,411 ****
- nspace = 0;
-
- if (diff > nspace)
- ! DoTimes(DelPChar(), (diff - nspace));
- else if (diff < nspace)
- ! DoTimes(Insert(' '), (nspace - diff));
- }
-
- DoJustify(l1, c1, l2, c2, scrunch, indent)
- --- 402,410 ----
- nspace = 0;
-
- if (diff > nspace)
- ! del_char(BACKWARD, (diff - nspace));
- else if (diff < nspace)
- ! insert_c(' ', (nspace - diff));
- }
-
- DoJustify(l1, c1, l2, c2, scrunch, indent)
- ***************
- *** 414,423 ****
- {
- int okay_char = -1;
- char *cp;
- ! Mark *savedot = MakeMark(curline, curchar, FLOATER),
- *endmark;
-
- - exp = 1;
- (void) fixorder(&l1, &c1, &l2, &c2); /* l1/c1 will be before l2/c2 */
- DotTo(l1, c1);
- if (get_indent(l1) >= c1) {
- --- 413,421 ----
- {
- int okay_char = -1;
- char *cp;
- ! Mark *savedot = MakeMark(curline, curchar, M_FLOATER),
- *endmark;
-
- (void) fixorder(&l1, &c1, &l2, &c2); /* l1/c1 will be before l2/c2 */
- DotTo(l1, c1);
- if (get_indent(l1) >= c1) {
- ***************
- *** 427,474 ****
- }
- ToIndent();
- }
- ! endmark = MakeMark(l2, c2, FLOATER);
-
- for (;;) {
- ! cp = StrIndex(1, linebuf, curchar, ' ');
- ! if (cp == 0)
- ! Eol();
- ! else
- ! curchar = (cp - linebuf);
- ! if (curline == endmark->m_line && curchar >= endmark->m_char)
- ! goto outahere;
- ! if (eolp()) {
- ! ins_str(" ", NO);
- ! DelNChar(); /* delete line separator */
- ! curchar -= 2; /* back over the spaces */
- ! }
- ! /* at this point we are ALWAYS sitting right after
- ! a word - that is, just before some spaces or the
- ! end of the line */
- ! if (calc_pos(linebuf, curchar) <= RMargin) {
- okay_char = curchar;
- do_space();
- - continue;
- }
- -
- - /* if we get here, we have done all we can for
- - this line - now we split the line, or just move
- - to the next one */
- if (okay_char > 0)
- curchar = okay_char;
- if (curline == endmark->m_line && curchar >= endmark->m_char)
- goto outahere;
- ! /* can't fit in small margin, so we do the best we can */
- if (eolp()) {
- ! line_move(FORWARD, NO);
- n_indent(indent);
- } else {
- - /* insert a line break - line WAS too long */
- DelWtSpace();
- LineInsert(1);
- if (scrunch && TwoBlank()) {
- Eol();
- ! DelNChar();
- }
- n_indent(indent);
- }
- --- 425,464 ----
- }
- ToIndent();
- }
- ! endmark = MakeMark(l2, c2, M_FLOATER);
-
- for (;;) {
- ! while (calc_pos(linebuf, curchar) < RMargin) {
- ! if (curline == endmark->m_line && curchar >= endmark->m_char)
- ! goto outahere;
- okay_char = curchar;
- + if (eolp()) {
- + del_char(FORWARD, 1); /* Delete line separator. */
- + ins_str(" ", NO);
- + } else {
- + cp = StrIndex(1, linebuf, curchar + 1, ' ');
- + if (cp == 0)
- + Eol();
- + else
- + curchar = (cp - linebuf);
- + }
- do_space();
- }
- if (okay_char > 0)
- curchar = okay_char;
- if (curline == endmark->m_line && curchar >= endmark->m_char)
- goto outahere;
- !
- ! /* Can't fit in small margin, so we do the best we can. */
- if (eolp()) {
- ! line_move(FORWARD, 1, NO);
- n_indent(indent);
- } else {
- DelWtSpace();
- LineInsert(1);
- if (scrunch && TwoBlank()) {
- Eol();
- ! del_char(FORWARD, 1);
- }
- n_indent(indent);
- }
- ***************
- *** 486,492 ****
-
- DoPara(dir)
- {
- ! register int num = exp,
- first_time = TRUE;
-
- while (--num >= 0) {
- --- 476,482 ----
-
- DoPara(dir)
- {
- ! register int num = arg_value(),
- first_time = TRUE;
-
- while (--num >= 0) {
- ***************
- *** 495,501 ****
- ((!first_time) || ((para_head == curline) && bolp()))) {
- if (bobp())
- complain((char *) 0);
- ! BackChar();
- first_time = !first_time;
- goto tryagain;
- }
- --- 485,491 ----
- ((!first_time) || ((para_head == curline) && bolp()))) {
- if (bobp())
- complain((char *) 0);
- ! b_char(1);
- first_time = !first_time;
- goto tryagain;
- }
- ***************
- *** 502,508 ****
- SetLine((dir == BACKWARD) ? para_head : para_tail);
- if (dir == BACKWARD && !firstp(curline) &&
- i_blank(curline->l_prev))
- ! line_move(BACKWARD, NO);
- else if (dir == FORWARD) {
- if (lastp(curline)) {
- Eol();
- --- 492,498 ----
- SetLine((dir == BACKWARD) ? para_head : para_tail);
- if (dir == BACKWARD && !firstp(curline) &&
- i_blank(curline->l_prev))
- ! line_move(BACKWARD, 1, NO);
- else if (dir == FORWARD) {
- if (lastp(curline)) {
- Eol();
- ***************
- *** 509,515 ****
- break;
- }
- /* otherwise */
- ! line_move(FORWARD, NO);
- }
- }
- }
- --- 499,505 ----
- break;
- }
- /* otherwise */
- ! line_move(FORWARD, 1, NO);
- }
- }
- }
- diff -c ojove/proc.c jove/proc.c
- *** ojove/proc.c Thu Jul 16 09:14:48 1987
- --- jove/proc.c Thu Jun 25 09:45:20 1987
- ***************
- *** 124,130 ****
- }
- if (cur_error != 0)
- ShowErr();
- - exp = 1;
- }
-
- /* Free up all the errors */
- --- 124,129 ----
- ***************
- *** 145,153 ****
- noerrs[] = "No errors!";
-
- private
- ! toerror(forward)
- {
- - register int i;
- register struct error *e = cur_error;
-
- if (e == 0)
- --- 144,151 ----
- noerrs[] = "No errors!";
-
- private
- ! toerror(forward, num)
- {
- register struct error *e = cur_error;
-
- if (e == 0)
- ***************
- *** 156,162 ****
- (!forward && (e->er_prev == 0)))
- complain(errbounds, forward ? "last" : "first");
-
- ! for (i = 0; i < exp; i++) {
- if ((e = forward ? e->er_next : e->er_prev) == 0)
- break;
- cur_error = e;
- --- 154,160 ----
- (!forward && (e->er_prev == 0)))
- complain(errbounds, forward ? "last" : "first");
-
- ! while (--num >= 0) {
- if ((e = forward ? e->er_next : e->er_prev) == 0)
- break;
- cur_error = e;
- ***************
- *** 187,194 ****
- ToError(forward)
- {
- do {
- ! toerror(forward);
- ! exp = 1;
- } while (!okay_error());
- ShowErr();
- }
- --- 185,191 ----
- ToError(forward)
- {
- do {
- ! toerror(forward, arg_value());
- } while (!okay_error());
- ShowErr();
- }
- ***************
- *** 293,303 ****
- default command and let the person decide. */
-
- compilation = (sindex("make", make_cmd) || sindex("cc", make_cmd));
- ! if (exp_p || !compilation) {
- if (!compilation) {
- rbell();
- ! Inputp = make_cmd; /* insert the default for the
- ! user */
- }
- null_ncpy(make_cmd, ask(make_cmd, "Compilation command: "),
- sizeof (make_cmd) - 1);
- --- 290,299 ----
- default command and let the person decide. */
-
- compilation = (sindex("make", make_cmd) || sindex("cc", make_cmd));
- ! if (is_an_arg() || !compilation) {
- if (!compilation) {
- rbell();
- ! Inputp = make_cmd; /* insert the default for the user */
- }
- null_ncpy(make_cmd, ask(make_cmd, "Compilation command: "),
- sizeof (make_cmd) - 1);
- ***************
- *** 367,373 ****
- curline, curchar);
- }
- SetBuf(wordsb);
- ! line_move(FORWARD, NO);
- }
- add_mess("Done.");
- SetBuf(buftospel);
- --- 363,369 ----
- curline, curchar);
- }
- SetBuf(wordsb);
- ! line_move(FORWARD, 1, NO);
- }
- add_mess("Done.");
- SetBuf(buftospel);
- ***************
- *** 378,387 ****
-
- ShToBuf()
- {
- ! char bufname[100];
-
- strcpy(bufname, ask((char *) 0, "Buffer: "));
- ! DoShell(bufname, ask(ShcomBuf, "Command: "));
- }
-
- ShellCom()
- --- 374,385 ----
-
- ShToBuf()
- {
- ! char bufname[128],
- ! cmd[128];
-
- strcpy(bufname, ask((char *) 0, "Buffer: "));
- ! strcpy(cmd, ask(ShcomBuf, "Command: "));
- ! DoShell(bufname, cmd);
- }
-
- ShellCom()
- ***************
- *** 402,409 ****
- Window *savewp = curwind;
- int status;
-
- ! exp = 1;
- ! status = UnixToBuf(bufname, YES, 0, !exp_p, Shell,
- ShFlags, command, (char *) 0);
- com_finish(status, command);
- SetWind(savewp);
- --- 400,406 ----
- Window *savewp = curwind;
- int status;
-
- ! status = UnixToBuf(bufname, YES, 0, !is_an_arg(), Shell,
- ShFlags, command, (char *) 0);
- com_finish(status, command);
- SetWind(savewp);
- ***************
- *** 465,471 ****
- to fix everything up after we're done. (Usually there's nothing to
- fix up.) */
-
- ! /* VARARGS5 */
-
- UnixToBuf(bufname, disp, wsize, clobber, va_alist)
- char *bufname;
- --- 462,468 ----
- to fix everything up after we're done. (Usually there's nothing to
- fix up.) */
-
- ! /* VARARGS4 */
-
- UnixToBuf(bufname, disp, wsize, clobber, va_alist)
- char *bufname;
- ***************
- *** 517,523 ****
- #else
- old_int = signal(SIGINT, SIG_IGN),
- #endif
- - exp = 1;
- dopipe(p);
- pid = fork();
- if (pid == -1) {
- --- 514,519 ----
- ***************
- *** 621,633 ****
- {
- Mark *m = CurMark();
- char *tname = mktemp("/tmp/jfilterXXXXXX"),
- ! combuf[130];
- Window *save_wind = curwind;
- ! int status;
- File *fp;
-
- - CATCH
- fp = open_file(tname, iobuff, F_WRITE, COMPLAIN, QUIET);
- putreg(fp, m->m_line, m->m_char, curline, curchar, YES);
- DelReg();
- sprintf(combuf, "%s < %s", cmd, tname);
- --- 617,630 ----
- {
- Mark *m = CurMark();
- char *tname = mktemp("/tmp/jfilterXXXXXX"),
- ! combuf[128];
- Window *save_wind = curwind;
- ! int status,
- ! error = NO;
- File *fp;
-
- fp = open_file(tname, iobuff, F_WRITE, COMPLAIN, QUIET);
- + CATCH
- putreg(fp, m->m_line, m->m_char, curline, curchar, YES);
- DelReg();
- sprintf(combuf, "%s < %s", cmd, tname);
- ***************
- *** 634,646 ****
- status = UnixToBuf(outbuf->b_name, NO, 0, outbuf->b_type == B_SCRATCH,
- Shell, ShFlags, combuf, (char *) 0);
- ONERROR
- ! ; /* Do nothing ... but fall through and delete the tmp
- ! file. */
- ENDCATCH
- f_close(fp);
- (void) unlink(tname);
- SetWind(save_wind);
- ! com_finish(status, combuf);
- }
-
- isprocbuf(bufname)
- --- 631,643 ----
- status = UnixToBuf(outbuf->b_name, NO, 0, outbuf->b_type == B_SCRATCH,
- Shell, ShFlags, combuf, (char *) 0);
- ONERROR
- ! error = YES;
- ENDCATCH
- f_close(fp);
- (void) unlink(tname);
- SetWind(save_wind);
- ! if (error == NO)
- ! com_finish(status, combuf);
- }
-
- isprocbuf(bufname)
- Only in ojove: rcs.output
- diff -c ojove/re.c jove/re.c
- *** ojove/re.c Thu Jul 16 09:14:53 1987
- --- jove/re.c Wed Jun 24 12:43:25 1987
- ***************
- *** 26,50 ****
- WrapScan = 0,
- UseRE = 0;
-
- - private char CaseEquiv[] = {
- - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
- - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
- - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
- - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
- - '\040', '!', '"', '#', '$', '%', '&', '\'',
- - '(', ')', '*', '+', ',', '-', '.', '/',
- - '0', '1', '2', '3', '4', '5', '6', '7',
- - '8', '9', ':', ';', '<', '=', '>', '?',
- - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
- - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
- - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
- - 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
- - '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
- - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
- - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
- - 'X', 'Y', 'Z', '{', '|', '}', '~', '\177'
- - };
- -
- #define cind_cmp(a, b) (CaseEquiv[a] == CaseEquiv[b])
-
- private int REpeekc;
- --- 26,31 ----
- ***************
- *** 738,747 ****
-
- if (!delp) while (c = *repp++) {
- if (c == '\\') {
- ! if ((c = *repp++) == '\0') {
- *tp++ = '\\';
- goto endchk;
- ! } else if ((c = *repp++) >= '1' && c <= nparens + '1') {
- tp = insert(tp, endp, c - '1');
- continue;
- }
- --- 719,729 ----
-
- if (!delp) while (c = *repp++) {
- if (c == '\\') {
- ! c = *repp++;
- ! if (c == '\0') {
- *tp++ = '\\';
- goto endchk;
- ! } else if (c >= '1' && c <= nparens + '1') {
- tp = insert(tp, endp, c - '1');
- continue;
- }
- ***************
- *** 786,792 ****
- repbuf[sizeof rep_str],
- *altbuf[NALTS];
- int npars;
- ! Mark *m = MakeMark(curline, REbom, FLOATER);
-
- message("Type C-X C-C to continue with query replace.");
-
- --- 768,774 ----
- repbuf[sizeof rep_str],
- *altbuf[NALTS];
- int npars;
- ! Mark *m = MakeMark(curline, REbom, M_FLOATER);
-
- message("Type C-X C-C to continue with query replace.");
-
- ***************
- *** 801,807 ****
- byte_copy(sbuf, searchstr, sizeof searchstr);
- byte_copy(repbuf, rep_str, sizeof rep_str);
- byte_copy((char *) altbuf, (char *) alternates, sizeof alternates);
- ! if (!exp_p)
- ToMark(m);
- DelMark(m);
- }
- --- 783,789 ----
- byte_copy(sbuf, searchstr, sizeof searchstr);
- byte_copy(repbuf, rep_str, sizeof rep_str);
- byte_copy((char *) altbuf, (char *) alternates, sizeof alternates);
- ! if (!is_an_arg())
- ToMark(m);
- DelMark(m);
- }
- diff -c ojove/re1.c jove/re1.c
- *** ojove/re1.c Thu Jul 16 09:14:58 1987
- --- jove/re1.c Fri Jul 10 09:25:51 1987
- ***************
- *** 8,15 ****
- #include "jove.h"
- #include "io.h"
- #include "re.h"
-
- ! static
- substitute(query, l1, char1, l2, char2)
- Line *l1,
- *l2;
- --- 8,17 ----
- #include "jove.h"
- #include "io.h"
- #include "re.h"
- + #include <sys/types.h>
- + #include <sys/stat.h>
-
- ! private
- substitute(query, l1, char1, l2, char2)
- Line *l1,
- *l2;
- ***************
- *** 35,41 ****
- if (query) {
- message("Replace (Type '?' for help)? ");
- reswitch: redisplay();
- ! switch (Upper(getchar())) {
- case '.':
- stop++;
- /* Fall into ... */
- --- 37,43 ----
- if (query) {
- message("Replace (Type '?' for help)? ");
- reswitch: redisplay();
- ! switch (CharUpcase(getchar())) {
- case '.':
- stop++;
- /* Fall into ... */
- ***************
- *** 51,57 ****
- goto nxtline;
- continue;
-
- ! case CTL(W):
- re_dosub(linebuf, YES);
- numdone++;
- offset = curchar = REbom;
- --- 53,59 ----
- goto nxtline;
- continue;
-
- ! case CTL('W'):
- re_dosub(linebuf, YES);
- numdone++;
- offset = curchar = REbom;
- ***************
- *** 58,64 ****
- makedirty(curline);
- /* Fall into ... */
-
- ! case CTL(R):
- case 'R':
- RErecur();
- offset = curchar;
- --- 60,66 ----
- makedirty(curline);
- /* Fall into ... */
-
- ! case CTL('R'):
- case 'R':
- RErecur();
- offset = curchar;
- ***************
- *** 65,71 ****
- lp = curline;
- continue;
-
- ! case CTL(U):
- case 'U':
- if (UNDO_lp == 0)
- continue;
- --- 67,73 ----
- lp = curline;
- continue;
-
- ! case CTL('U'):
- case 'U':
- if (UNDO_lp == 0)
- continue;
- ***************
- *** 85,91 ****
- case 'Q':
- goto done;
-
- ! case CTL(L):
- RedrawDisplay();
- goto reswitch;
-
- --- 87,93 ----
- case 'Q':
- goto done;
-
- ! case CTL('L'):
- RedrawDisplay();
- goto reswitch;
-
- ***************
- *** 110,116 ****
- nxtline: break;
- }
- }
- ! SetMark();
- done: s_mess("%d substitution%n.", numdone, numdone);
- }
-
- --- 112,118 ----
- nxtline: break;
- }
- }
- ! set_mark();
- done: s_mess("%d substitution%n.", numdone, numdone);
- }
-
- ***************
- *** 117,126 ****
- /* Prompt for search and replacement strings and do the substitution. The
- point is restored when we're done. */
-
- ! static
- replace(query, inreg)
- {
- ! Mark *save = MakeMark(curline, curchar, FLOATER),
- *m;
- char *rep_ptr;
- Line *l1 = curline,
- --- 119,128 ----
- /* Prompt for search and replacement strings and do the substitution. The
- point is restored when we're done. */
-
- ! private
- replace(query, inreg)
- {
- ! Mark *save = MakeMark(curline, curchar, M_FLOATER),
- *m;
- char *rep_ptr;
- Line *l1 = curline,
- ***************
- *** 166,174 ****
- replace(0, NO);
- }
-
- ! /* C tags package. */
-
- ! static
- lookup(searchbuf, filebuf, tag, file)
- char *searchbuf,
- *filebuf,
- --- 168,180 ----
- replace(0, NO);
- }
-
- ! /* Lookup a tag in tag file FILE. FILE is assumed to be sorted
- ! alphabetically. The FASTTAGS code, which is implemented with
- ! a binary search, depends on this assumption. If it's not true
- ! it is possible to comment out the fast tag code (which is clearly
- ! labeled) and everything else will just work. */
-
- ! private
- lookup(searchbuf, filebuf, tag, file)
- char *searchbuf,
- *filebuf,
- ***************
- *** 176,205 ****
- *file;
- {
- register int taglen = strlen(tag);
- ! char line[128],
- ! pattern[100];
- ! File *fp;
-
- fp = open_file(file, iobuff, F_READ, !COMPLAIN, QUIET);
- if (fp == NIL)
- return 0;
- ! sprintf(pattern, "^%s[^\t]*\t\\([^\t]*\\)\t[?/]\\(.*\\)[?/]$", tag);
- while (f_gets(fp, line, sizeof line) != EOF) {
- ! if (line[0] != *tag || strncmp(tag, line, taglen) != 0)
- continue;
- ! if (!LookingAt(pattern, line, 0)) {
- complain("I thought I saw it!");
- break;
- } else {
- putmatch(2, searchbuf, 100);
- ! putmatch(1, filebuf, 100);
- ! close_file(fp);
- ! return 1;
- }
- }
- ! f_close(fp);
- ! s_mess("Can't find tag \"%s\".", tag);
- ! return 0;
- }
-
- char TagFile[128] = "./tags";
- --- 182,267 ----
- *file;
- {
- register int taglen = strlen(tag);
- ! char line[BUFSIZ],
- ! pattern[128];
- ! register File *fp;
- ! struct stat stbuf;
- ! int fast = YES,
- ! success = NO;
- ! register off_t lower, upper;
-
- + sprintf(pattern, "^%s[^\t]*\t*\\([^\t]*\\)\t*[?/]\\([^?/]*\\)[?/]", tag);
- fp = open_file(file, iobuff, F_READ, !COMPLAIN, QUIET);
- if (fp == NIL)
- return 0;
- !
- ! /* ********BEGIN FAST TAG CODE******** */
- !
- ! if (stat(file, &stbuf) < 0)
- ! fast = NO;
- ! else {
- ! lower = 0;
- ! upper = stbuf.st_size;
- ! if (upper - lower < BUFSIZ)
- ! fast = NO;
- ! }
- ! if (fast == YES) for (;;) {
- ! off_t mid;
- ! int whichway;
- !
- ! if (upper - lower < BUFSIZ) {
- ! f_seek(fp, lower);
- ! break; /* stop this nonsense */
- ! }
- ! mid = (lower + upper) / 2;
- ! f_seek(fp, mid);
- ! f_toNL(fp);
- ! if (f_gets(fp, line, sizeof line) == EOF)
- ! break;
- ! whichway = strncmp(line, tag, taglen);
- ! if (whichway < 0) {
- ! lower = mid;
- ! continue;
- ! } else if (whichway > 0) {
- ! upper = mid;
- ! continue;
- ! } else {
- ! if (strcmp(tag, line) == 0) /* exact match */
- ! goto found;
- ! goto look_harder;
- ! }
- ! }
- ! f_toNL(fp);
- ! /* END FAST TAG CODE */
- !
- while (f_gets(fp, line, sizeof line) != EOF) {
- ! int cmp;
- !
- ! look_harder: if (line[0] > *tag)
- ! break;
- ! else if ((cmp = strncmp(line, tag, taglen)) > 0)
- ! break;
- ! else if (cmp < 0)
- continue;
- ! /* if we get here, we've found the match */
- ! found: if (!LookingAt(pattern, line, 0)) {
- complain("I thought I saw it!");
- break;
- } else {
- + putmatch(1, filebuf, FILESIZE);
- putmatch(2, searchbuf, 100);
- ! success = YES;
- ! if (strcmp(tag, line) == 0) /* exact match */
- ! break;
- ! continue;
- }
- }
- ! close_file(fp);
- !
- ! if (success == NO)
- ! s_mess("Can't find tag \"%s\".", tag);
- !
- ! return success;
- }
-
- char TagFile[128] = "./tags";
- ***************
- *** 223,235 ****
- tagfname = TagFile;
- if (lookup(sstr, filebuf, tag, tagfname) == 0)
- return;
- ! SetMark();
- b = do_find(curwind, filebuf, 0);
- if (curbuf != b)
- SetABuf(curbuf);
- SetBuf(b);
- if ((bp = dosearch(sstr, BACKWARD, 0)) == 0 &&
- ! (WrapScan || ((bp = dosearch(sstr, FORWARD, 0)) == 0)))
- message("Well, I found the file, but the tag is missing.");
- else
- SetDot(bp);
- --- 285,297 ----
- tagfname = TagFile;
- if (lookup(sstr, filebuf, tag, tagfname) == 0)
- return;
- ! set_mark();
- b = do_find(curwind, filebuf, 0);
- if (curbuf != b)
- SetABuf(curbuf);
- SetBuf(b);
- if ((bp = dosearch(sstr, BACKWARD, 0)) == 0 &&
- ! ((bp = dosearch(sstr, FORWARD, 0)) == 0))
- message("Well, I found the file, but the tag is missing.");
- else
- SetDot(bp);
- ***************
- *** 237,243 ****
-
- FindTag()
- {
- ! int localp = !exp_p;
- char tag[128];
-
- strcpy(tag, ask((char *) 0, ProcFmt));
- --- 299,305 ----
-
- FindTag()
- {
- ! int localp = !is_an_arg();
- char tag[128];
-
- strcpy(tag, ask((char *) 0, ProcFmt));
- ***************
- *** 260,266 ****
- c2++;
-
- null_ncpy(tagname, linebuf + c1, c2 - c1);
- ! find_tag(tagname, !exp_p);
- }
-
- /* I-search returns a code saying what to do:
- --- 322,328 ----
- c2++;
-
- null_ncpy(tagname, linebuf + c1, c2 - c1);
- ! find_tag(tagname, !is_an_arg());
- }
-
- /* I-search returns a code saying what to do:
- ***************
- *** 282,288 ****
- *incp = 0;
- int SExitChar = CR;
-
- ! #define cmp_char(a, b) ((a) == (b) || (CaseIgnore && (Upper(a) == Upper(b))))
-
- static Bufpos *
- doisearch(dir, c, failing)
- --- 344,350 ----
- *incp = 0;
- int SExitChar = CR;
-
- ! #define cmp_char(a, b) ((a) == (b) || (CaseIgnore && (CharUpcase(a) == CharUpcase(b))))
-
- static Bufpos *
- doisearch(dir, c, failing)
- ***************
- *** 294,300 ****
- Bufpos *bp;
- extern int okay_wrap;
-
- ! if (c == CTL(S) || c == CTL(R))
- goto dosrch;
-
- if (failing)
- --- 356,362 ----
- Bufpos *bp;
- extern int okay_wrap;
-
- ! if (c == CTL('S') || c == CTL('R'))
- goto dosrch;
-
- if (failing)
- ***************
- *** 338,344 ****
- SetDot(&save_env);
- else {
- if (LineDist(curline, save_env.p_line) >= MarkThresh)
- ! DoSetMark(save_env.p_line, save_env.p_char);
- }
- setsearch(ISbuf);
- }
- --- 400,406 ----
- SetDot(&save_env);
- else {
- if (LineDist(curline, save_env.p_line) >= MarkThresh)
- ! do_set_mark(save_env.p_line, save_env.p_char);
- }
- setsearch(ISbuf);
- }
- ***************
- *** 385,391 ****
- case BS:
- return DELETE;
-
- ! case CTL(G):
- /* If we're failing, we backup until we're no longer
- failing or we've reached the beginning; else, we
- just about the search and go back to the start. */
- --- 447,453 ----
- case BS:
- return DELETE;
-
- ! case CTL('G'):
- /* If we're failing, we backup until we're no longer
- failing or we've reached the beginning; else, we
- just about the search and go back to the start. */
- ***************
- *** 393,402 ****
- return BACKUP;
- return TOSTART;
-
- ! case CTL(\\):
- ! c = CTL(S);
- ! case CTL(S):
- ! case CTL(R):
- /* If this is the first time through and we have a
- search string left over from last time, use that
- one now. */
- --- 455,464 ----
- return BACKUP;
- return TOSTART;
-
- ! case CTL('\\'):
- ! c = CTL('S');
- ! case CTL('S'):
- ! case CTL('R'):
- /* If this is the first time through and we have a
- search string left over from last time, use that
- one now. */
- ***************
- *** 404,410 ****
- strcpy(ISbuf, getsearch());
- incp = &ISbuf[strlen(ISbuf)];
- }
- ! ndir = (c == CTL(S)) ? FORWARD : BACKWARD;
- /* If we're failing and we're not changing our
- direction, don't recur since there's no way
- the search can work. */
- --- 466,472 ----
- strcpy(ISbuf, getsearch());
- incp = &ISbuf[strlen(ISbuf)];
- }
- ! ndir = (c == CTL('S')) ? FORWARD : BACKWARD;
- /* If we're failing and we're not changing our
- direction, don't recur since there's no way
- the search can work. */
- ***************
- *** 423,430 ****
- add_mess("\\");
- /* Fall into ... */
-
- ! case CTL(Q):
- ! case CTL(^):
- add_mess("");
- c = getch() | 0400;
- /* Fall into ... */
- --- 485,492 ----
- add_mess("\\");
- /* Fall into ... */
-
- ! case CTL('Q'):
- ! case CTL('^'):
- add_mess("");
- c = getch() | 0400;
- /* Fall into ... */
-