[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs .cvsignore Makefile TODO configure input...
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs .cvsignore Makefile TODO configure input... |
Date: |
Thu, 10 Jan 2008 12:21:06 +0000 |
CVSROOT: /cvsroot/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 08/01/10 12:21:06
Modified files:
. : .cvsignore Makefile TODO configure input.c
qe-doc.html qe.c qe.h unicode_join.c
Added files:
. : kmap.c
Log message:
changed Makefile and ifdefs to link tiny version as tqe at all times
moved kmap code from input.c to new file kmap.c
updated TODO
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/.cvsignore?cvsroot=qemacs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/qemacs/Makefile?cvsroot=qemacs&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/qemacs/TODO?cvsroot=qemacs&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/qemacs/configure?cvsroot=qemacs&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/qemacs/input.c?cvsroot=qemacs&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe-doc.html?cvsroot=qemacs&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/qemacs/unicode_join.c?cvsroot=qemacs&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/qemacs/kmap.c?cvsroot=qemacs&rev=1.1
Patches:
Index: .cvsignore
===================================================================
RCS file: /cvsroot/qemacs/qemacs/.cvsignore,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- .cvsignore 3 Jan 2008 09:51:29 -0000 1.5
+++ .cvsignore 10 Jan 2008 12:21:05 -0000 1.6
@@ -4,6 +4,8 @@
*.exe
qe
qe_g
+tqe
+tqe_g
fbftoqe
fbffonts.c
html2png
@@ -12,3 +14,5 @@
ligtoqe
jistoqe
allmodules.txt
+basemodules.txt
+STATS
Index: Makefile
===================================================================
RCS file: /cvsroot/qemacs/qemacs/Makefile,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- Makefile 8 Jan 2008 16:37:54 -0000 1.29
+++ Makefile 10 Jan 2008 12:21:05 -0000 1.30
@@ -44,6 +44,7 @@
# do not warn about zero-length formats.
CFLAGS += -Wno-format-zero-length
LDFLAGS := -g
+ TLDFLAGS := -g
endif
#include local compiler configuration file
@@ -52,6 +53,7 @@
ifdef TARGET_GPROF
CFLAGS += -p
LDFLAGS += -p
+ TLDFLAGS += -p
endif
ifdef TARGET_ARCH_X86
@@ -81,17 +83,31 @@
LIBS+=-lm
TARGETLIBS:=
-TARGETS+=qe$(EXE) kmaps ligatures
+TARGETS+= qe$(EXE) tqe$(EXE) kmaps ligatures
ifndef CONFIG_CYGWIN
TARGETS+=qe-doc.html
endif
-OBJS=qe.o charset.o buffer.o \
- input.o unicode_join.o display.o util.o hex.o list.o cutils.o
+OBJS=qe.o charset.o buffer.o input.o display.o util.o hex.o list.o cutils.o
+TOBJS=tqe.o charset.o buffer.o input.o display.o util.o hex.o list.o cutils.o
-ifndef CONFIG_WIN32
+ifdef CONFIG_WIN32
+ OBJS+= win32.o
+ TOBJS+= win32.o
+ LIBS+= -lgdi32
+ TLIBS+= -lgdi32
+else
OBJS+= unix.o tty.o
+ TOBJS+= unix.o tty.o
+endif
+
+ifdef CONFIG_ALL_KMAPS
+ OBJS+= kmap.o
+endif
+
+ifdef CONFIG_UNICODE_JOIN
+ OBJS+= unicode_join.o arabic.o indic.o qfribidi.o
endif
# more charsets if needed
@@ -107,11 +123,6 @@
endif
endif
-ifdef CONFIG_WIN32
- OBJS+= win32.o
- LIBS+= -lgdi32
-endif
-
# currently not used in qemacs
ifdef CONFIG_CFB
OBJS+= libfbf.o fbfrender.o cfb.o fbffonts.o
@@ -119,12 +130,12 @@
ifdef CONFIG_X11
OBJS+= x11.o
-ifdef CONFIG_XRENDER
+ ifdef CONFIG_XRENDER
LIBS+=-lXrender
-endif
-ifdef CONFIG_XV
+ endif
+ ifdef CONFIG_XV
LIBS+=-lXv
-endif
+ endif
LIBS+= -L/usr/X11R6/lib -lXext -lX11
endif
@@ -139,10 +150,6 @@
endif
endif
-ifdef CONFIG_UNICODE_JOIN
- OBJS+= arabic.o indic.o qfribidi.o
-endif
-
ifdef CONFIG_FFMPEG
OBJS+= video.o image.o
DEP_LIBS+=$(FFMPEG_LIBDIR)/libavcodec/libavcodec.a
$(FFMPEG_LIBDIR)/libavformat/libavformat.a
@@ -157,14 +164,24 @@
make -C libqhtml all
ifdef CONFIG_INIT_CALLS
-# must be the last object
-OBJS+= qeend.o
+ # must be the last object
+ OBJS+= qeend.o
+ TOBJS+= qeend.o
else
-SRCS:= $(OBJS:.o=.c)
+ SRCS:= $(OBJS:.o=.c)
+ TSRCS:= $(TOBJS:.o=.c)
+ TSRCS:= $(TSRCS:tqe.c=qe.c)
+
qe.o: allmodules.txt
+tqe.o: basemodules.txt
+
allmodules.txt: $(SRCS) Makefile
echo '/* This file was generated automatically */\n' > $@
grep -h ^qe_module_init $(SRCS) >> $@
+
+basemodules.txt: $(TSRCS) Makefile
+ echo '/* This file was generated automatically */\n' > $@
+ grep -h ^qe_module_init $(TSRCS) >> $@
endif
qe_g$(EXE): $(OBJS) $(DEP_LIBS)
@@ -178,6 +195,20 @@
echo `size address@hidden `wc --bytes address@hidden qe $(OPTIONS) \
| cut -d ' ' -f 7-10,13,15-40 >> STATS
+tqe.o: qe.c qe.h qestyles.h qeconfig.h config.h config.mak Makefile
+ $(CC) $(DEFINES) -DCONFIG_TINY $(CFLAGS) -o $@ -c $<
+
+tqe_g$(EXE): $(TOBJS)
+ $(CC) $(TLDFLAGS) -o $@ $^ $(TLIBS)
+
+tqe$(EXE): tqe_g$(EXE) Makefile
+ rm -f $@
+ cp $< $@
+ $(STRIP) $@
+ @ls -l $@
+ echo `size address@hidden `wc --bytes address@hidden tqe $(OPTIONS) \
+ | cut -d ' ' -f 7-10,13,15-40 >> STATS
+
ffplay$(EXE): qe$(EXE) Makefile
ln -sf $< $@
@@ -194,7 +225,7 @@
make -C libqhtml clean
rm -f *~ *.o *.a *.exe *_g TAGS gmon.out core *.exe.stackdump \
qe qfribidi kmaptoqe ligtoqe html2png fbftoqe fbffonts.c \
- cptoqe jistoqe allmodules.txt
+ cptoqe jistoqe allmodules.txt basemodules.txt
distclean: clean
rm -f config.h config.mak
@@ -356,13 +387,13 @@
#
# html2png tool (XML/HTML/CSS2 renderer test tool)
#
-OBJS=util.o cutils.o \
+OBJS1=util.o cutils.o \
arabic.o indic.o qfribidi.o display.o unicode_join.o \
charset.o charsetmore.o charsetjis.o \
libfbf.o fbfrender.o cfb.o fbffonts.o
-html2png$(EXE): html2png.o $(OBJS) libqhtml/libqhtml.a
- $(CC) $(LDFLAGS) -o $@ html2png.o $(OBJS) \
+html2png$(EXE): html2png.o $(OBJS1) libqhtml/libqhtml.a
+ $(CC) $(LDFLAGS) -o $@ html2png.o $(OBJS1) \
-L./libqhtml -lqhtml $(HTMLTOPPM_LIBS)
# autotest target
Index: TODO
===================================================================
RCS file: /cvsroot/qemacs/qemacs/TODO,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- TODO 24 Dec 2007 09:31:36 -0000 1.12
+++ TODO 10 Jan 2008 12:21:05 -0000 1.13
@@ -86,7 +86,7 @@
DONE - fix control-h mess
- fix bof/eof shell mode
- merge hex-mode and ascii mode
-- write-region -> add filename and offsets to save_buffer stuff
+DONE - write-region -> add filename and offsets to save_buffer stuff
DONE - detect full screen mode in shell buffer and grab all keys until exit
- fix configure for missing support: x11 xv png ...
- add configure --disable-graphics
@@ -99,12 +99,12 @@
- enlarge-window-horizontally
- enlarge-window
- show modified status and mode in bufed
-- *messages* system buffer
+DONE - *messages* system buffer
- doctor command should create and show *trace* buffer, remove eb_new kludge
- invoking key as intrinsic argument
- fix column computation based on display properties:
(variable pitch, tabs, ^x and \uxxxx stuff -- emacs behaviour) ?
-- check X11 connection at probe time
+DONE - check X11 connection at probe time
DONE - allow quoting of special keys : let do_char insert xterm/vt100
key sequence to allow typing special keys into shell process
- fix scroll up/down to move point if already at end
Index: configure
===================================================================
RCS file: /cvsroot/qemacs/qemacs/configure,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- configure 21 Dec 2007 14:24:08 -0000 1.9
+++ configure 10 Jan 2008 12:21:05 -0000 1.10
@@ -275,8 +275,8 @@
fi
if test "$tiny" = "yes" ; then
- x11="no"
ffmpeg="no"
+ x11="no"
xv="no"
xrender="no"
png="no"
Index: input.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/input.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- input.c 8 Jan 2008 16:37:54 -0000 1.18
+++ input.c 10 Jan 2008 12:21:05 -0000 1.19
@@ -84,212 +84,6 @@
*p = m;
}
-#ifdef CONFIG_ALL_KMAPS
-
-/* XXX: use an edit buffer to access the kmap !!!! */
-
-/* parse the internal compressed input method format */
-static int kmap_input(int *match_buf, int match_buf_size,
- int *match_len_ptr, const u8 *data,
- const unsigned int *buf, int len)
-{
- const u8 *p, *p1, *match_extra;
- int c, flag, i, l, l1, match_len, match_char, match_count, match_real_len;
- int match_olen;
- int nb_prefixes, last_outputc, match, prefix_len, trailing_space, olen;
-
- p = data;
- nb_prefixes = p[0] & 0x7f;
- trailing_space = p[0] & 0x80;
- p++;
- prefix_len = 0;
- if (nb_prefixes > 0) {
- p1 = p;
- for (i = 0; i < nb_prefixes; i++) {
- if (buf[0] == p1[0])
- goto prefix_match;
- p1 += 4;
- }
- return INPUTMETHOD_NOMATCH;
- prefix_match:
- p += nb_prefixes * 4 + (p1[1] << 16) + (p1[2] << 8) + p1[3];
- prefix_len = 1;
- }
-
- match_len = 0;
- match_real_len = 0;
- match_char = 0;
- match_count = 0;
- last_outputc = 0;
- match_olen = 0;
- match_extra = NULL;
- for (;;) {
- match = 1;
- olen = 1;
- l1 = prefix_len; /* length of input pattern */
- for (;;) {
- /* c = 0x00 end of table
- * c = 0x01..0x1d delta unicode
- * c = 0x1e unicode output mapping follows
- * c = 0x1f unicode input char follows.
- * c = 0x20..0x7f input character
- * c = 0x80 unused
- * c = 0x81 unused
- * c = 0x82..0x9d extra unicode outputs follow
- * c = 0x9e first unicode output mapping follows
- * c = 0x9f last unicode input char follows and delta==1.
- * c = 0xa0..0xff last input character and delta==1
- */
- c = *p++;
- flag = c & 0x80;
- c &= 0x7f;
- if (c == 0) {
- /* end of table / unused */
- goto the_end;
- } else
- if (c < 0x1e) {
- if (flag) {
- /* extra output glyphs */
- olen = c;
- } else {
- /* delta */
- last_outputc += c;
- }
- break;
- } else
- if (c == 0x1e) {
- /* explicit output */
- last_outputc = (p[0] << 8) | p[1];
- p += 2;
- if (flag)
- continue;
- else
- break;
- } else
- if (c == 0x1f) {
- /* unicode value */
- c = (p[0] << 8) | p[1];
- p += 2;
- }
- if (l1 < len && c != (int)buf[l1])
- match = 0;
- l1++;
- if (flag) {
- /* delta = 1 */
- last_outputc++;
- break;
- }
- }
- if (trailing_space) {
- if (l1 < len && ' ' != buf[l1])
- match = 0;
- l1++;
- }
-
- if (match) {
- l = l1;
- if (l > len)
- l = len;
- if (l == match_len) {
- match_count++;
- } else
- if (l > match_len) {
- match_len = l;
- match_real_len = l1;
- match_char = last_outputc;
- match_count = 1;
- match_olen = olen;
- match_extra = p;
- }
- }
- p += (olen - 1) << 1;
- }
- the_end:
- if (match_len == 0) {
- return INPUTMETHOD_NOMATCH;
- } else
- if (match_count > 1 || match_real_len > len) {
- return INPUTMETHOD_MORECHARS;
- } else {
- *match_len_ptr = match_len;
- if (match_buf_size > 0) {
- match_buf[0] = match_char;
- p = match_extra;
- for (i = 1; i < match_olen && i < match_buf_size; i++, p += 2) {
- match_buf[i] = (p[0] << 8) + p[1];
- }
- }
- return match_olen;
- }
-}
-
-static int input_method_fd;
-static size_t input_method_size;
-static void *input_method_map;
-
-static void load_input_methods(void)
-{
- char buf[MAX_FILENAME_SIZE];
- size_t file_size;
- int fd, offset;
- const unsigned char *file_ptr, *p;
- InputMethod *m;
-
- input_method_fd = -1;
-
- if (find_resource_file(buf, sizeof(buf), "kmaps") < 0)
- return;
-
- fd = open(buf, O_RDONLY);
- if (fd < 0)
- return;
- file_size = lseek(fd, 0, SEEK_END);
- file_ptr = mmap(NULL, file_size, PROT_READ, MAP_SHARED, fd, 0);
- if ((void*)file_ptr == (void*)MAP_FAILED) {
- // XXX: allocate a buffer and read the file in memory
- fail:
- // XXX: print error message
- close(fd);
- return;
- }
-
- if (memcmp(file_ptr, "kmap", 4) != 0) {
- munmap((void*)file_ptr, file_size);
- goto fail;
- }
-
- p = file_ptr + 4;
- for (;;) {
- offset = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
- p += 4;
- if (offset == 0)
- break;
- m = qe_malloc(InputMethod);
- if (m) {
- m->data = file_ptr + offset;
- m->input_match = kmap_input;
- m->name = (const char*)p;
- register_input_method(m);
- }
- p += strlen((const char *)p) + 1;
- }
-
- input_method_fd = fd;
- input_method_map = (void *)file_ptr;
- input_method_size = file_size;
-}
-
-static void unload_input_methods(void)
-{
- if (input_method_fd >= 0) {
- munmap((void*)input_method_map, input_method_size);
- input_method_map = NULL;
- close(input_method_fd);
- input_method_fd = -1;
- }
-}
-#endif
-
static void input_completion(CompleteState *cp)
{
InputMethod *m;
@@ -335,14 +129,4 @@
register_input_method(&default_input_method);
register_input_method(&unicode_input_method);
register_completion("input", input_completion);
-#ifdef CONFIG_ALL_KMAPS
- load_input_methods();
-#endif
-}
-
-void close_input_methods(void)
-{
-#ifdef CONFIG_ALL_KMAPS
- unload_input_methods();
-#endif
}
Index: qe-doc.html
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe-doc.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- qe-doc.html 9 Jan 2008 13:41:41 -0000 1.8
+++ qe-doc.html 10 Jan 2008 12:21:05 -0000 1.9
@@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html401/loose.dtd">
<html>
-<!-- Created on January, 9 2008 by texi2html 1.76 -->
+<!-- Created on January, 10 2008 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <address@hidden> (original author)
Karl Berry <address@hidden>
@@ -1810,7 +1810,7 @@
</tr></table>
<h1>About This Document</h1>
<p>
- This document was generated by <em>Charlie Gordon</em> on <em>January, 9
2008</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html
1.76</em></a>.
+ This document was generated by <em>Charlie Gordon</em> on <em>January, 10
2008</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html
1.76</em></a>.
</p>
<p>
The buttons in the navigation panels have the following meaning:
@@ -1912,7 +1912,7 @@
<hr size="1">
<p>
<font size="-1">
- This document was generated by <em>Charlie Gordon</em> on <em>January, 9
2008</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html
1.76</em></a>.
+ This document was generated by <em>Charlie Gordon</em> on <em>January, 10
2008</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html
1.76</em></a>.
</font>
<br>
Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- qe.c 9 Jan 2008 13:41:41 -0000 1.64
+++ qe.c 10 Jan 2008 12:21:05 -0000 1.65
@@ -20,7 +20,15 @@
*/
#include "qe.h"
+
+#ifdef CONFIG_TINY
+#undef CONFIG_DLL
+#undef CONFIG_ALL_KMAPS
+#undef CONFIG_UNICODE_JOIN
+#endif
+
#include "qfribidi.h"
+
#ifdef CONFIG_DLL
#include <dlfcn.h>
#endif
@@ -2625,6 +2633,28 @@
s->line_index = n;
}
+#ifndef CONFIG_UNICODE_JOIN
+
+/* fallback unicode functions */
+
+int unicode_to_glyphs(unsigned int *dst, unsigned int *char_to_glyph_pos,
+ int dst_size, unsigned int *src, int src_size, int
reverse)
+{
+ int len, i;
+
+ len = src_size;
+ if (len > dst_size)
+ len = dst_size;
+ memcpy(dst, src, len * sizeof(unsigned int));
+ if (char_to_glyph_pos) {
+ for (i = 0; i < len; i++)
+ char_to_glyph_pos[i] = i;
+ }
+ return len;
+}
+
+#endif
+
/* layout of a word fragment */
static void flush_fragment(DisplayState *s)
{
@@ -2685,8 +2715,7 @@
style_index = s->edit_state->default_style;
get_style(s->edit_state, &style, style_index);
/* select font according to current style */
- font = select_font(screen,
- style.font_style, style.font_size);
+ font = select_font(screen, style.font_style, style.font_size);
j = s->line_index;
ascent = font->ascent;
descent = font->descent;
@@ -3000,6 +3029,7 @@
#endif
#ifndef CONFIG_TINY
+
/************************************************************/
/* colorization handling */
/* NOTE: only one colorization mode can be selected at a time for a
@@ -3097,11 +3127,13 @@
}
}
-#else
+#else /* CONFIG_TINY */
+
void set_colorize_func(EditState *s, ColorizeFunc colorize_func)
{
}
-#endif
+
+#endif /* CONFIG_TINY */
#define RLE_EMBEDDINGS_SIZE 128
#define COLORED_MAX_LINE_SIZE 1024
@@ -3124,24 +3156,19 @@
offset1 = offset;
#ifdef CONFIG_UNICODE_JOIN
- if (s->bidir) {
/* compute the embedding levels and rle encode them */
- if (bidir_compute_attributes(embeds, RLE_EMBEDDINGS_SIZE,
- s->b, offset) > 2) {
+ if (s->bidir
+ && bidir_compute_attributes(embeds, RLE_EMBEDDINGS_SIZE,
+ s->b, offset) > 2)
+ {
base = FRIBIDI_TYPE_WL;
fribidi_analyse_string(embeds, &base, &embedding_max_level);
/* assure that base has only two possible values */
if (base != FRIBIDI_TYPE_RTL)
base = FRIBIDI_TYPE_LTR;
- } else {
- goto no_bidir;
- }
} else
#endif
{
-#ifdef CONFIG_UNICODE_JOIN
- no_bidir:
-#endif
/* all line is at embedding level 0 */
embedding_max_level = 0;
embeds[1].level = 0;
@@ -6789,9 +6816,37 @@
/* text mode */
+#if 0
+int detect_binary(const u8 *buf, int size)
+{
+ int i, c;
+
+ for (i = 0; i < size; i++) {
+ c = buf[i];
+ if (c < 32 && (c != '\r' && c != '\n' && c != '\t' && c != '\e'))
+ return 1;
+ }
+ /* Treat very long sequences of identical characters as binary */
+ for (i = 0; i < size; i++) {
+ if (buf[i] != buf[0])
+ break;
+ }
+ if (i == size && size >= 2048 && buf[0] != '\n')
+ return 1;
+
+ return 0;
+}
+#endif
+
static int text_mode_probe(__unused__ ModeProbeData *p)
{
- return 10;
+#if 0
+ /* text mode inappropriate for huge binary files */
+ if (detect_binary(p->buf, p->buf_size) && p->total_size > 1000000)
+ return 0;
+ else
+#endif
+ return 20;
}
int text_mode_init(EditState *s, ModeSavedData *saved_data)
@@ -7467,15 +7522,21 @@
#else
+#ifdef CONFIG_TINY
+#define MODULE_LIST "basemodules.txt"
+#else
+#define MODULE_LIST "allmodules.txt"
+#endif
+
#undef qe_module_init
#define qe_module_init(fn) extern int module_ ## fn(void)
-#include "allmodules.txt"
+#include MODULE_LIST
#undef qe_module_init
static void init_all_modules(void)
{
#define qe_module_init(fn) module_ ## fn()
-#include "allmodules.txt"
+#include MODULE_LIST
#undef qe_module_init
}
#endif
@@ -7557,7 +7618,12 @@
eb_init();
charset_init();
init_input_methods();
+#ifdef CONFIG_ALL_KMAPS
+ load_input_methods();
+#endif
+#ifdef CONFIG_UNICODE_JOIN
load_ligatures();
+#endif
/* init basic modules */
qe_register_mode(&text_mode);
@@ -7688,7 +7754,9 @@
url_main_loop(qe_init, &args);
- close_input_methods();
+#ifdef CONFIG_ALL_KMAPS
+ unload_input_methods();
+#endif
dpy_close(&global_screen);
return 0;
Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- qe.h 9 Jan 2008 13:41:41 -0000 1.60
+++ qe.h 10 Jan 2008 12:21:06 -0000 1.61
@@ -1405,7 +1405,8 @@
void do_set_input_method(EditState *s, const char *method);
void do_switch_input_method(EditState *s);
void init_input_methods(void);
-void close_input_methods(void);
+void load_input_methods(void);
+void unload_input_methods(void);
/* the following will be suppressed */
#define LINE_MAX_SIZE 256
Index: unicode_join.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/unicode_join.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- unicode_join.c 3 Jan 2008 09:51:32 -0000 1.11
+++ unicode_join.c 10 Jan 2008 12:21:06 -0000 1.12
@@ -21,8 +21,6 @@
#include "qfribidi.h"
#include "qe.h"
-#ifdef CONFIG_UNICODE_JOIN
-
/* ligature tables */
static unsigned short *subst1;
static unsigned short *ligature2;
@@ -308,31 +306,3 @@
}
return len;
}
-
-#else /* CONFIG_UNICODE_JOIN */
-
-
-/* fallback unicode functions */
-
-int load_ligatures(void)
-{
- return 0;
-}
-
-int unicode_to_glyphs(unsigned int *dst, unsigned int *char_to_glyph_pos,
- int dst_size, unsigned int *src, int src_size, int
reverse)
-{
- int len, i;
-
- len = src_size;
- if (len > dst_size)
- len = dst_size;
- memcpy(dst, src, len * sizeof(unsigned int));
- if (char_to_glyph_pos) {
- for (i = 0; i < len; i++)
- char_to_glyph_pos[i] = i;
- }
- return len;
-}
-
-#endif /* CONFIG_UNICODE_JOIN */
Index: kmap.c
===================================================================
RCS file: kmap.c
diff -N kmap.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ kmap.c 10 Jan 2008 12:21:05 -0000 1.1
@@ -0,0 +1,228 @@
+/*
+ * Kmap file based input method handling for QEmacs.
+ *
+ * Copyright (c) 2000 Fabrice Bellard.
+ * Copyright (c) 2002-2008 Charlie Gordon.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "qe.h"
+#ifndef WIN32
+#include <sys/mman.h>
+#endif
+
+/* XXX: use an edit buffer to access the kmap !!!! */
+
+/* parse the internal compressed input method format */
+static int kmap_input(int *match_buf, int match_buf_size,
+ int *match_len_ptr, const u8 *data,
+ const unsigned int *buf, int len)
+{
+ const u8 *p, *p1, *match_extra;
+ int c, flag, i, l, l1, match_len, match_char, match_count, match_real_len;
+ int match_olen;
+ int nb_prefixes, last_outputc, match, prefix_len, trailing_space, olen;
+
+ p = data;
+ nb_prefixes = p[0] & 0x7f;
+ trailing_space = p[0] & 0x80;
+ p++;
+ prefix_len = 0;
+ if (nb_prefixes > 0) {
+ p1 = p;
+ for (i = 0; i < nb_prefixes; i++) {
+ if (buf[0] == p1[0])
+ goto prefix_match;
+ p1 += 4;
+ }
+ return INPUTMETHOD_NOMATCH;
+ prefix_match:
+ p += nb_prefixes * 4 + (p1[1] << 16) + (p1[2] << 8) + p1[3];
+ prefix_len = 1;
+ }
+
+ match_len = 0;
+ match_real_len = 0;
+ match_char = 0;
+ match_count = 0;
+ last_outputc = 0;
+ match_olen = 0;
+ match_extra = NULL;
+ for (;;) {
+ match = 1;
+ olen = 1;
+ l1 = prefix_len; /* length of input pattern */
+ for (;;) {
+ /* c = 0x00 end of table
+ * c = 0x01..0x1d delta unicode
+ * c = 0x1e unicode output mapping follows
+ * c = 0x1f unicode input char follows.
+ * c = 0x20..0x7f input character
+ * c = 0x80 unused
+ * c = 0x81 unused
+ * c = 0x82..0x9d extra unicode outputs follow
+ * c = 0x9e first unicode output mapping follows
+ * c = 0x9f last unicode input char follows and delta==1.
+ * c = 0xa0..0xff last input character and delta==1
+ */
+ c = *p++;
+ flag = c & 0x80;
+ c &= 0x7f;
+ if (c == 0) {
+ /* end of table / unused */
+ goto the_end;
+ } else
+ if (c < 0x1e) {
+ if (flag) {
+ /* extra output glyphs */
+ olen = c;
+ } else {
+ /* delta */
+ last_outputc += c;
+ }
+ break;
+ } else
+ if (c == 0x1e) {
+ /* explicit output */
+ last_outputc = (p[0] << 8) | p[1];
+ p += 2;
+ if (flag)
+ continue;
+ else
+ break;
+ } else
+ if (c == 0x1f) {
+ /* unicode value */
+ c = (p[0] << 8) | p[1];
+ p += 2;
+ }
+ if (l1 < len && c != (int)buf[l1])
+ match = 0;
+ l1++;
+ if (flag) {
+ /* delta = 1 */
+ last_outputc++;
+ break;
+ }
+ }
+ if (trailing_space) {
+ if (l1 < len && ' ' != buf[l1])
+ match = 0;
+ l1++;
+ }
+
+ if (match) {
+ l = l1;
+ if (l > len)
+ l = len;
+ if (l == match_len) {
+ match_count++;
+ } else
+ if (l > match_len) {
+ match_len = l;
+ match_real_len = l1;
+ match_char = last_outputc;
+ match_count = 1;
+ match_olen = olen;
+ match_extra = p;
+ }
+ }
+ p += (olen - 1) << 1;
+ }
+ the_end:
+ if (match_len == 0) {
+ return INPUTMETHOD_NOMATCH;
+ } else
+ if (match_count > 1 || match_real_len > len) {
+ return INPUTMETHOD_MORECHARS;
+ } else {
+ *match_len_ptr = match_len;
+ if (match_buf_size > 0) {
+ match_buf[0] = match_char;
+ p = match_extra;
+ for (i = 1; i < match_olen && i < match_buf_size; i++, p += 2) {
+ match_buf[i] = (p[0] << 8) + p[1];
+ }
+ }
+ return match_olen;
+ }
+}
+
+static int input_method_fd;
+static size_t input_method_size;
+static void *input_method_map;
+
+void load_input_methods(void)
+{
+ char buf[MAX_FILENAME_SIZE];
+ size_t file_size;
+ int fd, offset;
+ const unsigned char *file_ptr, *p;
+ InputMethod *m;
+
+ input_method_fd = -1;
+
+ if (find_resource_file(buf, sizeof(buf), "kmaps") < 0)
+ return;
+
+ fd = open(buf, O_RDONLY);
+ if (fd < 0)
+ return;
+ file_size = lseek(fd, 0, SEEK_END);
+ file_ptr = mmap(NULL, file_size, PROT_READ, MAP_SHARED, fd, 0);
+ if ((void*)file_ptr == (void*)MAP_FAILED) {
+ // XXX: allocate a buffer and read the file in memory
+ fail:
+ // XXX: print error message
+ close(fd);
+ return;
+ }
+
+ if (memcmp(file_ptr, "kmap", 4) != 0) {
+ munmap((void*)file_ptr, file_size);
+ goto fail;
+ }
+
+ p = file_ptr + 4;
+ for (;;) {
+ offset = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+ p += 4;
+ if (offset == 0)
+ break;
+ m = qe_malloc(InputMethod);
+ if (m) {
+ m->data = file_ptr + offset;
+ m->input_match = kmap_input;
+ m->name = (const char*)p;
+ register_input_method(m);
+ }
+ p += strlen((const char *)p) + 1;
+ }
+
+ input_method_fd = fd;
+ input_method_map = (void *)file_ptr;
+ input_method_size = file_size;
+}
+
+void unload_input_methods(void)
+{
+ if (input_method_fd >= 0) {
+ munmap((void*)input_method_map, input_method_size);
+ input_method_map = NULL;
+ close(input_method_fd);
+ input_method_fd = -1;
+ }
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs .cvsignore Makefile TODO configure input...,
Charlie Gordon <=