Mercurial > hg > xemacs-beta
annotate lib-src/vcdiff @ 5776:65d65b52d608
Pass character count from coding systems to buffer insertion code.
src/ChangeLog addition:
2014-01-16 Aidan Kehoe <kehoea@parhasard.net>
Pass character count information from the no-conversion and
unicode coding systems to the buffer insertion code, making
#'find-file on large buffers a little snappier (if
ERROR_CHECK_TEXT is not defined).
* file-coding.c:
* file-coding.c (coding_character_tell): New.
* file-coding.c (conversion_coding_stream_description): New.
* file-coding.c (no_conversion_convert):
Update characters_seen when decoding.
* file-coding.c (no_conversion_character_tell): New.
* file-coding.c (lstream_type_create_file_coding): Create the
no_conversion type with data.
* file-coding.c (coding_system_type_create):
Make the character_tell method available here.
* file-coding.h:
* file-coding.h (struct coding_system_methods):
Add a new character_tell() method, passing charcount information
from the coding systems to the buffer code, avoiding duplicate
bytecount-to-charcount work especially with large buffers.
* fileio.c (Finsert_file_contents_internal):
Update this to pass charcount information to
buffer_insert_string_1(), if that is available from the lstream code.
* insdel.c:
* insdel.c (buffer_insert_string_1):
Add a new CCLEN argument, giving the character count of the string
to insert. It can be -1 to indicate that te function should work
it out itself using bytecount_to_charcount(), as it used to.
* insdel.c (buffer_insert_raw_string_1):
* insdel.c (buffer_insert_lisp_string_1):
* insdel.c (buffer_insert_ascstring_1):
* insdel.c (buffer_insert_emacs_char_1):
* insdel.c (buffer_insert_from_buffer_1):
* insdel.c (buffer_replace_char):
Update these functions to use the new calling convention.
* insdel.h:
* insdel.h (buffer_insert_string):
Update this header to reflect the new buffer_insert_string_1()
argument.
* lstream.c (Lstream_character_tell): New.
Return the number of characters *read* and seen by the consumer so
far, taking into account the unget buffer, and buffered reading.
* lstream.c (Lstream_unread):
Update unget_character_count here as appropriate.
* lstream.c (Lstream_rewind):
Reset unget_character_count here too.
* lstream.h:
* lstream.h (struct lstream):
Provide the character_tell method, add a new field,
unget_character_count, giving the number of characters ever passed
to Lstream_unread().
Declare Lstream_character_tell().
Make Lstream_ungetc(), which happens to be unused, an inline
function rather than a macro, in the course of updating it to
modify unget_character_count.
* print.c (output_string):
Use the new argument to buffer_insert_string_1().
* tests.c:
* tests.c (Ftest_character_tell):
New test function.
* tests.c (syms_of_tests):
Make it available.
* unicode.c:
* unicode.c (struct unicode_coding_stream):
* unicode.c (unicode_character_tell):
New method.
* unicode.c (unicode_convert):
Update the character counter as appropriate.
* unicode.c (coding_system_type_create_unicode):
Make the character_tell method available.
| author | Aidan Kehoe <kehoea@parhasard.net> |
|---|---|
| date | Thu, 16 Jan 2014 16:27:52 +0000 |
| parents | 06dd936cde16 |
| children |
| rev | line source |
|---|---|
| 5491 | 1 #! /bin/sh |
| 2 | |
| 0 | 3 # Enhanced sccs diff utility for use with vc mode. |
| 4 # This version is more compatible with rcsdiff(1). | |
| 5491 | 5 |
| 6 # Copyright (C) 1992, 1993, 1995, 1997, 2001, 2002, 2003, 2004, 2005, | |
| 7 # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | |
| 8 | |
| 9 # Author: Paul Eggert | |
| 10 # (according to authors.el) | |
| 11 | |
| 12 # This file is part of XEmacs. | |
| 13 | |
| 14 # XEmacs is free software: you can redistribute it and/or modify | |
| 15 # it under the terms of the GNU General Public License as published by | |
| 16 # the Free Software Foundation, either version 3 of the License, or | |
| 17 # (at your option) any later version. | |
| 18 | |
| 19 # XEmacs is distributed in the hope that it will be useful, | |
| 20 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 22 # GNU General Public License for more details. | |
| 23 | |
| 24 # You should have received a copy of the GNU General Public License | |
| 25 # along with XEmacs. If not, see <http://www.gnu.org/licenses/>. | |
| 26 | |
| 0 | 27 # Modified by: vladimir@Eng.Sun.COM on 95-06-07 |
| 28 # * Made sure that file arguments are specifed as s.<filename>. | |
| 5491 | 29 |
| 30 # Synced up with: GNU 23.1.92. | |
| 31 # Synced by: Ben Wing, 2-17-10. | |
| 32 | |
| 0 | 33 |
| 34 DIFF="diff" | |
| 35 usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..." | |
| 36 | |
| 5491 | 37 # Now that we use `sccs get' rather than just `get', we don't need this. |
| 38 # PATH=$PATH:/usr/ccs/bin:/usr/sccs:/usr/xpg4/bin # common SCCS hangouts | |
| 0 | 39 |
| 5491 | 40 echo="echo" |
| 0 | 41 sid1= sid2= |
| 42 | |
| 43 for f | |
| 44 do | |
| 45 case $f in | |
| 46 -*) | |
| 47 case $f in | |
| 48 --brief) | |
| 49 DIFF=cmp;; | |
| 50 -q) | |
| 51 echo=:;; | |
| 52 -r?*) | |
| 53 case $sid1 in | |
| 5491 | 54 '') |
| 55 sid1=$f | |
| 0 | 56 ;; |
| 57 *) | |
| 58 case $sid2 in | |
| 5491 | 59 ?*) echo "$usage" >&2; exit 2 ;; |
| 0 | 60 esac |
| 5491 | 61 sid2=$f |
| 0 | 62 ;; |
| 63 esac | |
| 64 ;; | |
| 65 *) | |
| 66 options="$options $f" | |
| 67 ;; | |
| 68 esac | |
| 69 shift | |
| 70 ;; | |
| 71 *) | |
| 72 break | |
| 73 ;; | |
| 74 esac | |
| 75 done | |
| 76 | |
| 77 case $# in | |
| 78 0) | |
| 79 echo "$usage" >&2 | |
| 80 exit 2 | |
| 81 esac | |
| 82 | |
| 83 | |
| 84 rev1= rev2= status=0 | |
| 85 trap 'status=2; exit' 1 2 13 15 | |
| 86 trap 'rm -f $rev1 $rev2 || status=2; exit $status' 0 | |
| 87 | |
| 88 for f | |
| 89 do | |
| 5491 | 90 s=2 |
| 91 | |
| 92 # For files under SCCS control, fixup the file name to be the | |
| 93 # s. filename | |
| 94 if [ -d SCCS ]; then | |
| 95 if [ $f = `echo $f | sed -e 's|SCCS/s.||'` ]; then | |
| 96 f="SCCS/s.$f" | |
| 97 fi | |
| 98 fi | |
| 0 | 99 |
| 100 case $f in | |
| 101 s.* | */s.*) | |
| 102 if | |
| 5491 | 103 rev1=`mktemp /tmp/geta.XXXXXXXX` |
| 104 sccs get -s -p -k $sid1 "$f" > $rev1 && | |
| 0 | 105 case $sid2 in |
| 106 '') | |
| 107 workfile=`expr " /$f" : '.*/s.\(.*\)'` | |
| 108 ;; | |
| 109 *) | |
| 5491 | 110 rev2=`mktemp /tmp/getb.XXXXXXXX` |
| 111 sccs get -s -p -k $sid2 "$f" > $rev2 | |
| 0 | 112 workfile=$rev2 |
| 113 esac | |
| 114 then | |
| 5491 | 115 $echo $DIFF $options $rev1 $workfile >&2 |
| 0 | 116 $DIFF $options $rev1 $workfile |
| 117 s=$? | |
| 118 fi | |
| 119 ;; | |
| 120 *) | |
| 121 echo "$0: $f is not an SCCS file" >&2 | |
| 122 esac | |
| 123 | |
| 124 if test $status -lt $s | |
| 125 then status=$s | |
| 126 fi | |
| 127 done | |
| 5491 | 128 |
| 129 # arch-tag: 4344ba3a-bcbe-4f77-971c-f43c1606953a |
