home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1135
< prev
next >
Wrap
Internet Message Format
|
1990-12-28
|
36KB
From: howard@hasse.ericsson.se (Howard Gayle)
Newsgroups: alt.sources
Subject: GNU Emacs 8-bit mods part 08 of 12
Message-ID: <1990Apr5.134005.9052@ericsson.se>
Date: 5 Apr 90 13:40:05 GMT
*** ../18.55/src/search.c Thu Aug 3 08:05:06 1989
--- src/search.c Thu Apr 5 09:16:19 1990
***************
*** 1,5 ****
/* String search routines for GNU Emacs.
! Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,5 ----
/* String search routines for GNU Emacs.
! Copyright (C) 1985, 1986, 1987, 1990 Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 19,60 ****
and this notice must be preserved on all copies. */
#include "config.h"
#include "lisp.h"
#include "syntax.h"
#include "buffer.h"
#include "commands.h"
#include "regex.h"
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
- unsigned char downcase_table[01000] = {0}; /* folds upper to lower case */
- /* A WHEEL WILL FALL OFF IF, IN A trt, CHARACTER A */
- /* TRANSLATES INTO CHARACTER B AND CHARACTER B DOES NOT */
- /* ALSO TRANSLATE INTO CHARACTER B. */
- /* If that constraint is met, compute_trt_inverse will follow a */
- /* translation table with its inverse. The inverse of a table */
- /* follows the table at table[0400]. The form of this is that if */
- /* table[a]=b then the chain starting at table[0400+b], linked by */
- /* link(x)=table[0400+x] and ended by b must include a. */
-
- /* At present compute_trt_inverse is blinded and the inverse for this */
- /* particular table is created by a single-purpose loop. */
- /* compute_trt_inverse has been tested on the following cases: */
- /* trt[x]=x, trt[x]=(+ 3 (logand x, 0370)), trt[x]='a', and the */
- /* downcase table. */
-
/* We compile regexps into this buffer and then use it for searching. */
struct re_pattern_buffer searchbuf;
! char search_fastmap[0400];
/* Last regexp we compiled */
-
Lisp_Object last_regexp;
/* Every call to re_match, etc., must pass &search_regs as the regs argument
unless you can show it is unnecessary (i.e., if re_match is certainly going
to be called again before region-around-match can be called). */
--- 19,51 ----
and this notice must be preserved on all copies. */
+ /* Modified 1990 for 8-bit character support by Howard Gayle.
+ * See chartab.c for details. */
+
+
#include "config.h"
#include "lisp.h"
#include "syntax.h"
#include "buffer.h"
+ #include "casetab.h"
+ #include "chartab.h"
#include "commands.h"
#include "regex.h"
+ #include "sorttab.h"
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
/* We compile regexps into this buffer and then use it for searching. */
struct re_pattern_buffer searchbuf;
! char_t search_fastmap[0400];
/* Last regexp we compiled */
Lisp_Object last_regexp;
+
/* Every call to re_match, etc., must pass &search_regs as the regs argument
unless you can show it is unnecessary (i.e., if re_match is certainly going
to be called again before region-around-match can be called). */
***************
*** 67,88 ****
/* Compile a regexp and signal a Lisp error if anything goes wrong. */
! compile_pattern (pattern, bufp, translate)
Lisp_Object pattern;
struct re_pattern_buffer *bufp;
! char *translate;
{
char *val;
Lisp_Object dummy;
if (EQ (pattern, last_regexp)
! && translate == bufp->translate)
return;
last_regexp = Qnil;
! bufp->translate = translate;
! val = re_compile_pattern (XSTRING (pattern)->data,
! XSTRING (pattern)->size,
! bufp);
if (val)
{
dummy = build_string (val);
--- 58,81 ----
/* Compile a regexp and signal a Lisp error if anything goes wrong. */
! compile_pattern (pattern, bufp, sorttab)
Lisp_Object pattern;
struct re_pattern_buffer *bufp;
! struct Lisp_Sorttab *sorttab;
{
char *val;
Lisp_Object dummy;
+ /* Sort table used for last regexp compilation: */
+ static struct Lisp_Sorttab *last_sort_table;
+
if (EQ (pattern, last_regexp)
! && (sorttab == last_sort_table))
return;
last_regexp = Qnil;
! val = re_compile_pattern_sort (XSTRING (pattern)->data,
! XSTRING (pattern)->size,
! bufp, sorttab);
if (val)
{
dummy = build_string (val);
***************
*** 90,95 ****
--- 83,89 ----
Fsignal (Qinvalid_regexp, Fcons (dummy, Qnil));
}
last_regexp = pattern;
+ last_sort_table = sorttab;
return;
}
***************
*** 115,122 ****
register int i;
CHECK_STRING (string, 0);
! compile_pattern (string, &searchbuf,
! !NULL (bf_cur->case_fold_search) ? (char *) downcase_table : 0);
immediate_quit = 1;
QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */
--- 109,115 ----
register int i;
CHECK_STRING (string, 0);
! compile_pattern (string, &searchbuf, current_sort_table ());
immediate_quit = 1;
QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */
***************
*** 183,190 ****
args_out_of_range (string, start);
}
! compile_pattern (regexp, &searchbuf,
! !NULL (bf_cur->case_fold_search) ? (char *) downcase_table : 0);
immediate_quit = 1;
val = re_search (&searchbuf, XSTRING (string)->data, XSTRING (string)->size,
s, XSTRING (string)->size - s, &search_regs);
--- 176,182 ----
args_out_of_range (string, start);
}
! compile_pattern (regexp, &searchbuf, current_sort_table ());
immediate_quit = 1;
val = re_search (&searchbuf, XSTRING (string)->data, XSTRING (string)->size,
s, XSTRING (string)->size - s, &search_regs);
***************
*** 273,279 ****
find_next_newline (from, cnt)
register int from, cnt;
{
! return (scan_buffer ('\n', from, cnt, (int *) 0));
}
DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0,
--- 265,271 ----
find_next_newline (from, cnt)
register int from, cnt;
{
! return (scan_buffer (NEWLINE, from, cnt, (int *) 0));
}
DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0,
***************
*** 403,410 ****
lim = FirstCharacter;
}
! np = search_buffer (string, point, lim, n, RE,
! !NULL (bf_cur->case_fold_search) ? downcase_table : 0);
if (np <= 0)
{
if (NULL (noerror))
--- 395,401 ----
lim = FirstCharacter;
}
! np = search_buffer (string, point, lim, n, RE);
if (np <= 0)
{
if (NULL (noerror))
***************
*** 441,454 ****
/* INTERFACE CHANGE ALERT!!!! search_buffer now returns -x if only */
/* n-x occurences are found. */
! search_buffer (string, pos, lim, n, RE, trt)
Lisp_Object string;
int pos;
int lim;
int n;
int RE;
- register unsigned char *trt;
{
int len = XSTRING (string)->size;
unsigned char *base_pat = XSTRING (string)->data;
register int *BM_tab;
--- 432,446 ----
/* INTERFACE CHANGE ALERT!!!! search_buffer now returns -x if only */
/* n-x occurences are found. */
! search_buffer (string, pos, lim, n, RE)
Lisp_Object string;
int pos;
int lim;
int n;
int RE;
{
+ struct Lisp_Sorttab *sorttab;
+ register char_t *trt; /* Equivalence class table. */
int len = XSTRING (string)->size;
unsigned char *base_pat = XSTRING (string)->data;
register int *BM_tab;
***************
*** 465,472 ****
if (!len)
return (0);
if (RE)
! compile_pattern (string, &searchbuf, (char *) trt);
if (RE /* Here we detect whether the */
/* generality of an RE search is */
--- 457,466 ----
if (!len)
return (0);
+ sorttab = current_sort_table ();
+ trt = current_equiv_class_table ();
if (RE)
! compile_pattern (string, &searchbuf, sorttab);
if (RE /* Here we detect whether the */
/* generality of an RE search is */
***************
*** 476,482 ****
{
RE = 0; /* can do straight (non RE) search */
pat = (base_pat = (unsigned char *) searchbuf.buffer + 2);
! /* trt already applied */
len = searchbuf.used - 2;
}
else if (!RE)
--- 470,476 ----
{
RE = 0; /* can do straight (non RE) search */
pat = (base_pat = (unsigned char *) searchbuf.buffer + 2);
! /* sorttab already applied */
len = searchbuf.used - 2;
}
else if (!RE)
***************
*** 483,490 ****
{
pat = (unsigned char *) alloca (len);
! for (i = len; i--;) /* Copy the pattern; apply trt */
! *pat++ = (((int) trt) ? trt [*base_pat++] : *base_pat++);
pat -= len; base_pat = pat;
}
--- 477,484 ----
{
pat = (unsigned char *) alloca (len);
! for (i = len; i--;) /* Copy the pattern; apply sorttab */
! *pat++ = (trt ? trt[*base_pat++] : *base_pat++);
pat -= len; base_pat = pat;
}
***************
*** 596,602 ****
/* is determined only by the last character of the putative match. */
/* If that character does not match, we will stride the proper */
/* distance to propose a match that superimposes it on the last */
! /* instance of a character that matches it (per trt), or misses */
/* it entirely if there is none. */
dirlen = len * direction;
--- 590,596 ----
/* is determined only by the last character of the putative match. */
/* If that character does not match, we will stride the proper */
/* distance to propose a match that superimposes it on the last */
! /* instance of a character that matches it (per sorttab), or misses */
/* it entirely if there is none. */
dirlen = len * direction;
***************
*** 620,642 ****
{
j = pat[i]; i += direction;
if (i == dirlen) i = infinity;
! if ((int) trt)
{
- k = (j = trt[j]);
if (i == infinity)
stride_for_teases = BM_tab[j];
BM_tab[j] = dirlen - i;
- /* A translation table is followed by its inverse -- see */
- /* comment following downcase_table for details */
-
- while ((j = trt[0400+j]) != k)
- BM_tab[j] = dirlen - i;
}
else
{
if (i == infinity)
! stride_for_teases = BM_tab[j];
! BM_tab[j] = dirlen - i;
}
/* stride_for_teases tells how much to stride if we get a */
/* match on the far character but are subsequently */
--- 614,635 ----
{
j = pat[i]; i += direction;
if (i == dirlen) i = infinity;
! if (sorttab == NULL_SORT_TABLE)
{
if (i == infinity)
stride_for_teases = BM_tab[j];
BM_tab[j] = dirlen - i;
}
else
{
+ /* We now want to set BM_tab[x] = dirlen - 1 for
+ all characters x in equivalence class j. */
+ k = sorttab->srt_dope[j].ec_lo;
if (i == infinity)
! stride_for_teases = BM_tab[sorttab->srt_chars[k]];
! do
! BM_tab[sorttab->srt_chars[k++]] = dirlen - i;
! while (k <= sorttab->srt_dope[j].ec_hi);
}
/* stride_for_teases tells how much to stride if we get a */
/* match on the far character but are subsequently */
***************
*** 706,712 ****
break; /* a small overrun is genuine */
cursor -= infinity; /* large overrun = hit */
i = dirlen - direction;
! if ((int) trt)
{
while ((i -= direction) + direction != 0)
if (pat[i] != trt[*(cursor -= direction)])
--- 699,705 ----
break; /* a small overrun is genuine */
cursor -= infinity; /* large overrun = hit */
i = dirlen - direction;
! if (trt)
{
while ((i -= direction) + direction != 0)
if (pat[i] != trt[*(cursor -= direction)])
***************
*** 768,776 ****
while ((i -= direction) + direction != 0)
{
pos -= direction;
! if (pat[i] != (((int) trt)
! ? trt[CharAt(pos)]
! : CharAt (pos)))
break;
}
/* Above loop has moved POS part or all the way
--- 761,767 ----
while ((i -= direction) + direction != 0)
{
pos -= direction;
! if (pat[i] != (trt ? trt[CharAt(pos)] : CharAt (pos)))
break;
}
/* Above loop has moved POS part or all the way
***************
*** 977,983 ****
/* Decide how to casify by examining the matched text. */
last = search_regs.end[0];
! prevc = '\n';
case_action = all_caps;
/* some_multiletter_word is set nonzero if any original word
--- 968,974 ----
/* Decide how to casify by examining the matched text. */
last = search_regs.end[0];
! prevc = NEWLINE;
case_action = all_caps;
/* some_multiletter_word is set nonzero if any original word
***************
*** 987,1014 ****
for (pos = search_regs.start[0]; pos < last; pos++)
{
c = CharAt (pos);
! if (LOWERCASEP (c))
! {
! /* Cannot be all caps if any original char is lower case */
!
! case_action = cap_initial;
! if (SYNTAX (prevc) != Sword)
! {
! /* Cannot even be cap initials
! if some original initial is lower case */
! case_action = nochange;
! break;
! }
! else
! some_multiletter_word = 1;
! }
! else if (!NOCASEP (c))
{
! some_letter = 1;
! if (!some_multiletter_word && SYNTAX (prevc) == Sword)
! some_multiletter_word = 1;
}
-
prevc = c;
}
--- 978,1004 ----
for (pos = search_regs.start[0]; pos < last; pos++)
{
c = CharAt (pos);
! switch (LOCAL_CASE (c))
{
! case lowercase_e:
! /* Cannot be all caps if any original char is lower case */
! case_action = cap_initial;
! if (SYNTAX (prevc) != Sword)
! {
! /* Cannot even be cap initials
! if some original initial is lower case */
! case_action = nochange;
! break;
! }
! else
! some_multiletter_word = 1;
! break;
! case uppercase_e:
! some_letter = 1;
! if (!some_multiletter_word && SYNTAX (prevc) == Sword)
! some_multiletter_word = 1;
! break;
}
prevc = c;
}
***************
*** 1216,1268 ****
}
return ostr;
}
!
! /* This code should be unzapped when there comes to be multiple */
! /* translation tables. It has been certified on various cases. */
! /*
! void
! compute_trt_inverse (trt)
! register unsigned char *trt;
! {
! register int i = 0400;
! register unsigned char c, q;
!
! while (i--)
! trt[0400+i] = i;
! i = 0400;
! while (i--)
! {
! if ((q = trt[i]) != (unsigned char) i)
! {
! c = trt[q + 0400];
! trt[q + 0400] = i;
! trt[0400 + i] = c;
! }
! }
}
- */
syms_of_search ()
{
- register int i;
-
- for (i = 0; i < 0400; i++)
- {
- downcase_table[i] = (i >= 'A' && i <= 'Z') ? i + 040 : i;
- /* We do this instead of using compute_trt_inverse to save space. */
- /* Does it? */
- downcase_table[0400+i]
- = ((i >= 'A' && i <= 'Z')
- ? i + ('a' - 'A')
- : ((i >= 'a' && i <= 'z')
- ? i + ('A' - 'a')
- : i));
- }
- /* Use this instead when there come to be multiple translation tables.
- compute_trt_inverse (downcase_table); */
-
searchbuf.allocated = 100;
! searchbuf.buffer = (char *) malloc (searchbuf.allocated);
searchbuf.fastmap = search_fastmap;
Qsearch_failed = intern ("search-failed");
--- 1206,1228 ----
}
return ostr;
}
!
! DEFUN ("compile-regexp", Fcompile_regexp, Scompile_regexp, 1, 1, 0,
! "Compile regular expression.")
! (re)
! Lisp_Object re;
! {
! CHECK_STRING (re, 0);
! compile_pattern (re, &searchbuf, current_sort_table ());
! re_compile_fastmap (&searchbuf);
! return (Fcons (make_string (searchbuf.buffer, searchbuf.used),
! make_string (search_fastmap, 256)));
}
syms_of_search ()
{
searchbuf.allocated = 100;
! searchbuf.buffer = (char_t *) malloc (searchbuf.allocated);
searchbuf.fastmap = search_fastmap;
Qsearch_failed = intern ("search-failed");
***************
*** 1299,1302 ****
--- 1259,1263 ----
defsubr (&Smatch_data);
defsubr (&Sstore_match_data);
defsubr (&Sregexp_quote);
+ defsubr (&Scompile_regexp);
}
*** ../18.55/src/term.c Wed Mar 29 17:49:32 1989
--- src/term.c Wed Mar 7 09:53:29 1990
***************
*** 1,5 ****
/* terminal control module for terminals described by TERMCAP
! Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,5 ----
/* terminal control module for terminals described by TERMCAP
! Copyright (C) 1985, 1986, 1987, 1990 Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 20,27 ****
--- 20,30 ----
#include <stdio.h>
+ #undef NULL
#include <ctype.h>
#include "config.h"
+ #include "lisp.h"
+ #include "chartab.h"
#include "termhooks.h"
#include "termchar.h"
#include "termopts.h"
***************
*** 60,72 ****
where one page is used for Emacs and another for all else. */
int no_redraw_on_reenter;
- /* DCICcost[n] is cost of inserting N characters.
- DCICcost[-n] is cost of deleting N characters. */
-
- #define DCICcost (&DC_ICcost[MScreenWidth])
- int DC_ICcost[1 + 2 * MScreenWidth];
-
-
/* Hook functions that you can set to snap out the functions in this file.
These are all extern'd in termhooks.h */
--- 63,68 ----
***************
*** 82,90 ****
int (*change_line_highlight_hook) ();
int (*reassert_line_highlight_hook) ();
! int (*insert_chars_hook) ();
! int (*write_chars_hook) ();
! int (*delete_chars_hook) ();
int (*ring_bell_hook) ();
--- 78,86 ----
int (*change_line_highlight_hook) ();
int (*reassert_line_highlight_hook) ();
! int (*insert_glyfs_hook) ();
! int (*write_glyfs_hook) ();
! int (*delete_glyfs_hook) ();
int (*ring_bell_hook) ();
***************
*** 520,527 ****
clear_end_of_line (first_unused_hpos)
int first_unused_hpos;
{
if (TN_standout_width == 0 && curX == 0 && chars_wasted[curY] != 0)
! write_chars (" ", 1);
clear_end_of_line_raw (first_unused_hpos);
}
--- 516,525 ----
clear_end_of_line (first_unused_hpos)
int first_unused_hpos;
{
+ static glyf_t sg = SPACEGLYF;
+
if (TN_standout_width == 0 && curX == 0 && chars_wasted[curY] != 0)
! write_glyfs (&sg, 1);
clear_end_of_line_raw (first_unused_hpos);
}
***************
*** 564,660 ****
}
}
! write_chars (start, len)
! register char *start;
! int len;
{
! register char *p;
! register int n;
! register char *buf;
! register int c;
! char *first_check;
!
! if (write_chars_hook)
! {
! (*write_chars_hook) (start, len);
! return;
! }
! highlight_if_desired ();
! turn_off_insert ();
!
! /* Don't dare write in last column of bottom line, if AutoWrap,
! since that would scroll the whole screen on some terminals. */
!
! if (AutoWrap && curY + 1 == screen_height
! && curX + len - (chars_wasted[curY] & 077) == screen_width)
! len --;
!
! cmplus (len);
!
! first_check = start;
!
! if (RPov > len && !TF_underscore && !TF_hazeltine)
! {
! fwrite (start, 1, len, stdout);
! if (ferror (stdout))
! clearerr (stdout);
! if (termscript)
! fwrite (start, 1, len, termscript);
! }
! else
! while (--len >= 0)
{
! if (RPov + 1 < len && start >= first_check && *start == start[1])
! {
! p = start + 2;
!
! /* Now, len is number of chars left starting at p */
! while (*p++ == *start);
! --p;
! /* n is number of identical chars in this run */
! n = p - start;
! if (n > RPov)
! {
! buf = tparam (TS_repeat, 0, 0, *start, n);
! tputs (buf, n, cmputc);
! free (buf);
! start = p;
! len -= n - 1;
! continue;
! }
! else
! /* If all N identical chars are too few,
! don't even consider the last N-1, the last N-2,... */
! first_check = p;
! }
! c = *start++;
! if (c == '_' && TF_underscore)
! {
! if (termscript)
! fputc (' ', termscript);
! putchar (' ');
! OUTPUT (Left);
! }
! if (TF_hazeltine && c == '~')
! c = '`';
! if (termscript)
! fputc (c, termscript);
! putchar (c);
}
}
! /* If start is zero, insert blanks instead of a string at start */
- insert_chars (start, len)
- register char *start;
- int len;
- {
- register char *buf;
- register int c;
! if (insert_chars_hook)
{
! (*insert_chars_hook) (start, len);
return;
}
highlight_if_desired ();
--- 562,654 ----
}
}
! write_glyfs (start, len)
! register glyf_t *start;
! register int len;
{
! register glyf_t g;
!
! if (write_glyfs_hook)
! {
! (*write_glyfs_hook) (start, len);
! return;
! }
! highlight_if_desired ();
! turn_off_insert ();
!
! /* Don't dare write in last column of bottom line, if AutoWrap,
! since that would scroll the whole screen on some terminals. */
! if (AutoWrap && curY + 1 == screen_height
! && curX + len == screen_width)
! len--;
! cmplus (len);
! while (--len >= 0)
! {
! g = *start++;
! if (g)
{
! fwrite (glyf_str (g), 1, glyf_len (g), stdout);
! if (ferror (stdout)) clearerr (stdout);
! if (termscript) fwrite (glyf_str (g), 1, glyf_len (g), termscript);
}
+ }
}
! insert_glyfs (start, len)
! register glyf_t *start;
! register int len;
! {
! register glyf_t g;
! register int l;
! register unsigned char *cp;
! register char_t c;
!
! highlight_if_desired ();
! turn_on_insert ();
! cmplus (len);
! if (TS_pad_inserted_char == 0 && TS_ins_char == 0)
! {
! while (--len >= 0)
! {
! g = *start++;
! if (g)
! {
! fwrite (glyf_str (g), 1, glyf_len (g), stdout);
! if (ferror (stdout)) clearerr (stdout);
! if (termscript) fwrite (glyf_str (g), 1, glyf_len (g), termscript);
! }
! }
! }
! else
! {
! while (--len >= 0)
! {
! g = *start++;
! if (g)
! {
! cp = glyf_str (g);
! for (l = glyf_len (g); 0 != l; --l)
! {
! OUTPUT1_IF (TS_ins_char);
! c = *cp++;
! if (termscript) fputc (c, termscript);
! putchar (c);
! OUTPUT1_IF (TS_pad_inserted_char);
! }
! }
! }
! }
! }
! insert_spaces (len)
! int len;
! {
! register char_t *buf;
!
! if (insert_glyfs_hook)
{
! (*insert_glyfs_hook) ((glyf_t *) 0, len);
return;
}
highlight_if_desired ();
***************
*** 661,671 ****
if (TS_ins_multi_chars)
{
! buf = tparam (TS_ins_multi_chars, 0, 0, len);
OUTPUT1 (buf);
free (buf);
- if (start)
- write_chars (start, len);
return;
}
--- 655,663 ----
if (TS_ins_multi_chars)
{
! buf = (char_t *) tparam (TS_ins_multi_chars, 0, 0, len);
OUTPUT1 (buf);
free (buf);
return;
}
***************
*** 672,712 ****
turn_on_insert ();
cmplus (len);
! if (!TF_underscore && !TF_hazeltine && start
! && TS_pad_inserted_char == 0 && TS_ins_char == 0)
{
! fwrite (start, 1, len, stdout);
if (termscript)
! fwrite (start, 1, len, termscript);
}
- else
- while (--len >= 0)
- {
- OUTPUT1_IF (TS_ins_char);
- if (!start)
- c = ' ';
- else
- {
- c = *start++;
- if (TF_hazeltine && c == '~')
- c = '`';
- }
- if (termscript)
- fputc (c, termscript);
- putchar (c);
- OUTPUT1_IF (TS_pad_inserted_char);
- }
}
! delete_chars (n)
! register int n;
{
char *buf;
register int i;
! if (delete_chars_hook)
{
! (*delete_chars_hook) (n);
return;
}
--- 664,688 ----
turn_on_insert ();
cmplus (len);
! while (--len >= 0)
{
! OUTPUT1_IF (TS_ins_char);
if (termscript)
! fputc (' ', termscript);
! putchar (' ');
! OUTPUT1_IF (TS_pad_inserted_char);
}
}
! delete_glyfs (n)
! register int n;
{
char *buf;
register int i;
! if (delete_glyfs_hook)
{
! (*delete_glyfs_hook) (n);
return;
}
***************
*** 854,867 ****
return cost;
}
/* ARGSUSED */
calculate_ins_del_char_costs ()
{
- int ins_startup_cost, del_startup_cost;
- int ins_cost_per_char, del_cost_per_char;
- register int i;
- register int *p;
-
if (TS_ins_multi_chars)
{
ins_cost_per_char = 0;
--- 830,843 ----
return cost;
}
+ static int ins_startup_cost;
+ static int del_startup_cost;
+ static int ins_cost_per_char;
+ static int del_cost_per_char;
+
/* ARGSUSED */
calculate_ins_del_char_costs ()
{
if (TS_ins_multi_chars)
{
ins_cost_per_char = 0;
***************
*** 898,916 ****
del_startup_cost = 9999;
del_cost_per_char = 0;
}
!
! /* Delete costs are at negative offsets */
! p = &DCICcost[0];
! for (i = screen_width; --i >= 0;)
! *--p = (del_startup_cost += del_cost_per_char);
!
! /* Doing nothing is free */
! p = &DCICcost[0];
! *p++ = 0;
!
! /* Insert costs are at positive offsets */
! for (i = screen_width; --i >= 0;)
! *p++ = (ins_startup_cost += ins_cost_per_char);
}
calculate_costs ()
--- 874,886 ----
del_startup_cost = 9999;
del_cost_per_char = 0;
}
! }
! int DCICcost (n)
! register int n;
! {
! if (n > 0) return (ins_startup_cost + n * ins_cost_per_char);
! else if (n == 0) return (0);
! else return (del_startup_cost - n * del_cost_per_char);
}
calculate_costs ()
*** ../18.55/src/termchar.h Mon Sep 29 23:45:22 1986
--- src/termchar.h Thu Apr 5 09:16:33 1990
***************
*** 1,5 ****
/* Flags and parameters describing terminal's characteristics.
! Copyright (C) 1985, 1986 Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,5 ----
/* Flags and parameters describing terminal's characteristics.
! Copyright (C) 1985, 1986, 1990 Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 19,24 ****
--- 19,28 ----
and this notice must be preserved on all copies. */
+ /* Modified 1990 for 8-bit character support by Howard Gayle.
+ * See chartab.c for details. */
+
+
extern int baud_rate; /* Output speed in baud */
extern int screen_width; /* Number of usable columns */
extern int screen_height; /* Number of lines */
***************
*** 42,49 ****
where one page is used for Emacs and another for all else. */
extern int no_redraw_on_reenter;
! /* DCICcost[n] is cost of inserting N characters.
! DCICcost[-n] is cost of deleting N characters. */
!
! #define DCICcost (&DC_ICcost[MScreenWidth])
! extern int DC_ICcost[1 + 2 * MScreenWidth];
--- 46,51 ----
where one page is used for Emacs and another for all else. */
extern int no_redraw_on_reenter;
! /* DCICcost(n) is cost of inserting N characters.
! DCICcost(-n) is cost of deleting N characters. */
! int DCICcost ();
*** ../18.55/src/termhooks.h Mon Sep 29 23:45:32 1986
--- src/termhooks.h Thu Apr 5 09:16:48 1990
***************
*** 1,6 ****
/* Hooks by which low level terminal operations
can be made to call other routines.
! Copyright (C) 1985, 1986 Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,6 ----
/* Hooks by which low level terminal operations
can be made to call other routines.
! Copyright (C) 1985, 1986, 1990 Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 20,25 ****
--- 20,29 ----
and this notice must be preserved on all copies. */
+ /* Modified 1990 for 8-bit character support by Howard Gayle.
+ * See chartab.c for details. */
+
+
extern int (*topos_hook) ();
extern int (*raw_topos_hook) ();
***************
*** 32,40 ****
extern int (*change_line_highlight_hook) ();
extern int (*reassert_line_highlight_hook) ();
! extern int (*insert_chars_hook) ();
! extern int (*write_chars_hook) ();
! extern int (*delete_chars_hook) ();
extern int (*ring_bell_hook) ();
--- 36,44 ----
extern int (*change_line_highlight_hook) ();
extern int (*reassert_line_highlight_hook) ();
! extern int (*insert_glyfs_hook) ();
! extern int (*write_glyfs_hook) ();
! extern int (*delete_glyfs_hook) ();
extern int (*ring_bell_hook) ();
*** ../18.55/src/window.c Fri Jun 10 15:07:24 1988
--- src/window.c Thu Apr 5 09:17:01 1990
***************
*** 1,6 ****
/* Window creation, deletion and examination for GNU Emacs.
Does not include redisplay.
! Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,6 ----
/* Window creation, deletion and examination for GNU Emacs.
Does not include redisplay.
! Copyright (C) 1985, 1986, 1987, 1990 Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 20,28 ****
--- 20,33 ----
and this notice must be preserved on all copies. */
+ /* Modified 1990 for 8-bit character support by Howard Gayle.
+ * See chartab.c for details. */
+
+
#include "config.h"
#include "lisp.h"
#include "buffer.h"
+ #include "chartab.h"
#include "window.h"
#include "commands.h"
#include "indent.h"
***************
*** 107,112 ****
--- 112,121 ----
p->start = Fmake_marker ();
p->pointm = Fmake_marker ();
XFASTINT (p->use_time) = 0;
+ p->window_char_table =
+ (XTYPE (buffer_defaults.buffer_char_table) == Lisp_Chartab)
+ ? buffer_defaults.buffer_char_table
+ : Vctl_arrow_char_table;
return val;
}
***************
*** 204,209 ****
--- 213,243 ----
return decode_window (window)->buffer;
}
+ DEFUN ("window-char-table", Fwindow_char_table, Swindow_char_table, 0, 1, 0,
+ "Return the char table that WINDOW is using.")
+ (window)
+ Lisp_Object window;
+ {
+ return decode_window (window)->window_char_table;
+ }
+
+ DEFUN ("set-window-char-table",
+ Fset_window_char_table, Sset_window_char_table, 1, 2, 0,
+ "Use TABLE as the char table in WINDOW (default selected\n\
+ window). Returns the old char table.")
+ (table, window)
+ register Lisp_Object table, window;
+ {
+ register struct window *w;
+ register Lisp_Object z; /* Return. */
+
+ table = check_char_table (table);
+ w = decode_window (window);
+ z = w->window_char_table;
+ w->window_char_table = table;
+ return (z);
+ }
+
DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0,
"Return the number of lines in WINDOW (including its mode line).")
(window)
***************
*** 835,845 ****
{
register Lisp_Object tem;
register struct window *w = decode_window (window);
buffer = Fget_buffer (buffer);
CHECK_BUFFER (buffer, 1);
! if (NULL (XBUFFER (buffer)->name))
error ("Attempt to display deleted buffer");
tem = w->buffer;
--- 869,881 ----
{
register Lisp_Object tem;
register struct window *w = decode_window (window);
+ register struct buffer *bp;
buffer = Fget_buffer (buffer);
CHECK_BUFFER (buffer, 1);
+ bp = XBUFFER (buffer);
! if (NULL (bp->name))
error ("Attempt to display deleted buffer");
tem = w->buffer;
***************
*** 848,860 ****
w->buffer = buffer;
Fset_marker (w->pointm,
! make_number (XBUFFER (buffer) == bf_cur
! ? point : XBUFFER (buffer)->text.pointloc),
buffer);
! Fset_marker (w->start, make_number (XBUFFER (buffer)->last_window_start),
buffer);
w->start_at_line_beg = Qnil;
XFASTINT (w->last_modified) = 0;
windows_or_buffers_changed++;
if (EQ (window, selected_window))
Fset_buffer (buffer);
--- 884,902 ----
w->buffer = buffer;
Fset_marker (w->pointm,
! make_number (bp == bf_cur
! ? point : bp->text.pointloc),
buffer);
! Fset_marker (w->start, make_number (bp->last_window_start),
buffer);
w->start_at_line_beg = Qnil;
XFASTINT (w->last_modified) = 0;
+ if (XTYPE (bp->buffer_char_table) == Lisp_Chartab)
+ w->window_char_table = bp->buffer_char_table;
+ else if (XTYPE (buffer_defaults.buffer_char_table) == Lisp_Chartab)
+ w->window_char_table = buffer_defaults.buffer_char_table;
+ else
+ w->window_char_table = Vctl_arrow_char_table;
windows_or_buffers_changed++;
if (EQ (window, selected_window))
Fset_buffer (buffer);
***************
*** 1593,1600 ****
Lisp_Object left, top, width, height, hscroll;
Lisp_Object parent, prev;
Lisp_Object start_at_line_beg;
};
! #define SAVED_WINDOW_VECTOR_SIZE 13 /* Arg to Fmake_vector */
#define SAVED_WINDOW_N(swv,n) \
((struct saved_window *) (XVECTOR ((swv)->contents[(n)])))
--- 1635,1643 ----
Lisp_Object left, top, width, height, hscroll;
Lisp_Object parent, prev;
Lisp_Object start_at_line_beg;
+ Lisp_Object saved_char_table;
};
! #define SAVED_WINDOW_VECTOR_SIZE 14 /* Arg to Fmake_vector */
#define SAVED_WINDOW_N(swv,n) \
((struct saved_window *) (XVECTOR ((swv)->contents[(n)])))
***************
*** 1684,1689 ****
--- 1727,1733 ----
w->height = p->height;
w->hscroll = p->hscroll;
XFASTINT (w->last_modified) = 0;
+ w->window_char_table = p->saved_char_table;
/* Reinstall the saved buffer and pointers into it. */
if (NULL (p->buffer))
***************
*** 1846,1851 ****
--- 1890,1897 ----
else
p->parent = XWINDOW (w->parent)->temslot;
+ p->saved_char_table = w->window_char_table;
+
if (NULL (w->prev))
p->prev = Qnil;
else
***************
*** 1950,1955 ****
--- 1996,2003 ----
defsubr (&Swindowp);
defsubr (&Spos_visible_in_window_p);
defsubr (&Swindow_buffer);
+ defsubr (&Swindow_char_table);
+ defsubr (&Sset_window_char_table);
defsubr (&Swindow_height);
defsubr (&Swindow_width);
defsubr (&Swindow_hscroll);
*** ../18.55/src/window.h Thu Feb 19 21:47:01 1987
--- src/window.h Thu Apr 5 09:17:13 1990
***************
*** 1,5 ****
/* Window definitions for GNU Emacs.
! Copyright (C) 1985, 1986 Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,5 ----
/* Window definitions for GNU Emacs.
! Copyright (C) 1985, 1986, 1990 Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 19,24 ****
--- 19,28 ----
and this notice must be preserved on all copies. */
+ /* Modified 1990 for 8-bit character support by Howard Gayle.
+ * See chartab.c for details. */
+
+
/* Windows are allocated as if they were vectors, but then the
Lisp data type is changed to Lisp_Window. They are garbage
collected along with the vectors.
***************
*** 118,123 ****
--- 122,129 ----
Lisp_Object last_modified;
/* Value of point at that time */
Lisp_Object last_point;
+ /* The char table to use for display. */
+ Lisp_Object window_char_table;
/* The rest are currently not used or only half used */
/* Screen coords of point at that time */
Lisp_Object last_point_x;